@modern-js/repo-generator 0.0.0-next-1690771128169 → 0.0.0-next-1690812483547

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 +19 -108
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -122780,6 +122780,10 @@ var require_chainId = __commonJS({
122780
122780
  HTML_NONCE: "html-nonce",
122781
122781
  /** HtmlCrossOriginPlugin */
122782
122782
  HTML_CROSS_ORIGIN: "html-cross-origin",
122783
+ /** htmlPreconnectPlugin */
122784
+ HTML_PRECONNECT: "html-preconnect-plugin",
122785
+ /** htmlDnsPrefetchPlugin */
122786
+ HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
122783
122787
  /** MiniCssExtractPlugin */
122784
122788
  MINI_CSS_EXTRACT: "mini-css-extract",
122785
122789
  /** VueLoaderPlugin */
@@ -123250,6 +123254,7 @@ var require_config2 = __commonJS({
123250
123254
  return isSingleEntry;
123251
123255
  }
123252
123256
  });
123257
+ var _constants = require_constants2();
123253
123258
  var _type = require_type();
123254
123259
  var isSSR = (config) => {
123255
123260
  var _server, _server1;
@@ -123287,12 +123292,12 @@ var require_config2 = __commonJS({
123287
123292
  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";
123288
123293
  };
123289
123294
  var isSSGEntry = (config, entryName, entrypoints) => {
123290
- var _ssgConfig, _ssgConfig1;
123295
+ var _config_source, _ssgConfig, _ssgConfig1;
123291
123296
  const ssgConfig = config.output.ssg;
123292
- 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]);
123297
+ 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]);
123293
123298
  return useSSG;
123294
123299
  };
123295
- var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
123300
+ var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
123296
123301
  }
123297
123302
  });
123298
123303
 
@@ -123839,6 +123844,9 @@ var require_logger2 = __commonJS({
123839
123844
  });
123840
123845
  }
