@lynx-js/react-rsbuild-plugin 0.9.7 → 0.9.9
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 +51 -0
- package/dist/index.js +35 -16
- package/package.json +13 -12
- package/dist/background-only/empty.d.ts +0 -1
- package/dist/background-only/error.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.9.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix runtime error: "SyntaxError: Identifier 'i' has already been declared". ([#651](https://github.com/lynx-family/lynx-stack/pull/651))
|
|
8
|
+
|
|
9
|
+
- Enable runtime profiling when `performance.profile` is set to true. ([#722](https://github.com/lynx-family/lynx-stack/pull/722))
|
|
10
|
+
|
|
11
|
+
- fix: resolve page crash on development mode when enabling `experimental_isLazyBundle: true` ([#653](https://github.com/lynx-family/lynx-stack/pull/653))
|
|
12
|
+
|
|
13
|
+
- Support `@lynx-js/react` v0.108.0. ([#649](https://github.com/lynx-family/lynx-stack/pull/649))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`ea4da1a`](https://github.com/lynx-family/lynx-stack/commit/ea4da1af0ff14e2480e49f7004a3a2616594968d), [`ca15dda`](https://github.com/lynx-family/lynx-stack/commit/ca15dda4122c5eedc1fd82cefb0cd9af7fdaa47e), [`f8d369d`](https://github.com/lynx-family/lynx-stack/commit/f8d369ded802f8d7b9b859b1f150015d65773b0f), [`ea4da1a`](https://github.com/lynx-family/lynx-stack/commit/ea4da1af0ff14e2480e49f7004a3a2616594968d)]:
|
|
16
|
+
- @lynx-js/react-webpack-plugin@0.6.13
|
|
17
|
+
- @lynx-js/runtime-wrapper-webpack-plugin@0.0.10
|
|
18
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.9.9
|
|
19
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.2
|
|
20
|
+
|
|
21
|
+
## 0.9.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Support @lynx-js/react v0.107.0 ([#438](https://github.com/lynx-family/lynx-stack/pull/438))
|
|
26
|
+
|
|
27
|
+
- fix(web): `:root` not work on web platform ([#607](https://github.com/lynx-family/lynx-stack/pull/607))
|
|
28
|
+
|
|
29
|
+
Note: To solve this issue, you need to upgrade your `react-rsbuild-plugin`
|
|
30
|
+
|
|
31
|
+
- Refactor: Replace built-in `background-only` implementation with npm package ([#602](https://github.com/lynx-family/lynx-stack/pull/602))
|
|
32
|
+
|
|
33
|
+
Previously we maintained custom files:
|
|
34
|
+
|
|
35
|
+
- `empty.ts` for background thread
|
|
36
|
+
- `error.ts` for main thread validation
|
|
37
|
+
|
|
38
|
+
Now adopting the standard `background-only` npm package
|
|
39
|
+
|
|
40
|
+
- fix(web): css selector not work for selectors with combinator and pseudo-class on WEB ([#608](https://github.com/lynx-family/lynx-stack/pull/608))
|
|
41
|
+
|
|
42
|
+
like `.parent > :not([hidden]) ~ :not([hidden])`
|
|
43
|
+
|
|
44
|
+
you will need to upgrade your `react-rsbuild-plugin` to fix this issue
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`6a5fc80`](https://github.com/lynx-family/lynx-stack/commit/6a5fc80716e668bacf4ce4ff59c569683ace0ba2), [`06bb78a`](https://github.com/lynx-family/lynx-stack/commit/06bb78a6b93d4a7be7177a6269dd4337852ce90d), [`f3afaf6`](https://github.com/lynx-family/lynx-stack/commit/f3afaf6c7919d3fe60ac2dfcd8af77178436f785), [`bf9c685`](https://github.com/lynx-family/lynx-stack/commit/bf9c68501205b038043e2f315e0a690c8bc46829), [`5269cab`](https://github.com/lynx-family/lynx-stack/commit/5269cabef7609159bdd0dd14a03c5da667907424)]:
|
|
47
|
+
- @lynx-js/react-webpack-plugin@0.6.12
|
|
48
|
+
- @lynx-js/web-webpack-plugin@0.6.6
|
|
49
|
+
- @lynx-js/template-webpack-plugin@0.6.10
|
|
50
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.9.8
|
|
51
|
+
- @lynx-js/react-refresh-webpack-plugin@0.3.2
|
|
52
|
+
- @lynx-js/css-extract-webpack-plugin@0.5.3
|
|
53
|
+
|
|
3
54
|
## 0.9.7
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -130,10 +130,20 @@ const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
|
|
|
130
130
|
const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
|
|
131
131
|
function applyBackgroundOnly(api) {
|
|
132
132
|
const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url));
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
const backgroundResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
|
|
134
|
+
'import'
|
|
135
|
+
]);
|
|
136
|
+
const mainThreadResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
|
|
137
|
+
'lepus'
|
|
138
|
+
]);
|
|
139
|
+
api.modifyBundlerChain(async (chain)=>{
|
|
140
|
+
const backgroundOnly = {
|
|
141
|
+
background: await backgroundResolve('background-only'),
|
|
142
|
+
mainThread: await mainThreadResolve('background-only')
|
|
143
|
+
};
|
|
144
|
+
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$', backgroundOnly.mainThread);
|
|
145
|
+
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.background);
|
|
146
|
+
chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnly.mainThread).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
|
|
137
147
|
message: '\'background-only\' cannot be imported from a main-thread module.'
|
|
138
148
|
});
|
|
139
149
|
});
|
|
@@ -236,7 +246,7 @@ function applyEntry(api, options) {
|
|
|
236
246
|
const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle';
|
|
237
247
|
const mainThreadEntry = `${entryName}__main-thread`;
|
|
238
248
|
const mainThreadName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
|
|
239
|
-
const backgroundName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd));
|
|
249
|
+
const backgroundName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd, experimental_isLazyBundle));
|
|
240
250
|
const backgroundEntry = entryName;
|
|
241
251
|
mainThreadChunks.push(mainThreadName);
|
|
242
252
|
chain.entry(mainThreadEntry).add({
|
|
@@ -245,7 +255,7 @@ function applyEntry(api, options) {
|
|
|
245
255
|
filename: mainThreadName
|
|
246
256
|
}).when(isDev && !isWeb, (entry)=>{
|
|
247
257
|
const require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
248
|
-
entry.
|
|
258
|
+
entry.prepend({
|
|
249
259
|
layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD,
|
|
250
260
|
import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs')
|
|
251
261
|
});
|
|
@@ -254,13 +264,13 @@ function applyEntry(api, options) {
|
|
|
254
264
|
import: imports,
|
|
255
265
|
filename: backgroundName
|
|
256
266
|
}).when(isDev && !isWeb, (entry)=>{
|
|
257
|
-
entry.
|
|
267
|
+
entry.prepend({
|
|
258
268
|
layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
|
|
259
269
|
import: '@rspack/core/hot/dev-server'
|
|
260
|
-
}).
|
|
270
|
+
}).prepend({
|
|
261
271
|
layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
|
|
262
272
|
import: '@lynx-js/webpack-dev-transport/client'
|
|
263
|
-
}).
|
|
273
|
+
}).prepend({
|
|
264
274
|
layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
|
|
265
275
|
import: '@lynx-js/react/refresh'
|
|
266
276
|
});
|
|
@@ -298,18 +308,26 @@ function applyEntry(api, options) {
|
|
|
298
308
|
if (isLynx) chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__.RuntimeWrapperWebpackPlugin, [
|
|
299
309
|
{
|
|
300
310
|
injectVars (vars) {
|
|
311
|
+
const UNUSED_VARS = new Set([
|
|
312
|
+
'Card',
|
|
313
|
+
'Component',
|
|
314
|
+
'ReactLynx',
|
|
315
|
+
'Behavior'
|
|
316
|
+
]);
|
|
301
317
|
return vars.map((name)=>{
|
|
302
|
-
if (
|
|
318
|
+
if (UNUSED_VARS.has(name)) return `__${name}`;
|
|
303
319
|
return name;
|
|
304
320
|
});
|
|
305
321
|
},
|
|
306
322
|
targetSdkVersion,
|
|
307
|
-
test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js
|
|
323
|
+
test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/,
|
|
324
|
+
experimental_isLazyBundle
|
|
308
325
|
}
|
|
309
326
|
]).end().plugin(`${__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin.name}`).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin, [
|
|
310
327
|
{}
|
|
311
328
|
]).end();
|
|
312
329
|
if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_web_webpack_plugin_6ba19e5a__.WebWebpackPlugin, []).end();
|
|
330
|
+
const rsbuildConfig = api.getRsbuildConfig();
|
|
313
331
|
chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin, [
|
|
314
332
|
{
|
|
315
333
|
disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
|
|
@@ -317,7 +335,8 @@ function applyEntry(api, options) {
|
|
|
317
335
|
enableSSR,
|
|
318
336
|
mainThreadChunks,
|
|
319
337
|
extractStr,
|
|
320
|
-
experimental_isLazyBundle
|
|
338
|
+
experimental_isLazyBundle,
|
|
339
|
+
profile: rsbuildConfig.performance?.profile
|
|
321
340
|
}
|
|
322
341
|
]);
|
|
323
342
|
});
|
|
@@ -347,15 +366,15 @@ function getChunks(entryName, entryValue) {
|
|
|
347
366
|
imports
|
|
348
367
|
};
|
|
349
368
|
}
|
|
350
|
-
function getBackgroundFilename(entryName, config, isProd) {
|
|
369
|
+
function getBackgroundFilename(entryName, config, isProd, experimental_isLazyBundle) {
|
|
351
370
|
const { filename } = config.output;
|
|
352
371
|
if ('string' == typeof filename.js) return filename.js.replaceAll('[name]', entryName).replaceAll('.js', '/background.js');
|
|
353
|
-
return `${entryName}/background${getHash(config, isProd)}.js`;
|
|
372
|
+
return `${entryName}/background${getHash(config, isProd, experimental_isLazyBundle)}.js`;
|
|
354
373
|
}
|
|
355
|
-
function getHash(config, isProd) {
|
|
374
|
+
function getHash(config, isProd, experimental_isLazyBundle) {
|
|
356
375
|
if ('string' == typeof config.output?.filenameHash) return config.output.filenameHash ? `.[${config.output.filenameHash}]` : EMPTY_HASH;
|
|
357
376
|
if (config.output?.filenameHash === false) return EMPTY_HASH;
|
|
358
|
-
if (isProd) return DEFAULT_FILENAME_HASH;
|
|
377
|
+
if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
|
|
359
378
|
return EMPTY_HASH;
|
|
360
379
|
}
|
|
361
380
|
function applyGenerator(api) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,32 +33,33 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@lynx-js/css-extract-webpack-plugin": "0.5.3",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "0.9.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.9.9",
|
|
37
37
|
"@lynx-js/react-refresh-webpack-plugin": "0.3.2",
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "0.6.
|
|
39
|
-
"@lynx-js/runtime-wrapper-webpack-plugin": "0.0.
|
|
40
|
-
"@lynx-js/template-webpack-plugin": "0.6.
|
|
41
|
-
"@lynx-js/web-webpack-plugin": "0.6.
|
|
38
|
+
"@lynx-js/react-webpack-plugin": "0.6.13",
|
|
39
|
+
"@lynx-js/runtime-wrapper-webpack-plugin": "0.0.10",
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "0.6.10",
|
|
41
|
+
"@lynx-js/web-webpack-plugin": "0.6.6",
|
|
42
|
+
"background-only": "^0.0.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@microsoft/api-extractor": "7.52.
|
|
45
|
+
"@microsoft/api-extractor": "7.52.7",
|
|
45
46
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
46
|
-
"@rsbuild/core": "1.3.
|
|
47
|
+
"@rsbuild/core": "1.3.17",
|
|
47
48
|
"@rsbuild/plugin-sass": "1.3.1",
|
|
48
49
|
"@rsbuild/plugin-typed-css-modules": "1.0.2",
|
|
49
50
|
"@rsbuild/plugin-webpack-swc": "1.1.0",
|
|
50
51
|
"@rsbuild/webpack": "1.3.0",
|
|
51
52
|
"@samchon/openapi": "4.1.0",
|
|
52
53
|
"tailwindcss": "^3.4.17",
|
|
53
|
-
"type-fest": "^4.
|
|
54
|
+
"type-fest": "^4.41.0",
|
|
54
55
|
"typia": "9.1.1",
|
|
55
56
|
"typia-rspack-plugin": "2.0.1",
|
|
56
|
-
"@lynx-js/react": "0.
|
|
57
|
-
"@lynx-js/rspeedy": "0.9.
|
|
57
|
+
"@lynx-js/react": "0.108.0",
|
|
58
|
+
"@lynx-js/rspeedy": "0.9.4",
|
|
58
59
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
|
-
"@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0"
|
|
62
|
+
"@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0"
|
|
62
63
|
},
|
|
63
64
|
"peerDependenciesMeta": {
|
|
64
65
|
"@lynx-js/react": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|