@lynx-js/react-alias-rsbuild-plugin 0.10.1 → 0.10.3
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 +8 -0
- package/dist/index.js +18 -10
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import external_node_path_default from "node:path";
|
|
3
3
|
const S_PLUGIN_REACT_ALIAS = Symbol.for('@lynx-js/plugin-react-alias');
|
|
4
4
|
function pluginReactAlias(options) {
|
|
5
5
|
const { LAYERS, lazy, rootPath } = options ?? {};
|
|
@@ -9,8 +9,8 @@ function pluginReactAlias(options) {
|
|
|
9
9
|
const hasAlias = api.useExposed(S_PLUGIN_REACT_ALIAS);
|
|
10
10
|
if (hasAlias) return;
|
|
11
11
|
api.expose(S_PLUGIN_REACT_ALIAS, true);
|
|
12
|
-
const require =
|
|
13
|
-
const reactLynxDir =
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const reactLynxDir = external_node_path_default.dirname(require.resolve('@lynx-js/react/package.json', {
|
|
14
14
|
paths: [
|
|
15
15
|
rootPath ?? api.context.rootPath
|
|
16
16
|
]
|
|
@@ -29,17 +29,25 @@ function pluginReactAlias(options) {
|
|
|
29
29
|
}
|
|
30
30
|
}));
|
|
31
31
|
api.modifyBundlerChain(async (chain)=>{
|
|
32
|
+
const [jsxRuntimeBackground, jsxRuntimeMainThread, jsxDevRuntimeBackground, jsxDevRuntimeMainThread, reactLepusBackground, reactLepusMainThread] = await Promise.all([
|
|
33
|
+
resolve('@lynx-js/react/jsx-runtime'),
|
|
34
|
+
resolve('@lynx-js/react/lepus/jsx-runtime'),
|
|
35
|
+
resolve('@lynx-js/react/jsx-dev-runtime'),
|
|
36
|
+
resolve('@lynx-js/react/lepus/jsx-dev-runtime'),
|
|
37
|
+
resolve('@lynx-js/react'),
|
|
38
|
+
resolve('@lynx-js/react/lepus')
|
|
39
|
+
]);
|
|
32
40
|
const jsxRuntime = {
|
|
33
|
-
background:
|
|
34
|
-
mainThread:
|
|
41
|
+
background: jsxRuntimeBackground,
|
|
42
|
+
mainThread: jsxRuntimeMainThread
|
|
35
43
|
};
|
|
36
44
|
const jsxDevRuntime = {
|
|
37
|
-
background:
|
|
38
|
-
mainThread:
|
|
45
|
+
background: jsxDevRuntimeBackground,
|
|
46
|
+
mainThread: jsxDevRuntimeMainThread
|
|
39
47
|
};
|
|
40
48
|
const reactLepus = {
|
|
41
|
-
background:
|
|
42
|
-
mainThread:
|
|
49
|
+
background: reactLepusBackground,
|
|
50
|
+
mainThread: reactLepusMainThread
|
|
43
51
|
};
|
|
44
52
|
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).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).end().end().end().end();
|
|
45
53
|
const transformedEntries = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-alias-rsbuild-plugin",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "A rsbuild plugin for making alias in ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@microsoft/api-extractor": "7.52.8",
|
|
39
39
|
"@rsbuild/core": "1.3.21",
|
|
40
|
-
"@lynx-js/react": "0.109.
|
|
41
|
-
"@lynx-js/react-webpack-plugin": "0.6.
|
|
40
|
+
"@lynx-js/react": "0.109.2",
|
|
41
|
+
"@lynx-js/react-webpack-plugin": "0.6.15",
|
|
42
42
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|