@lynx-js/react-rsbuild-plugin 0.10.7 → 0.10.9
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 +32 -0
- package/dist/index.js +26 -7
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.10.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Be compat with `@lynx-js/react` v0.112.0 ([#1323](https://github.com/lynx-family/lynx-stack/pull/1323))
|
|
8
|
+
|
|
9
|
+
- Fix not having profile in development by default. ([#1306](https://github.com/lynx-family/lynx-stack/pull/1306))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`fcafd54`](https://github.com/lynx-family/lynx-stack/commit/fcafd541c535f354476cf439b8ba97b00530aa52), [`fe38de5`](https://github.com/lynx-family/lynx-stack/commit/fe38de505b87b768035e3a833bdf8415dc4023ac), [`7cd5ea2`](https://github.com/lynx-family/lynx-stack/commit/7cd5ea2cebf12aa982ddc048dec4c5c7ed6bc1d6)]:
|
|
12
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.9
|
|
13
|
+
- @lynx-js/react-webpack-plugin@0.6.19
|
|
14
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
15
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
16
|
+
|
|
17
|
+
## 0.10.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Fix "TypeError: cannot read property 'call' of undefined" error during HMR updates. ([#1304](https://github.com/lynx-family/lynx-stack/pull/1304))
|
|
22
|
+
|
|
23
|
+
- Supports extractStr for large JSON ([#1230](https://github.com/lynx-family/lynx-stack/pull/1230))
|
|
24
|
+
|
|
25
|
+
- Change `extractStr` to `false` when `performance.chunkSplit.strategy` is not `all-in-one`. ([#1251](https://github.com/lynx-family/lynx-stack/pull/1251))
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`cb7feb6`](https://github.com/lynx-family/lynx-stack/commit/cb7feb6e8cc9f4b83ac3147bd3e5a82059caa06a), [`ec7228f`](https://github.com/lynx-family/lynx-stack/commit/ec7228fadfb917a1f6149aca4775386badae73fa)]:
|
|
28
|
+
- @lynx-js/template-webpack-plugin@0.8.2
|
|
29
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.8
|
|
30
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
31
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
32
|
+
- @lynx-js/react-webpack-plugin@0.6.18
|
|
33
|
+
- @lynx-js/css-extract-webpack-plugin@0.6.0
|
|
34
|
+
|
|
3
35
|
## 0.10.7
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -287,8 +287,8 @@ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
|
|
|
287
287
|
const DEFAULT_FILENAME_HASH = '.[contenthash:8]';
|
|
288
288
|
const EMPTY_HASH = '';
|
|
289
289
|
function applyEntry(api, options) {
|
|
290
|
-
const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, extractStr, experimental_isLazyBundle } = options;
|
|
291
|
-
const { config } = api.useExposed(Symbol.for('rspeedy.api'));
|
|
290
|
+
const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, extractStr: originalExtractStr, experimental_isLazyBundle } = options;
|
|
291
|
+
const { config, logger } = api.useExposed(Symbol.for('rspeedy.api'));
|
|
292
292
|
api.modifyBundlerChain((chain, { environment, isDev, isProd })=>{
|
|
293
293
|
const entries = chain.entryPoints.entries() ?? {};
|
|
294
294
|
const isLynx = 'lynx' === environment.name;
|
|
@@ -390,6 +390,12 @@ function applyEntry(api, options) {
|
|
|
390
390
|
}
|
|
391
391
|
if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
|
|
392
392
|
const rsbuildConfig = api.getRsbuildConfig();
|
|
393
|
+
const userConfig = api.getRsbuildConfig('original');
|
|
394
|
+
let extractStr = originalExtractStr;
|
|
395
|
+
if (rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one' && originalExtractStr) {
|
|
396
|
+
logger.warn('`extractStr` is changed to `false` because it is only supported in `all-in-one` chunkSplit strategy, please set `performance.chunkSplit.strategy` to `all-in-one` to use `extractStr.`');
|
|
397
|
+
extractStr = false;
|
|
398
|
+
}
|
|
393
399
|
chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
|
|
394
400
|
{
|
|
395
401
|
disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
|
|
@@ -398,11 +404,23 @@ function applyEntry(api, options) {
|
|
|
398
404
|
mainThreadChunks,
|
|
399
405
|
extractStr,
|
|
400
406
|
experimental_isLazyBundle,
|
|
401
|
-
profile:
|
|
407
|
+
profile: getDefaultProfile()
|
|
402
408
|
}
|
|
403
409
|
]);
|
|
410
|
+
function getDefaultProfile() {
|
|
411
|
+
if (userConfig.performance?.profile !== void 0) return userConfig.performance.profile;
|
|
412
|
+
if (isDebug()) return true;
|
|
413
|
+
}
|
|
404
414
|
});
|
|
405
415
|
}
|
|
416
|
+
const isDebug = ()=>{
|
|
417
|
+
if (!process.env['DEBUG']) return false;
|
|
418
|
+
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
419
|
+
return [
|
|
420
|
+
'rspeedy',
|
|
421
|
+
'*'
|
|
422
|
+
].some((key)=>values.includes(key));
|
|
423
|
+
};
|
|
406
424
|
function getChunks(entryName, entryValue) {
|
|
407
425
|
const chunks = [
|
|
408
426
|
entryName
|
|
@@ -439,13 +457,14 @@ function getHash(config, isProd, experimental_isLazyBundle) {
|
|
|
439
457
|
if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
|
|
440
458
|
return EMPTY_HASH;
|
|
441
459
|
}
|
|
442
|
-
function applyGenerator(api) {
|
|
460
|
+
function applyGenerator(api, options) {
|
|
443
461
|
api.modifyBundlerChain({
|
|
444
462
|
order: 'pre',
|
|
445
463
|
handler: (chain)=>{
|
|
446
|
-
chain.module.rule(
|
|
464
|
+
const rule = chain.module.rule("react:json-parse").test(/\.json$/).type('json').generator({
|
|
447
465
|
JSONParse: false
|
|
448
466
|
});
|
|
467
|
+
if (!options.extractStr) rule.issuerLayer(LAYERS.MAIN_THREAD);
|
|
449
468
|
}
|
|
450
469
|
});
|
|
451
470
|
}
|
|
@@ -513,7 +532,7 @@ function applyRefresh(api) {
|
|
|
513
532
|
});
|
|
514
533
|
}
|
|
515
534
|
function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) {
|
|
516
|
-
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').
|
|
535
|
+
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
|
|
517
536
|
}
|
|
518
537
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
519
538
|
const applySplitChunksRule = (api)=>{
|
|
@@ -1211,7 +1230,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1211
1230
|
applyCSS(api, resolvedOptions);
|
|
1212
1231
|
applyEntry(api, resolvedOptions);
|
|
1213
1232
|
applyBackgroundOnly(api);
|
|
1214
|
-
applyGenerator(api);
|
|
1233
|
+
applyGenerator(api, resolvedOptions);
|
|
1215
1234
|
applyLoaders(api, resolvedOptions);
|
|
1216
1235
|
applyRefresh(api);
|
|
1217
1236
|
applySplitChunksRule(api);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
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.6.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "0.10.7",
|
|
37
36
|
"@lynx-js/react-refresh-webpack-plugin": "0.3.4",
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "0.6.
|
|
37
|
+
"@lynx-js/react-webpack-plugin": "0.6.19",
|
|
38
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.10.9",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "0.1.2",
|
|
40
|
-
"@lynx-js/template-webpack-plugin": "0.8.
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "0.8.2",
|
|
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.52.8",
|
|
46
46
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
47
|
-
"@rsbuild/core": "1.4.
|
|
47
|
+
"@rsbuild/core": "1.4.7",
|
|
48
48
|
"@rsbuild/plugin-sass": "1.3.3",
|
|
49
49
|
"@rsbuild/plugin-typed-css-modules": "1.0.2",
|
|
50
50
|
"@rsbuild/plugin-webpack-swc": "1.1.1",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"type-fest": "^4.41.0",
|
|
55
55
|
"typia": "9.3.1",
|
|
56
56
|
"typia-rspack-plugin": "2.1.0",
|
|
57
|
-
"@lynx-js/react": "0.
|
|
57
|
+
"@lynx-js/react": "0.112.0",
|
|
58
58
|
"@lynx-js/react-transform": "0.2.0",
|
|
59
|
-
"@lynx-js/rspeedy": "0.10.
|
|
59
|
+
"@lynx-js/rspeedy": "0.10.3",
|
|
60
60
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@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"
|
|
63
|
+
"@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"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"@lynx-js/react": {
|