@lynx-js/react-rsbuild-plugin-canary 0.12.0-canary-20251205-6400f87b → 0.12.0
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 +47 -48
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
-
## 0.12.0
|
|
3
|
+
## 0.12.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
- Support Yarn Plug'n'Play. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
|
|
12
12
|
|
|
13
|
-
- Updated dependencies [[`
|
|
14
|
-
- @lynx-js/react@0.
|
|
15
|
-
- @lynx-js/
|
|
16
|
-
- @lynx-js/
|
|
17
|
-
- @lynx-js/template-webpack-plugin@0.9.2-canary-20251205074811-6400f87b9b0370e5fe53ce37711d45932fede695
|
|
13
|
+
- Updated dependencies [[`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb), [`5bbb439`](https://github.com/lynx-family/lynx-stack/commit/5bbb43981580f917f59819cd4ff7972b9737a341), [`3692a16`](https://github.com/lynx-family/lynx-stack/commit/3692a169ae443124de0e9f7a288318f5dfba13b0), [`d2e290b`](https://github.com/lynx-family/lynx-stack/commit/d2e290b67971ead5bedbcc1e34dd7f3bf4a6f5f3), [`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb)]:
|
|
14
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.12.0
|
|
15
|
+
- @lynx-js/css-extract-webpack-plugin@0.6.5
|
|
16
|
+
- @lynx-js/template-webpack-plugin@0.9.2
|
|
18
17
|
- @lynx-js/use-sync-external-store@1.5.0
|
|
19
18
|
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
20
19
|
- @lynx-js/react-webpack-plugin@0.7.2
|
|
@@ -30,8 +29,8 @@
|
|
|
30
29
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
31
30
|
|
|
32
31
|
```js
|
|
33
|
-
import { defineConfig } from
|
|
34
|
-
import { pluginBabel } from
|
|
32
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
33
|
+
import { pluginBabel } from '@rsbuild/plugin-babel'
|
|
35
34
|
|
|
36
35
|
export default defineConfig({
|
|
37
36
|
plugins: [
|
|
@@ -39,17 +38,17 @@
|
|
|
39
38
|
include: /\.(?:jsx|tsx)$/,
|
|
40
39
|
babelLoaderOptions(opts) {
|
|
41
40
|
opts.plugins?.unshift([
|
|
42
|
-
|
|
41
|
+
'babel-plugin-react-compiler',
|
|
43
42
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
44
43
|
{
|
|
45
44
|
// ReactLynx only supports target to version 17
|
|
46
|
-
target:
|
|
45
|
+
target: '17',
|
|
47
46
|
},
|
|
48
|
-
])
|
|
47
|
+
])
|
|
49
48
|
},
|
|
50
49
|
}),
|
|
51
50
|
],
|
|
52
|
-
})
|
|
51
|
+
})
|
|
53
52
|
```
|
|
54
53
|
|
|
55
54
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -252,28 +251,28 @@
|
|
|
252
251
|
|
|
253
252
|
```ts
|
|
254
253
|
type InlineChunkTestFunction = (params: {
|
|
255
|
-
size: number
|
|
256
|
-
name: string
|
|
257
|
-
}) => boolean
|
|
254
|
+
size: number
|
|
255
|
+
name: string
|
|
256
|
+
}) => boolean
|
|
258
257
|
|
|
259
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
258
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
260
259
|
|
|
261
260
|
type InlineChunkConfig =
|
|
262
261
|
| boolean
|
|
263
262
|
| InlineChunkTest
|
|
264
|
-
| { enable?: boolean |
|
|
263
|
+
| { enable?: boolean | 'auto', test: InlineChunkTest }
|
|
265
264
|
```
|
|
266
265
|
|
|
267
266
|
```ts
|
|
268
|
-
import { defineConfig } from
|
|
267
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
269
268
|
|
|
270
269
|
export default defineConfig({
|
|
271
270
|
output: {
|
|
272
271
|
inlineScripts: ({ name, size }) => {
|
|
273
|
-
return name.includes(
|
|
272
|
+
return name.includes('foo') && size < 1000
|
|
274
273
|
},
|
|
275
274
|
},
|
|
276
|
-
})
|
|
275
|
+
})
|
|
277
276
|
```
|
|
278
277
|
|
|
279
278
|
- 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)]:
|
|
@@ -353,13 +352,13 @@
|
|
|
353
352
|
example:
|
|
354
353
|
|
|
355
354
|
```js
|
|
356
|
-
import { defineConfig } from
|
|
355
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
357
356
|
|
|
358
357
|
export default defineConfig({
|
|
359
358
|
output: {
|
|
360
359
|
inlineScripts: false,
|
|
361
360
|
},
|
|
362
|
-
})
|
|
361
|
+
})
|
|
363
362
|
```
|
|
364
363
|
|
|
365
364
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -446,7 +445,7 @@
|
|
|
446
445
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
447
446
|
|
|
448
447
|
```js
|
|
449
|
-
import { defineConfig } from
|
|
448
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
450
449
|
|
|
451
450
|
export default defineConfig({
|
|
452
451
|
tools: {
|
|
@@ -458,7 +457,7 @@
|
|
|
458
457
|
},
|
|
459
458
|
},
|
|
460
459
|
},
|
|
461
|
-
})
|
|
460
|
+
})
|
|
462
461
|
```
|
|
463
462
|
|
|
464
463
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -634,7 +633,7 @@
|
|
|
634
633
|
You may turn it off using `output.minify.css: false`:
|
|
635
634
|
|
|
636
635
|
```js
|
|
637
|
-
import { defineConfig } from
|
|
636
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
638
637
|
|
|
639
638
|
export default defineConfig({
|
|
640
639
|
output: {
|
|
@@ -642,18 +641,18 @@
|
|
|
642
641
|
css: false,
|
|
643
642
|
},
|
|
644
643
|
},
|
|
645
|
-
})
|
|
644
|
+
})
|
|
646
645
|
```
|
|
647
646
|
|
|
648
647
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
649
648
|
|
|
650
649
|
```js
|
|
651
|
-
import { defineConfig } from
|
|
652
|
-
import { pluginCssMinimizer } from
|
|
650
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
651
|
+
import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
|
|
653
652
|
|
|
654
653
|
export default defineConfig({
|
|
655
654
|
plugins: [pluginCssMinimizer()],
|
|
656
|
-
})
|
|
655
|
+
})
|
|
657
656
|
```
|
|
658
657
|
|
|
659
658
|
### Patch Changes
|
|
@@ -733,18 +732,18 @@
|
|
|
733
732
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
734
733
|
|
|
735
734
|
```js
|
|
736
|
-
import { pluginReactLynx } from
|
|
737
|
-
import { defineConfig } from
|
|
735
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
736
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
738
737
|
|
|
739
738
|
export default defineConfig({
|
|
740
739
|
plugins: [
|
|
741
740
|
pluginReactLynx({
|
|
742
741
|
defineDCE: {
|
|
743
|
-
__SOME_FALSE_DEFINE__:
|
|
742
|
+
__SOME_FALSE_DEFINE__: 'false',
|
|
744
743
|
},
|
|
745
744
|
}),
|
|
746
745
|
],
|
|
747
|
-
})
|
|
746
|
+
})
|
|
748
747
|
```
|
|
749
748
|
|
|
750
749
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -752,20 +751,20 @@
|
|
|
752
751
|
For example, `import` initialized by dead code will be removed:
|
|
753
752
|
|
|
754
753
|
```js
|
|
755
|
-
import { foo } from
|
|
754
|
+
import { foo } from 'bar'
|
|
756
755
|
|
|
757
756
|
if (__SOME_FALSE_DEFINE__) {
|
|
758
|
-
foo()
|
|
759
|
-
console.log(
|
|
757
|
+
foo()
|
|
758
|
+
console.log('dead code')
|
|
760
759
|
} else {
|
|
761
|
-
console.log(
|
|
760
|
+
console.log('reachable code')
|
|
762
761
|
}
|
|
763
762
|
```
|
|
764
763
|
|
|
765
764
|
will be transformed to:
|
|
766
765
|
|
|
767
766
|
```js
|
|
768
|
-
console.log(
|
|
767
|
+
console.log('reachable code')
|
|
769
768
|
```
|
|
770
769
|
|
|
771
770
|
- Updated dependencies [8dd6cca]
|
|
@@ -808,18 +807,18 @@
|
|
|
808
807
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
809
808
|
|
|
810
809
|
```js
|
|
811
|
-
import { pluginReactLynx } from
|
|
812
|
-
import { defineConfig } from
|
|
810
|
+
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
811
|
+
import { defineConfig } from '@lynx-js/rspeedy'
|
|
813
812
|
|
|
814
813
|
export default defineConfig({
|
|
815
814
|
plugins: [
|
|
816
815
|
pluginReactLynx({
|
|
817
816
|
compat: {
|
|
818
|
-
removeComponentAttrRegex:
|
|
817
|
+
removeComponentAttrRegex: 'YOUR REGEX',
|
|
819
818
|
},
|
|
820
819
|
}),
|
|
821
820
|
],
|
|
822
|
-
})
|
|
821
|
+
})
|
|
823
822
|
```
|
|
824
823
|
|
|
825
824
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -838,11 +837,11 @@
|
|
|
838
837
|
|
|
839
838
|
```javascript
|
|
840
839
|
// bar.ts
|
|
841
|
-
import
|
|
840
|
+
import 'background-only'
|
|
842
841
|
|
|
843
842
|
export const bar = () => {
|
|
844
|
-
return
|
|
845
|
-
}
|
|
843
|
+
return 'bar'
|
|
844
|
+
}
|
|
846
845
|
```
|
|
847
846
|
|
|
848
847
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -851,15 +850,15 @@
|
|
|
851
850
|
|
|
852
851
|
```tsx
|
|
853
852
|
// App.tsx
|
|
854
|
-
import { bar } from
|
|
853
|
+
import { bar } from './bar.js'
|
|
855
854
|
|
|
856
855
|
function App() {
|
|
857
|
-
bar()
|
|
856
|
+
bar()
|
|
858
857
|
return (
|
|
859
858
|
<view>
|
|
860
859
|
<text>Hello, Lynx x rspeedy</text>
|
|
861
860
|
</view>
|
|
862
|
-
)
|
|
861
|
+
)
|
|
863
862
|
}
|
|
864
863
|
```
|
|
865
864
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.12.0
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"README.md"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.5
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.0
|
|
35
|
+
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.5",
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.0",
|
|
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.2",
|
|
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.9.2
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.9.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
|
},
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"type-fest": "^5.0.1",
|
|
55
55
|
"typia": "9.7.2",
|
|
56
56
|
"typia-rspack-plugin": "2.2.2",
|
|
57
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.115.0",
|
|
57
58
|
"@lynx-js/react-transform": "0.2.0",
|
|
58
|
-
"@lynx-js/
|
|
59
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.1
|
|
60
|
-
"@lynx-js/vitest-setup": "0.0.0"
|
|
59
|
+
"@lynx-js/vitest-setup": "0.0.0",
|
|
60
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@lynx-js/react": "*"
|