@vercel/next 4.15.29 → 4.15.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.
@@ -2725,95 +2725,6 @@ var require_constants = __commonJS({
2725
2725
  }
2726
2726
  });
2727
2727
 
2728
- // ../../node_modules/.pnpm/bytes@3.1.2/node_modules/bytes/index.js
2729
- var require_bytes = __commonJS({
2730
- "../../node_modules/.pnpm/bytes@3.1.2/node_modules/bytes/index.js"(exports2, module2) {
2731
- "use strict";
2732
- module2.exports = bytes2;
2733
- module2.exports.format = format;
2734
- module2.exports.parse = parse;
2735
- var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
2736
- var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
2737
- var map = {
2738
- b: 1,
2739
- kb: 1 << 10,
2740
- mb: 1 << 20,
2741
- gb: 1 << 30,
2742
- tb: Math.pow(1024, 4),
2743
- pb: Math.pow(1024, 5)
2744
- };
2745
- var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
2746
- function bytes2(value, options) {
2747
- if (typeof value === "string") {
2748
- return parse(value);
2749
- }
2750
- if (typeof value === "number") {
2751
- return format(value, options);
2752
- }
2753
- return null;
2754
- }
2755
- function format(value, options) {
2756
- if (!Number.isFinite(value)) {
2757
- return null;
2758
- }
2759
- var mag = Math.abs(value);
2760
- var thousandsSeparator = options && options.thousandsSeparator || "";
2761
- var unitSeparator = options && options.unitSeparator || "";
2762
- var decimalPlaces = options && options.decimalPlaces !== void 0 ? options.decimalPlaces : 2;
2763
- var fixedDecimals = Boolean(options && options.fixedDecimals);
2764
- var unit = options && options.unit || "";
2765
- if (!unit || !map[unit.toLowerCase()]) {
2766
- if (mag >= map.pb) {
2767
- unit = "PB";
2768
- } else if (mag >= map.tb) {
2769
- unit = "TB";
2770
- } else if (mag >= map.gb) {
2771
- unit = "GB";
2772
- } else if (mag >= map.mb) {
2773
- unit = "MB";
2774
- } else if (mag >= map.kb) {
2775
- unit = "KB";
2776
- } else {
2777
- unit = "B";
2778
- }
2779
- }
2780
- var val = value / map[unit.toLowerCase()];
2781
- var str = val.toFixed(decimalPlaces);
2782
- if (!fixedDecimals) {
2783
- str = str.replace(formatDecimalsRegExp, "$1");
2784
- }
2785
- if (thousandsSeparator) {
2786
- str = str.split(".").map(function(s, i) {
2787
- return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s;
2788
- }).join(".");
2789
- }
2790
- return str + unitSeparator + unit;
2791
- }
2792
- function parse(val) {
2793
- if (typeof val === "number" && !isNaN(val)) {
2794
- return val;
2795
- }
2796
- if (typeof val !== "string") {
2797
- return null;
2798
- }
2799
- var results = parseRegExp.exec(val);
2800
- var floatValue;
2801
- var unit = "b";
2802
- if (!results) {
2803
- floatValue = parseInt(val, 10);
2804
- unit = "b";
2805
- } else {
2806
- floatValue = parseFloat(results[1]);
2807
- unit = results[4].toLowerCase();
2808
- }
2809
- if (isNaN(floatValue)) {
2810
- return null;
2811
- }
2812
- return Math.floor(map[unit] * floatValue);
2813
- }
2814
- }
2815
- });
2816
-
2817
2728
  // ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/Source.js
