@vercel/next 12.0.3 → 13.0.0

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.
package/dist/index.js CHANGED
@@ -8391,7 +8391,7 @@ var require_util = __commonJS({
8391
8391
  return path6;
8392
8392
  });
8393
8393
  exports.normalize = normalize;
8394
- function join2(aRoot, aPath) {
8394
+ function join3(aRoot, aPath) {
8395
8395
  if (aRoot === "") {
8396
8396
  aRoot = ".";
8397
8397
  }
@@ -8423,7 +8423,7 @@ var require_util = __commonJS({
8423
8423
  }
8424
8424
  return joined;
8425
8425
  }
8426
- exports.join = join2;
8426
+ exports.join = join3;
8427
8427
  exports.isAbsolute = function(aPath) {
8428
8428
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
8429
8429
  };
@@ -8596,7 +8596,7 @@ var require_util = __commonJS({
8596
8596
  parsed.path = parsed.path.substring(0, index + 1);
8597
8597
  }
8598
8598
  }
8599
- sourceURL = join2(urlGenerate(parsed), sourceURL);
8599
+ sourceURL = join3(urlGenerate(parsed), sourceURL);
8600
8600
  }
8601
8601
  return normalize(sourceURL);
8602
8602
  }
@@ -10912,25 +10912,843 @@ var require_pretty_bytes = __commonJS({
10912
10912
  }
10913
10913
  });
10914
10914
 
10915
+ // ../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js
10916
+ var require_concat_map = __commonJS({
10917
+ "../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js"(exports, module2) {
10918
+ module2.exports = function(xs, fn) {
10919
+ var res = [];
10920
+ for (var i = 0; i < xs.length; i++) {
10921
+ var x = fn(xs[i], i);
10922
+ if (isArray(x))
10923
+ res.push.apply(res, x);
10924
+ else
10925
+ res.push(x);
10926
+ }
10927
+ return res;
10928
+ };
10929
+ var isArray = Array.isArray || function(xs) {
10930
+ return Object.prototype.toString.call(xs) === "[object Array]";
10931
+ };
10932
+ }
10933
+ });
10934
+
10935
+ // ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
10936
+ var require_balanced_match = __commonJS({
10937
+ "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module2) {
10938
+ "use strict";
10939
+ module2.exports = balanced;
10940
+ function balanced(a, b, str) {
10941
+ if (a instanceof RegExp)
10942
+ a = maybeMatch(a, str);
10943
+ if (b instanceof RegExp)
10944
+ b = maybeMatch(b, str);
10945
+ var r = range(a, b, str);
10946
+ return r && {
10947
+ start: r[0],
10948
+ end: r[1],
10949
+ pre: str.slice(0, r[0]),
10950
+ body: str.slice(r[0] + a.length, r[1]),
10951
+ post: str.slice(r[1] + b.length)
10952
+ };
10953
+ }
10954
+ function maybeMatch(reg, str) {
10955
+ var m = str.match(reg);
10956
+ return m ? m[0] : null;
10957
+ }
10958
+ balanced.range = range;
10959
+ function range(a, b, str) {
10960
+ var begs, beg, left, right, result;
10961
+ var ai = str.indexOf(a);
10962
+ var bi = str.indexOf(b, ai + 1);
10963
+ var i = ai;
10964
+ if (ai >= 0 && bi > 0) {
10965
+ if (a === b) {
10966
+ return [ai, bi];
10967
+ }
10968
+ begs = [];
10969
+ left = str.length;
10970
+ while (i >= 0 && !result) {
10971
+ if (i == ai) {
10972
+ begs.push(i);
10973
+ ai = str.indexOf(a, i + 1);
10974
+ } else if (begs.length == 1) {
10975
+ result = [begs.pop(), bi];
10976
+ } else {
10977
+ beg = begs.pop();
10978
+ if (beg < left) {
10979
+ left = beg;
10980
+ right = bi;
10981
+ }
10982
+ bi = str.indexOf(b, i + 1);
10983
+ }
10984
+ i = ai < bi && ai >= 0 ? ai : bi;
10985
+ }
10986
+ if (begs.length) {
10987
+ result = [left, right];
10988
+ }
10989
+ }
10990
+ return result;
10991
+ }
10992
+ }
10993
+ });
10994
+
10995
+ // ../../node_modules/.pnpm/brace-expansion@1.1.15/node_modules/brace-expansion/index.js
10996
+ var require_brace_expansion = __commonJS({
10997
+ "../../node_modules/.pnpm/brace-expansion@1.1.15/node_modules/brace-expansion/index.js"(exports, module2) {
10998
+ var concatMap = require_concat_map();
10999
+ var balanced = require_balanced_match();
11000
+ module2.exports = expandTop;
11001
+ var escSlash = "\0SLASH" + Math.random() + "\0";
11002
+ var escOpen = "\0OPEN" + Math.random() + "\0";
11003
+ var escClose = "\0CLOSE" + Math.random() + "\0";
11004
+ var escComma = "\0COMMA" + Math.random() + "\0";
11005
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
11006
+ function numeric(str) {
11007
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
11008
+ }
11009
+ function escapeBraces(str) {
11010
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
11011
+ }
11012
+ function unescapeBraces(str) {
11013
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
11014
+ }
11015
+ function parseCommaParts(str) {
11016
+ if (!str)
11017
+ return [""];
11018
+ var parts = [];
11019
+ var m = balanced("{", "}", str);
11020
+ if (!m)
11021
+ return str.split(",");
11022
+ var pre = m.pre;
11023
+ var body = m.body;
11024
+ var post = m.post;
11025
+ var p = pre.split(",");
11026
+ p[p.length - 1] += "{" + body + "}";
11027
+ var postParts = parseCommaParts(post);
11028
+ if (post.length) {
11029
+ p[p.length - 1] += postParts.shift();
11030
+ p.push.apply(p, postParts);
11031
+ }
11032
+ parts.push.apply(parts, p);
11033
+ return parts;
11034
+ }
11035
+ function expandTop(str, options) {
11036
+ if (!str)
11037
+ return [];
11038
+ options = options || {};
11039
+ var max = options.max == null ? Infinity : options.max;
11040
+ if (str.substr(0, 2) === "{}") {
11041
+ str = "\\{\\}" + str.substr(2);
11042
+ }
11043
+ return expand(escapeBraces(str), max, true).map(unescapeBraces);
11044
+ }
11045
+ function embrace(str) {
11046
+ return "{" + str + "}";
11047
+ }
11048
+ function isPadded(el) {
11049
+ return /^-?0\d/.test(el);
11050
+ }
11051
+ function lte(i, y) {
11052
+ return i <= y;
11053
+ }
11054
+ function gte(i, y) {
11055
+ return i >= y;
11056
+ }
11057
+ function expand(str, max, isTop) {
11058
+ var expansions = [];
11059
+ var m = balanced("{", "}", str);
11060
+ if (!m || /\$$/.test(m.pre))
11061
+ return [str];
11062
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
11063
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
11064
+ var isSequence = isNumericSequence || isAlphaSequence;
11065
+ var isOptions = m.body.indexOf(",") >= 0;
11066
+ if (!isSequence && !isOptions) {
11067
+ if (m.post.match(/,(?!,).*\}/)) {
11068
+ str = m.pre + "{" + m.body + escClose + m.post;
11069
+ return expand(str, max, true);
11070
+ }
11071
+ return [str];
11072
+ }
11073
+ var n;
11074
+ if (isSequence) {
11075
+ n = m.body.split(/\.\./);
11076
+ } else {
11077
+ n = parseCommaParts(m.body);
11078
+ if (n.length === 1) {
11079
+ n = expand(n[0], max, false).map(embrace);
11080
+ if (n.length === 1) {
11081
+ var post = m.post.length ? expand(m.post, max, false) : [""];
11082
+ return post.map(function(p) {
11083
+ return m.pre + n[0] + p;
11084
+ });
11085
+ }
11086
+ }
11087
+ }
11088
+ var pre = m.pre;
11089
+ var post = m.post.length ? expand(m.post, max, false) : [""];
11090
+ var N;
11091
+ if (isSequence) {
11092
+ var x = numeric(n[0]);
11093
+ var y = numeric(n[1]);
11094
+ var width = Math.max(n[0].length, n[1].length);
11095
+ var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
11096
+ var test = lte;
11097
+ var reverse = y < x;
11098
+ if (reverse) {
11099
+ incr *= -1;
11100
+ test = gte;
11101
+ }
11102
+ var pad = n.some(isPadded);
11103
+ N = [];
11104
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
11105
+ var c;
11106
+ if (isAlphaSequence) {
11107
+ c = String.fromCharCode(i);
11108
+ if (c === "\\")
11109
+ c = "";
11110
+ } else {
11111
+ c = String(i);
11112
+ if (pad) {
11113
+ var need = width - c.length;
11114
+ if (need > 0) {
11115
+ var z = new Array(need + 1).join("0");
11116
+ if (i < 0)
11117
+ c = "-" + z + c.slice(1);
11118
+ else
11119
+ c = z + c;
11120
+ }
11121
+ }
11122
+ }
11123
+ N.push(c);
11124
+ }
11125
+ } else {
11126
+ N = concatMap(n, function(el) {
11127
+ return expand(el, max, false);
11128
+ });
11129
+ }
11130
+ for (var j = 0; j < N.length; j++) {
11131
+ for (var k = 0; k < post.length && expansions.length < max; k++) {
11132
+ var expansion = pre + N[j] + post[k];
11133
+ if (!isTop || isSequence || expansion)
11134
+ expansions.push(expansion);
11135
+ }
11136
+ }
11137
+ return expansions;
11138
+ }
11139
+ }
11140
+ });
11141
+
11142
+ // ../../node_modules/.pnpm/minimatch@3.1.2/node_modules/minimatch/minimatch.js
11143
+ var require_minimatch = __commonJS({
11144
+ "../../node_modules/.pnpm/minimatch@3.1.2/node_modules/minimatch/minimatch.js"(exports, module2) {
11145
+ module2.exports = minimatch2;
11146
+ minimatch2.Minimatch = Minimatch;
11147
+ var path6 = function() {
11148
+ try {
11149
+ return require("path");
11150
+ } catch (e) {
11151
+ }
11152
+ }() || {
11153
+ sep: "/"
11154
+ };
11155
+ minimatch2.sep = path6.sep;
11156
+ var GLOBSTAR = minimatch2.GLOBSTAR = Minimatch.GLOBSTAR = {};
11157
+ var expand = require_brace_expansion();
11158
+ var plTypes = {
11159
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
11160
+ "?": { open: "(?:", close: ")?" },
11161
+ "+": { open: "(?:", close: ")+" },
11162
+ "*": { open: "(?:", close: ")*" },
11163
+ "@": { open: "(?:", close: ")" }
11164
+ };
11165
+ var qmark = "[^/]";
11166
+ var star = qmark + "*?";
11167
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
11168
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
11169
+ var reSpecials = charSet("().*{}+?[]^$\\!");
11170
+ function charSet(s) {
11171
+ return s.split("").reduce(function(set, c) {
11172
+ set[c] = true;
11173
+ return set;
11174
+ }, {});
11175
+ }
11176
+ var slashSplit = /\/+/;
11177
+ minimatch2.filter = filter;
11178
+ function filter(pattern, options) {
11179
+ options = options || {};
11180
+ return function(p, i, list) {
11181
+ return minimatch2(p, pattern, options);
11182
+ };
11183
+ }
11184
+ function ext(a, b) {
11185
+ b = b || {};
11186
+ var t = {};
11187
+ Object.keys(a).forEach(function(k) {
11188
+ t[k] = a[k];
11189
+ });
11190
+ Object.keys(b).forEach(function(k) {
11191
+ t[k] = b[k];
11192
+ });
11193
+ return t;
11194
+ }
11195
+ minimatch2.defaults = function(def) {
11196
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
11197
+ return minimatch2;
11198
+ }
11199
+ var orig = minimatch2;
11200
+ var m = function minimatch3(p, pattern, options) {
11201
+ return orig(p, pattern, ext(def, options));
11202
+ };
11203
+ m.Minimatch = function Minimatch2(pattern, options) {
11204
+ return new orig.Minimatch(pattern, ext(def, options));
11205
+ };
11206
+ m.Minimatch.defaults = function defaults(options) {
11207
+ return orig.defaults(ext(def, options)).Minimatch;
11208
+ };
11209
+ m.filter = function filter2(pattern, options) {
11210
+ return orig.filter(pattern, ext(def, options));
11211
+ };
11212
+ m.defaults = function defaults(options) {
11213
+ return orig.defaults(ext(def, options));
11214
+ };
11215
+ m.makeRe = function makeRe2(pattern, options) {
11216
+ return orig.makeRe(pattern, ext(def, options));
11217
+ };
11218
+ m.braceExpand = function braceExpand2(pattern, options) {
11219
+ return orig.braceExpand(pattern, ext(def, options));
11220
+ };
11221
+ m.match = function(list, pattern, options) {
11222
+ return orig.match(list, pattern, ext(def, options));
11223
+ };
11224
+ return m;
11225
+ };
11226
+ Minimatch.defaults = function(def) {
11227
+ return minimatch2.defaults(def).Minimatch;
11228
+ };
11229
+ function minimatch2(p, pattern, options) {
11230
+ assertValidPattern(pattern);
11231
+ if (!options)
11232
+ options = {};
11233
+ if (!options.nocomment && pattern.charAt(0) === "#") {
11234
+ return false;
11235
+ }
11236
+ return new Minimatch(pattern, options).match(p);
11237
+ }
11238
+ function Minimatch(pattern, options) {
11239
+ if (!(this instanceof Minimatch)) {
11240
+ return new Minimatch(pattern, options);
11241
+ }
11242
+ assertValidPattern(pattern);
11243
+ if (!options)
11244
+ options = {};
11245
+ pattern = pattern.trim();
11246
+ if (!options.allowWindowsEscape && path6.sep !== "/") {
11247
+ pattern = pattern.split(path6.sep).join("/");
11248
+ }
11249
+ this.options = options;
11250
+ this.set = [];
11251
+ this.pattern = pattern;
11252
+ this.regexp = null;
11253
+ this.negate = false;
11254
+ this.comment = false;
11255
+ this.empty = false;
11256
+ this.partial = !!options.partial;
11257
+ this.make();
11258
+ }
11259
+ Minimatch.prototype.debug = function() {
11260
+ };
11261
+ Minimatch.prototype.make = make;
11262
+ function make() {
11263
+ var pattern = this.pattern;
11264
+ var options = this.options;
11265
+ if (!options.nocomment && pattern.charAt(0) === "#") {
11266
+ this.comment = true;
11267
+ return;
11268
+ }
11269
+ if (!pattern) {
11270
+ this.empty = true;
11271
+ return;
11272
+ }
11273
+ this.parseNegate();
11274
+ var set = this.globSet = this.braceExpand();
11275
+ if (options.debug)
11276
+ this.debug = function debug4() {
11277
+ console.error.apply(console, arguments);
11278
+ };
11279
+ this.debug(this.pattern, set);
11280
+ set = this.globParts = set.map(function(s) {
11281
+ return s.split(slashSplit);
11282
+ });
11283
+ this.debug(this.pattern, set);
11284
+ set = set.map(function(s, si, set2) {
11285
+ return s.map(this.parse, this);
11286
+ }, this);
11287
+ this.debug(this.pattern, set);
11288
+ set = set.filter(function(s) {
11289
+ return s.indexOf(false) === -1;
11290
+ });
11291
+ this.debug(this.pattern, set);
11292
+ this.set = set;
11293
+ }
11294
+ Minimatch.prototype.parseNegate = parseNegate;
11295
+ function parseNegate() {
11296
+ var pattern = this.pattern;
11297
+ var negate = false;
11298
+ var options = this.options;
11299
+ var negateOffset = 0;
11300
+ if (options.nonegate)
11301
+ return;
11302
+ for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
11303
+ negate = !negate;
11304
+ negateOffset++;
11305
+ }
11306
+ if (negateOffset)
11307
+ this.pattern = pattern.substr(negateOffset);
11308
+ this.negate = negate;
11309
+ }
11310
+ minimatch2.braceExpand = function(pattern, options) {
11311
+ return braceExpand(pattern, options);
11312
+ };
11313
+ Minimatch.prototype.braceExpand = braceExpand;
11314
+ function braceExpand(pattern, options) {
11315
+ if (!options) {
11316
+ if (this instanceof Minimatch) {
11317
+ options = this.options;
11318
+ } else {
11319
+ options = {};
11320
+ }
11321
+ }
11322
+ pattern = typeof pattern === "undefined" ? this.pattern : pattern;
11323
+ assertValidPattern(pattern);
11324
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
11325
+ return [pattern];
11326
+ }
11327
+ return expand(pattern);
11328
+ }
11329
+ var MAX_PATTERN_LENGTH = 1024 * 64;
11330
+ var assertValidPattern = function(pattern) {
11331
+ if (typeof pattern !== "string") {
11332
+ throw new TypeError("invalid pattern");
11333
+ }
11334
+ if (pattern.length > MAX_PATTERN_LENGTH) {
11335
+ throw new TypeError("pattern is too long");
11336
+ }
11337
+ };
11338
+ Minimatch.prototype.parse = parse;
11339
+ var SUBPARSE = {};
11340
+ function parse(pattern, isSub) {
11341
+ assertValidPattern(pattern);
11342
+ var options = this.options;
11343
+ if (pattern === "**") {
11344
+ if (!options.noglobstar)
11345
+ return GLOBSTAR;
11346
+ else
11347
+ pattern = "*";
11348
+ }
11349
+ if (pattern === "")
11350
+ return "";
11351
+ var re = "";
11352
+ var hasMagic = !!options.nocase;
11353
+ var escaping = false;
11354
+ var patternListStack = [];
11355
+ var negativeLists = [];
11356
+ var stateChar;
11357
+ var inClass = false;
11358
+ var reClassStart = -1;
11359
+ var classStart = -1;
11360
+ var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
11361
+ var self = this;
11362
+ function clearStateChar() {
11363
+ if (stateChar) {
11364
+ switch (stateChar) {
11365
+ case "*":
11366
+ re += star;
11367
+ hasMagic = true;
11368
+ break;
11369
+ case "?":
11370
+ re += qmark;
11371
+ hasMagic = true;
11372
+ break;
11373
+ default:
11374
+ re += "\\" + stateChar;
11375
+ break;
11376
+ }
11377
+ self.debug("clearStateChar %j %j", stateChar, re);
11378
+ stateChar = false;
11379
+ }
11380
+ }
11381
+ for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
11382
+ this.debug("%s %s %s %j", pattern, i, re, c);
11383
+ if (escaping && reSpecials[c]) {
11384
+ re += "\\" + c;
11385
+ escaping = false;
11386
+ continue;
11387
+ }
11388
+ switch (c) {
11389
+ case "/": {
11390
+ return false;
11391
+ }
11392
+ case "\\":
11393
+ clearStateChar();
11394
+ escaping = true;
11395
+ continue;
11396
+ case "?":
11397
+ case "*":
11398
+ case "+":
11399
+ case "@":
11400
+ case "!":
11401
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
11402
+ if (inClass) {
11403
+ this.debug(" in class");
11404
+ if (c === "!" && i === classStart + 1)
11405
+ c = "^";
11406
+ re += c;
11407
+ continue;
11408
+ }
11409
+ self.debug("call clearStateChar %j", stateChar);
11410
+ clearStateChar();
11411
+ stateChar = c;
11412
+ if (options.noext)
11413
+ clearStateChar();
11414
+ continue;
11415
+ case "(":
11416
+ if (inClass) {
11417
+ re += "(";
11418
+ continue;
11419
+ }
11420
+ if (!stateChar) {
11421
+ re += "\\(";
11422
+ continue;
11423
+ }
11424
+ patternListStack.push({
11425
+ type: stateChar,
11426
+ start: i - 1,
11427
+ reStart: re.length,
11428
+ open: plTypes[stateChar].open,
11429
+ close: plTypes[stateChar].close
11430
+ });
11431
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
11432
+ this.debug("plType %j %j", stateChar, re);
11433
+ stateChar = false;
11434
+ continue;
11435
+ case ")":
11436
+ if (inClass || !patternListStack.length) {
11437
+ re += "\\)";
11438
+ continue;
11439
+ }
11440
+ clearStateChar();
11441
+ hasMagic = true;
11442
+ var pl = patternListStack.pop();
11443
+ re += pl.close;
11444
+ if (pl.type === "!") {
11445
+ negativeLists.push(pl);
11446
+ }
11447
+ pl.reEnd = re.length;
11448
+ continue;
11449
+ case "|":
11450
+ if (inClass || !patternListStack.length || escaping) {
11451
+ re += "\\|";
11452
+ escaping = false;
11453
+ continue;
11454
+ }
11455
+ clearStateChar();
11456
+ re += "|";
11457
+ continue;
11458
+ case "[":
11459
+ clearStateChar();
11460
+ if (inClass) {
11461
+ re += "\\" + c;
11462
+ continue;
11463
+ }
11464
+ inClass = true;
11465
+ classStart = i;
11466
+ reClassStart = re.length;
11467
+ re += c;
11468
+ continue;
11469
+ case "]":
11470
+ if (i === classStart + 1 || !inClass) {
11471
+ re += "\\" + c;
11472
+ escaping = false;
11473
+ continue;
11474
+ }
11475
+ var cs = pattern.substring(classStart + 1, i);
11476
+ try {
11477
+ RegExp("[" + cs + "]");
11478
+ } catch (er) {
11479
+ var sp = this.parse(cs, SUBPARSE);
11480
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
11481
+ hasMagic = hasMagic || sp[1];
11482
+ inClass = false;
11483
+ continue;
11484
+ }
11485
+ hasMagic = true;
11486
+ inClass = false;
11487
+ re += c;
11488
+ continue;
11489
+ default:
11490
+ clearStateChar();
11491
+ if (escaping) {
11492
+ escaping = false;
11493
+ } else if (reSpecials[c] && !(c === "^" && inClass)) {
11494
+ re += "\\";
11495
+ }
11496
+ re += c;
11497
+ }
11498
+ }
11499
+ if (inClass) {
11500
+ cs = pattern.substr(classStart + 1);
11501
+ sp = this.parse(cs, SUBPARSE);
11502
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
11503
+ hasMagic = hasMagic || sp[1];
11504
+ }
11505
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
11506
+ var tail = re.slice(pl.reStart + pl.open.length);
11507
+ this.debug("setting tail", re, pl);
11508
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
11509
+ if (!$2) {
11510
+ $2 = "\\";
11511
+ }
11512
+ return $1 + $1 + $2 + "|";
11513
+ });
11514
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
11515
+ var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
11516
+ hasMagic = true;
11517
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
11518
+ }
11519
+ clearStateChar();
11520
+ if (escaping) {
11521
+ re += "\\\\";
11522
+ }
11523
+ var addPatternStart = false;
11524
+ switch (re.charAt(0)) {
11525
+ case "[":
11526
+ case ".":
11527
+ case "(":
11528
+ addPatternStart = true;
11529
+ }
11530
+ for (var n = negativeLists.length - 1; n > -1; n--) {
11531
+ var nl = negativeLists[n];
11532
+ var nlBefore = re.slice(0, nl.reStart);
11533
+ var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
11534
+ var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
11535
+ var nlAfter = re.slice(nl.reEnd);
11536
+ nlLast += nlAfter;
11537
+ var openParensBefore = nlBefore.split("(").length - 1;
11538
+ var cleanAfter = nlAfter;
11539
+ for (i = 0; i < openParensBefore; i++) {
11540
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
11541
+ }
11542
+ nlAfter = cleanAfter;
11543
+ var dollar = "";
11544
+ if (nlAfter === "" && isSub !== SUBPARSE) {
11545
+ dollar = "$";
11546
+ }
11547
+ var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
11548
+ re = newRe;
11549
+ }
11550
+ if (re !== "" && hasMagic) {
11551
+ re = "(?=.)" + re;
11552
+ }
11553
+ if (addPatternStart) {
11554
+ re = patternStart + re;
11555
+ }
11556
+ if (isSub === SUBPARSE) {
11557
+ return [re, hasMagic];
11558
+ }
11559
+ if (!hasMagic) {
11560
+ return globUnescape(pattern);
11561
+ }
11562
+ var flags = options.nocase ? "i" : "";
11563
+ try {
11564
+ var regExp = new RegExp("^" + re + "$", flags);
11565
+ } catch (er) {
11566
+ return new RegExp("$.");
11567
+ }
11568
+ regExp._glob = pattern;
11569
+ regExp._src = re;
11570
+ return regExp;
11571
+ }
11572
+ minimatch2.makeRe = function(pattern, options) {
11573
+ return new Minimatch(pattern, options || {}).makeRe();
11574
+ };
11575
+ Minimatch.prototype.makeRe = makeRe;
11576
+ function makeRe() {
11577
+ if (this.regexp || this.regexp === false)
11578
+ return this.regexp;
11579
+ var set = this.set;
11580
+ if (!set.length) {
11581
+ this.regexp = false;
11582
+ return this.regexp;
11583
+ }
11584
+ var options = this.options;
11585
+ var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
11586
+ var flags = options.nocase ? "i" : "";
11587
+ var re = set.map(function(pattern) {
11588
+ return pattern.map(function(p) {
11589
+ return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
11590
+ }).join("\\/");
11591
+ }).join("|");
11592
+ re = "^(?:" + re + ")$";
11593
+ if (this.negate)
11594
+ re = "^(?!" + re + ").*$";
11595
+ try {
11596
+ this.regexp = new RegExp(re, flags);
11597
+ } catch (ex) {
11598
+ this.regexp = false;
11599
+ }
11600
+ return this.regexp;
11601
+ }
11602
+ minimatch2.match = function(list, pattern, options) {
11603
+ options = options || {};
11604
+ var mm = new Minimatch(pattern, options);
11605
+ list = list.filter(function(f) {
11606
+ return mm.match(f);
11607
+ });
11608
+ if (mm.options.nonull && !list.length) {
11609
+ list.push(pattern);
11610
+ }
11611
+ return list;
11612
+ };
11613
+ Minimatch.prototype.match = function match(f, partial) {
11614
+ if (typeof partial === "undefined")
11615
+ partial = this.partial;
11616
+ this.debug("match", f, this.pattern);
11617
+ if (this.comment)
11618
+ return false;
11619
+ if (this.empty)
11620
+ return f === "";
11621
+ if (f === "/" && partial)
11622
+ return true;
11623
+ var options = this.options;
11624
+ if (path6.sep !== "/") {
11625
+ f = f.split(path6.sep).join("/");
11626
+ }
11627
+ f = f.split(slashSplit);
11628
+ this.debug(this.pattern, "split", f);
11629
+ var set = this.set;
11630
+ this.debug(this.pattern, "set", set);
11631
+ var filename;
11632
+ var i;
11633
+ for (i = f.length - 1; i >= 0; i--) {
11634
+ filename = f[i];
11635
+ if (filename)
11636
+ break;
11637
+ }
11638
+ for (i = 0; i < set.length; i++) {
11639
+ var pattern = set[i];
11640
+ var file = f;
11641
+ if (options.matchBase && pattern.length === 1) {
11642
+ file = [filename];
11643
+ }
11644
+ var hit = this.matchOne(file, pattern, partial);
11645
+ if (hit) {
11646
+ if (options.flipNegate)
11647
+ return true;
11648
+ return !this.negate;
11649
+ }
11650
+ }
11651
+ if (options.flipNegate)
11652
+ return false;
11653
+ return this.negate;
11654
+ };
11655
+ Minimatch.prototype.matchOne = function(file, pattern, partial) {
11656
+ var options = this.options;
11657
+ this.debug(
11658
+ "matchOne",
11659
+ { "this": this, file, pattern }
11660
+ );
11661
+ this.debug("matchOne", file.length, pattern.length);
11662
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
11663
+ this.debug("matchOne loop");
11664
+ var p = pattern[pi];
11665
+ var f = file[fi];
11666
+ this.debug(pattern, p, f);
11667
+ if (p === false)
11668
+ return false;
11669
+ if (p === GLOBSTAR) {
11670
+ this.debug("GLOBSTAR", [pattern, p, f]);
11671
+ var fr = fi;
11672
+ var pr = pi + 1;
11673
+ if (pr === pl) {
11674
+ this.debug("** at the end");
11675
+ for (; fi < fl; fi++) {
11676
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
11677
+ return false;
11678
+ }
11679
+ return true;
11680
+ }
11681
+ while (fr < fl) {
11682
+ var swallowee = file[fr];
11683
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
11684
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
11685
+ this.debug("globstar found match!", fr, fl, swallowee);
11686
+ return true;
11687
+ } else {
11688
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
11689
+ this.debug("dot detected!", file, fr, pattern, pr);
11690
+ break;
11691
+ }
11692
+ this.debug("globstar swallow a segment, and continue");
11693
+ fr++;
11694
+ }
11695
+ }
11696
+ if (partial) {
11697
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
11698
+ if (fr === fl)
11699
+ return true;
11700
+ }
11701
+ return false;
11702
+ }
11703
+ var hit;
11704
+ if (typeof p === "string") {
11705
+ hit = f === p;
11706
+ this.debug("string match", p, f, hit);
11707
+ } else {
11708
+ hit = f.match(p);
11709
+ this.debug("pattern match", p, f, hit);
11710
+ }
11711
+ if (!hit)
11712
+ return false;
11713
+ }
11714
+ if (fi === fl && pi === pl) {
11715
+ return true;
11716
+ } else if (fi === fl) {
11717
+ return partial;
11718
+ } else if (pi === pl) {
11719
+ return fi === fl - 1 && file[fi] === "";
11720
+ }
11721
+ throw new Error("wtf?");
11722
+ };
11723
+ function globUnescape(s) {
11724
+ return s.replace(/\\(.)/g, "$1");
11725
+ }
11726
+ function regExpEscape(s) {
11727
+ return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
11728
+ }
11729
+ }
11730
+ });
11731
+
10915
11732
  // src/index.ts
