@umijs/preset-umi 4.0.53 → 4.0.55
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/dist/commands/build.js +3 -3
- package/dist/commands/config/remove.js +2 -12
- package/dist/commands/config/set.js +2 -12
- package/dist/commands/deadcode.d.ts +3 -0
- package/dist/commands/deadcode.js +184 -0
- package/dist/commands/dev/dev.js +7 -1
- package/dist/commands/generators/jest.js +1 -1
- package/dist/commands/mfsu/mfsu.js +27 -11
- package/dist/commands/mfsu/util.js +3 -1
- package/dist/features/appData/appData.js +13 -5
- package/dist/features/configPlugins/schema.js +1 -0
- package/dist/features/esmi/esmi.js +2 -2
- package/dist/features/helmet/helmet.d.ts +6 -0
- package/dist/features/helmet/helmet.js +64 -0
- package/dist/features/icons/esbuildIconPlugin.js +9 -4
- package/dist/features/icons/icons.js +12 -9
- package/dist/features/polyfill/polyfill.js +2 -5
- package/dist/features/prepare/build.d.ts +2 -1
- package/dist/features/prepare/build.js +5 -2
- package/dist/features/prepare/esbuildPlugins/esbuildAliasPlugin.js +4 -3
- package/dist/features/prepare/esbuildPlugins/esbuildExternalPlugin.d.ts +3 -1
- package/dist/features/prepare/esbuildPlugins/esbuildExternalPlugin.js +22 -5
- package/dist/features/prepare/esbuildPlugins/isRelative.d.ts +1 -0
- package/dist/features/prepare/esbuildPlugins/isRelative.js +31 -0
- package/dist/features/prepare/prepare.js +2 -1
- package/dist/features/ssr/ssr.js +8 -8
- package/dist/features/ssr/webpack/webpack.js +3 -5
- package/dist/features/tmpFiles/configTypes.js +2 -2
- package/dist/features/tmpFiles/tmpFiles.js +1 -1
- package/dist/features/transform/transform.js +9 -5
- package/dist/index.js +6 -1
- package/dist/libs/folderCache/LazySourceCodeCache.d.ts +3 -2
- package/dist/libs/folderCache/LazySourceCodeCache.js +15 -11
- package/dist/registerMethods.js +4 -3
- package/dist/utils/projectFileList.d.ts +2 -0
- package/dist/utils/projectFileList.js +35 -0
- package/dist/utils/routeExportExtractor.js +1 -1
- package/package.json +16 -16
- package/templates/umi.tpl +1 -1
package/dist/commands/build.js
CHANGED
|
@@ -26,12 +26,12 @@ var import_server = require("@umijs/server");
|
|
|
26
26
|
var import_utils = require("@umijs/utils");
|
|
27
27
|
var import_fs = require("fs");
|
|
28
28
|
var import_path = require("path");
|
|
29
|
+
var import_fileSizeReporter = require("../utils/fileSizeReporter");
|
|
29
30
|
var import_lazyImportFromCurrentPkg = require("../utils/lazyImportFromCurrentPkg");
|
|
30
31
|
var import_getAssetsMap = require("./dev/getAssetsMap");
|
|
31
32
|
var import_getBabelOpts = require("./dev/getBabelOpts");
|
|
32
33
|
var import_getMarkupArgs = require("./dev/getMarkupArgs");
|
|
33
34
|
var import_printMemoryUsage = require("./dev/printMemoryUsage");
|
|
34
|
-
var import_fileSizeReporter = require("../utils/fileSizeReporter");
|
|
35
35
|
var bundlerWebpack = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-webpack");
|
|
36
36
|
var bundlerVite = (0, import_lazyImportFromCurrentPkg.lazyImportFromCurrentPkg)("@umijs/bundler-vite");
|
|
37
37
|
var build_default = (api) => {
|
|
@@ -113,9 +113,9 @@ umi build --clean
|
|
|
113
113
|
beforeBabelPresets,
|
|
114
114
|
extraBabelPlugins,
|
|
115
115
|
extraBabelPresets,
|
|
116
|
-
onBuildComplete(opts2) {
|
|
116
|
+
async onBuildComplete(opts2) {
|
|
117
117
|
(0, import_printMemoryUsage.printMemoryUsage)();
|
|
118
|
-
api.applyPlugins({
|
|
118
|
+
await api.applyPlugins({
|
|
119
119
|
key: "onBuildComplete",
|
|
120
120
|
args: opts2
|
|
121
121
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/commands/config/remove.ts
|
|
@@ -33,14 +23,14 @@ __export(remove_exports, {
|
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(remove_exports);
|
|
35
25
|
var import_ast = require("@umijs/ast");
|
|
36
|
-
var import_prettier = __toESM(require("@umijs/utils/compiled/prettier"));
|
|
37
26
|
var import_fs = require("fs");
|
|
38
27
|
function remove(mainConfigFile, name) {
|
|
39
28
|
const ast = (0, import_ast.getASTByFilePath)(mainConfigFile);
|
|
40
29
|
if (!ast)
|
|
41
30
|
return;
|
|
42
31
|
const generateCode = (0, import_ast.generate)((0, import_ast.removeConfigByName)(ast, name));
|
|
43
|
-
const
|
|
32
|
+
const prettier = require("@umijs/utils/compiled/prettier");
|
|
33
|
+
const printStr = prettier.format(generateCode, {
|
|
44
34
|
parser: "typescript"
|
|
45
35
|
});
|
|
46
36
|
(0, import_fs.writeFileSync)(mainConfigFile, printStr, "utf-8");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/commands/config/set.ts
|
|
@@ -33,7 +23,6 @@ __export(set_exports, {
|
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(set_exports);
|
|
35
25
|
var import_ast = require("@umijs/ast");
|
|
36
|
-
var import_prettier = __toESM(require("@umijs/utils/compiled/prettier"));
|
|
37
26
|
var import_fs = require("fs");
|
|
38
27
|
var import_path = require("path");
|
|
39
28
|
function set(api, name, value) {
|
|
@@ -49,7 +38,8 @@ function set(api, name, value) {
|
|
|
49
38
|
if (!ast)
|
|
50
39
|
return;
|
|
51
40
|
const generateCode = (0, import_ast.generate)((0, import_ast.setConfigByName)(ast, name, value));
|
|
52
|
-
const
|
|
41
|
+
const prettier = require("@umijs/utils/compiled/prettier");
|
|
42
|
+
const printStr = prettier.format(generateCode, {
|
|
53
43
|
parser: "typescript"
|
|
54
44
|
});
|
|
55
45
|
(0, import_fs.writeFileSync)(mainConfigFile, printStr, "utf-8");
|
|
@@ -0,0 +1,184 @@
|
|
|
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/commands/deadcode.ts
|
|
20
|
+
var deadcode_exports = {};
|
|
21
|
+
__export(deadcode_exports, {
|
|
22
|
+
default: () => deadcode_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(deadcode_exports);
|
|
25
|
+
var import_utils = require("@umijs/utils");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var outputUnusedFiles = (unusedFiles, fileName) => {
|
|
28
|
+
if (!(unusedFiles == null ? void 0 : unusedFiles.length)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const content = unusedFiles.map((file, index) => `
|
|
32
|
+
${index + 1}. ${file}`);
|
|
33
|
+
const str = `
|
|
34
|
+
Warning: There are ${unusedFiles.length} unused files:
|
|
35
|
+
${content.join("")}
|
|
36
|
+
|
|
37
|
+
Please be careful if you want to remove them (¬º-°)¬.
|
|
38
|
+
|
|
39
|
+
`;
|
|
40
|
+
import_utils.fsExtra.writeFileSync(fileName, str, "utf8");
|
|
41
|
+
};
|
|
42
|
+
var deadcode_default = (api) => {
|
|
43
|
+
api.registerCommand({
|
|
44
|
+
name: "deadcode",
|
|
45
|
+
description: "check dead code",
|
|
46
|
+
async fn() {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const pkg = api.pkg;
|
|
49
|
+
const userDeps = {
|
|
50
|
+
...pkg == null ? void 0 : pkg.dependencies,
|
|
51
|
+
...pkg == null ? void 0 : pkg.devDependencies
|
|
52
|
+
};
|
|
53
|
+
const MADGE_NAME = "madge";
|
|
54
|
+
const MADGE_VERSION = "6.0.0";
|
|
55
|
+
const isInstalled = Object.keys(userDeps).includes(MADGE_NAME);
|
|
56
|
+
if (!isInstalled) {
|
|
57
|
+
pkg.devDependencies || (pkg.devDependencies = {});
|
|
58
|
+
pkg.devDependencies[MADGE_NAME] = MADGE_VERSION;
|
|
59
|
+
import_utils.fsExtra.writeFileSync(
|
|
60
|
+
api.pkgPath,
|
|
61
|
+
`${JSON.stringify(pkg, null, 2)}
|
|
62
|
+
`,
|
|
63
|
+
"utf-8"
|
|
64
|
+
);
|
|
65
|
+
import_utils.logger.info(
|
|
66
|
+
`Installing ${import_utils.chalk.blue(MADGE_NAME)} (required by deadcode) ...`
|
|
67
|
+
);
|
|
68
|
+
(0, import_utils.installWithNpmClient)({
|
|
69
|
+
cwd: api.cwd,
|
|
70
|
+
npmClient: api.appData.npmClient
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
import_utils.rimraf.sync(api.paths.absTmpPath);
|
|
74
|
+
await api.applyPlugins({
|
|
75
|
+
key: "onGenerateFiles",
|
|
76
|
+
args: {
|
|
77
|
+
files: null,
|
|
78
|
+
isFirstTime: true
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
import_utils.logger.info("begin check deadCode");
|
|
82
|
+
const cwd = api.cwd;
|
|
83
|
+
const tsconfig = await import_utils.tsconfigPaths.loadConfig(cwd);
|
|
84
|
+
const exclude = [/node_modules/, /\.d\.ts$/, /\.umi/];
|
|
85
|
+
const isExclude = (path) => {
|
|
86
|
+
return exclude.some((reg) => reg.test(path));
|
|
87
|
+
};
|
|
88
|
+
const userAlias = api.config.alias;
|
|
89
|
+
const parsedAlias = import_utils.aliasUtils.parseCircleAlias({
|
|
90
|
+
alias: userAlias
|
|
91
|
+
});
|
|
92
|
+
const filteredAlias = Object.keys(parsedAlias).reduce(
|
|
93
|
+
(acc, key) => {
|
|
94
|
+
var _a2, _b2;
|
|
95
|
+
const value = parsedAlias[key];
|
|
96
|
+
if (isExclude(value)) {
|
|
97
|
+
return acc;
|
|
98
|
+
}
|
|
99
|
+
if ((_a2 = tsconfig.paths) == null ? void 0 : _a2[key]) {
|
|
100
|
+
return acc;
|
|
101
|
+
}
|
|
102
|
+
const tsconfigValue = [(0, import_path.join)((0, import_path.relative)(cwd, value), "/*")];
|
|
103
|
+
const tsconfigKey = `${key}/*`;
|
|
104
|
+
if ((_b2 = tsconfig.paths) == null ? void 0 : _b2[tsconfigKey]) {
|
|
105
|
+
return acc;
|
|
106
|
+
}
|
|
107
|
+
acc[tsconfigKey] = tsconfigValue;
|
|
108
|
+
return acc;
|
|
109
|
+
},
|
|
110
|
+
{}
|
|
111
|
+
);
|
|
112
|
+
if (!api.appData.hasSrcDir) {
|
|
113
|
+
throw new Error(`Only supports projects containing "src" folders.`);
|
|
114
|
+
}
|
|
115
|
+
const devTmpDir = (0, import_path.join)(api.paths.absSrcPath, ".umi");
|
|
116
|
+
const entryFile = (0, import_path.join)(devTmpDir, "umi.ts");
|
|
117
|
+
const exportsFile = (0, import_path.join)(devTmpDir, "exports.ts");
|
|
118
|
+
const madgePkg = (0, import_path.dirname)(
|
|
119
|
+
import_utils.resolve.sync(`${MADGE_NAME}/package.json`, {
|
|
120
|
+
basedir: cwd
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
const madge = require(madgePkg);
|
|
124
|
+
const res = await madge(entryFile, {
|
|
125
|
+
tsConfig: {
|
|
126
|
+
compilerOptions: {
|
|
127
|
+
baseUrl: tsconfig.baseUrl,
|
|
128
|
+
paths: {
|
|
129
|
+
...filteredAlias,
|
|
130
|
+
...tsconfig.paths,
|
|
131
|
+
umi: [exportsFile],
|
|
132
|
+
"@umijs/max": [exportsFile],
|
|
133
|
+
// 适配 bigfish
|
|
134
|
+
...((_b = (_a = api.appData) == null ? void 0 : _a.umi) == null ? void 0 : _b.importSource) ? {
|
|
135
|
+
[api.appData.umi.importSource]: [exportsFile]
|
|
136
|
+
} : {}
|
|
137
|
+
},
|
|
138
|
+
target: "esnext",
|
|
139
|
+
module: "esnext",
|
|
140
|
+
moduleResolution: "node",
|
|
141
|
+
importHelpers: true,
|
|
142
|
+
jsx: "react-jsx",
|
|
143
|
+
esModuleInterop: true,
|
|
144
|
+
strict: true,
|
|
145
|
+
resolveJsonModule: true,
|
|
146
|
+
allowSyntheticDefaultImports: true
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
fileExtensions: ["ts", "tsx", "js", "jsx"],
|
|
150
|
+
excludeRegExp: exclude,
|
|
151
|
+
baseDir: cwd
|
|
152
|
+
});
|
|
153
|
+
const treeMap = res.tree;
|
|
154
|
+
const dependenceMap = Object.keys(treeMap).reduce(
|
|
155
|
+
(acc, key) => {
|
|
156
|
+
const path = (0, import_utils.winPath)((0, import_path.join)(api.paths.cwd, key));
|
|
157
|
+
acc[path] = true;
|
|
158
|
+
return acc;
|
|
159
|
+
},
|
|
160
|
+
{}
|
|
161
|
+
);
|
|
162
|
+
const unusedFiles = (0, import_utils.readDirFiles)({
|
|
163
|
+
dir: api.paths.absSrcPath,
|
|
164
|
+
exclude
|
|
165
|
+
}).filter(({ filePath: filePath2 }) => !dependenceMap[filePath2]).map((file) => {
|
|
166
|
+
const relativePath = (0, import_path.relative)(cwd, file.filePath);
|
|
167
|
+
return relativePath;
|
|
168
|
+
});
|
|
169
|
+
if (!unusedFiles.length) {
|
|
170
|
+
return import_utils.logger.info(`good job, no unusedFiles`);
|
|
171
|
+
}
|
|
172
|
+
const filePath = (0, import_utils.winPath)((0, import_path.join)(cwd, `DeadCodeList-${Date.now()}.txt`));
|
|
173
|
+
import_utils.logger.info(
|
|
174
|
+
`${unusedFiles.length} unusedFiles, write content to file ${filePath}`
|
|
175
|
+
);
|
|
176
|
+
outputUnusedFiles(unusedFiles, filePath);
|
|
177
|
+
import_utils.logger.info(
|
|
178
|
+
`check dead code end, please be careful if you want to remove them (¬º-°)¬`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
184
|
+
0 && (module.exports = {});
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -39,6 +39,7 @@ var import_worker_threads = require("worker_threads");
|
|
|
39
39
|
var import_constants = require("../../constants");
|
|
40
40
|
var import_LazySourceCodeCache = require("../../libs/folderCache/LazySourceCodeCache");
|
|
41
41
|
var import_lazyImportFromCurrentPkg = require("../../utils/lazyImportFromCurrentPkg");
|
|
42
|
+
var import_projectFileList = require("../../utils/projectFileList");
|
|
42
43
|
var import_createRouteMiddleware = require("./createRouteMiddleware");
|
|
43
44
|
var import_faviconMiddleware = require("./faviconMiddleware");
|
|
44
45
|
var import_getBabelOpts = require("./getBabelOpts");
|
|
@@ -278,7 +279,12 @@ PORT=8888 umi dev
|
|
|
278
279
|
"mfsu_v4"
|
|
279
280
|
)
|
|
280
281
|
});
|
|
281
|
-
|
|
282
|
+
if (api.appData.framework === "vue") {
|
|
283
|
+
await srcCodeCache.initWithScan();
|
|
284
|
+
} else {
|
|
285
|
+
const files = (0, import_projectFileList.getProjectFileList)(api);
|
|
286
|
+
await srcCodeCache.init(files);
|
|
287
|
+
}
|
|
282
288
|
(0, import_watch.addUnWatch)(() => {
|
|
283
289
|
srcCodeCache.unwatch();
|
|
284
290
|
});
|
|
@@ -64,7 +64,7 @@ var jest_default = (api) => {
|
|
|
64
64
|
"jest-environment-jsdom": jestMajorVersion,
|
|
65
65
|
// RTL
|
|
66
66
|
"@testing-library/jest-dom": "^5",
|
|
67
|
-
"@testing-library/react": "^
|
|
67
|
+
"@testing-library/react": "^14"
|
|
68
68
|
};
|
|
69
69
|
const packageToInstall = res.willUseTLR ? {
|
|
70
70
|
...basicDeps,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
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
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/commands/mfsu/mfsu.ts
|
|
@@ -22,21 +32,26 @@ __export(mfsu_exports, {
|
|
|
22
32
|
default: () => mfsu_default
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(mfsu_exports);
|
|
25
|
-
var
|
|
35
|
+
var import_utils = require("@umijs/utils");
|
|
36
|
+
var utils = (0, import_utils.importLazy)(require.resolve("./util"));
|
|
26
37
|
var HELP_TEXT = `
|
|
27
38
|
# MFSU CLI util
|
|
28
39
|
# umi mfsu [action]
|
|
29
40
|
|
|
30
41
|
# Show Help
|
|
31
|
-
$ umi mfsu
|
|
42
|
+
$ umi mfsu
|
|
32
43
|
|
|
33
44
|
# Manually build mfsu dependencies
|
|
34
|
-
$ umi mfsu build
|
|
35
|
-
$ umi mfsu b
|
|
45
|
+
$ umi mfsu build
|
|
46
|
+
$ umi mfsu b
|
|
36
47
|
|
|
37
48
|
# list mfsu dependencies
|
|
38
|
-
$ umi mfsu list
|
|
39
|
-
$ umi mfsu ls
|
|
49
|
+
$ umi mfsu list
|
|
50
|
+
$ umi mfsu ls
|
|
51
|
+
|
|
52
|
+
# remove mfsu dependencies
|
|
53
|
+
$ umi mfsu remove
|
|
54
|
+
$ umi mfsu remove --all
|
|
40
55
|
`.trim();
|
|
41
56
|
var mfsu_default = (api) => {
|
|
42
57
|
api.describe({
|
|
@@ -44,7 +59,7 @@ var mfsu_default = (api) => {
|
|
|
44
59
|
});
|
|
45
60
|
api.registerCommand({
|
|
46
61
|
name: "mfsu",
|
|
47
|
-
description: "
|
|
62
|
+
description: "mfsu CLI util",
|
|
48
63
|
details: HELP_TEXT,
|
|
49
64
|
configResolveMode: "strict",
|
|
50
65
|
async fn({ args }) {
|
|
@@ -55,7 +70,8 @@ var mfsu_default = (api) => {
|
|
|
55
70
|
api.logger.info("MFSU is not enabled");
|
|
56
71
|
return;
|
|
57
72
|
}
|
|
58
|
-
const
|
|
73
|
+
const { EagerUtil, NormalUtil } = utils;
|
|
74
|
+
const util = ((_a = api.config.mfsu) == null ? void 0 : _a.strategy) === "eager" ? new EagerUtil(api) : new NormalUtil(api);
|
|
59
75
|
switch (command) {
|
|
60
76
|
case "build":
|
|
61
77
|
case "b":
|
|
@@ -82,7 +98,7 @@ var mfsu_default = (api) => {
|
|
|
82
98
|
}
|
|
83
99
|
break;
|
|
84
100
|
case "help":
|
|
85
|
-
printHelpInfo();
|
|
101
|
+
printHelpInfo(api);
|
|
86
102
|
break;
|
|
87
103
|
default:
|
|
88
104
|
throw new Error(`Unsupported mfsu action`);
|
|
@@ -90,8 +106,8 @@ var mfsu_default = (api) => {
|
|
|
90
106
|
}
|
|
91
107
|
});
|
|
92
108
|
};
|
|
93
|
-
function printHelpInfo() {
|
|
94
|
-
console.log(HELP_TEXT);
|
|
109
|
+
function printHelpInfo(api) {
|
|
110
|
+
console.log(HELP_TEXT.replace(/umi/g, api.appData.umi.cliName));
|
|
95
111
|
}
|
|
96
112
|
// Annotate the CommonJS export names for ESM import in node:
|
|
97
113
|
0 && (module.exports = {});
|
|
@@ -39,6 +39,7 @@ var import_webpack = __toESM(require("@umijs/bundler-webpack/compiled/webpack"))
|
|
|
39
39
|
var import_utils = require("@umijs/utils");
|
|
40
40
|
var import_path = require("path");
|
|
41
41
|
var import_LazySourceCodeCache = require("../../libs/folderCache/LazySourceCodeCache");
|
|
42
|
+
var import_projectFileList = require("../../utils/projectFileList");
|
|
42
43
|
var import_getBabelOpts = require("../dev/getBabelOpts");
|
|
43
44
|
var MFSUUtilBase = class {
|
|
44
45
|
constructor(api) {
|
|
@@ -100,7 +101,8 @@ var MFSUUtilBase = class {
|
|
|
100
101
|
"mfsu_v4"
|
|
101
102
|
)
|
|
102
103
|
});
|
|
103
|
-
|
|
104
|
+
const fileList = (0, import_projectFileList.getProjectFileList)(api);
|
|
105
|
+
await srcCodeCache.init(fileList);
|
|
104
106
|
}
|
|
105
107
|
const entry = await api.applyPlugins({
|
|
106
108
|
key: "modifyEntry",
|
|
@@ -43,6 +43,9 @@ var appData_default = (api) => {
|
|
|
43
43
|
const routesApi = (0, import_utils.importLazy)(
|
|
44
44
|
require.resolve("../tmpFiles/routes")
|
|
45
45
|
);
|
|
46
|
+
const bundlerUtils = (0, import_utils.importLazy)(
|
|
47
|
+
require.resolve("@umijs/bundler-utils")
|
|
48
|
+
);
|
|
46
49
|
api.modifyAppData(async (memo) => {
|
|
47
50
|
var _a;
|
|
48
51
|
memo.routes = await routesApi.getRoutes({
|
|
@@ -78,10 +81,11 @@ var appData_default = (api) => {
|
|
|
78
81
|
memo.appJS = await getAppJsInfo();
|
|
79
82
|
memo.locale = await (0, import_os_locale.osLocale)();
|
|
80
83
|
memo.vite = api.config.vite ? {} : void 0;
|
|
81
|
-
const { globalCSS, globalJS, overridesCSS } = getGlobalFiles();
|
|
84
|
+
const { globalCSS, globalJS, overridesCSS, globalLoading } = getGlobalFiles();
|
|
82
85
|
memo.globalCSS = globalCSS;
|
|
83
86
|
memo.globalJS = globalJS;
|
|
84
87
|
memo.overridesCSS = overridesCSS;
|
|
88
|
+
memo.globalLoading = globalLoading;
|
|
85
89
|
const gitDir = findGitDir(api.paths.cwd);
|
|
86
90
|
if (gitDir) {
|
|
87
91
|
const git = {};
|
|
@@ -103,10 +107,11 @@ var appData_default = (api) => {
|
|
|
103
107
|
async fn(args) {
|
|
104
108
|
if (!args.isFirstTime) {
|
|
105
109
|
api.appData.appJS = await getAppJsInfo();
|
|
106
|
-
const { globalCSS, globalJS, overridesCSS } = getGlobalFiles();
|
|
110
|
+
const { globalCSS, globalJS, overridesCSS, globalLoading } = getGlobalFiles();
|
|
107
111
|
api.appData.globalCSS = globalCSS;
|
|
108
112
|
api.appData.globalJS = globalJS;
|
|
109
113
|
api.appData.overridesCSS = overridesCSS;
|
|
114
|
+
api.appData.globalLoading = globalLoading;
|
|
110
115
|
}
|
|
111
116
|
},
|
|
112
117
|
stage: Number.NEGATIVE_INFINITY
|
|
@@ -136,8 +141,7 @@ var appData_default = (api) => {
|
|
|
136
141
|
async function getAppJsInfo() {
|
|
137
142
|
for (const path of (0, import_watch.expandJSPaths)((0, import_path.join)(api.paths.absSrcPath, "app"))) {
|
|
138
143
|
if ((0, import_fs.existsSync)(path)) {
|
|
139
|
-
const
|
|
140
|
-
const [_, exports] = await parseModule({
|
|
144
|
+
const [_, exports] = await bundlerUtils.parseModule({
|
|
141
145
|
path,
|
|
142
146
|
content: (0, import_fs.readFileSync)(path, "utf-8")
|
|
143
147
|
});
|
|
@@ -162,13 +166,17 @@ var appData_default = (api) => {
|
|
|
162
166
|
existsAndPushFile,
|
|
163
167
|
[]
|
|
164
168
|
);
|
|
169
|
+
const globalLoading = (0, import_watch.expandJSPaths)((0, import_path.join)(absSrcPath, "loading")).find(
|
|
170
|
+
import_fs.existsSync
|
|
171
|
+
);
|
|
165
172
|
const overridesCSS = [(0, import_overrides.getOverridesCSS)(api.paths.absSrcPath)].filter(
|
|
166
173
|
Boolean
|
|
167
174
|
);
|
|
168
175
|
return {
|
|
169
176
|
globalCSS,
|
|
170
177
|
globalJS,
|
|
171
|
-
overridesCSS
|
|
178
|
+
overridesCSS,
|
|
179
|
+
globalLoading
|
|
172
180
|
};
|
|
173
181
|
}
|
|
174
182
|
};
|
|
@@ -31,6 +31,7 @@ function getSchemas() {
|
|
|
31
31
|
base: Joi.string(),
|
|
32
32
|
exclude: Joi.array().items(Joi.any())
|
|
33
33
|
}),
|
|
34
|
+
esbuildMinifyIIFE: (Joi) => Joi.boolean(),
|
|
34
35
|
headScripts: (Joi) => Joi.array(),
|
|
35
36
|
history: (Joi) => Joi.object({
|
|
36
37
|
type: Joi.string().valid("browser", "hash", "memory")
|
|
@@ -33,7 +33,7 @@ __export(esmi_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(esmi_exports);
|
|
35
35
|
var import_es_module_lexer = require("@umijs/bundler-utils/compiled/es-module-lexer");
|
|
36
|
-
var
|
|
36
|
+
var import_utils = require("@umijs/utils");
|
|
37
37
|
var import_path = require("path");
|
|
38
38
|
var import_scan = require("../../libs/scan");
|
|
39
39
|
var import_requireToImport = __toESM(require("./esbuildPlugins/requireToImport"));
|
|
@@ -88,7 +88,7 @@ function esmi(opts) {
|
|
|
88
88
|
importmap.imports[specifier]
|
|
89
89
|
);
|
|
90
90
|
if (replacement) {
|
|
91
|
-
s ?? (s = new
|
|
91
|
+
s ?? (s = new import_utils.MagicString(source));
|
|
92
92
|
s.overwrite(start, end, replacement);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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;
|
|
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/features/helmet/helmet.ts
|
|
30
|
+
var helmet_exports = {};
|
|
31
|
+
__export(helmet_exports, {
|
|
32
|
+
default: () => helmet_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(helmet_exports);
|
|
35
|
+
var import_utils = require("@umijs/utils");
|
|
36
|
+
var import_path = require("path");
|
|
37
|
+
var helmet_default = (api) => {
|
|
38
|
+
api.describe({
|
|
39
|
+
config: {
|
|
40
|
+
schema: (Joi) => Joi.boolean()
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
api.onGenerateFiles(() => {
|
|
44
|
+
if (api.appData.framework === "react") {
|
|
45
|
+
api.writeTmpFile({
|
|
46
|
+
noPluginDir: true,
|
|
47
|
+
path: "core/helmet.ts",
|
|
48
|
+
content: `import React from 'react';
|
|
49
|
+
import { HelmetProvider } from '${(0, import_utils.winPath)(
|
|
50
|
+
(0, import_path.dirname)(require.resolve("@umijs/renderer-react/package"))
|
|
51
|
+
)}';
|
|
52
|
+
|
|
53
|
+
export const innerProvider = (container) => {
|
|
54
|
+
return React.createElement(HelmetProvider, { context: {} }, container);
|
|
55
|
+
}`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
api.addRuntimePlugin(
|
|
60
|
+
() => api.appData.framework === "react" ? ["@@/core/helmet.ts"] : []
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {});
|
|
@@ -35,13 +35,18 @@ module.exports = __toCommonJS(esbuildIconPlugin_exports);
|
|
|
35
35
|
var import_utils = require("@umijs/utils");
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
37
|
var import_extract = require("./extract");
|
|
38
|
+
var loaderMap = {
|
|
39
|
+
js: "tsx",
|
|
40
|
+
jsx: "tsx",
|
|
41
|
+
tsx: "tsx",
|
|
42
|
+
ts: "ts"
|
|
43
|
+
};
|
|
38
44
|
function esbuildIconPlugin(opts) {
|
|
39
45
|
return {
|
|
40
46
|
name: "esbuildCollectIconPlugin",
|
|
41
47
|
setup(build) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const filter = new RegExp(`\\.(${loader})$`);
|
|
48
|
+
Object.keys(loaderMap).forEach((extName) => {
|
|
49
|
+
const filter = new RegExp(`\\.(${extName})$`);
|
|
45
50
|
build.onLoad({ filter }, async (args) => {
|
|
46
51
|
const contents = await import_fs.default.promises.readFile(args.path, "utf-8");
|
|
47
52
|
const icons = (0, import_extract.extractIcons)(contents);
|
|
@@ -51,7 +56,7 @@ function esbuildIconPlugin(opts) {
|
|
|
51
56
|
});
|
|
52
57
|
return {
|
|
53
58
|
contents,
|
|
54
|
-
loader
|
|
59
|
+
loader: loaderMap[extName]
|
|
55
60
|
};
|
|
56
61
|
});
|
|
57
62
|
});
|
|
@@ -37,6 +37,10 @@ var import_fs = __toESM(require("fs"));
|
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
38
|
var import_depsOnDemand = require("../depsOnDemand/depsOnDemand");
|
|
39
39
|
var icons_default = (api) => {
|
|
40
|
+
const iconPlugin = (0, import_utils.importLazy)(
|
|
41
|
+
require.resolve("./esbuildIconPlugin")
|
|
42
|
+
);
|
|
43
|
+
const svgr = (0, import_utils.importLazy)(require.resolve("./svgr"));
|
|
40
44
|
api.describe({
|
|
41
45
|
config: {
|
|
42
46
|
schema(Joi) {
|
|
@@ -62,9 +66,8 @@ var icons_default = (api) => {
|
|
|
62
66
|
const EMPTY_ICONS_FILE = `export const __no_icons = true;`;
|
|
63
67
|
const icons = /* @__PURE__ */ new Set();
|
|
64
68
|
api.addPrepareBuildPlugins(() => {
|
|
65
|
-
const { esbuildIconPlugin } = (0, import_utils.importLazy)(require.resolve("./esbuildIconPlugin"));
|
|
66
69
|
return [
|
|
67
|
-
esbuildIconPlugin({
|
|
70
|
+
iconPlugin.esbuildIconPlugin({
|
|
68
71
|
icons,
|
|
69
72
|
alias: api.config.icons.alias || {}
|
|
70
73
|
})
|
|
@@ -79,13 +82,13 @@ var icons_default = (api) => {
|
|
|
79
82
|
}
|
|
80
83
|
import_utils.logger.info(`[icons] generate icons ${Array.from(icons).join(", ")}`);
|
|
81
84
|
const code = [];
|
|
82
|
-
const { generateIconName, generateSvgr } =
|
|
85
|
+
const { generateIconName, generateSvgr } = svgr;
|
|
83
86
|
for (const iconStr of allIcons) {
|
|
84
87
|
const [collect, icon] = iconStr.split(":");
|
|
85
88
|
const iconName = generateIconName({ collect, icon });
|
|
86
|
-
let
|
|
89
|
+
let svgr2;
|
|
87
90
|
try {
|
|
88
|
-
|
|
91
|
+
svgr2 = await generateSvgr({
|
|
89
92
|
collect,
|
|
90
93
|
api,
|
|
91
94
|
icon,
|
|
@@ -114,8 +117,8 @@ var icons_default = (api) => {
|
|
|
114
117
|
} catch (e) {
|
|
115
118
|
import_utils.logger.error(e);
|
|
116
119
|
}
|
|
117
|
-
if (
|
|
118
|
-
code.push(
|
|
120
|
+
if (svgr2) {
|
|
121
|
+
code.push(svgr2);
|
|
119
122
|
code.push(`export { ${iconName} };`);
|
|
120
123
|
} else {
|
|
121
124
|
if (api.env === "development") {
|
|
@@ -352,10 +355,10 @@ export const Icon = React.forwardRef<HTMLSpanElement, IUmiIconProps>((props, ref
|
|
|
352
355
|
svgStyle.msTransform = transformStr;
|
|
353
356
|
svgStyle.transform = transformStr;
|
|
354
357
|
}
|
|
355
|
-
|
|
358
|
+
|
|
356
359
|
const spanClassName = HoverComponent ? 'umiIconDoNotUseThis ' : '' + className;
|
|
357
360
|
const spanClass = spanClassName ? { className: spanClassName } : {};
|
|
358
|
-
|
|
361
|
+
|
|
359
362
|
return (
|
|
360
363
|
<span role="img" ref={ref} {...spanClass} style={style}>
|
|
361
364
|
<Component {...extraProps} className={cls} style={svgStyle} />
|
|
@@ -36,6 +36,7 @@ var import_constants = require("@umijs/bundler-webpack/dist/constants");
|
|
|
36
36
|
var import_utils = require("@umijs/utils");
|
|
37
37
|
var import_path = require("path");
|
|
38
38
|
var polyfill_default = (api) => {
|
|
39
|
+
const babelCore = (0, import_utils.importLazy)(require.resolve("@umijs/bundler-utils/compiled/babel/core"));
|
|
39
40
|
api.describe({
|
|
40
41
|
key: "polyfill",
|
|
41
42
|
config: {
|
|
@@ -52,11 +53,7 @@ var polyfill_default = (api) => {
|
|
|
52
53
|
api.onGenerateFiles(() => {
|
|
53
54
|
var _a, _b;
|
|
54
55
|
const coreJsImports = ((_a = api.config.polyfill) == null ? void 0 : _a.imports) ? (_b = api.config.polyfill) == null ? void 0 : _b.imports.map((item) => `import '${item}';`).join("\n") : `import 'core-js';`;
|
|
55
|
-
const {
|
|
56
|
-
transform
|
|
57
|
-
} = (0, import_utils.importLazy)(
|
|
58
|
-
require.resolve("@umijs/bundler-utils/compiled/babel/core")
|
|
59
|
-
);
|
|
56
|
+
const { transform } = babelCore;
|
|
60
57
|
const { code } = transform(
|
|
61
58
|
`
|
|
62
59
|
${coreJsImports}
|
|
@@ -40,7 +40,10 @@ var import_esbuildExternalPlugin = require("./esbuildPlugins/esbuildExternalPlug
|
|
|
40
40
|
async function build(opts) {
|
|
41
41
|
var _a;
|
|
42
42
|
const outdir = import_path.default.join(import_path.default.dirname(opts.entryPoints[0]), "out");
|
|
43
|
+
const alias = ((_a = opts.config) == null ? void 0 : _a.alias) || {};
|
|
43
44
|
return await import_esbuild.default.build({
|
|
45
|
+
// 需要指定 absWorkingDir 兼容 APP_ROOT 的情况
|
|
46
|
+
absWorkingDir: opts.config.cwd,
|
|
44
47
|
format: "esm",
|
|
45
48
|
platform: "browser",
|
|
46
49
|
target: "esnext",
|
|
@@ -78,8 +81,8 @@ async function build(opts) {
|
|
|
78
81
|
// then we import 'foo/bar.less'
|
|
79
82
|
// if we resolve alias first, we will get { path }
|
|
80
83
|
// if we resolve externals first, we will get { external: true }
|
|
81
|
-
(0, import_esbuildExternalPlugin.esbuildExternalPlugin)(),
|
|
82
|
-
(0, import_esbuildAliasPlugin.esbuildAliasPlugin)({ alias
|
|
84
|
+
(0, import_esbuildExternalPlugin.esbuildExternalPlugin)({ alias }),
|
|
85
|
+
(0, import_esbuildAliasPlugin.esbuildAliasPlugin)({ alias }),
|
|
83
86
|
...opts.plugins || []
|
|
84
87
|
]
|
|
85
88
|
});
|
|
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(esbuildAliasPlugin_exports);
|
|
|
35
35
|
var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_isRelative = require("./isRelative");
|
|
38
39
|
var resolver = import_enhanced_resolve.default.create({
|
|
39
40
|
mainFields: ["module", "browser", "main"],
|
|
40
41
|
extensions: [".json", ".js", ".jsx", ".ts", ".tsx", ".cjs", ".mjs"],
|
|
@@ -70,13 +71,13 @@ function esbuildAliasPlugin(opts) {
|
|
|
70
71
|
name: "esbuildAliasPlugin",
|
|
71
72
|
setup(build) {
|
|
72
73
|
sortByAffix({ keys: Object.keys(opts.alias), affix: "$" }).filter((key) => {
|
|
73
|
-
return import_path.default.isAbsolute(opts.alias[key]) && !opts.alias[key].includes("node_modules");
|
|
74
|
+
return import_path.default.isAbsolute(opts.alias[key]) && !opts.alias[key].includes("node_modules") || (0, import_isRelative.isRelativePath)(opts.alias[key]);
|
|
74
75
|
}).forEach((key) => {
|
|
75
76
|
const value = opts.alias[key];
|
|
76
77
|
const filter = key.endsWith("$") ? new RegExp(`^${key}`) : new RegExp(`^${key}$`);
|
|
77
78
|
build.onResolve({ filter }, async (args) => {
|
|
78
79
|
const path2 = await resolve(
|
|
79
|
-
args.
|
|
80
|
+
args.resolveDir,
|
|
80
81
|
args.path.replace(filter, value)
|
|
81
82
|
);
|
|
82
83
|
return {
|
|
@@ -87,7 +88,7 @@ function esbuildAliasPlugin(opts) {
|
|
|
87
88
|
const filter2 = new RegExp(`^${addSlashAffix(key)}`);
|
|
88
89
|
build.onResolve({ filter: filter2 }, async (args) => {
|
|
89
90
|
const path2 = await resolve(
|
|
90
|
-
args.
|
|
91
|
+
args.resolveDir,
|
|
91
92
|
args.path.replace(filter2, addSlashAffix(value))
|
|
92
93
|
);
|
|
93
94
|
return {
|
|
@@ -34,7 +34,9 @@ __export(esbuildExternalPlugin_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(esbuildExternalPlugin_exports);
|
|
35
35
|
var import_utils = require("@umijs/utils");
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
|
-
|
|
37
|
+
var import_isRelative = require("./isRelative");
|
|
38
|
+
function esbuildExternalPlugin(opts) {
|
|
39
|
+
const { alias } = opts;
|
|
38
40
|
return {
|
|
39
41
|
name: "esbuildExternalPlugin",
|
|
40
42
|
setup(build) {
|
|
@@ -50,10 +52,25 @@ function esbuildExternalPlugin() {
|
|
|
50
52
|
if (args.kind === "entry-point") {
|
|
51
53
|
return null;
|
|
52
54
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const isAbsoluteImport = import_path.default.isAbsolute(args.path);
|
|
56
|
+
if (!isAbsoluteImport) {
|
|
57
|
+
const winP = (0, import_utils.winPath)(args.path);
|
|
58
|
+
const aliasImport = import_utils.aliasUtils.getAliasValue({
|
|
59
|
+
alias,
|
|
60
|
+
imported: winP
|
|
61
|
+
});
|
|
62
|
+
if (aliasImport) {
|
|
63
|
+
if (aliasImport.includes("node_modules")) {
|
|
64
|
+
return { external: true };
|
|
65
|
+
}
|
|
66
|
+
if (import_path.default.isAbsolute(aliasImport)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
if ((0, import_isRelative.isRelativePath)(aliasImport)) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return { external: true };
|
|
73
|
+
}
|
|
57
74
|
}
|
|
58
75
|
const isNodeModuleImport = args.path.includes("node_modules");
|
|
59
76
|
if (import_path.default.isAbsolute(args.path) && !isNodeModuleImport) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isRelativePath(p: string): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
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/features/prepare/esbuildPlugins/isRelative.tsx
|
|
20
|
+
var isRelative_exports = {};
|
|
21
|
+
__export(isRelative_exports, {
|
|
22
|
+
isRelativePath: () => isRelativePath
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(isRelative_exports);
|
|
25
|
+
function isRelativePath(p) {
|
|
26
|
+
return p.startsWith("./") || p.startsWith("../");
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
isRelativePath
|
|
31
|
+
});
|
package/dist/features/ssr/ssr.js
CHANGED
|
@@ -39,6 +39,12 @@ var import_fs = require("fs");
|
|
|
39
39
|
var import_path = require("path");
|
|
40
40
|
var import_utils2 = require("./utils");
|
|
41
41
|
var ssr_default = (api) => {
|
|
42
|
+
const esbuildBuilder = (0, import_utils.importLazy)(
|
|
43
|
+
require.resolve("./builder/builder")
|
|
44
|
+
);
|
|
45
|
+
const webpackBuilder = (0, import_utils.importLazy)(
|
|
46
|
+
require.resolve("./webpack/webpack")
|
|
47
|
+
);
|
|
42
48
|
api.describe({
|
|
43
49
|
key: "ssr",
|
|
44
50
|
config: {
|
|
@@ -87,10 +93,7 @@ export { React };
|
|
|
87
93
|
api.onBeforeCompiler(async ({ opts }) => {
|
|
88
94
|
const { builder = "esbuild" } = api.config.ssr;
|
|
89
95
|
if (builder === "esbuild") {
|
|
90
|
-
|
|
91
|
-
require.resolve("./builder/builder")
|
|
92
|
-
);
|
|
93
|
-
await build({
|
|
96
|
+
await esbuildBuilder.build({
|
|
94
97
|
api,
|
|
95
98
|
watch: api.env === "development"
|
|
96
99
|
});
|
|
@@ -99,10 +102,7 @@ export { React };
|
|
|
99
102
|
!api.config.vite,
|
|
100
103
|
`The \`vite\` config is now allowed when \`ssr.builder\` is webpack!`
|
|
101
104
|
);
|
|
102
|
-
|
|
103
|
-
require.resolve("./webpack/webpack")
|
|
104
|
-
);
|
|
105
|
-
await build(api, opts);
|
|
105
|
+
await webpackBuilder.build(api, opts);
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
api.onBuildComplete(async ({ err }) => {
|
|
@@ -32,10 +32,10 @@ __export(webpack_exports, {
|
|
|
32
32
|
build: () => build2
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(webpack_exports);
|
|
35
|
-
var import_utils = require("@umijs/utils");
|
|
36
35
|
var bundlerWebpack = __toESM(require("@umijs/bundler-webpack"));
|
|
37
|
-
var
|
|
36
|
+
var import_utils = require("@umijs/utils");
|
|
38
37
|
var import_path = require("path");
|
|
38
|
+
var import_utils2 = require("../utils");
|
|
39
39
|
var build2 = async (api, opts) => {
|
|
40
40
|
import_utils.logger.wait("[SSR] Compiling...");
|
|
41
41
|
const now = new Date().getTime();
|
|
@@ -48,6 +48,7 @@ var build2 = async (api, opts) => {
|
|
|
48
48
|
"umi-server-dynamic-import-node"
|
|
49
49
|
]);
|
|
50
50
|
delete bundlerOpts.onBuildComplete;
|
|
51
|
+
bundlerOpts.watch = api.env === "development";
|
|
51
52
|
bundlerOpts.chainWebpack = async (memo) => {
|
|
52
53
|
const absOutputFile = (0, import_utils2.absServerBuildPath)(api);
|
|
53
54
|
await oChainWebpack(memo);
|
|
@@ -59,9 +60,6 @@ var build2 = async (api, opts) => {
|
|
|
59
60
|
memo.output.path((0, import_path.dirname)(absOutputFile)).filename("umi.server.js").chunkFilename("[name].server.js").libraryTarget("commonjs2");
|
|
60
61
|
memo.plugins.delete("progress-plugin");
|
|
61
62
|
memo.optimization.minimize(false);
|
|
62
|
-
if (api.env === "development") {
|
|
63
|
-
memo.watch(true);
|
|
64
|
-
}
|
|
65
63
|
return memo;
|
|
66
64
|
};
|
|
67
65
|
await bundlerWebpack.build(bundlerOpts);
|
|
@@ -33,7 +33,6 @@ __export(configTypes_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(configTypes_exports);
|
|
35
35
|
var import_joi = __toESM(require("@umijs/utils/compiled/@hapi/joi"));
|
|
36
|
-
var import_joi2types = __toESM(require("../../../compiled/joi2types"));
|
|
37
36
|
var FILTER_KEYS = ["chainWebpack"];
|
|
38
37
|
var configTypes_default = (api) => {
|
|
39
38
|
api.onGenerateFiles(async () => {
|
|
@@ -56,7 +55,8 @@ var configTypes_default = (api) => {
|
|
|
56
55
|
};
|
|
57
56
|
}, {});
|
|
58
57
|
const interfaceName = "IConfigFromPlugins";
|
|
59
|
-
const
|
|
58
|
+
const joi2Types = require("../../../compiled/joi2types").default;
|
|
59
|
+
const content = await joi2Types(import_joi.default.object(properties), {
|
|
60
60
|
interfaceName,
|
|
61
61
|
bannerComment: "// Created by Umi Plugin",
|
|
62
62
|
unknownAny: true
|
|
@@ -316,7 +316,7 @@ declare module '*.txt' {
|
|
|
316
316
|
historyType: api.config.history.type,
|
|
317
317
|
hydrate: !!api.config.ssr,
|
|
318
318
|
reactRouter5Compat: !!api.config.reactRouter5Compat,
|
|
319
|
-
loadingComponent:
|
|
319
|
+
loadingComponent: api.appData.globalLoading
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
api.writeTmpFile({
|
|
@@ -32,10 +32,10 @@ __export(transform_exports, {
|
|
|
32
32
|
default: () => transform_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(transform_exports);
|
|
35
|
-
var import_code_frame = require("@umijs/bundler-utils/compiled/babel/code-frame");
|
|
36
35
|
var import_utils = require("@umijs/utils");
|
|
37
36
|
var import_babelPlugin = __toESM(require("./babelPlugin"));
|
|
38
37
|
var import_CodeFrameError = __toESM(require("./CodeFrameError"));
|
|
38
|
+
var babelCodeFrame = (0, import_utils.importLazy)(require.resolve("@umijs/bundler-utils/compiled/babel/code-frame"));
|
|
39
39
|
var transform_default = (api) => {
|
|
40
40
|
api.addBeforeBabelPresets(() => {
|
|
41
41
|
return [
|
|
@@ -60,10 +60,14 @@ var transform_default = (api) => {
|
|
|
60
60
|
if (err instanceof import_CodeFrameError.default) {
|
|
61
61
|
throw new Error(
|
|
62
62
|
`
|
|
63
|
-
${
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
${babelCodeFrame.codeFrameColumns(
|
|
64
|
+
args.code,
|
|
65
|
+
err.location,
|
|
66
|
+
{
|
|
67
|
+
highlightCode: true,
|
|
68
|
+
message: err.message
|
|
69
|
+
}
|
|
70
|
+
)}
|
|
67
71
|
`,
|
|
68
72
|
{ cause: err }
|
|
69
73
|
);
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ var src_default = () => {
|
|
|
51
51
|
require.resolve("./features/esmi/esmi"),
|
|
52
52
|
require.resolve("./features/exportStatic/exportStatic"),
|
|
53
53
|
require.resolve("./features/favicons/favicons"),
|
|
54
|
+
require.resolve("./features/helmet/helmet"),
|
|
54
55
|
require.resolve("./features/icons/icons"),
|
|
55
56
|
require.resolve("./features/mock/mock"),
|
|
56
57
|
require.resolve("./features/mpa/mpa"),
|
|
@@ -60,11 +61,14 @@ var src_default = () => {
|
|
|
60
61
|
require.resolve("./features/polyfill/publicPathPolyfill"),
|
|
61
62
|
require.resolve("./features/prepare/prepare"),
|
|
62
63
|
require.resolve("./features/routePrefetch/routePrefetch"),
|
|
63
|
-
require.resolve("./features/ssr/ssr"),
|
|
64
64
|
require.resolve("./features/terminal/terminal"),
|
|
65
|
+
// 1. generate tmp files
|
|
65
66
|
require.resolve("./features/tmpFiles/tmpFiles"),
|
|
67
|
+
// 2. `clientLoader` and `routeProps` depends on `tmpFiles` files
|
|
66
68
|
require.resolve("./features/clientLoader/clientLoader"),
|
|
67
69
|
require.resolve("./features/routeProps/routeProps"),
|
|
70
|
+
// 3. `ssr` needs to be run last
|
|
71
|
+
require.resolve("./features/ssr/ssr"),
|
|
68
72
|
require.resolve("./features/tmpFiles/configTypes"),
|
|
69
73
|
require.resolve("./features/transform/transform"),
|
|
70
74
|
require.resolve("./features/lowImport/lowImport"),
|
|
@@ -85,6 +89,7 @@ var src_default = () => {
|
|
|
85
89
|
require.resolve("./commands/help"),
|
|
86
90
|
require.resolve("./commands/lint"),
|
|
87
91
|
require.resolve("./commands/setup"),
|
|
92
|
+
require.resolve("./commands/deadcode"),
|
|
88
93
|
require.resolve("./commands/version"),
|
|
89
94
|
require.resolve("./commands/generators/page"),
|
|
90
95
|
require.resolve("./commands/generators/prettier"),
|
|
@@ -17,10 +17,11 @@ export declare class LazySourceCodeCache {
|
|
|
17
17
|
cwd: string;
|
|
18
18
|
cachePath: string;
|
|
19
19
|
});
|
|
20
|
-
init(): Promise<void>;
|
|
20
|
+
init(files: string[]): Promise<void>;
|
|
21
|
+
initWithScan(): Promise<void>;
|
|
22
|
+
private initFileList;
|
|
21
23
|
getSrcPath(): string;
|
|
22
24
|
loadFiles(files: string[]): Promise<void>;
|
|
23
|
-
private initFileList;
|
|
24
25
|
getMergedCode(): {
|
|
25
26
|
code: string;
|
|
26
27
|
imports: readonly ImportSpecifier[];
|
|
@@ -38,8 +38,8 @@ var import_utils = require("@umijs/utils");
|
|
|
38
38
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
39
39
|
var import_fs = require("fs");
|
|
40
40
|
var import_path = require("path");
|
|
41
|
-
var import_FolderWatch = require("./FolderWatch");
|
|
42
41
|
var import_constant = require("./constant");
|
|
42
|
+
var import_FolderWatch = require("./FolderWatch");
|
|
43
43
|
var LazySourceCodeCache = class {
|
|
44
44
|
constructor(opts) {
|
|
45
45
|
this.listeners = [];
|
|
@@ -58,7 +58,11 @@ var LazySourceCodeCache = class {
|
|
|
58
58
|
this.pendingFilesEvents.push(e);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
async init() {
|
|
61
|
+
async init(files) {
|
|
62
|
+
await Promise.all([import_es_module_lexer.init, this.folderWatch.init()]);
|
|
63
|
+
await this.loadFiles(files);
|
|
64
|
+
}
|
|
65
|
+
async initWithScan() {
|
|
62
66
|
const [files] = await Promise.all([
|
|
63
67
|
this.initFileList(),
|
|
64
68
|
import_es_module_lexer.init,
|
|
@@ -66,15 +70,6 @@ var LazySourceCodeCache = class {
|
|
|
66
70
|
]);
|
|
67
71
|
await this.loadFiles(files);
|
|
68
72
|
}
|
|
69
|
-
getSrcPath() {
|
|
70
|
-
return this.srcPath;
|
|
71
|
-
}
|
|
72
|
-
async loadFiles(files) {
|
|
73
|
-
const loaded = await this.filesLoader(files);
|
|
74
|
-
for (const f of Object.keys(loaded)) {
|
|
75
|
-
this.fileContentCache[f] = loaded[f];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
73
|
async initFileList() {
|
|
79
74
|
const start = Date.now();
|
|
80
75
|
const files = await (0, import_fast_glob.default)(
|
|
@@ -87,6 +82,15 @@ var LazySourceCodeCache = class {
|
|
|
87
82
|
import_utils.logger.debug("[MFSU][eager] fast-glob costs", Date.now() - start);
|
|
88
83
|
return files;
|
|
89
84
|
}
|
|
85
|
+
getSrcPath() {
|
|
86
|
+
return this.srcPath;
|
|
87
|
+
}
|
|
88
|
+
async loadFiles(files) {
|
|
89
|
+
const loaded = await this.filesLoader(files);
|
|
90
|
+
for (const f of Object.keys(loaded)) {
|
|
91
|
+
this.fileContentCache[f] = loaded[f];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
90
94
|
getMergedCode() {
|
|
91
95
|
const code = Object.values(this.fileContentCache).join("\n");
|
|
92
96
|
const [imports] = (0, import_es_module_lexer.parse)(code);
|
package/dist/registerMethods.js
CHANGED
|
@@ -92,6 +92,9 @@ var registerMethods_default = (api) => {
|
|
|
92
92
|
api.onStart(async () => {
|
|
93
93
|
await import_es_module_lexer.init;
|
|
94
94
|
});
|
|
95
|
+
const transformModule = (0, import_utils.importLazy)(
|
|
96
|
+
require.resolve("./utils/transformIEAR")
|
|
97
|
+
);
|
|
95
98
|
api.registerMethod({
|
|
96
99
|
name: "writeTmpFile",
|
|
97
100
|
fn(opts) {
|
|
@@ -129,9 +132,7 @@ var registerMethods_default = (api) => {
|
|
|
129
132
|
""
|
|
130
133
|
].filter((text) => text !== false).join("\n");
|
|
131
134
|
if (api.appData.vite && isJsFile) {
|
|
132
|
-
const
|
|
133
|
-
require.resolve("./utils/transformIEAR")
|
|
134
|
-
);
|
|
135
|
+
const transformIEAR = transformModule.default;
|
|
135
136
|
content = transformIEAR({ content, path: absPath }, api);
|
|
136
137
|
}
|
|
137
138
|
if (!(0, import_fs.existsSync)(absPath)) {
|
|
@@ -0,0 +1,35 @@
|
|
|
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/utils/projectFileList.ts
|
|
20
|
+
var projectFileList_exports = {};
|
|
21
|
+
__export(projectFileList_exports, {
|
|
22
|
+
getProjectFileList: () => getProjectFileList
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(projectFileList_exports);
|
|
25
|
+
var import_utils = require("@umijs/utils");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
function getProjectFileList(api) {
|
|
28
|
+
const result = api.appData.prepare.buildResult;
|
|
29
|
+
const srcPath = (0, import_utils.winPath)((0, import_path.normalize)(api.paths.absSrcPath));
|
|
30
|
+
return Object.keys(result.metafile.inputs).map((f) => (0, import_utils.winPath)((0, import_path.resolve)(api.paths.cwd, f))).filter((f) => f.startsWith(srcPath));
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
getProjectFileList
|
|
35
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.55",
|
|
4
4
|
"description": "@umijs/preset-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -26,28 +26,27 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@iconify/utils": "2.1.1",
|
|
29
|
-
"@svgr/core": "6.
|
|
30
|
-
"@umijs/ast": "4.0.
|
|
31
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
32
|
-
"@umijs/bundler-utils": "4.0.
|
|
33
|
-
"@umijs/bundler-vite": "4.0.
|
|
34
|
-
"@umijs/bundler-webpack": "4.0.
|
|
35
|
-
"@umijs/core": "4.0.
|
|
29
|
+
"@svgr/core": "6.5.1",
|
|
30
|
+
"@umijs/ast": "4.0.55",
|
|
31
|
+
"@umijs/babel-preset-umi": "4.0.55",
|
|
32
|
+
"@umijs/bundler-utils": "4.0.55",
|
|
33
|
+
"@umijs/bundler-vite": "4.0.55",
|
|
34
|
+
"@umijs/bundler-webpack": "4.0.55",
|
|
35
|
+
"@umijs/core": "4.0.55",
|
|
36
36
|
"@umijs/did-you-know": "^1.0.0",
|
|
37
37
|
"@umijs/history": "5.3.1",
|
|
38
|
-
"@umijs/mfsu": "4.0.
|
|
39
|
-
"@umijs/plugin-run": "4.0.
|
|
40
|
-
"@umijs/renderer-react": "4.0.
|
|
41
|
-
"@umijs/server": "4.0.
|
|
42
|
-
"@umijs/utils": "4.0.
|
|
38
|
+
"@umijs/mfsu": "4.0.55",
|
|
39
|
+
"@umijs/plugin-run": "4.0.55",
|
|
40
|
+
"@umijs/renderer-react": "4.0.55",
|
|
41
|
+
"@umijs/server": "4.0.55",
|
|
42
|
+
"@umijs/utils": "4.0.55",
|
|
43
43
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
|
44
44
|
"click-to-react-component": "^1.0.8",
|
|
45
|
-
"core-js": "3.
|
|
45
|
+
"core-js": "3.28.0",
|
|
46
46
|
"current-script-polyfill": "1.0.0",
|
|
47
47
|
"enhanced-resolve": "5.9.3",
|
|
48
48
|
"fast-glob": "3.2.12",
|
|
49
49
|
"html-webpack-plugin": "5.5.0",
|
|
50
|
-
"magic-string": "0.27.0",
|
|
51
50
|
"path-to-regexp": "1.7.0",
|
|
52
51
|
"postcss-prefix-selector": "1.16.0",
|
|
53
52
|
"react": "18.1.0",
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
"@manypkg/get-packages": "1.1.3",
|
|
61
60
|
"@types/body-parser": "1.19.2",
|
|
62
61
|
"@types/ini": "1.3.31",
|
|
62
|
+
"@types/madge": "^5.0.0",
|
|
63
63
|
"@types/multer": "1.4.7",
|
|
64
64
|
"body-parser": "1.20.0",
|
|
65
65
|
"ini": "3.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"multer": "1.4.4",
|
|
68
68
|
"os-locale": "^6.0.2",
|
|
69
69
|
"sirv": "2.0.2",
|
|
70
|
-
"vite": "4.
|
|
70
|
+
"vite": "4.1.4"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
package/templates/umi.tpl
CHANGED
|
@@ -5,7 +5,7 @@ import { getRoutes } from './core/route';
|
|
|
5
5
|
import { createPluginManager } from './core/plugin';
|
|
6
6
|
import { createHistory } from './core/history';
|
|
7
7
|
{{#loadingComponent}}
|
|
8
|
-
import Loading from '
|
|
8
|
+
import Loading from '{{{ loadingComponent }}}';
|
|
9
9
|
{{/loadingComponent}}
|
|
10
10
|
import { ApplyPluginsType } from 'umi';
|
|
11
11
|
{{{ imports }}}
|