@lynx-js/react-rsbuild-plugin-canary 0.11.4 → 0.12.0-canary-20251127-2765ceaa
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 +57 -42
- package/dist/{856.js → 300.js} +2 -2
- package/dist/index.js +2 -12
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.12.0-canary-20251127035014-2765ceaa24c24bc2f4d4111472596125a074ed44
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **BREAKING CHANGE**: Require `@lynx-js/rspeedy` 0.12.0. ([#1951](https://github.com/lynx-family/lynx-stack/pull/1951))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`09adc7e`](https://github.com/lynx-family/lynx-stack/commit/09adc7e0c96d8151a45279bb5bf63552645132ad)]:
|
|
12
|
+
- @lynx-js/react@0.114.6-canary-20251127035014-2765ceaa24c24bc2f4d4111472596125a074ed44
|
|
13
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.12.0-canary-20251127035014-2765ceaa24c24bc2f4d4111472596125a074ed44
|
|
14
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
15
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.4
|
|
16
|
+
- @lynx-js/react-webpack-plugin@0.7.2
|
|
17
|
+
|
|
3
18
|
## 0.11.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -11,8 +26,8 @@
|
|
|
11
26
|
With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
|
|
12
27
|
|
|
13
28
|
```js
|
|
14
|
-
import { defineConfig } from
|
|
15
|
-
import { pluginBabel } from
|
|
29
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
30
|
+
import { pluginBabel } from "@rsbuild/plugin-babel";
|
|
16
31
|
|
|
17
32
|
export default defineConfig({
|
|
18
33
|
plugins: [
|
|
@@ -20,17 +35,17 @@
|
|
|
20
35
|
include: /\.(?:jsx|tsx)$/,
|
|
21
36
|
babelLoaderOptions(opts) {
|
|
22
37
|
opts.plugins?.unshift([
|
|
23
|
-
|
|
38
|
+
"babel-plugin-react-compiler",
|
|
24
39
|
// See https://react.dev/reference/react-compiler/configuration for config
|
|
25
40
|
{
|
|
26
41
|
// ReactLynx only supports target to version 17
|
|
27
|
-
target:
|
|
42
|
+
target: "17",
|
|
28
43
|
},
|
|
29
|
-
])
|
|
44
|
+
]);
|
|
30
45
|
},
|
|
31
46
|
}),
|
|
32
47
|
],
|
|
33
|
-
})
|
|
48
|
+
});
|
|
34
49
|
```
|
|
35
50
|
|
|
36
51
|
- Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
|
|
@@ -233,28 +248,28 @@
|
|
|
233
248
|
|
|
234
249
|
```ts
|
|
235
250
|
type InlineChunkTestFunction = (params: {
|
|
236
|
-
size: number
|
|
237
|
-
name: string
|
|
238
|
-
}) => boolean
|
|
251
|
+
size: number;
|
|
252
|
+
name: string;
|
|
253
|
+
}) => boolean;
|
|
239
254
|
|
|
240
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
255
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
241
256
|
|
|
242
257
|
type InlineChunkConfig =
|
|
243
258
|
| boolean
|
|
244
259
|
| InlineChunkTest
|
|
245
|
-
| { enable?: boolean |
|
|
260
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
246
261
|
```
|
|
247
262
|
|
|
248
263
|
```ts
|
|
249
|
-
import { defineConfig } from
|
|
264
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
250
265
|
|
|
251
266
|
export default defineConfig({
|
|
252
267
|
output: {
|
|
253
268
|
inlineScripts: ({ name, size }) => {
|
|
254
|
-
return name.includes(
|
|
269
|
+
return name.includes("foo") && size < 1000;
|
|
255
270
|
},
|
|
256
271
|
},
|
|
257
|
-
})
|
|
272
|
+
});
|
|
258
273
|
```
|
|
259
274
|
|
|
260
275
|
- 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)]:
|
|
@@ -334,13 +349,13 @@
|
|
|
334
349
|
example:
|
|
335
350
|
|
|
336
351
|
```js
|
|
337
|
-
import { defineConfig } from
|
|
352
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
338
353
|
|
|
339
354
|
export default defineConfig({
|
|
340
355
|
output: {
|
|
341
356
|
inlineScripts: false,
|
|
342
357
|
},
|
|
343
|
-
})
|
|
358
|
+
});
|
|
344
359
|
```
|
|
345
360
|
|
|
346
361
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -427,7 +442,7 @@
|
|
|
427
442
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
428
443
|
|
|
429
444
|
```js
|
|
430
|
-
import { defineConfig } from
|
|
445
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
431
446
|
|
|
432
447
|
export default defineConfig({
|
|
433
448
|
tools: {
|
|
@@ -439,7 +454,7 @@
|
|
|
439
454
|
},
|
|
440
455
|
},
|
|
441
456
|
},
|
|
442
|
-
})
|
|
457
|
+
});
|
|
443
458
|
```
|
|
444
459
|
|
|
445
460
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -615,7 +630,7 @@
|
|
|
615
630
|
You may turn it off using `output.minify.css: false`:
|
|
616
631
|
|
|
617
632
|
```js
|
|
618
|
-
import { defineConfig } from
|
|
633
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
619
634
|
|
|
620
635
|
export default defineConfig({
|
|
621
636
|
output: {
|
|
@@ -623,18 +638,18 @@
|
|
|
623
638
|
css: false,
|
|
624
639
|
},
|
|
625
640
|
},
|
|
626
|
-
})
|
|
641
|
+
});
|
|
627
642
|
```
|
|
628
643
|
|
|
629
644
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
630
645
|
|
|
631
646
|
```js
|
|
632
|
-
import { defineConfig } from
|
|
633
|
-
import { pluginCssMinimizer } from
|
|
647
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
648
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
634
649
|
|
|
635
650
|
export default defineConfig({
|
|
636
651
|
plugins: [pluginCssMinimizer()],
|
|
637
|
-
})
|
|
652
|
+
});
|
|
638
653
|
```
|
|
639
654
|
|
|
640
655
|
### Patch Changes
|
|
@@ -714,18 +729,18 @@
|
|
|
714
729
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
715
730
|
|
|
716
731
|
```js
|
|
717
|
-
import { pluginReactLynx } from
|
|
718
|
-
import { defineConfig } from
|
|
732
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
733
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
719
734
|
|
|
720
735
|
export default defineConfig({
|
|
721
736
|
plugins: [
|
|
722
737
|
pluginReactLynx({
|
|
723
738
|
defineDCE: {
|
|
724
|
-
__SOME_FALSE_DEFINE__:
|
|
739
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
725
740
|
},
|
|
726
741
|
}),
|
|
727
742
|
],
|
|
728
|
-
})
|
|
743
|
+
});
|
|
729
744
|
```
|
|
730
745
|
|
|
731
746
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -733,20 +748,20 @@
|
|
|
733
748
|
For example, `import` initialized by dead code will be removed:
|
|
734
749
|
|
|
735
750
|
```js
|
|
736
|
-
import { foo } from
|
|
751
|
+
import { foo } from "bar";
|
|
737
752
|
|
|
738
753
|
if (__SOME_FALSE_DEFINE__) {
|
|
739
|
-
foo()
|
|
740
|
-
console.log(
|
|
754
|
+
foo();
|
|
755
|
+
console.log("dead code");
|
|
741
756
|
} else {
|
|
742
|
-
console.log(
|
|
757
|
+
console.log("reachable code");
|
|
743
758
|
}
|
|
744
759
|
```
|
|
745
760
|
|
|
746
761
|
will be transformed to:
|
|
747
762
|
|
|
748
763
|
```js
|
|
749
|
-
console.log(
|
|
764
|
+
console.log("reachable code");
|
|
750
765
|
```
|
|
751
766
|
|
|
752
767
|
- Updated dependencies [8dd6cca]
|
|
@@ -789,18 +804,18 @@
|
|
|
789
804
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
790
805
|
|
|
791
806
|
```js
|
|
792
|
-
import { pluginReactLynx } from
|
|
793
|
-
import { defineConfig } from
|
|
807
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
808
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
794
809
|
|
|
795
810
|
export default defineConfig({
|
|
796
811
|
plugins: [
|
|
797
812
|
pluginReactLynx({
|
|
798
813
|
compat: {
|
|
799
|
-
removeComponentAttrRegex:
|
|
814
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
800
815
|
},
|
|
801
816
|
}),
|
|
802
817
|
],
|
|
803
|
-
})
|
|
818
|
+
});
|
|
804
819
|
```
|
|
805
820
|
|
|
806
821
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -819,11 +834,11 @@
|
|
|
819
834
|
|
|
820
835
|
```javascript
|
|
821
836
|
// bar.ts
|
|
822
|
-
import
|
|
837
|
+
import "background-only";
|
|
823
838
|
|
|
824
839
|
export const bar = () => {
|
|
825
|
-
return
|
|
826
|
-
}
|
|
840
|
+
return "bar";
|
|
841
|
+
};
|
|
827
842
|
```
|
|
828
843
|
|
|
829
844
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -832,15 +847,15 @@
|
|
|
832
847
|
|
|
833
848
|
```tsx
|
|
834
849
|
// App.tsx
|
|
835
|
-
import { bar } from
|
|
850
|
+
import { bar } from "./bar.js";
|
|
836
851
|
|
|
837
852
|
function App() {
|
|
838
|
-
bar()
|
|
853
|
+
bar();
|
|
839
854
|
return (
|
|
840
855
|
<view>
|
|
841
856
|
<text>Hello, Lynx x rspeedy</text>
|
|
842
857
|
</view>
|
|
843
|
-
)
|
|
858
|
+
);
|
|
844
859
|
}
|
|
845
860
|
```
|
|
846
861
|
|
package/dist/{856.js → 300.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const __webpack_id__ = "
|
|
1
|
+
export const __webpack_id__ = "300";
|
|
2
2
|
export const __webpack_ids__ = [
|
|
3
|
-
"
|
|
3
|
+
"300"
|
|
4
4
|
];
|
|
5
5
|
export const __webpack_modules__ = {
|
|
6
6
|
"./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
package/dist/index.js
CHANGED
|
@@ -189,7 +189,7 @@ const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background
|
|
|
189
189
|
function applyBackgroundOnly(api) {
|
|
190
190
|
api.modifyBundlerChain(async (chain)=>{
|
|
191
191
|
const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
192
|
-
const { resolve, resolveMainThread } = await __webpack_require__.e("
|
|
192
|
+
const { resolve, resolveMainThread } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
|
|
193
193
|
const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
|
|
194
194
|
resolve('background-only'),
|
|
195
195
|
resolveMainThread('background-only')
|
|
@@ -471,11 +471,6 @@ function applyLazy(api) {
|
|
|
471
471
|
function applyLoaders(api, options) {
|
|
472
472
|
const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, experimental_isLazyBundle } = options;
|
|
473
473
|
api.modifyBundlerChain((chain, { CHAIN_ID })=>{
|
|
474
|
-
const experiments = chain.get('experiments');
|
|
475
|
-
chain.experiments({
|
|
476
|
-
...experiments,
|
|
477
|
-
layers: true
|
|
478
|
-
});
|
|
479
474
|
const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
480
475
|
const uses = rule.uses.entries() ?? {};
|
|
481
476
|
const { output } = api.getRsbuildConfig();
|
|
@@ -603,7 +598,7 @@ function applySWC(api) {
|
|
|
603
598
|
}
|
|
604
599
|
function applyUseSyncExternalStore(api) {
|
|
605
600
|
api.modifyBundlerChain(async (chain)=>{
|
|
606
|
-
const { resolve } = await __webpack_require__.e("
|
|
601
|
+
const { resolve } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
|
|
607
602
|
const useSyncExternalStoreEntries = [
|
|
608
603
|
'use-sync-external-store',
|
|
609
604
|
'use-sync-external-store/with-selector',
|
|
@@ -1229,11 +1224,6 @@ function pluginReactLynx(userOptions) {
|
|
|
1229
1224
|
]
|
|
1230
1225
|
}
|
|
1231
1226
|
});
|
|
1232
|
-
if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
|
|
1233
|
-
output: {
|
|
1234
|
-
inlineScripts: true
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1237
1227
|
config = mergeRsbuildConfig({
|
|
1238
1228
|
tools: {
|
|
1239
1229
|
rspack: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0-canary-20251127-2765ceaa",
|
|
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.6.4",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.0-canary-20251127-2765ceaa",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "7.52.15",
|
|
46
46
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
47
|
-
"@rsbuild/core": "1.
|
|
47
|
+
"@rsbuild/core": "1.6.7",
|
|
48
48
|
"@rsbuild/plugin-sass": "1.4.0",
|
|
49
49
|
"@rsbuild/plugin-typed-css-modules": "1.1.1",
|
|
50
50
|
"rsbuild-plugin-arethetypeswrong": "0.1.1",
|
|
@@ -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.114.
|
|
57
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.114.6-canary-20251127-2765ceaa",
|
|
58
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.0",
|
|
58
59
|
"@lynx-js/react-transform": "0.2.0",
|
|
59
|
-
"@lynx-js/vitest-setup": "0.0.0"
|
|
60
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.11.9"
|
|
60
|
+
"@lynx-js/vitest-setup": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@lynx-js/react": "*"
|