10916
11733
  var src_exports = {};
10917
11734
  __export(src_exports, {
10918
11735
  MAX_AGE_ONE_YEAR: () => MAX_AGE_ONE_YEAR,
10919
11736
  build: () => build,
10920
11737
  diagnostics: () => diagnostics,
11738
+ getDevManifest: () => getDevManifest,
10921
11739
  htmlContentType: () => htmlContentType,
10922
11740
  prepareCache: () => prepareCache,
10923
11741
  version: () => version
10924
11742
  });
10925
11743
  module.exports = __toCommonJS(src_exports);
10926
- var import_build_utils3 = require("@vercel/build-utils");
11744
+ var import_build_utils5 = require("@vercel/build-utils");
10927
11745
  var import_superstatic = __toESM(require_superstatic());
10928
11746
  var import_nft2 = require("@vercel/nft");
10929
11747
  var import_async_sema3 = __toESM(require_lib());
10930
11748
  var import_escape_string_regexp3 = __toESM(require_escape_string_regexp());
10931
11749
  var import_find_up = __toESM(require_find_up());
10932
11750
  var import_fs_extra6 = __toESM(require_lib2());
10933
- var import_path6 = __toESM(require("path"));
11751
+ var import_path7 = __toESM(require("path"));
10934
11752
  var import_semver5 = __toESM(require_semver());
10935
11753
  var import_url2 = __toESM(require("url"));
10936
11754
 
@@ -16695,6 +17513,243 @@ ${JSON.stringify(
16695
17513
  };
16696
17514
  }
16697
17515
 
