@modern-js/dependence-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 +157 -17
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -136156,7 +136156,7 @@ var require_format2 = __commonJS({
136156
136156
  if (typeof stats === "object") {
136157
136157
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
136158
136158
  ` : "";
136159
- const mainMessage = stats.message;
136159
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
136160
136160
  const details = stats.details ? `
136161
136161
  Details: ${stats.details}
136162
136162
  ` : "";
@@ -139517,6 +139517,143 @@ var require_getTargetDir = __commonJS({
139517
139517
  }
139518
139518
  });
139519
139519
 
139520
+ // ../../../toolkit/utils/dist/babel.js
139521
+ var require_babel = __commonJS({
139522
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
139523
+ var __defProp2 = Object.defineProperty;
139524
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
139525
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
139526
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
139527
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
139528
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
139529
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
139530
+ var __spreadValues2 = (a, b) => {
139531
+ for (var prop in b || (b = {}))
139532
+ if (__hasOwnProp2.call(b, prop))
139533
+ __defNormalProp2(a, prop, b[prop]);
139534
+ if (__getOwnPropSymbols2)
139535
+ for (var prop of __getOwnPropSymbols2(b)) {
139536
+ if (__propIsEnum2.call(b, prop))
139537
+ __defNormalProp2(a, prop, b[prop]);
139538
+ }
139539
+ return a;
139540
+ };
139541
+ var __export2 = (target, all) => {
139542
+ for (var name in all)
139543
+ __defProp2(target, name, { get: all[name], enumerable: true });
139544
+ };
139545
+ var __copyProps2 = (to, from, except, desc) => {
139546
+ if (from && typeof from === "object" || typeof from === "function") {
139547
+ for (let key of __getOwnPropNames2(from))
139548
+ if (!__hasOwnProp2.call(to, key) && key !== except)
139549
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
139550
+ }
139551
+ return to;
139552
+ };
139553
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
139554
+ var babel_exports = {};
139555
+ __export2(babel_exports, {
139556
+ applyUserBabelConfig: () => applyUserBabelConfig,
139557
+ getBabelUtils: () => getBabelUtils
139558
+ });
139559
+ module2.exports = __toCommonJS2(babel_exports);
139560
+ var import_path4 = require("path");
139561
+ var import_applyOptionsChain = require_applyOptionsChain2();
139562
+ var import_ensureArray = require_ensureArray2();
139563
+ var import_path22 = require_path2();
139564
+ var formatPath = (originPath) => {
139565
+ if ((0, import_path4.isAbsolute)(originPath)) {
139566
+ return originPath.split(import_path4.sep).join("/");
139567
+ }
139568
+ return originPath;
139569
+ };
139570
+ var getPluginItemName = (item) => {
139571
+ if (typeof item === "string") {
139572
+ return formatPath(item);
139573
+ }
139574
+ if (Array.isArray(item) && typeof item[0] === "string") {
139575
+ return formatPath(item[0]);
139576
+ }
139577
+ return null;
139578
+ };
139579
+ var addPlugins = (plugins, config) => {
139580
+ if (config.plugins) {
139581
+ config.plugins.push(...plugins);
139582
+ } else {
139583
+ config.plugins = plugins;
139584
+ }
139585
+ };
139586
+ var addPresets = (presets, config) => {
139587
+ if (config.presets) {
139588
+ config.presets.push(...presets);
139589
+ } else {
139590
+ config.presets = presets;
139591
+ }
139592
+ };
139593
+ var removePlugins = (plugins, config) => {
139594
+ if (!config.plugins) {
139595
+ return;
139596
+ }
139597
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
139598
+ config.plugins = config.plugins.filter((item) => {
139599
+ const name = getPluginItemName(item);
139600
+ if (name) {
139601
+ return !removeList.find((removeItem) => name.includes(removeItem));
139602
+ }
139603
+ return true;
139604
+ });
139605
+ };
139606
+ var removePresets = (presets, config) => {
139607
+ if (!config.presets) {
139608
+ return;
139609
+ }
139610
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
139611
+ config.presets = config.presets.filter((item) => {
139612
+ const name = getPluginItemName(item);
139613
+ if (name) {
139614
+ return !removeList.find((removeItem) => name.includes(removeItem));
139615
+ }
139616
+ return true;
139617
+ });
139618
+ };
139619
+ var modifyPresetOptions = (presetName, options, presets = []) => {
139620
+ presets.forEach((preset, index) => {
139621
+ if (Array.isArray(preset)) {
139622
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
139623
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
139624
+ }
139625
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
139626
+ presets[index] = [preset, options];
139627
+ }
139628
+ });
139629
+ };
139630
+ var getBabelUtils = (config) => {
139631
+ const noop = () => {
139632
+ };
139633
+ return {
139634
+ addPlugins: (plugins) => addPlugins(plugins, config),
139635
+ addPresets: (presets) => addPresets(presets, config),
139636
+ removePlugins: (plugins) => removePlugins(plugins, config),
139637
+ removePresets: (presets) => removePresets(presets, config),
139638
+ // `addIncludes` and `addExcludes` are noop functions by default,
139639
+ // It can be overridden by `extraBabelUtils`.
139640
+ addIncludes: noop,
139641
+ addExcludes: noop,
139642
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
139643
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
139644
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
139645
+ };
139646
+ };
139647
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
139648
+ if (userBabelConfig) {
139649
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
139650
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
139651
+ }
139652
+ return defaultOptions;
139653
+ };
139654
+ }
139655
+ });
139656
+
139520
139657
  // ../../../toolkit/utils/dist/index.js
139521
139658
  var require_dist3 = __commonJS({
139522
139659
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -139580,6 +139717,7 @@ var require_dist3 = __commonJS({
139580
139717
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
139581
139718
  __reExport(src_exports2, require_react(), module2.exports);
139582
139719
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
139720
+ __reExport(src_exports2, require_babel(), module2.exports);
139583
139721
  }
139584
139722
  });
139585
139723
 
@@ -139667,8 +139805,9 @@ var I18n = class {
139667
139805
  var ZH_LOCALE = {
139668
139806
  solution: {
139669
139807
  self: "请选择你想创建的工程类型",
139670
- mwa: "应用",
139671
- module: "模块",
139808
+ mwa: "Web 应用",
139809
+ module: "Npm 模块",
139810
+ doc: "文档站",
139672
139811
  monorepo: "Monorepo",
139673
139812
  custom: "自定义",
139674
139813
  default: "默认"
@@ -139678,10 +139817,10 @@ var ZH_LOCALE = {
139678
139817
  },
139679
139818
  sub_solution: {
139680
139819
  self: "请选择你想创建的工程类型",
139681
- mwa: "应用",
139682
- mwa_test: "应用(测试)",
139683
- module: "模块",
139684
- inner_module: "模块(内部)"
139820
+ mwa: "Web 应用",
139821
+ mwa_test: "Web 应用(测试)",
139822
+ module: "Npm 模块",
139823
+ inner_module: "Npm 模块(内部)"
139685
139824
  },
139686
139825
  action: {
139687
139826
  self: "请选择你想要的操作",
@@ -139763,9 +139902,10 @@ var ZH_LOCALE = {
139763
139902
  var EN_LOCALE = {
139764
139903
  solution: {
139765
139904
  self: "Please select the solution you want to create",
139766
- mwa: "Web App Solution",
139767
- module: "Module Solution",
139768
- monorepo: "Monorepo Solution",
139905
+ mwa: "Web App",
139906
+ module: "Npm Module",
139907
+ doc: "Doc Site",
139908
+ monorepo: "Monorepo",
139769
139909
  custom: "Custom Solution",
139770
139910
  default: "Default"
139771
139911
  },
@@ -139774,11 +139914,11 @@ var EN_LOCALE = {
139774
139914
  },
139775
139915
  sub_solution: {
139776
139916
  self: "Please select the solution you want to create",
139777
- mwa: "Web App Solution",
139778
- mwa_test: "Web App Solution (Test)",
139779
- module: "Module Solution",
139780
- inner_module: "Module Solution (Inner)",
139781
- monorepo: "Monorepo Solution"
139917
+ mwa: "Web App",
139918
+ mwa_test: "Web App (Test)",
139919
+ module: "Npm Module",
139920
+ inner_module: "Npm Module (Inner)",
139921
+ monorepo: "Monorepo"
139782
139922
  },
139783
139923
  action: {
139784
139924
  self: "Action",
@@ -139818,7 +139958,7 @@ var EN_LOCALE = {
139818
139958
  self: "Development Language"
139819
139959
  },
139820
139960
  packageManager: {
139821
- self: "Package Management Tool"
139961
+ self: "Package Manager"
139822
139962
  },
139823
139963
  packageName: {
139824
139964
  self: "Package Name",
@@ -139850,7 +139990,7 @@ var EN_LOCALE = {
139850
139990
  }
139851
139991
  },
139852
139992
  buildTools: {
139853
- self: "Build Tools",
139993
+ self: "Bundler",
139854
139994
  webpack: "webpack",
139855
139995
  rspack: "Rspack (experimental)"
139856
139996
  }
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,15 +23,15 @@
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
- "@scripts/build": "2.8.0",
31
- "@scripts/jest-config": "2.8.0",
32
- "@modern-js/generator-utils": "3.0.10",
33
- "@modern-js/plugin-i18n": "2.8.0",
34
- "@modern-js/generator-common": "3.0.10"
30
+ "@scripts/build": "2.10.0",
31
+ "@scripts/jest-config": "2.10.0",
32
+ "@modern-js/generator-common": "3.1.0",
33
+ "@modern-js/plugin-i18n": "2.10.0",
34
+ "@modern-js/generator-utils": "3.1.0"
35
35
  },
36
36
  "sideEffects": false,
37
37
  "publishConfig": {