2818
2729
  var require_Source = __commonJS({
2819
2730
  "../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/Source.js"(exports2, module2) {
@@ -9518,13 +9429,6 @@ var import_async_sema = __toESM(require_lib());
9518
9429
  var import_fs_extra3 = __toESM(require_lib2());
9519
9430
  var import_constants = __toESM(require_constants());
9520
9431
 
9521
- // src/pretty-bytes.ts
9522
- var import_bytes = __toESM(require_bytes());
9523
-
9524
- // src/constants.ts
9525
- var EDGE_FUNCTION_SIZE_LIMIT = 1024 * 1024;
9526
- var INTERNAL_PAGES = ["_app", "_error", "_document"];
9527
-
9528
9432
  // src/get-edge-function-source.ts
9529
9433
  var import_fs_extra2 = __toESM(require_lib2());
9530
9434
  var import_path = require("path");
@@ -10225,13 +10129,6 @@ async function getSourceFilePathFromPage({
10225
10129
  if (page === "/_global-error/page") {
10226
10130
  return "";
10227
10131
  }
10228
- if (!INTERNAL_PAGES.includes(page)) {
10229
- console.log(
10230
- `WARNING: Unable to find source file for page ${page} with extensions: ${extensionsToTry.join(
10231
- ", "
10232
- )}, this can cause functions config from \`vercel.json\` to not be applied`
10233
- );
10234
- }
10235
10132
  return "";
10236
10133
  }
10237
10134
 
@@ -11280,13 +11177,3 @@ var myAdapter = {
11280
11177
  }
11281
11178
  };
11282
11179
  module.exports = myAdapter;
11283
- /*! Bundled license information:
11284
-
11285
- bytes/index.js:
11286
- (*!
11287
- * bytes
11288
- * Copyright(c) 2012-2014 TJ Holowaychuk
11289
- * Copyright(c) 2015 Jed Watson
11290
- * MIT Licensed
11291
- *)
11292
- */
@@ -36,7 +36,6 @@ const getHandlerSource = (ctx) => `
36
36
  return fromSymbol[SYMBOL_FOR_REQ_CONTEXT]?.get?.() ?? {};
37
37
  }
38
38
  return async function handler(request) {
39
- console.log("middleware handler", request);
40
39
  let middlewareHandler = await require("./" + path.posix.join(relativeDistDir, "server", "middleware.js"));
41
40
  middlewareHandler = middlewareHandler.handler || middlewareHandler;
42
41
  const context = getRequestContext();
@@ -121,7 +120,6 @@ const getHandlerSource = (ctx) => `
121
120
  }
122
121
  function matchUrlToPage(urlPathname) {
123
122
  urlPathname = normalizeDataPath(urlPathname);
124
- console.log("before normalize", urlPathname);
125
123
  for (const suffixRegex of [
126
124
  /\.segments(\/.*)\.segment\.rsc$/,
127
125
  /\.rsc$/
@@ -134,12 +132,10 @@ const getHandlerSource = (ctx) => `
134
132
  i18n?.locales
135
133
  );
136
134
  urlPathname = normalizeResult.pathname;
137
- console.log("after normalize", normalizeResult);
138
135
  urlPathname = urlPathname.replace(/\/$/, "") || "/";
139
136
  const combinedRoutes = [...staticRoutes, ...dynamicRoutes];
140
137
  for (const route of combinedRoutes) {
141
138
  if (route.page === urlPathname) {
142
- console.log("matched direct page", route);
143
139
  return {
144
140
  matchedPathname: inversedAppRoutesManifest[route.page] || route.page,
145
141
  locale: normalizeResult.locale
@@ -147,20 +143,12 @@ const getHandlerSource = (ctx) => `
147
143
  }
148
144
  }
149
145
  for (const route of [...staticRoutes, ...dynamicRoutes]) {
150
- console.log("testing", route.namedRegex, "against", urlPathname);
151
146
  const matches = urlPathname.match(route.namedRegex);
152
147
  if (matches || urlPathname === "/index" && route.namedRegex.test("/")) {
153
148
  const fallbackFalseMap = prerenderFallbackFalseMap[route.page];
154
149
  if (fallbackFalseMap && !(fallbackFalseMap.includes(urlPathname) || fallbackFalseMap.includes(urlPathnameWithLocale))) {
155
- console.log("fallback: false but not prerendered", {
156
- page: route.page,
157
- urlPathname,
158
- urlPathnameWithLocale,
159
- paths: Object.values(fallbackFalseMap)
160
- });
161
150
  continue;
162
151
  }
163
- console.log("matched route", route, urlPathname, matches);
164
152
  return {
165
153
  matchedPathname: inversedAppRoutesManifest[route.page] || route.page,
166
154
  locale: normalizeResult.locale,
@@ -197,7 +185,6 @@ const getHandlerSource = (ctx) => `
197
185
  `_not-found`,
198
186
  "page.js"
199
187
  ));
200
- console.log("using _not-found.js for render404");
201
188
  } catch {
202
189
  }
203
190
  if (!mod) {
@@ -207,7 +194,6 @@ const getHandlerSource = (ctx) => `
207
194
  "pages",
208
195
  `404.js`
209
196
  ));
210
- console.log("using 404.js for render404");
211
197
  }
212
198
  } catch (_) {
213
199
  mod = await require("./" + path.posix.join(
@@ -216,7 +202,6 @@ const getHandlerSource = (ctx) => `
216
202
  "pages",
217
203
  `_error.js`
218
204
  ));
219
- console.log("using _error for render404");
220
205
  }
221
206
  res.statusCode = 404;
222
207
  if (mod) {
@@ -224,12 +209,6 @@ const getHandlerSource = (ctx) => `
224
209
  waitUntil: getRequestContext().waitUntil
225
210
  });
226
211
  } else {
227
- console.log(
228
- "failed to find 404 module",
229
- await require("fs").promises.readdir(
230
- path.posix.join(relativeDistDir, "server", "pages")
231
- ).catch((err) => err)
232
- );
233
212
  res.end("This page could not be found");
234
213
  }
235
214
  }
@@ -244,10 +223,10 @@ const getHandlerSource = (ctx) => `
244
223
  }
245
224
  return async function handler(req, res, internalMetadata) {
246
225
  try {
226
+ const initURL = `https://${req.headers.host || "localhost"}${req.url}`;
247
227
  const parsedUrl = new URL(req.url || "/", "http://n");
248
228
  let urlPathname = typeof req.headers["x-matched-path"] === "string" ? fixMojibake(req.headers["x-matched-path"]) : void 0;
249
229
  if (typeof urlPathname !== "string") {
250
- console.log("no x-matched-path", { url: req.url });
251
230
  urlPathname = parsedUrl.pathname || "/";
252
231
  }
253
232
  const {
@@ -265,14 +244,8 @@ const getHandlerSource = (ctx) => `
265
244
  }
266
245
  }
267
246
  if (addedMatchesToUrl) {
268
- console.log("updating URL with new matches", matches, req.url);
269
247
  req.url = `${parsedUrl.pathname}${parsedUrl.searchParams.size > 0 ? "?" : ""}${parsedUrl.searchParams.toString()}`;
270
248
  }
271
- console.log("invoking handler", {
272
- page,
273
- url: req.url,
274
- matchedPath: req.headers["x-matched-path"]
275
- });
276
249
  const mod = await require("./" + path.posix.join(
277
250
  relativeDistDir,
278
251
  "server",
@@ -288,7 +261,8 @@ const getHandlerSource = (ctx) => `
288
261
  // to the same directory as the handler file so everything is
289
262
  // relative to that/project dir
290
263
  relativeProjectDir: ".",
291
- locale
264
+ locale,
265
+ initURL
292
266
  }
293
267
  });
