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