@vercel/next 4.5.0 → 4.5.1

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 +73 -38
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -790,6 +790,66 @@ var require_dist2 = __commonJS({
790
790
  }
791
791
  });
792
792
 
793
+ // ../../internals/path-to-regexp/dist/index.js
794
+ var require_dist3 = __commonJS({
795
+ "../../internals/path-to-regexp/dist/index.js"(exports) {
796
+ "use strict";
797
+ Object.defineProperty(exports, "__esModule", { value: true });
798
+ exports.compile = exports.pathToRegexp = void 0;
799
+ var path_to_regexp_1 = require_dist();
800
+ Object.defineProperty(exports, "compile", { enumerable: true, get: function() {
801
+ return path_to_regexp_1.compile;
802
+ } });
803
+ var path_to_regexp_updated_1 = require_dist2();
804
+ function cloneKeys(keys) {
805
+ if (typeof keys === "undefined") {
806
+ return void 0;
807
+ }
808
+ return keys.slice(0);
809
+ }
810
+ function compareKeys(left, right) {
811
+ const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
812
+ const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
813
+ return leftSerialized === rightSerialized;
814
+ }
815
+ function pathToRegexp(callerId, path5, keys, options) {
816
+ const newKeys = cloneKeys(keys);
817
+ const currentRegExp = (0, path_to_regexp_1.pathToRegexp)(path5, keys, options);
818
+ try {
819
+ const currentKeys = keys;
820
+ const newRegExp = (0, path_to_regexp_updated_1.pathToRegexp)(path5, newKeys, options);
821
+ const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
822
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
823
+ const message = JSON.stringify({
824
+ path: path5,
825
+ currentRegExp: currentRegExp.toString(),
826
+ newRegExp: newRegExp.toString()
827
+ });
828
+ console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
829
+ }
830
+ const isDiffKeys = !compareKeys(keys, newKeys);
831
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
832
+ const message = JSON.stringify({
833
+ isDiffKeys,
834
+ currentKeys,
835
+ newKeys
836
+ });
837
+ console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
838
+ }
839
+ } catch (err) {
840
+ const error = err;
841
+ const message = JSON.stringify({
842
+ path: path5,
843
+ error: error.message
844
+ });
845
+ console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
846
+ }
847
+ return currentRegExp;
848
+ }
849
+ exports.pathToRegexp = pathToRegexp;
850
+ }
851
+ });
852
+
793
853
  // ../routing-utils/dist/superstatic.js
