@lynx-js/react-rsbuild-plugin-canary 0.10.3-canary-20250605-2d36a78f → 0.10.3-canary-20250605-01f94c32
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 +4 -4
- package/dist/index.js +37 -38
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
-
## 0.10.3-canary-
|
|
3
|
+
## 0.10.3-canary-20250605165823-01f94c3245202d31f7dd990c1e99e1f2ef24bc58
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
See [lynx-family/lynx-stack#893](https://github.com/lynx-family/lynx-stack/issues/893) for more details.
|
|
10
10
|
|
|
11
11
|
- Updated dependencies [[`33f7aa4`](https://github.com/lynx-family/lynx-stack/commit/33f7aa4eb4bb257484b58c4307005193b0ae8f08)]:
|
|
12
|
-
- @lynx-js/react@0.109.2-canary-
|
|
13
|
-
- @lynx-js/react-alias-rsbuild-plugin@0.10.3-canary-
|
|
12
|
+
- @lynx-js/react@0.109.2-canary-20250605165823-01f94c3245202d31f7dd990c1e99e1f2ef24bc58
|
|
13
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.10.3-canary-20250605165823-01f94c3245202d31f7dd990c1e99e1f2ef24bc58
|
|
14
14
|
- @lynx-js/use-sync-external-store@1.5.0
|
|
15
15
|
- @lynx-js/react-refresh-webpack-plugin@0.3.3
|
|
16
16
|
- @lynx-js/react-webpack-plugin@0.6.15
|
|
17
17
|
- @lynx-js/css-extract-webpack-plugin@0.5.4
|
|
18
|
-
- @lynx-js/template-webpack-plugin@0.7.2-canary-
|
|
18
|
+
- @lynx-js/template-webpack-plugin@0.7.2-canary-20250605165823-01f94c3245202d31f7dd990c1e99e1f2ef24bc58
|
|
19
19
|
|
|
20
20
|
## 0.10.2
|
|
21
21
|
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin";
|
|
2
2
|
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
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
|
|
6
|
+
import { CSSPlugins, LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
|
|
7
|
+
import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
|
|
8
|
+
import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
|
|
9
9
|
var __webpack_modules__ = {
|
|
10
10
|
"../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
|
|
11
11
|
exports._accessExpressionAsString = void 0;
|
|
@@ -177,7 +177,7 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
177
177
|
var react_alias_rsbuild_plugin_ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
|
|
178
178
|
function applyAlias(api, lazy) {
|
|
179
179
|
return (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
|
|
180
|
-
LAYERS:
|
|
180
|
+
LAYERS: LAYERS,
|
|
181
181
|
lazy,
|
|
182
182
|
rootPath: api.context.rootPath
|
|
183
183
|
}).setup(api);
|
|
@@ -195,9 +195,9 @@ function applyBackgroundOnly(api) {
|
|
|
195
195
|
resolve('background-only'),
|
|
196
196
|
resolveMainThread('background-only')
|
|
197
197
|
]);
|
|
198
|
-
chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(
|
|
199
|
-
chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(
|
|
200
|
-
chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnlyMainThread).issuerLayer(
|
|
198
|
+
chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', backgroundOnlyMainThread);
|
|
199
|
+
chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(LAYERS.BACKGROUND).resolve.alias.set('background-only$', backgroundOnly);
|
|
200
|
+
chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnlyMainThread).issuerLayer(LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(external_node_path_["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
|
|
201
201
|
message: '\'background-only\' cannot be imported from a main-thread module.'
|
|
202
202
|
});
|
|
203
203
|
});
|
|
@@ -222,11 +222,11 @@ function applyCSS(api, options) {
|
|
|
222
222
|
cssRules.filter((rule)=>chain.module.rules.has(rule)).forEach((ruleName)=>{
|
|
223
223
|
const rule = chain.module.rule(ruleName);
|
|
224
224
|
removeLightningCSS(rule);
|
|
225
|
-
rule.issuerLayer(
|
|
225
|
+
rule.issuerLayer(LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end();
|
|
226
226
|
const uses = rule.uses.entries();
|
|
227
227
|
const ruleEntries = rule.entries();
|
|
228
228
|
const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries();
|
|
229
|
-
chain.module.rule(`${ruleName}:${
|
|
229
|
+
chain.module.rule(`${ruleName}:${LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(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();
|
|
230
230
|
});
|
|
231
231
|
const inlineCSSRules = [
|
|
232
232
|
CHAIN_ID.RULE.CSS_INLINE,
|
|
@@ -249,7 +249,7 @@ function applyCSS(api, options) {
|
|
|
249
249
|
enableCSSInvalidation,
|
|
250
250
|
targetSdkVersion,
|
|
251
251
|
cssPlugins: [
|
|
252
|
-
|
|
252
|
+
CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
|
|
253
253
|
]
|
|
254
254
|
}
|
|
255
255
|
]).init((_, args)=>new CssExtractPlugin(...args)).end().end();
|
|
@@ -304,31 +304,31 @@ function applyEntry(api, options) {
|
|
|
304
304
|
const backgroundEntry = entryName;
|
|
305
305
|
mainThreadChunks.push(mainThreadName);
|
|
306
306
|
chain.entry(mainThreadEntry).add({
|
|
307
|
-
layer:
|
|
307
|
+
layer: LAYERS.MAIN_THREAD,
|
|
308
308
|
import: imports,
|
|
309
309
|
filename: mainThreadName
|
|
310
310
|
}).when(isDev && !isWeb, (entry)=>{
|
|
311
|
-
const require =
|
|
311
|
+
const require = createRequire(import.meta.url);
|
|
312
312
|
entry.prepend({
|
|
313
|
-
layer:
|
|
313
|
+
layer: LAYERS.MAIN_THREAD,
|
|
314
314
|
import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs')
|
|
315
315
|
});
|
|
316
316
|
}).end().entry(backgroundEntry).add({
|
|
317
|
-
layer:
|
|
317
|
+
layer: LAYERS.BACKGROUND,
|
|
318
318
|
import: imports,
|
|
319
319
|
filename: backgroundName
|
|
320
320
|
}).when(isDev && !isWeb, (entry)=>{
|
|
321
321
|
entry.prepend({
|
|
322
|
-
layer:
|
|
322
|
+
layer: LAYERS.BACKGROUND,
|
|
323
323
|
import: '@rspack/core/hot/dev-server'
|
|
324
324
|
}).prepend({
|
|
325
|
-
layer:
|
|
325
|
+
layer: LAYERS.BACKGROUND,
|
|
326
326
|
import: '@lynx-js/webpack-dev-transport/client'
|
|
327
327
|
}).prepend({
|
|
328
|
-
layer:
|
|
328
|
+
layer: LAYERS.BACKGROUND,
|
|
329
329
|
import: '@lynx-js/react/refresh'
|
|
330
330
|
});
|
|
331
|
-
}).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(
|
|
331
|
+
}).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(LynxTemplatePlugin, [
|
|
332
332
|
{
|
|
333
333
|
dsl: 'react_nodiff',
|
|
334
334
|
chunks: [
|
|
@@ -354,14 +354,14 @@ function applyEntry(api, options) {
|
|
|
354
354
|
targetSdkVersion,
|
|
355
355
|
experimental_isLazyBundle,
|
|
356
356
|
cssPlugins: [
|
|
357
|
-
|
|
357
|
+
CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
|
|
358
358
|
]
|
|
359
359
|
}
|
|
360
360
|
]).end();
|
|
361
361
|
});
|
|
362
362
|
if (isLynx) {
|
|
363
363
|
const inlineScripts = 'boolean' == typeof environment.config.output?.inlineScripts ? environment.config.output.inlineScripts : true;
|
|
364
|
-
chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(
|
|
364
|
+
chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(RuntimeWrapperWebpackPlugin, [
|
|
365
365
|
{
|
|
366
366
|
injectVars (vars) {
|
|
367
367
|
const UNUSED_VARS = new Set([
|
|
@@ -379,15 +379,15 @@ function applyEntry(api, options) {
|
|
|
379
379
|
test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/,
|
|
380
380
|
experimental_isLazyBundle
|
|
381
381
|
}
|
|
382
|
-
]).end().plugin(`${
|
|
382
|
+
]).end().plugin(`${LynxEncodePlugin.name}`).use(LynxEncodePlugin, [
|
|
383
383
|
{
|
|
384
384
|
inlineScripts
|
|
385
385
|
}
|
|
386
386
|
]).end();
|
|
387
387
|
}
|
|
388
|
-
if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(
|
|
388
|
+
if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
|
|
389
389
|
const rsbuildConfig = api.getRsbuildConfig();
|
|
390
|
-
chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(
|
|
390
|
+
chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
|
|
391
391
|
{
|
|
392
392
|
disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
|
|
393
393
|
firstScreenSyncTiming,
|
|
@@ -440,7 +440,7 @@ function applyGenerator(api) {
|
|
|
440
440
|
api.modifyBundlerChain({
|
|
441
441
|
order: 'pre',
|
|
442
442
|
handler: (chain)=>{
|
|
443
|
-
chain.module.rule(`json-parse:${
|
|
443
|
+
chain.module.rule(`json-parse:${LAYERS.MAIN_THREAD}`).issuerLayer(LAYERS.MAIN_THREAD).test(/\.json$/).type('json').generator({
|
|
444
444
|
JSONParse: false
|
|
445
445
|
});
|
|
446
446
|
}
|
|
@@ -465,16 +465,16 @@ function applyLoaders(api, options) {
|
|
|
465
465
|
const uses = rule.uses.entries() ?? {};
|
|
466
466
|
const { output } = api.getRsbuildConfig();
|
|
467
467
|
const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources'));
|
|
468
|
-
const backgroundRule = rule.oneOf(
|
|
469
|
-
backgroundRule.issuerLayer(
|
|
468
|
+
const backgroundRule = rule.oneOf(LAYERS.BACKGROUND);
|
|
469
|
+
backgroundRule.issuerLayer(LAYERS.BACKGROUND).uses.merge(uses).end().use(LAYERS.BACKGROUND).loader(ReactWebpackPlugin.loaders.BACKGROUND).options({
|
|
470
470
|
compat,
|
|
471
471
|
enableRemoveCSSScope,
|
|
472
472
|
isDynamicComponent: experimental_isLazyBundle,
|
|
473
473
|
inlineSourcesContent,
|
|
474
474
|
defineDCE
|
|
475
475
|
}).end();
|
|
476
|
-
const mainThreadRule = rule.oneOf(
|
|
477
|
-
mainThreadRule.issuerLayer(
|
|
476
|
+
const mainThreadRule = rule.oneOf(LAYERS.MAIN_THREAD);
|
|
477
|
+
mainThreadRule.issuerLayer(LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
|
|
478
478
|
rule.uses.delete(CHAIN_ID.USE.SWC);
|
|
479
479
|
const swcLoaderRule = uses[CHAIN_ID.USE.SWC].entries();
|
|
480
480
|
const swcLoaderOptions = swcLoaderRule.options;
|
|
@@ -485,7 +485,7 @@ function applyLoaders(api, options) {
|
|
|
485
485
|
target: 'es2019'
|
|
486
486
|
}
|
|
487
487
|
});
|
|
488
|
-
}).use(
|
|
488
|
+
}).use(LAYERS.MAIN_THREAD).loader(ReactWebpackPlugin.loaders.MAIN_THREAD).options({
|
|
489
489
|
compat,
|
|
490
490
|
enableRemoveCSSScope,
|
|
491
491
|
inlineSourcesContent,
|
|
@@ -497,20 +497,20 @@ function applyLoaders(api, options) {
|
|
|
497
497
|
});
|
|
498
498
|
}
|
|
499
499
|
const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
|
|
500
|
-
const refresh_require =
|
|
500
|
+
const refresh_require = createRequire(import.meta.url);
|
|
501
501
|
function applyRefresh(api) {
|
|
502
502
|
api.modifyWebpackChain((chain, { CHAIN_ID, isProd })=>{
|
|
503
|
-
if (!isProd) applyRefreshRules(chain, CHAIN_ID,
|
|
503
|
+
if (!isProd) applyRefreshRules(chain, CHAIN_ID, ReactRefreshWebpackPlugin);
|
|
504
504
|
});
|
|
505
505
|
api.modifyBundlerChain((chain, { isProd, CHAIN_ID })=>{
|
|
506
506
|
if (!isProd) {
|
|
507
|
-
applyRefreshRules(chain, CHAIN_ID,
|
|
507
|
+
applyRefreshRules(chain, CHAIN_ID, ReactRefreshRspackPlugin);
|
|
508
508
|
chain.resolve.alias.set('@lynx-js/react/refresh$', refresh_require.resolve('@lynx-js/react/refresh')).end();
|
|
509
509
|
}
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) {
|
|
513
|
-
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(
|
|
513
|
+
chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(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();
|
|
514
514
|
}
|
|
515
515
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
516
516
|
const applySplitChunksRule = (api)=>{
|
|
@@ -1232,7 +1232,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1232
1232
|
});
|
|
1233
1233
|
if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
|
|
1234
1234
|
const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
|
|
1235
|
-
const require =
|
|
1235
|
+
const require = createRequire(import.meta.url);
|
|
1236
1236
|
const { version } = require('../package.json');
|
|
1237
1237
|
rspeedyAPIs.debug(()=>{
|
|
1238
1238
|
const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
|
|
@@ -1241,5 +1241,4 @@ function pluginReactLynx(userOptions) {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
1243
|
}
|
|
1244
|
-
|
|
1245
|
-
export { pluginReactLynx, __webpack_exports__LAYERS as LAYERS };
|
|
1244
|
+
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-canary-20250605-
|
|
3
|
+
"version": "0.10.3-canary-20250605-01f94c32",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,11 +33,11 @@
|
|
|
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.3-canary-20250605-
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.10.3-canary-20250605-01f94c32",
|
|
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
|
-
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.7.2-canary-20250605-
|
|
40
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.7.2-canary-20250605-01f94c32",
|
|
41
41
|
"@lynx-js/use-sync-external-store": "npm:@lynx-js/use-sync-external-store-canary@1.5.0",
|
|
42
42
|
"background-only": "npm:background-only-canary@0.0.1"
|
|
43
43
|
},
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"type-fest": "^4.41.0",
|
|
55
55
|
"typia": "9.3.1",
|
|
56
56
|
"typia-rspack-plugin": "2.1.0",
|
|
57
|
-
"@lynx-js/react": "npm:@lynx-js/react-canary@0.109.2-canary-20250605-
|
|
57
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.109.2-canary-20250605-01f94c32",
|
|
58
58
|
"@lynx-js/react-transform": "0.2.0",
|
|
59
|
-
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.9.9-canary-20250605-
|
|
59
|
+
"@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.9.9-canary-20250605-01f94c32",
|
|
60
60
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|