@modern-js/server-generator 2.4.3 → 2.4.5

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 +131 -63
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -18878,7 +18878,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
18878
18878
  }
18879
18879
  function baseFunctions(object, props) {
18880
18880
  return arrayFilter(props, function(key) {
18881
- return isFunction(object[key]);
18881
+ return isFunction2(object[key]);
18882
18882
  });
18883
18883
  }
18884
18884
  function baseGet(object, path2) {
@@ -19041,7 +19041,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
19041
19041
  if (!isObject5(value) || isMasked(value)) {
19042
19042
  return false;
19043
19043
  }
19044
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
19044
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
19045
19045
  return pattern.test(toSource(value));
19046
19046
  }
19047
19047
  function baseIsRegExp(value) {
@@ -19163,7 +19163,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
19163
19163
  newValue = objValue;
19164
19164
  if (isArguments(objValue)) {
19165
19165
  newValue = toPlainObject(objValue);
19166
- } else if (!isObject5(objValue) || isFunction(objValue)) {
19166
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
19167
19167
  newValue = initCloneObject(srcValue);
19168
19168
  }
19169
19169
  } else {
@@ -20465,7 +20465,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
20465
20465
  function isMasked(func) {
20466
20466
  return !!maskSrcKey && maskSrcKey in func;
20467
20467
  }
20468
- var isMaskable = coreJsData ? isFunction : stubFalse;
20468
+ var isMaskable = coreJsData ? isFunction2 : stubFalse;
20469
20469
  function isPrototype(value) {
20470
20470
  var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
20471
20471
  return value === proto;
@@ -21578,7 +21578,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
21578
21578
  var isArray4 = Array2.isArray;
21579
21579
  var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
21580
21580
  function isArrayLike(value) {
21581
- return value != null && isLength(value.length) && !isFunction(value);
21581
+ return value != null && isLength(value.length) && !isFunction2(value);
21582
21582
  }
21583
21583
  function isArrayLikeObject(value) {
21584
21584
  return isObjectLike(value) && isArrayLike(value);
@@ -21630,7 +21630,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
21630
21630
  function isFinite2(value) {
21631
21631
  return typeof value == "number" && nativeIsFinite(value);
21632
21632
  }
21633
- function isFunction(value) {
21633
+ function isFunction2(value) {
21634
21634
  if (!isObject5(value)) {
21635
21635
  return false;
21636
21636
  }
@@ -21953,7 +21953,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
21953
21953
  index = length;
21954
21954
  value = defaultValue;
21955
21955
  }
21956
- object = isFunction(value) ? value.call(object) : value;
21956
+ object = isFunction2(value) ? value.call(object) : value;
21957
21957
  }
21958
21958
  return object;
21959
21959
  }
@@ -21974,7 +21974,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
21974
21974
  if (isArrLike) {
21975
21975
  accumulator = isArr4 ? new Ctor() : [];
21976
21976
  } else if (isObject5(object)) {
21977
- accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
21977
+ accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
21978
21978
  } else {
21979
21979
  accumulator = {};
21980
21980
  }
@@ -22391,7 +22391,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
22391
22391
  object = this;
22392
22392
  methodNames = baseFunctions(source, keys(source));
22393
22393
  }
22394
- var chain2 = !(isObject5(options3) && "chain" in options3) || !!options3.chain, isFunc = isFunction(object);
22394
+ var chain2 = !(isObject5(options3) && "chain" in options3) || !!options3.chain, isFunc = isFunction2(object);
22395
22395
  arrayEach(methodNames, function(methodName) {
22396
22396
  var func = source[methodName];
22397
22397
  object[methodName] = func;
@@ -22726,7 +22726,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
22726
22726
  lodash.isEqualWith = isEqualWith;
22727
22727
  lodash.isError = isError;
22728
22728
  lodash.isFinite = isFinite2;
22729
- lodash.isFunction = isFunction;
22729
+ lodash.isFunction = isFunction2;
22730
22730
  lodash.isInteger = isInteger;
22731
22731
  lodash.isLength = isLength;
22732
22732
  lodash.isMap = isMap2;
@@ -34599,6 +34599,11 @@ var require_logger = __commonJSMin((exports) => {
34599
34599
  label: "info",
34600
34600
  level: "info"
34601
34601
  },
34602
+ success: {
34603
+ color: "green",
34604
+ label: "Success",
34605
+ level: "info"
34606
+ },
34602
34607
  warn: {
34603
34608
  color: "yellow",
34604
34609
  label: "warn",
@@ -34885,10 +34890,10 @@ var require_type = __commonJSMin((exports) => {
34885
34890
  return Array.isArray(obj);
34886
34891
  }
34887
34892
  exports.isArray = isArray4;
34888
- function isFunction(func) {
34893
+ function isFunction2(func) {
34889
34894
  return typeof func === "function";
34890
34895
  }
34891
- exports.isFunction = isFunction;
34896
+ exports.isFunction = isFunction2;
34892
34897
  function isObject5(obj) {
34893
34898
  return obj !== null && typeof obj === "object";
34894
34899
  }
@@ -37389,7 +37394,7 @@ var init_common3 = __esmMin(() => {
37389
37394
  });
37390
37395
  ActionTypeTextMap = (_ActionTypeTextMap = {}, _defineProperty(_ActionTypeTextMap, ActionType.Element, ActionElementText), _defineProperty(_ActionTypeTextMap, ActionType.Function, ActionFunctionText), _defineProperty(_ActionTypeTextMap, ActionType.Refactor, ActionRefactorText), _ActionTypeTextMap);
37391
37396
  });
37392
- var _MWAActionTypesMap, _MWAActionFunctionsDe, _MWAActionFunctionsDe2, _ActionType$Element, _ActionType$Function, _MWANewActionGenerato, MWAActionTypes, MWAActionFunctions, MWAActionElements, MWAActionReactors, MWAActionTypesMap, MWASpecialSchemaMap, MWANewActionSchema, MWAActionFunctionsDevDependencies, MWAActionFunctionsDependencies, MWAActionFunctionsAppendTypeContent, MWANewActionGenerators;
37397
+ var _MWAActionTypesMap, _MWAActionFunctionsDe, _MWAActionFunctionsDe2, _MWAActionFunctionsAp, _ActionType$Element, _ActionType$Function, _MWANewActionGenerato, MWAActionTypes, MWAActionFunctions, MWAActionElements, MWAActionReactors, MWAActionTypesMap, MWASpecialSchemaMap, MWANewActionSchema, MWAActionFunctionsDevDependencies, MWAActionFunctionsDependencies, MWAActionFunctionsAppendTypeContent, MWANewActionGenerators;
37393
37398
  var init_mwa2 = __esmMin(() => {
37394
37399
  init_defineProperty();
37395
37400
  init_common3();
@@ -37448,7 +37453,7 @@ var init_mwa2 = __esmMin(() => {
37448
37453
  };
37449
37454
  MWAActionFunctionsDevDependencies = (_MWAActionFunctionsDe = {}, _defineProperty(_MWAActionFunctionsDe, ActionFunction.Less, "@modern-js/plugin-less"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.Sass, "@modern-js/plugin-sass"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.SSG, "@modern-js/plugin-ssg"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.Test, "@modern-js/plugin-testing"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.E2ETest, "@modern-js/plugin-e2e"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.Electron, "@modern-js/plugin-electron"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.Storybook, "@modern-js/plugin-storybook"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.Proxy, "@modern-js/plugin-proxy"), _defineProperty(_MWAActionFunctionsDe, ActionFunction.TailwindCSS, "tailwindcss"), _MWAActionFunctionsDe);
37450
37455
  MWAActionFunctionsDependencies = (_MWAActionFunctionsDe2 = {}, _defineProperty(_MWAActionFunctionsDe2, ActionFunction.BFF, "@modern-js/plugin-bff"), _defineProperty(_MWAActionFunctionsDe2, ActionFunction.MicroFrontend, "@modern-js/plugin-garfish"), _defineProperty(_MWAActionFunctionsDe2, ActionFunction.I18n, "@modern-js/plugin-i18n"), _defineProperty(_MWAActionFunctionsDe2, ActionFunction.TailwindCSS, "@modern-js/plugin-tailwindcss"), _defineProperty(_MWAActionFunctionsDe2, ActionFunction.Polyfill, "@modern-js/plugin-polyfill"), _MWAActionFunctionsDe2);
37451
- MWAActionFunctionsAppendTypeContent = _defineProperty({}, ActionFunction.MicroFrontend, "/// <reference types='@modern-js/plugin-garfish/types' />");
37456
+ MWAActionFunctionsAppendTypeContent = (_MWAActionFunctionsAp = {}, _defineProperty(_MWAActionFunctionsAp, ActionFunction.MicroFrontend, "/// <reference types='@modern-js/plugin-garfish/types' />"), _defineProperty(_MWAActionFunctionsAp, ActionFunction.Test, "/// <reference types='@modern-js/plugin-testing/types' />"), _MWAActionFunctionsAp);
37452
37457
  MWANewActionGenerators = (_MWANewActionGenerato = {}, _defineProperty(_MWANewActionGenerato, ActionType.Element, (_ActionType$Element = {}, _defineProperty(_ActionType$Element, ActionElement.Entry, "@modern-js/entry-generator"), _defineProperty(_ActionType$Element, ActionElement.Server, "@modern-js/server-generator"), _ActionType$Element)), _defineProperty(_MWANewActionGenerato, ActionType.Function, (_ActionType$Function = {}, _defineProperty(_ActionType$Function, ActionFunction.TailwindCSS, "@modern-js/tailwindcss-generator"), _defineProperty(_ActionType$Function, ActionFunction.Less, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Sass, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.BFF, "@modern-js/bff-generator"), _defineProperty(_ActionType$Function, ActionFunction.MicroFrontend, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Electron, "@modern-js/electron-generator"), _defineProperty(_ActionType$Function, ActionFunction.I18n, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Test, "@modern-js/test-generator"), _defineProperty(_ActionType$Function, ActionFunction.E2ETest, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Doc, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Storybook, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.SSG, "@modern-js/ssg-generator"), _defineProperty(_ActionType$Function, ActionFunction.Polyfill, "@modern-js/dependence-generator"), _defineProperty(_ActionType$Function, ActionFunction.Proxy, "@modern-js/dependence-generator"), _ActionType$Function)), _defineProperty(_MWANewActionGenerato, ActionType.Refactor, _defineProperty({}, ActionRefactor.BFFToApp, "@modern-js/bff-refactor-generator")), _MWANewActionGenerato);
37453
37458
  });
37454
37459
  var _ModuleActionFunction, _ModuleActionFunction2, _ModuleActionFunction3, _ActionType$Function2, ModuleActionTypes, ModuleActionFunctions, ModuleActionTypesMap, ModuleSpecialSchemaMap, ModuleNewActionSchema, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies, ModuleActionFunctionsDependencies, ModuleNewActionGenerators;
@@ -38010,7 +38015,7 @@ var require_node = __commonJSMin((exports) => {
38010
38015
  const version5 = await getPackageVersion2(packageName, registry2);
38011
38016
  return version5;
38012
38017
  };
38013
- if (!packageName.startsWith("@modern-js")) {
38018
+ if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
38014
38019
  return getLatetPluginVersion();
38015
38020
  }
38016
38021
  const pkgPath = _path.default.join(__require.resolve(_generatorCommon.SolutionToolsMap[solution], {
@@ -67560,10 +67565,10 @@ var require_type2 = __commonJSMin((exports) => {
67560
67565
  return Array.isArray(obj);
67561
67566
  }
67562
67567
  exports.isArray = isArray4;
67563
- function isFunction(func) {
67568
+ function isFunction2(func) {
67564
67569
  return typeof func === "function";
67565
67570
  }
67566
- exports.isFunction = isFunction;
67571
+ exports.isFunction = isFunction2;
67567
67572
  function isObject5(obj) {
67568
67573
  return obj !== null && typeof obj === "object";
67569
67574
  }
@@ -75130,10 +75135,10 @@ var require_util = __commonJSMin((exports) => {
75130
75135
  return objectToString(e) === "[object Error]" || e instanceof Error;
75131
75136
  }
75132
75137
  exports.isError = isError;
75133
- function isFunction(arg) {
75138
+ function isFunction2(arg) {
75134
75139
  return typeof arg === "function";
75135
75140
  }
75136
- exports.isFunction = isFunction;
75141
+ exports.isFunction = isFunction2;
75137
75142
  function isPrimitive(arg) {
75138
75143
  return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
75139
75144
  }
@@ -76411,7 +76416,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76411
76416
  var {
76412
76417
  isArray: isArray4,
76413
76418
  isObject: isObject5,
76414
- isFunction,
76419
+ isFunction: isFunction2,
76415
76420
  isNumber,
76416
76421
  isString: isString3
76417
76422
  } = require_util();
@@ -76538,10 +76543,10 @@ var require_stringify = __commonJSMin((exports, module2) => {
76538
76543
  };
76539
76544
  function stringify(key, holder, gap) {
76540
76545
  let value = holder[key];
76541
- if (isObject5(value) && isFunction(value.toJSON)) {
76546
+ if (isObject5(value) && isFunction2(value.toJSON)) {
76542
76547
  value = value.toJSON(key);
76543
76548
  }
76544
- if (isFunction(replacer)) {
76549
+ if (isFunction2(replacer)) {
76545
76550
  value = replacer.call(holder, key, value);
76546
76551
  }
76547
76552
  switch (typeof value) {
@@ -76576,7 +76581,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76576
76581
  if (!indent_) {
76577
76582
  return JSON.stringify(value, replacer_);
76578
76583
  }
76579
- if (!isFunction(replacer_) && !isArray4(replacer_)) {
76584
+ if (!isFunction2(replacer_) && !isArray4(replacer_)) {
76580
76585
  replacer_ = null;
76581
76586
  }
76582
76587
  replacer = replacer_;
@@ -76699,13 +76704,20 @@ var require_install = __commonJSMin((exports) => {
76699
76704
  }));
76700
76705
  return promise;
76701
76706
  }
76702
- async function npmInstall(cwd, registryUrl) {
76707
+ async function npmInstall({
76708
+ cwd,
76709
+ registryUrl,
76710
+ ignoreScripts
76711
+ }) {
76703
76712
  const canUse = await (0, _env.canUseNpm)();
76704
76713
  if (canUse) {
76705
76714
  const params = ["install"];
76706
76715
  if (registryUrl) {
76707
76716
  params.push(`--registry=${registryUrl}`);
76708
76717
  }
76718
+ if (ignoreScripts) {
76719
+ params.push("--ignore-scripts");
76720
+ }
76709
76721
  return execaWithStreamLog("npm", params, {
76710
76722
  cwd,
76711
76723
  env: process.env
@@ -76713,13 +76725,20 @@ var require_install = __commonJSMin((exports) => {
76713
76725
  }
76714
76726
  throw new Error("please install npm first");
76715
76727
  }
76716
- async function yarnInstall(cwd, registryUrl) {
76728
+ async function yarnInstall({
76729
+ cwd,
76730
+ registryUrl,
76731
+ ignoreScripts
76732
+ }) {
76717
76733
  const canUse = await (0, _env.canUseYarn)();
76718
76734
  if (canUse) {
76719
76735
  const params = ["install"];
76720
76736
  if (registryUrl) {
76721
76737
  params.push(`--registry=${registryUrl}`);
76722
76738
  }
76739
+ if (ignoreScripts) {
76740
+ params.push("--ignore-scripts");
76741
+ }
76723
76742
  return execaWithStreamLog("yarn", params, {
76724
76743
  cwd,
76725
76744
  env: process.env
@@ -76727,13 +76746,20 @@ var require_install = __commonJSMin((exports) => {
76727
76746
  }
76728
76747
  throw new Error("please install yarn first");
76729
76748
  }
76730
- async function pnpmInstall(cwd, registryUrl) {
76749
+ async function pnpmInstall({
76750
+ cwd,
76751
+ registryUrl,
76752
+ ignoreScripts
76753
+ }) {
76731
76754
  const canUse = await (0, _env.canUsePnpm)();
76732
76755
  if (canUse) {
76733
76756
  const params = ["install"];
76734
76757
  if (registryUrl) {
76735
76758
  params.push(`--registry=${registryUrl}`);
76736
76759
  }
76760
+ if (ignoreScripts) {
76761
+ params.push("--ignore-scripts");
76762
+ }
76737
76763
  return execaWithStreamLog("pnpm", params, {
76738
76764
  cwd,
76739
76765
  env: process.env
@@ -76829,14 +76855,38 @@ var require_node2 = __commonJSMin((exports) => {
76829
76855
  _defineProperty2(this, "generatorCore", void 0);
76830
76856
  this.generatorCore = generatorCore;
76831
76857
  }
76832
- npmInstall(cwd = this.generatorCore.outputPath) {
76833
- return (0, _utils.npmInstall)(cwd);
76858
+ npmInstall({
76859
+ cwd,
76860
+ registryUrl,
76861
+ ignoreScripts
76862
+ }) {
76863
+ return (0, _utils.npmInstall)({
76864
+ cwd: cwd || this.generatorCore.outputPath,
76865
+ registryUrl,
76866
+ ignoreScripts
76867
+ });
76834
76868
  }
76835
- yarnInstall(cwd = this.generatorCore.outputPath) {
76836
- return (0, _utils.yarnInstall)(cwd);
76869
+ yarnInstall({
76870
+ cwd,
76871
+ registryUrl,
76872
+ ignoreScripts
76873
+ }) {
76874
+ return (0, _utils.yarnInstall)({
76875
+ cwd: cwd || this.generatorCore.outputPath,
76876
+ registryUrl,
76877
+ ignoreScripts
76878
+ });
76837
76879
  }
76838
- pnpmInstall(cwd = this.generatorCore.outputPath) {
76839
- return (0, _utils.pnpmInstall)(cwd);
76880
+ pnpmInstall({
76881
+ cwd,
76882
+ registryUrl,
76883
+ ignoreScripts
76884
+ }) {
76885
+ return (0, _utils.pnpmInstall)({
76886
+ cwd: cwd || this.generatorCore.outputPath,
76887
+ registryUrl,
76888
+ ignoreScripts
76889
+ });
76840
76890
  }
76841
76891
  };
76842
76892
  exports.NpmAPI = NpmAPI;
@@ -77622,11 +77672,11 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77622
77672
  function isBlob(val) {
77623
77673
  return toString5.call(val) === "[object Blob]";
77624
77674
  }
77625
- function isFunction(val) {
77675
+ function isFunction2(val) {
77626
77676
  return toString5.call(val) === "[object Function]";
77627
77677
  }
77628
77678
  function isStream(val) {
77629
- return isObject5(val) && isFunction(val.pipe);
77679
+ return isObject5(val) && isFunction2(val.pipe);
77630
77680
  }
77631
77681
  function isURLSearchParams(val) {
77632
77682
  return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
@@ -77707,7 +77757,7 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77707
77757
  isDate,
77708
77758
  isFile,
77709
77759
  isBlob,
77710
- isFunction,
77760
+ isFunction: isFunction2,
77711
77761
  isStream,
77712
77762
  isURLSearchParams,
77713
77763
  isStandardBrowserEnv,
@@ -85423,15 +85473,15 @@ var require_utils6 = __commonJSMin((exports) => {
85423
85473
  }
85424
85474
  var toString5 = Object.prototype.toString;
85425
85475
  exports.toString = toString5;
85426
- var isFunction = function isFunction2(value) {
85476
+ var isFunction2 = function isFunction3(value) {
85427
85477
  return typeof value === "function";
85428
85478
  };
85429
- if (isFunction(/x/)) {
85430
- exports.isFunction = isFunction = function(value) {
85479
+ if (isFunction2(/x/)) {
85480
+ exports.isFunction = isFunction2 = function(value) {
85431
85481
  return typeof value === "function" && toString5.call(value) === "[object Function]";
85432
85482
  };
85433
85483
  }
85434
- exports.isFunction = isFunction;
85484
+ exports.isFunction = isFunction2;
85435
85485
  var isArray4 = Array.isArray || function(value) {
85436
85486
  return value && typeof value === "object" ? toString5.call(value) === "[object Array]" : false;
85437
85487
  };
@@ -93498,14 +93548,14 @@ var require_isFunction = __commonJSMin((exports, module2) => {
93498
93548
  var funcTag = "[object Function]";
93499
93549
  var genTag = "[object GeneratorFunction]";
93500
93550
  var proxyTag = "[object Proxy]";
93501
- function isFunction(value) {
93551
+ function isFunction2(value) {
93502
93552
  if (!isObject5(value)) {
93503
93553
  return false;
93504
93554
  }
93505
93555
  var tag = baseGetTag(value);
93506
93556
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
93507
93557
  }
93508
- module2.exports = isFunction;
93558
+ module2.exports = isFunction2;
93509
93559
  });
93510
93560
  var require_coreJsData = __commonJSMin((exports, module2) => {
93511
93561
  var root = require_root();
@@ -93542,7 +93592,7 @@ var require_toSource = __commonJSMin((exports, module2) => {
93542
93592
  module2.exports = toSource;
93543
93593
  });
93544
93594
  var require_baseIsNative = __commonJSMin((exports, module2) => {
93545
- var isFunction = require_isFunction();
93595
+ var isFunction2 = require_isFunction();
93546
93596
  var isMasked = require_isMasked();
93547
93597
  var isObject5 = require_isObject();
93548
93598
  var toSource = require_toSource();
@@ -93557,7 +93607,7 @@ var require_baseIsNative = __commonJSMin((exports, module2) => {
93557
93607
  if (!isObject5(value) || isMasked(value)) {
93558
93608
  return false;
93559
93609
  }
93560
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
93610
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
93561
93611
  return pattern.test(toSource(value));
93562
93612
  }
93563
93613
  module2.exports = baseIsNative;
@@ -93756,10 +93806,10 @@ var require_isLength = __commonJSMin((exports, module2) => {
93756
93806
  module2.exports = isLength;
93757
93807
  });
93758
93808
  var require_isArrayLike = __commonJSMin((exports, module2) => {
93759
- var isFunction = require_isFunction();
93809
+ var isFunction2 = require_isFunction();
93760
93810
  var isLength = require_isLength();
93761
93811
  function isArrayLike(value) {
93762
- return value != null && isLength(value.length) && !isFunction(value);
93812
+ return value != null && isLength(value.length) && !isFunction2(value);
93763
93813
  }
93764
93814
  module2.exports = isArrayLike;
93765
93815
  });
@@ -95672,10 +95722,10 @@ var require_isFunction2 = __commonJSMin((exports) => {
95672
95722
  "use strict";
95673
95723
  Object.defineProperty(exports, "__esModule", { value: true });
95674
95724
  exports.isFunction = void 0;
95675
- function isFunction(value) {
95725
+ function isFunction2(value) {
95676
95726
  return typeof value === "function";
95677
95727
  }
95678
- exports.isFunction = isFunction;
95728
+ exports.isFunction = isFunction2;
95679
95729
  });
95680
95730
  var require_createErrorClass = __commonJSMin((exports) => {
95681
95731
  "use strict";
@@ -129783,7 +129833,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129783
129833
  var isArray4 = require_isArray();
129784
129834
  var isArrayLikeObject = require_isArrayLikeObject();
129785
129835
  var isBuffer = require_isBuffer();
129786
- var isFunction = require_isFunction();
129836
+ var isFunction2 = require_isFunction();
129787
129837
  var isObject5 = require_isObject();
129788
129838
  var isPlainObject = require_isPlainObject();
129789
129839
  var isTypedArray = require_isTypedArray();
@@ -129818,7 +129868,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129818
129868
  newValue = objValue;
129819
129869
  if (isArguments(objValue)) {
129820
129870
  newValue = toPlainObject(objValue);
129821
- } else if (!isObject5(objValue) || isFunction(objValue)) {
129871
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
129822
129872
  newValue = initCloneObject(srcValue);
129823
129873
  }
129824
129874
  } else {
@@ -143778,7 +143828,7 @@ function getQuestionFromSchema(schema) {
143778
143828
  }
143779
143829
  var questions = fields.map(function(field) {
143780
143830
  var _field = properties[field], type = _field.type, title = _field.title, defaultValue = _field["default"], items5 = _field["enum"], fieldValidate = _field["x-validate"], extra = _objectWithoutProperties(_field, _excluded2);
143781
- if (type === "void") {
143831
+ if (type === "void" || type === "object") {
143782
143832
  return getQuestionFromSchema(properties[field], configValue, validateMap, initValue);
143783
143833
  }
143784
143834
  if (type !== "string" && type !== "number") {
@@ -143796,7 +143846,9 @@ function getQuestionFromSchema(schema) {
143796
143846
  break;
143797
143847
  }
143798
143848
  _context.next = 3;
143799
- return validate4(input, fieldValidate);
143849
+ return validate4(input, (0, import_lodash3.isFunction)(fieldValidate) ? {
143850
+ validator: fieldValidate
143851
+ } : fieldValidate);
143800
143852
  case 3:
143801
143853
  _result = _context.sent;
143802
143854
  if (!((_result$error = _result.error) !== null && _result$error !== void 0 && _result$error.length)) {
@@ -144219,10 +144271,12 @@ var init_inquirer = __esmMin(() => {
144219
144271
  });
144220
144272
  var treeshaking_exports4 = {};
144221
144273
  __export2(treeshaking_exports4, {
144222
- CLIReader: () => CLIReader
144274
+ CLIReader: () => CLIReader,
144275
+ validate: () => validate4
144223
144276
  });
144224
144277
  var init_treeshaking4 = __esmMin(() => {
144225
144278
  init_inquirer();
144279
+ init_esm4();
144226
144280
  });
144227
144281
  function getObjKeyMap2(obj) {
144228
144282
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
@@ -144906,7 +144960,7 @@ var require_node9 = __commonJSMin((exports) => {
144906
144960
  }
144907
144961
  return true;
144908
144962
  }
144909
- async runInstall(command) {
144963
+ async runInstall(command, options3) {
144910
144964
  const {
144911
144965
  config: {
144912
144966
  packageManager,
@@ -144920,11 +144974,11 @@ var require_node9 = __commonJSMin((exports) => {
144920
144974
  if (command) {
144921
144975
  intallPromise = (0, _utils.execa)(command);
144922
144976
  } else if (packageManager === "pnpm") {
144923
- intallPromise = this.npmApi.pnpmInstall();
144977
+ intallPromise = this.npmApi.pnpmInstall(options3 || {});
144924
144978
  } else if (packageManager === "yarn") {
144925
- intallPromise = this.npmApi.yarnInstall();
144979
+ intallPromise = this.npmApi.yarnInstall(options3 || {});
144926
144980
  } else {
144927
- intallPromise = this.npmApi.npmInstall();
144981
+ intallPromise = this.npmApi.npmInstall(options3 || {});
144928
144982
  }
144929
144983
  try {
144930
144984
  await intallPromise;
@@ -145017,6 +145071,21 @@ var require_node9 = __commonJSMin((exports) => {
145017
145071
  throw new Error("run sub generator failed");
145018
145072
  }
145019
145073
  }
145074
+ mergeAnswers(answers, configValue) {
145075
+ const inputData = (0, _lodash.merge)(answers, configValue);
145076
+ this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145077
+ return inputData;
145078
+ }
145079
+ async getInputBySchemaFunc(schemaFunc, configValue = {}, validateMap = {}, initValue = {}) {
145080
+ const reader = new _codesmithFormily.CLIReader({
145081
+ schema: schemaFunc(configValue),
145082
+ validateMap,
145083
+ initValue
145084
+ });
145085
+ reader.setAnswers(configValue);
145086
+ const answers = await reader.start();
145087
+ return this.mergeAnswers(answers, configValue);
145088
+ }
145020
145089
  async getInputBySchema(schema, configValue = {}, validateMap = {}, initValue = {}, type = "easy-form") {
145021
145090
  if (type === "easy-form") {
145022
145091
  const reader = new _easyFormCli.CliReader({
@@ -145027,9 +145096,7 @@ var require_node9 = __commonJSMin((exports) => {
145027
145096
  return new Promise((resolve, reject) => {
145028
145097
  reader.startQuestion({
145029
145098
  onComplete: (answers) => {
145030
- const inputData = (0, _lodash.merge)(answers, configValue);
145031
- this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145032
- resolve(inputData);
145099
+ resolve(this.mergeAnswers(answers, configValue));
145033
145100
  },
145034
145101
  onError: (error) => {
145035
145102
  reject(error);
@@ -145043,10 +145110,11 @@ var require_node9 = __commonJSMin((exports) => {
145043
145110
  initValue
145044
145111
  });
145045
145112
  reader.setAnswers(configValue);
145046
- return reader.start();
145113
+ const answers = await reader.start();
145114
+ return this.mergeAnswers(answers, configValue);
145047
145115
  } else {
145048
- const result = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145049
- return _objectSpread(_objectSpread({}, configValue), result);
145116
+ const answers = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145117
+ return this.mergeAnswers(answers, configValue);
145050
145118
  }
145051
145119
  }
145052
145120
  };
@@ -146106,7 +146174,7 @@ var src_default = async (context, generator) => {
146106
146174
  generator.logger.debug(`context=${JSON.stringify(context)}`);
146107
146175
  generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
146108
146176
  await handleTemplateFile(context, generator, appApi);
146109
- await appApi.runInstall();
146177
+ await appApi.runInstall(void 0, { ignoreScripts: true });
146110
146178
  appApi.showSuccessInfo();
146111
146179
  generator.logger.debug(`forge @modern-js/server-generator succeed `);
146112
146180
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.4.3",
14
+ "version": "2.4.5",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./src/index.ts",
17
17
  "main": "./dist/index.js",
@@ -21,13 +21,13 @@
21
21
  ],
22
22
  "devDependencies": {
23
23
  "@babel/runtime": "^7.18.0",
24
- "@modern-js/codesmith": "1.6.1",
25
- "@modern-js/codesmith-api-app": "1.6.1",
26
- "@modern-js/codesmith-api-json": "1.6.1",
27
- "@modern-js/generator-common": "2.4.3",
28
- "@modern-js/generator-utils": "2.4.3",
29
- "@scripts/build": "1.20.0",
30
- "@scripts/jest-config": "1.20.0",
24
+ "@modern-js/codesmith": "1.6.3",
25
+ "@modern-js/codesmith-api-app": "1.6.3",
26
+ "@modern-js/codesmith-api-json": "1.6.3",
27
+ "@modern-js/generator-common": "2.4.5",
28
+ "@modern-js/generator-utils": "2.4.5",
29
+ "@scripts/build": "1.21.0",
30
+ "@scripts/jest-config": "1.21.0",
31
31
  "@types/jest": "^27",
32
32
  "@types/node": "^14",
33
33
  "jest": "^27",