UNPKG

@lynx-js/template-webpack-plugin

Version:

Simplifies creation of Lynx template files to serve your webpack bundles

76 lines (75 loc) 2.08 kB
import type { Compiler } from 'webpack'; type InlineChunkTestFunction = (params: { size: number; name: string; }) => boolean; type InlineChunkTest = RegExp | InlineChunkTestFunction; type InlineChunkConfig = boolean | InlineChunkTest | { enable?: boolean | 'auto'; test: InlineChunkTest; }; /** * The options for LynxEncodePluginOptions * * @public */ export interface LynxEncodePluginOptions { inlineScripts?: InlineChunkConfig | undefined; } /** * LynxEncodePlugin * * @public */ export declare class LynxEncodePlugin { protected options?: LynxEncodePluginOptions | undefined; /** * The stage of the beforeEncode hook. */ static BEFORE_ENCODE_STAGE: number; /** * The stage of the encode hook. */ static ENCODE_STAGE: number; /** * The stage of the beforeEmit hook. */ static BEFORE_EMIT_STAGE: number; constructor(options?: LynxEncodePluginOptions | undefined); /** * `defaultOptions` is the default options that the {@link LynxEncodePlugin} uses. * * @example * `defaultOptions` can be used to change part of the option and keep others as the default value. * * ```js * // webpack.config.js * import { LynxEncodePlugin } from '@lynx-js/template-webpack-plugin' * export default { * plugins: [ * new LynxEncodePlugin({ * ...LynxEncodePlugin.defaultOptions, * enableRemoveCSSScope: true, * }), * ], * } * ``` * * @public */ static defaultOptions: Readonly<Required<LynxEncodePluginOptions>>; /** * The entry point of a webpack plugin. * @param compiler - the webpack compiler */ apply(compiler: Compiler): void; } export declare class LynxEncodePluginImpl { #private; name: string; constructor(compiler: Compiler, options: Required<LynxEncodePluginOptions>); protected options: Required<LynxEncodePluginOptions>; } export declare function isDebug(): boolean; export declare function isRsdoctor(): boolean; export {};