@lynx-js/react-rsbuild-plugin-canary 0.12.3-canary-20251226-f8b5be81 → 0.12.3
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 -47
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
-
## 0.12.3
|
|
3
|
+
## 0.12.3
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- expose LAYERS via `api.expose` for other rsbuild plugins. ([#2006](https://github.com/lynx-family/lynx-stack/pull/2006))
|
|
8
8
|
|
|
9
|
-
- Updated dependencies [[`
|
|
10
|
-
- @lynx-js/
|
|
11
|
-
- @lynx-js/
|
|
12
|
-
- @lynx-js/react-alias-rsbuild-plugin@0.12.3-canary-20251226141420-f8b5be81acbf7b3fed18046c5d1e4100a75a9843
|
|
9
|
+
- Updated dependencies [[`cd89bf9`](https://github.com/lynx-family/lynx-stack/commit/cd89bf9e3fc8ed4658dfb6c983584376416d620f)]:
|
|
10
|
+
- @lynx-js/template-webpack-plugin@0.10.1
|
|
11
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.12.3
|
|
13
12
|
- @lynx-js/use-sync-external-store@1.5.0
|
|
14
13
|
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
15
14
|
- @lynx-js/react-webpack-plugin@0.7.3
|
|
@@ -67,8 +66,8 @@
|
|
|
67
66
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
68
67
|
|
|
69
68
|
```js
|
|
70
|
-
import { defineConfig } from
|
|
71
|
-
import { pluginBabel } from
|
|
69
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
70
|
+
import { pluginBabel } from '@rsbuild/plugin-babel'
|
|
72
71
|
|
|
73
72
|
export default defineConfig({
|
|
74
73
|
plugins: [
|
|
@@ -76,17 +75,17 @@
|
|
|
76
75
|
include: /\.(?:jsx|tsx)$/,
|
|
77
76
|
babelLoaderOptions(opts) {
|
|
78
77
|
opts.plugins?.unshift([
|
|
79
|
-
|
|
78
|
+
'babel-plugin-react-compiler',
|
|
80
79
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
81
80
|
{
|
|
82
81
|
// ReactLynx only supports target to version 17
|
|
83
|
-
target:
|
|
82
|
+
target: '17',
|
|
84
83
|
},
|
|
85
|
-
])
|
|
84
|
+
])
|
|
86
85
|
},
|
|
87
86
|
}),
|
|
88
87
|
],
|
|
89
|
-
})
|
|
88
|
+
})
|
|
90
89
|
```
|
|
91
90
|
|
|
92
91
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -289,28 +288,28 @@
|
|
|
289
288
|
|
|
290
289
|
```ts
|
|
291
290
|
type InlineChunkTestFunction = (params: {
|
|
292
|
-
size: number
|
|
293
|
-
name: string
|
|
294
|
-
}) => boolean
|
|
291
|
+
size: number
|
|
292
|
+
name: string
|
|
293
|
+
}) => boolean
|
|
295
294
|
|
|
296
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
295
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
297
296
|
|
|
298
297
|
type InlineChunkConfig =
|
|
299
298
|
| boolean
|
|
300
299
|
| InlineChunkTest
|
|
301
|
-
| { enable?: boolean |
|
|
300
|
+
| { enable?: boolean | 'auto', test: InlineChunkTest }
|
|
302
301
|
```
|
|
303
302
|
|
|
304
303
|
```ts
|
|
305
|
-
import { defineConfig } from
|
|
304
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
306
305
|
|
|
307
306
|
export default defineConfig({
|
|
308
307
|
output: {
|
|
309
308
|
inlineScripts: ({ name, size }) => {
|
|
310
|
-
return name.includes(
|
|
309
|
+
return name.includes('foo') && size < 1000
|
|
311
310
|
},
|
|
312
311
|
},
|
|
313
|
-
})
|
|
312
|
+
})
|
|
314
313
|
```
|
|
315
314
|
|
|
316
315
|
- 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)]:
|
|
@@ -390,13 +389,13 @@
|
|
|
390
389
|
example:
|
|
391
390
|
|
|
392
391
|
```js
|
|
393
|
-
import { defineConfig } from
|
|
392
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
394
393
|
|
|
395
394
|
export default defineConfig({
|
|
396
395
|
output: {
|
|
397
396
|
inlineScripts: false,
|
|
398
397
|
},
|
|
399
|
-
})
|
|
398
|
+
})
|
|
400
399
|
```
|
|
401
400
|
|
|
402
401
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -483,7 +482,7 @@
|
|
|
483
482
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
484
483
|
|
|
485
484
|
```js
|
|
486
|
-
import { defineConfig } from
|
|
485
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
487
486
|
|
|
488
487
|
export default defineConfig({
|
|
489
488
|
tools: {
|
|
@@ -495,7 +494,7 @@
|
|
|
495
494
|
},
|
|
496
495
|
},
|
|
497
496
|
},
|
|
498
|
-
})
|
|
497
|
+
})
|
|
499
498
|
```
|
|
500
499
|
|
|
501
500
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -671,7 +670,7 @@
|
|
|
671
670
|
You may turn it off using `output.minify.css: false`:
|
|
672
671
|
|
|
673
672
|
```js
|
|
674
|
-
import { defineConfig } from
|
|
673
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
675
674
|
|
|
676
675
|
export default defineConfig({
|
|
677
676
|
output: {
|
|
@@ -679,18 +678,18 @@
|
|
|
679
678
|
css: false,
|
|
680
679
|
},
|
|
681
680
|
},
|
|
682
|
-
})
|
|
681
|
+
})
|
|
683
682
|
```
|
|
684
683
|
|
|
685
684
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
686
685
|
|
|
687
686
|
```js
|
|
688
|
-
import { defineConfig } from
|
|
689
|
-
import { pluginCssMinimizer } from
|
|
687
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
688
|
+
import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
|
|
690
689
|
|
|
691
690
|
export default defineConfig({
|
|
692
691
|
plugins: [pluginCssMinimizer()],
|
|
693
|
-
})
|
|
692
|
+
})
|
|
694
693
|
```
|
|
695
694
|
|
|
696
695
|
### Patch Changes
|
|
@@ -770,18 +769,18 @@
|
|
|
770
769
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
771
770
|
|
|
772
771
|
```js
|
|
773
|
-
import { pluginReactLynx } from
|
|
774
|
-
import { defineConfig } from
|
|
772
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
773
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
775
774
|
|
|
776
775
|
export default defineConfig({
|
|
777
776
|
plugins: [
|
|
778
777
|
pluginReactLynx({
|
|
779
778
|
defineDCE: {
|
|
780
|
-
__SOME_FALSE_DEFINE__:
|
|
779
|
+
__SOME_FALSE_DEFINE__: 'false',
|
|
781
780
|
},
|
|
782
781
|
}),
|
|
783
782
|
],
|
|
784
|
-
})
|
|
783
|
+
})
|
|
785
784
|
```
|
|
786
785
|
|
|
787
786
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -789,20 +788,20 @@
|
|
|
789
788
|
For example, `import` initialized by dead code will be removed:
|
|
790
789
|
|
|
791
790
|
```js
|
|
792
|
-
import { foo } from
|
|
791
|
+
import { foo } from 'bar'
|
|
793
792
|
|
|
794
793
|
if (__SOME_FALSE_DEFINE__) {
|
|
795
|
-
foo()
|
|
796
|
-
console.log(
|
|
794
|
+
foo()
|
|
795
|
+
console.log('dead code')
|
|
797
796
|
} else {
|
|
798
|
-
console.log(
|
|
797
|
+
console.log('reachable code')
|
|
799
798
|
}
|
|
800
799
|
```
|
|
801
800
|
|
|
802
801
|
will be transformed to:
|
|
803
802
|
|
|
804
803
|
```js
|
|
805
|
-
console.log(
|
|
804
|
+
console.log('reachable code')
|
|
806
805
|
```
|
|
807
806
|
|
|
808
807
|
- Updated dependencies [8dd6cca]
|
|
@@ -845,18 +844,18 @@
|
|
|
845
844
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
846
845
|
|
|
847
846
|
```js
|
|
848
|
-
import { pluginReactLynx } from
|
|
849
|
-
import { defineConfig } from
|
|
847
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
848
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
850
849
|
|
|
851
850
|
export default defineConfig({
|
|
852
851
|
plugins: [
|
|
853
852
|
pluginReactLynx({
|
|
854
853
|
compat: {
|
|
855
|
-
removeComponentAttrRegex:
|
|
854
|
+
removeComponentAttrRegex: 'YOUR REGEX',
|
|
856
855
|
},
|
|
857
856
|
}),
|
|
858
857
|
],
|
|
859
|
-
})
|
|
858
|
+
})
|
|
860
859
|
```
|
|
861
860
|
|
|
862
861
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -875,11 +874,11 @@
|
|
|
875
874
|
|
|
876
875
|
```javascript
|
|
877
876
|
// bar.ts
|
|
878
|
-
import
|
|
877
|
+
import 'background-only'
|
|
879
878
|
|
|
880
879
|
export const bar = () => {
|
|
881
|
-
return
|
|
882
|
-
}
|
|
880
|
+
return 'bar'
|
|
881
|
+
}
|
|
883
882
|
```
|
|
884
883
|
|
|
885
884
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -888,15 +887,15 @@
|
|
|
888
887
|
|
|
889
888
|
```tsx
|
|
890
889
|
// App.tsx
|
|
891
|
-
import { bar } from
|
|
890
|
+
import { bar } from './bar.js'
|
|
892
891
|
|
|
893
892
|
function App() {
|
|
894
|
-
bar()
|
|
893
|
+
bar()
|
|
895
894
|
return (
|
|
896
895
|
<view>
|
|
897
896
|
<text>Hello, Lynx x rspeedy</text>
|
|
898
897
|
</view>
|
|
899
|
-
)
|
|
898
|
+
)
|
|
900
899
|
}
|
|
901
900
|
```
|
|
902
901
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.12.3
|
|
3
|
+
"version": "0.12.3",
|
|
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.7.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.3
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.3",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.3.4",
|
|
38
38
|
"@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.7.3",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.3",
|
|
40
|
-
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.10.1
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.10.1",
|
|
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
|
},
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"type-fest": "^5.0.1",
|
|
55
55
|
"typia": "10.1.0",
|
|
56
56
|
"typia-rspack-plugin": "2.2.2",
|
|
57
|
-
"@lynx-js/react": "npm:@lynx-js/react-canary@0.115.2
|
|
57
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.115.2",
|
|
58
58
|
"@lynx-js/react-transform": "0.2.0",
|
|
59
59
|
"@lynx-js/vitest-setup": "0.0.0",
|
|
60
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.4
|
|
60
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.4"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@lynx-js/react": "*"
|