@lynx-js/react-alias-rsbuild-plugin 0.15.0 → 0.16.0
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 +12 -0
- package/dist/index.js +11 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @lynx-js/react-alias-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Simplify hooks for main-thread runtime, which only can run during the first screen. ([#2441](https://github.com/lynx-family/lynx-stack/pull/2441))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- fix(rstest): add global fallback aliases for `@lynx-js/react/jsx-runtime` and `@lynx-js/react/jsx-dev-runtime` ([#2464](https://github.com/lynx-family/lynx-stack/pull/2464))
|
|
12
|
+
|
|
13
|
+
`pluginReactAlias` only aliased these entries inside layer-specific rules (`issuerLayer: BACKGROUND/MAIN_THREAD`). In rstest mode there are no layers, so JSX transformed by the testing loader—which emits `import { jsx } from '@lynx-js/react/jsx-runtime'`—could not be resolved, causing a `Cannot find module '@lynx-js/react/jsx-runtime'` error. Added global (non-layer-specific) fallback aliases pointing to the background jsx-runtime.
|
|
14
|
+
|
|
3
15
|
## 0.15.0
|
|
4
16
|
|
|
5
17
|
## 0.14.0
|
package/dist/index.js
CHANGED
|
@@ -385,11 +385,14 @@ function pluginReactAlias(options) {
|
|
|
385
385
|
Object.defineProperty(environment, S_PLUGIN_REACT_ALIAS, {
|
|
386
386
|
value: true
|
|
387
387
|
});
|
|
388
|
-
const [jsxRuntimeBackground, jsxRuntimeMainThread, jsxDevRuntimeBackground, jsxDevRuntimeMainThread, reactLepusBackground, reactLepusMainThread, reactCompat] = await Promise.all([
|
|
388
|
+
const [jsxRuntimeBackground, jsxRuntimeMainThread, jsxDevRuntimeBackground, jsxDevRuntimeMainThread, preactHooks, hooksBackground, hooksMainThread, reactLepusBackground, reactLepusMainThread, reactCompat] = await Promise.all([
|
|
389
389
|
resolve('@lynx-js/react/jsx-runtime'),
|
|
390
390
|
resolve('@lynx-js/react/lepus/jsx-runtime'),
|
|
391
391
|
resolve('@lynx-js/react/jsx-dev-runtime'),
|
|
392
392
|
resolve('@lynx-js/react/lepus/jsx-dev-runtime'),
|
|
393
|
+
resolvePreact('preact/hooks'),
|
|
394
|
+
resolve('@lynx-js/react/hooks'),
|
|
395
|
+
resolve('@lynx-js/react/lepus/hooks'),
|
|
393
396
|
resolve('@lynx-js/react'),
|
|
394
397
|
resolve('@lynx-js/react/lepus'),
|
|
395
398
|
gte_default()(version, '0.111.9999') ? resolve('@lynx-js/react/compat') : Promise.resolve(null)
|
|
@@ -406,7 +409,12 @@ function pluginReactAlias(options) {
|
|
|
406
409
|
background: reactLepusBackground,
|
|
407
410
|
mainThread: reactLepusMainThread
|
|
408
411
|
};
|
|
409
|
-
|
|
412
|
+
const reactHooks = {
|
|
413
|
+
mainThread: hooksMainThread,
|
|
414
|
+
background: hooksBackground,
|
|
415
|
+
preact: preactHooks
|
|
416
|
+
};
|
|
417
|
+
chain.module.rule('react:jsx-runtime:main-thread').issuerLayer(LAYERS.MAIN_THREAD).resolve.alias.set('react/jsx-runtime', jsxRuntime.mainThread).set('react/jsx-dev-runtime', jsxDevRuntime.mainThread).set('@lynx-js/react/jsx-runtime', jsxRuntime.mainThread).set('@lynx-js/react/jsx-dev-runtime', jsxDevRuntime.mainThread).set('@lynx-js/react/lepus$', reactLepus.mainThread).set('@lynx-js/react/lepus/jsx-runtime', jsxRuntime.mainThread).set('@lynx-js/react/lepus/jsx-dev-runtime', jsxDevRuntime.mainThread).set('preact/hooks', reactHooks.mainThread).set('@lynx-js/react/hooks', reactHooks.mainThread).set('@lynx-js/react/lepus/hooks', reactHooks.mainThread).end().end().end().rule('react:jsx-runtime:background').issuerLayer(LAYERS.BACKGROUND).resolve.alias.set('react/jsx-runtime', jsxRuntime.background).set('react/jsx-dev-runtime', jsxDevRuntime.background).set('@lynx-js/react/jsx-runtime', jsxRuntime.background).set('@lynx-js/react/jsx-dev-runtime', jsxDevRuntime.background).set('@lynx-js/react/lepus$', reactLepus.background).set('preact/hooks', reactHooks.preact).set('@lynx-js/react/hooks', reactHooks.background).end().end().end().end();
|
|
410
418
|
const transformedEntries = [
|
|
411
419
|
'experimental/lazy/import',
|
|
412
420
|
'internal',
|
|
@@ -422,14 +430,13 @@ function pluginReactAlias(options) {
|
|
|
422
430
|
chain.resolve.alias.set('@lynx-js/preact-devtools$', false);
|
|
423
431
|
}
|
|
424
432
|
if (!chain.resolve.alias.has('react$')) chain.resolve.alias.set('react$', reactLepus.background);
|
|
425
|
-
chain.resolve.alias.set('@lynx-js/react$', reactLepus.background);
|
|
433
|
+
chain.resolve.alias.set('@lynx-js/react$', reactLepus.background).set('@lynx-js/react/jsx-runtime', jsxRuntime.background).set('@lynx-js/react/jsx-dev-runtime', jsxDevRuntime.background);
|
|
426
434
|
if (reactCompat) chain.resolve.alias.set('@lynx-js/react/compat$', reactCompat);
|
|
427
435
|
const preactEntries = [
|
|
428
436
|
'preact',
|
|
429
437
|
'preact/compat',
|
|
430
438
|
'preact/debug',
|
|
431
439
|
'preact/devtools',
|
|
432
|
-
'preact/hooks',
|
|
433
440
|
'preact/test-utils',
|
|
434
441
|
'preact/jsx-runtime',
|
|
435
442
|
'preact/jsx-dev-runtime',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-alias-rsbuild-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A rsbuild plugin for making alias in ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@rspack/core": "1.7.9",
|
|
38
38
|
"@types/semver": "^7.7.1",
|
|
39
39
|
"semver": "^7.7.4",
|
|
40
|
-
"@lynx-js/react": "0.
|
|
41
|
-
"@lynx-js/react-webpack-plugin": "0.9.
|
|
40
|
+
"@lynx-js/react": "0.119.0",
|
|
41
|
+
"@lynx-js/react-webpack-plugin": "0.9.1",
|
|
42
42
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|