@umijs/mfsu 4.0.0-beta.8 → 4.0.0-canary-20240513.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/compiled/is-absolute-url/LICENSE +9 -0
- package/compiled/is-absolute-url/index.d.ts +20 -0
- package/compiled/is-absolute-url/index.js +1 -0
- package/compiled/is-absolute-url/package.json +1 -0
- package/compiled/mrmime/package.json +1 -1
- package/compiled/webpack-virtual-modules/index.js +1 -1
- package/compiled/webpack-virtual-modules/package.json +1 -1
- package/dist/babelPlugins/awaitImport/MFImport.d.ts +24 -0
- package/dist/babelPlugins/awaitImport/MFImport.js +66 -0
- package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
- package/dist/babelPlugins/awaitImport/awaitImport.js +111 -112
- package/dist/babelPlugins/awaitImport/checkMatch.d.ts +3 -1
- package/dist/babelPlugins/awaitImport/checkMatch.js +166 -109
- package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +2 -2
- package/dist/babelPlugins/awaitImport/getAliasedPath.js +44 -33
- package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
- package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
- package/dist/babelPlugins/awaitImport/parseSpecifiers.js +62 -47
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +50 -10
- package/dist/dep/dep.d.ts +11 -4
- package/dist/dep/dep.js +118 -80
- package/dist/dep/getCJSExports.js +83 -47
- package/dist/dep/getExposeFromContent.d.ts +0 -1
- package/dist/dep/getExposeFromContent.js +99 -74
- package/dist/dep/getModuleExports.js +58 -43
- package/dist/depBuilder/depBuilder.d.ts +6 -2
- package/dist/depBuilder/depBuilder.js +222 -158
- package/dist/depBuilder/getESBuildEntry.d.ts +1 -1
- package/dist/depBuilder/getESBuildEntry.js +50 -14
- package/dist/depInfo.d.ts +20 -6
- package/dist/depInfo.js +90 -39
- package/dist/esbuildHandlers/autoCssModules.d.ts +2 -0
- package/dist/esbuildHandlers/autoCssModules.js +48 -0
- package/dist/esbuildHandlers/awaitImport/index.d.ts +15 -0
- package/dist/esbuildHandlers/awaitImport/index.js +86 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +35 -13
- package/dist/loader/esbuild.d.ts +5 -0
- package/dist/loader/esbuild.js +79 -0
- package/dist/mfsu/mfsu.d.ts +69 -0
- package/dist/mfsu/mfsu.js +319 -0
- package/dist/mfsu/strategyCompileTime.d.ts +20 -0
- package/dist/mfsu/strategyCompileTime.js +142 -0
- package/dist/mfsu/strategyStaticAnalyze.d.ts +24 -0
- package/dist/mfsu/strategyStaticAnalyze.js +196 -0
- package/dist/moduleGraph.d.ts +6 -9
- package/dist/moduleGraph.js +228 -178
- package/dist/staticDepInfo/importParser.d.ts +4 -0
- package/dist/staticDepInfo/importParser.js +28 -0
- package/dist/staticDepInfo/simulations/babel-plugin-import.d.ts +15 -0
- package/dist/staticDepInfo/simulations/babel-plugin-import.js +118 -0
- package/dist/staticDepInfo/staticDepInfo.d.ts +61 -0
- package/dist/staticDepInfo/staticDepInfo.js +274 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.js +33 -8
- package/dist/utils/makeArray.js +29 -5
- package/dist/utils/resolveUtils.d.ts +1 -0
- package/dist/utils/resolveUtils.js +104 -0
- package/dist/utils/trimFileContent.js +29 -5
- package/dist/utils/webpackUtils.d.ts +3 -0
- package/dist/utils/webpackUtils.js +80 -0
- package/dist/webpackPlugins/buildDepPlugin.d.ts +4 -3
- package/dist/webpackPlugins/buildDepPlugin.js +61 -17
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +1 -1
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +47 -19
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +55 -27
- package/dist/webpackPlugins/writeCachePlugin.js +45 -15
- package/package.json +32 -28
- package/vendors/importParser/_importParser.js +683 -0
- package/vendors/importParser/importParser.jison +105 -0
- package/dist/babelPlugins/autoExport.d.ts +0 -7
- package/dist/babelPlugins/autoExport.d.ts.map +0 -1
- package/dist/babelPlugins/autoExport.js +0 -61
- package/dist/babelPlugins/awaitImport/awaitImport.d.ts.map +0 -1
- package/dist/babelPlugins/awaitImport/checkMatch.d.ts.map +0 -1
- package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts.map +0 -1
- package/dist/babelPlugins/awaitImport/getRealPath.d.ts.map +0 -1
- package/dist/babelPlugins/awaitImport/isExternals.d.ts.map +0 -1
- package/dist/babelPlugins/awaitImport/parseSpecifiers.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/dep/dep.d.ts.map +0 -1
- package/dist/dep/getCJSExports.d.ts.map +0 -1
- package/dist/dep/getExposeFromContent.d.ts.map +0 -1
- package/dist/dep/getModuleExports.d.ts.map +0 -1
- package/dist/depBuilder/depBuilder.d.ts.map +0 -1
- package/dist/depBuilder/getESBuildEntry.d.ts.map +0 -1
- package/dist/depInfo.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mfsu.d.ts +0 -55
- package/dist/mfsu.d.ts.map +0 -1
- package/dist/mfsu.js +0 -173
- package/dist/moduleGraph.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/makeArray.d.ts.map +0 -1
- package/dist/utils/trimFileContent.d.ts.map +0 -1
- package/dist/webpackPlugins/buildDepPlugin.d.ts.map +0 -1
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts.map +0 -1
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.d.ts.map +0 -1
- package/dist/webpackPlugins/writeCachePlugin.d.ts.map +0 -1
|
@@ -1,119 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/babelPlugins/awaitImport/checkMatch.ts
|
|
30
|
+
var checkMatch_exports = {};
|
|
31
|
+
__export(checkMatch_exports, {
|
|
32
|
+
checkMatch: () => checkMatch,
|
|
33
|
+
getPath: () => getPath
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(checkMatch_exports);
|
|
36
|
+
var import_utils = require("@umijs/utils");
|
|
37
|
+
var import_assert = __toESM(require("assert"));
|
|
38
|
+
var import_path = require("path");
|
|
39
|
+
var import_isExternals = require("./isExternals");
|
|
40
|
+
var RE_NODE_MODULES = /node_modules/;
|
|
41
|
+
function isUmiLocalDev(path) {
|
|
42
|
+
const rootPath = (0, import_utils.isLocalDev)();
|
|
43
|
+
if (rootPath) {
|
|
44
|
+
const winP = (0, import_utils.winPath)(path);
|
|
45
|
+
const pkgP = (0, import_utils.winPath)((0, import_path.join)(rootPath, "./packages"));
|
|
46
|
+
const libP = (0, import_utils.winPath)((0, import_path.join)(rootPath, "./libs"));
|
|
47
|
+
return winP.startsWith(pkgP) || winP.startsWith(libP);
|
|
48
|
+
} else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function genUnMatchLibsRegex(libs) {
|
|
53
|
+
if (!libs) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const deps = libs.map((lib) => {
|
|
57
|
+
if (typeof lib === "string") {
|
|
58
|
+
return `^${lib}$`;
|
|
59
|
+
} else if (lib instanceof RegExp) {
|
|
60
|
+
return lib.source;
|
|
42
61
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
});
|
|
63
|
+
return deps.length ? new RegExp(deps.join("|")) : null;
|
|
64
|
+
}
|
|
65
|
+
function checkMatch({
|
|
66
|
+
value,
|
|
67
|
+
path,
|
|
68
|
+
opts,
|
|
69
|
+
isExportAll,
|
|
70
|
+
depth,
|
|
71
|
+
cache,
|
|
72
|
+
filename
|
|
73
|
+
}) {
|
|
74
|
+
var _a;
|
|
75
|
+
let isMatch;
|
|
76
|
+
let replaceValue = "";
|
|
77
|
+
depth = depth || 1;
|
|
78
|
+
(0, import_assert.default)(
|
|
79
|
+
depth <= 10,
|
|
80
|
+
`endless loop detected in checkMatch, please check your alias config.`
|
|
81
|
+
);
|
|
82
|
+
opts = opts || {};
|
|
83
|
+
const remoteName = opts.remoteName || "mf";
|
|
84
|
+
value = value.replace(/^@fs\//, "/");
|
|
85
|
+
const unMatchLibsRegex = genUnMatchLibsRegex(opts.unMatchLibs);
|
|
86
|
+
const mfPathInitial = `${remoteName}/`;
|
|
87
|
+
if (
|
|
88
|
+
// unMatch specified libs
|
|
89
|
+
(unMatchLibsRegex == null ? void 0 : unMatchLibsRegex.test(value)) || // do not match bundler-webpack/client/client/client.js
|
|
90
|
+
value.includes("client/client/client.js") || // don't match dynamic path
|
|
91
|
+
// e.g. @umijs/deps/compiled/babel/svgr-webpack.js?-svgo,+titleProp,+ref!./umi.svg
|
|
92
|
+
(0, import_utils.winPath)(value).includes("babel/svgr-webpack") || // don't match webpack loader
|
|
93
|
+
// e.g. !!dumi-raw-code-loader!/path/to/VerticalProgress/index.module.less?dumi-raw-code
|
|
94
|
+
value.startsWith("!!") || // don't match externals
|
|
95
|
+
(0, import_isExternals.isExternals)({ value, externals: opts.externals }) || // relative import
|
|
96
|
+
value.startsWith(".")
|
|
97
|
+
) {
|
|
98
|
+
isMatch = false;
|
|
99
|
+
} else if (value.startsWith(mfPathInitial)) {
|
|
100
|
+
isMatch = true;
|
|
101
|
+
} else if ((0, import_path.isAbsolute)(value)) {
|
|
102
|
+
isMatch = RE_NODE_MODULES.test(value) || isUmiLocalDev(value);
|
|
103
|
+
} else {
|
|
104
|
+
const aliasedPath = import_utils.aliasUtils.getAliasValue({
|
|
105
|
+
imported: value,
|
|
106
|
+
alias: opts.alias || {}
|
|
107
|
+
});
|
|
108
|
+
if (aliasedPath) {
|
|
109
|
+
return checkMatch({
|
|
110
|
+
value: aliasedPath,
|
|
111
|
+
path,
|
|
112
|
+
opts,
|
|
113
|
+
isExportAll,
|
|
114
|
+
depth: depth + 1,
|
|
115
|
+
cache,
|
|
116
|
+
filename
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
isMatch = true;
|
|
61
120
|
}
|
|
62
|
-
|
|
63
|
-
|
|
121
|
+
}
|
|
122
|
+
if (isMatch && isExportAll) {
|
|
123
|
+
isMatch = !!(opts.exportAllMembers && value in opts.exportAllMembers);
|
|
124
|
+
}
|
|
125
|
+
if (isMatch) {
|
|
126
|
+
if (value.startsWith(mfPathInitial)) {
|
|
127
|
+
replaceValue = value;
|
|
128
|
+
value = value.replace(mfPathInitial, "");
|
|
129
|
+
} else {
|
|
130
|
+
replaceValue = `${remoteName}/${(0, import_utils.winPath)(value)}`;
|
|
64
131
|
}
|
|
65
|
-
|
|
66
|
-
|
|
132
|
+
}
|
|
133
|
+
const file = (path == null ? void 0 : path.hub.file.opts.filename) || filename;
|
|
134
|
+
(_a = opts.onTransformDeps) == null ? void 0 : _a.call(opts, {
|
|
135
|
+
sourceValue: value,
|
|
136
|
+
replaceValue,
|
|
137
|
+
isMatch,
|
|
138
|
+
file
|
|
139
|
+
});
|
|
140
|
+
if (cache) {
|
|
141
|
+
let mod;
|
|
142
|
+
if (cache.has(file)) {
|
|
143
|
+
mod = cache.get(file);
|
|
144
|
+
} else {
|
|
145
|
+
mod = {
|
|
146
|
+
matched: /* @__PURE__ */ new Set(),
|
|
147
|
+
unMatched: /* @__PURE__ */ new Set()
|
|
148
|
+
};
|
|
149
|
+
cache.set(file, mod);
|
|
67
150
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
replaceValue,
|
|
73
|
-
isMatch,
|
|
74
|
-
file,
|
|
151
|
+
mod[isMatch ? "matched" : "unMatched"].add({
|
|
152
|
+
sourceValue: value,
|
|
153
|
+
replaceValue,
|
|
154
|
+
file
|
|
75
155
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
mod = {
|
|
83
|
-
matched: new Set(),
|
|
84
|
-
unMatched: new Set(),
|
|
85
|
-
};
|
|
86
|
-
cache.set(file, mod);
|
|
87
|
-
}
|
|
88
|
-
mod[isMatch ? 'matched' : 'unMatched'].add({
|
|
89
|
-
sourceValue: value,
|
|
90
|
-
replaceValue,
|
|
91
|
-
file,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
// console.log(
|
|
95
|
-
// '> check',
|
|
96
|
-
// // @ts-ignore
|
|
97
|
-
// path.hub.file.opts.filename,
|
|
98
|
-
// value,
|
|
99
|
-
// cache,
|
|
100
|
-
// 'isMatch',
|
|
101
|
-
// isMatch,
|
|
102
|
-
// );
|
|
103
|
-
return {
|
|
104
|
-
isMatch,
|
|
105
|
-
replaceValue,
|
|
106
|
-
};
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
isMatch,
|
|
159
|
+
replaceValue,
|
|
160
|
+
value
|
|
161
|
+
};
|
|
107
162
|
}
|
|
108
|
-
exports.checkMatch = checkMatch;
|
|
109
|
-
// TODO: REMOVE ME
|
|
110
163
|
function getPath({ value, opts }) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
164
|
+
const alias = opts.alias || {};
|
|
165
|
+
for (const key of Object.keys(alias)) {
|
|
166
|
+
if (value.startsWith(key)) {
|
|
167
|
+
return value.replace(key, alias[key]);
|
|
116
168
|
}
|
|
117
|
-
|
|
169
|
+
}
|
|
170
|
+
return value;
|
|
118
171
|
}
|
|
119
|
-
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
checkMatch,
|
|
175
|
+
getPath
|
|
176
|
+
});
|
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/babelPlugins/awaitImport/getAliasedPath.ts
|
|
20
|
+
var getAliasedPath_exports = {};
|
|
21
|
+
__export(getAliasedPath_exports, {
|
|
22
|
+
getAliasedPathWithLoopDetect: () => getAliasedPathWithLoopDetect
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getAliasedPath_exports);
|
|
25
|
+
var import_utils = require("@umijs/utils");
|
|
26
|
+
function getAliasedPathWithLoopDetect({
|
|
27
|
+
value,
|
|
28
|
+
alias
|
|
29
|
+
}) {
|
|
30
|
+
let needUnAlias = value;
|
|
31
|
+
for (let i = 0; i < 10; i++) {
|
|
32
|
+
let unAliased = import_utils.aliasUtils.getAliasValue({ imported: needUnAlias, alias });
|
|
33
|
+
if (unAliased) {
|
|
34
|
+
needUnAlias = unAliased;
|
|
35
|
+
} else {
|
|
36
|
+
return needUnAlias;
|
|
27
37
|
}
|
|
38
|
+
}
|
|
39
|
+
throw Error(
|
|
40
|
+
`endless loop detected in resolve alias for '${value}', please check your alias config.`
|
|
41
|
+
);
|
|
28
42
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function addLastSlash(path) {
|
|
34
|
-
return path.endsWith('/') ? path : `${path}/`;
|
|
35
|
-
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
getAliasedPathWithLoopDetect
|
|
46
|
+
});
|
|
@@ -1,24 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/babelPlugins/awaitImport/getRealPath.ts
|
|
20
|
+
var getRealPath_exports = {};
|
|
21
|
+
__export(getRealPath_exports, {
|
|
22
|
+
getRealPath: () => getRealPath
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getRealPath_exports);
|
|
25
|
+
var import_fs = require("fs");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var FILE_EXT_NAMES = [".tsx", ".ts", ".jsx", ".mjs", ".js"];
|
|
7
28
|
function getRealPath(opts) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if ((0, fs_1.existsSync)(targetWithExtName)) {
|
|
18
|
-
return targetWithExtName;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
29
|
+
const target = (0, import_path.isAbsolute)(opts.dep) ? opts.dep : (0, import_path.join)((0, import_path.dirname)(opts.file), opts.dep);
|
|
30
|
+
if (FILE_EXT_NAMES.includes((0, import_path.extname)(target))) {
|
|
31
|
+
return target;
|
|
32
|
+
} else {
|
|
33
|
+
for (const fileExtName of FILE_EXT_NAMES) {
|
|
34
|
+
const targetWithExtName = `${target}${fileExtName}`;
|
|
35
|
+
if ((0, import_fs.existsSync)(targetWithExtName)) {
|
|
36
|
+
return targetWithExtName;
|
|
37
|
+
}
|
|
22
38
|
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
23
41
|
}
|
|
24
|
-
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
getRealPath
|
|
45
|
+
});
|
|
@@ -1,29 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/babelPlugins/awaitImport/isExternals.ts
|
|
20
|
+
var isExternals_exports = {};
|
|
21
|
+
__export(isExternals_exports, {
|
|
22
|
+
isExternal: () => isExternal,
|
|
23
|
+
isExternals: () => isExternals
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(isExternals_exports);
|
|
26
|
+
function isExternals({
|
|
27
|
+
value,
|
|
28
|
+
externals
|
|
29
|
+
}) {
|
|
30
|
+
const externalsArr = Array.isArray(externals) ? externals : [externals];
|
|
31
|
+
for (const external of externalsArr) {
|
|
32
|
+
if (isExternal({ value, external })) {
|
|
33
|
+
return true;
|
|
10
34
|
}
|
|
11
|
-
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
12
37
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
function isExternal({
|
|
39
|
+
value,
|
|
40
|
+
external
|
|
41
|
+
}) {
|
|
42
|
+
if (typeof external === "object") {
|
|
43
|
+
return !!external[value];
|
|
44
|
+
} else if (typeof external === "function") {
|
|
45
|
+
let ret = false;
|
|
46
|
+
external({}, value, (_, b) => {
|
|
47
|
+
ret = !!b;
|
|
48
|
+
});
|
|
49
|
+
return ret;
|
|
50
|
+
} else {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
28
53
|
}
|
|
29
|
-
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
isExternal,
|
|
57
|
+
isExternals
|
|
58
|
+
});
|
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
20
18
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/babelPlugins/awaitImport/parseSpecifiers.ts
|
|
30
|
+
var parseSpecifiers_exports = {};
|
|
31
|
+
__export(parseSpecifiers_exports, {
|
|
32
|
+
parseSpecifiers: () => parseSpecifiers
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(parseSpecifiers_exports);
|
|
35
|
+
var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
|
|
36
|
+
var DEFAULT = "default";
|
|
25
37
|
function parseSpecifiers(specifiers) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
return specifiers.reduce(
|
|
39
|
+
(memo, s) => {
|
|
40
|
+
if (t.isImportDefaultSpecifier(s)) {
|
|
41
|
+
memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.local));
|
|
42
|
+
} else if (t.isExportDefaultSpecifier(s)) {
|
|
43
|
+
memo.properties.push(
|
|
44
|
+
t.objectProperty(t.identifier(DEFAULT), s.exported)
|
|
45
|
+
);
|
|
46
|
+
} else if (t.isExportSpecifier(s)) {
|
|
47
|
+
if (t.isIdentifier(s.exported, { name: DEFAULT })) {
|
|
48
|
+
memo.defaultIdentifier = s.local.name;
|
|
49
|
+
memo.properties.push(t.objectProperty(s.local, s.local));
|
|
50
|
+
} else {
|
|
51
|
+
memo.properties.push(t.objectProperty(s.local, s.exported));
|
|
32
52
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
else if (t.isImportNamespaceSpecifier(s)) {
|
|
43
|
-
memo.namespaceIdentifier = s.local;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
memo.properties.push(t.objectProperty(s.imported, s.local));
|
|
47
|
-
}
|
|
48
|
-
return memo;
|
|
49
|
-
}, { properties: [], namespaceIdentifier: null, defaultIdentifier: null });
|
|
53
|
+
} else if (t.isImportNamespaceSpecifier(s)) {
|
|
54
|
+
memo.namespaceIdentifier = s.local;
|
|
55
|
+
} else {
|
|
56
|
+
memo.properties.push(t.objectProperty(s.imported, s.local));
|
|
57
|
+
}
|
|
58
|
+
return memo;
|
|
59
|
+
},
|
|
60
|
+
{ properties: [], namespaceIdentifier: null, defaultIdentifier: null }
|
|
61
|
+
);
|
|
50
62
|
}
|
|
51
|
-
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
parseSpecifiers
|
|
66
|
+
});
|
package/dist/constants.d.ts
CHANGED