@modern-js/generator-utils 3.0.0-beta.2 → 3.0.0-beta.4
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/CHANGELOG.md +62 -0
- package/dist/js/modern/index.js +165 -108
- package/dist/js/modern/locale/en.js +7 -8
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +7 -8
- package/dist/js/modern/utils/index.js +1 -1
- package/dist/js/modern/utils/package.js +73 -55
- package/dist/js/modern/utils/strip-ansi.js +13 -9
- package/dist/js/node/index.js +167 -219
- package/dist/js/node/locale/en.js +23 -12
- package/dist/js/node/locale/index.js +27 -15
- package/dist/js/node/locale/zh.js +23 -12
- package/dist/js/node/utils/index.js +18 -27
- package/dist/js/node/utils/package.js +92 -63
- package/dist/js/node/utils/strip-ansi.js +30 -13
- package/dist/types/utils/package.d.ts +1 -0
- package/package.json +7 -7
package/dist/js/node/index.js
CHANGED
|
@@ -1,264 +1,212 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
getPackageManagerText: true,
|
|
11
|
-
isTsProject: true,
|
|
12
|
-
getPackageObj: true,
|
|
13
|
-
getAllPackages: true,
|
|
14
|
-
validatePackageName: true,
|
|
15
|
-
validatePackagePath: true,
|
|
16
|
-
getModuleProjectPath: true,
|
|
17
|
-
getMWAProjectPath: true,
|
|
18
|
-
ora: true,
|
|
19
|
-
fs: true,
|
|
20
|
-
semver: true,
|
|
21
|
-
execa: true,
|
|
22
|
-
readTsConfigByFile: true,
|
|
23
|
-
getPackageManager: true,
|
|
24
|
-
canUseNpm: true,
|
|
25
|
-
canUsePnpm: true,
|
|
26
|
-
canUseYarn: true,
|
|
27
|
-
isReact18: true,
|
|
28
|
-
i18n: true
|
|
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 });
|
|
29
10
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "canUsePnpm", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _utils.canUsePnpm;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "canUseYarn", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _utils.canUseYarn;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "execa", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _utils.execa;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "fs", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _utils.fs;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
exports.getAllPackages = getAllPackages;
|
|
61
|
-
exports.getMWAProjectPath = getMWAProjectPath;
|
|
62
|
-
exports.getModernPluginVersion = getModernPluginVersion;
|
|
63
|
-
exports.getModernVersion = getModernVersion;
|
|
64
|
-
exports.getModuleProjectPath = getModuleProjectPath;
|
|
65
|
-
Object.defineProperty(exports, "getPackageManager", {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _utils.getPackageManager;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
exports.getPackageManagerText = getPackageManagerText;
|
|
72
|
-
exports.getPackageObj = getPackageObj;
|
|
73
|
-
exports.getPackageVersion = getPackageVersion;
|
|
74
|
-
Object.defineProperty(exports, "i18n", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function () {
|
|
77
|
-
return _locale.i18n;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "isReact18", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
get: function () {
|
|
83
|
-
return _utils.isReact18;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
exports.isTsProject = isTsProject;
|
|
87
|
-
Object.defineProperty(exports, "ora", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () {
|
|
90
|
-
return _utils.ora;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(exports, "readTsConfigByFile", {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
get: function () {
|
|
96
|
-
return _utils.readTsConfigByFile;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
Object.defineProperty(exports, "semver", {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
get: function () {
|
|
102
|
-
return _utils.semver;
|
|
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 });
|
|
103
16
|
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var stdin_exports = {};
|
|
26
|
+
__export(stdin_exports, {
|
|
27
|
+
canUseNpm: () => import_utils2.canUseNpm,
|
|
28
|
+
canUsePnpm: () => import_utils2.canUsePnpm,
|
|
29
|
+
canUseYarn: () => import_utils2.canUseYarn,
|
|
30
|
+
execa: () => import_utils2.execa,
|
|
31
|
+
fs: () => import_utils2.fs,
|
|
32
|
+
getAllPackages: () => getAllPackages,
|
|
33
|
+
getMWAProjectPath: () => getMWAProjectPath,
|
|
34
|
+
getModernPluginVersion: () => getModernPluginVersion,
|
|
35
|
+
getModernVersion: () => getModernVersion,
|
|
36
|
+
getModuleProjectPath: () => getModuleProjectPath,
|
|
37
|
+
getPackageManager: () => import_utils2.getPackageManager,
|
|
38
|
+
getPackageManagerText: () => getPackageManagerText,
|
|
39
|
+
getPackageObj: () => getPackageObj,
|
|
40
|
+
getPackageVersion: () => getPackageVersion,
|
|
41
|
+
i18n: () => import_locale2.i18n,
|
|
42
|
+
isReact18: () => import_utils2.isReact18,
|
|
43
|
+
isTsProject: () => isTsProject,
|
|
44
|
+
ora: () => import_utils2.ora,
|
|
45
|
+
readTsConfigByFile: () => import_utils2.readTsConfigByFile,
|
|
46
|
+
semver: () => import_utils2.semver,
|
|
47
|
+
validatePackageName: () => validatePackageName,
|
|
48
|
+
validatePackagePath: () => validatePackagePath
|
|
104
49
|
});
|
|
105
|
-
exports
|
|
106
|
-
|
|
107
|
-
var
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
50
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
51
|
+
var import_path = __toESM(require("path"));
|
|
52
|
+
var import_utils = require("@modern-js/utils");
|
|
53
|
+
var import_generator_common = require("@modern-js/generator-common");
|
|
54
|
+
var import_strip_ansi = require("./utils/strip-ansi");
|
|
55
|
+
var import_locale = require("./locale");
|
|
56
|
+
var import_package = require("./utils/package");
|
|
57
|
+
__reExport(stdin_exports, require("./utils"), module.exports);
|
|
58
|
+
var import_utils2 = require("@modern-js/utils");
|
|
59
|
+
var import_locale2 = require("./locale");
|
|
60
|
+
var __async = (__this, __arguments, generator) => {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
var fulfilled = (value) => {
|
|
63
|
+
try {
|
|
64
|
+
step(generator.next(value));
|
|
65
|
+
} catch (e) {
|
|
66
|
+
reject(e);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var rejected = (value) => {
|
|
70
|
+
try {
|
|
71
|
+
step(generator.throw(value));
|
|
72
|
+
} catch (e) {
|
|
73
|
+
reject(e);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
77
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
123
78
|
});
|
|
124
|
-
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
79
|
+
};
|
|
80
|
+
function getPackageVersion(packageName, registry) {
|
|
81
|
+
return __async(this, null, function* () {
|
|
82
|
+
const spinner = (0, import_utils.ora)({
|
|
83
|
+
text: "Load Generator...",
|
|
84
|
+
spinner: "runner"
|
|
85
|
+
}).start();
|
|
86
|
+
if (yield (0, import_utils.canUsePnpm)()) {
|
|
87
|
+
const args = ["info", packageName, "version"];
|
|
88
|
+
if (registry) {
|
|
89
|
+
args.push(`--registry=${registry}`);
|
|
90
|
+
}
|
|
91
|
+
const result = yield (0, import_utils.execa)("pnpm", args);
|
|
92
|
+
spinner.stop();
|
|
93
|
+
return (0, import_strip_ansi.stripAnsi)(result.stdout);
|
|
135
94
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
95
|
+
if (yield (0, import_utils.canUseYarn)()) {
|
|
96
|
+
const args = ["info", packageName, "version", "--silent"];
|
|
97
|
+
if (registry) {
|
|
98
|
+
args.push(`--registry=${registry}`);
|
|
99
|
+
}
|
|
100
|
+
const result = yield (0, import_utils.execa)("yarn", args);
|
|
101
|
+
spinner.stop();
|
|
102
|
+
return (0, import_strip_ansi.stripAnsi)(result.stdout);
|
|
144
103
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
104
|
+
if (yield (0, import_utils.canUseNpm)()) {
|
|
105
|
+
const args = ["view", packageName, "version"];
|
|
106
|
+
if (registry) {
|
|
107
|
+
args.push(`--registry=${registry}`);
|
|
108
|
+
}
|
|
109
|
+
const result = yield (0, import_utils.execa)("npm", args);
|
|
110
|
+
spinner.stop();
|
|
111
|
+
return (0, import_strip_ansi.stripAnsi)(result.stdout);
|
|
153
112
|
}
|
|
154
|
-
const result = await (0, _utils.execa)('npm', args);
|
|
155
113
|
spinner.stop();
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
spinner.stop();
|
|
159
|
-
throw new Error('not found npm, please install npm before');
|
|
114
|
+
throw new Error("not found npm, please install npm before");
|
|
115
|
+
});
|
|
160
116
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
117
|
+
function getModernVersion(solution, registry, distTag = "latest") {
|
|
118
|
+
return __async(this, null, function* () {
|
|
119
|
+
const dep = import_generator_common.SolutionToolsMap[solution];
|
|
120
|
+
const modernVersion = yield getPackageVersion(`${dep}@${distTag}`, registry);
|
|
121
|
+
return modernVersion;
|
|
122
|
+
});
|
|
165
123
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
cwd = process.cwd(),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
// get project solution version
|
|
182
|
-
const pkgPath = _path.default.join(require.resolve(_generatorCommon.SolutionToolsMap[solution], {
|
|
183
|
-
paths: [cwd]
|
|
184
|
-
}), '../../../../', 'package.json');
|
|
185
|
-
if (_utils.fs.existsSync(pkgPath)) {
|
|
186
|
-
const pkgInfo = _utils.fs.readJSONSync(pkgPath);
|
|
187
|
-
const modernVersion = pkgInfo.version;
|
|
188
|
-
if (typeof modernVersion !== 'string') {
|
|
189
|
-
return getLatetPluginVersion();
|
|
124
|
+
function getModernPluginVersion(_0, _1) {
|
|
125
|
+
return __async(this, arguments, function* (solution, packageName, options = {
|
|
126
|
+
distTag: "latest"
|
|
127
|
+
}) {
|
|
128
|
+
const { cwd = process.cwd(), registry, distTag } = options;
|
|
129
|
+
const getLatetPluginVersion = (tag) => __async(this, null, function* () {
|
|
130
|
+
const version = yield getPackageVersion(
|
|
131
|
+
`${packageName}@${tag || distTag || "latest"}`,
|
|
132
|
+
registry
|
|
133
|
+
);
|
|
134
|
+
return version;
|
|
135
|
+
});
|
|
136
|
+
if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
|
|
137
|
+
return getLatetPluginVersion("latest");
|
|
190
138
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
139
|
+
const pkgPath = import_path.default.join(
|
|
140
|
+
require.resolve(import_generator_common.SolutionToolsMap[solution], { paths: [cwd] }),
|
|
141
|
+
"../../../../",
|
|
142
|
+
"package.json"
|
|
143
|
+
);
|
|
144
|
+
if (import_utils.fs.existsSync(pkgPath)) {
|
|
145
|
+
const pkgInfo = import_utils.fs.readJSONSync(pkgPath);
|
|
146
|
+
const modernVersion = pkgInfo.version;
|
|
147
|
+
if (typeof modernVersion !== "string") {
|
|
148
|
+
return getLatetPluginVersion();
|
|
149
|
+
}
|
|
150
|
+
return (0, import_package.getAvailableVersion)(packageName, modernVersion, registry);
|
|
151
|
+
}
|
|
152
|
+
return getLatetPluginVersion();
|
|
153
|
+
});
|
|
194
154
|
}
|
|
195
155
|
function getPackageManagerText(packageManager) {
|
|
196
|
-
return packageManager ===
|
|
156
|
+
return packageManager === "yarn" ? "yarn" : `${packageManager} run`;
|
|
197
157
|
}
|
|
198
158
|
function isTsProject(appDir) {
|
|
199
|
-
return
|
|
159
|
+
return import_utils.fs.existsSync(import_path.default.join(appDir, "tsconfig.json"));
|
|
200
160
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
161
|
+
function getPackageObj(context) {
|
|
162
|
+
return __async(this, null, function* () {
|
|
163
|
+
const pkgStr = (yield context.materials.default.get(`package.json`).value()).content;
|
|
164
|
+
return JSON.parse(pkgStr);
|
|
165
|
+
});
|
|
204
166
|
}
|
|
205
167
|
function getAllPackages(appDir) {
|
|
206
|
-
const packages = (0,
|
|
207
|
-
return packages.map(pkg => pkg.name);
|
|
168
|
+
const packages = (0, import_utils.getMonorepoPackages)(appDir);
|
|
169
|
+
return packages.map((pkg) => pkg.name);
|
|
208
170
|
}
|
|
209
171
|
function validatePackageName(value, packages, options) {
|
|
210
|
-
const {
|
|
211
|
-
isMonorepoSubProject
|
|
212
|
-
} = options;
|
|
172
|
+
const { isMonorepoSubProject } = options;
|
|
213
173
|
if (isMonorepoSubProject && packages.includes(value)) {
|
|
214
174
|
return {
|
|
215
175
|
success: false,
|
|
216
|
-
error:
|
|
217
|
-
value
|
|
218
|
-
})
|
|
176
|
+
error: import_locale.i18n.t(import_locale.localeKeys.packageName.exit, { value })
|
|
219
177
|
};
|
|
220
178
|
}
|
|
221
|
-
return {
|
|
222
|
-
success: true
|
|
223
|
-
};
|
|
179
|
+
return { success: true };
|
|
224
180
|
}
|
|
225
181
|
function validatePackagePath(value, projectDir, options) {
|
|
226
|
-
const {
|
|
227
|
-
|
|
228
|
-
isPublic,
|
|
229
|
-
isTest
|
|
230
|
-
} = options || {};
|
|
231
|
-
let dir = 'apps';
|
|
182
|
+
const { isMwa, isPublic, isTest } = options || {};
|
|
183
|
+
let dir = "apps";
|
|
232
184
|
if (isMwa && isTest) {
|
|
233
|
-
dir =
|
|
185
|
+
dir = "examples";
|
|
234
186
|
} else {
|
|
235
|
-
dir = isPublic ?
|
|
187
|
+
dir = isPublic ? "packages" : "features";
|
|
236
188
|
}
|
|
237
|
-
const packageDir =
|
|
238
|
-
if (
|
|
189
|
+
const packageDir = import_path.default.resolve(projectDir || "", dir, value);
|
|
190
|
+
if (import_utils.fs.existsSync(packageDir)) {
|
|
239
191
|
return {
|
|
240
192
|
success: false,
|
|
241
|
-
error:
|
|
242
|
-
value
|
|
243
|
-
})
|
|
193
|
+
error: import_locale.i18n.t(import_locale.localeKeys.packagePath.exit, { value })
|
|
244
194
|
};
|
|
245
195
|
}
|
|
246
|
-
return {
|
|
247
|
-
success: true
|
|
248
|
-
};
|
|
196
|
+
return { success: true };
|
|
249
197
|
}
|
|
250
198
|
function getModuleProjectPath(packagePath, isMonorepoSubProject, isPublic, isLocalPackages) {
|
|
251
199
|
if (isLocalPackages && packagePath) {
|
|
252
200
|
return `${packagePath}/`;
|
|
253
201
|
}
|
|
254
202
|
if (isMonorepoSubProject && packagePath) {
|
|
255
|
-
return `${isPublic ?
|
|
203
|
+
return `${isPublic ? "packages" : "features"}/${packagePath}/`;
|
|
256
204
|
}
|
|
257
|
-
return
|
|
205
|
+
return "";
|
|
258
206
|
}
|
|
259
207
|
function getMWAProjectPath(packagePath, isMonorepoSubProject, isTest = false) {
|
|
260
208
|
if (isMonorepoSubProject && packagePath) {
|
|
261
|
-
return `${isTest ?
|
|
209
|
+
return `${isTest ? "examples" : "apps"}/${packagePath}/`;
|
|
262
210
|
}
|
|
263
|
-
return
|
|
264
|
-
}
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
EN_LOCALE: () => EN_LOCALE
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
7
23
|
const EN_LOCALE = {
|
|
8
|
-
packageName: {
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
packagePath: {
|
|
12
|
-
exit: 'package path {value} is already exists'
|
|
13
|
-
}
|
|
24
|
+
packageName: { exit: "package name `{value}` is already exists" },
|
|
25
|
+
packagePath: { exit: "package path {value} is already exists" }
|
|
14
26
|
};
|
|
15
|
-
exports.EN_LOCALE = EN_LOCALE;
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
i18n: () => i18n,
|
|
21
|
+
localeKeys: () => localeKeys
|
|
5
22
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
const i18n = new
|
|
11
|
-
|
|
12
|
-
const localeKeys = i18n.init('zh', {
|
|
13
|
-
zh: _zh.ZH_LOCALE,
|
|
14
|
-
en: _en.EN_LOCALE
|
|
15
|
-
});
|
|
16
|
-
exports.localeKeys = localeKeys;
|
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
+
var import_plugin_i18n = require("@modern-js/plugin-i18n");
|
|
25
|
+
var import_zh = require("./zh");
|
|
26
|
+
var import_en = require("./en");
|
|
27
|
+
const i18n = new import_plugin_i18n.I18n();
|
|
28
|
+
const localeKeys = i18n.init("zh", { zh: import_zh.ZH_LOCALE, en: import_en.EN_LOCALE });
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
ZH_LOCALE: () => ZH_LOCALE
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
7
23
|
const ZH_LOCALE = {
|
|
8
|
-
packageName: {
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
packagePath: {
|
|
12
|
-
exit: '目录 {value} 已存在'
|
|
13
|
-
}
|
|
24
|
+
packageName: { exit: "项目名称 {value} 已存在" },
|
|
25
|
+
packagePath: { exit: "目录 {value} 已存在" }
|
|
14
26
|
};
|
|
15
|
-
exports.ZH_LOCALE = ZH_LOCALE;
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _package[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _package[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var stdin_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
17
|
+
__reExport(stdin_exports, require("./strip-ansi"), module.exports);
|
|
18
|
+
__reExport(stdin_exports, require("./package"), module.exports);
|