@modern-js/server-generator 2.4.4 → 2.4.6

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 +126 -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;
@@ -34890,10 +34890,10 @@ var require_type = __commonJSMin((exports) => {
34890
34890
  return Array.isArray(obj);
34891
34891
  }
34892
34892
  exports.isArray = isArray4;
34893
- function isFunction(func) {
34893
+ function isFunction2(func) {
34894
34894
  return typeof func === "function";
34895
34895
  }
34896
- exports.isFunction = isFunction;
34896
+ exports.isFunction = isFunction2;
34897
34897
  function isObject5(obj) {
34898
34898
  return obj !== null && typeof obj === "object";
34899
34899
  }
@@ -37394,7 +37394,7 @@ var init_common3 = __esmMin(() => {
37394
37394
  });
37395
37395
  ActionTypeTextMap = (_ActionTypeTextMap = {}, _defineProperty(_ActionTypeTextMap, ActionType.Element, ActionElementText), _defineProperty(_ActionTypeTextMap, ActionType.Function, ActionFunctionText), _defineProperty(_ActionTypeTextMap, ActionType.Refactor, ActionRefactorText), _ActionTypeTextMap);
37396
37396
  });
37397
- 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;
37398
37398
  var init_mwa2 = __esmMin(() => {
37399
37399
  init_defineProperty();
37400
37400
  init_common3();
@@ -37453,7 +37453,7 @@ var init_mwa2 = __esmMin(() => {
37453
37453
  };
37454
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);
37455
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);
37456
- 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);
37457
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);
37458
37458
  });
37459
37459
  var _ModuleActionFunction, _ModuleActionFunction2, _ModuleActionFunction3, _ActionType$Function2, ModuleActionTypes, ModuleActionFunctions, ModuleActionTypesMap, ModuleSpecialSchemaMap, ModuleNewActionSchema, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies, ModuleActionFunctionsDependencies, ModuleNewActionGenerators;
@@ -38015,7 +38015,7 @@ var require_node = __commonJSMin((exports) => {
38015
38015
  const version5 = await getPackageVersion2(packageName, registry2);
38016
38016
  return version5;
38017
38017
  };
38018
- 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")) {
38019
38019
  return getLatetPluginVersion();
38020
38020
  }
