@modern-js/entry-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 +130 -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;
@@ -34601,6 +34601,11 @@ var require_logger = __commonJSMin((exports) => {
34601
34601
  label: "info",
34602
34602
  level: "info"
34603
34603
  },
34604
+ success: {
34605
+ color: "green",
34606
+ label: "Success",
34607
+ level: "info"
34608
+ },
34604
34609
  warn: {
34605
34610
  color: "yellow",
34606
34611
  label: "warn",
@@ -34887,10 +34892,10 @@ var require_type = __commonJSMin((exports) => {
34887
34892
  return Array.isArray(obj);
34888
34893
  }
34889
34894
  exports.isArray = isArray4;
34890
- function isFunction(func) {
34895
+ function isFunction2(func) {
34891
34896
  return typeof func === "function";
34892
34897
  }
34893
- exports.isFunction = isFunction;
34898
+ exports.isFunction = isFunction2;
34894
34899
  function isObject5(obj) {
34895
34900
  return obj !== null && typeof obj === "object";
34896
34901
  }
@@ -37391,7 +37396,7 @@ var init_common3 = __esmMin(() => {
37391
37396
  });
37392
37397
  ActionTypeTextMap = (_ActionTypeTextMap = {}, _defineProperty(_ActionTypeTextMap, ActionType.Element, ActionElementText), _defineProperty(_ActionTypeTextMap, ActionType.Function, ActionFunctionText), _defineProperty(_ActionTypeTextMap, ActionType.Refactor, ActionRefactorText), _ActionTypeTextMap);
37393
37398
  });
37394
- 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;
37395
37400
  var init_mwa2 = __esmMin(() => {
37396
37401
  init_defineProperty();
37397
37402
  init_common3();
@@ -37450,7 +37455,7 @@ var init_mwa2 = __esmMin(() => {
37450
37455
  };
37451
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);
37452
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);
37453
- 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);
37454
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);
37455
37460
  });
37456
37461
  var _ModuleActionFunction, _ModuleActionFunction2, _ModuleActionFunction3, _ActionType$Function2, ModuleActionTypes, ModuleActionFunctions, ModuleActionTypesMap, ModuleSpecialSchemaMap, ModuleNewActionSchema, ModuleActionFunctionsDevDependencies, ModuleActionFunctionsPeerDependencies, ModuleActionFunctionsDependencies, ModuleNewActionGenerators;
@@ -38012,7 +38017,7 @@ var require_node = __commonJSMin((exports) => {
38012
38017
  const version5 = await getPackageVersion(packageName, registry2);
38013
38018
  return version5;
38014
38019
  };
38015
- 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")) {
38016
38021
  return getLatetPluginVersion();
38017
38022
  }
