@lynx-js/react-rsbuild-plugin-canary 0.10.7 → 0.10.8-canary-20250715-1443e468
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 +45 -36
- package/dist/index.js +4 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.10.8-canary-20250715131556-1443e468a353363e29aab0d90cd8b91c232a5525
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Supports extractStr for large JSON ([#1230](https://github.com/lynx-family/lynx-stack/pull/1230))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.8-canary-20250715131556-1443e468a353363e29aab0d90cd8b91c232a5525
|
|
11
|
+
|
|
3
12
|
## 0.10.7
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -34,28 +43,28 @@
|
|
|
34
43
|
|
|
35
44
|
```ts
|
|
36
45
|
type InlineChunkTestFunction = (params: {
|
|
37
|
-
size: number
|
|
38
|
-
name: string
|
|
39
|
-
}) => boolean
|
|
46
|
+
size: number;
|
|
47
|
+
name: string;
|
|
48
|
+
}) => boolean;
|
|
40
49
|
|
|
41
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
50
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
42
51
|
|
|
43
52
|
type InlineChunkConfig =
|
|
44
53
|
| boolean
|
|
45
54
|
| InlineChunkTest
|
|
46
|
-
| { enable?: boolean |
|
|
55
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
47
56
|
```
|
|
48
57
|
|
|
49
58
|
```ts
|
|
50
|
-
import { defineConfig } from
|
|
59
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
51
60
|
|
|
52
61
|
export default defineConfig({
|
|
53
62
|
output: {
|
|
54
63
|
inlineScripts: ({ name, size }) => {
|
|
55
|
-
return name.includes(
|
|
64
|
+
return name.includes("foo") && size < 1000;
|
|
56
65
|
},
|
|
57
66
|
},
|
|
58
|
-
})
|
|
67
|
+
});
|
|
59
68
|
```
|
|
60
69
|
|
|
61
70
|
- 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)]:
|
|
@@ -135,13 +144,13 @@
|
|
|
135
144
|
example:
|
|
136
145
|
|
|
137
146
|
```js
|
|
138
|
-
import { defineConfig } from
|
|
147
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
139
148
|
|
|
140
149
|
export default defineConfig({
|
|
141
150
|
output: {
|
|
142
151
|
inlineScripts: false,
|
|
143
152
|
},
|
|
144
|
-
})
|
|
153
|
+
});
|
|
145
154
|
```
|
|
146
155
|
|
|
147
156
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -228,7 +237,7 @@
|
|
|
228
237
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
229
238
|
|
|
230
239
|
```js
|
|
231
|
-
import { defineConfig } from
|
|
240
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
232
241
|
|
|
233
242
|
export default defineConfig({
|
|
234
243
|
tools: {
|
|
@@ -240,7 +249,7 @@
|
|
|
240
249
|
},
|
|
241
250
|
},
|
|
242
251
|
},
|
|
243
|
-
})
|
|
252
|
+
});
|
|
244
253
|
```
|
|
245
254
|
|
|
246
255
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -416,7 +425,7 @@
|
|
|
416
425
|
You may turn it off using `output.minify.css: false`:
|
|
417
426
|
|
|
418
427
|
```js
|
|
419
|
-
import { defineConfig } from
|
|
428
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
420
429
|
|
|
421
430
|
export default defineConfig({
|
|
422
431
|
output: {
|
|
@@ -424,18 +433,18 @@
|
|
|
424
433
|
css: false,
|
|
425
434
|
},
|
|
426
435
|
},
|
|
427
|
-
})
|
|
436
|
+
});
|
|
428
437
|
```
|
|
429
438
|
|
|
430
439
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
431
440
|
|
|
432
441
|
```js
|
|
433
|
-
import { defineConfig } from
|
|
434
|
-
import { pluginCssMinimizer } from
|
|
442
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
443
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
435
444
|
|
|
436
445
|
export default defineConfig({
|
|
437
446
|
plugins: [pluginCssMinimizer()],
|
|
438
|
-
})
|
|
447
|
+
});
|
|
439
448
|
```
|
|
440
449
|
|
|
441
450
|
### Patch Changes
|
|
@@ -515,18 +524,18 @@
|
|
|
515
524
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
516
525
|
|
|
517
526
|
```js
|
|
518
|
-
import { pluginReactLynx } from
|
|
519
|
-
import { defineConfig } from
|
|
527
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
528
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
520
529
|
|
|
521
530
|
export default defineConfig({
|
|
522
531
|
plugins: [
|
|
523
532
|
pluginReactLynx({
|
|
524
533
|
defineDCE: {
|
|
525
|
-
__SOME_FALSE_DEFINE__:
|
|
534
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
526
535
|
},
|
|
527
536
|
}),
|
|
528
537
|
],
|
|
529
|
-
})
|
|
538
|
+
});
|
|
530
539
|
```
|
|
531
540
|
|
|
532
541
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -534,20 +543,20 @@
|
|
|
534
543
|
For example, `import` initialized by dead code will be removed:
|
|
535
544
|
|
|
536
545
|
```js
|
|
537
|
-
import { foo } from
|
|
546
|
+
import { foo } from "bar";
|
|
538
547
|
|
|
539
548
|
if (__SOME_FALSE_DEFINE__) {
|
|
540
|
-
foo()
|
|
541
|
-
console.log(
|
|
549
|
+
foo();
|
|
550
|
+
console.log("dead code");
|
|
542
551
|
} else {
|
|
543
|
-
console.log(
|
|
552
|
+
console.log("reachable code");
|
|
544
553
|
}
|
|
545
554
|
```
|
|
546
555
|
|
|
547
556
|
will be transformed to:
|
|
548
557
|
|
|
549
558
|
```js
|
|
550
|
-
console.log(
|
|
559
|
+
console.log("reachable code");
|
|
551
560
|
```
|
|
552
561
|
|
|
553
562
|
- Updated dependencies [8dd6cca]
|
|
@@ -590,18 +599,18 @@
|
|
|
590
599
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
591
600
|
|
|
592
601
|
```js
|
|
593
|
-
import { pluginReactLynx } from
|
|
594
|
-
import { defineConfig } from
|
|
602
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
603
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
595
604
|
|
|
596
605
|
export default defineConfig({
|
|
597
606
|
plugins: [
|
|
598
607
|
pluginReactLynx({
|
|
599
608
|
compat: {
|
|
600
|
-
removeComponentAttrRegex:
|
|
609
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
601
610
|
},
|
|
602
611
|
}),
|
|
603
612
|
],
|
|
604
|
-
})
|
|
613
|
+
});
|
|
605
614
|
```
|
|
606
615
|
|
|
607
616
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -620,11 +629,11 @@
|
|
|
620
629
|
|
|
621
630
|
```javascript
|
|
622
631
|
// bar.ts
|
|
623
|
-
import
|
|
632
|
+
import "background-only";
|
|
624
633
|
|
|
625
634
|
export const bar = () => {
|
|
626
|
-
return
|
|
627
|
-
}
|
|
635
|
+
return "bar";
|
|
636
|
+
};
|
|
628
637
|
```
|
|
629
638
|
|
|
630
639
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -633,15 +642,15 @@
|
|
|
633
642
|
|
|
634
643
|
```tsx
|
|
635
644
|
// App.tsx
|
|
636
|
-
import { bar } from
|
|
645
|
+
import { bar } from "./bar.js";
|
|
637
646
|
|
|
638
647
|
function App() {
|
|
639
|
-
bar()
|
|
648
|
+
bar();
|
|
640
649
|
return (
|
|
641
650
|
<view>
|
|
642
651
|
<text>Hello, Lynx x rspeedy</text>
|
|
643
652
|
</view>
|
|
644
|
-
)
|
|
653
|
+
);
|
|
645
654
|
}
|
|
646
655
|
```
|
|
647
656
|
|
package/dist/index.js
CHANGED
|
@@ -439,13 +439,14 @@ function getHash(config, isProd, experimental_isLazyBundle) {
|
|
|
439
439
|
if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
|
|
440
440
|
return EMPTY_HASH;
|
|
441
441
|
}
|
|
442
|
-
function applyGenerator(api) {
|
|
442
|
+
function applyGenerator(api, options) {
|
|
443
443
|
api.modifyBundlerChain({
|
|
444
444
|
order: 'pre',
|
|
445
445
|
handler: (chain)=>{
|
|
446
|
-
chain.module.rule(
|
|
446
|
+
const rule = chain.module.rule("react:json-parse").test(/\.json$/).type('json').generator({
|
|
447
447
|
JSONParse: false
|
|
448
448
|
});
|
|
449
|
+
if (!options.extractStr) rule.issuerLayer(LAYERS.MAIN_THREAD);
|
|
449
450
|
}
|
|
450
451
|
});
|
|
451
452
|
}
|
|
@@ -1211,7 +1212,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1211
1212
|
applyCSS(api, resolvedOptions);
|
|
1212
1213
|
applyEntry(api, resolvedOptions);
|
|
1213
1214
|
applyBackgroundOnly(api);
|
|
1214
|
-
applyGenerator(api);
|
|
1215
|
+
applyGenerator(api, resolvedOptions);
|
|
1215
1216
|
applyLoaders(api, resolvedOptions);
|
|
1216
1217
|
applyRefresh(api);
|
|
1217
1218
|
applySplitChunksRule(api);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin-canary",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.8-canary-20250715-1443e468",
|
|
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.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.10.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.10.8-canary-20250715-1443e468",
|
|
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.6.18",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.2",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"type-fest": "^4.41.0",
|
|
55
55
|
"typia": "9.3.1",
|
|
56
56
|
"typia-rspack-plugin": "2.1.0",
|
|
57
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.10.1",
|
|
58
57
|
"@lynx-js/react": "npm:@lynx-js/react-canary@0.111.1",
|
|
59
|
-
"@lynx-js/
|
|
60
|
-
"@lynx-js/
|
|
58
|
+
"@lynx-js/react-transform": "0.2.0",
|
|
59
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.10.1",
|
|
60
|
+
"@lynx-js/vitest-setup": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@lynx-js/react": "*"
|