@lynx-js/react-webpack-plugin-canary 0.7.1 → 0.7.2-canary-20251103-0d7a4c3d
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 +21 -15
- package/lib/loaders/options.d.ts +4 -0
- package/lib/loaders/options.js +2 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lynx-js/react-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.7.2-canary-20251103073213-0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- When engineVersion is greater than or equal to 3.1, use `__SetAttribute` to set text attribute for text node instead of creating a raw text node. ([#1880](https://github.com/lynx-family/lynx-stack/pull/1880))
|
|
8
|
+
|
|
3
9
|
## 0.7.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -52,16 +58,16 @@
|
|
|
52
58
|
type InlineChunkConfig =
|
|
53
59
|
| boolean
|
|
54
60
|
| InlineChunkTest
|
|
55
|
-
| { enable?: boolean |
|
|
61
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
56
62
|
```
|
|
57
63
|
|
|
58
64
|
```ts
|
|
59
|
-
import { defineConfig } from
|
|
65
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
60
66
|
|
|
61
67
|
export default defineConfig({
|
|
62
68
|
output: {
|
|
63
69
|
inlineScripts: ({ name, size }) => {
|
|
64
|
-
return name.includes(
|
|
70
|
+
return name.includes("foo") && size < 1000;
|
|
65
71
|
},
|
|
66
72
|
},
|
|
67
73
|
});
|
|
@@ -145,7 +151,7 @@
|
|
|
145
151
|
- Shake `useImperativeHandle` on the main-thread by default. ([#153](https://github.com/lynx-family/lynx-stack/pull/153))
|
|
146
152
|
|
|
147
153
|
```js
|
|
148
|
-
import { forwardRef, useImperativeHandle } from
|
|
154
|
+
import { forwardRef, useImperativeHandle } from "@lynx-js/react";
|
|
149
155
|
|
|
150
156
|
export default forwardRef(function App(_, ref) {
|
|
151
157
|
useImperativeHandle(ref, () => {
|
|
@@ -153,7 +159,7 @@
|
|
|
153
159
|
return {
|
|
154
160
|
name() {
|
|
155
161
|
// This should be considered as background only
|
|
156
|
-
console.info(
|
|
162
|
+
console.info("This should not exist in main-thread");
|
|
157
163
|
},
|
|
158
164
|
};
|
|
159
165
|
});
|
|
@@ -213,14 +219,14 @@
|
|
|
213
219
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
214
220
|
|
|
215
221
|
```js
|
|
216
|
-
import { pluginReactLynx } from
|
|
217
|
-
import { defineConfig } from
|
|
222
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
223
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
218
224
|
|
|
219
225
|
export default defineConfig({
|
|
220
226
|
plugins: [
|
|
221
227
|
pluginReactLynx({
|
|
222
228
|
defineDCE: {
|
|
223
|
-
__SOME_FALSE_DEFINE__:
|
|
229
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
224
230
|
},
|
|
225
231
|
}),
|
|
226
232
|
],
|
|
@@ -232,20 +238,20 @@
|
|
|
232
238
|
For example, `import` initialized by dead code will be removed:
|
|
233
239
|
|
|
234
240
|
```js
|
|
235
|
-
import { foo } from
|
|
241
|
+
import { foo } from "bar";
|
|
236
242
|
|
|
237
243
|
if (__SOME_FALSE_DEFINE__) {
|
|
238
244
|
foo();
|
|
239
|
-
console.log(
|
|
245
|
+
console.log("dead code");
|
|
240
246
|
} else {
|
|
241
|
-
console.log(
|
|
247
|
+
console.log("reachable code");
|
|
242
248
|
}
|
|
243
249
|
```
|
|
244
250
|
|
|
245
251
|
will be transformed to:
|
|
246
252
|
|
|
247
253
|
```js
|
|
248
|
-
console.log(
|
|
254
|
+
console.log("reachable code");
|
|
249
255
|
```
|
|
250
256
|
|
|
251
257
|
## 0.6.0
|
|
@@ -255,14 +261,14 @@
|
|
|
255
261
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
256
262
|
|
|
257
263
|
```js
|
|
258
|
-
import { pluginReactLynx } from
|
|
259
|
-
import { defineConfig } from
|
|
264
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
265
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
260
266
|
|
|
261
267
|
export default defineConfig({
|
|
262
268
|
plugins: [
|
|
263
269
|
pluginReactLynx({
|
|
264
270
|
compat: {
|
|
265
|
-
removeComponentAttrRegex:
|
|
271
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
266
272
|
},
|
|
267
273
|
}),
|
|
268
274
|
],
|
package/lib/loaders/options.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export interface ReactLoaderOptions {
|
|
|
33
33
|
* Generate inline source content in source-map.
|
|
34
34
|
*/
|
|
35
35
|
inlineSourcesContent?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The engine version.
|
|
38
|
+
*/
|
|
39
|
+
engineVersion?: string | undefined;
|
|
36
40
|
}
|
|
37
41
|
export declare function getMainThreadTransformOptions(this: LoaderContext<ReactLoaderOptions>): TransformNodiffOptions;
|
|
38
42
|
export declare function getBackgroundTransformOptions(this: LoaderContext<ReactLoaderOptions>): TransformNodiffOptions;
|
package/lib/loaders/options.js
CHANGED
|
@@ -16,7 +16,7 @@ function normalizeSlashes(file) {
|
|
|
16
16
|
}
|
|
17
17
|
function getCommonOptions() {
|
|
18
18
|
const filename = normalizeSlashes(path.relative(this.rootContext, this.resourcePath));
|
|
19
|
-
const { compat, enableRemoveCSSScope, inlineSourcesContent, isDynamicComponent, defineDCE = { define: {} }, } = this.getOptions();
|
|
19
|
+
const { compat, enableRemoveCSSScope, inlineSourcesContent, isDynamicComponent, engineVersion, defineDCE = { define: {} }, } = this.getOptions();
|
|
20
20
|
const syntax = (/\.[mc]?tsx?$/.exec(this.resourcePath))
|
|
21
21
|
? 'typescript'
|
|
22
22
|
: 'ecmascript';
|
|
@@ -73,6 +73,7 @@ function getCommonOptions() {
|
|
|
73
73
|
filename,
|
|
74
74
|
isDynamicComponent: isDynamicComponent ?? false,
|
|
75
75
|
},
|
|
76
|
+
engineVersion: engineVersion ?? '',
|
|
76
77
|
syntaxConfig: JSON.stringify({
|
|
77
78
|
syntax,
|
|
78
79
|
decorators: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-webpack-plugin-canary",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2-canary-20251103-0d7a4c3d",
|
|
4
4
|
"description": "A webpack plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"tiny-invariant": "^1.3.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@microsoft/api-extractor": "7.52.
|
|
41
|
-
"@rspack/core": "1.
|
|
40
|
+
"@microsoft/api-extractor": "7.52.15",
|
|
41
|
+
"@rspack/core": "1.6.0-beta.1",
|
|
42
42
|
"css-loader": "^7.1.2",
|
|
43
43
|
"swc-loader": "^0.2.6",
|
|
44
|
-
"webpack": "^5.
|
|
45
|
-
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.
|
|
46
|
-
"@lynx-js/
|
|
44
|
+
"webpack": "^5.102.0",
|
|
45
|
+
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.4",
|
|
46
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.9.1",
|
|
47
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.114.4-canary-20251103-0d7a4c3d",
|
|
47
48
|
"@lynx-js/test-tools": "0.0.0",
|
|
48
|
-
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.9.0",
|
|
49
49
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|