794
854
  var require_superstatic = __commonJS({
795
855
  "../routing-utils/dist/superstatic.js"(exports, module2) {
@@ -824,38 +884,7 @@ var require_superstatic = __commonJS({
824
884
  });
825
885
  module2.exports = __toCommonJS2(superstatic_exports);
826
886
  var import_url4 = require("url");
827
- var import_path_to_regexp = require_dist();
828
- var import_path_to_regexp_updated = require_dist2();
829
- function pathToRegexp(callerId, path5, keys, options) {
830
- const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path5, keys, options);
831
- try {
832
- const currentKeys = keys;
833
- const newKeys = [];
834
- const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path5, newKeys, options);
835
- const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
836
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
837
- const message = JSON.stringify({
838
- path: path5,
839
- currentRegExp: currentRegExp.toString(),
840
- newRegExp: newRegExp.toString()
841
- });
842
- console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
843
- }
844
- const isDiffKeys = keys?.toString() !== newKeys?.toString();
845
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
846
- const message = JSON.stringify({
847
- isDiffKeys,
848
- currentKeys,
849
- newKeys
850
- });
851
- console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
852
- }
853
- } catch (err) {
854
- const error = err;
855
- console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${error.message}`);
856
- }
857
- return currentRegExp;
858
- }
887
+ var import_path_to_regexp = require_dist3();
859
888
  var UN_NAMED_SEGMENT = "__UN_NAMED_SEGMENT__";
860
889
  function getCleanUrls(filePaths) {
861
890
  const htmlFiles = filePaths.map(toRoute).filter((f) => f.endsWith(".html")).map((f) => ({
@@ -1011,7 +1040,7 @@ var require_superstatic = __commonJS({
1011
1040
  }
1012
1041
  function sourceToRegex(source) {
1013
1042
  const keys = [];
1014
- const r = pathToRegexp("632", source, keys, {
1043
+ const r = (0, import_path_to_regexp.pathToRegexp)("632", source, keys, {
1015
1044
  strict: true,
1016
1045
  sensitive: true,
1017
1046
  delimiter: "/"
@@ -1084,9 +1113,9 @@ var require_superstatic = __commonJS({
1084
1113
  const hashKeys = [];
1085
1114
  const hostnameKeys = [];
1086
1115
  try {
1087
- pathToRegexp("528", pathname, pathnameKeys);
1088
- pathToRegexp("834", hash || "", hashKeys);
1089
- pathToRegexp("712", hostname || "", hostnameKeys);
1116
+ (0, import_path_to_regexp.pathToRegexp)("528", pathname, pathnameKeys);
1117
+ (0, import_path_to_regexp.pathToRegexp)("834", hash || "", hashKeys);
1118
+ (0, import_path_to_regexp.pathToRegexp)("712", hostname || "", hostnameKeys);
1090
1119
  } catch (_) {
1091
1120
  }
1092
1121
  destParams = new Set(
@@ -11248,6 +11277,7 @@ async function getDynamicRoutes({
11248
11277
  }
11249
11278
  function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, isServerMode, isCorrectLocaleAPIRoutes, inversedAppPathRoutesManifest) {
11250
11279
  const finalDynamicRoutes = [];
11280
+ const nonLocalePrefixedRoutes = [];
11251
11281
  for (const route of dynamicRoutes) {
11252
11282
  if (route.middleware !== void 0 || route.middlewarePath !== void 0) {
11253
11283
  finalDynamicRoutes.push(route);
@@ -11269,11 +11299,13 @@ function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, sta
11269
11299
  "^",
11270
11300
  `^${dynamicPrefix || ""}[/]?`
11271
11301
  );
11272
- finalDynamicRoutes.push(nonLocalePrefixedRoute);
11302
+ nonLocalePrefixedRoutes.push(nonLocalePrefixedRoute);
11273
11303
  }
11274
11304
  route.src = route.src.replace(
11275
11305
  "^",
11276
- `^${dynamicPrefix ? `${dynamicPrefix}[/]?` : "[/]?"}(?${isLocalePrefixed ? "<nextLocale>" : ":"}${i18n.locales.map((locale) => (0, import_escape_string_regexp.default)(locale)).join("|")})?`
11306
+ `^${dynamicPrefix ? `${dynamicPrefix}[/]?` : "[/]?"}(?${isLocalePrefixed ? "<nextLocale>" : ":"}${i18n.locales.map((locale) => (0, import_escape_string_regexp.default)(locale)).join("|")})${// the locale is not optional on this path with the skip default
11307
+ // locale rewrite flag otherwise can cause double slash in dest
11308
+ skipDefaultLocaleRewrite ? "" : "?"}`
11277
11309
  );
11278
11310
  if (isLocalePrefixed && !(isCorrectLocaleAPIRoutes && isApiRoute) && !isAppRoute) {
11279
11311
  route.dest = route.dest.replace(
@@ -11286,6 +11318,9 @@ function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, sta
11286
11318
  }
11287
11319
  finalDynamicRoutes.push(route);
11288
11320
  }
11321
+ if (nonLocalePrefixedRoutes.length > 0) {
11322
+ finalDynamicRoutes.push(...nonLocalePrefixedRoutes);
11323
+ }
11289
11324
  return finalDynamicRoutes;
11290
11325
  }
11291
11326
  async function getImagesManifest(entryPath, outputDirectory) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -31,7 +31,7 @@
31
31
  "@types/text-table": "0.2.1",
32
32
  "@types/webpack-sources": "3.2.0",
33
33
  "@vercel/build-utils": "9.2.0",
34
- "@vercel/routing-utils": "5.0.2",
34
+ "@vercel/routing-utils": "5.0.3",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",
37
37
  "bytes": "3.1.2",