@lynx-js/react-rsbuild-plugin 0.12.10 → 0.14.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 +46 -0
- package/dist/208.js +103 -10
- package/dist/index.d.ts +26 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: support `optimizeBundleSize` option to remove unused code for main-thread and background. ([#2336](https://github.com/lynx-family/lynx-stack/pull/2336))
|
|
8
|
+
|
|
9
|
+
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.background` is `true`, `lynx.registerDataProcessors` calls will be marked as pure for the background thread output.
|
|
10
|
+
- 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.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- refactor: remove `modifyWebpackChain` since Rsbuild 2.0 dropped webpack support ([#2397](https://github.com/lynx-family/lynx-stack/pull/2397))
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`9193711`](https://github.com/lynx-family/lynx-stack/commit/919371167f4136f2ee975075d8e73d2986b20a8f)]:
|
|
17
|
+
- @lynx-js/template-webpack-plugin@0.10.7
|
|
18
|
+
- @lynx-js/css-extract-webpack-plugin@0.7.0
|
|
19
|
+
- @lynx-js/react-webpack-plugin@0.8.0
|
|
20
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.14.0
|
|
21
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
22
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.5
|
|
23
|
+
|
|
24
|
+
## 0.13.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- **BREAKING CHANGE**: ([#2319](https://github.com/lynx-family/lynx-stack/pull/2319))
|
|
29
|
+
|
|
30
|
+
Change preact package from `@hongzhiyuan/preact` to `@lynx-js/internal-preact`.
|
|
31
|
+
|
|
32
|
+
Upgrade preact from [f7693b72](https://github.com/preactjs/preact/commit/f7693b72ecb4a40c66e6e47f54e2d4edc374c9f0) to [55254ef7](https://github.com/preactjs/preact/commit/55254ef7021e563cc1a86fb816058964a1b6a29a), see diffs at [f7693b72...55254ef7](https://github.com/preactjs/preact/compare/f7693b72ecb4a40c66e6e47f54e2d4edc374c9f0...preactjs:preact:55254ef7021e563cc1a86fb816058964a1b6a29a?expand=1).
|
|
33
|
+
|
|
34
|
+
- feat: add `globalPropsMode` option to `PluginReactLynxOptions` ([#2346](https://github.com/lynx-family/lynx-stack/pull/2346))
|
|
35
|
+
|
|
36
|
+
- When configured to `"event"`, `updateGlobalProps` will only trigger a global event and skip the `runWithForce` flow.
|
|
37
|
+
- Defaults to `"reactive"`, which means `updateGlobalProps` will trigger re-render automatically.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`f1129ea`](https://github.com/lynx-family/lynx-stack/commit/f1129ea0a84096354a86bc3436c7b0efc109d768), [`27f1cff`](https://github.com/lynx-family/lynx-stack/commit/27f1cffbea99585b547aff669b8e230533987036), [`ed566f0`](https://github.com/lynx-family/lynx-stack/commit/ed566f0fe6a14ffae59d21bd2c5e5dd2755f28a4), [`402ec2b`](https://github.com/lynx-family/lynx-stack/commit/402ec2b34bce286181493e171f95e6a4257a1907)]:
|
|
42
|
+
- @lynx-js/react-webpack-plugin@0.8.0
|
|
43
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.5
|
|
44
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.13.0
|
|
45
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
46
|
+
- @lynx-js/template-webpack-plugin@0.10.6
|
|
47
|
+
- @lynx-js/css-extract-webpack-plugin@0.7.0
|
|
48
|
+
|
|
3
49
|
## 0.12.10
|
|
4
50
|
|
|
5
51
|
### Patch 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;
|
|
@@ -199,7 +199,7 @@ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
|
|
|
199
199
|
const DEFAULT_FILENAME_HASH = '.[contenthash:8]';
|
|
200
200
|
const EMPTY_HASH = '';
|
|
201
201
|
function applyEntry(api, options) {
|
|
202
|
-
const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, removeDescendantSelectorScope, targetSdkVersion, extractStr: originalExtractStr, experimental_isLazyBundle } = options;
|
|
202
|
+
const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableRemoveCSSScope, firstScreenSyncTiming, globalPropsMode, enableSSR, removeDescendantSelectorScope, targetSdkVersion, extractStr: originalExtractStr, experimental_isLazyBundle } = options;
|
|
203
203
|
api.modifyBundlerChain(async (chain, { environment, isDev, isProd })=>{
|
|
204
204
|
const mainThreadChunks = [];
|
|
205
205
|
const rsbuildConfig = api.getRsbuildConfig();
|
|
@@ -315,6 +315,7 @@ function applyEntry(api, options) {
|
|
|
315
315
|
{
|
|
316
316
|
disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
|
|
317
317
|
firstScreenSyncTiming,
|
|
318
|
+
globalPropsMode,
|
|
318
319
|
enableSSR,
|
|
319
320
|
mainThreadChunks,
|
|
320
321
|
extractStr,
|
|
@@ -442,11 +443,43 @@ function applyNodeEnv(api) {
|
|
|
442
443
|
}
|
|
443
444
|
}));
|
|
444
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
|
+
}
|
|
445
481
|
const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
|
|
446
482
|
function applyRefresh(api) {
|
|
447
|
-
api.modifyWebpackChain(async (chain, { CHAIN_ID, isProd })=>{
|
|
448
|
-
if (!isProd) await applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshWebpackPlugin);
|
|
449
|
-
});
|
|
450
483
|
api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID })=>{
|
|
451
484
|
if (!isProd) {
|
|
452
485
|
const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
|
|
@@ -489,7 +522,7 @@ const applySplitChunksRule = (api)=>{
|
|
|
489
522
|
const extraGroups = {};
|
|
490
523
|
extraGroups['preact'] = {
|
|
491
524
|
name: 'lib-preact',
|
|
492
|
-
test: /node_modules[\\/](.*?[\\/])?(?:preact|preact[\\/]compat|preact[\\/]hooks|preact[\\/]jsx-runtime)[\\/]/,
|
|
525
|
+
test: /node_modules[\\/](.*?[\\/])?(?:(?:internal-)?preact|(?:internal-)?preact[\\/]compat|(?:internal-)?preact[\\/]hooks|(?:internal-)?preact[\\/]jsx-runtime)[\\/]/,
|
|
493
526
|
priority: 0
|
|
494
527
|
};
|
|
495
528
|
chain.optimization.splitChunks({
|
|
@@ -562,7 +595,7 @@ function applyUseSyncExternalStore(api) {
|
|
|
562
595
|
const _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js");
|
|
563
596
|
const _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
|
|
564
597
|
const validateConfig = (()=>{
|
|
565
|
-
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) && 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)=>{
|
|
566
599
|
if ([
|
|
567
600
|
"compat",
|
|
568
601
|
"customCSSInheritanceList",
|
|
@@ -581,8 +614,10 @@ const validateConfig = (()=>{
|
|
|
581
614
|
"defineDCE",
|
|
582
615
|
"engineVersion",
|
|
583
616
|
"targetSdkVersion",
|
|
617
|
+
"globalPropsMode",
|
|
584
618
|
"extractStr",
|
|
585
|
-
"experimental_isLazyBundle"
|
|
619
|
+
"experimental_isLazyBundle",
|
|
620
|
+
"optimizeBundleSize"
|
|
586
621
|
].some((prop)=>key === prop)) return true;
|
|
587
622
|
const value = input[key];
|
|
588
623
|
if (void 0 === value) return true;
|
|
@@ -652,6 +687,15 @@ const validateConfig = (()=>{
|
|
|
652
687
|
if (void 0 === value) return true;
|
|
653
688
|
return false;
|
|
654
689
|
}));
|
|
690
|
+
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)=>{
|
|
691
|
+
if ([
|
|
692
|
+
"mainThread",
|
|
693
|
+
"background"
|
|
694
|
+
].some((prop)=>key === prop)) return true;
|
|
695
|
+
const value = input[key];
|
|
696
|
+
if (void 0 === value) return true;
|
|
697
|
+
return false;
|
|
698
|
+
}));
|
|
655
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, {
|
|
656
700
|
method: "typia.createAssertEquals",
|
|
657
701
|
path: _path + ".compat",
|
|
@@ -762,6 +806,11 @@ const validateConfig = (()=>{
|
|
|
762
806
|
path: _path + ".targetSdkVersion",
|
|
763
807
|
expected: "(string | undefined)",
|
|
764
808
|
value: input.targetSdkVersion
|
|
809
|
+
}, _errorFactory)) && (void 0 === input.globalPropsMode || "reactive" === input.globalPropsMode || "event" === input.globalPropsMode || _assertGuard._assertGuard(_exceptionable, {
|
|
810
|
+
method: "typia.createAssertEquals",
|
|
811
|
+
path: _path + ".globalPropsMode",
|
|
812
|
+
expected: "(\"event\" | \"reactive\" | undefined)",
|
|
813
|
+
value: input.globalPropsMode
|
|
765
814
|
}, _errorFactory)) && (null !== input.extractStr || _assertGuard._assertGuard(_exceptionable, {
|
|
766
815
|
method: "typia.createAssertEquals",
|
|
767
816
|
path: _path + ".extractStr",
|
|
@@ -782,6 +831,21 @@ const validateConfig = (()=>{
|
|
|
782
831
|
path: _path + ".experimental_isLazyBundle",
|
|
783
832
|
expected: "(boolean | undefined)",
|
|
784
833
|
value: input.experimental_isLazyBundle
|
|
834
|
+
}, _errorFactory)) && (null !== input.optimizeBundleSize || _assertGuard._assertGuard(_exceptionable, {
|
|
835
|
+
method: "typia.createAssertEquals",
|
|
836
|
+
path: _path + ".optimizeBundleSize",
|
|
837
|
+
expected: "(__type | boolean | undefined)",
|
|
838
|
+
value: input.optimizeBundleSize
|
|
839
|
+
}, _errorFactory)) && (void 0 === input.optimizeBundleSize || "boolean" == typeof input.optimizeBundleSize || ("object" == typeof input.optimizeBundleSize && null !== input.optimizeBundleSize && false === Array.isArray(input.optimizeBundleSize) || _assertGuard._assertGuard(_exceptionable, {
|
|
840
|
+
method: "typia.createAssertEquals",
|
|
841
|
+
path: _path + ".optimizeBundleSize",
|
|
842
|
+
expected: "(__type | boolean | undefined)",
|
|
843
|
+
value: input.optimizeBundleSize
|
|
844
|
+
}, _errorFactory)) && _ao8(input.optimizeBundleSize, _path + ".optimizeBundleSize", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
|
|
845
|
+
method: "typia.createAssertEquals",
|
|
846
|
+
path: _path + ".optimizeBundleSize",
|
|
847
|
+
expected: "(__type | boolean | undefined)",
|
|
848
|
+
value: input.optimizeBundleSize
|
|
785
849
|
}, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
|
|
786
850
|
if ([
|
|
787
851
|
"compat",
|
|
@@ -801,8 +865,10 @@ const validateConfig = (()=>{
|
|
|
801
865
|
"defineDCE",
|
|
802
866
|
"engineVersion",
|
|
803
867
|
"targetSdkVersion",
|
|
868
|
+
"globalPropsMode",
|
|
804
869
|
"extractStr",
|
|
805
|
-
"experimental_isLazyBundle"
|
|
870
|
+
"experimental_isLazyBundle",
|
|
871
|
+
"optimizeBundleSize"
|
|
806
872
|
].some((prop)=>key === prop)) return true;
|
|
807
873
|
const value = input[key];
|
|
808
874
|
if (void 0 === value) return true;
|
|
@@ -1082,6 +1148,30 @@ const validateConfig = (()=>{
|
|
|
1082
1148
|
value: value
|
|
1083
1149
|
}, _errorFactory);
|
|
1084
1150
|
}));
|
|
1151
|
+
const _ao8 = (input, _path, _exceptionable = true)=>(void 0 === input.mainThread || "boolean" == typeof input.mainThread || _assertGuard._assertGuard(_exceptionable, {
|
|
1152
|
+
method: "typia.createAssertEquals",
|
|
1153
|
+
path: _path + ".mainThread",
|
|
1154
|
+
expected: "(boolean | undefined)",
|
|
1155
|
+
value: input.mainThread
|
|
1156
|
+
}, _errorFactory)) && (void 0 === input.background || "boolean" == typeof input.background || _assertGuard._assertGuard(_exceptionable, {
|
|
1157
|
+
method: "typia.createAssertEquals",
|
|
1158
|
+
path: _path + ".background",
|
|
1159
|
+
expected: "(boolean | undefined)",
|
|
1160
|
+
value: input.background
|
|
1161
|
+
}, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
|
|
1162
|
+
if ([
|
|
1163
|
+
"mainThread",
|
|
1164
|
+
"background"
|
|
1165
|
+
].some((prop)=>key === prop)) return true;
|
|
1166
|
+
const value = input[key];
|
|
1167
|
+
if (void 0 === value) return true;
|
|
1168
|
+
return _assertGuard._assertGuard(_exceptionable, {
|
|
1169
|
+
method: "typia.createAssertEquals",
|
|
1170
|
+
path: _path + _accessExpressionAsString._accessExpressionAsString(key),
|
|
1171
|
+
expected: "undefined",
|
|
1172
|
+
value: value
|
|
1173
|
+
}, _errorFactory);
|
|
1174
|
+
}));
|
|
1085
1175
|
const __is = (input, _exceptionable = true)=>void 0 === input || "object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);
|
|
1086
1176
|
let _errorFactory;
|
|
1087
1177
|
return (input, errorFactory = ({ path, expected, value })=>{
|
|
@@ -1138,7 +1228,9 @@ function pluginReactLynx(userOptions) {
|
|
|
1138
1228
|
targetSdkVersion: '',
|
|
1139
1229
|
engineVersion: '',
|
|
1140
1230
|
extractStr: false,
|
|
1141
|
-
|
|
1231
|
+
globalPropsMode: 'reactive',
|
|
1232
|
+
experimental_isLazyBundle: false,
|
|
1233
|
+
optimizeBundleSize: false
|
|
1142
1234
|
};
|
|
1143
1235
|
const resolvedOptions = Object.assign(defaultOptions, userOptions, {
|
|
1144
1236
|
targetSdkVersion: engineVersion,
|
|
@@ -1200,6 +1292,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1200
1292
|
}, config);
|
|
1201
1293
|
return config;
|
|
1202
1294
|
});
|
|
1295
|
+
if (resolvedOptions.optimizeBundleSize) applyOptimizeBundleSize(api, resolvedOptions);
|
|
1203
1296
|
if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
|
|
1204
1297
|
api.expose(Symbol.for('LAYERS'), LAYERS);
|
|
1205
1298
|
api.expose(Symbol.for('LynxTemplatePlugin'), {
|
package/dist/index.d.ts
CHANGED
|
@@ -630,6 +630,19 @@ export declare interface PluginReactLynxOptions {
|
|
|
630
630
|
* @deprecated `targetSdkVersion` is now an alias of {@link PluginReactLynxOptions.engineVersion}. Use {@link PluginReactLynxOptions.engineVersion} instead.
|
|
631
631
|
*/
|
|
632
632
|
targetSdkVersion?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Configure the update mode of `lynx.__globalProps`.
|
|
635
|
+
*
|
|
636
|
+
* This flag has two options:
|
|
637
|
+
*
|
|
638
|
+
* `'reactive'`: `UpdateGlobalProps` will trigger update automatically.
|
|
639
|
+
*
|
|
640
|
+
* `'event'`: `UpdateGlobalProps` will trigger global event and users need to trigger update in the event handler.
|
|
641
|
+
*
|
|
642
|
+
* @defaultValue `'reactive'`
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
globalPropsMode?: 'reactive' | 'event';
|
|
633
646
|
/**
|
|
634
647
|
* Merge same string literals in JS and Lepus to reduce output bundle size.
|
|
635
648
|
* Set to `false` to disable.
|
|
@@ -643,6 +656,19 @@ export declare interface PluginReactLynxOptions {
|
|
|
643
656
|
* @alpha
|
|
644
657
|
*/
|
|
645
658
|
experimental_isLazyBundle?: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* Optimize bundle size by removing unused code by Minify.mainThreadOptions and Minify.backgroundOptions.
|
|
661
|
+
*
|
|
662
|
+
* When optimizeBundleSize or optimizeBundleSize.mainThread is true, main-thread code will be optimized.
|
|
663
|
+
* When optimizeBundleSize or optimizeBundleSize.background is true, background code will be optimized.
|
|
664
|
+
*
|
|
665
|
+
* @defaultValue `false`
|
|
666
|
+
* @public
|
|
667
|
+
*/
|
|
668
|
+
optimizeBundleSize?: boolean | {
|
|
669
|
+
mainThread?: boolean;
|
|
670
|
+
background?: boolean;
|
|
671
|
+
};
|
|
646
672
|
}
|
|
647
673
|
|
|
648
674
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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.
|
|
37
|
-
"@lynx-js/react-refresh-webpack-plugin": "0.3.
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "0.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.14.0",
|
|
37
|
+
"@lynx-js/react-refresh-webpack-plugin": "0.3.5",
|
|
38
|
+
"@lynx-js/react-webpack-plugin": "0.8.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.7",
|
|
41
41
|
"@lynx-js/use-sync-external-store": "1.5.0",
|
|
42
42
|
"background-only": "^0.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "7.57.6",
|
|
46
46
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
47
|
-
"@rsbuild/core": "1.7.
|
|
47
|
+
"@rsbuild/core": "1.7.4",
|
|
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",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"typia": "10.1.0",
|
|
56
56
|
"typia-rspack-plugin": "2.2.2",
|
|
57
57
|
"@lynx-js/config-rsbuild-plugin": "0.0.1",
|
|
58
|
-
"@lynx-js/react": "0.
|
|
58
|
+
"@lynx-js/react": "0.117.1",
|
|
59
59
|
"@lynx-js/react-transform": "0.2.0",
|
|
60
|
-
"@lynx-js/rspeedy": "0.
|
|
60
|
+
"@lynx-js/rspeedy": "0.14.0",
|
|
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"
|
|
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
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@lynx-js/react": {
|