diff --git a/.changeset/free-facts-tell.md b/.changeset/free-facts-tell.md new file mode 100644 index 0000000000..853d812bb3 --- /dev/null +++ b/.changeset/free-facts-tell.md @@ -0,0 +1,3 @@ +--- + +--- diff --git a/packages/react/transform/index.d.ts b/packages/react/transform/index.d.ts index 0649e3f782..b261df5cae 100644 --- a/packages/react/transform/index.d.ts +++ b/packages/react/transform/index.d.ts @@ -353,8 +353,35 @@ export interface DynamicImportVisitorConfig { /** @internal */ layer: string } +/** + * {@inheritdoc PluginReactLynxOptions.extractStr} + * @public + */ export interface ExtractStrConfig { - /** @public */ + /** + * @public + * The minimum length of string literals to be extracted. + * + * @remarks + * Default value: `20`. + * + * @example + * + * ```js + * import { defineConfig } from '@lynx-js/rspeedy' + * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin' + * + * export default defineConfig({ + * plugins: [ + * pluginReactLynx({ + * extractStr: { + * strLength: 10, + * }, + * }) + * ], + * }) + * ``` + */ strLength: number /** @internal */ extractedStrArr?: Array diff --git a/packages/react/transform/src/swc_plugin_extract_str/mod.rs b/packages/react/transform/src/swc_plugin_extract_str/mod.rs index 79445622f6..8dda6b88ec 100644 --- a/packages/react/transform/src/swc_plugin_extract_str/mod.rs +++ b/packages/react/transform/src/swc_plugin_extract_str/mod.rs @@ -7,11 +7,35 @@ use swc_core::{ ecma::visit::{VisitMut, VisitMutWith}, quote, }; + +/// {@inheritdoc PluginReactLynxOptions.extractStr} +/// @public #[derive(PartialEq, Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] #[napi(object)] pub struct ExtractStrConfig { /// @public + /// The minimum length of string literals to be extracted. + /// + /// @remarks + /// Default value: `20`. + /// + /// @example + /// + /// ```js + /// import { defineConfig } from '@lynx-js/rspeedy' + /// import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin' + /// + /// export default defineConfig({ + /// plugins: [ + /// pluginReactLynx({ + /// extractStr: { + /// strLength: 10, + /// }, + /// }) + /// ], + /// }) + /// ``` pub str_length: u32, /// @internal pub extracted_str_arr: Option>,