@lynx-js/react-rsbuild-plugin-canary 0.17.2-canary-20260703-a73bd993 → 0.17.2
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 +58 -53
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
-
## 0.17.2
|
|
3
|
+
## 0.17.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
The `web` environment now uses the same target and HMR entry as the `lynx` environment, going through Lynx's own HMR runtime instead of the Rsbuild web one.
|
|
12
12
|
|
|
13
|
-
- Updated dependencies [[`7a6577a`](https://github.com/lynx-family/lynx-stack/commit/7a6577a5b29db4020cbba22a911f712bafde7e66), [`
|
|
14
|
-
- @lynx-js/runtime-wrapper-webpack-plugin@0.2.1
|
|
15
|
-
- @lynx-js/react@0.
|
|
16
|
-
- @lynx-js/react-
|
|
17
|
-
- @lynx-js/react-webpack-plugin@0.9.5-canary-20260703080527-a73bd9933968f265b6fb7a6b295bd759df2997dc
|
|
13
|
+
- Updated dependencies [[`7a6577a`](https://github.com/lynx-family/lynx-stack/commit/7a6577a5b29db4020cbba22a911f712bafde7e66), [`d18c3e7`](https://github.com/lynx-family/lynx-stack/commit/d18c3e7a3976569ec9ba2a1b4a1e0e6c3ffa1f1d)]:
|
|
14
|
+
- @lynx-js/runtime-wrapper-webpack-plugin@0.2.1
|
|
15
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.17.2
|
|
16
|
+
- @lynx-js/react-webpack-plugin@0.9.5
|
|
18
17
|
- @lynx-js/use-sync-external-store@1.5.0
|
|
19
18
|
- @lynx-js/react-refresh-webpack-plugin@0.4.0
|
|
20
|
-
- @lynx-js/template-webpack-plugin@0.12.2
|
|
19
|
+
- @lynx-js/template-webpack-plugin@0.12.2
|
|
21
20
|
- @lynx-js/css-extract-webpack-plugin@0.8.0
|
|
22
21
|
|
|
23
22
|
## 0.17.1
|
|
@@ -47,11 +46,11 @@
|
|
|
47
46
|
`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.
|
|
48
47
|
|
|
49
48
|
```js
|
|
50
|
-
import { execSync } from
|
|
49
|
+
import { execSync } from 'node:child_process'
|
|
51
50
|
|
|
52
|
-
import { defineConfig } from
|
|
51
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
53
52
|
|
|
54
|
-
const gitHash = execSync(
|
|
53
|
+
const gitHash = execSync('git rev-parse --short HEAD').toString().trim()
|
|
55
54
|
|
|
56
55
|
export default defineConfig({
|
|
57
56
|
output: {
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
: `[name].${platform}.bundle`,
|
|
63
62
|
},
|
|
64
63
|
},
|
|
65
|
-
})
|
|
64
|
+
})
|
|
66
65
|
```
|
|
67
66
|
|
|
68
67
|
- 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))
|
|
@@ -175,6 +174,7 @@
|
|
|
175
174
|
### Minor Changes
|
|
176
175
|
|
|
177
176
|
- 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
178
|
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.background` is `true`, `lynx.registerDataProcessors` calls will be marked as pure for the background thread output.
|
|
179
179
|
- 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
180
|
|
|
@@ -201,6 +201,7 @@
|
|
|
201
201
|
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
202
|
|
|
203
203
|
- feat: add `globalPropsMode` option to `PluginReactLynxOptions` ([#2346](https://github.com/lynx-family/lynx-stack/pull/2346))
|
|
204
|
+
|
|
204
205
|
- When configured to `"event"`, `updateGlobalProps` will only trigger a global event and skip the `runWithForce` flow.
|
|
205
206
|
- Defaults to `"reactive"`, which means `updateGlobalProps` will trigger re-render automatically.
|
|
206
207
|
|
|
@@ -369,8 +370,8 @@
|
|
|
369
370
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
370
371
|
|
|
371
372
|
```js
|
|
372
|
-
import { defineConfig } from
|
|
373
|
-
import { pluginBabel } from
|
|
373
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
374
|
+
import { pluginBabel } from '@rsbuild/plugin-babel'
|
|
374
375
|
|
|
375
376
|
export default defineConfig({
|
|
376
377
|
plugins: [
|
|
@@ -378,17 +379,17 @@
|
|
|
378
379
|
include: /\.(?:jsx|tsx)$/,
|
|
379
380
|
babelLoaderOptions(opts) {
|
|
380
381
|
opts.plugins?.unshift([
|
|
381
|
-
|
|
382
|
+
'babel-plugin-react-compiler',
|
|
382
383
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
383
384
|
{
|
|
384
385
|
// ReactLynx only supports target to version 17
|
|
385
|
-
target:
|
|
386
|
+
target: '17',
|
|
386
387
|
},
|
|
387
|
-
])
|
|
388
|
+
])
|
|
388
389
|
},
|
|
389
390
|
}),
|
|
390
391
|
],
|
|
391
|
-
})
|
|
392
|
+
})
|
|
392
393
|
```
|
|
393
394
|
|
|
394
395
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -591,28 +592,28 @@
|
|
|
591
592
|
|
|
592
593
|
```ts
|
|
593
594
|
type InlineChunkTestFunction = (params: {
|
|
594
|
-
size: number
|
|
595
|
-
name: string
|
|
596
|
-
}) => boolean
|
|
595
|
+
size: number
|
|
596
|
+
name: string
|
|
597
|
+
}) => boolean
|
|
597
598
|
|
|
598
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
599
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
599
600
|
|
|
600
601
|
type InlineChunkConfig =
|
|
601
602
|
| boolean
|
|
602
603
|
| InlineChunkTest
|
|
603
|
-
| { enable?: boolean |
|
|
604
|
+
| { enable?: boolean | 'auto', test: InlineChunkTest }
|
|
604
605
|
```
|
|
605
606
|
|
|
606
607
|
```ts
|
|
607
|
-
import { defineConfig } from
|
|
608
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
608
609
|
|
|
609
610
|
export default defineConfig({
|
|
610
611
|
output: {
|
|
611
612
|
inlineScripts: ({ name, size }) => {
|
|
612
|
-
return name.includes(
|
|
613
|
+
return name.includes('foo') && size < 1000
|
|
613
614
|
},
|
|
614
615
|
},
|
|
615
|
-
})
|
|
616
|
+
})
|
|
616
617
|
```
|
|
617
618
|
|
|
618
619
|
- 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)]:
|
|
@@ -692,13 +693,13 @@
|
|
|
692
693
|
example:
|
|
693
694
|
|
|
694
695
|
```js
|
|
695
|
-
import { defineConfig } from
|
|
696
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
696
697
|
|
|
697
698
|
export default defineConfig({
|
|
698
699
|
output: {
|
|
699
700
|
inlineScripts: false,
|
|
700
701
|
},
|
|
701
|
-
})
|
|
702
|
+
})
|
|
702
703
|
```
|
|
703
704
|
|
|
704
705
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -756,6 +757,7 @@
|
|
|
756
757
|
- Refactor: Replace built-in `background-only` implementation with npm package ([#602](https://github.com/lynx-family/lynx-stack/pull/602))
|
|
757
758
|
|
|
758
759
|
Previously we maintained custom files:
|
|
760
|
+
|
|
759
761
|
- `empty.ts` for background thread
|
|
760
762
|
- `error.ts` for main thread validation
|
|
761
763
|
|
|
@@ -784,7 +786,7 @@
|
|
|
784
786
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
785
787
|
|
|
786
788
|
```js
|
|
787
|
-
import { defineConfig } from
|
|
789
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
788
790
|
|
|
789
791
|
export default defineConfig({
|
|
790
792
|
tools: {
|
|
@@ -796,7 +798,7 @@
|
|
|
796
798
|
},
|
|
797
799
|
},
|
|
798
800
|
},
|
|
799
|
-
})
|
|
801
|
+
})
|
|
800
802
|
```
|
|
801
803
|
|
|
802
804
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -972,7 +974,7 @@
|
|
|
972
974
|
You may turn it off using `output.minify.css: false`:
|
|
973
975
|
|
|
974
976
|
```js
|
|
975
|
-
import { defineConfig } from
|
|
977
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
976
978
|
|
|
977
979
|
export default defineConfig({
|
|
978
980
|
output: {
|
|
@@ -980,18 +982,18 @@
|
|
|
980
982
|
css: false,
|
|
981
983
|
},
|
|
982
984
|
},
|
|
983
|
-
})
|
|
985
|
+
})
|
|
984
986
|
```
|
|
985
987
|
|
|
986
988
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
987
989
|
|
|
988
990
|
```js
|
|
989
|
-
import { defineConfig } from
|
|
990
|
-
import { pluginCssMinimizer } from
|
|
991
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
992
|
+
import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
|
|
991
993
|
|
|
992
994
|
export default defineConfig({
|
|
993
995
|
plugins: [pluginCssMinimizer()],
|
|
994
|
-
})
|
|
996
|
+
})
|
|
995
997
|
```
|
|
996
998
|
|
|
997
999
|
### Patch Changes
|
|
@@ -1045,6 +1047,7 @@
|
|
|
1045
1047
|
|
|
1046
1048
|
- 7b84edf: feat(web): introduce new output chunk format
|
|
1047
1049
|
- 39efd7c: Change `enableRemoveCSSScope` defaults from `undefined` to `true`, now `enableRemoveCSSScope` can be:
|
|
1050
|
+
|
|
1048
1051
|
- `true` (by default): All CSS files are treated as global CSS.
|
|
1049
1052
|
- `false`: All CSS files are treated as scoped CSS, and only take effect in the component that explicitly imports it.
|
|
1050
1053
|
- `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.
|
|
@@ -1070,18 +1073,18 @@
|
|
|
1070
1073
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
1071
1074
|
|
|
1072
1075
|
```js
|
|
1073
|
-
import { pluginReactLynx } from
|
|
1074
|
-
import { defineConfig } from
|
|
1076
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
1077
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
1075
1078
|
|
|
1076
1079
|
export default defineConfig({
|
|
1077
1080
|
plugins: [
|
|
1078
1081
|
pluginReactLynx({
|
|
1079
1082
|
defineDCE: {
|
|
1080
|
-
__SOME_FALSE_DEFINE__:
|
|
1083
|
+
__SOME_FALSE_DEFINE__: 'false',
|
|
1081
1084
|
},
|
|
1082
1085
|
}),
|
|
1083
1086
|
],
|
|
1084
|
-
})
|
|
1087
|
+
})
|
|
1085
1088
|
```
|
|
1086
1089
|
|
|
1087
1090
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -1089,20 +1092,20 @@
|
|
|
1089
1092
|
For example, `import` initialized by dead code will be removed:
|
|
1090
1093
|
|
|
1091
1094
|
```js
|
|
1092
|
-
import { foo } from
|
|
1095
|
+
import { foo } from 'bar'
|
|
1093
1096
|
|
|
1094
1097
|
if (__SOME_FALSE_DEFINE__) {
|
|
1095
|
-
foo()
|
|
1096
|
-
console.log(
|
|
1098
|
+
foo()
|
|
1099
|
+
console.log('dead code')
|
|
1097
1100
|
} else {
|
|
1098
|
-
console.log(
|
|
1101
|
+
console.log('reachable code')
|
|
1099
1102
|
}
|
|
1100
1103
|
```
|
|
1101
1104
|
|
|
1102
1105
|
will be transformed to:
|
|
1103
1106
|
|
|
1104
1107
|
```js
|
|
1105
|
-
console.log(
|
|
1108
|
+
console.log('reachable code')
|
|
1106
1109
|
```
|
|
1107
1110
|
|
|
1108
1111
|
- Updated dependencies [8dd6cca]
|
|
@@ -1121,6 +1124,7 @@
|
|
|
1121
1124
|
- 958efda: feat(web): bundle background.js into main-thread.js for web
|
|
1122
1125
|
|
|
1123
1126
|
To enable this feature:
|
|
1127
|
+
|
|
1124
1128
|
1. set the performance.chunkSplit.strategy to `all-in-one`
|
|
1125
1129
|
2. use the `mode:'production'` to build
|
|
1126
1130
|
|
|
@@ -1144,18 +1148,18 @@
|
|
|
1144
1148
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
1145
1149
|
|
|
1146
1150
|
```js
|
|
1147
|
-
import { pluginReactLynx } from
|
|
1148
|
-
import { defineConfig } from
|
|
1151
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
1152
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
1149
1153
|
|
|
1150
1154
|
export default defineConfig({
|
|
1151
1155
|
plugins: [
|
|
1152
1156
|
pluginReactLynx({
|
|
1153
1157
|
compat: {
|
|
1154
|
-
removeComponentAttrRegex:
|
|
1158
|
+
removeComponentAttrRegex: 'YOUR REGEX',
|
|
1155
1159
|
},
|
|
1156
1160
|
}),
|
|
1157
1161
|
],
|
|
1158
|
-
})
|
|
1162
|
+
})
|
|
1159
1163
|
```
|
|
1160
1164
|
|
|
1161
1165
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -1167,17 +1171,18 @@
|
|
|
1167
1171
|
|
|
1168
1172
|
- 36f8e4c: Add `enableAccessibilityElement`.
|
|
1169
1173
|
- b37e3d9: Enforced build-time errors for importing `background-only` modules in the `main-thread`.
|
|
1174
|
+
|
|
1170
1175
|
- 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.
|
|
1171
1176
|
|
|
1172
1177
|
For example:
|
|
1173
1178
|
|
|
1174
1179
|
```javascript
|
|
1175
1180
|
// bar.ts
|
|
1176
|
-
import
|
|
1181
|
+
import 'background-only'
|
|
1177
1182
|
|
|
1178
1183
|
export const bar = () => {
|
|
1179
|
-
return
|
|
1180
|
-
}
|
|
1184
|
+
return 'bar'
|
|
1185
|
+
}
|
|
1181
1186
|
```
|
|
1182
1187
|
|
|
1183
1188
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -1186,15 +1191,15 @@
|
|
|
1186
1191
|
|
|
1187
1192
|
```tsx
|
|
1188
1193
|
// App.tsx
|
|
1189
|
-
import { bar } from
|
|
1194
|
+
import { bar } from './bar.js'
|
|
1190
1195
|
|
|
1191
1196
|
function App() {
|
|
1192
|
-
bar()
|
|
1197
|
+
bar()
|
|
1193
1198
|
return (
|
|
1194
1199
|
<view>
|
|
1195
1200
|
<text>Hello, Lynx x rspeedy</text>
|
|
1196
1201
|
</view>
|
|
1197
|
-
)
|
|
1202
|
+
)
|
|
1198
1203
|
}
|
|
1199
1204
|
```
|
|
1200
1205
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.17.2
|
|
3
|
+
"version": "0.17.2",
|
|
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.2
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.17.2",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.4.0",
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.9.5
|
|
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.2
|
|
38
|
+
"@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.9.5",
|
|
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.2",
|
|
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"
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"typia": "12.1.1",
|
|
57
57
|
"typia-rspack-plugin": "3.0.1",
|
|
58
58
|
"@lynx-js/debug-metadata": "npm:@lynx-js/debug-metadata-canary@0.1.0",
|
|
59
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.122.1",
|
|
60
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.15.2",
|
|
59
61
|
"@lynx-js/react-transform": "0.2.0",
|
|
60
62
|
"@lynx-js/config-rsbuild-plugin": "npm:@lynx-js/config-rsbuild-plugin-canary@0.1.0",
|
|
61
|
-
"@lynx-js/
|
|
62
|
-
"@lynx-js/test-tools": "0.0.0",
|
|
63
|
-
"@lynx-js/react": "npm:@lynx-js/react-canary@0.122.1-canary-20260703-a73bd993"
|
|
63
|
+
"@lynx-js/test-tools": "0.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@lynx-js/react": "*"
|