@lynx-js/react-rsbuild-plugin-canary 0.10.2 → 0.10.3-canary-20250604-8a6afe92
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 +39 -28
- package/dist/525.js +21 -0
- package/dist/index.js +93 -23
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.10.3-canary-20250604104722-8a6afe92dc47add49319c57ca27fd086e58ebf12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Better [zustand](https://github.com/pmndrs/zustand) support by creating an alias for `use-sync-external-store`. ([#980](https://github.com/lynx-family/lynx-stack/pull/980))
|
|
8
|
+
|
|
9
|
+
See [lynx-family/lynx-stack#893](https://github.com/lynx-family/lynx-stack/issues/893) for more details.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.3-canary-20250604104722-8a6afe92dc47add49319c57ca27fd086e58ebf12
|
|
13
|
+
|
|
3
14
|
## 0.10.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -37,13 +48,13 @@
|
|
|
37
48
|
example:
|
|
38
49
|
|
|
39
50
|
```js
|
|
40
|
-
import { defineConfig } from
|
|
51
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
41
52
|
|
|
42
53
|
export default defineConfig({
|
|
43
54
|
output: {
|
|
44
55
|
inlineScripts: false,
|
|
45
56
|
},
|
|
46
|
-
})
|
|
57
|
+
});
|
|
47
58
|
```
|
|
48
59
|
|
|
49
60
|
- Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
|
|
@@ -130,7 +141,7 @@
|
|
|
130
141
|
Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
|
|
131
142
|
|
|
132
143
|
```js
|
|
133
|
-
import { defineConfig } from
|
|
144
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
134
145
|
|
|
135
146
|
export default defineConfig({
|
|
136
147
|
tools: {
|
|
@@ -142,7 +153,7 @@
|
|
|
142
153
|
},
|
|
143
154
|
},
|
|
144
155
|
},
|
|
145
|
-
})
|
|
156
|
+
});
|
|
146
157
|
```
|
|
147
158
|
|
|
148
159
|
- Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
|
|
@@ -318,7 +329,7 @@
|
|
|
318
329
|
You may turn it off using `output.minify.css: false`:
|
|
319
330
|
|
|
320
331
|
```js
|
|
321
|
-
import { defineConfig } from
|
|
332
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
322
333
|
|
|
323
334
|
export default defineConfig({
|
|
324
335
|
output: {
|
|
@@ -326,18 +337,18 @@
|
|
|
326
337
|
css: false,
|
|
327
338
|
},
|
|
328
339
|
},
|
|
329
|
-
})
|
|
340
|
+
});
|
|
330
341
|
```
|
|
331
342
|
|
|
332
343
|
Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
|
|
333
344
|
|
|
334
345
|
```js
|
|
335
|
-
import { defineConfig } from
|
|
336
|
-
import { pluginCssMinimizer } from
|
|
346
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
347
|
+
import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
|
|
337
348
|
|
|
338
349
|
export default defineConfig({
|
|
339
350
|
plugins: [pluginCssMinimizer()],
|
|
340
|
-
})
|
|
351
|
+
});
|
|
341
352
|
```
|
|
342
353
|
|
|
343
354
|
### Patch Changes
|
|
@@ -417,18 +428,18 @@
|
|
|
417
428
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
418
429
|
|
|
419
430
|
```js
|
|
420
|
-
import { pluginReactLynx } from
|
|
421
|
-
import { defineConfig } from
|
|
431
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
432
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
422
433
|
|
|
423
434
|
export default defineConfig({
|
|
424
435
|
plugins: [
|
|
425
436
|
pluginReactLynx({
|
|
426
437
|
defineDCE: {
|
|
427
|
-
__SOME_FALSE_DEFINE__:
|
|
438
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
428
439
|
},
|
|
429
440
|
}),
|
|
430
441
|
],
|
|
431
|
-
})
|
|
442
|
+
});
|
|
432
443
|
```
|
|
433
444
|
|
|
434
445
|
Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
|
|
@@ -436,20 +447,20 @@
|
|
|
436
447
|
For example, `import` initialized by dead code will be removed:
|
|
437
448
|
|
|
438
449
|
```js
|
|
439
|
-
import { foo } from
|
|
450
|
+
import { foo } from "bar";
|
|
440
451
|
|
|
441
452
|
if (__SOME_FALSE_DEFINE__) {
|
|
442
|
-
foo()
|
|
443
|
-
console.log(
|
|
453
|
+
foo();
|
|
454
|
+
console.log("dead code");
|
|
444
455
|
} else {
|
|
445
|
-
console.log(
|
|
456
|
+
console.log("reachable code");
|
|
446
457
|
}
|
|
447
458
|
```
|
|
448
459
|
|
|
449
460
|
will be transformed to:
|
|
450
461
|
|
|
451
462
|
```js
|
|
452
|
-
console.log(
|
|
463
|
+
console.log("reachable code");
|
|
453
464
|
```
|
|
454
465
|
|
|
455
466
|
- Updated dependencies [8dd6cca]
|
|
@@ -492,18 +503,18 @@
|
|
|
492
503
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
493
504
|
|
|
494
505
|
```js
|
|
495
|
-
import { pluginReactLynx } from
|
|
496
|
-
import { defineConfig } from
|
|
506
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
507
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
497
508
|
|
|
498
509
|
export default defineConfig({
|
|
499
510
|
plugins: [
|
|
500
511
|
pluginReactLynx({
|
|
501
512
|
compat: {
|
|
502
|
-
removeComponentAttrRegex:
|
|
513
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
503
514
|
},
|
|
504
515
|
}),
|
|
505
516
|
],
|
|
506
|
-
})
|
|
517
|
+
});
|
|
507
518
|
```
|
|
508
519
|
|
|
509
520
|
NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
|
|
@@ -522,11 +533,11 @@
|
|
|
522
533
|
|
|
523
534
|
```javascript
|
|
524
535
|
// bar.ts
|
|
525
|
-
import
|
|
536
|
+
import "background-only";
|
|
526
537
|
|
|
527
538
|
export const bar = () => {
|
|
528
|
-
return
|
|
529
|
-
}
|
|
539
|
+
return "bar";
|
|
540
|
+
};
|
|
530
541
|
```
|
|
531
542
|
|
|
532
543
|
If `bar` is called in `main-thread`, build time error will be triggered.
|
|
@@ -535,15 +546,15 @@
|
|
|
535
546
|
|
|
536
547
|
```tsx
|
|
537
548
|
// App.tsx
|
|
538
|
-
import { bar } from
|
|
549
|
+
import { bar } from "./bar.js";
|
|
539
550
|
|
|
540
551
|
function App() {
|
|
541
|
-
bar()
|
|
552
|
+
bar();
|
|
542
553
|
return (
|
|
543
554
|
<view>
|
|
544
555
|
<text>Hello, Lynx x rspeedy</text>
|
|
545
556
|
</view>
|
|
546
|
-
)
|
|
557
|
+
);
|
|
547
558
|
}
|
|
548
559
|
```
|
|
549
560
|
|
package/dist/525.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const __webpack_ids__ = [
|
|
2
|
+
"525"
|
|
3
|
+
];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
"./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
7
|
+
resolve: ()=>resolve,
|
|
8
|
+
resolveMainThread: ()=>resolveMainThread
|
|
9
|
+
});
|
|
10
|
+
var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
|
|
11
|
+
var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
|
|
12
|
+
var _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
|
|
13
|
+
const __dirname = node_path__WEBPACK_IMPORTED_MODULE_0__["default"].dirname((0, node_url__WEBPACK_IMPORTED_MODULE_1__.fileURLToPath)(import.meta.url));
|
|
14
|
+
const resolve = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
|
|
15
|
+
'import'
|
|
16
|
+
]);
|
|
17
|
+
const resolveMainThread = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
|
|
18
|
+
'lepus'
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
2
1
|
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__ from "@lynx-js/react-webpack-plugin";
|
|
4
2
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__ from "@lynx-js/react-webpack-plugin";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__ from "@lynx-js/template-webpack-plugin";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__ from "@lynx-js/runtime-wrapper-webpack-plugin";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__ from "@lynx-js/react-refresh-webpack-plugin";
|
|
@@ -62,6 +62,15 @@ var __webpack_modules__ = {
|
|
|
62
62
|
};
|
|
63
63
|
exports._assertGuard = _assertGuard;
|
|
64
64
|
},
|
|
65
|
+
"@lynx-js/react-alias-rsbuild-plugin": function(module) {
|
|
66
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__;
|
|
67
|
+
},
|
|
68
|
+
"node:path": function(module) {
|
|
69
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
70
|
+
},
|
|
71
|
+
"node:url": function(module) {
|
|
72
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
|
|
73
|
+
},
|
|
65
74
|
"../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
66
75
|
__webpack_require__.r(__webpack_exports__);
|
|
67
76
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -96,6 +105,7 @@ function __webpack_require__(moduleId) {
|
|
|
96
105
|
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
97
106
|
return module.exports;
|
|
98
107
|
}
|
|
108
|
+
__webpack_require__.m = __webpack_modules__;
|
|
99
109
|
(()=>{
|
|
100
110
|
__webpack_require__.d = (exports, definition)=>{
|
|
101
111
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
@@ -104,6 +114,16 @@ function __webpack_require__(moduleId) {
|
|
|
104
114
|
});
|
|
105
115
|
};
|
|
106
116
|
})();
|
|
117
|
+
(()=>{
|
|
118
|
+
__webpack_require__.f = {};
|
|
119
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
120
|
+
__webpack_require__.f[key](chunkId, promises);
|
|
121
|
+
return promises;
|
|
122
|
+
}, []));
|
|
123
|
+
})();
|
|
124
|
+
(()=>{
|
|
125
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
126
|
+
})();
|
|
107
127
|
(()=>{
|
|
108
128
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
109
129
|
})();
|
|
@@ -117,32 +137,67 @@ function __webpack_require__(moduleId) {
|
|
|
117
137
|
});
|
|
118
138
|
};
|
|
119
139
|
})();
|
|
140
|
+
(()=>{
|
|
141
|
+
var installedChunks = {
|
|
142
|
+
980: 0
|
|
143
|
+
};
|
|
144
|
+
var installChunk = (data)=>{
|
|
145
|
+
var __webpack_ids__ = data.__webpack_ids__;
|
|
146
|
+
var __webpack_modules__ = data.__webpack_modules__;
|
|
147
|
+
var __webpack_runtime__ = data.__webpack_runtime__;
|
|
148
|
+
var moduleId, chunkId, i = 0;
|
|
149
|
+
for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
|
|
150
|
+
if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
|
|
151
|
+
for(; i < __webpack_ids__.length; i++){
|
|
152
|
+
chunkId = __webpack_ids__[i];
|
|
153
|
+
if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
|
|
154
|
+
installedChunks[__webpack_ids__[i]] = 0;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
__webpack_require__.f.j = function(chunkId, promises) {
|
|
158
|
+
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
159
|
+
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
160
|
+
else {
|
|
161
|
+
var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
162
|
+
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
163
|
+
throw e;
|
|
164
|
+
});
|
|
165
|
+
var promise = Promise.race([
|
|
166
|
+
promise,
|
|
167
|
+
new Promise((resolve)=>{
|
|
168
|
+
installedChunkData = installedChunks[chunkId] = [
|
|
169
|
+
resolve
|
|
170
|
+
];
|
|
171
|
+
})
|
|
172
|
+
]);
|
|
173
|
+
promises.push(installedChunkData[1] = promise);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
})();
|
|
177
|
+
var react_alias_rsbuild_plugin_ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
|
|
120
178
|
function applyAlias(api, lazy) {
|
|
121
|
-
return (0,
|
|
179
|
+
return (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
|
|
122
180
|
LAYERS: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS,
|
|
123
181
|
lazy,
|
|
124
182
|
rootPath: api.context.rootPath
|
|
125
183
|
}).setup(api);
|
|
126
184
|
}
|
|
185
|
+
var external_node_path_ = __webpack_require__("node:path");
|
|
186
|
+
var external_node_url_ = __webpack_require__("node:url");
|
|
127
187
|
const DETECT_IMPORT_ERROR = 'react:detect-import-error';
|
|
128
188
|
const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
|
|
129
189
|
const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
|
|
130
190
|
function applyBackgroundOnly(api) {
|
|
131
|
-
const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url));
|
|
132
|
-
const backgroundResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
|
|
133
|
-
'import'
|
|
134
|
-
]);
|
|
135
|
-
const mainThreadResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
|
|
136
|
-
'lepus'
|
|
137
|
-
]);
|
|
138
191
|
api.modifyBundlerChain(async (chain)=>{
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
chain.module.rule(
|
|
192
|
+
const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
193
|
+
const { resolve, resolveMainThread } = await __webpack_require__.e("525").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
|
|
194
|
+
const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
|
|
195
|
+
resolve('background-only'),
|
|
196
|
+
resolveMainThread('background-only')
|
|
197
|
+
]);
|
|
198
|
+
chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', backgroundOnlyMainThread);
|
|
199
|
+
chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).resolve.alias.set('background-only$', backgroundOnly);
|
|
200
|
+
chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnlyMainThread).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(external_node_path_["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
|
|
146
201
|
message: '\'background-only\' cannot be imported from a main-thread module.'
|
|
147
202
|
});
|
|
148
203
|
});
|
|
@@ -154,7 +209,7 @@ function applyCSS(api, options) {
|
|
|
154
209
|
injectStyles: false
|
|
155
210
|
}
|
|
156
211
|
}));
|
|
157
|
-
const __dirname =
|
|
212
|
+
const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
158
213
|
api.modifyBundlerChain(async function(chain, { CHAIN_ID, environment }) {
|
|
159
214
|
const { CssExtractRspackPlugin, CssExtractWebpackPlugin } = await import("@lynx-js/css-extract-webpack-plugin");
|
|
160
215
|
const CssExtractPlugin = 'rspack' === api.context.bundlerType ? CssExtractRspackPlugin : CssExtractWebpackPlugin;
|
|
@@ -171,7 +226,7 @@ function applyCSS(api, options) {
|
|
|
171
226
|
const uses = rule.uses.entries();
|
|
172
227
|
const ruleEntries = rule.entries();
|
|
173
228
|
const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries();
|
|
174
|
-
chain.module.rule(`${ruleName}:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(
|
|
229
|
+
chain.module.rule(`${ruleName}:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(external_node_path_["default"].resolve(__dirname, './loaders/ignore-css-loader')).end().uses.merge(uses).delete(CHAIN_ID.USE.MINI_CSS_EXTRACT).delete(CHAIN_ID.USE.LIGHTNINGCSS).delete(CHAIN_ID.USE.CSS).end().use(CHAIN_ID.USE.CSS).after(CHAIN_ID.USE.IGNORE_CSS).merge(cssLoaderRule).options(normalizeCssLoaderOptions(cssLoaderRule.options, true)).end();
|
|
175
230
|
});
|
|
176
231
|
const inlineCSSRules = [
|
|
177
232
|
CHAIN_ID.RULE.CSS_INLINE,
|
|
@@ -244,8 +299,8 @@ function applyEntry(api, options) {
|
|
|
244
299
|
const { imports } = getChunks(entryName, entryPoint.values());
|
|
245
300
|
const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle';
|
|
246
301
|
const mainThreadEntry = `${entryName}__main-thread`;
|
|
247
|
-
const mainThreadName =
|
|
248
|
-
const backgroundName =
|
|
302
|
+
const mainThreadName = external_node_path_["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
|
|
303
|
+
const backgroundName = external_node_path_["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd, experimental_isLazyBundle));
|
|
249
304
|
const backgroundEntry = entryName;
|
|
250
305
|
mainThreadChunks.push(mainThreadName);
|
|
251
306
|
chain.entry(mainThreadEntry).add({
|
|
@@ -281,7 +336,7 @@ function applyEntry(api, options) {
|
|
|
281
336
|
backgroundEntry
|
|
282
337
|
],
|
|
283
338
|
filename: templateFilename.replaceAll('[name]', entryName).replaceAll('[platform]', environment.name),
|
|
284
|
-
intermediate:
|
|
339
|
+
intermediate: external_node_path_["default"].posix.join(DEFAULT_DIST_PATH_INTERMEDIATE, entryName),
|
|
285
340
|
customCSSInheritanceList,
|
|
286
341
|
debugInfoOutside,
|
|
287
342
|
defaultDisplayLinear,
|
|
@@ -455,7 +510,7 @@ function applyRefresh(api) {
|
|
|
455
510
|
});
|
|
456
511
|
}
|
|
457
512
|
function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) {
|
|
458
|
-
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(
|
|
513
|
+
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
|
|
459
514
|
}
|
|
460
515
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
461
516
|
const applySplitChunksRule = (api)=>{
|
|
@@ -520,6 +575,20 @@ function applySWC(api) {
|
|
|
520
575
|
}
|
|
521
576
|
}, config));
|
|
522
577
|
}
|
|
578
|
+
function applyUseSyncExternalStore(api) {
|
|
579
|
+
api.modifyBundlerChain(async (chain)=>{
|
|
580
|
+
const { resolve } = await __webpack_require__.e("525").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
|
|
581
|
+
const useSyncExternalStoreEntries = [
|
|
582
|
+
'use-sync-external-store',
|
|
583
|
+
'use-sync-external-store/with-selector',
|
|
584
|
+
'use-sync-external-store/shim',
|
|
585
|
+
'use-sync-external-store/shim/with-selector'
|
|
586
|
+
];
|
|
587
|
+
await Promise.all(useSyncExternalStoreEntries.map((entry)=>resolve(`@lynx-js/${entry}`).then((value)=>{
|
|
588
|
+
chain.resolve.alias.set(`${entry}$`, value);
|
|
589
|
+
})));
|
|
590
|
+
});
|
|
591
|
+
}
|
|
523
592
|
var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
|
|
524
593
|
var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_assertGuard.js");
|
|
525
594
|
const validateConfig = (()=>{
|
|
@@ -1144,6 +1213,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1144
1213
|
applyRefresh(api);
|
|
1145
1214
|
applySplitChunksRule(api);
|
|
1146
1215
|
applySWC(api);
|
|
1216
|
+
applyUseSyncExternalStore(api);
|
|
1147
1217
|
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
1148
1218
|
const userConfig = api.getRsbuildConfig('original');
|
|
1149
1219
|
if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
|
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.3-canary-20250604-8a6afe92",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.5.4",
|
|
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.3-canary-20250604-8a6afe92",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.3.3",
|
|
38
38
|
"@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.6.15",
|
|
39
39
|
"@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.0",
|
|
40
40
|
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.7.1",
|
|
41
|
+
"@lynx-js/use-sync-external-store": "npm:@lynx-js/use-sync-external-store-canary@1.5.0",
|
|
41
42
|
"background-only": "npm:background-only-canary@0.0.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
@@ -54,9 +55,9 @@
|
|
|
54
55
|
"typia": "9.3.1",
|
|
55
56
|
"typia-rspack-plugin": "2.1.0",
|
|
56
57
|
"@lynx-js/react": "npm:@lynx-js/react-canary@0.109.1",
|
|
58
|
+
"@lynx-js/react-transform": "0.2.0",
|
|
57
59
|
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.9.8",
|
|
58
|
-
"@lynx-js/vitest-setup": "0.0.0"
|
|
59
|
-
"@lynx-js/react-transform": "0.2.0"
|
|
60
|
+
"@lynx-js/vitest-setup": "0.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"@lynx-js/react": "*"
|