@modern-js/generator-utils 3.0.0-beta.3 → 3.0.0-beta.5

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