@vercel/node 5.1.2 → 5.1.3

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.
@@ -31,826 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  mod
32
32
  ));
33
33
 
34
- // ../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js
35
- var require_dist = __commonJS({
36
- "../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports) {
37
- "use strict";
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- function lexer(str) {
40
- var tokens = [];
41
- var i = 0;
42
- while (i < str.length) {
43
- var char = str[i];
44
- if (char === "*" || char === "+" || char === "?") {
45
- tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
46
- continue;
47
- }
48
- if (char === "\\") {
49
- tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
50
- continue;
51
- }
52
- if (char === "{") {
53
- tokens.push({ type: "OPEN", index: i, value: str[i++] });
54
- continue;
55
- }
56
- if (char === "}") {
57
- tokens.push({ type: "CLOSE", index: i, value: str[i++] });
58
- continue;
59
- }
60
- if (char === ":") {
61
- var name = "";
62
- var j = i + 1;
63
- while (j < str.length) {
64
- var code = str.charCodeAt(j);
65
- if (
66
- // `0-9`
67
- code >= 48 && code <= 57 || // `A-Z`
68
- code >= 65 && code <= 90 || // `a-z`
69
- code >= 97 && code <= 122 || // `_`
70
- code === 95
71
- ) {
72
- name += str[j++];
73
- continue;
74
- }
75
- break;
76
- }
77
- if (!name)
78
- throw new TypeError("Missing parameter name at " + i);
79
- tokens.push({ type: "NAME", index: i, value: name });
80
- i = j;
81
- continue;
82
- }
83
- if (char === "(") {
84
- var count = 1;
85
- var pattern = "";
86
- var j = i + 1;
87
- if (str[j] === "?") {
88
- throw new TypeError('Pattern cannot start with "?" at ' + j);
89
- }
90
- while (j < str.length) {
91
- if (str[j] === "\\") {
92
- pattern += str[j++] + str[j++];
93
- continue;
94
- }
95
- if (str[j] === ")") {
96
- count--;
97
- if (count === 0) {
98
- j++;
99
- break;
100
- }
101
- } else if (str[j] === "(") {
102
- count++;
103
- if (str[j + 1] !== "?") {
104
- throw new TypeError("Capturing groups are not allowed at " + j);
105
- }
106
- }
107
- pattern += str[j++];
108
- }
109
- if (count)
110
- throw new TypeError("Unbalanced pattern at " + i);
111
- if (!pattern)
112
- throw new TypeError("Missing pattern at " + i);
113
- tokens.push({ type: "PATTERN", index: i, value: pattern });
114
- i = j;
115
- continue;
116
- }
117
- tokens.push({ type: "CHAR", index: i, value: str[i++] });
118
- }
119
- tokens.push({ type: "END", index: i, value: "" });
120
- return tokens;
121
- }
122
- function parse(str, options) {
123
- if (options === void 0) {
124
- options = {};
125
- }
126
- var tokens = lexer(str);
127
- var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
128
- var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
129
- var result = [];
130
- var key = 0;
131
- var i = 0;
132
- var path = "";
133
- var tryConsume = function(type) {
134
- if (i < tokens.length && tokens[i].type === type)
135
- return tokens[i++].value;
136
- };
137
- var mustConsume = function(type) {
138
- var value2 = tryConsume(type);
139
- if (value2 !== void 0)
140
- return value2;
141
- var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
142
- throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
143
- };
144
- var consumeText = function() {
145
- var result2 = "";
146
- var value2;
147
- while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
148
- result2 += value2;
149
- }
150
- return result2;
151
- };
152
- while (i < tokens.length) {
153
- var char = tryConsume("CHAR");
154
- var name = tryConsume("NAME");
155
- var pattern = tryConsume("PATTERN");
156
- if (name || pattern) {
157
- var prefix = char || "";
158
- if (prefixes.indexOf(prefix) === -1) {
159
- path += prefix;
160
- prefix = "";
161
- }
162
- if (path) {
163
- result.push(path);
164
- path = "";
165
- }
166
- result.push({
167
- name: name || key++,
168
- prefix,
169
- suffix: "",
170
- pattern: pattern || defaultPattern,
171
- modifier: tryConsume("MODIFIER") || ""
172
- });
173
- continue;
174
- }
175
- var value = char || tryConsume("ESCAPED_CHAR");
176
- if (value) {
177
- path += value;
178
- continue;
179
- }
180
- if (path) {
181
- result.push(path);
182
- path = "";
183
- }
184
- var open = tryConsume("OPEN");
185
- if (open) {
186
- var prefix = consumeText();
187
- var name_1 = tryConsume("NAME") || "";
188
- var pattern_1 = tryConsume("PATTERN") || "";
189
- var suffix = consumeText();
190
- mustConsume("CLOSE");
191
- result.push({
192
- name: name_1 || (pattern_1 ? key++ : ""),
193
- pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
194
- prefix,
195
- suffix,
196
- modifier: tryConsume("MODIFIER") || ""
197
- });
198
- continue;
199
- }
200
- mustConsume("END");
201
- }
202
- return result;
203
- }
204
- exports.parse = parse;
205
- function compile(str, options) {
206
- return tokensToFunction(parse(str, options), options);
207
- }
208
- exports.compile = compile;
209
- function tokensToFunction(tokens, options) {
210
- if (options === void 0) {
211
- options = {};
212
- }
213
- var reFlags = flags(options);
214
- var _a = options.encode, encode = _a === void 0 ? function(x) {
215
- return x;
216
- } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
217
- var matches = tokens.map(function(token) {
218
- if (typeof token === "object") {
219
- return new RegExp("^(?:" + token.pattern + ")$", reFlags);
220
- }
221
- });
222
- return function(data) {
223
- var path = "";
224
- for (var i = 0; i < tokens.length; i++) {
225
- var token = tokens[i];
226
- if (typeof token === "string") {
227
- path += token;
228
- continue;
229
- }
230
- var value = data ? data[token.name] : void 0;
231
- var optional = token.modifier === "?" || token.modifier === "*";
232
- var repeat = token.modifier === "*" || token.modifier === "+";
233
- if (Array.isArray(value)) {
234
- if (!repeat) {
235
- throw new TypeError('Expected "' + token.name + '" to not repeat, but got an array');
236
- }
237
- if (value.length === 0) {
238
- if (optional)
239
- continue;
240
- throw new TypeError('Expected "' + token.name + '" to not be empty');
241
- }
242
- for (var j = 0; j < value.length; j++) {
243
- var segment = encode(value[j], token);
244
- if (validate && !matches[i].test(segment)) {
245
- throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
246
- }
247
- path += token.prefix + segment + token.suffix;
248
- }
249
- continue;
250
- }
251
- if (typeof value === "string" || typeof value === "number") {
252
- var segment = encode(String(value), token);
253
- if (validate && !matches[i].test(segment)) {
254
- throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
255
- }
256
- path += token.prefix + segment + token.suffix;
257
- continue;
258
- }
259
- if (optional)
260
- continue;
261
- var typeOfMessage = repeat ? "an array" : "a string";
262
- throw new TypeError('Expected "' + token.name + '" to be ' + typeOfMessage);
263
- }
264
- return path;
265
- };
266
- }
267
- exports.tokensToFunction = tokensToFunction;
268
- function match(str, options) {
269
- var keys = [];
270
- var re = pathToRegexp2(str, keys, options);
271
- return regexpToFunction(re, keys, options);
272
- }
273
- exports.match = match;
274
- function regexpToFunction(re, keys, options) {
275
- if (options === void 0) {
276
- options = {};
277
- }
278
- var _a = options.decode, decode = _a === void 0 ? function(x) {
279
- return x;
280
- } : _a;
281
- return function(pathname) {
282
- var m = re.exec(pathname);
283
- if (!m)
284
- return false;
285
- var path = m[0], index = m.index;
286
- var params = /* @__PURE__ */ Object.create(null);
287
- var _loop_1 = function(i2) {
288
- if (m[i2] === void 0)
289
- return "continue";
290
- var key = keys[i2 - 1];
291
- if (key.modifier === "*" || key.modifier === "+") {
292
- params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
293
- return decode(value, key);
294
- });
295
- } else {
296
- params[key.name] = decode(m[i2], key);
297
- }
298
- };
299
- for (var i = 1; i < m.length; i++) {
300
- _loop_1(i);
301
- }
302
- return { path, index, params };
303
- };
304
- }
305
- exports.regexpToFunction = regexpToFunction;
306
- function escapeString(str) {
307
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
308
- }
309
- function flags(options) {
310
- return options && options.sensitive ? "" : "i";
311
- }
312
- function regexpToRegexp(path, keys) {
313
- if (!keys)
314
- return path;
315
- var groups = path.source.match(/\((?!\?)/g);
316
- if (groups) {
317
- for (var i = 0; i < groups.length; i++) {
318
- keys.push({
319
- name: i,
320
- prefix: "",
321
- suffix: "",
322
- modifier: "",
323
- pattern: ""
324
- });
325
- }
326
- }
327
- return path;
328
- }
329
- function arrayToRegexp(paths, keys, options) {
330
- var parts = paths.map(function(path) {
331
- return pathToRegexp2(path, keys, options).source;
332
- });
333
- return new RegExp("(?:" + parts.join("|") + ")", flags(options));
334
- }
335
- function stringToRegexp(path, keys, options) {
336
- return tokensToRegexp(parse(path, options), keys, options);
337
- }
338
- function tokensToRegexp(tokens, keys, options) {
339
- if (options === void 0) {
340
- options = {};
341
- }
342
- var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
343
- return x;
344
- } : _d;
345
- var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
346
- var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
347
- var route = start ? "^" : "";
348
- for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
349
- var token = tokens_1[_i];
350
- if (typeof token === "string") {
351
- route += escapeString(encode(token));
352
- } else {
353
- var prefix = escapeString(encode(token.prefix));
354
- var suffix = escapeString(encode(token.suffix));
355
- if (token.pattern) {
356
- if (keys)
357
- keys.push(token);
358
- if (prefix || suffix) {
359
- if (token.modifier === "+" || token.modifier === "*") {
360
- var mod = token.modifier === "*" ? "?" : "";
361
- route += "(?:" + prefix + "((?:" + token.pattern + ")(?:" + suffix + prefix + "(?:" + token.pattern + "))*)" + suffix + ")" + mod;
362
- } else {
363
- route += "(?:" + prefix + "(" + token.pattern + ")" + suffix + ")" + token.modifier;
364
- }
365
- } else {
366
- route += "(" + token.pattern + ")" + token.modifier;
367
- }
368
- } else {
369
- route += "(?:" + prefix + suffix + ")" + token.modifier;
370
- }
371
- }
372
- }
373
- if (end) {
374
- if (!strict)
375
- route += delimiter + "?";
376
- route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
377
- } else {
378
- var endToken = tokens[tokens.length - 1];
379
- var isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : (
380
- // tslint:disable-next-line
381
- endToken === void 0
382
- );
383
- if (!strict) {
384
- route += "(?:" + delimiter + "(?=" + endsWith + "))?";
385
- }
386
- if (!isEndDelimited) {
387
- route += "(?=" + delimiter + "|" + endsWith + ")";
388
- }
389
- }
390
- return new RegExp(route, flags(options));
391
- }
392
- exports.tokensToRegexp = tokensToRegexp;
393
- function pathToRegexp2(path, keys, options) {
394
- if (path instanceof RegExp)
395
- return regexpToRegexp(path, keys);
396
- if (Array.isArray(path))
397
- return arrayToRegexp(path, keys, options);
398
- return stringToRegexp(path, keys, options);
399
- }
400
- exports.pathToRegexp = pathToRegexp2;
401
- }
402
- });
403
-
404
- // ../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js
405
- var require_dist2 = __commonJS({
406
- "../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js"(exports) {
407
- "use strict";
408
- Object.defineProperty(exports, "__esModule", { value: true });
409
- exports.pathToRegexp = exports.tokensToRegexp = exports.regexpToFunction = exports.match = exports.tokensToFunction = exports.compile = exports.parse = void 0;
410
- function lexer(str) {
411
- var tokens = [];
412
- var i = 0;
413
- while (i < str.length) {
414
- var char = str[i];
415
- if (char === "*" || char === "+" || char === "?") {
416
- tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
417
- continue;
418
- }
419
- if (char === "\\") {
420
- tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
421
- continue;
422
- }
423
- if (char === "{") {
424
- tokens.push({ type: "OPEN", index: i, value: str[i++] });
425
- continue;
426
- }
427
- if (char === "}") {
428
- tokens.push({ type: "CLOSE", index: i, value: str[i++] });
429
- continue;
430
- }
431
- if (char === ":") {
432
- var name = "";
433
- var j = i + 1;
434
- while (j < str.length) {
435
- var code = str.charCodeAt(j);
436
- if (
437
- // `0-9`
438
- code >= 48 && code <= 57 || // `A-Z`
439
- code >= 65 && code <= 90 || // `a-z`
440
- code >= 97 && code <= 122 || // `_`
441
- code === 95
442
- ) {
443
- name += str[j++];
444
- continue;
445
- }
446
- break;
447
- }
448
- if (!name)
449
- throw new TypeError("Missing parameter name at ".concat(i));
450
- tokens.push({ type: "NAME", index: i, value: name });
451
- i = j;
452
- continue;
453
- }
454
- if (char === "(") {
455
- var count = 1;
456
- var pattern = "";
457
- var j = i + 1;
458
- if (str[j] === "?") {
459
- throw new TypeError('Pattern cannot start with "?" at '.concat(j));
460
- }
461
- while (j < str.length) {
462
- if (str[j] === "\\") {
463
- pattern += str[j++] + str[j++];
464
- continue;
465
- }
466
- if (str[j] === ")") {
467
- count--;
468
- if (count === 0) {
469
- j++;
470
- break;
471
- }
472
- } else if (str[j] === "(") {
473
- count++;
474
- if (str[j + 1] !== "?") {
475
- throw new TypeError("Capturing groups are not allowed at ".concat(j));
476
- }
477
- }
478
- pattern += str[j++];
479
- }
480
- if (count)
481
- throw new TypeError("Unbalanced pattern at ".concat(i));
482
- if (!pattern)
483
- throw new TypeError("Missing pattern at ".concat(i));
484
- tokens.push({ type: "PATTERN", index: i, value: pattern });
485
- i = j;
486
- continue;
487
- }
488
- tokens.push({ type: "CHAR", index: i, value: str[i++] });
489
- }
490
- tokens.push({ type: "END", index: i, value: "" });
491
- return tokens;
492
- }
493
- function parse(str, options) {
494
- if (options === void 0) {
495
- options = {};
496
- }
497
- var tokens = lexer(str);
498
- var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
499
- var result = [];
500
- var key = 0;
501
- var i = 0;
502
- var path = "";
503
- var tryConsume = function(type) {
504
- if (i < tokens.length && tokens[i].type === type)
505
- return tokens[i++].value;
506
- };
507
- var mustConsume = function(type) {
508
- var value2 = tryConsume(type);
509
- if (value2 !== void 0)
510
- return value2;
511
- var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
512
- throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
513
- };
514
- var consumeText = function() {
515
- var result2 = "";
516
- var value2;
517
- while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
518
- result2 += value2;
519
- }
520
- return result2;
521
- };
522
- var isSafe = function(value2) {
523
- for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
524
- var char2 = delimiter_1[_i];
525
- if (value2.indexOf(char2) > -1)
526
- return true;
527
- }
528
- return false;
529
- };
530
- var safePattern = function(prefix2) {
531
- var prev = result[result.length - 1];
532
- var prevText = prefix2 || (prev && typeof prev === "string" ? prev : "");
533
- if (prev && !prevText) {
534
- throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name, '"'));
535
- }
536
- if (!prevText || isSafe(prevText))
537
- return "[^".concat(escapeString(delimiter), "]+?");
538
- return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
539
- };
540
- while (i < tokens.length) {
541
- var char = tryConsume("CHAR");
542
- var name = tryConsume("NAME");
543
- var pattern = tryConsume("PATTERN");
544
- if (name || pattern) {
545
- var prefix = char || "";
546
- if (prefixes.indexOf(prefix) === -1) {
547
- path += prefix;
548
- prefix = "";
549
- }
550
- if (path) {
551
- result.push(path);
552
- path = "";
553
- }
554
- result.push({
555
- name: name || key++,
556
- prefix,
557
- suffix: "",
558
- pattern: pattern || safePattern(prefix),
559
- modifier: tryConsume("MODIFIER") || ""
560
- });
561
- continue;
562
- }
563
- var value = char || tryConsume("ESCAPED_CHAR");
564
- if (value) {
565
- path += value;
566
- continue;
567
- }
568
- if (path) {
569
- result.push(path);
570
- path = "";
571
- }
572
- var open = tryConsume("OPEN");
573
- if (open) {
574
- var prefix = consumeText();
575
- var name_1 = tryConsume("NAME") || "";
576
- var pattern_1 = tryConsume("PATTERN") || "";
577
- var suffix = consumeText();
578
- mustConsume("CLOSE");
579
- result.push({
580
- name: name_1 || (pattern_1 ? key++ : ""),
581
- pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,
582
- prefix,
583
- suffix,
584
- modifier: tryConsume("MODIFIER") || ""
585
- });
586
- continue;
587
- }
588
- mustConsume("END");
589
- }
590
- return result;
591
- }
592
- exports.parse = parse;
593
- function compile(str, options) {
594
- return tokensToFunction(parse(str, options), options);
595
- }
596
- exports.compile = compile;
597
- function tokensToFunction(tokens, options) {
598
- if (options === void 0) {
599
- options = {};
600
- }
601
- var reFlags = flags(options);
602
- var _a = options.encode, encode = _a === void 0 ? function(x) {
603
- return x;
604
- } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
605
- var matches = tokens.map(function(token) {
606
- if (typeof token === "object") {
607
- return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
608
- }
609
- });
610
- return function(data) {
611
- var path = "";
612
- for (var i = 0; i < tokens.length; i++) {
613
- var token = tokens[i];
614
- if (typeof token === "string") {
615
- path += token;
616
- continue;
617
- }
618
- var value = data ? data[token.name] : void 0;
619
- var optional = token.modifier === "?" || token.modifier === "*";
620
- var repeat = token.modifier === "*" || token.modifier === "+";
621
- if (Array.isArray(value)) {
622
- if (!repeat) {
623
- throw new TypeError('Expected "'.concat(token.name, '" to not repeat, but got an array'));
624
- }
625
- if (value.length === 0) {
626
- if (optional)
627
- continue;
628
- throw new TypeError('Expected "'.concat(token.name, '" to not be empty'));
629
- }
630
- for (var j = 0; j < value.length; j++) {
631
- var segment = encode(value[j], token);
632
- if (validate && !matches[i].test(segment)) {
633
- throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
634
- }
635
- path += token.prefix + segment + token.suffix;
636
- }
637
- continue;
638
- }
639
- if (typeof value === "string" || typeof value === "number") {
640
- var segment = encode(String(value), token);
641
- if (validate && !matches[i].test(segment)) {
642
- throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
643
- }
644
- path += token.prefix + segment + token.suffix;
645
- continue;
646
- }
647
- if (optional)
648
- continue;
649
- var typeOfMessage = repeat ? "an array" : "a string";
650
- throw new TypeError('Expected "'.concat(token.name, '" to be ').concat(typeOfMessage));
651
- }
652
- return path;
653
- };
654
- }
655
- exports.tokensToFunction = tokensToFunction;
656
- function match(str, options) {
657
- var keys = [];
658
- var re = pathToRegexp2(str, keys, options);
659
- return regexpToFunction(re, keys, options);
660
- }
661
- exports.match = match;
662
- function regexpToFunction(re, keys, options) {
663
- if (options === void 0) {
664
- options = {};
665
- }
666
- var _a = options.decode, decode = _a === void 0 ? function(x) {
667
- return x;
668
- } : _a;
669
- return function(pathname) {
670
- var m = re.exec(pathname);
671
- if (!m)
672
- return false;
673
- var path = m[0], index = m.index;
674
- var params = /* @__PURE__ */ Object.create(null);
675
- var _loop_1 = function(i2) {
676
- if (m[i2] === void 0)
677
- return "continue";
678
- var key = keys[i2 - 1];
679
- if (key.modifier === "*" || key.modifier === "+") {
680
- params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
681
- return decode(value, key);
682
- });
683
- } else {
684
- params[key.name] = decode(m[i2], key);
685
- }
686
- };
687
- for (var i = 1; i < m.length; i++) {
688
- _loop_1(i);
689
- }
690
- return { path, index, params };
691
- };
692
- }
693
- exports.regexpToFunction = regexpToFunction;
694
- function escapeString(str) {
695
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
696
- }
697
- function flags(options) {
698
- return options && options.sensitive ? "" : "i";
699
- }
700
- function regexpToRegexp(path, keys) {
701
- if (!keys)
702
- return path;
703
- var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
704
- var index = 0;
705
- var execResult = groupsRegex.exec(path.source);
706
- while (execResult) {
707
- keys.push({
708
- // Use parenthesized substring match if available, index otherwise
709
- name: execResult[1] || index++,
710
- prefix: "",
711
- suffix: "",
712
- modifier: "",
713
- pattern: ""
714
- });
715
- execResult = groupsRegex.exec(path.source);
716
- }
717
- return path;
718
- }
719
- function arrayToRegexp(paths, keys, options) {
720
- var parts = paths.map(function(path) {
721
- return pathToRegexp2(path, keys, options).source;
722
- });
723
- return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
724
- }
725
- function stringToRegexp(path, keys, options) {
726
- return tokensToRegexp(parse(path, options), keys, options);
727
- }
728
- function tokensToRegexp(tokens, keys, options) {
729
- if (options === void 0) {
730
- options = {};
731
- }
732
- var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
733
- return x;
734
- } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
735
- var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
736
- var delimiterRe = "[".concat(escapeString(delimiter), "]");
737
- var route = start ? "^" : "";
738
- for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
739
- var token = tokens_1[_i];
740
- if (typeof token === "string") {
741
- route += escapeString(encode(token));
742
- } else {
743
- var prefix = escapeString(encode(token.prefix));
744
- var suffix = escapeString(encode(token.suffix));
745
- if (token.pattern) {
746
- if (keys)
747
- keys.push(token);
748
- if (prefix || suffix) {
749
- if (token.modifier === "+" || token.modifier === "*") {
750
- var mod = token.modifier === "*" ? "?" : "";
751
- route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
752
- } else {
753
- route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
754
- }
755
- } else {
756
- if (token.modifier === "+" || token.modifier === "*") {
757
- throw new TypeError('Can not repeat "'.concat(token.name, '" without a prefix and suffix'));
758
- }
759
- route += "(".concat(token.pattern, ")").concat(token.modifier);
760
- }
761
- } else {
762
- route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
763
- }
764
- }
765
- }
766
- if (end) {
767
- if (!strict)
768
- route += "".concat(delimiterRe, "?");
769
- route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
770
- } else {
771
- var endToken = tokens[tokens.length - 1];
772
- var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
773
- if (!strict) {
774
- route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
775
- }
776
- if (!isEndDelimited) {
777
- route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
778
- }
779
- }
780
- return new RegExp(route, flags(options));
781
- }
782
- exports.tokensToRegexp = tokensToRegexp;
783
- function pathToRegexp2(path, keys, options) {
784
- if (path instanceof RegExp)
785
- return regexpToRegexp(path, keys);
786
- if (Array.isArray(path))
787
- return arrayToRegexp(path, keys, options);
788
- return stringToRegexp(path, keys, options);
789
- }
790
- exports.pathToRegexp = pathToRegexp2;
791
- }
792
- });
793
-
794
- // ../../internals/path-to-regexp/dist/index.js
795
- var require_dist3 = __commonJS({
796
- "../../internals/path-to-regexp/dist/index.js"(exports) {
797
- "use strict";
798
- Object.defineProperty(exports, "__esModule", { value: true });
799
- exports.compile = exports.pathToRegexp = void 0;
800
- var path_to_regexp_1 = require_dist();
801
- Object.defineProperty(exports, "compile", { enumerable: true, get: function() {
802
- return path_to_regexp_1.compile;
803
- } });
804
- var path_to_regexp_updated_1 = require_dist2();
805
- function cloneKeys(keys) {
806
- if (typeof keys === "undefined") {
807
- return void 0;
808
- }
809
- return keys.slice(0);
810
- }
811
- function compareKeys(left, right) {
812
- const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
813
- const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
814
- return leftSerialized === rightSerialized;
815
- }
816
- function pathToRegexp2(callerId, path, keys, options) {
817
- const newKeys = cloneKeys(keys);
818
- const currentRegExp = (0, path_to_regexp_1.pathToRegexp)(path, keys, options);
819
- try {
820
- const currentKeys = keys;
821
- const newRegExp = (0, path_to_regexp_updated_1.pathToRegexp)(path, newKeys, options);
822
- const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
823
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
824
- const message = JSON.stringify({
825
- path,
826
- currentRegExp: currentRegExp.toString(),
827
- newRegExp: newRegExp.toString()
828
- });
829
- console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
830
- }
831
- const isDiffKeys = !compareKeys(keys, newKeys);
832
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
833
- const message = JSON.stringify({
834
- isDiffKeys,
835
- currentKeys,
836
- newKeys
837
- });
838
- console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
839
- }
840
- } catch (err) {
841
- const error = err;
842
- const message = JSON.stringify({
843
- path,
844
- error: error.message
845
- });
846
- console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
847
- }
848
- return currentRegExp;
849
- }
850
- exports.pathToRegexp = pathToRegexp2;
851
- }
852
- });
853
-
854
34
  // ../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js
855
35
  var require_content_type = __commonJS({
856
36
  "../../node_modules/.pnpm/content-type@1.0.5/node_modules/content-type/index.js"(exports) {
@@ -1412,9 +592,10 @@ import { isError } from "@vercel/error-utils";
1412
592
  import { readFileSync } from "fs";
1413
593
 
1414
594
  // src/utils.ts
1415
- var import_path_to_regexp = __toESM(require_dist3());
1416
595
  import { debug, streamToBuffer } from "@vercel/build-utils";
1417
596
  import { extname } from "path";
597
+ import { pathToRegexp as pathToRegexpCurrent } from "path-to-regexp";
598
+ import { pathToRegexp as pathToRegexpUpdated } from "path-to-regexp-updated";
1418
599
  var WAIT_UNTIL_TIMEOUT = 10;
1419
600
  var WAIT_UNTIL_TIMEOUT_MS = 10 * 1e3;
1420
601
  var waitUntilWarning = (entrypointPath) => `