umi 4.0.2 → 4.0.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/dist/cli/printHelp.js +1 -1
- package/dist/test.d.ts +2 -0
- package/dist/test.js +24 -8
- package/package.json +13 -13
- package/prettier.js +1 -0
package/dist/cli/printHelp.js
CHANGED
|
@@ -5,6 +5,6 @@ const utils_1 = require("@umijs/utils");
|
|
|
5
5
|
function printHelp() {
|
|
6
6
|
utils_1.logger.fatal('A complete log of this run can be found in:');
|
|
7
7
|
utils_1.logger.fatal(utils_1.logger.getLatestLogFilePath());
|
|
8
|
-
utils_1.logger.fatal('Consider reporting a GitHub issue on https://github.com/umijs/umi
|
|
8
|
+
utils_1.logger.fatal('Consider reporting a GitHub issue on https://github.com/umijs/umi/issues');
|
|
9
9
|
}
|
|
10
10
|
exports.printHelp = printHelp;
|
package/dist/test.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Config } from '@umijs/test';
|
|
2
2
|
export * from '@umijs/test';
|
|
3
|
+
export declare function getAliasPathWithKey(alias: Record<string, string>, key: string): string;
|
|
4
|
+
export declare function getUmiAlias(): Promise<any>;
|
|
3
5
|
export declare function configUmiAlias(config: Config.InitialOptions): Promise<Partial<{
|
|
4
6
|
automock: boolean;
|
|
5
7
|
bail: number | boolean;
|
package/dist/test.js
CHANGED
|
@@ -14,19 +14,28 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.configUmiAlias = void 0;
|
|
17
|
+
exports.configUmiAlias = exports.getUmiAlias = exports.getAliasPathWithKey = void 0;
|
|
18
18
|
const fs_1 = require("fs");
|
|
19
19
|
const service_1 = require("./service/service");
|
|
20
20
|
__exportStar(require("@umijs/test"), exports);
|
|
21
21
|
function getAliasPathWithKey(alias, key) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (alias[key]) {
|
|
23
|
+
return getAliasPathWithKey(alias, alias[key]);
|
|
24
|
+
}
|
|
25
|
+
const aliasKeys = Object.keys(alias);
|
|
26
|
+
const keyStartedWith = aliasKeys.find((k) => !k.endsWith('$') && key.startsWith(`${k}/`));
|
|
27
|
+
if (keyStartedWith) {
|
|
28
|
+
const realPath = alias[keyStartedWith];
|
|
29
|
+
const newKey = realPath + key.slice(keyStartedWith.length);
|
|
30
|
+
return getAliasPathWithKey(alias, newKey);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return key;
|
|
25
34
|
}
|
|
26
|
-
return thePath;
|
|
27
35
|
}
|
|
36
|
+
exports.getAliasPathWithKey = getAliasPathWithKey;
|
|
28
37
|
let service;
|
|
29
|
-
async function
|
|
38
|
+
async function getUmiAlias() {
|
|
30
39
|
if (!service) {
|
|
31
40
|
service = new service_1.Service();
|
|
32
41
|
await service.run2({
|
|
@@ -34,11 +43,18 @@ async function configUmiAlias(config) {
|
|
|
34
43
|
args: { quiet: true },
|
|
35
44
|
});
|
|
36
45
|
}
|
|
46
|
+
return service.config.alias;
|
|
47
|
+
}
|
|
48
|
+
exports.getUmiAlias = getUmiAlias;
|
|
49
|
+
async function configUmiAlias(config) {
|
|
37
50
|
config.moduleNameMapper || (config.moduleNameMapper = {});
|
|
38
|
-
const
|
|
51
|
+
const alias = await getUmiAlias();
|
|
39
52
|
for (const key of Object.keys(alias)) {
|
|
40
53
|
const aliasPath = getAliasPathWithKey(alias, key);
|
|
41
|
-
if (
|
|
54
|
+
if (key.endsWith('$')) {
|
|
55
|
+
config.moduleNameMapper[`^${key}`] = aliasPath;
|
|
56
|
+
}
|
|
57
|
+
else if ((0, fs_1.existsSync)(aliasPath) && (0, fs_1.statSync)(aliasPath).isDirectory()) {
|
|
42
58
|
config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
|
|
43
59
|
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
44
60
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "umi",
|
|
5
|
-
"homepage": "https://github.com/umijs/umi
|
|
6
|
-
"bugs": "https://github.com/umijs/umi
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/umi#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/umijs/umi
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/index.js",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"test": "umi-scripts jest-turbo"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@umijs/bundler-utils": "4.0.
|
|
42
|
-
"@umijs/bundler-webpack": "4.0.
|
|
43
|
-
"@umijs/core": "4.0.
|
|
44
|
-
"@umijs/lint": "4.0.
|
|
45
|
-
"@umijs/preset-umi": "4.0.
|
|
46
|
-
"@umijs/renderer-react": "4.0.
|
|
47
|
-
"@umijs/server": "4.0.
|
|
48
|
-
"@umijs/test": "4.0.
|
|
49
|
-
"@umijs/utils": "4.0.
|
|
41
|
+
"@umijs/bundler-utils": "4.0.3",
|
|
42
|
+
"@umijs/bundler-webpack": "4.0.3",
|
|
43
|
+
"@umijs/core": "4.0.3",
|
|
44
|
+
"@umijs/lint": "4.0.3",
|
|
45
|
+
"@umijs/preset-umi": "4.0.3",
|
|
46
|
+
"@umijs/renderer-react": "4.0.3",
|
|
47
|
+
"@umijs/server": "4.0.3",
|
|
48
|
+
"@umijs/test": "4.0.3",
|
|
49
|
+
"@umijs/utils": "4.0.3",
|
|
50
50
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
51
51
|
"prettier-plugin-packagejson": "^2.2.17"
|
|
52
52
|
},
|