@lynx-js/react-webpack-plugin-canary 0.9.5 → 0.9.6-canary-20260708-1064984d
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 +24 -19
- package/lib/loaders/options.js +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @lynx-js/react-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.9.6-canary-20260708100107-1064984d887eb76f880b8ccfeea096c9d787beca
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix `globDynamicComponentEntry is not defined` when an external bundle's main-thread section is evaluated. An external bundle is not a dynamic component, so `globDynamicComponentEntry` (only in scope for the main card and dynamic components) is undeclared there. The snapshot / element-template transform now bakes the `__Card__` entry name into an external bundle's snapshots instead of referencing the bare identifier, via a new internal `isExternalBundle` loader option. ([#2934](https://github.com/lynx-family/lynx-stack/pull/2934))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @lynx-js/template-webpack-plugin@0.12.3-canary-20260708100107-1064984d887eb76f880b8ccfeea096c9d787beca
|
|
11
|
+
|
|
3
12
|
## 0.9.5
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -7,7 +16,6 @@
|
|
|
7
16
|
- Support enabling preact devtools in production via the `REACT_DEVTOOL` environment variable. ([#2880](https://github.com/lynx-family/lynx-stack/pull/2880))
|
|
8
17
|
|
|
9
18
|
By default `@lynx-js/preact-devtools` is aliased away in production builds. Setting the `REACT_DEVTOOL` environment variable now:
|
|
10
|
-
|
|
11
19
|
1. keeps a user-imported `@lynx-js/preact-devtools` from being stripped;
|
|
12
20
|
2. defines `__REACT_DEVTOOL__`, which gates the dev-only runtime hooks devtools depends on (such as `injectLepusMethods`) so they also run in production;
|
|
13
21
|
3. keeps function/class names during minification (`keep_fnames`/`keep_classnames`), which devtools needs to resolve component names (`type.name`) and to reconstruct the hook tree (it matches minified stack frames by function name).
|
|
@@ -64,7 +72,6 @@
|
|
|
64
72
|
### Minor Changes
|
|
65
73
|
|
|
66
74
|
- feat: add `globalPropsMode` option to `PluginReactLynxOptions` ([#2346](https://github.com/lynx-family/lynx-stack/pull/2346))
|
|
67
|
-
|
|
68
75
|
- When configured to `"event"`, `updateGlobalProps` will only trigger a global event and skip the `runWithForce` flow.
|
|
69
76
|
- Defaults to `"reactive"`, which means `updateGlobalProps` will trigger re-render automatically.
|
|
70
77
|
|
|
@@ -73,7 +80,6 @@
|
|
|
73
80
|
- Fix sourcemap misalignment when wrapping lazy bundle main-thread chunks. ([#2361](https://github.com/lynx-family/lynx-stack/pull/2361))
|
|
74
81
|
|
|
75
82
|
The lazy bundle IIFE wrapper is now injected in `processAssets` at `PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1` by walking chunk groups instead of patching assets in `beforeEncode`.
|
|
76
|
-
|
|
77
83
|
- With `experimental_isLazyBundle: true`, the wrapper is applied to lazy-bundle chunk groups.
|
|
78
84
|
- Without lazy bundle mode, the wrapper is applied to async main-thread chunk groups generated by dynamic import.
|
|
79
85
|
|
|
@@ -153,16 +159,16 @@
|
|
|
153
159
|
type InlineChunkConfig =
|
|
154
160
|
| boolean
|
|
155
161
|
| InlineChunkTest
|
|
156
|
-
| { enable?: boolean |
|
|
162
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
157
163
|
```
|
|
158
164
|
|
|
159
165
|
```ts
|
|
160
|
-
import { defineConfig } from
|
|
166
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
161
167
|
|
|
162
168
|
export default defineConfig({
|
|
163
169
|
output: {
|
|
164
170
|
inlineScripts: ({ name, size }) => {
|
|
165
|
-
return name.includes(
|
|
171
|
+
return name.includes("foo") && size < 1000;
|
|
166
172
|
},
|
|
167
173
|
},
|
|
168
174
|
});
|
|
@@ -217,7 +223,6 @@
|
|
|
217
223
|
- feat: fully support MTS ([#569](https://github.com/lynx-family/lynx-stack/pull/569))
|
|
218
224
|
|
|
219
225
|
Now use support the following usage
|
|
220
|
-
|
|
221
226
|
- mainthread event
|
|
222
227
|
- mainthread ref
|
|
223
228
|
- runOnMainThread/runOnBackground
|
|
@@ -246,7 +251,7 @@
|
|
|
246
251
|
- Shake `useImperativeHandle` on the main-thread by default. ([#153](https://github.com/lynx-family/lynx-stack/pull/153))
|
|
247
252
|
|
|
248
253
|
```js
|
|
249
|
-
import { forwardRef, useImperativeHandle } from
|
|
254
|
+
import { forwardRef, useImperativeHandle } from "@lynx-js/react";
|
|
250
255
|
|
|
251
256
|
export default forwardRef(function App(_, ref) {
|
|
252
257
|
useImperativeHandle(ref, () => {
|
|
@@ -254,7 +259,7 @@
|
|
|
254
259
|
return {
|
|
255
260
|
name() {
|
|
256
261
|
// This should be considered as background only
|
|
257
|
-
console.info(
|
|
262
|
+
console.info("This should not exist in main-thread");
|
|
258
263
|
},
|
|
259
264
|
};
|
|
260
265
|
});
|
|
@@ -314,14 +319,14 @@
|
|
|
314
319
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
315
320
|
|
|
316
321
|
```js
|
|
317
|
-
import { pluginReactLynx } from
|
|
318
|
-
import { defineConfig } from
|
|
322
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
323
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
319
324
|
|
|
320
325
|
export default defineConfig({
|
|
321
326
|
plugins: [
|
|
322
327
|
pluginReactLynx({
|
|
323
328
|
defineDCE: {
|
|
324
|
-
__SOME_FALSE_DEFINE__:
|
|
329
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
325
330
|
},
|
|
326
331
|
}),
|
|
327
332
|
],
|
|
@@ -333,20 +338,20 @@
|
|
|
333
338
|
For example, `import` initialized by dead code will be removed:
|
|
334
339
|
|
|
335
340
|
```js
|
|
336
|
-
import { foo } from
|
|
341
|
+
import { foo } from "bar";
|
|
337
342
|
|
|
338
343
|
if (__SOME_FALSE_DEFINE__) {
|
|
339
344
|
foo();
|
|
340
|
-
console.log(
|
|
345
|
+
console.log("dead code");
|
|
341
346
|
} else {
|
|
342
|
-
console.log(
|
|
347
|
+
console.log("reachable code");
|
|
343
348
|
}
|
|
344
349
|
```
|
|
345
350
|
|
|
346
351
|
will be transformed to:
|
|
347
352
|
|
|
348
353
|
```js
|
|
349
|
-
console.log(
|
|
354
|
+
console.log("reachable code");
|
|
350
355
|
```
|
|
351
356
|
|
|
352
357
|
## 0.6.0
|
|
@@ -356,14 +361,14 @@
|
|
|
356
361
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
357
362
|
|
|
358
363
|
```js
|
|
359
|
-
import { pluginReactLynx } from
|
|
360
|
-
import { defineConfig } from
|
|
364
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
365
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
361
366
|
|
|
362
367
|
export default defineConfig({
|
|
363
368
|
plugins: [
|
|
364
369
|
pluginReactLynx({
|
|
365
370
|
compat: {
|
|
366
|
-
removeComponentAttrRegex:
|
|
371
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
367
372
|
},
|
|
368
373
|
}),
|
|
369
374
|
],
|
package/lib/loaders/options.js
CHANGED
|
@@ -18,7 +18,7 @@ function normalizeSlashes(file) {
|
|
|
18
18
|
}
|
|
19
19
|
function getCommonOptions(inputSourceMap) {
|
|
20
20
|
const filename = normalizeSlashes(path.relative(this.rootContext, this.resourcePath));
|
|
21
|
-
const { compat, enableRemoveCSSScope, enableUiSourceMap, inlineSourcesContent, isDynamicComponent, engineVersion, experimental_useElementTemplate, defineDCE = { define: {} }, } = this.getOptions();
|
|
21
|
+
const { compat, enableRemoveCSSScope, enableUiSourceMap, inlineSourcesContent, isDynamicComponent, isExternalBundle, engineVersion, experimental_useElementTemplate, defineDCE = { define: {} }, } = this.getOptions();
|
|
22
22
|
const useElementTemplate = experimental_useElementTemplate === true;
|
|
23
23
|
const syntax = (/\.[mc]?tsx?$/.exec(this.resourcePath))
|
|
24
24
|
? 'typescript'
|
|
@@ -77,6 +77,7 @@ function getCommonOptions(inputSourceMap) {
|
|
|
77
77
|
runtimePkg: RUNTIME_PKG,
|
|
78
78
|
filename,
|
|
79
79
|
isDynamicComponent: isDynamicComponent ?? false,
|
|
80
|
+
isExternalBundle: isExternalBundle ?? false,
|
|
80
81
|
},
|
|
81
82
|
elementTemplate: useElementTemplate
|
|
82
83
|
? {
|
|
@@ -86,6 +87,7 @@ function getCommonOptions(inputSourceMap) {
|
|
|
86
87
|
filename,
|
|
87
88
|
target: 'JS',
|
|
88
89
|
isDynamicComponent: isDynamicComponent ?? false,
|
|
90
|
+
isExternalBundle: isExternalBundle ?? false,
|
|
89
91
|
}
|
|
90
92
|
: false,
|
|
91
93
|
engineVersion: engineVersion ?? '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-webpack-plugin-canary",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6-canary-20260708-1064984d",
|
|
4
4
|
"description": "A webpack plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"css-loader": "^7.1.4",
|
|
46
46
|
"swc-loader": "^0.2.7",
|
|
47
47
|
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.8.0",
|
|
48
|
-
"@lynx-js/
|
|
48
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.122.2-canary-20260708-1064984d",
|
|
49
49
|
"@lynx-js/test-tools": "0.0.0",
|
|
50
|
-
"@lynx-js/
|
|
50
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.12.3-canary-20260708-1064984d"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@lynx-js/template-webpack-plugin": "*"
|