@modern-js/monorepo-generator 3.0.10 → 3.1.0

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 +162 -17
  2. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -136168,7 +136168,7 @@ var require_format2 = __commonJS({
136168
136168
  if (typeof stats === "object") {
136169
136169
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
136170
136170
  ` : "";
136171
- const mainMessage = stats.message;
136171
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
136172
136172
  const details = stats.details ? `
136173
136173
  Details: ${stats.details}
136174
136174
  ` : "";
@@ -139529,6 +139529,143 @@ var require_getTargetDir = __commonJS({
139529
139529
  }
139530
139530
  });
139531
139531
 
139532
+ // ../../../toolkit/utils/dist/babel.js
139533
+ var require_babel = __commonJS({
139534
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
139535
+ var __defProp2 = Object.defineProperty;
139536
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
139537
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
139538
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
139539
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
139540
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
139541
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
139542
+ var __spreadValues2 = (a, b) => {
139543
+ for (var prop in b || (b = {}))
139544
+ if (__hasOwnProp2.call(b, prop))
139545
+ __defNormalProp2(a, prop, b[prop]);
139546
+ if (__getOwnPropSymbols2)
139547
+ for (var prop of __getOwnPropSymbols2(b)) {
139548
+ if (__propIsEnum2.call(b, prop))
139549
+ __defNormalProp2(a, prop, b[prop]);
139550
+ }
139551
+ return a;
139552
+ };
139553
+ var __export2 = (target, all) => {
139554
+ for (var name in all)
139555
+ __defProp2(target, name, { get: all[name], enumerable: true });
139556
+ };
139557
+ var __copyProps2 = (to, from, except, desc) => {
139558
+ if (from && typeof from === "object" || typeof from === "function") {
139559
+ for (let key of __getOwnPropNames2(from))
139560
+ if (!__hasOwnProp2.call(to, key) && key !== except)
139561
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
139562
+ }
139563
+ return to;
139564
+ };
139565
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
139566
+ var babel_exports = {};
139567
+ __export2(babel_exports, {
139568
+ applyUserBabelConfig: () => applyUserBabelConfig,
139569
+ getBabelUtils: () => getBabelUtils
139570
+ });
139571
+ module2.exports = __toCommonJS2(babel_exports);
139572
+ var import_path4 = require("path");
139573
+ var import_applyOptionsChain = require_applyOptionsChain2();
139574
+ var import_ensureArray = require_ensureArray2();
139575
+ var import_path22 = require_path2();
139576
+ var formatPath = (originPath) => {
139577
+ if ((0, import_path4.isAbsolute)(originPath)) {
139578
+ return originPath.split(import_path4.sep).join("/");
139579
+ }
139580
+ return originPath;
139581
+ };
139582
+ var getPluginItemName = (item) => {
139583
+ if (typeof item === "string") {
139584
+ return formatPath(item);
139585
+ }
139586
+ if (Array.isArray(item) && typeof item[0] === "string") {
139587
+ return formatPath(item[0]);
139588
+ }
139589
+ return null;
139590
+ };
139591
+ var addPlugins = (plugins, config) => {
139592
+ if (config.plugins) {
139593
+ config.plugins.push(...plugins);
139594
+ } else {
139595
+ config.plugins = plugins;
139596
+ }
139597
+ };
139598
+ var addPresets = (presets, config) => {
139599
+ if (config.presets) {
139600
+ config.presets.push(...presets);
139601
+ } else {
139602
+ config.presets = presets;
139603
+ }
139604
+ };
139605
+ var removePlugins = (plugins, config) => {
139606
+ if (!config.plugins) {
139607
+ return;
139608
+ }
139609
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
139610
+ config.plugins = config.plugins.filter((item) => {
139611
+ const name = getPluginItemName(item);
139612
+ if (name) {
139613
+ return !removeList.find((removeItem) => name.includes(removeItem));
139614
+ }
139615
+ return true;
139616
+ });
139617
+ };
139618
+ var removePresets = (presets, config) => {
139619
+ if (!config.presets) {
139620
+ return;
139621
+ }
139622
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
139623
+ config.presets = config.presets.filter((item) => {
139624
+ const name = getPluginItemName(item);
139625
+ if (name) {
139626
+ return !removeList.find((removeItem) => name.includes(removeItem));
139627
+ }
139628
+ return true;
139629
+ });
139630
+ };
139631
+ var modifyPresetOptions = (presetName, options, presets = []) => {
139632
+ presets.forEach((preset, index) => {
139633
+ if (Array.isArray(preset)) {
139634
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
139635
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
139636
+ }
139637
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
139638
+ presets[index] = [preset, options];
139639
+ }
139640
+ });
139641
+ };
139642
+ var getBabelUtils = (config) => {
139643
+ const noop = () => {
139644
+ };
139645
+ return {
139646
+ addPlugins: (plugins) => addPlugins(plugins, config),
139647
+ addPresets: (presets) => addPresets(presets, config),
139648
+ removePlugins: (plugins) => removePlugins(plugins, config),
139649
+ removePresets: (presets) => removePresets(presets, config),
139650
+ // `addIncludes` and `addExcludes` are noop functions by default,
139651
+ // It can be overridden by `extraBabelUtils`.
139652
+ addIncludes: noop,
139653
+ addExcludes: noop,
139654
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
139655
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
139656
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
139657
+ };
139658
+ };
139659
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
139660
+ if (userBabelConfig) {
139661
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
139662
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
139663
+ }
139664
+ return defaultOptions;
139665
+ };
139666
+ }
139667
+ });
139668
+
139532
139669
  // ../../../toolkit/utils/dist/index.js
139533
139670
  var require_dist3 = __commonJS({
139534
139671
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -139592,6 +139729,7 @@ var require_dist3 = __commonJS({
139592
139729
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
139593
139730
  __reExport(src_exports2, require_react(), module2.exports);
139594
139731
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
139732
+ __reExport(src_exports2, require_babel(), module2.exports);
139595
139733
  }
139596
139734
  });
139597
139735
 
@@ -139680,8 +139818,9 @@ var I18n = class {
139680
139818
  var ZH_LOCALE = {
139681
139819
  solution: {
139682
139820
  self: "请选择你想创建的工程类型",
139683
- mwa: "应用",
139684
- module: "模块",
139821
+ mwa: "Web 应用",
139822
+ module: "Npm 模块",
139823
+ doc: "文档站",
139685
139824
  monorepo: "Monorepo",
139686
139825
  custom: "自定义",
139687
139826
  default: "默认"
@@ -139691,10 +139830,10 @@ var ZH_LOCALE = {
139691
139830
  },
139692
139831
  sub_solution: {
139693
139832
  self: "请选择你想创建的工程类型",
139694
- mwa: "应用",
139695
- mwa_test: "应用(测试)",
139696
- module: "模块",
139697
- inner_module: "模块(内部)"
139833
+ mwa: "Web 应用",
139834
+ mwa_test: "Web 应用(测试)",
139835
+ module: "Npm 模块",
139836
+ inner_module: "Npm 模块(内部)"
139698
139837
  },
139699
139838
  action: {
139700
139839
  self: "请选择你想要的操作",
@@ -139776,9 +139915,10 @@ var ZH_LOCALE = {
139776
139915
  var EN_LOCALE = {
139777
139916
  solution: {
139778
139917
  self: "Please select the solution you want to create",
139779
- mwa: "Web App Solution",
139780
- module: "Module Solution",
139781
- monorepo: "Monorepo Solution",
139918
+ mwa: "Web App",
139919
+ module: "Npm Module",
139920
+ doc: "Doc Site",
139921
+ monorepo: "Monorepo",
139782
139922
  custom: "Custom Solution",
139783
139923
  default: "Default"
139784
139924
  },
@@ -139787,11 +139927,11 @@ var EN_LOCALE = {
139787
139927
  },
139788
139928
  sub_solution: {
139789
139929
  self: "Please select the solution you want to create",
139790
- mwa: "Web App Solution",
139791
- mwa_test: "Web App Solution (Test)",
139792
- module: "Module Solution",
139793
- inner_module: "Module Solution (Inner)",
139794
- monorepo: "Monorepo Solution"
139930
+ mwa: "Web App",
139931
+ mwa_test: "Web App (Test)",
139932
+ module: "Npm Module",
139933
+ inner_module: "Npm Module (Inner)",
139934
+ monorepo: "Monorepo"
139795
139935
  },
139796
139936
  action: {
139797
139937
  self: "Action",
@@ -139831,7 +139971,7 @@ var EN_LOCALE = {
139831
139971
  self: "Development Language"
139832
139972
  },
139833
139973
  packageManager: {
139834
- self: "Package Management Tool"
139974
+ self: "Package Manager"
139835
139975
  },
139836
139976
  packageName: {
139837
139977
  self: "Package Name",
@@ -139863,7 +140003,7 @@ var EN_LOCALE = {
139863
140003
  }
139864
140004
  },
139865
140005
  buildTools: {
139866
- self: "Build Tools",
140006
+ self: "Bundler",
139867
140007
  webpack: "webpack",
139868
140008
  rspack: "Rspack (experimental)"
139869
140009
  }
@@ -139877,6 +140017,7 @@ var localeKeys = i18n.init("zh", { zh: ZH_LOCALE, en: EN_LOCALE });
139877
140017
  var Solution = /* @__PURE__ */ ((Solution2) => {
139878
140018
  Solution2["MWA"] = "mwa";
139879
140019
  Solution2["Module"] = "module";
140020
+ Solution2["Doc"] = "doc";
139880
140021
  Solution2["Monorepo"] = "monorepo";
139881
140022
  return Solution2;
139882
140023
  })(Solution || {});
@@ -139889,6 +140030,10 @@ var SolutionToolsMap = {
139889
140030
  "module"
139890
140031
  /* Module */
139891
140032
  ]: "@modern-js/module-tools",
140033
+ [
140034
+ "doc"
140035
+ /* Doc */
140036
+ ]: "@modern-js/doc-tools",
139892
140037
  [
139893
140038
  "monorepo"
139894
140039
  /* Monorepo */
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.10",
14
+ "version": "3.1.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "main": "./dist/index.js",
17
17
  "files": [
@@ -23,18 +23,18 @@
23
23
  "@modern-js/codesmith": "2.0.5",
24
24
  "@modern-js/codesmith-api-app": "2.0.5",
25
25
  "@modern-js/codesmith-api-json": "2.0.5",
26
- "@types/jest": "^27",
26
+ "@types/jest": "^29",
27
27
  "@types/node": "^14",
28
- "jest": "^27",
28
+ "jest": "^29",
29
29
  "typescript": "^4",
30
- "@modern-js/generator-utils": "3.0.10",
31
- "@modern-js/plugin-i18n": "2.8.0",
32
- "@modern-js/packages-generator": "3.0.10",
33
- "@modern-js/generator-common": "3.0.10",
34
- "@modern-js/changeset-generator": "3.0.10",
35
- "@modern-js/base-generator": "3.0.10",
36
- "@scripts/build": "2.8.0",
37
- "@scripts/jest-config": "2.8.0"
30
+ "@modern-js/base-generator": "3.1.0",
31
+ "@modern-js/generator-utils": "3.1.0",
32
+ "@modern-js/plugin-i18n": "2.10.0",
33
+ "@modern-js/packages-generator": "3.1.0",
34
+ "@modern-js/changeset-generator": "3.1.0",
35
+ "@modern-js/generator-common": "3.1.0",
36
+ "@scripts/build": "2.10.0",
37
+ "@scripts/jest-config": "2.10.0"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "publishConfig": {