@lynx-js/react-webpack-plugin
Version:
A webpack plugin for ReactLynx
64 lines (63 loc) • 2.52 kB
TypeScript
import type { LoaderContext } from '@rspack/core';
import type { CompatVisitorConfig, DefineDceVisitorConfig, JsxTransformerConfig, ShakeVisitorConfig, TransformBuiltinAttributeNamesOptions, TransformNodiffOptions } from '@lynx-js/react/transform';
export declare const JSX_IMPORT_SOURCE: {
MAIN_THREAD: string;
BACKGROUND: string;
ELEMENT_TEMPLATE: string;
};
export declare const RUNTIME_PKG = "@lynx-js/react/internal";
export declare const ELEMENT_TEMPLATE_RUNTIME_PKG = "@lynx-js/react/element-template";
/**
* The options of the ReactLynx plugin.
* @public
*/
export interface ReactLoaderOptions {
/**
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.compat}
*/
compat?: CompatVisitorConfig | undefined;
/**
* {@inheritdoc @lynx-js/template-webpack-plugin#LynxTemplatePluginOptions.enableRemoveCSSScope}
*/
enableRemoveCSSScope?: boolean | undefined;
/**
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.jsx}
*/
jsx?: JsxTransformerConfig | undefined;
/**
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableUiSourceMap}
*/
enableUiSourceMap?: boolean | undefined;
/**
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.experimental_transformBuiltinAttributeNames}
*/
experimental_transformBuiltinAttributeNames?: boolean | TransformBuiltinAttributeNamesOptions | undefined;
/**
* Enable the Fast Refresh for ReactLynx.
*/
refresh?: boolean | undefined;
/**
* How main-thread code will be shaken.
*/
shake?: ShakeVisitorConfig | undefined;
/**
* Like `define` in various bundlers, but this one happens at transform time, and a DCE pass will be performed.
*/
defineDCE?: DefineDceVisitorConfig | undefined;
/**
* Generate inline source content in source-map.
*/
inlineSourcesContent?: boolean | undefined;
/**
* The engine version.
*/
engineVersion?: string | undefined;
/**
* Whether to enable Element Template compilation.
*
* @experimental
*/
experimental_useElementTemplate?: boolean | undefined;
}
export declare function getMainThreadTransformOptions(this: LoaderContext<ReactLoaderOptions>, inputSourceMap: string | undefined): TransformNodiffOptions;
export declare function getBackgroundTransformOptions(this: LoaderContext<ReactLoaderOptions>, inputSourceMap: string | undefined): TransformNodiffOptions;