@umijs/utils 4.0.0-beta.9 → 4.0.0-canary-20240513.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/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +70 -0
- package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
- package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
- package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
- package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
- package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
- package/compiled/@ampproject/remapping/LICENSE +202 -0
- package/compiled/@ampproject/remapping/dist/types/remapping.d.ts +19 -0
- package/compiled/@ampproject/remapping/dist/types/source-map.d.ts +17 -0
- package/compiled/@ampproject/remapping/dist/types/types.d.ts +14 -0
- package/compiled/@ampproject/remapping/index.js +1 -0
- package/compiled/@ampproject/remapping/package.json +1 -0
- package/compiled/@clack/prompts/LICENSE +23 -0
- package/compiled/@clack/prompts/dist/index.d.ts +38 -0
- package/compiled/@clack/prompts/index.js +1 -0
- package/compiled/@clack/prompts/package.json +1 -0
- package/compiled/@hapi/joi/index.d.ts +2218 -0
- package/compiled/@hapi/joi/index.js +1 -0
- package/compiled/@hapi/joi/package.json +1 -0
- 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/fastest-levenshtein/index.js +1 -0
- package/compiled/fastest-levenshtein/mod.d.ts +3 -0
- package/compiled/fastest-levenshtein/package.json +1 -0
- package/compiled/filesize/LICENSE +28 -0
- package/compiled/filesize/filesize.d.ts +131 -0
- package/compiled/filesize/index.js +8 -0
- package/compiled/filesize/package.json +1 -0
- package/compiled/filesize/types/filesize.d.ts +46 -0
- package/compiled/fs-extra/index.d.ts +930 -253
- package/compiled/fs-extra/index.js +1 -1
- package/compiled/fs-extra/jsonfile/index.d.ts +78 -0
- package/compiled/fs-extra/package.json +1 -1
- package/compiled/glob/LICENSE +1 -7
- package/compiled/glob/index.d.ts +3 -1
- package/compiled/glob/index.js +1 -1
- package/compiled/glob/package.json +1 -1
- package/compiled/gzip-size/LICENSE +9 -0
- package/compiled/gzip-size/index.d.ts +103 -0
- package/compiled/gzip-size/index.js +1 -0
- package/compiled/gzip-size/package.json +1 -0
- package/compiled/lodash/common/array.d.ts +0 -0
- package/compiled/lodash/common/collection.d.ts +0 -0
- package/compiled/lodash/common/common.d.ts +0 -0
- package/compiled/lodash/common/date.d.ts +0 -0
- package/compiled/lodash/common/function.d.ts +0 -0
- package/compiled/lodash/common/lang.d.ts +0 -0
- package/compiled/lodash/common/math.d.ts +0 -0
- package/compiled/lodash/common/number.d.ts +0 -0
- package/compiled/lodash/common/object.d.ts +0 -0
- package/compiled/lodash/common/seq.d.ts +0 -0
- package/compiled/lodash/common/string.d.ts +0 -0
- package/compiled/lodash/common/util.d.ts +0 -0
- package/compiled/magic-string/LICENSE +7 -0
- package/compiled/magic-string/index.d.ts +250 -0
- package/compiled/magic-string/index.js +1 -0
- package/compiled/magic-string/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/portfinder/index.js +1 -1
- package/compiled/portfinder/lib/portfinder.d.ts +16 -1
- package/compiled/portfinder/package.json +1 -1
- package/compiled/resolve/index.js +1 -1
- package/compiled/semver/classes/range.d.ts +1 -1
- package/compiled/semver/classes/semver.d.ts +1 -1
- package/compiled/semver/functions/compare-build.d.ts +6 -1
- package/compiled/semver/functions/diff.d.ts +1 -5
- package/compiled/semver/functions/satisfies.d.ts +1 -1
- package/compiled/semver/index.d.ts +3 -0
- package/compiled/semver/index.js +1 -1
- package/compiled/semver/package.json +1 -1
- package/compiled/semver/ranges/gtr.d.ts +1 -1
- package/compiled/semver/ranges/intersects.d.ts +1 -1
- package/compiled/semver/ranges/ltr.d.ts +1 -1
- package/compiled/semver/ranges/max-satisfying.d.ts +1 -1
- package/compiled/semver/ranges/min-satisfying.d.ts +1 -1
- package/compiled/semver/ranges/outside.d.ts +1 -1
- package/compiled/semver/ranges/subset.d.ts +1 -5
- package/compiled/semver/ranges/valid.d.ts +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/tar/LICENSE +15 -0
- package/compiled/tar/index.d.ts +943 -0
- package/compiled/tar/index.js +1 -0
- package/compiled/tar/minipass/index.d.ts +150 -0
- package/compiled/tar/package.json +1 -0
- package/compiled/tsconfig-paths/LICENSE +21 -0
- package/compiled/tsconfig-paths/index.js +1 -0
- package/compiled/tsconfig-paths/lib/index.d.ts +5 -0
- package/compiled/tsconfig-paths/package.json +1 -0
- package/compiled/yargs-parser/index.js +1 -1
- package/compiled/yargs-parser/package.json +1 -1
- package/compiled/zod/LICENSE +21 -0
- package/compiled/zod/index.d.ts +2 -0
- package/compiled/zod/index.js +1 -0
- package/compiled/zod/lib/ZodError.d.ts +159 -0
- package/compiled/zod/lib/__tests__/Mocker.d.ts +17 -0
- package/compiled/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
- package/compiled/zod/lib/benchmarks/index.d.ts +1 -0
- package/compiled/zod/lib/benchmarks/object.d.ts +5 -0
- package/compiled/zod/lib/benchmarks/primitives.d.ts +5 -0
- package/compiled/zod/lib/benchmarks/realworld.d.ts +5 -0
- package/compiled/zod/lib/benchmarks/string.d.ts +5 -0
- package/compiled/zod/lib/benchmarks/union.d.ts +5 -0
- package/compiled/zod/lib/errors.d.ts +5 -0
- package/compiled/zod/lib/external.d.ts +6 -0
- package/compiled/zod/lib/helpers/enumUtil.d.ts +8 -0
- package/compiled/zod/lib/helpers/errorUtil.d.ts +9 -0
- package/compiled/zod/lib/helpers/parseUtil.d.ts +78 -0
- package/compiled/zod/lib/helpers/partialUtil.d.ts +8 -0
- package/compiled/zod/lib/helpers/typeAliases.d.ts +2 -0
- package/compiled/zod/lib/helpers/util.d.ts +47 -0
- package/compiled/zod/lib/index.d.ts +4 -0
- package/compiled/zod/lib/locales/en.d.ts +3 -0
- package/compiled/zod/lib/types.d.ts +975 -0
- package/compiled/zod/package.json +1 -0
- package/dist/BaseGenerator/BaseGenerator.d.ts +3 -3
- package/dist/BaseGenerator/BaseGenerator.js +78 -54
- package/dist/BaseGenerator/generateFile.d.ts +2 -1
- package/dist/BaseGenerator/generateFile.js +49 -22
- package/dist/Generator/Generator.d.ts +18 -14
- package/dist/Generator/Generator.js +97 -70
- package/dist/aliasUtils/getAliasValue.d.ts +4 -0
- package/dist/aliasUtils/getAliasValue.js +66 -0
- package/dist/aliasUtils/index.d.ts +2 -0
- package/dist/aliasUtils/index.js +32 -0
- package/dist/aliasUtils/parseCircleAlias.d.ts +4 -0
- package/dist/aliasUtils/parseCircleAlias.js +66 -0
- package/dist/getCorejsVersion.d.ts +1 -0
- package/dist/getCorejsVersion.js +35 -0
- package/dist/getDevBanner.d.ts +5 -0
- package/dist/getDevBanner.js +81 -0
- package/dist/getFileGitIno.d.ts +47 -0
- package/dist/getFileGitIno.js +130 -0
- package/dist/getGitInfo.d.ts +6 -0
- package/dist/getGitInfo.js +50 -0
- package/dist/importLazy.js +42 -14
- package/dist/index.d.ts +26 -3
- package/dist/index.js +185 -86
- package/dist/installDeps.js +69 -37
- package/dist/isJavaScriptFile.d.ts +1 -0
- package/dist/isJavaScriptFile.js +32 -0
- package/dist/isLocalDev.d.ts +4 -0
- package/dist/isLocalDev.js +36 -0
- package/dist/isMonorepo.d.ts +5 -0
- package/dist/isMonorepo.js +44 -0
- package/dist/isStyleFile.d.ts +5 -0
- package/dist/isStyleFile.js +44 -0
- package/dist/logger.d.ts +13 -6
- package/dist/logger.js +166 -25
- package/dist/node.d.ts +4 -0
- package/dist/node.js +61 -0
- package/dist/npmClient.d.ts +3 -2
- package/dist/npmClient.js +86 -40
- package/dist/printHelp.d.ts +2 -0
- package/dist/printHelp.js +64 -0
- package/dist/randomColor/randomColor.js +47 -16
- package/dist/readDirFiles.d.ts +9 -0
- package/dist/readDirFiles.js +62 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +75 -38
- package/dist/setNoDeprecation.d.ts +1 -0
- package/dist/setNoDeprecation.js +31 -0
- package/dist/tryPaths.d.ts +1 -0
- package/dist/tryPaths.js +35 -0
- package/dist/updatePackageJSON.js +50 -19
- package/dist/winPath.js +33 -9
- package/dist/zod/isZodSchema.d.ts +2 -0
- package/dist/zod/isZodSchema.js +31 -0
- package/package.json +60 -34
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCorejsVersion: (pkgPath: string) => any;
|
|
@@ -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/getCorejsVersion.ts
|
|
20
|
+
var getCorejsVersion_exports = {};
|
|
21
|
+
__export(getCorejsVersion_exports, {
|
|
22
|
+
getCorejsVersion: () => getCorejsVersion
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getCorejsVersion_exports);
|
|
25
|
+
var import_fs_extra = require("../compiled/fs-extra");
|
|
26
|
+
var getCorejsVersion = (pkgPath) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const pkg = (0, import_fs_extra.readJsonSync)(pkgPath, { encoding: "utf-8" });
|
|
29
|
+
const version = ((_a = pkg.dependencies["core-js"]) == null ? void 0 : _a.split(".").slice(0, 2).join(".")) || "3";
|
|
30
|
+
return version;
|
|
31
|
+
};
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
getCorejsVersion
|
|
35
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
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/getDevBanner.ts
|
|
30
|
+
var getDevBanner_exports = {};
|
|
31
|
+
__export(getDevBanner_exports, {
|
|
32
|
+
getDevBanner: () => getDevBanner
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(getDevBanner_exports);
|
|
35
|
+
var import_address = __toESM(require("../compiled/address"));
|
|
36
|
+
var import_chalk = __toESM(require("../compiled/chalk"));
|
|
37
|
+
var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
|
|
38
|
+
var BORDERS = {
|
|
39
|
+
TL: import_chalk.default.gray.dim("╔"),
|
|
40
|
+
TR: import_chalk.default.gray.dim("╗"),
|
|
41
|
+
BL: import_chalk.default.gray.dim("╚"),
|
|
42
|
+
BR: import_chalk.default.gray.dim("╝"),
|
|
43
|
+
V: import_chalk.default.gray.dim("║"),
|
|
44
|
+
H_PURE: "═"
|
|
45
|
+
};
|
|
46
|
+
function getDevBanner(protocol, host = "0.0.0.0", port, offset = 8) {
|
|
47
|
+
const header = " App listening at:";
|
|
48
|
+
const footer = import_chalk.default.bold(
|
|
49
|
+
" Now you can open browser with the above addresses↑ "
|
|
50
|
+
);
|
|
51
|
+
const local = ` ${import_chalk.default.gray(">")} Local: ${import_chalk.default.green(
|
|
52
|
+
`${protocol}//${host === "0.0.0.0" ? "localhost" : host}:${port}`
|
|
53
|
+
)} `;
|
|
54
|
+
const ip = import_address.default.ip();
|
|
55
|
+
const network = ` ${import_chalk.default.gray(">")} Network: ${ip ? import_chalk.default.green(`${protocol}//${ip}:${port}`) : import_chalk.default.gray("Not available")} `;
|
|
56
|
+
const maxLen = Math.max(
|
|
57
|
+
...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length)
|
|
58
|
+
);
|
|
59
|
+
const beforeLines = [
|
|
60
|
+
`${BORDERS.TL}${import_chalk.default.gray.dim("".padStart(maxLen, BORDERS.H_PURE))}${BORDERS.TR}`,
|
|
61
|
+
`${BORDERS.V}${header}${"".padStart(maxLen - header.length)}${BORDERS.V}`,
|
|
62
|
+
`${BORDERS.V}${local}${"".padStart(maxLen - (0, import_strip_ansi.default)(local).length)}${BORDERS.V}`
|
|
63
|
+
];
|
|
64
|
+
const mainLine = `${BORDERS.V}${network}${"".padStart(
|
|
65
|
+
maxLen - (0, import_strip_ansi.default)(network).length
|
|
66
|
+
)}${BORDERS.V}`;
|
|
67
|
+
const afterLines = [
|
|
68
|
+
`${BORDERS.V}${"".padStart(maxLen)}${BORDERS.V}`,
|
|
69
|
+
`${BORDERS.V}${footer}${"".padStart(maxLen - (0, import_strip_ansi.default)(footer).length)}${BORDERS.V}`,
|
|
70
|
+
`${BORDERS.BL}${import_chalk.default.gray.dim("".padStart(maxLen, BORDERS.H_PURE))}${BORDERS.BR}`
|
|
71
|
+
];
|
|
72
|
+
return {
|
|
73
|
+
before: beforeLines.map((l) => l.padStart(l.length + offset)).join("\n"),
|
|
74
|
+
main: mainLine,
|
|
75
|
+
after: afterLines.map((l) => l.padStart(l.length + offset)).join("\n")
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
getDevBanner
|
|
81
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface ICreateInfo {
|
|
2
|
+
createTime?: string;
|
|
3
|
+
creator?: string;
|
|
4
|
+
creatorEmail?: string;
|
|
5
|
+
createSince?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IModifyInfo {
|
|
8
|
+
modifyTime?: string;
|
|
9
|
+
modifier?: string;
|
|
10
|
+
modifierEmail?: string;
|
|
11
|
+
modifySince?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 获取文件创建信息
|
|
15
|
+
* @param filePath 文件路径,绝对或相对 .git
|
|
16
|
+
* @param gitDirPath .git路径
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare const getFileCreateInfo: (filePath: string, gitDirPath?: string) => Promise<{
|
|
20
|
+
createTime: string | undefined;
|
|
21
|
+
creator: string | undefined;
|
|
22
|
+
creatorEmail: string | undefined;
|
|
23
|
+
createSince: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
createTime?: undefined;
|
|
26
|
+
creator?: undefined;
|
|
27
|
+
creatorEmail?: undefined;
|
|
28
|
+
createSince?: undefined;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* 获取文件最新修改信息
|
|
32
|
+
* @param filePath 文件路径,绝对或相对 .git
|
|
33
|
+
* @param gitDirPath .git路径
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const getFileLastModifyInfo: (filePath: string, gitDirPath?: string) => Promise<{
|
|
37
|
+
modifyTime: string | undefined;
|
|
38
|
+
modifier: string | undefined;
|
|
39
|
+
modifierEmail: string | undefined;
|
|
40
|
+
modifySince: string | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
modifyTime?: undefined;
|
|
43
|
+
modifier?: undefined;
|
|
44
|
+
modifierEmail?: undefined;
|
|
45
|
+
modifySince?: undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const isGitRepo: () => Promise<boolean>;
|
|
@@ -0,0 +1,130 @@
|
|
|
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/getFileGitIno.ts
|
|
30
|
+
var getFileGitIno_exports = {};
|
|
31
|
+
__export(getFileGitIno_exports, {
|
|
32
|
+
getFileCreateInfo: () => getFileCreateInfo,
|
|
33
|
+
getFileLastModifyInfo: () => getFileLastModifyInfo,
|
|
34
|
+
isGitRepo: () => isGitRepo
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(getFileGitIno_exports);
|
|
37
|
+
var import_cross_spawn = __toESM(require("../compiled/cross-spawn"));
|
|
38
|
+
var import_execa = require("../compiled/execa");
|
|
39
|
+
var promisifySpawn = (cmd, args, {
|
|
40
|
+
onlyOnce,
|
|
41
|
+
...rest
|
|
42
|
+
}) => new Promise((resolve, reject) => {
|
|
43
|
+
var _a;
|
|
44
|
+
const cp = (0, import_cross_spawn.default)(cmd, args, rest);
|
|
45
|
+
const error = [];
|
|
46
|
+
const stdout = [];
|
|
47
|
+
(_a = cp.stdout) == null ? void 0 : _a.on("data", (data) => {
|
|
48
|
+
stdout.push(data.toString());
|
|
49
|
+
if (onlyOnce) {
|
|
50
|
+
cp.kill("SIGKILL");
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
cp.on("error", (e) => {
|
|
54
|
+
error.push(e.toString());
|
|
55
|
+
});
|
|
56
|
+
cp.on("close", () => {
|
|
57
|
+
if (error.length) {
|
|
58
|
+
reject(error.join(""));
|
|
59
|
+
} else {
|
|
60
|
+
resolve(stdout);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
var getFileCreateInfo = async (filePath, gitDirPath) => {
|
|
65
|
+
try {
|
|
66
|
+
const info = await promisifySpawn(
|
|
67
|
+
"git",
|
|
68
|
+
// time|name|email|since
|
|
69
|
+
["log", "--reverse", "-1000000", "--pretty='%ad|%an|%ae|%ar'", filePath],
|
|
70
|
+
{
|
|
71
|
+
cwd: gitDirPath,
|
|
72
|
+
onlyOnce: true,
|
|
73
|
+
shell: true
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
if (info.length && info[0]) {
|
|
77
|
+
const firstCommit = info[0].slice(0, info[0].indexOf("\n")).split("|");
|
|
78
|
+
return {
|
|
79
|
+
createTime: firstCommit.at(0),
|
|
80
|
+
creator: firstCommit.at(1),
|
|
81
|
+
creatorEmail: firstCommit.at(2),
|
|
82
|
+
createSince: firstCommit.at(3)
|
|
83
|
+
};
|
|
84
|
+
} else {
|
|
85
|
+
return {};
|
|
86
|
+
}
|
|
87
|
+
} catch (err) {
|
|
88
|
+
throw new Error(`get file ${filePath} git info failed`);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var getFileLastModifyInfo = async (filePath, gitDirPath) => {
|
|
92
|
+
try {
|
|
93
|
+
const info = await promisifySpawn(
|
|
94
|
+
"git",
|
|
95
|
+
["log", "-1", "--pretty='%ad|%an|%ae|%ar'", filePath],
|
|
96
|
+
{
|
|
97
|
+
cwd: gitDirPath,
|
|
98
|
+
onlyOnce: true,
|
|
99
|
+
shell: true
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
if (info.length && info[0]) {
|
|
103
|
+
const firstCommit = info[0].slice(0, info[0].indexOf("\n")).split("|");
|
|
104
|
+
return {
|
|
105
|
+
modifyTime: firstCommit.at(0),
|
|
106
|
+
modifier: firstCommit.at(1),
|
|
107
|
+
modifierEmail: firstCommit.at(2),
|
|
108
|
+
modifySince: firstCommit.at(3)
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
return {};
|
|
112
|
+
}
|
|
113
|
+
} catch (err) {
|
|
114
|
+
throw new Error(`get file ${filePath} git info failed`);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var isGitRepo = async () => {
|
|
118
|
+
try {
|
|
119
|
+
const res = await (0, import_execa.execa)("git", ["rev-parse", "--is-inside-work-tree"]);
|
|
120
|
+
return res.stdout.includes("true");
|
|
121
|
+
} catch (e) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
getFileCreateInfo,
|
|
128
|
+
getFileLastModifyInfo,
|
|
129
|
+
isGitRepo
|
|
130
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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/getGitInfo.ts
|
|
30
|
+
var getGitInfo_exports = {};
|
|
31
|
+
__export(getGitInfo_exports, {
|
|
32
|
+
default: () => getGitInfo_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(getGitInfo_exports);
|
|
35
|
+
var execa = __toESM(require("../compiled/execa"));
|
|
36
|
+
var getGitInfo = async () => {
|
|
37
|
+
try {
|
|
38
|
+
const [{ stdout: username }, { stdout: email }] = await Promise.all([
|
|
39
|
+
execa.execaCommand("git config --global user.name"),
|
|
40
|
+
execa.execaCommand("git config --global user.email")
|
|
41
|
+
]);
|
|
42
|
+
return { username, email };
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return {
|
|
45
|
+
username: "",
|
|
46
|
+
email: ""
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var getGitInfo_default = getGitInfo;
|
package/dist/importLazy.js
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
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 });
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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/importLazy.ts
|
|
30
|
+
var importLazy_exports = {};
|
|
31
|
+
__export(importLazy_exports, {
|
|
32
|
+
importLazy: () => importLazy
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(importLazy_exports);
|
|
35
|
+
var import_import_lazy = __toESM(require("../compiled/import-lazy"));
|
|
13
36
|
function importLazy(moduleName, requireFn) {
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
const importLazyLocal = (0, import_import_lazy.default)(
|
|
38
|
+
requireFn || require
|
|
39
|
+
);
|
|
40
|
+
return importLazyLocal(moduleName);
|
|
16
41
|
}
|
|
17
|
-
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
importLazy
|
|
45
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as chokidar from 'chokidar';
|
|
2
|
-
import * as
|
|
2
|
+
import * as clackPrompts from '../compiled/@clack/prompts';
|
|
3
3
|
import address from '../compiled/address';
|
|
4
4
|
import axios from '../compiled/axios';
|
|
5
5
|
import chalk from '../compiled/chalk';
|
|
@@ -7,27 +7,50 @@ import cheerio from '../compiled/cheerio';
|
|
|
7
7
|
import crossSpawn from '../compiled/cross-spawn';
|
|
8
8
|
import debug from '../compiled/debug';
|
|
9
9
|
import deepmerge from '../compiled/deepmerge';
|
|
10
|
+
import * as execa from '../compiled/execa';
|
|
10
11
|
import fsExtra from '../compiled/fs-extra';
|
|
11
12
|
import glob from '../compiled/glob';
|
|
13
|
+
import remapping from '../compiled/@ampproject/remapping';
|
|
14
|
+
import * as fastestLevenshtein from '../compiled/fastest-levenshtein';
|
|
15
|
+
import * as filesize from '../compiled/filesize';
|
|
16
|
+
import * as gzipSize from '../compiled/gzip-size';
|
|
12
17
|
import lodash from '../compiled/lodash';
|
|
18
|
+
import MagicString from '../compiled/magic-string';
|
|
13
19
|
import Mustache from '../compiled/mustache';
|
|
14
|
-
import pkgUp from '../compiled/pkg-up';
|
|
20
|
+
import * as pkgUp from '../compiled/pkg-up';
|
|
15
21
|
import portfinder from '../compiled/portfinder';
|
|
16
22
|
import prompts from '../compiled/prompts';
|
|
17
23
|
import resolve from '../compiled/resolve';
|
|
18
24
|
import rimraf from '../compiled/rimraf';
|
|
19
25
|
import semver from '../compiled/semver';
|
|
20
26
|
import stripAnsi from '../compiled/strip-ansi';
|
|
27
|
+
import * as tsconfigPaths from '../compiled/tsconfig-paths';
|
|
21
28
|
import yParser from '../compiled/yargs-parser';
|
|
29
|
+
import { z } from '../compiled/zod';
|
|
22
30
|
import BaseGenerator from './BaseGenerator/BaseGenerator';
|
|
23
31
|
import generateFile from './BaseGenerator/generateFile';
|
|
24
32
|
import Generator from './Generator/Generator';
|
|
33
|
+
import getGitInfo from './getGitInfo';
|
|
25
34
|
import installDeps from './installDeps';
|
|
26
35
|
import * as logger from './logger';
|
|
36
|
+
import * as printHelp from './printHelp';
|
|
27
37
|
import updatePackageJSON from './updatePackageJSON';
|
|
38
|
+
export * as aliasUtils from './aliasUtils';
|
|
39
|
+
export * from './getCorejsVersion';
|
|
40
|
+
export * from './getDevBanner';
|
|
41
|
+
export * as git from './getFileGitIno';
|
|
28
42
|
export * from './importLazy';
|
|
43
|
+
export * from './isJavaScriptFile';
|
|
44
|
+
export * from './isLocalDev';
|
|
45
|
+
export * from './isMonorepo';
|
|
46
|
+
export * from './isStyleFile';
|
|
47
|
+
export * from './node';
|
|
29
48
|
export * from './npmClient';
|
|
30
49
|
export * from './randomColor/randomColor';
|
|
50
|
+
export * from './readDirFiles';
|
|
31
51
|
export * as register from './register';
|
|
52
|
+
export * from './setNoDeprecation';
|
|
53
|
+
export * from './tryPaths';
|
|
32
54
|
export * from './winPath';
|
|
33
|
-
export
|
|
55
|
+
export * from './zod/isZodSchema';
|
|
56
|
+
export { address, axios, chalk, cheerio, chokidar, crossSpawn, debug, deepmerge, execa, fsExtra, glob, Generator, BaseGenerator, generateFile, installDeps, lodash, logger, Mustache, pkgUp, portfinder, prompts, resolve, rimraf, semver, stripAnsi, updatePackageJSON, yParser, getGitInfo, printHelp, filesize, gzipSize, fastestLevenshtein, clackPrompts, MagicString, remapping, tsconfigPaths, z as zod, };
|