@modern-js/entry-generator 2.4.4 → 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 +125 -62
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1336,7 +1336,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
1336
1336
  }
1337
1337
  function baseFunctions(object, props) {
1338
1338
  return arrayFilter(props, function(key) {
1339
- return isFunction(object[key]);
1339
+ return isFunction2(object[key]);
1340
1340
  });
1341
1341
  }
1342
1342
  function baseGet(object, path3) {
@@ -1499,7 +1499,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
1499
1499
  if (!isObject5(value) || isMasked(value)) {
1500
1500
  return false;
1501
1501
  }
1502
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1502
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
1503
1503
  return pattern.test(toSource(value));
1504
1504
  }
1505
1505
  function baseIsRegExp(value) {
@@ -1621,7 +1621,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
1621
1621
  newValue = objValue;
1622
1622
  if (isArguments(objValue)) {
1623
1623
  newValue = toPlainObject(objValue);
1624
- } else if (!isObject5(objValue) || isFunction(objValue)) {
1624
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
1625
1625
  newValue = initCloneObject(srcValue);
1626
1626
  }
1627
1627
  } else {
@@ -2923,7 +2923,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
2923
2923
  function isMasked(func) {
2924
2924
  return !!maskSrcKey && maskSrcKey in func;
2925
2925
  }
2926
- var isMaskable = coreJsData ? isFunction : stubFalse;
2926
+ var isMaskable = coreJsData ? isFunction2 : stubFalse;
2927
2927
  function isPrototype(value) {
2928
2928
  var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
2929
2929
  return value === proto;
@@ -4036,7 +4036,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
4036
4036
  var isArray4 = Array2.isArray;
4037
4037
  var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
4038
4038
  function isArrayLike(value) {
4039
- return value != null && isLength(value.length) && !isFunction(value);
4039
+ return value != null && isLength(value.length) && !isFunction2(value);
4040
4040
  }
4041
4041
  function isArrayLikeObject(value) {
4042
4042
  return isObjectLike(value) && isArrayLike(value);
@@ -4088,7 +4088,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
4088
4088
  function isFinite2(value) {
4089
4089
  return typeof value == "number" && nativeIsFinite(value);
4090
4090
  }
4091
- function isFunction(value) {
4091
+ function isFunction2(value) {
4092
4092
  if (!isObject5(value)) {
4093
4093
  return false;
4094
4094
  }
@@ -4411,7 +4411,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
4411
4411
  index = length;
4412
4412
  value = defaultValue;
4413
4413
  }
4414
- object = isFunction(value) ? value.call(object) : value;
4414
+ object = isFunction2(value) ? value.call(object) : value;
4415
4415
  }
4416
4416
  return object;
4417
4417
  }
@@ -4432,7 +4432,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
4432
4432
  if (isArrLike) {
4433
4433
  accumulator = isArr4 ? new Ctor() : [];
4434
4434
  } else if (isObject5(object)) {
4435
- accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
4435
+ accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
4436
4436
  } else {
4437
4437
  accumulator = {};
4438
4438
  }
@@ -4849,7 +4849,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
4849
4849
  object = this;
4850
4850
  methodNames = baseFunctions(source, keys(source));
4851
4851
  }
4852
- var chain2 = !(isObject5(options3) && "chain" in options3) || !!options3.chain, isFunc = isFunction(object);
4852
+ var chain2 = !(isObject5(options3) && "chain" in options3) || !!options3.chain, isFunc = isFunction2(object);
4853
4853
  arrayEach(methodNames, function(methodName) {
4854
4854
  var func = source[methodName];
4855
4855
  object[methodName] = func;
@@ -5184,7 +5184,7 @@ var require_lodash = __commonJSMin((exports, module2) => {
5184
5184
  lodash.isEqualWith = isEqualWith;
5185
5185
  lodash.isError = isError;
5186
5186
  lodash.isFinite = isFinite2;
5187
- lodash.isFunction = isFunction;
5187
+ lodash.isFunction = isFunction2;
5188
5188
  lodash.isInteger = isInteger;
5189
5189
  lodash.isLength = isLength;
5190
5190
  lodash.isMap = isMap2;
@@ -34892,10 +34892,10 @@ var require_type = __commonJSMin((exports) => {
34892
34892
  return Array.isArray(obj);
34893
34893
  }
34894
34894
  exports.isArray = isArray4;
34895
- function isFunction(func) {
34895
+ function isFunction2(func) {
34896
34896
  return typeof func === "function";
34897
34897
  }
34898
- exports.isFunction = isFunction;
34898
+ exports.isFunction = isFunction2;
34899
34899
  function isObject5(obj) {
34900
34900
  return obj !== null && typeof obj === "object";
34901
34901
  }
@@ -37396,7 +37396,7 @@ var init_common3 = __esmMin(() => {
37396
37396
  });
37397
37397
  ActionTypeTextMap = (_ActionTypeTextMap = {}, _defineProperty(_ActionTypeTextMap, ActionType.Element, ActionElementText), _defineProperty(_ActionTypeTextMap, ActionType.Function, ActionFunctionText), _defineProperty(_ActionTypeTextMap, ActionType.Refactor, ActionRefactorText), _ActionTypeTextMap);
37398
37398
  });
37399
- var _MWAActionTypesMap, _MWAActionFunctionsDe, _MWAActionFunctionsDe2, _ActionType$Element, _ActionType$Function, _MWANewActionGenerato, MWAActionTypes, MWAActionFunctions, MWAActionElements, MWAActionReactors, MWAActionTypesMap, MWASpecialSchemaMap, MWANewActionSchema, MWAActionFunctionsDevDependencies, MWAActionFunctionsDependencies, MWAActionFunctionsAppendTypeContent, MWANewActionGenerators;
37399
+ var _MWAActionTypesMap, _MWAActionFunctionsDe, _MWAActionFunctionsDe2, _MWAActionFunctionsAp, _ActionType$Element, _ActionType$Function, _MWANewActionGenerato, MWAActionTypes, MWAActionFunctions, MWAActionElements, MWAActionReactors, MWAActionTypesMap, MWASpecialSchemaMap, MWANewActionSchema, MWAActionFunctionsDevDependencies, MWAActionFunctionsDependencies, MWAActionFunctionsAppendTypeContent, MWANewActionGenerators;
37400
37400
  var init_mwa2 = __esmMin(() => {
37401
37401
  init_defineProperty();
37402
37402
  init_common3();
@@ -37455,7 +37455,7 @@ var init_mwa2 = __esmMin(() => {
37455
37455
  };
37456
37456
  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);
37457
37457
  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);
37458
- MWAActionFunctionsAppendTypeContent = _defineProperty({}, ActionFunction.MicroFrontend, "/// <reference types='@modern-js/plugin-garfish/types' />");
37458
+ 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);
37459
37459
  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);
37460
37460
  });
37461
37461
  var _ModuleActionFunction, _ModuleActionFunction2, _ModuleActionFunction3, _ActionType$Function2, ModuleActionTypes, ModuleActionFunctions, ModuleActionTypesMap, ModuleSpecialSchemaMap, ModuleNewActionSchema, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies, ModuleActionFunctionsDependencies, ModuleNewActionGenerators;
@@ -38017,7 +38017,7 @@ var require_node = __commonJSMin((exports) => {
38017
38017
  const version5 = await getPackageVersion(packageName, registry2);
38018
38018
  return version5;
38019
38019
  };
38020
- if (!packageName.startsWith("@modern-js")) {
38020
+ if (!packageName.startsWith("@modern-js") || packageName.includes("electron") || packageName.includes("codesmith") || packageName.includes("easy-form") || packageName.startsWith("@modern-js-reduck")) {
38021
38021
  return getLatetPluginVersion();
38022
38022
  }
38023
38023
  const pkgPath = _path.default.join(__require.resolve(_generatorCommon.SolutionToolsMap[solution], {
@@ -67567,10 +67567,10 @@ var require_type2 = __commonJSMin((exports) => {
67567
67567
  return Array.isArray(obj);
67568
67568
  }
67569
67569
  exports.isArray = isArray4;
67570
- function isFunction(func) {
67570
+ function isFunction2(func) {
67571
67571
  return typeof func === "function";
67572
67572
  }
67573
- exports.isFunction = isFunction;
67573
+ exports.isFunction = isFunction2;
67574
67574
  function isObject5(obj) {
67575
67575
  return obj !== null && typeof obj === "object";
67576
67576
  }
@@ -75137,10 +75137,10 @@ var require_util = __commonJSMin((exports) => {
75137
75137
  return objectToString(e) === "[object Error]" || e instanceof Error;
75138
75138
  }
75139
75139
  exports.isError = isError;
75140
- function isFunction(arg) {
75140
+ function isFunction2(arg) {
75141
75141
  return typeof arg === "function";
75142
75142
  }
75143
- exports.isFunction = isFunction;
75143
+ exports.isFunction = isFunction2;
75144
75144
  function isPrimitive(arg) {
75145
75145
  return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
75146
75146
  }
@@ -76418,7 +76418,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76418
76418
  var {
76419
76419
  isArray: isArray4,
76420
76420
  isObject: isObject5,
76421
- isFunction,
76421
+ isFunction: isFunction2,
76422
76422
  isNumber,
76423
76423
  isString: isString3
76424
76424
  } = require_util();
@@ -76545,10 +76545,10 @@ var require_stringify = __commonJSMin((exports, module2) => {
76545
76545
  };
76546
76546
  function stringify(key, holder, gap) {
76547
76547
  let value = holder[key];
76548
- if (isObject5(value) && isFunction(value.toJSON)) {
76548
+ if (isObject5(value) && isFunction2(value.toJSON)) {
76549
76549
  value = value.toJSON(key);
76550
76550
  }
76551
- if (isFunction(replacer)) {
76551
+ if (isFunction2(replacer)) {
76552
76552
  value = replacer.call(holder, key, value);
76553
76553
  }
76554
76554
  switch (typeof value) {
@@ -76583,7 +76583,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76583
76583
  if (!indent_) {
76584
76584
  return JSON.stringify(value, replacer_);
76585
76585
  }
76586
- if (!isFunction(replacer_) && !isArray4(replacer_)) {
76586
+ if (!isFunction2(replacer_) && !isArray4(replacer_)) {
76587
76587
  replacer_ = null;
76588
76588
  }
76589
76589
  replacer = replacer_;
@@ -76706,13 +76706,20 @@ var require_install = __commonJSMin((exports) => {
76706
76706
  }));
76707
76707
  return promise;
76708
76708
  }
76709
- async function npmInstall(cwd, registryUrl) {
76709
+ async function npmInstall({
76710
+ cwd,
76711
+ registryUrl,
76712
+ ignoreScripts
76713
+ }) {
76710
76714
  const canUse = await (0, _env.canUseNpm)();
76711
76715
  if (canUse) {
76712
76716
  const params = ["install"];
76713
76717
  if (registryUrl) {
76714
76718
  params.push(`--registry=${registryUrl}`);
76715
76719
  }
76720
+ if (ignoreScripts) {
76721
+ params.push("--ignore-scripts");
76722
+ }
76716
76723
  return execaWithStreamLog("npm", params, {
76717
76724
  cwd,
76718
76725
  env: process.env
@@ -76720,13 +76727,20 @@ var require_install = __commonJSMin((exports) => {
76720
76727
  }
76721
76728
  throw new Error("please install npm first");
76722
76729
  }
76723
- async function yarnInstall(cwd, registryUrl) {
76730
+ async function yarnInstall({
76731
+ cwd,
76732
+ registryUrl,
76733
+ ignoreScripts
76734
+ }) {
76724
76735
  const canUse = await (0, _env.canUseYarn)();
76725
76736
  if (canUse) {
76726
76737
  const params = ["install"];
76727
76738
  if (registryUrl) {
76728
76739
  params.push(`--registry=${registryUrl}`);
76729
76740
  }
76741
+ if (ignoreScripts) {
76742
+ params.push("--ignore-scripts");
76743
+ }
76730
76744
  return execaWithStreamLog("yarn", params, {
76731
76745
  cwd,
76732
76746
  env: process.env
@@ -76734,13 +76748,20 @@ var require_install = __commonJSMin((exports) => {
76734
76748
  }
76735
76749
  throw new Error("please install yarn first");
76736
76750
  }
76737
- async function pnpmInstall(cwd, registryUrl) {
76751
+ async function pnpmInstall({
76752
+ cwd,
76753
+ registryUrl,
76754
+ ignoreScripts
76755
+ }) {
76738
76756
  const canUse = await (0, _env.canUsePnpm)();
76739
76757
  if (canUse) {
76740
76758
  const params = ["install"];
76741
76759
  if (registryUrl) {
76742
76760
  params.push(`--registry=${registryUrl}`);
76743
76761
  }
76762
+ if (ignoreScripts) {
76763
+ params.push("--ignore-scripts");
76764
+ }
76744
76765
  return execaWithStreamLog("pnpm", params, {
76745
76766
  cwd,
76746
76767
  env: process.env
@@ -76836,14 +76857,38 @@ var require_node2 = __commonJSMin((exports) => {
76836
76857
  _defineProperty2(this, "generatorCore", void 0);
76837
76858
  this.generatorCore = generatorCore;
76838
76859
  }
76839
- npmInstall(cwd = this.generatorCore.outputPath) {
76840
- return (0, _utils.npmInstall)(cwd);
76860
+ npmInstall({
76861
+ cwd,
76862
+ registryUrl,
76863
+ ignoreScripts
76864
+ }) {
76865
+ return (0, _utils.npmInstall)({
76866
+ cwd: cwd || this.generatorCore.outputPath,
76867
+ registryUrl,
76868
+ ignoreScripts
76869
+ });
76841
76870
  }
76842
- yarnInstall(cwd = this.generatorCore.outputPath) {
76843
- return (0, _utils.yarnInstall)(cwd);
76871
+ yarnInstall({
76872
+ cwd,
76873
+ registryUrl,
76874
+ ignoreScripts
76875
+ }) {
76876
+ return (0, _utils.yarnInstall)({
76877
+ cwd: cwd || this.generatorCore.outputPath,
76878
+ registryUrl,
76879
+ ignoreScripts
76880
+ });
76844
76881
  }
76845
- pnpmInstall(cwd = this.generatorCore.outputPath) {
76846
- return (0, _utils.pnpmInstall)(cwd);
76882
+ pnpmInstall({
76883
+ cwd,
76884
+ registryUrl,
76885
+ ignoreScripts
76886
+ }) {
76887
+ return (0, _utils.pnpmInstall)({
76888
+ cwd: cwd || this.generatorCore.outputPath,
76889
+ registryUrl,
76890
+ ignoreScripts
76891
+ });
76847
76892
  }
76848
76893
  };
76849
76894
  exports.NpmAPI = NpmAPI;
@@ -77629,11 +77674,11 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77629
77674
  function isBlob(val) {
77630
77675
  return toString5.call(val) === "[object Blob]";
77631
77676
  }
77632
- function isFunction(val) {
77677
+ function isFunction2(val) {
77633
77678
  return toString5.call(val) === "[object Function]";
77634
77679
  }
77635
77680
  function isStream(val) {
77636
- return isObject5(val) && isFunction(val.pipe);
77681
+ return isObject5(val) && isFunction2(val.pipe);
77637
77682
  }
77638
77683
  function isURLSearchParams(val) {
77639
77684
  return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
@@ -77714,7 +77759,7 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77714
77759
  isDate,
77715
77760
  isFile,
77716
77761
  isBlob,
77717
- isFunction,
77762
+ isFunction: isFunction2,
77718
77763
  isStream,
77719
77764
  isURLSearchParams,
77720
77765
  isStandardBrowserEnv,
@@ -85430,15 +85475,15 @@ var require_utils6 = __commonJSMin((exports) => {
85430
85475
  }
85431
85476
  var toString5 = Object.prototype.toString;
85432
85477
  exports.toString = toString5;
85433
- var isFunction = function isFunction2(value) {
85478
+ var isFunction2 = function isFunction3(value) {
85434
85479
  return typeof value === "function";
85435
85480
  };
85436
- if (isFunction(/x/)) {
85437
- exports.isFunction = isFunction = function(value) {
85481
+ if (isFunction2(/x/)) {
85482
+ exports.isFunction = isFunction2 = function(value) {
85438
85483
  return typeof value === "function" && toString5.call(value) === "[object Function]";
85439
85484
  };
85440
85485
  }
85441
- exports.isFunction = isFunction;
85486
+ exports.isFunction = isFunction2;
85442
85487
  var isArray4 = Array.isArray || function(value) {
85443
85488
  return value && typeof value === "object" ? toString5.call(value) === "[object Array]" : false;
85444
85489
  };
@@ -93505,14 +93550,14 @@ var require_isFunction = __commonJSMin((exports, module2) => {
93505
93550
  var funcTag = "[object Function]";
93506
93551
  var genTag = "[object GeneratorFunction]";
93507
93552
  var proxyTag = "[object Proxy]";
93508
- function isFunction(value) {
93553
+ function isFunction2(value) {
93509
93554
  if (!isObject5(value)) {
93510
93555
  return false;
93511
93556
  }
93512
93557
  var tag = baseGetTag(value);
93513
93558
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
93514
93559
  }
93515
- module2.exports = isFunction;
93560
+ module2.exports = isFunction2;
93516
93561
  });
93517
93562
  var require_coreJsData = __commonJSMin((exports, module2) => {
93518
93563
  var root = require_root();
@@ -93549,7 +93594,7 @@ var require_toSource = __commonJSMin((exports, module2) => {
93549
93594
  module2.exports = toSource;
93550
93595
  });
93551
93596
  var require_baseIsNative = __commonJSMin((exports, module2) => {
93552
- var isFunction = require_isFunction();
93597
+ var isFunction2 = require_isFunction();
93553
93598
  var isMasked = require_isMasked();
93554
93599
  var isObject5 = require_isObject();
93555
93600
  var toSource = require_toSource();
@@ -93564,7 +93609,7 @@ var require_baseIsNative = __commonJSMin((exports, module2) => {
93564
93609
  if (!isObject5(value) || isMasked(value)) {
93565
93610
  return false;
93566
93611
  }
93567
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
93612
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
93568
93613
  return pattern.test(toSource(value));
93569
93614
  }
93570
93615
  module2.exports = baseIsNative;
@@ -93763,10 +93808,10 @@ var require_isLength = __commonJSMin((exports, module2) => {
93763
93808
  module2.exports = isLength;
93764
93809
  });
93765
93810
  var require_isArrayLike = __commonJSMin((exports, module2) => {
93766
- var isFunction = require_isFunction();
93811
+ var isFunction2 = require_isFunction();
93767
93812
  var isLength = require_isLength();
93768
93813
  function isArrayLike(value) {
93769
- return value != null && isLength(value.length) && !isFunction(value);
93814
+ return value != null && isLength(value.length) && !isFunction2(value);
93770
93815
  }
93771
93816
  module2.exports = isArrayLike;
93772
93817
  });
@@ -95679,10 +95724,10 @@ var require_isFunction2 = __commonJSMin((exports) => {
95679
95724
  "use strict";
95680
95725
  Object.defineProperty(exports, "__esModule", { value: true });
95681
95726
  exports.isFunction = void 0;
95682
- function isFunction(value) {
95727
+ function isFunction2(value) {
95683
95728
  return typeof value === "function";
95684
95729
  }
95685
- exports.isFunction = isFunction;
95730
+ exports.isFunction = isFunction2;
95686
95731
  });
95687
95732
  var require_createErrorClass = __commonJSMin((exports) => {
95688
95733
  "use strict";
@@ -129790,7 +129835,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129790
129835
  var isArray4 = require_isArray();
129791
129836
  var isArrayLikeObject = require_isArrayLikeObject();
129792
129837
  var isBuffer = require_isBuffer();
129793
- var isFunction = require_isFunction();
129838
+ var isFunction2 = require_isFunction();
129794
129839
  var isObject5 = require_isObject();
129795
129840
  var isPlainObject = require_isPlainObject();
129796
129841
  var isTypedArray = require_isTypedArray();
@@ -129825,7 +129870,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129825
129870
  newValue = objValue;
129826
129871
  if (isArguments(objValue)) {
129827
129872
  newValue = toPlainObject(objValue);
129828
- } else if (!isObject5(objValue) || isFunction(objValue)) {
129873
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
129829
129874
  newValue = initCloneObject(srcValue);
129830
129875
  }
129831
129876
  } else {
@@ -143785,7 +143830,7 @@ function getQuestionFromSchema(schema) {
143785
143830
  }
143786
143831
  var questions = fields.map(function(field) {
143787
143832
  var _field = properties[field], type = _field.type, title = _field.title, defaultValue = _field["default"], items5 = _field["enum"], fieldValidate = _field["x-validate"], extra = _objectWithoutProperties(_field, _excluded2);
143788
- if (type === "void") {
143833
+ if (type === "void" || type === "object") {
143789
143834
  return getQuestionFromSchema(properties[field], configValue, validateMap, initValue);
143790
143835
  }
143791
143836
  if (type !== "string" && type !== "number") {
@@ -143803,7 +143848,9 @@ function getQuestionFromSchema(schema) {
143803
143848
  break;
143804
143849
  }
143805
143850
  _context.next = 3;
143806
- return validate4(input, fieldValidate);
143851
+ return validate4(input, (0, import_lodash3.isFunction)(fieldValidate) ? {
143852
+ validator: fieldValidate
143853
+ } : fieldValidate);
143807
143854
  case 3:
143808
143855
  _result = _context.sent;
143809
143856
  if (!((_result$error = _result.error) !== null && _result$error !== void 0 && _result$error.length)) {
@@ -144226,10 +144273,12 @@ var init_inquirer = __esmMin(() => {
144226
144273
  });
144227
144274
  var treeshaking_exports4 = {};
144228
144275
  __export2(treeshaking_exports4, {
144229
- CLIReader: () => CLIReader
144276
+ CLIReader: () => CLIReader,
144277
+ validate: () => validate4
144230
144278
  });
144231
144279
  var init_treeshaking4 = __esmMin(() => {
144232
144280
  init_inquirer();
144281
+ init_esm4();
144233
144282
  });
144234
144283
  function getObjKeyMap2(obj) {
144235
144284
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
@@ -144913,7 +144962,7 @@ var require_node9 = __commonJSMin((exports) => {
144913
144962
  }
144914
144963
  return true;
144915
144964
  }
144916
- async runInstall(command) {
144965
+ async runInstall(command, options3) {
144917
144966
  const {
144918
144967
  config: {
144919
144968
  packageManager,
@@ -144927,11 +144976,11 @@ var require_node9 = __commonJSMin((exports) => {
144927
144976
  if (command) {
144928
144977
  intallPromise = (0, _utils.execa)(command);
144929
144978
  } else if (packageManager === "pnpm") {
144930
- intallPromise = this.npmApi.pnpmInstall();
144979
+ intallPromise = this.npmApi.pnpmInstall(options3 || {});
144931
144980
  } else if (packageManager === "yarn") {
144932
- intallPromise = this.npmApi.yarnInstall();
144981
+ intallPromise = this.npmApi.yarnInstall(options3 || {});
144933
144982
  } else {
144934
- intallPromise = this.npmApi.npmInstall();
144983
+ intallPromise = this.npmApi.npmInstall(options3 || {});
144935
144984
  }
144936
144985
  try {
144937
144986
  await intallPromise;
@@ -145024,6 +145073,21 @@ var require_node9 = __commonJSMin((exports) => {
145024
145073
  throw new Error("run sub generator failed");
145025
145074
  }
145026
145075
  }
145076
+ mergeAnswers(answers, configValue) {
145077
+ const inputData = (0, _lodash.merge)(answers, configValue);
145078
+ this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145079
+ return inputData;
145080
+ }
145081
+ async getInputBySchemaFunc(schemaFunc, configValue = {}, validateMap = {}, initValue = {}) {
145082
+ const reader = new _codesmithFormily.CLIReader({
145083
+ schema: schemaFunc(configValue),
145084
+ validateMap,
145085
+ initValue
145086
+ });
145087
+ reader.setAnswers(configValue);
145088
+ const answers = await reader.start();
145089
+ return this.mergeAnswers(answers, configValue);
145090
+ }
145027
145091
  async getInputBySchema(schema, configValue = {}, validateMap = {}, initValue = {}, type = "easy-form") {
145028
145092
  if (type === "easy-form") {
145029
145093
  const reader = new _easyFormCli.CliReader({
@@ -145034,9 +145098,7 @@ var require_node9 = __commonJSMin((exports) => {
145034
145098
  return new Promise((resolve, reject) => {
145035
145099
  reader.startQuestion({
145036
145100
  onComplete: (answers) => {
145037
- const inputData = (0, _lodash.merge)(answers, configValue);
145038
- this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145039
- resolve(inputData);
145101
+ resolve(this.mergeAnswers(answers, configValue));
145040
145102
  },
145041
145103
  onError: (error) => {
145042
145104
  reject(error);
@@ -145050,10 +145112,11 @@ var require_node9 = __commonJSMin((exports) => {
145050
145112
  initValue
145051
145113
  });
145052
145114
  reader.setAnswers(configValue);
145053
- return reader.start();
145115
+ const answers = await reader.start();
145116
+ return this.mergeAnswers(answers, configValue);
145054
145117
  } else {
145055
- const result = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145056
- return _objectSpread(_objectSpread({}, configValue), result);
145118
+ const answers = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145119
+ return this.mergeAnswers(answers, configValue);
145057
145120
  }
145058
145121
  }
145059
145122
  };
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.5",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "main": "./dist/index.js",
17
17
  "files": [
@@ -20,15 +20,15 @@
20
20
  ],
21
21
  "devDependencies": {
22
22
  "@babel/runtime": "^7.18.0",
23
- "@modern-js/codesmith": "1.6.1",
24
- "@modern-js/codesmith-api-app": "1.6.1",
25
- "@modern-js/codesmith-api-handlebars": "1.6.1",
26
- "@modern-js/generator-common": "2.4.4",
27
- "@modern-js/generator-utils": "2.4.4",
28
- "@modern-js/plugin-i18n": "1.20.1",
29
- "@modern-js/utils": "1.20.1",
30
- "@scripts/build": "1.20.1",
31
- "@scripts/jest-config": "1.20.1",
23
+ "@modern-js/codesmith": "1.6.3",
24
+ "@modern-js/codesmith-api-app": "1.6.3",
25
+ "@modern-js/codesmith-api-handlebars": "1.6.3",
26
+ "@modern-js/generator-common": "2.4.5",
27
+ "@modern-js/generator-utils": "2.4.5",
28
+ "@modern-js/plugin-i18n": "1.21.0",
29
+ "@modern-js/utils": "1.21.0",
30
+ "@scripts/build": "1.21.0",
31
+ "@scripts/jest-config": "1.21.0",
32
32
  "@types/jest": "^27",
33
33
  "@types/node": "^14",
34
34
  "jest": "^27",