@lynx-js/react-rsbuild-plugin 0.11.4 → 0.12.1

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 CHANGED
@@ -1,5 +1,37 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.12.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Avoid injecting hot update runtime when dev.hmr or dev.liveReload is set to false. ([#1980](https://github.com/lynx-family/lynx-stack/pull/1980))
8
+
9
+ - Updated dependencies [[`553ece1`](https://github.com/lynx-family/lynx-stack/commit/553ece1e025b1f4feae353310c21b2e159f1f03a), [`8cdb69d`](https://github.com/lynx-family/lynx-stack/commit/8cdb69d4b2cc3e9925a2494ee8a889d7af17e2e9), [`8cdb69d`](https://github.com/lynx-family/lynx-stack/commit/8cdb69d4b2cc3e9925a2494ee8a889d7af17e2e9)]:
10
+ - @lynx-js/react-webpack-plugin@0.7.3
11
+ - @lynx-js/css-extract-webpack-plugin@0.7.0
12
+ - @lynx-js/template-webpack-plugin@0.10.0
13
+ - @lynx-js/react-alias-rsbuild-plugin@0.12.1
14
+ - @lynx-js/use-sync-external-store@1.5.0
15
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
16
+
17
+ ## 0.12.0
18
+
19
+ ### Minor Changes
20
+
21
+ - **BREAKING CHANGE**: Require `@lynx-js/rspeedy` 0.12.0. ([#1951](https://github.com/lynx-family/lynx-stack/pull/1951))
22
+
23
+ ### Patch Changes
24
+
25
+ - Support Yarn Plug'n'Play. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
26
+
27
+ - Updated dependencies [[`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb), [`5bbb439`](https://github.com/lynx-family/lynx-stack/commit/5bbb43981580f917f59819cd4ff7972b9737a341), [`3692a16`](https://github.com/lynx-family/lynx-stack/commit/3692a169ae443124de0e9f7a288318f5dfba13b0), [`d2e290b`](https://github.com/lynx-family/lynx-stack/commit/d2e290b67971ead5bedbcc1e34dd7f3bf4a6f5f3), [`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb)]:
28
+ - @lynx-js/react-alias-rsbuild-plugin@0.12.0
29
+ - @lynx-js/css-extract-webpack-plugin@0.6.5
30
+ - @lynx-js/template-webpack-plugin@0.9.2
31
+ - @lynx-js/use-sync-external-store@1.5.0
32
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
33
+ - @lynx-js/react-webpack-plugin@0.7.2
34
+
3
35
  ## 0.11.4
4
36
 
5
37
  ### Patch Changes
package/dist/300.js ADDED
@@ -0,0 +1,34 @@
1
+ export const __rspack_esm_id = "300";
2
+ export const __rspack_esm_ids = [
3
+ "300"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/resolve.ts" (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ getImportResolver: ()=>getImportResolver,
9
+ getMainThreadResolver: ()=>getMainThreadResolver
10
+ });
11
+ var node_path__rspack_import_0 = __webpack_require__("node:path");
12
+ var node_url__rspack_import_1 = __webpack_require__("node:url");
13
+ var _lynx_js_react_alias_rsbuild_plugin__rspack_import_2 = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
14
+ const __dirname = node_path__rspack_import_0["default"].dirname((0, node_url__rspack_import_1.fileURLToPath)(import.meta.url));
15
+ const getImportResolver = (()=>{
16
+ let resolver = null;
17
+ return (rspack)=>{
18
+ resolver ??= (0, _lynx_js_react_alias_rsbuild_plugin__rspack_import_2.createLazyResolver)(rspack, __dirname, [
19
+ 'import'
20
+ ]);
21
+ return resolver;
22
+ };
23
+ })();
24
+ const getMainThreadResolver = (()=>{
25
+ let resolver = null;
26
+ return (rspack)=>{
27
+ resolver ??= (0, _lynx_js_react_alias_rsbuild_plugin__rspack_import_2.createLazyResolver)(rspack, __dirname, [
28
+ 'lepus'
29
+ ]);
30
+ return resolver;
31
+ };
32
+ })();
33
+ }
34
+ };
package/dist/index.d.ts CHANGED
@@ -441,7 +441,7 @@ export declare interface PluginReactLynxOptions {
441
441
  *
442
442
  * These options should only be used for migrating from ReactLynx2.0.
443
443
  */
444
- compat?: (Partial<CompatVisitorConfig> & {
444
+ compat?: Partial<CompatVisitorConfig> & {
445
445
  /**
446
446
  * Whether disable runtime warnings about using ReactLynx2.0-incompatible `SelectorQuery` APIs.
447
447
  *
@@ -458,7 +458,7 @@ export declare interface PluginReactLynxOptions {
458
458
  * @defaultValue `false`
459
459
  */
460
460
  disableCreateSelectorQueryIncompatibleWarning?: boolean;
461
- }) | undefined;
461
+ } | undefined;
462
462
  /**
463
463
  * When {@link PluginReactLynxOptions.enableCSSInheritance} is enabled, `customCSSInheritanceList` can control which properties are inheritable, not just the default ones.
464
464
  *
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
1
+ import * as __rspack_external__lynx_js_react_alias_rsbuild_plugin_2a0391db from "@lynx-js/react-alias-rsbuild-plugin";
2
+ import * as __rspack_external_node_path_c5b9b54f from "node:path";
3
+ import * as __rspack_external_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
6
  import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
7
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
- "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
10
+ "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js" (__unused_webpack_module, exports) {
11
11
  exports._accessExpressionAsString = void 0;
12
12
  const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
13
13
  exports._accessExpressionAsString = _accessExpressionAsString;
@@ -52,7 +52,7 @@ var __webpack_modules__ = {
52
52
  "with"
53
53
  ]);
54
54
  },
55
- "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) {
55
+ "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js" (__unused_webpack_module, exports, __webpack_require__) {
56
56
  exports._assertGuard = void 0;
57
57
  const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs");
58
58
  const _assertGuard = (exceptionable, props, factory)=>{
@@ -62,16 +62,16 @@ 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__;
65
+ "@lynx-js/react-alias-rsbuild-plugin" (module) {
66
+ module.exports = __rspack_external__lynx_js_react_alias_rsbuild_plugin_2a0391db;
67
67
  },
68
- "node:path": function(module) {
69
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
68
+ "node:path" (module) {
69
+ module.exports = __rspack_external_node_path_c5b9b54f;
70
70
  },
71
- "node:url": function(module) {
72
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
71
+ "node:url" (module) {
72
+ module.exports = __rspack_external_node_url_e96de089;
73
73
  },
74
- "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
74
+ "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs" (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
75
75
  __webpack_require__.r(__webpack_exports__);
76
76
  __webpack_require__.d(__webpack_exports__, {
77
77
  TypeGuardError: ()=>TypeGuardError
@@ -148,16 +148,16 @@ __webpack_require__.m = __webpack_modules__;
148
148
  410: 0
149
149
  };
150
150
  var installChunk = (data)=>{
151
- var __webpack_ids__ = data.__webpack_ids__;
151
+ var __rspack_esm_ids = data.__rspack_esm_ids;
152
152
  var __webpack_modules__ = data.__webpack_modules__;
153
- var __webpack_runtime__ = data.__webpack_runtime__;
153
+ var __rspack_esm_runtime = data.__rspack_esm_runtime;
154
154
  var moduleId, chunkId, i = 0;
155
155
  for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
156
- if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
157
- for(; i < __webpack_ids__.length; i++){
158
- chunkId = __webpack_ids__[i];
156
+ if (__rspack_esm_runtime) __rspack_esm_runtime(__webpack_require__);
157
+ for(; i < __rspack_esm_ids.length; i++){
158
+ chunkId = __rspack_esm_ids[i];
159
159
  if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
160
- installedChunks[__webpack_ids__[i]] = 0;
160
+ installedChunks[__rspack_esm_ids[i]] = 0;
161
161
  }
162
162
  };
163
163
  __webpack_require__.f.j = function(chunkId, promises) {
@@ -187,9 +187,11 @@ const DETECT_IMPORT_ERROR = 'react:detect-import-error';
187
187
  const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
188
188
  const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
189
189
  function applyBackgroundOnly(api) {
190
- api.modifyBundlerChain(async (chain)=>{
190
+ api.modifyBundlerChain(async (chain, { rspack })=>{
191
191
  const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
192
- const { resolve, resolveMainThread } = await __webpack_require__.e("856").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
192
+ const { getImportResolver, getMainThreadResolver } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
193
+ const resolve = getImportResolver(rspack);
194
+ const resolveMainThread = getMainThreadResolver(rspack);
193
195
  const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
194
196
  resolve('background-only'),
195
197
  resolveMainThread('background-only')
@@ -290,6 +292,9 @@ function applyEntry(api, options) {
290
292
  const entries = chain.entryPoints.entries() ?? {};
291
293
  const isLynx = 'lynx' === environment.name;
292
294
  const isWeb = 'web' === environment.name;
295
+ const { hmr, liveReload } = environment.config.dev ?? {};
296
+ const enabledHMR = isDev && !isWeb && false !== hmr;
297
+ const enabledLiveReload = isDev && !isWeb && false !== liveReload;
293
298
  chain.entryPoints.clear();
294
299
  const mainThreadChunks = [];
295
300
  Object.entries(entries).forEach(([entryName, entryPoint])=>{
@@ -304,7 +309,7 @@ function applyEntry(api, options) {
304
309
  layer: LAYERS.MAIN_THREAD,
305
310
  import: imports,
306
311
  filename: mainThreadName
307
- }).when(isDev && !isWeb, (entry)=>{
312
+ }).when(enabledHMR, (entry)=>{
308
313
  const require = createRequire(import.meta.url);
309
314
  entry.prepend({
310
315
  layer: LAYERS.MAIN_THREAD,
@@ -314,17 +319,19 @@ function applyEntry(api, options) {
314
319
  layer: LAYERS.BACKGROUND,
315
320
  import: imports,
316
321
  filename: backgroundName
317
- }).when(isDev && !isWeb, (entry)=>{
322
+ }).when(enabledHMR, (entry)=>{
318
323
  entry.prepend({
319
324
  layer: LAYERS.BACKGROUND,
320
325
  import: '@rspack/core/hot/dev-server'
321
- }).prepend({
322
- layer: LAYERS.BACKGROUND,
323
- import: '@lynx-js/webpack-dev-transport/client'
324
326
  }).prepend({
325
327
  layer: LAYERS.BACKGROUND,
326
328
  import: '@lynx-js/react/refresh'
327
329
  });
330
+ }).when(enabledHMR || enabledLiveReload, (entry)=>{
331
+ entry.prepend({
332
+ layer: LAYERS.BACKGROUND,
333
+ import: '@lynx-js/webpack-dev-transport/client'
334
+ });
328
335
  }).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(LynxTemplatePlugin, [
329
336
  {
330
337
  dsl: 'react_nodiff',
@@ -471,11 +478,6 @@ function applyLazy(api) {
471
478
  function applyLoaders(api, options) {
472
479
  const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, experimental_isLazyBundle } = options;
473
480
  api.modifyBundlerChain((chain, { CHAIN_ID })=>{
474
- const experiments = chain.get('experiments');
475
- chain.experiments({
476
- ...experiments,
477
- layers: true
478
- });
479
481
  const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
480
482
  const uses = rule.uses.entries() ?? {};
481
483
  const { output } = api.getRsbuildConfig();
@@ -602,8 +604,9 @@ function applySWC(api) {
602
604
  }, config));
603
605
  }
604
606
  function applyUseSyncExternalStore(api) {
605
- api.modifyBundlerChain(async (chain)=>{
606
- const { resolve } = await __webpack_require__.e("856").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
607
+ api.modifyBundlerChain(async (chain, { rspack })=>{
608
+ const { getImportResolver } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
609
+ const resolve = getImportResolver(rspack);
607
610
  const useSyncExternalStoreEntries = [
608
611
  'use-sync-external-store',
609
612
  'use-sync-external-store/with-selector',
@@ -1229,11 +1232,6 @@ function pluginReactLynx(userOptions) {
1229
1232
  ]
1230
1233
  }
1231
1234
  });
1232
- if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
1233
- output: {
1234
- inlineScripts: true
1235
- }
1236
- });
1237
1235
  config = mergeRsbuildConfig({
1238
1236
  tools: {
1239
1237
  rspack: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.11.4",
3
+ "version": "0.12.1",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,19 +32,19 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "@lynx-js/css-extract-webpack-plugin": "0.6.4",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.11.4",
35
+ "@lynx-js/css-extract-webpack-plugin": "0.7.0",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.12.1",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.4",
38
- "@lynx-js/react-webpack-plugin": "0.7.2",
38
+ "@lynx-js/react-webpack-plugin": "0.7.3",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
40
- "@lynx-js/template-webpack-plugin": "0.9.1",
40
+ "@lynx-js/template-webpack-plugin": "0.10.0",
41
41
  "@lynx-js/use-sync-external-store": "1.5.0",
42
42
  "background-only": "^0.0.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "7.52.15",
46
46
  "@rollup/plugin-typescript": "^12.1.4",
47
- "@rsbuild/core": "1.5.17",
47
+ "@rsbuild/core": "1.6.13",
48
48
  "@rsbuild/plugin-sass": "1.4.0",
49
49
  "@rsbuild/plugin-typed-css-modules": "1.1.1",
50
50
  "rsbuild-plugin-arethetypeswrong": "0.1.1",
@@ -54,13 +54,13 @@
54
54
  "type-fest": "^5.0.1",
55
55
  "typia": "9.7.2",
56
56
  "typia-rspack-plugin": "2.2.2",
57
- "@lynx-js/react": "0.114.4",
57
+ "@lynx-js/react": "0.115.1",
58
58
  "@lynx-js/react-transform": "0.2.0",
59
- "@lynx-js/rspeedy": "0.11.9",
59
+ "@lynx-js/rspeedy": "0.12.2",
60
60
  "@lynx-js/vitest-setup": "0.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0"
63
+ "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0 || ^0.115.0"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "@lynx-js/react": {
package/dist/856.js DELETED
@@ -1,22 +0,0 @@
1
- export const __webpack_id__ = "856";
2
- export const __webpack_ids__ = [
3
- "856"
4
- ];
5
- export const __webpack_modules__ = {
6
- "./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
- __webpack_require__.d(__webpack_exports__, {
8
- resolve: ()=>resolve,
9
- resolveMainThread: ()=>resolveMainThread
10
- });
11
- var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
12
- var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
13
- var _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
14
- const __dirname = node_path__WEBPACK_IMPORTED_MODULE_0__["default"].dirname((0, node_url__WEBPACK_IMPORTED_MODULE_1__.fileURLToPath)(import.meta.url));
15
- const resolve = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
16
- 'import'
17
- ]);
18
- const resolveMainThread = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
19
- 'lepus'
20
- ]);
21
- }
22
- };