@lynx-js/react-rsbuild-plugin 0.13.0 → 0.15.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 +41 -0
- package/dist/208.js +124 -23
- package/dist/index.d.ts +69 -3
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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))
|
|
8
|
+
|
|
9
|
+
`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.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Support `@lynx-js/react` 0.118.0. ([#2432](https://github.com/lynx-family/lynx-stack/pull/2432))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`1f4f117`](https://github.com/lynx-family/lynx-stack/commit/1f4f1171a35a00d2c9f2ae9ecff50be2626ca5bb)]:
|
|
16
|
+
- @lynx-js/react-webpack-plugin@0.9.0
|
|
17
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.15.0
|
|
18
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
19
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.5
|
|
20
|
+
- @lynx-js/css-extract-webpack-plugin@0.7.0
|
|
21
|
+
- @lynx-js/template-webpack-plugin@0.10.8
|
|
22
|
+
|
|
23
|
+
## 0.14.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- feat: support `optimizeBundleSize` option to remove unused code for main-thread and background. ([#2336](https://github.com/lynx-family/lynx-stack/pull/2336))
|
|
28
|
+
|
|
29
|
+
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.background` is `true`, `lynx.registerDataProcessors` calls will be marked as pure for the background thread output.
|
|
30
|
+
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.mainThread` is `true`, `NativeModules.call` and `lynx.getJSModule` calls will be marked as pure for the main-thread output.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- refactor: remove `modifyWebpackChain` since Rsbuild 2.0 dropped webpack support ([#2397](https://github.com/lynx-family/lynx-stack/pull/2397))
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`9193711`](https://github.com/lynx-family/lynx-stack/commit/919371167f4136f2ee975075d8e73d2986b20a8f)]:
|
|
37
|
+
- @lynx-js/template-webpack-plugin@0.10.7
|
|
38
|
+
- @lynx-js/css-extract-webpack-plugin@0.7.0
|
|
39
|
+
- @lynx-js/react-webpack-plugin@0.8.0
|
|
40
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.14.0
|
|
41
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
42
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.5
|
|
43
|
+
|
|
3
44
|
## 0.13.0
|
|
4
45
|
|
|
5
46
|
### 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
|
|
9
|
+
import { ReactRefreshRspackPlugin } 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;
|
|
@@ -443,11 +443,43 @@ function applyNodeEnv(api) {
|
|
|
443
443
|
}
|
|
444
444
|
}));
|
|
445
445
|
}
|
|
446
|
+
function applyOptimizeBundleSize(api, options) {
|
|
447
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
448
|
+
const optimizeBundleSize = options.optimizeBundleSize;
|
|
449
|
+
const optimizeBackground = 'boolean' == typeof optimizeBundleSize ? optimizeBundleSize : optimizeBundleSize?.background;
|
|
450
|
+
const optimizeMainThread = 'boolean' == typeof optimizeBundleSize ? optimizeBundleSize : optimizeBundleSize?.mainThread;
|
|
451
|
+
if (optimizeBackground || optimizeMainThread) {
|
|
452
|
+
const minifyConfig = {};
|
|
453
|
+
if (optimizeBackground) minifyConfig['backgroundOptions'] = {
|
|
454
|
+
minimizerOptions: {
|
|
455
|
+
compress: {
|
|
456
|
+
pure_funcs: [
|
|
457
|
+
'lynx.registerDataProcessors'
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
if (optimizeMainThread) minifyConfig['mainThreadOptions'] = {
|
|
463
|
+
minimizerOptions: {
|
|
464
|
+
compress: {
|
|
465
|
+
pure_funcs: [
|
|
466
|
+
'NativeModules.call',
|
|
467
|
+
'lynx.getJSModule'
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
return mergeRsbuildConfig(config, {
|
|
473
|
+
output: {
|
|
474
|
+
minify: minifyConfig
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
return config;
|
|
479
|
+
});
|
|
480
|
+
}
|
|
446
481
|
const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
|
|
447
482
|
function applyRefresh(api) {
|
|
448
|
-
api.modifyWebpackChain(async (chain, { CHAIN_ID, isProd })=>{
|
|
449
|
-
if (!isProd) await applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshWebpackPlugin);
|
|
450
|
-
});
|
|
451
483
|
api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID })=>{
|
|
452
484
|
if (!isProd) {
|
|
453
485
|
const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
|
|
@@ -563,7 +595,7 @@ function applyUseSyncExternalStore(api) {
|
|
|
563
595
|
const _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js");
|
|
564
596
|
const _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
|
|
565
597
|
const validateConfig = (()=>{
|
|
566
|
-
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) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
|
|
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)=>{
|
|
567
599
|
if ([
|
|
568
600
|
"compat",
|
|
569
601
|
"customCSSInheritanceList",
|
|
@@ -584,7 +616,8 @@ const validateConfig = (()=>{
|
|
|
584
616
|
"targetSdkVersion",
|
|
585
617
|
"globalPropsMode",
|
|
586
618
|
"extractStr",
|
|
587
|
-
"experimental_isLazyBundle"
|
|
619
|
+
"experimental_isLazyBundle",
|
|
620
|
+
"optimizeBundleSize"
|
|
588
621
|
].some((prop)=>key === prop)) return true;
|
|
589
622
|
const value = input[key];
|
|
590
623
|
if (void 0 === value) return true;
|
|
@@ -623,10 +656,11 @@ const validateConfig = (()=>{
|
|
|
623
656
|
if (void 0 === value) return true;
|
|
624
657
|
return false;
|
|
625
658
|
}));
|
|
626
|
-
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,
|
|
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.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)=>{
|
|
627
660
|
if ([
|
|
628
661
|
"pkgName",
|
|
629
662
|
"retainProp",
|
|
663
|
+
"removeCall",
|
|
630
664
|
"removeCallParams"
|
|
631
665
|
].some((prop)=>key === prop)) return true;
|
|
632
666
|
const value = input[key];
|
|
@@ -654,6 +688,15 @@ const validateConfig = (()=>{
|
|
|
654
688
|
if (void 0 === value) return true;
|
|
655
689
|
return false;
|
|
656
690
|
}));
|
|
691
|
+
const _io8 = (input, _exceptionable = true)=>(void 0 === input.mainThread || "boolean" == typeof input.mainThread) && (void 0 === input.background || "boolean" == typeof input.background) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
|
|
692
|
+
if ([
|
|
693
|
+
"mainThread",
|
|
694
|
+
"background"
|
|
695
|
+
].some((prop)=>key === prop)) return true;
|
|
696
|
+
const value = input[key];
|
|
697
|
+
if (void 0 === value) return true;
|
|
698
|
+
return false;
|
|
699
|
+
}));
|
|
657
700
|
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, {
|
|
658
701
|
method: "typia.createAssertEquals",
|
|
659
702
|
path: _path + ".compat",
|
|
@@ -669,9 +712,9 @@ const validateConfig = (()=>{
|
|
|
669
712
|
path: _path + ".customCSSInheritanceList",
|
|
670
713
|
expected: "(Array<string> | undefined)",
|
|
671
714
|
value: input.customCSSInheritanceList
|
|
672
|
-
}, _errorFactory)) && input.customCSSInheritanceList.every((elem,
|
|
715
|
+
}, _errorFactory)) && input.customCSSInheritanceList.every((elem, _index9)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
673
716
|
method: "typia.createAssertEquals",
|
|
674
|
-
path: _path + ".customCSSInheritanceList[" +
|
|
717
|
+
path: _path + ".customCSSInheritanceList[" + _index9 + "]",
|
|
675
718
|
expected: "string",
|
|
676
719
|
value: elem
|
|
677
720
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -789,6 +832,21 @@ const validateConfig = (()=>{
|
|
|
789
832
|
path: _path + ".experimental_isLazyBundle",
|
|
790
833
|
expected: "(boolean | undefined)",
|
|
791
834
|
value: input.experimental_isLazyBundle
|
|
835
|
+
}, _errorFactory)) && (null !== input.optimizeBundleSize || _assertGuard._assertGuard(_exceptionable, {
|
|
836
|
+
method: "typia.createAssertEquals",
|
|
837
|
+
path: _path + ".optimizeBundleSize",
|
|
838
|
+
expected: "(__type | boolean | undefined)",
|
|
839
|
+
value: input.optimizeBundleSize
|
|
840
|
+
}, _errorFactory)) && (void 0 === input.optimizeBundleSize || "boolean" == typeof input.optimizeBundleSize || ("object" == typeof input.optimizeBundleSize && null !== input.optimizeBundleSize && false === Array.isArray(input.optimizeBundleSize) || _assertGuard._assertGuard(_exceptionable, {
|
|
841
|
+
method: "typia.createAssertEquals",
|
|
842
|
+
path: _path + ".optimizeBundleSize",
|
|
843
|
+
expected: "(__type | boolean | undefined)",
|
|
844
|
+
value: input.optimizeBundleSize
|
|
845
|
+
}, _errorFactory)) && _ao8(input.optimizeBundleSize, _path + ".optimizeBundleSize", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
|
|
846
|
+
method: "typia.createAssertEquals",
|
|
847
|
+
path: _path + ".optimizeBundleSize",
|
|
848
|
+
expected: "(__type | boolean | undefined)",
|
|
849
|
+
value: input.optimizeBundleSize
|
|
792
850
|
}, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
|
|
793
851
|
if ([
|
|
794
852
|
"compat",
|
|
@@ -810,7 +868,8 @@ const validateConfig = (()=>{
|
|
|
810
868
|
"targetSdkVersion",
|
|
811
869
|
"globalPropsMode",
|
|
812
870
|
"extractStr",
|
|
813
|
-
"experimental_isLazyBundle"
|
|
871
|
+
"experimental_isLazyBundle",
|
|
872
|
+
"optimizeBundleSize"
|
|
814
873
|
].some((prop)=>key === prop)) return true;
|
|
815
874
|
const value = input[key];
|
|
816
875
|
if (void 0 === value) return true;
|
|
@@ -826,9 +885,9 @@ const validateConfig = (()=>{
|
|
|
826
885
|
path: _path + ".componentsPkg",
|
|
827
886
|
expected: "(Array<string> | undefined)",
|
|
828
887
|
value: input.componentsPkg
|
|
829
|
-
}, _errorFactory)) && input.componentsPkg.every((elem,
|
|
888
|
+
}, _errorFactory)) && input.componentsPkg.every((elem, _index10)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
830
889
|
method: "typia.createAssertEquals",
|
|
831
|
-
path: _path + ".componentsPkg[" +
|
|
890
|
+
path: _path + ".componentsPkg[" + _index10 + "]",
|
|
832
891
|
expected: "string",
|
|
833
892
|
value: elem
|
|
834
893
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -841,9 +900,9 @@ const validateConfig = (()=>{
|
|
|
841
900
|
path: _path + ".oldRuntimePkg",
|
|
842
901
|
expected: "(Array<string> | undefined)",
|
|
843
902
|
value: input.oldRuntimePkg
|
|
844
|
-
}, _errorFactory)) && input.oldRuntimePkg.every((elem,
|
|
903
|
+
}, _errorFactory)) && input.oldRuntimePkg.every((elem, _index11)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
845
904
|
method: "typia.createAssertEquals",
|
|
846
|
-
path: _path + ".oldRuntimePkg[" +
|
|
905
|
+
path: _path + ".oldRuntimePkg[" + _index11 + "]",
|
|
847
906
|
expected: "string",
|
|
848
907
|
value: elem
|
|
849
908
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -861,9 +920,9 @@ const validateConfig = (()=>{
|
|
|
861
920
|
path: _path + ".additionalComponentAttributes",
|
|
862
921
|
expected: "(Array<string> | undefined)",
|
|
863
922
|
value: input.additionalComponentAttributes
|
|
864
|
-
}, _errorFactory)) && input.additionalComponentAttributes.every((elem,
|
|
923
|
+
}, _errorFactory)) && input.additionalComponentAttributes.every((elem, _index12)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
865
924
|
method: "typia.createAssertEquals",
|
|
866
|
-
path: _path + ".additionalComponentAttributes[" +
|
|
925
|
+
path: _path + ".additionalComponentAttributes[" + _index12 + "]",
|
|
867
926
|
expected: "string",
|
|
868
927
|
value: elem
|
|
869
928
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -984,9 +1043,9 @@ const validateConfig = (()=>{
|
|
|
984
1043
|
path: _path + ".pkgName",
|
|
985
1044
|
expected: "(Array<string> | undefined)",
|
|
986
1045
|
value: input.pkgName
|
|
987
|
-
}, _errorFactory)) && input.pkgName.every((elem,
|
|
1046
|
+
}, _errorFactory)) && input.pkgName.every((elem, _index13)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
988
1047
|
method: "typia.createAssertEquals",
|
|
989
|
-
path: _path + ".pkgName[" +
|
|
1048
|
+
path: _path + ".pkgName[" + _index13 + "]",
|
|
990
1049
|
expected: "string",
|
|
991
1050
|
value: elem
|
|
992
1051
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -999,9 +1058,9 @@ const validateConfig = (()=>{
|
|
|
999
1058
|
path: _path + ".retainProp",
|
|
1000
1059
|
expected: "(Array<string> | undefined)",
|
|
1001
1060
|
value: input.retainProp
|
|
1002
|
-
}, _errorFactory)) && input.retainProp.every((elem,
|
|
1061
|
+
}, _errorFactory)) && input.retainProp.every((elem, _index14)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
1003
1062
|
method: "typia.createAssertEquals",
|
|
1004
|
-
path: _path + ".retainProp[" +
|
|
1063
|
+
path: _path + ".retainProp[" + _index14 + "]",
|
|
1005
1064
|
expected: "string",
|
|
1006
1065
|
value: elem
|
|
1007
1066
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -1009,14 +1068,29 @@ const validateConfig = (()=>{
|
|
|
1009
1068
|
path: _path + ".retainProp",
|
|
1010
1069
|
expected: "(Array<string> | undefined)",
|
|
1011
1070
|
value: input.retainProp
|
|
1071
|
+
}, _errorFactory)) && (void 0 === input.removeCall || (Array.isArray(input.removeCall) || _assertGuard._assertGuard(_exceptionable, {
|
|
1072
|
+
method: "typia.createAssertEquals",
|
|
1073
|
+
path: _path + ".removeCall",
|
|
1074
|
+
expected: "(Array<string> | undefined)",
|
|
1075
|
+
value: input.removeCall
|
|
1076
|
+
}, _errorFactory)) && input.removeCall.every((elem, _index15)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
1077
|
+
method: "typia.createAssertEquals",
|
|
1078
|
+
path: _path + ".removeCall[" + _index15 + "]",
|
|
1079
|
+
expected: "string",
|
|
1080
|
+
value: elem
|
|
1081
|
+
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
1082
|
+
method: "typia.createAssertEquals",
|
|
1083
|
+
path: _path + ".removeCall",
|
|
1084
|
+
expected: "(Array<string> | undefined)",
|
|
1085
|
+
value: input.removeCall
|
|
1012
1086
|
}, _errorFactory)) && (void 0 === input.removeCallParams || (Array.isArray(input.removeCallParams) || _assertGuard._assertGuard(_exceptionable, {
|
|
1013
1087
|
method: "typia.createAssertEquals",
|
|
1014
1088
|
path: _path + ".removeCallParams",
|
|
1015
1089
|
expected: "(Array<string> | undefined)",
|
|
1016
1090
|
value: input.removeCallParams
|
|
1017
|
-
}, _errorFactory)) && input.removeCallParams.every((elem,
|
|
1091
|
+
}, _errorFactory)) && input.removeCallParams.every((elem, _index16)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
|
|
1018
1092
|
method: "typia.createAssertEquals",
|
|
1019
|
-
path: _path + ".removeCallParams[" +
|
|
1093
|
+
path: _path + ".removeCallParams[" + _index16 + "]",
|
|
1020
1094
|
expected: "string",
|
|
1021
1095
|
value: elem
|
|
1022
1096
|
}, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
|
|
@@ -1028,6 +1102,7 @@ const validateConfig = (()=>{
|
|
|
1028
1102
|
if ([
|
|
1029
1103
|
"pkgName",
|
|
1030
1104
|
"retainProp",
|
|
1105
|
+
"removeCall",
|
|
1031
1106
|
"removeCallParams"
|
|
1032
1107
|
].some((prop)=>key === prop)) return true;
|
|
1033
1108
|
const value = input[key];
|
|
@@ -1090,6 +1165,30 @@ const validateConfig = (()=>{
|
|
|
1090
1165
|
value: value
|
|
1091
1166
|
}, _errorFactory);
|
|
1092
1167
|
}));
|
|
1168
|
+
const _ao8 = (input, _path, _exceptionable = true)=>(void 0 === input.mainThread || "boolean" == typeof input.mainThread || _assertGuard._assertGuard(_exceptionable, {
|
|
1169
|
+
method: "typia.createAssertEquals",
|
|
1170
|
+
path: _path + ".mainThread",
|
|
1171
|
+
expected: "(boolean | undefined)",
|
|
1172
|
+
value: input.mainThread
|
|
1173
|
+
}, _errorFactory)) && (void 0 === input.background || "boolean" == typeof input.background || _assertGuard._assertGuard(_exceptionable, {
|
|
1174
|
+
method: "typia.createAssertEquals",
|
|
1175
|
+
path: _path + ".background",
|
|
1176
|
+
expected: "(boolean | undefined)",
|
|
1177
|
+
value: input.background
|
|
1178
|
+
}, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
|
|
1179
|
+
if ([
|
|
1180
|
+
"mainThread",
|
|
1181
|
+
"background"
|
|
1182
|
+
].some((prop)=>key === prop)) return true;
|
|
1183
|
+
const value = input[key];
|
|
1184
|
+
if (void 0 === value) return true;
|
|
1185
|
+
return _assertGuard._assertGuard(_exceptionable, {
|
|
1186
|
+
method: "typia.createAssertEquals",
|
|
1187
|
+
path: _path + _accessExpressionAsString._accessExpressionAsString(key),
|
|
1188
|
+
expected: "undefined",
|
|
1189
|
+
value: value
|
|
1190
|
+
}, _errorFactory);
|
|
1191
|
+
}));
|
|
1093
1192
|
const __is = (input, _exceptionable = true)=>void 0 === input || "object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);
|
|
1094
1193
|
let _errorFactory;
|
|
1095
1194
|
return (input, errorFactory = ({ path, expected, value })=>{
|
|
@@ -1147,7 +1246,8 @@ function pluginReactLynx(userOptions) {
|
|
|
1147
1246
|
engineVersion: '',
|
|
1148
1247
|
extractStr: false,
|
|
1149
1248
|
globalPropsMode: 'reactive',
|
|
1150
|
-
experimental_isLazyBundle: false
|
|
1249
|
+
experimental_isLazyBundle: false,
|
|
1250
|
+
optimizeBundleSize: false
|
|
1151
1251
|
};
|
|
1152
1252
|
const resolvedOptions = Object.assign(defaultOptions, userOptions, {
|
|
1153
1253
|
targetSdkVersion: engineVersion,
|
|
@@ -1209,6 +1309,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1209
1309
|
}, config);
|
|
1210
1310
|
return config;
|
|
1211
1311
|
});
|
|
1312
|
+
if (resolvedOptions.optimizeBundleSize) applyOptimizeBundleSize(api, resolvedOptions);
|
|
1212
1313
|
if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
|
|
1213
1314
|
api.expose(Symbol.for('LAYERS'), LAYERS);
|
|
1214
1315
|
api.expose(Symbol.for('LynxTemplatePlugin'), {
|
package/dist/index.d.ts
CHANGED
|
@@ -446,6 +446,8 @@ export declare interface PluginReactLynxOptions {
|
|
|
446
446
|
* @remarks
|
|
447
447
|
*
|
|
448
448
|
* These options should only be used for migrating from ReactLynx2.0.
|
|
449
|
+
*
|
|
450
|
+
* @defaultValue `undefined`
|
|
449
451
|
*/
|
|
450
452
|
compat?: Partial<CompatVisitorConfig> & {
|
|
451
453
|
/**
|
|
@@ -484,6 +486,8 @@ export declare interface PluginReactLynxOptions {
|
|
|
484
486
|
* ],
|
|
485
487
|
* }
|
|
486
488
|
* ```
|
|
489
|
+
*
|
|
490
|
+
* @defaultValue `undefined`
|
|
487
491
|
*/
|
|
488
492
|
customCSSInheritanceList?: string[] | undefined;
|
|
489
493
|
/**
|
|
@@ -492,19 +496,23 @@ export declare interface PluginReactLynxOptions {
|
|
|
492
496
|
* @remarks
|
|
493
497
|
* This is recommended to be set to true to reduce template size.
|
|
494
498
|
*
|
|
499
|
+
* @defaultValue `true`
|
|
500
|
+
*
|
|
495
501
|
* @public
|
|
496
502
|
*/
|
|
497
503
|
debugInfoOutside?: boolean;
|
|
498
504
|
/**
|
|
499
505
|
* defaultDisplayLinear controls whether the default value of `display` in CSS is `linear`.
|
|
500
506
|
*
|
|
501
|
-
* @remarks
|
|
502
|
-
*
|
|
503
507
|
* If `defaultDisplayLinear === false`, the default `display` would be `flex` instead of `linear`.
|
|
508
|
+
*
|
|
509
|
+
* @defaultValue `true`
|
|
504
510
|
*/
|
|
505
511
|
defaultDisplayLinear?: boolean;
|
|
506
512
|
/**
|
|
507
513
|
* enableAccessibilityElement set the default value of `accessibility-element` for all `<view />` elements.
|
|
514
|
+
*
|
|
515
|
+
* @defaultValue `false`
|
|
508
516
|
*/
|
|
509
517
|
enableAccessibilityElement?: boolean;
|
|
510
518
|
/**
|
|
@@ -539,6 +547,8 @@ export declare interface PluginReactLynxOptions {
|
|
|
539
547
|
* - `text-shadow`
|
|
540
548
|
*
|
|
541
549
|
* It is recommended to use with {@link PluginReactLynxOptions.customCSSInheritanceList} to avoid performance issues.
|
|
550
|
+
*
|
|
551
|
+
* @defaultValue `false`
|
|
542
552
|
*/
|
|
543
553
|
enableCSSInheritance?: boolean;
|
|
544
554
|
/**
|
|
@@ -554,11 +564,15 @@ export declare interface PluginReactLynxOptions {
|
|
|
554
564
|
*
|
|
555
565
|
* We find that collecting invalidation nodes and updating them is a relatively time-consuming process.
|
|
556
566
|
* If there is no such usage and better style matching performance is needed, this feature can be selectively disabled.
|
|
567
|
+
*
|
|
568
|
+
* @defaultValue `true`
|
|
557
569
|
*/
|
|
558
570
|
enableCSSInvalidation?: boolean;
|
|
559
571
|
/**
|
|
560
572
|
* enableCSSSelector controls whether enabling the new CSS implementation.
|
|
561
573
|
*
|
|
574
|
+
* @defaultValue `true`
|
|
575
|
+
*
|
|
562
576
|
* @public
|
|
563
577
|
*/
|
|
564
578
|
enableCSSSelector?: boolean;
|
|
@@ -607,25 +621,35 @@ export declare interface PluginReactLynxOptions {
|
|
|
607
621
|
enableSSR?: boolean;
|
|
608
622
|
/**
|
|
609
623
|
* removeDescendantSelectorScope is used to remove the scope of descendant selectors.
|
|
624
|
+
*
|
|
625
|
+
* @defaultValue `true`
|
|
610
626
|
*/
|
|
611
627
|
removeDescendantSelectorScope?: boolean;
|
|
612
628
|
/**
|
|
613
629
|
* How main-thread code will be shaken.
|
|
630
|
+
*
|
|
631
|
+
* @defaultValue `undefined`
|
|
614
632
|
*/
|
|
615
633
|
shake?: Partial<ShakeVisitorConfig> | undefined;
|
|
616
634
|
/**
|
|
617
635
|
* Like `define` in various bundlers, but this one happens at transform time, and a DCE pass will be performed.
|
|
636
|
+
*
|
|
637
|
+
* @defaultValue `undefined`
|
|
618
638
|
*/
|
|
619
639
|
defineDCE?: Partial<DefineDceVisitorConfig> | undefined;
|
|
620
640
|
/**
|
|
621
641
|
* `engineVersion` specifies the minimum Lynx Engine version required for an App bundle to function properly.
|
|
622
642
|
*
|
|
643
|
+
* @defaultValue `'3.2'`
|
|
644
|
+
*
|
|
623
645
|
* @public
|
|
624
646
|
*/
|
|
625
647
|
engineVersion?: string;
|
|
626
648
|
/**
|
|
627
649
|
* targetSdkVersion is used to specify the minimal Lynx Engine version that a App bundle can run on.
|
|
628
650
|
*
|
|
651
|
+
* @defaultValue `'3.2'`
|
|
652
|
+
*
|
|
629
653
|
* @public
|
|
630
654
|
* @deprecated `targetSdkVersion` is now an alias of {@link PluginReactLynxOptions.engineVersion}. Use {@link PluginReactLynxOptions.engineVersion} instead.
|
|
631
655
|
*/
|
|
@@ -640,6 +664,7 @@ export declare interface PluginReactLynxOptions {
|
|
|
640
664
|
* `'event'`: `UpdateGlobalProps` will trigger global event and users need to trigger update in the event handler.
|
|
641
665
|
*
|
|
642
666
|
* @defaultValue `'reactive'`
|
|
667
|
+
* @public
|
|
643
668
|
*/
|
|
644
669
|
globalPropsMode?: 'reactive' | 'event';
|
|
645
670
|
/**
|
|
@@ -652,9 +677,24 @@ export declare interface PluginReactLynxOptions {
|
|
|
652
677
|
/**
|
|
653
678
|
* Generate standalone lazy bundle.
|
|
654
679
|
*
|
|
680
|
+
* @defaultValue `false`
|
|
681
|
+
*
|
|
655
682
|
* @alpha
|
|
656
683
|
*/
|
|
657
684
|
experimental_isLazyBundle?: boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Optimize bundle size by removing unused code by Minify.mainThreadOptions and Minify.backgroundOptions.
|
|
687
|
+
*
|
|
688
|
+
* When optimizeBundleSize or optimizeBundleSize.mainThread is true, main-thread code will be optimized.
|
|
689
|
+
* When optimizeBundleSize or optimizeBundleSize.background is true, background code will be optimized.
|
|
690
|
+
*
|
|
691
|
+
* @defaultValue `false`
|
|
692
|
+
* @public
|
|
693
|
+
*/
|
|
694
|
+
optimizeBundleSize?: boolean | {
|
|
695
|
+
mainThread?: boolean;
|
|
696
|
+
background?: boolean;
|
|
697
|
+
};
|
|
658
698
|
}
|
|
659
699
|
|
|
660
700
|
/**
|
|
@@ -713,6 +753,32 @@ export declare interface ShakeVisitorConfig {
|
|
|
713
753
|
* @public
|
|
714
754
|
*/
|
|
715
755
|
retainProp: Array<string>
|
|
756
|
+
/**
|
|
757
|
+
* Function names whose calls should be replaced with `undefined` during transformation
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```js
|
|
761
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
762
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
763
|
+
*
|
|
764
|
+
* export default defineConfig({
|
|
765
|
+
* plugins: [
|
|
766
|
+
* pluginReactLynx({
|
|
767
|
+
* shake: {
|
|
768
|
+
* removeCall: ['useMyCustomEffect']
|
|
769
|
+
* }
|
|
770
|
+
* })
|
|
771
|
+
* ]
|
|
772
|
+
* })
|
|
773
|
+
* ```
|
|
774
|
+
*
|
|
775
|
+
* @remarks
|
|
776
|
+
* Default value: `['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']`
|
|
777
|
+
* The provided values will be merged with the default values instead of replacing them.
|
|
778
|
+
*
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
781
|
+
removeCall: Array<string>
|
|
716
782
|
/**
|
|
717
783
|
* Function names whose parameters should be removed during transformation
|
|
718
784
|
*
|
|
@@ -733,7 +799,7 @@ export declare interface ShakeVisitorConfig {
|
|
|
733
799
|
* ```
|
|
734
800
|
*
|
|
735
801
|
* @remarks
|
|
736
|
-
* Default value: `[
|
|
802
|
+
* Default value: `[]`
|
|
737
803
|
* The provided values will be merged with the default values instead of replacing them.
|
|
738
804
|
*
|
|
739
805
|
* @public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@lynx-js/css-extract-webpack-plugin": "0.7.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "0.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.15.0",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "0.3.5",
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "0.
|
|
38
|
+
"@lynx-js/react-webpack-plugin": "0.9.0",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
|
|
40
|
-
"@lynx-js/template-webpack-plugin": "0.10.
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "0.10.8",
|
|
41
41
|
"@lynx-js/use-sync-external-store": "1.5.0",
|
|
42
42
|
"background-only": "^0.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "7.
|
|
45
|
+
"@microsoft/api-extractor": "7.58.2",
|
|
46
46
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
47
|
-
"@rsbuild/core": "1.7.
|
|
47
|
+
"@rsbuild/core": "1.7.5",
|
|
48
48
|
"@rsbuild/plugin-sass": "1.5.0",
|
|
49
49
|
"@rsbuild/plugin-typed-css-modules": "1.2.2",
|
|
50
50
|
"rsbuild-plugin-arethetypeswrong": "0.2.0",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"type-fest": "^5.4.4",
|
|
55
55
|
"typia": "10.1.0",
|
|
56
56
|
"typia-rspack-plugin": "2.2.2",
|
|
57
|
-
"@lynx-js/config-rsbuild-plugin": "0.0.
|
|
58
|
-
"@lynx-js/react": "0.
|
|
57
|
+
"@lynx-js/config-rsbuild-plugin": "0.0.2",
|
|
58
|
+
"@lynx-js/react": "0.118.0",
|
|
59
59
|
"@lynx-js/react-transform": "0.2.0",
|
|
60
|
-
"@lynx-js/rspeedy": "0.
|
|
60
|
+
"@lynx-js/rspeedy": "0.14.1",
|
|
61
61
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
62
62
|
},
|
|
63
63
|
"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"
|
|
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 || ^0.118.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@lynx-js/react": {
|