@modern-js/upgrade-generator 3.0.11 → 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 +150 -1
  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
 
@@ -139673,6 +139811,7 @@ var ZH_LOCALE = {
139673
139811
  self: "请选择你想创建的工程类型",
139674
139812
  mwa: "Web 应用",
139675
139813
  module: "Npm 模块",
139814
+ doc: "文档站",
139676
139815
  monorepo: "Monorepo",
139677
139816
  custom: "自定义",
139678
139817
  default: "默认"
@@ -139769,6 +139908,7 @@ var EN_LOCALE = {
139769
139908
  self: "Please select the solution you want to create",
139770
139909
  mwa: "Web App",
139771
139910
  module: "Npm Module",
139911
+ doc: "Doc Site",
139772
139912
  monorepo: "Monorepo",
139773
139913
  custom: "Custom Solution",
139774
139914
  default: "Default"
@@ -139868,6 +140008,7 @@ var localeKeys = i18n.init("zh", { zh: ZH_LOCALE, en: EN_LOCALE });
139868
140008
  var Solution = /* @__PURE__ */ ((Solution2) => {
139869
140009
  Solution2["MWA"] = "mwa";
139870
140010
  Solution2["Module"] = "module";
140011
+ Solution2["Doc"] = "doc";
139871
140012
  Solution2["Monorepo"] = "monorepo";
139872
140013
  return Solution2;
139873
140014
  })(Solution || {});
@@ -139880,6 +140021,10 @@ var SolutionText = {
139880
140021
  "module"
139881
140022
  /* Module */
139882
140023
  ]: () => i18n.t(localeKeys.solution.module),
140024
+ [
140025
+ "doc"
140026
+ /* Doc */
140027
+ ]: () => i18n.t(localeKeys.solution.doc),
139883
140028
  [
139884
140029
  "monorepo"
139885
140030
  /* Monorepo */
@@ -139894,6 +140039,10 @@ var SolutionToolsMap = {
139894
140039
  "module"
139895
140040
  /* Module */
139896
140041
  ]: "@modern-js/module-tools",
140042
+ [
140043
+ "doc"
140044
+ /* Doc */
140045
+ ]: "@modern-js/doc-tools",
139897
140046
  [
139898
140047
  "monorepo"
139899
140048
  /* Monorepo */
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.11",
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
- "@modern-js/generator-utils": "3.0.11",
31
- "@scripts/build": "2.9.0",
32
- "@scripts/jest-config": "2.9.0",
33
- "@modern-js/generator-common": "3.0.11",
34
- "@modern-js/plugin-i18n": "2.9.0"
30
+ "@scripts/build": "2.10.0",
31
+ "@scripts/jest-config": "2.10.0",
32
+ "@modern-js/generator-common": "3.1.0",
33
+ "@modern-js/generator-utils": "3.1.0",
34
+ "@modern-js/plugin-i18n": "2.10.0"
35
35
  },
36
36
  "sideEffects": false,
37
37
  "publishConfig": {