@modern-js/repo-generator 3.3.10 → 3.3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/dist/index.js +1338 -1479
  2. package/package.json +11 -11
  3. package/src/index.ts +2 -11
package/dist/index.js CHANGED
@@ -28563,7 +28563,7 @@ var require_binary_search = __commonJS({
28563
28563
  var require_quick_sort = __commonJS({
28564
28564
  "../../../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/quick-sort.js"(exports) {
28565
28565
  "use strict";
28566
- function swap(ary, x, y) {
28566
+ function swap2(ary, x, y) {
28567
28567
  var temp = ary[x];
28568
28568
  ary[x] = ary[y];
28569
28569
  ary[y] = temp;
@@ -28575,15 +28575,15 @@ var require_quick_sort = __commonJS({
28575
28575
  if (p < r) {
28576
28576
  var pivotIndex = randomIntInRange(p, r);
28577
28577
  var i = p - 1;
28578
- swap(ary, pivotIndex, r);
28578
+ swap2(ary, pivotIndex, r);
28579
28579
  var pivot = ary[r];
28580
28580
  for (var j = p; j < r; j++) {
28581
28581
  if (comparator(ary[j], pivot) <= 0) {
28582
28582
  i += 1;
28583
- swap(ary, i, j);
28583
+ swap2(ary, i, j);
28584
28584
  }
28585
28585
  }
28586
- swap(ary, i + 1, j);
28586
+ swap2(ary, i + 1, j);
28587
28587
  var q = i + 1;
28588
28588
  doQuickSort(ary, comparator, p, q - 1);
28589
28589
  doQuickSort(ary, comparator, q + 1, r);
@@ -64263,10 +64263,10 @@ var require_extend_node = __commonJS({
64263
64263
  length = void 0;
64264
64264
  }
64265
64265
  } else {
64266
- var swap = encoding;
64266
+ var swap2 = encoding;
64267
64267
  encoding = offset;
64268
64268
  offset = length;
64269
- length = swap;
64269
+ length = swap2;
64270
64270
  }
64271
64271
  offset = +offset || 0;
64272
64272
  var remaining = this.length - offset;
@@ -64320,10 +64320,10 @@ var require_extend_node = __commonJS({
64320
64320
  length = void 0;
64321
64321
  }
64322
64322
  } else {
64323
- var swap = encoding;
64323
+ var swap2 = encoding;
64324
64324
  encoding = offset;
64325
64325
  offset = length;
64326
- length = swap;
64326
+ length = swap2;
64327
64327
  }
64328
64328
  encoding = String(encoding || "utf8").toLowerCase();
64329
64329
  if (Buffer2.isNativeEncoding(encoding))
@@ -68844,7 +68844,6 @@ __export(src_exports, {
68844
68844
  default: () => src_default
68845
68845
  });
68846
68846
  module.exports = __toCommonJS(src_exports);
68847
- var import_path18 = __toESM(require("path"));
68848
68847
  var import_lodash15 = require("@modern-js/utils/lodash");
68849
68848
 
68850
68849
  // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/esm/_define_property.js
@@ -83379,15 +83378,6 @@ var AppAPI = class {
83379
83378
  }
83380
83379
  };
83381
83380
 
83382
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_define_property.js
83383
- function _define_property2(obj, key, value) {
83384
- if (key in obj) {
83385
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
83386
- } else
83387
- obj[key] = value;
83388
- return obj;
83389
- }
83390
-
83391
83381
  // ../../../cli/plugin-i18n/dist/esm-node/index.js
83392
83382
  var import_lodash8 = require("@modern-js/utils/lodash");
83393
83383
 
@@ -83446,8 +83436,8 @@ var I18n2 = class {
83446
83436
  };
83447
83437
  }
83448
83438
  constructor() {
83449
- _define_property2(this, "language", "en");
83450
- _define_property2(this, "languageMap", {});
83439
+ this.language = "en";
83440
+ this.languageMap = {};
83451
83441
  }
83452
83442
  };
83453
83443
 
@@ -83480,10 +83470,8 @@ var ZH_LOCALE2 = {
83480
83470
  i18n: "启用「国际化(i18n)」功能",
83481
83471
  test: "启用「单元测试 / 集成测试」功能",
83482
83472
  e2e_test: "启用「E2E 测试」功能",
83483
- storybook: "启用「Storybook」",
83484
83473
  storybookV7: "启用「Storybook」V7",
83485
83474
  runtime_api: "启用「Runtime API」",
83486
- mwa_storybook: "启用「Visual Testing (Storybook)」模式",
83487
83475
  ssg: "启用「SSG」功能",
83488
83476
  polyfill: "启用「基于 UA 的 Polyfill」功能",
83489
83477
  proxy: "启用「全局代理」",
@@ -83578,10 +83566,8 @@ var EN_LOCALE2 = {
83578
83566
  i18n: "Enable Internationalization (i18n)",
83579
83567
  test: "Enable Unit Test / Integration Test",
83580
83568
  e2e_test: "Enable E2E Test",
83581
- storybook: "Enable Storybook",
83582
83569
  storybookV7: "Enable Storybook V7",
83583
83570
  runtime_api: "Enable Runtime API",
83584
- mwa_storybook: "Enable Visual Testing (Storybook)",
83585
83571
  ssg: "Enable SSG",
83586
83572
  polyfill: "Enable UA-based Polyfill Feature",
83587
83573
  proxy: "Enable Global Proxy",
@@ -83971,7 +83957,6 @@ var ActionFunction;
83971
83957
  ActionFunction2["I18n"] = "i18n";
83972
83958
  ActionFunction2["Test"] = "test";
83973
83959
  ActionFunction2["E2ETest"] = "e2e_test";
83974
- ActionFunction2["Storybook"] = "storybook";
83975
83960
  ActionFunction2["StorybookV7"] = "storybookV7";
83976
83961
  ActionFunction2["RuntimeApi"] = "runtimeApi";
83977
83962
  ActionFunction2["SSG"] = "ssg";
@@ -84005,7 +83990,6 @@ var ActionFunctionText = {
84005
83990
  ["i18n"]: () => i18n2.t(localeKeys2.action.function.i18n),
84006
83991
  ["test"]: () => i18n2.t(localeKeys2.action.function.test),
84007
83992
  ["e2e_test"]: () => i18n2.t(localeKeys2.action.function.e2e_test),
84008
- ["storybook"]: () => i18n2.t(localeKeys2.action.function.storybook),
84009
83993
  ["storybookV7"]: () => i18n2.t(localeKeys2.action.function.storybookV7),
84010
83994
  ["runtimeApi"]: () => i18n2.t(localeKeys2.action.function.runtime_api),
84011
83995
  ["ssg"]: () => i18n2.t(localeKeys2.action.function.ssg),
@@ -84033,7 +84017,6 @@ var MWAActionFunctions = [
84033
84017
  ActionFunction.Test,
84034
84018
  ActionFunction.Polyfill,
84035
84019
  ActionFunction.Proxy,
84036
- ActionFunction.Storybook,
84037
84020
  ActionFunction.StorybookV7
84038
84021
  ];
84039
84022
  var MWAActionElements = [
@@ -84091,7 +84074,7 @@ var getMWANewActionSchema = (extra = {}) => {
84091
84074
  title: ActionTypeQuestionText[ActionType.Function](),
84092
84075
  enum: funcs.map((func) => ({
84093
84076
  value: func,
84094
- label: func === ActionFunction.Storybook ? i18n2.t(localeKeys2.action.function.mwa_storybook) : ActionFunctionText[func]()
84077
+ label: ActionFunctionText[func]()
84095
84078
  })),
84096
84079
  "x-reactions": [
84097
84080
  {
@@ -84132,7 +84115,6 @@ var getMWANewActionSchema = (extra = {}) => {
84132
84115
  var MWAActionFunctionsDevDependencies = {
84133
84116
  [ActionFunction.SSG]: "@modern-js/plugin-ssg",
84134
84117
  [ActionFunction.Test]: "@modern-js/plugin-testing",
84135
- [ActionFunction.Storybook]: "@modern-js/plugin-storybook",
84136
84118
  [ActionFunction.StorybookV7]: "@modern-js/storybook",
84137
84119
  [ActionFunction.Proxy]: "@modern-js/plugin-proxy",
84138
84120
  [ActionFunction.TailwindCSS]: "tailwindcss",
@@ -84164,7 +84146,6 @@ var MWANewActionGenerators = {
84164
84146
  [ActionFunction.BFF]: "@modern-js/bff-generator",
84165
84147
  [ActionFunction.MicroFrontend]: "@modern-js/dependence-generator",
84166
84148
  [ActionFunction.Test]: "@modern-js/test-generator",
84167
- [ActionFunction.Storybook]: "@modern-js/dependence-generator",
84168
84149
  [ActionFunction.StorybookV7]: "@modern-js/storybook-next-generator",
84169
84150
  [ActionFunction.SSG]: "@modern-js/ssg-generator",
84170
84151
  [ActionFunction.Polyfill]: "@modern-js/dependence-generator",
@@ -84184,7 +84165,6 @@ var MWANewActionPluginName = {
84184
84165
  [ActionFunction.BFF]: "bffPlugin",
84185
84166
  [ActionFunction.MicroFrontend]: "garfishPlugin",
84186
84167
  [ActionFunction.Test]: "testingPlugin",
84187
- [ActionFunction.Storybook]: "storybookPlugin",
84188
84168
  [ActionFunction.SSG]: "ssgPlugin",
84189
84169
  [ActionFunction.Polyfill]: "polyfillPlugin",
84190
84170
  [ActionFunction.Proxy]: "proxyPlugin",
@@ -84203,7 +84183,6 @@ var MWANewActionPluginDependence = {
84203
84183
  [ActionFunction.BFF]: "@modern-js/plugin-bff",
84204
84184
  [ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
84205
84185
  [ActionFunction.Test]: "@modern-js/plugin-testing",
84206
- [ActionFunction.Storybook]: "@modern-js/plugin-storybook",
84207
84186
  [ActionFunction.SSG]: "@modern-js/plugin-ssg",
84208
84187
  [ActionFunction.Polyfill]: "@modern-js/plugin-polyfill",
84209
84188
  [ActionFunction.Proxy]: "@modern-js/plugin-proxy",
@@ -84344,194 +84323,8 @@ var SolutionSchemas = {
84344
84323
  custom: getBaseSchema
84345
84324
  };
84346
84325
 
84347
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_async_to_generator.js
84348
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
84349
- try {
84350
- var info = gen[key](arg);
84351
- var value = info.value;
84352
- } catch (error) {
84353
- reject(error);
84354
- return;
84355
- }
84356
- if (info.done)
84357
- resolve(value);
84358
- else
84359
- Promise.resolve(value).then(_next, _throw);
84360
- }
84361
- function _async_to_generator(fn) {
84362
- return function() {
84363
- var self3 = this, args = arguments;
84364
- return new Promise(function(resolve, reject) {
84365
- var gen = fn.apply(self3, args);
84366
- function _next(value) {
84367
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
84368
- }
84369
- function _throw(err) {
84370
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
84371
- }
84372
- _next(void 0);
84373
- });
84374
- };
84375
- }
84376
-
84377
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_class_call_check.js
84378
- function _class_call_check(instance, Constructor) {
84379
- if (!(instance instanceof Constructor))
84380
- throw new TypeError("Cannot call a class as a function");
84381
- }
84382
-
84383
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_create_class.js
84384
- function _defineProperties(target, props) {
84385
- for (var i = 0; i < props.length; i++) {
84386
- var descriptor = props[i];
84387
- descriptor.enumerable = descriptor.enumerable || false;
84388
- descriptor.configurable = true;
84389
- if ("value" in descriptor)
84390
- descriptor.writable = true;
84391
- Object.defineProperty(target, descriptor.key, descriptor);
84392
- }
84393
- }
84394
- function _create_class(Constructor, protoProps, staticProps) {
84395
- if (protoProps)
84396
- _defineProperties(Constructor.prototype, protoProps);
84397
- if (staticProps)
84398
- _defineProperties(Constructor, staticProps);
84399
- return Constructor;
84400
- }
84401
-
84402
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread.js
84403
- function _object_spread(target) {
84404
- for (var i = 1; i < arguments.length; i++) {
84405
- var source = arguments[i] != null ? arguments[i] : {};
84406
- var ownKeys2 = Object.keys(source);
84407
- if (typeof Object.getOwnPropertySymbols === "function") {
84408
- ownKeys2 = ownKeys2.concat(
84409
- Object.getOwnPropertySymbols(source).filter(function(sym) {
84410
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
84411
- })
84412
- );
84413
- }
84414
- ownKeys2.forEach(function(key) {
84415
- _define_property2(target, key, source[key]);
84416
- });
84417
- }
84418
- return target;
84419
- }
84420
-
84421
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread_props.js
84422
- function ownKeys(object, enumerableOnly) {
84423
- var keys = Object.keys(object);
84424
- if (Object.getOwnPropertySymbols) {
84425
- var symbols = Object.getOwnPropertySymbols(object);
84426
- if (enumerableOnly) {
84427
- symbols = symbols.filter(function(sym) {
84428
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
84429
- });
84430
- }
84431
- keys.push.apply(keys, symbols);
84432
- }
84433
- return keys;
84434
- }
84435
- function _object_spread_props(target, source) {
84436
- source = source != null ? source : {};
84437
- if (Object.getOwnPropertyDescriptors)
84438
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84439
- else {
84440
- ownKeys(Object(source)).forEach(function(key) {
84441
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
84442
- });
84443
- }
84444
- return target;
84445
- }
84446
-
84447
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_without_properties_loose.js
84448
- function _object_without_properties_loose(source, excluded) {
84449
- if (source == null)
84450
- return {};
84451
- var target = {};
84452
- var sourceKeys = Object.keys(source);
84453
- var key, i;
84454
- for (i = 0; i < sourceKeys.length; i++) {
84455
- key = sourceKeys[i];
84456
- if (excluded.indexOf(key) >= 0)
84457
- continue;
84458
- target[key] = source[key];
84459
- }
84460
- return target;
84461
- }
84462
-
84463
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_without_properties.js
84464
- function _object_without_properties(source, excluded) {
84465
- if (source == null)
84466
- return {};
84467
- var target = _object_without_properties_loose(source, excluded);
84468
- var key, i;
84469
- if (Object.getOwnPropertySymbols) {
84470
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
84471
- for (i = 0; i < sourceSymbolKeys.length; i++) {
84472
- key = sourceSymbolKeys[i];
84473
- if (excluded.indexOf(key) >= 0)
84474
- continue;
84475
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
84476
- continue;
84477
- target[key] = source[key];
84478
- }
84479
- }
84480
- return target;
84481
- }
84482
-
84483
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_array_like_to_array.js
84484
- function _array_like_to_array(arr, len) {
84485
- if (len == null || len > arr.length)
84486
- len = arr.length;
84487
- for (var i = 0, arr2 = new Array(len); i < len; i++)
84488
- arr2[i] = arr[i];
84489
- return arr2;
84490
- }
84491
-
84492
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_array_without_holes.js
84493
- function _array_without_holes(arr) {
84494
- if (Array.isArray(arr))
84495
- return _array_like_to_array(arr);
84496
- }
84497
-
84498
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_iterable_to_array.js
84499
- function _iterable_to_array(iter) {
84500
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
84501
- return Array.from(iter);
84502
- }
84503
- }
84504
-
84505
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_non_iterable_spread.js
84506
- function _non_iterable_spread() {
84507
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84508
- }
84509
-
84510
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js
84511
- function _unsupported_iterable_to_array(o, minLen) {
84512
- if (!o)
84513
- return;
84514
- if (typeof o === "string")
84515
- return _array_like_to_array(o, minLen);
84516
- var n = Object.prototype.toString.call(o).slice(8, -1);
84517
- if (n === "Object" && o.constructor)
84518
- n = o.constructor.name;
84519
- if (n === "Map" || n === "Set")
84520
- return Array.from(n);
84521
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
84522
- return _array_like_to_array(o, minLen);
84523
- }
84524
-
84525
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_to_consumable_array.js
84526
- function _to_consumable_array(arr) {
84527
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
84528
- }
84529
-
84530
- // ../../generator-plugin/dist/esm/index.js
84531
- var import_path17 = __toESM(require("path"));
84532
-
84533
84326
  // ../../generator-utils/dist/esm/index.js
84534
- var import_path11 = __toESM(require("path"));
84327
+ var import_path12 = __toESM(require("path"));
84535
84328
  var import_utils49 = require("@modern-js/utils");
84536
84329
 
84537
84330
  // ../../generator-utils/dist/esm/utils/stripAnsi.js
@@ -84652,6 +84445,21 @@ async function getAvailableVersion(packageName, currentVersion, registry2) {
84652
84445
  return currentVersion;
84653
84446
  }
84654
84447
 
84448
+ // ../../generator-utils/dist/esm/utils/getGeneratorPath.js
84449
+ var import_path11 = __toESM(require("path"));
84450
+ var getGeneratorPath = (generator, distTag, paths) => {
84451
+ if (process.env.CODESMITH_ENV === "development") {
84452
+ return import_path11.default.dirname(require.resolve(generator, {
84453
+ paths: paths !== null && paths !== void 0 ? paths : [
84454
+ process.cwd()
84455
+ ]
84456
+ }));
84457
+ } else if (distTag) {
84458
+ return `${generator}@${distTag}`;
84459
+ }
84460
+ return generator;
84461
+ };
84462
+
84655
84463
  // ../../generator-utils/dist/esm/index.js
84656
84464
  var import_utils50 = require("@modern-js/utils");
84657
84465
  async function getPackageVersion(packageName, registry2) {
@@ -84699,13 +84507,13 @@ async function getModernPluginVersion(solution, packageName, options = {
84699
84507
  if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
84700
84508
  return getLatetPluginVersion("latest");
84701
84509
  }
84702
- let pkgPath = import_path11.default.join(require.resolve(SolutionToolsMap[solution], {
84510
+ let pkgPath = import_path12.default.join(require.resolve(SolutionToolsMap[solution], {
84703
84511
  paths: [
84704
84512
  cwd
84705
84513
  ]
84706
84514
  }), "../../..", "package.json");
84707
84515
  if (solution === Solution.Module) {
84708
- pkgPath = import_path11.default.join(require.resolve(SolutionToolsMap[solution], {
84516
+ pkgPath = import_path12.default.join(require.resolve(SolutionToolsMap[solution], {
84709
84517
  paths: [
84710
84518
  cwd
84711
84519
  ]
@@ -84726,11 +84534,204 @@ async function getModernPluginVersion(solution, packageName, options = {
84726
84534
  return getLatetPluginVersion();
84727
84535
  }
84728
84536
 
84537
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_async_to_generator.js
84538
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
84539
+ try {
84540
+ var info = gen[key](arg);
84541
+ var value = info.value;
84542
+ } catch (error) {
84543
+ reject(error);
84544
+ return;
84545
+ }
84546
+ if (info.done)
84547
+ resolve(value);
84548
+ else
84549
+ Promise.resolve(value).then(_next, _throw);
84550
+ }
84551
+ function _async_to_generator(fn) {
84552
+ return function() {
84553
+ var self3 = this, args = arguments;
84554
+ return new Promise(function(resolve, reject) {
84555
+ var gen = fn.apply(self3, args);
84556
+ function _next(value) {
84557
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
84558
+ }
84559
+ function _throw(err) {
84560
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
84561
+ }
84562
+ _next(void 0);
84563
+ });
84564
+ };
84565
+ }
84566
+
84567
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_class_call_check.js
84568
+ function _class_call_check(instance, Constructor) {
84569
+ if (!(instance instanceof Constructor))
84570
+ throw new TypeError("Cannot call a class as a function");
84571
+ }
84572
+
84573
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_define_property.js
84574
+ function _define_property2(obj, key, value) {
84575
+ if (key in obj) {
84576
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
84577
+ } else
84578
+ obj[key] = value;
84579
+ return obj;
84580
+ }
84581
+
84582
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread.js
84583
+ function _object_spread(target) {
84584
+ for (var i = 1; i < arguments.length; i++) {
84585
+ var source = arguments[i] != null ? arguments[i] : {};
84586
+ var ownKeys2 = Object.keys(source);
84587
+ if (typeof Object.getOwnPropertySymbols === "function") {
84588
+ ownKeys2 = ownKeys2.concat(
84589
+ Object.getOwnPropertySymbols(source).filter(function(sym) {
84590
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
84591
+ })
84592
+ );
84593
+ }
84594
+ ownKeys2.forEach(function(key) {
84595
+ _define_property2(target, key, source[key]);
84596
+ });
84597
+ }
84598
+ return target;
84599
+ }
84600
+
84601
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread_props.js
84602
+ function ownKeys(object, enumerableOnly) {
84603
+ var keys = Object.keys(object);
84604
+ if (Object.getOwnPropertySymbols) {
84605
+ var symbols = Object.getOwnPropertySymbols(object);
84606
+ if (enumerableOnly) {
84607
+ symbols = symbols.filter(function(sym) {
84608
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
84609
+ });
84610
+ }
84611
+ keys.push.apply(keys, symbols);
84612
+ }
84613
+ return keys;
84614
+ }
84615
+ function _object_spread_props(target, source) {
84616
+ source = source != null ? source : {};
84617
+ if (Object.getOwnPropertyDescriptors)
84618
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84619
+ else {
84620
+ ownKeys(Object(source)).forEach(function(key) {
84621
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
84622
+ });
84623
+ }
84624
+ return target;
84625
+ }
84626
+
84627
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_without_properties_loose.js
84628
+ function _object_without_properties_loose(source, excluded) {
84629
+ if (source == null)
84630
+ return {};
84631
+ var target = {};
84632
+ var sourceKeys = Object.keys(source);
84633
+ var key, i;
84634
+ for (i = 0; i < sourceKeys.length; i++) {
84635
+ key = sourceKeys[i];
84636
+ if (excluded.indexOf(key) >= 0)
84637
+ continue;
84638
+ target[key] = source[key];
84639
+ }
84640
+ return target;
84641
+ }
84642
+
84643
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_without_properties.js
84644
+ function _object_without_properties(source, excluded) {
84645
+ if (source == null)
84646
+ return {};
84647
+ var target = _object_without_properties_loose(source, excluded);
84648
+ var key, i;
84649
+ if (Object.getOwnPropertySymbols) {
84650
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
84651
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
84652
+ key = sourceSymbolKeys[i];
84653
+ if (excluded.indexOf(key) >= 0)
84654
+ continue;
84655
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
84656
+ continue;
84657
+ target[key] = source[key];
84658
+ }
84659
+ }
84660
+ return target;
84661
+ }
84662
+
84663
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_array_like_to_array.js
84664
+ function _array_like_to_array(arr, len) {
84665
+ if (len == null || len > arr.length)
84666
+ len = arr.length;
84667
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
84668
+ arr2[i] = arr[i];
84669
+ return arr2;
84670
+ }
84671
+
84672
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_array_without_holes.js
84673
+ function _array_without_holes(arr) {
84674
+ if (Array.isArray(arr))
84675
+ return _array_like_to_array(arr);
84676
+ }
84677
+
84678
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_iterable_to_array.js
84679
+ function _iterable_to_array(iter) {
84680
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
84681
+ return Array.from(iter);
84682
+ }
84683
+ }
84684
+
84685
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_non_iterable_spread.js
84686
+ function _non_iterable_spread() {
84687
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84688
+ }
84689
+
84690
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js
84691
+ function _unsupported_iterable_to_array(o, minLen) {
84692
+ if (!o)
84693
+ return;
84694
+ if (typeof o === "string")
84695
+ return _array_like_to_array(o, minLen);
84696
+ var n = Object.prototype.toString.call(o).slice(8, -1);
84697
+ if (n === "Object" && o.constructor)
84698
+ n = o.constructor.name;
84699
+ if (n === "Map" || n === "Set")
84700
+ return Array.from(n);
84701
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
84702
+ return _array_like_to_array(o, minLen);
84703
+ }
84704
+
84705
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_to_consumable_array.js
84706
+ function _to_consumable_array(arr) {
84707
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
84708
+ }
84709
+
84729
84710
  // ../../generator-plugin/dist/esm/index.js
84711
+ var import_path18 = __toESM(require("path"));
84730
84712
  var import_lodash14 = require("@modern-js/utils/lodash");
84731
84713
 
84714
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_create_class.js
84715
+ function _defineProperties(target, props) {
84716
+ for (var i = 0; i < props.length; i++) {
84717
+ var descriptor = props[i];
84718
+ descriptor.enumerable = descriptor.enumerable || false;
84719
+ descriptor.configurable = true;
84720
+ if ("value" in descriptor)
84721
+ descriptor.writable = true;
84722
+ Object.defineProperty(target, descriptor.key, descriptor);
84723
+ }
84724
+ }
84725
+ function _create_class(Constructor, protoProps, staticProps) {
84726
+ if (protoProps)
84727
+ _defineProperties(Constructor.prototype, protoProps);
84728
+ if (staticProps)
84729
+ _defineProperties(Constructor, staticProps);
84730
+ return Constructor;
84731
+ }
84732
+
84732
84733
  // ../../generator-plugin/dist/esm/context/file.js
84733
- var import_path13 = __toESM(require("path"));
84734
+ var import_path14 = __toESM(require("path"));
84734
84735
 
84735
84736
  // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.3.5/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
84736
84737
  var import_comment_json2 = __toESM(require_src2());
@@ -84795,7 +84796,7 @@ var JsonAPI = class {
84795
84796
  };
84796
84797
 
84797
84798
  // ../../generator-plugin/dist/esm/utils/file.js
84798
- var import_path12 = __toESM(require("path"));
84799
+ var import_path13 = __toESM(require("path"));
84799
84800
  var import_utils52 = require("@modern-js/utils");
84800
84801
  var FileType;
84801
84802
  (function(FileType22) {
@@ -84845,20 +84846,20 @@ function _fileExists() {
84845
84846
  return _fileExists.apply(this, arguments);
84846
84847
  }
84847
84848
  function dropFileRootFolder(file) {
84848
- var fileParts = import_path12.default.normalize(file).split(import_path12.default.sep);
84849
+ var fileParts = import_path13.default.normalize(file).split(import_path13.default.sep);
84849
84850
  fileParts.shift();
84850
- return fileParts.join(import_path12.default.sep);
84851
+ return fileParts.join(import_path13.default.sep);
84851
84852
  }
84852
84853
  function dropFileRootPath(file, rootPath) {
84853
84854
  var fileRootPath = rootPath ? file.replace(rootPath, "") : dropFileRootFolder(file);
84854
- return fileRootPath.startsWith(import_path12.default.sep) ? fileRootPath : "".concat(import_path12.default.sep).concat(fileRootPath);
84855
+ return fileRootPath.startsWith(import_path13.default.sep) ? fileRootPath : "".concat(import_path13.default.sep).concat(fileRootPath);
84855
84856
  }
84856
84857
  function isAbsoluteOrRelativeFileTo(relativePath) {
84857
84858
  var isFile2 = function(file) {
84858
84859
  return import_utils50.fs.existsSync(file) && import_utils50.fs.lstatSync(file).isFile();
84859
84860
  };
84860
84861
  return function(fileName) {
84861
- return isFile2(fileName) || isFile2(import_path12.default.join(relativePath, fileName));
84862
+ return isFile2(fileName) || isFile2(import_path13.default.join(relativePath, fileName));
84862
84863
  };
84863
84864
  }
84864
84865
  function addFile(config, projectPath, templatePath, renderString3) {
@@ -84870,7 +84871,7 @@ function _addFile() {
84870
84871
  return __generator(this, function(_state) {
84871
84872
  switch (_state.label) {
84872
84873
  case 0:
84873
- fileDestPath = import_path12.default.join(projectPath, config.file);
84874
+ fileDestPath = import_path13.default.join(projectPath, config.file);
84874
84875
  return [
84875
84876
  4,
84876
84877
  fileExists(fileDestPath)
@@ -84882,13 +84883,13 @@ function _addFile() {
84882
84883
  }
84883
84884
  return [
84884
84885
  4,
84885
- import_utils50.fs.mkdir(import_path12.default.dirname(fileDestPath), {
84886
+ import_utils50.fs.mkdir(import_path13.default.dirname(fileDestPath), {
84886
84887
  recursive: true
84887
84888
  })
84888
84889
  ];
84889
84890
  case 2:
84890
84891
  _state.sent();
84891
- absTemplatePath = config.templateFile ? import_path12.default.join(templatePath, config.templateFile) : null;
84892
+ absTemplatePath = config.templateFile ? import_path13.default.join(templatePath, config.templateFile) : null;
84892
84893
  if (!(absTemplatePath != null && (config.type === "binary" || Object.keys(config.data || {}).length === 0)))
84893
84894
  return [
84894
84895
  3,
@@ -84958,9 +84959,9 @@ function _addManyFiles() {
84958
84959
  config.templateFiles = config.templateFiles();
84959
84960
  }
84960
84961
  config.templateFiles = config.templateFiles.map(function(templateFile2) {
84961
- return import_path12.default.join(templatePath, templateFile2);
84962
+ return import_path13.default.join(templatePath, templateFile2);
84962
84963
  });
84963
- config.templateBase = ((_config_templateBase = config.templateBase) === null || _config_templateBase === void 0 ? void 0 : _config_templateBase.startsWith(import_path12.default.sep)) ? config.templateBase : "".concat(import_path12.default.sep).concat(config.templateBase || "");
84964
+ config.templateBase = ((_config_templateBase = config.templateBase) === null || _config_templateBase === void 0 ? void 0 : _config_templateBase.startsWith(import_path13.default.sep)) ? config.templateBase : "".concat(import_path13.default.sep).concat(config.templateBase || "");
84964
84965
  templateFiles = import_utils52.globby.sync(config.templateFiles, {
84965
84966
  braceExpansion: false,
84966
84967
  dot: config.dot
@@ -84988,10 +84989,10 @@ function _addManyFiles() {
84988
84989
  5
84989
84990
  ];
84990
84991
  templateFile = _step.value;
84991
- absTemplatePath = import_path12.default.resolve(templatePath, templateFile);
84992
+ absTemplatePath = import_path13.default.resolve(templatePath, templateFile);
84992
84993
  targetFile = dropFileRootPath(templateFile, config.templateBase);
84993
84994
  fileCfg = _object_spread_props(_object_spread({}, config), {
84994
- file: import_path12.default.join(config.destination, config.fileNameFunc ? config.fileNameFunc(targetFile) : targetFile),
84995
+ file: import_path13.default.join(config.destination, config.fileNameFunc ? config.fileNameFunc(targetFile) : targetFile),
84995
84996
  templateFile: absTemplatePath,
84996
84997
  force: true
84997
84998
  });
@@ -85051,36 +85052,28 @@ var PluginHandlebarsAPI = /* @__PURE__ */ function() {
85051
85052
  "use strict";
85052
85053
  function PluginHandlebarsAPI2() {
85053
85054
  _class_call_check(this, PluginHandlebarsAPI2);
85054
- _define_property2(this, "helpers", {});
85055
- _define_property2(this, "partials", {});
85056
- }
85055
+ this.helpers = {};
85056
+ this.partials = {};
85057
+ }
85058
+ var _proto = PluginHandlebarsAPI2.prototype;
85059
+ _proto.renderString = function renderString3(template, data) {
85060
+ var helpers = _object_spread({}, this.helpers);
85061
+ var partials = _object_spread({}, this.partials);
85062
+ Object.keys(helpers).forEach(function(h) {
85063
+ return handlebars2.registerHelper(h, helpers[h]);
85064
+ });
85065
+ Object.keys(partials).forEach(function(p) {
85066
+ return handlebars2.registerPartial(p, partials[p]);
85067
+ });
85068
+ return handlebars2.compile(template)(data) || "";
85069
+ };
85070
+ _proto.addHelper = function addHelper(name, fn) {
85071
+ this.helpers[name] = fn;
85072
+ };
85073
+ _proto.addPartial = function addPartial(name, str) {
85074
+ this.partials[name] = str;
85075
+ };
85057
85076
  _create_class(PluginHandlebarsAPI2, [
85058
- {
85059
- key: "renderString",
85060
- value: function renderString3(template, data) {
85061
- var helpers = _object_spread({}, this.helpers);
85062
- var partials = _object_spread({}, this.partials);
85063
- Object.keys(helpers).forEach(function(h) {
85064
- return handlebars2.registerHelper(h, helpers[h]);
85065
- });
85066
- Object.keys(partials).forEach(function(p) {
85067
- return handlebars2.registerPartial(p, partials[p]);
85068
- });
85069
- return handlebars2.compile(template)(data) || "";
85070
- }
85071
- },
85072
- {
85073
- key: "addHelper",
85074
- value: function addHelper(name, fn) {
85075
- this.helpers[name] = fn;
85076
- }
85077
- },
85078
- {
85079
- key: "addPartial",
85080
- value: function addPartial(name, str) {
85081
- this.partials[name] = str;
85082
- }
85083
- },
85084
85077
  {
85085
85078
  key: "method",
85086
85079
  get: function get4() {
@@ -85101,14 +85094,10 @@ var PluginEjsAPI = /* @__PURE__ */ function() {
85101
85094
  function PluginEjsAPI2() {
85102
85095
  _class_call_check(this, PluginEjsAPI2);
85103
85096
  }
85104
- _create_class(PluginEjsAPI2, [
85105
- {
85106
- key: "renderString",
85107
- value: function renderString3(template, data) {
85108
- return import_ejs2.default.render(template, data) || "";
85109
- }
85110
- }
85111
- ]);
85097
+ var _proto = PluginEjsAPI2.prototype;
85098
+ _proto.renderString = function renderString3(template, data) {
85099
+ return import_ejs2.default.render(template, data) || "";
85100
+ };
85112
85101
  return PluginEjsAPI2;
85113
85102
  }();
85114
85103
 
@@ -85124,13 +85113,250 @@ var PluginFileAPI = /* @__PURE__ */ function() {
85124
85113
  "use strict";
85125
85114
  function PluginFileAPI2() {
85126
85115
  _class_call_check(this, PluginFileAPI2);
85127
- _define_property2(this, "projectPath", "");
85128
- _define_property2(this, "templatePath", "");
85129
- _define_property2(this, "handlebarAPI", new PluginHandlebarsAPI());
85130
- _define_property2(this, "ejsAPI", new PluginEjsAPI());
85131
- _define_property2(this, "jsonAPI", void 0);
85116
+ this.projectPath = "";
85117
+ this.templatePath = "";
85118
+ this.handlebarAPI = new PluginHandlebarsAPI();
85119
+ this.ejsAPI = new PluginEjsAPI();
85132
85120
  this.renderString = this.renderString.bind(this);
85133
85121
  }
85122
+ var _proto = PluginFileAPI2.prototype;
85123
+ _proto.renderString = function renderString3() {
85124
+ var template = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "handlebars";
85125
+ if (type === "ejs") {
85126
+ return this.ejsAPI.renderString(template, data);
85127
+ }
85128
+ return this.handlebarAPI.renderString(template, data);
85129
+ };
85130
+ _proto.prepare = function prepare(generator, projectPath, templatePath) {
85131
+ this.projectPath = projectPath;
85132
+ this.jsonAPI = new JsonAPI(generator);
85133
+ this.templatePath = templatePath;
85134
+ };
85135
+ _proto.addFile = function addFile1(params) {
85136
+ var _this = this;
85137
+ return _async_to_generator(function() {
85138
+ return __generator(this, function(_state) {
85139
+ switch (_state.label) {
85140
+ case 0:
85141
+ return [
85142
+ 4,
85143
+ addFile(params, _this.projectPath, _this.templatePath, _this.renderString)
85144
+ ];
85145
+ case 1:
85146
+ _state.sent();
85147
+ return [
85148
+ 2
85149
+ ];
85150
+ }
85151
+ });
85152
+ })();
85153
+ };
85154
+ _proto.addManyFiles = function addManyFiles1(params) {
85155
+ var _this = this;
85156
+ return _async_to_generator(function() {
85157
+ return __generator(this, function(_state) {
85158
+ switch (_state.label) {
85159
+ case 0:
85160
+ return [
85161
+ 4,
85162
+ addManyFiles(params, _this.projectPath, _this.templatePath, _this.renderString)
85163
+ ];
85164
+ case 1:
85165
+ _state.sent();
85166
+ return [
85167
+ 2
85168
+ ];
85169
+ }
85170
+ });
85171
+ })();
85172
+ };
85173
+ _proto.updateJSONFile = function updateJSONFile(fileName, updateInfo) {
85174
+ var _this = this;
85175
+ return _async_to_generator(function() {
85176
+ var fsMaterial;
85177
+ return __generator(this, function(_state) {
85178
+ switch (_state.label) {
85179
+ case 0:
85180
+ fsMaterial = new FsMaterial(_this.projectPath);
85181
+ return [
85182
+ 4,
85183
+ _this.jsonAPI.update(fsMaterial.get(fileName), {
85184
+ query: {},
85185
+ update: {
85186
+ $set: _object_spread({}, updateInfo)
85187
+ }
85188
+ })
85189
+ ];
85190
+ case 1:
85191
+ _state.sent();
85192
+ return [
85193
+ 2
85194
+ ];
85195
+ }
85196
+ });
85197
+ })();
85198
+ };
85199
+ _proto.updateModernConfig = function updateModernConfig(updateInfo) {
85200
+ var _this = this;
85201
+ return _async_to_generator(function() {
85202
+ var update;
85203
+ return __generator(this, function(_state) {
85204
+ switch (_state.label) {
85205
+ case 0:
85206
+ update = {};
85207
+ Object.keys(updateInfo).forEach(function(key) {
85208
+ update["modernConfig.".concat(key)] = updateInfo[key];
85209
+ });
85210
+ return [
85211
+ 4,
85212
+ _this.updateJSONFile("package.json", update)
85213
+ ];
85214
+ case 1:
85215
+ _state.sent();
85216
+ return [
85217
+ 2
85218
+ ];
85219
+ }
85220
+ });
85221
+ })();
85222
+ };
85223
+ _proto.updateTextRawFile = function updateTextRawFile(fileName, update) {
85224
+ var _this = this;
85225
+ return _async_to_generator(function() {
85226
+ var content, newContent;
85227
+ return __generator(this, function(_state) {
85228
+ switch (_state.label) {
85229
+ case 0:
85230
+ return [
85231
+ 4,
85232
+ import_utils50.fs.readFile(import_path14.default.join(_this.projectPath, fileName), "utf-8")
85233
+ ];
85234
+ case 1:
85235
+ content = _state.sent();
85236
+ newContent = update(content.split("\n"));
85237
+ return [
85238
+ 4,
85239
+ import_utils50.fs.writeFile(import_path14.default.join(_this.projectPath, fileName), newContent.join("\n"), "utf-8")
85240
+ ];
85241
+ case 2:
85242
+ _state.sent();
85243
+ return [
85244
+ 2
85245
+ ];
85246
+ }
85247
+ });
85248
+ })();
85249
+ };
85250
+ _proto.rmFile = function rmFile(fileName) {
85251
+ var _this = this;
85252
+ return _async_to_generator(function() {
85253
+ var file;
85254
+ return __generator(this, function(_state) {
85255
+ switch (_state.label) {
85256
+ case 0:
85257
+ file = import_path14.default.join(_this.projectPath, fileName);
85258
+ return [
85259
+ 4,
85260
+ fileExists(file)
85261
+ ];
85262
+ case 1:
85263
+ if (!_state.sent())
85264
+ return [
85265
+ 3,
85266
+ 3
85267
+ ];
85268
+ return [
85269
+ 4,
85270
+ import_utils50.fs.rm(file)
85271
+ ];
85272
+ case 2:
85273
+ _state.sent();
85274
+ _state.label = 3;
85275
+ case 3:
85276
+ return [
85277
+ 2
85278
+ ];
85279
+ }
85280
+ });
85281
+ })();
85282
+ };
85283
+ _proto.rmDir = function rmDir(dirName) {
85284
+ var _this = this;
85285
+ return _async_to_generator(function() {
85286
+ var dir, stat, e;
85287
+ return __generator(this, function(_state) {
85288
+ switch (_state.label) {
85289
+ case 0:
85290
+ dir = import_path14.default.join(_this.projectPath, dirName);
85291
+ _state.label = 1;
85292
+ case 1:
85293
+ _state.trys.push([
85294
+ 1,
85295
+ 5,
85296
+ ,
85297
+ 6
85298
+ ]);
85299
+ return [
85300
+ 4,
85301
+ import_utils50.fs.stat(dir)
85302
+ ];
85303
+ case 2:
85304
+ stat = _state.sent();
85305
+ if (!stat.isDirectory())
85306
+ return [
85307
+ 3,
85308
+ 4
85309
+ ];
85310
+ return [
85311
+ 4,
85312
+ import_utils50.fs.rm(dir, {
85313
+ recursive: true
85314
+ })
85315
+ ];
85316
+ case 3:
85317
+ _state.sent();
85318
+ _state.label = 4;
85319
+ case 4:
85320
+ return [
85321
+ 3,
85322
+ 6
85323
+ ];
85324
+ case 5:
85325
+ e = _state.sent();
85326
+ return [
85327
+ 3,
85328
+ 6
85329
+ ];
85330
+ case 6:
85331
+ return [
85332
+ 2
85333
+ ];
85334
+ }
85335
+ });
85336
+ })();
85337
+ };
85338
+ _proto.isFileExist = function isFileExist(fileName) {
85339
+ var _this = this;
85340
+ return _async_to_generator(function() {
85341
+ return __generator(this, function(_state) {
85342
+ return [
85343
+ 2,
85344
+ fileExists(import_path14.default.join(_this.projectPath, fileName))
85345
+ ];
85346
+ });
85347
+ })();
85348
+ };
85349
+ _proto.readDir = function readDir(dir) {
85350
+ var _this = this;
85351
+ return _async_to_generator(function() {
85352
+ return __generator(this, function(_state) {
85353
+ return [
85354
+ 2,
85355
+ import_utils50.fs.readdir(import_path14.default.join(_this.projectPath, dir))
85356
+ ];
85357
+ });
85358
+ })();
85359
+ };
85134
85360
  _create_class(PluginFileAPI2, [
85135
85361
  {
85136
85362
  key: "context",
@@ -85156,276 +85382,6 @@ var PluginFileAPI = /* @__PURE__ */ function() {
85156
85382
  addPartial: this.handlebarAPI.addPartial.bind(this.handlebarAPI)
85157
85383
  };
85158
85384
  }
85159
- },
85160
- {
85161
- key: "renderString",
85162
- value: function renderString3() {
85163
- var template = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "handlebars";
85164
- if (type === "ejs") {
85165
- return this.ejsAPI.renderString(template, data);
85166
- }
85167
- return this.handlebarAPI.renderString(template, data);
85168
- }
85169
- },
85170
- {
85171
- key: "prepare",
85172
- value: function prepare(generator, projectPath, templatePath) {
85173
- this.projectPath = projectPath;
85174
- this.jsonAPI = new JsonAPI(generator);
85175
- this.templatePath = templatePath;
85176
- }
85177
- },
85178
- {
85179
- key: "addFile",
85180
- value: function addFile1(params) {
85181
- var _this = this;
85182
- return _async_to_generator(function() {
85183
- return __generator(this, function(_state) {
85184
- switch (_state.label) {
85185
- case 0:
85186
- return [
85187
- 4,
85188
- addFile(params, _this.projectPath, _this.templatePath, _this.renderString)
85189
- ];
85190
- case 1:
85191
- _state.sent();
85192
- return [
85193
- 2
85194
- ];
85195
- }
85196
- });
85197
- })();
85198
- }
85199
- },
85200
- {
85201
- key: "addManyFiles",
85202
- value: function addManyFiles1(params) {
85203
- var _this = this;
85204
- return _async_to_generator(function() {
85205
- return __generator(this, function(_state) {
85206
- switch (_state.label) {
85207
- case 0:
85208
- return [
85209
- 4,
85210
- addManyFiles(params, _this.projectPath, _this.templatePath, _this.renderString)
85211
- ];
85212
- case 1:
85213
- _state.sent();
85214
- return [
85215
- 2
85216
- ];
85217
- }
85218
- });
85219
- })();
85220
- }
85221
- },
85222
- {
85223
- key: "updateJSONFile",
85224
- value: function updateJSONFile(fileName, updateInfo) {
85225
- var _this = this;
85226
- return _async_to_generator(function() {
85227
- var fsMaterial;
85228
- return __generator(this, function(_state) {
85229
- switch (_state.label) {
85230
- case 0:
85231
- fsMaterial = new FsMaterial(_this.projectPath);
85232
- return [
85233
- 4,
85234
- _this.jsonAPI.update(fsMaterial.get(fileName), {
85235
- query: {},
85236
- update: {
85237
- $set: _object_spread({}, updateInfo)
85238
- }
85239
- })
85240
- ];
85241
- case 1:
85242
- _state.sent();
85243
- return [
85244
- 2
85245
- ];
85246
- }
85247
- });
85248
- })();
85249
- }
85250
- },
85251
- {
85252
- key: "updateModernConfig",
85253
- value: function updateModernConfig(updateInfo) {
85254
- var _this = this;
85255
- return _async_to_generator(function() {
85256
- var update;
85257
- return __generator(this, function(_state) {
85258
- switch (_state.label) {
85259
- case 0:
85260
- update = {};
85261
- Object.keys(updateInfo).forEach(function(key) {
85262
- update["modernConfig.".concat(key)] = updateInfo[key];
85263
- });
85264
- return [
85265
- 4,
85266
- _this.updateJSONFile("package.json", update)
85267
- ];
85268
- case 1:
85269
- _state.sent();
85270
- return [
85271
- 2
85272
- ];
85273
- }
85274
- });
85275
- })();
85276
- }
85277
- },
85278
- {
85279
- key: "updateTextRawFile",
85280
- value: function updateTextRawFile(fileName, update) {
85281
- var _this = this;
85282
- return _async_to_generator(function() {
85283
- var content, newContent;
85284
- return __generator(this, function(_state) {
85285
- switch (_state.label) {
85286
- case 0:
85287
- return [
85288
- 4,
85289
- import_utils50.fs.readFile(import_path13.default.join(_this.projectPath, fileName), "utf-8")
85290
- ];
85291
- case 1:
85292
- content = _state.sent();
85293
- newContent = update(content.split("\n"));
85294
- return [
85295
- 4,
85296
- import_utils50.fs.writeFile(import_path13.default.join(_this.projectPath, fileName), newContent.join("\n"), "utf-8")
85297
- ];
85298
- case 2:
85299
- _state.sent();
85300
- return [
85301
- 2
85302
- ];
85303
- }
85304
- });
85305
- })();
85306
- }
85307
- },
85308
- {
85309
- key: "rmFile",
85310
- value: function rmFile(fileName) {
85311
- var _this = this;
85312
- return _async_to_generator(function() {
85313
- var file;
85314
- return __generator(this, function(_state) {
85315
- switch (_state.label) {
85316
- case 0:
85317
- file = import_path13.default.join(_this.projectPath, fileName);
85318
- return [
85319
- 4,
85320
- fileExists(file)
85321
- ];
85322
- case 1:
85323
- if (!_state.sent())
85324
- return [
85325
- 3,
85326
- 3
85327
- ];
85328
- return [
85329
- 4,
85330
- import_utils50.fs.rm(file)
85331
- ];
85332
- case 2:
85333
- _state.sent();
85334
- _state.label = 3;
85335
- case 3:
85336
- return [
85337
- 2
85338
- ];
85339
- }
85340
- });
85341
- })();
85342
- }
85343
- },
85344
- {
85345
- key: "rmDir",
85346
- value: function rmDir(dirName) {
85347
- var _this = this;
85348
- return _async_to_generator(function() {
85349
- var dir, stat, e;
85350
- return __generator(this, function(_state) {
85351
- switch (_state.label) {
85352
- case 0:
85353
- dir = import_path13.default.join(_this.projectPath, dirName);
85354
- _state.label = 1;
85355
- case 1:
85356
- _state.trys.push([
85357
- 1,
85358
- 5,
85359
- ,
85360
- 6
85361
- ]);
85362
- return [
85363
- 4,
85364
- import_utils50.fs.stat(dir)
85365
- ];
85366
- case 2:
85367
- stat = _state.sent();
85368
- if (!stat.isDirectory())
85369
- return [
85370
- 3,
85371
- 4
85372
- ];
85373
- return [
85374
- 4,
85375
- import_utils50.fs.rm(dir, {
85376
- recursive: true
85377
- })
85378
- ];
85379
- case 3:
85380
- _state.sent();
85381
- _state.label = 4;
85382
- case 4:
85383
- return [
85384
- 3,
85385
- 6
85386
- ];
85387
- case 5:
85388
- e = _state.sent();
85389
- return [
85390
- 3,
85391
- 6
85392
- ];
85393
- case 6:
85394
- return [
85395
- 2
85396
- ];
85397
- }
85398
- });
85399
- })();
85400
- }
85401
- },
85402
- {
85403
- key: "isFileExist",
85404
- value: function isFileExist(fileName) {
85405
- var _this = this;
85406
- return _async_to_generator(function() {
85407
- return __generator(this, function(_state) {
85408
- return [
85409
- 2,
85410
- fileExists(import_path13.default.join(_this.projectPath, fileName))
85411
- ];
85412
- });
85413
- })();
85414
- }
85415
- },
85416
- {
85417
- key: "readDir",
85418
- value: function readDir(dir) {
85419
- var _this = this;
85420
- return _async_to_generator(function() {
85421
- return __generator(this, function(_state) {
85422
- return [
85423
- 2,
85424
- import_utils50.fs.readdir(import_path13.default.join(_this.projectPath, dir))
85425
- ];
85426
- });
85427
- })();
85428
- }
85429
85385
  }
85430
85386
  ]);
85431
85387
  return PluginFileAPI2;
@@ -85436,10 +85392,66 @@ var PluginGitAPI = /* @__PURE__ */ function() {
85436
85392
  "use strict";
85437
85393
  function PluginGitAPI2() {
85438
85394
  _class_call_check(this, PluginGitAPI2);
85439
- _define_property2(this, "gitMessage", "");
85440
- _define_property2(this, "gitApi", void 0);
85441
- _define_property2(this, "projectPath", void 0);
85395
+ this.gitMessage = "";
85442
85396
  }
85397
+ var _proto = PluginGitAPI2.prototype;
85398
+ _proto.setGitMessage = function setGitMessage(gitMessage) {
85399
+ this.gitMessage = gitMessage;
85400
+ };
85401
+ _proto.prepare = function prepare(generator, projectPath) {
85402
+ this.gitApi = new GitAPI(generator);
85403
+ this.projectPath = projectPath;
85404
+ };
85405
+ _proto.isInGitRepo = function isInGitRepo2() {
85406
+ var _this = this;
85407
+ return _async_to_generator(function() {
85408
+ return __generator(this, function(_state) {
85409
+ return [
85410
+ 2,
85411
+ _this.gitApi.isInGitRepo(_this.projectPath)
85412
+ ];
85413
+ });
85414
+ })();
85415
+ };
85416
+ _proto.initGitRepo = function initGitRepo2() {
85417
+ var _this = this;
85418
+ return _async_to_generator(function() {
85419
+ return __generator(this, function(_state) {
85420
+ switch (_state.label) {
85421
+ case 0:
85422
+ return [
85423
+ 4,
85424
+ _this.gitApi.initGitRepo(_this.projectPath)
85425
+ ];
85426
+ case 1:
85427
+ _state.sent();
85428
+ return [
85429
+ 2
85430
+ ];
85431
+ }
85432
+ });
85433
+ })();
85434
+ };
85435
+ _proto.gitAddAndCommit = function gitAddAndCommit() {
85436
+ var commitMessage = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "feat: init";
85437
+ var _this = this;
85438
+ return _async_to_generator(function() {
85439
+ return __generator(this, function(_state) {
85440
+ switch (_state.label) {
85441
+ case 0:
85442
+ return [
85443
+ 4,
85444
+ _this.gitApi.addAndCommit(commitMessage, _this.projectPath)
85445
+ ];
85446
+ case 1:
85447
+ _state.sent();
85448
+ return [
85449
+ 2
85450
+ ];
85451
+ }
85452
+ });
85453
+ })();
85454
+ };
85443
85455
  _create_class(PluginGitAPI2, [
85444
85456
  {
85445
85457
  key: "context",
@@ -85458,78 +85470,6 @@ var PluginGitAPI = /* @__PURE__ */ function() {
85458
85470
  gitAddAndCommit: this.gitAddAndCommit.bind(this)
85459
85471
  };
85460
85472
  }
85461
- },
85462
- {
85463
- key: "setGitMessage",
85464
- value: function setGitMessage(gitMessage) {
85465
- this.gitMessage = gitMessage;
85466
- }
85467
- },
85468
- {
85469
- key: "prepare",
85470
- value: function prepare(generator, projectPath) {
85471
- this.gitApi = new GitAPI(generator);
85472
- this.projectPath = projectPath;
85473
- }
85474
- },
85475
- {
85476
- key: "isInGitRepo",
85477
- value: function isInGitRepo2() {
85478
- var _this = this;
85479
- return _async_to_generator(function() {
85480
- return __generator(this, function(_state) {
85481
- return [
85482
- 2,
85483
- _this.gitApi.isInGitRepo(_this.projectPath)
85484
- ];
85485
- });
85486
- })();
85487
- }
85488
- },
85489
- {
85490
- key: "initGitRepo",
85491
- value: function initGitRepo2() {
85492
- var _this = this;
85493
- return _async_to_generator(function() {
85494
- return __generator(this, function(_state) {
85495
- switch (_state.label) {
85496
- case 0:
85497
- return [
85498
- 4,
85499
- _this.gitApi.initGitRepo(_this.projectPath)
85500
- ];
85501
- case 1:
85502
- _state.sent();
85503
- return [
85504
- 2
85505
- ];
85506
- }
85507
- });
85508
- })();
85509
- }
85510
- },
85511
- {
85512
- key: "gitAddAndCommit",
85513
- value: function gitAddAndCommit() {
85514
- var commitMessage = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "feat: init";
85515
- var _this = this;
85516
- return _async_to_generator(function() {
85517
- return __generator(this, function(_state) {
85518
- switch (_state.label) {
85519
- case 0:
85520
- return [
85521
- 4,
85522
- _this.gitApi.addAndCommit(commitMessage, _this.projectPath)
85523
- ];
85524
- case 1:
85525
- _state.sent();
85526
- return [
85527
- 2
85528
- ];
85529
- }
85530
- });
85531
- })();
85532
- }
85533
85473
  }
85534
85474
  ]);
85535
85475
  return PluginGitAPI2;
@@ -85541,200 +85481,173 @@ var PluginInputContext = /* @__PURE__ */ function() {
85541
85481
  "use strict";
85542
85482
  function PluginInputContext2(solutionSchema) {
85543
85483
  _class_call_check(this, PluginInputContext2);
85544
- _define_property2(this, "inputValue", {});
85545
- _define_property2(this, "defaultConfig", {});
85546
- _define_property2(this, "solutionSchemaFunc", void 0);
85547
- _define_property2(this, "solutionSchema", {});
85548
- _define_property2(this, "extendInputMap", {});
85484
+ this.inputValue = {};
85485
+ this.defaultConfig = {};
85486
+ this.solutionSchema = {};
85487
+ this.extendInputMap = {};
85549
85488
  this.solutionSchemaFunc = solutionSchema;
85550
85489
  }
85551
- _create_class(PluginInputContext2, [
85552
- {
85553
- key: "prepare",
85554
- value: function prepare(inputData) {
85555
- this.solutionSchema = this.solutionSchemaFunc(inputData).properties;
85556
- }
85557
- },
85558
- {
85559
- key: "context",
85560
- get: function get4() {
85561
- return {
85562
- addInputBefore: this.addInputBefore.bind(this),
85563
- addInputAfter: this.addInputAfter.bind(this),
85564
- setInput: this.setInput.bind(this),
85565
- setInputValue: this.setInputValue.bind(this),
85566
- setDefaultConfig: this.setDefualtConfig.bind(this)
85567
- };
85490
+ var _proto = PluginInputContext2.prototype;
85491
+ _proto.prepare = function prepare(inputData) {
85492
+ this.solutionSchema = this.solutionSchemaFunc(inputData).properties;
85493
+ };
85494
+ _proto.validateInputKey = function validateInputKey(inputKey) {
85495
+ if (!this.solutionSchema[inputKey]) {
85496
+ throw new Error("the input key ".concat(inputKey, " not found"));
85497
+ }
85498
+ };
85499
+ _proto.validateInput = function validateInput(inputKey) {
85500
+ var _this = this;
85501
+ if (this.solutionSchema[inputKey]) {
85502
+ throw new Error("the input key ".concat(inputKey, " already exists"));
85503
+ }
85504
+ Object.keys(this.extendInputMap).forEach(function(key) {
85505
+ if (_this.extendInputMap[key].before[inputKey] || _this.extendInputMap[key].after[inputKey]) {
85506
+ throw new Error("the input key ".concat(inputKey, " is already added"));
85568
85507
  }
85569
- },
85570
- {
85571
- key: "validateInputKey",
85572
- value: function validateInputKey(inputKey) {
85573
- if (!this.solutionSchema[inputKey]) {
85574
- throw new Error("the input key ".concat(inputKey, " not found"));
85508
+ });
85509
+ };
85510
+ _proto.addInputBefore = function addInputBefore(key, input) {
85511
+ this.validateInputKey(key);
85512
+ var properties = input.properties || {};
85513
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85514
+ try {
85515
+ for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85516
+ var inputKey = _step.value;
85517
+ this.validateInput(inputKey);
85518
+ if (this.extendInputMap[key]) {
85519
+ this.extendInputMap[key].before[inputKey] = properties[inputKey];
85520
+ } else {
85521
+ this.extendInputMap[key] = {
85522
+ before: _define_property2({}, inputKey, properties[inputKey]),
85523
+ after: {}
85524
+ };
85575
85525
  }
85576
85526
  }
85577
- },
85578
- {
85579
- key: "validateInput",
85580
- value: function validateInput(inputKey) {
85581
- var _this = this;
85582
- if (this.solutionSchema[inputKey]) {
85583
- throw new Error("the input key ".concat(inputKey, " already exists"));
85527
+ } catch (err) {
85528
+ _didIteratorError = true;
85529
+ _iteratorError = err;
85530
+ } finally {
85531
+ try {
85532
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85533
+ _iterator.return();
85584
85534
  }
85585
- Object.keys(this.extendInputMap).forEach(function(key) {
85586
- if (_this.extendInputMap[key].before[inputKey] || _this.extendInputMap[key].after[inputKey]) {
85587
- throw new Error("the input key ".concat(inputKey, " is already added"));
85588
- }
85589
- });
85590
- }
85591
- },
85592
- {
85593
- key: "addInputBefore",
85594
- value: function addInputBefore(key, input) {
85595
- this.validateInputKey(key);
85596
- var properties = input.properties || {};
85597
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85598
- try {
85599
- for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85600
- var inputKey = _step.value;
85601
- this.validateInput(inputKey);
85602
- if (this.extendInputMap[key]) {
85603
- this.extendInputMap[key].before[inputKey] = properties[inputKey];
85604
- } else {
85605
- this.extendInputMap[key] = {
85606
- before: _define_property2({}, inputKey, properties[inputKey]),
85607
- after: {}
85608
- };
85609
- }
85610
- }
85611
- } catch (err) {
85612
- _didIteratorError = true;
85613
- _iteratorError = err;
85614
- } finally {
85615
- try {
85616
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85617
- _iterator.return();
85618
- }
85619
- } finally {
85620
- if (_didIteratorError) {
85621
- throw _iteratorError;
85622
- }
85623
- }
85535
+ } finally {
85536
+ if (_didIteratorError) {
85537
+ throw _iteratorError;
85624
85538
  }
85625
85539
  }
85626
- },
85627
- {
85628
- key: "addInputAfter",
85629
- value: function addInputAfter(key, input) {
85630
- this.validateInputKey(key);
85631
- var properties = input.properties || {};
85632
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85633
- try {
85634
- for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85635
- var inputKey = _step.value;
85636
- this.validateInput(inputKey);
85637
- if (this.extendInputMap[key]) {
85638
- this.extendInputMap[key].after[inputKey] = properties[inputKey];
85639
- } else {
85640
- this.extendInputMap[key] = {
85641
- before: {},
85642
- after: _define_property2({}, inputKey, properties[inputKey])
85643
- };
85644
- }
85645
- }
85646
- } catch (err) {
85647
- _didIteratorError = true;
85648
- _iteratorError = err;
85649
- } finally {
85650
- try {
85651
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85652
- _iterator.return();
85653
- }
85654
- } finally {
85655
- if (_didIteratorError) {
85656
- throw _iteratorError;
85657
- }
85658
- }
85540
+ }
85541
+ };
85542
+ _proto.addInputAfter = function addInputAfter(key, input) {
85543
+ this.validateInputKey(key);
85544
+ var properties = input.properties || {};
85545
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85546
+ try {
85547
+ for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85548
+ var inputKey = _step.value;
85549
+ this.validateInput(inputKey);
85550
+ if (this.extendInputMap[key]) {
85551
+ this.extendInputMap[key].after[inputKey] = properties[inputKey];
85552
+ } else {
85553
+ this.extendInputMap[key] = {
85554
+ before: {},
85555
+ after: _define_property2({}, inputKey, properties[inputKey])
85556
+ };
85659
85557
  }
85660
85558
  }
85661
- },
85662
- {
85663
- key: "setInput",
85664
- value: function setInput(key, field, value) {
85665
- var schema = this.solutionSchema[key];
85666
- if (schema) {
85667
- schema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85668
- return;
85669
- }
85670
- var findFlag = false;
85671
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85672
- try {
85673
- for (var _iterator = Object.keys(this.extendInputMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85674
- var inputKey = _step.value;
85675
- var beforeSchema = this.extendInputMap[inputKey].before[key];
85676
- if (beforeSchema) {
85677
- findFlag = true;
85678
- beforeSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85679
- break;
85680
- }
85681
- var afterSchema = this.extendInputMap[inputKey].after[key];
85682
- if (afterSchema) {
85683
- findFlag = true;
85684
- afterSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85685
- break;
85686
- }
85687
- }
85688
- } catch (err) {
85689
- _didIteratorError = true;
85690
- _iteratorError = err;
85691
- } finally {
85692
- try {
85693
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85694
- _iterator.return();
85695
- }
85696
- } finally {
85697
- if (_didIteratorError) {
85698
- throw _iteratorError;
85699
- }
85700
- }
85559
+ } catch (err) {
85560
+ _didIteratorError = true;
85561
+ _iteratorError = err;
85562
+ } finally {
85563
+ try {
85564
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85565
+ _iterator.return();
85701
85566
  }
85702
- if (!findFlag) {
85703
- throw new Error("the input ".concat(key, " not found"));
85567
+ } finally {
85568
+ if (_didIteratorError) {
85569
+ throw _iteratorError;
85704
85570
  }
85705
85571
  }
85706
- },
85707
- {
85708
- key: "getFinalInputs",
85709
- value: function getFinalInputs() {
85710
- var _this = this;
85711
- var result = {};
85712
- Object.keys(this.solutionSchema).forEach(function(key) {
85713
- var _ref = _this.extendInputMap[key] || {
85714
- before: {},
85715
- after: {}
85716
- }, before = _ref.before, after = _ref.after;
85717
- Object.keys(before).forEach(function(beforeKey) {
85718
- return result[beforeKey] = before[beforeKey];
85719
- });
85720
- result[key] = _this.solutionSchema[key];
85721
- Object.keys(after).forEach(function(afterKey) {
85722
- return result[afterKey] = after[afterKey];
85723
- });
85724
- });
85725
- return result;
85572
+ }
85573
+ };
85574
+ _proto.setInput = function setInput(key, field, value) {
85575
+ var schema = this.solutionSchema[key];
85576
+ if (schema) {
85577
+ schema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85578
+ return;
85579
+ }
85580
+ var findFlag = false;
85581
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85582
+ try {
85583
+ for (var _iterator = Object.keys(this.extendInputMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85584
+ var inputKey = _step.value;
85585
+ var beforeSchema = this.extendInputMap[inputKey].before[key];
85586
+ if (beforeSchema) {
85587
+ findFlag = true;
85588
+ beforeSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85589
+ break;
85590
+ }
85591
+ var afterSchema = this.extendInputMap[inputKey].after[key];
85592
+ if (afterSchema) {
85593
+ findFlag = true;
85594
+ afterSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85595
+ break;
85596
+ }
85726
85597
  }
85727
- },
85728
- {
85729
- key: "setInputValue",
85730
- value: function setInputValue(value) {
85731
- this.inputValue = value;
85598
+ } catch (err) {
85599
+ _didIteratorError = true;
85600
+ _iteratorError = err;
85601
+ } finally {
85602
+ try {
85603
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85604
+ _iterator.return();
85605
+ }
85606
+ } finally {
85607
+ if (_didIteratorError) {
85608
+ throw _iteratorError;
85609
+ }
85732
85610
  }
85733
- },
85611
+ }
85612
+ if (!findFlag) {
85613
+ throw new Error("the input ".concat(key, " not found"));
85614
+ }
85615
+ };
85616
+ _proto.getFinalInputs = function getFinalInputs() {
85617
+ var _this = this;
85618
+ var result = {};
85619
+ Object.keys(this.solutionSchema).forEach(function(key) {
85620
+ var _ref = _this.extendInputMap[key] || {
85621
+ before: {},
85622
+ after: {}
85623
+ }, before = _ref.before, after = _ref.after;
85624
+ Object.keys(before).forEach(function(beforeKey) {
85625
+ return result[beforeKey] = before[beforeKey];
85626
+ });
85627
+ result[key] = _this.solutionSchema[key];
85628
+ Object.keys(after).forEach(function(afterKey) {
85629
+ return result[afterKey] = after[afterKey];
85630
+ });
85631
+ });
85632
+ return result;
85633
+ };
85634
+ _proto.setInputValue = function setInputValue(value) {
85635
+ this.inputValue = value;
85636
+ };
85637
+ _proto.setDefualtConfig = function setDefualtConfig(value) {
85638
+ this.defaultConfig = value;
85639
+ };
85640
+ _create_class(PluginInputContext2, [
85734
85641
  {
85735
- key: "setDefualtConfig",
85736
- value: function setDefualtConfig(value) {
85737
- this.defaultConfig = value;
85642
+ key: "context",
85643
+ get: function get4() {
85644
+ return {
85645
+ addInputBefore: this.addInputBefore.bind(this),
85646
+ addInputAfter: this.addInputAfter.bind(this),
85647
+ setInput: this.setInput.bind(this),
85648
+ setInputValue: this.setInputValue.bind(this),
85649
+ setDefaultConfig: this.setDefualtConfig.bind(this)
85650
+ };
85738
85651
  }
85739
85652
  }
85740
85653
  ]);
@@ -85746,11 +85659,70 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
85746
85659
  "use strict";
85747
85660
  function PluginNpmAPI2(projectPath, packageManager) {
85748
85661
  _class_call_check(this, PluginNpmAPI2);
85749
- _define_property2(this, "projectPath", "");
85750
- _define_property2(this, "packageManager", void 0);
85662
+ this.projectPath = "";
85751
85663
  this.projectPath = projectPath;
85752
85664
  this.packageManager = packageManager;
85753
85665
  }
85666
+ var _proto = PluginNpmAPI2.prototype;
85667
+ _proto.install = function install() {
85668
+ var _this = this;
85669
+ return _async_to_generator(function() {
85670
+ return __generator(this, function(_state) {
85671
+ switch (_state.label) {
85672
+ case 0:
85673
+ if (!(_this.packageManager === PackageManager.Pnpm))
85674
+ return [
85675
+ 3,
85676
+ 2
85677
+ ];
85678
+ return [
85679
+ 4,
85680
+ pnpmInstall({
85681
+ cwd: _this.projectPath
85682
+ })
85683
+ ];
85684
+ case 1:
85685
+ _state.sent();
85686
+ return [
85687
+ 3,
85688
+ 6
85689
+ ];
85690
+ case 2:
85691
+ if (!(_this.packageManager === PackageManager.Yarn))
85692
+ return [
85693
+ 3,
85694
+ 4
85695
+ ];
85696
+ return [
85697
+ 4,
85698
+ yarnInstall({
85699
+ cwd: _this.projectPath
85700
+ })
85701
+ ];
85702
+ case 3:
85703
+ _state.sent();
85704
+ return [
85705
+ 3,
85706
+ 6
85707
+ ];
85708
+ case 4:
85709
+ return [
85710
+ 4,
85711
+ npmInstall({
85712
+ cwd: _this.projectPath
85713
+ })
85714
+ ];
85715
+ case 5:
85716
+ _state.sent();
85717
+ _state.label = 6;
85718
+ case 6:
85719
+ return [
85720
+ 2
85721
+ ];
85722
+ }
85723
+ });
85724
+ })();
85725
+ };
85754
85726
  _create_class(PluginNpmAPI2, [
85755
85727
  {
85756
85728
  key: "method",
@@ -85759,79 +85731,24 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
85759
85731
  install: this.install.bind(this)
85760
85732
  };
85761
85733
  }
85762
- },
85763
- {
85764
- key: "install",
85765
- value: function install() {
85766
- var _this = this;
85767
- return _async_to_generator(function() {
85768
- return __generator(this, function(_state) {
85769
- switch (_state.label) {
85770
- case 0:
85771
- if (!(_this.packageManager === PackageManager.Pnpm))
85772
- return [
85773
- 3,
85774
- 2
85775
- ];
85776
- return [
85777
- 4,
85778
- pnpmInstall({
85779
- cwd: _this.projectPath
85780
- })
85781
- ];
85782
- case 1:
85783
- _state.sent();
85784
- return [
85785
- 3,
85786
- 6
85787
- ];
85788
- case 2:
85789
- if (!(_this.packageManager === PackageManager.Yarn))
85790
- return [
85791
- 3,
85792
- 4
85793
- ];
85794
- return [
85795
- 4,
85796
- yarnInstall({
85797
- cwd: _this.projectPath
85798
- })
85799
- ];
85800
- case 3:
85801
- _state.sent();
85802
- return [
85803
- 3,
85804
- 6
85805
- ];
85806
- case 4:
85807
- return [
85808
- 4,
85809
- npmInstall({
85810
- cwd: _this.projectPath
85811
- })
85812
- ];
85813
- case 5:
85814
- _state.sent();
85815
- _state.label = 6;
85816
- case 6:
85817
- return [
85818
- 2
85819
- ];
85820
- }
85821
- });
85822
- })();
85823
- }
85824
85734
  }
85825
85735
  ]);
85826
85736
  return PluginNpmAPI2;
85827
85737
  }();
85828
85738
 
85829
85739
  // ../../new-action/dist/esm/utils/index.js
85830
- var import_path14 = __toESM(require("path"));
85740
+ var import_path15 = __toESM(require("path"));
85831
85741
  var import_utils53 = require("@modern-js/utils");
85742
+ var swap = (obj) => {
85743
+ return Object.keys(obj).reduce((acc, key) => {
85744
+ acc[obj[key]] = key;
85745
+ return acc;
85746
+ }, {});
85747
+ };
85748
+ var dependenceToSolution = swap(SolutionToolsMap);
85832
85749
  function alreadyRepo(cwd = process.cwd()) {
85833
85750
  try {
85834
- return import_utils50.fs.existsSync(import_path14.default.resolve(cwd, "package.json"));
85751
+ return import_utils50.fs.existsSync(import_path15.default.resolve(cwd, "package.json"));
85835
85752
  } catch (e) {
85836
85753
  return false;
85837
85754
  }
@@ -85850,7 +85767,7 @@ var readJson = (jsonPath) => {
85850
85767
  }
85851
85768
  };
85852
85769
  function hasEnabledFunction(action2, dependencies, devDependencies, peerDependencies, cwd) {
85853
- const packageJsonPath = import_path14.default.normalize(`${cwd}/package.json`);
85770
+ const packageJsonPath = import_path15.default.normalize(`${cwd}/package.json`);
85854
85771
  const packageJson = readJson(packageJsonPath);
85855
85772
  if (!dependencies[action2] && !devDependencies[action2]) {
85856
85773
  return false;
@@ -85869,9 +85786,9 @@ function hasEnabledFunction(action2, dependencies, devDependencies, peerDependen
85869
85786
  }
85870
85787
  return false;
85871
85788
  }
85872
- function getGeneratorPath(generator, distTag) {
85789
+ function getGeneratorPath2(generator, distTag) {
85873
85790
  if (process.env.CODESMITH_ENV === "development") {
85874
- return import_path14.default.dirname(require.resolve(generator));
85791
+ return import_path15.default.dirname(require.resolve(generator));
85875
85792
  } else if (distTag) {
85876
85793
  return `${generator}@${distTag}`;
85877
85794
  }
@@ -85928,7 +85845,7 @@ var MWANewAction = async (options) => {
85928
85845
  });
85929
85846
  const actionType = ans.actionType;
85930
85847
  const action2 = ans[actionType];
85931
- const generator = getGeneratorPath(MWANewActionGenerators[actionType][action2], distTag);
85848
+ const generator = getGeneratorPath2(MWANewActionGenerators[actionType][action2], distTag);
85932
85849
  if (!generator) {
85933
85850
  throw new Error(`no valid option`);
85934
85851
  }
@@ -86024,7 +85941,7 @@ var ModuleNewAction = async (options) => {
86024
85941
  });
86025
85942
  const actionType = ans.actionType;
86026
85943
  const action2 = ans[actionType];
86027
- const generator = getGeneratorPath(ModuleNewActionGenerators[actionType][action2], distTag);
85944
+ const generator = getGeneratorPath2(ModuleNewActionGenerators[actionType][action2], distTag);
86028
85945
  if (!generator) {
86029
85946
  throw new Error(`no valid option`);
86030
85947
  }
@@ -86080,7 +85997,7 @@ var ModuleNewAction = async (options) => {
86080
85997
  };
86081
85998
 
86082
85999
  // ../../new-action/dist/esm/monorepo.js
86083
- var import_path15 = __toESM(require("path"));
86000
+ var import_path16 = __toESM(require("path"));
86084
86001
  var import_lodash12 = require("@modern-js/utils/lodash");
86085
86002
  var REPO_GENERATOR = "@modern-js/repo-generator";
86086
86003
  var MonorepoNewAction = async (options) => {
@@ -86103,10 +86020,10 @@ var MonorepoNewAction = async (options) => {
86103
86020
  }
86104
86021
  const plugins = plugin.map((plugin2) => {
86105
86022
  try {
86106
- return import_path15.default.join(require.resolve(plugin2), "../../");
86023
+ return import_path16.default.join(require.resolve(plugin2), "../../");
86107
86024
  } catch (e) {
86108
86025
  try {
86109
- return import_path15.default.join(require.resolve(plugin2), "../../../../");
86026
+ return import_path16.default.join(require.resolve(plugin2), "../../../../");
86110
86027
  } catch (e2) {
86111
86028
  return plugin2;
86112
86029
  }
@@ -86146,14 +86063,141 @@ var PluginNewAPI = /* @__PURE__ */ function() {
86146
86063
  "use strict";
86147
86064
  function PluginNewAPI2(solution, projectPath, inputData) {
86148
86065
  _class_call_check(this, PluginNewAPI2);
86149
- _define_property2(this, "solution", void 0);
86150
- _define_property2(this, "projectPath", void 0);
86151
- _define_property2(this, "inputData", void 0);
86152
86066
  this.solution = solution;
86153
86067
  this.projectPath = projectPath;
86154
86068
  this.inputData = inputData;
86155
86069
  process.setMaxListeners(20);
86156
86070
  }
86071
+ var _proto = PluginNewAPI2.prototype;
86072
+ _proto.createElement = function createElement(element, params) {
86073
+ var _this = this;
86074
+ return _async_to_generator(function() {
86075
+ return __generator(this, function(_state) {
86076
+ switch (_state.label) {
86077
+ case 0:
86078
+ if (!(_this.solution === Solution.MWA))
86079
+ return [
86080
+ 3,
86081
+ 2
86082
+ ];
86083
+ if (!MWAActionElements.includes(element)) {
86084
+ throw new Error("the element ".concat(element, " not support to create"));
86085
+ }
86086
+ return [
86087
+ 4,
86088
+ MWANewAction({
86089
+ config: JSON.stringify(_object_spread({
86090
+ actionType: ActionType.Element,
86091
+ element,
86092
+ noNeedInstall: true
86093
+ }, _this.inputData, params)),
86094
+ cwd: _this.projectPath
86095
+ })
86096
+ ];
86097
+ case 1:
86098
+ _state.sent();
86099
+ return [
86100
+ 2
86101
+ ];
86102
+ case 2:
86103
+ throw new Error("this solution project not support create element");
86104
+ }
86105
+ });
86106
+ })();
86107
+ };
86108
+ _proto.enableFunc = function enableFunc(func, params) {
86109
+ var _this = this;
86110
+ return _async_to_generator(function() {
86111
+ return __generator(this, function(_state) {
86112
+ switch (_state.label) {
86113
+ case 0:
86114
+ if (!(_this.solution === Solution.MWA))
86115
+ return [
86116
+ 3,
86117
+ 2
86118
+ ];
86119
+ if (!MWAActionFunctions.includes(func)) {
86120
+ throw new Error("the func ".concat(func, " not support to enable"));
86121
+ }
86122
+ return [
86123
+ 4,
86124
+ MWANewAction({
86125
+ config: JSON.stringify(_object_spread({
86126
+ actionType: ActionType.Function,
86127
+ function: func,
86128
+ noNeedInstall: true
86129
+ }, _this.inputData, params)),
86130
+ cwd: _this.projectPath
86131
+ })
86132
+ ];
86133
+ case 1:
86134
+ _state.sent();
86135
+ return [
86136
+ 2
86137
+ ];
86138
+ case 2:
86139
+ if (!(_this.solution === Solution.Module))
86140
+ return [
86141
+ 3,
86142
+ 4
86143
+ ];
86144
+ if (!ModuleActionFunctions.includes(func)) {
86145
+ throw new Error("the func ".concat(func, " not support to enable"));
86146
+ }
86147
+ return [
86148
+ 4,
86149
+ ModuleNewAction({
86150
+ config: JSON.stringify(_object_spread({
86151
+ actionType: ActionType.Function,
86152
+ function: func,
86153
+ noNeedInstall: true
86154
+ }, _this.inputData, params)),
86155
+ cwd: _this.projectPath
86156
+ })
86157
+ ];
86158
+ case 3:
86159
+ _state.sent();
86160
+ return [
86161
+ 2
86162
+ ];
86163
+ case 4:
86164
+ throw new Error("this solution project not support enable function");
86165
+ }
86166
+ });
86167
+ })();
86168
+ };
86169
+ _proto.createSubProject = function createSubProject(solution, params) {
86170
+ var _this = this;
86171
+ return _async_to_generator(function() {
86172
+ return __generator(this, function(_state) {
86173
+ switch (_state.label) {
86174
+ case 0:
86175
+ if (!(_this.solution === Solution.Monorepo))
86176
+ return [
86177
+ 3,
86178
+ 2
86179
+ ];
86180
+ return [
86181
+ 4,
86182
+ MonorepoNewAction({
86183
+ config: JSON.stringify(_object_spread({
86184
+ solution,
86185
+ noNeedInstall: true
86186
+ }, _this.inputData, params)),
86187
+ cwd: _this.projectPath
86188
+ })
86189
+ ];
86190
+ case 1:
86191
+ _state.sent();
86192
+ return [
86193
+ 2
86194
+ ];
86195
+ case 2:
86196
+ throw new Error("this solution project not support create subproject");
86197
+ }
86198
+ });
86199
+ })();
86200
+ };
86157
86201
  _create_class(PluginNewAPI2, [
86158
86202
  {
86159
86203
  key: "method",
@@ -86164,144 +86208,6 @@ var PluginNewAPI = /* @__PURE__ */ function() {
86164
86208
  createSubProject: this.createSubProject.bind(this)
86165
86209
  };
86166
86210
  }
86167
- },
86168
- {
86169
- key: "createElement",
86170
- value: function createElement(element, params) {
86171
- var _this = this;
86172
- return _async_to_generator(function() {
86173
- return __generator(this, function(_state) {
86174
- switch (_state.label) {
86175
- case 0:
86176
- if (!(_this.solution === Solution.MWA))
86177
- return [
86178
- 3,
86179
- 2
86180
- ];
86181
- if (!MWAActionElements.includes(element)) {
86182
- throw new Error("the element ".concat(element, " not support to create"));
86183
- }
86184
- return [
86185
- 4,
86186
- MWANewAction({
86187
- config: JSON.stringify(_object_spread({
86188
- actionType: ActionType.Element,
86189
- element,
86190
- noNeedInstall: true
86191
- }, _this.inputData, params)),
86192
- cwd: _this.projectPath
86193
- })
86194
- ];
86195
- case 1:
86196
- _state.sent();
86197
- return [
86198
- 2
86199
- ];
86200
- case 2:
86201
- throw new Error("this solution project not support create element");
86202
- }
86203
- });
86204
- })();
86205
- }
86206
- },
86207
- {
86208
- key: "enableFunc",
86209
- value: function enableFunc(func, params) {
86210
- var _this = this;
86211
- return _async_to_generator(function() {
86212
- return __generator(this, function(_state) {
86213
- switch (_state.label) {
86214
- case 0:
86215
- if (!(_this.solution === Solution.MWA))
86216
- return [
86217
- 3,
86218
- 2
86219
- ];
86220
- if (!MWAActionFunctions.includes(func)) {
86221
- throw new Error("the func ".concat(func, " not support to enable"));
86222
- }
86223
- return [
86224
- 4,
86225
- MWANewAction({
86226
- config: JSON.stringify(_object_spread({
86227
- actionType: ActionType.Function,
86228
- function: func,
86229
- noNeedInstall: true
86230
- }, _this.inputData, params)),
86231
- cwd: _this.projectPath
86232
- })
86233
- ];
86234
- case 1:
86235
- _state.sent();
86236
- return [
86237
- 2
86238
- ];
86239
- case 2:
86240
- if (!(_this.solution === Solution.Module))
86241
- return [
86242
- 3,
86243
- 4
86244
- ];
86245
- if (!ModuleActionFunctions.includes(func)) {
86246
- throw new Error("the func ".concat(func, " not support to enable"));
86247
- }
86248
- return [
86249
- 4,
86250
- ModuleNewAction({
86251
- config: JSON.stringify(_object_spread({
86252
- actionType: ActionType.Function,
86253
- function: func,
86254
- noNeedInstall: true
86255
- }, _this.inputData, params)),
86256
- cwd: _this.projectPath
86257
- })
86258
- ];
86259
- case 3:
86260
- _state.sent();
86261
- return [
86262
- 2
86263
- ];
86264
- case 4:
86265
- throw new Error("this solution project not support enable function");
86266
- }
86267
- });
86268
- })();
86269
- }
86270
- },
86271
- {
86272
- key: "createSubProject",
86273
- value: function createSubProject(solution, params) {
86274
- var _this = this;
86275
- return _async_to_generator(function() {
86276
- return __generator(this, function(_state) {
86277
- switch (_state.label) {
86278
- case 0:
86279
- if (!(_this.solution === Solution.Monorepo))
86280
- return [
86281
- 3,
86282
- 2
86283
- ];
86284
- return [
86285
- 4,
86286
- MonorepoNewAction({
86287
- config: JSON.stringify(_object_spread({
86288
- solution,
86289
- noNeedInstall: true
86290
- }, _this.inputData, params)),
86291
- cwd: _this.projectPath
86292
- })
86293
- ];
86294
- case 1:
86295
- _state.sent();
86296
- return [
86297
- 2
86298
- ];
86299
- case 2:
86300
- throw new Error("this solution project not support create subproject");
86301
- }
86302
- });
86303
- })();
86304
- }
86305
86211
  }
86306
86212
  ]);
86307
86213
  return PluginNewAPI2;
@@ -86317,22 +86223,29 @@ var PluginContext = /* @__PURE__ */ function() {
86317
86223
  "use strict";
86318
86224
  function PluginContext2(solutionSchema, locale) {
86319
86225
  _class_call_check(this, PluginContext2);
86320
- _define_property2(this, "generator", void 0);
86321
- _define_property2(this, "inputContext", void 0);
86322
- _define_property2(this, "gitAPI", void 0);
86323
- _define_property2(this, "fileAPI", void 0);
86324
- _define_property2(this, "npmAPI", void 0);
86325
- _define_property2(this, "newAPI", void 0);
86326
- _define_property2(this, "locale", void 0);
86327
86226
  var _obj;
86328
- _define_property2(this, "lifeCycleFuncMap", (_obj = {}, _define_property2(_obj, "onForged", function() {
86227
+ this.lifeCycleFuncMap = (_obj = {}, _define_property2(_obj, "onForged", function() {
86329
86228
  }), _define_property2(_obj, "afterForged", function() {
86330
- }), _obj));
86229
+ }), _obj);
86331
86230
  this.inputContext = new PluginInputContext(solutionSchema);
86332
86231
  this.gitAPI = new PluginGitAPI();
86333
86232
  this.fileAPI = new PluginFileAPI();
86334
86233
  this.locale = locale;
86335
86234
  }
86235
+ var _proto = PluginContext2.prototype;
86236
+ _proto.handlePrepareContext = function handlePrepareContext(generator, solution, projectPath, templatePath, inputData) {
86237
+ this.generator = generator;
86238
+ this.gitAPI.prepare(generator, projectPath);
86239
+ this.fileAPI.prepare(generator, projectPath, templatePath);
86240
+ this.npmAPI = new PluginNpmAPI(projectPath, inputData.packageManager);
86241
+ this.newAPI = new PluginNewAPI(solution, projectPath, inputData);
86242
+ };
86243
+ _proto.onForged = function onForged(func) {
86244
+ this.lifeCycleFuncMap["onForged"] = func;
86245
+ };
86246
+ _proto.afterForged = function afterForged(func) {
86247
+ this.lifeCycleFuncMap["afterForged"] = func;
86248
+ };
86336
86249
  _create_class(PluginContext2, [
86337
86250
  {
86338
86251
  key: "context",
@@ -86356,35 +86269,13 @@ var PluginContext = /* @__PURE__ */ function() {
86356
86269
  get: function get4() {
86357
86270
  return _object_spread({}, this.gitAPI.method, this.npmAPI.method);
86358
86271
  }
86359
- },
86360
- {
86361
- key: "handlePrepareContext",
86362
- value: function handlePrepareContext(generator, solution, projectPath, templatePath, inputData) {
86363
- this.generator = generator;
86364
- this.gitAPI.prepare(generator, projectPath);
86365
- this.fileAPI.prepare(generator, projectPath, templatePath);
86366
- this.npmAPI = new PluginNpmAPI(projectPath, inputData.packageManager);
86367
- this.newAPI = new PluginNewAPI(solution, projectPath, inputData);
86368
- }
86369
- },
86370
- {
86371
- key: "onForged",
86372
- value: function onForged(func) {
86373
- this.lifeCycleFuncMap["onForged"] = func;
86374
- }
86375
- },
86376
- {
86377
- key: "afterForged",
86378
- value: function afterForged(func) {
86379
- this.lifeCycleFuncMap["afterForged"] = func;
86380
- }
86381
86272
  }
86382
86273
  ]);
86383
86274
  return PluginContext2;
86384
86275
  }();
86385
86276
 
86386
86277
  // ../../generator-plugin/dist/esm/utils/index.js
86387
- var import_path16 = __toESM(require("path"));
86278
+ var import_path17 = __toESM(require("path"));
86388
86279
 
86389
86280
  // ../../generator-plugin/dist/esm/utils/module.js
86390
86281
  var import_lodash13 = require("@modern-js/utils/lodash");
@@ -86468,7 +86359,7 @@ function _installPlugins() {
86468
86359
  switch (_state2.label) {
86469
86360
  case 0:
86470
86361
  if (plugin.startsWith("file:")) {
86471
- pluginPath = import_path16.default.join(process.cwd(), plugin.slice(5));
86362
+ pluginPath = import_path17.default.join(process.cwd(), plugin.slice(5));
86472
86363
  return [
86473
86364
  2,
86474
86365
  {
@@ -86477,7 +86368,7 @@ function _installPlugins() {
86477
86368
  }
86478
86369
  ];
86479
86370
  }
86480
- if (import_path16.default.isAbsolute(plugin)) {
86371
+ if (import_path17.default.isAbsolute(plugin)) {
86481
86372
  return [
86482
86373
  2,
86483
86374
  {
@@ -86545,11 +86436,9 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
86545
86436
  function GeneratorPlugin2(logger2, event) {
86546
86437
  var locale = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "en";
86547
86438
  _class_call_check(this, GeneratorPlugin2);
86548
- _define_property2(this, "plugins", []);
86549
- _define_property2(this, "extendPlugin", {});
86550
- _define_property2(this, "customPlugin", {});
86551
- _define_property2(this, "event", void 0);
86552
- _define_property2(this, "logger", void 0);
86439
+ this.plugins = [];
86440
+ this.extendPlugin = {};
86441
+ this.customPlugin = {};
86553
86442
  this.event = event;
86554
86443
  this.logger = logger2;
86555
86444
  if (event) {
@@ -86565,451 +86454,421 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
86565
86454
  locale
86566
86455
  });
86567
86456
  }
86568
- _create_class(GeneratorPlugin2, [
86569
- {
86570
- key: "setupPlugin",
86571
- value: function setupPlugin(plugins, registry2) {
86572
- var _this = this;
86573
- return _async_to_generator(function() {
86574
- return __generator(this, function(_state) {
86575
- switch (_state.label) {
86576
- case 0:
86577
- return [
86578
- 4,
86579
- Promise.all(plugins.map(function() {
86580
- var _ref = _async_to_generator(function(plugin) {
86581
- var pkgJSON, _getPackageInfo, name, pkgVersion, meta;
86582
- return __generator(this, function(_state2) {
86583
- switch (_state2.label) {
86584
- case 0:
86585
- if (!plugin.startsWith("file:"))
86586
- return [
86587
- 3,
86588
- 2
86589
- ];
86590
- return [
86591
- 4,
86592
- import_utils50.fs.readJSON(import_path17.default.join(process.cwd(), plugin.slice(5), "package.json"))
86593
- ];
86594
- case 1:
86595
- pkgJSON = _state2.sent();
86596
- return [
86597
- 3,
86598
- 6
86599
- ];
86600
- case 2:
86601
- if (!import_path17.default.isAbsolute(plugin))
86602
- return [
86603
- 3,
86604
- 4
86605
- ];
86606
- return [
86607
- 4,
86608
- import_utils50.fs.readJSON(import_path17.default.join(plugin, "package.json"))
86609
- ];
86610
- case 3:
86611
- pkgJSON = _state2.sent();
86612
- return [
86613
- 3,
86614
- 6
86615
- ];
86616
- case 4:
86617
- _getPackageInfo = getPackageInfo(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
86618
- return [
86619
- 4,
86620
- getPackageMeta(name, pkgVersion, {
86621
- registryUrl: registry2
86622
- })
86623
- ];
86624
- case 5:
86625
- pkgJSON = _state2.sent();
86626
- _state2.label = 6;
86627
- case 6:
86628
- meta = pkgJSON.meta;
86629
- if (!meta) {
86630
- throw new Error(i18n4.t(localeKeys4.plugin_no_meta_error, {
86631
- plugin
86632
- }));
86633
- }
86634
- if (meta.extend) {
86635
- _this.extendPlugin[meta.extend] = _to_consumable_array(_this.extendPlugin[meta.extend] || []).concat([
86636
- plugin
86637
- ]);
86638
- } else if (meta.type && meta.key) {
86639
- _this.customPlugin[meta.type] = _to_consumable_array(_this.customPlugin[meta.type] || []).concat([
86640
- _object_spread_props(_object_spread({}, meta), {
86641
- plugin
86642
- })
86643
- ]);
86644
- }
86645
- return [
86646
- 2
86647
- ];
86457
+ var _proto = GeneratorPlugin2.prototype;
86458
+ _proto.setupPlugin = function setupPlugin(plugins, registry2) {
86459
+ var _this = this;
86460
+ return _async_to_generator(function() {
86461
+ return __generator(this, function(_state) {
86462
+ switch (_state.label) {
86463
+ case 0:
86464
+ return [
86465
+ 4,
86466
+ Promise.all(plugins.map(function() {
86467
+ var _ref = _async_to_generator(function(plugin) {
86468
+ var pkgJSON, _getPackageInfo, name, pkgVersion, meta;
86469
+ return __generator(this, function(_state2) {
86470
+ switch (_state2.label) {
86471
+ case 0:
86472
+ if (!plugin.startsWith("file:"))
86473
+ return [
86474
+ 3,
86475
+ 2
86476
+ ];
86477
+ return [
86478
+ 4,
86479
+ import_utils50.fs.readJSON(import_path18.default.join(process.cwd(), plugin.slice(5), "package.json"))
86480
+ ];
86481
+ case 1:
86482
+ pkgJSON = _state2.sent();
86483
+ return [
86484
+ 3,
86485
+ 6
86486
+ ];
86487
+ case 2:
86488
+ if (!import_path18.default.isAbsolute(plugin))
86489
+ return [
86490
+ 3,
86491
+ 4
86492
+ ];
86493
+ return [
86494
+ 4,
86495
+ import_utils50.fs.readJSON(import_path18.default.join(plugin, "package.json"))
86496
+ ];
86497
+ case 3:
86498
+ pkgJSON = _state2.sent();
86499
+ return [
86500
+ 3,
86501
+ 6
86502
+ ];
86503
+ case 4:
86504
+ _getPackageInfo = getPackageInfo(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
86505
+ return [
86506
+ 4,
86507
+ getPackageMeta(name, pkgVersion, {
86508
+ registryUrl: registry2
86509
+ })
86510
+ ];
86511
+ case 5:
86512
+ pkgJSON = _state2.sent();
86513
+ _state2.label = 6;
86514
+ case 6:
86515
+ meta = pkgJSON.meta;
86516
+ if (!meta) {
86517
+ throw new Error(i18n4.t(localeKeys4.plugin_no_meta_error, {
86518
+ plugin
86519
+ }));
86648
86520
  }
86649
- });
86650
- });
86651
- return function(plugin) {
86652
- return _ref.apply(this, arguments);
86653
- };
86654
- }()))
86655
- ];
86656
- case 1:
86657
- _state.sent();
86658
- return [
86659
- 2
86660
- ];
86661
- }
86662
- });
86663
- })();
86664
- }
86665
- },
86666
- {
86667
- key: "getInputSchema",
86668
- value: function getInputSchema() {
86669
- var properties = {};
86670
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86671
- try {
86672
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86673
- var info = _step.value;
86674
- properties = _object_spread({}, properties, info.context.inputContext.getFinalInputs());
86675
- }
86676
- } catch (err) {
86677
- _didIteratorError = true;
86678
- _iteratorError = err;
86679
- } finally {
86680
- try {
86681
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86682
- _iterator.return();
86683
- }
86684
- } finally {
86685
- if (_didIteratorError) {
86686
- throw _iteratorError;
86687
- }
86688
- }
86521
+ if (meta.extend) {
86522
+ _this.extendPlugin[meta.extend] = _to_consumable_array(_this.extendPlugin[meta.extend] || []).concat([
86523
+ plugin
86524
+ ]);
86525
+ } else if (meta.type && meta.key) {
86526
+ _this.customPlugin[meta.type] = _to_consumable_array(_this.customPlugin[meta.type] || []).concat([
86527
+ _object_spread_props(_object_spread({}, meta), {
86528
+ plugin
86529
+ })
86530
+ ]);
86531
+ }
86532
+ return [
86533
+ 2
86534
+ ];
86535
+ }
86536
+ });
86537
+ });
86538
+ return function(plugin) {
86539
+ return _ref.apply(this, arguments);
86540
+ };
86541
+ }()))
86542
+ ];
86543
+ case 1:
86544
+ _state.sent();
86545
+ return [
86546
+ 2
86547
+ ];
86689
86548
  }
86690
- return {
86691
- type: "object",
86692
- properties
86693
- };
86549
+ });
86550
+ })();
86551
+ };
86552
+ _proto.getInputSchema = function getInputSchema() {
86553
+ var properties = {};
86554
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86555
+ try {
86556
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86557
+ var info = _step.value;
86558
+ properties = _object_spread({}, properties, info.context.inputContext.getFinalInputs());
86694
86559
  }
86695
- },
86696
- {
86697
- key: "getInputValue",
86698
- value: function getInputValue() {
86699
- var result = {};
86700
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86701
- try {
86702
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86703
- var info = _step.value;
86704
- result = (0, import_lodash14.merge)(result, info.context.inputContext.inputValue);
86705
- }
86706
- } catch (err) {
86707
- _didIteratorError = true;
86708
- _iteratorError = err;
86709
- } finally {
86710
- try {
86711
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86712
- _iterator.return();
86713
- }
86714
- } finally {
86715
- if (_didIteratorError) {
86716
- throw _iteratorError;
86717
- }
86718
- }
86560
+ } catch (err) {
86561
+ _didIteratorError = true;
86562
+ _iteratorError = err;
86563
+ } finally {
86564
+ try {
86565
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86566
+ _iterator.return();
86567
+ }
86568
+ } finally {
86569
+ if (_didIteratorError) {
86570
+ throw _iteratorError;
86719
86571
  }
86720
- return result;
86721
86572
  }
86722
- },
86723
- {
86724
- key: "getDefaultConfig",
86725
- value: function getDefaultConfig() {
86726
- var result = {};
86727
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86728
- try {
86729
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86730
- var info = _step.value;
86731
- result = (0, import_lodash14.merge)(result, info.context.inputContext.defaultConfig);
86732
- }
86733
- } catch (err) {
86734
- _didIteratorError = true;
86735
- _iteratorError = err;
86736
- } finally {
86737
- try {
86738
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86739
- _iterator.return();
86740
- }
86741
- } finally {
86742
- if (_didIteratorError) {
86743
- throw _iteratorError;
86744
- }
86745
- }
86573
+ }
86574
+ return {
86575
+ type: "object",
86576
+ properties
86577
+ };
86578
+ };
86579
+ _proto.getInputValue = function getInputValue() {
86580
+ var result = {};
86581
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86582
+ try {
86583
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86584
+ var info = _step.value;
86585
+ result = (0, import_lodash14.merge)(result, info.context.inputContext.inputValue);
86586
+ }
86587
+ } catch (err) {
86588
+ _didIteratorError = true;
86589
+ _iteratorError = err;
86590
+ } finally {
86591
+ try {
86592
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86593
+ _iterator.return();
86594
+ }
86595
+ } finally {
86596
+ if (_didIteratorError) {
86597
+ throw _iteratorError;
86746
86598
  }
86747
- return result;
86748
86599
  }
86749
- },
86750
- {
86751
- key: "installPlugins",
86752
- value: function installPlugins1(solution, inputData) {
86753
- var _this = this;
86754
- return _async_to_generator(function() {
86755
- var plugins, plugin, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info;
86756
- return __generator(this, function(_state) {
86757
- switch (_state.label) {
86758
- case 0:
86759
- plugins = [];
86760
- if (_this.extendPlugin[solution] && _this.extendPlugin[solution].length > 0) {
86761
- plugins = _to_consumable_array(plugins).concat(_to_consumable_array(_this.extendPlugin[solution]));
86762
- }
86763
- if (_this.customPlugin[solution]) {
86764
- plugin = _this.customPlugin[solution].find(function(item) {
86765
- return item.key === inputData.scenes;
86766
- });
86767
- if (plugin) {
86768
- plugins.push(plugin.plugin);
86769
- }
86770
- }
86771
- _this.logger.info(i18n4.t(localeKeys4.install_plugin));
86772
- return [
86773
- 4,
86774
- installPlugins(plugins, inputData.registry)
86775
- ];
86776
- case 1:
86777
- _this.plugins = _state.sent();
86778
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86779
- try {
86780
- for (_iterator = _this.plugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86781
- info = _step.value;
86782
- info.context = new PluginContext(SolutionSchemas[solution], inputData.locale);
86783
- info.context.inputContext.prepare(inputData);
86784
- info.module(info.context.context);
86785
- }
86786
- } catch (err) {
86787
- _didIteratorError = true;
86788
- _iteratorError = err;
86789
- } finally {
86790
- try {
86791
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86792
- _iterator.return();
86793
- }
86794
- } finally {
86795
- if (_didIteratorError) {
86796
- throw _iteratorError;
86797
- }
86798
- }
86799
- }
86800
- return [
86801
- 2
86802
- ];
86803
- }
86804
- });
86805
- })();
86600
+ }
86601
+ return result;
86602
+ };
86603
+ _proto.getDefaultConfig = function getDefaultConfig() {
86604
+ var result = {};
86605
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86606
+ try {
86607
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86608
+ var info = _step.value;
86609
+ result = (0, import_lodash14.merge)(result, info.context.inputContext.defaultConfig);
86806
86610
  }
86807
- },
86808
- {
86809
- key: "getGitMessage",
86810
- value: function getGitMessage() {
86811
- var result = "";
86812
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86813
- try {
86814
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86815
- var info = _step.value;
86816
- var _info_context;
86817
- if ((_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.gitAPI.gitMessage) {
86818
- var _info_context1;
86819
- result = ((_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.gitAPI.gitMessage) || "";
86820
- }
86821
- }
86822
- } catch (err) {
86823
- _didIteratorError = true;
86824
- _iteratorError = err;
86825
- } finally {
86826
- try {
86827
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86828
- _iterator.return();
86829
- }
86830
- } finally {
86831
- if (_didIteratorError) {
86832
- throw _iteratorError;
86833
- }
86834
- }
86611
+ } catch (err) {
86612
+ _didIteratorError = true;
86613
+ _iteratorError = err;
86614
+ } finally {
86615
+ try {
86616
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86617
+ _iterator.return();
86618
+ }
86619
+ } finally {
86620
+ if (_didIteratorError) {
86621
+ throw _iteratorError;
86835
86622
  }
86836
- return result;
86837
86623
  }
86838
- },
86839
- {
86840
- key: "handleForged",
86841
- value: function handleForged(solution, basePath, inputData, projectPath, generatorCore) {
86842
- var _this = this;
86843
- return _async_to_generator(function() {
86844
- var generatorPlugin, restData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info, _info_context, _info_context1, onForgedFunc, err, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, info1, _info_context2, afterForged, err;
86845
- return __generator(this, function(_state) {
86846
- switch (_state.label) {
86847
- case 0:
86848
- _this.logger.info(i18n4.t(localeKeys4.run_plugin));
86849
- generatorPlugin = inputData.generatorPlugin, restData = _object_without_properties(inputData, [
86850
- "generatorPlugin"
86851
- ]);
86852
- if (solution !== restData.solution) {
86853
- if (_this.event) {
86854
- _this.event.emit("handle forged success");
86855
- }
86856
- return [
86857
- 2
86858
- ];
86859
- }
86860
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86861
- _state.label = 1;
86862
- case 1:
86863
- _state.trys.push([
86864
- 1,
86865
- 6,
86866
- 7,
86867
- 8
86868
- ]);
86869
- _iterator = _this.plugins[Symbol.iterator]();
86870
- _state.label = 2;
86871
- case 2:
86872
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
86873
- return [
86874
- 3,
86875
- 5
86876
- ];
86624
+ }
86625
+ return result;
86626
+ };
86627
+ _proto.installPlugins = function installPlugins1(solution, inputData) {
86628
+ var _this = this;
86629
+ return _async_to_generator(function() {
86630
+ var plugins, plugin, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info;
86631
+ return __generator(this, function(_state) {
86632
+ switch (_state.label) {
86633
+ case 0:
86634
+ plugins = [];
86635
+ if (_this.extendPlugin[solution] && _this.extendPlugin[solution].length > 0) {
86636
+ plugins = _to_consumable_array(plugins).concat(_to_consumable_array(_this.extendPlugin[solution]));
86637
+ }
86638
+ if (_this.customPlugin[solution]) {
86639
+ plugin = _this.customPlugin[solution].find(function(item) {
86640
+ return item.key === inputData.scenes;
86641
+ });
86642
+ if (plugin) {
86643
+ plugins.push(plugin.plugin);
86644
+ }
86645
+ }
86646
+ _this.logger.info(i18n4.t(localeKeys4.install_plugin));
86647
+ return [
86648
+ 4,
86649
+ installPlugins(plugins, inputData.registry)
86650
+ ];
86651
+ case 1:
86652
+ _this.plugins = _state.sent();
86653
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86654
+ try {
86655
+ for (_iterator = _this.plugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86877
86656
  info = _step.value;
86878
- (_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.handlePrepareContext(generatorCore, solution, import_path17.default.join(basePath, projectPath), import_path17.default.join(info.templatePath, "templates"), restData);
86879
- onForgedFunc = (_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.lifeCycleFuncMap[LifeCycle2.OnForged];
86880
- if (!(onForgedFunc && (0, import_lodash14.isFunction)(onForgedFunc)))
86881
- return [
86882
- 3,
86883
- 4
86884
- ];
86885
- return [
86886
- 4,
86887
- onForgedFunc(info.context.forgedAPI, restData)
86888
- ];
86889
- case 3:
86890
- _state.sent();
86891
- _state.label = 4;
86892
- case 4:
86893
- _iteratorNormalCompletion = true;
86894
- return [
86895
- 3,
86896
- 2
86897
- ];
86898
- case 5:
86899
- return [
86900
- 3,
86901
- 8
86902
- ];
86903
- case 6:
86904
- err = _state.sent();
86905
- _didIteratorError = true;
86906
- _iteratorError = err;
86907
- return [
86908
- 3,
86909
- 8
86910
- ];
86911
- case 7:
86912
- try {
86913
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86914
- _iterator.return();
86915
- }
86916
- } finally {
86917
- if (_didIteratorError) {
86918
- throw _iteratorError;
86919
- }
86920
- }
86921
- return [
86922
- 7
86923
- ];
86924
- case 8:
86925
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
86926
- _state.label = 9;
86927
- case 9:
86928
- _state.trys.push([
86929
- 9,
86930
- 14,
86931
- 15,
86932
- 16
86933
- ]);
86934
- _iterator1 = _this.plugins[Symbol.iterator]();
86935
- _state.label = 10;
86936
- case 10:
86937
- if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done))
86938
- return [
86939
- 3,
86940
- 13
86941
- ];
86942
- info1 = _step1.value;
86943
- afterForged = (_info_context2 = info1.context) === null || _info_context2 === void 0 ? void 0 : _info_context2.lifeCycleFuncMap[LifeCycle2.AfterForged];
86944
- if (!(afterForged && (0, import_lodash14.isFunction)(afterForged)))
86945
- return [
86946
- 3,
86947
- 12
86948
- ];
86949
- return [
86950
- 4,
86951
- afterForged(info1.context.afterForgedAPI, restData)
86952
- ];
86953
- case 11:
86954
- _state.sent();
86955
- _state.label = 12;
86956
- case 12:
86957
- _iteratorNormalCompletion1 = true;
86958
- return [
86959
- 3,
86960
- 10
86961
- ];
86962
- case 13:
86963
- return [
86964
- 3,
86965
- 16
86966
- ];
86967
- case 14:
86968
- err = _state.sent();
86969
- _didIteratorError1 = true;
86970
- _iteratorError1 = err;
86971
- return [
86972
- 3,
86973
- 16
86974
- ];
86975
- case 15:
86976
- try {
86977
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
86978
- _iterator1.return();
86979
- }
86980
- } finally {
86981
- if (_didIteratorError1) {
86982
- throw _iteratorError1;
86983
- }
86657
+ info.context = new PluginContext(SolutionSchemas[solution], inputData.locale);
86658
+ info.context.inputContext.prepare(inputData);
86659
+ info.module(info.context.context);
86660
+ }
86661
+ } catch (err) {
86662
+ _didIteratorError = true;
86663
+ _iteratorError = err;
86664
+ } finally {
86665
+ try {
86666
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86667
+ _iterator.return();
86984
86668
  }
86985
- return [
86986
- 7
86987
- ];
86988
- case 16:
86989
- if (_this.event) {
86990
- _this.event.emit("handle forged success");
86669
+ } finally {
86670
+ if (_didIteratorError) {
86671
+ throw _iteratorError;
86991
86672
  }
86992
- return [
86993
- 2
86994
- ];
86673
+ }
86995
86674
  }
86996
- });
86997
- })();
86675
+ return [
86676
+ 2
86677
+ ];
86678
+ }
86679
+ });
86680
+ })();
86681
+ };
86682
+ _proto.getGitMessage = function getGitMessage() {
86683
+ var result = "";
86684
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86685
+ try {
86686
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86687
+ var info = _step.value;
86688
+ var _info_context;
86689
+ if ((_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.gitAPI.gitMessage) {
86690
+ var _info_context1;
86691
+ result = ((_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.gitAPI.gitMessage) || "";
86692
+ }
86693
+ }
86694
+ } catch (err) {
86695
+ _didIteratorError = true;
86696
+ _iteratorError = err;
86697
+ } finally {
86698
+ try {
86699
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86700
+ _iterator.return();
86701
+ }
86702
+ } finally {
86703
+ if (_didIteratorError) {
86704
+ throw _iteratorError;
86705
+ }
86998
86706
  }
86999
86707
  }
87000
- ]);
86708
+ return result;
86709
+ };
86710
+ _proto.handleForged = function handleForged(solution, basePath, inputData, projectPath, generatorCore) {
86711
+ var _this = this;
86712
+ return _async_to_generator(function() {
86713
+ var generatorPlugin, restData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info, _info_context, _info_context1, onForgedFunc, err, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, info1, _info_context2, afterForged, err;
86714
+ return __generator(this, function(_state) {
86715
+ switch (_state.label) {
86716
+ case 0:
86717
+ _this.logger.info(i18n4.t(localeKeys4.run_plugin));
86718
+ generatorPlugin = inputData.generatorPlugin, restData = _object_without_properties(inputData, [
86719
+ "generatorPlugin"
86720
+ ]);
86721
+ if (solution !== restData.solution) {
86722
+ if (_this.event) {
86723
+ _this.event.emit("handle forged success");
86724
+ }
86725
+ return [
86726
+ 2
86727
+ ];
86728
+ }
86729
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86730
+ _state.label = 1;
86731
+ case 1:
86732
+ _state.trys.push([
86733
+ 1,
86734
+ 6,
86735
+ 7,
86736
+ 8
86737
+ ]);
86738
+ _iterator = _this.plugins[Symbol.iterator]();
86739
+ _state.label = 2;
86740
+ case 2:
86741
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
86742
+ return [
86743
+ 3,
86744
+ 5
86745
+ ];
86746
+ info = _step.value;
86747
+ (_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.handlePrepareContext(generatorCore, solution, import_path18.default.join(basePath, projectPath), import_path18.default.join(info.templatePath, "templates"), restData);
86748
+ onForgedFunc = (_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.lifeCycleFuncMap[LifeCycle2.OnForged];
86749
+ if (!(onForgedFunc && (0, import_lodash14.isFunction)(onForgedFunc)))
86750
+ return [
86751
+ 3,
86752
+ 4
86753
+ ];
86754
+ return [
86755
+ 4,
86756
+ onForgedFunc(info.context.forgedAPI, restData)
86757
+ ];
86758
+ case 3:
86759
+ _state.sent();
86760
+ _state.label = 4;
86761
+ case 4:
86762
+ _iteratorNormalCompletion = true;
86763
+ return [
86764
+ 3,
86765
+ 2
86766
+ ];
86767
+ case 5:
86768
+ return [
86769
+ 3,
86770
+ 8
86771
+ ];
86772
+ case 6:
86773
+ err = _state.sent();
86774
+ _didIteratorError = true;
86775
+ _iteratorError = err;
86776
+ return [
86777
+ 3,
86778
+ 8
86779
+ ];
86780
+ case 7:
86781
+ try {
86782
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86783
+ _iterator.return();
86784
+ }
86785
+ } finally {
86786
+ if (_didIteratorError) {
86787
+ throw _iteratorError;
86788
+ }
86789
+ }
86790
+ return [
86791
+ 7
86792
+ ];
86793
+ case 8:
86794
+ _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
86795
+ _state.label = 9;
86796
+ case 9:
86797
+ _state.trys.push([
86798
+ 9,
86799
+ 14,
86800
+ 15,
86801
+ 16
86802
+ ]);
86803
+ _iterator1 = _this.plugins[Symbol.iterator]();
86804
+ _state.label = 10;
86805
+ case 10:
86806
+ if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done))
86807
+ return [
86808
+ 3,
86809
+ 13
86810
+ ];
86811
+ info1 = _step1.value;
86812
+ afterForged = (_info_context2 = info1.context) === null || _info_context2 === void 0 ? void 0 : _info_context2.lifeCycleFuncMap[LifeCycle2.AfterForged];
86813
+ if (!(afterForged && (0, import_lodash14.isFunction)(afterForged)))
86814
+ return [
86815
+ 3,
86816
+ 12
86817
+ ];
86818
+ return [
86819
+ 4,
86820
+ afterForged(info1.context.afterForgedAPI, restData)
86821
+ ];
86822
+ case 11:
86823
+ _state.sent();
86824
+ _state.label = 12;
86825
+ case 12:
86826
+ _iteratorNormalCompletion1 = true;
86827
+ return [
86828
+ 3,
86829
+ 10
86830
+ ];
86831
+ case 13:
86832
+ return [
86833
+ 3,
86834
+ 16
86835
+ ];
86836
+ case 14:
86837
+ err = _state.sent();
86838
+ _didIteratorError1 = true;
86839
+ _iteratorError1 = err;
86840
+ return [
86841
+ 3,
86842
+ 16
86843
+ ];
86844
+ case 15:
86845
+ try {
86846
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
86847
+ _iterator1.return();
86848
+ }
86849
+ } finally {
86850
+ if (_didIteratorError1) {
86851
+ throw _iteratorError1;
86852
+ }
86853
+ }
86854
+ return [
86855
+ 7
86856
+ ];
86857
+ case 16:
86858
+ if (_this.event) {
86859
+ _this.event.emit("handle forged success");
86860
+ }
86861
+ return [
86862
+ 2
86863
+ ];
86864
+ }
86865
+ });
86866
+ })();
86867
+ };
87001
86868
  return GeneratorPlugin2;
87002
86869
  }();
87003
86870
 
87004
86871
  // src/index.ts
87005
- var getGeneratorPath2 = (generator, distTag) => {
87006
- if (process.env.CODESMITH_ENV === "development") {
87007
- return import_path18.default.dirname(require.resolve(generator));
87008
- } else if (distTag) {
87009
- return `${generator}@${distTag}`;
87010
- }
87011
- return generator;
87012
- };
87013
86872
  var mergeDefaultConfig = (context) => {
87014
86873
  const { defaultSolution } = context.config;
87015
86874
  if (defaultSolution) {
@@ -87050,7 +86909,7 @@ var handleTemplateFile = async (context, generator, appApi, generatorPlugin) =>
87050
86909
  generator.logger.error("solution is not valid ");
87051
86910
  }
87052
86911
  await appApi.runSubGenerator(
87053
- getGeneratorPath2(solutionGenerator, context.config.distTag),
86912
+ getGeneratorPath(solutionGenerator, context.config.distTag, [__dirname]),
87054
86913
  void 0,
87055
86914
  {
87056
86915
  ...isMonorepo ? MonorepoNewActionConfig[solution] || {} : {},