@lynx-js/react-rsbuild-plugin-canary 0.17.2 → 0.17.3-canary-20260706-db543ea9
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 +56 -52
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.17.3-canary-20260706063705-db543ea9be725eb343cd6c2c4b0fc0785ab6a3d1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/template-webpack-plugin@0.12.3-canary-20260706063705-db543ea9be725eb343cd6c2c4b0fc0785ab6a3d1
|
|
9
|
+
- @lynx-js/css-extract-webpack-plugin@0.8.0
|
|
10
|
+
- @lynx-js/react-webpack-plugin@0.9.5
|
|
11
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.17.3-canary-20260706063705-db543ea9be725eb343cd6c2c4b0fc0785ab6a3d1
|
|
12
|
+
|
|
3
13
|
## 0.17.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -46,11 +56,11 @@
|
|
|
46
56
|
`output.filename.bundle` now accepts a function `(context: { lazyBundle: boolean; entryName?: string; platform: string }) => string` in addition to a string. The function is called once for the main bundle (`lazyBundle: false`) and once for the lazy bundles (`lazyBundle: true`), so a single config can control both the main bundle filename and the lazy bundle filename — without a dedicated `lazyBundle` field or a custom plugin.
|
|
47
57
|
|
|
48
58
|
```js
|
|
49
|
-
import { execSync } from
|
|
59
|
+
import { execSync } from "node:child_process";
|
|
50
60
|
|
|
51
|
-
import { defineConfig } from
|
|
61
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
52
62
|
|
|
53
|
-
const gitHash = execSync(
|
|
63
|
+
const gitHash = execSync("git rev-parse --short HEAD").toString().trim();
|
|
54
64
|
|
|
55
65
|
export default defineConfig({
|
|
56
66
|
output: {
|
|
@@ -61,7 +71,7 @@
|
|
|
61
71
|
: `[name].${platform}.bundle`,
|
|
62
72
|
},
|
|
63
73
|
},
|
|
64
|
-
})
|
|
74
|
+
});
|
|
65
75
|
```
|
|
66
76
|
|
|
67
77
|
- Support [Rsbuild v2](https://rsbuild.rs/guide/upgrade/v1-to-v2) and [Rspack v2](https://rspack.rs/guide/migration/rspack_1.x) in the React Rsbuild plugin, including the new CSS and JavaScript rule structure, Rspack-only refresh and CSS extraction plugins, top-level `splitChunks` handling, and Rspeedy profile configuration. ([#2603](https://github.com/lynx-family/lynx-stack/pull/2603))
|
|
@@ -174,7 +184,6 @@
|
|
|
174
184
|
### Minor Changes
|
|
175
185
|
|
|
176
186
|
- feat: support `optimizeBundleSize` option to remove unused code for main-thread and background. ([#2336](https://github.com/lynx-family/lynx-stack/pull/2336))
|
|
177
|
-
|
|
178
187
|
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.background` is `true`, `lynx.registerDataProcessors` calls will be marked as pure for the background thread output.
|
|
179
188
|
- 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.
|
|
180
189
|
|
|
@@ -201,7 +210,6 @@
|
|
|
201
210
|
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).
|
|
202
211
|
|
|
203
212
|
- feat: add `globalPropsMode` option to `PluginReactLynxOptions` ([#2346](https://github.com/lynx-family/lynx-stack/pull/2346))
|
|
204
|
-
|
|
205
213
|
- When configured to `"event"`, `updateGlobalProps` will only trigger a global event and skip the `runWithForce` flow.
|
|
206
214
|
- Defaults to `"reactive"`, which means `updateGlobalProps` will trigger re-render automatically.
|
|
207
215
|
|
|
@@ -370,8 +378,8 @@
|
|
|
370
378
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
371
379
|
|
|
372
380
|
```js
|
|
373
|
-
import { defineConfig } from
|
|
374
|
-
import { pluginBabel } from
|
|
381
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
382
|
+
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
375
383
|
|
|
376
384
|
export default defineConfig({
|
|
377
385
|
plugins: [
|
|
@@ -379,17 +387,17 @@
|
|
|
379
387
|
include: /\.(?:jsx|tsx)$/,
|
|
380
388
|
babelLoaderOptions(opts) {
|
|
381
389
|
opts.plugins?.unshift([
|
|
382
|
-
|
|
390
|
+
"babel-plugin-react-compiler",
|
|
383
391
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
384
392
|
{
|
|
385
393
|
// ReactLynx only supports target to version 17
|
|
386
|
-
target:
|
|
394
|
+
target: "17",
|
|
387
395
|
},
|
|
388
|
-
])
|
|
396
|
+
]);
|
|
389
397
|
},
|
|
390
398
|
}),
|
|
391
399
|
],
|
|
392
|
-
})
|
|
400
|
+
});
|
|
393
401
|
```
|
|
394
402
|
|
|
395
403
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -592,28 +600,28 @@
|
|
|
592
600
|
|
|
593
601
|
```ts
|
|
594
602
|
type InlineChunkTestFunction = (params: {
|
|
595
|
-
size: number
|
|
596
|
-
name: string
|
|
597
|
-
}) => boolean
|
|
603
|
+
size: number;
|
|
604
|
+
name: string;
|
|
605
|
+
}) => boolean;
|
|
598
606
|
|
|
599
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
607
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
600
608
|
|
|
601
609
|
type InlineChunkConfig =
|
|
602
610
|
| boolean
|
|
603
611
|
| InlineChunkTest
|
|
604
|
-
| { enable?: boolean |
|
|
612
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
605
613
|
```
|
|
606
614
|
|
|
607
615
|
```ts
|
|
608
|
-
import { defineConfig } from
|
|
616
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
609
617
|
|
|
610
618
|
export default defineConfig({
|
|
611
619
|
output: {
|
|
612
620
|
inlineScripts: ({ name, size }) => {
|
|
613
|
-
return name.includes(
|
|
621
|
+
return name.includes("foo") && size < 1000;
|
|
614
622
|
},
|
|
615
623
|
},
|
|
616
|
-
})
|
|
624
|
+
});
|
|
617
625
|
```
|
|
618
626
|
|
|
619
627
|
- Updated dependencies [[`51cb73d`](https://github.com/lynx-family/lynx-stack/commit/51cb73dd0b77d35540644cdd2e6c37db856f0e8a), [`69fb042`](https://github.com/lynx-family/lynx-stack/commit/69fb0420e297abf768c889769c95a207c480b3c7), [`a7e8b5b`](https://github.com/lynx-family/lynx-stack/commit/a7e8b5bbbab0490e7cf6f47581130e7b32739abb)]:
|
|
@@ -693,13 +701,13 @@
|
|
|
693
701
|
example:
|
|
694
702
|
|
|
695
703
|
```js
|
|
696
|
-
import { defineConfig } from
|
|
704
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
697
705
|
|
|
698
706
|
export default defineConfig({
|
|
699
707
|
output: {
|
|
700
708
|
inlineScripts: false,
|
|
701
709
|
},
|
|
702
|
-
})
|
|
710
|
+
});
|
|
703
711
|
```
|
|
704
712
|
|
|
705
713
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -757,7 +765,6 @@
|
|
|
757
765
|
- Refactor: Replace built-in `background-only` implementation with npm package ([#602](https://github.com/lynx-family/lynx-stack/pull/602))
|
|
758
766
|
|
|
759
767
|
Previously we maintained custom files:
|
|
760
|
-
|
|
761
768
|
- `empty.ts` for background thread
|
|
762
769
|
- `error.ts` for main thread validation
|
|
763
770
|
|
|
@@ -786,7 +793,7 @@
|
|
|
786
793
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
787
794
|
|
|
788
795
|
```js
|
|
789
|
-
import { defineConfig } from
|
|
796
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
790
797
|
|
|
791
798
|
export default defineConfig({
|
|
792
799
|
tools: {
|
|
@@ -798,7 +805,7 @@
|
|
|
798
805
|
},
|
|
799
806
|
},
|
|
800
807
|
},
|
|
801
|
-
})
|
|
808
|
+
});
|
|
802
809
|
```
|
|
803
810
|
|
|
804
811
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -974,7 +981,7 @@
|
|
|
974
981
|
You may turn it off using `output.minify.css: false`:
|
|
975
982
|
|
|
976
983
|
```js
|
|
977
|
-
import { defineConfig } from
|
|
984
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
978
985
|
|
|
979
986
|
export default defineConfig({
|
|
980
987
|
output: {
|
|
@@ -982,18 +989,18 @@
|
|
|
982
989
|
css: false,
|
|
983
990
|
},
|
|
984
991
|
},
|
|
985
|
-
})
|
|
992
|
+
});
|
|
986
993
|
```
|
|
987
994
|
|
|
988
995
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
989
996
|
|
|
990
997
|
```js
|
|
991
|
-
import { defineConfig } from
|
|
992
|
-
import { pluginCssMinimizer } from
|
|
998
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
999
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
993
1000
|
|
|
994
1001
|
export default defineConfig({
|
|
995
1002
|
plugins: [pluginCssMinimizer()],
|
|
996
|
-
})
|
|
1003
|
+
});
|
|
997
1004
|
```
|
|
998
1005
|
|
|
999
1006
|
### Patch Changes
|
|
@@ -1047,7 +1054,6 @@
|
|
|
1047
1054
|
|
|
1048
1055
|
- 7b84edf: feat(web): introduce new output chunk format
|
|
1049
1056
|
- 39efd7c: Change `enableRemoveCSSScope` defaults from `undefined` to `true`, now `enableRemoveCSSScope` can be:
|
|
1050
|
-
|
|
1051
1057
|
- `true` (by default): All CSS files are treated as global CSS.
|
|
1052
1058
|
- `false`: All CSS files are treated as scoped CSS, and only take effect in the component that explicitly imports it.
|
|
1053
1059
|
- `undefined`: Only use scoped CSS for CSS Modules, and treat other CSS files as global CSS. Scoped CSS is faster than global CSS, thus you can use CSS Modules to speedy up your CSS if there are performance issues.
|
|
@@ -1073,18 +1079,18 @@
|
|
|
1073
1079
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
1074
1080
|
|
|
1075
1081
|
```js
|
|
1076
|
-
import { pluginReactLynx } from
|
|
1077
|
-
import { defineConfig } from
|
|
1082
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
1083
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
1078
1084
|
|
|
1079
1085
|
export default defineConfig({
|
|
1080
1086
|
plugins: [
|
|
1081
1087
|
pluginReactLynx({
|
|
1082
1088
|
defineDCE: {
|
|
1083
|
-
__SOME_FALSE_DEFINE__:
|
|
1089
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
1084
1090
|
},
|
|
1085
1091
|
}),
|
|
1086
1092
|
],
|
|
1087
|
-
})
|
|
1093
|
+
});
|
|
1088
1094
|
```
|
|
1089
1095
|
|
|
1090
1096
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -1092,20 +1098,20 @@
|
|
|
1092
1098
|
For example, `import` initialized by dead code will be removed:
|
|
1093
1099
|
|
|
1094
1100
|
```js
|
|
1095
|
-
import { foo } from
|
|
1101
|
+
import { foo } from "bar";
|
|
1096
1102
|
|
|
1097
1103
|
if (__SOME_FALSE_DEFINE__) {
|
|
1098
|
-
foo()
|
|
1099
|
-
console.log(
|
|
1104
|
+
foo();
|
|
1105
|
+
console.log("dead code");
|
|
1100
1106
|
} else {
|
|
1101
|
-
console.log(
|
|
1107
|
+
console.log("reachable code");
|
|
1102
1108
|
}
|
|
1103
1109
|
```
|
|
1104
1110
|
|
|
1105
1111
|
will be transformed to:
|
|
1106
1112
|
|
|
1107
1113
|
```js
|
|
1108
|
-
console.log(
|
|
1114
|
+
console.log("reachable code");
|
|
1109
1115
|
```
|
|
1110
1116
|
|
|
1111
1117
|
- Updated dependencies [8dd6cca]
|
|
@@ -1124,7 +1130,6 @@
|
|
|
1124
1130
|
- 958efda: feat(web): bundle background.js into main-thread.js for web
|
|
1125
1131
|
|
|
1126
1132
|
To enable this feature:
|
|
1127
|
-
|
|
1128
1133
|
1. set the performance.chunkSplit.strategy to `all-in-one`
|
|
1129
1134
|
2. use the `mode:'production'` to build
|
|
1130
1135
|
|
|
@@ -1148,18 +1153,18 @@
|
|
|
1148
1153
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
1149
1154
|
|
|
1150
1155
|
```js
|
|
1151
|
-
import { pluginReactLynx } from
|
|
1152
|
-
import { defineConfig } from
|
|
1156
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
1157
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
1153
1158
|
|
|
1154
1159
|
export default defineConfig({
|
|
1155
1160
|
plugins: [
|
|
1156
1161
|
pluginReactLynx({
|
|
1157
1162
|
compat: {
|
|
1158
|
-
removeComponentAttrRegex:
|
|
1163
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
1159
1164
|
},
|
|
1160
1165
|
}),
|
|
1161
1166
|
],
|
|
1162
|
-
})
|
|
1167
|
+
});
|
|
1163
1168
|
```
|
|
1164
1169
|
|
|
1165
1170
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -1171,18 +1176,17 @@
|
|
|
1171
1176
|
|
|
1172
1177
|
- 36f8e4c: Add `enableAccessibilityElement`.
|
|
1173
1178
|
- b37e3d9: Enforced build-time errors for importing `background-only` modules in the `main-thread`.
|
|
1174
|
-
|
|
1175
1179
|
- use `import 'background-only'` to mark a module as restricted to the background environment. Any attempt to import such a module in the main thread will result in a build-time error.
|
|
1176
1180
|
|
|
1177
1181
|
For example:
|
|
1178
1182
|
|
|
1179
1183
|
```javascript
|
|
1180
1184
|
// bar.ts
|
|
1181
|
-
import
|
|
1185
|
+
import "background-only";
|
|
1182
1186
|
|
|
1183
1187
|
export const bar = () => {
|
|
1184
|
-
return
|
|
1185
|
-
}
|
|
1188
|
+
return "bar";
|
|
1189
|
+
};
|
|
1186
1190
|
```
|
|
1187
1191
|
|
|
1188
1192
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -1191,15 +1195,15 @@
|
|
|
1191
1195
|
|
|
1192
1196
|
```tsx
|
|
1193
1197
|
// App.tsx
|
|
1194
|
-
import { bar } from
|
|
1198
|
+
import { bar } from "./bar.js";
|
|
1195
1199
|
|
|
1196
1200
|
function App() {
|
|
1197
|
-
bar()
|
|
1201
|
+
bar();
|
|
1198
1202
|
return (
|
|
1199
1203
|
<view>
|
|
1200
1204
|
<text>Hello, Lynx x rspeedy</text>
|
|
1201
1205
|
</view>
|
|
1202
|
-
)
|
|
1206
|
+
);
|
|
1203
1207
|
}
|
|
1204
1208
|
```
|
|
1205
1209
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3-canary-20260706-db543ea9",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.8.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.17.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.17.3-canary-20260706-db543ea9",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.4.0",
|
|
38
38
|
"@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.9.5",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.2.1",
|
|
40
|
-
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.12.
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.12.3-canary-20260706-db543ea9",
|
|
41
41
|
"@lynx-js/use-sync-external-store": "npm:@lynx-js/use-sync-external-store-canary@1.5.0",
|
|
42
42
|
"background-only": "npm:background-only-canary@0.0.1",
|
|
43
43
|
"tiny-invariant": "^1.3.3"
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"type-fest": "^5.4.4",
|
|
56
56
|
"typia": "12.1.1",
|
|
57
57
|
"typia-rspack-plugin": "3.0.1",
|
|
58
|
+
"@lynx-js/config-rsbuild-plugin": "npm:@lynx-js/config-rsbuild-plugin-canary@0.1.0",
|
|
58
59
|
"@lynx-js/debug-metadata": "npm:@lynx-js/debug-metadata-canary@0.1.0",
|
|
59
60
|
"@lynx-js/react": "npm:@lynx-js/react-canary@0.122.1",
|
|
60
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.15.2",
|
|
61
61
|
"@lynx-js/react-transform": "0.2.0",
|
|
62
|
-
"@lynx-js/
|
|
62
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.15.3-canary-20260706-db543ea9",
|
|
63
63
|
"@lynx-js/test-tools": "0.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|