@modern-js/repo-generator 3.3.11 → 3.3.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +1163 -1315
- 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
|
-
|
83449
|
-
|
83439
|
+
this.language = "en";
|
83440
|
+
this.languageMap = {};
|
83450
83441
|
}
|
83451
83442
|
};
|
83452
83443
|
|
@@ -83479,10 +83470,8 @@ var ZH_LOCALE2 = {
|
|
83479
83470
|
i18n: "启用「国际化(i18n)」功能",
|
83480
83471
|
test: "启用「单元测试 / 集成测试」功能",
|
83481
83472
|
e2e_test: "启用「E2E 测试」功能",
|
83482
|
-
storybook: "启用「Storybook」",
|
83483
83473
|
storybookV7: "启用「Storybook」V7",
|
83484
83474
|
runtime_api: "启用「Runtime API」",
|
83485
|
-
mwa_storybook: "启用「Visual Testing (Storybook)」模式",
|
83486
83475
|
ssg: "启用「SSG」功能",
|
83487
83476
|
polyfill: "启用「基于 UA 的 Polyfill」功能",
|
83488
83477
|
proxy: "启用「全局代理」",
|
@@ -83577,10 +83566,8 @@ var EN_LOCALE2 = {
|
|
83577
83566
|
i18n: "Enable Internationalization (i18n)",
|
83578
83567
|
test: "Enable Unit Test / Integration Test",
|
83579
83568
|
e2e_test: "Enable E2E Test",
|
83580
|
-
storybook: "Enable Storybook",
|
83581
83569
|
storybookV7: "Enable Storybook V7",
|
83582
83570
|
runtime_api: "Enable Runtime API",
|
83583
|
-
mwa_storybook: "Enable Visual Testing (Storybook)",
|
83584
83571
|
ssg: "Enable SSG",
|
83585
83572
|
polyfill: "Enable UA-based Polyfill Feature",
|
83586
83573
|
proxy: "Enable Global Proxy",
|
@@ -83970,7 +83957,6 @@ var ActionFunction;
|
|
83970
83957
|
ActionFunction2["I18n"] = "i18n";
|
83971
83958
|
ActionFunction2["Test"] = "test";
|
83972
83959
|
ActionFunction2["E2ETest"] = "e2e_test";
|
83973
|
-
ActionFunction2["Storybook"] = "storybook";
|
83974
83960
|
ActionFunction2["StorybookV7"] = "storybookV7";
|
83975
83961
|
ActionFunction2["RuntimeApi"] = "runtimeApi";
|
83976
83962
|
ActionFunction2["SSG"] = "ssg";
|
@@ -84004,7 +83990,6 @@ var ActionFunctionText = {
|
|
84004
83990
|
["i18n"]: () => i18n2.t(localeKeys2.action.function.i18n),
|
84005
83991
|
["test"]: () => i18n2.t(localeKeys2.action.function.test),
|
84006
83992
|
["e2e_test"]: () => i18n2.t(localeKeys2.action.function.e2e_test),
|
84007
|
-
["storybook"]: () => i18n2.t(localeKeys2.action.function.storybook),
|
84008
83993
|
["storybookV7"]: () => i18n2.t(localeKeys2.action.function.storybookV7),
|
84009
83994
|
["runtimeApi"]: () => i18n2.t(localeKeys2.action.function.runtime_api),
|
84010
83995
|
["ssg"]: () => i18n2.t(localeKeys2.action.function.ssg),
|
@@ -84032,7 +84017,6 @@ var MWAActionFunctions = [
|
|
84032
84017
|
ActionFunction.Test,
|
84033
84018
|
ActionFunction.Polyfill,
|
84034
84019
|
ActionFunction.Proxy,
|
84035
|
-
ActionFunction.Storybook,
|
84036
84020
|
ActionFunction.StorybookV7
|
84037
84021
|
];
|
84038
84022
|
var MWAActionElements = [
|
@@ -84090,7 +84074,7 @@ var getMWANewActionSchema = (extra = {}) => {
|
|
84090
84074
|
title: ActionTypeQuestionText[ActionType.Function](),
|
84091
84075
|
enum: funcs.map((func) => ({
|
84092
84076
|
value: func,
|
84093
|
-
label:
|
84077
|
+
label: ActionFunctionText[func]()
|
84094
84078
|
})),
|
84095
84079
|
"x-reactions": [
|
84096
84080
|
{
|
@@ -84131,7 +84115,6 @@ var getMWANewActionSchema = (extra = {}) => {
|
|
84131
84115
|
var MWAActionFunctionsDevDependencies = {
|
84132
84116
|
[ActionFunction.SSG]: "@modern-js/plugin-ssg",
|
84133
84117
|
[ActionFunction.Test]: "@modern-js/plugin-testing",
|
84134
|
-
[ActionFunction.Storybook]: "@modern-js/plugin-storybook",
|
84135
84118
|
[ActionFunction.StorybookV7]: "@modern-js/storybook",
|
84136
84119
|
[ActionFunction.Proxy]: "@modern-js/plugin-proxy",
|
84137
84120
|
[ActionFunction.TailwindCSS]: "tailwindcss",
|
@@ -84163,7 +84146,6 @@ var MWANewActionGenerators = {
|
|
84163
84146
|
[ActionFunction.BFF]: "@modern-js/bff-generator",
|
84164
84147
|
[ActionFunction.MicroFrontend]: "@modern-js/dependence-generator",
|
84165
84148
|
[ActionFunction.Test]: "@modern-js/test-generator",
|
84166
|
-
[ActionFunction.Storybook]: "@modern-js/dependence-generator",
|
84167
84149
|
[ActionFunction.StorybookV7]: "@modern-js/storybook-next-generator",
|
84168
84150
|
[ActionFunction.SSG]: "@modern-js/ssg-generator",
|
84169
84151
|
[ActionFunction.Polyfill]: "@modern-js/dependence-generator",
|
@@ -84183,7 +84165,6 @@ var MWANewActionPluginName = {
|
|
84183
84165
|
[ActionFunction.BFF]: "bffPlugin",
|
84184
84166
|
[ActionFunction.MicroFrontend]: "garfishPlugin",
|
84185
84167
|
[ActionFunction.Test]: "testingPlugin",
|
84186
|
-
[ActionFunction.Storybook]: "storybookPlugin",
|
84187
84168
|
[ActionFunction.SSG]: "ssgPlugin",
|
84188
84169
|
[ActionFunction.Polyfill]: "polyfillPlugin",
|
84189
84170
|
[ActionFunction.Proxy]: "proxyPlugin",
|
@@ -84202,7 +84183,6 @@ var MWANewActionPluginDependence = {
|
|
84202
84183
|
[ActionFunction.BFF]: "@modern-js/plugin-bff",
|
84203
84184
|
[ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
|
84204
84185
|
[ActionFunction.Test]: "@modern-js/plugin-testing",
|
84205
|
-
[ActionFunction.Storybook]: "@modern-js/plugin-storybook",
|
84206
84186
|
[ActionFunction.SSG]: "@modern-js/plugin-ssg",
|
84207
84187
|
[ActionFunction.Polyfill]: "@modern-js/plugin-polyfill",
|
84208
84188
|
[ActionFunction.Proxy]: "@modern-js/plugin-proxy",
|
@@ -84590,23 +84570,13 @@ function _class_call_check(instance, Constructor) {
|
|
84590
84570
|
throw new TypeError("Cannot call a class as a function");
|
84591
84571
|
}
|
84592
84572
|
|
84593
|
-
// ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/
|
84594
|
-
function
|
84595
|
-
|
84596
|
-
|
84597
|
-
|
84598
|
-
|
84599
|
-
|
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;
|
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;
|
84610
84580
|
}
|
84611
84581
|
|
84612
84582
|
// ../../../../node_modules/.pnpm/@swc+helpers@0.5.3/node_modules/@swc/helpers/esm/_object_spread.js
|
@@ -84741,6 +84711,25 @@ function _to_consumable_array(arr) {
|
|
84741
84711
|
var import_path18 = __toESM(require("path"));
|
84742
84712
|
var import_lodash14 = require("@modern-js/utils/lodash");
|
84743
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
|
+
|
84744
84733
|
// ../../generator-plugin/dist/esm/context/file.js
|
84745
84734
|
var import_path14 = __toESM(require("path"));
|
84746
84735
|
|
@@ -85063,36 +85052,28 @@ var PluginHandlebarsAPI = /* @__PURE__ */ function() {
|
|
85063
85052
|
"use strict";
|
85064
85053
|
function PluginHandlebarsAPI2() {
|
85065
85054
|
_class_call_check(this, PluginHandlebarsAPI2);
|
85066
|
-
|
85067
|
-
|
85068
|
-
}
|
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
|
+
};
|
85069
85076
|
_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
85077
|
{
|
85097
85078
|
key: "method",
|
85098
85079
|
get: function get4() {
|
@@ -85113,14 +85094,10 @@ var PluginEjsAPI = /* @__PURE__ */ function() {
|
|
85113
85094
|
function PluginEjsAPI2() {
|
85114
85095
|
_class_call_check(this, PluginEjsAPI2);
|
85115
85096
|
}
|
85116
|
-
|
85117
|
-
|
85118
|
-
|
85119
|
-
|
85120
|
-
return import_ejs2.default.render(template, data) || "";
|
85121
|
-
}
|
85122
|
-
}
|
85123
|
-
]);
|
85097
|
+
var _proto = PluginEjsAPI2.prototype;
|
85098
|
+
_proto.renderString = function renderString3(template, data) {
|
85099
|
+
return import_ejs2.default.render(template, data) || "";
|
85100
|
+
};
|
85124
85101
|
return PluginEjsAPI2;
|
85125
85102
|
}();
|
85126
85103
|
|
@@ -85136,13 +85113,250 @@ var PluginFileAPI = /* @__PURE__ */ function() {
|
|
85136
85113
|
"use strict";
|
85137
85114
|
function PluginFileAPI2() {
|
85138
85115
|
_class_call_check(this, PluginFileAPI2);
|
85139
|
-
|
85140
|
-
|
85141
|
-
|
85142
|
-
|
85143
|
-
_define_property2(this, "jsonAPI", void 0);
|
85116
|
+
this.projectPath = "";
|
85117
|
+
this.templatePath = "";
|
85118
|
+
this.handlebarAPI = new PluginHandlebarsAPI();
|
85119
|
+
this.ejsAPI = new PluginEjsAPI();
|
85144
85120
|
this.renderString = this.renderString.bind(this);
|
85145
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
|
+
};
|
85146
85360
|
_create_class(PluginFileAPI2, [
|
85147
85361
|
{
|
85148
85362
|
key: "context",
|
@@ -85168,297 +85382,83 @@ var PluginFileAPI = /* @__PURE__ */ function() {
|
|
85168
85382
|
addPartial: this.handlebarAPI.addPartial.bind(this.handlebarAPI)
|
85169
85383
|
};
|
85170
85384
|
}
|
85171
|
-
}
|
85172
|
-
|
85173
|
-
|
85174
|
-
|
85175
|
-
|
85176
|
-
|
85177
|
-
|
85385
|
+
}
|
85386
|
+
]);
|
85387
|
+
return PluginFileAPI2;
|
85388
|
+
}();
|
85389
|
+
|
85390
|
+
// ../../generator-plugin/dist/esm/context/git.js
|
85391
|
+
var PluginGitAPI = /* @__PURE__ */ function() {
|
85392
|
+
"use strict";
|
85393
|
+
function PluginGitAPI2() {
|
85394
|
+
_class_call_check(this, PluginGitAPI2);
|
85395
|
+
this.gitMessage = "";
|
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
|
+
];
|
85178
85431
|
}
|
85179
|
-
|
85180
|
-
|
85181
|
-
|
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
|
+
};
|
85455
|
+
_create_class(PluginGitAPI2, [
|
85182
85456
|
{
|
85183
|
-
key: "
|
85184
|
-
|
85185
|
-
|
85186
|
-
|
85187
|
-
|
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
|
-
};
|
85457
|
+
key: "context",
|
85458
|
+
get: function get4() {
|
85459
|
+
return {
|
85460
|
+
setGitMessage: this.setGitMessage.bind(this)
|
85461
|
+
};
|
85462
85462
|
}
|
85463
85463
|
},
|
85464
85464
|
{
|
@@ -85470,78 +85470,6 @@ var PluginGitAPI = /* @__PURE__ */ function() {
|
|
85470
85470
|
gitAddAndCommit: this.gitAddAndCommit.bind(this)
|
85471
85471
|
};
|
85472
85472
|
}
|
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
85473
|
}
|
85546
85474
|
]);
|
85547
85475
|
return PluginGitAPI2;
|
@@ -85553,20 +85481,163 @@ var PluginInputContext = /* @__PURE__ */ function() {
|
|
85553
85481
|
"use strict";
|
85554
85482
|
function PluginInputContext2(solutionSchema) {
|
85555
85483
|
_class_call_check(this, PluginInputContext2);
|
85556
|
-
|
85557
|
-
|
85558
|
-
|
85559
|
-
|
85560
|
-
_define_property2(this, "extendInputMap", {});
|
85484
|
+
this.inputValue = {};
|
85485
|
+
this.defaultConfig = {};
|
85486
|
+
this.solutionSchema = {};
|
85487
|
+
this.extendInputMap = {};
|
85561
85488
|
this.solutionSchemaFunc = solutionSchema;
|
85562
85489
|
}
|
85563
|
-
|
85564
|
-
|
85565
|
-
|
85566
|
-
|
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
|
-
}
|
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
|
+
};
|
85525
|
+
}
|
85526
|
+
}
|
85527
|
+
} catch (err) {
|
85528
|
+
_didIteratorError = true;
|
85529
|
+
_iteratorError = err;
|
85530
|
+
} finally {
|
85531
|
+
try {
|
85532
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
85533
|
+
_iterator.return();
|
85534
|
+
}
|
85535
|
+
} finally {
|
85536
|
+
if (_didIteratorError) {
|
85537
|
+
throw _iteratorError;
|
85538
|
+
}
|
85539
|
+
}
|
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
|
+
};
|
85557
|
+
}
|
85558
|
+
}
|
85559
|
+
} catch (err) {
|
85560
|
+
_didIteratorError = true;
|
85561
|
+
_iteratorError = err;
|
85562
|
+
} finally {
|
85563
|
+
try {
|
85564
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
85565
|
+
_iterator.return();
|
85566
|
+
}
|
85567
|
+
} finally {
|
85568
|
+
if (_didIteratorError) {
|
85569
|
+
throw _iteratorError;
|
85570
|
+
}
|
85571
|
+
}
|
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
|
+
}
|
85597
|
+
}
|
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
|
+
}
|
85610
|
+
}
|
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, [
|
85570
85641
|
{
|
85571
85642
|
key: "context",
|
85572
85643
|
get: function get4() {
|
@@ -85578,176 +85649,6 @@ var PluginInputContext = /* @__PURE__ */ function() {
|
|
85578
85649
|
setDefaultConfig: this.setDefualtConfig.bind(this)
|
85579
85650
|
};
|
85580
85651
|
}
|
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
85652
|
}
|
85752
85653
|
]);
|
85753
85654
|
return PluginInputContext2;
|
@@ -85758,11 +85659,70 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
|
|
85758
85659
|
"use strict";
|
85759
85660
|
function PluginNpmAPI2(projectPath, packageManager) {
|
85760
85661
|
_class_call_check(this, PluginNpmAPI2);
|
85761
|
-
|
85762
|
-
_define_property2(this, "packageManager", void 0);
|
85662
|
+
this.projectPath = "";
|
85763
85663
|
this.projectPath = projectPath;
|
85764
85664
|
this.packageManager = packageManager;
|
85765
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
|
+
};
|
85766
85726
|
_create_class(PluginNpmAPI2, [
|
85767
85727
|
{
|
85768
85728
|
key: "method",
|
@@ -85771,68 +85731,6 @@ var PluginNpmAPI = /* @__PURE__ */ function() {
|
|
85771
85731
|
install: this.install.bind(this)
|
85772
85732
|
};
|
85773
85733
|
}
|
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
85734
|
}
|
85837
85735
|
]);
|
85838
85736
|
return PluginNpmAPI2;
|
@@ -86165,14 +86063,141 @@ var PluginNewAPI = /* @__PURE__ */ function() {
|
|
86165
86063
|
"use strict";
|
86166
86064
|
function PluginNewAPI2(solution, projectPath, inputData) {
|
86167
86065
|
_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
86066
|
this.solution = solution;
|
86172
86067
|
this.projectPath = projectPath;
|
86173
86068
|
this.inputData = inputData;
|
86174
86069
|
process.setMaxListeners(20);
|
86175
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
|
+
};
|
86176
86201
|
_create_class(PluginNewAPI2, [
|
86177
86202
|
{
|
86178
86203
|
key: "method",
|
@@ -86182,186 +86207,55 @@ var PluginNewAPI = /* @__PURE__ */ function() {
|
|
86182
86207
|
enableFunc: this.enableFunc.bind(this),
|
86183
86208
|
createSubProject: this.createSubProject.bind(this)
|
86184
86209
|
};
|
86185
|
-
}
|
86186
|
-
}
|
86187
|
-
|
86188
|
-
|
86189
|
-
|
86190
|
-
|
86191
|
-
|
86192
|
-
|
86193
|
-
|
86194
|
-
|
86195
|
-
|
86196
|
-
|
86197
|
-
|
86198
|
-
|
86199
|
-
|
86200
|
-
|
86201
|
-
|
86202
|
-
|
86203
|
-
|
86204
|
-
|
86205
|
-
|
86206
|
-
|
86207
|
-
|
86208
|
-
|
86209
|
-
|
86210
|
-
|
86211
|
-
|
86212
|
-
|
86213
|
-
|
86214
|
-
|
86215
|
-
|
86216
|
-
|
86217
|
-
|
86218
|
-
|
86219
|
-
|
86220
|
-
|
86221
|
-
|
86222
|
-
|
86223
|
-
|
86224
|
-
|
86225
|
-
|
86226
|
-
|
86227
|
-
|
86228
|
-
|
86229
|
-
|
86230
|
-
|
86231
|
-
|
86232
|
-
|
86233
|
-
|
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
|
-
});
|
86210
|
+
}
|
86211
|
+
}
|
86212
|
+
]);
|
86213
|
+
return PluginNewAPI2;
|
86214
|
+
}();
|
86215
|
+
|
86216
|
+
// ../../generator-plugin/dist/esm/context/index.js
|
86217
|
+
var LifeCycle2;
|
86218
|
+
(function(LifeCycle22) {
|
86219
|
+
LifeCycle22["OnForged"] = "onForged";
|
86220
|
+
LifeCycle22["AfterForged"] = "afterForged";
|
86221
|
+
})(LifeCycle2 || (LifeCycle2 = {}));
|
86222
|
+
var PluginContext = /* @__PURE__ */ function() {
|
86223
|
+
"use strict";
|
86224
|
+
function PluginContext2(solutionSchema, locale) {
|
86225
|
+
_class_call_check(this, PluginContext2);
|
86226
|
+
var _obj;
|
86227
|
+
this.lifeCycleFuncMap = (_obj = {}, _define_property2(_obj, "onForged", function() {
|
86228
|
+
}), _define_property2(_obj, "afterForged", function() {
|
86229
|
+
}), _obj);
|
86230
|
+
this.inputContext = new PluginInputContext(solutionSchema);
|
86231
|
+
this.gitAPI = new PluginGitAPI();
|
86232
|
+
this.fileAPI = new PluginFileAPI();
|
86233
|
+
this.locale = locale;
|
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
|
+
};
|
86249
|
+
_create_class(PluginContext2, [
|
86250
|
+
{
|
86251
|
+
key: "context",
|
86252
|
+
get: function get4() {
|
86253
|
+
return _object_spread_props(_object_spread({
|
86254
|
+
locale: this.locale
|
86255
|
+
}, this.inputContext.context, this.gitAPI.context, this.fileAPI.context), {
|
86256
|
+
onForged: this.onForged.bind(this),
|
86257
|
+
afterForged: this.afterForged.bind(this)
|
86258
|
+
});
|
86365
86259
|
}
|
86366
86260
|
},
|
86367
86261
|
{
|
@@ -86375,28 +86269,6 @@ var PluginContext = /* @__PURE__ */ function() {
|
|
86375
86269
|
get: function get4() {
|
86376
86270
|
return _object_spread({}, this.gitAPI.method, this.npmAPI.method);
|
86377
86271
|
}
|
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
86272
|
}
|
86401
86273
|
]);
|
86402
86274
|
return PluginContext2;
|
@@ -86564,11 +86436,9 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
86564
86436
|
function GeneratorPlugin2(logger2, event) {
|
86565
86437
|
var locale = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "en";
|
86566
86438
|
_class_call_check(this, GeneratorPlugin2);
|
86567
|
-
|
86568
|
-
|
86569
|
-
|
86570
|
-
_define_property2(this, "event", void 0);
|
86571
|
-
_define_property2(this, "logger", void 0);
|
86439
|
+
this.plugins = [];
|
86440
|
+
this.extendPlugin = {};
|
86441
|
+
this.customPlugin = {};
|
86572
86442
|
this.event = event;
|
86573
86443
|
this.logger = logger2;
|
86574
86444
|
if (event) {
|
@@ -86584,439 +86454,417 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
86584
86454
|
locale
|
86585
86455
|
});
|
86586
86456
|
}
|
86587
|
-
|
86588
|
-
|
86589
|
-
|
86590
|
-
|
86591
|
-
|
86592
|
-
|
86593
|
-
|
86594
|
-
|
86595
|
-
|
86596
|
-
|
86597
|
-
|
86598
|
-
|
86599
|
-
|
86600
|
-
|
86601
|
-
|
86602
|
-
|
86603
|
-
|
86604
|
-
|
86605
|
-
|
86606
|
-
|
86607
|
-
|
86608
|
-
|
86609
|
-
|
86610
|
-
|
86611
|
-
|
86612
|
-
|
86613
|
-
|
86614
|
-
|
86615
|
-
|
86616
|
-
|
86617
|
-
|
86618
|
-
|
86619
|
-
|
86620
|
-
|
86621
|
-
|
86622
|
-
|
86623
|
-
|
86624
|
-
|
86625
|
-
|
86626
|
-
|
86627
|
-
|
86628
|
-
|
86629
|
-
|
86630
|
-
|
86631
|
-
|
86632
|
-
|
86633
|
-
|
86634
|
-
|
86635
|
-
|
86636
|
-
|
86637
|
-
|
86638
|
-
|
86639
|
-
|
86640
|
-
|
86641
|
-
|
86642
|
-
|
86643
|
-
|
86644
|
-
|
86645
|
-
|
86646
|
-
|
86647
|
-
|
86648
|
-
|
86649
|
-
|
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
|
-
];
|
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
|
+
}));
|
86667
86520
|
}
|
86668
|
-
|
86669
|
-
|
86670
|
-
|
86671
|
-
|
86672
|
-
|
86673
|
-
|
86674
|
-
|
86675
|
-
|
86676
|
-
|
86677
|
-
|
86678
|
-
|
86679
|
-
|
86680
|
-
|
86681
|
-
|
86682
|
-
|
86683
|
-
|
86684
|
-
|
86685
|
-
|
86686
|
-
|
86687
|
-
|
86688
|
-
|
86689
|
-
|
86690
|
-
|
86691
|
-
|
86692
|
-
|
86693
|
-
|
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
|
-
}
|
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
|
+
];
|
86708
86548
|
}
|
86709
|
-
|
86710
|
-
|
86711
|
-
|
86712
|
-
|
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());
|
86713
86559
|
}
|
86714
|
-
}
|
86715
|
-
|
86716
|
-
|
86717
|
-
|
86718
|
-
|
86719
|
-
|
86720
|
-
|
86721
|
-
|
86722
|
-
|
86723
|
-
|
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
|
-
}
|
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;
|
86738
86571
|
}
|
86739
|
-
return result;
|
86740
86572
|
}
|
86741
|
-
}
|
86742
|
-
{
|
86743
|
-
|
86744
|
-
|
86745
|
-
|
86746
|
-
|
86747
|
-
|
86748
|
-
|
86749
|
-
|
86750
|
-
|
86751
|
-
|
86752
|
-
|
86753
|
-
|
86754
|
-
|
86755
|
-
|
86756
|
-
|
86757
|
-
|
86758
|
-
|
86759
|
-
|
86760
|
-
|
86761
|
-
|
86762
|
-
|
86763
|
-
|
86764
|
-
|
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;
|
86765
86598
|
}
|
86766
|
-
return result;
|
86767
86599
|
}
|
86768
|
-
}
|
86769
|
-
|
86770
|
-
|
86771
|
-
|
86772
|
-
|
86773
|
-
|
86774
|
-
|
86775
|
-
|
86776
|
-
|
86777
|
-
|
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
|
-
})();
|
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);
|
86825
86610
|
}
|
86826
|
-
}
|
86827
|
-
|
86828
|
-
|
86829
|
-
|
86830
|
-
|
86831
|
-
|
86832
|
-
|
86833
|
-
|
86834
|
-
|
86835
|
-
|
86836
|
-
|
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
|
-
}
|
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;
|
86854
86622
|
}
|
86855
|
-
return result;
|
86856
86623
|
}
|
86857
|
-
}
|
86858
|
-
|
86859
|
-
|
86860
|
-
|
86861
|
-
|
86862
|
-
|
86863
|
-
|
86864
|
-
|
86865
|
-
|
86866
|
-
|
86867
|
-
|
86868
|
-
|
86869
|
-
|
86870
|
-
|
86871
|
-
|
86872
|
-
|
86873
|
-
|
86874
|
-
|
86875
|
-
|
86876
|
-
|
86877
|
-
|
86878
|
-
|
86879
|
-
|
86880
|
-
|
86881
|
-
|
86882
|
-
|
86883
|
-
|
86884
|
-
|
86885
|
-
|
86886
|
-
|
86887
|
-
|
86888
|
-
|
86889
|
-
_state.label = 2;
|
86890
|
-
case 2:
|
86891
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
86892
|
-
return [
|
86893
|
-
3,
|
86894
|
-
5
|
86895
|
-
];
|
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) {
|
86896
86656
|
info = _step.value;
|
86897
|
-
|
86898
|
-
|
86899
|
-
|
86900
|
-
|
86901
|
-
|
86902
|
-
|
86903
|
-
|
86904
|
-
|
86905
|
-
|
86906
|
-
|
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
|
-
}
|
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();
|
87003
86668
|
}
|
87004
|
-
|
87005
|
-
|
87006
|
-
|
87007
|
-
case 16:
|
87008
|
-
if (_this.event) {
|
87009
|
-
_this.event.emit("handle forged success");
|
86669
|
+
} finally {
|
86670
|
+
if (_didIteratorError) {
|
86671
|
+
throw _iteratorError;
|
87010
86672
|
}
|
87011
|
-
|
87012
|
-
2
|
87013
|
-
];
|
86673
|
+
}
|
87014
86674
|
}
|
87015
|
-
|
87016
|
-
|
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
|
+
}
|
87017
86706
|
}
|
87018
86707
|
}
|
87019
|
-
|
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
|
+
};
|
87020
86868
|
return GeneratorPlugin2;
|
87021
86869
|
}();
|
87022
86870
|
|