@upupming/react-rsbuild-plugin 0.0.0-stage → 0.22.2-genui.20261113.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,961 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * A rsbuild plugin that integrates with ReactLynx.
5
+ */
6
+
7
+ import { LAYERS } from '@lynx-js/react-webpack-plugin';
8
+ import type { LynxTemplatePlugin as LynxTemplatePlugin_2 } from '@lynx-js/template-webpack-plugin';
9
+ import { ReactCompileResult } from '@lynx-js/react-webpack-plugin';
10
+ import type { RsbuildPlugin } from '@rsbuild/core';
11
+ import type { Rspack } from '@rsbuild/core';
12
+ import type { TemplateHooks } from '@lynx-js/template-webpack-plugin';
13
+
14
+ /**
15
+ * {@inheritDoc CompatVisitorConfig.addComponentElement}
16
+ * @public
17
+ */
18
+ export declare interface AddComponentElementConfig {
19
+ /**
20
+ * @public
21
+ * Whether to only add component element during compilation
22
+ *
23
+ * @example
24
+ *
25
+ * Note that this only take effects on `Component` imported from {@link CompatVisitorConfig.oldRuntimePkg}.
26
+ *
27
+ * ```js
28
+ * import { defineConfig } from '@lynx-js/rspeedy'
29
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
30
+ *
31
+ * export default defineConfig({
32
+ * plugins: [
33
+ * pluginReactLynx({
34
+ * compat: {
35
+ * addComponentElement: { compilerOnly: true }
36
+ * },
37
+ * })
38
+ * ],
39
+ * })
40
+ * ```
41
+ */
42
+ compilerOnly: boolean
43
+ }
44
+
45
+ /**
46
+ * {@inheritDoc PluginReactLynxOptions.compat}
47
+ * @public
48
+ */
49
+ export declare interface CompatVisitorConfig {
50
+ /** @internal */
51
+ target: 'LEPUS' | 'JS' | 'MIXED'
52
+ /**
53
+ * @public
54
+ * Specifies the list of component package names that need compatibility processing
55
+ *
56
+ * @defaultValue `['@lynx-js/react-components']`
57
+ *
58
+ * @example
59
+ *
60
+ * ```js
61
+ * import { defineConfig } from '@lynx-js/rspeedy'
62
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
63
+ *
64
+ * export default defineConfig({
65
+ * plugins: [
66
+ * pluginReactLynx({
67
+ * compat: {
68
+ * componentsPkg: ['@my-org/components', '@legacy/ui-kit']
69
+ * },
70
+ * })
71
+ * ],
72
+ * })
73
+ * ```
74
+ */
75
+ componentsPkg: Array<string>
76
+ /**
77
+ * @public
78
+ * Specifies the list of old runtime package names that need compatibility processing
79
+ *
80
+ * @defaultValue `['@lynx-js/react-runtime']`
81
+ *
82
+ * @example
83
+ *
84
+ * ```js
85
+ * import { defineConfig } from '@lynx-js/rspeedy'
86
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
87
+ *
88
+ * export default defineConfig({
89
+ * plugins: [
90
+ * pluginReactLynx({
91
+ * compat: {
92
+ * oldRuntimePkg: ['@my-org/runtime', '@legacy/runtime']
93
+ * },
94
+ * })
95
+ * ],
96
+ * })
97
+ * ```
98
+ */
99
+ oldRuntimePkg: Array<string>
100
+ /**
101
+ * @public
102
+ * Specifies the new runtime package name
103
+ *
104
+ * @defaultValue `'@lynx-js/react'`
105
+ *
106
+ * @example
107
+ *
108
+ * ```js
109
+ * import { defineConfig } from '@lynx-js/rspeedy'
110
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
111
+ *
112
+ * export default defineConfig({
113
+ * plugins: [
114
+ * pluginReactLynx({
115
+ * compat: {
116
+ * newRuntimePkg: '@my-org/react'
117
+ * },
118
+ * })
119
+ * ],
120
+ * })
121
+ * ```
122
+ */
123
+ newRuntimePkg: string
124
+ /**
125
+ * @public
126
+ * Specifies additional component attributes list, these attributes will be passed to the wrapped `<view>` instead of the component.
127
+ *
128
+ * @defaultValue `[]`
129
+ *
130
+ * @remarks
131
+ * This only takes effect when {@link CompatVisitorConfig.addComponentElement} is enabled.
132
+ *
133
+ * @example
134
+ *
135
+ * ```js
136
+ * import { defineConfig } from '@lynx-js/rspeedy'
137
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
138
+ *
139
+ * export default defineConfig({
140
+ * plugins: [
141
+ * pluginReactLynx({
142
+ * compat: {
143
+ * additionalComponentAttributes: ['custom-attr', 'data-special']
144
+ * },
145
+ * })
146
+ * ],
147
+ * })
148
+ * ```
149
+ */
150
+ additionalComponentAttributes: Array<string>
151
+ /**
152
+ * @public
153
+ * Controls whether to add wrapper elements for components
154
+ *
155
+ * @defaultValue `false`
156
+ *
157
+ * @example
158
+ *
159
+ * Add a `<view>` wrapper element for all components during runtime.
160
+ *
161
+ * ```js
162
+ * import { defineConfig } from '@lynx-js/rspeedy'
163
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
164
+ *
165
+ * export default defineConfig({
166
+ * plugins: [
167
+ * pluginReactLynx({
168
+ * compat: {
169
+ * addComponentElement: true
170
+ * },
171
+ * })
172
+ * ],
173
+ * })
174
+ * ```
175
+ *
176
+ * @example
177
+ *
178
+ * Only add component element during compilation.
179
+ * Note that this only take effects on `Component` imported from {@link CompatVisitorConfig.oldRuntimePkg}.
180
+ *
181
+ * ```js
182
+ * import { defineConfig } from '@lynx-js/rspeedy'
183
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
184
+ *
185
+ * export default defineConfig({
186
+ * plugins: [
187
+ * pluginReactLynx({
188
+ * compat: {
189
+ * addComponentElement: { compilerOnly: true }
190
+ * },
191
+ * })
192
+ * ],
193
+ * })
194
+ * ```
195
+ */
196
+ addComponentElement: boolean | AddComponentElementConfig
197
+ /**
198
+ * @public
199
+ * Whether to simplify constructor calls like ReactLynx 2
200
+ *
201
+ * @deprecated
202
+ * Using `simplifyCtorLikeReactLynx2` is not recommended as it introduces implicit behaviors that can:
203
+ *
204
+ * - Make code harder to understand and maintain
205
+ *
206
+ * - Create hidden dependencies between components
207
+ *
208
+ * - Complicate debugging and testing processes
209
+ *
210
+ * Instead, use `background-only` on class methods for explicit and maintainable behavior
211
+ *
212
+ * @defaultValue `false`
213
+ *
214
+ * @example
215
+ *
216
+ * ```js
217
+ * import { defineConfig } from '@lynx-js/rspeedy'
218
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
219
+ *
220
+ * export default defineConfig({
221
+ * plugins: [
222
+ * pluginReactLynx({
223
+ * compat: {
224
+ * simplifyCtorLikeReactLynx2: true
225
+ * },
226
+ * })
227
+ * ],
228
+ * })
229
+ * ```
230
+ */
231
+ simplifyCtorLikeReactLynx2: boolean
232
+ /**
233
+ * @public
234
+ * Whether to transform legacy event attribute names on Lynx elements.
235
+ *
236
+ * When enabled, legacy event attributes such as `onClick` and
237
+ * `onClickCatch` are transformed to `bindtap` and `catchtap`.
238
+ * Disable this when another transform owns event attribute-name conversion.
239
+ *
240
+ * @defaultValue `true`
241
+ */
242
+ transformLegacyEventAttributeNames?: boolean
243
+ /**
244
+ * @public
245
+ * Regular expression used to remove component attributes
246
+ *
247
+ * @deprecated It's recommended to use `background-only`.
248
+ *
249
+ * If your code depends on this switch, when distributing it to other projects through npm packages or other means, you'll also need to enable this switch. This will lead to the proliferation of switches, which is not conducive to code reuse between different projects.
250
+ *
251
+ * @defaultValue `undefined`
252
+ *
253
+ * @example
254
+ *
255
+ * ```js
256
+ * import { defineConfig } from '@lynx-js/rspeedy'
257
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
258
+ *
259
+ * export default defineConfig({
260
+ * plugins: [
261
+ * pluginReactLynx({
262
+ * compat: {
263
+ * removeComponentAttrRegex: '^data-test-'
264
+ * },
265
+ * })
266
+ * ],
267
+ * })
268
+ * ```
269
+ */
270
+ removeComponentAttrRegex?: string
271
+ /**
272
+ * @public
273
+ * Whether to disable deprecated warnings
274
+ *
275
+ * @defaultValue `false`
276
+ *
277
+ * @example
278
+ *
279
+ * Disable all the `DEPRECATED:` warnings.
280
+ *
281
+ * ```js
282
+ * import { defineConfig } from '@lynx-js/rspeedy'
283
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
284
+ *
285
+ * export default defineConfig({
286
+ * plugins: [
287
+ * pluginReactLynx({
288
+ * compat: {
289
+ * disableDeprecatedWarning: true
290
+ * },
291
+ * })
292
+ * ],
293
+ * })
294
+ * ```
295
+ */
296
+ disableDeprecatedWarning: boolean
297
+ /**
298
+ * Dark mode configuration
299
+ *
300
+ * @public
301
+ * @deprecated
302
+ *
303
+ * @defaultValue `undefined`
304
+ *
305
+ * @example
306
+ *
307
+ * ```js
308
+ * import { defineConfig } from '@lynx-js/rspeedy'
309
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
310
+ *
311
+ * export default defineConfig({
312
+ * plugins: [
313
+ * pluginReactLynx({
314
+ * compat: {
315
+ * darkMode: true
316
+ * },
317
+ * })
318
+ * ],
319
+ * })
320
+ * ```
321
+ */
322
+ darkMode?: boolean | DarkModeConfig
323
+
324
+ /**
325
+ * Compile dynamic children as children + wrapper (the pre-SlotV2 slot
326
+ * codegen: `Slot`/`Children` dynamic parts rendered through wrapper
327
+ * elements) instead of the default SlotV2 codegen (`$N` slot props).
328
+ *
329
+ * @remarks
330
+ *
331
+ * Enable this when the compiled output needs to run on legacy
332
+ * `@lynx-js/react` runtimes without `SlotV2` support (`< 0.120.0`),
333
+ * e.g. a standalone lazy bundle consumed by a host App that ships an
334
+ * older runtime. It only changes the compile output; the runtime
335
+ * supports both forms.
336
+ *
337
+ * @example
338
+ *
339
+ * ```js
340
+ * import { defineConfig } from '@lynx-js/rspeedy'
341
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
342
+ *
343
+ * export default defineConfig({
344
+ * plugins: [
345
+ * pluginReactLynx({
346
+ * compat: {
347
+ * legacySlot: true,
348
+ * },
349
+ * })
350
+ * ],
351
+ * })
352
+ * ```
353
+ *
354
+ * @defaultValue `false`
355
+ */
356
+ legacySlot?: boolean
357
+ }
358
+
359
+ declare interface DarkModeConfig {
360
+ /**
361
+ * @public
362
+ * Theme expression to be used for dark mode
363
+ */
364
+ themeExpr: string
365
+ }
366
+
367
+ /**
368
+ * {@inheritDoc PluginReactLynxOptions.defineDCE}
369
+ * @public
370
+ */
371
+ export declare interface DefineDceVisitorConfig {
372
+ /**
373
+ * @public
374
+ * Replaces variables in your code with other values or expressions at compile time.
375
+ *
376
+ * @remarks
377
+ * Caveat: differences between `source.define`
378
+ *
379
+ * `defineDCE` happens before transforming `background-only` directives.
380
+ * So it's useful for eliminating code that is only used in the background from main-thread.
381
+ *
382
+ * @example
383
+ *
384
+ * ```js
385
+ * import { defineConfig } from '@lynx-js/rspeedy'
386
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
387
+ *
388
+ * export default defineConfig({
389
+ * plugins: [
390
+ * pluginReactLynx({
391
+ * defineDCE: {
392
+ * define: {
393
+ * __FOO__: 'false',
394
+ * 'process.env.PLATFORM': '"lynx"',
395
+ * },
396
+ * },
397
+ * })
398
+ * ],
399
+ * })
400
+ * ```
401
+ *
402
+ * Then, `__FOO__` and `process.env.PLATFORM` could be used in source code.
403
+ *
404
+ * ```
405
+ * if (process.env.PLATFORM === 'lynx') {
406
+ * console.log('lynx')
407
+ * }
408
+ *
409
+ * function FooOrBar() {
410
+ * if (__FOO__) {
411
+ * return <text>foo</text>
412
+ * } else {
413
+ * return <text>bar</text>
414
+ * }
415
+ * }
416
+ * ```
417
+ */
418
+ define: Record<string, string>
419
+ }
420
+
421
+ /**
422
+ * {@inheritDoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.extractStr}
423
+ * @public
424
+ */
425
+ export declare interface ExtractStrConfig {
426
+ /**
427
+ * @public
428
+ * The minimum length of string literals to be extracted.
429
+ *
430
+ * @defaultValue `20`
431
+ *
432
+ * @example
433
+ *
434
+ * ```js
435
+ * import { defineConfig } from '@lynx-js/rspeedy'
436
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
437
+ *
438
+ * export default defineConfig({
439
+ * plugins: [
440
+ * pluginReactLynx({
441
+ * extractStr: {
442
+ * strLength: 10,
443
+ * },
444
+ * })
445
+ * ],
446
+ * })
447
+ * ```
448
+ */
449
+ strLength: number
450
+ /** @internal */
451
+ extractedStrArr?: Array<string>
452
+ }
453
+
454
+ export { LAYERS }
455
+
456
+ export declare interface LynxTemplatePlugin {
457
+ getLynxTemplatePluginHooks: typeof LynxTemplatePlugin_2.getLynxTemplatePluginHooks;
458
+ }
459
+
460
+ /**
461
+ * Create a rsbuild plugin for ReactLynx.
462
+ *
463
+ * @example
464
+ * ```ts
465
+ * // rsbuild.config.ts
466
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
467
+ * export default {
468
+ * plugins: [pluginReactLynx()]
469
+ * }
470
+ * ```
471
+ *
472
+ * @public
473
+ */
474
+ export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): RsbuildPlugin[];
475
+
476
+ /**
477
+ * Options of {@link pluginReactLynx}
478
+ *
479
+ * @public
480
+ */
481
+ export declare interface PluginReactLynxOptions {
482
+ /**
483
+ * Generate UI source maps in the main-thread transform.
484
+ *
485
+ * @defaultValue `false`
486
+ */
487
+ enableUiSourceMap?: boolean;
488
+ /**
489
+ * The `compat` option controls compatibilities with legacy ReactLynx.
490
+ *
491
+ * @remarks
492
+ *
493
+ * These options should only be used for migrating from ReactLynx2.0 or
494
+ * targeting legacy ReactLynx3 runtimes.
495
+ *
496
+ * @defaultValue `undefined`
497
+ */
498
+ compat?: Partial<CompatVisitorConfig> & {
499
+ /**
500
+ * Whether disable runtime warnings about using ReactLynx2.0-incompatible `SelectorQuery` APIs.
501
+ *
502
+ * @example
503
+ * Using the following APIs will have a runtime warning by default:
504
+ *
505
+ * ```ts
506
+ * this.createSelectorQuery()
507
+ * this.getElementById()
508
+ * this.getNodeRef()
509
+ * this.getNodeRefFromRoot()
510
+ * ```
511
+ *
512
+ * @defaultValue `false`
513
+ */
514
+ disableCreateSelectorQueryIncompatibleWarning?: boolean;
515
+ } | undefined;
516
+ /**
517
+ * When {@link PluginReactLynxOptions.enableCSSInheritance} is enabled, `customCSSInheritanceList` can control which properties are inheritable, not just the default ones.
518
+ *
519
+ * @example
520
+ *
521
+ * By setting `customCSSInheritanceList: ['direction', 'overflow']`, only the `direction` and `overflow` properties are inheritable.
522
+ *
523
+ * ```js
524
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
525
+ * import { defineConfig } from '@rsbuild/core'
526
+ *
527
+ * export default defineConfig({
528
+ * plugins: [
529
+ * pluginReactLynx({
530
+ * enableCSSInheritance: true,
531
+ * customCSSInheritanceList: ['direction', 'overflow']
532
+ * }),
533
+ * ],
534
+ * })
535
+ * ```
536
+ *
537
+ * @defaultValue `undefined`
538
+ */
539
+ customCSSInheritanceList?: string[] | undefined;
540
+ /**
541
+ * debugInfoOutside controls whether the debug info is placed outside the template.
542
+ *
543
+ * @remarks
544
+ * This is recommended to be set to true to reduce template size.
545
+ *
546
+ * @defaultValue `true`
547
+ *
548
+ * @public
549
+ */
550
+ debugInfoOutside?: boolean;
551
+ /**
552
+ * defaultDisplayLinear controls whether the default value of `display` in CSS is `linear`.
553
+ *
554
+ * If `defaultDisplayLinear === false`, the default `display` would be `flex` instead of `linear`.
555
+ *
556
+ * @defaultValue `true`
557
+ */
558
+ defaultDisplayLinear?: boolean;
559
+ /**
560
+ * enableAccessibilityElement set the default value of `accessibility-element` for all `<view />` elements.
561
+ *
562
+ * @defaultValue `false`
563
+ */
564
+ enableAccessibilityElement?: boolean;
565
+ /**
566
+ * Transform attribute names on Lynx builtin elements.
567
+ *
568
+ * @remarks
569
+ *
570
+ * `false` disables the conversion. `true` applies the default rule:
571
+ * `onClick` becomes `bindtap`, `onCatchTap` becomes `catchtap`, other
572
+ * `onXXX` names become `bindxxx`, and remaining camelCase names become
573
+ * dash-case. An object provides serializable custom rules. Exact entries in
574
+ * `rename` take precedence over `preserve`, followed by the fallback behavior
575
+ * selected by `mode`.
576
+ *
577
+ * Explicit JSX attributes are transformed at compile time. Attributes
578
+ * supplied through JSX spreads are transformed at runtime with the same
579
+ * rules.
580
+ *
581
+ * @defaultValue `false`
582
+ *
583
+ * @experimental
584
+ */
585
+ experimental_transformBuiltinAttributeNames?: boolean | TransformBuiltinAttributeNamesOptions;
586
+ /**
587
+ * enableCSSInheritance enables the default inheritance properties.
588
+ *
589
+ * @remarks
590
+ *
591
+ * The following properties are inherited by default:
592
+ *
593
+ * - `direction`
594
+ *
595
+ * - `color`
596
+ *
597
+ * - `font-family`
598
+ *
599
+ * - `font-size`
600
+ *
601
+ * - `font-style`
602
+ *
603
+ * - `font-weight`
604
+ *
605
+ * - `letter-spacing`
606
+ *
607
+ * - `line-height`
608
+ *
609
+ * - `line-spacing`
610
+ *
611
+ * - `text-align`
612
+ *
613
+ * - `text-decoration`
614
+ *
615
+ * - `text-shadow`
616
+ *
617
+ * It is recommended to use with {@link PluginReactLynxOptions.customCSSInheritanceList} to avoid performance issues.
618
+ *
619
+ * @defaultValue `false`
620
+ */
621
+ enableCSSInheritance?: boolean;
622
+ /**
623
+ * CSS Invalidation refers to the process of determining which elements need to have their styles recalculated when the DOM is updated.
624
+ *
625
+ * @example
626
+ *
627
+ * If a descendant selector `.a .b` is defined in a CSS file, then when an element's class changes to `.a`, all nodes in its subtree with the className `.b` need to have their styles recalculated.
628
+ *
629
+ * @remarks
630
+ *
631
+ * When using combinator to determine the styles of various elements (including descendants, adjacent siblings, etc.), it is recommended to enable this feature. Otherwise, only the initial class setting can match the corresponding combinator, and subsequent updates will not recalculate the related styles.
632
+ *
633
+ * We find that collecting invalidation nodes and updating them is a relatively time-consuming process.
634
+ * If there is no such usage and better style matching performance is needed, this feature can be selectively disabled.
635
+ *
636
+ * @defaultValue `true`
637
+ */
638
+ enableCSSInvalidation?: boolean;
639
+ /**
640
+ * enableCSSSelector controls whether enabling the new CSS implementation.
641
+ *
642
+ * @defaultValue `true`
643
+ *
644
+ * @public
645
+ */
646
+ enableCSSSelector?: boolean;
647
+ /**
648
+ * enableNewGesture enables the new gesture system.
649
+ *
650
+ * @defaultValue `false`
651
+ */
652
+ enableNewGesture?: boolean;
653
+ /**
654
+ * enableRemoveCSSScope controls whether CSS is restrict to use in the component scope.
655
+ *
656
+ * `true`: All CSS files are treated as global CSS.
657
+ *
658
+ * `false`: All CSS files are treated as scoped CSS, and only take effect in the component that explicitly imports it.
659
+ *
660
+ * `undefined`: Only use scoped CSS for CSS Modules, and treat other CSS files as global CSS. Scoped CSS is faster than global CSS, thus you can use CSS Modules to speedy up your CSS if there are performance issues.
661
+ *
662
+ * @defaultValue `true`
663
+ *
664
+ * @public
665
+ */
666
+ enableRemoveCSSScope?: boolean | undefined;
667
+ /**
668
+ * This flag controls when MainThread (Lepus) transfers control to Background after the first screen
669
+ *
670
+ * This flag has three options:
671
+ *
672
+ * `"immediately"`: Transfer immediately
673
+ *
674
+ * `"jsReady"`: Transfer when background (JS Runtime) is ready
675
+ *
676
+ * `"manual"`: Transfer when the business calls the `markFirstScreenSyncReady()` API exported
677
+ * by `@lynx-js/react`, so the handover timing is fully controlled by the user
678
+ *
679
+ * After handing over control, MainThread (Lepus) runtime can no longer respond to data updates,
680
+ * and data updates will be forwarded to background (JS Runtime) and processed __asynchronously__
681
+ *
682
+ * @defaultValue "immediately"
683
+ */
684
+ firstScreenSyncTiming?: 'immediately' | 'jsReady' | 'manual';
685
+ /**
686
+ * `enableSSR` enable Lynx SSR feature for this build.
687
+ *
688
+ * @defaultValue `false`
689
+ *
690
+ * @public
691
+ */
692
+ enableSSR?: boolean;
693
+ /**
694
+ * removeDescendantSelectorScope is used to remove the scope of descendant selectors.
695
+ *
696
+ * @defaultValue `true`
697
+ */
698
+ removeDescendantSelectorScope?: boolean;
699
+ /**
700
+ * How main-thread code will be shaken.
701
+ *
702
+ * @defaultValue `undefined`
703
+ */
704
+ shake?: Partial<ShakeVisitorConfig> | undefined;
705
+ /**
706
+ * Like `define` in various bundlers, but this one happens at transform time, and a DCE pass will be performed.
707
+ *
708
+ * @defaultValue `undefined`
709
+ */
710
+ defineDCE?: Partial<DefineDceVisitorConfig> | undefined;
711
+ /**
712
+ * `engineVersion` specifies the minimum Lynx Engine version required for an App bundle to function properly.
713
+ *
714
+ * @defaultValue `'3.2'`
715
+ *
716
+ * @public
717
+ */
718
+ engineVersion?: string;
719
+ /**
720
+ * targetSdkVersion is used to specify the minimal Lynx Engine version that a App bundle can run on.
721
+ *
722
+ * @defaultValue `'3.2'`
723
+ *
724
+ * @public
725
+ * @deprecated `targetSdkVersion` is now an alias of {@link PluginReactLynxOptions.engineVersion}. Use {@link PluginReactLynxOptions.engineVersion} instead.
726
+ */
727
+ targetSdkVersion?: string;
728
+ /**
729
+ * Configure the update mode of `lynx.__globalProps`.
730
+ *
731
+ * This flag has two options:
732
+ *
733
+ * `'reactive'`: `UpdateGlobalProps` will trigger update automatically.
734
+ *
735
+ * `'event'`: `UpdateGlobalProps` will trigger global event and users need to trigger update in the event handler.
736
+ *
737
+ * @defaultValue `'reactive'`
738
+ * @public
739
+ */
740
+ globalPropsMode?: 'reactive' | 'event';
741
+ /**
742
+ * Merge same string literals in JS and Lepus to reduce output bundle size.
743
+ * Set to `false` to disable.
744
+ *
745
+ * @defaultValue false
746
+ */
747
+ extractStr?: Partial<ExtractStrConfig> | boolean;
748
+ /**
749
+ * Generate standalone lazy bundle.
750
+ *
751
+ * @defaultValue `false`
752
+ *
753
+ * @alpha
754
+ */
755
+ experimental_isLazyBundle?: boolean;
756
+ /**
757
+ * Enable Element Template compile and runtime entries.
758
+ *
759
+ * @defaultValue `false`
760
+ * @experimental
761
+ */
762
+ experimental_useElementTemplate?: boolean;
763
+ /**
764
+ * Optimize bundle size by removing unused code by Minify.mainThreadOptions and Minify.backgroundOptions.
765
+ *
766
+ * When optimizeBundleSize or optimizeBundleSize.mainThread is true, main-thread code will be optimized.
767
+ * When optimizeBundleSize or optimizeBundleSize.background is true, background code will be optimized.
768
+ *
769
+ * @defaultValue `false`
770
+ * @public
771
+ */
772
+ optimizeBundleSize?: boolean | {
773
+ mainThread?: boolean;
774
+ background?: boolean;
775
+ };
776
+ /**
777
+ * Re-evaluate the whole JS bundle on `reloadTemplate` instead of reusing
778
+ * the JSX of the previous render, so module scoped state of the entry is
779
+ * reset while the element tree is still reused.
780
+ *
781
+ * @defaultValue `false`
782
+ * @experimental
783
+ */
784
+ experimental_reEvalJSOnReload?: boolean;
785
+ }
786
+
787
+ export { ReactCompileResult }
788
+
789
+ /**
790
+ * Versioned React compilation-result exposure retrieved with
791
+ * `api.useExposed(Symbol.for('@lynx-js/react/internal:compile-result'))`.
792
+ *
793
+ * @public
794
+ */
795
+ export declare interface ReactCompileResultExposureV1 {
796
+ /** The exposure protocol version. */
797
+ version: 1;
798
+ /**
799
+ * Read semantic runtime requirements from the supplied compilations.
800
+ *
801
+ * @param stats - Original Stats or MultiStats objects, read before the build
802
+ * is closed. Serialized Stats JSON is not supported; callers must handle
803
+ * absent stats and build errors before calling this method.
804
+ * @returns A known result, or `undefined` if any compilation has no compatible
805
+ * semantic producer. An explicit `false` remains distinct from unknown.
806
+ * @remarks
807
+ * MultiStats combines all child requirements with OR only when every child
808
+ * has a compatible result. Pass a single environment's Stats to read its
809
+ * result independently in a mixed-environment build.
810
+ */
811
+ getCompileResult(stats: Rspack.Stats | Rspack.MultiStats): ReactCompileResult | undefined;
812
+ }
813
+
814
+ /**
815
+ * {@inheritDoc PluginReactLynxOptions.shake}
816
+ * @public
817
+ */
818
+ export declare interface ShakeVisitorConfig {
819
+ /**
820
+ * Package names to identify runtime imports that need to be processed
821
+ *
822
+ * @example
823
+ * ```js
824
+ * import { defineConfig } from '@lynx-js/rspeedy'
825
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
826
+ *
827
+ * export default defineConfig({
828
+ * plugins: [
829
+ * pluginReactLynx({
830
+ * shake: {
831
+ * pkgName: ['@lynx-js/react-runtime']
832
+ * }
833
+ * })
834
+ * ]
835
+ * })
836
+ * ```
837
+ *
838
+ * @defaultValue `['@lynx-js/react-runtime']`
839
+ *
840
+ * @remarks
841
+ * The provided values will be merged with the default values instead of replacing them.
842
+ *
843
+ * @public
844
+ */
845
+ pkgName: Array<string>
846
+ /**
847
+ * Properties that should be retained in the component class
848
+ *
849
+ * @example
850
+ * ```js
851
+ * import { defineConfig } from '@lynx-js/rspeedy'
852
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
853
+ *
854
+ * export default defineConfig({
855
+ * plugins: [
856
+ * pluginReactLynx({
857
+ * shake: {
858
+ * retainProp: ['myCustomMethod']
859
+ * }
860
+ * })
861
+ * ]
862
+ * })
863
+ * ```
864
+ *
865
+ * @defaultValue `['constructor', 'render', 'getDerivedStateFromProps', 'state', 'defaultDataProcessor', 'dataProcessors', 'contextType', 'defaultProps']`
866
+ *
867
+ * @remarks
868
+ * The provided values will be merged with the default values instead of replacing them.
869
+ *
870
+ * @public
871
+ */
872
+ retainProp: Array<string>
873
+ /**
874
+ * Function names whose calls should be replaced with `undefined` during transformation
875
+ *
876
+ * @example
877
+ * ```js
878
+ * import { defineConfig } from '@lynx-js/rspeedy'
879
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
880
+ *
881
+ * export default defineConfig({
882
+ * plugins: [
883
+ * pluginReactLynx({
884
+ * shake: {
885
+ * removeCall: ['useMyCustomEffect']
886
+ * }
887
+ * })
888
+ * ]
889
+ * })
890
+ * ```
891
+ *
892
+ * @defaultValue `['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']`
893
+ *
894
+ * @remarks
895
+ * The provided values will be merged with the default values instead of replacing them.
896
+ *
897
+ * @public
898
+ */
899
+ removeCall: Array<string>
900
+ /**
901
+ * Function names whose parameters should be removed during transformation
902
+ *
903
+ * @example
904
+ * ```js
905
+ * import { defineConfig } from '@lynx-js/rspeedy'
906
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
907
+ *
908
+ * export default defineConfig({
909
+ * plugins: [
910
+ * pluginReactLynx({
911
+ * shake: {
912
+ * removeCallParams: ['useMyCustomEffect']
913
+ * }
914
+ * })
915
+ * ]
916
+ * })
917
+ * ```
918
+ *
919
+ * @defaultValue `[]`
920
+ *
921
+ * @remarks
922
+ * The provided values will be merged with the default values instead of replacing them.
923
+ *
924
+ * @public
925
+ */
926
+ removeCallParams: Array<string>
927
+ }
928
+
929
+ export { TemplateHooks }
930
+
931
+ /**
932
+ * Serializable rules for transforming builtin element attribute names.
933
+ *
934
+ * Exact entries in `rename` take precedence over `preserve`, followed by the
935
+ * fallback behavior selected by `mode`.
936
+ *
937
+ * @public
938
+ */
939
+ export declare interface TransformBuiltinAttributeNamesOptions {
940
+ /**
941
+ * The fallback behavior for attribute names not listed in `rename` or
942
+ * `preserve`.
943
+ *
944
+ * `'dash-case'` also applies the default React-style event mappings.
945
+ * `'mapping-only'` leaves all remaining names unchanged.
946
+ *
947
+ * @defaultValue `'dash-case'`
948
+ */
949
+ mode?: 'dash-case' | 'mapping-only'
950
+ /**
951
+ * Attribute names that should remain unchanged unless an exact `rename`
952
+ * entry is also present.
953
+ */
954
+ preserve?: ReadonlyArray<string>
955
+ /**
956
+ * Exact mappings from source attribute names to transformed attribute names.
957
+ */
958
+ rename?: Readonly<Record<string, string>>
959
+ }
960
+
961
+ export { }