@umijs/utils 4.0.0-beta.9 → 4.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/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/globby/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
- package/compiled/globby/@nodelib/fs.scandir/out/index.d.ts +12 -0
- package/compiled/globby/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
- package/compiled/globby/@nodelib/fs.scandir/out/settings.d.ts +20 -0
- package/compiled/globby/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
- package/compiled/globby/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
- package/compiled/globby/@nodelib/fs.stat/out/index.d.ts +12 -0
- package/compiled/globby/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
- package/compiled/globby/@nodelib/fs.stat/out/settings.d.ts +16 -0
- package/compiled/globby/@nodelib/fs.stat/out/types/index.d.ts +4 -0
- package/compiled/globby/@nodelib/fs.walk/out/index.d.ts +14 -0
- package/compiled/globby/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
- package/compiled/globby/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
- package/compiled/globby/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
- package/compiled/globby/@nodelib/fs.walk/out/settings.d.ts +30 -0
- package/compiled/globby/@nodelib/fs.walk/out/types/index.d.ts +8 -0
- package/compiled/globby/LICENSE +9 -0
- package/compiled/globby/fast-glob/out/index.d.ts +27 -0
- package/compiled/globby/fast-glob/out/managers/tasks.d.ts +22 -0
- package/compiled/globby/fast-glob/out/settings.d.ts +164 -0
- package/compiled/globby/fast-glob/out/types/index.d.ts +31 -0
- package/compiled/globby/index.d.ts +206 -0
- package/compiled/globby/index.js +37 -0
- package/compiled/globby/package.json +1 -0
- 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/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/getCorejsVersion.d.ts +1 -0
- package/dist/getCorejsVersion.js +11 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6 -5
- package/dist/installDeps.js +20 -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/register.js +21 -22
- package/dist/tryPaths.d.ts +1 -0
- package/dist/tryPaths.js +11 -0
- package/package.json +19 -18
package/dist/logger.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.event = exports.info = exports.ready = exports.warn = exports.error = exports.wait = exports.prefixes = void 0;
|
|
6
|
+
exports.debug = exports.event = exports.info = exports.ready = exports.warn = exports.error = exports.wait = exports.prefixes = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("../compiled/chalk"));
|
|
8
8
|
exports.prefixes = {
|
|
9
9
|
wait: chalk_1.default.cyan('wait') + ' -',
|
|
@@ -12,6 +12,7 @@ exports.prefixes = {
|
|
|
12
12
|
ready: chalk_1.default.green('ready') + ' -',
|
|
13
13
|
info: chalk_1.default.cyan('info') + ' -',
|
|
14
14
|
event: chalk_1.default.magenta('event') + ' -',
|
|
15
|
+
debug: chalk_1.default.gray('debug') + ' -',
|
|
15
16
|
};
|
|
16
17
|
function wait(...message) {
|
|
17
18
|
console.log(exports.prefixes.wait, ...message);
|
|
@@ -37,3 +38,9 @@ function event(...message) {
|
|
|
37
38
|
console.log(exports.prefixes.event, ...message);
|
|
38
39
|
}
|
|
39
40
|
exports.event = event;
|
|
41
|
+
function debug(...message) {
|
|
42
|
+
if (process.env.DEBUG) {
|
|
43
|
+
console.log(exports.prefixes.debug, ...message);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.debug = debug;
|
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,9 +41,7 @@ function clearFiles() {
|
|
|
40
41
|
}
|
|
41
42
|
exports.clearFiles = clearFiles;
|
|
42
43
|
function restore() {
|
|
43
|
-
|
|
44
|
-
require.extensions[type] = Extensions[type];
|
|
45
|
-
}
|
|
44
|
+
revert();
|
|
46
45
|
registered = false;
|
|
47
46
|
}
|
|
48
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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/utils",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.3",
|
|
4
4
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
|
|
5
5
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
6
6
|
"repository": {
|
|
@@ -20,42 +20,41 @@
|
|
|
20
20
|
"dev": "pnpm build -- --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"chokidar": "3.5.
|
|
24
|
-
"clipboardy": "2.3.0"
|
|
23
|
+
"chokidar": "3.5.3"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@types/color": "3.0.
|
|
26
|
+
"@types/color": "3.0.3",
|
|
28
27
|
"@types/cross-spawn": "6.0.2",
|
|
29
28
|
"@types/debug": "4.1.7",
|
|
30
|
-
"@types/lodash": "4.14.
|
|
29
|
+
"@types/lodash": "4.14.178",
|
|
31
30
|
"@types/mustache": "4.1.2",
|
|
32
31
|
"@types/prompts": "^2.0.14",
|
|
33
32
|
"@types/rimraf": "3.0.2",
|
|
34
33
|
"@types/semver": "7.3.9",
|
|
35
34
|
"address": "1.1.2",
|
|
36
|
-
"axios": "0.
|
|
37
|
-
"chalk": "
|
|
35
|
+
"axios": "0.26.0",
|
|
36
|
+
"chalk": "5.0.0",
|
|
38
37
|
"cheerio": "1.0.0-rc.10",
|
|
39
|
-
"color": "4.
|
|
38
|
+
"color": "4.2.1",
|
|
40
39
|
"cross-spawn": "7.0.3",
|
|
41
|
-
"debug": "4.3.
|
|
40
|
+
"debug": "4.3.3",
|
|
42
41
|
"deepmerge": "4.2.2",
|
|
43
|
-
"execa": "
|
|
42
|
+
"execa": "6.1.0",
|
|
44
43
|
"fs-extra": "10.0.0",
|
|
45
44
|
"glob": "7.2.0",
|
|
46
|
-
"globby": "11.0.4",
|
|
47
45
|
"import-lazy": "4.0.0",
|
|
48
46
|
"lodash": "4.17.21",
|
|
49
47
|
"mustache": "4.2.0",
|
|
50
|
-
"
|
|
48
|
+
"pirates": "4.0.5",
|
|
49
|
+
"pkg-up": "4.0.0",
|
|
51
50
|
"portfinder": "1.0.28",
|
|
52
|
-
"prettier": "2.5.
|
|
51
|
+
"prettier": "2.5.1",
|
|
53
52
|
"prompts": "2.4.2",
|
|
54
|
-
"resolve": "1.
|
|
53
|
+
"resolve": "1.22.0",
|
|
55
54
|
"rimraf": "3.0.2",
|
|
56
55
|
"semver": "7.3.5",
|
|
57
|
-
"strip-ansi": "
|
|
58
|
-
"yargs-parser": "
|
|
56
|
+
"strip-ansi": "7.0.1",
|
|
57
|
+
"yargs-parser": "21.0.0"
|
|
59
58
|
},
|
|
60
59
|
"publishConfig": {
|
|
61
60
|
"access": "public"
|
|
@@ -87,7 +86,8 @@
|
|
|
87
86
|
"resolve",
|
|
88
87
|
"semver",
|
|
89
88
|
"strip-ansi",
|
|
90
|
-
"yargs-parser"
|
|
89
|
+
"yargs-parser",
|
|
90
|
+
"pirates"
|
|
91
91
|
],
|
|
92
92
|
"externals": {
|
|
93
93
|
"address": "$$LOCAL",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"resolve": "$$LOCAL",
|
|
108
108
|
"semver": "$$LOCAL",
|
|
109
109
|
"strip-ansi": "$$LOCAL",
|
|
110
|
-
"yargs-parser": "$$LOCAL"
|
|
110
|
+
"yargs-parser": "$$LOCAL",
|
|
111
|
+
"pirates": "$$LOCAL"
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
}
|