@lynx-js/react-rsbuild-plugin-canary 0.10.12 → 0.10.13-canary-20250820-f0d483ca
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 +49 -36
- package/dist/index.d.ts +1 -1
- package/dist/index.js +56 -62
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.10.13-canary-20250820072701-f0d483ca2d3e208a618727590061b0babc075737
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support using multiple times in different environments. ([#1498](https://github.com/lynx-family/lynx-stack/pull/1498))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`f0d483c`](https://github.com/lynx-family/lynx-stack/commit/f0d483ca2d3e208a618727590061b0babc075737), [`a753712`](https://github.com/lynx-family/lynx-stack/commit/a7537125cf7a9bd25ba2d94872496f8783310079), [`e0c0b3a`](https://github.com/lynx-family/lynx-stack/commit/e0c0b3a0109d90f3a8cee6825d70c59e36f968be)]:
|
|
10
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.13-canary-20250820072701-f0d483ca2d3e208a618727590061b0babc075737
|
|
11
|
+
- @lynx-js/react@0.112.4-canary-20250820072701-f0d483ca2d3e208a618727590061b0babc075737
|
|
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.6.19
|
|
15
|
+
|
|
3
16
|
## 0.10.12
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -102,28 +115,28 @@
|
|
|
102
115
|
|
|
103
116
|
```ts
|
|
104
117
|
type InlineChunkTestFunction = (params: {
|
|
105
|
-
size: number
|
|
106
|
-
name: string
|
|
107
|
-
}) => boolean
|
|
118
|
+
size: number;
|
|
119
|
+
name: string;
|
|
120
|
+
}) => boolean;
|
|
108
121
|
|
|
109
|
-
type InlineChunkTest = RegExp | InlineChunkTestFunction
|
|
122
|
+
type InlineChunkTest = RegExp | InlineChunkTestFunction;
|
|
110
123
|
|
|
111
124
|
type InlineChunkConfig =
|
|
112
125
|
| boolean
|
|
113
126
|
| InlineChunkTest
|
|
114
|
-
| { enable?: boolean |
|
|
127
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
115
128
|
```
|
|
116
129
|
|
|
117
130
|
```ts
|
|
118
|
-
import { defineConfig } from
|
|
131
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
119
132
|
|
|
120
133
|
export default defineConfig({
|
|
121
134
|
output: {
|
|
122
135
|
inlineScripts: ({ name, size }) => {
|
|
123
|
-
return name.includes(
|
|
136
|
+
return name.includes("foo") && size < 1000;
|
|
124
137
|
},
|
|
125
138
|
},
|
|
126
|
-
})
|
|
139
|
+
});
|
|
127
140
|
```
|
|
128
141
|
|
|
129
142
|
- 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)]:
|
|
@@ -203,13 +216,13 @@
|
|
|
203
216
|
example:
|
|
204
217
|
|
|
205
218
|
```js
|
|
206
|
-
import { defineConfig } from
|
|
219
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
207
220
|
|
|
208
221
|
export default defineConfig({
|
|
209
222
|
output: {
|
|
210
223
|
inlineScripts: false,
|
|
211
224
|
},
|
|
212
|
-
})
|
|
225
|
+
});
|
|
213
226
|
```
|
|
214
227
|
|
|
215
228
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -296,7 +309,7 @@
|
|
|
296
309
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
297
310
|
|
|
298
311
|
```js
|
|
299
|
-
import { defineConfig } from
|
|
312
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
300
313
|
|
|
301
314
|
export default defineConfig({
|
|
302
315
|
tools: {
|
|
@@ -308,7 +321,7 @@
|
|
|
308
321
|
},
|
|
309
322
|
},
|
|
310
323
|
},
|
|
311
|
-
})
|
|
324
|
+
});
|
|
312
325
|
```
|
|
313
326
|
|
|
314
327
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -484,7 +497,7 @@
|
|
|
484
497
|
You may turn it off using `output.minify.css: false`:
|
|
485
498
|
|
|
486
499
|
```js
|
|
487
|
-
import { defineConfig } from
|
|
500
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
488
501
|
|
|
489
502
|
export default defineConfig({
|
|
490
503
|
output: {
|
|
@@ -492,18 +505,18 @@
|
|
|
492
505
|
css: false,
|
|
493
506
|
},
|
|
494
507
|
},
|
|
495
|
-
})
|
|
508
|
+
});
|
|
496
509
|
```
|
|
497
510
|
|
|
498
511
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
499
512
|
|
|
500
513
|
```js
|
|
501
|
-
import { defineConfig } from
|
|
502
|
-
import { pluginCssMinimizer } from
|
|
514
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
515
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
503
516
|
|
|
504
517
|
export default defineConfig({
|
|
505
518
|
plugins: [pluginCssMinimizer()],
|
|
506
|
-
})
|
|
519
|
+
});
|
|
507
520
|
```
|
|
508
521
|
|
|
509
522
|
### Patch Changes
|
|
@@ -583,18 +596,18 @@
|
|
|
583
596
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
584
597
|
|
|
585
598
|
```js
|
|
586
|
-
import { pluginReactLynx } from
|
|
587
|
-
import { defineConfig } from
|
|
599
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
600
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
588
601
|
|
|
589
602
|
export default defineConfig({
|
|
590
603
|
plugins: [
|
|
591
604
|
pluginReactLynx({
|
|
592
605
|
defineDCE: {
|
|
593
|
-
__SOME_FALSE_DEFINE__:
|
|
606
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
594
607
|
},
|
|
595
608
|
}),
|
|
596
609
|
],
|
|
597
|
-
})
|
|
610
|
+
});
|
|
598
611
|
```
|
|
599
612
|
|
|
600
613
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -602,20 +615,20 @@
|
|
|
602
615
|
For example, `import` initialized by dead code will be removed:
|
|
603
616
|
|
|
604
617
|
```js
|
|
605
|
-
import { foo } from
|
|
618
|
+
import { foo } from "bar";
|
|
606
619
|
|
|
607
620
|
if (__SOME_FALSE_DEFINE__) {
|
|
608
|
-
foo()
|
|
609
|
-
console.log(
|
|
621
|
+
foo();
|
|
622
|
+
console.log("dead code");
|
|
610
623
|
} else {
|
|
611
|
-
console.log(
|
|
624
|
+
console.log("reachable code");
|
|
612
625
|
}
|
|
613
626
|
```
|
|
614
627
|
|
|
615
628
|
will be transformed to:
|
|
616
629
|
|
|
617
630
|
```js
|
|
618
|
-
console.log(
|
|
631
|
+
console.log("reachable code");
|
|
619
632
|
```
|
|
620
633
|
|
|
621
634
|
- Updated dependencies [8dd6cca]
|
|
@@ -658,18 +671,18 @@
|
|
|
658
671
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
659
672
|
|
|
660
673
|
```js
|
|
661
|
-
import { pluginReactLynx } from
|
|
662
|
-
import { defineConfig } from
|
|
674
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
675
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
663
676
|
|
|
664
677
|
export default defineConfig({
|
|
665
678
|
plugins: [
|
|
666
679
|
pluginReactLynx({
|
|
667
680
|
compat: {
|
|
668
|
-
removeComponentAttrRegex:
|
|
681
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
669
682
|
},
|
|
670
683
|
}),
|
|
671
684
|
],
|
|
672
|
-
})
|
|
685
|
+
});
|
|
673
686
|
```
|
|
674
687
|
|
|
675
688
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -688,11 +701,11 @@
|
|
|
688
701
|
|
|
689
702
|
```javascript
|
|
690
703
|
// bar.ts
|
|
691
|
-
import
|
|
704
|
+
import "background-only";
|
|
692
705
|
|
|
693
706
|
export const bar = () => {
|
|
694
|
-
return
|
|
695
|
-
}
|
|
707
|
+
return "bar";
|
|
708
|
+
};
|
|
696
709
|
```
|
|
697
710
|
|
|
698
711
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -701,15 +714,15 @@
|
|
|
701
714
|
|
|
702
715
|
```tsx
|
|
703
716
|
// App.tsx
|
|
704
|
-
import { bar } from
|
|
717
|
+
import { bar } from "./bar.js";
|
|
705
718
|
|
|
706
719
|
function App() {
|
|
707
|
-
bar()
|
|
720
|
+
bar();
|
|
708
721
|
return (
|
|
709
722
|
<view>
|
|
710
723
|
<text>Hello, Lynx x rspeedy</text>
|
|
711
724
|
</view>
|
|
712
|
-
)
|
|
725
|
+
);
|
|
713
726
|
}
|
|
714
727
|
```
|
|
715
728
|
|
package/dist/index.d.ts
CHANGED
|
@@ -426,7 +426,7 @@ export { LAYERS }
|
|
|
426
426
|
*
|
|
427
427
|
* @public
|
|
428
428
|
*/
|
|
429
|
-
export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): RsbuildPlugin;
|
|
429
|
+
export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): RsbuildPlugin[];
|
|
430
430
|
|
|
431
431
|
/**
|
|
432
432
|
* Options of {@link pluginReactLynx}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
|
|
6
|
-
import { CSSPlugins, LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
|
|
7
6
|
import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
|
|
7
|
+
import { LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
|
|
8
8
|
import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
|
|
9
9
|
var __webpack_modules__ = {
|
|
10
10
|
"../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
|
|
@@ -175,13 +175,6 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
175
175
|
};
|
|
176
176
|
})();
|
|
177
177
|
var react_alias_rsbuild_plugin_ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
|
|
178
|
-
function applyAlias(api, lazy) {
|
|
179
|
-
return (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
|
|
180
|
-
LAYERS: LAYERS,
|
|
181
|
-
lazy,
|
|
182
|
-
rootPath: api.context.rootPath
|
|
183
|
-
}).setup(api);
|
|
184
|
-
}
|
|
185
178
|
var external_node_path_ = __webpack_require__("node:path");
|
|
186
179
|
var external_node_url_ = __webpack_require__("node:url");
|
|
187
180
|
const DETECT_IMPORT_ERROR = 'react:detect-import-error';
|
|
@@ -248,9 +241,7 @@ function applyCSS(api, options) {
|
|
|
248
241
|
enableCSSSelector,
|
|
249
242
|
enableCSSInvalidation,
|
|
250
243
|
targetSdkVersion,
|
|
251
|
-
cssPlugins: [
|
|
252
|
-
CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
|
|
253
|
-
]
|
|
244
|
+
cssPlugins: []
|
|
254
245
|
}
|
|
255
246
|
]).init((_, args)=>new CssExtractPlugin(...args)).end().end();
|
|
256
247
|
chain.module.when(void 0 === enableRemoveCSSScope, (module)=>module.rule('lynx.css.scoped').test(/\.css$/).resourceQuery({
|
|
@@ -353,9 +344,7 @@ function applyEntry(api, options) {
|
|
|
353
344
|
removeDescendantSelectorScope,
|
|
354
345
|
targetSdkVersion,
|
|
355
346
|
experimental_isLazyBundle,
|
|
356
|
-
cssPlugins: [
|
|
357
|
-
CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
|
|
358
|
-
]
|
|
347
|
+
cssPlugins: []
|
|
359
348
|
}
|
|
360
349
|
]).end();
|
|
361
350
|
});
|
|
@@ -1221,56 +1210,61 @@ function pluginReactLynx(userOptions) {
|
|
|
1221
1210
|
targetSdkVersion: engineVersion,
|
|
1222
1211
|
engineVersion
|
|
1223
1212
|
});
|
|
1224
|
-
return
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1213
|
+
return [
|
|
1214
|
+
(0, react_alias_rsbuild_plugin_.pluginReactAlias)({
|
|
1215
|
+
lazy: resolvedOptions.experimental_isLazyBundle,
|
|
1216
|
+
LAYERS: LAYERS
|
|
1217
|
+
}),
|
|
1218
|
+
{
|
|
1219
|
+
name: 'lynx:react',
|
|
1220
|
+
pre: [
|
|
1221
|
+
'lynx:rsbuild:plugin-api'
|
|
1222
|
+
],
|
|
1223
|
+
setup (api) {
|
|
1224
|
+
applyCSS(api, resolvedOptions);
|
|
1225
|
+
applyEntry(api, resolvedOptions);
|
|
1226
|
+
applyBackgroundOnly(api);
|
|
1227
|
+
applyGenerator(api, resolvedOptions);
|
|
1228
|
+
applyLoaders(api, resolvedOptions);
|
|
1229
|
+
applyRefresh(api);
|
|
1230
|
+
applySplitChunksRule(api);
|
|
1231
|
+
applySWC(api);
|
|
1232
|
+
applyUseSyncExternalStore(api);
|
|
1233
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
1234
|
+
const userConfig = api.getRsbuildConfig('original');
|
|
1235
|
+
if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
|
|
1236
|
+
source: {
|
|
1237
|
+
include: [
|
|
1238
|
+
/\.(?:js|mjs|cjs)$/
|
|
1239
|
+
]
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
|
|
1243
|
+
output: {
|
|
1244
|
+
inlineScripts: true
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
config = mergeRsbuildConfig({
|
|
1248
|
+
tools: {
|
|
1249
|
+
rspack: {
|
|
1250
|
+
output: {
|
|
1251
|
+
iife: false
|
|
1252
|
+
}
|
|
1259
1253
|
}
|
|
1260
1254
|
}
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1255
|
+
}, config);
|
|
1256
|
+
return config;
|
|
1257
|
+
});
|
|
1258
|
+
if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
|
|
1259
|
+
const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
|
|
1260
|
+
const require = createRequire(import.meta.url);
|
|
1261
|
+
const { version } = require('../package.json');
|
|
1262
|
+
rspeedyAPIs.debug(()=>{
|
|
1263
|
+
const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
|
|
1264
|
+
return `Using @lynx-js/react-webpack-plugin v${version} at ${webpackPluginPath}`;
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1273
1267
|
}
|
|
1274
|
-
|
|
1268
|
+
];
|
|
1275
1269
|
}
|
|
1276
1270
|
export { LAYERS, pluginReactLynx };
|
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.13-canary-20250820-f0d483ca",
|
|
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.2",
|
|
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.13-canary-20250820-f0d483ca",
|
|
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.19",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.2",
|
|
@@ -47,14 +47,16 @@
|
|
|
47
47
|
"@rsbuild/core": "1.4.15",
|
|
48
48
|
"@rsbuild/plugin-sass": "1.3.5",
|
|
49
49
|
"@rsbuild/plugin-typed-css-modules": "1.0.3",
|
|
50
|
+
"rsbuild-plugin-arethetypeswrong": "0.1.1",
|
|
51
|
+
"rsbuild-plugin-publint": "0.3.3",
|
|
50
52
|
"tailwindcss": "^3.4.17",
|
|
51
53
|
"type-fest": "^4.41.0",
|
|
52
54
|
"typia": "9.7.1",
|
|
53
55
|
"typia-rspack-plugin": "2.2.1",
|
|
54
|
-
"@lynx-js/react": "npm:@lynx-js/react-canary@0.112.
|
|
56
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.112.4-canary-20250820-f0d483ca",
|
|
55
57
|
"@lynx-js/react-transform": "0.2.0",
|
|
56
|
-
"@lynx-js/
|
|
57
|
-
"@lynx-js/
|
|
58
|
+
"@lynx-js/vitest-setup": "0.0.0",
|
|
59
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.10.8-canary-20250820-f0d483ca"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
62
|
"@lynx-js/react": "*"
|