38021
38021
  const pkgPath = _path.default.join(__require.resolve(_generatorCommon.SolutionToolsMap[solution], {
@@ -67565,10 +67565,10 @@ var require_type2 = __commonJSMin((exports) => {
67565
67565
  return Array.isArray(obj);
67566
67566
  }
67567
67567
  exports.isArray = isArray4;
67568
- function isFunction(func) {
67568
+ function isFunction2(func) {
67569
67569
  return typeof func === "function";
67570
67570
  }
67571
- exports.isFunction = isFunction;
67571
+ exports.isFunction = isFunction2;
67572
67572
  function isObject5(obj) {
67573
67573
  return obj !== null && typeof obj === "object";
67574
67574
  }
@@ -75135,10 +75135,10 @@ var require_util = __commonJSMin((exports) => {
75135
75135
  return objectToString(e) === "[object Error]" || e instanceof Error;
75136
75136
  }
75137
75137
  exports.isError = isError;
75138
- function isFunction(arg) {
75138
+ function isFunction2(arg) {
75139
75139
  return typeof arg === "function";
75140
75140
  }
75141
- exports.isFunction = isFunction;
75141
+ exports.isFunction = isFunction2;
75142
75142
  function isPrimitive(arg) {
75143
75143
  return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
75144
75144
  }
@@ -76416,7 +76416,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76416
76416
  var {
76417
76417
  isArray: isArray4,
76418
76418
  isObject: isObject5,
76419
- isFunction,
76419
+ isFunction: isFunction2,
76420
76420
  isNumber,
76421
76421
  isString: isString3
76422
76422
  } = require_util();
@@ -76543,10 +76543,10 @@ var require_stringify = __commonJSMin((exports, module2) => {
76543
76543
  };
76544
76544
  function stringify(key, holder, gap) {
76545
76545
  let value = holder[key];
76546
- if (isObject5(value) && isFunction(value.toJSON)) {
76546
+ if (isObject5(value) && isFunction2(value.toJSON)) {
76547
76547
  value = value.toJSON(key);
76548
76548
  }
76549
- if (isFunction(replacer)) {
76549
+ if (isFunction2(replacer)) {
76550
76550
  value = replacer.call(holder, key, value);
76551
76551
  }
76552
76552
  switch (typeof value) {
@@ -76581,7 +76581,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76581
76581
  if (!indent_) {
76582
76582
  return JSON.stringify(value, replacer_);
76583
76583
  }
76584
- if (!isFunction(replacer_) && !isArray4(replacer_)) {
76584
+ if (!isFunction2(replacer_) && !isArray4(replacer_)) {
76585
76585
  replacer_ = null;
76586
76586
  }
76587
76587
  replacer = replacer_;
@@ -76704,13 +76704,20 @@ var require_install = __commonJSMin((exports) => {
76704
76704
  }));
76705
76705
  return promise;
76706
76706
  }
76707
- async function npmInstall(cwd, registryUrl) {
76707
+ async function npmInstall({
76708
+ cwd,
76709
+ registryUrl,
76710
+ ignoreScripts
76711
+ }) {
76708
76712
  const canUse = await (0, _env.canUseNpm)();
76709
76713
  if (canUse) {
76710
76714
  const params = ["install"];
76711
76715
  if (registryUrl) {
76712
76716
  params.push(`--registry=${registryUrl}`);
76713
76717
  }
76718
+ if (ignoreScripts) {
76719
+ params.push("--ignore-scripts");
76720
+ }
76714
76721
  return execaWithStreamLog("npm", params, {
76715
76722
  cwd,
76716
76723
  env: process.env
@@ -76718,13 +76725,20 @@ var require_install = __commonJSMin((exports) => {
76718
76725
  }
76719
76726
  throw new Error("please install npm first");
76720
76727
  }
76721
- async function yarnInstall(cwd, registryUrl) {
76728
+ async function yarnInstall({
76729
+ cwd,
76730
+ registryUrl,
76731
+ ignoreScripts
76732
+ }) {
76722
76733
  const canUse = await (0, _env.canUseYarn)();
76723
76734
  if (canUse) {
76724
76735
  const params = ["install"];
76725
76736
  if (registryUrl) {
76726
76737
  params.push(`--registry=${registryUrl}`);
76727
76738
  }
76739
+ if (ignoreScripts) {
76740
+ params.push("--ignore-scripts");
76741
+ }
76728
76742
  return execaWithStreamLog("yarn", params, {
76729
76743
  cwd,
76730
76744
  env: process.env
@@ -76732,13 +76746,20 @@ var require_install = __commonJSMin((exports) => {
76732
76746
  }
76733
76747
  throw new Error("please install yarn first");
76734
76748
  }
76735
- async function pnpmInstall(cwd, registryUrl) {
76749
+ async function pnpmInstall({
76750
+ cwd,
76751
+ registryUrl,
76752
+ ignoreScripts
76753
+ }) {
76736
76754
  const canUse = await (0, _env.canUsePnpm)();
76737
76755
  if (canUse) {
76738
76756
  const params = ["install"];
76739
76757
  if (registryUrl) {
76740
76758
  params.push(`--registry=${registryUrl}`);
76741
76759
  }
76760
+ if (ignoreScripts) {
76761
+ params.push("--ignore-scripts");
76762
+ }
76742
76763
  return execaWithStreamLog("pnpm", params, {
76743
76764
  cwd,
76744
76765
  env: process.env
@@ -76834,14 +76855,38 @@ var require_node2 = __commonJSMin((exports) => {
76834
76855
  _defineProperty2(this, "generatorCore", void 0);
76835
76856
  this.generatorCore = generatorCore;
76836
76857
  }
76837
- npmInstall(cwd = this.generatorCore.outputPath) {
76838
- 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
+ });
76839
76868
  }
76840
- yarnInstall(cwd = this.generatorCore.outputPath) {
76841
- 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
+ });
76842
76879
  }
76843
- pnpmInstall(cwd = this.generatorCore.outputPath) {
76844
- 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
+ });
76845
76890
  }
76846
76891
  };
76847
76892
  exports.NpmAPI = NpmAPI;
@@ -77627,11 +77672,11 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77627
77672
  function isBlob(val) {
77628
77673
  return toString5.call(val) === "[object Blob]";
77629
77674
  }
77630
- function isFunction(val) {
77675
+ function isFunction2(val) {
77631
77676
  return toString5.call(val) === "[object Function]";
77632
77677
  }
77633
77678
  function isStream(val) {
77634
- return isObject5(val) && isFunction(val.pipe);
77679
+ return isObject5(val) && isFunction2(val.pipe);
77635
77680
  }
77636
77681
  function isURLSearchParams(val) {
77637
77682
  return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
@@ -77712,7 +77757,7 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77712
77757
  isDate,
77713
77758
  isFile,
77714
77759
  isBlob,
77715
- isFunction,
77760
+ isFunction: isFunction2,
77716
77761
  isStream,
77717
77762
  isURLSearchParams,
77718
77763
  isStandardBrowserEnv,
@@ -85428,15 +85473,15 @@ var require_utils6 = __commonJSMin((exports) => {
85428
85473
  }
85429
85474
  var toString5 = Object.prototype.toString;
85430
85475
  exports.toString = toString5;
85431
- var isFunction = function isFunction2(value) {
85476
+ var isFunction2 = function isFunction3(value) {
85432
85477
  return typeof value === "function";
85433
85478
  };
85434
- if (isFunction(/x/)) {
85435
- exports.isFunction = isFunction = function(value) {
85479
+ if (isFunction2(/x/)) {
85480
+ exports.isFunction = isFunction2 = function(value) {
85436
85481
  return typeof value === "function" && toString5.call(value) === "[object Function]";
85437
85482
  };
85438
85483
  }
85439
- exports.isFunction = isFunction;
85484
+ exports.isFunction = isFunction2;
85440
85485
  var isArray4 = Array.isArray || function(value) {
85441
85486
  return value && typeof value === "object" ? toString5.call(value) === "[object Array]" : false;
85442
85487
  };
@@ -93503,14 +93548,14 @@ var require_isFunction = __commonJSMin((exports, module2) => {
93503
93548
  var funcTag = "[object Function]";
93504
93549
  var genTag = "[object GeneratorFunction]";
93505
93550
  var proxyTag = "[object Proxy]";
93506
- function isFunction(value) {
93551
+ function isFunction2(value) {
93507
93552
  if (!isObject5(value)) {
93508
93553
  return false;
93509
93554
  }
93510
93555
  var tag = baseGetTag(value);
93511
93556
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
93512
93557
  }
93513
- module2.exports = isFunction;
93558
+ module2.exports = isFunction2;
93514
93559
  });
93515
93560
  var require_coreJsData = __commonJSMin((exports, module2) => {
93516
93561
  var root = require_root();
@@ -93547,7 +93592,7 @@ var require_toSource = __commonJSMin((exports, module2) => {
93547
93592
  module2.exports = toSource;
93548
93593
  });
93549
93594
  var require_baseIsNative = __commonJSMin((exports, module2) => {
93550
- var isFunction = require_isFunction();
93595
+ var isFunction2 = require_isFunction();
93551
93596
  var isMasked = require_isMasked();
93552
93597
  var isObject5 = require_isObject();
93553
93598
  var toSource = require_toSource();
@@ -93562,7 +93607,7 @@ var require_baseIsNative = __commonJSMin((exports, module2) => {
93562
93607
  if (!isObject5(value) || isMasked(value)) {
93563
93608
  return false;
93564
93609
  }
93565
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
93610
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
93566
93611
  return pattern.test(toSource(value));
93567
93612
  }
93568
93613
  module2.exports = baseIsNative;
@@ -93761,10 +93806,10 @@ var require_isLength = __commonJSMin((exports, module2) => {
93761
93806
  module2.exports = isLength;
93762
93807
  });
93763
93808
  var require_isArrayLike = __commonJSMin((exports, module2) => {
93764
- var isFunction = require_isFunction();
93809
+ var isFunction2 = require_isFunction();
93765
93810
  var isLength = require_isLength();
93766
93811
  function isArrayLike(value) {
93767
- return value != null && isLength(value.length) && !isFunction(value);
93812
+ return value != null && isLength(value.length) && !isFunction2(value);
93768
93813
  }
93769
93814
  module2.exports = isArrayLike;
93770
93815
  });
@@ -95677,10 +95722,10 @@ var require_isFunction2 = __commonJSMin((exports) => {
95677
95722
  "use strict";
95678
95723
  Object.defineProperty(exports, "__esModule", { value: true });
95679
95724
  exports.isFunction = void 0;
95680
- function isFunction(value) {
95725
+ function isFunction2(value) {
95681
95726
  return typeof value === "function";
95682
95727
  }
95683
- exports.isFunction = isFunction;
95728
+ exports.isFunction = isFunction2;
95684
95729
  });
95685
95730
  var require_createErrorClass = __commonJSMin((exports) => {
95686
95731
  "use strict";
@@ -129788,7 +129833,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129788
129833
  var isArray4 = require_isArray();
129789
129834
  var isArrayLikeObject = require_isArrayLikeObject();
129790
129835
  var isBuffer = require_isBuffer();
129791
- var isFunction = require_isFunction();
129836
+ var isFunction2 = require_isFunction();
129792
129837
  var isObject5 = require_isObject();
129793
129838
  var isPlainObject = require_isPlainObject();
129794
129839
  var isTypedArray = require_isTypedArray();
@@ -129823,7 +129868,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129823
129868
  newValue = objValue;
129824
129869
  if (isArguments(objValue)) {
129825
129870
  newValue = toPlainObject(objValue);
129826
- } else if (!isObject5(objValue) || isFunction(objValue)) {
129871
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
129827
129872
  newValue = initCloneObject(srcValue);
129828
129873
  }
129829
129874
  } else {
@@ -143783,7 +143828,7 @@ function getQuestionFromSchema(schema) {
143783
143828
  }
143784
143829
  var questions = fields.map(function(field) {
143785
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);
143786
- if (type === "void") {
143831
+ if (type === "void" || type === "object") {
143787
143832
  return getQuestionFromSchema(properties[field], configValue, validateMap, initValue);
143788
143833
  }
143789
143834
  if (type !== "string" && type !== "number") {
@@ -143801,7 +143846,9 @@ function getQuestionFromSchema(schema) {
143801
143846
  break;
143802
143847
  }
143803
143848
  _context.next = 3;
143804
- return validate4(input, fieldValidate);
143849
+ return validate4(input, (0, import_lodash3.isFunction)(fieldValidate) ? {
143850
+ validator: fieldValidate
143851
+ } : fieldValidate);
143805
143852
  case 3:
143806
143853
  _result = _context.sent;
143807
143854
  if (!((_result$error = _result.error) !== null && _result$error !== void 0 && _result$error.length)) {
@@ -144224,10 +144271,12 @@ var init_inquirer = __esmMin(() => {
144224
144271
  });
144225
144272
  var treeshaking_exports4 = {};
144226
144273
  __export2(treeshaking_exports4, {
144227
- CLIReader: () => CLIReader
144274
+ CLIReader: () => CLIReader,
144275
+ validate: () => validate4
144228
144276
  });
144229
144277
  var init_treeshaking4 = __esmMin(() => {
144230
144278
  init_inquirer();
144279
+ init_esm4();
144231
144280
  });
144232
144281
  function getObjKeyMap2(obj) {
144233
144282
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
@@ -144911,7 +144960,7 @@ var require_node9 = __commonJSMin((exports) => {
144911
144960
  }
144912
144961
  return true;
144913
144962
  }
144914
- async runInstall(command) {
144963
+ async runInstall(command, options3) {
144915
144964
  const {
144916
144965
  config: {
144917
144966
  packageManager,
@@ -144925,11 +144974,11 @@ var require_node9 = __commonJSMin((exports) => {
144925
144974
  if (command) {
144926
144975
  intallPromise = (0, _utils.execa)(command);
144927
144976
  } else if (packageManager === "pnpm") {
144928
- intallPromise = this.npmApi.pnpmInstall();
144977
+ intallPromise = this.npmApi.pnpmInstall(options3 || {});
144929
144978
  } else if (packageManager === "yarn") {
144930
- intallPromise = this.npmApi.yarnInstall();
144979
+ intallPromise = this.npmApi.yarnInstall(options3 || {});
144931
144980
  } else {
144932
- intallPromise = this.npmApi.npmInstall();
144981
+ intallPromise = this.npmApi.npmInstall(options3 || {});
144933
144982
  }
144934
144983
  try {
144935
144984
  await intallPromise;
@@ -145022,6 +145071,21 @@ var require_node9 = __commonJSMin((exports) => {
145022
145071
  throw new Error("run sub generator failed");
145023
145072
  }
145024
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
+ }
145025
145089
  async getInputBySchema(schema, configValue = {}, validateMap = {}, initValue = {}, type = "easy-form") {
145026
145090
  if (type === "easy-form") {
145027
145091
  const reader = new _easyFormCli.CliReader({
@@ -145032,9 +145096,7 @@ var require_node9 = __commonJSMin((exports) => {
145032
145096
  return new Promise((resolve, reject) => {
145033
145097
  reader.startQuestion({
145034
145098
  onComplete: (answers) => {
145035
- const inputData = (0, _lodash.merge)(answers, configValue);
145036
- this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145037
- resolve(inputData);
145099
+ resolve(this.mergeAnswers(answers, configValue));
145038
145100
  },
145039
145101
  onError: (error) => {
145040
145102
  reject(error);
@@ -145048,10 +145110,11 @@ var require_node9 = __commonJSMin((exports) => {
145048
145110
  initValue
145049
145111
  });
145050
145112
  reader.setAnswers(configValue);
145051
- return reader.start();
145113
+ const answers = await reader.start();
145114
+ return this.mergeAnswers(answers, configValue);
145052
145115
  } else {
145053
- const result = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145054
- 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);
145055
145118
  }
145056
145119
  }
145057
145120
  };
@@ -146111,7 +146174,7 @@ var src_default = async (context, generator) => {
146111
146174
  generator.logger.debug(`context=${JSON.stringify(context)}`);
146112
146175
  generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
146113
146176
  await handleTemplateFile(context, generator, appApi);
146114
- await appApi.runInstall();
146177
+ await appApi.runInstall(void 0, { ignoreScripts: true });
146115
146178
  appApi.showSuccessInfo();
146116
146179
  generator.logger.debug(`forge @modern-js/server-generator succeed `);
146117
146180
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.4.4",
14
+ "version": "2.4.6",
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.4",
28
- "@modern-js/generator-utils": "2.4.4",
29
- "@scripts/build": "1.20.1",
30
- "@scripts/jest-config": "1.20.1",
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.6",
28
+ "@modern-js/generator-utils": "2.4.6",
29
+ "@scripts/build": "1.21.1",
30
+ "@scripts/jest-config": "1.21.1",
31
31
  "@types/jest": "^27",
32
32
  "@types/node": "^14",
33
33
  "jest": "^27",