@modern-js/server-utils 2.26.1-alpha.1 → 2.27.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/cjs/compilers/babel/preset/alias.js +2 -2
- package/dist/esm/compilers/babel/preset/alias.js +2 -2
- package/dist/esm-node/compilers/babel/preset/alias.js +2 -2
- package/package.json +11 -19
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -56
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -13
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -28
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -21
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -157
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -92
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -24
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -19
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -98
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -92
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -73
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -74
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -118
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -863
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -21
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -50
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -1
- package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -12
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -41
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -8
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -17
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -10
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -162
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -86
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -15
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -8
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -57
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -87
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -68
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -71
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -124
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -862
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -16
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -45
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -0
- package/dist/esm/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -2
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/index.js +0 -37
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/log.js +0 -3
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.js +0 -17
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.js +0 -10
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js +0 -146
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.js +0 -81
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js +0 -13
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js +0 -8
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.js +0 -57
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.js +0 -87
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.js +0 -68
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.js +0 -69
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.js +0 -113
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.js +0 -857
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.js +0 -16
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.js +0 -45
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/first/index.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/node_modules/second/index.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/package.json +0 -1
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/header.css +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.js +0 -0
- package/dist/esm-node/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.js +0 -2
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/index.d.ts +0 -19
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/log.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/mapPath.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/mapToRelative.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.d.ts +0 -24
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/resolvePath.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/src/utils.d.ts +0 -9
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/call.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/custom-call.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/dynamicImport.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/import.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/index.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/mapToRelative.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/normalizeOptions.test.d.ts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/example-file.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/actions/something.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/app.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/App.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/SubHeader.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Header/index.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Root.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/SidebarFooterButton.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/Sidebar/Footer/index.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/components/index.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants/actions.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/constants.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/libs/custom.modernizr3.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/nodemodule.d.mts +0 -1
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.android.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/src/rn/index.ios.d.ts +0 -0
- package/dist/types/compilers/babel/plugins/babel-plugin-module-resolver/test/testproject/test/tools.d.ts +0 -1
- package/test-setup.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @modern-js/server-utils
|
|
2
2
|
|
|
3
|
+
## 2.27.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [91d14b8]
|
|
8
|
+
- Updated dependencies [8322a51]
|
|
9
|
+
- Updated dependencies [6d7104d]
|
|
10
|
+
- @modern-js/utils@2.27.0
|
|
11
|
+
- @modern-js/babel-compiler@2.27.0
|
|
12
|
+
- @modern-js/babel-preset-base@2.27.0
|
|
13
|
+
- @modern-js/babel-plugin-module-resolver@2.27.0
|
|
14
|
+
|
|
3
15
|
## 2.26.0
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -12,7 +12,7 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
|
|
|
12
12
|
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
13
13
|
const _tsconfigpaths = require("@modern-js/utils/tsconfig-paths");
|
|
14
14
|
const _utils = require("@modern-js/utils");
|
|
15
|
-
const { resolvePath } = require("
|
|
15
|
+
const { resolvePath } = require("@modern-js/babel-plugin-module-resolver");
|
|
16
16
|
const defaultPaths = {
|
|
17
17
|
"@": [
|
|
18
18
|
"./src"
|
|
@@ -73,7 +73,7 @@ const aliasPlugin = (alias) => {
|
|
|
73
73
|
".mjs"
|
|
74
74
|
];
|
|
75
75
|
return [
|
|
76
|
-
"
|
|
76
|
+
"@modern-js/babel-plugin-module-resolver",
|
|
77
77
|
{
|
|
78
78
|
root: absoluteBaseUrl,
|
|
79
79
|
alias: mergedPaths,
|
|
@@ -4,7 +4,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
|
|
6
6
|
import { getUserAlias } from "@modern-js/utils";
|
|
7
|
-
var resolvePath = require("
|
|
7
|
+
var resolvePath = require("@modern-js/babel-plugin-module-resolver").resolvePath;
|
|
8
8
|
var defaultPaths = {
|
|
9
9
|
"@": [
|
|
10
10
|
"./src"
|
|
@@ -56,7 +56,7 @@ export var aliasPlugin = function(alias) {
|
|
|
56
56
|
".mjs"
|
|
57
57
|
];
|
|
58
58
|
return [
|
|
59
|
-
"
|
|
59
|
+
"@modern-js/babel-plugin-module-resolver",
|
|
60
60
|
{
|
|
61
61
|
root: absoluteBaseUrl,
|
|
62
62
|
alias: mergedPaths,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
|
|
3
3
|
import { getUserAlias } from "@modern-js/utils";
|
|
4
|
-
const { resolvePath } = require("
|
|
4
|
+
const { resolvePath } = require("@modern-js/babel-plugin-module-resolver");
|
|
5
5
|
const defaultPaths = {
|
|
6
6
|
"@": [
|
|
7
7
|
"./src"
|
|
@@ -62,7 +62,7 @@ export const aliasPlugin = (alias) => {
|
|
|
62
62
|
".mjs"
|
|
63
63
|
];
|
|
64
64
|
return [
|
|
65
|
-
"
|
|
65
|
+
"@modern-js/babel-plugin-module-resolver",
|
|
66
66
|
{
|
|
67
67
|
root: absoluteBaseUrl,
|
|
68
68
|
alias: mergedPaths,
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.27.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -31,36 +31,28 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@babel/core": "^7.21.8",
|
|
34
35
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
35
36
|
"@babel/plugin-proposal-decorators": "^7.21.0",
|
|
37
|
+
"@babel/preset-env": "^7.21.5",
|
|
36
38
|
"@babel/preset-typescript": "^7.21.5",
|
|
37
|
-
"@swc/helpers": "0.5.1",
|
|
38
|
-
"babel-plugin-module-resolver": "^4.1.0",
|
|
39
39
|
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"@modern-js/
|
|
45
|
-
"@modern-js/babel-preset-base": "2.26.0",
|
|
46
|
-
"@modern-js/babel-compiler": "2.26.0"
|
|
40
|
+
"@swc/helpers": "0.5.1",
|
|
41
|
+
"@modern-js/babel-compiler": "2.27.0",
|
|
42
|
+
"@modern-js/babel-preset-base": "2.27.0",
|
|
43
|
+
"@modern-js/utils": "2.27.0",
|
|
44
|
+
"@modern-js/babel-plugin-module-resolver": "2.27.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.21.8",
|
|
50
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
51
|
-
"@babel/plugin-transform-modules-commonjs": "^7.17.7",
|
|
52
|
-
"@babel/preset-env": "^7.21.5",
|
|
53
47
|
"@types/babel__core": "^7.20.0",
|
|
54
48
|
"@types/jest": "^29",
|
|
55
49
|
"@types/node": "^14",
|
|
56
|
-
"babel-core": "^6.26.3",
|
|
57
|
-
"common-tags": "^1.8.2",
|
|
58
50
|
"jest": "^29",
|
|
59
51
|
"ts-jest": "^29.1.0",
|
|
60
52
|
"typescript": "^5",
|
|
61
|
-
"@modern-js/server-core": "2.
|
|
62
|
-
"@scripts/
|
|
63
|
-
"@scripts/
|
|
53
|
+
"@modern-js/server-core": "2.27.0",
|
|
54
|
+
"@scripts/build": "2.27.0",
|
|
55
|
+
"@scripts/jest-config": "2.27.0"
|
|
64
56
|
},
|
|
65
57
|
"sideEffects": false,
|
|
66
58
|
"publishConfig": {
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: all[name]
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
resolvePath: function() {
|
|
14
|
-
return _resolvePath.default;
|
|
15
|
-
},
|
|
16
|
-
default: function() {
|
|
17
|
-
return _default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
21
|
-
const _normalizeOptions = /* @__PURE__ */ _interop_require_default._(require("./normalizeOptions"));
|
|
22
|
-
const _resolvePath = /* @__PURE__ */ _interop_require_default._(require("./resolvePath"));
|
|
23
|
-
const _call = /* @__PURE__ */ _interop_require_default._(require("./transformers/call"));
|
|
24
|
-
const _import = /* @__PURE__ */ _interop_require_default._(require("./transformers/import"));
|
|
25
|
-
const importVisitors = {
|
|
26
|
-
CallExpression: _call.default,
|
|
27
|
-
"ImportDeclaration|ExportDeclaration": _import.default
|
|
28
|
-
};
|
|
29
|
-
const visitor = {
|
|
30
|
-
Program: {
|
|
31
|
-
enter(programPath, state) {
|
|
32
|
-
programPath.traverse(importVisitors, state);
|
|
33
|
-
},
|
|
34
|
-
exit(programPath, state) {
|
|
35
|
-
programPath.traverse(importVisitors, state);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const _default = ({ types }) => ({
|
|
40
|
-
name: "module-resolver",
|
|
41
|
-
manipulateOptions(opts) {
|
|
42
|
-
if (opts.filename === void 0) {
|
|
43
|
-
opts.filename = "unknown";
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
pre(file) {
|
|
47
|
-
this.types = types;
|
|
48
|
-
const currentFile = file.opts.filename;
|
|
49
|
-
this.normalizedOpts = (0, _normalizeOptions.default)(currentFile, this.opts);
|
|
50
|
-
this.moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
51
|
-
},
|
|
52
|
-
visitor,
|
|
53
|
-
post() {
|
|
54
|
-
this.moduleResolverVisited.clear();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return mapPathString;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _resolvePath = /* @__PURE__ */ _interop_require_default._(require("./resolvePath"));
|
|
13
|
-
function mapPathString(nodePath, state) {
|
|
14
|
-
if (!state.types.isStringLiteral(nodePath)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const sourcePath = nodePath.node.value;
|
|
18
|
-
const currentFile = state.file.opts.filename;
|
|
19
|
-
const resolvePath = state.normalizedOpts.customResolvePath || _resolvePath.default;
|
|
20
|
-
const modulePath = resolvePath(sourcePath, currentFile, state.opts);
|
|
21
|
-
if (modulePath) {
|
|
22
|
-
if (nodePath.node.pathResolved) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
nodePath.replaceWith(state.types.stringLiteral(modulePath));
|
|
26
|
-
nodePath.node.pathResolved = true;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return mapToRelative;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
13
|
-
const _utils = require("./utils");
|
|
14
|
-
function mapToRelative(cwd, currentFile, module) {
|
|
15
|
-
let from = _path.default.dirname(currentFile);
|
|
16
|
-
let to = _path.default.normalize(module);
|
|
17
|
-
from = _path.default.resolve(cwd, from);
|
|
18
|
-
to = _path.default.resolve(cwd, to);
|
|
19
|
-
const moduleMapped = _path.default.relative(from, to);
|
|
20
|
-
return (0, _utils.toPosixPath)(moduleMapped);
|
|
21
|
-
}
|
package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/normalizeOptions.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _fs = /* @__PURE__ */ _interop_require_default._(require("fs"));
|
|
13
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
14
|
-
const _reselect = require("reselect");
|
|
15
|
-
const _findbabelconfig = /* @__PURE__ */ _interop_require_default._(require("find-babel-config"));
|
|
16
|
-
const _glob = /* @__PURE__ */ _interop_require_default._(require("glob"));
|
|
17
|
-
const _pkgup = /* @__PURE__ */ _interop_require_default._(require("pkg-up"));
|
|
18
|
-
const _utils = require("./utils");
|
|
19
|
-
const defaultExtensions = [
|
|
20
|
-
".js",
|
|
21
|
-
".jsx",
|
|
22
|
-
".es",
|
|
23
|
-
".es6",
|
|
24
|
-
".mjs"
|
|
25
|
-
];
|
|
26
|
-
const defaultTransformedFunctions = [
|
|
27
|
-
"require",
|
|
28
|
-
"require.resolve",
|
|
29
|
-
"System.import",
|
|
30
|
-
// Jest methods
|
|
31
|
-
"jest.genMockFromModule",
|
|
32
|
-
"jest.mock",
|
|
33
|
-
"jest.unmock",
|
|
34
|
-
"jest.doMock",
|
|
35
|
-
"jest.dontMock",
|
|
36
|
-
"jest.setMock",
|
|
37
|
-
"jest.requireActual",
|
|
38
|
-
"jest.requireMock",
|
|
39
|
-
// Older Jest methods
|
|
40
|
-
"require.requireActual",
|
|
41
|
-
"require.requireMock"
|
|
42
|
-
];
|
|
43
|
-
function isRegExp(string) {
|
|
44
|
-
return string.startsWith("^") || string.endsWith("$");
|
|
45
|
-
}
|
|
46
|
-
const specialCwd = {
|
|
47
|
-
babelrc: (startPath) => _findbabelconfig.default.sync(startPath).file,
|
|
48
|
-
packagejson: (startPath) => _pkgup.default.sync({
|
|
49
|
-
cwd: startPath
|
|
50
|
-
})
|
|
51
|
-
};
|
|
52
|
-
function normalizeCwd(optsCwd, currentFile) {
|
|
53
|
-
let cwd;
|
|
54
|
-
if (optsCwd in specialCwd) {
|
|
55
|
-
const startPath = currentFile === "unknown" ? "./" : currentFile;
|
|
56
|
-
const computedCwd = specialCwd[optsCwd](startPath);
|
|
57
|
-
cwd = computedCwd ? _path.default.dirname(computedCwd) : null;
|
|
58
|
-
} else {
|
|
59
|
-
cwd = optsCwd;
|
|
60
|
-
}
|
|
61
|
-
return cwd || process.cwd();
|
|
62
|
-
}
|
|
63
|
-
function normalizeRoot(optsRoot, cwd) {
|
|
64
|
-
if (!optsRoot) {
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
const rootArray = Array.isArray(optsRoot) ? optsRoot : [
|
|
68
|
-
optsRoot
|
|
69
|
-
];
|
|
70
|
-
return rootArray.map((dirPath) => _path.default.resolve(cwd, dirPath)).reduce((resolvedDirs, absDirPath) => {
|
|
71
|
-
if (_glob.default.hasMagic(absDirPath)) {
|
|
72
|
-
const roots = _glob.default.sync(absDirPath).filter((resolvedPath) => _fs.default.lstatSync(resolvedPath).isDirectory());
|
|
73
|
-
return [
|
|
74
|
-
...resolvedDirs,
|
|
75
|
-
...roots
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
return [
|
|
79
|
-
...resolvedDirs,
|
|
80
|
-
absDirPath
|
|
81
|
-
];
|
|
82
|
-
}, []);
|
|
83
|
-
}
|
|
84
|
-
function getAliasTarget(key, isKeyRegExp) {
|
|
85
|
-
const regExpPattern = isKeyRegExp ? key : `^${(0, _utils.escapeRegExp)(key)}(/.*|)$`;
|
|
86
|
-
return new RegExp(regExpPattern);
|
|
87
|
-
}
|
|
88
|
-
function getAliasSubstitute(value, isKeyRegExp) {
|
|
89
|
-
if (typeof value === "function") {
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
if (!isKeyRegExp) {
|
|
93
|
-
return ([, match]) => {
|
|
94
|
-
if (Array.isArray(value)) {
|
|
95
|
-
return value.map((v) => `${v}${match}`);
|
|
96
|
-
}
|
|
97
|
-
return `${value}${match}`;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const parts = value.split("\\\\");
|
|
101
|
-
return (execResult) => parts.map((part) => part.replace(/\\\d+/g, (number) => execResult[number.slice(1)] || "")).join("\\");
|
|
102
|
-
}
|
|
103
|
-
function normalizeAlias(optsAlias) {
|
|
104
|
-
if (!optsAlias) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
const aliasArray = Array.isArray(optsAlias) ? optsAlias : [
|
|
108
|
-
optsAlias
|
|
109
|
-
];
|
|
110
|
-
return aliasArray.reduce((aliasPairs, alias) => {
|
|
111
|
-
const aliasKeys = Object.keys(alias);
|
|
112
|
-
aliasKeys.forEach((key) => {
|
|
113
|
-
const isKeyRegExp = isRegExp(key);
|
|
114
|
-
aliasPairs.push([
|
|
115
|
-
getAliasTarget(key, isKeyRegExp),
|
|
116
|
-
getAliasSubstitute(alias[key], isKeyRegExp)
|
|
117
|
-
]);
|
|
118
|
-
});
|
|
119
|
-
return aliasPairs;
|
|
120
|
-
}, []);
|
|
121
|
-
}
|
|
122
|
-
function normalizeTransformedFunctions(optsTransformFunctions) {
|
|
123
|
-
if (!optsTransformFunctions) {
|
|
124
|
-
return defaultTransformedFunctions;
|
|
125
|
-
}
|
|
126
|
-
return [
|
|
127
|
-
...defaultTransformedFunctions,
|
|
128
|
-
...optsTransformFunctions
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
function normalizeLoglevel(optsLoglevel) {
|
|
132
|
-
return optsLoglevel || "warn";
|
|
133
|
-
}
|
|
134
|
-
const _default = (0, _reselect.createSelector)(
|
|
135
|
-
// The currentFile should have an extension; otherwise it's considered a special value
|
|
136
|
-
(currentFile) => currentFile.includes(".") ? _path.default.dirname(currentFile) : currentFile,
|
|
137
|
-
(_, opts) => opts,
|
|
138
|
-
(currentFile, opts) => {
|
|
139
|
-
const cwd = normalizeCwd(opts.cwd, currentFile);
|
|
140
|
-
const root = normalizeRoot(opts.root, cwd);
|
|
141
|
-
const alias = normalizeAlias(opts.alias);
|
|
142
|
-
const loglevel = normalizeLoglevel(opts.loglevel);
|
|
143
|
-
const transformFunctions = normalizeTransformedFunctions(opts.transformFunctions);
|
|
144
|
-
const extensions = opts.extensions || defaultExtensions;
|
|
145
|
-
const stripExtensions = opts.stripExtensions || extensions;
|
|
146
|
-
return {
|
|
147
|
-
cwd,
|
|
148
|
-
root,
|
|
149
|
-
alias,
|
|
150
|
-
loglevel,
|
|
151
|
-
transformFunctions,
|
|
152
|
-
extensions,
|
|
153
|
-
stripExtensions,
|
|
154
|
-
customResolvePath: opts.resolvePath
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
);
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return resolvePath;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
13
|
-
const _log = require("./log");
|
|
14
|
-
const _mapToRelative = /* @__PURE__ */ _interop_require_default._(require("./mapToRelative"));
|
|
15
|
-
const _normalizeOptions = /* @__PURE__ */ _interop_require_default._(require("./normalizeOptions"));
|
|
16
|
-
const _utils = require("./utils");
|
|
17
|
-
function getRelativePath(sourcePath, currentFile, absFileInRoot, opts) {
|
|
18
|
-
const realSourceFileExtension = _path.default.extname(absFileInRoot);
|
|
19
|
-
const sourceFileExtension = _path.default.extname(sourcePath);
|
|
20
|
-
let relativePath = (0, _mapToRelative.default)(opts.cwd, currentFile, absFileInRoot);
|
|
21
|
-
if (realSourceFileExtension !== sourceFileExtension) {
|
|
22
|
-
relativePath = (0, _utils.replaceExtension)(relativePath, opts);
|
|
23
|
-
}
|
|
24
|
-
return (0, _utils.toLocalPath)((0, _utils.toPosixPath)(relativePath));
|
|
25
|
-
}
|
|
26
|
-
function findPathInRoots(sourcePath, { extensions, root }) {
|
|
27
|
-
let resolvedSourceFile;
|
|
28
|
-
root.some((basedir) => {
|
|
29
|
-
resolvedSourceFile = (0, _utils.nodeResolvePath)(`./${sourcePath}`, basedir, extensions);
|
|
30
|
-
return resolvedSourceFile !== null;
|
|
31
|
-
});
|
|
32
|
-
return resolvedSourceFile;
|
|
33
|
-
}
|
|
34
|
-
function resolvePathFromRootConfig(sourcePath, currentFile, opts) {
|
|
35
|
-
const absFileInRoot = findPathInRoots(sourcePath, opts);
|
|
36
|
-
if (!absFileInRoot) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return getRelativePath(sourcePath, currentFile, absFileInRoot, opts);
|
|
40
|
-
}
|
|
41
|
-
function checkIfPackageExists(modulePath, currentFile, extensions, loglevel) {
|
|
42
|
-
const resolvedPath = (0, _utils.nodeResolvePath)(modulePath, currentFile, extensions);
|
|
43
|
-
if (resolvedPath === null && loglevel !== "silent") {
|
|
44
|
-
(0, _log.warn)(`Could not resolve "${modulePath}" in file ${currentFile}.`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function resolvePathFromAliasConfig(sourcePath, currentFile, opts) {
|
|
48
|
-
let aliasedSourceFile;
|
|
49
|
-
opts.alias.find(([regExp, substitute]) => {
|
|
50
|
-
const execResult = regExp.exec(sourcePath);
|
|
51
|
-
if (execResult === null) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
aliasedSourceFile = substitute(execResult);
|
|
55
|
-
return true;
|
|
56
|
-
});
|
|
57
|
-
if (!aliasedSourceFile) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
if (Array.isArray(aliasedSourceFile)) {
|
|
61
|
-
return aliasedSourceFile.map((asf) => {
|
|
62
|
-
if ((0, _utils.isRelativePath)(asf)) {
|
|
63
|
-
return (0, _utils.toLocalPath)((0, _utils.toPosixPath)((0, _mapToRelative.default)(opts.cwd, currentFile, asf)));
|
|
64
|
-
}
|
|
65
|
-
return asf;
|
|
66
|
-
}).find((src) => (0, _utils.nodeResolvePath)(src, _path.default.dirname(currentFile), opts.extensions));
|
|
67
|
-
}
|
|
68
|
-
if ((0, _utils.isRelativePath)(aliasedSourceFile)) {
|
|
69
|
-
return (0, _utils.toLocalPath)((0, _utils.toPosixPath)((0, _mapToRelative.default)(opts.cwd, currentFile, aliasedSourceFile)));
|
|
70
|
-
}
|
|
71
|
-
if (process.env.NODE_ENV !== "production") {
|
|
72
|
-
checkIfPackageExists(aliasedSourceFile, currentFile, opts.extensions, opts.loglevel);
|
|
73
|
-
}
|
|
74
|
-
return aliasedSourceFile;
|
|
75
|
-
}
|
|
76
|
-
const resolvers = [
|
|
77
|
-
resolvePathFromAliasConfig,
|
|
78
|
-
resolvePathFromRootConfig
|
|
79
|
-
];
|
|
80
|
-
function resolvePath(sourcePath, currentFile, opts) {
|
|
81
|
-
if ((0, _utils.isRelativePath)(sourcePath)) {
|
|
82
|
-
return sourcePath;
|
|
83
|
-
}
|
|
84
|
-
const normalizedOpts = (0, _normalizeOptions.default)(currentFile, opts);
|
|
85
|
-
const absoluteCurrentFile = _path.default.resolve(currentFile);
|
|
86
|
-
let resolvedPath = null;
|
|
87
|
-
resolvers.some((resolver) => {
|
|
88
|
-
resolvedPath = resolver(sourcePath, absoluteCurrentFile, normalizedOpts);
|
|
89
|
-
return resolvedPath !== null;
|
|
90
|
-
});
|
|
91
|
-
return resolvedPath;
|
|
92
|
-
}
|
package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/call.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return transformCall;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _utils = require("../utils");
|
|
13
|
-
const _mapPath = /* @__PURE__ */ _interop_require_default._(require("../mapPath"));
|
|
14
|
-
function transformCall(nodePath, state) {
|
|
15
|
-
if (state.moduleResolverVisited.has(nodePath)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const calleePath = nodePath.get("callee");
|
|
19
|
-
const isNormalCall = state.normalizedOpts.transformFunctions.some((pattern) => (0, _utils.matchesPattern)(state.types, calleePath, pattern));
|
|
20
|
-
if (isNormalCall || (0, _utils.isImportCall)(state.types, nodePath)) {
|
|
21
|
-
state.moduleResolverVisited.add(nodePath);
|
|
22
|
-
(0, _mapPath.default)(nodePath.get("arguments.0"), state);
|
|
23
|
-
}
|
|
24
|
-
}
|
package/dist/cjs/compilers/babel/plugins/babel-plugin-module-resolver/src/transformers/import.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return transformImport;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _mapPath = /* @__PURE__ */ _interop_require_default._(require("../mapPath"));
|
|
13
|
-
function transformImport(nodePath, state) {
|
|
14
|
-
if (state.moduleResolverVisited.has(nodePath)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
state.moduleResolverVisited.add(nodePath);
|
|
18
|
-
(0, _mapPath.default)(nodePath.get("source"), state);
|
|
19
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: all[name]
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
nodeResolvePath: function() {
|
|
14
|
-
return nodeResolvePath;
|
|
15
|
-
},
|
|
16
|
-
isRelativePath: function() {
|
|
17
|
-
return isRelativePath;
|
|
18
|
-
},
|
|
19
|
-
toPosixPath: function() {
|
|
20
|
-
return toPosixPath;
|
|
21
|
-
},
|
|
22
|
-
toLocalPath: function() {
|
|
23
|
-
return toLocalPath;
|
|
24
|
-
},
|
|
25
|
-
stripExtension: function() {
|
|
26
|
-
return stripExtension;
|
|
27
|
-
},
|
|
28
|
-
replaceExtension: function() {
|
|
29
|
-
return replaceExtension;
|
|
30
|
-
},
|
|
31
|
-
matchesPattern: function() {
|
|
32
|
-
return matchesPattern;
|
|
33
|
-
},
|
|
34
|
-
isImportCall: function() {
|
|
35
|
-
return isImportCall;
|
|
36
|
-
},
|
|
37
|
-
escapeRegExp: function() {
|
|
38
|
-
return escapeRegExp;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
42
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
43
|
-
const _resolve = /* @__PURE__ */ _interop_require_default._(require("resolve"));
|
|
44
|
-
function nodeResolvePath(modulePath, basedir, extensions) {
|
|
45
|
-
try {
|
|
46
|
-
return _resolve.default.sync(modulePath, {
|
|
47
|
-
basedir,
|
|
48
|
-
extensions
|
|
49
|
-
});
|
|
50
|
-
} catch (e) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function isRelativePath(nodePath) {
|
|
55
|
-
return nodePath.match(/^\.?\.\//);
|
|
56
|
-
}
|
|
57
|
-
function toPosixPath(modulePath) {
|
|
58
|
-
return modulePath.replace(/\\/g, "/");
|
|
59
|
-
}
|
|
60
|
-
function toLocalPath(modulePath) {
|
|
61
|
-
let localPath = modulePath.replace(/\/index$/, "");
|
|
62
|
-
if (!isRelativePath(localPath)) {
|
|
63
|
-
localPath = `./${localPath}`;
|
|
64
|
-
}
|
|
65
|
-
return localPath;
|
|
66
|
-
}
|
|
67
|
-
function stripExtension(modulePath, stripExtensions) {
|
|
68
|
-
let name = _path.default.basename(modulePath);
|
|
69
|
-
stripExtensions.some((extension) => {
|
|
70
|
-
if (name.endsWith(extension)) {
|
|
71
|
-
name = name.slice(0, name.length - extension.length);
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
});
|
|
76
|
-
return name;
|
|
77
|
-
}
|
|
78
|
-
function replaceExtension(modulePath, opts) {
|
|
79
|
-
const filename = stripExtension(modulePath, opts.stripExtensions);
|
|
80
|
-
return _path.default.join(_path.default.dirname(modulePath), filename);
|
|
81
|
-
}
|
|
82
|
-
function matchesPattern(types, calleePath, pattern) {
|
|
83
|
-
const { node } = calleePath;
|
|
84
|
-
if (types.isMemberExpression(node)) {
|
|
85
|
-
return calleePath.matchesPattern(pattern);
|
|
86
|
-
}
|
|
87
|
-
if (!types.isIdentifier(node) || pattern.includes(".")) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
const name = pattern.split(".")[0];
|
|
91
|
-
return node.name === name;
|
|
92
|
-
}
|
|
93
|
-
function isImportCall(types, calleePath) {
|
|
94
|
-
return types.isImport(calleePath.node.callee);
|
|
95
|
-
}
|
|
96
|
-
function escapeRegExp(string) {
|
|
97
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
98
|
-
}
|