@lynx-js/react-webpack-plugin-canary 0.6.20 → 0.7.0-canary-20250911-2800dce9

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,13 @@
1
1
  # @lynx-js/react-webpack-plugin
2
2
 
3
+ ## 0.7.0-canary-20250911092247-2800dce925f20c08b21faee351a032c3372f8e42
4
+
5
+ ### Minor Changes
6
+
7
+ - Remove `@lynx-js/react` from peerDependencies. ([#1711](https://github.com/lynx-family/lynx-stack/pull/1711))
8
+
9
+ - Add a new required option `workletRuntimePath`. ([#1711](https://github.com/lynx-family/lynx-stack/pull/1711))
10
+
3
11
  ## 0.6.20
4
12
 
5
13
  ### Patch Changes
@@ -38,16 +46,16 @@
38
46
  type InlineChunkConfig =
39
47
  | boolean
40
48
  | InlineChunkTest
41
- | { enable?: boolean | 'auto'; test: InlineChunkTest };
49
+ | { enable?: boolean | "auto"; test: InlineChunkTest };
42
50
  ```
43
51
 
44
52
  ```ts
45
- import { defineConfig } from '@lynx-js/rspeedy';
53
+ import { defineConfig } from "@lynx-js/rspeedy";
46
54
 
47
55
  export default defineConfig({
48
56
  output: {
49
57
  inlineScripts: ({ name, size }) => {
50
- return name.includes('foo') && size < 1000;
58
+ return name.includes("foo") && size < 1000;
51
59
  },
52
60
  },
53
61
  });
@@ -131,7 +139,7 @@
131
139
  - Shake `useImperativeHandle` on the main-thread by default. ([#153](https://github.com/lynx-family/lynx-stack/pull/153))
132
140
 
133
141
  ```js
134
- import { forwardRef, useImperativeHandle } from '@lynx-js/react';
142
+ import { forwardRef, useImperativeHandle } from "@lynx-js/react";
135
143
 
136
144
  export default forwardRef(function App(_, ref) {
137
145
  useImperativeHandle(ref, () => {
@@ -139,7 +147,7 @@
139
147
  return {
140
148
  name() {
141
149
  // This should be considered as background only
142
- console.info('This should not exist in main-thread');
150
+ console.info("This should not exist in main-thread");
143
151
  },
144
152
  };
145
153
  });
@@ -199,14 +207,14 @@
199
207
  - e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
200
208
 
201
209
  ```js
202
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin';
203
- import { defineConfig } from '@lynx-js/rspeedy';
210
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
211
+ import { defineConfig } from "@lynx-js/rspeedy";
204
212
 
205
213
  export default defineConfig({
206
214
  plugins: [
207
215
  pluginReactLynx({
208
216
  defineDCE: {
209
- __SOME_FALSE_DEFINE__: 'false',
217
+ __SOME_FALSE_DEFINE__: "false",
210
218
  },
211
219
  }),
212
220
  ],
@@ -218,20 +226,20 @@
218
226
  For example, `import` initialized by dead code will be removed:
219
227
 
220
228
  ```js
221
- import { foo } from 'bar';
229
+ import { foo } from "bar";
222
230
 
223
231
  if (__SOME_FALSE_DEFINE__) {
224
232
  foo();
225
- console.log('dead code');
233
+ console.log("dead code");
226
234
  } else {
227
- console.log('reachable code');
235
+ console.log("reachable code");
228
236
  }
229
237
  ```
230
238
 
231
239
  will be transformed to:
232
240
 
233
241
  ```js
234
- console.log('reachable code');
242
+ console.log("reachable code");
235
243
  ```
236
244
 
237
245
  ## 0.6.0
@@ -241,14 +249,14 @@
241
249
  - a30c83d: Add `compat.removeComponentAttrRegex`.
242
250
 
243
251
  ```js
244
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin';
245
- import { defineConfig } from '@lynx-js/rspeedy';
252
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
253
+ import { defineConfig } from "@lynx-js/rspeedy";
246
254
 
247
255
  export default defineConfig({
248
256
  plugins: [
249
257
  pluginReactLynx({
250
258
  compat: {
251
- removeComponentAttrRegex: 'YOUR REGEX',
259
+ removeComponentAttrRegex: "YOUR REGEX",
252
260
  },
253
261
  }),
254
262
  ],
@@ -42,6 +42,10 @@ interface ReactWebpackPluginOptions {
42
42
  * @defaultValue `false` when production, `true` when development
43
43
  */
44
44
  profile?: boolean | undefined;
45
+ /**
46
+ * The file path of `@lynx-js/react/worklet-runtime`.
47
+ */
48
+ workletRuntimePath: string;
45
49
  }
46
50
  /**
47
51
  * ReactWebpackPlugin allows using ReactLynx with webpack
@@ -78,6 +78,7 @@ class ReactWebpackPlugin {
78
78
  extractStr: false,
79
79
  experimental_isLazyBundle: false,
80
80
  profile: undefined,
81
+ workletRuntimePath: '',
81
82
  }); }
82
83
  /**
83
84
  * The entry point of a webpack plugin.
@@ -155,13 +156,9 @@ class ReactWebpackPlugin {
155
156
  hooks.beforeEncode.tap(this.constructor.name, (args) => {
156
157
  const lepusCode = args.encodeData.lepusCode;
157
158
  if (lepusCode.root?.source.source().toString()?.includes('registerWorkletInternal')) {
158
- const path = compiler.options.mode === 'development'
159
- ? '@lynx-js/react/worklet-dev-runtime'
160
- : '@lynx-js/react/worklet-runtime';
161
- const runtimeFile = require.resolve(path);
162
159
  lepusCode.chunks.push({
163
160
  name: 'worklet-runtime',
164
- source: new RawSource(fs.readFileSync(runtimeFile, 'utf8')),
161
+ source: new RawSource(fs.readFileSync(options.workletRuntimePath, 'utf8')),
165
162
  info: {
166
163
  ['lynx:main-thread']: true,
167
164
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-webpack-plugin-canary",
3
- "version": "0.6.20",
3
+ "version": "0.7.0-canary-20250911-2800dce9",
4
4
  "description": "A webpack plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "webpack",
@@ -38,18 +38,17 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@microsoft/api-extractor": "7.52.11",
41
- "@rspack/core": "1.4.11",
41
+ "@rspack/core": "1.5.2",
42
42
  "css-loader": "^7.1.2",
43
43
  "swc-loader": "^0.2.6",
44
44
  "webpack": "^5.101.3",
45
45
  "@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.2",
46
- "@lynx-js/react": "npm:@lynx-js/react-canary@0.112.4",
47
- "@lynx-js/vitest-setup": "0.0.0",
46
+ "@lynx-js/react": "npm:@lynx-js/react-canary@0.112.7-canary-20250911-2800dce9",
48
47
  "@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.8.5",
49
- "@lynx-js/test-tools": "0.0.0"
48
+ "@lynx-js/test-tools": "0.0.0",
49
+ "@lynx-js/vitest-setup": "0.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@lynx-js/react": "*",
53
52
  "@lynx-js/template-webpack-plugin": "*"
54
53
  },
55
54
  "peerDependenciesMeta": {