38018
38023
  const pkgPath = _path.default.join(__require.resolve(_generatorCommon.SolutionToolsMap[solution], {
@@ -67562,10 +67567,10 @@ var require_type2 = __commonJSMin((exports) => {
67562
67567
  return Array.isArray(obj);
67563
67568
  }
67564
67569
  exports.isArray = isArray4;
67565
- function isFunction(func) {
67570
+ function isFunction2(func) {
67566
67571
  return typeof func === "function";
67567
67572
  }
67568
- exports.isFunction = isFunction;
67573
+ exports.isFunction = isFunction2;
67569
67574
  function isObject5(obj) {
67570
67575
  return obj !== null && typeof obj === "object";
67571
67576
  }
@@ -75132,10 +75137,10 @@ var require_util = __commonJSMin((exports) => {
75132
75137
  return objectToString(e) === "[object Error]" || e instanceof Error;
75133
75138
  }
75134
75139
  exports.isError = isError;
75135
- function isFunction(arg) {
75140
+ function isFunction2(arg) {
75136
75141
  return typeof arg === "function";
75137
75142
  }
75138
- exports.isFunction = isFunction;
75143
+ exports.isFunction = isFunction2;
75139
75144
  function isPrimitive(arg) {
75140
75145
  return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
75141
75146
  }
@@ -76413,7 +76418,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76413
76418
  var {
76414
76419
  isArray: isArray4,
76415
76420
  isObject: isObject5,
76416
- isFunction,
76421
+ isFunction: isFunction2,
76417
76422
  isNumber,
76418
76423
  isString: isString3
76419
76424
  } = require_util();
@@ -76540,10 +76545,10 @@ var require_stringify = __commonJSMin((exports, module2) => {
76540
76545
  };
76541
76546
  function stringify(key, holder, gap) {
76542
76547
  let value = holder[key];
76543
- if (isObject5(value) && isFunction(value.toJSON)) {
76548
+ if (isObject5(value) && isFunction2(value.toJSON)) {
76544
76549
  value = value.toJSON(key);
76545
76550
  }
76546
- if (isFunction(replacer)) {
76551
+ if (isFunction2(replacer)) {
76547
76552
  value = replacer.call(holder, key, value);
76548
76553
  }
76549
76554
  switch (typeof value) {
@@ -76578,7 +76583,7 @@ var require_stringify = __commonJSMin((exports, module2) => {
76578
76583
  if (!indent_) {
76579
76584
  return JSON.stringify(value, replacer_);
76580
76585
  }
76581
- if (!isFunction(replacer_) && !isArray4(replacer_)) {
76586
+ if (!isFunction2(replacer_) && !isArray4(replacer_)) {
76582
76587
  replacer_ = null;
76583
76588
  }
76584
76589
  replacer = replacer_;
@@ -76701,13 +76706,20 @@ var require_install = __commonJSMin((exports) => {
76701
76706
  }));
76702
76707
  return promise;
76703
76708
  }
76704
- async function npmInstall(cwd, registryUrl) {
76709
+ async function npmInstall({
76710
+ cwd,
76711
+ registryUrl,
76712
+ ignoreScripts
76713
+ }) {
76705
76714
  const canUse = await (0, _env.canUseNpm)();
76706
76715
  if (canUse) {
76707
76716
  const params = ["install"];
76708
76717
  if (registryUrl) {
76709
76718
  params.push(`--registry=${registryUrl}`);
76710
76719
  }
76720
+ if (ignoreScripts) {
76721
+ params.push("--ignore-scripts");
76722
+ }
76711
76723
  return execaWithStreamLog("npm", params, {
76712
76724
  cwd,
76713
76725
  env: process.env
@@ -76715,13 +76727,20 @@ var require_install = __commonJSMin((exports) => {
76715
76727
  }
76716
76728
  throw new Error("please install npm first");
76717
76729
  }
76718
- async function yarnInstall(cwd, registryUrl) {
76730
+ async function yarnInstall({
76731
+ cwd,
76732
+ registryUrl,
76733
+ ignoreScripts
76734
+ }) {
76719
76735
  const canUse = await (0, _env.canUseYarn)();
76720
76736
  if (canUse) {
76721
76737
  const params = ["install"];
76722
76738
  if (registryUrl) {
76723
76739
  params.push(`--registry=${registryUrl}`);
76724
76740
  }
76741
+ if (ignoreScripts) {
76742
+ params.push("--ignore-scripts");
76743
+ }
76725
76744
  return execaWithStreamLog("yarn", params, {
76726
76745
  cwd,
76727
76746
  env: process.env
@@ -76729,13 +76748,20 @@ var require_install = __commonJSMin((exports) => {
76729
76748
  }
76730
76749
  throw new Error("please install yarn first");
76731
76750
  }
76732
- async function pnpmInstall(cwd, registryUrl) {
76751
+ async function pnpmInstall({
76752
+ cwd,
76753
+ registryUrl,
76754
+ ignoreScripts
76755
+ }) {
76733
76756
  const canUse = await (0, _env.canUsePnpm)();
76734
76757
  if (canUse) {
76735
76758
  const params = ["install"];
76736
76759
  if (registryUrl) {
76737
76760
  params.push(`--registry=${registryUrl}`);
76738
76761
  }
76762
+ if (ignoreScripts) {
76763
+ params.push("--ignore-scripts");
76764
+ }
76739
76765
  return execaWithStreamLog("pnpm", params, {
76740
76766
  cwd,
76741
76767
  env: process.env
@@ -76831,14 +76857,38 @@ var require_node2 = __commonJSMin((exports) => {
76831
76857
  _defineProperty2(this, "generatorCore", void 0);
76832
76858
  this.generatorCore = generatorCore;
76833
76859
  }
76834
- npmInstall(cwd = this.generatorCore.outputPath) {
76835
- 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
+ });
76836
76870
  }
76837
- yarnInstall(cwd = this.generatorCore.outputPath) {
76838
- 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
+ });
76839
76881
  }
76840
- pnpmInstall(cwd = this.generatorCore.outputPath) {
76841
- 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
+ });
76842
76892
  }
76843
76893
  };
76844
76894
  exports.NpmAPI = NpmAPI;
@@ -77624,11 +77674,11 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77624
77674
  function isBlob(val) {
77625
77675
  return toString5.call(val) === "[object Blob]";
77626
77676
  }
77627
- function isFunction(val) {
77677
+ function isFunction2(val) {
77628
77678
  return toString5.call(val) === "[object Function]";
77629
77679
  }
77630
77680
  function isStream(val) {
77631
- return isObject5(val) && isFunction(val.pipe);
77681
+ return isObject5(val) && isFunction2(val.pipe);
77632
77682
  }
77633
77683
  function isURLSearchParams(val) {
77634
77684
  return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
@@ -77709,7 +77759,7 @@ var require_utils4 = __commonJSMin((exports, module2) => {
77709
77759
  isDate,
77710
77760
  isFile,
77711
77761
  isBlob,
77712
- isFunction,
77762
+ isFunction: isFunction2,
77713
77763
  isStream,
77714
77764
  isURLSearchParams,
77715
77765
  isStandardBrowserEnv,
@@ -85425,15 +85475,15 @@ var require_utils6 = __commonJSMin((exports) => {
85425
85475
  }
85426
85476
  var toString5 = Object.prototype.toString;
85427
85477
  exports.toString = toString5;
85428
- var isFunction = function isFunction2(value) {
85478
+ var isFunction2 = function isFunction3(value) {
85429
85479
  return typeof value === "function";
85430
85480
  };
85431
- if (isFunction(/x/)) {
85432
- exports.isFunction = isFunction = function(value) {
85481
+ if (isFunction2(/x/)) {
85482
+ exports.isFunction = isFunction2 = function(value) {
85433
85483
  return typeof value === "function" && toString5.call(value) === "[object Function]";
85434
85484
  };
85435
85485
  }
85436
- exports.isFunction = isFunction;
85486
+ exports.isFunction = isFunction2;
85437
85487
  var isArray4 = Array.isArray || function(value) {
85438
85488
  return value && typeof value === "object" ? toString5.call(value) === "[object Array]" : false;
85439
85489
  };
@@ -93500,14 +93550,14 @@ var require_isFunction = __commonJSMin((exports, module2) => {
93500
93550
  var funcTag = "[object Function]";
93501
93551
  var genTag = "[object GeneratorFunction]";
93502
93552
  var proxyTag = "[object Proxy]";
93503
- function isFunction(value) {
93553
+ function isFunction2(value) {
93504
93554
  if (!isObject5(value)) {
93505
93555
  return false;
93506
93556
  }
93507
93557
  var tag = baseGetTag(value);
93508
93558
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
93509
93559
  }
93510
- module2.exports = isFunction;
93560
+ module2.exports = isFunction2;
93511
93561
  });
93512
93562
  var require_coreJsData = __commonJSMin((exports, module2) => {
93513
93563
  var root = require_root();
@@ -93544,7 +93594,7 @@ var require_toSource = __commonJSMin((exports, module2) => {
93544
93594
  module2.exports = toSource;
93545
93595
  });
93546
93596
  var require_baseIsNative = __commonJSMin((exports, module2) => {
93547
- var isFunction = require_isFunction();
93597
+ var isFunction2 = require_isFunction();
93548
93598
  var isMasked = require_isMasked();
93549
93599
  var isObject5 = require_isObject();
93550
93600
  var toSource = require_toSource();
@@ -93559,7 +93609,7 @@ var require_baseIsNative = __commonJSMin((exports, module2) => {
93559
93609
  if (!isObject5(value) || isMasked(value)) {
93560
93610
  return false;
93561
93611
  }
93562
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
93612
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
93563
93613
  return pattern.test(toSource(value));
93564
93614
  }
93565
93615
  module2.exports = baseIsNative;
@@ -93758,10 +93808,10 @@ var require_isLength = __commonJSMin((exports, module2) => {
93758
93808
  module2.exports = isLength;
93759
93809
  });
93760
93810
  var require_isArrayLike = __commonJSMin((exports, module2) => {
93761
- var isFunction = require_isFunction();
93811
+ var isFunction2 = require_isFunction();
93762
93812
  var isLength = require_isLength();
93763
93813
  function isArrayLike(value) {
93764
- return value != null && isLength(value.length) && !isFunction(value);
93814
+ return value != null && isLength(value.length) && !isFunction2(value);
93765
93815
  }
93766
93816
  module2.exports = isArrayLike;
93767
93817
  });
@@ -95674,10 +95724,10 @@ var require_isFunction2 = __commonJSMin((exports) => {
95674
95724
  "use strict";
95675
95725
  Object.defineProperty(exports, "__esModule", { value: true });
95676
95726
  exports.isFunction = void 0;
95677
- function isFunction(value) {
95727
+ function isFunction2(value) {
95678
95728
  return typeof value === "function";
95679
95729
  }
95680
- exports.isFunction = isFunction;
95730
+ exports.isFunction = isFunction2;
95681
95731
  });
95682
95732
  var require_createErrorClass = __commonJSMin((exports) => {
95683
95733
  "use strict";
@@ -129785,7 +129835,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129785
129835
  var isArray4 = require_isArray();
129786
129836
  var isArrayLikeObject = require_isArrayLikeObject();
129787
129837
  var isBuffer = require_isBuffer();
129788
- var isFunction = require_isFunction();
129838
+ var isFunction2 = require_isFunction();
129789
129839
  var isObject5 = require_isObject();
129790
129840
  var isPlainObject = require_isPlainObject();
129791
129841
  var isTypedArray = require_isTypedArray();
@@ -129820,7 +129870,7 @@ var require_baseMergeDeep = __commonJSMin((exports, module2) => {
129820
129870
  newValue = objValue;
129821
129871
  if (isArguments(objValue)) {
129822
129872
  newValue = toPlainObject(objValue);
129823
- } else if (!isObject5(objValue) || isFunction(objValue)) {
129873
+ } else if (!isObject5(objValue) || isFunction2(objValue)) {
129824
129874
  newValue = initCloneObject(srcValue);
129825
129875
  }
129826
129876
  } else {
@@ -143780,7 +143830,7 @@ function getQuestionFromSchema(schema) {
143780
143830
  }
143781
143831
  var questions = fields.map(function(field) {
143782
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);
143783
- if (type === "void") {
143833
+ if (type === "void" || type === "object") {
143784
143834
  return getQuestionFromSchema(properties[field], configValue, validateMap, initValue);
143785
143835
  }
143786
143836
  if (type !== "string" && type !== "number") {
@@ -143798,7 +143848,9 @@ function getQuestionFromSchema(schema) {
143798
143848
  break;
143799
143849
  }
143800
143850
  _context.next = 3;
143801
- return validate4(input, fieldValidate);
143851
+ return validate4(input, (0, import_lodash3.isFunction)(fieldValidate) ? {
143852
+ validator: fieldValidate
143853
+ } : fieldValidate);
143802
143854
  case 3:
143803
143855
  _result = _context.sent;
143804
143856
  if (!((_result$error = _result.error) !== null && _result$error !== void 0 && _result$error.length)) {
@@ -144221,10 +144273,12 @@ var init_inquirer = __esmMin(() => {
144221
144273
  });
144222
144274
  var treeshaking_exports4 = {};
144223
144275
  __export2(treeshaking_exports4, {
144224
- CLIReader: () => CLIReader
144276
+ CLIReader: () => CLIReader,
144277
+ validate: () => validate4
144225
144278
  });
144226
144279
  var init_treeshaking4 = __esmMin(() => {
144227
144280
  init_inquirer();
144281
+ init_esm4();
144228
144282
  });
144229
144283
  function getObjKeyMap2(obj) {
144230
144284
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
@@ -144908,7 +144962,7 @@ var require_node9 = __commonJSMin((exports) => {
144908
144962
  }
144909
144963
  return true;
144910
144964
  }
144911
- async runInstall(command) {
144965
+ async runInstall(command, options3) {
144912
144966
  const {
144913
144967
  config: {
144914
144968
  packageManager,
@@ -144922,11 +144976,11 @@ var require_node9 = __commonJSMin((exports) => {
144922
144976
  if (command) {
144923
144977
  intallPromise = (0, _utils.execa)(command);
144924
144978
  } else if (packageManager === "pnpm") {
144925
- intallPromise = this.npmApi.pnpmInstall();
144979
+ intallPromise = this.npmApi.pnpmInstall(options3 || {});
144926
144980
  } else if (packageManager === "yarn") {
144927
- intallPromise = this.npmApi.yarnInstall();
144981
+ intallPromise = this.npmApi.yarnInstall(options3 || {});
144928
144982
  } else {
144929
- intallPromise = this.npmApi.npmInstall();
144983
+ intallPromise = this.npmApi.npmInstall(options3 || {});
144930
144984
  }
144931
144985
  try {
144932
144986
  await intallPromise;
@@ -145019,6 +145073,21 @@ var require_node9 = __commonJSMin((exports) => {
145019
145073
  throw new Error("run sub generator failed");
145020
145074
  }
145021
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
+ }
145022
145091
  async getInputBySchema(schema, configValue = {}, validateMap = {}, initValue = {}, type = "easy-form") {
145023
145092
  if (type === "easy-form") {
145024
145093
  const reader = new _easyFormCli.CliReader({
@@ -145029,9 +145098,7 @@ var require_node9 = __commonJSMin((exports) => {
145029
145098
  return new Promise((resolve, reject) => {
145030
145099
  reader.startQuestion({
145031
145100
  onComplete: (answers) => {
145032
- const inputData = (0, _lodash.merge)(answers, configValue);
145033
- this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
145034
- resolve(inputData);
145101
+ resolve(this.mergeAnswers(answers, configValue));
145035
145102
  },
145036
145103
  onError: (error) => {
145037
145104
  reject(error);
@@ -145045,10 +145112,11 @@ var require_node9 = __commonJSMin((exports) => {
145045
145112
  initValue
145046
145113
  });
145047
145114
  reader.setAnswers(configValue);
145048
- return reader.start();
145115
+ const answers = await reader.start();
145116
+ return this.mergeAnswers(answers, configValue);
145049
145117
  } else {
145050
- const result = await _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
145051
- 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);
145052
145120
  }
145053
145121
  }
145054
145122
  };
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
  "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.3",
27
- "@modern-js/generator-utils": "2.4.3",
28
- "@modern-js/plugin-i18n": "1.20.0",
29
- "@modern-js/utils": "1.20.0",
30
- "@scripts/build": "1.20.0",
31
- "@scripts/jest-config": "1.20.0",
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",