@modern-js/repo-generator 3.3.0 → 3.3.2

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 (2) hide show
  1. package/dist/index.js +85 -56
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -23522,9 +23522,9 @@ var require_ejs = __commonJS({
23522
23522
  }
23523
23523
  });
23524
23524
 
23525
- // ../../../../node_modules/.pnpm/@modern-js+utils@2.37.2/node_modules/@modern-js/utils/dist/compiled/chalk/index.js
23525
+ // ../../../../node_modules/.pnpm/@modern-js+utils@2.39.2/node_modules/@modern-js/utils/dist/compiled/chalk/index.js
23526
23526
  var require_chalk = __commonJS({
23527
- "../../../../node_modules/.pnpm/@modern-js+utils@2.37.2/node_modules/@modern-js/utils/dist/compiled/chalk/index.js"(exports, module2) {
23527
+ "../../../../node_modules/.pnpm/@modern-js+utils@2.39.2/node_modules/@modern-js/utils/dist/compiled/chalk/index.js"(exports, module2) {
23528
23528
  "use strict";
23529
23529
  (() => {
23530
23530
  var e = { 44: (e2, t2, n2) => {
@@ -60919,12 +60919,12 @@ function _define_property(obj, key, value) {
60919
60919
  return obj;
60920
60920
  }
60921
60921
 
60922
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
60922
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
60923
60923
  var import_utils23 = require("@modern-js/utils");
60924
60924
  var import_lodash6 = require("@modern-js/utils/lodash");
60925
60925
  var import_comment_json = __toESM(require_src2());
60926
60926
 
60927
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
60927
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/env.js
60928
60928
  var import_utils = require("@modern-js/utils");
60929
60929
  async function canUseNvm() {
60930
60930
  try {
@@ -60974,7 +60974,7 @@ async function canUsePnpm() {
60974
60974
  }
60975
60975
  }
60976
60976
 
60977
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
60977
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
60978
60978
  var import_utils2 = require("@modern-js/utils");
60979
60979
  function execaWithStreamLog(command, args, options) {
60980
60980
  const promise = (0, import_utils2.execa)(command, args, {
@@ -61070,7 +61070,7 @@ async function pnpmInstall({ cwd, registryUrl, ignoreScripts, useNvm }) {
61070
61070
  throw new Error("please install pnpm first");
61071
61071
  }
61072
61072
 
61073
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.0/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
61073
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.3.1/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
61074
61074
  var NpmAPI = class {
61075
61075
  npmInstall({ cwd, registryUrl, ignoreScripts }) {
61076
61076
  return npmInstall({
@@ -61099,7 +61099,7 @@ var NpmAPI = class {
61099
61099
  }
61100
61100
  };
61101
61101
 
61102
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
61102
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
61103
61103
  var import_utils4 = require("@modern-js/utils");
61104
61104
  async function canUseGit() {
61105
61105
  try {
@@ -61174,7 +61174,7 @@ async function gitCommit(cwd, commitMessage) {
61174
61174
  });
61175
61175
  }
61176
61176
 
61177
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
61177
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
61178
61178
  var GitAPI = class {
61179
61179
  async isInGitRepo(cwd = this.generatorCore.outputPath) {
61180
61180
  const canUse = await canUseGit();
@@ -61226,7 +61226,7 @@ var GitAPI = class {
61226
61226
  }
61227
61227
  };
61228
61228
 
61229
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/logger/constants.js
61229
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/logger/constants.js
61230
61230
  var LoggerLevel;
61231
61231
  (function(LoggerLevel2) {
61232
61232
  LoggerLevel2["Error"] = "error";
@@ -61235,17 +61235,19 @@ var LoggerLevel;
61235
61235
  LoggerLevel2["Debug"] = "debug";
61236
61236
  LoggerLevel2["Verbose"] = "verbose";
61237
61237
  LoggerLevel2["Stream"] = "stream";
61238
+ LoggerLevel2["Timing"] = "timing";
61238
61239
  })(LoggerLevel || (LoggerLevel = {}));
61239
61240
  var LevelPriority = [
61240
61241
  LoggerLevel.Error,
61241
61242
  LoggerLevel.Warn,
61242
61243
  LoggerLevel.Info,
61244
+ LoggerLevel.Timing,
61243
61245
  LoggerLevel.Debug,
61244
61246
  LoggerLevel.Verbose,
61245
61247
  LoggerLevel.Stream
61246
61248
  ];
61247
61249
 
61248
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/logger/index.js
61250
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/logger/index.js
61249
61251
  var import_utils6 = require("@modern-js/utils");
61250
61252
  var Logger = class {
61251
61253
  get currentLevelIndex() {
@@ -61278,6 +61280,16 @@ var Logger = class {
61278
61280
  }
61279
61281
  console.log(import_utils6.chalk.blue("[DEBUG]"), ...meta);
61280
61282
  }
61283
+ timing(key, end) {
61284
+ if (this.currentLevelIndex < this.getLevalIndex(LoggerLevel.Timing)) {
61285
+ return;
61286
+ }
61287
+ if (end) {
61288
+ console.timeEnd(key);
61289
+ } else {
61290
+ console.time(key);
61291
+ }
61292
+ }
61281
61293
  verbose(...meta) {
61282
61294
  if (this.currentLevelIndex < this.getLevalIndex(LoggerLevel.Verbose)) {
61283
61295
  return;
@@ -61296,23 +61308,23 @@ var Logger = class {
61296
61308
  }
61297
61309
  };
61298
61310
 
61299
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/codesmith/index.js
61311
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/codesmith/index.js
61300
61312
  var import_path7 = __toESM(require("path"));
61301
61313
 
61302
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/generator/index.js
61314
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/generator/index.js
61303
61315
  var import_path4 = __toESM(require("path"));
61304
61316
  var import_events = require("events");
61305
61317
  var import_utils11 = require("@modern-js/utils");
61306
61318
 
61307
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsMaterial.js
61319
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsMaterial.js
61308
61320
  var import_path2 = __toESM(require("path"));
61309
61321
  var import_utils8 = require("@modern-js/utils");
61310
61322
 
61311
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
61323
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
61312
61324
  var import_path = __toESM(require("path"));
61313
61325
  var import_utils7 = require("@modern-js/utils");
61314
61326
 
61315
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/constants.js
61327
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/constants.js
61316
61328
  var IMAGE_EXT_LIST = [
61317
61329
  ".jpg",
61318
61330
  ".jpeg",
@@ -61326,7 +61338,7 @@ var IMAGE_EXT_LIST = [
61326
61338
  ".wmf"
61327
61339
  ];
61328
61340
 
61329
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
61341
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
61330
61342
  var FS_RESOURCE = "_codesmith_core_fs_resource";
61331
61343
  var FsResource = class {
61332
61344
  async value() {
@@ -61352,7 +61364,7 @@ var FsResource = class {
61352
61364
  }
61353
61365
  };
61354
61366
 
61355
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsMaterial.js
61367
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsMaterial.js
61356
61368
  var promisifyGlob = function(pattern, options) {
61357
61369
  return new Promise((resolve, reject) => {
61358
61370
  (0, import_utils8.glob)(pattern, options, (err, files) => err === null ? resolve(files) : reject(err));
@@ -61380,7 +61392,7 @@ var FsMaterial = class {
61380
61392
  }
61381
61393
  };
61382
61394
 
61383
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/nodeRequire.js
61395
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/nodeRequire.js
61384
61396
  var nodeRequire = (path18) => {
61385
61397
  try {
61386
61398
  const module2 = __non_webpack_require__(path18);
@@ -61397,11 +61409,11 @@ var nodeRequire = (path18) => {
61397
61409
  }
61398
61410
  };
61399
61411
 
61400
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getGeneratorDir.js
61412
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getGeneratorDir.js
61401
61413
  var import_path3 = __toESM(require("path"));
61402
61414
  var import_utils10 = require("@modern-js/utils");
61403
61415
 
61404
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
61416
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
61405
61417
  var import_utils9 = require("@modern-js/utils");
61406
61418
  async function fsExists(path18) {
61407
61419
  try {
@@ -61412,7 +61424,7 @@ async function fsExists(path18) {
61412
61424
  }
61413
61425
  }
61414
61426
 
61415
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getGeneratorDir.js
61427
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getGeneratorDir.js
61416
61428
  var MaxTimes = 5;
61417
61429
  async function getGeneratorDir(generator) {
61418
61430
  let result = generator;
@@ -61431,7 +61443,7 @@ async function getGeneratorDir(generator) {
61431
61443
  return result;
61432
61444
  }
61433
61445
 
61434
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/generator/index.js
61446
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/generator/index.js
61435
61447
  var GeneratorCore = class {
61436
61448
  get lifeCycleMethod() {
61437
61449
  return {
@@ -61523,6 +61535,7 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61523
61535
  return Promise.resolve();
61524
61536
  }
61525
61537
  async loadGenerator(generator) {
61538
+ this.logger.timing(`loadGenerator ${generator}`);
61526
61539
  let generatorPath = generator;
61527
61540
  if (generator.startsWith("file:")) {
61528
61541
  generatorPath = import_path4.default.join(this.basePath, generator.slice(5));
@@ -61533,6 +61546,7 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61533
61546
  return {};
61534
61547
  }
61535
61548
  this.logger.debug("[runGenerator] task.generator loaded");
61549
+ this.logger.timing(`loadGenerator ${generator}`, true);
61536
61550
  const generatorScript = nodeRequire(generatorPkg.basePath);
61537
61551
  if (typeof generatorScript !== "function") {
61538
61552
  this.logger.debug(`generator module [${pkgJson.name}] export default is not a function`, generatorScript);
@@ -61545,6 +61559,7 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61545
61559
  };
61546
61560
  }
61547
61561
  async runGenerator(generator, config = {}) {
61562
+ this.logger.timing(`runGenerator ${generator}`);
61548
61563
  const spinner = (0, import_utils11.ora)({
61549
61564
  text: "Load Generator...",
61550
61565
  spinner: "runner"
@@ -61562,8 +61577,10 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61562
61577
  this.setbasePath(this._context.current.material.basePath);
61563
61578
  await generatorScript(this._context, this);
61564
61579
  this.setCurrent(null);
61580
+ this.logger.timing(`runGenerator ${generator}`, true);
61565
61581
  }
61566
61582
  async runSubGenerator(subGenerator, relativePwdPath = "", config) {
61583
+ this.logger.timing(`runSubGenerator ${subGenerator}`);
61567
61584
  const spinner = (0, import_utils11.ora)({
61568
61585
  text: "Load Generator...",
61569
61586
  spinner: "runner"
@@ -61596,6 +61613,7 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61596
61613
  await generatorScript(subContext, this);
61597
61614
  this.setOutputPath(preOutputPath);
61598
61615
  this.setbasePath(preBasePath);
61616
+ this.logger.timing(`runSubGenerator ${subGenerator}`, true);
61599
61617
  }
61600
61618
  constructor({ logger: logger2, materialsManager, outputPath }) {
61601
61619
  _define_property(this, "logger", void 0);
@@ -61627,10 +61645,10 @@ check path: ${import_utils11.chalk.blue.underline(generator)} exist a package.js
61627
61645
  }
61628
61646
  };
61629
61647
 
61630
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/index.js
61648
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/index.js
61631
61649
  var import_path6 = __toESM(require("path"));
61632
61650
 
61633
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/packageManager.js
61651
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/packageManager.js
61634
61652
  var import_path5 = __toESM(require("path"));
61635
61653
  var import_utils12 = require("@modern-js/utils");
61636
61654
  async function canUseYarn2() {
@@ -61711,7 +61729,7 @@ async function runInstall(targetDir, registryUrl) {
61711
61729
  }
61712
61730
  }
61713
61731
 
61714
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/timeoutPromise.js
61732
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/timeoutPromise.js
61715
61733
  async function timeoutPromise(promise, ms, reason = "Operation") {
61716
61734
  let timeoutId = null;
61717
61735
  const delayPromise = (ms2) => new Promise((resolve) => {
@@ -61733,20 +61751,20 @@ async function timeoutPromise(promise, ms, reason = "Operation") {
61733
61751
  }
61734
61752
  }
61735
61753
 
61736
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/downloadPackage.js
61754
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/downloadPackage.js
61737
61755
  var import_os = __toESM(require("os"));
61738
61756
  var import_utils15 = require("@modern-js/utils");
61739
61757
  var import_axios = __toESM(require_axios2());
61740
61758
  var import_tar = __toESM(require_tar());
61741
61759
 
61742
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmTarballUrl.js
61760
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmTarballUrl.js
61743
61761
  var import_utils13 = require("@modern-js/utils");
61744
61762
 
61745
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/constants.js
61763
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/constants.js
61746
61764
  var NPM_API_TIMEOUT = 3e4;
61747
61765
  var CATCHE_VALIDITY_PREIOD = 12 * 3600 * 1e3;
61748
61766
 
61749
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmTarballUrl.js
61767
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmTarballUrl.js
61750
61768
  async function getNpmTarballUrl(pkgName, pkgVersion, options) {
61751
61769
  const { registryUrl } = options || {};
61752
61770
  const params = [
@@ -61769,7 +61787,7 @@ async function getNpmTarballUrl(pkgName, pkgVersion, options) {
61769
61787
  }
61770
61788
  }
61771
61789
 
61772
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmVersion.js
61790
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmVersion.js
61773
61791
  var import_utils14 = require("@modern-js/utils");
61774
61792
  async function getNpmVersion(packageName, options) {
61775
61793
  const { version, registryUrl } = options || {};
@@ -61791,7 +61809,7 @@ async function getNpmVersion(packageName, options) {
61791
61809
  return stdout;
61792
61810
  }
61793
61811
 
61794
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/downloadPackage.js
61812
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/downloadPackage.js
61795
61813
  async function isValidCache(cacheDir) {
61796
61814
  if (await fsExists(`${cacheDir}/.codesmith.completed`)) {
61797
61815
  const preCacheTimeStr = await import_utils15.fs.readFile(`${cacheDir}/.codesmith.completed`, {
@@ -61871,7 +61889,7 @@ async function downloadPackage(pkgName, pkgVersion = "latest", options = {}) {
61871
61889
  return targetDir;
61872
61890
  }
61873
61891
 
61874
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/utils/getPackageInfo.js
61892
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/utils/getPackageInfo.js
61875
61893
  var import_utils16 = require("@modern-js/utils");
61876
61894
  function getPackageInfo(packageName) {
61877
61895
  if (!packageName) {
@@ -61896,7 +61914,7 @@ function getPackageInfo(packageName) {
61896
61914
  };
61897
61915
  }
61898
61916
 
61899
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/materials/index.js
61917
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/materials/index.js
61900
61918
  var MaterialsManager = class {
61901
61919
  loadLocalGenerator(generator) {
61902
61920
  if (!import_path6.default.isAbsolute(generator)) {
@@ -61927,9 +61945,10 @@ var MaterialsManager = class {
61927
61945
  }
61928
61946
  };
61929
61947
 
61930
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith/dist/esm-node/codesmith/index.js
61948
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith/dist/esm-node/codesmith/index.js
61931
61949
  var CodeSmith = class {
61932
61950
  async forge({ tasks, pwd }) {
61951
+ this.logger.timing("CodeSmith all tasks");
61933
61952
  this.core = new GeneratorCore({
61934
61953
  logger: this.logger,
61935
61954
  materialsManager: this.materialsManager,
@@ -61943,6 +61962,8 @@ var CodeSmith = class {
61943
61962
  } catch (e) {
61944
61963
  this.logger.error("run task error:", e);
61945
61964
  throw new Error("run task error");
61965
+ } finally {
61966
+ this.logger.timing("CodeSmith all tasks", true);
61946
61967
  }
61947
61968
  }
61948
61969
  async runTask(task) {
@@ -61950,7 +61971,9 @@ var CodeSmith = class {
61950
61971
  throw new Error("no core in 'runTask'");
61951
61972
  }
61952
61973
  const { generator, config } = task;
61974
+ this.logger.timing(`runTask ${generator}`);
61953
61975
  await this.core.runGenerator(generator, config);
61976
+ this.logger.timing(`runTask ${generator}`, true);
61954
61977
  }
61955
61978
  constructor({ debug, logger: logger2, registryUrl }) {
61956
61979
  _define_property(this, "core", void 0);
@@ -61963,7 +61986,7 @@ var CodeSmith = class {
61963
61986
  }
61964
61987
  };
61965
61988
 
61966
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
61989
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
61967
61990
  var import_handlebars = __toESM(require_lib());
61968
61991
  function renderString(template, fullData, registers) {
61969
61992
  const helpers = {
@@ -61977,7 +62000,7 @@ function renderString(template, fullData, registers) {
61977
62000
  return import_handlebars.default.compile(template)(fullData) || "";
61978
62001
  }
61979
62002
 
61980
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
62003
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
61981
62004
  var HandlebarsAPI = class {
61982
62005
  async registerHelp(helpers) {
61983
62006
  this.registers.helpers = {
@@ -62027,13 +62050,13 @@ var HandlebarsAPI = class {
62027
62050
  }
62028
62051
  };
62029
62052
 
62030
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
62053
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
62031
62054
  var import_ejs = __toESM(require_ejs());
62032
62055
  function renderString2(template, fullData) {
62033
62056
  return import_ejs.default.render(template, fullData) || "";
62034
62057
  }
62035
62058
 
62036
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
62059
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
62037
62060
  var EjsAPI = class {
62038
62061
  async renderTemplate(templateResource, target, parameters = {}) {
62039
62062
  if (templateResource._type !== FS_RESOURCE) {
@@ -62066,7 +62089,7 @@ var EjsAPI = class {
62066
62089
  }
62067
62090
  };
62068
62091
 
62069
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.3.0_@modern-js+codesmith@2.3.0/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
62092
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.3.1_@modern-js+codesmith@2.3.1/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
62070
62093
  var import_path8 = __toESM(require("path"));
62071
62094
  var import_utils20 = require("@modern-js/utils");
62072
62095
  var FsAPI = class {
@@ -62094,7 +62117,7 @@ var FsAPI = class {
62094
62117
  }
62095
62118
  };
62096
62119
 
62097
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/index.js
62120
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/index.js
62098
62121
  var import_lodash2 = require("@modern-js/utils/lodash");
62099
62122
 
62100
62123
  // ../../../../node_modules/.pnpm/@formily+shared@2.2.24/node_modules/@formily/shared/esm/checkers.js
@@ -71729,10 +71752,10 @@ var Schema = (
71729
71752
  }()
71730
71753
  );
71731
71754
 
71732
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
71755
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
71733
71756
  var import_inquirer = __toESM(require_inquirer());
71734
71757
 
71735
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
71758
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
71736
71759
  var import_lodash = require("@modern-js/utils/lodash");
71737
71760
  function validateSchema(schema) {
71738
71761
  const { type, properties } = schema;
@@ -71824,7 +71847,7 @@ function transformForm(schema, configValue = {}, validateMap, initValue) {
71824
71847
  return getQuestionFromSchema(schema, configValue, validateMap, initValue);
71825
71848
  }
71826
71849
 
71827
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
71850
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
71828
71851
  var compileRule = (rule, scope) => {
71829
71852
  const state = Schema.compile(rule, {
71830
71853
  $self: {},
@@ -71928,7 +71951,7 @@ async function prompt(schema, configValue = {}, validateMap, initValue) {
71928
71951
  return answers;
71929
71952
  }
71930
71953
 
71931
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
71954
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
71932
71955
  var CLIReader = class {
71933
71956
  getAnswers() {
71934
71957
  return this.answers;
@@ -71959,7 +71982,7 @@ var CLIReader = class {
71959
71982
  }
71960
71983
  };
71961
71984
 
71962
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/index.js
71985
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-formily/dist/esm-node/index.js
71963
71986
  var FormilyAPI = class {
71964
71987
  mergeAnswers(answers, configValue) {
71965
71988
  const inputData = (0, import_lodash2.merge)(answers, configValue);
@@ -71982,7 +72005,7 @@ var FormilyAPI = class {
71982
72005
  }
71983
72006
  };
71984
72007
 
71985
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
72008
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
71986
72009
  var import_inquirer3 = __toESM(require_inquirer2());
71987
72010
 
71988
72011
  // ../../../../node_modules/.pnpm/@modern-js+plugin-i18n@2.37.2/node_modules/@modern-js/plugin-i18n/dist/esm-node/index.js
@@ -72048,7 +72071,7 @@ var I18n = class {
72048
72071
  }
72049
72072
  };
72050
72073
 
72051
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
72074
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
72052
72075
  var ZH_LOCALE = {
72053
72076
  environment: {
72054
72077
  node_version: "请升级 Node 版本至 LIS",
@@ -72075,7 +72098,7 @@ var ZH_LOCALE = {
72075
72098
  }
72076
72099
  };
72077
72100
 
72078
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
72101
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
72079
72102
  var EN_LOCALE = {
72080
72103
  environment: {
72081
72104
  node_version: "please upgrade node to lts version",
@@ -72102,14 +72125,14 @@ var EN_LOCALE = {
72102
72125
  }
72103
72126
  };
72104
72127
 
72105
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
72128
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
72106
72129
  var i18n = new I18n();
72107
72130
  var localeKeys = i18n.init("zh", {
72108
72131
  zh: ZH_LOCALE,
72109
72132
  en: EN_LOCALE
72110
72133
  });
72111
72134
 
72112
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
72135
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
72113
72136
  var import_lodash5 = require("@modern-js/utils/lodash");
72114
72137
  function transformInquirerSchema(questions, configValue = {}, validateMap = {}, initValue = {}) {
72115
72138
  for (const question of questions) {
@@ -72137,7 +72160,7 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
72137
72160
  return questions;
72138
72161
  }
72139
72162
 
72140
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
72163
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
72141
72164
  var import_path10 = __toESM(require("path"));
72142
72165
  var import_utils22 = require("@modern-js/utils");
72143
72166
  var NODE_MAJOR_VERSION_MAP = {
@@ -72185,7 +72208,7 @@ async function checkUseNvm(cwd, logger2) {
72185
72208
  }
72186
72209
  }
72187
72210
 
72188
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.0_@modern-js+codesmith@2.3.0_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
72211
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.3.1_@modern-js+codesmith@2.3.1_typescript@5.0.4/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
72189
72212
  var AppAPI = class {
72190
72213
  async checkEnvironment(nodeVersion) {
72191
72214
  if (import_utils23.semver.lt(process.versions.node, nodeVersion || "12.22.12")) {
@@ -72274,6 +72297,7 @@ var AppAPI = class {
72274
72297
  }
72275
72298
  async forgeTemplate(templatePattern, filter, rename, parameters, type = "handlebars") {
72276
72299
  try {
72300
+ this.generatorCore.logger.timing(`forgeTemplate`);
72277
72301
  const { material } = this.generatorContext.current;
72278
72302
  const resourceMap = await material.find(templatePattern, {
72279
72303
  nodir: true,
@@ -72294,10 +72318,13 @@ var AppAPI = class {
72294
72318
  this.generatorCore.logger.debug("base forging failed:", e);
72295
72319
  this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
72296
72320
  throw new Error("base forging failed");
72321
+ } finally {
72322
+ this.generatorCore.logger.timing(`forgeTemplate`, true);
72297
72323
  }
72298
72324
  }
72299
72325
  async renderTemplateByFileType(templatePattern, filter, rename, parameters) {
72300
72326
  try {
72327
+ this.generatorCore.logger.timing(`renderTemplateByFileType`);
72301
72328
  const { material } = this.generatorContext.current;
72302
72329
  const resourceMap = await material.find(templatePattern, {
72303
72330
  nodir: true,
@@ -72328,6 +72355,8 @@ var AppAPI = class {
72328
72355
  this.generatorCore.logger.debug("base forging failed:", e);
72329
72356
  this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
72330
72357
  throw new Error("base forging failed");
72358
+ } finally {
72359
+ this.generatorCore.logger.timing(`renderTemplateByFileType`, true);
72331
72360
  }
72332
72361
  }
72333
72362
  async updateWorkspace(folder, workspaceName = "monorepo.code-workspace") {
@@ -73775,11 +73804,11 @@ var import_lodash14 = require("@modern-js/utils/lodash");
73775
73804
  // ../../generator-plugin/dist/esm/context/file.js
73776
73805
  var import_path13 = __toESM(require("path"));
73777
73806
 
73778
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
73807
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
73779
73808
  var import_comment_json2 = __toESM(require_src2());
73780
73809
  var declarationUpdate = __toESM(require_dist());
73781
73810
 
73782
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
73811
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
73783
73812
  async function editJson(generatorCore, resource, getNewJsonValue) {
73784
73813
  const originJsonValue = await resource.value();
73785
73814
  const newJsonString = await getNewJsonValue(originJsonValue.content);
@@ -73792,7 +73821,7 @@ async function editJson(generatorCore, resource, getNewJsonValue) {
73792
73821
  return newJsonString;
73793
73822
  }
73794
73823
 
73795
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.0/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
73824
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.1/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
73796
73825
  var JsonAPI = class {
73797
73826
  async get(resource) {
73798
73827
  const originJsonValue = await resource.value();
@@ -75057,7 +75086,7 @@ var ModuleNewAction = async (options) => {
75057
75086
  }
75058
75087
  });
75059
75088
  if (!hasOption) {
75060
- smith.logger.warn("no option can be enabled");
75089
+ smith.logger.warn("No option can be enabled, exit 1.", funcMap);
75061
75090
  process.exit(1);
75062
75091
  }
75063
75092
  const ans = await formilyAPI.getInputBySchemaFunc(getModuleNewActionSchema, {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.3.0",
18
+ "version": "3.3.2",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -23,24 +23,24 @@
23
23
  "/dist/index.js"
24
24
  ],
25
25
  "dependencies": {
26
- "@modern-js/utils": "2.41.0"
26
+ "@modern-js/utils": "2.42.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@modern-js/codesmith": "2.3.0",
30
- "@modern-js/codesmith-api-app": "2.3.0",
29
+ "@modern-js/codesmith": "2.3.1",
30
+ "@modern-js/codesmith-api-app": "2.3.1",
31
31
  "@types/jest": "^29",
32
32
  "@types/node": "^14",
33
33
  "jest": "^29",
34
34
  "typescript": "^5",
35
- "@modern-js/base-generator": "3.3.0",
36
- "@modern-js/generator-common": "3.3.0",
37
- "@modern-js/generator-utils": "3.3.0",
38
- "@modern-js/generator-plugin": "3.3.0",
39
- "@modern-js/module-generator": "3.3.0",
40
- "@modern-js/monorepo-generator": "3.3.0",
41
- "@modern-js/mwa-generator": "3.3.0",
42
- "@scripts/build": "2.41.0",
43
- "@scripts/jest-config": "2.41.0"
35
+ "@modern-js/generator-plugin": "3.3.2",
36
+ "@modern-js/generator-common": "3.3.2",
37
+ "@modern-js/base-generator": "3.3.2",
38
+ "@modern-js/module-generator": "3.3.2",
39
+ "@modern-js/monorepo-generator": "3.3.2",
40
+ "@modern-js/mwa-generator": "3.3.2",
41
+ "@scripts/build": "2.42.1",
42
+ "@scripts/jest-config": "2.42.1",
43
+ "@modern-js/generator-utils": "3.3.2"
44
44
  },
45
45
  "sideEffects": false,
46
46
  "publishConfig": {