@modern-js/create 2.8.0 → 2.10.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 +140 -2
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -34833,7 +34833,7 @@ var require_format = __commonJS({
34833
34833
  if (typeof stats === "object") {
34834
34834
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
34835
34835
  ` : "";
34836
- const mainMessage = stats.message;
34836
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
34837
34837
  const details = stats.details ? `
34838
34838
  Details: ${stats.details}
34839
34839
  ` : "";
@@ -38194,6 +38194,143 @@ var require_getTargetDir = __commonJS({
38194
38194
  }
38195
38195
  });
38196
38196
 
38197
+ // ../utils/dist/babel.js
38198
+ var require_babel = __commonJS({
38199
+ "../utils/dist/babel.js"(exports, module2) {
38200
+ var __defProp2 = Object.defineProperty;
38201
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
38202
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
38203
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
38204
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38205
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
38206
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
38207
+ var __spreadValues2 = (a, b) => {
38208
+ for (var prop in b || (b = {}))
38209
+ if (__hasOwnProp2.call(b, prop))
38210
+ __defNormalProp2(a, prop, b[prop]);
38211
+ if (__getOwnPropSymbols2)
38212
+ for (var prop of __getOwnPropSymbols2(b)) {
38213
+ if (__propIsEnum2.call(b, prop))
38214
+ __defNormalProp2(a, prop, b[prop]);
38215
+ }
38216
+ return a;
38217
+ };
38218
+ var __export2 = (target, all) => {
38219
+ for (var name in all)
38220
+ __defProp2(target, name, { get: all[name], enumerable: true });
38221
+ };
38222
+ var __copyProps2 = (to, from, except, desc) => {
38223
+ if (from && typeof from === "object" || typeof from === "function") {
38224
+ for (let key of __getOwnPropNames2(from))
38225
+ if (!__hasOwnProp2.call(to, key) && key !== except)
38226
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
38227
+ }
38228
+ return to;
38229
+ };
38230
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38231
+ var babel_exports = {};
38232
+ __export2(babel_exports, {
38233
+ applyUserBabelConfig: () => applyUserBabelConfig,
38234
+ getBabelUtils: () => getBabelUtils
38235
+ });
38236
+ module2.exports = __toCommonJS2(babel_exports);
38237
+ var import_path4 = require("path");
38238
+ var import_applyOptionsChain = require_applyOptionsChain();
38239
+ var import_ensureArray = require_ensureArray();
38240
+ var import_path22 = require_path();
38241
+ var formatPath = (originPath) => {
38242
+ if ((0, import_path4.isAbsolute)(originPath)) {
38243
+ return originPath.split(import_path4.sep).join("/");
38244
+ }
38245
+ return originPath;
38246
+ };
38247
+ var getPluginItemName = (item) => {
38248
+ if (typeof item === "string") {
38249
+ return formatPath(item);
38250
+ }
38251
+ if (Array.isArray(item) && typeof item[0] === "string") {
38252
+ return formatPath(item[0]);
38253
+ }
38254
+ return null;
38255
+ };
38256
+ var addPlugins = (plugins, config) => {
38257
+ if (config.plugins) {
38258
+ config.plugins.push(...plugins);
38259
+ } else {
38260
+ config.plugins = plugins;
38261
+ }
38262
+ };
38263
+ var addPresets = (presets, config) => {
38264
+ if (config.presets) {
38265
+ config.presets.push(...presets);
38266
+ } else {
38267
+ config.presets = presets;
38268
+ }
38269
+ };
38270
+ var removePlugins = (plugins, config) => {
38271
+ if (!config.plugins) {
38272
+ return;
38273
+ }
38274
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
38275
+ config.plugins = config.plugins.filter((item) => {
38276
+ const name = getPluginItemName(item);
38277
+ if (name) {
38278
+ return !removeList.find((removeItem) => name.includes(removeItem));
38279
+ }
38280
+ return true;
38281
+ });
38282
+ };
38283
+ var removePresets = (presets, config) => {
38284
+ if (!config.presets) {
38285
+ return;
38286
+ }
38287
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
38288
+ config.presets = config.presets.filter((item) => {
38289
+ const name = getPluginItemName(item);
38290
+ if (name) {
38291
+ return !removeList.find((removeItem) => name.includes(removeItem));
38292
+ }
38293
+ return true;
38294
+ });
38295
+ };
38296
+ var modifyPresetOptions = (presetName, options, presets = []) => {
38297
+ presets.forEach((preset, index) => {
38298
+ if (Array.isArray(preset)) {
38299
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
38300
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
38301
+ }
38302
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
38303
+ presets[index] = [preset, options];
38304
+ }
38305
+ });
38306
+ };
38307
+ var getBabelUtils = (config) => {
38308
+ const noop = () => {
38309
+ };
38310
+ return {
38311
+ addPlugins: (plugins) => addPlugins(plugins, config),
38312
+ addPresets: (presets) => addPresets(presets, config),
38313
+ removePlugins: (plugins) => removePlugins(plugins, config),
38314
+ removePresets: (presets) => removePresets(presets, config),
38315
+ // `addIncludes` and `addExcludes` are noop functions by default,
38316
+ // It can be overridden by `extraBabelUtils`.
38317
+ addIncludes: noop,
38318
+ addExcludes: noop,
38319
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
38320
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
38321
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
38322
+ };
38323
+ };
38324
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
38325
+ if (userBabelConfig) {
38326
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
38327
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
38328
+ }
38329
+ return defaultOptions;
38330
+ };
38331
+ }
38332
+ });
38333
+
38197
38334
  // ../utils/dist/index.js
38198
38335
  var require_dist = __commonJS({
38199
38336
  "../utils/dist/index.js"(exports, module2) {
@@ -38257,6 +38394,7 @@ var require_dist = __commonJS({
38257
38394
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
38258
38395
  __reExport(src_exports2, require_react(), module2.exports);
38259
38396
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
38397
+ __reExport(src_exports2, require_babel(), module2.exports);
38260
38398
  }
38261
38399
  });
38262
38400
 
@@ -78283,7 +78421,7 @@ var import_path2 = __toESM(require("path"));
78283
78421
  var import_codesmith = __toESM(require_node());
78284
78422
 
78285
78423
  // package.json
78286
- var version = "2.8.0";
78424
+ var version = "2.10.0";
78287
78425
 
78288
78426
  // ../../cli/plugin-i18n/dist/esm-node/index.js
78289
78427
  var import_lodash2 = __toESM(require_lodash2());
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.8.0",
14
+ "version": "2.10.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -35,17 +35,17 @@
35
35
  "devDependencies": {
36
36
  "@babel/runtime": "^7.18.0",
37
37
  "@modern-js/codesmith": "2.0.5",
38
- "@types/jest": "^27",
38
+ "@types/jest": "^29",
39
39
  "@types/node": "^14",
40
- "jest": "^27",
40
+ "jest": "^29",
41
41
  "ts-node": "^10.1.0",
42
42
  "typescript": "^4",
43
- "@modern-js/generator-plugin-plugin": "3.0.10",
44
- "@modern-js/utils": "2.8.0",
45
- "@modern-js/repo-generator": "3.0.10",
46
- "@modern-js/plugin-i18n": "2.8.0",
47
- "@scripts/build": "2.8.0",
48
- "@scripts/jest-config": "2.8.0"
43
+ "@modern-js/generator-plugin-plugin": "3.1.0",
44
+ "@modern-js/utils": "2.10.0",
45
+ "@modern-js/plugin-i18n": "2.10.0",
46
+ "@modern-js/repo-generator": "3.1.0",
47
+ "@scripts/jest-config": "2.10.0",
48
+ "@scripts/build": "2.10.0"
49
49
  },
50
50
  "sideEffects": false,
51
51
  "publishConfig": {