@modern-js/dependence-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
@@ -115416,6 +115416,8 @@ var require_chainId = __commonJS({
115416
115416
  CSS_MODULES_TS: "css-modules-typescript",
115417
115417
  /** mini-css-extract-plugin.loader */
115418
115418
  MINI_CSS_EXTRACT: "mini-css-extract",
115419
+ /** resolve-url-loader */
115420
+ RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
115419
115421
  /** builder-plugin-image-compress.loader */
115420
115422
  IMAGE_COMPRESS: "image-compress",
115421
115423
  /** builder-plugin-image-compress svgo-loader */
@@ -115463,6 +115465,10 @@ var require_chainId = __commonJS({
115463
115465
  HTML_NONCE: "html-nonce",
115464
115466
  /** HtmlCrossOriginPlugin */
115465
115467
  HTML_CROSS_ORIGIN: "html-cross-origin",
115468
+ /** htmlPreconnectPlugin */
115469
+ HTML_PRECONNECT: "html-preconnect-plugin",
115470
+ /** htmlDnsPrefetchPlugin */
115471
+ HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
115466
115472
  /** MiniCssExtractPlugin */
115467
115473
  MINI_CSS_EXTRACT: "mini-css-extract",
115468
115474
  /** VueLoaderPlugin */
@@ -115626,7 +115632,7 @@ var require_constants = __commonJS({
115626
115632
  var API_DIR = "api";
115627
115633
  var SERVER_DIR = "server";
115628
115634
  var SHARED_DIR = "shared";
115629
- var CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
115635
+ var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
115630
115636
  var CONFIG_FILE_EXTENSIONS = [
115631
115637
  ".js",
115632
115638
  ".ts",
@@ -115933,6 +115939,7 @@ var require_config2 = __commonJS({
115933
115939
  return isSingleEntry;
115934
115940
  }
115935
115941
  });
115942
+ var _constants = require_constants();
115936
115943
  var _type = require_type();
115937
115944
  var isSSR = (config) => {
115938
115945
  var _server, _server1;
@@ -115970,12 +115977,12 @@ var require_config2 = __commonJS({
115970
115977
  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";
115971
115978
  };
115972
115979
  var isSSGEntry = (config, entryName, entrypoints) => {
115973
- var _ssgConfig, _ssgConfig1;
115980
+ var _config_source, _ssgConfig, _ssgConfig1;
115974
115981
  const ssgConfig = config.output.ssg;
115975
- 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]);
115982
+ 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]);
115976
115983
  return useSSG;
115977
115984
  };
115978
- var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
115985
+ var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
115979
115986
  }
115980
115987
  });
115981
115988
 
@@ -116522,6 +116529,9 @@ var require_logger2 = __commonJS({
116522
116529
  });
116523
116530
  }
