@lynx-js/react-webpack-plugin-canary 0.10.1 → 0.10.2-canary-20260729-fa2ef9b6
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 +28 -19
- package/lib/loaders/options.d.ts +5 -1
- package/lib/loaders/options.js +4 -1
- package/lib/loaders/testing.js +4 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @lynx-js/react-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.10.2-canary-20260729060727-fa2ef9b6fa2ff9e881a77ff5d80f300950fbca0d
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add the experimental `experimental_transformBuiltinAttributeNames` option for transforming builtin element attribute names. `false` preserves attribute names. `true` transforms `onClick` to `bindtap`, `onCatchTap` to `catchtap`, other `onXXX` event names to `bindxxx`, and remaining camelCase names to dash-case. An object supports serializable custom rules through `mode`, `preserve`, and `rename`. Currently, only explicit JSX attributes are transformed during compilation; runtime transformation of spread attributes is planned for a future release. ([#3274](https://github.com/lynx-family/lynx-stack/pull/3274))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`7795a43`](https://github.com/lynx-family/lynx-stack/commit/7795a43797ac9daf59e5f18dc978e1596948f94b)]:
|
|
10
|
+
- @lynx-js/template-webpack-plugin@0.14.1-canary-20260729060727-fa2ef9b6fa2ff9e881a77ff5d80f300950fbca0d
|
|
11
|
+
|
|
3
12
|
## 0.10.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -25,12 +34,12 @@
|
|
|
25
34
|
|
|
26
35
|
```js
|
|
27
36
|
pluginReactLynx({
|
|
28
|
-
firstScreenSyncTiming:
|
|
37
|
+
firstScreenSyncTiming: "manual",
|
|
29
38
|
});
|
|
30
39
|
```
|
|
31
40
|
|
|
32
41
|
```js
|
|
33
|
-
import { markFirstScreenSyncReady } from
|
|
42
|
+
import { markFirstScreenSyncReady } from "@lynx-js/react";
|
|
34
43
|
|
|
35
44
|
markFirstScreenSyncReady();
|
|
36
45
|
```
|
|
@@ -40,8 +49,8 @@
|
|
|
40
49
|
- Add `compat.legacySlot` to `pluginReactLynx`. When enabled, dynamic children are compiled to the pre-SlotV2 form (JSX `children` + `wrapper` elements + `__DynamicPartChildren`/`__DynamicPartSlot` symbols instead of `$0`/`$1` slot props + `SlotV2`), so the compiled output stays compatible with legacy runtimes without `SlotV2` support (`< 0.120.0`, which shipped the SlotV2 refactor in #1764) — e.g. a standalone lazy bundle consumed by a host App that ships an older runtime. ([#2947](https://github.com/lynx-family/lynx-stack/pull/2947))
|
|
41
50
|
|
|
42
51
|
```js
|
|
43
|
-
import { defineConfig } from
|
|
44
|
-
import { pluginReactLynx } from
|
|
52
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
53
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
45
54
|
|
|
46
55
|
export default defineConfig({
|
|
47
56
|
plugins: [
|
|
@@ -214,16 +223,16 @@
|
|
|
214
223
|
type InlineChunkConfig =
|
|
215
224
|
| boolean
|
|
216
225
|
| InlineChunkTest
|
|
217
|
-
| { enable?: boolean |
|
|
226
|
+
| { enable?: boolean | "auto"; test: InlineChunkTest };
|
|
218
227
|
```
|
|
219
228
|
|
|
220
229
|
```ts
|
|
221
|
-
import { defineConfig } from
|
|
230
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
222
231
|
|
|
223
232
|
export default defineConfig({
|
|
224
233
|
output: {
|
|
225
234
|
inlineScripts: ({ name, size }) => {
|
|
226
|
-
return name.includes(
|
|
235
|
+
return name.includes("foo") && size < 1000;
|
|
227
236
|
},
|
|
228
237
|
},
|
|
229
238
|
});
|
|
@@ -307,7 +316,7 @@
|
|
|
307
316
|
- Shake `useImperativeHandle` on the main-thread by default. ([#153](https://github.com/lynx-family/lynx-stack/pull/153))
|
|
308
317
|
|
|
309
318
|
```js
|
|
310
|
-
import { forwardRef, useImperativeHandle } from
|
|
319
|
+
import { forwardRef, useImperativeHandle } from "@lynx-js/react";
|
|
311
320
|
|
|
312
321
|
export default forwardRef(function App(_, ref) {
|
|
313
322
|
useImperativeHandle(ref, () => {
|
|
@@ -315,7 +324,7 @@
|
|
|
315
324
|
return {
|
|
316
325
|
name() {
|
|
317
326
|
// This should be considered as background only
|
|
318
|
-
console.info(
|
|
327
|
+
console.info("This should not exist in main-thread");
|
|
319
328
|
},
|
|
320
329
|
};
|
|
321
330
|
});
|
|
@@ -375,14 +384,14 @@
|
|
|
375
384
|
- e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
|
|
376
385
|
|
|
377
386
|
```js
|
|
378
|
-
import { pluginReactLynx } from
|
|
379
|
-
import { defineConfig } from
|
|
387
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
388
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
380
389
|
|
|
381
390
|
export default defineConfig({
|
|
382
391
|
plugins: [
|
|
383
392
|
pluginReactLynx({
|
|
384
393
|
defineDCE: {
|
|
385
|
-
__SOME_FALSE_DEFINE__:
|
|
394
|
+
__SOME_FALSE_DEFINE__: "false",
|
|
386
395
|
},
|
|
387
396
|
}),
|
|
388
397
|
],
|
|
@@ -394,20 +403,20 @@
|
|
|
394
403
|
For example, `import` initialized by dead code will be removed:
|
|
395
404
|
|
|
396
405
|
```js
|
|
397
|
-
import { foo } from
|
|
406
|
+
import { foo } from "bar";
|
|
398
407
|
|
|
399
408
|
if (__SOME_FALSE_DEFINE__) {
|
|
400
409
|
foo();
|
|
401
|
-
console.log(
|
|
410
|
+
console.log("dead code");
|
|
402
411
|
} else {
|
|
403
|
-
console.log(
|
|
412
|
+
console.log("reachable code");
|
|
404
413
|
}
|
|
405
414
|
```
|
|
406
415
|
|
|
407
416
|
will be transformed to:
|
|
408
417
|
|
|
409
418
|
```js
|
|
410
|
-
console.log(
|
|
419
|
+
console.log("reachable code");
|
|
411
420
|
```
|
|
412
421
|
|
|
413
422
|
## 0.6.0
|
|
@@ -417,14 +426,14 @@
|
|
|
417
426
|
- a30c83d: Add `compat.removeComponentAttrRegex`.
|
|
418
427
|
|
|
419
428
|
```js
|
|
420
|
-
import { pluginReactLynx } from
|
|
421
|
-
import { defineConfig } from
|
|
429
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
430
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
422
431
|
|
|
423
432
|
export default defineConfig({
|
|
424
433
|
plugins: [
|
|
425
434
|
pluginReactLynx({
|
|
426
435
|
compat: {
|
|
427
|
-
removeComponentAttrRegex:
|
|
436
|
+
removeComponentAttrRegex: "YOUR REGEX",
|
|
428
437
|
},
|
|
429
438
|
}),
|
|
430
439
|
],
|
package/lib/loaders/options.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LoaderContext } from '@rspack/core';
|
|
2
|
-
import type { CompatVisitorConfig, DefineDceVisitorConfig, JsxTransformerConfig, ShakeVisitorConfig, TransformNodiffOptions } from '@lynx-js/react/transform';
|
|
2
|
+
import type { CompatVisitorConfig, DefineDceVisitorConfig, JsxTransformerConfig, ShakeVisitorConfig, TransformBuiltinAttributeNamesOptions, TransformNodiffOptions } from '@lynx-js/react/transform';
|
|
3
3
|
export declare const JSX_IMPORT_SOURCE: {
|
|
4
4
|
MAIN_THREAD: string;
|
|
5
5
|
BACKGROUND: string;
|
|
@@ -28,6 +28,10 @@ export interface ReactLoaderOptions {
|
|
|
28
28
|
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.enableUiSourceMap}
|
|
29
29
|
*/
|
|
30
30
|
enableUiSourceMap?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.experimental_transformBuiltinAttributeNames}
|
|
33
|
+
*/
|
|
34
|
+
experimental_transformBuiltinAttributeNames?: boolean | TransformBuiltinAttributeNamesOptions | undefined;
|
|
31
35
|
/**
|
|
32
36
|
* Enable the Fast Refresh for ReactLynx.
|
|
33
37
|
*/
|
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, isExternalBundle, engineVersion, experimental_useElementTemplate, defineDCE = { define: {} }, } = this.getOptions();
|
|
21
|
+
const { compat, enableRemoveCSSScope, enableUiSourceMap, experimental_transformBuiltinAttributeNames, 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'
|
|
@@ -108,6 +108,9 @@ function getCommonOptions(inputSourceMap) {
|
|
|
108
108
|
},
|
|
109
109
|
directiveDCE: false,
|
|
110
110
|
defineDCE,
|
|
111
|
+
...(experimental_transformBuiltinAttributeNames !== undefined && {
|
|
112
|
+
experimental_transformBuiltinAttributeNames,
|
|
113
|
+
}),
|
|
111
114
|
refresh: false,
|
|
112
115
|
isModule: 'unknown',
|
|
113
116
|
};
|
package/lib/loaders/testing.js
CHANGED
|
@@ -9,7 +9,7 @@ function normalizeSlashes(file) {
|
|
|
9
9
|
}
|
|
10
10
|
function testingLoader(content) {
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
|
-
const { compat = false, defineDCE = { define: {} }, engineVersion = '', experimental_useElementTemplate = false, shake = false, transformPath = '@lynx-js/react/transform', } = this.getOptions();
|
|
12
|
+
const { compat = false, defineDCE = { define: {} }, engineVersion = '', experimental_transformBuiltinAttributeNames, experimental_useElementTemplate = false, shake = false, transformPath = '@lynx-js/react/transform', } = this.getOptions();
|
|
13
13
|
const { transformReactLynxSync } = require(transformPath);
|
|
14
14
|
const filename = normalizeSlashes(path.relative(this.rootContext, this.resourcePath));
|
|
15
15
|
const normalizedCompat = typeof compat === 'object'
|
|
@@ -62,6 +62,9 @@ function testingLoader(content) {
|
|
|
62
62
|
},
|
|
63
63
|
refresh: false,
|
|
64
64
|
cssScope: false,
|
|
65
|
+
...(experimental_transformBuiltinAttributeNames !== undefined && {
|
|
66
|
+
experimental_transformBuiltinAttributeNames,
|
|
67
|
+
}),
|
|
65
68
|
});
|
|
66
69
|
if (result.errors.length > 0) {
|
|
67
70
|
for (const error of result.errors) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-webpack-plugin-canary",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2-canary-20260729-fa2ef9b6",
|
|
4
4
|
"description": "A webpack plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@rstest/core": "0.11.3",
|
|
45
45
|
"css-loader": "^7.1.4",
|
|
46
46
|
"swc-loader": "^0.2.7",
|
|
47
|
+
"@lynx-js/react": "npm:@lynx-js/react-canary@0.123.2-canary-20260729-fa2ef9b6",
|
|
47
48
|
"@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.10.0",
|
|
48
|
-
"@lynx-js/
|
|
49
|
-
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.14.
|
|
50
|
-
"@lynx-js/test-tools": "0.0.0"
|
|
49
|
+
"@lynx-js/test-tools": "0.0.0",
|
|
50
|
+
"@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.14.1-canary-20260729-fa2ef9b6"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@lynx-js/template-webpack-plugin": "*"
|