import type { RsbuildEntry, Rspack } from '@rsbuild/core'; import type { LynxTemplatePlugin as LynxTemplatePluginClass, TemplateHooks } from '@lynx-js/template-webpack-plugin'; /** * The options of the {@link LynxDebugMetadataPlugin}. * * @public */ export interface LynxDebugMetadataPluginOptions { /** * The LynxTemplatePlugin class. */ LynxTemplatePlugin: typeof LynxTemplatePluginClass; /** * The rsbuild environment's `entry`. Used to populate * `meta.rspeedy.entryFiles`. When omitted (e.g. when the webpack * plugin is applied outside of an rsbuild pipeline), * `meta.rspeedy.entryFiles` is empty. */ rsbuildEntry?: RsbuildEntry; getDevServerOrigin?: () => string | undefined; } /** * The LynxDebugMetadataPlugin is a webpack plugin that adds debug metadata to the output. * * The emitted asset is always named `debug-metadata.json` — * the name is hard-coded throughout the pipeline (the JS * `sourceMappingURL` rewriter, the tasm `templateDebugUrl`, and the * dev-server middleware all literal-match this name), so allowing a * custom name here would silently break the downstream URLs. * * @public */ export declare class LynxDebugMetadataPlugin { protected options?: LynxDebugMetadataPluginOptions | undefined; constructor(options?: LynxDebugMetadataPluginOptions | undefined); /** * The entry point of a webpack plugin. * @param compiler - the webpack compiler */ apply(compiler: Rspack.Compiler): void; } export declare class LynxDebugMetadataPluginImpl { protected compiler: Rspack.Compiler; protected options: LynxDebugMetadataPluginOptions; name: string; constructor(compiler: Rspack.Compiler, options: LynxDebugMetadataPluginOptions); } /** * Options for {@link rewriteSourceMappingURLs}. * * @public */ export interface RewriteSourceMappingURLsOptions { /** * Override the URL written into each rewritten sourceMappingURL. Defaults * to `${debugMetadataUrl}?field=source-map&path=`. */ getSourceMappingURL?: (info: { mapPath: string; debugMetadataUrl: string; }) => string; } /** * Rewrite the `//# sourceMappingURL=...` directive of every JS asset in the * current template to an absolute URL. No-op when `debugMetadataUrl` * (`args.encodeData.sourceContent.config['debugMetadataUrl']`) is unset. * * @public */ export declare function rewriteSourceMappingURLs(compilation: Rspack.Compilation, args: Parameters[1]>[0], options?: RewriteSourceMappingURLsOptions): void;