@lynx-js/react-webpack-plugin 0.6.7 → 0.6.8

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,29 @@
1
1
  # @lynx-js/react-webpack-plugin
2
2
 
3
+ ## 0.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Shake `useImperativeHandle` on the main-thread by default. ([#153](https://github.com/lynx-family/lynx-stack/pull/153))
8
+
9
+ ```js
10
+ import { forwardRef, useImperativeHandle } from '@lynx-js/react';
11
+
12
+ export default forwardRef(function App(_, ref) {
13
+ useImperativeHandle(ref, () => {
14
+ // This should be considered as background only
15
+ return {
16
+ name() {
17
+ // This should be considered as background only
18
+ console.info('This should not exist in main-thread');
19
+ },
20
+ };
21
+ });
22
+ });
23
+ ```
24
+
25
+ - Avoid wrapping standalone lazy bundles with `var globDynamicComponentEntry`. ([#177](https://github.com/lynx-family/lynx-stack/pull/177))
26
+
3
27
  ## 0.6.7
4
28
 
5
29
  ### Patch Changes
@@ -18,6 +18,12 @@ interface ReactWebpackPluginOptions {
18
18
  * The chunk names to be considered as main thread chunks.
19
19
  */
20
20
  mainThreadChunks?: string[] | undefined;
21
+ /**
22
+ * Whether to enable lazy bundle.
23
+ *
24
+ * @alpha
25
+ */
26
+ experimental_isLazyBundle?: boolean;
21
27
  }
22
28
  /**
23
29
  * ReactWebpackPlugin allows using ReactLynx with webpack
@@ -74,6 +74,7 @@ class ReactWebpackPlugin {
74
74
  disableCreateSelectorQueryIncompatibleWarning: false,
75
75
  firstScreenSyncTiming: 'immediately',
76
76
  mainThreadChunks: [],
77
+ experimental_isLazyBundle: false,
77
78
  }); }
78
79
  /**
79
80
  * The entry point of a webpack plugin.
@@ -82,12 +83,14 @@ class ReactWebpackPlugin {
82
83
  apply(compiler) {
83
84
  const options = Object.assign({}, ReactWebpackPlugin.defaultOptions, this.options);
84
85
  const { BannerPlugin, DefinePlugin, EnvironmentPlugin } = compiler.webpack;
85
- new BannerPlugin({
86
- // TODO: handle cases that do not have `'use strict'`
87
- banner: `'use strict';var globDynamicComponentEntry=globDynamicComponentEntry||'__Card__';`,
88
- raw: true,
89
- test: options.mainThreadChunks,
90
- }).apply(compiler);
86
+ if (!options.experimental_isLazyBundle) {
87
+ new BannerPlugin({
88
+ // TODO: handle cases that do not have `'use strict'`
89
+ banner: `'use strict';var globDynamicComponentEntry=globDynamicComponentEntry||'__Card__';`,
90
+ raw: true,
91
+ test: options.mainThreadChunks,
92
+ }).apply(compiler);
93
+ }
91
94
  new EnvironmentPlugin({
92
95
  // Default values of null and undefined behave differently.
93
96
  // Use undefined for variables that must be provided during bundling, or null if they are optional.
@@ -150,6 +150,7 @@ export function getMainThreadTransformOptions() {
150
150
  'useLayoutEffect',
151
151
  '__runInJS',
152
152
  'useLynxGlobalEventListener',
153
+ 'useImperativeHandle',
153
154
  ...(shake?.removeCallParams ?? []),
154
155
  ],
155
156
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-webpack-plugin",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "A webpack plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "webpack",
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@microsoft/api-extractor": "7.51.1",
41
- "@rspack/core": "1.2.7",
41
+ "@rspack/core": "1.2.8",
42
42
  "css-loader": "^7.1.2",
43
43
  "swc-loader": "^0.2.6",
44
44
  "webpack": "^5.98.0",
45
- "@lynx-js/css-extract-webpack-plugin": "0.5.1",
46
- "@lynx-js/react": "0.105.1",
45
+ "@lynx-js/css-extract-webpack-plugin": "0.5.2",
46
+ "@lynx-js/react": "0.105.2",
47
+ "@lynx-js/template-webpack-plugin": "0.6.5",
47
48
  "@lynx-js/test-tools": "0.0.0",
48
- "@lynx-js/template-webpack-plugin": "0.6.4",
49
49
  "@lynx-js/vitest-setup": "0.0.0"
50
50
  },
51
51
  "peerDependencies": {