294
268
  } catch (error) {
@@ -302,7 +276,6 @@ const getHandlerSource = (ctx) => `
302
276
 
303
277
  ${ctx.isMiddleware ? "" : `
304
278
  module.exports.getRequestHandlerWithMetadata = (metadata) => {
305
- console.log('using getRequestHandlerWithMetadata', metadata)
306
279
  return (req, res) => _n_handler(req, res, metadata)
307
280
  }
308
281
  `}
package/dist/index.js CHANGED
@@ -12167,6 +12167,17 @@ function addLocaleOrDefault(pathname, routesManifest, locale) {
12167
12167
  locale = routesManifest.i18n.defaultLocale;
12168
12168
  return locale ? `/${locale}${pathname === "/index" ? "" : pathname}` : pathname;
12169
12169
  }
12170
+ function regionsArrayEqual(a, b) {
12171
+ if (a === b)
12172
+ return true;
12173
+ if (!a || !b)
12174
+ return false;
12175
+ if (a.length !== b.length)
12176
+ return false;
12177
+ const sortedA = [...a].sort();
12178
+ const sortedB = [...b].sort();
12179
+ return sortedA.every((val, i) => val === sortedB[i]);
12180
+ }
12170
12181
  async function getPageLambdaGroups({
12171
12182
  entryPath,
12172
12183
  config,
@@ -12239,7 +12250,10 @@ async function getPageLambdaGroups({
12239
12250
  }
12240
12251
  }
12241
12252
  let matchingGroup = experimentalAllowBundling ? void 0 : groups.find((group) => {
12242
- const matches = group.maxDuration === opts.maxDuration && group.memory === opts.memory && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR && JSON.stringify(group.experimentalTriggers) === JSON.stringify(opts.experimentalTriggers) && group.supportsCancellation === opts.supportsCancellation;
12253
+ const matches = group.maxDuration === opts.maxDuration && group.memory === opts.memory && regionsArrayEqual(group.regions, opts.regions) && regionsArrayEqual(
12254
+ group.functionFailoverRegions,
12255
+ opts.functionFailoverRegions
12256
+ ) && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR && JSON.stringify(group.experimentalTriggers) === JSON.stringify(opts.experimentalTriggers) && group.supportsCancellation === opts.supportsCancellation;
12243
12257
  if (matches) {
12244
12258
  let newTracedFilesUncompressedSize = group.pseudoLayerUncompressedBytes;
12245
12259
  for (const newPage of newPages) {
@@ -15222,6 +15236,8 @@ ${JSON.stringify(
15222
15236
  memory: group.memory,
15223
15237
  runtime: nodeVersion.runtime,
15224
15238
  maxDuration: group.maxDuration,
15239
+ regions: group.regions,
15240
+ functionFailoverRegions: group.functionFailoverRegions,
15225
15241
  supportsCancellation: group.supportsCancellation,
15226
15242
  isStreaming: group.isStreaming,
15227
15243
  nextVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.15.29",
3
+ "version": "4.15.31",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -16,7 +16,7 @@
16
16
  "@vercel/nft": "1.1.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@next-community/adapter-vercel": "0.0.1-beta.7",
19
+ "@next-community/adapter-vercel": "0.0.1-beta.9",
20
20
  "@types/aws-lambda": "8.10.19",
21
21
  "@types/buffer-crc32": "0.2.0",
22
22
  "@types/bytes": "3.1.1",
@@ -53,7 +53,7 @@
53
53
  "test-listen": "1.1.0",
54
54
  "text-table": "0.2.0",
55
55
  "webpack-sources": "3.2.3",
56
- "@vercel/build-utils": "13.4.1",
56
+ "@vercel/build-utils": "13.4.3",
57
57
  "@vercel/routing-utils": "5.3.3"
58
58
  },
59
59
  "scripts": {