@lynx-js/react-rsbuild-plugin-canary 0.12.2-canary-20251222-4d689a71 → 0.12.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 +44 -44
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
-
## 0.12.2
|
|
3
|
+
## 0.12.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Support environment variants to enable multiple configurations for the same targets. ([#1969](https://github.com/lynx-family/lynx-stack/pull/1969))
|
|
8
8
|
|
|
9
9
|
- Updated dependencies []:
|
|
10
|
-
- @lynx-js/react-alias-rsbuild-plugin@0.12.2
|
|
10
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.12.2
|
|
11
11
|
|
|
12
12
|
## 0.12.1
|
|
13
13
|
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
53
53
|
|
|
54
54
|
```js
|
|
55
|
-
import { defineConfig } from
|
|
56
|
-
import { pluginBabel } from
|
|
55
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
56
|
+
import { pluginBabel } from '@rsbuild/plugin-babel'
|
|
57
57
|
|
|
58
58
|
export default defineConfig({
|
|
59
59
|
plugins: [
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
include: /\.(?:jsx|tsx)$/,
|
|
62
62
|
babelLoaderOptions(opts) {
|
|
63
63
|
opts.plugins?.unshift([
|
|
64
|
-
|
|
64
|
+
'babel-plugin-react-compiler',
|
|
65
65
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
66
66
|
{
|
|
67
67
|
// ReactLynx only supports target to version 17
|
|
68
|
-
target:
|
|
68
|
+
target: '17',
|
|
69
69
|
},
|
|
70
|
-
])
|
|
70
|
+
])
|
|
71
71
|
},
|
|
72
72
|
}),
|
|
73
73
|
],
|
|
74
|
-
})
|
|
74
|
+
})
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -274,28 +274,28 @@
|
|
|
274
274
|
|
|
275
275
|
```ts
|
|
276
276
|
type InlineChunkTestFunction = (params: {
|
|
277
|
-
size: number
|
|
278
|
-
name: string
|
|
279
|
-
}) => boolean
|
|
277
|
+
size: number
|
|
278
|
+
name: string
|
|
279
|
+
}) => boolean
|
|
280
280
|
|
|
281
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
281
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
282
282
|
|
|
283
283
|
type InlineChunkConfig =
|
|
284
284
|
| boolean
|
|
285
285
|
| InlineChunkTest
|
|
286
|
-
| { enable?: boolean |
|
|
286
|
+
| { enable?: boolean | 'auto', test: InlineChunkTest }
|
|
287
287
|
```
|
|
288
288
|
|
|
289
289
|
```ts
|
|
290
|
-
import { defineConfig } from
|
|
290
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
291
291
|
|
|
292
292
|
export default defineConfig({
|
|
293
293
|
output: {
|
|
294
294
|
inlineScripts: ({ name, size }) => {
|
|
295
|
-
return name.includes(
|
|
295
|
+
return name.includes('foo') && size < 1000
|
|
296
296
|
},
|
|
297
297
|
},
|
|
298
|
-
})
|
|
298
|
+
})
|
|
299
299
|
```
|
|
300
300
|
|
|
301
301
|
- 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)]:
|
|
@@ -375,13 +375,13 @@
|
|
|
375
375
|
example:
|
|
376
376
|
|
|
377
377
|
```js
|
|
378
|
-
import { defineConfig } from
|
|
378
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
379
379
|
|
|
380
380
|
export default defineConfig({
|
|
381
381
|
output: {
|
|
382
382
|
inlineScripts: false,
|
|
383
383
|
},
|
|
384
|
-
})
|
|
384
|
+
})
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
469
469
|
|
|
470
470
|
```js
|
|
471
|
-
import { defineConfig } from
|
|
471
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
472
472
|
|
|
473
473
|
export default defineConfig({
|
|
474
474
|
tools: {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
},
|
|
481
481
|
},
|
|
482
482
|
},
|
|
483
|
-
})
|
|
483
|
+
})
|
|
484
484
|
```
|
|
485
485
|
|
|
486
486
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -656,7 +656,7 @@
|
|
|
656
656
|
You may turn it off using `output.minify.css: false`:
|
|
657
657
|
|
|
658
658
|
```js
|
|
659
|
-
import { defineConfig } from
|
|
659
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
660
660
|
|
|
661
661
|
export default defineConfig({
|
|
662
662
|
output: {
|
|
@@ -664,18 +664,18 @@
|
|
|
664
664
|
css: false,
|
|
665
665
|
},
|
|
666
666
|
},
|
|
667
|
-
})
|
|
667
|
+
})
|
|
668
668
|
```
|
|
669
669
|
|
|
670
670
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
671
671
|
|
|
672
672
|
```js
|
|
673
|
-
import { defineConfig } from
|
|
674
|
-
import { pluginCssMinimizer } from
|
|
673
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
674
|
+
import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
|
|
675
675
|
|
|
676
676
|
export default defineConfig({
|
|
677
677
|
plugins: [pluginCssMinimizer()],
|
|
678
|
-
})
|
|
678
|
+
})
|
|
679
679
|
```
|
|
680
680
|
|
|
681
681
|
### Patch Changes
|
|
@@ -755,18 +755,18 @@
|
|
|
755
755
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
756
756
|
|
|
757
757
|
```js
|
|
758
|
-
import { pluginReactLynx } from
|
|
759
|
-
import { defineConfig } from
|
|
758
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
759
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
760
760
|
|
|
761
761
|
export default defineConfig({
|
|
762
762
|
plugins: [
|
|
763
763
|
pluginReactLynx({
|
|
764
764
|
defineDCE: {
|
|
765
|
-
__SOME_FALSE_DEFINE__:
|
|
765
|
+
__SOME_FALSE_DEFINE__: 'false',
|
|
766
766
|
},
|
|
767
767
|
}),
|
|
768
768
|
],
|
|
769
|
-
})
|
|
769
|
+
})
|
|
770
770
|
```
|
|
771
771
|
|
|
772
772
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -774,20 +774,20 @@
|
|
|
774
774
|
For example, `import` initialized by dead code will be removed:
|
|
775
775
|
|
|
776
776
|
```js
|
|
777
|
-
import { foo } from
|
|
777
|
+
import { foo } from 'bar'
|
|
778
778
|
|
|
779
779
|
if (__SOME_FALSE_DEFINE__) {
|
|
780
|
-
foo()
|
|
781
|
-
console.log(
|
|
780
|
+
foo()
|
|
781
|
+
console.log('dead code')
|
|
782
782
|
} else {
|
|
783
|
-
console.log(
|
|
783
|
+
console.log('reachable code')
|
|
784
784
|
}
|
|
785
785
|
```
|
|
786
786
|
|
|
787
787
|
will be transformed to:
|
|
788
788
|
|
|
789
789
|
```js
|
|
790
|
-
console.log(
|
|
790
|
+
console.log('reachable code')
|
|
791
791
|
```
|
|
792
792
|
|
|
793
793
|
- Updated dependencies [8dd6cca]
|
|
@@ -830,18 +830,18 @@
|
|
|
830
830
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
831
831
|
|
|
832
832
|
```js
|
|
833
|
-
import { pluginReactLynx } from
|
|
834
|
-
import { defineConfig } from
|
|
833
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
834
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
835
835
|
|
|
836
836
|
export default defineConfig({
|
|
837
837
|
plugins: [
|
|
838
838
|
pluginReactLynx({
|
|
839
839
|
compat: {
|
|
840
|
-
removeComponentAttrRegex:
|
|
840
|
+
removeComponentAttrRegex: 'YOUR REGEX',
|
|
841
841
|
},
|
|
842
842
|
}),
|
|
843
843
|
],
|
|
844
|
-
})
|
|
844
|
+
})
|
|
845
845
|
```
|
|
846
846
|
|
|
847
847
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -860,11 +860,11 @@
|
|
|
860
860
|
|
|
861
861
|
```javascript
|
|
862
862
|
// bar.ts
|
|
863
|
-
import
|
|
863
|
+
import 'background-only'
|
|
864
864
|
|
|
865
865
|
export const bar = () => {
|
|
866
|
-
return
|
|
867
|
-
}
|
|
866
|
+
return 'bar'
|
|
867
|
+
}
|
|
868
868
|
```
|
|
869
869
|
|
|
870
870
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -873,15 +873,15 @@
|
|
|
873
873
|
|
|
874
874
|
```tsx
|
|
875
875
|
// App.tsx
|
|
876
|
-
import { bar } from
|
|
876
|
+
import { bar } from './bar.js'
|
|
877
877
|
|
|
878
878
|
function App() {
|
|
879
|
-
bar()
|
|
879
|
+
bar()
|
|
880
880
|
return (
|
|
881
881
|
<view>
|
|
882
882
|
<text>Hello, Lynx x rspeedy</text>
|
|
883
883
|
</view>
|
|
884
|
-
)
|
|
884
|
+
)
|
|
885
885
|
}
|
|
886
886
|
```
|
|
887
887
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.12.2
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,7 +33,7 @@
|
|
|
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.2
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.2",
|
|
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",
|
|
@@ -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.1",
|
|
58
57
|
"@lynx-js/react-transform": "0.2.0",
|
|
59
|
-
"@lynx-js/
|
|
60
|
-
"@lynx-js/vitest-setup": "0.0.0"
|
|
58
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.115.1",
|
|
59
|
+
"@lynx-js/vitest-setup": "0.0.0",
|
|
60
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@lynx-js/react": "*"
|