@umijs/utils 4.0.0-beta.8 → 4.0.0-canary.20220317.1
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/axios/index.d.ts +29 -14
- package/compiled/axios/index.js +1 -1
- package/compiled/chalk/LICENSE +1 -1
- package/compiled/chalk/index.js +1 -1
- package/compiled/chalk/package.json +1 -1
- package/compiled/chalk/source/index.d.ts +318 -0
- package/compiled/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/compiled/color/color-convert/conversions.d.ts +87 -87
- package/compiled/color/color-convert/index.d.ts +75 -60
- package/compiled/color/color-convert/route.d.ts +271 -271
- package/compiled/color/index.d.ts +118 -121
- package/compiled/color/index.js +1 -1
- package/compiled/color/package.json +1 -4
- package/compiled/debug/LICENSE +10 -9
- package/compiled/debug/index.js +1 -1
- package/compiled/debug/package.json +1 -1
- package/compiled/execa/index.d.ts +467 -445
- package/compiled/execa/index.js +1 -1
- package/compiled/fs-extra/index.d.ts +347 -116
- package/compiled/fs-extra/index.js +1 -1
- package/compiled/pirates/LICENSE +21 -0
- package/compiled/pirates/index.d.ts +82 -0
- package/compiled/pirates/index.js +1 -0
- package/compiled/pirates/package.json +1 -0
- package/compiled/pkg-up/LICENSE +1 -1
- package/compiled/pkg-up/index.d.ts +55 -44
- package/compiled/pkg-up/index.js +1 -1
- package/compiled/pkg-up/package.json +1 -1
- package/compiled/prettier/index.d.ts +568 -679
- package/compiled/prettier/index.js +62 -274
- package/compiled/prettier/package.json +1 -5
- package/compiled/resolve/index.js +1 -1
- package/compiled/strip-ansi/LICENSE +1 -1
- package/compiled/strip-ansi/index.d.ts +2 -4
- package/compiled/strip-ansi/index.js +1 -1
- package/compiled/strip-ansi/package.json +1 -1
- package/compiled/yargs-parser/index.js +1 -1
- package/dist/BaseGenerator/BaseGenerator.js +3 -4
- package/dist/getCorejsVersion.d.ts +1 -0
- package/dist/getCorejsVersion.js +11 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +11 -6
- package/dist/installDeps.js +24 -4
- package/dist/isStyleFile.d.ts +5 -0
- package/dist/isStyleFile.js +16 -0
- package/dist/logger.d.ts +8 -6
- package/dist/logger.js +8 -1
- package/dist/npmClient.js +2 -2
- package/dist/register.js +22 -22
- package/dist/tryPaths.d.ts +1 -0
- package/dist/tryPaths.js +11 -0
- package/package.json +35 -33
package/dist/register.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.restore = exports.clearFiles = exports.getFiles = exports.register = void 0;
|
|
4
|
-
const
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const pirates_1 = require("../compiled/pirates");
|
|
6
|
+
const COMPILE_EXTS = ['.ts', '.tsx', '.js', '.jsx'];
|
|
7
|
+
const HOOK_EXTS = [...COMPILE_EXTS, '.mjs'];
|
|
5
8
|
let registered = false;
|
|
6
9
|
let files = [];
|
|
7
|
-
|
|
10
|
+
let revert = () => { };
|
|
8
11
|
function transform(opts) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
12
|
+
const { code, filename, implementor } = opts;
|
|
13
|
+
files.push(filename);
|
|
14
|
+
const ext = (0, path_1.extname)(filename);
|
|
15
|
+
if (COMPILE_EXTS.includes(ext)) {
|
|
16
|
+
return implementor.transformSync(code, {
|
|
17
|
+
loader: ext.slice(1),
|
|
18
|
+
target: 'es2017',
|
|
19
|
+
format: 'cjs',
|
|
20
|
+
}).code;
|
|
21
|
+
}
|
|
22
|
+
return code;
|
|
21
23
|
}
|
|
22
24
|
function register(opts) {
|
|
23
25
|
files = [];
|
|
24
|
-
const types = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];
|
|
25
26
|
if (!registered) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
27
|
+
revert = (0, pirates_1.addHook)((code, filename) => transform({ code, filename, implementor: opts.implementor }), {
|
|
28
|
+
ext: HOOK_EXTS,
|
|
29
|
+
ignoreNodeModules: true,
|
|
30
|
+
});
|
|
30
31
|
registered = true;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -40,8 +41,7 @@ function clearFiles() {
|
|
|
40
41
|
}
|
|
41
42
|
exports.clearFiles = clearFiles;
|
|
42
43
|
function restore() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
44
|
+
revert();
|
|
45
|
+
registered = false;
|
|
46
46
|
}
|
|
47
47
|
exports.restore = restore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryPaths(paths: string[]): string | undefined;
|
package/dist/tryPaths.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryPaths = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
function tryPaths(paths) {
|
|
6
|
+
for (const path of paths) {
|
|
7
|
+
if ((0, fs_1.existsSync)(path))
|
|
8
|
+
return path;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.tryPaths = tryPaths;
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/utils",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary.20220317.1",
|
|
4
|
+
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
|
|
5
|
+
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/umijs/umi-next"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
4
11
|
"main": "dist/index.js",
|
|
5
12
|
"types": "dist/index.d.ts",
|
|
6
13
|
"files": [
|
|
@@ -10,59 +17,52 @@
|
|
|
10
17
|
"scripts": {
|
|
11
18
|
"build": "pnpm tsc",
|
|
12
19
|
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
13
|
-
"dev": "pnpm build -- --watch"
|
|
14
|
-
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "https://github.com/umijs/umi-next"
|
|
18
|
-
},
|
|
19
|
-
"authors": [
|
|
20
|
-
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
21
|
-
],
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
24
|
-
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
20
|
+
"dev": "pnpm build -- --watch",
|
|
21
|
+
"test": "jest -c ../../jest.turbo.config.ts"
|
|
27
22
|
},
|
|
28
23
|
"dependencies": {
|
|
29
|
-
"chokidar": "3.5.
|
|
30
|
-
"clipboardy": "2.3.0"
|
|
24
|
+
"chokidar": "3.5.3"
|
|
31
25
|
},
|
|
32
26
|
"devDependencies": {
|
|
33
|
-
"@types/color": "3.0.
|
|
27
|
+
"@types/color": "3.0.3",
|
|
34
28
|
"@types/cross-spawn": "6.0.2",
|
|
35
29
|
"@types/debug": "4.1.7",
|
|
36
|
-
"@types/lodash": "4.14.
|
|
30
|
+
"@types/lodash": "4.14.179",
|
|
37
31
|
"@types/mustache": "4.1.2",
|
|
38
32
|
"@types/prompts": "^2.0.14",
|
|
39
33
|
"@types/rimraf": "3.0.2",
|
|
40
34
|
"@types/semver": "7.3.9",
|
|
41
35
|
"address": "1.1.2",
|
|
42
|
-
"axios": "0.
|
|
43
|
-
"chalk": "
|
|
36
|
+
"axios": "0.26.1",
|
|
37
|
+
"chalk": "5.0.1",
|
|
44
38
|
"cheerio": "1.0.0-rc.10",
|
|
45
|
-
"color": "4.
|
|
39
|
+
"color": "4.2.1",
|
|
46
40
|
"cross-spawn": "7.0.3",
|
|
47
|
-
"debug": "4.3.
|
|
41
|
+
"debug": "4.3.3",
|
|
48
42
|
"deepmerge": "4.2.2",
|
|
49
|
-
"execa": "
|
|
50
|
-
"fs-extra": "10.0.
|
|
43
|
+
"execa": "6.1.0",
|
|
44
|
+
"fs-extra": "10.0.1",
|
|
51
45
|
"glob": "7.2.0",
|
|
52
|
-
"globby": "11.0.4",
|
|
53
46
|
"import-lazy": "4.0.0",
|
|
54
47
|
"lodash": "4.17.21",
|
|
55
48
|
"mustache": "4.2.0",
|
|
56
|
-
"
|
|
49
|
+
"pirates": "4.0.5",
|
|
50
|
+
"pkg-up": "4.0.0",
|
|
57
51
|
"portfinder": "1.0.28",
|
|
58
|
-
"prettier": "2.
|
|
52
|
+
"prettier": "2.5.1",
|
|
59
53
|
"prompts": "2.4.2",
|
|
60
|
-
"resolve": "1.
|
|
54
|
+
"resolve": "1.22.0",
|
|
61
55
|
"rimraf": "3.0.2",
|
|
62
56
|
"semver": "7.3.5",
|
|
63
|
-
"strip-ansi": "
|
|
64
|
-
"yargs-parser": "
|
|
57
|
+
"strip-ansi": "7.0.1",
|
|
58
|
+
"yargs-parser": "21.0.1"
|
|
65
59
|
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"authors": [
|
|
64
|
+
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
65
|
+
],
|
|
66
66
|
"compiledConfig": {
|
|
67
67
|
"deps": [
|
|
68
68
|
"address",
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"resolve",
|
|
88
88
|
"semver",
|
|
89
89
|
"strip-ansi",
|
|
90
|
-
"yargs-parser"
|
|
90
|
+
"yargs-parser",
|
|
91
|
+
"pirates"
|
|
91
92
|
],
|
|
92
93
|
"externals": {
|
|
93
94
|
"address": "$$LOCAL",
|
|
@@ -107,7 +108,8 @@
|
|
|
107
108
|
"resolve": "$$LOCAL",
|
|
108
109
|
"semver": "$$LOCAL",
|
|
109
110
|
"strip-ansi": "$$LOCAL",
|
|
110
|
-
"yargs-parser": "$$LOCAL"
|
|
111
|
+
"yargs-parser": "$$LOCAL",
|
|
112
|
+
"pirates": "$$LOCAL"
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
}
|