123841
123846
  _export(exports, {
123847
+ isErrorStackMessage: function() {
123848
+ return isErrorStackMessage;
123849
+ },
123842
123850
  Logger: function() {
123843
123851
  return Logger2;
123844
123852
  },
@@ -123889,6 +123897,8 @@ var require_logger2 = __commonJS({
123889
123897
  displayLabel: true,
123890
123898
  uppercaseLabel: false
123891
123899
  };
123900
+ var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*(\n|$)/m;
123901
+ var isErrorStackMessage = (message) => errorStackRegExp.test(message);
123892
123902
  var Logger2 = class {
123893
123903
  _log(type, message, ...args) {
123894
123904
  if (message === void 0 || message === null) {
@@ -123914,6 +123924,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
123914
123924
  } else {
123915
123925
  text = message.message;
123916
123926
  }
123927
+ } else if (logType.level === "error" && typeof message === "string") {
123928
+ const lines = message.split("\n");
123929
+ text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
123917
123930
  } else {
123918
123931
  text = `${message}`;
123919
123932
  }
@@ -124095,15 +124108,6 @@ var require_path = __commonJS({
124095
124108
  getTemplatePath: function() {
124096
124109
  return getTemplatePath;
124097
124110
  },
124098
- compilePathMatcherRegExp: function() {
124099
- return compilePathMatcherRegExp;
124100
- },
124101
- _joinPathParts: function() {
124102
- return _joinPathParts;
124103
- },
124104
- upwardPaths: function() {
124105
- return upwardPaths;
124106
- },
124107
124111
  getRealTemporaryDirectory: function() {
124108
124112
  return getRealTemporaryDirectory;
124109
124113
  },
@@ -124141,20 +124145,6 @@ var require_path = __commonJS({
124141
124145
  parts.push((0, _compiled.nanoid)());
124142
124146
  return _path.default.resolve(...parts);
124143
124147
  };
124144
- function compilePathMatcherRegExp(match) {
124145
- if (typeof match !== "string") {
124146
- return match;
124147
- }
124148
- const escaped = _compiled.lodash.escapeRegExp(match);
124149
- return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
124150
- }
124151
- var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
124152
- "/",
124153
- "\\"
124154
- ].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
124155
- function upwardPaths(start) {
124156
- return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
124157
- }
124158
124148
  function getRealTemporaryDirectory() {
124159
124149
  let ret = null;
124160
124150
  try {
@@ -124406,84 +124396,6 @@ var require_monorepo = __commonJS({
124406
124396
  }
124407
124397
  });
124408
124398
 
124409
- // ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
124410
- var require_pathSerializer = __commonJS({
124411
- "../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
124412
- "use strict";
124413
- Object.defineProperty(exports, "__esModule", {
124414
- value: true
124415
- });
124416
- function _export(target, all) {
124417
- for (var name in all)
124418
- Object.defineProperty(target, name, {
124419
- enumerable: true,
124420
- get: all[name]
124421
- });
124422
- }
124423
- _export(exports, {
124424
- matchUpwardPathsAsUnknown: function() {
124425
- return matchUpwardPathsAsUnknown;
124426
- },
124427
- applyPathMatcher: function() {
124428
- return applyPathMatcher;
124429
- },
124430
- applyMatcherReplacement: function() {
124431
- return applyMatcherReplacement;
124432
- },
124433
- createDefaultPathMatchers: function() {
124434
- return createDefaultPathMatchers;
124435
- }
124436
- });
124437
- var _interop_require_default = require_interop_require_default();
124438
- var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
124439
- var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash4());
124440
- var _path = require_path();
124441
- var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
124442
- match,
124443
- mark: "unknown"
124444
- })).slice(1, -1).value();
124445
- function applyPathMatcher(matcher, str, options = {}) {
124446
- const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
124447
- const replacer = (substring, ...args) => {
124448
- if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
124449
- return substring;
124450
- }
124451
- const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
124452
- return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
124453
- };
124454
- return str.replace(regex2, replacer);
124455
- }
124456
- function applyMatcherReplacement(matchers, str, options = {}) {
124457
- return matchers.reduce((ret, matcher) => {
124458
- return applyPathMatcher(matcher, ret, options);
124459
- }, str);
124460
- }
124461
- var createDefaultPathMatchers = (root) => {
124462
- const ret = [
124463
- {
124464
- match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
124465
- mark: "pnpmInner"
124466
- }
124467
- ];
124468
- const tmpdir = (0, _path.getRealTemporaryDirectory)();
124469
- tmpdir && ret.push({
124470
- match: tmpdir,
124471
- mark: "temp"
124472
- });
124473
- ret.push({
124474
- match: _os.default.tmpdir(),
124475
- mark: "temp"
124476
- });
124477
- ret.push({
124478
- match: _os.default.homedir(),
124479
- mark: "home"
124480
- });
124481
- ret.push(...matchUpwardPathsAsUnknown(root));
124482
- return ret;
124483
- };
124484
- }
124485
- });
124486
-
124487
124399
  // ../../../toolkit/utils/dist/cjs/cli/port.js
124488
124400
  var require_port = __commonJS({
124489
124401
  "../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
@@ -124618,19 +124530,19 @@ var require_prettyInstructions = __commonJS({
124618
124530
  }, []);
124619
124531
  };
124620
124532
  var prettyInstructions = (appContext, config) => {
124621
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
124533
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
124622
124534
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
124623
124535
  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);
124624
124536
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
124625
124537
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
124626
124538
  let message = "App running at:\n\n";
124627
- if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
124539
+ if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
124628
124540
  message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
124629
124541
  `).join("");
124630
124542
  } else {
124631
124543
  const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
124632
124544
  urls.forEach(({ label, url }) => {
124633
- message += ` ${_compiled.chalk.bold(`> ${label}`)}
124545
+ message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
124634
124546
  `;
124635
124547
  routes.forEach(({ entryName, urlPath, isSSR }) => {
124636
124548
  if (!checkedEntries.includes(entryName)) {
@@ -124879,7 +124791,6 @@ var require_cli = __commonJS({
124879
124791
  _export_star._(require_monorepo(), exports);
124880
124792
  _export_star._(require_package5(), exports);
124881
124793
  _export_star._(require_path(), exports);
124882
- _export_star._(require_pathSerializer(), exports);
124883
124794
  _export_star._(require_port(), exports);
124884
124795
  _export_star._(require_prettyInstructions(), exports);
124885
124796
  _export_star._(require_require(), exports);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-1690771128169",
18
+ "version": "0.0.0-next-1690812483547",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -29,17 +29,17 @@
29
29
  "@types/node": "^14",
30
30
  "jest": "^29",
31
31
  "typescript": "^5",
32
- "@modern-js/base-generator": "0.0.0-next-1690771128169",
33
- "@modern-js/generator-common": "0.0.0-next-1690771128169",
34
- "@modern-js/generator-plugin": "0.0.0-next-1690771128169",
35
- "@modern-js/generator-utils": "0.0.0-next-1690771128169",
36
- "@modern-js/module-generator": "0.0.0-next-1690771128169",
37
- "@modern-js/monorepo-generator": "0.0.0-next-1690771128169",
38
- "@modern-js/mwa-generator": "0.0.0-next-1690771128169",
39
- "@modern-js/doc-generator": "0.0.0-next-1690771128169",
40
- "@scripts/build": "0.0.0-next-1690771128169",
41
- "@modern-js/utils": "0.0.0-next-1690771128169",
42
- "@scripts/jest-config": "0.0.0-next-1690771128169"
32
+ "@modern-js/base-generator": "0.0.0-next-1690812483547",
33
+ "@modern-js/generator-common": "0.0.0-next-1690812483547",
34
+ "@modern-js/generator-plugin": "0.0.0-next-1690812483547",
35
+ "@modern-js/generator-utils": "0.0.0-next-1690812483547",
36
+ "@modern-js/module-generator": "0.0.0-next-1690812483547",
37
+ "@modern-js/monorepo-generator": "0.0.0-next-1690812483547",
38
+ "@modern-js/mwa-generator": "0.0.0-next-1690812483547",
39
+ "@modern-js/doc-generator": "0.0.0-next-1690812483547",
40
+ "@modern-js/utils": "0.0.0-next-1690812483547",
41
+ "@scripts/build": "0.0.0-next-1690812483547",
42
+ "@scripts/jest-config": "0.0.0-next-1690812483547"
43
43
  },
44
44
  "sideEffects": false,
45
45
  "publishConfig": {