@modern-js/server-generator 3.4.15 → 3.4.17

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.
Files changed (3) hide show
  1. package/dist/index.js +805 -775
  2. package/package.json +10 -10
  3. package/src/index.ts +9 -11
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __commonJS = (cb, mod) => function __require() {
9
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
13
  };
@@ -207,7 +210,7 @@ var require_package = __commonJS({
207
210
  var require_ejs = __commonJS({
208
211
  "../../../../node_modules/.pnpm/ejs@3.1.9/node_modules/ejs/lib/ejs.js"(exports) {
209
212
  "use strict";
210
- var fs8 = require("fs");
213
+ var fs7 = require("fs");
211
214
  var path7 = require("path");
212
215
  var utils = require_utils();
213
216
  var scopeOptionWarned = false;
@@ -235,7 +238,7 @@ var require_ejs = __commonJS({
235
238
  var _BOM = /^\uFEFF/;
236
239
  var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
237
240
  exports.cache = utils.cache;
238
- exports.fileLoader = fs8.readFileSync;
241
+ exports.fileLoader = fs7.readFileSync;
239
242
  exports.localsName = _DEFAULT_LOCALS_NAME;
240
243
  exports.promiseImpl = new Function("return this;")().Promise;
241
244
  exports.resolveInclude = function(name, filename, isDir) {
@@ -253,7 +256,7 @@ var require_ejs = __commonJS({
253
256
  var filePath;
254
257
  if (paths.some(function(v) {
255
258
  filePath = exports.resolveInclude(name, v, true);
256
- return fs8.existsSync(filePath);
259
+ return fs7.existsSync(filePath);
257
260
  })) {
258
261
  return filePath;
259
262
  }
@@ -273,7 +276,7 @@ var require_ejs = __commonJS({
273
276
  } else {
274
277
  if (options.filename) {
275
278
  filePath = exports.resolveInclude(path8, options.filename);
276
- if (fs8.existsSync(filePath)) {
279
+ if (fs7.existsSync(filePath)) {
277
280
  includePath = filePath;
278
281
  }
279
282
  }
@@ -1569,15 +1572,15 @@ var require_runtime = __commonJS({
1569
1572
  throw new _exception2["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (" + compilerInfo[1] + ").");
1570
1573
  }
1571
1574
  }
1572
- function template(templateSpec, env) {
1573
- if (!env) {
1575
+ function template(templateSpec, env2) {
1576
+ if (!env2) {
1574
1577
  throw new _exception2["default"]("No environment passed to template");
1575
1578
  }
1576
1579
  if (!templateSpec || !templateSpec.main) {
1577
1580
  throw new _exception2["default"]("Unknown template object: " + typeof templateSpec);
1578
1581
  }
1579
1582
  templateSpec.main.decorator = templateSpec.main_d;
1580
- env.VM.checkRevision(templateSpec.compiler);
1583
+ env2.VM.checkRevision(templateSpec.compiler);
1581
1584
  var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7;
1582
1585
  function invokePartialWrapper(partial, context, options) {
1583
1586
  if (options.hash) {
@@ -1586,14 +1589,14 @@ var require_runtime = __commonJS({
1586
1589
  options.ids[0] = true;
1587
1590
  }
1588
1591
  }
1589
- partial = env.VM.resolvePartial.call(this, partial, context, options);
1592
+ partial = env2.VM.resolvePartial.call(this, partial, context, options);
1590
1593
  var extendedOptions = Utils.extend({}, options, {
1591
1594
  hooks: this.hooks,
1592
1595
  protoAccessControl: this.protoAccessControl
1593
1596
  });
1594
- var result = env.VM.invokePartial.call(this, partial, context, extendedOptions);
1595
- if (result == null && env.compile) {
1596
- options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
1597
+ var result = env2.VM.invokePartial.call(this, partial, context, extendedOptions);
1598
+ if (result == null && env2.compile) {
1599
+ options.partials[options.name] = env2.compile(partial, templateSpec.compilerOptions, env2);
1597
1600
  result = options.partials[options.name](context, extendedOptions);
1598
1601
  }
1599
1602
  if (result != null) {
@@ -1678,7 +1681,7 @@ var require_runtime = __commonJS({
1678
1681
  },
1679
1682
  // An empty object to use as replacement for null-contexts
1680
1683
  nullContext: Object.seal({}),
1681
- noop: env.VM.noop,
1684
+ noop: env2.VM.noop,
1682
1685
  compilerInfo: templateSpec.compiler
1683
1686
  };
1684
1687
  function ret(context) {
@@ -1705,14 +1708,14 @@ var require_runtime = __commonJS({
1705
1708
  ret.isTop = true;
1706
1709
  ret._setup = function(options) {
1707
1710
  if (!options.partial) {
1708
- var mergedHelpers = Utils.extend({}, env.helpers, options.helpers);
1711
+ var mergedHelpers = Utils.extend({}, env2.helpers, options.helpers);
1709
1712
  wrapHelpersToPassLookupProperty(mergedHelpers, container);
1710
1713
  container.helpers = mergedHelpers;
1711
1714
  if (templateSpec.usePartial) {
1712
- container.partials = container.mergeIfNeeded(options.partials, env.partials);
1715
+ container.partials = container.mergeIfNeeded(options.partials, env2.partials);
1713
1716
  }
1714
1717
  if (templateSpec.usePartial || templateSpec.useDecorators) {
1715
- container.decorators = Utils.extend({}, env.decorators, options.decorators);
1718
+ container.decorators = Utils.extend({}, env2.decorators, options.decorators);
1716
1719
  }
1717
1720
  container.hooks = {};
1718
1721
  container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options);
@@ -3514,7 +3517,7 @@ var require_compiler = __commonJS({
3514
3517
  }
3515
3518
  }
3516
3519
  };
3517
- function precompile(input, options, env) {
3520
+ function precompile(input, options, env2) {
3518
3521
  if (input == null || typeof input !== "string" && input.type !== "Program") {
3519
3522
  throw new _exception2["default"]("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
3520
3523
  }
@@ -3525,10 +3528,10 @@ var require_compiler = __commonJS({
3525
3528
  if (options.compat) {
3526
3529
  options.useDepths = true;
3527
3530
  }
3528
- var ast = env.parse(input, options), environment = new env.Compiler().compile(ast, options);
3529
- return new env.JavaScriptCompiler().compile(environment, options);
3531
+ var ast = env2.parse(input, options), environment = new env2.Compiler().compile(ast, options);
3532
+ return new env2.JavaScriptCompiler().compile(environment, options);
3530
3533
  }
3531
- function compile2(input, options, env) {
3534
+ function compile2(input, options, env2) {
3532
3535
  if (options === void 0)
3533
3536
  options = {};
3534
3537
  if (input == null || typeof input !== "string" && input.type !== "Program") {
@@ -3543,8 +3546,8 @@ var require_compiler = __commonJS({
3543
3546
  }
3544
3547
  var compiled = void 0;
3545
3548
  function compileInput() {
3546
- var ast = env.parse(input, options), environment = new env.Compiler().compile(ast, options), templateSpec = new env.JavaScriptCompiler().compile(environment, options, void 0, true);
3547
- return env.template(templateSpec);
3549
+ var ast = env2.parse(input, options), environment = new env2.Compiler().compile(ast, options), templateSpec = new env2.JavaScriptCompiler().compile(environment, options, void 0, true);
3550
+ return env2.template(templateSpec);
3548
3551
  }
3549
3552
  function ret(context, execOptions) {
3550
3553
  if (!compiled) {
@@ -6609,8 +6612,8 @@ var require_lib = __commonJS({
6609
6612
  handlebars2.print = printer.print;
6610
6613
  module2.exports = handlebars2;
6611
6614
  function extension(module3, filename) {
6612
- var fs8 = require("fs");
6613
- var templateString = fs8.readFileSync(filename, "utf8");
6615
+ var fs7 = require("fs");
6616
+ var templateString = fs7.readFileSync(filename, "utf8");
6614
6617
  module3.exports = handlebars2.compile(templateString);
6615
6618
  }
6616
6619
  if (typeof require !== "undefined" && require.extensions) {
@@ -6620,9 +6623,9 @@ var require_lib = __commonJS({
6620
6623
  }
6621
6624
  });
6622
6625
 
6623
- // ../../../../node_modules/.pnpm/@modern-js+utils@2.58.0/node_modules/@modern-js/utils/dist/compiled/chalk/index.js
6626
+ // ../../../../node_modules/.pnpm/@modern-js+utils@2.58.1/node_modules/@modern-js/utils/dist/compiled/chalk/index.js
6624
6627
  var require_chalk = __commonJS({
6625
- "../../../../node_modules/.pnpm/@modern-js+utils@2.58.0/node_modules/@modern-js/utils/dist/compiled/chalk/index.js"(exports, module2) {
6628
+ "../../../../node_modules/.pnpm/@modern-js+utils@2.58.1/node_modules/@modern-js/utils/dist/compiled/chalk/index.js"(exports, module2) {
6626
6629
  "use strict";
6627
6630
  (() => {
6628
6631
  var e = { 44: (e2, t2, n2) => {
@@ -7751,13 +7754,13 @@ var require_chalk = __commonJS({
7751
7754
  c = l.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(l.FORCE_COLOR, 10), 3);
7752
7755
  }
7753
7756
  }
7754
- function translateLevel(e3) {
7757
+ function translateLevel2(e3) {
7755
7758
  if (e3 === 0) {
7756
7759
  return false;
7757
7760
  }
7758
7761
  return { level: e3, hasBasic: true, has256: e3 >= 2, has16m: e3 >= 3 };
7759
7762
  }
7760
- function supportsColor(e3, t3) {
7763
+ function supportsColor2(e3, t3) {
7761
7764
  if (c === 0) {
7762
7765
  return 0;
7763
7766
  }
@@ -7814,10 +7817,10 @@ var require_chalk = __commonJS({
7814
7817
  return n3;
7815
7818
  }
7816
7819
  function getSupportLevel(e3) {
7817
- const t3 = supportsColor(e3, e3 && e3.isTTY);
7818
- return translateLevel(t3);
7820
+ const t3 = supportsColor2(e3, e3 && e3.isTTY);
7821
+ return translateLevel2(t3);
7819
7822
  }
7820
- e2.exports = { supportsColor: getSupportLevel, stdout: translateLevel(supportsColor(true, s.isatty(1))), stderr: translateLevel(supportsColor(true, s.isatty(2))) };
7823
+ e2.exports = { supportsColor: getSupportLevel, stdout: translateLevel2(supportsColor2(true, s.isatty(1))), stderr: translateLevel2(supportsColor2(true, s.isatty(2))) };
7821
7824
  }, 37: (e2) => {
7822
7825
  "use strict";
7823
7826
  e2.exports = require("os");
@@ -12743,7 +12746,7 @@ var require_innerFrom = __commonJS({
12743
12746
  exports.fromIterable = fromIterable;
12744
12747
  function fromAsyncIterable(asyncIterable) {
12745
12748
  return new Observable_1.Observable(function(subscriber) {
12746
- process2(asyncIterable, subscriber).catch(function(err) {
12749
+ process3(asyncIterable, subscriber).catch(function(err) {
12747
12750
  return subscriber.error(err);
12748
12751
  });
12749
12752
  });
@@ -12753,7 +12756,7 @@ var require_innerFrom = __commonJS({
12753
12756
  return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
12754
12757
  }
12755
12758
  exports.fromReadableStreamLike = fromReadableStreamLike;
12756
- function process2(asyncIterable, subscriber) {
12759
+ function process3(asyncIterable, subscriber) {
12757
12760
  var asyncIterable_1, asyncIterable_1_1;
12758
12761
  var e_2, _a2;
12759
12762
  return __awaiter6(this, void 0, void 0, function() {
@@ -20034,11 +20037,11 @@ var require_signals = __commonJS({
20034
20037
  var require_signal_exit = __commonJS({
20035
20038
  "../../../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module2) {
20036
20039
  "use strict";
20037
- var process2 = global.process;
20038
- var processOk = function(process3) {
20039
- return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
20040
+ var process3 = global.process;
20041
+ var processOk = function(process4) {
20042
+ return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
20040
20043
  };
20041
- if (!processOk(process2)) {
20044
+ if (!processOk(process3)) {
20042
20045
  module2.exports = function() {
20043
20046
  return function() {
20044
20047
  };
@@ -20046,15 +20049,15 @@ var require_signal_exit = __commonJS({
20046
20049
  } else {
20047
20050
  assert = require("assert");
20048
20051
  signals = require_signals();
20049
- isWin = /^win/i.test(process2.platform);
20052
+ isWin = /^win/i.test(process3.platform);
20050
20053
  EE = require("events");
20051
20054
  if (typeof EE !== "function") {
20052
20055
  EE = EE.EventEmitter;
20053
20056
  }
20054
- if (process2.__signal_exit_emitter__) {
20055
- emitter = process2.__signal_exit_emitter__;
20057
+ if (process3.__signal_exit_emitter__) {
20058
+ emitter = process3.__signal_exit_emitter__;
20056
20059
  } else {
20057
- emitter = process2.__signal_exit_emitter__ = new EE();
20060
+ emitter = process3.__signal_exit_emitter__ = new EE();
20058
20061
  emitter.count = 0;
20059
20062
  emitter.emitted = {};
20060
20063
  }
@@ -20091,12 +20094,12 @@ var require_signal_exit = __commonJS({
20091
20094
  loaded = false;
20092
20095
  signals.forEach(function(sig) {
20093
20096
  try {
20094
- process2.removeListener(sig, sigListeners[sig]);
20097
+ process3.removeListener(sig, sigListeners[sig]);
20095
20098
  } catch (er) {
20096
20099
  }
20097
20100
  });
20098
- process2.emit = originalProcessEmit;
20099
- process2.reallyExit = originalProcessReallyExit;
20101
+ process3.emit = originalProcessEmit;
20102
+ process3.reallyExit = originalProcessReallyExit;
20100
20103
  emitter.count -= 1;
20101
20104
  };
20102
20105
  module2.exports.unload = unload;
@@ -20113,7 +20116,7 @@ var require_signal_exit = __commonJS({
20113
20116
  if (!processOk(global.process)) {
20114
20117
  return;
20115
20118
  }
20116
- var listeners = process2.listeners(sig);
20119
+ var listeners = process3.listeners(sig);
20117
20120
  if (listeners.length === emitter.count) {
20118
20121
  unload();
20119
20122
  emit("exit", null, sig);
@@ -20121,7 +20124,7 @@ var require_signal_exit = __commonJS({
20121
20124
  if (isWin && sig === "SIGHUP") {
20122
20125
  sig = "SIGINT";
20123
20126
  }
20124
- process2.kill(process2.pid, sig);
20127
+ process3.kill(process3.pid, sig);
20125
20128
  }
20126
20129
  };
20127
20130
  });
@@ -20137,36 +20140,36 @@ var require_signal_exit = __commonJS({
20137
20140
  emitter.count += 1;
20138
20141
  signals = signals.filter(function(sig) {
20139
20142
  try {
20140
- process2.on(sig, sigListeners[sig]);
20143
+ process3.on(sig, sigListeners[sig]);
20141
20144
  return true;
20142
20145
  } catch (er) {
20143
20146
  return false;
20144
20147
  }
20145
20148
  });
20146
- process2.emit = processEmit;
20147
- process2.reallyExit = processReallyExit;
20149
+ process3.emit = processEmit;
20150
+ process3.reallyExit = processReallyExit;
20148
20151
  };
20149
20152
  module2.exports.load = load;
20150
- originalProcessReallyExit = process2.reallyExit;
20153
+ originalProcessReallyExit = process3.reallyExit;
20151
20154
  processReallyExit = function processReallyExit2(code) {
20152
20155
  if (!processOk(global.process)) {
20153
20156
  return;
20154
20157
  }
20155
- process2.exitCode = code || /* istanbul ignore next */
20158
+ process3.exitCode = code || /* istanbul ignore next */
20156
20159
  0;
20157
- emit("exit", process2.exitCode, null);
20158
- emit("afterexit", process2.exitCode, null);
20159
- originalProcessReallyExit.call(process2, process2.exitCode);
20160
+ emit("exit", process3.exitCode, null);
20161
+ emit("afterexit", process3.exitCode, null);
20162
+ originalProcessReallyExit.call(process3, process3.exitCode);
20160
20163
  };
20161
- originalProcessEmit = process2.emit;
20164
+ originalProcessEmit = process3.emit;
20162
20165
  processEmit = function processEmit2(ev, arg) {
20163
20166
  if (ev === "exit" && processOk(global.process)) {
20164
20167
  if (arg !== void 0) {
20165
- process2.exitCode = arg;
20168
+ process3.exitCode = arg;
20166
20169
  }
20167
20170
  var ret = originalProcessEmit.apply(this, arguments);
20168
- emit("exit", process2.exitCode, null);
20169
- emit("afterexit", process2.exitCode, null);
20171
+ emit("exit", process3.exitCode, null);
20172
+ emit("afterexit", process3.exitCode, null);
20170
20173
  return ret;
20171
20174
  } else {
20172
20175
  return originalProcessEmit.apply(this, arguments);
@@ -36069,7 +36072,7 @@ var require_iso2022 = __commonJS({
36069
36072
  var require_chardet = __commonJS({
36070
36073
  "../../../../node_modules/.pnpm/chardet@0.7.0/node_modules/chardet/index.js"(exports, module2) {
36071
36074
  "use strict";
36072
- var fs8 = require("fs");
36075
+ var fs7 = require("fs");
36073
36076
  var utf8 = require_utf8();
36074
36077
  var unicode = require_unicode();
36075
36078
  var mbcs = require_mbcs();
@@ -36143,29 +36146,29 @@ var require_chardet = __commonJS({
36143
36146
  var fd;
36144
36147
  var handler = function(err, buffer) {
36145
36148
  if (fd) {
36146
- fs8.closeSync(fd);
36149
+ fs7.closeSync(fd);
36147
36150
  }
36148
36151
  if (err)
36149
36152
  return cb(err, null);
36150
36153
  cb(null, self3.detect(buffer, opts));
36151
36154
  };
36152
36155
  if (opts && opts.sampleSize) {
36153
- fd = fs8.openSync(filepath, "r"), sample = Buffer.allocUnsafe(opts.sampleSize);
36154
- fs8.read(fd, sample, 0, opts.sampleSize, null, function(err) {
36156
+ fd = fs7.openSync(filepath, "r"), sample = Buffer.allocUnsafe(opts.sampleSize);
36157
+ fs7.read(fd, sample, 0, opts.sampleSize, null, function(err) {
36155
36158
  handler(err, sample);
36156
36159
  });
36157
36160
  return;
36158
36161
  }
36159
- fs8.readFile(filepath, handler);
36162
+ fs7.readFile(filepath, handler);
36160
36163
  };
36161
36164
  module2.exports.detectFileSync = function(filepath, opts) {
36162
36165
  if (opts && opts.sampleSize) {
36163
- var fd = fs8.openSync(filepath, "r"), sample2 = Buffer.allocUnsafe(opts.sampleSize);
36164
- fs8.readSync(fd, sample2, 0, opts.sampleSize);
36165
- fs8.closeSync(fd);
36166
+ var fd = fs7.openSync(filepath, "r"), sample2 = Buffer.allocUnsafe(opts.sampleSize);
36167
+ fs7.readSync(fd, sample2, 0, opts.sampleSize);
36168
+ fs7.closeSync(fd);
36166
36169
  return self3.detect(sample2, opts);
36167
36170
  }
36168
- return self3.detect(fs8.readFileSync(filepath), opts);
36171
+ return self3.detect(fs7.readFileSync(filepath), opts);
36169
36172
  };
36170
36173
  module2.exports.detectAll = function(buffer, opts) {
36171
36174
  if (typeof opts !== "object") {
@@ -39669,7 +39672,7 @@ var require_os_tmpdir = __commonJS({
39669
39672
  var require_tmp = __commonJS({
39670
39673
  "../../../../node_modules/.pnpm/tmp@0.0.33/node_modules/tmp/lib/tmp.js"(exports, module2) {
39671
39674
  "use strict";
39672
- var fs8 = require("fs");
39675
+ var fs7 = require("fs");
39673
39676
  var path7 = require("path");
39674
39677
  var crypto = require("crypto");
39675
39678
  var osTmpDir = require_os_tmpdir();
@@ -39733,7 +39736,7 @@ var require_tmp = __commonJS({
39733
39736
  return cb(new Error("Invalid template provided"));
39734
39737
  (function _getUniqueName() {
39735
39738
  const name = _generateTmpName(opts);
39736
- fs8.stat(name, function(err) {
39739
+ fs7.stat(name, function(err) {
39737
39740
  if (!err) {
39738
39741
  if (tries-- > 0)
39739
39742
  return _getUniqueName();
@@ -39752,7 +39755,7 @@ var require_tmp = __commonJS({
39752
39755
  do {
39753
39756
  const name = _generateTmpName(opts);
39754
39757
  try {
39755
- fs8.statSync(name);
39758
+ fs7.statSync(name);
39756
39759
  } catch (e) {
39757
39760
  return name;
39758
39761
  }
@@ -39765,14 +39768,14 @@ var require_tmp = __commonJS({
39765
39768
  tmpName(opts, function _tmpNameCreated(err, name) {
39766
39769
  if (err)
39767
39770
  return cb(err);
39768
- fs8.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
39771
+ fs7.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
39769
39772
  if (err2)
39770
39773
  return cb(err2);
39771
39774
  if (opts.discardDescriptor) {
39772
- return fs8.close(fd, function _discardCallback(err3) {
39775
+ return fs7.close(fd, function _discardCallback(err3) {
39773
39776
  if (err3) {
39774
39777
  try {
39775
- fs8.unlinkSync(name);
39778
+ fs7.unlinkSync(name);
39776
39779
  } catch (e) {
39777
39780
  if (!isENOENT(e)) {
39778
39781
  err3 = e;
@@ -39795,9 +39798,9 @@ var require_tmp = __commonJS({
39795
39798
  opts.postfix = opts.postfix || ".tmp";
39796
39799
  const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
39797
39800
  const name = tmpNameSync(opts);
39798
- var fd = fs8.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
39801
+ var fd = fs7.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
39799
39802
  if (opts.discardDescriptor) {
39800
- fs8.closeSync(fd);
39803
+ fs7.closeSync(fd);
39801
39804
  fd = void 0;
39802
39805
  }
39803
39806
  return {
@@ -39809,9 +39812,9 @@ var require_tmp = __commonJS({
39809
39812
  function _rmdirRecursiveSync(root) {
39810
39813
  const dirs = [root];
39811
39814
  do {
39812
- var dir2 = dirs.pop(), deferred = false, files = fs8.readdirSync(dir2);
39815
+ var dir2 = dirs.pop(), deferred = false, files = fs7.readdirSync(dir2);
39813
39816
  for (var i = 0, length = files.length; i < length; i++) {
39814
- var file2 = path7.join(dir2, files[i]), stat = fs8.lstatSync(file2);
39817
+ var file2 = path7.join(dir2, files[i]), stat = fs7.lstatSync(file2);
39815
39818
  if (stat.isDirectory()) {
39816
39819
  if (!deferred) {
39817
39820
  deferred = true;
@@ -39819,11 +39822,11 @@ var require_tmp = __commonJS({
39819
39822
  }
39820
39823
  dirs.push(file2);
39821
39824
  } else {
39822
- fs8.unlinkSync(file2);
39825
+ fs7.unlinkSync(file2);
39823
39826
  }
39824
39827
  }
39825
39828
  if (!deferred) {
39826
- fs8.rmdirSync(dir2);
39829
+ fs7.rmdirSync(dir2);
39827
39830
  }
39828
39831
  } while (dirs.length !== 0);
39829
39832
  }
@@ -39832,7 +39835,7 @@ var require_tmp = __commonJS({
39832
39835
  tmpName(opts, function _tmpNameCreated(err, name) {
39833
39836
  if (err)
39834
39837
  return cb(err);
39835
- fs8.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
39838
+ fs7.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
39836
39839
  if (err2)
39837
39840
  return cb(err2);
39838
39841
  cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
@@ -39842,7 +39845,7 @@ var require_tmp = __commonJS({
39842
39845
  function dirSync(options) {
39843
39846
  var args = _parseArguments(options), opts = args[0];
39844
39847
  const name = tmpNameSync(opts);
39845
- fs8.mkdirSync(name, opts.mode || DIR_MODE);
39848
+ fs7.mkdirSync(name, opts.mode || DIR_MODE);
39846
39849
  return {
39847
39850
  name,
39848
39851
  removeCallback: _prepareTmpDirRemoveCallback(name, opts)
@@ -39852,7 +39855,7 @@ var require_tmp = __commonJS({
39852
39855
  const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
39853
39856
  try {
39854
39857
  if (0 <= fdPath[0]) {
39855
- fs8.closeSync(fdPath[0]);
39858
+ fs7.closeSync(fdPath[0]);
39856
39859
  }
39857
39860
  } catch (e) {
39858
39861
  if (!isEBADF(e) && !isENOENT(e)) {
@@ -39860,7 +39863,7 @@ var require_tmp = __commonJS({
39860
39863
  }
39861
39864
  }
39862
39865
  try {
39863
- fs8.unlinkSync(fdPath[1]);
39866
+ fs7.unlinkSync(fdPath[1]);
39864
39867
  } catch (e) {
39865
39868
  if (!isENOENT(e)) {
39866
39869
  throw e;
@@ -39873,7 +39876,7 @@ var require_tmp = __commonJS({
39873
39876
  return removeCallback;
39874
39877
  }
39875
39878
  function _prepareTmpDirRemoveCallback(name, opts) {
39876
- const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs8.rmdirSync.bind(fs8);
39879
+ const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs7.rmdirSync.bind(fs7);
39877
39880
  const removeCallback = _prepareRemoveCallback(removeFunction, name);
39878
39881
  if (!opts.keep) {
39879
39882
  _removeObjects.unshift(removeCallback);
@@ -51165,11 +51168,11 @@ var require_ms = __commonJS({
51165
51168
  }
51166
51169
  });
51167
51170
 
51168
- // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/common.js
51171
+ // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/common.js
51169
51172
  var require_common2 = __commonJS({
51170
- "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/common.js"(exports, module2) {
51173
+ "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/common.js"(exports, module2) {
51171
51174
  "use strict";
51172
- function setup(env) {
51175
+ function setup(env2) {
51173
51176
  createDebug.debug = createDebug;
51174
51177
  createDebug.default = createDebug;
51175
51178
  createDebug.coerce = coerce;
@@ -51178,8 +51181,8 @@ var require_common2 = __commonJS({
51178
51181
  createDebug.enabled = enabled;
51179
51182
  createDebug.humanize = require_ms();
51180
51183
  createDebug.destroy = destroy2;
51181
- Object.keys(env).forEach((key) => {
51182
- createDebug[key] = env[key];
51184
+ Object.keys(env2).forEach((key) => {
51185
+ createDebug[key] = env2[key];
51183
51186
  });
51184
51187
  createDebug.names = [];
51185
51188
  createDebug.skips = [];
@@ -51329,9 +51332,9 @@ var require_common2 = __commonJS({
51329
51332
  }
51330
51333
  });
51331
51334
 
51332
- // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/browser.js
51335
+ // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/browser.js
51333
51336
  var require_browser = __commonJS({
51334
- "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/browser.js"(exports, module2) {
51337
+ "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/browser.js"(exports, module2) {
51335
51338
  "use strict";
51336
51339
  exports.formatArgs = formatArgs;
51337
51340
  exports.save = save;
@@ -51499,120 +51502,147 @@ var require_browser = __commonJS({
51499
51502
  }
51500
51503
  });
51501
51504
 
51502
- // ../../../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
51503
- var require_has_flag = __commonJS({
51504
- "../../../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports, module2) {
51505
- "use strict";
51506
- module2.exports = (flag, argv) => {
51507
- argv = argv || process.argv;
51508
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
51509
- const pos = argv.indexOf(prefix + flag);
51510
- const terminatorPos = argv.indexOf("--");
51511
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
51512
- };
51513
- }
51505
+ // ../../../../node_modules/.pnpm/supports-color@9.3.1/node_modules/supports-color/index.js
51506
+ var supports_color_exports = {};
51507
+ __export(supports_color_exports, {
51508
+ createSupportsColor: () => createSupportsColor,
51509
+ default: () => supports_color_default
51514
51510
  });
51515
-
51516
- // ../../../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
51517
- var require_supports_color = __commonJS({
51518
- "../../../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports, module2) {
51519
- "use strict";
51520
- var os = require("os");
51521
- var hasFlag = require_has_flag();
51522
- var env = process.env;
51523
- var forceColor;
51524
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
51525
- forceColor = false;
51526
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
51527
- forceColor = true;
51511
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
51512
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
51513
+ const position = argv.indexOf(prefix + flag);
51514
+ const terminatorPosition = argv.indexOf("--");
51515
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
51516
+ }
51517
+ function envForceColor() {
51518
+ if ("FORCE_COLOR" in env) {
51519
+ if (env.FORCE_COLOR === "true") {
51520
+ return 1;
51528
51521
  }
51529
- if ("FORCE_COLOR" in env) {
51530
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
51522
+ if (env.FORCE_COLOR === "false") {
51523
+ return 0;
51531
51524
  }
51532
- function translateLevel(level) {
51533
- if (level === 0) {
51534
- return false;
51535
- }
51536
- return {
51537
- level,
51538
- hasBasic: true,
51539
- has256: level >= 2,
51540
- has16m: level >= 3
51541
- };
51525
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
51526
+ }
51527
+ }
51528
+ function translateLevel(level) {
51529
+ if (level === 0) {
51530
+ return false;
51531
+ }
51532
+ return {
51533
+ level,
51534
+ hasBasic: true,
51535
+ has256: level >= 2,
51536
+ has16m: level >= 3
51537
+ };
51538
+ }
51539
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
51540
+ const noFlagForceColor = envForceColor();
51541
+ if (noFlagForceColor !== void 0) {
51542
+ flagForceColor = noFlagForceColor;
51543
+ }
51544
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
51545
+ if (forceColor === 0) {
51546
+ return 0;
51547
+ }
51548
+ if (sniffFlags) {
51549
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
51550
+ return 3;
51542
51551
  }
51543
- function supportsColor(stream) {
51544
- if (forceColor === false) {
51545
- return 0;
51546
- }
51547
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
51548
- return 3;
51549
- }
51550
- if (hasFlag("color=256")) {
51551
- return 2;
51552
- }
51553
- if (stream && !stream.isTTY && forceColor !== true) {
51554
- return 0;
51555
- }
51556
- const min = forceColor ? 1 : 0;
51557
- if (process.platform === "win32") {
51558
- const osRelease = os.release().split(".");
51559
- if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
51560
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
51561
- }
51562
- return 1;
51563
- }
51564
- if ("CI" in env) {
51565
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
51566
- return 1;
51567
- }
51568
- return min;
51569
- }
51570
- if ("TEAMCITY_VERSION" in env) {
51571
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
51572
- }
51573
- if (env.COLORTERM === "truecolor") {
51574
- return 3;
51575
- }
51576
- if ("TERM_PROGRAM" in env) {
51577
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
51578
- switch (env.TERM_PROGRAM) {
51579
- case "iTerm.app":
51580
- return version >= 3 ? 3 : 2;
51581
- case "Apple_Terminal":
51582
- return 2;
51583
- }
51552
+ if (hasFlag("color=256")) {
51553
+ return 2;
51554
+ }
51555
+ }
51556
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
51557
+ return 1;
51558
+ }
51559
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
51560
+ return 0;
51561
+ }
51562
+ const min = forceColor || 0;
51563
+ if (env.TERM === "dumb") {
51564
+ return min;
51565
+ }
51566
+ if (import_node_process.default.platform === "win32") {
51567
+ const osRelease = import_node_os.default.release().split(".");
51568
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
51569
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
51570
+ }
51571
+ return 1;
51572
+ }
51573
+ if ("CI" in env) {
51574
+ if ("GITHUB_ACTIONS" in env) {
51575
+ return 3;
51576
+ }
51577
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
51578
+ return 1;
51579
+ }
51580
+ return min;
51581
+ }
51582
+ if ("TEAMCITY_VERSION" in env) {
51583
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
51584
+ }
51585
+ if (env.COLORTERM === "truecolor") {
51586
+ return 3;
51587
+ }
51588
+ if (env.TERM === "xterm-kitty") {
51589
+ return 3;
51590
+ }
51591
+ if ("TERM_PROGRAM" in env) {
51592
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
51593
+ switch (env.TERM_PROGRAM) {
51594
+ case "iTerm.app": {
51595
+ return version >= 3 ? 3 : 2;
51584
51596
  }
51585
- if (/-256(color)?$/i.test(env.TERM)) {
51597
+ case "Apple_Terminal": {
51586
51598
  return 2;
51587
51599
  }
51588
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
51589
- return 1;
51590
- }
51591
- if ("COLORTERM" in env) {
51592
- return 1;
51593
- }
51594
- if (env.TERM === "dumb") {
51595
- return min;
51596
- }
51597
- return min;
51598
51600
  }
51599
- function getSupportLevel(stream) {
51600
- const level = supportsColor(stream);
51601
- return translateLevel(level);
51601
+ }
51602
+ if (/-256(color)?$/i.test(env.TERM)) {
51603
+ return 2;
51604
+ }
51605
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
51606
+ return 1;
51607
+ }
51608
+ if ("COLORTERM" in env) {
51609
+ return 1;
51610
+ }
51611
+ return min;
51612
+ }
51613
+ function createSupportsColor(stream, options = {}) {
51614
+ const level = _supportsColor(stream, {
51615
+ streamIsTTY: stream && stream.isTTY,
51616
+ ...options
51617
+ });
51618
+ return translateLevel(level);
51619
+ }
51620
+ var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
51621
+ var init_supports_color = __esm({
51622
+ "../../../../node_modules/.pnpm/supports-color@9.3.1/node_modules/supports-color/index.js"() {
51623
+ "use strict";
51624
+ import_node_process = __toESM(require("process"));
51625
+ import_node_os = __toESM(require("os"));
51626
+ import_node_tty = __toESM(require("tty"));
51627
+ ({ env } = import_node_process.default);
51628
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
51629
+ flagForceColor = 0;
51630
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
51631
+ flagForceColor = 1;
51602
51632
  }
51603
- module2.exports = {
51604
- supportsColor: getSupportLevel,
51605
- stdout: getSupportLevel(process.stdout),
51606
- stderr: getSupportLevel(process.stderr)
51633
+ supportsColor = {
51634
+ stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
51635
+ stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
51607
51636
  };
51637
+ supports_color_default = supportsColor;
51608
51638
  }
51609
51639
  });
51610
51640
 
51611
- // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/node.js
51641
+ // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/node.js
51612
51642
  var require_node2 = __commonJS({
51613
- "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/node.js"(exports, module2) {
51643
+ "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/node.js"(exports, module2) {
51614
51644
  "use strict";
51615
- var tty = require("tty");
51645
+ var tty2 = require("tty");
51616
51646
  var util = require("util");
51617
51647
  exports.init = init;
51618
51648
  exports.log = log;
@@ -51627,8 +51657,8 @@ var require_node2 = __commonJS({
51627
51657
  );
51628
51658
  exports.colors = [6, 2, 3, 4, 5, 1];
51629
51659
  try {
51630
- const supportsColor = require_supports_color();
51631
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
51660
+ const supportsColor2 = (init_supports_color(), __toCommonJS(supports_color_exports));
51661
+ if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
51632
51662
  exports.colors = [
51633
51663
  20,
51634
51664
  21,
@@ -51730,7 +51760,7 @@ var require_node2 = __commonJS({
51730
51760
  return obj;
51731
51761
  }, {});
51732
51762
  function useColors() {
51733
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
51763
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
51734
51764
  }
51735
51765
  function formatArgs(args) {
51736
51766
  const { namespace: name, useColors: useColors2 } = this;
@@ -51783,9 +51813,9 @@ var require_node2 = __commonJS({
51783
51813
  }
51784
51814
  });
51785
51815
 
51786
- // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/index.js
51816
+ // ../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/index.js
51787
51817
  var require_src3 = __commonJS({
51788
- "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@5.5.0/node_modules/debug/src/index.js"(exports, module2) {
51818
+ "../../../../node_modules/.pnpm/debug@4.3.4_supports-color@9.3.1/node_modules/debug/src/index.js"(exports, module2) {
51789
51819
  "use strict";
51790
51820
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
51791
51821
  module2.exports = require_browser();
@@ -52658,489 +52688,29 @@ __export(src_exports, {
52658
52688
  module.exports = __toCommonJS(src_exports);
52659
52689
  var import_path7 = __toESM(require("path"));
52660
52690
 
52661
- // ../../generator-utils/dist/esm/index.js
52662
- var import_path2 = __toESM(require("path"));
52663
- var import_utils3 = require("@modern-js/utils");
52664
-
52665
- // ../../../cli/plugin-i18n/dist/esm-node/index.js
52666
- var import_lodash2 = require("@modern-js/utils/lodash");
52667
-
52668
- // ../../../cli/plugin-i18n/dist/esm-node/utils/index.js
52669
- var import_lodash = require("@modern-js/utils/lodash");
52670
- function getObjKeyMap(obj, prefix = "") {
52671
- const result = {};
52672
- Object.keys(obj).forEach((key) => {
52673
- if ((0, import_lodash.isString)(obj[key])) {
52674
- result[key] = prefix ? `${prefix}.${key}` : key;
52675
- } else if ((0, import_lodash.isObject)(obj[key])) {
52676
- result[key] = getObjKeyMap(obj[key], prefix ? `${prefix}.${key}` : key);
52677
- }
52678
- });
52679
- return result;
52680
- }
52681
-
52682
- // ../../../cli/plugin-i18n/dist/esm-node/index.js
52683
- var I18n = class {
52684
- format(msg, vars) {
52685
- return msg.replace(/\{(\w+)\}/g, (_match, capture) => Object.prototype.hasOwnProperty.call(vars, capture) ? vars[capture] : capture);
52686
- }
52687
- getMessage(lang, key, vars, fallbackText) {
52688
- const languages = Object.keys(this.languageMap);
52689
- const resultLang = languages.find((l) => l === lang);
52690
- if (!resultLang && languages.length === 0) {
52691
- return fallbackText || key;
52692
- }
52693
- const model = this.languageMap[resultLang || "en"];
52694
- if (!model) {
52695
- return fallbackText || key;
52696
- }
52697
- const message = (0, import_lodash2.get)(model, key);
52698
- const value = message || fallbackText || key;
52699
- if (typeof value === "string") {
52700
- return this.format(value, vars || {});
52701
- }
52702
- throw new Error("key is not a string");
52703
- }
52704
- init(language, languageMap) {
52705
- this.language = language || "en";
52706
- if (languageMap) {
52707
- this.languageMap = languageMap;
52708
- }
52709
- return getObjKeyMap(this.languageMap[this.language]);
52710
- }
52711
- changeLanguage(config) {
52712
- this.language = config.locale || "en";
52713
- }
52714
- t(key, vars, fallbackText) {
52715
- return this.getMessage(this.language, key, vars, fallbackText);
52716
- }
52717
- lang(lang) {
52718
- return {
52719
- t: (key, vars, fallbackText) => this.getMessage(lang, key, vars, fallbackText)
52720
- };
52721
- }
52722
- constructor() {
52723
- this.language = "en";
52724
- this.languageMap = {};
52725
- }
52726
- };
52727
-
52728
- // ../../generator-common/dist/esm-node/locale/zh.js
52729
- var ZH_LOCALE = {
52730
- solution: {
52731
- self: "请选择你想创建的工程类型",
52732
- mwa: "Web 应用",
52733
- module: "Npm 模块",
52734
- custom: "自定义",
52735
- default: "默认"
52736
- },
52737
- scenes: {
52738
- self: "请选择项目场景"
52739
- },
52740
- sub_solution: {
52741
- self: "请选择你想创建的工程类型",
52742
- mwa: "Web 应用",
52743
- module: "Npm 模块"
52744
- },
52745
- action: {
52746
- self: "请选择你想要的操作",
52747
- function: {
52748
- self: "启用可选功能",
52749
- question: "请选择功能名称",
52750
- tailwindcss: "启用「Tailwind CSS」 支持",
52751
- bff: "启用「BFF」功能",
52752
- micro_frontend: "启用「微前端」模式",
52753
- i18n: "启用「国际化(i18n)」功能",
52754
- storybookV7: "启用「Storybook」V7",
52755
- runtime_api: "启用「Runtime API」",
52756
- ssg: "启用「SSG」功能",
52757
- polyfill: "启用「基于 UA 的 Polyfill」功能",
52758
- proxy: "启用「全局代理」",
52759
- swc: "启用「SWC 编译」",
52760
- module_doc: "启动「模块文档」功能"
52761
- },
52762
- element: {
52763
- self: "创建工程元素",
52764
- question: "请选择创建元素类型",
52765
- entry: "新建「应用入口」",
52766
- server: "新建「自定义 Web Server」源码目录"
52767
- },
52768
- refactor: {
52769
- self: "自动重构",
52770
- question: "请选择重构类型",
52771
- react_router_5: "使用 React Router v5"
52772
- }
52773
- },
52774
- boolean: {
52775
- yes: "是",
52776
- no: "否"
52777
- },
52778
- language: {
52779
- self: "请选择开发语言"
52780
- },
52781
- packageManager: {
52782
- self: "请选择包管理工具"
52783
- },
52784
- entry: {
52785
- name: "请填写入口名称",
52786
- no_empty: "入口名称不能为空!",
52787
- no_pages: '入口名称不支持 "pages"!'
52788
- },
52789
- packageName: {
52790
- self: "请填写项目名称",
52791
- sub_name: "请填写子项目名称",
52792
- no_empty: "项目名称不能为空!"
52793
- },
52794
- packagePath: {
52795
- self: "请填写子项目目录名称",
52796
- no_empty: "目录名称不能为空!",
52797
- format: "目录名称只能使用小写字母、数字和分隔线(-)、下划线(_)和目录分隔符(/)"
52798
- },
52799
- framework: {
52800
- self: "请选择运行时框架",
52801
- egg: "Egg",
52802
- express: "Express",
52803
- koa: "Koa",
52804
- nest: "Nest"
52805
- },
52806
- bff: {
52807
- bffType: {
52808
- self: "请选择 BFF 类型",
52809
- func: "函数模式",
52810
- framework: "框架模式"
52811
- }
52812
- },
52813
- buildTools: {
52814
- self: "请选择构建工具",
52815
- webpack: "webpack",
52816
- rspack: "Rspack (实验性)"
52817
- }
52818
- };
52819
-
52820
- // ../../generator-common/dist/esm-node/locale/en.js
52821
- var EN_LOCALE = {
52822
- solution: {
52823
- self: "Please select the type of project you want to create:",
52824
- mwa: "Web App",
52825
- module: "Npm Module",
52826
- custom: "Custom Solution",
52827
- default: "Default"
52828
- },
52829
- scenes: {
52830
- self: "Please select the project scenario:"
52831
- },
52832
- sub_solution: {
52833
- self: "Please select the type of project you want to create:",
52834
- mwa: "Web App",
52835
- module: "Npm Module"
52836
- },
52837
- action: {
52838
- self: "Please select the operation you want:",
52839
- function: {
52840
- self: "Enable Features",
52841
- question: "Please select the feature name:",
52842
- tailwindcss: "Enable Tailwind CSS",
52843
- bff: "Enable BFF",
52844
- micro_frontend: "Enable Micro Frontend",
52845
- i18n: "Enable Internationalization (i18n)",
52846
- storybookV7: "Enable Storybook V7",
52847
- runtime_api: "Enable Runtime API",
52848
- ssg: "Enable SSG",
52849
- polyfill: "Enable UA-based Polyfill Feature",
52850
- proxy: "Enable Global Proxy",
52851
- swc: "Enable SWC Compile",
52852
- module_doc: "Enable Module Doc"
52853
- },
52854
- element: {
52855
- self: "Create Element",
52856
- question: "Please select the type of element to create:",
52857
- entry: 'New "entry"',
52858
- server: 'New "Custom Web Server" source code directory'
52859
- },
52860
- refactor: {
52861
- self: "Automatic Refactor",
52862
- question: "Please select the type of refactoring:",
52863
- react_router_5: "Use React Router v5"
52864
- }
52865
- },
52866
- boolean: {
52867
- yes: "Yes",
52868
- no: "No"
52869
- },
52870
- language: {
52871
- self: "Please select the programming language:"
52872
- },
52873
- packageManager: {
52874
- self: "Please select the package manager:"
52875
- },
52876
- entry: {
52877
- name: "Please fill in the entry name:",
52878
- no_empty: "The entry name cannot be empty!",
52879
- no_pages: 'The entry name cannot be "pages"!'
52880
- },
52881
- packageName: {
52882
- self: "Please fill in the project name:",
52883
- sub_name: "Please fill in the sub-project name:",
52884
- no_empty: "The package name cannot be empty!"
52885
- },
52886
- packagePath: {
52887
- self: "Please fill in the sub-project directory name:",
52888
- no_empty: "The package path cannot be empty!",
52889
- format: "Only lowercase letters, numbers and delimiters (-), and underscore (_), and directory delimiters (/) can be used in package path."
52890
- },
52891
- framework: {
52892
- self: "Please select the framework:",
52893
- egg: "Egg",
52894
- express: "Express",
52895
- koa: "Koa",
52896
- nest: "Nest"
52897
- },
52898
- bff: {
52899
- bffType: {
52900
- self: "Please select the BFF type:",
52901
- func: "Function",
52902
- framework: "Framework"
52903
- }
52904
- },
52905
- buildTools: {
52906
- self: "Please select the bundler:",
52907
- webpack: "webpack",
52908
- rspack: "Rspack (experimental)"
52909
- }
52910
- };
52911
-
52912
- // ../../generator-common/dist/esm-node/locale/index.js
52913
- var i18n = new I18n();
52914
- var localeKeys = i18n.init("en", {
52915
- zh: ZH_LOCALE,
52916
- en: EN_LOCALE
52917
- });
52918
-
52919
- // ../../generator-common/dist/esm-node/common/solution.js
52920
- var Solution;
52921
- (function(Solution2) {
52922
- Solution2["MWA"] = "mwa";
52923
- Solution2["Module"] = "module";
52924
- })(Solution || (Solution = {}));
52925
- var SolutionToolsMap = {
52926
- ["mwa"]: "@modern-js/app-tools",
52927
- ["module"]: "@modern-js/module-tools"
52928
- };
52929
- var DependenceGenerator = "@modern-js/dependence-generator";
52930
-
52931
- // ../../generator-common/dist/esm-node/common/language.js
52932
- var Language;
52933
- (function(Language2) {
52934
- Language2["TS"] = "ts";
52935
- Language2["JS"] = "js";
52936
- })(Language || (Language = {}));
52937
-
52938
- // ../../generator-utils/dist/esm/utils/stripAnsi.js
52939
- function ansiRegex({ onlyFirst = false } = {}) {
52940
- const pattern = [
52941
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
52942
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
52943
- ].join("|");
52944
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
52945
- }
52946
- function stripAnsi(string) {
52947
- if (typeof string !== "string") {
52948
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
52949
- }
52950
- return string.replace(ansiRegex(), "");
52951
- }
52952
-
52953
- // ../../generator-utils/dist/esm/utils/package.js
52954
- var import_utils2 = require("@modern-js/utils");
52955
- async function isPackageExist(packageName, registry2) {
52956
- if (await (0, import_utils2.canUseNpm)()) {
52957
- try {
52958
- const args = [
52959
- "view",
52960
- packageName,
52961
- "version"
52962
- ];
52963
- if (registry2) {
52964
- args.push(`--registry=${registry2}`);
52965
- }
52966
- const result = await (0, import_utils2.execa)("npm", args);
52967
- return (0, import_utils2.stripAnsi)(result.stdout);
52968
- } catch (e) {
52969
- return false;
52970
- }
52971
- }
52972
- throw new Error("not found npm, please install npm before");
52973
- }
52974
- async function isPackageDeprecated(packageName, registry2) {
52975
- if (await (0, import_utils2.canUseNpm)()) {
52976
- const args = [
52977
- "view",
52978
- packageName,
52979
- "deprecated"
52980
- ];
52981
- if (registry2) {
52982
- args.push(`--registry=${registry2}`);
52983
- }
52984
- const result = await (0, import_utils2.execa)("npm", args);
52985
- return (0, import_utils2.stripAnsi)(result.stdout);
52986
- }
52987
- throw new Error("not found npm, please install npm before");
52988
- }
52989
- function semverDecrease(version) {
52990
- const versionObj = import_utils2.semver.parse(version, {
52991
- loose: true
52992
- });
52993
- if (!versionObj) {
52994
- throw new Error(`Version ${version} is not valid semver`);
52995
- }
52996
- versionObj.build = [];
52997
- versionObj.prerelease = [];
52998
- versionObj.patch--;
52999
- const result = versionObj.format();
53000
- if (!import_utils2.semver.valid(result)) {
53001
- import_utils2.logger.debug(`Version ${result} is not valid semver`);
53002
- return version;
53003
- }
53004
- return result;
53005
- }
53006
- async function getAvailableVersion(packageName, currentVersion, registry2) {
53007
- let times = 5;
53008
- let version = currentVersion;
53009
- while (times) {
53010
- if (!await isPackageExist(`${packageName}@${version}`, registry2) || await isPackageDeprecated(`${packageName}@${version}`, registry2)) {
53011
- version = import_utils2.semver.inc(version, "patch");
53012
- times--;
53013
- continue;
53014
- }
53015
- return version;
53016
- }
53017
- times = 5;
53018
- while (times) {
53019
- version = semverDecrease(version);
53020
- if (!await isPackageExist(`${packageName}@${version}`, registry2) || await isPackageDeprecated(`${packageName}@${version}`, registry2)) {
53021
- times--;
53022
- continue;
53023
- }
53024
- return version;
53025
- }
53026
- return currentVersion;
53027
- }
53028
-
53029
- // ../../generator-utils/dist/esm/utils/getGeneratorPath.js
52691
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
53030
52692
  var import_path = __toESM(require("path"));
53031
- var getGeneratorPath = (generator, distTag, paths) => {
53032
- if (process.env.CODESMITH_ENV === "development") {
53033
- return import_path.default.dirname(require.resolve(generator, {
53034
- paths: paths !== null && paths !== void 0 ? paths : [
53035
- process.cwd()
53036
- ]
53037
- }));
53038
- } else if (distTag) {
53039
- return `${generator}@${distTag}`;
53040
- }
53041
- return generator;
53042
- };
53043
-
53044
- // ../../generator-utils/dist/esm/index.js
53045
- var import_utils4 = require("@modern-js/utils");
53046
- async function getPackageVersion(packageName, registry2) {
53047
- const spinner = (0, import_utils3.ora)({
53048
- text: "Load Generator...",
53049
- spinner: "runner"
53050
- }).start();
53051
- if (await (0, import_utils3.canUsePnpm)()) {
53052
- const args = [
53053
- "info",
53054
- packageName,
53055
- "version"
53056
- ];
53057
- if (registry2) {
53058
- args.push(`--registry=${registry2}`);
53059
- }
53060
- const result = await (0, import_utils3.execa)("pnpm", args);
53061
- spinner.stop();
53062
- return stripAnsi(result.stdout);
53063
- }
53064
- if (await (0, import_utils3.canUseNpm)()) {
53065
- const args = [
53066
- "view",
53067
- packageName,
53068
- "version"
53069
- ];
53070
- if (registry2) {
53071
- args.push(`--registry=${registry2}`);
53072
- }
53073
- const result = await (0, import_utils3.execa)("npm", args);
53074
- spinner.stop();
53075
- return stripAnsi(result.stdout);
53076
- }
53077
- spinner.stop();
53078
- throw new Error("not found npm, please install npm before");
53079
- }
53080
- async function getModernPluginVersion(solution, packageName, options = {
53081
- distTag: "latest"
53082
- }) {
53083
- const { cwd = process.cwd(), registry: registry2, distTag } = options;
53084
- const getLatetPluginVersion = async (tag) => {
53085
- const version = await getPackageVersion(`${packageName}@${tag || distTag || "latest"}`, registry2);
53086
- return version;
53087
- };
53088
- if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
53089
- return getLatetPluginVersion("latest");
53090
- }
53091
- let pkgPath = import_path2.default.join(require.resolve(SolutionToolsMap[solution], {
53092
- paths: [
53093
- cwd
53094
- ]
53095
- }), "../../..", "package.json");
53096
- if (solution === Solution.Module) {
53097
- pkgPath = import_path2.default.join(require.resolve(SolutionToolsMap[solution], {
53098
- paths: [
53099
- cwd
53100
- ]
53101
- }), "../..", "package.json");
53102
- }
53103
- if (import_utils3.fs.existsSync(pkgPath)) {
53104
- const pkgInfo = import_utils3.fs.readJSONSync(pkgPath);
53105
- const modernVersion = pkgInfo.version;
53106
- if (typeof modernVersion !== "string") {
53107
- return getLatetPluginVersion();
53108
- }
53109
- const version = await getAvailableVersion(packageName, modernVersion, registry2);
53110
- if (!await isPackageExist(`${packageName}@${version}`)) {
53111
- return getLatetPluginVersion();
53112
- }
53113
- return version;
53114
- }
53115
- return getLatetPluginVersion();
53116
- }
53117
- function isTsProject(appDir) {
53118
- return import_utils3.fs.existsSync(import_path2.default.join(appDir, "tsconfig.json"));
53119
- }
53120
-
53121
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
53122
- var import_path3 = __toESM(require("path"));
53123
- var import_utils5 = require("@modern-js/utils");
52693
+ var import_utils = require("@modern-js/utils");
53124
52694
  var FS_RESOURCE = "_codesmith_core_fs_resource";
53125
52695
 
53126
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
53127
- var import_utils6 = require("@modern-js/utils");
52696
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
52697
+ var import_utils2 = require("@modern-js/utils");
53128
52698
  async function fsExists(path7) {
53129
52699
  try {
53130
- await import_utils6.fs.access(path7);
52700
+ await import_utils2.fs.access(path7);
53131
52701
  return true;
53132
52702
  } catch (e) {
53133
52703
  return false;
53134
52704
  }
53135
52705
  }
53136
52706
 
53137
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
52707
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
53138
52708
  var import_ejs = __toESM(require_ejs());
53139
52709
  function renderString(template, fullData) {
53140
52710
  return import_ejs.default.render(template, fullData) || "";
53141
52711
  }
53142
52712
 
53143
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
52713
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
53144
52714
  var EjsAPI = class {
53145
52715
  async renderTemplate(templateResource, target, parameters = {}) {
53146
52716
  if (templateResource._type !== FS_RESOURCE) {
@@ -53172,17 +52742,17 @@ var EjsAPI = class {
53172
52742
  }
53173
52743
  };
53174
52744
 
53175
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
53176
- var import_path4 = __toESM(require("path"));
53177
- var import_utils8 = require("@modern-js/utils");
52745
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
52746
+ var import_path2 = __toESM(require("path"));
52747
+ var import_utils4 = require("@modern-js/utils");
53178
52748
  var FsAPI = class {
53179
52749
  async renderFile(resource, target) {
53180
52750
  if (resource._type !== FS_RESOURCE) {
53181
52751
  throw new Error("resource not match");
53182
52752
  }
53183
- const filePath = import_path4.default.resolve(this.generatorCore.outputPath, target.toString());
53184
- await import_utils8.fs.mkdirp(import_path4.default.dirname(filePath));
53185
- await import_utils8.fs.copyFile(resource.filePath, filePath);
52753
+ const filePath = import_path2.default.resolve(this.generatorCore.outputPath, target.toString());
52754
+ await import_utils4.fs.mkdirp(import_path2.default.dirname(filePath));
52755
+ await import_utils4.fs.copyFile(resource.filePath, filePath);
53186
52756
  }
53187
52757
  async renderDir(material, findGlob, target, options) {
53188
52758
  const resourceMap = await material.find(findGlob, {
@@ -53199,11 +52769,11 @@ var FsAPI = class {
53199
52769
  }
53200
52770
  };
53201
52771
 
53202
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
53203
- var import_utils9 = require("@modern-js/utils");
52772
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
52773
+ var import_utils5 = require("@modern-js/utils");
53204
52774
  async function canUseGit() {
53205
52775
  try {
53206
- await (0, import_utils9.execa)("git", [
52776
+ await (0, import_utils5.execa)("git", [
53207
52777
  "--version"
53208
52778
  ], {
53209
52779
  env: process.env
@@ -53215,7 +52785,7 @@ async function canUseGit() {
53215
52785
  }
53216
52786
  async function isInGitRepo(cwd) {
53217
52787
  try {
53218
- await (0, import_utils9.execa)("git", [
52788
+ await (0, import_utils5.execa)("git", [
53219
52789
  "rev-parse",
53220
52790
  "--is-inside-work-tree"
53221
52791
  ], {
@@ -53228,13 +52798,13 @@ async function isInGitRepo(cwd) {
53228
52798
  }
53229
52799
  }
53230
52800
  async function initGitRepo(cwd, defaultBranch) {
53231
- await (0, import_utils9.execa)("git", [
52801
+ await (0, import_utils5.execa)("git", [
53232
52802
  "init"
53233
52803
  ], {
53234
52804
  env: process.env,
53235
52805
  cwd
53236
52806
  });
53237
- const { stdout } = await (0, import_utils9.execa)("git", [
52807
+ const { stdout } = await (0, import_utils5.execa)("git", [
53238
52808
  "symbolic-ref",
53239
52809
  "--short",
53240
52810
  "HEAD"
@@ -53243,7 +52813,7 @@ async function initGitRepo(cwd, defaultBranch) {
53243
52813
  cwd
53244
52814
  });
53245
52815
  if (stdout !== defaultBranch) {
53246
- await (0, import_utils9.execa)("git", [
52816
+ await (0, import_utils5.execa)("git", [
53247
52817
  "checkout",
53248
52818
  "-b",
53249
52819
  defaultBranch
@@ -53254,7 +52824,7 @@ async function initGitRepo(cwd, defaultBranch) {
53254
52824
  }
53255
52825
  }
53256
52826
  async function gitAdd(cwd) {
53257
- await (0, import_utils9.execa)("git", [
52827
+ await (0, import_utils5.execa)("git", [
53258
52828
  "add",
53259
52829
  "-A"
53260
52830
  ], {
@@ -53263,7 +52833,7 @@ async function gitAdd(cwd) {
53263
52833
  });
53264
52834
  }
53265
52835
  async function gitCommit(cwd, commitMessage) {
53266
- await (0, import_utils9.execa)("git", [
52836
+ await (0, import_utils5.execa)("git", [
53267
52837
  "commit",
53268
52838
  "-m",
53269
52839
  commitMessage,
@@ -53274,7 +52844,7 @@ async function gitCommit(cwd, commitMessage) {
53274
52844
  });
53275
52845
  }
53276
52846
 
53277
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
52847
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
53278
52848
  var GitAPI = class {
53279
52849
  async isInGitRepo(cwd = this.generatorCore.outputPath) {
53280
52850
  const canUse = await canUseGit();
@@ -53324,7 +52894,7 @@ var GitAPI = class {
53324
52894
  }
53325
52895
  };
53326
52896
 
53327
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
52897
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
53328
52898
  var import_handlebars = __toESM(require_lib());
53329
52899
  function renderString2(template, fullData, registers) {
53330
52900
  const helpers = {
@@ -53338,7 +52908,7 @@ function renderString2(template, fullData, registers) {
53338
52908
  return import_handlebars.default.compile(template)(fullData) || "";
53339
52909
  }
53340
52910
 
53341
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.4.0_@modern-js+codesmith@2.4.0/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
52911
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.4.1_@modern-js+codesmith@2.4.1/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
53342
52912
  var HandlebarsAPI = class {
53343
52913
  async registerHelp(helpers) {
53344
52914
  this.registers.helpers = {
@@ -53386,11 +52956,11 @@ var HandlebarsAPI = class {
53386
52956
  }
53387
52957
  };
53388
52958
 
53389
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
53390
- var import_utils12 = require("@modern-js/utils");
52959
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
52960
+ var import_utils8 = require("@modern-js/utils");
53391
52961
  async function canUseNvm() {
53392
52962
  try {
53393
- await (0, import_utils12.execa)("source ~/.nvm/nvm.sh", {
52963
+ await (0, import_utils8.execa)("source ~/.nvm/nvm.sh", {
53394
52964
  env: process.env,
53395
52965
  shell: true
53396
52966
  });
@@ -53399,9 +52969,9 @@ async function canUseNvm() {
53399
52969
  return false;
53400
52970
  }
53401
52971
  }
53402
- async function canUseNpm3() {
52972
+ async function canUseNpm() {
53403
52973
  try {
53404
- await (0, import_utils12.execa)("npm", [
52974
+ await (0, import_utils8.execa)("npm", [
53405
52975
  "--version"
53406
52976
  ], {
53407
52977
  env: process.env
@@ -53411,9 +52981,9 @@ async function canUseNpm3() {
53411
52981
  return false;
53412
52982
  }
53413
52983
  }
53414
- async function canUseYarn2() {
52984
+ async function canUseYarn() {
53415
52985
  try {
53416
- await (0, import_utils12.execa)("yarn", [
52986
+ await (0, import_utils8.execa)("yarn", [
53417
52987
  "--version"
53418
52988
  ], {
53419
52989
  env: process.env
@@ -53423,9 +52993,9 @@ async function canUseYarn2() {
53423
52993
  return false;
53424
52994
  }
53425
52995
  }
53426
- async function canUsePnpm3() {
52996
+ async function canUsePnpm() {
53427
52997
  try {
53428
- await (0, import_utils12.execa)("pnpm", [
52998
+ await (0, import_utils8.execa)("pnpm", [
53429
52999
  "--version"
53430
53000
  ], {
53431
53001
  env: process.env
@@ -53436,10 +53006,10 @@ async function canUsePnpm3() {
53436
53006
  }
53437
53007
  }
53438
53008
 
53439
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
53440
- var import_utils13 = require("@modern-js/utils");
53009
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
53010
+ var import_utils9 = require("@modern-js/utils");
53441
53011
  function execaWithStreamLog(command, args, options) {
53442
- const promise = (0, import_utils13.execa)(command, args, {
53012
+ const promise = (0, import_utils9.execa)(command, args, {
53443
53013
  ...options,
53444
53014
  stdin: "inherit",
53445
53015
  stdout: "inherit",
@@ -53448,7 +53018,7 @@ function execaWithStreamLog(command, args, options) {
53448
53018
  return promise;
53449
53019
  }
53450
53020
  async function runInstallWithNvm(command, options) {
53451
- await (0, import_utils13.execa)(`~/.nvm/nvm-exec ${command}`, {
53021
+ await (0, import_utils9.execa)(`~/.nvm/nvm-exec ${command}`, {
53452
53022
  ...options,
53453
53023
  shell: true,
53454
53024
  stdin: "inherit",
@@ -53457,7 +53027,7 @@ async function runInstallWithNvm(command, options) {
53457
53027
  });
53458
53028
  }
53459
53029
  async function npmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53460
- const canUse = await canUseNpm3();
53030
+ const canUse = await canUseNpm();
53461
53031
  if (canUse) {
53462
53032
  const params = [
53463
53033
  "install"
@@ -53482,7 +53052,7 @@ async function npmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53482
53052
  throw new Error("please install npm first");
53483
53053
  }
53484
53054
  async function yarnInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53485
- const canUse = await canUseYarn2();
53055
+ const canUse = await canUseYarn();
53486
53056
  if (canUse) {
53487
53057
  const params = [
53488
53058
  "install"
@@ -53507,7 +53077,7 @@ async function yarnInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53507
53077
  throw new Error("please install yarn first");
53508
53078
  }
53509
53079
  async function pnpmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53510
- const canUse = await canUsePnpm3();
53080
+ const canUse = await canUsePnpm();
53511
53081
  if (canUse) {
53512
53082
  const params = [
53513
53083
  "install"
@@ -53532,7 +53102,7 @@ async function pnpmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
53532
53102
  throw new Error("please install pnpm first");
53533
53103
  }
53534
53104
 
53535
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
53105
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.4.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
53536
53106
  var NpmAPI = class {
53537
53107
  npmInstall({ cwd, registryUrl, ignoreScripts }) {
53538
53108
  return npmInstall({
@@ -53942,7 +53512,7 @@ function pascalCase(input, options) {
53942
53512
  }
53943
53513
 
53944
53514
  // ../../../../node_modules/.pnpm/@formily+shared@2.2.24/node_modules/@formily/shared/esm/string.js
53945
- var ansiRegex2 = function() {
53515
+ var ansiRegex = function() {
53946
53516
  var pattern = [
53947
53517
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)",
53948
53518
  "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
@@ -53953,11 +53523,11 @@ var regex = "[\uD800-\uDBFF][\uDC00-\uDFFF]";
53953
53523
  var astralRegex = function(opts) {
53954
53524
  return opts && opts.exact ? new RegExp("^".concat(regex, "$")) : new RegExp(regex, "g");
53955
53525
  };
53956
- var stripAnsi3 = function(input) {
53957
- return typeof input === "string" ? input.replace(ansiRegex2(), "") : input;
53526
+ var stripAnsi = function(input) {
53527
+ return typeof input === "string" ? input.replace(ansiRegex(), "") : input;
53958
53528
  };
53959
53529
  var stringLength = function(input) {
53960
- return stripAnsi3(input).replace(astralRegex(), " ").length;
53530
+ return stripAnsi(input).replace(astralRegex(), " ").length;
53961
53531
  };
53962
53532
 
53963
53533
  // ../../../../node_modules/.pnpm/@formily+path@2.2.24/node_modules/@formily/path/esm/contexts.js
@@ -63116,11 +62686,11 @@ var Schema = (
63116
62686
  }()
63117
62687
  );
63118
62688
 
63119
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
62689
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
63120
62690
  var import_inquirer = __toESM(require_inquirer());
63121
62691
 
63122
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
63123
- var import_lodash3 = require("@modern-js/utils/lodash");
62692
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
62693
+ var import_lodash = require("@modern-js/utils/lodash");
63124
62694
  function validateSchema(schema) {
63125
62695
  const { type, properties } = schema;
63126
62696
  if (type !== "object") {
@@ -63149,7 +62719,7 @@ function getQuestionFromSchema(schema, configValue = {}, validateMap, initValue)
63149
62719
  const questionValidate = async (field2, input) => {
63150
62720
  if (fieldValidate) {
63151
62721
  var _result_error;
63152
- const result2 = await validate(input, (0, import_lodash3.isFunction)(fieldValidate) ? {
62722
+ const result2 = await validate(input, (0, import_lodash.isFunction)(fieldValidate) ? {
63153
62723
  validator: fieldValidate
63154
62724
  } : fieldValidate);
63155
62725
  if ((_result_error = result2.error) === null || _result_error === void 0 ? void 0 : _result_error.length) {
@@ -63173,14 +62743,14 @@ function getQuestionFromSchema(schema, configValue = {}, validateMap, initValue)
63173
62743
  when: !configValue[field]
63174
62744
  };
63175
62745
  if (items) {
63176
- if ((0, import_lodash3.isArray)(defaultValue)) {
62746
+ if ((0, import_lodash.isArray)(defaultValue)) {
63177
62747
  return {
63178
62748
  ...result,
63179
62749
  type: "checkbox",
63180
62750
  choices: items.map((item) => ({
63181
62751
  type: "choice",
63182
- name: (0, import_lodash3.isObject)(item) ? item.label : item,
63183
- value: (0, import_lodash3.isObject)(item) ? item.value : item
62752
+ name: (0, import_lodash.isObject)(item) ? item.label : item,
62753
+ value: (0, import_lodash.isObject)(item) ? item.value : item
63184
62754
  }))
63185
62755
  };
63186
62756
  }
@@ -63189,8 +62759,8 @@ function getQuestionFromSchema(schema, configValue = {}, validateMap, initValue)
63189
62759
  type: "list",
63190
62760
  choices: items.map((item) => ({
63191
62761
  type: "choice",
63192
- name: (0, import_lodash3.isObject)(item) ? item.label : item,
63193
- value: (0, import_lodash3.isObject)(item) ? item.value : item
62762
+ name: (0, import_lodash.isObject)(item) ? item.label : item,
62763
+ value: (0, import_lodash.isObject)(item) ? item.value : item
63194
62764
  }))
63195
62765
  };
63196
62766
  }
@@ -63205,13 +62775,13 @@ function getQuestionFromSchema(schema, configValue = {}, validateMap, initValue)
63205
62775
  type: "input"
63206
62776
  };
63207
62777
  });
63208
- return (0, import_lodash3.flattenDeep)(questions);
62778
+ return (0, import_lodash.flattenDeep)(questions);
63209
62779
  }
63210
62780
  function transformForm(schema, configValue = {}, validateMap, initValue) {
63211
62781
  return getQuestionFromSchema(schema, configValue, validateMap, initValue);
63212
62782
  }
63213
62783
 
63214
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
62784
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
63215
62785
  var compileRule = (rule, scope) => {
63216
62786
  const state = Schema.compile(rule, {
63217
62787
  $self: {},
@@ -63315,7 +62885,7 @@ async function prompt(schema, configValue = {}, validateMap, initValue) {
63315
62885
  return answers;
63316
62886
  }
63317
62887
 
63318
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
62888
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
63319
62889
  var CLIReader = class {
63320
62890
  getAnswers() {
63321
62891
  return this.answers;
@@ -63344,31 +62914,31 @@ var CLIReader = class {
63344
62914
  }
63345
62915
  };
63346
62916
 
63347
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
63348
- var import_utils17 = require("@modern-js/utils");
63349
- var import_lodash7 = require("@modern-js/utils/lodash");
62917
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
62918
+ var import_utils13 = require("@modern-js/utils");
62919
+ var import_lodash5 = require("@modern-js/utils/lodash");
63350
62920
  var import_comment_json = __toESM(require_src2());
63351
62921
  var import_inquirer2 = __toESM(require_inquirer2());
63352
62922
 
63353
62923
  // ../../../../node_modules/.pnpm/@modern-js+plugin-i18n@2.58.0/node_modules/@modern-js/plugin-i18n/dist/esm-node/index.js
63354
- var import_lodash5 = require("@modern-js/utils/lodash");
62924
+ var import_lodash3 = require("@modern-js/utils/lodash");
63355
62925
 
63356
62926
  // ../../../../node_modules/.pnpm/@modern-js+plugin-i18n@2.58.0/node_modules/@modern-js/plugin-i18n/dist/esm-node/utils/index.js
63357
- var import_lodash4 = require("@modern-js/utils/lodash");
63358
- function getObjKeyMap2(obj, prefix = "") {
62927
+ var import_lodash2 = require("@modern-js/utils/lodash");
62928
+ function getObjKeyMap(obj, prefix = "") {
63359
62929
  const result = {};
63360
62930
  Object.keys(obj).forEach((key) => {
63361
- if ((0, import_lodash4.isString)(obj[key])) {
62931
+ if ((0, import_lodash2.isString)(obj[key])) {
63362
62932
  result[key] = prefix ? `${prefix}.${key}` : key;
63363
- } else if ((0, import_lodash4.isObject)(obj[key])) {
63364
- result[key] = getObjKeyMap2(obj[key], prefix ? `${prefix}.${key}` : key);
62933
+ } else if ((0, import_lodash2.isObject)(obj[key])) {
62934
+ result[key] = getObjKeyMap(obj[key], prefix ? `${prefix}.${key}` : key);
63365
62935
  }
63366
62936
  });
63367
62937
  return result;
63368
62938
  }
63369
62939
 
63370
62940
  // ../../../../node_modules/.pnpm/@modern-js+plugin-i18n@2.58.0/node_modules/@modern-js/plugin-i18n/dist/esm-node/index.js
63371
- var I18n2 = class {
62941
+ var I18n = class {
63372
62942
  format(msg, vars) {
63373
62943
  return msg.replace(/\{(\w+)\}/g, (_match, capture) => Object.prototype.hasOwnProperty.call(vars, capture) ? vars[capture] : capture);
63374
62944
  }
@@ -63382,7 +62952,7 @@ var I18n2 = class {
63382
62952
  if (!model) {
63383
62953
  return fallbackText || key;
63384
62954
  }
63385
- const message = (0, import_lodash5.get)(model, key);
62955
+ const message = (0, import_lodash3.get)(model, key);
63386
62956
  const value = message || fallbackText || key;
63387
62957
  if (typeof value === "string") {
63388
62958
  return this.format(value, vars || {});
@@ -63394,7 +62964,7 @@ var I18n2 = class {
63394
62964
  if (languageMap) {
63395
62965
  this.languageMap = languageMap;
63396
62966
  }
63397
- return getObjKeyMap2(this.languageMap[this.language]);
62967
+ return getObjKeyMap(this.languageMap[this.language]);
63398
62968
  }
63399
62969
  changeLanguage(config) {
63400
62970
  this.language = config.locale || "en";
@@ -63413,8 +62983,8 @@ var I18n2 = class {
63413
62983
  }
63414
62984
  };
63415
62985
 
63416
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
63417
- var EN_LOCALE2 = {
62986
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
62987
+ var EN_LOCALE = {
63418
62988
  environment: {
63419
62989
  node_version: "please upgrade node to lts version",
63420
62990
  nvm_install: "please install nvm first",
@@ -63440,8 +63010,8 @@ var EN_LOCALE2 = {
63440
63010
  }
63441
63011
  };
63442
63012
 
63443
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
63444
- var ZH_LOCALE2 = {
63013
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
63014
+ var ZH_LOCALE = {
63445
63015
  environment: {
63446
63016
  node_version: "请升级 Node 版本至 LIS",
63447
63017
  nvm_install: "检测到环境中未安装 nvm,请先安装 nvm",
@@ -63467,16 +63037,16 @@ var ZH_LOCALE2 = {
63467
63037
  }
63468
63038
  };
63469
63039
 
63470
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
63471
- var i18n2 = new I18n2();
63472
- var localeKeys2 = i18n2.init("zh", {
63473
- zh: ZH_LOCALE2,
63474
- en: EN_LOCALE2
63040
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
63041
+ var i18n = new I18n();
63042
+ var localeKeys = i18n.init("zh", {
63043
+ zh: ZH_LOCALE,
63044
+ en: EN_LOCALE
63475
63045
  });
63476
63046
 
63477
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
63478
- var import_path6 = __toESM(require("path"));
63479
- var import_utils16 = require("@modern-js/utils");
63047
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
63048
+ var import_path4 = __toESM(require("path"));
63049
+ var import_utils12 = require("@modern-js/utils");
63480
63050
  var NODE_MAJOR_VERSION_MAP = {
63481
63051
  "lts/*": 18,
63482
63052
  "lts/argon": 4,
@@ -63489,7 +63059,7 @@ var NODE_MAJOR_VERSION_MAP = {
63489
63059
  "lts/hydrogen": 18
63490
63060
  };
63491
63061
  async function getNoteVersion() {
63492
- const result = await (0, import_utils16.execa)("node", [
63062
+ const result = await (0, import_utils12.execa)("node", [
63493
63063
  "--version"
63494
63064
  ]);
63495
63065
  return result.stdout.slice(1);
@@ -63498,13 +63068,13 @@ async function checkUseNvm(cwd, logger2) {
63498
63068
  if (process.platform.startsWith("win")) {
63499
63069
  return false;
63500
63070
  }
63501
- if (!await fsExists(import_path6.default.join(cwd, ".nvmrc"))) {
63071
+ if (!await fsExists(import_path4.default.join(cwd, ".nvmrc"))) {
63502
63072
  return false;
63503
63073
  }
63504
- const nvmrcContent = (await import_utils16.fs.readFile(import_path6.default.join(cwd, ".nvmrc"), "utf-8")).replace("\n", "");
63074
+ const nvmrcContent = (await import_utils12.fs.readFile(import_path4.default.join(cwd, ".nvmrc"), "utf-8")).replace("\n", "");
63505
63075
  const expectNodeVersion = NODE_MAJOR_VERSION_MAP[nvmrcContent] || nvmrcContent;
63506
63076
  const currentNodeVersion = await getNoteVersion();
63507
- if (expectNodeVersion === import_utils16.semver.major(currentNodeVersion)) {
63077
+ if (expectNodeVersion === import_utils12.semver.major(currentNodeVersion)) {
63508
63078
  return false;
63509
63079
  }
63510
63080
  if (!await canUseNvm()) {
@@ -63522,8 +63092,8 @@ async function checkUseNvm(cwd, logger2) {
63522
63092
  }
63523
63093
  }
63524
63094
 
63525
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
63526
- var import_lodash6 = require("@modern-js/utils/lodash");
63095
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
63096
+ var import_lodash4 = require("@modern-js/utils/lodash");
63527
63097
  function transformInquirerSchema(questions, configValue = {}, validateMap = {}, initValue = {}) {
63528
63098
  for (const question of questions) {
63529
63099
  question.default = initValue[question.name] || question.default;
@@ -63531,7 +63101,7 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
63531
63101
  question.validate = async (input, answers) => {
63532
63102
  if (originValidate) {
63533
63103
  const result = await originValidate(input, answers);
63534
- if ((0, import_lodash6.isString)(result)) {
63104
+ if ((0, import_lodash4.isString)(result)) {
63535
63105
  return result;
63536
63106
  }
63537
63107
  }
@@ -63550,16 +63120,16 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
63550
63120
  return questions;
63551
63121
  }
63552
63122
 
63553
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.0_@modern-js+codesmith@2.4.0_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
63123
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.4.1_@modern-js+codesmith@2.4.1_typescript@5.3.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
63554
63124
  var AppAPI = class {
63555
63125
  async checkEnvironment(nodeVersion) {
63556
- if (import_utils17.semver.lt(process.versions.node, nodeVersion || "12.22.12")) {
63557
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.environment.node_version));
63126
+ if (import_utils13.semver.lt(process.versions.node, nodeVersion || "12.22.12")) {
63127
+ this.generatorCore.logger.warn(i18n.t(localeKeys.environment.node_version));
63558
63128
  return false;
63559
63129
  }
63560
- if (!await canUseYarn2() && !await canUsePnpm3() && !await canUseNpm3()) {
63130
+ if (!await canUseYarn() && !await canUsePnpm() && !await canUseNpm()) {
63561
63131
  this.generatorCore.logger.debug("can't use yarn or pnpm or npm");
63562
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.environment.yarn_pnpm_npm));
63132
+ this.generatorCore.logger.warn(i18n.t(localeKeys.environment.yarn_pnpm_npm));
63563
63133
  return false;
63564
63134
  }
63565
63135
  return true;
@@ -63576,7 +63146,7 @@ var AppAPI = class {
63576
63146
  }
63577
63147
  let intallPromise;
63578
63148
  if (command) {
63579
- intallPromise = (0, import_utils17.execa)(command, [], {
63149
+ intallPromise = (0, import_utils13.execa)(command, [], {
63580
63150
  shell: true,
63581
63151
  stdin: "inherit",
63582
63152
  stdout: "inherit",
@@ -63601,10 +63171,10 @@ var AppAPI = class {
63601
63171
  }
63602
63172
  try {
63603
63173
  await intallPromise;
63604
- this.generatorCore.logger.info(i18n2.t(localeKeys2.install.success));
63174
+ this.generatorCore.logger.info(i18n.t(localeKeys.install.success));
63605
63175
  } catch (e) {
63606
63176
  this.generatorCore.logger.warn(e);
63607
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.install.failed, {
63177
+ this.generatorCore.logger.warn(i18n.t(localeKeys.install.failed, {
63608
63178
  command: command || `${packageManager} install`
63609
63179
  }));
63610
63180
  }
@@ -63625,16 +63195,16 @@ var AppAPI = class {
63625
63195
  }
63626
63196
  } catch (e) {
63627
63197
  this.generatorCore.logger.debug("Dependencies install failed", e);
63628
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.install.failed_no_command));
63198
+ this.generatorCore.logger.warn(i18n.t(localeKeys.install.failed_no_command));
63629
63199
  }
63630
63200
  try {
63631
63201
  if (!isMonorepoSubProject && !customNoNeedGit && !inGitRepo) {
63632
63202
  await this.gitApi.addAndCommit(commitMessage || "feat: init");
63633
- this.generatorCore.logger.info(i18n2.t(localeKeys2.git.success));
63203
+ this.generatorCore.logger.info(i18n.t(localeKeys.git.success));
63634
63204
  }
63635
63205
  } catch (e) {
63636
63206
  this.generatorCore.logger.debug("Git repository create failed", e);
63637
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.git.failed));
63207
+ this.generatorCore.logger.warn(i18n.t(localeKeys.git.failed));
63638
63208
  }
63639
63209
  }
63640
63210
  async forgeTemplate(templatePattern, filter, rename, parameters, type = "handlebars") {
@@ -63659,7 +63229,7 @@ var AppAPI = class {
63659
63229
  }
63660
63230
  } catch (e) {
63661
63231
  this.generatorCore.logger.debug("base forging failed:", e);
63662
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.templated.failed));
63232
+ this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
63663
63233
  throw new Error("base forging failed");
63664
63234
  } finally {
63665
63235
  var _this_generatorCore_logger_timing1, _this_generatorCore_logger1;
@@ -63698,7 +63268,7 @@ var AppAPI = class {
63698
63268
  }
63699
63269
  } catch (e) {
63700
63270
  this.generatorCore.logger.debug("base forging failed:", e);
63701
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.templated.failed));
63271
+ this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
63702
63272
  throw new Error("base forging failed");
63703
63273
  } finally {
63704
63274
  var _this_generatorCore_logger_timing1, _this_generatorCore_logger1;
@@ -63707,35 +63277,35 @@ var AppAPI = class {
63707
63277
  }
63708
63278
  async updateWorkspace(folder, workspaceName = "monorepo.code-workspace") {
63709
63279
  const { filePath } = this.generatorContext.materials.default.get(workspaceName);
63710
- if (!import_utils17.fs.existsSync(filePath)) {
63280
+ if (!import_utils13.fs.existsSync(filePath)) {
63711
63281
  return;
63712
63282
  }
63713
- const content = await import_utils17.fs.readFile(filePath);
63283
+ const content = await import_utils13.fs.readFile(filePath);
63714
63284
  const workspace = (0, import_comment_json.parse)(content.toString());
63715
63285
  workspace.folders = [
63716
63286
  folder,
63717
63287
  ...workspace.folders || []
63718
63288
  ];
63719
63289
  const indent = 2;
63720
- await import_utils17.fs.writeFile(filePath, (0, import_comment_json.stringify)(workspace, null, indent), {
63290
+ await import_utils13.fs.writeFile(filePath, (0, import_comment_json.stringify)(workspace, null, indent), {
63721
63291
  encoding: "utf-8"
63722
63292
  });
63723
63293
  }
63724
63294
  showSuccessInfo(successInfo) {
63725
- this.generatorCore.logger.info(successInfo || i18n2.t(localeKeys2.success.info));
63295
+ this.generatorCore.logger.info(successInfo || i18n.t(localeKeys.success.info));
63726
63296
  }
63727
63297
  async runSubGenerator(subGenerator, relativePwdPath, config) {
63728
63298
  try {
63729
63299
  await this.generatorCore.runSubGenerator(subGenerator, relativePwdPath, config);
63730
63300
  } catch (e) {
63731
- this.generatorCore.logger.warn(i18n2.t(localeKeys2.generator.failed));
63732
- this.generatorCore.logger.debug(i18n2.t(localeKeys2.generator.failed), e);
63301
+ this.generatorCore.logger.warn(i18n.t(localeKeys.generator.failed));
63302
+ this.generatorCore.logger.debug(i18n.t(localeKeys.generator.failed), e);
63733
63303
  throw new Error("run sub generator failed");
63734
63304
  }
63735
63305
  }
63736
63306
  mergeAnswers(answers, configValue) {
63737
- const inputData = (0, import_lodash7.merge)(answers, configValue);
63738
- this.generatorContext.config = (0, import_lodash7.merge)(this.generatorContext.config, inputData);
63307
+ const inputData = (0, import_lodash5.merge)(answers, configValue);
63308
+ this.generatorContext.config = (0, import_lodash5.merge)(this.generatorContext.config, inputData);
63739
63309
  return inputData;
63740
63310
  }
63741
63311
  async getInputBySchemaFunc(schemaFunc, configValue = {}, validateMap = {}, initValue = {}) {
@@ -63771,7 +63341,7 @@ var AppAPI = class {
63771
63341
  return this.mergeAnswers(answers, configValue);
63772
63342
  }
63773
63343
  constructor(generatorContext, generatorCore) {
63774
- this.i18n = i18n2;
63344
+ this.i18n = i18n;
63775
63345
  this.generatorCore = generatorCore;
63776
63346
  this.generatorContext = generatorContext;
63777
63347
  this.npmApi = new NpmAPI(generatorCore);
@@ -63782,11 +63352,11 @@ var AppAPI = class {
63782
63352
  }
63783
63353
  };
63784
63354
 
63785
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
63355
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
63786
63356
  var import_comment_json2 = __toESM(require_src2());
63787
63357
  var declarationUpdate = __toESM(require_dist());
63788
63358
 
63789
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
63359
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
63790
63360
  async function editJson(generatorCore, resource, getNewJsonValue) {
63791
63361
  const originJsonValue = await resource.value();
63792
63362
  const newJsonString = await getNewJsonValue(originJsonValue.content);
@@ -63799,7 +63369,7 @@ async function editJson(generatorCore, resource, getNewJsonValue) {
63799
63369
  return newJsonString;
63800
63370
  }
63801
63371
 
63802
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
63372
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.4.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
63803
63373
  var JsonAPI = class {
63804
63374
  async get(resource) {
63805
63375
  const originJsonValue = await resource.value();
@@ -63843,15 +63413,475 @@ var JsonAPI = class {
63843
63413
  }
63844
63414
  };
63845
63415
 
63416
+ // ../../../cli/plugin-i18n/dist/esm-node/index.js
63417
+ var import_lodash7 = require("@modern-js/utils/lodash");
63418
+
63419
+ // ../../../cli/plugin-i18n/dist/esm-node/utils/index.js
63420
+ var import_lodash6 = require("@modern-js/utils/lodash");
63421
+ function getObjKeyMap2(obj, prefix = "") {
63422
+ const result = {};
63423
+ Object.keys(obj).forEach((key) => {
63424
+ if ((0, import_lodash6.isString)(obj[key])) {
63425
+ result[key] = prefix ? `${prefix}.${key}` : key;
63426
+ } else if ((0, import_lodash6.isObject)(obj[key])) {
63427
+ result[key] = getObjKeyMap2(obj[key], prefix ? `${prefix}.${key}` : key);
63428
+ }
63429
+ });
63430
+ return result;
63431
+ }
63432
+
63433
+ // ../../../cli/plugin-i18n/dist/esm-node/index.js
63434
+ var I18n2 = class {
63435
+ format(msg, vars) {
63436
+ return msg.replace(/\{(\w+)\}/g, (_match, capture) => Object.prototype.hasOwnProperty.call(vars, capture) ? vars[capture] : capture);
63437
+ }
63438
+ getMessage(lang, key, vars, fallbackText) {
63439
+ const languages = Object.keys(this.languageMap);
63440
+ const resultLang = languages.find((l) => l === lang);
63441
+ if (!resultLang && languages.length === 0) {
63442
+ return fallbackText || key;
63443
+ }
63444
+ const model = this.languageMap[resultLang || "en"];
63445
+ if (!model) {
63446
+ return fallbackText || key;
63447
+ }
63448
+ const message = (0, import_lodash7.get)(model, key);
63449
+ const value = message || fallbackText || key;
63450
+ if (typeof value === "string") {
63451
+ return this.format(value, vars || {});
63452
+ }
63453
+ throw new Error("key is not a string");
63454
+ }
63455
+ init(language, languageMap) {
63456
+ this.language = language || "en";
63457
+ if (languageMap) {
63458
+ this.languageMap = languageMap;
63459
+ }
63460
+ return getObjKeyMap2(this.languageMap[this.language]);
63461
+ }
63462
+ changeLanguage(config) {
63463
+ this.language = config.locale || "en";
63464
+ }
63465
+ t(key, vars, fallbackText) {
63466
+ return this.getMessage(this.language, key, vars, fallbackText);
63467
+ }
63468
+ lang(lang) {
63469
+ return {
63470
+ t: (key, vars, fallbackText) => this.getMessage(lang, key, vars, fallbackText)
63471
+ };
63472
+ }
63473
+ constructor() {
63474
+ this.language = "en";
63475
+ this.languageMap = {};
63476
+ }
63477
+ };
63478
+
63479
+ // ../../generator-common/dist/esm-node/locale/en.js
63480
+ var EN_LOCALE2 = {
63481
+ solution: {
63482
+ self: "Please select the type of project you want to create:",
63483
+ mwa: "Web App",
63484
+ module: "Npm Module",
63485
+ custom: "Custom Solution",
63486
+ default: "Default"
63487
+ },
63488
+ scenes: {
63489
+ self: "Please select the project scenario:"
63490
+ },
63491
+ sub_solution: {
63492
+ self: "Please select the type of project you want to create:",
63493
+ mwa: "Web App",
63494
+ module: "Npm Module"
63495
+ },
63496
+ action: {
63497
+ self: "Please select the operation you want:",
63498
+ function: {
63499
+ self: "Enable Features",
63500
+ question: "Please select the feature name:",
63501
+ tailwindcss: "Enable Tailwind CSS",
63502
+ bff: "Enable BFF",
63503
+ micro_frontend: "Enable Micro Frontend",
63504
+ i18n: "Enable Internationalization (i18n)",
63505
+ storybookV7: "Enable Storybook V7",
63506
+ runtime_api: "Enable Runtime API",
63507
+ ssg: "Enable SSG",
63508
+ polyfill: "Enable UA-based Polyfill Feature",
63509
+ proxy: "Enable Global Proxy",
63510
+ swc: "Enable SWC Compile",
63511
+ module_doc: "Enable Module Doc"
63512
+ },
63513
+ element: {
63514
+ self: "Create Element",
63515
+ question: "Please select the type of element to create:",
63516
+ entry: 'New "entry"',
63517
+ server: 'New "Custom Web Server" source code directory'
63518
+ },
63519
+ refactor: {
63520
+ self: "Automatic Refactor",
63521
+ question: "Please select the type of refactoring:",
63522
+ react_router_5: "Use React Router v5"
63523
+ }
63524
+ },
63525
+ boolean: {
63526
+ yes: "Yes",
63527
+ no: "No"
63528
+ },
63529
+ language: {
63530
+ self: "Please select the programming language:"
63531
+ },
63532
+ packageManager: {
63533
+ self: "Please select the package manager:"
63534
+ },
63535
+ entry: {
63536
+ name: "Please fill in the entry name:",
63537
+ no_empty: "The entry name cannot be empty!",
63538
+ no_pages: 'The entry name cannot be "pages"!'
63539
+ },
63540
+ packageName: {
63541
+ self: "Please fill in the project name:",
63542
+ sub_name: "Please fill in the sub-project name:",
63543
+ no_empty: "The package name cannot be empty!"
63544
+ },
63545
+ packagePath: {
63546
+ self: "Please fill in the sub-project directory name:",
63547
+ no_empty: "The package path cannot be empty!",
63548
+ format: "Only lowercase letters, numbers and delimiters (-), and underscore (_), and directory delimiters (/) can be used in package path."
63549
+ },
63550
+ framework: {
63551
+ self: "Please select the framework:",
63552
+ egg: "Egg",
63553
+ express: "Express",
63554
+ koa: "Koa",
63555
+ nest: "Nest"
63556
+ },
63557
+ bff: {
63558
+ bffType: {
63559
+ self: "Please select the BFF type:",
63560
+ func: "Function",
63561
+ framework: "Framework"
63562
+ }
63563
+ },
63564
+ buildTools: {
63565
+ self: "Please select the bundler:",
63566
+ webpack: "webpack",
63567
+ rspack: "Rspack (experimental)"
63568
+ }
63569
+ };
63570
+
63571
+ // ../../generator-common/dist/esm-node/locale/zh.js
63572
+ var ZH_LOCALE2 = {
63573
+ solution: {
63574
+ self: "请选择你想创建的工程类型",
63575
+ mwa: "Web 应用",
63576
+ module: "Npm 模块",
63577
+ custom: "自定义",
63578
+ default: "默认"
63579
+ },
63580
+ scenes: {
63581
+ self: "请选择项目场景"
63582
+ },
63583
+ sub_solution: {
63584
+ self: "请选择你想创建的工程类型",
63585
+ mwa: "Web 应用",
63586
+ module: "Npm 模块"
63587
+ },
63588
+ action: {
63589
+ self: "请选择你想要的操作",
63590
+ function: {
63591
+ self: "启用可选功能",
63592
+ question: "请选择功能名称",
63593
+ tailwindcss: "启用「Tailwind CSS」 支持",
63594
+ bff: "启用「BFF」功能",
63595
+ micro_frontend: "启用「微前端」模式",
63596
+ i18n: "启用「国际化(i18n)」功能",
63597
+ storybookV7: "启用「Storybook」V7",
63598
+ runtime_api: "启用「Runtime API」",
63599
+ ssg: "启用「SSG」功能",
63600
+ polyfill: "启用「基于 UA 的 Polyfill」功能",
63601
+ proxy: "启用「全局代理」",
63602
+ swc: "启用「SWC 编译」",
63603
+ module_doc: "启动「模块文档」功能"
63604
+ },
63605
+ element: {
63606
+ self: "创建工程元素",
63607
+ question: "请选择创建元素类型",
63608
+ entry: "新建「应用入口」",
63609
+ server: "新建「自定义 Web Server」源码目录"
63610
+ },
63611
+ refactor: {
63612
+ self: "自动重构",
63613
+ question: "请选择重构类型",
63614
+ react_router_5: "使用 React Router v5"
63615
+ }
63616
+ },
63617
+ boolean: {
63618
+ yes: "是",
63619
+ no: "否"
63620
+ },
63621
+ language: {
63622
+ self: "请选择开发语言"
63623
+ },
63624
+ packageManager: {
63625
+ self: "请选择包管理工具"
63626
+ },
63627
+ entry: {
63628
+ name: "请填写入口名称",
63629
+ no_empty: "入口名称不能为空!",
63630
+ no_pages: '入口名称不支持 "pages"!'
63631
+ },
63632
+ packageName: {
63633
+ self: "请填写项目名称",
63634
+ sub_name: "请填写子项目名称",
63635
+ no_empty: "项目名称不能为空!"
63636
+ },
63637
+ packagePath: {
63638
+ self: "请填写子项目目录名称",
63639
+ no_empty: "目录名称不能为空!",
63640
+ format: "目录名称只能使用小写字母、数字和分隔线(-)、下划线(_)和目录分隔符(/)"
63641
+ },
63642
+ framework: {
63643
+ self: "请选择运行时框架",
63644
+ egg: "Egg",
63645
+ express: "Express",
63646
+ koa: "Koa",
63647
+ nest: "Nest"
63648
+ },
63649
+ bff: {
63650
+ bffType: {
63651
+ self: "请选择 BFF 类型",
63652
+ func: "函数模式",
63653
+ framework: "框架模式"
63654
+ }
63655
+ },
63656
+ buildTools: {
63657
+ self: "请选择构建工具",
63658
+ webpack: "webpack",
63659
+ rspack: "Rspack (实验性)"
63660
+ }
63661
+ };
63662
+
63663
+ // ../../generator-common/dist/esm-node/locale/index.js
63664
+ var i18n2 = new I18n2();
63665
+ var localeKeys2 = i18n2.init("en", {
63666
+ zh: ZH_LOCALE2,
63667
+ en: EN_LOCALE2
63668
+ });
63669
+
63670
+ // ../../generator-common/dist/esm-node/common/solution.js
63671
+ var Solution;
63672
+ (function(Solution2) {
63673
+ Solution2["MWA"] = "mwa";
63674
+ Solution2["Module"] = "module";
63675
+ })(Solution || (Solution = {}));
63676
+ var SolutionToolsMap = {
63677
+ ["mwa"]: "@modern-js/app-tools",
63678
+ ["module"]: "@modern-js/module-tools"
63679
+ };
63680
+ var DependenceGenerator = "@modern-js/dependence-generator";
63681
+
63682
+ // ../../generator-common/dist/esm-node/common/language.js
63683
+ var Language;
63684
+ (function(Language2) {
63685
+ Language2["TS"] = "ts";
63686
+ Language2["JS"] = "js";
63687
+ })(Language || (Language = {}));
63688
+
63689
+ // ../../generator-utils/dist/esm/index.js
63690
+ var import_path6 = __toESM(require("path"));
63691
+ var import_utils17 = require("@modern-js/utils");
63692
+
63693
+ // ../../generator-utils/dist/esm/utils/package.js
63694
+ var import_utils16 = require("@modern-js/utils");
63695
+ async function isPackageExist(packageName, registry2) {
63696
+ if (await (0, import_utils16.canUseNpm)()) {
63697
+ try {
63698
+ const args = [
63699
+ "view",
63700
+ packageName,
63701
+ "version"
63702
+ ];
63703
+ if (registry2) {
63704
+ args.push(`--registry=${registry2}`);
63705
+ }
63706
+ const result = await (0, import_utils16.execa)("npm", args);
63707
+ return (0, import_utils16.stripAnsi)(result.stdout);
63708
+ } catch (e) {
63709
+ return false;
63710
+ }
63711
+ }
63712
+ throw new Error("not found npm, please install npm before");
63713
+ }
63714
+ async function isPackageDeprecated(packageName, registry2) {
63715
+ if (await (0, import_utils16.canUseNpm)()) {
63716
+ const args = [
63717
+ "view",
63718
+ packageName,
63719
+ "deprecated"
63720
+ ];
63721
+ if (registry2) {
63722
+ args.push(`--registry=${registry2}`);
63723
+ }
63724
+ const result = await (0, import_utils16.execa)("npm", args);
63725
+ return (0, import_utils16.stripAnsi)(result.stdout);
63726
+ }
63727
+ throw new Error("not found npm, please install npm before");
63728
+ }
63729
+ function semverDecrease(version) {
63730
+ const versionObj = import_utils16.semver.parse(version, {
63731
+ loose: true
63732
+ });
63733
+ if (!versionObj) {
63734
+ throw new Error(`Version ${version} is not valid semver`);
63735
+ }
63736
+ versionObj.build = [];
63737
+ versionObj.prerelease = [];
63738
+ versionObj.patch--;
63739
+ const result = versionObj.format();
63740
+ if (!import_utils16.semver.valid(result)) {
63741
+ import_utils16.logger.debug(`Version ${result} is not valid semver`);
63742
+ return version;
63743
+ }
63744
+ return result;
63745
+ }
63746
+ async function getAvailableVersion(packageName, currentVersion, registry2) {
63747
+ let times = 5;
63748
+ let version = currentVersion;
63749
+ while (times) {
63750
+ if (!await isPackageExist(`${packageName}@${version}`, registry2) || await isPackageDeprecated(`${packageName}@${version}`, registry2)) {
63751
+ version = import_utils16.semver.inc(version, "patch");
63752
+ times--;
63753
+ continue;
63754
+ }
63755
+ return version;
63756
+ }
63757
+ times = 5;
63758
+ while (times) {
63759
+ version = semverDecrease(version);
63760
+ if (!await isPackageExist(`${packageName}@${version}`, registry2) || await isPackageDeprecated(`${packageName}@${version}`, registry2)) {
63761
+ times--;
63762
+ continue;
63763
+ }
63764
+ return version;
63765
+ }
63766
+ return currentVersion;
63767
+ }
63768
+
63769
+ // ../../generator-utils/dist/esm/utils/stripAnsi.js
63770
+ function ansiRegex2({ onlyFirst = false } = {}) {
63771
+ const pattern = [
63772
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
63773
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
63774
+ ].join("|");
63775
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
63776
+ }
63777
+ function stripAnsi3(string) {
63778
+ if (typeof string !== "string") {
63779
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
63780
+ }
63781
+ return string.replace(ansiRegex2(), "");
63782
+ }
63783
+
63784
+ // ../../generator-utils/dist/esm/utils/getGeneratorPath.js
63785
+ var import_path5 = __toESM(require("path"));
63786
+ var getGeneratorPath = (generator, distTag, paths) => {
63787
+ if (process.env.CODESMITH_ENV === "development") {
63788
+ return import_path5.default.dirname(require.resolve(generator, {
63789
+ paths: paths !== null && paths !== void 0 ? paths : [
63790
+ process.cwd()
63791
+ ]
63792
+ }));
63793
+ } else if (distTag) {
63794
+ return `${generator}@${distTag}`;
63795
+ }
63796
+ return generator;
63797
+ };
63798
+
63799
+ // ../../generator-utils/dist/esm/index.js
63800
+ var import_utils18 = require("@modern-js/utils");
63801
+ async function getPackageVersion(packageName, registry2) {
63802
+ const spinner = (0, import_utils17.ora)({
63803
+ text: "Load Generator...",
63804
+ spinner: "runner"
63805
+ }).start();
63806
+ if (await (0, import_utils17.canUsePnpm)()) {
63807
+ const args = [
63808
+ "info",
63809
+ packageName,
63810
+ "version"
63811
+ ];
63812
+ if (registry2) {
63813
+ args.push(`--registry=${registry2}`);
63814
+ }
63815
+ const result = await (0, import_utils17.execa)("pnpm", args);
63816
+ spinner.stop();
63817
+ return stripAnsi3(result.stdout);
63818
+ }
63819
+ if (await (0, import_utils17.canUseNpm)()) {
63820
+ const args = [
63821
+ "view",
63822
+ packageName,
63823
+ "version"
63824
+ ];
63825
+ if (registry2) {
63826
+ args.push(`--registry=${registry2}`);
63827
+ }
63828
+ const result = await (0, import_utils17.execa)("npm", args);
63829
+ spinner.stop();
63830
+ return stripAnsi3(result.stdout);
63831
+ }
63832
+ spinner.stop();
63833
+ throw new Error("not found npm, please install npm before");
63834
+ }
63835
+ async function getModernPluginVersion(solution, packageName, options = {
63836
+ distTag: "latest"
63837
+ }) {
63838
+ const { cwd = process.cwd(), registry: registry2, distTag } = options;
63839
+ const getLatetPluginVersion = async (tag) => {
63840
+ const version = await getPackageVersion(`${packageName}@${tag || distTag || "latest"}`, registry2);
63841
+ return version;
63842
+ };
63843
+ if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
63844
+ return getLatetPluginVersion("latest");
63845
+ }
63846
+ let pkgPath = import_path6.default.join(require.resolve(SolutionToolsMap[solution], {
63847
+ paths: [
63848
+ cwd
63849
+ ]
63850
+ }), "../../..", "package.json");
63851
+ if (solution === Solution.Module) {
63852
+ pkgPath = import_path6.default.join(require.resolve(SolutionToolsMap[solution], {
63853
+ paths: [
63854
+ cwd
63855
+ ]
63856
+ }), "../..", "package.json");
63857
+ }
63858
+ if (import_utils17.fs.existsSync(pkgPath)) {
63859
+ const pkgInfo = import_utils17.fs.readJSONSync(pkgPath);
63860
+ const modernVersion = pkgInfo.version;
63861
+ if (typeof modernVersion !== "string") {
63862
+ return getLatetPluginVersion();
63863
+ }
63864
+ const version = await getAvailableVersion(packageName, modernVersion, registry2);
63865
+ if (!await isPackageExist(`${packageName}@${version}`)) {
63866
+ return getLatetPluginVersion();
63867
+ }
63868
+ return version;
63869
+ }
63870
+ return getLatetPluginVersion();
63871
+ }
63872
+ function isTsProject(appDir) {
63873
+ return import_utils17.fs.existsSync(import_path6.default.join(appDir, "tsconfig.json"));
63874
+ }
63875
+
63846
63876
  // src/index.ts
63847
63877
  function isEmptyServerDir(serverDir) {
63848
- const files = import_utils4.fs.readdirSync(serverDir);
63878
+ const files = import_utils18.fs.readdirSync(serverDir);
63849
63879
  if (files.length === 0) {
63850
63880
  return true;
63851
63881
  }
63852
63882
  return files.every((file) => {
63853
- if (import_utils4.fs.statSync(import_path7.default.join(serverDir, file)).isDirectory()) {
63854
- const childFiles = import_utils4.fs.readdirSync(import_path7.default.join(serverDir, file));
63883
+ if (import_utils18.fs.statSync(import_path7.default.join(serverDir, file)).isDirectory()) {
63884
+ const childFiles = import_utils18.fs.readdirSync(import_path7.default.join(serverDir, file));
63855
63885
  return childFiles.length === 0;
63856
63886
  }
63857
63887
  return false;
@@ -63861,8 +63891,8 @@ var handleTemplateFile = async (context, generator, appApi) => {
63861
63891
  const jsonAPI = new JsonAPI(generator);
63862
63892
  const appDir = context.materials.default.basePath;
63863
63893
  const serverDir = import_path7.default.join(appDir, "server");
63864
- if (import_utils4.fs.existsSync(serverDir) && !isEmptyServerDir(serverDir)) {
63865
- const files = import_utils4.fs.readdirSync("server");
63894
+ if (import_utils18.fs.existsSync(serverDir) && !isEmptyServerDir(serverDir)) {
63895
+ const files = import_utils18.fs.readdirSync("server");
63866
63896
  if (files.length > 0) {
63867
63897
  generator.logger.warn("'server' is already exist");
63868
63898
  process.exit(1);
@@ -63897,7 +63927,7 @@ var handleTemplateFile = async (context, generator, appApi) => {
63897
63927
  (resourceKey) => resourceKey.replace(`templates/base-template/${language}/`, "").replace(".handlebars", "")
63898
63928
  );
63899
63929
  if (language === Language.TS) {
63900
- const tsconfigJSON = (0, import_utils4.readTsConfigByFile)(import_path7.default.join(appDir, "tsconfig.json"));
63930
+ const tsconfigJSON = (0, import_utils18.readTsConfigByFile)(import_path7.default.join(appDir, "tsconfig.json"));
63901
63931
  if (!(tsconfigJSON.include || []).includes("server")) {
63902
63932
  await jsonAPI.update(
63903
63933
  context.materials.default.get(import_path7.default.join(appDir, "tsconfig.json")),
@@ -63916,7 +63946,7 @@ var handleTemplateFile = async (context, generator, appApi) => {
63916
63946
  var src_default = async (context, generator) => {
63917
63947
  const appApi = new AppAPI(context, generator);
63918
63948
  const { locale } = context.config;
63919
- i18n.changeLanguage({ locale });
63949
+ i18n2.changeLanguage({ locale });
63920
63950
  appApi.i18n.changeLanguage({ locale });
63921
63951
  if (!await appApi.checkEnvironment()) {
63922
63952
  process.exit(1);