116524
116531
  _export(exports, {
116532
+ isErrorStackMessage: function() {
116533
+ return isErrorStackMessage;
116534
+ },
116525
116535
  Logger: function() {
116526
116536
  return Logger;
116527
116537
  },
@@ -116572,6 +116582,9 @@ var require_logger2 = __commonJS({
116572
116582
  displayLabel: true,
116573
116583
  uppercaseLabel: false
116574
116584
  };
116585
+ var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
116586
+ var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
116587
+ var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
116575
116588
  var Logger = class {
116576
116589
  _log(type, message, ...args) {
116577
116590
  if (message === void 0 || message === null) {
@@ -116597,6 +116610,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
116597
116610
  } else {
116598
116611
  text = message.message;
116599
116612
  }
116613
+ } else if (logType.level === "error" && typeof message === "string") {
116614
+ const lines = message.split("\n");
116615
+ text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
116600
116616
  } else {
116601
116617
  text = `${message}`;
116602
116618
  }
@@ -116778,15 +116794,6 @@ var require_path = __commonJS({
116778
116794
  getTemplatePath: function() {
116779
116795
  return getTemplatePath;
116780
116796
  },
116781
- compilePathMatcherRegExp: function() {
116782
- return compilePathMatcherRegExp;
116783
- },
116784
- _joinPathParts: function() {
116785
- return _joinPathParts;
116786
- },
116787
- upwardPaths: function() {
116788
- return upwardPaths;
116789
- },
116790
116797
  getRealTemporaryDirectory: function() {
116791
116798
  return getRealTemporaryDirectory;
116792
116799
  },
@@ -116824,20 +116831,6 @@ var require_path = __commonJS({
116824
116831
  parts.push((0, _compiled.nanoid)());
116825
116832
  return _path.default.resolve(...parts);
116826
116833
  };
116827
- function compilePathMatcherRegExp(match) {
116828
- if (typeof match !== "string") {
116829
- return match;
116830
- }
116831
- const escaped = _compiled.lodash.escapeRegExp(match);
116832
- return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
116833
- }
116834
- var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
116835
- "/",
116836
- "\\"
116837
- ].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
116838
- function upwardPaths(start) {
116839
- return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
116840
- }
116841
116834
  function getRealTemporaryDirectory() {
116842
116835
  let ret = null;
116843
116836
  try {
@@ -117089,84 +117082,6 @@ var require_monorepo = __commonJS({
117089
117082
  }
117090
117083
  });
117091
117084
 
117092
- // ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
117093
- var require_pathSerializer = __commonJS({
117094
- "../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
117095
- "use strict";
117096
- Object.defineProperty(exports, "__esModule", {
117097
- value: true
117098
- });
117099
- function _export(target, all) {
117100
- for (var name in all)
117101
- Object.defineProperty(target, name, {
117102
- enumerable: true,
117103
- get: all[name]
117104
- });
117105
- }
117106
- _export(exports, {
117107
- matchUpwardPathsAsUnknown: function() {
117108
- return matchUpwardPathsAsUnknown;
117109
- },
117110
- applyPathMatcher: function() {
117111
- return applyPathMatcher;
117112
- },
117113
- applyMatcherReplacement: function() {
117114
- return applyMatcherReplacement;
117115
- },
117116
- createDefaultPathMatchers: function() {
117117
- return createDefaultPathMatchers;
117118
- }
117119
- });
117120
- var _interop_require_default = require_interop_require_default();
117121
- var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
117122
- var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash4());
117123
- var _path = require_path();
117124
- var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
117125
- match,
117126
- mark: "unknown"
117127
- })).slice(1, -1).value();
117128
- function applyPathMatcher(matcher, str, options = {}) {
117129
- const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
117130
- const replacer = (substring, ...args) => {
117131
- if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
117132
- return substring;
117133
- }
117134
- const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
117135
- return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
117136
- };
117137
- return str.replace(regex2, replacer);
117138
- }
117139
- function applyMatcherReplacement(matchers, str, options = {}) {
117140
- return matchers.reduce((ret, matcher) => {
117141
- return applyPathMatcher(matcher, ret, options);
117142
- }, str);
117143
- }
117144
- var createDefaultPathMatchers = (root) => {
117145
- const ret = [
117146
- {
117147
- match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
117148
- mark: "pnpmInner"
117149
- }
117150
- ];
117151
- const tmpdir = (0, _path.getRealTemporaryDirectory)();
117152
- tmpdir && ret.push({
117153
- match: tmpdir,
117154
- mark: "temp"
117155
- });
117156
- ret.push({
117157
- match: _os.default.tmpdir(),
117158
- mark: "temp"
117159
- });
117160
- ret.push({
117161
- match: _os.default.homedir(),
117162
- mark: "home"
117163
- });
117164
- ret.push(...matchUpwardPathsAsUnknown(root));
117165
- return ret;
117166
- };
117167
- }
117168
- });
117169
-
117170
117085
  // ../../../toolkit/utils/dist/cjs/cli/port.js
117171
117086
  var require_port = __commonJS({
117172
117087
  "../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
@@ -117301,19 +117216,19 @@ var require_prettyInstructions = __commonJS({
117301
117216
  }, []);
117302
117217
  };
117303
117218
  var prettyInstructions = (appContext, config) => {
117304
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
117219
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
117305
117220
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
117306
117221
  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);
117307
117222
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
117308
117223
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
117309
117224
  let message = "App running at:\n\n";
117310
- if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
117225
+ if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
117311
117226
  message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
117312
117227
  `).join("");
117313
117228
  } else {
117314
117229
  const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
117315
117230
  urls.forEach(({ label, url }) => {
117316
- message += ` ${_compiled.chalk.bold(`> ${label}`)}
117231
+ message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
117317
117232
  `;
117318
117233
  routes.forEach(({ entryName, urlPath, isSSR }) => {
117319
117234
  if (!checkedEntries.includes(entryName)) {
@@ -117562,7 +117477,6 @@ var require_cli = __commonJS({
117562
117477
  _export_star._(require_monorepo(), exports);
117563
117478
  _export_star._(require_package4(), exports);
117564
117479
  _export_star._(require_path(), exports);
117565
- _export_star._(require_pathSerializer(), exports);
117566
117480
  _export_star._(require_port(), exports);
117567
117481
  _export_star._(require_prettyInstructions(), exports);
117568
117482
  _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
- "@modern-js/generator-utils": "3.1.30",
34
- "@scripts/jest-config": "2.28.0",
35
- "@modern-js/plugin-i18n": "2.28.0",
36
- "@scripts/build": "2.28.0",
37
- "@modern-js/generator-common": "3.1.30"
33
+ "@scripts/build": "2.29.0",
34
+ "@scripts/jest-config": "2.29.0",
35
+ "@modern-js/plugin-i18n": "2.29.0",
36
+ "@modern-js/generator-utils": "3.1.31",
37
+ "@modern-js/generator-common": "3.1.31"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "publishConfig": {