@lynx-js/react-webpack-plugin 0.6.12 → 0.6.14

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,23 @@
1
1
  # @lynx-js/react-webpack-plugin
2
2
 
3
+ ## 0.6.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Support `@lynx-js/template-webpack-plugin` v0.7.0. ([#880](https://github.com/lynx-family/lynx-stack/pull/880))
8
+
9
+ - Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
10
+
11
+ ## 0.6.13
12
+
13
+ ### Patch Changes
14
+
15
+ - feat: add `experimental_isLazyBundle` option, it will disable snapshot HMR for standalone lazy bundle ([#653](https://github.com/lynx-family/lynx-stack/pull/653))
16
+
17
+ - Add the `profile` option to control whether `__PROFILE__` is enabled. ([#722](https://github.com/lynx-family/lynx-stack/pull/722))
18
+
19
+ - Support `@lynx-js/react` v0.108.0. ([#649](https://github.com/lynx-family/lynx-stack/pull/649))
20
+
3
21
  ## 0.6.12
4
22
 
5
23
  ### Patch Changes
@@ -1,20 +1,6 @@
1
1
  import type { Compiler } from '@rspack/core';
2
+ import type { ExtractStrConfig } from '@lynx-js/react/transform';
2
3
  import { LAYERS } from './layer.js';
3
- /**
4
- * The options for extractStr.
5
- *
6
- * @public
7
- */
8
- export interface ExtractStrConfig {
9
- /**
10
- * The minimum length of string literals to be extracted.
11
- *
12
- * @defaultValue `20`
13
- *
14
- * @public
15
- */
16
- strLength: number;
17
- }
18
4
  /**
19
5
  * The options for ReactWebpackPlugin
20
6
  *
@@ -50,6 +36,12 @@ interface ReactWebpackPluginOptions {
50
36
  * @alpha
51
37
  */
52
38
  experimental_isLazyBundle?: boolean;
39
+ /**
40
+ * Whether to enable profile.
41
+ *
42
+ * @defaultValue `false` when production, `true` when development
43
+ */
44
+ profile?: boolean | undefined;
53
45
  }
54
46
  /**
55
47
  * ReactWebpackPlugin allows using ReactLynx with webpack
@@ -77,6 +77,7 @@ class ReactWebpackPlugin {
77
77
  mainThreadChunks: [],
78
78
  extractStr: false,
79
79
  experimental_isLazyBundle: false,
80
+ profile: undefined,
80
81
  }); }
81
82
  /**
82
83
  * The entry point of a webpack plugin.
@@ -102,7 +103,9 @@ class ReactWebpackPlugin {
102
103
  __DEV__: JSON.stringify(compiler.options.mode === 'development'),
103
104
  // We enable profile by default in development.
104
105
  // It can also be disabled by environment variable `REACT_PROFILE=false`
105
- __PROFILE__: JSON.stringify(process.env['REACT_PROFILE'] ?? compiler.options.mode === 'development'),
106
+ __PROFILE__: JSON.stringify(options.profile
107
+ ?? process.env['REACT_PROFILE']
108
+ ?? compiler.options.mode === 'development'),
106
109
  __EXTRACT_STR__: JSON.stringify(Boolean(options.extractStr)),
107
110
  __FIRST_SCREEN_SYNC_TIMING__: JSON.stringify(options.firstScreenSyncTiming),
108
111
  __ENABLE_SSR__: JSON.stringify(options.enableSSR),
package/lib/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * A webpack plugin to integrate webpack with ReactLynx.
5
5
  */
6
6
  export { ReactWebpackPlugin } from './ReactWebpackPlugin.js';
7
- export type { ReactWebpackPluginOptions, ExtractStrConfig, } from './ReactWebpackPlugin.js';
7
+ export type { ReactWebpackPluginOptions } from './ReactWebpackPlugin.js';
8
+ export type { ExtractStrConfig } from '@lynx-js/react/transform';
8
9
  export { LAYERS } from './layer.js';
9
10
  export type { ReactLoaderOptions } from './loaders/options.js';
@@ -61,7 +61,12 @@ function getCommonOptions() {
61
61
  snapshot: {
62
62
  // TODO: config
63
63
  preserveJsx: false,
64
- target: 'MIXED',
64
+ // In standalone lazy bundle mode, we do not support HMR now.
65
+ target: this.hot && !isDynamicComponent
66
+ // Using `MIX` when HMR is enabled.
67
+ // This allows serializing the updated runtime code to Lepus using `Function.prototype.toString`.
68
+ ? 'MIXED'
69
+ : 'JS',
65
70
  runtimePkg: RUNTIME_PKG,
66
71
  filename,
67
72
  isDynamicComponent: isDynamicComponent ?? false,
@@ -180,11 +185,6 @@ export function getBackgroundTransformOptions() {
180
185
  snapshot: {
181
186
  ...commonOptions.snapshot,
182
187
  jsxImportSource: JSX_IMPORT_SOURCE.BACKGROUND,
183
- target: this.hot
184
- // Using `MIX` when HMR is enabled.
185
- // This allows serializing the updated runtime code to Lepus using `Function.prototype.toString`.
186
- ? 'MIXED'
187
- : 'JS',
188
188
  },
189
189
  defineDCE: {
190
190
  define: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-webpack-plugin",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "description": "A webpack plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "webpack",
@@ -37,20 +37,20 @@
37
37
  "@lynx-js/webpack-runtime-globals": "0.0.5"
38
38
  },
39
39
  "devDependencies": {
40
- "@microsoft/api-extractor": "7.52.5",
41
- "@rspack/core": "1.3.6",
40
+ "@microsoft/api-extractor": "7.52.8",
41
+ "@rspack/core": "1.3.11",
42
42
  "css-loader": "^7.1.2",
43
43
  "swc-loader": "^0.2.6",
44
- "webpack": "^5.99.6",
45
- "@lynx-js/css-extract-webpack-plugin": "0.5.3",
46
- "@lynx-js/react": "0.107.0",
47
- "@lynx-js/template-webpack-plugin": "0.6.10",
44
+ "webpack": "^5.99.9",
45
+ "@lynx-js/css-extract-webpack-plugin": "0.5.4",
46
+ "@lynx-js/react": "0.109.0",
47
+ "@lynx-js/template-webpack-plugin": "0.7.0",
48
48
  "@lynx-js/test-tools": "0.0.0",
49
49
  "@lynx-js/vitest-setup": "0.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0",
53
- "@lynx-js/template-webpack-plugin": "^0.4.0 || ^0.5.0 || ^0.6.0"
52
+ "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0",
53
+ "@lynx-js/template-webpack-plugin": "^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@lynx-js/react": {