@lynx-js/react-rsbuild-plugin 0.9.8 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.js +21 -12
  3. package/package.json +12 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
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
+
3
21
  ## 0.9.8
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -246,7 +246,7 @@ function applyEntry(api, options) {
246
246
  const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle';
247
247
  const mainThreadEntry = `${entryName}__main-thread`;
248
248
  const mainThreadName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
249
- 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));
250
250
  const backgroundEntry = entryName;
251
251
  mainThreadChunks.push(mainThreadName);
252
252
  chain.entry(mainThreadEntry).add({
@@ -255,7 +255,7 @@ function applyEntry(api, options) {
255
255
  filename: mainThreadName
256
256
  }).when(isDev && !isWeb, (entry)=>{
257
257
  const require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
258
- entry.add({
258
+ entry.prepend({
259
259
  layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD,
260
260
  import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs')
261
261
  });
@@ -264,13 +264,13 @@ function applyEntry(api, options) {
264
264
  import: imports,
265
265
  filename: backgroundName
266
266
  }).when(isDev && !isWeb, (entry)=>{
267
- entry.add({
267
+ entry.prepend({
268
268
  layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
269
269
  import: '@rspack/core/hot/dev-server'
270
- }).add({
270
+ }).prepend({
271
271
  layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
272
272
  import: '@lynx-js/webpack-dev-transport/client'
273
- }).add({
273
+ }).prepend({
274
274
  layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
275
275
  import: '@lynx-js/react/refresh'
276
276
  });
@@ -308,18 +308,26 @@ function applyEntry(api, options) {
308
308
  if (isLynx) chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__.RuntimeWrapperWebpackPlugin, [
309
309
  {
310
310
  injectVars (vars) {
311
+ const UNUSED_VARS = new Set([
312
+ 'Card',
313
+ 'Component',
314
+ 'ReactLynx',
315
+ 'Behavior'
316
+ ]);
311
317
  return vars.map((name)=>{
312
- if ('Component' === name) return '__Component';
318
+ if (UNUSED_VARS.has(name)) return `__${name}`;
313
319
  return name;
314
320
  });
315
321
  },
316
322
  targetSdkVersion,
317
- test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/
323
+ test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/,
324
+ experimental_isLazyBundle
318
325
  }
319
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, [
320
327
  {}
321
328
  ]).end();
322
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();
323
331
  chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin, [
324
332
  {
325
333
  disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
@@ -327,7 +335,8 @@ function applyEntry(api, options) {
327
335
  enableSSR,
328
336
  mainThreadChunks,
329
337
  extractStr,
330
- experimental_isLazyBundle
338
+ experimental_isLazyBundle,
339
+ profile: rsbuildConfig.performance?.profile
331
340
  }
332
341
  ]);
333
342
  });
@@ -357,15 +366,15 @@ function getChunks(entryName, entryValue) {
357
366
  imports
358
367
  };
359
368
  }
360
- function getBackgroundFilename(entryName, config, isProd) {
369
+ function getBackgroundFilename(entryName, config, isProd, experimental_isLazyBundle) {
361
370
  const { filename } = config.output;
362
371
  if ('string' == typeof filename.js) return filename.js.replaceAll('[name]', entryName).replaceAll('.js', '/background.js');
363
- return `${entryName}/background${getHash(config, isProd)}.js`;
372
+ return `${entryName}/background${getHash(config, isProd, experimental_isLazyBundle)}.js`;
364
373
  }
365
- function getHash(config, isProd) {
374
+ function getHash(config, isProd, experimental_isLazyBundle) {
366
375
  if ('string' == typeof config.output?.filenameHash) return config.output.filenameHash ? `.[${config.output.filenameHash}]` : EMPTY_HASH;
367
376
  if (config.output?.filenameHash === false) return EMPTY_HASH;
368
- if (isProd) return DEFAULT_FILENAME_HASH;
377
+ if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
369
378
  return EMPTY_HASH;
370
379
  }
371
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.8",
3
+ "version": "0.9.9",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,34 +32,34 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "background-only": "^0.0.1",
36
35
  "@lynx-js/css-extract-webpack-plugin": "0.5.3",
37
- "@lynx-js/react-alias-rsbuild-plugin": "0.9.8",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.9.9",
38
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.2",
39
- "@lynx-js/react-webpack-plugin": "0.6.12",
40
- "@lynx-js/runtime-wrapper-webpack-plugin": "0.0.9",
38
+ "@lynx-js/react-webpack-plugin": "0.6.13",
39
+ "@lynx-js/runtime-wrapper-webpack-plugin": "0.0.10",
41
40
  "@lynx-js/template-webpack-plugin": "0.6.10",
42
- "@lynx-js/web-webpack-plugin": "0.6.6"
41
+ "@lynx-js/web-webpack-plugin": "0.6.6",
42
+ "background-only": "^0.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "7.52.5",
45
+ "@microsoft/api-extractor": "7.52.7",
46
46
  "@rollup/plugin-typescript": "^12.1.2",
47
- "@rsbuild/core": "1.3.11",
47
+ "@rsbuild/core": "1.3.17",
48
48
  "@rsbuild/plugin-sass": "1.3.1",
49
49
  "@rsbuild/plugin-typed-css-modules": "1.0.2",
50
50
  "@rsbuild/plugin-webpack-swc": "1.1.0",
51
51
  "@rsbuild/webpack": "1.3.0",
52
52
  "@samchon/openapi": "4.1.0",
53
53
  "tailwindcss": "^3.4.17",
54
- "type-fest": "^4.40.0",
54
+ "type-fest": "^4.41.0",
55
55
  "typia": "9.1.1",
56
56
  "typia-rspack-plugin": "2.0.1",
57
- "@lynx-js/react": "0.107.0",
58
- "@lynx-js/rspeedy": "0.9.3",
57
+ "@lynx-js/react": "0.108.0",
58
+ "@lynx-js/rspeedy": "0.9.4",
59
59
  "@lynx-js/vitest-setup": "0.0.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0"
62
+ "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "@lynx-js/react": {