@modern-js/repo-generator 0.0.0-nightly-20240228170648 → 0.0.0-nightly-20240229170649

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1162 -1303
  2. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -83378,15 +83378,6 @@ var AppAPI = class {
83378
83378
  }
83379
83379
  };
83380
83380
 
83381
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_define_property.js
83382
- function _define_property2(obj, key, value) {
83383
- if (key in obj) {
83384
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
83385
- } else
83386
- obj[key] = value;
83387
- return obj;
83388
- }
83389
-
83390
83381
  // ../../../cli/plugin-i18n/dist/esm-node/index.js
83391
83382
  var import_lodash8 = require("@modern-js/utils/lodash");
83392
83383
 
@@ -83445,8 +83436,8 @@ var I18n2 = class {
83445
83436
  };
83446
83437
  }
83447
83438
  constructor() {
83448
- _define_property2(this, "language", "en");
83449
- _define_property2(this, "languageMap", {});
83439
+ this.language = "en";
83440
+ this.languageMap = {};
83450
83441
  }
83451
83442
  };
83452
83443
 
@@ -84590,23 +84581,13 @@ function _class_call_check(instance, Constructor) {
84590
84581
  throw new TypeError("Cannot call a class as a function");
84591
84582
  }
84592
84583
 
84593
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_create_class.js
84594
- function _defineProperties(target, props) {
84595
- for (var i = 0; i < props.length; i++) {
84596
- var descriptor = props[i];
84597
- descriptor.enumerable = descriptor.enumerable || false;
84598
- descriptor.configurable = true;
84599
- if ("value" in descriptor)
84600
- descriptor.writable = true;
84601
- Object.defineProperty(target, descriptor.key, descriptor);
84602
- }
84603
- }
84604
- function _create_class(Constructor, protoProps, staticProps) {
84605
- if (protoProps)
84606
- _defineProperties(Constructor.prototype, protoProps);
84607
- if (staticProps)
84608
- _defineProperties(Constructor, staticProps);
84609
- return Constructor;
84584
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_define_property.js
84585
+ function _define_property2(obj, key, value) {
84586
+ if (key in obj) {
84587
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
84588
+ } else
84589
+ obj[key] = value;
84590
+ return obj;
84610
84591
  }
84611
84592
 
84612
84593
  // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread.js
@@ -84741,6 +84722,25 @@ function _to_consumable_array(arr) {
84741
84722
  var import_path18 = __toESM(require("path"));
84742
84723
  var import_lodash14 = require("@modern-js/utils/lodash");
84743
84724
 
84725
+ // ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_create_class.js
84726
+ function _defineProperties(target, props) {
84727
+ for (var i = 0; i < props.length; i++) {
84728
+ var descriptor = props[i];
84729
+ descriptor.enumerable = descriptor.enumerable || false;
84730
+ descriptor.configurable = true;
84731
+ if ("value" in descriptor)
84732
+ descriptor.writable = true;
84733
+ Object.defineProperty(target, descriptor.key, descriptor);
84734
+ }
84735
+ }
84736
+ function _create_class(Constructor, protoProps, staticProps) {
84737
+ if (protoProps)
84738
+ _defineProperties(Constructor.prototype, protoProps);
84739
+ if (staticProps)
84740
+ _defineProperties(Constructor, staticProps);
84741
+ return Constructor;
84742
+ }
84743
+
84744
84744
  // ../../generator-plugin/dist/esm/context/file.js
84745
84745
  var import_path14 = __toESM(require("path"));
84746
84746
 
@@ -85063,36 +85063,28 @@ var PluginHandlebarsAPI = /* @__PURE__ */ function() {
85063
85063
  "use strict";
85064
85064
  function PluginHandlebarsAPI2() {
85065
85065
  _class_call_check(this, PluginHandlebarsAPI2);
85066
- _define_property2(this, "helpers", {});
85067
- _define_property2(this, "partials", {});
85068
- }
85066
+ this.helpers = {};
85067
+ this.partials = {};
85068
+ }
85069
+ var _proto = PluginHandlebarsAPI2.prototype;
85070
+ _proto.renderString = function renderString3(template, data) {
85071
+ var helpers = _object_spread({}, this.helpers);
85072
+ var partials = _object_spread({}, this.partials);
85073
+ Object.keys(helpers).forEach(function(h) {
85074
+ return handlebars2.registerHelper(h, helpers[h]);
85075
+ });
85076
+ Object.keys(partials).forEach(function(p) {
85077
+ return handlebars2.registerPartial(p, partials[p]);
85078
+ });
85079
+ return handlebars2.compile(template)(data) || "";
85080
+ };
85081
+ _proto.addHelper = function addHelper(name, fn) {
85082
+ this.helpers[name] = fn;
85083
+ };
85084
+ _proto.addPartial = function addPartial(name, str) {
85085
+ this.partials[name] = str;
85086
+ };
85069
85087
  _create_class(PluginHandlebarsAPI2, [
85070
- {
85071
- key: "renderString",
85072
- value: function renderString3(template, data) {
85073
- var helpers = _object_spread({}, this.helpers);
85074
- var partials = _object_spread({}, this.partials);
85075
- Object.keys(helpers).forEach(function(h) {
85076
- return handlebars2.registerHelper(h, helpers[h]);
85077
- });
85078
- Object.keys(partials).forEach(function(p) {
85079
- return handlebars2.registerPartial(p, partials[p]);
85080
- });
85081
- return handlebars2.compile(template)(data) || "";
85082
- }
85083
- },
85084
- {
85085
- key: "addHelper",
85086
- value: function addHelper(name, fn) {
85087
- this.helpers[name] = fn;
85088
- }
85089
- },
85090
- {
85091
- key: "addPartial",
85092
- value: function addPartial(name, str) {
85093
- this.partials[name] = str;
85094
- }
85095
- },
85096
85088
  {
85097
85089
  key: "method",
85098
85090
  get: function get4() {
@@ -85113,14 +85105,10 @@ var PluginEjsAPI = /* @__PURE__ */ function() {
85113
85105
  function PluginEjsAPI2() {
85114
85106
  _class_call_check(this, PluginEjsAPI2);
85115
85107
  }
85116
- _create_class(PluginEjsAPI2, [
85117
- {
85118
- key: "renderString",
85119
- value: function renderString3(template, data) {
85120
- return import_ejs2.default.render(template, data) || "";
85121
- }
85122
- }
85123
- ]);
85108
+ var _proto = PluginEjsAPI2.prototype;
85109
+ _proto.renderString = function renderString3(template, data) {
85110
+ return import_ejs2.default.render(template, data) || "";
85111
+ };
85124
85112
  return PluginEjsAPI2;
85125
85113
  }();
85126
85114
 
@@ -85136,13 +85124,250 @@ var PluginFileAPI = /* @__PURE__ */ function() {
85136
85124
  "use strict";
85137
85125
  function PluginFileAPI2() {
85138
85126
  _class_call_check(this, PluginFileAPI2);
85139
- _define_property2(this, "projectPath", "");
85140
- _define_property2(this, "templatePath", "");
85141
- _define_property2(this, "handlebarAPI", new PluginHandlebarsAPI());
85142
- _define_property2(this, "ejsAPI", new PluginEjsAPI());
85143
- _define_property2(this, "jsonAPI", void 0);
85127
+ this.projectPath = "";
85128
+ this.templatePath = "";
85129
+ this.handlebarAPI = new PluginHandlebarsAPI();
85130
+ this.ejsAPI = new PluginEjsAPI();
85144
85131
  this.renderString = this.renderString.bind(this);
85145
85132
  }
85133
+ var _proto = PluginFileAPI2.prototype;
85134
+ _proto.renderString = function renderString3() {
85135
+ 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";
85136
+ if (type === "ejs") {
85137
+ return this.ejsAPI.renderString(template, data);
85138
+ }
85139
+ return this.handlebarAPI.renderString(template, data);
85140
+ };
85141
+ _proto.prepare = function prepare(generator, projectPath, templatePath) {
85142
+ this.projectPath = projectPath;
85143
+ this.jsonAPI = new JsonAPI(generator);
85144
+ this.templatePath = templatePath;
85145
+ };
85146
+ _proto.addFile = function addFile1(params) {
85147
+ var _this = this;
85148
+ return _async_to_generator(function() {
85149
+ return __generator(this, function(_state) {
85150
+ switch (_state.label) {
85151
+ case 0:
85152
+ return [
85153
+ 4,
85154
+ addFile(params, _this.projectPath, _this.templatePath, _this.renderString)
85155
+ ];
85156
+ case 1:
85157
+ _state.sent();
85158
+ return [
85159
+ 2
85160
+ ];
85161
+ }
85162
+ });
85163
+ })();
85164
+ };
85165
+ _proto.addManyFiles = function addManyFiles1(params) {
85166
+ var _this = this;
85167
+ return _async_to_generator(function() {
85168
+ return __generator(this, function(_state) {
85169
+ switch (_state.label) {
85170
+ case 0:
85171
+ return [
85172
+ 4,
85173
+ addManyFiles(params, _this.projectPath, _this.templatePath, _this.renderString)
85174
+ ];
85175
+ case 1:
85176
+ _state.sent();
85177
+ return [
85178
+ 2
85179
+ ];
85180
+ }
85181
+ });
85182
+ })();
85183
+ };
85184
+ _proto.updateJSONFile = function updateJSONFile(fileName, updateInfo) {
85185
+ var _this = this;
85186
+ return _async_to_generator(function() {
85187
+ var fsMaterial;
85188
+ return __generator(this, function(_state) {
85189
+ switch (_state.label) {
85190
+ case 0:
85191
+ fsMaterial = new FsMaterial(_this.projectPath);
85192
+ return [
85193
+ 4,
85194
+ _this.jsonAPI.update(fsMaterial.get(fileName), {
85195
+ query: {},
85196
+ update: {
85197
+ $set: _object_spread({}, updateInfo)
85198
+ }
85199
+ })
85200
+ ];
85201
+ case 1:
85202
+ _state.sent();
85203
+ return [
85204
+ 2
85205
+ ];
85206
+ }
85207
+ });
85208
+ })();
85209
+ };
85210
+ _proto.updateModernConfig = function updateModernConfig(updateInfo) {
85211
+ var _this = this;
85212
+ return _async_to_generator(function() {
85213
+ var update;
85214
+ return __generator(this, function(_state) {
85215
+ switch (_state.label) {
85216
+ case 0:
85217
+ update = {};
85218
+ Object.keys(updateInfo).forEach(function(key) {
85219
+ update["modernConfig.".concat(key)] = updateInfo[key];
85220
+ });
85221
+ return [
85222
+ 4,
85223
+ _this.updateJSONFile("package.json", update)
85224
+ ];
85225
+ case 1:
85226
+ _state.sent();
85227
+ return [
85228
+ 2
85229
+ ];
85230
+ }
85231
+ });
85232
+ })();
85233
+ };
85234
+ _proto.updateTextRawFile = function updateTextRawFile(fileName, update) {
85235
+ var _this = this;
85236
+ return _async_to_generator(function() {
85237
+ var content, newContent;
85238
+ return __generator(this, function(_state) {
85239
+ switch (_state.label) {
85240
+ case 0:
85241
+ return [
85242
+ 4,
85243
+ import_utils50.fs.readFile(import_path14.default.join(_this.projectPath, fileName), "utf-8")
85244
+ ];
85245
+ case 1:
85246
+ content = _state.sent();
85247
+ newContent = update(content.split("\n"));
85248
+ return [
85249
+ 4,
85250
+ import_utils50.fs.writeFile(import_path14.default.join(_this.projectPath, fileName), newContent.join("\n"), "utf-8")
85251
+ ];
85252
+ case 2:
85253
+ _state.sent();
85254
+ return [
85255
+ 2
85256
+ ];
85257
+ }
85258
+ });
85259
+ })();
85260
+ };
85261
+ _proto.rmFile = function rmFile(fileName) {
85262
+ var _this = this;
85263
+ return _async_to_generator(function() {
85264
+ var file;
85265
+ return __generator(this, function(_state) {
85266
+ switch (_state.label) {
85267
+ case 0:
85268
+ file = import_path14.default.join(_this.projectPath, fileName);
85269
+ return [
85270
+ 4,
85271
+ fileExists(file)
85272
+ ];
85273
+ case 1:
85274
+ if (!_state.sent())
85275
+ return [
85276
+ 3,
85277
+ 3
85278
+ ];
85279
+ return [
85280
+ 4,
85281
+ import_utils50.fs.rm(file)
85282
+ ];
85283
+ case 2:
85284
+ _state.sent();
85285
+ _state.label = 3;
85286
+ case 3:
85287
+ return [
85288
+ 2
85289
+ ];
85290
+ }
85291
+ });
85292
+ })();
85293
+ };
85294
+ _proto.rmDir = function rmDir(dirName) {
85295
+ var _this = this;
85296
+ return _async_to_generator(function() {
85297
+ var dir, stat, e;
85298
+ return __generator(this, function(_state) {
85299
+ switch (_state.label) {
85300
+ case 0:
85301
+ dir = import_path14.default.join(_this.projectPath, dirName);
85302
+ _state.label = 1;
85303
+ case 1:
85304
+ _state.trys.push([
85305
+ 1,
85306
+ 5,
85307
+ ,
85308
+ 6
85309
+ ]);
85310
+ return [
85311
+ 4,
85312
+ import_utils50.fs.stat(dir)
85313
+ ];
85314
+ case 2:
85315
+ stat = _state.sent();
85316
+ if (!stat.isDirectory())
85317
+ return [
85318
+ 3,
85319
+ 4
85320
+ ];
85321
+ return [
85322
+ 4,
85323
+ import_utils50.fs.rm(dir, {
85324
+ recursive: true
85325
+ })
85326
+ ];
85327
+ case 3:
85328
+ _state.sent();
85329
+ _state.label = 4;
85330
+ case 4:
85331
+ return [
85332
+ 3,
85333
+ 6
85334
+ ];
85335
+ case 5:
85336
+ e = _state.sent();
85337
+ return [
85338
+ 3,
85339
+ 6
85340
+ ];
85341
+ case 6:
85342
+ return [
85343
+ 2
85344
+ ];
85345
+ }
85346
+ });
85347
+ })();
85348
+ };
85349
+ _proto.isFileExist = function isFileExist(fileName) {
85350
+ var _this = this;
85351
+ return _async_to_generator(function() {
85352
+ return __generator(this, function(_state) {
85353
+ return [
85354
+ 2,
85355
+ fileExists(import_path14.default.join(_this.projectPath, fileName))
85356
+ ];
85357
+ });
85358
+ })();
85359
+ };
85360
+ _proto.readDir = function readDir(dir) {
85361
+ var _this = this;
85362
+ return _async_to_generator(function() {
85363
+ return __generator(this, function(_state) {
85364
+ return [
85365
+ 2,
85366
+ import_utils50.fs.readdir(import_path14.default.join(_this.projectPath, dir))
85367
+ ];
85368
+ });
85369
+ })();
85370
+ };
85146
85371
  _create_class(PluginFileAPI2, [
85147
85372
  {
85148
85373
  key: "context",
@@ -85168,297 +85393,83 @@ var PluginFileAPI = /* @__PURE__ */ function() {
85168
85393
  addPartial: this.handlebarAPI.addPartial.bind(this.handlebarAPI)
85169
85394
  };
85170
85395
  }
85171
- },
85172
- {
85173
- key: "renderString",
85174
- value: function renderString3() {
85175
- 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";
85176
- if (type === "ejs") {
85177
- return this.ejsAPI.renderString(template, data);
85396
+ }
85397
+ ]);
85398
+ return PluginFileAPI2;
85399
+ }();
85400
+
85401
+ // ../../generator-plugin/dist/esm/context/git.js
85402
+ var PluginGitAPI = /* @__PURE__ */ function() {
85403
+ "use strict";
85404
+ function PluginGitAPI2() {
85405
+ _class_call_check(this, PluginGitAPI2);
85406
+ this.gitMessage = "";
85407
+ }
85408
+ var _proto = PluginGitAPI2.prototype;
85409
+ _proto.setGitMessage = function setGitMessage(gitMessage) {
85410
+ this.gitMessage = gitMessage;
85411
+ };
85412
+ _proto.prepare = function prepare(generator, projectPath) {
85413
+ this.gitApi = new GitAPI(generator);
85414
+ this.projectPath = projectPath;
85415
+ };
85416
+ _proto.isInGitRepo = function isInGitRepo2() {
85417
+ var _this = this;
85418
+ return _async_to_generator(function() {
85419
+ return __generator(this, function(_state) {
85420
+ return [
85421
+ 2,
85422
+ _this.gitApi.isInGitRepo(_this.projectPath)
85423
+ ];
85424
+ });
85425
+ })();
85426
+ };
85427
+ _proto.initGitRepo = function initGitRepo2() {
85428
+ var _this = this;
85429
+ return _async_to_generator(function() {
85430
+ return __generator(this, function(_state) {
85431
+ switch (_state.label) {
85432
+ case 0:
85433
+ return [
85434
+ 4,
85435
+ _this.gitApi.initGitRepo(_this.projectPath)
85436
+ ];
85437
+ case 1:
85438
+ _state.sent();
85439
+ return [
85440
+ 2
85441
+ ];
85178
85442
  }
85179
- return this.handlebarAPI.renderString(template, data);
85180
- }
85181
- },
85443
+ });
85444
+ })();
85445
+ };
85446
+ _proto.gitAddAndCommit = function gitAddAndCommit() {
85447
+ var commitMessage = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "feat: init";
85448
+ var _this = this;
85449
+ return _async_to_generator(function() {
85450
+ return __generator(this, function(_state) {
85451
+ switch (_state.label) {
85452
+ case 0:
85453
+ return [
85454
+ 4,
85455
+ _this.gitApi.addAndCommit(commitMessage, _this.projectPath)
85456
+ ];
85457
+ case 1:
85458
+ _state.sent();
85459
+ return [
85460
+ 2
85461
+ ];
85462
+ }
85463
+ });
85464
+ })();
85465
+ };
85466
+ _create_class(PluginGitAPI2, [
85182
85467
  {
85183
- key: "prepare",
85184
- value: function prepare(generator, projectPath, templatePath) {
85185
- this.projectPath = projectPath;
85186
- this.jsonAPI = new JsonAPI(generator);
85187
- this.templatePath = templatePath;
85188
- }
85189
- },
85190
- {
85191
- key: "addFile",
85192
- value: function addFile1(params) {
85193
- var _this = this;
85194
- return _async_to_generator(function() {
85195
- return __generator(this, function(_state) {
85196
- switch (_state.label) {
85197
- case 0:
85198
- return [
85199
- 4,
85200
- addFile(params, _this.projectPath, _this.templatePath, _this.renderString)
85201
- ];
85202
- case 1:
85203
- _state.sent();
85204
- return [
85205
- 2
85206
- ];
85207
- }
85208
- });
85209
- })();
85210
- }
85211
- },
85212
- {
85213
- key: "addManyFiles",
85214
- value: function addManyFiles1(params) {
85215
- var _this = this;
85216
- return _async_to_generator(function() {
85217
- return __generator(this, function(_state) {
85218
- switch (_state.label) {
85219
- case 0:
85220
- return [
85221
- 4,
85222
- addManyFiles(params, _this.projectPath, _this.templatePath, _this.renderString)
85223
- ];
85224
- case 1:
85225
- _state.sent();
85226
- return [
85227
- 2
85228
- ];
85229
- }
85230
- });
85231
- })();
85232
- }
85233
- },
85234
- {
85235
- key: "updateJSONFile",
85236
- value: function updateJSONFile(fileName, updateInfo) {
85237
- var _this = this;
85238
- return _async_to_generator(function() {
85239
- var fsMaterial;
85240
- return __generator(this, function(_state) {
85241
- switch (_state.label) {
85242
- case 0:
85243
- fsMaterial = new FsMaterial(_this.projectPath);
85244
- return [
85245
- 4,
85246
- _this.jsonAPI.update(fsMaterial.get(fileName), {
85247
- query: {},
85248
- update: {
85249
- $set: _object_spread({}, updateInfo)
85250
- }
85251
- })
85252
- ];
85253
- case 1:
85254
- _state.sent();
85255
- return [
85256
- 2
85257
- ];
85258
- }
85259
- });
85260
- })();
85261
- }
85262
- },
85263
- {
85264
- key: "updateModernConfig",
85265
- value: function updateModernConfig(updateInfo) {
85266
- var _this = this;
85267
- return _async_to_generator(function() {
85268
- var update;
85269
- return __generator(this, function(_state) {
85270
- switch (_state.label) {
85271
- case 0:
85272
- update = {};
85273
- Object.keys(updateInfo).forEach(function(key) {
85274
- update["modernConfig.".concat(key)] = updateInfo[key];
85275
- });
85276
- return [
85277
- 4,
85278
- _this.updateJSONFile("package.json", update)
85279
- ];
85280
- case 1:
85281
- _state.sent();
85282
- return [
85283
- 2
85284
- ];
85285
- }
85286
- });
85287
- })();
85288
- }
85289
- },
85290
- {
85291
- key: "updateTextRawFile",
85292
- value: function updateTextRawFile(fileName, update) {
85293
- var _this = this;
85294
- return _async_to_generator(function() {
85295
- var content, newContent;
85296
- return __generator(this, function(_state) {
85297
- switch (_state.label) {
85298
- case 0:
85299
- return [
85300
- 4,
85301
- import_utils50.fs.readFile(import_path14.default.join(_this.projectPath, fileName), "utf-8")
85302
- ];
85303
- case 1:
85304
- content = _state.sent();
85305
- newContent = update(content.split("\n"));
85306
- return [
85307
- 4,
85308
- import_utils50.fs.writeFile(import_path14.default.join(_this.projectPath, fileName), newContent.join("\n"), "utf-8")
85309
- ];
85310
- case 2:
85311
- _state.sent();
85312
- return [
85313
- 2
85314
- ];
85315
- }
85316
- });
85317
- })();
85318
- }
85319
- },
85320
- {
85321
- key: "rmFile",
85322
- value: function rmFile(fileName) {
85323
- var _this = this;
85324
- return _async_to_generator(function() {
85325
- var file;
85326
- return __generator(this, function(_state) {
85327
- switch (_state.label) {
85328
- case 0:
85329
- file = import_path14.default.join(_this.projectPath, fileName);
85330
- return [
85331
- 4,
85332
- fileExists(file)
85333
- ];
85334
- case 1:
85335
- if (!_state.sent())
85336
- return [
85337
- 3,
85338
- 3
85339
- ];
85340
- return [
85341
- 4,
85342
- import_utils50.fs.rm(file)
85343
- ];
85344
- case 2:
85345
- _state.sent();
85346
- _state.label = 3;
85347
- case 3:
85348
- return [
85349
- 2
85350
- ];
85351
- }
85352
- });
85353
- })();
85354
- }
85355
- },
85356
- {
85357
- key: "rmDir",
85358
- value: function rmDir(dirName) {
85359
- var _this = this;
85360
- return _async_to_generator(function() {
85361
- var dir, stat, e;
85362
- return __generator(this, function(_state) {
85363
- switch (_state.label) {
85364
- case 0:
85365
- dir = import_path14.default.join(_this.projectPath, dirName);
85366
- _state.label = 1;
85367
- case 1:
85368
- _state.trys.push([
85369
- 1,
85370
- 5,
85371
- ,
85372
- 6
85373
- ]);
85374
- return [
85375
- 4,
85376
- import_utils50.fs.stat(dir)
85377
- ];
85378
- case 2:
85379
- stat = _state.sent();
85380
- if (!stat.isDirectory())
85381
- return [
85382
- 3,
85383
- 4
85384
- ];
85385
- return [
85386
- 4,
85387
- import_utils50.fs.rm(dir, {
85388
- recursive: true
85389
- })
85390
- ];
85391
- case 3:
85392
- _state.sent();
85393
- _state.label = 4;
85394
- case 4:
85395
- return [
85396
- 3,
85397
- 6
85398
- ];
85399
- case 5:
85400
- e = _state.sent();
85401
- return [
85402
- 3,
85403
- 6
85404
- ];
85405
- case 6:
85406
- return [
85407
- 2
85408
- ];
85409
- }
85410
- });
85411
- })();
85412
- }
85413
- },
85414
- {
85415
- key: "isFileExist",
85416
- value: function isFileExist(fileName) {
85417
- var _this = this;
85418
- return _async_to_generator(function() {
85419
- return __generator(this, function(_state) {
85420
- return [
85421
- 2,
85422
- fileExists(import_path14.default.join(_this.projectPath, fileName))
85423
- ];
85424
- });
85425
- })();
85426
- }
85427
- },
85428
- {
85429
- key: "readDir",
85430
- value: function readDir(dir) {
85431
- var _this = this;
85432
- return _async_to_generator(function() {
85433
- return __generator(this, function(_state) {
85434
- return [
85435
- 2,
85436
- import_utils50.fs.readdir(import_path14.default.join(_this.projectPath, dir))
85437
- ];
85438
- });
85439
- })();
85440
- }
85441
- }
85442
- ]);
85443
- return PluginFileAPI2;
85444
- }();
85445
-
85446
- // ../../generator-plugin/dist/esm/context/git.js
85447
- var PluginGitAPI = /* @__PURE__ */ function() {
85448
- "use strict";
85449
- function PluginGitAPI2() {
85450
- _class_call_check(this, PluginGitAPI2);
85451
- _define_property2(this, "gitMessage", "");
85452
- _define_property2(this, "gitApi", void 0);
85453
- _define_property2(this, "projectPath", void 0);
85454
- }
85455
- _create_class(PluginGitAPI2, [
85456
- {
85457
- key: "context",
85458
- get: function get4() {
85459
- return {
85460
- setGitMessage: this.setGitMessage.bind(this)
85461
- };
85468
+ key: "context",
85469
+ get: function get4() {
85470
+ return {
85471
+ setGitMessage: this.setGitMessage.bind(this)
85472
+ };
85462
85473
  }
85463
85474
  },
85464
85475
  {
@@ -85470,78 +85481,6 @@ var PluginGitAPI = /* @__PURE__ */ function() {
85470
85481
  gitAddAndCommit: this.gitAddAndCommit.bind(this)
85471
85482
  };
85472
85483
  }
85473
- },
85474
- {
85475
- key: "setGitMessage",
85476
- value: function setGitMessage(gitMessage) {
85477
- this.gitMessage = gitMessage;
85478
- }
85479
- },
85480
- {
85481
- key: "prepare",
85482
- value: function prepare(generator, projectPath) {
85483
- this.gitApi = new GitAPI(generator);
85484
- this.projectPath = projectPath;
85485
- }
85486
- },
85487
- {
85488
- key: "isInGitRepo",
85489
- value: function isInGitRepo2() {
85490
- var _this = this;
85491
- return _async_to_generator(function() {
85492
- return __generator(this, function(_state) {
85493
- return [
85494
- 2,
85495
- _this.gitApi.isInGitRepo(_this.projectPath)
85496
- ];
85497
- });
85498
- })();
85499
- }
85500
- },
85501
- {
85502
- key: "initGitRepo",
85503
- value: function initGitRepo2() {
85504
- var _this = this;
85505
- return _async_to_generator(function() {
85506
- return __generator(this, function(_state) {
85507
- switch (_state.label) {
85508
- case 0:
85509
- return [
85510
- 4,
85511
- _this.gitApi.initGitRepo(_this.projectPath)
85512
- ];
85513
- case 1:
85514
- _state.sent();
85515
- return [
85516
- 2
85517
- ];
85518
- }
85519
- });
85520
- })();
85521
- }
85522
- },
85523
- {
85524
- key: "gitAddAndCommit",
85525
- value: function gitAddAndCommit() {
85526
- var commitMessage = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "feat: init";
85527
- var _this = this;
85528
- return _async_to_generator(function() {
85529
- return __generator(this, function(_state) {
85530
- switch (_state.label) {
85531
- case 0:
85532
- return [
85533
- 4,
85534
- _this.gitApi.addAndCommit(commitMessage, _this.projectPath)
85535
- ];
85536
- case 1:
85537
- _state.sent();
85538
- return [
85539
- 2
85540
- ];
85541
- }
85542
- });
85543
- })();
85544
- }
85545
85484
  }
85546
85485
  ]);
85547
85486
  return PluginGitAPI2;
@@ -85553,20 +85492,163 @@ var PluginInputContext = /* @__PURE__ */ function() {
85553
85492
  "use strict";
85554
85493
  function PluginInputContext2(solutionSchema) {
85555
85494
  _class_call_check(this, PluginInputContext2);
85556
- _define_property2(this, "inputValue", {});
85557
- _define_property2(this, "defaultConfig", {});
85558
- _define_property2(this, "solutionSchemaFunc", void 0);
85559
- _define_property2(this, "solutionSchema", {});
85560
- _define_property2(this, "extendInputMap", {});
85495
+ this.inputValue = {};
85496
+ this.defaultConfig = {};
85497
+ this.solutionSchema = {};
85498
+ this.extendInputMap = {};
85561
85499
  this.solutionSchemaFunc = solutionSchema;
85562
85500
  }
85563
- _create_class(PluginInputContext2, [
85564
- {
85565
- key: "prepare",
85566
- value: function prepare(inputData) {
85567
- this.solutionSchema = this.solutionSchemaFunc(inputData).properties;
85501
+ var _proto = PluginInputContext2.prototype;
85502
+ _proto.prepare = function prepare(inputData) {
85503
+ this.solutionSchema = this.solutionSchemaFunc(inputData).properties;
85504
+ };
85505
+ _proto.validateInputKey = function validateInputKey(inputKey) {
85506
+ if (!this.solutionSchema[inputKey]) {
85507
+ throw new Error("the input key ".concat(inputKey, " not found"));
85508
+ }
85509
+ };
85510
+ _proto.validateInput = function validateInput(inputKey) {
85511
+ var _this = this;
85512
+ if (this.solutionSchema[inputKey]) {
85513
+ throw new Error("the input key ".concat(inputKey, " already exists"));
85514
+ }
85515
+ Object.keys(this.extendInputMap).forEach(function(key) {
85516
+ if (_this.extendInputMap[key].before[inputKey] || _this.extendInputMap[key].after[inputKey]) {
85517
+ throw new Error("the input key ".concat(inputKey, " is already added"));
85568
85518
  }
85569
- },
85519
+ });
85520
+ };
85521
+ _proto.addInputBefore = function addInputBefore(key, input) {
85522
+ this.validateInputKey(key);
85523
+ var properties = input.properties || {};
85524
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85525
+ try {
85526
+ for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85527
+ var inputKey = _step.value;
85528
+ this.validateInput(inputKey);
85529
+ if (this.extendInputMap[key]) {
85530
+ this.extendInputMap[key].before[inputKey] = properties[inputKey];
85531
+ } else {
85532
+ this.extendInputMap[key] = {
85533
+ before: _define_property2({}, inputKey, properties[inputKey]),
85534
+ after: {}
85535
+ };
85536
+ }
85537
+ }
85538
+ } catch (err) {
85539
+ _didIteratorError = true;
85540
+ _iteratorError = err;
85541
+ } finally {
85542
+ try {
85543
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85544
+ _iterator.return();
85545
+ }
85546
+ } finally {
85547
+ if (_didIteratorError) {
85548
+ throw _iteratorError;
85549
+ }
85550
+ }
85551
+ }
85552
+ };
85553
+ _proto.addInputAfter = function addInputAfter(key, input) {
85554
+ this.validateInputKey(key);
85555
+ var properties = input.properties || {};
85556
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85557
+ try {
85558
+ for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85559
+ var inputKey = _step.value;
85560
+ this.validateInput(inputKey);
85561
+ if (this.extendInputMap[key]) {
85562
+ this.extendInputMap[key].after[inputKey] = properties[inputKey];
85563
+ } else {
85564
+ this.extendInputMap[key] = {
85565
+ before: {},
85566
+ after: _define_property2({}, inputKey, properties[inputKey])
85567
+ };
85568
+ }
85569
+ }
85570
+ } catch (err) {
85571
+ _didIteratorError = true;
85572
+ _iteratorError = err;
85573
+ } finally {
85574
+ try {
85575
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85576
+ _iterator.return();
85577
+ }
85578
+ } finally {
85579
+ if (_didIteratorError) {
85580
+ throw _iteratorError;
85581
+ }
85582
+ }
85583
+ }
85584
+ };
85585
+ _proto.setInput = function setInput(key, field, value) {
85586
+ var schema = this.solutionSchema[key];
85587
+ if (schema) {
85588
+ schema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85589
+ return;
85590
+ }
85591
+ var findFlag = false;
85592
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85593
+ try {
85594
+ for (var _iterator = Object.keys(this.extendInputMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85595
+ var inputKey = _step.value;
85596
+ var beforeSchema = this.extendInputMap[inputKey].before[key];
85597
+ if (beforeSchema) {
85598
+ findFlag = true;
85599
+ beforeSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85600
+ break;
85601
+ }
85602
+ var afterSchema = this.extendInputMap[inputKey].after[key];
85603
+ if (afterSchema) {
85604
+ findFlag = true;
85605
+ afterSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85606
+ break;
85607
+ }
85608
+ }
85609
+ } catch (err) {
85610
+ _didIteratorError = true;
85611
+ _iteratorError = err;
85612
+ } finally {
85613
+ try {
85614
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
85615
+ _iterator.return();
85616
+ }
85617
+ } finally {
85618
+ if (_didIteratorError) {
85619
+ throw _iteratorError;
85620
+ }
85621
+ }
85622
+ }
85623
+ if (!findFlag) {
85624
+ throw new Error("the input ".concat(key, " not found"));
85625
+ }
85626
+ };
85627
+ _proto.getFinalInputs = function getFinalInputs() {
85628
+ var _this = this;
85629
+ var result = {};
85630
+ Object.keys(this.solutionSchema).forEach(function(key) {
85631
+ var _ref = _this.extendInputMap[key] || {
85632
+ before: {},
85633
+ after: {}
85634
+ }, before = _ref.before, after = _ref.after;
85635
+ Object.keys(before).forEach(function(beforeKey) {
85636
+ return result[beforeKey] = before[beforeKey];
85637
+ });
85638
+ result[key] = _this.solutionSchema[key];
85639
+ Object.keys(after).forEach(function(afterKey) {
85640
+ return result[afterKey] = after[afterKey];
85641
+ });
85642
+ });
85643
+ return result;
85644
+ };
85645
+ _proto.setInputValue = function setInputValue(value) {
85646
+ this.inputValue = value;
85647
+ };
85648
+ _proto.setDefualtConfig = function setDefualtConfig(value) {
85649
+ this.defaultConfig = value;
85650
+ };
85651
+ _create_class(PluginInputContext2, [
85570
85652
  {
85571
85653
  key: "context",
85572
85654
  get: function get4() {
@@ -85578,176 +85660,6 @@ var PluginInputContext = /* @__PURE__ */ function() {
85578
85660
  setDefaultConfig: this.setDefualtConfig.bind(this)
85579
85661
  };
85580
85662
  }
85581
- },
85582
- {
85583
- key: "validateInputKey",
85584
- value: function validateInputKey(inputKey) {
85585
- if (!this.solutionSchema[inputKey]) {
85586
- throw new Error("the input key ".concat(inputKey, " not found"));
85587
- }
85588
- }
85589
- },
85590
- {
85591
- key: "validateInput",
85592
- value: function validateInput(inputKey) {
85593
- var _this = this;
85594
- if (this.solutionSchema[inputKey]) {
85595
- throw new Error("the input key ".concat(inputKey, " already exists"));
85596
- }
85597
- Object.keys(this.extendInputMap).forEach(function(key) {
85598
- if (_this.extendInputMap[key].before[inputKey] || _this.extendInputMap[key].after[inputKey]) {
85599
- throw new Error("the input key ".concat(inputKey, " is already added"));
85600
- }
85601
- });
85602
- }
85603
- },
85604
- {
85605
- key: "addInputBefore",
85606
- value: function addInputBefore(key, input) {
85607
- this.validateInputKey(key);
85608
- var properties = input.properties || {};
85609
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85610
- try {
85611
- for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85612
- var inputKey = _step.value;
85613
- this.validateInput(inputKey);
85614
- if (this.extendInputMap[key]) {
85615
- this.extendInputMap[key].before[inputKey] = properties[inputKey];
85616
- } else {
85617
- this.extendInputMap[key] = {
85618
- before: _define_property2({}, inputKey, properties[inputKey]),
85619
- after: {}
85620
- };
85621
- }
85622
- }
85623
- } catch (err) {
85624
- _didIteratorError = true;
85625
- _iteratorError = err;
85626
- } finally {
85627
- try {
85628
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85629
- _iterator.return();
85630
- }
85631
- } finally {
85632
- if (_didIteratorError) {
85633
- throw _iteratorError;
85634
- }
85635
- }
85636
- }
85637
- }
85638
- },
85639
- {
85640
- key: "addInputAfter",
85641
- value: function addInputAfter(key, input) {
85642
- this.validateInputKey(key);
85643
- var properties = input.properties || {};
85644
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85645
- try {
85646
- for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85647
- var inputKey = _step.value;
85648
- this.validateInput(inputKey);
85649
- if (this.extendInputMap[key]) {
85650
- this.extendInputMap[key].after[inputKey] = properties[inputKey];
85651
- } else {
85652
- this.extendInputMap[key] = {
85653
- before: {},
85654
- after: _define_property2({}, inputKey, properties[inputKey])
85655
- };
85656
- }
85657
- }
85658
- } catch (err) {
85659
- _didIteratorError = true;
85660
- _iteratorError = err;
85661
- } finally {
85662
- try {
85663
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85664
- _iterator.return();
85665
- }
85666
- } finally {
85667
- if (_didIteratorError) {
85668
- throw _iteratorError;
85669
- }
85670
- }
85671
- }
85672
- }
85673
- },
85674
- {
85675
- key: "setInput",
85676
- value: function setInput(key, field, value) {
85677
- var schema = this.solutionSchema[key];
85678
- if (schema) {
85679
- schema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85680
- return;
85681
- }
85682
- var findFlag = false;
85683
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
85684
- try {
85685
- for (var _iterator = Object.keys(this.extendInputMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
85686
- var inputKey = _step.value;
85687
- var beforeSchema = this.extendInputMap[inputKey].before[key];
85688
- if (beforeSchema) {
85689
- findFlag = true;
85690
- beforeSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85691
- break;
85692
- }
85693
- var afterSchema = this.extendInputMap[inputKey].after[key];
85694
- if (afterSchema) {
85695
- findFlag = true;
85696
- afterSchema[field] = (0, import_lodash9.isFunction)(value) ? value(schema) : value;
85697
- break;
85698
- }
85699
- }
85700
- } catch (err) {
85701
- _didIteratorError = true;
85702
- _iteratorError = err;
85703
- } finally {
85704
- try {
85705
- if (!_iteratorNormalCompletion && _iterator.return != null) {
85706
- _iterator.return();
85707
- }
85708
- } finally {
85709
- if (_didIteratorError) {
85710
- throw _iteratorError;
85711
- }
85712
- }
85713
- }
85714
- if (!findFlag) {
85715
- throw new Error("the input ".concat(key, " not found"));
85716
- }
85717
- }
85718
- },
85719
- {
85720
- key: "getFinalInputs",
85721
- value: function getFinalInputs() {
85722
- var _this = this;
85723
- var result = {};
85724
- Object.keys(this.solutionSchema).forEach(function(key) {
85725
- var _ref = _this.extendInputMap[key] || {
85726
- before: {},
85727
- after: {}
85728
- }, before = _ref.before, after = _ref.after;
85729
- Object.keys(before).forEach(function(beforeKey) {
85730
- return result[beforeKey] = before[beforeKey];
85731
- });
85732
- result[key] = _this.solutionSchema[key];
85733
- Object.keys(after).forEach(function(afterKey) {
85734
- return result[afterKey] = after[afterKey];
85735
- });
85736
- });
85737
- return result;
85738
- }
85739
- },
85740
- {
85741
- key: "setInputValue",
85742
- value: function setInputValue(value) {
85743
- this.inputValue = value;
85744
- }
85745
- },
85746
- {
85747
- key: "setDefualtConfig",
85748
- value: function setDefualtConfig(value) {
85749
- this.defaultConfig = value;
85750
- }
85751
85663
  }
85752
85664
  ]);
85753
85665
  return PluginInputContext2;
@@ -85758,11 +85670,70 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
85758
85670
  "use strict";
85759
85671
  function PluginNpmAPI2(projectPath, packageManager) {
85760
85672
  _class_call_check(this, PluginNpmAPI2);
85761
- _define_property2(this, "projectPath", "");
85762
- _define_property2(this, "packageManager", void 0);
85673
+ this.projectPath = "";
85763
85674
  this.projectPath = projectPath;
85764
85675
  this.packageManager = packageManager;
85765
85676
  }
85677
+ var _proto = PluginNpmAPI2.prototype;
85678
+ _proto.install = function install() {
85679
+ var _this = this;
85680
+ return _async_to_generator(function() {
85681
+ return __generator(this, function(_state) {
85682
+ switch (_state.label) {
85683
+ case 0:
85684
+ if (!(_this.packageManager === PackageManager.Pnpm))
85685
+ return [
85686
+ 3,
85687
+ 2
85688
+ ];
85689
+ return [
85690
+ 4,
85691
+ pnpmInstall({
85692
+ cwd: _this.projectPath
85693
+ })
85694
+ ];
85695
+ case 1:
85696
+ _state.sent();
85697
+ return [
85698
+ 3,
85699
+ 6
85700
+ ];
85701
+ case 2:
85702
+ if (!(_this.packageManager === PackageManager.Yarn))
85703
+ return [
85704
+ 3,
85705
+ 4
85706
+ ];
85707
+ return [
85708
+ 4,
85709
+ yarnInstall({
85710
+ cwd: _this.projectPath
85711
+ })
85712
+ ];
85713
+ case 3:
85714
+ _state.sent();
85715
+ return [
85716
+ 3,
85717
+ 6
85718
+ ];
85719
+ case 4:
85720
+ return [
85721
+ 4,
85722
+ npmInstall({
85723
+ cwd: _this.projectPath
85724
+ })
85725
+ ];
85726
+ case 5:
85727
+ _state.sent();
85728
+ _state.label = 6;
85729
+ case 6:
85730
+ return [
85731
+ 2
85732
+ ];
85733
+ }
85734
+ });
85735
+ })();
85736
+ };
85766
85737
  _create_class(PluginNpmAPI2, [
85767
85738
  {
85768
85739
  key: "method",
@@ -85771,68 +85742,6 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
85771
85742
  install: this.install.bind(this)
85772
85743
  };
85773
85744
  }
85774
- },
85775
- {
85776
- key: "install",
85777
- value: function install() {
85778
- var _this = this;
85779
- return _async_to_generator(function() {
85780
- return __generator(this, function(_state) {
85781
- switch (_state.label) {
85782
- case 0:
85783
- if (!(_this.packageManager === PackageManager.Pnpm))
85784
- return [
85785
- 3,
85786
- 2
85787
- ];
85788
- return [
85789
- 4,
85790
- pnpmInstall({
85791
- cwd: _this.projectPath
85792
- })
85793
- ];
85794
- case 1:
85795
- _state.sent();
85796
- return [
85797
- 3,
85798
- 6
85799
- ];
85800
- case 2:
85801
- if (!(_this.packageManager === PackageManager.Yarn))
85802
- return [
85803
- 3,
85804
- 4
85805
- ];
85806
- return [
85807
- 4,
85808
- yarnInstall({
85809
- cwd: _this.projectPath
85810
- })
85811
- ];
85812
- case 3:
85813
- _state.sent();
85814
- return [
85815
- 3,
85816
- 6
85817
- ];
85818
- case 4:
85819
- return [
85820
- 4,
85821
- npmInstall({
85822
- cwd: _this.projectPath
85823
- })
85824
- ];
85825
- case 5:
85826
- _state.sent();
85827
- _state.label = 6;
85828
- case 6:
85829
- return [
85830
- 2
85831
- ];
85832
- }
85833
- });
85834
- })();
85835
- }
85836
85745
  }
85837
85746
  ]);
85838
85747
  return PluginNpmAPI2;
@@ -86165,14 +86074,141 @@ var PluginNewAPI = /* @__PURE__ */ function() {
86165
86074
  "use strict";
86166
86075
  function PluginNewAPI2(solution, projectPath, inputData) {
86167
86076
  _class_call_check(this, PluginNewAPI2);
86168
- _define_property2(this, "solution", void 0);
86169
- _define_property2(this, "projectPath", void 0);
86170
- _define_property2(this, "inputData", void 0);
86171
86077
  this.solution = solution;
86172
86078
  this.projectPath = projectPath;
86173
86079
  this.inputData = inputData;
86174
86080
  process.setMaxListeners(20);
86175
86081
  }
86082
+ var _proto = PluginNewAPI2.prototype;
86083
+ _proto.createElement = function createElement(element, params) {
86084
+ var _this = this;
86085
+ return _async_to_generator(function() {
86086
+ return __generator(this, function(_state) {
86087
+ switch (_state.label) {
86088
+ case 0:
86089
+ if (!(_this.solution === Solution.MWA))
86090
+ return [
86091
+ 3,
86092
+ 2
86093
+ ];
86094
+ if (!MWAActionElements.includes(element)) {
86095
+ throw new Error("the element ".concat(element, " not support to create"));
86096
+ }
86097
+ return [
86098
+ 4,
86099
+ MWANewAction({
86100
+ config: JSON.stringify(_object_spread({
86101
+ actionType: ActionType.Element,
86102
+ element,
86103
+ noNeedInstall: true
86104
+ }, _this.inputData, params)),
86105
+ cwd: _this.projectPath
86106
+ })
86107
+ ];
86108
+ case 1:
86109
+ _state.sent();
86110
+ return [
86111
+ 2
86112
+ ];
86113
+ case 2:
86114
+ throw new Error("this solution project not support create element");
86115
+ }
86116
+ });
86117
+ })();
86118
+ };
86119
+ _proto.enableFunc = function enableFunc(func, params) {
86120
+ var _this = this;
86121
+ return _async_to_generator(function() {
86122
+ return __generator(this, function(_state) {
86123
+ switch (_state.label) {
86124
+ case 0:
86125
+ if (!(_this.solution === Solution.MWA))
86126
+ return [
86127
+ 3,
86128
+ 2
86129
+ ];
86130
+ if (!MWAActionFunctions.includes(func)) {
86131
+ throw new Error("the func ".concat(func, " not support to enable"));
86132
+ }
86133
+ return [
86134
+ 4,
86135
+ MWANewAction({
86136
+ config: JSON.stringify(_object_spread({
86137
+ actionType: ActionType.Function,
86138
+ function: func,
86139
+ noNeedInstall: true
86140
+ }, _this.inputData, params)),
86141
+ cwd: _this.projectPath
86142
+ })
86143
+ ];
86144
+ case 1:
86145
+ _state.sent();
86146
+ return [
86147
+ 2
86148
+ ];
86149
+ case 2:
86150
+ if (!(_this.solution === Solution.Module))
86151
+ return [
86152
+ 3,
86153
+ 4
86154
+ ];
86155
+ if (!ModuleActionFunctions.includes(func)) {
86156
+ throw new Error("the func ".concat(func, " not support to enable"));
86157
+ }
86158
+ return [
86159
+ 4,
86160
+ ModuleNewAction({
86161
+ config: JSON.stringify(_object_spread({
86162
+ actionType: ActionType.Function,
86163
+ function: func,
86164
+ noNeedInstall: true
86165
+ }, _this.inputData, params)),
86166
+ cwd: _this.projectPath
86167
+ })
86168
+ ];
86169
+ case 3:
86170
+ _state.sent();
86171
+ return [
86172
+ 2
86173
+ ];
86174
+ case 4:
86175
+ throw new Error("this solution project not support enable function");
86176
+ }
86177
+ });
86178
+ })();
86179
+ };
86180
+ _proto.createSubProject = function createSubProject(solution, params) {
86181
+ var _this = this;
86182
+ return _async_to_generator(function() {
86183
+ return __generator(this, function(_state) {
86184
+ switch (_state.label) {
86185
+ case 0:
86186
+ if (!(_this.solution === Solution.Monorepo))
86187
+ return [
86188
+ 3,
86189
+ 2
86190
+ ];
86191
+ return [
86192
+ 4,
86193
+ MonorepoNewAction({
86194
+ config: JSON.stringify(_object_spread({
86195
+ solution,
86196
+ noNeedInstall: true
86197
+ }, _this.inputData, params)),
86198
+ cwd: _this.projectPath
86199
+ })
86200
+ ];
86201
+ case 1:
86202
+ _state.sent();
86203
+ return [
86204
+ 2
86205
+ ];
86206
+ case 2:
86207
+ throw new Error("this solution project not support create subproject");
86208
+ }
86209
+ });
86210
+ })();
86211
+ };
86176
86212
  _create_class(PluginNewAPI2, [
86177
86213
  {
86178
86214
  key: "method",
@@ -86182,186 +86218,55 @@ var PluginNewAPI = /* @__PURE__ */ function() {
86182
86218
  enableFunc: this.enableFunc.bind(this),
86183
86219
  createSubProject: this.createSubProject.bind(this)
86184
86220
  };
86185
- }
86186
- },
86187
- {
86188
- key: "createElement",
86189
- value: function createElement(element, params) {
86190
- var _this = this;
86191
- return _async_to_generator(function() {
86192
- return __generator(this, function(_state) {
86193
- switch (_state.label) {
86194
- case 0:
86195
- if (!(_this.solution === Solution.MWA))
86196
- return [
86197
- 3,
86198
- 2
86199
- ];
86200
- if (!MWAActionElements.includes(element)) {
86201
- throw new Error("the element ".concat(element, " not support to create"));
86202
- }
86203
- return [
86204
- 4,
86205
- MWANewAction({
86206
- config: JSON.stringify(_object_spread({
86207
- actionType: ActionType.Element,
86208
- element,
86209
- noNeedInstall: true
86210
- }, _this.inputData, params)),
86211
- cwd: _this.projectPath
86212
- })
86213
- ];
86214
- case 1:
86215
- _state.sent();
86216
- return [
86217
- 2
86218
- ];
86219
- case 2:
86220
- throw new Error("this solution project not support create element");
86221
- }
86222
- });
86223
- })();
86224
- }
86225
- },
86226
- {
86227
- key: "enableFunc",
86228
- value: function enableFunc(func, params) {
86229
- var _this = this;
86230
- return _async_to_generator(function() {
86231
- return __generator(this, function(_state) {
86232
- switch (_state.label) {
86233
- case 0:
86234
- if (!(_this.solution === Solution.MWA))
86235
- return [
86236
- 3,
86237
- 2
86238
- ];
86239
- if (!MWAActionFunctions.includes(func)) {
86240
- throw new Error("the func ".concat(func, " not support to enable"));
86241
- }
86242
- return [
86243
- 4,
86244
- MWANewAction({
86245
- config: JSON.stringify(_object_spread({
86246
- actionType: ActionType.Function,
86247
- function: func,
86248
- noNeedInstall: true
86249
- }, _this.inputData, params)),
86250
- cwd: _this.projectPath
86251
- })
86252
- ];
86253
- case 1:
86254
- _state.sent();
86255
- return [
86256
- 2
86257
- ];
86258
- case 2:
86259
- if (!(_this.solution === Solution.Module))
86260
- return [
86261
- 3,
86262
- 4
86263
- ];
86264
- if (!ModuleActionFunctions.includes(func)) {
86265
- throw new Error("the func ".concat(func, " not support to enable"));
86266
- }
86267
- return [
86268
- 4,
86269
- ModuleNewAction({
86270
- config: JSON.stringify(_object_spread({
86271
- actionType: ActionType.Function,
86272
- function: func,
86273
- noNeedInstall: true
86274
- }, _this.inputData, params)),
86275
- cwd: _this.projectPath
86276
- })
86277
- ];
86278
- case 3:
86279
- _state.sent();
86280
- return [
86281
- 2
86282
- ];
86283
- case 4:
86284
- throw new Error("this solution project not support enable function");
86285
- }
86286
- });
86287
- })();
86288
- }
86289
- },
86290
- {
86291
- key: "createSubProject",
86292
- value: function createSubProject(solution, params) {
86293
- var _this = this;
86294
- return _async_to_generator(function() {
86295
- return __generator(this, function(_state) {
86296
- switch (_state.label) {
86297
- case 0:
86298
- if (!(_this.solution === Solution.Monorepo))
86299
- return [
86300
- 3,
86301
- 2
86302
- ];
86303
- return [
86304
- 4,
86305
- MonorepoNewAction({
86306
- config: JSON.stringify(_object_spread({
86307
- solution,
86308
- noNeedInstall: true
86309
- }, _this.inputData, params)),
86310
- cwd: _this.projectPath
86311
- })
86312
- ];
86313
- case 1:
86314
- _state.sent();
86315
- return [
86316
- 2
86317
- ];
86318
- case 2:
86319
- throw new Error("this solution project not support create subproject");
86320
- }
86321
- });
86322
- })();
86323
- }
86324
- }
86325
- ]);
86326
- return PluginNewAPI2;
86327
- }();
86328
-
86329
- // ../../generator-plugin/dist/esm/context/index.js
86330
- var LifeCycle2;
86331
- (function(LifeCycle22) {
86332
- LifeCycle22["OnForged"] = "onForged";
86333
- LifeCycle22["AfterForged"] = "afterForged";
86334
- })(LifeCycle2 || (LifeCycle2 = {}));
86335
- var PluginContext = /* @__PURE__ */ function() {
86336
- "use strict";
86337
- function PluginContext2(solutionSchema, locale) {
86338
- _class_call_check(this, PluginContext2);
86339
- _define_property2(this, "generator", void 0);
86340
- _define_property2(this, "inputContext", void 0);
86341
- _define_property2(this, "gitAPI", void 0);
86342
- _define_property2(this, "fileAPI", void 0);
86343
- _define_property2(this, "npmAPI", void 0);
86344
- _define_property2(this, "newAPI", void 0);
86345
- _define_property2(this, "locale", void 0);
86346
- var _obj;
86347
- _define_property2(this, "lifeCycleFuncMap", (_obj = {}, _define_property2(_obj, "onForged", function() {
86348
- }), _define_property2(_obj, "afterForged", function() {
86349
- }), _obj));
86350
- this.inputContext = new PluginInputContext(solutionSchema);
86351
- this.gitAPI = new PluginGitAPI();
86352
- this.fileAPI = new PluginFileAPI();
86353
- this.locale = locale;
86354
- }
86355
- _create_class(PluginContext2, [
86356
- {
86357
- key: "context",
86358
- get: function get4() {
86359
- return _object_spread_props(_object_spread({
86360
- locale: this.locale
86361
- }, this.inputContext.context, this.gitAPI.context, this.fileAPI.context), {
86362
- onForged: this.onForged.bind(this),
86363
- afterForged: this.afterForged.bind(this)
86364
- });
86221
+ }
86222
+ }
86223
+ ]);
86224
+ return PluginNewAPI2;
86225
+ }();
86226
+
86227
+ // ../../generator-plugin/dist/esm/context/index.js
86228
+ var LifeCycle2;
86229
+ (function(LifeCycle22) {
86230
+ LifeCycle22["OnForged"] = "onForged";
86231
+ LifeCycle22["AfterForged"] = "afterForged";
86232
+ })(LifeCycle2 || (LifeCycle2 = {}));
86233
+ var PluginContext = /* @__PURE__ */ function() {
86234
+ "use strict";
86235
+ function PluginContext2(solutionSchema, locale) {
86236
+ _class_call_check(this, PluginContext2);
86237
+ var _obj;
86238
+ this.lifeCycleFuncMap = (_obj = {}, _define_property2(_obj, "onForged", function() {
86239
+ }), _define_property2(_obj, "afterForged", function() {
86240
+ }), _obj);
86241
+ this.inputContext = new PluginInputContext(solutionSchema);
86242
+ this.gitAPI = new PluginGitAPI();
86243
+ this.fileAPI = new PluginFileAPI();
86244
+ this.locale = locale;
86245
+ }
86246
+ var _proto = PluginContext2.prototype;
86247
+ _proto.handlePrepareContext = function handlePrepareContext(generator, solution, projectPath, templatePath, inputData) {
86248
+ this.generator = generator;
86249
+ this.gitAPI.prepare(generator, projectPath);
86250
+ this.fileAPI.prepare(generator, projectPath, templatePath);
86251
+ this.npmAPI = new PluginNpmAPI(projectPath, inputData.packageManager);
86252
+ this.newAPI = new PluginNewAPI(solution, projectPath, inputData);
86253
+ };
86254
+ _proto.onForged = function onForged(func) {
86255
+ this.lifeCycleFuncMap["onForged"] = func;
86256
+ };
86257
+ _proto.afterForged = function afterForged(func) {
86258
+ this.lifeCycleFuncMap["afterForged"] = func;
86259
+ };
86260
+ _create_class(PluginContext2, [
86261
+ {
86262
+ key: "context",
86263
+ get: function get4() {
86264
+ return _object_spread_props(_object_spread({
86265
+ locale: this.locale
86266
+ }, this.inputContext.context, this.gitAPI.context, this.fileAPI.context), {
86267
+ onForged: this.onForged.bind(this),
86268
+ afterForged: this.afterForged.bind(this)
86269
+ });
86365
86270
  }
86366
86271
  },
86367
86272
  {
@@ -86375,28 +86280,6 @@ var PluginContext = /* @__PURE__ */ function() {
86375
86280
  get: function get4() {
86376
86281
  return _object_spread({}, this.gitAPI.method, this.npmAPI.method);
86377
86282
  }
86378
- },
86379
- {
86380
- key: "handlePrepareContext",
86381
- value: function handlePrepareContext(generator, solution, projectPath, templatePath, inputData) {
86382
- this.generator = generator;
86383
- this.gitAPI.prepare(generator, projectPath);
86384
- this.fileAPI.prepare(generator, projectPath, templatePath);
86385
- this.npmAPI = new PluginNpmAPI(projectPath, inputData.packageManager);
86386
- this.newAPI = new PluginNewAPI(solution, projectPath, inputData);
86387
- }
86388
- },
86389
- {
86390
- key: "onForged",
86391
- value: function onForged(func) {
86392
- this.lifeCycleFuncMap["onForged"] = func;
86393
- }
86394
- },
86395
- {
86396
- key: "afterForged",
86397
- value: function afterForged(func) {
86398
- this.lifeCycleFuncMap["afterForged"] = func;
86399
- }
86400
86283
  }
86401
86284
  ]);
86402
86285
  return PluginContext2;
@@ -86564,11 +86447,9 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
86564
86447
  function GeneratorPlugin2(logger2, event) {
86565
86448
  var locale = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "en";
86566
86449
  _class_call_check(this, GeneratorPlugin2);
86567
- _define_property2(this, "plugins", []);
86568
- _define_property2(this, "extendPlugin", {});
86569
- _define_property2(this, "customPlugin", {});
86570
- _define_property2(this, "event", void 0);
86571
- _define_property2(this, "logger", void 0);
86450
+ this.plugins = [];
86451
+ this.extendPlugin = {};
86452
+ this.customPlugin = {};
86572
86453
  this.event = event;
86573
86454
  this.logger = logger2;
86574
86455
  if (event) {
@@ -86584,439 +86465,417 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
86584
86465
  locale
86585
86466
  });
86586
86467
  }
86587
- _create_class(GeneratorPlugin2, [
86588
- {
86589
- key: "setupPlugin",
86590
- value: function setupPlugin(plugins, registry2) {
86591
- var _this = this;
86592
- return _async_to_generator(function() {
86593
- return __generator(this, function(_state) {
86594
- switch (_state.label) {
86595
- case 0:
86596
- return [
86597
- 4,
86598
- Promise.all(plugins.map(function() {
86599
- var _ref = _async_to_generator(function(plugin) {
86600
- var pkgJSON, _getPackageInfo, name, pkgVersion, meta;
86601
- return __generator(this, function(_state2) {
86602
- switch (_state2.label) {
86603
- case 0:
86604
- if (!plugin.startsWith("file:"))
86605
- return [
86606
- 3,
86607
- 2
86608
- ];
86609
- return [
86610
- 4,
86611
- import_utils50.fs.readJSON(import_path18.default.join(process.cwd(), plugin.slice(5), "package.json"))
86612
- ];
86613
- case 1:
86614
- pkgJSON = _state2.sent();
86615
- return [
86616
- 3,
86617
- 6
86618
- ];
86619
- case 2:
86620
- if (!import_path18.default.isAbsolute(plugin))
86621
- return [
86622
- 3,
86623
- 4
86624
- ];
86625
- return [
86626
- 4,
86627
- import_utils50.fs.readJSON(import_path18.default.join(plugin, "package.json"))
86628
- ];
86629
- case 3:
86630
- pkgJSON = _state2.sent();
86631
- return [
86632
- 3,
86633
- 6
86634
- ];
86635
- case 4:
86636
- _getPackageInfo = getPackageInfo(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
86637
- return [
86638
- 4,
86639
- getPackageMeta(name, pkgVersion, {
86640
- registryUrl: registry2
86641
- })
86642
- ];
86643
- case 5:
86644
- pkgJSON = _state2.sent();
86645
- _state2.label = 6;
86646
- case 6:
86647
- meta = pkgJSON.meta;
86648
- if (!meta) {
86649
- throw new Error(i18n4.t(localeKeys4.plugin_no_meta_error, {
86650
- plugin
86651
- }));
86652
- }
86653
- if (meta.extend) {
86654
- _this.extendPlugin[meta.extend] = _to_consumable_array(_this.extendPlugin[meta.extend] || []).concat([
86655
- plugin
86656
- ]);
86657
- } else if (meta.type && meta.key) {
86658
- _this.customPlugin[meta.type] = _to_consumable_array(_this.customPlugin[meta.type] || []).concat([
86659
- _object_spread_props(_object_spread({}, meta), {
86660
- plugin
86661
- })
86662
- ]);
86663
- }
86664
- return [
86665
- 2
86666
- ];
86468
+ var _proto = GeneratorPlugin2.prototype;
86469
+ _proto.setupPlugin = function setupPlugin(plugins, registry2) {
86470
+ var _this = this;
86471
+ return _async_to_generator(function() {
86472
+ return __generator(this, function(_state) {
86473
+ switch (_state.label) {
86474
+ case 0:
86475
+ return [
86476
+ 4,
86477
+ Promise.all(plugins.map(function() {
86478
+ var _ref = _async_to_generator(function(plugin) {
86479
+ var pkgJSON, _getPackageInfo, name, pkgVersion, meta;
86480
+ return __generator(this, function(_state2) {
86481
+ switch (_state2.label) {
86482
+ case 0:
86483
+ if (!plugin.startsWith("file:"))
86484
+ return [
86485
+ 3,
86486
+ 2
86487
+ ];
86488
+ return [
86489
+ 4,
86490
+ import_utils50.fs.readJSON(import_path18.default.join(process.cwd(), plugin.slice(5), "package.json"))
86491
+ ];
86492
+ case 1:
86493
+ pkgJSON = _state2.sent();
86494
+ return [
86495
+ 3,
86496
+ 6
86497
+ ];
86498
+ case 2:
86499
+ if (!import_path18.default.isAbsolute(plugin))
86500
+ return [
86501
+ 3,
86502
+ 4
86503
+ ];
86504
+ return [
86505
+ 4,
86506
+ import_utils50.fs.readJSON(import_path18.default.join(plugin, "package.json"))
86507
+ ];
86508
+ case 3:
86509
+ pkgJSON = _state2.sent();
86510
+ return [
86511
+ 3,
86512
+ 6
86513
+ ];
86514
+ case 4:
86515
+ _getPackageInfo = getPackageInfo(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
86516
+ return [
86517
+ 4,
86518
+ getPackageMeta(name, pkgVersion, {
86519
+ registryUrl: registry2
86520
+ })
86521
+ ];
86522
+ case 5:
86523
+ pkgJSON = _state2.sent();
86524
+ _state2.label = 6;
86525
+ case 6:
86526
+ meta = pkgJSON.meta;
86527
+ if (!meta) {
86528
+ throw new Error(i18n4.t(localeKeys4.plugin_no_meta_error, {
86529
+ plugin
86530
+ }));
86667
86531
  }
86668
- });
86669
- });
86670
- return function(plugin) {
86671
- return _ref.apply(this, arguments);
86672
- };
86673
- }()))
86674
- ];
86675
- case 1:
86676
- _state.sent();
86677
- return [
86678
- 2
86679
- ];
86680
- }
86681
- });
86682
- })();
86683
- }
86684
- },
86685
- {
86686
- key: "getInputSchema",
86687
- value: function getInputSchema() {
86688
- var properties = {};
86689
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86690
- try {
86691
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86692
- var info = _step.value;
86693
- properties = _object_spread({}, properties, info.context.inputContext.getFinalInputs());
86694
- }
86695
- } catch (err) {
86696
- _didIteratorError = true;
86697
- _iteratorError = err;
86698
- } finally {
86699
- try {
86700
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86701
- _iterator.return();
86702
- }
86703
- } finally {
86704
- if (_didIteratorError) {
86705
- throw _iteratorError;
86706
- }
86707
- }
86532
+ if (meta.extend) {
86533
+ _this.extendPlugin[meta.extend] = _to_consumable_array(_this.extendPlugin[meta.extend] || []).concat([
86534
+ plugin
86535
+ ]);
86536
+ } else if (meta.type && meta.key) {
86537
+ _this.customPlugin[meta.type] = _to_consumable_array(_this.customPlugin[meta.type] || []).concat([
86538
+ _object_spread_props(_object_spread({}, meta), {
86539
+ plugin
86540
+ })
86541
+ ]);
86542
+ }
86543
+ return [
86544
+ 2
86545
+ ];
86546
+ }
86547
+ });
86548
+ });
86549
+ return function(plugin) {
86550
+ return _ref.apply(this, arguments);
86551
+ };
86552
+ }()))
86553
+ ];
86554
+ case 1:
86555
+ _state.sent();
86556
+ return [
86557
+ 2
86558
+ ];
86708
86559
  }
86709
- return {
86710
- type: "object",
86711
- properties
86712
- };
86560
+ });
86561
+ })();
86562
+ };
86563
+ _proto.getInputSchema = function getInputSchema() {
86564
+ var properties = {};
86565
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86566
+ try {
86567
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86568
+ var info = _step.value;
86569
+ properties = _object_spread({}, properties, info.context.inputContext.getFinalInputs());
86713
86570
  }
86714
- },
86715
- {
86716
- key: "getInputValue",
86717
- value: function getInputValue() {
86718
- var result = {};
86719
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86720
- try {
86721
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86722
- var info = _step.value;
86723
- result = (0, import_lodash14.merge)(result, info.context.inputContext.inputValue);
86724
- }
86725
- } catch (err) {
86726
- _didIteratorError = true;
86727
- _iteratorError = err;
86728
- } finally {
86729
- try {
86730
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86731
- _iterator.return();
86732
- }
86733
- } finally {
86734
- if (_didIteratorError) {
86735
- throw _iteratorError;
86736
- }
86737
- }
86571
+ } catch (err) {
86572
+ _didIteratorError = true;
86573
+ _iteratorError = err;
86574
+ } finally {
86575
+ try {
86576
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86577
+ _iterator.return();
86578
+ }
86579
+ } finally {
86580
+ if (_didIteratorError) {
86581
+ throw _iteratorError;
86738
86582
  }
86739
- return result;
86740
86583
  }
86741
- },
86742
- {
86743
- key: "getDefaultConfig",
86744
- value: function getDefaultConfig() {
86745
- var result = {};
86746
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86747
- try {
86748
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86749
- var info = _step.value;
86750
- result = (0, import_lodash14.merge)(result, info.context.inputContext.defaultConfig);
86751
- }
86752
- } catch (err) {
86753
- _didIteratorError = true;
86754
- _iteratorError = err;
86755
- } finally {
86756
- try {
86757
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86758
- _iterator.return();
86759
- }
86760
- } finally {
86761
- if (_didIteratorError) {
86762
- throw _iteratorError;
86763
- }
86764
- }
86584
+ }
86585
+ return {
86586
+ type: "object",
86587
+ properties
86588
+ };
86589
+ };
86590
+ _proto.getInputValue = function getInputValue() {
86591
+ var result = {};
86592
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86593
+ try {
86594
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86595
+ var info = _step.value;
86596
+ result = (0, import_lodash14.merge)(result, info.context.inputContext.inputValue);
86597
+ }
86598
+ } catch (err) {
86599
+ _didIteratorError = true;
86600
+ _iteratorError = err;
86601
+ } finally {
86602
+ try {
86603
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86604
+ _iterator.return();
86605
+ }
86606
+ } finally {
86607
+ if (_didIteratorError) {
86608
+ throw _iteratorError;
86765
86609
  }
86766
- return result;
86767
86610
  }
86768
- },
86769
- {
86770
- key: "installPlugins",
86771
- value: function installPlugins1(solution, inputData) {
86772
- var _this = this;
86773
- return _async_to_generator(function() {
86774
- var plugins, plugin, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info;
86775
- return __generator(this, function(_state) {
86776
- switch (_state.label) {
86777
- case 0:
86778
- plugins = [];
86779
- if (_this.extendPlugin[solution] && _this.extendPlugin[solution].length > 0) {
86780
- plugins = _to_consumable_array(plugins).concat(_to_consumable_array(_this.extendPlugin[solution]));
86781
- }
86782
- if (_this.customPlugin[solution]) {
86783
- plugin = _this.customPlugin[solution].find(function(item) {
86784
- return item.key === inputData.scenes;
86785
- });
86786
- if (plugin) {
86787
- plugins.push(plugin.plugin);
86788
- }
86789
- }
86790
- _this.logger.info(i18n4.t(localeKeys4.install_plugin));
86791
- return [
86792
- 4,
86793
- installPlugins(plugins, inputData.registry)
86794
- ];
86795
- case 1:
86796
- _this.plugins = _state.sent();
86797
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86798
- try {
86799
- for (_iterator = _this.plugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86800
- info = _step.value;
86801
- info.context = new PluginContext(SolutionSchemas[solution], inputData.locale);
86802
- info.context.inputContext.prepare(inputData);
86803
- info.module(info.context.context);
86804
- }
86805
- } catch (err) {
86806
- _didIteratorError = true;
86807
- _iteratorError = err;
86808
- } finally {
86809
- try {
86810
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86811
- _iterator.return();
86812
- }
86813
- } finally {
86814
- if (_didIteratorError) {
86815
- throw _iteratorError;
86816
- }
86817
- }
86818
- }
86819
- return [
86820
- 2
86821
- ];
86822
- }
86823
- });
86824
- })();
86611
+ }
86612
+ return result;
86613
+ };
86614
+ _proto.getDefaultConfig = function getDefaultConfig() {
86615
+ var result = {};
86616
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86617
+ try {
86618
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86619
+ var info = _step.value;
86620
+ result = (0, import_lodash14.merge)(result, info.context.inputContext.defaultConfig);
86825
86621
  }
86826
- },
86827
- {
86828
- key: "getGitMessage",
86829
- value: function getGitMessage() {
86830
- var result = "";
86831
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86832
- try {
86833
- for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86834
- var info = _step.value;
86835
- var _info_context;
86836
- if ((_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.gitAPI.gitMessage) {
86837
- var _info_context1;
86838
- result = ((_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.gitAPI.gitMessage) || "";
86839
- }
86840
- }
86841
- } catch (err) {
86842
- _didIteratorError = true;
86843
- _iteratorError = err;
86844
- } finally {
86845
- try {
86846
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86847
- _iterator.return();
86848
- }
86849
- } finally {
86850
- if (_didIteratorError) {
86851
- throw _iteratorError;
86852
- }
86853
- }
86622
+ } catch (err) {
86623
+ _didIteratorError = true;
86624
+ _iteratorError = err;
86625
+ } finally {
86626
+ try {
86627
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86628
+ _iterator.return();
86629
+ }
86630
+ } finally {
86631
+ if (_didIteratorError) {
86632
+ throw _iteratorError;
86854
86633
  }
86855
- return result;
86856
86634
  }
86857
- },
86858
- {
86859
- key: "handleForged",
86860
- value: function handleForged(solution, basePath, inputData, projectPath, generatorCore) {
86861
- var _this = this;
86862
- return _async_to_generator(function() {
86863
- 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;
86864
- return __generator(this, function(_state) {
86865
- switch (_state.label) {
86866
- case 0:
86867
- _this.logger.info(i18n4.t(localeKeys4.run_plugin));
86868
- generatorPlugin = inputData.generatorPlugin, restData = _object_without_properties(inputData, [
86869
- "generatorPlugin"
86870
- ]);
86871
- if (solution !== restData.solution) {
86872
- if (_this.event) {
86873
- _this.event.emit("handle forged success");
86874
- }
86875
- return [
86876
- 2
86877
- ];
86878
- }
86879
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86880
- _state.label = 1;
86881
- case 1:
86882
- _state.trys.push([
86883
- 1,
86884
- 6,
86885
- 7,
86886
- 8
86887
- ]);
86888
- _iterator = _this.plugins[Symbol.iterator]();
86889
- _state.label = 2;
86890
- case 2:
86891
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
86892
- return [
86893
- 3,
86894
- 5
86895
- ];
86635
+ }
86636
+ return result;
86637
+ };
86638
+ _proto.installPlugins = function installPlugins1(solution, inputData) {
86639
+ var _this = this;
86640
+ return _async_to_generator(function() {
86641
+ var plugins, plugin, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, info;
86642
+ return __generator(this, function(_state) {
86643
+ switch (_state.label) {
86644
+ case 0:
86645
+ plugins = [];
86646
+ if (_this.extendPlugin[solution] && _this.extendPlugin[solution].length > 0) {
86647
+ plugins = _to_consumable_array(plugins).concat(_to_consumable_array(_this.extendPlugin[solution]));
86648
+ }
86649
+ if (_this.customPlugin[solution]) {
86650
+ plugin = _this.customPlugin[solution].find(function(item) {
86651
+ return item.key === inputData.scenes;
86652
+ });
86653
+ if (plugin) {
86654
+ plugins.push(plugin.plugin);
86655
+ }
86656
+ }
86657
+ _this.logger.info(i18n4.t(localeKeys4.install_plugin));
86658
+ return [
86659
+ 4,
86660
+ installPlugins(plugins, inputData.registry)
86661
+ ];
86662
+ case 1:
86663
+ _this.plugins = _state.sent();
86664
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86665
+ try {
86666
+ for (_iterator = _this.plugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86896
86667
  info = _step.value;
86897
- (_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);
86898
- onForgedFunc = (_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.lifeCycleFuncMap[LifeCycle2.OnForged];
86899
- if (!(onForgedFunc && (0, import_lodash14.isFunction)(onForgedFunc)))
86900
- return [
86901
- 3,
86902
- 4
86903
- ];
86904
- return [
86905
- 4,
86906
- onForgedFunc(info.context.forgedAPI, restData)
86907
- ];
86908
- case 3:
86909
- _state.sent();
86910
- _state.label = 4;
86911
- case 4:
86912
- _iteratorNormalCompletion = true;
86913
- return [
86914
- 3,
86915
- 2
86916
- ];
86917
- case 5:
86918
- return [
86919
- 3,
86920
- 8
86921
- ];
86922
- case 6:
86923
- err = _state.sent();
86924
- _didIteratorError = true;
86925
- _iteratorError = err;
86926
- return [
86927
- 3,
86928
- 8
86929
- ];
86930
- case 7:
86931
- try {
86932
- if (!_iteratorNormalCompletion && _iterator.return != null) {
86933
- _iterator.return();
86934
- }
86935
- } finally {
86936
- if (_didIteratorError) {
86937
- throw _iteratorError;
86938
- }
86939
- }
86940
- return [
86941
- 7
86942
- ];
86943
- case 8:
86944
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
86945
- _state.label = 9;
86946
- case 9:
86947
- _state.trys.push([
86948
- 9,
86949
- 14,
86950
- 15,
86951
- 16
86952
- ]);
86953
- _iterator1 = _this.plugins[Symbol.iterator]();
86954
- _state.label = 10;
86955
- case 10:
86956
- if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done))
86957
- return [
86958
- 3,
86959
- 13
86960
- ];
86961
- info1 = _step1.value;
86962
- afterForged = (_info_context2 = info1.context) === null || _info_context2 === void 0 ? void 0 : _info_context2.lifeCycleFuncMap[LifeCycle2.AfterForged];
86963
- if (!(afterForged && (0, import_lodash14.isFunction)(afterForged)))
86964
- return [
86965
- 3,
86966
- 12
86967
- ];
86968
- return [
86969
- 4,
86970
- afterForged(info1.context.afterForgedAPI, restData)
86971
- ];
86972
- case 11:
86973
- _state.sent();
86974
- _state.label = 12;
86975
- case 12:
86976
- _iteratorNormalCompletion1 = true;
86977
- return [
86978
- 3,
86979
- 10
86980
- ];
86981
- case 13:
86982
- return [
86983
- 3,
86984
- 16
86985
- ];
86986
- case 14:
86987
- err = _state.sent();
86988
- _didIteratorError1 = true;
86989
- _iteratorError1 = err;
86990
- return [
86991
- 3,
86992
- 16
86993
- ];
86994
- case 15:
86995
- try {
86996
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
86997
- _iterator1.return();
86998
- }
86999
- } finally {
87000
- if (_didIteratorError1) {
87001
- throw _iteratorError1;
87002
- }
86668
+ info.context = new PluginContext(SolutionSchemas[solution], inputData.locale);
86669
+ info.context.inputContext.prepare(inputData);
86670
+ info.module(info.context.context);
86671
+ }
86672
+ } catch (err) {
86673
+ _didIteratorError = true;
86674
+ _iteratorError = err;
86675
+ } finally {
86676
+ try {
86677
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86678
+ _iterator.return();
87003
86679
  }
87004
- return [
87005
- 7
87006
- ];
87007
- case 16:
87008
- if (_this.event) {
87009
- _this.event.emit("handle forged success");
86680
+ } finally {
86681
+ if (_didIteratorError) {
86682
+ throw _iteratorError;
87010
86683
  }
87011
- return [
87012
- 2
87013
- ];
86684
+ }
87014
86685
  }
87015
- });
87016
- })();
86686
+ return [
86687
+ 2
86688
+ ];
86689
+ }
86690
+ });
86691
+ })();
86692
+ };
86693
+ _proto.getGitMessage = function getGitMessage() {
86694
+ var result = "";
86695
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86696
+ try {
86697
+ for (var _iterator = this.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
86698
+ var info = _step.value;
86699
+ var _info_context;
86700
+ if ((_info_context = info.context) === null || _info_context === void 0 ? void 0 : _info_context.gitAPI.gitMessage) {
86701
+ var _info_context1;
86702
+ result = ((_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.gitAPI.gitMessage) || "";
86703
+ }
86704
+ }
86705
+ } catch (err) {
86706
+ _didIteratorError = true;
86707
+ _iteratorError = err;
86708
+ } finally {
86709
+ try {
86710
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86711
+ _iterator.return();
86712
+ }
86713
+ } finally {
86714
+ if (_didIteratorError) {
86715
+ throw _iteratorError;
86716
+ }
87017
86717
  }
87018
86718
  }
87019
- ]);
86719
+ return result;
86720
+ };
86721
+ _proto.handleForged = function handleForged(solution, basePath, inputData, projectPath, generatorCore) {
86722
+ var _this = this;
86723
+ return _async_to_generator(function() {
86724
+ 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;
86725
+ return __generator(this, function(_state) {
86726
+ switch (_state.label) {
86727
+ case 0:
86728
+ _this.logger.info(i18n4.t(localeKeys4.run_plugin));
86729
+ generatorPlugin = inputData.generatorPlugin, restData = _object_without_properties(inputData, [
86730
+ "generatorPlugin"
86731
+ ]);
86732
+ if (solution !== restData.solution) {
86733
+ if (_this.event) {
86734
+ _this.event.emit("handle forged success");
86735
+ }
86736
+ return [
86737
+ 2
86738
+ ];
86739
+ }
86740
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
86741
+ _state.label = 1;
86742
+ case 1:
86743
+ _state.trys.push([
86744
+ 1,
86745
+ 6,
86746
+ 7,
86747
+ 8
86748
+ ]);
86749
+ _iterator = _this.plugins[Symbol.iterator]();
86750
+ _state.label = 2;
86751
+ case 2:
86752
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
86753
+ return [
86754
+ 3,
86755
+ 5
86756
+ ];
86757
+ info = _step.value;
86758
+ (_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);
86759
+ onForgedFunc = (_info_context1 = info.context) === null || _info_context1 === void 0 ? void 0 : _info_context1.lifeCycleFuncMap[LifeCycle2.OnForged];
86760
+ if (!(onForgedFunc && (0, import_lodash14.isFunction)(onForgedFunc)))
86761
+ return [
86762
+ 3,
86763
+ 4
86764
+ ];
86765
+ return [
86766
+ 4,
86767
+ onForgedFunc(info.context.forgedAPI, restData)
86768
+ ];
86769
+ case 3:
86770
+ _state.sent();
86771
+ _state.label = 4;
86772
+ case 4:
86773
+ _iteratorNormalCompletion = true;
86774
+ return [
86775
+ 3,
86776
+ 2
86777
+ ];
86778
+ case 5:
86779
+ return [
86780
+ 3,
86781
+ 8
86782
+ ];
86783
+ case 6:
86784
+ err = _state.sent();
86785
+ _didIteratorError = true;
86786
+ _iteratorError = err;
86787
+ return [
86788
+ 3,
86789
+ 8
86790
+ ];
86791
+ case 7:
86792
+ try {
86793
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
86794
+ _iterator.return();
86795
+ }
86796
+ } finally {
86797
+ if (_didIteratorError) {
86798
+ throw _iteratorError;
86799
+ }
86800
+ }
86801
+ return [
86802
+ 7
86803
+ ];
86804
+ case 8:
86805
+ _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
86806
+ _state.label = 9;
86807
+ case 9:
86808
+ _state.trys.push([
86809
+ 9,
86810
+ 14,
86811
+ 15,
86812
+ 16
86813
+ ]);
86814
+ _iterator1 = _this.plugins[Symbol.iterator]();
86815
+ _state.label = 10;
86816
+ case 10:
86817
+ if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done))
86818
+ return [
86819
+ 3,
86820
+ 13
86821
+ ];
86822
+ info1 = _step1.value;
86823
+ afterForged = (_info_context2 = info1.context) === null || _info_context2 === void 0 ? void 0 : _info_context2.lifeCycleFuncMap[LifeCycle2.AfterForged];
86824
+ if (!(afterForged && (0, import_lodash14.isFunction)(afterForged)))
86825
+ return [
86826
+ 3,
86827
+ 12
86828
+ ];
86829
+ return [
86830
+ 4,
86831
+ afterForged(info1.context.afterForgedAPI, restData)
86832
+ ];
86833
+ case 11:
86834
+ _state.sent();
86835
+ _state.label = 12;
86836
+ case 12:
86837
+ _iteratorNormalCompletion1 = true;
86838
+ return [
86839
+ 3,
86840
+ 10
86841
+ ];
86842
+ case 13:
86843
+ return [
86844
+ 3,
86845
+ 16
86846
+ ];
86847
+ case 14:
86848
+ err = _state.sent();
86849
+ _didIteratorError1 = true;
86850
+ _iteratorError1 = err;
86851
+ return [
86852
+ 3,
86853
+ 16
86854
+ ];
86855
+ case 15:
86856
+ try {
86857
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
86858
+ _iterator1.return();
86859
+ }
86860
+ } finally {
86861
+ if (_didIteratorError1) {
86862
+ throw _iteratorError1;
86863
+ }
86864
+ }
86865
+ return [
86866
+ 7
86867
+ ];
86868
+ case 16:
86869
+ if (_this.event) {
86870
+ _this.event.emit("handle forged success");
86871
+ }
86872
+ return [
86873
+ 2
86874
+ ];
86875
+ }
86876
+ });
86877
+ })();
86878
+ };
87020
86879
  return GeneratorPlugin2;
87021
86880
  }();
87022
86881