@modern-js/base-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.
package/dist/index.js CHANGED
@@ -135176,7 +135176,7 @@ var require_format2 = __commonJS({
135176
135176
  if (typeof stats === "object") {
135177
135177
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
135178
135178
  ` : "";
135179
- const mainMessage = stats.message;
135179
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
135180
135180
  const details = stats.details ? `
135181
135181
  Details: ${stats.details}
135182
135182
  ` : "";
@@ -138537,6 +138537,143 @@ var require_getTargetDir = __commonJS({
138537
138537
  }
138538
138538
  });
138539
138539
 
138540
+ // ../../../toolkit/utils/dist/babel.js
138541
+ var require_babel = __commonJS({
138542
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
138543
+ var __defProp2 = Object.defineProperty;
138544
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
138545
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
138546
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
138547
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
138548
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
138549
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138550
+ var __spreadValues2 = (a, b) => {
138551
+ for (var prop in b || (b = {}))
138552
+ if (__hasOwnProp2.call(b, prop))
138553
+ __defNormalProp2(a, prop, b[prop]);
138554
+ if (__getOwnPropSymbols2)
138555
+ for (var prop of __getOwnPropSymbols2(b)) {
138556
+ if (__propIsEnum2.call(b, prop))
138557
+ __defNormalProp2(a, prop, b[prop]);
138558
+ }
138559
+ return a;
138560
+ };
138561
+ var __export2 = (target, all) => {
138562
+ for (var name in all)
138563
+ __defProp2(target, name, { get: all[name], enumerable: true });
138564
+ };
138565
+ var __copyProps2 = (to, from, except, desc) => {
138566
+ if (from && typeof from === "object" || typeof from === "function") {
138567
+ for (let key of __getOwnPropNames2(from))
138568
+ if (!__hasOwnProp2.call(to, key) && key !== except)
138569
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
138570
+ }
138571
+ return to;
138572
+ };
138573
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
138574
+ var babel_exports = {};
138575
+ __export2(babel_exports, {
138576
+ applyUserBabelConfig: () => applyUserBabelConfig,
138577
+ getBabelUtils: () => getBabelUtils
138578
+ });
138579
+ module2.exports = __toCommonJS2(babel_exports);
138580
+ var import_path4 = require("path");
138581
+ var import_applyOptionsChain = require_applyOptionsChain2();
138582
+ var import_ensureArray = require_ensureArray2();
138583
+ var import_path22 = require_path2();
138584
+ var formatPath = (originPath) => {
138585
+ if ((0, import_path4.isAbsolute)(originPath)) {
138586
+ return originPath.split(import_path4.sep).join("/");
138587
+ }
138588
+ return originPath;
138589
+ };
138590
+ var getPluginItemName = (item) => {
138591
+ if (typeof item === "string") {
138592
+ return formatPath(item);
138593
+ }
138594
+ if (Array.isArray(item) && typeof item[0] === "string") {
138595
+ return formatPath(item[0]);
138596
+ }
138597
+ return null;
138598
+ };
138599
+ var addPlugins = (plugins, config) => {
138600
+ if (config.plugins) {
138601
+ config.plugins.push(...plugins);
138602
+ } else {
138603
+ config.plugins = plugins;
138604
+ }
138605
+ };
138606
+ var addPresets = (presets, config) => {
138607
+ if (config.presets) {
138608
+ config.presets.push(...presets);
138609
+ } else {
138610
+ config.presets = presets;
138611
+ }
138612
+ };
138613
+ var removePlugins = (plugins, config) => {
138614
+ if (!config.plugins) {
138615
+ return;
138616
+ }
138617
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
138618
+ config.plugins = config.plugins.filter((item) => {
138619
+ const name = getPluginItemName(item);
138620
+ if (name) {
138621
+ return !removeList.find((removeItem) => name.includes(removeItem));
138622
+ }
138623
+ return true;
138624
+ });
138625
+ };
138626
+ var removePresets = (presets, config) => {
138627
+ if (!config.presets) {
138628
+ return;
138629
+ }
138630
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
138631
+ config.presets = config.presets.filter((item) => {
138632
+ const name = getPluginItemName(item);
138633
+ if (name) {
138634
+ return !removeList.find((removeItem) => name.includes(removeItem));
138635
+ }
138636
+ return true;
138637
+ });
138638
+ };
138639
+ var modifyPresetOptions = (presetName, options, presets = []) => {
138640
+ presets.forEach((preset, index) => {
138641
+ if (Array.isArray(preset)) {
138642
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
138643
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
138644
+ }
138645
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
138646
+ presets[index] = [preset, options];
138647
+ }
138648
+ });
138649
+ };
138650
+ var getBabelUtils = (config) => {
138651
+ const noop = () => {
138652
+ };
138653
+ return {
138654
+ addPlugins: (plugins) => addPlugins(plugins, config),
138655
+ addPresets: (presets) => addPresets(presets, config),
138656
+ removePlugins: (plugins) => removePlugins(plugins, config),
138657
+ removePresets: (presets) => removePresets(presets, config),
138658
+ // `addIncludes` and `addExcludes` are noop functions by default,
138659
+ // It can be overridden by `extraBabelUtils`.
138660
+ addIncludes: noop,
138661
+ addExcludes: noop,
138662
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
138663
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
138664
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
138665
+ };
138666
+ };
138667
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
138668
+ if (userBabelConfig) {
138669
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
138670
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
138671
+ }
138672
+ return defaultOptions;
138673
+ };
138674
+ }
138675
+ });
138676
+
138540
138677
  // ../../../toolkit/utils/dist/index.js
138541
138678
  var require_dist2 = __commonJS({
138542
138679
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -138600,6 +138737,7 @@ var require_dist2 = __commonJS({
138600
138737
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
138601
138738
  __reExport(src_exports2, require_react(), module2.exports);
138602
138739
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
138740
+ __reExport(src_exports2, require_babel(), module2.exports);
138603
138741
  }
138604
138742
  });
138605
138743
 
@@ -138685,8 +138823,9 @@ var I18n = class {
138685
138823
  var ZH_LOCALE = {
138686
138824
  solution: {
138687
138825
  self: "请选择你想创建的工程类型",
138688
- mwa: "应用",
138689
- module: "模块",
138826
+ mwa: "Web 应用",
138827
+ module: "Npm 模块",
138828
+ doc: "文档站",
138690
138829
  monorepo: "Monorepo",
138691
138830
  custom: "自定义",
138692
138831
  default: "默认"
@@ -138696,10 +138835,10 @@ var ZH_LOCALE = {
138696
138835
  },
138697
138836
  sub_solution: {
138698
138837
  self: "请选择你想创建的工程类型",
138699
- mwa: "应用",
138700
- mwa_test: "应用(测试)",
138701
- module: "模块",
138702
- inner_module: "模块(内部)"
138838
+ mwa: "Web 应用",
138839
+ mwa_test: "Web 应用(测试)",
138840
+ module: "Npm 模块",
138841
+ inner_module: "Npm 模块(内部)"
138703
138842
  },
138704
138843
  action: {
138705
138844
  self: "请选择你想要的操作",
@@ -138781,9 +138920,10 @@ var ZH_LOCALE = {
138781
138920
  var EN_LOCALE = {
138782
138921
  solution: {
138783
138922
  self: "Please select the solution you want to create",
138784
- mwa: "Web App Solution",
138785
- module: "Module Solution",
138786
- monorepo: "Monorepo Solution",
138923
+ mwa: "Web App",
138924
+ module: "Npm Module",
138925
+ doc: "Doc Site",
138926
+ monorepo: "Monorepo",
138787
138927
  custom: "Custom Solution",
138788
138928
  default: "Default"
138789
138929
  },
@@ -138792,11 +138932,11 @@ var EN_LOCALE = {
138792
138932
  },
138793
138933
  sub_solution: {
138794
138934
  self: "Please select the solution you want to create",
138795
- mwa: "Web App Solution",
138796
- mwa_test: "Web App Solution (Test)",
138797
- module: "Module Solution",
138798
- inner_module: "Module Solution (Inner)",
138799
- monorepo: "Monorepo Solution"
138935
+ mwa: "Web App",
138936
+ mwa_test: "Web App (Test)",
138937
+ module: "Npm Module",
138938
+ inner_module: "Npm Module (Inner)",
138939
+ monorepo: "Monorepo"
138800
138940
  },
138801
138941
  action: {
138802
138942
  self: "Action",
@@ -138836,7 +138976,7 @@ var EN_LOCALE = {
138836
138976
  self: "Development Language"
138837
138977
  },
138838
138978
  packageManager: {
138839
- self: "Package Management Tool"
138979
+ self: "Package Manager"
138840
138980
  },
138841
138981
  packageName: {
138842
138982
  self: "Package Name",
@@ -138868,7 +139008,7 @@ var EN_LOCALE = {
138868
139008
  }
138869
139009
  },
138870
139010
  buildTools: {
138871
- self: "Build Tools",
139011
+ self: "Bundler",
138872
139012
  webpack: "webpack",
138873
139013
  rspack: "Rspack (experimental)"
138874
139014
  }
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
  "types": "./src/index.ts",
17
17
  "main": "./dist/index.js",
@@ -23,14 +23,14 @@
23
23
  "@babel/runtime": "^7.18.0",
24
24
  "@modern-js/codesmith": "2.0.5",
25
25
  "@modern-js/codesmith-api-app": "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
- "@scripts/build": "2.8.0",
32
- "@scripts/jest-config": "2.8.0",
33
- "@modern-js/generator-common": "3.0.10"
30
+ "@modern-js/generator-common": "3.1.0",
31
+ "@modern-js/generator-utils": "3.1.0",
32
+ "@scripts/build": "2.10.0",
33
+ "@scripts/jest-config": "2.10.0"
34
34
  },
35
35
  "sideEffects": false,
36
36
  "publishConfig": {
@@ -44,3 +44,5 @@ log/
44
44
  modern.config.local.ts
45
45
  modern.config.local.js
46
46
  modern.config.local.mjs
47
+
48
+ doc_build/