@lynx-js/react-rsbuild-plugin 0.14.0 → 0.16.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Simplify hooks for main-thread runtime, which only can run during the first screen. ([#2441](https://github.com/lynx-family/lynx-stack/pull/2441))
8
+
9
+ ### Patch Changes
10
+
11
+ - Support rstest for testing library using a dedicated testing loader. ([#2328](https://github.com/lynx-family/lynx-stack/pull/2328))
12
+
13
+ - Fix `environments.lynx.performance.profile` so it overrides the default profile behavior for the current environment. ([#2468](https://github.com/lynx-family/lynx-stack/pull/2468))
14
+
15
+ - Add `enableUiSourceMap` option to enable UI source map generation and debug-metadata asset emission. ([#2402](https://github.com/lynx-family/lynx-stack/pull/2402))
16
+
17
+ - Updated dependencies [[`a9f8d05`](https://github.com/lynx-family/lynx-stack/commit/a9f8d0548664ea32ebae2072c13f2cf6fee676eb), [`b1ad1b9`](https://github.com/lynx-family/lynx-stack/commit/b1ad1b98ed8d4635ad89fac42fe2fbb7e8e56c39), [`f6184f3`](https://github.com/lynx-family/lynx-stack/commit/f6184f32c3eb160d16ee852da4955765b5ad1398), [`f6184f3`](https://github.com/lynx-family/lynx-stack/commit/f6184f32c3eb160d16ee852da4955765b5ad1398), [`a9f8d05`](https://github.com/lynx-family/lynx-stack/commit/a9f8d0548664ea32ebae2072c13f2cf6fee676eb), [`f542d9c`](https://github.com/lynx-family/lynx-stack/commit/f542d9c98b376d340443b4683ed0c7707beeb5ad)]:
18
+ - @lynx-js/template-webpack-plugin@0.10.9
19
+ - @lynx-js/react-webpack-plugin@0.9.1
20
+ - @lynx-js/react-alias-rsbuild-plugin@0.16.0
21
+ - @lynx-js/css-extract-webpack-plugin@0.7.0
22
+ - @lynx-js/react-refresh-webpack-plugin@0.3.5
23
+ - @lynx-js/use-sync-external-store@1.5.0
24
+
25
+ ## 0.15.0
26
+
27
+ ### Minor Changes
28
+
29
+ - Add `removeCall` for shake function calls. Its initial default value matches the hooks that were previously in `removeCallParams`, and `removeCallParams` now defaults to empty. ([#2423](https://github.com/lynx-family/lynx-stack/pull/2423))
30
+
31
+ `removeCall` removes matched runtime hook calls entirely, replacing them with `undefined` in expression positions and dropping them in statement positions. `removeCallParams` keeps the existing behavior of preserving the call while stripping its arguments.
32
+
33
+ ### Patch Changes
34
+
35
+ - Support `@lynx-js/react` 0.118.0. ([#2432](https://github.com/lynx-family/lynx-stack/pull/2432))
36
+
37
+ - Updated dependencies [[`1f4f117`](https://github.com/lynx-family/lynx-stack/commit/1f4f1171a35a00d2c9f2ae9ecff50be2626ca5bb)]:
38
+ - @lynx-js/react-webpack-plugin@0.9.0
39
+ - @lynx-js/react-alias-rsbuild-plugin@0.15.0
40
+ - @lynx-js/use-sync-external-store@1.5.0
41
+ - @lynx-js/react-refresh-webpack-plugin@0.3.5
42
+ - @lynx-js/css-extract-webpack-plugin@0.7.0
43
+ - @lynx-js/template-webpack-plugin@0.10.8
44
+
3
45
  ## 0.14.0
4
46
 
5
47
  ### Minor Changes
package/dist/208.js CHANGED
@@ -6,7 +6,7 @@ import { LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/
6
6
  import node_path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
9
- import { ReactRefreshRspackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
9
+ import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
10
10
  __webpack_require__.add({
11
11
  "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js" (__unused_rspack_module, exports) {
12
12
  exports._accessExpressionAsString = void 0;
@@ -325,7 +325,10 @@ function applyEntry(api, options) {
325
325
  }
326
326
  ]);
327
327
  function getDefaultProfile() {
328
- if (userConfig.performance?.profile !== void 0) return userConfig.performance.profile;
328
+ const environmentProfile = userConfig.environments?.[environment.name]?.performance?.profile;
329
+ if (void 0 !== environmentProfile) return environmentProfile;
330
+ const userProfile = userConfig.performance?.profile;
331
+ if (void 0 !== userProfile) return userProfile;
329
332
  if (isDebug()) return true;
330
333
  }
331
334
  });
@@ -392,22 +395,36 @@ function applyLazy(api) {
392
395
  });
393
396
  });
394
397
  }
398
+ function getLoaderOptions(api, options, isMainThread = false) {
399
+ const { output } = api.getRsbuildConfig();
400
+ const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources'));
401
+ const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, enableUiSourceMap, experimental_isLazyBundle } = options;
402
+ return {
403
+ compat,
404
+ enableRemoveCSSScope,
405
+ isDynamicComponent: experimental_isLazyBundle,
406
+ inlineSourcesContent,
407
+ defineDCE,
408
+ engineVersion,
409
+ ...isMainThread ? {
410
+ enableUiSourceMap,
411
+ shake
412
+ } : {}
413
+ };
414
+ }
415
+ const TESTING_RULE_NAME = 'react:testing';
416
+ function applyTestingLoaders(api, options) {
417
+ api.modifyBundlerChain((chain, { CHAIN_ID })=>{
418
+ const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
419
+ rule.use(TESTING_RULE_NAME).loader(ReactWebpackPlugin.loaders.TESTING).options(getLoaderOptions(api, options)).end();
420
+ });
421
+ }
395
422
  function applyLoaders(api, options) {
396
- const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, experimental_isLazyBundle } = options;
397
423
  api.modifyBundlerChain((chain, { CHAIN_ID })=>{
398
424
  const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
399
425
  const uses = rule.uses.entries() ?? {};
400
- const { output } = api.getRsbuildConfig();
401
- const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources'));
402
426
  const backgroundRule = rule.oneOf(LAYERS.BACKGROUND);
403
- backgroundRule.issuerLayer(LAYERS.BACKGROUND).uses.merge(uses).end().use(LAYERS.BACKGROUND).loader(ReactWebpackPlugin.loaders.BACKGROUND).options({
404
- compat,
405
- enableRemoveCSSScope,
406
- isDynamicComponent: experimental_isLazyBundle,
407
- inlineSourcesContent,
408
- defineDCE,
409
- engineVersion
410
- }).end();
427
+ backgroundRule.issuerLayer(LAYERS.BACKGROUND).uses.merge(uses).end().use(LAYERS.BACKGROUND).loader(ReactWebpackPlugin.loaders.BACKGROUND).options(getLoaderOptions(api, options)).end();
411
428
  const mainThreadRule = rule.oneOf(LAYERS.MAIN_THREAD);
412
429
  mainThreadRule.issuerLayer(LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
413
430
  rule.uses.delete(CHAIN_ID.USE.SWC);
@@ -420,15 +437,7 @@ function applyLoaders(api, options) {
420
437
  target: 'es2019'
421
438
  }
422
439
  });
423
- }).use(LAYERS.MAIN_THREAD).loader(ReactWebpackPlugin.loaders.MAIN_THREAD).options({
424
- compat,
425
- enableRemoveCSSScope,
426
- inlineSourcesContent,
427
- isDynamicComponent: experimental_isLazyBundle,
428
- engineVersion,
429
- shake,
430
- defineDCE
431
- }).end();
440
+ }).use(LAYERS.MAIN_THREAD).loader(ReactWebpackPlugin.loaders.MAIN_THREAD).options(getLoaderOptions(api, options, true)).end();
432
441
  rule.uses.clear();
433
442
  });
434
443
  }
@@ -480,6 +489,9 @@ function applyOptimizeBundleSize(api, options) {
480
489
  }
481
490
  const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
482
491
  function applyRefresh(api) {
492
+ api.modifyWebpackChain?.(async (chain, { CHAIN_ID, isProd })=>{
493
+ if (!isProd) await applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshWebpackPlugin);
494
+ });
483
495
  api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID })=>{
484
496
  if (!isProd) {
485
497
  const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
@@ -595,8 +607,9 @@ function applyUseSyncExternalStore(api) {
595
607
  const _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js");
596
608
  const _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
597
609
  const validateConfig = (()=>{
598
- const _io0 = (input, _exceptionable = true)=>(void 0 === input.compat || "object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) && _io1(input.compat, _exceptionable)) && (void 0 === input.customCSSInheritanceList || Array.isArray(input.customCSSInheritanceList) && input.customCSSInheritanceList.every((elem, _index1)=>"string" == typeof elem)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope) && (void 0 === input.shake || "object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) && _io4(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io5(input.defineDCE, _exceptionable)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion) && (void 0 === input.globalPropsMode || "reactive" === input.globalPropsMode || "event" === input.globalPropsMode) && null !== input.extractStr && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || "object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) && _io7(input.extractStr, _exceptionable)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && null !== input.optimizeBundleSize && (void 0 === input.optimizeBundleSize || "boolean" == typeof input.optimizeBundleSize || "object" == typeof input.optimizeBundleSize && null !== input.optimizeBundleSize && false === Array.isArray(input.optimizeBundleSize) && _io8(input.optimizeBundleSize, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
610
+ const _io0 = (input, _exceptionable = true)=>(void 0 === input.enableUiSourceMap || "boolean" == typeof input.enableUiSourceMap) && (void 0 === input.compat || "object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) && _io1(input.compat, _exceptionable)) && (void 0 === input.customCSSInheritanceList || Array.isArray(input.customCSSInheritanceList) && input.customCSSInheritanceList.every((elem, _index1)=>"string" == typeof elem)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope) && (void 0 === input.shake || "object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) && _io4(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io5(input.defineDCE, _exceptionable)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion) && (void 0 === input.globalPropsMode || "reactive" === input.globalPropsMode || "event" === input.globalPropsMode) && null !== input.extractStr && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || "object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) && _io7(input.extractStr, _exceptionable)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && null !== input.optimizeBundleSize && (void 0 === input.optimizeBundleSize || "boolean" == typeof input.optimizeBundleSize || "object" == typeof input.optimizeBundleSize && null !== input.optimizeBundleSize && false === Array.isArray(input.optimizeBundleSize) && _io8(input.optimizeBundleSize, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
599
611
  if ([
612
+ "enableUiSourceMap",
600
613
  "compat",
601
614
  "customCSSInheritanceList",
602
615
  "debugInfoOutside",
@@ -656,10 +669,11 @@ const validateConfig = (()=>{
656
669
  if (void 0 === value) return true;
657
670
  return false;
658
671
  }));
659
- const _io4 = (input, _exceptionable = true)=>(void 0 === input.pkgName || Array.isArray(input.pkgName) && input.pkgName.every((elem, _index5)=>"string" == typeof elem)) && (void 0 === input.retainProp || Array.isArray(input.retainProp) && input.retainProp.every((elem, _index6)=>"string" == typeof elem)) && (void 0 === input.removeCallParams || Array.isArray(input.removeCallParams) && input.removeCallParams.every((elem, _index7)=>"string" == typeof elem)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
672
+ const _io4 = (input, _exceptionable = true)=>(void 0 === input.pkgName || Array.isArray(input.pkgName) && input.pkgName.every((elem, _index5)=>"string" == typeof elem)) && (void 0 === input.retainProp || Array.isArray(input.retainProp) && input.retainProp.every((elem, _index6)=>"string" == typeof elem)) && (void 0 === input.removeCall || Array.isArray(input.removeCall) && input.removeCall.every((elem, _index7)=>"string" == typeof elem)) && (void 0 === input.removeCallParams || Array.isArray(input.removeCallParams) && input.removeCallParams.every((elem, _index8)=>"string" == typeof elem)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
660
673
  if ([
661
674
  "pkgName",
662
675
  "retainProp",
676
+ "removeCall",
663
677
  "removeCallParams"
664
678
  ].some((prop)=>key === prop)) return true;
665
679
  const value = input[key];
@@ -696,7 +710,12 @@ const validateConfig = (()=>{
696
710
  if (void 0 === value) return true;
697
711
  return false;
698
712
  }));
699
- const _ao0 = (input, _path, _exceptionable = true)=>(void 0 === input.compat || ("object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) || _assertGuard._assertGuard(_exceptionable, {
713
+ const _ao0 = (input, _path, _exceptionable = true)=>(void 0 === input.enableUiSourceMap || "boolean" == typeof input.enableUiSourceMap || _assertGuard._assertGuard(_exceptionable, {
714
+ method: "typia.createAssertEquals",
715
+ path: _path + ".enableUiSourceMap",
716
+ expected: "(boolean | undefined)",
717
+ value: input.enableUiSourceMap
718
+ }, _errorFactory)) && (void 0 === input.compat || ("object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) || _assertGuard._assertGuard(_exceptionable, {
700
719
  method: "typia.createAssertEquals",
701
720
  path: _path + ".compat",
702
721
  expected: "(Partial<CompatVisitorConfig> & { disableCreateSelectorQueryIncompatibleWarning?: boolean; } | undefined)",
@@ -711,9 +730,9 @@ const validateConfig = (()=>{
711
730
  path: _path + ".customCSSInheritanceList",
712
731
  expected: "(Array<string> | undefined)",
713
732
  value: input.customCSSInheritanceList
714
- }, _errorFactory)) && input.customCSSInheritanceList.every((elem, _index8)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
733
+ }, _errorFactory)) && input.customCSSInheritanceList.every((elem, _index9)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
715
734
  method: "typia.createAssertEquals",
716
- path: _path + ".customCSSInheritanceList[" + _index8 + "]",
735
+ path: _path + ".customCSSInheritanceList[" + _index9 + "]",
717
736
  expected: "string",
718
737
  value: elem
719
738
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -848,6 +867,7 @@ const validateConfig = (()=>{
848
867
  value: input.optimizeBundleSize
849
868
  }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
850
869
  if ([
870
+ "enableUiSourceMap",
851
871
  "compat",
852
872
  "customCSSInheritanceList",
853
873
  "debugInfoOutside",
@@ -884,9 +904,9 @@ const validateConfig = (()=>{
884
904
  path: _path + ".componentsPkg",
885
905
  expected: "(Array<string> | undefined)",
886
906
  value: input.componentsPkg
887
- }, _errorFactory)) && input.componentsPkg.every((elem, _index9)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
907
+ }, _errorFactory)) && input.componentsPkg.every((elem, _index10)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
888
908
  method: "typia.createAssertEquals",
889
- path: _path + ".componentsPkg[" + _index9 + "]",
909
+ path: _path + ".componentsPkg[" + _index10 + "]",
890
910
  expected: "string",
891
911
  value: elem
892
912
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -899,9 +919,9 @@ const validateConfig = (()=>{
899
919
  path: _path + ".oldRuntimePkg",
900
920
  expected: "(Array<string> | undefined)",
901
921
  value: input.oldRuntimePkg
902
- }, _errorFactory)) && input.oldRuntimePkg.every((elem, _index10)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
922
+ }, _errorFactory)) && input.oldRuntimePkg.every((elem, _index11)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
903
923
  method: "typia.createAssertEquals",
904
- path: _path + ".oldRuntimePkg[" + _index10 + "]",
924
+ path: _path + ".oldRuntimePkg[" + _index11 + "]",
905
925
  expected: "string",
906
926
  value: elem
907
927
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -919,9 +939,9 @@ const validateConfig = (()=>{
919
939
  path: _path + ".additionalComponentAttributes",
920
940
  expected: "(Array<string> | undefined)",
921
941
  value: input.additionalComponentAttributes
922
- }, _errorFactory)) && input.additionalComponentAttributes.every((elem, _index11)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
942
+ }, _errorFactory)) && input.additionalComponentAttributes.every((elem, _index12)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
923
943
  method: "typia.createAssertEquals",
924
- path: _path + ".additionalComponentAttributes[" + _index11 + "]",
944
+ path: _path + ".additionalComponentAttributes[" + _index12 + "]",
925
945
  expected: "string",
926
946
  value: elem
927
947
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -1042,9 +1062,9 @@ const validateConfig = (()=>{
1042
1062
  path: _path + ".pkgName",
1043
1063
  expected: "(Array<string> | undefined)",
1044
1064
  value: input.pkgName
1045
- }, _errorFactory)) && input.pkgName.every((elem, _index12)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1065
+ }, _errorFactory)) && input.pkgName.every((elem, _index13)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1046
1066
  method: "typia.createAssertEquals",
1047
- path: _path + ".pkgName[" + _index12 + "]",
1067
+ path: _path + ".pkgName[" + _index13 + "]",
1048
1068
  expected: "string",
1049
1069
  value: elem
1050
1070
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -1057,9 +1077,9 @@ const validateConfig = (()=>{
1057
1077
  path: _path + ".retainProp",
1058
1078
  expected: "(Array<string> | undefined)",
1059
1079
  value: input.retainProp
1060
- }, _errorFactory)) && input.retainProp.every((elem, _index13)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1080
+ }, _errorFactory)) && input.retainProp.every((elem, _index14)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1061
1081
  method: "typia.createAssertEquals",
1062
- path: _path + ".retainProp[" + _index13 + "]",
1082
+ path: _path + ".retainProp[" + _index14 + "]",
1063
1083
  expected: "string",
1064
1084
  value: elem
1065
1085
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -1067,14 +1087,29 @@ const validateConfig = (()=>{
1067
1087
  path: _path + ".retainProp",
1068
1088
  expected: "(Array<string> | undefined)",
1069
1089
  value: input.retainProp
1090
+ }, _errorFactory)) && (void 0 === input.removeCall || (Array.isArray(input.removeCall) || _assertGuard._assertGuard(_exceptionable, {
1091
+ method: "typia.createAssertEquals",
1092
+ path: _path + ".removeCall",
1093
+ expected: "(Array<string> | undefined)",
1094
+ value: input.removeCall
1095
+ }, _errorFactory)) && input.removeCall.every((elem, _index15)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1096
+ method: "typia.createAssertEquals",
1097
+ path: _path + ".removeCall[" + _index15 + "]",
1098
+ expected: "string",
1099
+ value: elem
1100
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
1101
+ method: "typia.createAssertEquals",
1102
+ path: _path + ".removeCall",
1103
+ expected: "(Array<string> | undefined)",
1104
+ value: input.removeCall
1070
1105
  }, _errorFactory)) && (void 0 === input.removeCallParams || (Array.isArray(input.removeCallParams) || _assertGuard._assertGuard(_exceptionable, {
1071
1106
  method: "typia.createAssertEquals",
1072
1107
  path: _path + ".removeCallParams",
1073
1108
  expected: "(Array<string> | undefined)",
1074
1109
  value: input.removeCallParams
1075
- }, _errorFactory)) && input.removeCallParams.every((elem, _index14)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1110
+ }, _errorFactory)) && input.removeCallParams.every((elem, _index16)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1076
1111
  method: "typia.createAssertEquals",
1077
- path: _path + ".removeCallParams[" + _index14 + "]",
1112
+ path: _path + ".removeCallParams[" + _index16 + "]",
1078
1113
  expected: "string",
1079
1114
  value: elem
1080
1115
  }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
@@ -1086,6 +1121,7 @@ const validateConfig = (()=>{
1086
1121
  if ([
1087
1122
  "pkgName",
1088
1123
  "retainProp",
1124
+ "removeCall",
1089
1125
  "removeCallParams"
1090
1126
  ].some((prop)=>key === prop)) return true;
1091
1127
  const value = input[key];
@@ -1230,7 +1266,8 @@ function pluginReactLynx(userOptions) {
1230
1266
  extractStr: false,
1231
1267
  globalPropsMode: 'reactive',
1232
1268
  experimental_isLazyBundle: false,
1233
- optimizeBundleSize: false
1269
+ optimizeBundleSize: false,
1270
+ enableUiSourceMap: false
1234
1271
  };
1235
1272
  const resolvedOptions = Object.assign(defaultOptions, userOptions, {
1236
1273
  targetSdkVersion: engineVersion,
@@ -1249,17 +1286,19 @@ function pluginReactLynx(userOptions) {
1249
1286
  ],
1250
1287
  setup (api) {
1251
1288
  const isRslib = 'rslib' === api.context.callerName;
1289
+ const isRstest = 'rstest' === api.context.callerName;
1252
1290
  const exposedConfig = api.useExposed(Symbol.for('lynx.config'));
1253
1291
  if (exposedConfig) Object.keys(defaultOptions).forEach((key)=>{
1254
1292
  if (Object.hasOwn(exposedConfig.config, key)) Object.assign(resolvedOptions, {
1255
1293
  [key]: exposedConfig.config[key]
1256
1294
  });
1257
1295
  });
1258
- applyCSS(api, resolvedOptions);
1296
+ if (!isRstest) applyCSS(api, resolvedOptions);
1259
1297
  applyEntry(api, resolvedOptions);
1260
1298
  applyBackgroundOnly(api);
1261
1299
  applyGenerator(api, resolvedOptions);
1262
- applyLoaders(api, resolvedOptions);
1300
+ if (isRstest) applyTestingLoaders(api, resolvedOptions);
1301
+ else applyLoaders(api, resolvedOptions);
1263
1302
  applyRefresh(api);
1264
1303
  applySplitChunksRule(api);
1265
1304
  applySWC(api);
package/dist/index.d.ts CHANGED
@@ -440,12 +440,20 @@ export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): R
440
440
  * @public
441
441
  */
442
442
  export declare interface PluginReactLynxOptions {
443
+ /**
444
+ * Enable UI source map generation and debug-metadata asset emission.
445
+ *
446
+ * @defaultValue `false`
447
+ */
448
+ enableUiSourceMap?: boolean;
443
449
  /**
444
450
  * The `compat` option controls compatibilities with ReactLynx2.0.
445
451
  *
446
452
  * @remarks
447
453
  *
448
454
  * These options should only be used for migrating from ReactLynx2.0.
455
+ *
456
+ * @defaultValue `undefined`
449
457
  */
450
458
  compat?: Partial<CompatVisitorConfig> & {
451
459
  /**
@@ -484,6 +492,8 @@ export declare interface PluginReactLynxOptions {
484
492
  * ],
485
493
  * }
486
494
  * ```
495
+ *
496
+ * @defaultValue `undefined`
487
497
  */
488
498
  customCSSInheritanceList?: string[] | undefined;
489
499
  /**
@@ -492,19 +502,23 @@ export declare interface PluginReactLynxOptions {
492
502
  * @remarks
493
503
  * This is recommended to be set to true to reduce template size.
494
504
  *
505
+ * @defaultValue `true`
506
+ *
495
507
  * @public
496
508
  */
497
509
  debugInfoOutside?: boolean;
498
510
  /**
499
511
  * defaultDisplayLinear controls whether the default value of `display` in CSS is `linear`.
500
512
  *
501
- * @remarks
502
- *
503
513
  * If `defaultDisplayLinear === false`, the default `display` would be `flex` instead of `linear`.
514
+ *
515
+ * @defaultValue `true`
504
516
  */
505
517
  defaultDisplayLinear?: boolean;
506
518
  /**
507
519
  * enableAccessibilityElement set the default value of `accessibility-element` for all `<view />` elements.
520
+ *
521
+ * @defaultValue `false`
508
522
  */
509
523
  enableAccessibilityElement?: boolean;
510
524
  /**
@@ -539,6 +553,8 @@ export declare interface PluginReactLynxOptions {
539
553
  * - `text-shadow`
540
554
  *
541
555
  * It is recommended to use with {@link PluginReactLynxOptions.customCSSInheritanceList} to avoid performance issues.
556
+ *
557
+ * @defaultValue `false`
542
558
  */
543
559
  enableCSSInheritance?: boolean;
544
560
  /**
@@ -554,11 +570,15 @@ export declare interface PluginReactLynxOptions {
554
570
  *
555
571
  * We find that collecting invalidation nodes and updating them is a relatively time-consuming process.
556
572
  * If there is no such usage and better style matching performance is needed, this feature can be selectively disabled.
573
+ *
574
+ * @defaultValue `true`
557
575
  */
558
576
  enableCSSInvalidation?: boolean;
559
577
  /**
560
578
  * enableCSSSelector controls whether enabling the new CSS implementation.
561
579
  *
580
+ * @defaultValue `true`
581
+ *
562
582
  * @public
563
583
  */
564
584
  enableCSSSelector?: boolean;
@@ -607,25 +627,35 @@ export declare interface PluginReactLynxOptions {
607
627
  enableSSR?: boolean;
608
628
  /**
609
629
  * removeDescendantSelectorScope is used to remove the scope of descendant selectors.
630
+ *
631
+ * @defaultValue `true`
610
632
  */
611
633
  removeDescendantSelectorScope?: boolean;
612
634
  /**
613
635
  * How main-thread code will be shaken.
636
+ *
637
+ * @defaultValue `undefined`
614
638
  */
615
639
  shake?: Partial<ShakeVisitorConfig> | undefined;
616
640
  /**
617
641
  * Like `define` in various bundlers, but this one happens at transform time, and a DCE pass will be performed.
642
+ *
643
+ * @defaultValue `undefined`
618
644
  */
619
645
  defineDCE?: Partial<DefineDceVisitorConfig> | undefined;
620
646
  /**
621
647
  * `engineVersion` specifies the minimum Lynx Engine version required for an App bundle to function properly.
622
648
  *
649
+ * @defaultValue `'3.2'`
650
+ *
623
651
  * @public
624
652
  */
625
653
  engineVersion?: string;
626
654
  /**
627
655
  * targetSdkVersion is used to specify the minimal Lynx Engine version that a App bundle can run on.
628
656
  *
657
+ * @defaultValue `'3.2'`
658
+ *
629
659
  * @public
630
660
  * @deprecated `targetSdkVersion` is now an alias of {@link PluginReactLynxOptions.engineVersion}. Use {@link PluginReactLynxOptions.engineVersion} instead.
631
661
  */
@@ -653,6 +683,8 @@ export declare interface PluginReactLynxOptions {
653
683
  /**
654
684
  * Generate standalone lazy bundle.
655
685
  *
686
+ * @defaultValue `false`
687
+ *
656
688
  * @alpha
657
689
  */
658
690
  experimental_isLazyBundle?: boolean;
@@ -727,6 +759,32 @@ export declare interface ShakeVisitorConfig {
727
759
  * @public
728
760
  */
729
761
  retainProp: Array<string>
762
+ /**
763
+ * Function names whose calls should be replaced with `undefined` during transformation
764
+ *
765
+ * @example
766
+ * ```js
767
+ * import { defineConfig } from '@lynx-js/rspeedy'
768
+ * import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
769
+ *
770
+ * export default defineConfig({
771
+ * plugins: [
772
+ * pluginReactLynx({
773
+ * shake: {
774
+ * removeCall: ['useMyCustomEffect']
775
+ * }
776
+ * })
777
+ * ]
778
+ * })
779
+ * ```
780
+ *
781
+ * @remarks
782
+ * Default value: `['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']`
783
+ * The provided values will be merged with the default values instead of replacing them.
784
+ *
785
+ * @public
786
+ */
787
+ removeCall: Array<string>
730
788
  /**
731
789
  * Function names whose parameters should be removed during transformation
732
790
  *
@@ -747,7 +805,7 @@ export declare interface ShakeVisitorConfig {
747
805
  * ```
748
806
  *
749
807
  * @remarks
750
- * Default value: `['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']`
808
+ * Default value: `[]`
751
809
  * The provided values will be merged with the default values instead of replacing them.
752
810
  *
753
811
  * @public
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,19 +32,20 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
+ "tiny-invariant": "^1.3.3",
35
36
  "@lynx-js/css-extract-webpack-plugin": "0.7.0",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.14.0",
37
+ "@lynx-js/react-alias-rsbuild-plugin": "0.16.0",
37
38
  "@lynx-js/react-refresh-webpack-plugin": "0.3.5",
38
- "@lynx-js/react-webpack-plugin": "0.8.0",
39
+ "@lynx-js/react-webpack-plugin": "0.9.1",
39
40
  "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
40
- "@lynx-js/template-webpack-plugin": "0.10.7",
41
+ "@lynx-js/template-webpack-plugin": "0.10.9",
41
42
  "@lynx-js/use-sync-external-store": "1.5.0",
42
43
  "background-only": "^0.0.1"
43
44
  },
44
45
  "devDependencies": {
45
- "@microsoft/api-extractor": "7.57.6",
46
+ "@microsoft/api-extractor": "7.58.2",
46
47
  "@rollup/plugin-typescript": "^12.3.0",
47
- "@rsbuild/core": "1.7.4",
48
+ "@rsbuild/core": "1.7.5",
48
49
  "@rsbuild/plugin-sass": "1.5.0",
49
50
  "@rsbuild/plugin-typed-css-modules": "1.2.2",
50
51
  "rsbuild-plugin-arethetypeswrong": "0.2.0",
@@ -54,14 +55,14 @@
54
55
  "type-fest": "^5.4.4",
55
56
  "typia": "10.1.0",
56
57
  "typia-rspack-plugin": "2.2.2",
57
- "@lynx-js/config-rsbuild-plugin": "0.0.1",
58
- "@lynx-js/react": "0.117.1",
58
+ "@lynx-js/config-rsbuild-plugin": "0.0.2",
59
+ "@lynx-js/react": "0.119.0",
59
60
  "@lynx-js/react-transform": "0.2.0",
60
- "@lynx-js/rspeedy": "0.14.0",
61
+ "@lynx-js/rspeedy": "0.14.2",
61
62
  "@lynx-js/vitest-setup": "0.0.0"
62
63
  },
63
64
  "peerDependencies": {
64
- "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0 || ^0.115.0 || ^0.116.0 || ^0.117.0"
65
+ "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0 || ^0.115.0 || ^0.116.0 || ^0.117.0 || ^0.118.0 || ^0.119.0"
65
66
  },
66
67
  "peerDependenciesMeta": {
67
68
  "@lynx-js/react": {