@umijs/mfsu 4.0.6 → 4.0.9
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 +22 -0
- package/compiled/is-absolute-url/index.js +1 -0
- package/compiled/is-absolute-url/package.json +1 -0
- package/dist/babelPlugins/awaitImport/MFImport.js +59 -66
- package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
- package/dist/babelPlugins/awaitImport/awaitImport.js +103 -117
- package/dist/babelPlugins/awaitImport/checkMatch.js +131 -119
- package/dist/babelPlugins/awaitImport/getAliasedPath.js +54 -35
- package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
- package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
- package/dist/babelPlugins/awaitImport/parseSpecifiers.js +51 -52
- package/dist/constants.js +47 -10
- package/dist/dep/dep.js +112 -83
- package/dist/dep/getCJSExports.js +60 -53
- package/dist/dep/getExposeFromContent.js +71 -59
- package/dist/dep/getModuleExports.js +58 -32
- package/dist/depBuilder/depBuilder.js +184 -158
- package/dist/depBuilder/getESBuildEntry.js +35 -12
- package/dist/depInfo.js +75 -53
- package/dist/esbuildHandlers/autoCssModules.js +43 -22
- package/dist/esbuildHandlers/awaitImport/index.js +82 -70
- package/dist/index.js +32 -22
- package/dist/loader/esbuild.js +87 -35
- package/dist/mfsu/mfsu.d.ts +1 -1
- package/dist/mfsu/mfsu.js +231 -257
- package/dist/mfsu/strategyCompileTime.js +123 -99
- package/dist/mfsu/strategyStaticAnalyze.js +135 -117
- package/dist/moduleGraph.js +227 -186
- package/dist/staticDepInfo/importParser.js +28 -6
- package/dist/staticDepInfo/simulations/babel-plugin-import.js +99 -91
- package/dist/staticDepInfo/staticDepInfo.js +230 -197
- package/dist/types.js +33 -8
- package/dist/utils/makeArray.js +29 -5
- package/dist/utils/trimFileContent.js +29 -5
- package/dist/webpackPlugins/buildDepPlugin.js +49 -25
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +44 -19
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +46 -27
- package/dist/webpackPlugins/writeCachePlugin.js +39 -15
- package/package.json +8 -6
|
@@ -1,130 +1,142 @@
|
|
|
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
|
-
|
|
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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// checkMatch.ts
|
|
23
|
+
var checkMatch_exports = {};
|
|
24
|
+
__export(checkMatch_exports, {
|
|
25
|
+
checkMatch: () => checkMatch,
|
|
26
|
+
getPath: () => getPath
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(checkMatch_exports);
|
|
29
|
+
var import_utils = require("@umijs/utils");
|
|
30
|
+
var import_assert = __toESM(require("assert"));
|
|
31
|
+
var import_path = require("path");
|
|
32
|
+
var import_getAliasedPath = require("./getAliasedPath");
|
|
33
|
+
var import_isExternals = require("./isExternals");
|
|
34
|
+
var RE_NODE_MODULES = /node_modules/;
|
|
14
35
|
function isUmiLocalDev(path) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
? (0, utils_1.winPath)(path).startsWith((0, utils_1.winPath)((0, path_1.join)(rootPath, './packages')))
|
|
18
|
-
: false;
|
|
36
|
+
const rootPath = (0, import_utils.isLocalDev)();
|
|
37
|
+
return rootPath ? (0, import_utils.winPath)(path).startsWith((0, import_utils.winPath)((0, import_path.join)(rootPath, "./packages"))) : false;
|
|
19
38
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
value = value.replace(/^@fs\//, '/');
|
|
30
|
-
if (
|
|
31
|
-
// unMatch specified libs
|
|
32
|
-
((_a = opts.unMatchLibs) === null || _a === void 0 ? void 0 : _a.includes(value)) ||
|
|
33
|
-
// do not match bundler-webpack/client/client/client.js
|
|
34
|
-
value.includes('client/client/client.js') ||
|
|
35
|
-
// already handled
|
|
36
|
-
value.startsWith(`${remoteName}/`) ||
|
|
37
|
-
// don't match dynamic path
|
|
38
|
-
// e.g. @umijs/deps/compiled/babel/svgr-webpack.js?-svgo,+titleProp,+ref!./umi.svg
|
|
39
|
-
(0, utils_1.winPath)(value).includes('babel/svgr-webpack') ||
|
|
40
|
-
// don't match webpack loader
|
|
41
|
-
// e.g. !!dumi-raw-code-loader!/path/to/VerticalProgress/index.module.less?dumi-raw-code
|
|
42
|
-
value.startsWith('!!') ||
|
|
43
|
-
// don't match externals
|
|
44
|
-
(0, isExternals_1.isExternals)({ value, externals: opts.externals }) ||
|
|
45
|
-
// relative import
|
|
46
|
-
value.startsWith('.')) {
|
|
47
|
-
isMatch = false;
|
|
48
|
-
}
|
|
49
|
-
else if ((0, path_1.isAbsolute)(value)) {
|
|
50
|
-
isMatch = RE_NODE_MODULES.test(value) || isUmiLocalDev(value);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const aliasedPath = (0, getAliasedPath_1.getAliasedPath)({
|
|
54
|
-
value,
|
|
55
|
-
alias: opts.alias || {},
|
|
56
|
-
});
|
|
57
|
-
if (aliasedPath) {
|
|
58
|
-
return checkMatch({
|
|
59
|
-
value: aliasedPath,
|
|
60
|
-
path,
|
|
61
|
-
opts,
|
|
62
|
-
isExportAll,
|
|
63
|
-
depth: depth + 1,
|
|
64
|
-
cache,
|
|
65
|
-
filename,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
isMatch = true;
|
|
70
|
-
}
|
|
39
|
+
function genUnMatchLibsRegex(libs) {
|
|
40
|
+
if (!libs) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const deps = libs.map((lib) => {
|
|
44
|
+
if (typeof lib === "string") {
|
|
45
|
+
return `^${lib}$`;
|
|
46
|
+
} else if (lib instanceof RegExp) {
|
|
47
|
+
return lib.source;
|
|
71
48
|
}
|
|
72
|
-
|
|
73
|
-
|
|
49
|
+
});
|
|
50
|
+
return deps.length ? new RegExp(deps.join("|")) : null;
|
|
51
|
+
}
|
|
52
|
+
function checkMatch({
|
|
53
|
+
value,
|
|
54
|
+
path,
|
|
55
|
+
opts,
|
|
56
|
+
isExportAll,
|
|
57
|
+
depth,
|
|
58
|
+
cache,
|
|
59
|
+
filename
|
|
60
|
+
}) {
|
|
61
|
+
var _a;
|
|
62
|
+
let isMatch;
|
|
63
|
+
let replaceValue = "";
|
|
64
|
+
depth = depth || 1;
|
|
65
|
+
(0, import_assert.default)(depth <= 10, `endless loop detected in checkMatch, please check your alias config.`);
|
|
66
|
+
opts = opts || {};
|
|
67
|
+
const remoteName = opts.remoteName || "mf";
|
|
68
|
+
value = value.replace(/^@fs\//, "/");
|
|
69
|
+
const unMatchLibsRegex = genUnMatchLibsRegex(opts.unMatchLibs);
|
|
70
|
+
if ((unMatchLibsRegex == null ? void 0 : unMatchLibsRegex.test(value)) || value.includes("client/client/client.js") || value.startsWith(`${remoteName}/`) || (0, import_utils.winPath)(value).includes("babel/svgr-webpack") || value.startsWith("!!") || (0, import_isExternals.isExternals)({ value, externals: opts.externals }) || value.startsWith(".")) {
|
|
71
|
+
isMatch = false;
|
|
72
|
+
} else if ((0, import_path.isAbsolute)(value)) {
|
|
73
|
+
isMatch = RE_NODE_MODULES.test(value) || isUmiLocalDev(value);
|
|
74
|
+
} else {
|
|
75
|
+
const aliasedPath = (0, import_getAliasedPath.getAliasedPath)({
|
|
76
|
+
value,
|
|
77
|
+
alias: opts.alias || {}
|
|
78
|
+
});
|
|
79
|
+
if (aliasedPath) {
|
|
80
|
+
return checkMatch({
|
|
81
|
+
value: aliasedPath,
|
|
82
|
+
path,
|
|
83
|
+
opts,
|
|
84
|
+
isExportAll,
|
|
85
|
+
depth: depth + 1,
|
|
86
|
+
cache,
|
|
87
|
+
filename
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
isMatch = true;
|
|
74
91
|
}
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
}
|
|
93
|
+
if (isMatch && isExportAll) {
|
|
94
|
+
isMatch = !!(opts.exportAllMembers && value in opts.exportAllMembers);
|
|
95
|
+
}
|
|
96
|
+
if (isMatch) {
|
|
97
|
+
replaceValue = `${remoteName}/${(0, import_utils.winPath)(value)}`;
|
|
98
|
+
}
|
|
99
|
+
const file = (path == null ? void 0 : path.hub.file.opts.filename) || filename;
|
|
100
|
+
(_a = opts.onTransformDeps) == null ? void 0 : _a.call(opts, {
|
|
101
|
+
sourceValue: value,
|
|
102
|
+
replaceValue,
|
|
103
|
+
isMatch,
|
|
104
|
+
file
|
|
105
|
+
});
|
|
106
|
+
if (cache) {
|
|
107
|
+
let mod;
|
|
108
|
+
if (cache.has(file)) {
|
|
109
|
+
mod = cache.get(file);
|
|
110
|
+
} else {
|
|
111
|
+
mod = {
|
|
112
|
+
matched: /* @__PURE__ */ new Set(),
|
|
113
|
+
unMatched: /* @__PURE__ */ new Set()
|
|
114
|
+
};
|
|
115
|
+
cache.set(file, mod);
|
|
77
116
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
replaceValue,
|
|
83
|
-
isMatch,
|
|
84
|
-
file,
|
|
117
|
+
mod[isMatch ? "matched" : "unMatched"].add({
|
|
118
|
+
sourceValue: value,
|
|
119
|
+
replaceValue,
|
|
120
|
+
file
|
|
85
121
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
mod = {
|
|
93
|
-
matched: new Set(),
|
|
94
|
-
unMatched: new Set(),
|
|
95
|
-
};
|
|
96
|
-
cache.set(file, mod);
|
|
97
|
-
}
|
|
98
|
-
mod[isMatch ? 'matched' : 'unMatched'].add({
|
|
99
|
-
sourceValue: value,
|
|
100
|
-
replaceValue,
|
|
101
|
-
file,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
// console.log(
|
|
105
|
-
// '> check',
|
|
106
|
-
// // @ts-ignore
|
|
107
|
-
// path.hub.file.opts.filename,
|
|
108
|
-
// value,
|
|
109
|
-
// cache,
|
|
110
|
-
// 'isMatch',
|
|
111
|
-
// isMatch,
|
|
112
|
-
// );
|
|
113
|
-
return {
|
|
114
|
-
isMatch,
|
|
115
|
-
replaceValue,
|
|
116
|
-
value,
|
|
117
|
-
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
isMatch,
|
|
125
|
+
replaceValue,
|
|
126
|
+
value
|
|
127
|
+
};
|
|
118
128
|
}
|
|
119
|
-
exports.checkMatch = checkMatch;
|
|
120
|
-
// TODO: REMOVE ME
|
|
121
129
|
function getPath({ value, opts }) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
130
|
+
const alias = opts.alias || {};
|
|
131
|
+
for (const key of Object.keys(alias)) {
|
|
132
|
+
if (value.startsWith(key)) {
|
|
133
|
+
return value.replace(key, alias[key]);
|
|
127
134
|
}
|
|
128
|
-
|
|
135
|
+
}
|
|
136
|
+
return value;
|
|
129
137
|
}
|
|
130
|
-
|
|
138
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
139
|
+
0 && (module.exports = {
|
|
140
|
+
checkMatch,
|
|
141
|
+
getPath
|
|
142
|
+
});
|
|
@@ -1,44 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
// getAliasedPath.ts
|
|
20
|
+
var getAliasedPath_exports = {};
|
|
21
|
+
__export(getAliasedPath_exports, {
|
|
22
|
+
getAliasedPath: () => getAliasedPath,
|
|
23
|
+
getAliasedPathWithLoopDetect: () => getAliasedPathWithLoopDetect
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(getAliasedPath_exports);
|
|
4
26
|
function getAliasedPath({ value, alias }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
27
|
+
const importValue = value;
|
|
28
|
+
if (alias[value]) {
|
|
29
|
+
return alias[value];
|
|
30
|
+
}
|
|
31
|
+
for (const key of Object.keys(alias)) {
|
|
32
|
+
const aliasValue = alias[key];
|
|
33
|
+
if (key.endsWith("$")) {
|
|
34
|
+
if (importValue === key.slice(0, -1))
|
|
35
|
+
return aliasValue;
|
|
36
|
+
else
|
|
37
|
+
continue;
|
|
9
38
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// exact alias
|
|
13
|
-
// ref: https://webpack.js.org/configuration/resolve/#resolvealias
|
|
14
|
-
// e.g. foo$: path/to/foo
|
|
15
|
-
if (key.endsWith('$')) {
|
|
16
|
-
if (importValue === key.slice(0, -1))
|
|
17
|
-
return aliasValue;
|
|
18
|
-
else
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
// e.g. foo: path/to/foo.js
|
|
22
|
-
if (importValue.startsWith(addLastSlash(key))) {
|
|
23
|
-
return importValue.replace(key, aliasValue);
|
|
24
|
-
}
|
|
39
|
+
if (importValue.startsWith(addLastSlash(key))) {
|
|
40
|
+
return importValue.replace(key, aliasValue);
|
|
25
41
|
}
|
|
42
|
+
}
|
|
26
43
|
}
|
|
27
|
-
exports.getAliasedPath = getAliasedPath;
|
|
28
44
|
function addLastSlash(path) {
|
|
29
|
-
|
|
45
|
+
return path.endsWith("/") ? path : `${path}/`;
|
|
30
46
|
}
|
|
31
47
|
function getAliasedPathWithLoopDetect({ value, alias }) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return needUnAlias;
|
|
40
|
-
}
|
|
48
|
+
let needUnAlias = value;
|
|
49
|
+
for (let i = 0; i < 10; i++) {
|
|
50
|
+
let unAliased = getAliasedPath({ value: needUnAlias, alias });
|
|
51
|
+
if (unAliased) {
|
|
52
|
+
needUnAlias = unAliased;
|
|
53
|
+
} else {
|
|
54
|
+
return needUnAlias;
|
|
41
55
|
}
|
|
42
|
-
|
|
56
|
+
}
|
|
57
|
+
throw Error(`endless loop detected in resolve alias for '${value}', please check your alias config.`);
|
|
43
58
|
}
|
|
44
|
-
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
getAliasedPath,
|
|
62
|
+
getAliasedPathWithLoopDetect
|
|
63
|
+
});
|
|
@@ -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
|
+
// 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
|
+
// 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,55 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
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;
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// parseSpecifiers.ts
|
|
23
|
+
var parseSpecifiers_exports = {};
|
|
24
|
+
__export(parseSpecifiers_exports, {
|
|
25
|
+
parseSpecifiers: () => parseSpecifiers
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(parseSpecifiers_exports);
|
|
28
|
+
var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
|
|
29
|
+
var DEFAULT = "default";
|
|
29
30
|
function parseSpecifiers(specifiers) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
else {
|
|
50
|
-
memo.properties.push(t.objectProperty(s.imported, s.local));
|
|
51
|
-
}
|
|
52
|
-
return memo;
|
|
53
|
-
}, { properties: [], namespaceIdentifier: null, defaultIdentifier: null });
|
|
31
|
+
return specifiers.reduce((memo, s) => {
|
|
32
|
+
if (t.isImportDefaultSpecifier(s)) {
|
|
33
|
+
memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.local));
|
|
34
|
+
} else if (t.isExportDefaultSpecifier(s)) {
|
|
35
|
+
memo.properties.push(t.objectProperty(t.identifier(DEFAULT), s.exported));
|
|
36
|
+
} else if (t.isExportSpecifier(s)) {
|
|
37
|
+
if (t.isIdentifier(s.exported, { name: DEFAULT })) {
|
|
38
|
+
memo.defaultIdentifier = s.local.name;
|
|
39
|
+
memo.properties.push(t.objectProperty(s.local, s.local));
|
|
40
|
+
} else {
|
|
41
|
+
memo.properties.push(t.objectProperty(s.local, s.exported));
|
|
42
|
+
}
|
|
43
|
+
} else if (t.isImportNamespaceSpecifier(s)) {
|
|
44
|
+
memo.namespaceIdentifier = s.local;
|
|
45
|
+
} else {
|
|
46
|
+
memo.properties.push(t.objectProperty(s.imported, s.local));
|
|
47
|
+
}
|
|
48
|
+
return memo;
|
|
49
|
+
}, { properties: [], namespaceIdentifier: null, defaultIdentifier: null });
|
|
54
50
|
}
|
|
55
|
-
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
parseSpecifiers
|
|
54
|
+
});
|