@modern-js/server-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 +8 -8
package/dist/index.js CHANGED
@@ -34836,7 +34836,7 @@ var require_format = __commonJS({
34836
34836
  if (typeof stats === "object") {
34837
34837
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
34838
34838
  ` : "";
34839
- const mainMessage = stats.message;
34839
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
34840
34840
  const details = stats.details ? `
34841
34841
  Details: ${stats.details}
34842
34842
  ` : "";
@@ -38197,6 +38197,143 @@ var require_getTargetDir = __commonJS({
38197
38197
  }
38198
38198
  });
38199
38199
 
38200
+ // ../../../toolkit/utils/dist/babel.js
38201
+ var require_babel = __commonJS({
38202
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
38203
+ var __defProp2 = Object.defineProperty;
38204
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
38205
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
38206
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
38207
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38208
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
38209
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
38210
+ var __spreadValues2 = (a, b) => {
38211
+ for (var prop in b || (b = {}))
38212
+ if (__hasOwnProp2.call(b, prop))
38213
+ __defNormalProp2(a, prop, b[prop]);
38214
+ if (__getOwnPropSymbols2)
38215
+ for (var prop of __getOwnPropSymbols2(b)) {
38216
+ if (__propIsEnum2.call(b, prop))
38217
+ __defNormalProp2(a, prop, b[prop]);
38218
+ }
38219
+ return a;
38220
+ };
38221
+ var __export2 = (target, all) => {
38222
+ for (var name in all)
38223
+ __defProp2(target, name, { get: all[name], enumerable: true });
38224
+ };
38225
+ var __copyProps2 = (to, from, except, desc) => {
38226
+ if (from && typeof from === "object" || typeof from === "function") {
38227
+ for (let key of __getOwnPropNames2(from))
38228
+ if (!__hasOwnProp2.call(to, key) && key !== except)
38229
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
38230
+ }
38231
+ return to;
38232
+ };
38233
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38234
+ var babel_exports = {};
38235
+ __export2(babel_exports, {
38236
+ applyUserBabelConfig: () => applyUserBabelConfig,
38237
+ getBabelUtils: () => getBabelUtils
38238
+ });
38239
+ module2.exports = __toCommonJS2(babel_exports);
38240
+ var import_path4 = require("path");
38241
+ var import_applyOptionsChain = require_applyOptionsChain();
38242
+ var import_ensureArray = require_ensureArray();
38243
+ var import_path22 = require_path();
38244
+ var formatPath = (originPath) => {
38245
+ if ((0, import_path4.isAbsolute)(originPath)) {
38246
+ return originPath.split(import_path4.sep).join("/");
38247
+ }
38248
+ return originPath;
38249
+ };
38250
+ var getPluginItemName = (item) => {
38251
+ if (typeof item === "string") {
38252
+ return formatPath(item);
38253
+ }
38254
+ if (Array.isArray(item) && typeof item[0] === "string") {
38255
+ return formatPath(item[0]);
38256
+ }
38257
+ return null;
38258
+ };
38259
+ var addPlugins = (plugins, config) => {
38260
+ if (config.plugins) {
38261
+ config.plugins.push(...plugins);
38262
+ } else {
38263
+ config.plugins = plugins;
38264
+ }
38265
+ };
38266
+ var addPresets = (presets, config) => {
38267
+ if (config.presets) {
38268
+ config.presets.push(...presets);
38269
+ } else {
38270
+ config.presets = presets;
38271
+ }
38272
+ };
38273
+ var removePlugins = (plugins, config) => {
38274
+ if (!config.plugins) {
38275
+ return;
38276
+ }
38277
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
38278
+ config.plugins = config.plugins.filter((item) => {
38279
+ const name = getPluginItemName(item);
38280
+ if (name) {
38281
+ return !removeList.find((removeItem) => name.includes(removeItem));
38282
+ }
38283
+ return true;
38284
+ });
38285
+ };
38286
+ var removePresets = (presets, config) => {
38287
+ if (!config.presets) {
38288
+ return;
38289
+ }
38290
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
38291
+ config.presets = config.presets.filter((item) => {
38292
+ const name = getPluginItemName(item);
38293
+ if (name) {
38294
+ return !removeList.find((removeItem) => name.includes(removeItem));
38295
+ }
38296
+ return true;
38297
+ });
38298
+ };
38299
+ var modifyPresetOptions = (presetName, options, presets = []) => {
38300
+ presets.forEach((preset, index) => {
38301
+ if (Array.isArray(preset)) {
38302
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
38303
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
38304
+ }
38305
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
38306
+ presets[index] = [preset, options];
38307
+ }
38308
+ });
38309
+ };
38310
+ var getBabelUtils = (config) => {
38311
+ const noop = () => {
38312
+ };
38313
+ return {
38314
+ addPlugins: (plugins) => addPlugins(plugins, config),
38315
+ addPresets: (presets) => addPresets(presets, config),
38316
+ removePlugins: (plugins) => removePlugins(plugins, config),
38317
+ removePresets: (presets) => removePresets(presets, config),
38318
+ // `addIncludes` and `addExcludes` are noop functions by default,
38319
+ // It can be overridden by `extraBabelUtils`.
38320
+ addIncludes: noop,
38321
+ addExcludes: noop,
38322
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
38323
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
38324
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
38325
+ };
38326
+ };
38327
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
38328
+ if (userBabelConfig) {
38329
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
38330
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
38331
+ }
38332
+ return defaultOptions;
38333
+ };
38334
+ }
38335
+ });
38336
+
38200
38337
  // ../../../toolkit/utils/dist/index.js
38201
38338
  var require_dist = __commonJS({
38202
38339
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -38260,6 +38397,7 @@ var require_dist = __commonJS({
38260
38397
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
38261
38398
  __reExport(src_exports2, require_react(), module2.exports);
38262
38399
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
38400
+ __reExport(src_exports2, require_babel(), module2.exports);
38263
38401
  }
38264
38402
  });
38265
38403
 
@@ -139668,8 +139806,9 @@ var I18n = class {
139668
139806
  var ZH_LOCALE = {
139669
139807
  solution: {
139670
139808
  self: "请选择你想创建的工程类型",
139671
- mwa: "应用",
139672
- module: "模块",
139809
+ mwa: "Web 应用",
139810
+ module: "Npm 模块",
139811
+ doc: "文档站",
139673
139812
  monorepo: "Monorepo",
139674
139813
  custom: "自定义",
139675
139814
  default: "默认"
@@ -139679,10 +139818,10 @@ var ZH_LOCALE = {
139679
139818
  },
139680
139819
  sub_solution: {
139681
139820
  self: "请选择你想创建的工程类型",
139682
- mwa: "应用",
139683
- mwa_test: "应用(测试)",
139684
- module: "模块",
139685
- inner_module: "模块(内部)"
139821
+ mwa: "Web 应用",
139822
+ mwa_test: "Web 应用(测试)",
139823
+ module: "Npm 模块",
139824
+ inner_module: "Npm 模块(内部)"
139686
139825
  },
139687
139826
  action: {
139688
139827
  self: "请选择你想要的操作",
@@ -139764,9 +139903,10 @@ var ZH_LOCALE = {
139764
139903
  var EN_LOCALE = {
139765
139904
  solution: {
139766
139905
  self: "Please select the solution you want to create",
139767
- mwa: "Web App Solution",
139768
- module: "Module Solution",
139769
- monorepo: "Monorepo Solution",
139906
+ mwa: "Web App",
139907
+ module: "Npm Module",
139908
+ doc: "Doc Site",
139909
+ monorepo: "Monorepo",
139770
139910
  custom: "Custom Solution",
139771
139911
  default: "Default"
139772
139912
  },
@@ -139775,11 +139915,11 @@ var EN_LOCALE = {
139775
139915
  },
139776
139916
  sub_solution: {
139777
139917
  self: "Please select the solution you want to create",
139778
- mwa: "Web App Solution",
139779
- mwa_test: "Web App Solution (Test)",
139780
- module: "Module Solution",
139781
- inner_module: "Module Solution (Inner)",
139782
- monorepo: "Monorepo Solution"
139918
+ mwa: "Web App",
139919
+ mwa_test: "Web App (Test)",
139920
+ module: "Npm Module",
139921
+ inner_module: "Npm Module (Inner)",
139922
+ monorepo: "Monorepo"
139783
139923
  },
139784
139924
  action: {
139785
139925
  self: "Action",
@@ -139819,7 +139959,7 @@ var EN_LOCALE = {
139819
139959
  self: "Development Language"
139820
139960
  },
139821
139961
  packageManager: {
139822
- self: "Package Management Tool"
139962
+ self: "Package Manager"
139823
139963
  },
139824
139964
  packageName: {
139825
139965
  self: "Package Name",
@@ -139851,7 +139991,7 @@ var EN_LOCALE = {
139851
139991
  }
139852
139992
  },
139853
139993
  buildTools: {
139854
- self: "Build Tools",
139994
+ self: "Bundler",
139855
139995
  webpack: "webpack",
139856
139996
  rspack: "Rspack (experimental)"
139857
139997
  }
@@ -139865,6 +140005,7 @@ var localeKeys = i18n.init("zh", { zh: ZH_LOCALE, en: EN_LOCALE });
139865
140005
  var Solution = /* @__PURE__ */ ((Solution2) => {
139866
140006
  Solution2["MWA"] = "mwa";
139867
140007
  Solution2["Module"] = "module";
140008
+ Solution2["Doc"] = "doc";
139868
140009
  Solution2["Monorepo"] = "monorepo";
139869
140010
  return Solution2;
139870
140011
  })(Solution || {});
@@ -139877,6 +140018,10 @@ var SolutionToolsMap = {
139877
140018
  "module"
139878
140019
  /* Module */
139879
140020
  ]: "@modern-js/module-tools",
140021
+ [
140022
+ "doc"
140023
+ /* Doc */
140024
+ ]: "@modern-js/doc-tools",
139880
140025
  [
139881
140026
  "monorepo"
139882
140027
  /* 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
  "types": "./src/index.ts",
17
17
  "main": "./dist/index.js",
@@ -24,15 +24,15 @@
24
24
  "@modern-js/codesmith": "2.0.5",
25
25
  "@modern-js/codesmith-api-app": "2.0.5",
26
26
  "@modern-js/codesmith-api-json": "2.0.5",
27
- "@types/jest": "^27",
27
+ "@types/jest": "^29",
28
28
  "@types/node": "^14",
29
- "jest": "^27",
29
+ "jest": "^29",
30
30
  "typescript": "^4",
31
- "@scripts/build": "2.8.0",
32
- "@scripts/jest-config": "2.8.0",
33
- "@modern-js/dependence-generator": "3.0.10",
34
- "@modern-js/generator-utils": "3.0.10",
35
- "@modern-js/generator-common": "3.0.10"
31
+ "@modern-js/generator-utils": "3.1.0",
32
+ "@scripts/build": "2.10.0",
33
+ "@scripts/jest-config": "2.10.0",
34
+ "@modern-js/dependence-generator": "3.1.0",
35
+ "@modern-js/generator-common": "3.1.0"
36
36
  },
37
37
  "sideEffects": false,
38
38
  "publishConfig": {