/** * Webpack plugin for Domscribe transform * * Coordinates transform lifecycle via webpack hooks (beforeCompile, compilation, * done, shutdown). Uses a separate webpack loader for per-file transforms. * Manages relay auto-start, overlay entry injection, and HtmlWebpackPlugin integration. * * @module @domscribe/transform/plugins/webpack/webpack-plugin */ import type { Compiler } from 'webpack'; import { WebpackPluginOptions } from './types.js'; import { InjectorRegistry } from '../../core/injector.registry.js'; import { TransformStats } from '../../core/stats.js'; /** * Webpack plugin that manages the Domscribe transform pipeline. * Disabled automatically in production builds unless explicitly enabled. */ export declare class DomscribeWebpackPlugin { static name: string; stats: TransformStats | undefined; injectorRegistry: InjectorRegistry | undefined; /** Relay port after detection/auto-start (for HTML injection) */ relayPort: number | undefined; /** Relay host after detection/auto-start (for HTML injection) */ relayHost: string | undefined; private options; private writer; private relayControl; constructor(options?: WebpackPluginOptions); apply(compiler: Compiler): void; /** * Append @domscribe/overlay/auto-init to the existing webpack entry. * Must share the same entry (not a separate named entry) to ensure * the overlay and app share one webpack runtime and module registry — * otherwise singletons like RuntimeManager would be duplicated. * * By the time apply() is called, webpack has normalized the entry config * to an EntryObject (Record). */ private addOverlayEntry; private preCompilationHook; private initializeRelay; /** * Get the script content to inject relay connection info into HTML. * Use with HtmlWebpackPlugin or similar to inject into the page head. * * @example * ```js * // In your webpack config with html-webpack-plugin: * new HtmlWebpackPlugin({ * inject: true, * templateContent: ({ htmlWebpackPlugin }) => ` * * * * ${domscribePlugin.getRelayScriptTag()} * ${htmlWebpackPlugin.tags.headTags} * * * ${htmlWebpackPlugin.tags.bodyTags} * * * `, * }); * ``` */ getRelayScriptTag(): string; /** * Get the script tags to inject overlay into HTML. * Includes relay info, overlay options, and overlay initialization. * * @example * ```js * // In your webpack config with html-webpack-plugin: * new HtmlWebpackPlugin({ * inject: true, * templateContent: ({ htmlWebpackPlugin }) => ` * * * * ${domscribePlugin.getOverlayScriptTags().head} * ${htmlWebpackPlugin.tags.headTags} * * * ${htmlWebpackPlugin.tags.bodyTags} * ${domscribePlugin.getOverlayScriptTags().body} * * * `, * }); * ``` */ getOverlayScriptTags(): { head: string; body: string; }; /** * Auto-inject relay/overlay script tags via HtmlWebpackPlugin hooks. * Dynamically imports html-webpack-plugin — skips silently if not installed. */ private tapHtmlWebpackPlugin; /** * Inject relay/overlay script tags into an HTML string. * Reuses getOverlayScriptTags() which already includes relay globals. */ private injectIntoHtml; private printStats; private shutdownHook; } export default DomscribeWebpackPlugin; //# sourceMappingURL=webpack.plugin.d.ts.map