@modern-js/upgrade-generator 3.1.30 → 3.1.31

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 +23 -109
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -115409,6 +115409,8 @@ var require_chainId = __commonJS({
115409
115409
  CSS_MODULES_TS: "css-modules-typescript",
115410
115410
  /** mini-css-extract-plugin.loader */
115411
115411
  MINI_CSS_EXTRACT: "mini-css-extract",
115412
+ /** resolve-url-loader */
115413
+ RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
115412
115414
  /** builder-plugin-image-compress.loader */
115413
115415
  IMAGE_COMPRESS: "image-compress",
115414
115416
  /** builder-plugin-image-compress svgo-loader */
@@ -115456,6 +115458,10 @@ var require_chainId = __commonJS({
115456
115458
  HTML_NONCE: "html-nonce",
115457
115459
  /** HtmlCrossOriginPlugin */
115458
115460
  HTML_CROSS_ORIGIN: "html-cross-origin",
115461
+ /** htmlPreconnectPlugin */
115462
+ HTML_PRECONNECT: "html-preconnect-plugin",
115463
+ /** htmlDnsPrefetchPlugin */
115464
+ HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
115459
115465
  /** MiniCssExtractPlugin */
115460
115466
  MINI_CSS_EXTRACT: "mini-css-extract",
115461
115467
  /** VueLoaderPlugin */
@@ -115619,7 +115625,7 @@ var require_constants = __commonJS({
115619
115625
  var API_DIR = "api";
115620
115626
  var SERVER_DIR = "server";
115621
115627
  var SHARED_DIR = "shared";
115622
- var CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
115628
+ var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
115623
115629
  var CONFIG_FILE_EXTENSIONS = [
115624
115630
  ".js",
115625
115631
  ".ts",
@@ -115926,6 +115932,7 @@ var require_config2 = __commonJS({
115926
115932
  return isSingleEntry;
115927
115933
  }
115928
115934
  });
115935
+ var _constants = require_constants();
115929
115936
  var _type = require_type();
115930
115937
  var isSSR = (config) => {
115931
115938
  var _server, _server1;
@@ -115963,12 +115970,12 @@ var require_config2 = __commonJS({
115963
115970
  return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && ((_config = config) === null || _config === void 0 ? void 0 : (_config_runtime1 = _config.runtime) === null || _config_runtime1 === void 0 ? void 0 : (_config_runtime_router = _config_runtime1.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.mode) === "react-router-5";
115964
115971
  };
115965
115972
  var isSSGEntry = (config, entryName, entrypoints) => {
115966
- var _ssgConfig, _ssgConfig1;
115973
+ var _config_source, _ssgConfig, _ssgConfig1;
115967
115974
  const ssgConfig = config.output.ssg;
115968
- const useSSG = isSingleEntry(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof ((_ssgConfig = ssgConfig) === null || _ssgConfig === void 0 ? void 0 : _ssgConfig[0]) === "function" || Boolean((_ssgConfig1 = ssgConfig) === null || _ssgConfig1 === void 0 ? void 0 : _ssgConfig1[entryName]);
115975
+ const useSSG = isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) ? Boolean(ssgConfig) : ssgConfig === true || typeof ((_ssgConfig = ssgConfig) === null || _ssgConfig === void 0 ? void 0 : _ssgConfig[0]) === "function" || Boolean((_ssgConfig1 = ssgConfig) === null || _ssgConfig1 === void 0 ? void 0 : _ssgConfig1[entryName]);
115969
115976
  return useSSG;
115970
115977
  };
115971
- var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
115978
+ var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
115972
115979
  }
115973
115980
  });
115974
115981
 
@@ -116515,6 +116522,9 @@ var require_logger2 = __commonJS({
116515
116522
  });
116516
116523
  }
116517
116524
  _export(exports, {
116525
+ isErrorStackMessage: function() {
116526
+ return isErrorStackMessage;
116527
+ },
116518
116528
  Logger: function() {
116519
116529
  return Logger;
116520
116530
  },
@@ -116565,6 +116575,9 @@ var require_logger2 = __commonJS({
116565
116575
  displayLabel: true,
116566
116576
  uppercaseLabel: false
116567
116577
  };
116578
+ var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
116579
+ var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
116580
+ var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
116568
116581
  var Logger = class {
116569
116582
  _log(type, message, ...args) {
116570
116583
  if (message === void 0 || message === null) {
@@ -116590,6 +116603,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
116590
116603
  } else {
116591
116604
  text = message.message;
116592
116605
  }
116606
+ } else if (logType.level === "error" && typeof message === "string") {
116607
+ const lines = message.split("\n");
116608
+ text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
116593
116609
  } else {
116594
116610
  text = `${message}`;
116595
116611
  }
@@ -116771,15 +116787,6 @@ var require_path = __commonJS({
116771
116787
  getTemplatePath: function() {
116772
116788
  return getTemplatePath;
116773
116789
  },
116774
- compilePathMatcherRegExp: function() {
116775
- return compilePathMatcherRegExp;
116776
- },
116777
- _joinPathParts: function() {
116778
- return _joinPathParts;
116779
- },
116780
- upwardPaths: function() {
116781
- return upwardPaths;
116782
- },
116783
116790
  getRealTemporaryDirectory: function() {
116784
116791
  return getRealTemporaryDirectory;
116785
116792
  },
@@ -116817,20 +116824,6 @@ var require_path = __commonJS({
116817
116824
  parts.push((0, _compiled.nanoid)());
116818
116825
  return _path.default.resolve(...parts);
116819
116826
  };
116820
- function compilePathMatcherRegExp(match) {
116821
- if (typeof match !== "string") {
116822
- return match;
116823
- }
116824
- const escaped = _compiled.lodash.escapeRegExp(match);
116825
- return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
116826
- }
116827
- var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
116828
- "/",
116829
- "\\"
116830
- ].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
116831
- function upwardPaths(start) {
116832
- return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
116833
- }
116834
116827
  function getRealTemporaryDirectory() {
116835
116828
  let ret = null;
116836
116829
  try {
@@ -117082,84 +117075,6 @@ var require_monorepo = __commonJS({
117082
117075
  }
117083
117076
  });
117084
117077
 
117085
- // ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
117086
- var require_pathSerializer = __commonJS({
117087
- "../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
117088
- "use strict";
117089
- Object.defineProperty(exports, "__esModule", {
117090
- value: true
117091
- });
117092
- function _export(target, all) {
117093
- for (var name in all)
117094
- Object.defineProperty(target, name, {
117095
- enumerable: true,
117096
- get: all[name]
117097
- });
117098
- }
117099
- _export(exports, {
117100
- matchUpwardPathsAsUnknown: function() {
117101
- return matchUpwardPathsAsUnknown;
117102
- },
117103
- applyPathMatcher: function() {
117104
- return applyPathMatcher;
117105
- },
117106
- applyMatcherReplacement: function() {
117107
- return applyMatcherReplacement;
117108
- },
117109
- createDefaultPathMatchers: function() {
117110
- return createDefaultPathMatchers;
117111
- }
117112
- });
117113
- var _interop_require_default = require_interop_require_default();
117114
- var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
117115
- var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash3());
117116
- var _path = require_path();
117117
- var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
117118
- match,
117119
- mark: "unknown"
117120
- })).slice(1, -1).value();
117121
- function applyPathMatcher(matcher, str, options = {}) {
117122
- const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
117123
- const replacer = (substring, ...args) => {
117124
- if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
117125
- return substring;
117126
- }
117127
- const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
117128
- return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
117129
- };
117130
- return str.replace(regex2, replacer);
117131
- }
117132
- function applyMatcherReplacement(matchers, str, options = {}) {
117133
- return matchers.reduce((ret, matcher) => {
117134
- return applyPathMatcher(matcher, ret, options);
117135
- }, str);
117136
- }
117137
- var createDefaultPathMatchers = (root) => {
117138
- const ret = [
117139
- {
117140
- match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
117141
- mark: "pnpmInner"
117142
- }
117143
- ];
117144
- const tmpdir = (0, _path.getRealTemporaryDirectory)();
117145
- tmpdir && ret.push({
117146
- match: tmpdir,
117147
- mark: "temp"
117148
- });
117149
- ret.push({
117150
- match: _os.default.tmpdir(),
117151
- mark: "temp"
117152
- });
117153
- ret.push({
117154
- match: _os.default.homedir(),
117155
- mark: "home"
117156
- });
117157
- ret.push(...matchUpwardPathsAsUnknown(root));
117158
- return ret;
117159
- };
117160
- }
117161
- });
117162
-
117163
117078
  // ../../../toolkit/utils/dist/cjs/cli/port.js
117164
117079
  var require_port = __commonJS({
117165
117080
  "../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
@@ -117294,19 +117209,19 @@ var require_prettyInstructions = __commonJS({
117294
117209
  }, []);
117295
117210
  };
117296
117211
  var prettyInstructions = (appContext, config) => {
117297
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
117212
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
117298
117213
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
117299
117214
  const isHttps = (0, _is.isDev)() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
117300
117215
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
117301
117216
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
117302
117217
  let message = "App running at:\n\n";
117303
- if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
117218
+ if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
117304
117219
  message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
117305
117220
  `).join("");
117306
117221
  } else {
117307
117222
  const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
117308
117223
  urls.forEach(({ label, url }) => {
117309
- message += ` ${_compiled.chalk.bold(`> ${label}`)}
117224
+ message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
117310
117225
  `;
117311
117226
  routes.forEach(({ entryName, urlPath, isSSR }) => {
117312
117227
  if (!checkedEntries.includes(entryName)) {
@@ -117555,7 +117470,6 @@ var require_cli = __commonJS({
117555
117470
  _export_star._(require_monorepo(), exports);
117556
117471
  _export_star._(require_package4(), exports);
117557
117472
  _export_star._(require_path(), exports);
117558
- _export_star._(require_pathSerializer(), exports);
117559
117473
  _export_star._(require_port(), exports);
117560
117474
  _export_star._(require_prettyInstructions(), exports);
117561
117475
  _export_star._(require_require(), exports);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.30",
18
+ "version": "3.1.31",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,11 +30,11 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@scripts/build": "2.28.0",
34
- "@scripts/jest-config": "2.28.0",
35
- "@modern-js/generator-utils": "3.1.30",
36
- "@modern-js/plugin-i18n": "2.28.0",
37
- "@modern-js/generator-common": "3.1.30"
33
+ "@modern-js/generator-utils": "3.1.31",
34
+ "@scripts/jest-config": "2.29.0",
35
+ "@modern-js/generator-common": "3.1.31",
36
+ "@scripts/build": "2.29.0",
37
+ "@modern-js/plugin-i18n": "2.29.0"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "publishConfig": {