@modern-js/entry-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 +9 -9
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_path5 = 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_path5.isAbsolute)(originPath)) {
38246
+ return originPath.split(import_path5.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
 
@@ -138678,8 +138816,9 @@ var I18n = class {
138678
138816
  var ZH_LOCALE = {
138679
138817
  solution: {
138680
138818
  self: "请选择你想创建的工程类型",
138681
- mwa: "应用",
138682
- module: "模块",
138819
+ mwa: "Web 应用",
138820
+ module: "Npm 模块",
138821
+ doc: "文档站",
138683
138822
  monorepo: "Monorepo",
138684
138823
  custom: "自定义",
138685
138824
  default: "默认"
@@ -138689,10 +138828,10 @@ var ZH_LOCALE = {
138689
138828
  },
138690
138829
  sub_solution: {
138691
138830
  self: "请选择你想创建的工程类型",
138692
- mwa: "应用",
138693
- mwa_test: "应用(测试)",
138694
- module: "模块",
138695
- inner_module: "模块(内部)"
138831
+ mwa: "Web 应用",
138832
+ mwa_test: "Web 应用(测试)",
138833
+ module: "Npm 模块",
138834
+ inner_module: "Npm 模块(内部)"
138696
138835
  },
138697
138836
  action: {
138698
138837
  self: "请选择你想要的操作",
@@ -138774,9 +138913,10 @@ var ZH_LOCALE = {
138774
138913
  var EN_LOCALE = {
138775
138914
  solution: {
138776
138915
  self: "Please select the solution you want to create",
138777
- mwa: "Web App Solution",
138778
- module: "Module Solution",
138779
- monorepo: "Monorepo Solution",
138916
+ mwa: "Web App",
138917
+ module: "Npm Module",
138918
+ doc: "Doc Site",
138919
+ monorepo: "Monorepo",
138780
138920
  custom: "Custom Solution",
138781
138921
  default: "Default"
138782
138922
  },
@@ -138785,11 +138925,11 @@ var EN_LOCALE = {
138785
138925
  },
138786
138926
  sub_solution: {
138787
138927
  self: "Please select the solution you want to create",
138788
- mwa: "Web App Solution",
138789
- mwa_test: "Web App Solution (Test)",
138790
- module: "Module Solution",
138791
- inner_module: "Module Solution (Inner)",
138792
- monorepo: "Monorepo Solution"
138928
+ mwa: "Web App",
138929
+ mwa_test: "Web App (Test)",
138930
+ module: "Npm Module",
138931
+ inner_module: "Npm Module (Inner)",
138932
+ monorepo: "Monorepo"
138793
138933
  },
138794
138934
  action: {
138795
138935
  self: "Action",
@@ -138829,7 +138969,7 @@ var EN_LOCALE = {
138829
138969
  self: "Development Language"
138830
138970
  },
138831
138971
  packageManager: {
138832
- self: "Package Management Tool"
138972
+ self: "Package Manager"
138833
138973
  },
138834
138974
  packageName: {
138835
138975
  self: "Package Name",
@@ -138861,7 +139001,7 @@ var EN_LOCALE = {
138861
139001
  }
138862
139002
  },
138863
139003
  buildTools: {
138864
- self: "Build Tools",
139004
+ self: "Bundler",
138865
139005
  webpack: "webpack",
138866
139006
  rspack: "Rspack (experimental)"
138867
139007
  }
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,16 +23,16 @@
23
23
  "@modern-js/codesmith": "2.0.5",
24
24
  "@modern-js/codesmith-api-app": "2.0.5",
25
25
  "@modern-js/codesmith-api-handlebars": "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/generator-common": "3.0.10",
32
- "@modern-js/plugin-i18n": "2.8.0",
33
- "@modern-js/utils": "2.8.0",
34
- "@scripts/build": "2.8.0",
35
- "@scripts/jest-config": "2.8.0"
30
+ "@modern-js/generator-common": "3.1.0",
31
+ "@modern-js/utils": "2.10.0",
32
+ "@modern-js/plugin-i18n": "2.10.0",
33
+ "@modern-js/generator-utils": "3.1.0",
34
+ "@scripts/build": "2.10.0",
35
+ "@scripts/jest-config": "2.10.0"
36
36
  },
37
37
  "sideEffects": false,
38
38
  "publishConfig": {