@lynx-js/react-rsbuild-plugin-canary 0.12.4 → 0.12.5-canary-20260111-d9c9ff98
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 +55 -42
- package/dist/208.js +1193 -0
- package/dist/300.js +21 -34
- package/dist/index.js +1 -1271
- package/dist/loaders/ignore-css-loader.js +1 -1
- package/dist/loaders/invalid-import-error-loader.js +1 -1
- package/dist/rslib-runtime.js +39 -0
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.12.5-canary-20260111102946-d9c9ff985d02de83c98595b9851e45f50e944a3e
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support reading config from `pluginLynxConfig`. ([#2054](https://github.com/lynx-family/lynx-stack/pull/2054))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`4c60674`](https://github.com/lynx-family/lynx-stack/commit/4c60674c8ef9917bcbf1e26ecb9a50c07f335ef1), [`27c3d90`](https://github.com/lynx-family/lynx-stack/commit/27c3d90f3b63f8cb62dc705b2ec4c1d0bdd22c31)]:
|
|
10
|
+
- @lynx-js/react@0.115.4-canary-20260111102946-d9c9ff985d02de83c98595b9851e45f50e944a3e
|
|
11
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.12.5-canary-20260111102946-d9c9ff985d02de83c98595b9851e45f50e944a3e
|
|
12
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
13
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
14
|
+
- @lynx-js/react-webpack-plugin@0.7.3
|
|
15
|
+
|
|
3
16
|
## 0.12.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -78,8 +91,8 @@
|
|
|
78
91
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
79
92
|
|
|
80
93
|
```js
|
|
81
|
-
import { defineConfig } from
|
|
82
|
-
import { pluginBabel } from
|
|
94
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
95
|
+
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
83
96
|
|
|
84
97
|
export default defineConfig({
|
|
85
98
|
plugins: [
|
|
@@ -87,17 +100,17 @@
|
|
|
87
100
|
include: /\.(?:jsx|tsx)$/,
|
|
88
101
|
babelLoaderOptions(opts) {
|
|
89
102
|
opts.plugins?.unshift([
|
|
90
|
-
|
|
103
|
+
"babel-plugin-react-compiler",
|
|
91
104
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
92
105
|
{
|
|
93
106
|
// ReactLynx only supports target to version 17
|
|
94
|
-
target:
|
|
107
|
+
target: "17",
|
|
95
108
|
},
|
|
96
|
-
])
|
|
109
|
+
]);
|
|
97
110
|
},
|
|
98
111
|
}),
|
|
99
112
|
],
|
|
100
|
-
})
|
|
113
|
+
});
|
|
101
114
|
```
|
|
102
115
|
|
|
103
116
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -300,28 +313,28 @@
|
|
|
300
313
|
|
|
301
314
|
```ts
|
|
302
315
|
type InlineChunkTestFunction = (params: {
|
|
303
|
-
size: number
|
|
304
|
-
name: string
|
|
305
|
-
}) => boolean
|
|
316
|
+
size: number;
|
|
317
|
+
name: string;
|
|
318
|
+
}) => boolean;
|
|
306
319
|
|
|
307
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
320
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
308
321
|
|
|
309
322
|
type InlineChunkConfig =
|
|
310
323
|
| boolean
|
|
311
324
|
| InlineChunkTest
|
|
312
|
-
| { enable?: boolean |
|
|
325
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
313
326
|
```
|
|
314
327
|
|
|
315
328
|
```ts
|
|
316
|
-
import { defineConfig } from
|
|
329
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
317
330
|
|
|
318
331
|
export default defineConfig({
|
|
319
332
|
output: {
|
|
320
333
|
inlineScripts: ({ name, size }) => {
|
|
321
|
-
return name.includes(
|
|
334
|
+
return name.includes("foo") && size < 1000;
|
|
322
335
|
},
|
|
323
336
|
},
|
|
324
|
-
})
|
|
337
|
+
});
|
|
325
338
|
```
|
|
326
339
|
|
|
327
340
|
- 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)]:
|
|
@@ -401,13 +414,13 @@
|
|
|
401
414
|
example:
|
|
402
415
|
|
|
403
416
|
```js
|
|
404
|
-
import { defineConfig } from
|
|
417
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
405
418
|
|
|
406
419
|
export default defineConfig({
|
|
407
420
|
output: {
|
|
408
421
|
inlineScripts: false,
|
|
409
422
|
},
|
|
410
|
-
})
|
|
423
|
+
});
|
|
411
424
|
```
|
|
412
425
|
|
|
413
426
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -494,7 +507,7 @@
|
|
|
494
507
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
495
508
|
|
|
496
509
|
```js
|
|
497
|
-
import { defineConfig } from
|
|
510
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
498
511
|
|
|
499
512
|
export default defineConfig({
|
|
500
513
|
tools: {
|
|
@@ -506,7 +519,7 @@
|
|
|
506
519
|
},
|
|
507
520
|
},
|
|
508
521
|
},
|
|
509
|
-
})
|
|
522
|
+
});
|
|
510
523
|
```
|
|
511
524
|
|
|
512
525
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -682,7 +695,7 @@
|
|
|
682
695
|
You may turn it off using `output.minify.css: false`:
|
|
683
696
|
|
|
684
697
|
```js
|
|
685
|
-
import { defineConfig } from
|
|
698
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
686
699
|
|
|
687
700
|
export default defineConfig({
|
|
688
701
|
output: {
|
|
@@ -690,18 +703,18 @@
|
|
|
690
703
|
css: false,
|
|
691
704
|
},
|
|
692
705
|
},
|
|
693
|
-
})
|
|
706
|
+
});
|
|
694
707
|
```
|
|
695
708
|
|
|
696
709
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
697
710
|
|
|
698
711
|
```js
|
|
699
|
-
import { defineConfig } from
|
|
700
|
-
import { pluginCssMinimizer } from
|
|
712
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
713
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
701
714
|
|
|
702
715
|
export default defineConfig({
|
|
703
716
|
plugins: [pluginCssMinimizer()],
|
|
704
|
-
})
|
|
717
|
+
});
|
|
705
718
|
```
|
|
706
719
|
|
|
707
720
|
### Patch Changes
|
|
@@ -781,18 +794,18 @@
|
|
|
781
794
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
782
795
|
|
|
783
796
|
```js
|
|
784
|
-
import { pluginReactLynx } from
|
|
785
|
-
import { defineConfig } from
|
|
797
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
798
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
786
799
|
|
|
787
800
|
export default defineConfig({
|
|
788
801
|
plugins: [
|
|
789
802
|
pluginReactLynx({
|
|
790
803
|
defineDCE: {
|
|
791
|
-
__SOME_FALSE_DEFINE__:
|
|
804
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
792
805
|
},
|
|
793
806
|
}),
|
|
794
807
|
],
|
|
795
|
-
})
|
|
808
|
+
});
|
|
796
809
|
```
|
|
797
810
|
|
|
798
811
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -800,20 +813,20 @@
|
|
|
800
813
|
For example, `import` initialized by dead code will be removed:
|
|
801
814
|
|
|
802
815
|
```js
|
|
803
|
-
import { foo } from
|
|
816
|
+
import { foo } from "bar";
|
|
804
817
|
|
|
805
818
|
if (__SOME_FALSE_DEFINE__) {
|
|
806
|
-
foo()
|
|
807
|
-
console.log(
|
|
819
|
+
foo();
|
|
820
|
+
console.log("dead code");
|
|
808
821
|
} else {
|
|
809
|
-
console.log(
|
|
822
|
+
console.log("reachable code");
|
|
810
823
|
}
|
|
811
824
|
```
|
|
812
825
|
|
|
813
826
|
will be transformed to:
|
|
814
827
|
|
|
815
828
|
```js
|
|
816
|
-
console.log(
|
|
829
|
+
console.log("reachable code");
|
|
817
830
|
```
|
|
818
831
|
|
|
819
832
|
- Updated dependencies [8dd6cca]
|
|
@@ -856,18 +869,18 @@
|
|
|
856
869
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
857
870
|
|
|
858
871
|
```js
|
|
859
|
-
import { pluginReactLynx } from
|
|
860
|
-
import { defineConfig } from
|
|
872
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
873
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
861
874
|
|
|
862
875
|
export default defineConfig({
|
|
863
876
|
plugins: [
|
|
864
877
|
pluginReactLynx({
|
|
865
878
|
compat: {
|
|
866
|
-
removeComponentAttrRegex:
|
|
879
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
867
880
|
},
|
|
868
881
|
}),
|
|
869
882
|
],
|
|
870
|
-
})
|
|
883
|
+
});
|
|
871
884
|
```
|
|
872
885
|
|
|
873
886
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -886,11 +899,11 @@
|
|
|
886
899
|
|
|
887
900
|
```javascript
|
|
888
901
|
// bar.ts
|
|
889
|
-
import
|
|
902
|
+
import "background-only";
|
|
890
903
|
|
|
891
904
|
export const bar = () => {
|
|
892
|
-
return
|
|
893
|
-
}
|
|
905
|
+
return "bar";
|
|
906
|
+
};
|
|
894
907
|
```
|
|
895
908
|
|
|
896
909
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -899,15 +912,15 @@
|
|
|
899
912
|
|
|
900
913
|
```tsx
|
|
901
914
|
// App.tsx
|
|
902
|
-
import { bar } from
|
|
915
|
+
import { bar } from "./bar.js";
|
|
903
916
|
|
|
904
917
|
function App() {
|
|
905
|
-
bar()
|
|
918
|
+
bar();
|
|
906
919
|
return (
|
|
907
920
|
<view>
|
|
908
921
|
<text>Hello, Lynx x rspeedy</text>
|
|
909
922
|
</view>
|
|
910
|
-
)
|
|
923
|
+
);
|
|
911
924
|
}
|
|
912
925
|
```
|
|
913
926
|
|