17516
+ // src/dev-manifest.ts
17517
+ var import_build_utils4 = require("@vercel/build-utils");
17518
+ var import_minimatch = __toESM(require_minimatch());
17519
+ var import_path6 = require("path");
17520
+
17521
+ // src/next-dev-config.ts
17522
+ var import_child_process = require("child_process");
17523
+ var import_build_utils3 = require("@vercel/build-utils");
17524
+ var loader = `
17525
+ const { createRequire } = require('module');
17526
+ const { join } = require('path');
17527
+ const projectRequire = createRequire(join(process.cwd(), 'package.json'));
17528
+ async function load(files) {
17529
+ const nextRequire = createRequire(projectRequire.resolve('next/package.json'));
17530
+ const { PHASE_DEVELOPMENT_SERVER } = nextRequire('next/constants');
17531
+ const { default: loadConfig } = nextRequire('next/dist/server/config');
17532
+ // Older Next versions interpret a third argument as a custom config override.
17533
+ const config = await loadConfig(PHASE_DEVELOPMENT_SERVER, process.cwd());
17534
+ const result = {
17535
+ basePath: config.basePath,
17536
+ pageExtensions: config.pageExtensions,
17537
+ trailingSlash: config.trailingSlash === true,
17538
+ skipTrailingSlashRedirect: config.skipTrailingSlashRedirect === true,
17539
+ caseSensitiveRoutes: config.experimental?.caseSensitiveRoutes === true,
17540
+ };
17541
+ if (files.length) {
17542
+ result.edgeRuntimeFiles = [];
17543
+ const extensions = [...config.pageExtensions].sort((a, b) => b.length - a.length);
17544
+ for (const file of files) {
17545
+ const extension = extensions.find(ext => file.endsWith('.' + ext));
17546
+ if (!extension) continue;
17547
+ const entry = file.slice(0, -extension.length - 1).replace(/^src\\//, '');
17548
+ if (!/^(app\\/(.*\\/)?route|pages\\/api(\\/.*)?)$/.test(entry)) continue;
17549
+ if (entry.includes('[') || entry.split('/').some(part => part.startsWith('@') || (entry.startsWith('app/') && part.startsWith('_')) || /^\\(\\.{1,3}\\)/.test(part))) continue;
17550
+ const router = entry.split('/')[0];
17551
+ if (file.startsWith('src/') && files.some(candidate => candidate.startsWith(router + '/'))) continue;
17552
+ // Next's static analysis reads exports without executing the handler.
17553
+ const { getPageStaticInfo } = nextRequire('next/dist/build/analysis/get-page-static-info');
17554
+ const { runtime } = await getPageStaticInfo({
17555
+ pageFilePath: join(process.cwd(), file),
17556
+ nextConfig: config,
17557
+ isDev: true,
17558
+ page: '/' + entry.split('/').slice(1).join('/'),
17559
+ pageType: entry.startsWith('app/') ? 'app' : 'pages',
17560
+ });
17561
+ if (runtime === 'edge' || runtime === 'experimental-edge') result.edgeRuntimeFiles.push(file);
17562
+ }
17563
+ }
17564
+ process.send(result);
17565
+ }
17566
+ process.once('message', files => load(files).catch(() => process.exit(1)));
17567
+ `;
17568
+ function loadNextDevRoutingConfig(cwd, env, files = []) {
17569
+ return new Promise((resolve, reject) => {
17570
+ const fail = () => reject(
17571
+ new import_build_utils3.NowBuildError({
17572
+ code: "NEXT_DEV_MANIFEST_CONFIG",
17573
+ message: `Could not load Next.js development configuration in "${cwd}" for manifest discovery. Ensure Node.js and the project's Next.js dependency are installed, and that next dev can load next.config.* and statically analyze route runtime exports with the development environment. Configuration and route metadata must resolve within 10 seconds and return a string basePath and non-empty pageExtensions.`
17574
+ })
17575
+ );
17576
+ let child;
17577
+ try {
17578
+ child = (0, import_child_process.spawn)(
17579
+ (0, import_build_utils3.getNodeExecPath)(),
17580
+ ["--input-type=commonjs", "-e", loader],
17581
+ {
17582
+ cwd,
17583
+ env: { ...env, NODE_ENV: env.NODE_ENV ?? "development" },
17584
+ stdio: ["ignore", "ignore", "ignore", "ipc"],
17585
+ windowsHide: true
17586
+ }
17587
+ );
17588
+ } catch {
17589
+ fail();
17590
+ return;
17591
+ }
17592
+ const timeout = setTimeout(() => {
17593
+ child.kill("SIGKILL");
17594
+ fail();
17595
+ }, 1e4);
17596
+ child.once("error", () => {
17597
+ clearTimeout(timeout);
17598
+ fail();
17599
+ });
17600
+ child.once("exit", () => {
17601
+ clearTimeout(timeout);
17602
+ fail();
17603
+ });
17604
+ child.once("message", (config) => {
17605
+ clearTimeout(timeout);
17606
+ child.kill("SIGKILL");
17607
+ if (!config || typeof config !== "object" || !("basePath" in config) || typeof config.basePath !== "string" || !("pageExtensions" in config) || !Array.isArray(config.pageExtensions) || !config.pageExtensions.length || !config.pageExtensions.every(
17608
+ (ext) => typeof ext === "string" && ext.length > 0
17609
+ ) || "edgeRuntimeFiles" in config && (!Array.isArray(config.edgeRuntimeFiles) || !config.edgeRuntimeFiles.every((file) => typeof file === "string"))) {
17610
+ fail();
17611
+ return;
17612
+ }
17613
+ resolve({
17614
+ basePath: config.basePath,
17615
+ pageExtensions: config.pageExtensions,
17616
+ trailingSlash: "trailingSlash" in config && config.trailingSlash === true,
17617
+ skipTrailingSlashRedirect: "skipTrailingSlashRedirect" in config && config.skipTrailingSlashRedirect === true,
17618
+ caseSensitiveRoutes: "caseSensitiveRoutes" in config && config.caseSensitiveRoutes === true,
17619
+ ..."edgeRuntimeFiles" in config ? { edgeRuntimeFiles: config.edgeRuntimeFiles } : {}
17620
+ });
17621
+ });
17622
+ child.send(files, (error) => {
17623
+ if (error) {
17624
+ clearTimeout(timeout);
17625
+ child.kill("SIGKILL");
17626
+ fail();
17627
+ }
17628
+ });
17629
+ });
17630
+ }
17631
+
17632
+ // src/dev-manifest.ts
17633
+ var getDevManifest = async ({
17634
+ workPath,
17635
+ build: build2,
17636
+ files,
17637
+ config,
17638
+ env
17639
+ }) => {
17640
+ const functions = /* @__PURE__ */ new Map();
17641
+ const matchedFunctionPatterns = /* @__PURE__ */ new Set();
17642
+ const entries = Object.entries(config.functions ?? {});
17643
+ const entryDirectory = build2.src ? import_path6.posix.dirname(build2.src) : ".";
17644
+ const prefix = entryDirectory === "." ? "" : `${entryDirectory}/`;
17645
+ const sources = [...new Set(files)].filter((file) => file.startsWith(prefix));
17646
+ let nextConfig;
17647
+ for (const sourceFile of sources) {
17648
+ const relativeFile = sourceFile.slice(prefix.length);
17649
+ if (!/^(?:src\/)?(?:app|pages)\//.test(relativeFile))
17650
+ continue;
17651
+ const matched = entries.find(
17652
+ ([pattern2]) => sourceFile === pattern2 || (0, import_minimatch.default)(sourceFile, pattern2)
17653
+ );
17654
+ const pattern = matched?.[0];
17655
+ const hasTriggers = !!matched?.[1].experimentalTriggers?.length;
17656
+ nextConfig ??= await loadNextDevRoutingConfig(
17657
+ (0, import_path6.join)(workPath, entryDirectory),
17658
+ env,
17659
+ sources.map((file2) => file2.slice(prefix.length))
17660
+ );
17661
+ const file = relativeFile.replace(/^src\//, "");
17662
+ const extension = [...nextConfig.pageExtensions].sort((a, b) => b.length - a.length).find((ext) => file.endsWith(`.${ext}`));
17663
+ const extensionless = extension ? file.slice(0, -extension.length - 1) : "";
17664
+ const isPagesApi = /^pages\/api(?:\/.+)?$/.test(extensionless);
17665
+ const isAppRoute = /^app\/(?:.+\/)?route$/.test(extensionless);
17666
+ const isPage = extensionless.startsWith("pages/") || /^app\/(?:.+\/)?page$/.test(extensionless);
17667
+ if (!isPagesApi && !isAppRoute && !isPage && pattern !== sourceFile) {
17668
+ continue;
17669
+ }
17670
+ const routerDirectory = file.split("/")[0];
17671
+ if (relativeFile.startsWith("src/") && sources.some(
17672
+ (candidate) => candidate.startsWith(`${prefix}${routerDirectory}/`)
17673
+ )) {
17674
+ if (!hasTriggers)
17675
+ continue;
17676
+ throw new import_build_utils4.NowBuildError({
17677
+ code: "NEXT_DEV_MANIFEST_FUNCTION_UNSUPPORTED",
17678
+ message: `Cannot include "${sourceFile}" in the development manifest: Next.js uses the root ${routerDirectory} directory instead of src/${routerDirectory}. Move the handler and its functions configuration to the active router directory.`
17679
+ });
17680
+ }
17681
+ let pathname;
17682
+ if (isPagesApi) {
17683
+ pathname = extensionless.replace(/^pages/, "").replace(/\/index$/, "");
17684
+ } else if (isAppRoute && !file.split("/").some((segment) => segment.startsWith("_"))) {
17685
+ pathname = `/${file.split("/").slice(1, -1).filter((segment) => !(segment.startsWith("(") && segment.endsWith(")"))).join("/")}`;
17686
+ }
17687
+ if (!pathname || !/^\/(?:[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*)?$/.test(pathname) || pathname.split("/").some((segment) => segment === "." || segment === "..")) {
17688
+ if (!hasTriggers)
17689
+ continue;
17690
+ throw new import_build_utils4.NowBuildError({
17691
+ code: "NEXT_DEV_MANIFEST_FUNCTION_UNSUPPORTED",
17692
+ message: `Cannot include "${sourceFile}" in the development manifest. Configure a static Next.js App Router route handler (app/**/route.*) or Pages API route (pages/api.* or pages/api/**) matching pageExtensions. Dynamic, private, parallel, and intercepted routes and rendered pages are not supported.`
17693
+ });
17694
+ }
17695
+ if (nextConfig.basePath && entryDirectory !== ".") {
17696
+ throw new import_build_utils4.NowBuildError({
17697
+ code: "NEXT_BASEPATH_LEGACY_BUILDS",
17698
+ message: "basePath can not be used with `builds` in vercel.json, use Project Settings to configure your monorepo instead"
17699
+ });
17700
+ }
17701
+ const outputDirectory = import_path6.posix.join(entryDirectory, nextConfig.basePath);
17702
+ const outputName = import_path6.posix.join(
17703
+ outputDirectory,
17704
+ pathname === "/" ? "index" : pathname
17705
+ );
17706
+ let outputPath = isPagesApi ? normalizeIndexOutput(outputName, true) : outputName;
17707
+ if (nextConfig.edgeRuntimeFiles?.includes(relativeFile)) {
17708
+ outputPath = import_path6.posix.join(
17709
+ ".",
17710
+ nextConfig.basePath,
17711
+ pathname === "/" ? "index" : pathname
17712
+ );
17713
+ if (nextConfig.basePath) {
17714
+ outputPath = normalizeIndexOutput(outputPath, true);
17715
+ }
17716
+ }
17717
+ const existing = functions.get(outputPath);
17718
+ if (existing) {
17719
+ throw new import_build_utils4.NowBuildError({
17720
+ code: "NEXT_DEV_MANIFEST_FUNCTION_COLLISION",
17721
+ message: `Next.js sources "${existing.sourceFile}" and "${sourceFile}" resolve to the same development manifest output "${outputPath}". Each function must have a unique deployment output identity.`
17722
+ });
17723
+ }
17724
+ const { experimentalTriggers } = await (0, import_build_utils4.getLambdaOptionsFromFunction)({
17725
+ sourceFile,
17726
+ config
17727
+ });
17728
+ let invocationPathname = `${nextConfig.basePath}${pathname === "/" ? "" : pathname}` || "/";
17729
+ if (nextConfig.trailingSlash && !nextConfig.skipTrailingSlashRedirect && (pathname === "/" && nextConfig.basePath || new RegExp(
17730
+ "^/(?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+$",
17731
+ nextConfig.caseSensitiveRoutes ? "" : "i"
17732
+ ).test(invocationPathname))) {
17733
+ invocationPathname += "/";
17734
+ }
17735
+ functions.set(outputPath, {
17736
+ outputPath,
17737
+ sourceFile,
17738
+ invocation: {
17739
+ type: "http",
17740
+ pathname: invocationPathname
17741
+ },
17742
+ ...experimentalTriggers === void 0 ? {} : { experimentalTriggers }
17743
+ });
17744
+ if (pattern)
17745
+ matchedFunctionPatterns.add(pattern);
17746
+ }
17747
+ return {
17748
+ functions: [...functions.values()],
17749
+ matchedFunctionPatterns: [...matchedFunctionPatterns]
17750
+ };
17751
+ };
17752
+
16698
17753
  // src/index.ts
16699
17754
  var version = 2;
16700
17755
  var htmlContentType = "text/html; charset=utf-8";
@@ -16705,23 +17760,23 @@ var IS_APP_CLIENT_SEGMENT_CACHE_ENABLED_VERSION = "v16.0.0";
16705
17760
  var MINIMUM_NEXT_ADAPTER_VERSION = "v16.2.0-canary.28";
16706
17761
  var MAX_AGE_ONE_YEAR = 31536e3;
16707
17762
  async function readPackageJson(entryPath) {
16708
- const packagePath = import_path6.default.join(entryPath, "package.json");
17763
+ const packagePath = import_path7.default.join(entryPath, "package.json");
16709
17764
  try {
16710
17765
  return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
16711
17766
  } catch (_err) {
16712
- (0, import_build_utils3.debug)("package.json not found in entry");
17767
+ (0, import_build_utils5.debug)("package.json not found in entry");
16713
17768
  return {};
16714
17769
  }
16715
17770
  }
16716
17771
  async function writePackageJson(workPath, packageJson) {
16717
17772
  await (0, import_fs_extra6.writeFile)(
16718
- import_path6.default.join(workPath, "package.json"),
17773
+ import_path7.default.join(workPath, "package.json"),
16719
17774
  JSON.stringify(packageJson, null, 2)
16720
17775
  );
16721
17776
  }
16722
17777
  async function writeNpmRc(workPath, token) {
16723
17778
  await (0, import_fs_extra6.writeFile)(
16724
- import_path6.default.join(workPath, ".npmrc"),
17779
+ import_path7.default.join(workPath, ".npmrc"),
16725
17780
  `//registry.npmjs.org/:_authToken=${token}`
16726
17781
  );
16727
17782
  }
@@ -16765,7 +17820,7 @@ function isLegacyNext(nextVersion) {
16765
17820
  }
16766
17821
  var build = async (buildOptions) => {
16767
17822
  let { workPath, repoRootPath } = buildOptions;
16768
- const builderSpan = buildOptions.span ?? new import_build_utils3.Span({ name: "vc.builder" });
17823
+ const builderSpan = buildOptions.span ?? new import_build_utils5.Span({ name: "vc.builder" });
16769
17824
  const {
16770
17825
  files,
16771
17826
  entrypoint,
@@ -16774,16 +17829,16 @@ var build = async (buildOptions) => {
16774
17829
  buildCallback
16775
17830
  } = buildOptions;
16776
17831
  validateEntrypoint(entrypoint);
16777
- let entryDirectory = import_path6.default.dirname(entrypoint);
16778
- let entryPath = import_path6.default.join(workPath, entryDirectory);
17832
+ let entryDirectory = import_path7.default.dirname(entrypoint);
17833
+ let entryPath = import_path7.default.join(workPath, entryDirectory);
16779
17834
  if (config.rootDirectory) {
16780
17835
  repoRootPath = entryPath;
16781
- entryPath = import_path6.default.join(entryPath, config.rootDirectory);
17836
+ entryPath = import_path7.default.join(entryPath, config.rootDirectory);
16782
17837
  }
16783
- const outputDirectory = import_path6.default.join("./", config.outputDirectory || ".next");
16784
- const dotNextStatic = import_path6.default.join(entryPath, outputDirectory, "static");
17838
+ const outputDirectory = import_path7.default.join("./", config.outputDirectory || ".next");
17839
+ const dotNextStatic = import_path7.default.join(entryPath, outputDirectory, "static");
16785
17840
  const baseDir = repoRootPath || workPath;
16786
- (0, import_build_utils3.debug)(
17841
+ (0, import_build_utils5.debug)(
16787
17842
  JSON.stringify(
16788
17843
  {
16789
17844
  repoRootPath,
@@ -16797,20 +17852,20 @@ var build = async (buildOptions) => {
16797
17852
  2
16798
17853
  )
16799
17854
  );
16800
- const prefixedEnvs = (0, import_build_utils3.getPrefixedEnvVars)({
17855
+ const prefixedEnvs = (0, import_build_utils5.getPrefixedEnvVars)({
16801
17856
  envPrefix: "NEXT_PUBLIC_",
16802
17857
  envs: process.env
16803
17858
  });
16804
17859
  for (const [key, value] of Object.entries(prefixedEnvs)) {
16805
17860
  process.env[key] = value;
16806
17861
  }
16807
- await (0, import_build_utils3.download)(files, workPath, meta);
17862
+ await (0, import_build_utils5.download)(files, workPath, meta);
16808
17863
  if (config.rootDirectory) {
16809
- workPath = import_path6.default.join(workPath, config.rootDirectory);
17864
+ workPath = import_path7.default.join(workPath, config.rootDirectory);
16810
17865
  }
16811
17866
  let pkg = await readPackageJson(entryPath);
16812
17867
  const nextVersionRange = await getNextVersionRange(entryPath);
16813
- const nodeVersion = await (0, import_build_utils3.getNodeVersion)(entryPath, void 0, config, meta);
17868
+ const nodeVersion = await (0, import_build_utils5.getNodeVersion)(entryPath, void 0, config, meta);
16814
17869
  const {
16815
17870
  cliType,
16816
17871
  lockfilePath,
@@ -16818,8 +17873,8 @@ var build = async (buildOptions) => {
16818
17873
  packageJsonPackageManager,
16819
17874
  packageJsonDevEngines,
16820
17875
  turboSupportsCorepackHome
16821
- } = await (0, import_build_utils3.scanParentDirs)(entryPath, true);
16822
- const spawnEnv = (0, import_build_utils3.getEnvForPackageManager)({
17876
+ } = await (0, import_build_utils5.scanParentDirs)(entryPath, true);
17877
+ const spawnEnv = (0, import_build_utils5.getEnvForPackageManager)({
16823
17878
  cliType,
16824
17879
  lockfileVersion,
16825
17880
  packageJsonPackageManager,
@@ -16838,21 +17893,21 @@ var build = async (buildOptions) => {
16838
17893
  console.warn("WARNING: You should not upload the `.next` directory.");
16839
17894
  }
16840
17895
  const isLegacy = nextVersionRange && isLegacyNext(nextVersionRange);
16841
- (0, import_build_utils3.debug)(`MODE: ${isLegacy ? "legacy" : "server(less)"}`);
17896
+ (0, import_build_utils5.debug)(`MODE: ${isLegacy ? "legacy" : "server(less)"}`);
16842
17897
  if (isLegacy) {
16843
17898
  console.warn(
16844
17899
  "WARNING: your application is being deployed in @vercel/next's legacy mode. http://err.sh/vercel/vercel/now-next-legacy-mode"
16845
17900
  );
16846
17901
  await Promise.all([
16847
- (0, import_fs_extra6.remove)(import_path6.default.join(entryPath, "yarn.lock")),
16848
- (0, import_fs_extra6.remove)(import_path6.default.join(entryPath, "package-lock.json"))
17902
+ (0, import_fs_extra6.remove)(import_path7.default.join(entryPath, "yarn.lock")),
17903
+ (0, import_fs_extra6.remove)(import_path7.default.join(entryPath, "package-lock.json"))
16849
17904
  ]);
16850
- (0, import_build_utils3.debug)("Normalizing package.json");
17905
+ (0, import_build_utils5.debug)("Normalizing package.json");
16851
17906
  pkg = normalizePackageJson(pkg);
16852
- (0, import_build_utils3.debug)("Normalized package.json result: ", pkg);
17907
+ (0, import_build_utils5.debug)("Normalized package.json result: ", pkg);
16853
17908
  await writePackageJson(entryPath, pkg);
16854
17909
  }
16855
- let buildScriptName = (0, import_build_utils3.getScriptName)(pkg, [
17910
+ let buildScriptName = (0, import_build_utils5.getScriptName)(pkg, [
16856
17911
  "vercel-build",
16857
17912
  "now-build",
16858
17913
  "build"
@@ -16872,10 +17927,10 @@ var build = async (buildOptions) => {
16872
17927
  buildScriptName = "vercel-build";
16873
17928
  }
16874
17929
  if (process.env.NPM_AUTH_TOKEN) {
16875
- (0, import_build_utils3.debug)("Found NPM_AUTH_TOKEN in environment, creating .npmrc");
17930
+ (0, import_build_utils5.debug)("Found NPM_AUTH_TOKEN in environment, creating .npmrc");
16876
17931
  await writeNpmRc(entryPath, process.env.NPM_AUTH_TOKEN);
16877
17932
  }
16878
- const { detectedPackageManager } = (0, import_build_utils3.detectPackageManager)(
17933
+ const { detectedPackageManager } = (0, import_build_utils5.detectPackageManager)(
16879
17934
  cliType,
16880
17935
  lockfileVersion,
16881
17936
  config.projectSettings?.createdAt
@@ -16890,7 +17945,7 @@ var build = async (buildOptions) => {
16890
17945
  install: JSON.stringify(shouldRunInstallCommand)
16891
17946
  });
16892
17947
  if (shouldRunInstallCommand) {
16893
- await builderSpan.child(import_build_utils3.BUILDER_INSTALLER_STEP, {
17948
+ await builderSpan.child(import_build_utils5.BUILDER_INSTALLER_STEP, {
16894
17949
  cliType,
16895
17950
  lockfileVersion: lockfileVersion?.toString(),
16896
17951
  packageJsonPackageManager,
@@ -16901,12 +17956,12 @@ var build = async (buildOptions) => {
16901
17956
  console.log(
16902
17957
  `Running "install" command: \`${trimmedInstallCommand}\`...`
16903
17958
  );
16904
- await (0, import_build_utils3.execCommand)(trimmedInstallCommand, {
17959
+ await (0, import_build_utils5.execCommand)(trimmedInstallCommand, {
16905
17960
  env: spawnEnv,
16906
17961
  cwd: entryPath
16907
17962
  });
16908
17963
  } else {
16909
- await (0, import_build_utils3.runNpmInstall)(
17964
+ await (0, import_build_utils5.runNpmInstall)(
16910
17965
  entryPath,
16911
17966
  [],
16912
17967
  { env: spawnEnv },
@@ -16919,22 +17974,22 @@ var build = async (buildOptions) => {
16919
17974
  console.log(`Skipping "install" command...`);
16920
17975
  }
16921
17976
  if (spawnEnv.VERCEL_ANALYTICS_ID) {
16922
- (0, import_build_utils3.debug)("Found VERCEL_ANALYTICS_ID in environment");
16923
- const version2 = await (0, import_build_utils3.getInstalledPackageVersion)(
17977
+ (0, import_build_utils5.debug)("Found VERCEL_ANALYTICS_ID in environment");
17978
+ const version2 = await (0, import_build_utils5.getInstalledPackageVersion)(
16924
17979
  "@vercel/speed-insights",
16925
17980
  entryPath
16926
17981
  );
16927
17982
  if (version2) {
16928
17983
  delete spawnEnv.VERCEL_ANALYTICS_ID;
16929
17984
  delete process.env.VERCEL_ANALYTICS_ID;
16930
- (0, import_build_utils3.debug)(
17985
+ (0, import_build_utils5.debug)(
16931
17986
  "@vercel/speed-insights is installed, removing VERCEL_ANALYTICS_ID from environment"
16932
17987
  );
16933
17988
  }
16934
17989
  }
16935
17990
  const nextVersion = getRealNextVersion(entryPath);
16936
17991
  if (!nextVersion) {
16937
- throw new import_build_utils3.NowBuildError({
17992
+ throw new import_build_utils5.NowBuildError({
16938
17993
  code: "NEXT_NO_VERSION",
16939
17994
  message: 'No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies". Also check your Root Directory setting matches the directory of your package.json file.'
16940
17995
  });
@@ -16946,7 +18001,7 @@ var build = async (buildOptions) => {
16946
18001
  );
16947
18002
  const isCorrectLocaleAPIRoutes = import_semver5.default.gte(nextVersion, "v11.0.2-canary.3");
16948
18003
  if (isServerMode) {
16949
- (0, import_build_utils3.debug)(
18004
+ (0, import_build_utils5.debug)(
16950
18005
  `Application is being built in server mode since ${nextVersion} meets minimum version of ${SERVER_BUILD_MINIMUM_NEXT_VERSION}`
16951
18006
  );
16952
18007
  } else {
@@ -16955,7 +18010,7 @@ var build = async (buildOptions) => {
16955
18010
  if (Array.isArray(nowJsonData.routes) && nowJsonData.routes.length > 0) {
16956
18011
  hasLegacyRoutes = true;
16957
18012
  console.warn(
16958
- `WARNING: your application is being opted out of @vercel/next's optimized lambdas mode due to legacy routes in ${import_path6.default.basename(
18013
+ `WARNING: your application is being opted out of @vercel/next's optimized lambdas mode due to legacy routes in ${import_path7.default.basename(
16959
18014
  nowJsonPath
16960
18015
  )}. http://err.sh/vercel/vercel/next-legacy-routes-optimized-lambdas`
16961
18016
  );
@@ -16989,7 +18044,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16989
18044
  !process.env.NEXT_BUILDER_INTEGRATION && process.env.NEXT_ENABLE_ADAPTER === "1" && import_semver5.default.gte(nextVersion, MINIMUM_NEXT_ADAPTER_VERSION)
16990
18045
  );
16991
18046
  if (isAdapterEnabled) {
16992
- env.NEXT_ADAPTER_PATH = import_path6.default.join(__dirname, "adapter/index.js");
18047
+ env.NEXT_ADAPTER_PATH = import_path7.default.join(__dirname, "adapter/index.js");
16993
18048
  env.NEXT_ADAPTER_VERCEL_CONFIG = JSON.stringify(config);
16994
18049
  } else {
16995
18050
  const defaultNextDeploymentId = getDefaultNextDeploymentId(env);
@@ -17002,30 +18057,30 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17002
18057
  build: JSON.stringify(shouldRunCompileStep)
17003
18058
  });
17004
18059
  if (shouldRunCompileStep) {
17005
- await builderSpan.child(import_build_utils3.BUILDER_COMPILE_STEP, {
18060
+ await builderSpan.child(import_build_utils5.BUILDER_COMPILE_STEP, {
17006
18061
  buildCommand,
17007
18062
  buildScriptName
17008
18063
  }).trace(async () => {
17009
18064
  if (buildCommand) {
17010
- const nodeBinPaths = (0, import_build_utils3.getNodeBinPaths)({
18065
+ const nodeBinPaths = (0, import_build_utils5.getNodeBinPaths)({
17011
18066
  start: entryPath,
17012
18067
  base: repoRootPath
17013
18068
  });
17014
- const nodeBinPath = nodeBinPaths.join(import_path6.default.delimiter);
17015
- env.PATH = `${nodeBinPath}${import_path6.default.delimiter}${env.PATH}`;
18069
+ const nodeBinPath = nodeBinPaths.join(import_path7.default.delimiter);
18070
+ env.PATH = `${nodeBinPath}${import_path7.default.delimiter}${env.PATH}`;
17016
18071
  if (!env.YARN_NODE_LINKER) {
17017
18072
  env.YARN_NODE_LINKER = "node-modules";
17018
18073
  }
17019
- (0, import_build_utils3.debug)(
18074
+ (0, import_build_utils5.debug)(
17020
18075
  `Added "${nodeBinPath}" to PATH env because a build command was used.`
17021
18076
  );
17022
18077
  console.log(`Running "${buildCommand}"`);
17023
- await (0, import_build_utils3.execCommand)(buildCommand, {
18078
+ await (0, import_build_utils5.execCommand)(buildCommand, {
17024
18079
  cwd: entryPath,
17025
18080
  env
17026
18081
  });
17027
18082
  } else if (buildScriptName) {
17028
- await (0, import_build_utils3.runPackageJsonScript)(
18083
+ await (0, import_build_utils5.runPackageJsonScript)(
17029
18084
  entryPath,
17030
18085
  buildScriptName,
17031
18086
  {
@@ -17035,7 +18090,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17035
18090
  );
17036
18091
  }
17037
18092
  });
17038
- (0, import_build_utils3.debug)("build command exited");
18093
+ (0, import_build_utils5.debug)("build command exited");
17039
18094
  } else {
17040
18095
  console.log(`Skipping "build" command...`);
17041
18096
  }
@@ -17043,39 +18098,39 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17043
18098
  await buildCallback(buildOptions);
17044
18099
  }
17045
18100
  try {
17046
- await (0, import_build_utils3.generateProjectManifest)({
18101
+ await (0, import_build_utils5.generateProjectManifest)({
17047
18102
  workPath,
17048
18103
  nodeVersion,
17049
18104
  cliType,
17050
18105
  lockfilePath,
17051
18106
  lockfileVersion,
17052
18107
  framework: config.framework ?? void 0,
17053
- serviceType: buildOptions.service ? (0, import_build_utils3.getReportedServiceType)(buildOptions.service) : void 0
18108
+ serviceType: buildOptions.service ? (0, import_build_utils5.getReportedServiceType)(buildOptions.service) : void 0
17054
18109
  });
17055
18110
  } catch (err) {
17056
- (0, import_build_utils3.debug)(
18111
+ (0, import_build_utils5.debug)(
17057
18112
  `Failed to write next manifest: ${err instanceof Error ? err.message : String(err)}`
17058
18113
  );
17059
18114
  }
17060
18115
  let buildOutputVersion;
17061
18116
  try {
17062
18117
  const data = await (0, import_fs_extra6.readJSON)(
17063
- import_path6.default.join(entryPath, outputDirectory, "output/config.json")
18118
+ import_path7.default.join(entryPath, outputDirectory, "output/config.json")
17064
18119
  );
17065
18120
  buildOutputVersion = data.version;
17066
18121
  } catch (_) {
17067
18122
  }
17068
18123
  if (buildOutputVersion) {
17069
- const publicDir = import_path6.default.join(entryPath, "public");
17070
- const staticOutputDir = import_path6.default.join(
18124
+ const publicDir = import_path7.default.join(entryPath, "public");
18125
+ const staticOutputDir = import_path7.default.join(
17071
18126
  entryPath,
17072
18127
  outputDirectory,
17073
18128
  "output/static"
17074
18129
  );
17075
18130
  if (await (0, import_fs_extra6.pathExists)(publicDir)) {
17076
- const publicFiles = await (0, import_build_utils3.glob)("**/*", publicDir);
18131
+ const publicFiles = await (0, import_build_utils5.glob)("**/*", publicDir);
17077
18132
  for (const fileName of Object.keys(publicFiles)) {
17078
- const destPath = import_path6.default.join(staticOutputDir, fileName);
18133
+ const destPath = import_path7.default.join(staticOutputDir, fileName);
17079
18134
  if (!await (0, import_fs_extra6.pathExists)(destPath)) {
17080
18135
  const srcPath = publicFiles[fileName].fsPath;
17081
18136
  await (0, import_fs_extra6.copy)(srcPath, destPath);
@@ -17083,15 +18138,15 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17083
18138
  }
17084
18139
  }
17085
18140
  return {
17086
- buildOutputPath: import_path6.default.join(entryPath, outputDirectory, "output"),
18141
+ buildOutputPath: import_path7.default.join(entryPath, outputDirectory, "output"),
17087
18142
  buildOutputVersion,
17088
18143
  framework: { slug: "nextjs", version: nextVersion }
17089
18144
  };
17090
18145
  }
17091
- const absoluteOutputDirectory = import_path6.default.join(entryPath, outputDirectory);
18146
+ const absoluteOutputDirectory = import_path7.default.join(entryPath, outputDirectory);
17092
18147
  const outputDirExists = await (0, import_fs_extra6.pathExists)(absoluteOutputDirectory);
17093
18148
  if (!outputDirExists) {
17094
- throw new import_build_utils3.NowBuildError({
18149
+ throw new import_build_utils5.NowBuildError({
17095
18150
  code: "NEXT_OUTPUT_DIR_MISSING",
17096
18151
  message: `The Next.js output directory "${outputDirectory}" was not found at "${absoluteOutputDirectory}". This is usually caused by one of the following:
17097
18152
 
@@ -17105,7 +18160,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17105
18160
  }
17106
18161
  const outputDirContents = await (0, import_fs_extra6.readdir)(absoluteOutputDirectory);
17107
18162
  if (outputDirContents.length === 0) {
17108
- throw new import_build_utils3.NowBuildError({
18163
+ throw new import_build_utils5.NowBuildError({
17109
18164
  code: "NEXT_OUTPUT_DIR_EMPTY",
17110
18165
  message: `The Next.js output directory "${outputDirectory}" exists but is empty. This is usually caused by one of the following:
17111
18166
 
@@ -17117,7 +18172,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17117
18172
  link: "https://err.sh/vercel/vercel/now-next-routes-manifest"
17118
18173
  });
17119
18174
  }
17120
- let appMountPrefixNoTrailingSlash = import_path6.default.posix.join("/", entryDirectory).replace(/\/+$/, "");
18175
+ let appMountPrefixNoTrailingSlash = import_path7.default.posix.join("/", entryDirectory).replace(/\/+$/, "");
17121
18176
  const requiredServerFilesManifest = isServerMode ? await getRequiredServerFilesManifest(entryPath, outputDirectory) : false;
17122
18177
  isServerMode = Boolean(requiredServerFilesManifest);
17123
18178
  const functionsConfigManifest = await getFunctionsConfigManifest(
@@ -17141,8 +18196,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17141
18196
  const omittedPrerenderRoutes = new Set(
17142
18197
  Object.keys(prerenderManifest.omittedRoutes)
17143
18198
  );
17144
- const hasIsr404Page = typeof prerenderManifest.staticRoutes[routesManifest?.i18n ? import_path6.default.join("/", routesManifest?.i18n.defaultLocale, "/404") : "/404"]?.initialRevalidate === "number";
17145
- const hasIsr500Page = typeof prerenderManifest.staticRoutes[routesManifest?.i18n ? import_path6.default.join("/", routesManifest?.i18n.defaultLocale, "/500") : "/500"]?.initialRevalidate === "number";
18199
+ const hasIsr404Page = typeof prerenderManifest.staticRoutes[routesManifest?.i18n ? import_path7.default.join("/", routesManifest?.i18n.defaultLocale, "/404") : "/404"]?.initialRevalidate === "number";
18200
+ const hasIsr500Page = typeof prerenderManifest.staticRoutes[routesManifest?.i18n ? import_path7.default.join("/", routesManifest?.i18n.defaultLocale, "/500") : "/500"]?.initialRevalidate === "number";
17146
18201
  const wildcardConfig = routesManifest?.i18n?.domains && routesManifest.i18n.domains.length > 0 ? routesManifest.i18n.domains.map((item) => {
17147
18202
  return {
17148
18203
  domain: item.domain,
@@ -17150,7 +18205,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17150
18205
  };
17151
18206
  }) : void 0;
17152
18207
  const privateOutputs = await getPrivateOutputs(
17153
- import_path6.default.join(entryPath, outputDirectory),
18208
+ import_path7.default.join(entryPath, outputDirectory),
17154
18209
  {
17155
18210
  "next-stats.json": "_next/__private/stats.json",
17156
18211
  trace: "_next/__private/trace"
@@ -17171,12 +18226,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17171
18226
  if (isLegacy || isSharedLambdas || isServerMode) {
17172
18227
  try {
17173
18228
  buildId = await (0, import_fs_extra6.readFile)(
17174
- import_path6.default.join(entryPath, outputDirectory, "BUILD_ID"),
18229
+ import_path7.default.join(entryPath, outputDirectory, "BUILD_ID"),
17175
18230
  "utf8"
17176
18231
  );
17177
18232
  escapedBuildId = (0, import_escape_string_regexp3.default)(buildId);
17178
18233
  } catch (_err) {
17179
- throw new import_build_utils3.NowBuildError({
18234
+ throw new import_build_utils5.NowBuildError({
17180
18235
  code: "NOW_NEXT_NO_BUILD_ID",
17181
18236
  message: 'The BUILD_ID file was not found in the Output Directory. Did you forget to run "next build" in your Build Command?'
17182
18237
  });
@@ -17260,26 +18315,26 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17260
18315
  if (routesManifest.basePath && routesManifest.basePath !== "/") {
17261
18316
  const nextBasePath = routesManifest.basePath;
17262
18317
  if (!nextBasePath.startsWith("/")) {
17263
- throw new import_build_utils3.NowBuildError({
18318
+ throw new import_build_utils5.NowBuildError({
17264
18319
  code: "NEXT_BASEPATH_STARTING_SLASH",
17265
18320
  message: "basePath must start with `/`. Please upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen."
17266
18321
  });
17267
18322
  }
17268
18323
  if (nextBasePath.endsWith("/")) {
17269
- throw new import_build_utils3.NowBuildError({
18324
+ throw new import_build_utils5.NowBuildError({
17270
18325
  code: "NEXT_BASEPATH_TRAILING_SLASH",
17271
18326
  message: "basePath must not end with `/`. Please upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen."
17272
18327
  });
17273
18328
  }
17274
18329
  if (entryDirectory.length > 1) {
17275
- throw new import_build_utils3.NowBuildError({
18330
+ throw new import_build_utils5.NowBuildError({
17276
18331
  code: "NEXT_BASEPATH_LEGACY_BUILDS",
17277
18332
  message: "basePath can not be used with `builds` in vercel.json, use Project Settings to configure your monorepo instead",
17278
18333
  link: "https://vercel.com/docs/platform/projects#project-settings"
17279
18334
  });
17280
18335
  }
17281
- entryDirectory = import_path6.default.join(entryDirectory, nextBasePath);
17282
- appMountPrefixNoTrailingSlash = import_path6.default.posix.join("/", entryDirectory).replace(/\/+$/, "");
18336
+ entryDirectory = import_path7.default.join(entryDirectory, nextBasePath);
18337
+ appMountPrefixNoTrailingSlash = import_path7.default.posix.join("/", entryDirectory).replace(/\/+$/, "");
17283
18338
  }
17284
18339
  if (routesManifest.pages404) {
17285
18340
  hasPages404 = true;
@@ -17287,69 +18342,69 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17287
18342
  break;
17288
18343
  }
17289
18344
  default: {
17290
- throw new import_build_utils3.NowBuildError({
18345
+ throw new import_build_utils5.NowBuildError({
17291
18346
  code: "NEXT_VERSION_OUTDATED",
17292
18347
  message: "This version of `@vercel/next` does not support the version of Next.js you are trying to deploy.\nPlease upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen."
17293
18348
  });
17294
18349
  }
17295
18350
  }
17296
18351
  }
17297
- let dynamicPrefix = import_path6.default.posix.join("/", entryDirectory);
18352
+ let dynamicPrefix = import_path7.default.posix.join("/", entryDirectory);
17298
18353
  dynamicPrefix = dynamicPrefix === "/" ? "" : dynamicPrefix;
17299
18354
  if (imagesManifest) {
17300
18355
  switch (imagesManifest.version) {
17301
18356
  case 1: {
17302
18357
  if (!imagesManifest.images) {
17303
- throw new import_build_utils3.NowBuildError({
18358
+ throw new import_build_utils5.NowBuildError({
17304
18359
  code: "NEXT_IMAGES_MISSING",
17305
18360
  message: 'image-manifest.json "images" is required. Contact support if this continues to happen.'
17306
18361
  });
17307
18362
  }
17308
18363
  const { images } = imagesManifest;
17309
18364
  if (!Array.isArray(images.domains)) {
17310
- throw new import_build_utils3.NowBuildError({
18365
+ throw new import_build_utils5.NowBuildError({
17311
18366
  code: "NEXT_IMAGES_DOMAINS",
17312
18367
  message: 'image-manifest.json "images.domains" must be an array. Contact support if this continues to happen.'
17313
18368
  });
17314
18369
  }
17315
18370
  if (!Array.isArray(images.sizes)) {
17316
- throw new import_build_utils3.NowBuildError({
18371
+ throw new import_build_utils5.NowBuildError({
17317
18372
  code: "NEXT_IMAGES_SIZES",
17318
18373
  message: 'image-manifest.json "images.sizes" must be an array. Contact support if this continues to happen.'
17319
18374
  });
17320
18375
  }
17321
18376
  if (images.remotePatterns && !Array.isArray(images.remotePatterns)) {
17322
- throw new import_build_utils3.NowBuildError({
18377
+ throw new import_build_utils5.NowBuildError({
17323
18378
  code: "NEXT_IMAGES_REMOTEPATTERNS",
17324
18379
  message: 'image-manifest.json "images.remotePatterns" must be an array. Contact support if this continues to happen'
17325
18380
  });
17326
18381
  }
17327
18382
  if (images.localPatterns && !Array.isArray(images.localPatterns)) {
17328
- throw new import_build_utils3.NowBuildError({
18383
+ throw new import_build_utils5.NowBuildError({
17329
18384
  code: "NEXT_IMAGES_LOCALPATTERNS",
17330
18385
  message: 'image-manifest.json "images.localPatterns" must be an array. Contact support if this continues to happen'
17331
18386
  });
17332
18387
  }
17333
18388
  if (images.minimumCacheTTL && !Number.isInteger(images.minimumCacheTTL)) {
17334
- throw new import_build_utils3.NowBuildError({
18389
+ throw new import_build_utils5.NowBuildError({
17335
18390
  code: "NEXT_IMAGES_MINIMUMCACHETTL",
17336
18391
  message: 'image-manifest.json "images.minimumCacheTTL" must be an integer. Contact support if this continues to happen.'
17337
18392
  });
17338
18393
  }
17339
18394
  if (images.qualities && !Array.isArray(images.qualities)) {
17340
- throw new import_build_utils3.NowBuildError({
18395
+ throw new import_build_utils5.NowBuildError({
17341
18396
  code: "NEXT_IMAGES_QUALITIES",
17342
18397
  message: 'image-manifest.json "images.qualities" must be an array. Contact support if this continues to happen.'
17343
18398
  });
17344
18399
  }
17345
18400
  if (typeof images.dangerouslyAllowSVG !== "undefined" && typeof images.dangerouslyAllowSVG !== "boolean") {
17346
- throw new import_build_utils3.NowBuildError({
18401
+ throw new import_build_utils5.NowBuildError({
17347
18402
  code: "NEXT_IMAGES_DANGEROUSLYALLOWSVG",
17348
18403
  message: 'image-manifest.json "images.dangerouslyAllowSVG" must be a boolean. Contact support if this continues to happen.'
17349
18404
  });
17350
18405
  }
17351
18406
  if (typeof images.contentSecurityPolicy !== "undefined" && typeof images.contentSecurityPolicy !== "string") {
17352
- throw new import_build_utils3.NowBuildError({
18407
+ throw new import_build_utils5.NowBuildError({
17353
18408
  code: "NEXT_IMAGES_CONTENTSECURITYPOLICY",
17354
18409
  message: 'image-manifest.json "images.contentSecurityPolicy" must be a string. Contact support if this continues to happen.'
17355
18410
  });
@@ -17357,7 +18412,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17357
18412
  break;
17358
18413
  }
17359
18414
  default: {
17360
- throw new import_build_utils3.NowBuildError({
18415
+ throw new import_build_utils5.NowBuildError({
17361
18416
  code: "NEXT_IMAGES_VERSION_UNKNOWN",
17362
18417
  message: "This version of `@vercel/next` does not support the version of Next.js you are trying to deploy.\nPlease upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen."
17363
18418
  });
@@ -17370,20 +18425,20 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17370
18425
  const { trailingSlash: trailingSlash2 = false } = exportIntent || {};
17371
18426
  const resultingExport = await getExportStatus(entryPath);
17372
18427
  if (!resultingExport) {
17373
- throw new import_build_utils3.NowBuildError({
18428
+ throw new import_build_utils5.NowBuildError({
17374
18429
  code: "NEXT_EXPORT_FAILED",
17375
18430
  message: "Exporting Next.js app failed. Please check your build logs and contact us if this continues."
17376
18431
  });
17377
18432
  }
17378
18433
  if (resultingExport.success !== true) {
17379
- throw new import_build_utils3.NowBuildError({
18434
+ throw new import_build_utils5.NowBuildError({
17380
18435
  code: "NEXT_EXPORT_FAILED",
17381
18436
  message: "Export of Next.js app failed. Please check your build logs."
17382
18437
  });
17383
18438
  }
17384
18439
  const outDirectory = resultingExport.outDirectory;
17385
- (0, import_build_utils3.debug)(`next export should use trailing slash: ${trailingSlash2}`);
17386
- const filesAfterBuild = await (0, import_build_utils3.glob)("**", outDirectory);
18440
+ (0, import_build_utils5.debug)(`next export should use trailing slash: ${trailingSlash2}`);
18441
+ const filesAfterBuild = await (0, import_build_utils5.glob)("**", outDirectory);
17387
18442
  const output = {
17388
18443
  ...filesAfterBuild,
17389
18444
  ...privateOutputs.files
@@ -17409,7 +18464,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17409
18464
  ...beforeFilesRewrites,
17410
18465
  // Make sure to 404 for the /404 path itself
17411
18466
  {
17412
- src: import_path6.default.posix.join("/", entryDirectory, "404/?"),
18467
+ src: import_path7.default.posix.join("/", entryDirectory, "404/?"),
17413
18468
  status: 404,
17414
18469
  continue: true
17415
18470
  },
@@ -17420,7 +18475,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17420
18475
  // _next/image path
17421
18476
  ...routesManifest?.basePath ? [
17422
18477
  {
17423
- src: import_path6.default.posix.join("/", entryDirectory, "_next/image/?"),
18478
+ src: import_path7.default.posix.join("/", entryDirectory, "_next/image/?"),
17424
18479
  dest: "/_next/image",
17425
18480
  check: true
17426
18481
  }
@@ -17428,12 +18483,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17428
18483
  // No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
17429
18484
  // if no match to prevent rewriting _next/data unexpectedly
17430
18485
  {
17431
- src: import_path6.default.posix.join("/", entryDirectory, "_next/data/(.*)"),
17432
- dest: import_path6.default.posix.join("/", entryDirectory, "_next/data/$1"),
18486
+ src: import_path7.default.posix.join("/", entryDirectory, "_next/data/(.*)"),
18487
+ dest: import_path7.default.posix.join("/", entryDirectory, "_next/data/$1"),
17433
18488
  check: true
17434
18489
  },
17435
18490
  {
17436
- src: import_path6.default.posix.join("/", entryDirectory, "_next/data/(.*)"),
18491
+ src: import_path7.default.posix.join("/", entryDirectory, "_next/data/(.*)"),
17437
18492
  status: 404
17438
18493
  },
17439
18494
  // These need to come before handle: miss or else they are grouped
@@ -17443,16 +18498,16 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17443
18498
  // an index page
17444
18499
  { handle: "resource" },
17445
18500
  ...fallbackRewrites,
17446
- { src: import_path6.default.posix.join("/", entryDirectory, ".*"), status: 404 },
18501
+ { src: import_path7.default.posix.join("/", entryDirectory, ".*"), status: 404 },
17447
18502
  // We need to make sure to 404 for /_next after handle: miss since
17448
18503
  // handle: miss is called before rewrites and to prevent rewriting
17449
18504
  // /_next
17450
18505
  { handle: "miss" },
17451
18506
  {
17452
- src: import_path6.default.posix.join("/", entryDirectory, "_next/static/.+"),
18507
+ src: import_path7.default.posix.join("/", entryDirectory, "_next/static/.+"),
17453
18508
  status: 404,
17454
18509
  check: true,
17455
- dest: import_path6.default.posix.join(
18510
+ dest: import_path7.default.posix.join(
17456
18511
  "/",
17457
18512
  entryDirectory,
17458
18513
  "_next/static/not-found.txt"
@@ -17470,7 +18525,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17470
18525
  {
17471
18526
  // This ensures we only match known emitted-by-Next.js files and not
17472
18527
  // user-emitted files which may be missing a hash in their filename.
17473
- src: import_path6.default.posix.join(
18528
+ src: import_path7.default.posix.join(
17474
18529
  "/",
17475
18530
  entryDirectory,
17476
18531
  `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`
@@ -17485,12 +18540,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17485
18540
  },
17486
18541
  ...onMatchHeaders,
17487
18542
  // error handling
17488
- ...output[import_path6.default.posix.join("./", entryDirectory, "404")] || output[import_path6.default.posix.join("./", entryDirectory, "404/index")] ? [
18543
+ ...output[import_path7.default.posix.join("./", entryDirectory, "404")] || output[import_path7.default.posix.join("./", entryDirectory, "404/index")] ? [
17489
18544
  { handle: "error" },
17490
18545
  {
17491
18546
  status: 404,
17492
- src: import_path6.default.posix.join(entryDirectory, ".*"),
17493
- dest: import_path6.default.posix.join("/", entryDirectory, "404")
18547
+ src: import_path7.default.posix.join(entryDirectory, ".*"),
18548
+ dest: import_path7.default.posix.join("/", entryDirectory, "404")
17494
18549
  }
17495
18550
  ] : []
17496
18551
  ],
@@ -17499,8 +18554,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17499
18554
  };
17500
18555
  }
17501
18556
  if (isLegacy) {
17502
- (0, import_build_utils3.debug)("Running npm install --production...");
17503
- await (0, import_build_utils3.runNpmInstall)(
18557
+ (0, import_build_utils5.debug)("Running npm install --production...");
18558
+ await (0, import_build_utils5.runNpmInstall)(
17504
18559
  entryPath,
17505
18560
  ["--production"],
17506
18561
  {
@@ -17511,7 +18566,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17511
18566
  );
17512
18567
  }
17513
18568
  if (process.env.NPM_AUTH_TOKEN) {
17514
- await (0, import_fs_extra6.remove)(import_path6.default.join(entryPath, ".npmrc"));
18569
+ await (0, import_fs_extra6.remove)(import_path7.default.join(entryPath, ".npmrc"));
17515
18570
  }
17516
18571
  const trailingSlashRedirects = [];
17517
18572
  let trailingSlash = false;
@@ -17540,15 +18595,15 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17540
18595
  let page404Path = "";
17541
18596
  let hasStatic500;
17542
18597
  if (isLegacy) {
17543
- const filesAfterBuild = await (0, import_build_utils3.glob)("**", entryPath);
17544
- (0, import_build_utils3.debug)("Preparing serverless function files...");
17545
- const dotNextRootFiles = await (0, import_build_utils3.glob)(`${outputDirectory}/*`, entryPath);
17546
- const dotNextServerRootFiles = await (0, import_build_utils3.glob)(
18598
+ const filesAfterBuild = await (0, import_build_utils5.glob)("**", entryPath);
18599
+ (0, import_build_utils5.debug)("Preparing serverless function files...");
18600
+ const dotNextRootFiles = await (0, import_build_utils5.glob)(`${outputDirectory}/*`, entryPath);
18601
+ const dotNextServerRootFiles = await (0, import_build_utils5.glob)(
17547
18602
  `${outputDirectory}/server/*`,
17548
18603
  entryPath
17549
18604
  );
17550
18605
  const nodeModules = excludeFiles(
17551
- await (0, import_build_utils3.glob)("node_modules/**", entryPath),
18606
+ await (0, import_build_utils5.glob)("node_modules/**", entryPath),
17552
18607
  (file) => file.startsWith("node_modules/.cache")
17553
18608
  );
17554
18609
  const nextFiles = {
@@ -17559,7 +18614,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17559
18614
  if (filesAfterBuild["next.config.js"]) {
17560
18615
  nextFiles["next.config.js"] = filesAfterBuild["next.config.js"];
17561
18616
  }
17562
- const pagesDir = import_path6.default.join(
18617
+ const pagesDir = import_path7.default.join(
17563
18618
  entryPath,
17564
18619
  outputDirectory,
17565
18620
  "server",
@@ -17572,7 +18627,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17572
18627
  entryPath,
17573
18628
  outputDirectory
17574
18629
  });
17575
- const launcherPath = import_path6.default.join(__dirname, "legacy-launcher.js");
18630
+ const launcherPath = import_path7.default.join(__dirname, "legacy-launcher.js");
17576
18631
  const launcherData = await (0, import_fs_extra6.readFile)(launcherPath, "utf8");
17577
18632
  await Promise.all(
17578
18633
  Object.keys(pages).map(async (page) => {
@@ -17592,7 +18647,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17592
18647
  };
17593
18648
  let lambdaOptions = {};
17594
18649
  if (config && config.functions) {
17595
- lambdaOptions = await (0, import_build_utils3.getLambdaOptionsFromFunction)({
18650
+ lambdaOptions = await (0, import_build_utils5.getLambdaOptionsFromFunction)({
17596
18651
  sourceFile: await getSourceFilePathFromPage({
17597
18652
  workPath: entryPath,
17598
18653
  page
@@ -17600,12 +18655,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17600
18655
  config
17601
18656
  });
17602
18657
  }
17603
- (0, import_build_utils3.debug)(`Creating serverless function for page: "${page}"...`);
17604
- lambdas[import_path6.default.posix.join(entryDirectory, pathname)] = new import_build_utils3.NodejsLambda({
18658
+ (0, import_build_utils5.debug)(`Creating serverless function for page: "${page}"...`);
18659
+ lambdas[import_path7.default.posix.join(entryDirectory, pathname)] = new import_build_utils5.NodejsLambda({
17605
18660
  files: {
17606
18661
  ...nextFiles,
17607
18662
  ...pageFiles,
17608
- "___next_launcher.cjs": new import_build_utils3.FileBlob({ data: launcher })
18663
+ "___next_launcher.cjs": new import_build_utils5.FileBlob({ data: launcher })
17609
18664
  },
17610
18665
  handler: "___next_launcher.cjs",
17611
18666
  runtime: nodeVersion.runtime,
@@ -17621,12 +18676,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17621
18676
  },
17622
18677
  shouldDisableAutomaticFetchInstrumentation: process.env.VERCEL_TRACING_DISABLE_AUTOMATIC_FETCH_INSTRUMENTATION === "1"
17623
18678
  });
17624
- (0, import_build_utils3.debug)(`Created serverless function for page: "${page}"`);
18679
+ (0, import_build_utils5.debug)(`Created serverless function for page: "${page}"`);
17625
18680
  })
17626
18681
  );
17627
18682
  } else {
17628
- (0, import_build_utils3.debug)("Preparing serverless function files...");
17629
- const pagesDir = import_path6.default.join(
18683
+ (0, import_build_utils5.debug)("Preparing serverless function files...");
18684
+ const pagesDir = import_path7.default.join(
17630
18685
  entryPath,
17631
18686
  outputDirectory,
17632
18687
  isServerMode ? "server" : "serverless",
@@ -17634,10 +18689,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17634
18689
  );
17635
18690
  let appDir = null;
17636
18691
  const appPathRoutesManifest = await (0, import_fs_extra6.readJSON)(
17637
- import_path6.default.join(entryPath, outputDirectory, "app-path-routes-manifest.json")
18692
+ import_path7.default.join(entryPath, outputDirectory, "app-path-routes-manifest.json")
17638
18693
  ).catch(() => null);
17639
18694
  if (appPathRoutesManifest) {
17640
- appDir = import_path6.default.join(pagesDir, "../app");
18695
+ appDir = import_path7.default.join(pagesDir, "../app");
17641
18696
  }
17642
18697
  const { pages, appPaths: lambdaAppPaths } = await getServerlessPages({
17643
18698
  pagesDir,
@@ -17648,7 +18703,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17648
18703
  const canUsePreviewMode = Object.keys(pages).some(
17649
18704
  (page) => isApiPage(pages[page].fsPath)
17650
18705
  );
17651
- const originalStaticPages = await (0, import_build_utils3.glob)("**/*.html", pagesDir);
18706
+ const originalStaticPages = await (0, import_build_utils5.glob)("**/*.html", pagesDir);
17652
18707
  staticPages = filterStaticPages(
17653
18708
  originalStaticPages,
17654
18709
  dynamicPages,
@@ -17658,14 +18713,14 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17658
18713
  nextVersion,
17659
18714
  routesManifest
17660
18715
  );
17661
- hasStatic500 = !!staticPages[import_path6.default.posix.join(entryDirectory, "500")];
17662
- static404Page = staticPages[import_path6.default.posix.join(entryDirectory, "404")] && hasPages404 ? import_path6.default.posix.join(entryDirectory, "404") : staticPages[import_path6.default.posix.join(entryDirectory, "_errors/404")] ? import_path6.default.posix.join(entryDirectory, "_errors/404") : void 0;
18716
+ hasStatic500 = !!staticPages[import_path7.default.posix.join(entryDirectory, "500")];
18717
+ static404Page = staticPages[import_path7.default.posix.join(entryDirectory, "404")] && hasPages404 ? import_path7.default.posix.join(entryDirectory, "404") : staticPages[import_path7.default.posix.join(entryDirectory, "_errors/404")] ? import_path7.default.posix.join(entryDirectory, "_errors/404") : void 0;
17663
18718
  const { i18n: i18n2 } = routesManifest || {};
17664
18719
  if (!static404Page && i18n2) {
17665
- static404Page = staticPages[import_path6.default.posix.join(entryDirectory, i18n2.defaultLocale, "404")] ? import_path6.default.posix.join(entryDirectory, i18n2.defaultLocale, "404") : void 0;
18720
+ static404Page = staticPages[import_path7.default.posix.join(entryDirectory, i18n2.defaultLocale, "404")] ? import_path7.default.posix.join(entryDirectory, i18n2.defaultLocale, "404") : void 0;
17666
18721
  }
17667
18722
  if (!hasStatic500 && i18n2) {
17668
- hasStatic500 = !!staticPages[import_path6.default.posix.join(entryDirectory, i18n2.defaultLocale, "500")];
18723
+ hasStatic500 = !!staticPages[import_path7.default.posix.join(entryDirectory, i18n2.defaultLocale, "500")];
17669
18724
  }
17670
18725
  if (routesManifest) {
17671
18726
  switch (routesManifest.version) {
@@ -17682,7 +18737,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17682
18737
  }
17683
18738
  const route = {
17684
18739
  src: (dataRoute.namedDataRouteRegex || dataRoute.dataRouteRegex).replace(/^\^/, `^${appMountPrefixNoTrailingSlash}`),
17685
- dest: import_path6.default.posix.join(
18740
+ dest: import_path7.default.posix.join(
17686
18741
  "/",
17687
18742
  entryDirectory,
17688
18743
  // make sure to route SSG data route to the data prerender
@@ -17745,7 +18800,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17745
18800
  break;
17746
18801
  }
17747
18802
  default: {
17748
- throw new import_build_utils3.NowBuildError({
18803
+ throw new import_build_utils5.NowBuildError({
17749
18804
  code: "NEXT_VERSION_OUTDATED",
17750
18805
  message: "This version of `@vercel/next` does not support the version of Next.js you are trying to deploy.\nPlease upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen."
17751
18806
  });
@@ -17774,7 +18829,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17774
18829
  `A routes-manifest could not be located, please check your outputDirectory and try again.`
17775
18830
  );
17776
18831
  }
17777
- const localePrefixed404 = !!(routesManifest.i18n && originalStaticPages[import_path6.default.posix.join(".", routesManifest.i18n.defaultLocale, "404.html")]);
18832
+ const localePrefixed404 = !!(routesManifest.i18n && originalStaticPages[import_path7.default.posix.join(".", routesManifest.i18n.defaultLocale, "404.html")]);
17778
18833
  return serverBuild({
17779
18834
  config,
17780
18835
  functionsConfigManifest,
@@ -17834,7 +18889,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17834
18889
  console.info(nextConfig);
17835
18890
  console.info();
17836
18891
  }
17837
- throw new import_build_utils3.NowBuildError({
18892
+ throw new import_build_utils5.NowBuildError({
17838
18893
  code: "NEXT_NO_SERVERLESS_PAGES",
17839
18894
  message: "No serverless pages were built",
17840
18895
  link: "https://err.sh/vercel/vercel/now-next-no-serverless-pages-built"
@@ -17843,7 +18898,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17843
18898
  let requiresTracing = hasLambdas;
17844
18899
  try {
17845
18900
  if (nextVersion && import_semver5.default.lt(nextVersion, ExperimentalTraceVersion)) {
17846
- (0, import_build_utils3.debug)(
18901
+ (0, import_build_utils5.debug)(
17847
18902
  "Next.js version is too old for us to trace the required dependencies.\nAssuming Next.js has handled it!"
17848
18903
  );
17849
18904
  requiresTracing = false;
@@ -17915,7 +18970,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17915
18970
  );
17916
18971
  for (const page of mergedPageKeys) {
17917
18972
  const fileList = parentFilesMap.get(
17918
- import_path6.default.relative(baseDir, pages[page].fsPath)
18973
+ import_path7.default.relative(baseDir, pages[page].fsPath)
17919
18974
  );
17920
18975
  if (!fileList) {
17921
18976
  throw new Error(
@@ -17949,22 +19004,22 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17949
19004
  console.timeEnd(zippingLabel);
17950
19005
  }
17951
19006
  } else {
17952
- assets = await (0, import_build_utils3.glob)(
19007
+ assets = await (0, import_build_utils5.glob)(
17953
19008
  "assets/**",
17954
- import_path6.default.join(entryPath, outputDirectory, "serverless")
19009
+ import_path7.default.join(entryPath, outputDirectory, "serverless")
17955
19010
  );
17956
19011
  const assetKeys = Object.keys(assets);
17957
19012
  if (assetKeys.length > 0) {
17958
- (0, import_build_utils3.debug)(
19013
+ (0, import_build_utils5.debug)(
17959
19014
  "detected (legacy) assets to be bundled with serverless function:"
17960
19015
  );
17961
- assetKeys.forEach((assetFile) => (0, import_build_utils3.debug)(` ${assetFile}`));
17962
- (0, import_build_utils3.debug)(
19016
+ assetKeys.forEach((assetFile) => (0, import_build_utils5.debug)(` ${assetFile}`));
19017
+ (0, import_build_utils5.debug)(
17963
19018
  "\nPlease upgrade to Next.js 9.1 to leverage modern asset handling."
17964
19019
  );
17965
19020
  }
17966
19021
  }
17967
- const launcherPath = import_path6.default.join(__dirname, "templated-launcher.js");
19022
+ const launcherPath = import_path7.default.join(__dirname, "templated-launcher.js");
17968
19023
  const launcherData = await (0, import_fs_extra6.readFile)(launcherPath, "utf8");
17969
19024
  const allLambdasLabel = `All serverless functions created in`;
17970
19025
  if (hasLambdas) {
@@ -18008,7 +19063,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18008
19063
  for (const group of initialApiLambdaGroups) {
18009
19064
  group.isApiLambda = true;
18010
19065
  }
18011
- (0, import_build_utils3.debug)(
19066
+ (0, import_build_utils5.debug)(
18012
19067
  JSON.stringify(
18013
19068
  {
18014
19069
  apiLambdaGroups: initialApiLambdaGroups.map((group) => ({
@@ -18046,8 +19101,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18046
19101
  if (page === "_error.js" && (static404Page && staticPages[static404Page] || hasPages404 && pages["404.js"])) {
18047
19102
  continue;
18048
19103
  }
18049
- const pageFileName = import_path6.default.normalize(
18050
- import_path6.default.relative(workPath, pages[page].fsPath)
19104
+ const pageFileName = import_path7.default.normalize(
19105
+ import_path7.default.relative(workPath, pages[page].fsPath)
18051
19106
  );
18052
19107
  const pathname = page.replace(/\.js$/, "");
18053
19108
  const routeIsDynamic = isDynamicRoute(pathname, nextVersion);
@@ -18058,7 +19113,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18058
19113
  if (nonLambdaSsgPages.has(`/${pathname}`)) {
18059
19114
  continue;
18060
19115
  }
18061
- const outputName = import_path6.default.join("/", entryDirectory, pathname);
19116
+ const outputName = import_path7.default.join("/", entryDirectory, pathname);
18062
19117
  const lambdaGroupIndex = routeIsApi ? apiLambdaGroupIndex : nonApiLambdaGroupIndex;
18063
19118
  const lambdaGroups = routeIsApi ? apiLambdaGroups : pageLambdaGroups;
18064
19119
  const lastLambdaGroup = lambdaGroups[lambdaGroupIndex];
@@ -18070,7 +19125,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18070
19125
  pseudoLayer: group.pseudoLayer,
18071
19126
  lambdaCombinedBytes: group.pseudoLayerBytes,
18072
19127
  maxConcurrency: group.maxConcurrency,
18073
- lambdaIdentifier: import_path6.default.join(
19128
+ lambdaIdentifier: import_path7.default.join(
18074
19129
  entryDirectory,
18075
19130
  `__NEXT_${routeIsApi ? "API" : "PAGE"}_LAMBDA_${lambdaGroupIndex}`
18076
19131
  )
@@ -18082,7 +19137,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18082
19137
  /\/index$/,
18083
19138
  "(/|/index|)"
18084
19139
  )}/?$`,
18085
- dest: `${import_path6.default.join("/", currentLambdaGroup.lambdaIdentifier)}`,
19140
+ dest: `${import_path7.default.join("/", currentLambdaGroup.lambdaIdentifier)}`,
18086
19141
  headers: {
18087
19142
  "x-nextjs-page": outputName
18088
19143
  },
@@ -18104,13 +19159,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18104
19159
  addPageLambdaRoute((0, import_escape_string_regexp3.default)(outputName));
18105
19160
  }
18106
19161
  if (page === "_error.js" || hasPages404 && page === "404.js") {
18107
- page404Path = import_path6.default.join("/", entryDirectory, pathname);
19162
+ page404Path = import_path7.default.join("/", entryDirectory, pathname);
18108
19163
  }
18109
19164
  currentLambdaGroup.pages[outputName] = {
18110
19165
  pageFileName,
18111
19166
  pageName: page
18112
19167
  };
18113
- currentLambdaGroup.pseudoLayer[import_path6.default.join(import_path6.default.relative(baseDir, entryPath), pageFileName)] = compressedPages[page];
19168
+ currentLambdaGroup.pseudoLayer[import_path7.default.join(import_path7.default.relative(baseDir, entryPath), pageFileName)] = compressedPages[page];
18114
19169
  lambdaGroups[lambdaGroupIndex] = currentLambdaGroup;
18115
19170
  }
18116
19171
  if (routeIsApi) {
@@ -18132,22 +19187,22 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18132
19187
  if (isDynamicRoute(pathname, nextVersion)) {
18133
19188
  dynamicPages.push(normalizePage(pathname));
18134
19189
  }
18135
- const pageFileName = import_path6.default.normalize(
18136
- import_path6.default.relative(entryPath, pages[page].fsPath)
19190
+ const pageFileName = import_path7.default.normalize(
19191
+ import_path7.default.relative(entryPath, pages[page].fsPath)
18137
19192
  );
18138
19193
  const launcher = launcherData.replace(
18139
19194
  /__LAUNCHER_PAGE_PATH__/g,
18140
19195
  JSON.stringify(requiresTracing ? `./${pageFileName}` : "./page")
18141
19196
  );
18142
19197
  const launcherFiles = {
18143
- [import_path6.default.join(
18144
- import_path6.default.relative(baseDir, entryPath),
19198
+ [import_path7.default.join(
19199
+ import_path7.default.relative(baseDir, entryPath),
18145
19200
  "___next_launcher.cjs"
18146
- )]: new import_build_utils3.FileBlob({ data: launcher })
19201
+ )]: new import_build_utils5.FileBlob({ data: launcher })
18147
19202
  };
18148
19203
  let lambdaOptions = {};
18149
19204
  if (config && config.functions) {
18150
- lambdaOptions = await (0, import_build_utils3.getLambdaOptionsFromFunction)({
19205
+ lambdaOptions = await (0, import_build_utils5.getLambdaOptionsFromFunction)({
18151
19206
  sourceFile: await getSourceFilePathFromPage({
18152
19207
  workPath: entryPath,
18153
19208
  page
@@ -18156,7 +19211,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18156
19211
  });
18157
19212
  }
18158
19213
  const outputName = normalizeIndexOutput(
18159
- import_path6.default.join(entryDirectory, pathname),
19214
+ import_path7.default.join(entryDirectory, pathname),
18160
19215
  isServerMode
18161
19216
  );
18162
19217
  if (requiresTracing) {
@@ -18168,11 +19223,11 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18168
19223
  return prev;
18169
19224
  }, {}),
18170
19225
  {
18171
- [import_path6.default.join(import_path6.default.relative(baseDir, entryPath), pageFileName)]: compressedPages[page]
19226
+ [import_path7.default.join(import_path7.default.relative(baseDir, entryPath), pageFileName)]: compressedPages[page]
18172
19227
  }
18173
19228
  ],
18174
- handler: import_path6.default.join(
18175
- import_path6.default.relative(baseDir, entryPath),
19229
+ handler: import_path7.default.join(
19230
+ import_path7.default.relative(baseDir, entryPath),
18176
19231
  "___next_launcher.cjs"
18177
19232
  ),
18178
19233
  operationType: getOperationType({
@@ -18191,11 +19246,11 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18191
19246
  },
18192
19247
  layers: [
18193
19248
  {
18194
- [import_path6.default.join(import_path6.default.relative(baseDir, entryPath), "page.js")]: compressedPages[page]
19249
+ [import_path7.default.join(import_path7.default.relative(baseDir, entryPath), "page.js")]: compressedPages[page]
18195
19250
  }
18196
19251
  ],
18197
- handler: import_path6.default.join(
18198
- import_path6.default.relative(baseDir, entryPath),
19252
+ handler: import_path7.default.join(
19253
+ import_path7.default.relative(baseDir, entryPath),
18199
19254
  "___next_launcher.cjs"
18200
19255
  ),
18201
19256
  operationType: getOperationType({ pageFileName }),
@@ -18235,7 +19290,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18235
19290
  )
18236
19291
  );
18237
19292
  if (isSharedLambdas) {
18238
- const launcherPath2 = import_path6.default.join(__dirname, "templated-launcher-shared.js");
19293
+ const launcherPath2 = import_path7.default.join(__dirname, "templated-launcher-shared.js");
18239
19294
  const launcherData2 = await (0, import_fs_extra6.readFile)(launcherPath2, "utf8");
18240
19295
  const completeDynamicRoutes = await getDynamicRoutes({
18241
19296
  entryPath,
@@ -18290,7 +19345,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18290
19345
  try {
18291
19346
  const pages = {
18292
19347
  ${groupPageKeys.map(
18293
- (page) => `'${page}': () => require('./${import_path6.default.join(
19348
+ (page) => `'${page}': () => require('./${import_path7.default.join(
18294
19349
  "./",
18295
19350
  group.pages[page].pageFileName
18296
19351
  )}')`
@@ -18380,10 +19435,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18380
19435
  `
18381
19436
  );
18382
19437
  const launcherFiles = {
18383
- [import_path6.default.join(
18384
- import_path6.default.relative(baseDir, entryPath),
19438
+ [import_path7.default.join(
19439
+ import_path7.default.relative(baseDir, entryPath),
18385
19440
  "___next_launcher.cjs"
18386
- )]: new import_build_utils3.FileBlob({ data: launcher })
19441
+ )]: new import_build_utils5.FileBlob({ data: launcher })
18387
19442
  };
18388
19443
  for (const page of groupPageKeys) {
18389
19444
  pageLambdaMap[page] = group.lambdaIdentifier;
@@ -18398,8 +19453,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18398
19453
  ...assets
18399
19454
  },
18400
19455
  layers: [group.pseudoLayer],
18401
- handler: import_path6.default.join(
18402
- import_path6.default.relative(baseDir, entryPath),
19456
+ handler: import_path7.default.join(
19457
+ import_path7.default.relative(baseDir, entryPath),
18403
19458
  "___next_launcher.cjs"
18404
19459
  ),
18405
19460
  operationType,
@@ -18482,7 +19537,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18482
19537
  `^${appMountPrefixNoTrailingSlash}`
18483
19538
  ),
18484
19539
  // Location of lambda in builder output
18485
- dest: import_path6.default.posix.join(entryDirectory, dataRoute),
19540
+ dest: import_path7.default.posix.join(entryDirectory, dataRoute),
18486
19541
  check: true
18487
19542
  });
18488
19543
  if (!prefetchDataRoute || !prefetchDataRouteRegex)
@@ -18492,7 +19547,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18492
19547
  /^\^/,
18493
19548
  `^${appMountPrefixNoTrailingSlash}`
18494
19549
  ),
18495
- dest: import_path6.default.posix.join(entryDirectory, prefetchDataRoute),
19550
+ dest: import_path7.default.posix.join(entryDirectory, prefetchDataRoute),
18496
19551
  check: true
18497
19552
  });
18498
19553
  }
@@ -18501,12 +19556,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18501
19556
  }
18502
19557
  if (!isSharedLambdas) {
18503
19558
  omittedPrerenderRoutes.forEach((routeKey) => {
18504
- const routeFileNoExt = import_path6.default.posix.join(
19559
+ const routeFileNoExt = import_path7.default.posix.join(
18505
19560
  entryDirectory,
18506
19561
  routeKey === "/" ? "/index" : routeKey
18507
19562
  );
18508
19563
  if (typeof lambdas[routeFileNoExt] === void 0) {
18509
- throw new import_build_utils3.NowBuildError({
19564
+ throw new import_build_utils5.NowBuildError({
18510
19565
  code: "NEXT__UNKNOWN_ROUTE_KEY",
18511
19566
  message: `invariant: unknown lambda ${routeKey} (lookup: ${routeFileNoExt}) | please report this immediately`
18512
19567
  });
@@ -18572,31 +19627,31 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18572
19627
  // $wildcard
18573
19628
  // This is split into two rules to avoid matching the `/index` route as it causes issues with trailing slash redirect
18574
19629
  {
18575
- src: `^${import_path6.default.posix.join(
19630
+ src: `^${import_path7.default.posix.join(
18576
19631
  "/",
18577
19632
  entryDirectory,
18578
19633
  "/"
18579
19634
  )}(?!(?:_next/.*|${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})(?:/.*|$))$`,
18580
19635
  // we aren't able to ensure trailing slash mode here
18581
19636
  // so ensure this comes after the trailing slash redirect
18582
- dest: `${entryDirectory !== "." ? import_path6.default.posix.join("/", entryDirectory) : ""}$wildcard${trailingSlash ? "/" : ""}`,
19637
+ dest: `${entryDirectory !== "." ? import_path7.default.posix.join("/", entryDirectory) : ""}$wildcard${trailingSlash ? "/" : ""}`,
18583
19638
  continue: true
18584
19639
  },
18585
19640
  {
18586
- src: `^${import_path6.default.join(
19641
+ src: `^${import_path7.default.join(
18587
19642
  "/",
18588
19643
  entryDirectory,
18589
19644
  "/"
18590
19645
  )}(?!(?:_next/.*|${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})(?:/.*|$))(.*)$`,
18591
19646
  // we aren't able to ensure trailing slash mode here
18592
19647
  // so ensure this comes after the trailing slash redirect
18593
- dest: `${entryDirectory !== "." ? import_path6.default.join("/", entryDirectory) : ""}$wildcard/$1`,
19648
+ dest: `${entryDirectory !== "." ? import_path7.default.join("/", entryDirectory) : ""}$wildcard/$1`,
18594
19649
  continue: true
18595
19650
  },
18596
19651
  // Handle redirecting to locale specific domains
18597
19652
  ...i18n.domains && i18n.domains.length > 0 && i18n.localeDetection !== false ? [
18598
19653
  {
18599
- src: `^${import_path6.default.join("/", entryDirectory)}/?(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?/?$`,
19654
+ src: `^${import_path7.default.join("/", entryDirectory)}/?(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?/?$`,
18600
19655
  locale: {
18601
19656
  redirect: i18n.domains.reduce(
18602
19657
  (prev, item) => {
@@ -18637,8 +19692,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18637
19692
  }
18638
19693
  ] : [],
18639
19694
  {
18640
- src: `^${import_path6.default.join("/", entryDirectory)}$`,
18641
- dest: `${import_path6.default.join("/", entryDirectory, i18n.defaultLocale)}`,
19695
+ src: `^${import_path7.default.join("/", entryDirectory)}$`,
19696
+ dest: `${import_path7.default.join("/", entryDirectory, i18n.defaultLocale)}`,
18642
19697
  continue: true
18643
19698
  },
18644
19699
  // Auto-prefix non-locale path with default locale
@@ -18647,12 +19702,12 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18647
19702
  // e.g. for /de/posts/[slug] x-now-route-matches would have
18648
19703
  // 1=posts%2Fpost-1
18649
19704
  {
18650
- src: `^${import_path6.default.join(
19705
+ src: `^${import_path7.default.join(
18651
19706
  "/",
18652
19707
  entryDirectory,
18653
19708
  "/"
18654
19709
  )}(?!(?:_next/.*|${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})(?:/.*|$))(.*)$`,
18655
- dest: `${import_path6.default.join("/", entryDirectory, i18n.defaultLocale)}/$1`,
19710
+ dest: `${import_path7.default.join("/", entryDirectory, i18n.defaultLocale)}/$1`,
18656
19711
  continue: true
18657
19712
  }
18658
19713
  ] : [],
@@ -18662,13 +19717,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18662
19717
  // Make sure to 404 for the /404 path itself
18663
19718
  ...i18n ? [
18664
19719
  {
18665
- src: `${import_path6.default.join("/", entryDirectory, "/")}(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?[/]?404/?`,
19720
+ src: `${import_path7.default.join("/", entryDirectory, "/")}(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?[/]?404/?`,
18666
19721
  status: 404,
18667
19722
  continue: true
18668
19723
  }
18669
19724
  ] : [
18670
19725
  {
18671
- src: import_path6.default.join("/", entryDirectory, "404/?"),
19726
+ src: import_path7.default.join("/", entryDirectory, "404/?"),
18672
19727
  status: 404,
18673
19728
  continue: true
18674
19729
  }
@@ -18676,13 +19731,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18676
19731
  // Make sure to 500 when visiting /500 directly for static 500
18677
19732
  ...!hasStatic500 ? [] : i18n ? [
18678
19733
  {
18679
- src: `${import_path6.default.join("/", entryDirectory, "/")}(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?[/]?500`,
19734
+ src: `${import_path7.default.join("/", entryDirectory, "/")}(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})?[/]?500`,
18680
19735
  status: 500,
18681
19736
  continue: true
18682
19737
  }
18683
19738
  ] : [
18684
19739
  {
18685
- src: import_path6.default.join("/", entryDirectory, "500"),
19740
+ src: import_path7.default.join("/", entryDirectory, "500"),
18686
19741
  status: 500,
18687
19742
  continue: true
18688
19743
  }
@@ -18705,7 +19760,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18705
19760
  // _next/image path
18706
19761
  ...routesManifest?.basePath ? [
18707
19762
  {
18708
- src: import_path6.default.join("/", entryDirectory, "_next/image/?"),
19763
+ src: import_path7.default.join("/", entryDirectory, "_next/image/?"),
18709
19764
  dest: "/_next/image",
18710
19765
  check: true
18711
19766
  }
@@ -18713,8 +19768,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18713
19768
  // No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
18714
19769
  // if no match to prevent rewriting _next/data unexpectedly
18715
19770
  {
18716
- src: import_path6.default.join("/", entryDirectory, "_next/data/(.*)"),
18717
- dest: import_path6.default.join("/", entryDirectory, "_next/data/$1"),
19771
+ src: import_path7.default.join("/", entryDirectory, "_next/data/(.*)"),
19772
+ dest: import_path7.default.join("/", entryDirectory, "_next/data/$1"),
18718
19773
  check: true
18719
19774
  },
18720
19775
  // These need to come before handle: miss or else they are grouped
@@ -18724,15 +19779,15 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18724
19779
  // an index page
18725
19780
  { handle: "resource" },
18726
19781
  ...fallbackRewrites,
18727
- { src: import_path6.default.join("/", entryDirectory, ".*"), status: 404 },
19782
+ { src: import_path7.default.join("/", entryDirectory, ".*"), status: 404 },
18728
19783
  // We need to make sure to 404 for /_next after handle: miss since
18729
19784
  // handle: miss is called before rewrites and to prevent rewriting /_next
18730
19785
  { handle: "miss" },
18731
19786
  {
18732
- src: import_path6.default.join("/", entryDirectory, "_next/static/.+"),
19787
+ src: import_path7.default.join("/", entryDirectory, "_next/static/.+"),
18733
19788
  status: 404,
18734
19789
  check: true,
18735
- dest: import_path6.default.join("/", entryDirectory, "_next/static/not-found.txt"),
19790
+ dest: import_path7.default.join("/", entryDirectory, "_next/static/not-found.txt"),
18736
19791
  headers: {
18737
19792
  "content-type": "text/plain; charset=utf-8"
18738
19793
  }
@@ -18740,8 +19795,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18740
19795
  // remove locale prefixes to check public files
18741
19796
  ...i18n ? [
18742
19797
  {
18743
- src: `^${import_path6.default.join("/", entryDirectory)}/?(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})/(.*)`,
18744
- dest: `${import_path6.default.join("/", entryDirectory, "/")}$1`,
19798
+ src: `^${import_path7.default.join("/", entryDirectory)}/?(?:${i18n.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})/(.*)`,
19799
+ dest: `${import_path7.default.join("/", entryDirectory, "/")}$1`,
18745
19800
  check: true
18746
19801
  }
18747
19802
  ] : [],
@@ -18749,7 +19804,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18749
19804
  // to allow checking for lambda
18750
19805
  ...isSharedLambdas || !i18n ? [] : [
18751
19806
  {
18752
- src: `${import_path6.default.join("/", entryDirectory, "/")}(?:${i18n?.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})/(.*)`,
19807
+ src: `${import_path7.default.join("/", entryDirectory, "/")}(?:${i18n?.locales.map((locale) => (0, import_escape_string_regexp3.default)(locale)).join("|")})/(.*)`,
18753
19808
  dest: "/$1",
18754
19809
  check: true
18755
19810
  }
@@ -18762,8 +19817,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18762
19817
  // ensure we 404 for non-existent _next/data routes before
18763
19818
  // trying page dynamic routes
18764
19819
  {
18765
- src: import_path6.default.join("/", entryDirectory, "_next/data/(.*)"),
18766
- dest: import_path6.default.join("/", entryDirectory, "404"),
19820
+ src: import_path7.default.join("/", entryDirectory, "_next/data/(.*)"),
19821
+ dest: import_path7.default.join("/", entryDirectory, "404"),
18767
19822
  status: 404,
18768
19823
  check: true
18769
19824
  },
@@ -18778,7 +19833,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18778
19833
  {
18779
19834
  // This ensures we only match known emitted-by-Next.js files and not
18780
19835
  // user-emitted files which may be missing a hash in their filename.
18781
- src: import_path6.default.join(
19836
+ src: import_path7.default.join(
18782
19837
  "/",
18783
19838
  entryDirectory,
18784
19839
  `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`
@@ -18798,7 +19853,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18798
19853
  { handle: "error" },
18799
19854
  ...i18n && (static404Page || hasIsr404Page) ? [
18800
19855
  {
18801
- src: `${import_path6.default.join(
19856
+ src: `${import_path7.default.join(
18802
19857
  "/",
18803
19858
  entryDirectory,
18804
19859
  "/"
@@ -18808,16 +19863,16 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18808
19863
  caseSensitive: true
18809
19864
  },
18810
19865
  {
18811
- src: import_path6.default.join("/", entryDirectory, ".*"),
19866
+ src: import_path7.default.join("/", entryDirectory, ".*"),
18812
19867
  dest: `/${i18n.defaultLocale}/404`,
18813
19868
  status: 404
18814
19869
  }
18815
19870
  ] : [
18816
19871
  isSharedLambdas ? {
18817
- src: import_path6.default.join("/", entryDirectory, ".*"),
19872
+ src: import_path7.default.join("/", entryDirectory, ".*"),
18818
19873
  // if static 404 is not present but we have pages/404.js
18819
19874
  // it is a lambda due to _app getInitialProps
18820
- dest: import_path6.default.join(
19875
+ dest: import_path7.default.join(
18821
19876
  "/",
18822
19877
  static404Page ? static404Page : pageLambdaMap[page404Path]
18823
19878
  ),
@@ -18828,13 +19883,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18828
19883
  }
18829
19884
  }
18830
19885
  } : {
18831
- src: import_path6.default.join("/", entryDirectory, ".*"),
19886
+ src: import_path7.default.join("/", entryDirectory, ".*"),
18832
19887
  // if static 404 is not present but we have pages/404.js
18833
19888
  // it is a lambda due to _app getInitialProps
18834
- dest: static404Page ? import_path6.default.join("/", static404Page) : import_path6.default.join(
19889
+ dest: static404Page ? import_path7.default.join("/", static404Page) : import_path7.default.join(
18835
19890
  "/",
18836
19891
  entryDirectory,
18837
- hasPages404 && lambdas[import_path6.default.join("./", entryDirectory, "404")] ? "404" : "_error"
19892
+ hasPages404 && lambdas[import_path7.default.join("./", entryDirectory, "404")] ? "404" : "_error"
18838
19893
  ),
18839
19894
  status: 404
18840
19895
  }
@@ -18842,7 +19897,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18842
19897
  // static 500 page if present
18843
19898
  ...!hasStatic500 ? [] : i18n ? [
18844
19899
  {
18845
- src: `${import_path6.default.join(
19900
+ src: `${import_path7.default.join(
18846
19901
  "/",
18847
19902
  entryDirectory,
18848
19903
  "/"
@@ -18851,14 +19906,14 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18851
19906
  status: 500
18852
19907
  },
18853
19908
  {
18854
- src: import_path6.default.join("/", entryDirectory, ".*"),
19909
+ src: import_path7.default.join("/", entryDirectory, ".*"),
18855
19910
  dest: `/${i18n.defaultLocale}/500`,
18856
19911
  status: 500
18857
19912
  }
18858
19913
  ] : [
18859
19914
  {
18860
- src: import_path6.default.join("/", entryDirectory, ".*"),
18861
- dest: import_path6.default.join("/", entryDirectory, "/500"),
19915
+ src: import_path7.default.join("/", entryDirectory, ".*"),
19916
+ dest: import_path7.default.join("/", entryDirectory, "/500"),
18862
19917
  status: 500
18863
19918
  }
18864
19919
  ]
@@ -18868,7 +19923,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
18868
19923
  ...deploymentId && { deploymentId }
18869
19924
  };
18870
19925
  };
18871
- var packageManifestDiagnostics = (0, import_build_utils3.createDiagnostics)("node");
19926
+ var packageManifestDiagnostics = (0, import_build_utils5.createDiagnostics)("node");
18872
19927
  var diagnostics = async ({
18873
19928
  config,
18874
19929
  entrypoint,
@@ -18876,12 +19931,12 @@ var diagnostics = async ({
18876
19931
  repoRootPath,
18877
19932
  ...rest
18878
19933
  }) => {
18879
- const entryDirectory = import_path6.default.dirname(entrypoint);
18880
- const entryPath = import_path6.default.join(workPath, entryDirectory);
18881
- const outputDirectory = import_path6.default.join("./", config.outputDirectory || ".next");
19934
+ const entryDirectory = import_path7.default.dirname(entrypoint);
19935
+ const entryPath = import_path7.default.join(workPath, entryDirectory);
19936
+ const outputDirectory = import_path7.default.join("./", config.outputDirectory || ".next");
18882
19937
  const basePath = repoRootPath || workPath;
18883
- const diagnosticsEntrypoint = import_path6.default.relative(basePath, entryPath);
18884
- (0, import_build_utils3.debug)(
19938
+ const diagnosticsEntrypoint = import_path7.default.relative(basePath, entryPath);
19939
+ (0, import_build_utils5.debug)(
18885
19940
  `Reading diagnostics file in diagnosticsEntrypoint=${diagnosticsEntrypoint}`
18886
19941
  );
18887
19942
  return {
@@ -18893,29 +19948,29 @@ var diagnostics = async ({
18893
19948
  ...rest
18894
19949
  }),
18895
19950
  // Collect output in `.next/diagnostics`
18896
- ...await (0, import_build_utils3.glob)(
19951
+ ...await (0, import_build_utils5.glob)(
18897
19952
  "*",
18898
- import_path6.default.join(basePath, diagnosticsEntrypoint, outputDirectory, "diagnostics")
19953
+ import_path7.default.join(basePath, diagnosticsEntrypoint, outputDirectory, "diagnostics")
18899
19954
  ),
18900
19955
  // Collect `.next/trace` file
18901
- ...await (0, import_build_utils3.glob)(
19956
+ ...await (0, import_build_utils5.glob)(
18902
19957
  "trace",
18903
- import_path6.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
19958
+ import_path7.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
18904
19959
  ),
18905
19960
  // Collect `.next/trace-build` file
18906
- ...await (0, import_build_utils3.glob)(
19961
+ ...await (0, import_build_utils5.glob)(
18907
19962
  "trace-build",
18908
- import_path6.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
19963
+ import_path7.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
18909
19964
  ),
18910
19965
  // Collect `.next/turbopack` file
18911
- ...await (0, import_build_utils3.glob)(
19966
+ ...await (0, import_build_utils5.glob)(
18912
19967
  "turbopack",
18913
- import_path6.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
19968
+ import_path7.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
18914
19969
  ),
18915
19970
  // Collect `.next/trace-turbopack` file
18916
- ...await (0, import_build_utils3.glob)(
19971
+ ...await (0, import_build_utils5.glob)(
18917
19972
  "trace-turbopack",
18918
- import_path6.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
19973
+ import_path7.default.join(basePath, diagnosticsEntrypoint, outputDirectory)
18919
19974
  )
18920
19975
  };
18921
19976
  };
@@ -18925,34 +19980,34 @@ var prepareCache = async ({
18925
19980
  entrypoint,
18926
19981
  config = {}
18927
19982
  }) => {
18928
- (0, import_build_utils3.debug)("Preparing cache...");
18929
- const entryDirectory = import_path6.default.dirname(entrypoint);
18930
- const entryPath = import_path6.default.join(workPath, entryDirectory);
18931
- const outputDirectory = import_path6.default.join("./", config.outputDirectory || ".next");
19983
+ (0, import_build_utils5.debug)("Preparing cache...");
19984
+ const entryDirectory = import_path7.default.dirname(entrypoint);
19985
+ const entryPath = import_path7.default.join(workPath, entryDirectory);
19986
+ const outputDirectory = import_path7.default.join("./", config.outputDirectory || ".next");
18932
19987
  const nextVersionRange = await getNextVersionRange(entryPath);
18933
19988
  const isLegacy = nextVersionRange && isLegacyNext(nextVersionRange);
18934
19989
  if (isLegacy) {
18935
19990
  return {};
18936
19991
  }
18937
- (0, import_build_utils3.debug)("Producing cache file manifest...");
19992
+ (0, import_build_utils5.debug)("Producing cache file manifest...");
18938
19993
  const isMonorepo = repoRootPath && repoRootPath !== workPath;
18939
19994
  const cacheBasePath = repoRootPath || workPath;
18940
- const cacheEntrypoint = import_path6.default.relative(cacheBasePath, entryPath);
19995
+ const cacheEntrypoint = import_path7.default.relative(cacheBasePath, entryPath);
18941
19996
  const cache = {
18942
- ...await (0, import_build_utils3.glob)(
18943
- isMonorepo ? "**/node_modules/**" : import_path6.default.join(cacheEntrypoint, "node_modules/**"),
19997
+ ...await (0, import_build_utils5.glob)(
19998
+ isMonorepo ? "**/node_modules/**" : import_path7.default.join(cacheEntrypoint, "node_modules/**"),
18944
19999
  cacheBasePath
18945
20000
  ),
18946
- ...await (0, import_build_utils3.glob)(
18947
- import_path6.default.join(cacheEntrypoint, outputDirectory, "cache/**"),
20001
+ ...await (0, import_build_utils5.glob)(
20002
+ import_path7.default.join(cacheEntrypoint, outputDirectory, "cache/**"),
18948
20003
  cacheBasePath
18949
20004
  ),
18950
- ...await (0, import_build_utils3.glob)(
18951
- isMonorepo ? "**/.yarn/cache/**" : import_path6.default.join(cacheEntrypoint, ".yarn/cache/**"),
20005
+ ...await (0, import_build_utils5.glob)(
20006
+ isMonorepo ? "**/.yarn/cache/**" : import_path7.default.join(cacheEntrypoint, ".yarn/cache/**"),
18952
20007
  cacheBasePath
18953
20008
  )
18954
20009
  };
18955
- (0, import_build_utils3.debug)("Cache file manifest produced");
20010
+ (0, import_build_utils5.debug)("Cache file manifest produced");
18956
20011
  return cache;
18957
20012
  };
18958
20013
  // Annotate the CommonJS export names for ESM import in node:
@@ -18960,6 +20015,7 @@ var prepareCache = async ({
18960
20015
  MAX_AGE_ONE_YEAR,
18961
20016
  build,
18962
20017
  diagnostics,
20018
+ getDevManifest,
18963
20019
  htmlContentType,
18964
20020
  prepareCache,
18965
20021
  version