@vercel/next 4.4.4 → 4.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +425 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -400,6 +400,396 @@ var require_dist = __commonJS({
400
400
  }
401
401
  });
402
402
 
403
+ // ../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js
404
+ var require_dist2 = __commonJS({
405
+ "../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js"(exports) {
406
+ "use strict";
407
+ Object.defineProperty(exports, "__esModule", { value: true });
408
+ exports.pathToRegexp = exports.tokensToRegexp = exports.regexpToFunction = exports.match = exports.tokensToFunction = exports.compile = exports.parse = void 0;
409
+ function lexer(str) {
410
+ var tokens = [];
411
+ var i = 0;
412
+ while (i < str.length) {
413
+ var char = str[i];
414
+ if (char === "*" || char === "+" || char === "?") {
415
+ tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
416
+ continue;
417
+ }
418
+ if (char === "\\") {
419
+ tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
420
+ continue;
421
+ }
422
+ if (char === "{") {
423
+ tokens.push({ type: "OPEN", index: i, value: str[i++] });
424
+ continue;
425
+ }
426
+ if (char === "}") {
427
+ tokens.push({ type: "CLOSE", index: i, value: str[i++] });
428
+ continue;
429
+ }
430
+ if (char === ":") {
431
+ var name = "";
432
+ var j = i + 1;
433
+ while (j < str.length) {
434
+ var code = str.charCodeAt(j);
435
+ if (
436
+ // `0-9`
437
+ code >= 48 && code <= 57 || // `A-Z`
438
+ code >= 65 && code <= 90 || // `a-z`
439
+ code >= 97 && code <= 122 || // `_`
440
+ code === 95
441
+ ) {
442
+ name += str[j++];
443
+ continue;
444
+ }
445
+ break;
446
+ }
447
+ if (!name)
448
+ throw new TypeError("Missing parameter name at ".concat(i));
449
+ tokens.push({ type: "NAME", index: i, value: name });
450
+ i = j;
451
+ continue;
452
+ }
453
+ if (char === "(") {
454
+ var count = 1;
455
+ var pattern = "";
456
+ var j = i + 1;
457
+ if (str[j] === "?") {
458
+ throw new TypeError('Pattern cannot start with "?" at '.concat(j));
459
+ }
460
+ while (j < str.length) {
461
+ if (str[j] === "\\") {
462
+ pattern += str[j++] + str[j++];
463
+ continue;
464
+ }
465
+ if (str[j] === ")") {
466
+ count--;
467
+ if (count === 0) {
468
+ j++;
469
+ break;
470
+ }
471
+ } else if (str[j] === "(") {
472
+ count++;
473
+ if (str[j + 1] !== "?") {
474
+ throw new TypeError("Capturing groups are not allowed at ".concat(j));
475
+ }
476
+ }
477
+ pattern += str[j++];
478
+ }
479
+ if (count)
480
+ throw new TypeError("Unbalanced pattern at ".concat(i));
481
+ if (!pattern)
482
+ throw new TypeError("Missing pattern at ".concat(i));
483
+ tokens.push({ type: "PATTERN", index: i, value: pattern });
484
+ i = j;
485
+ continue;
486
+ }
487
+ tokens.push({ type: "CHAR", index: i, value: str[i++] });
488
+ }
489
+ tokens.push({ type: "END", index: i, value: "" });
490
+ return tokens;
491
+ }
492
+ function parse(str, options) {
493
+ if (options === void 0) {
494
+ options = {};
495
+ }
496
+ var tokens = lexer(str);
497
+ var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
498
+ var result = [];
499
+ var key = 0;
500
+ var i = 0;
501
+ var path5 = "";
502
+ var tryConsume = function(type) {
503
+ if (i < tokens.length && tokens[i].type === type)
504
+ return tokens[i++].value;
505
+ };
506
+ var mustConsume = function(type) {
507
+ var value2 = tryConsume(type);
508
+ if (value2 !== void 0)
509
+ return value2;
510
+ var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
511
+ throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
512
+ };
513
+ var consumeText = function() {
514
+ var result2 = "";
515
+ var value2;
516
+ while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
517
+ result2 += value2;
518
+ }
519
+ return result2;
520
+ };
521
+ var isSafe = function(value2) {
522
+ for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
523
+ var char2 = delimiter_1[_i];
524
+ if (value2.indexOf(char2) > -1)
525
+ return true;
526
+ }
527
+ return false;
528
+ };
529
+ var safePattern = function(prefix2) {
530
+ var prev = result[result.length - 1];
531
+ var prevText = prefix2 || (prev && typeof prev === "string" ? prev : "");
532
+ if (prev && !prevText) {
533
+ throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name, '"'));
534
+ }
535
+ if (!prevText || isSafe(prevText))
536
+ return "[^".concat(escapeString(delimiter), "]+?");
537
+ return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
538
+ };
539
+ while (i < tokens.length) {
540
+ var char = tryConsume("CHAR");
541
+ var name = tryConsume("NAME");
542
+ var pattern = tryConsume("PATTERN");
543
+ if (name || pattern) {
544
+ var prefix = char || "";
545
+ if (prefixes.indexOf(prefix) === -1) {
546
+ path5 += prefix;
547
+ prefix = "";
548
+ }
549
+ if (path5) {
550
+ result.push(path5);
551
+ path5 = "";
552
+ }
553
+ result.push({
554
+ name: name || key++,
555
+ prefix,
556
+ suffix: "",
557
+ pattern: pattern || safePattern(prefix),
558
+ modifier: tryConsume("MODIFIER") || ""
559
+ });
560
+ continue;
561
+ }
562
+ var value = char || tryConsume("ESCAPED_CHAR");
563
+ if (value) {
564
+ path5 += value;
565
+ continue;
566
+ }
567
+ if (path5) {
568
+ result.push(path5);
569
+ path5 = "";
570
+ }
571
+ var open = tryConsume("OPEN");
572
+ if (open) {
573
+ var prefix = consumeText();
574
+ var name_1 = tryConsume("NAME") || "";
575
+ var pattern_1 = tryConsume("PATTERN") || "";
576
+ var suffix = consumeText();
577
+ mustConsume("CLOSE");
578
+ result.push({
579
+ name: name_1 || (pattern_1 ? key++ : ""),
580
+ pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,
581
+ prefix,
582
+ suffix,
583
+ modifier: tryConsume("MODIFIER") || ""
584
+ });
585
+ continue;
586
+ }
587
+ mustConsume("END");
588
+ }
589
+ return result;
590
+ }
591
+ exports.parse = parse;
592
+ function compile(str, options) {
593
+ return tokensToFunction(parse(str, options), options);
594
+ }
595
+ exports.compile = compile;
596
+ function tokensToFunction(tokens, options) {
597
+ if (options === void 0) {
598
+ options = {};
599
+ }
600
+ var reFlags = flags(options);
601
+ var _a = options.encode, encode = _a === void 0 ? function(x) {
602
+ return x;
603
+ } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
604
+ var matches = tokens.map(function(token) {
605
+ if (typeof token === "object") {
606
+ return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
607
+ }
608
+ });
609
+ return function(data) {
610
+ var path5 = "";
611
+ for (var i = 0; i < tokens.length; i++) {
612
+ var token = tokens[i];
613
+ if (typeof token === "string") {
614
+ path5 += token;
615
+ continue;
616
+ }
617
+ var value = data ? data[token.name] : void 0;
618
+ var optional = token.modifier === "?" || token.modifier === "*";
619
+ var repeat = token.modifier === "*" || token.modifier === "+";
620
+ if (Array.isArray(value)) {
621
+ if (!repeat) {
622
+ throw new TypeError('Expected "'.concat(token.name, '" to not repeat, but got an array'));
623
+ }
624
+ if (value.length === 0) {
625
+ if (optional)
626
+ continue;
627
+ throw new TypeError('Expected "'.concat(token.name, '" to not be empty'));
628
+ }
629
+ for (var j = 0; j < value.length; j++) {
630
+ var segment = encode(value[j], token);
631
+ if (validate && !matches[i].test(segment)) {
632
+ throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
633
+ }
634
+ path5 += token.prefix + segment + token.suffix;
635
+ }
636
+ continue;
637
+ }
638
+ if (typeof value === "string" || typeof value === "number") {
639
+ var segment = encode(String(value), token);
640
+ if (validate && !matches[i].test(segment)) {
641
+ throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
642
+ }
643
+ path5 += token.prefix + segment + token.suffix;
644
+ continue;
645
+ }
646
+ if (optional)
647
+ continue;
648
+ var typeOfMessage = repeat ? "an array" : "a string";
649
+ throw new TypeError('Expected "'.concat(token.name, '" to be ').concat(typeOfMessage));
650
+ }
651
+ return path5;
652
+ };
653
+ }
654
+ exports.tokensToFunction = tokensToFunction;
655
+ function match(str, options) {
656
+ var keys = [];
657
+ var re = pathToRegexp(str, keys, options);
658
+ return regexpToFunction(re, keys, options);
659
+ }
660
+ exports.match = match;
661
+ function regexpToFunction(re, keys, options) {
662
+ if (options === void 0) {
663
+ options = {};
664
+ }
665
+ var _a = options.decode, decode = _a === void 0 ? function(x) {
666
+ return x;
667
+ } : _a;
668
+ return function(pathname) {
669
+ var m = re.exec(pathname);
670
+ if (!m)
671
+ return false;
672
+ var path5 = m[0], index = m.index;
673
+ var params = /* @__PURE__ */ Object.create(null);
674
+ var _loop_1 = function(i2) {
675
+ if (m[i2] === void 0)
676
+ return "continue";
677
+ var key = keys[i2 - 1];
678
+ if (key.modifier === "*" || key.modifier === "+") {
679
+ params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
680
+ return decode(value, key);
681
+ });
682
+ } else {
683
+ params[key.name] = decode(m[i2], key);
684
+ }
685
+ };
686
+ for (var i = 1; i < m.length; i++) {
687
+ _loop_1(i);
688
+ }
689
+ return { path: path5, index, params };
690
+ };
691
+ }
692
+ exports.regexpToFunction = regexpToFunction;
693
+ function escapeString(str) {
694
+ return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
695
+ }
696
+ function flags(options) {
697
+ return options && options.sensitive ? "" : "i";
698
+ }
699
+ function regexpToRegexp(path5, keys) {
700
+ if (!keys)
701
+ return path5;
702
+ var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
703
+ var index = 0;
704
+ var execResult = groupsRegex.exec(path5.source);
705
+ while (execResult) {
706
+ keys.push({
707
+ // Use parenthesized substring match if available, index otherwise
708
+ name: execResult[1] || index++,
709
+ prefix: "",
710
+ suffix: "",
711
+ modifier: "",
712
+ pattern: ""
713
+ });
714
+ execResult = groupsRegex.exec(path5.source);
715
+ }
716
+ return path5;
717
+ }
718
+ function arrayToRegexp(paths, keys, options) {
719
+ var parts = paths.map(function(path5) {
720
+ return pathToRegexp(path5, keys, options).source;
721
+ });
722
+ return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
723
+ }
724
+ function stringToRegexp(path5, keys, options) {
725
+ return tokensToRegexp(parse(path5, options), keys, options);
726
+ }
727
+ function tokensToRegexp(tokens, keys, options) {
728
+ if (options === void 0) {
729
+ options = {};
730
+ }
731
+ 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) {
732
+ return x;
733
+ } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
734
+ var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
735
+ var delimiterRe = "[".concat(escapeString(delimiter), "]");
736
+ var route = start ? "^" : "";
737
+ for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
738
+ var token = tokens_1[_i];
739
+ if (typeof token === "string") {
740
+ route += escapeString(encode(token));
741
+ } else {
742
+ var prefix = escapeString(encode(token.prefix));
743
+ var suffix = escapeString(encode(token.suffix));
744
+ if (token.pattern) {
745
+ if (keys)
746
+ keys.push(token);
747
+ if (prefix || suffix) {
748
+ if (token.modifier === "+" || token.modifier === "*") {
749
+ var mod = token.modifier === "*" ? "?" : "";
750
+ route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
751
+ } else {
752
+ route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
753
+ }
754
+ } else {
755
+ if (token.modifier === "+" || token.modifier === "*") {
756
+ throw new TypeError('Can not repeat "'.concat(token.name, '" without a prefix and suffix'));
757
+ }
758
+ route += "(".concat(token.pattern, ")").concat(token.modifier);
759
+ }
760
+ } else {
761
+ route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
762
+ }
763
+ }
764
+ }
765
+ if (end) {
766
+ if (!strict)
767
+ route += "".concat(delimiterRe, "?");
768
+ route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
769
+ } else {
770
+ var endToken = tokens[tokens.length - 1];
771
+ var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
772
+ if (!strict) {
773
+ route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
774
+ }
775
+ if (!isEndDelimited) {
776
+ route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
777
+ }
778
+ }
779
+ return new RegExp(route, flags(options));
780
+ }
781
+ exports.tokensToRegexp = tokensToRegexp;
782
+ function pathToRegexp(path5, keys, options) {
783
+ if (path5 instanceof RegExp)
784
+ return regexpToRegexp(path5, keys);
785
+ if (Array.isArray(path5))
786
+ return arrayToRegexp(path5, keys, options);
787
+ return stringToRegexp(path5, keys, options);
788
+ }
789
+ exports.pathToRegexp = pathToRegexp;
790
+ }
791
+ });
792
+
403
793
  // ../routing-utils/dist/superstatic.js
404
794
  var require_superstatic = __commonJS({
405
795
  "../routing-utils/dist/superstatic.js"(exports, module2) {
@@ -435,6 +825,37 @@ var require_superstatic = __commonJS({
435
825
  module2.exports = __toCommonJS2(superstatic_exports);
436
826
  var import_url4 = require("url");
437
827
  var import_path_to_regexp = require_dist();
828
+ var import_path_to_regexp_updated = require_dist2();
829
+ function pathToRegexp(callerId, path5, keys, options) {
830
+ const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path5, keys, options);
831
+ try {
832
+ const currentKeys = keys;
833
+ const newKeys = [];
834
+ const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path5, newKeys, options);
835
+ const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
836
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
837
+ const message = JSON.stringify({
838
+ path: path5,
839
+ currentRegExp: currentRegExp.toString(),
840
+ newRegExp: newRegExp.toString()
841
+ });
842
+ console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
843
+ }
844
+ const isDiffKeys = keys?.toString() !== newKeys?.toString();
845
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
846
+ const message = JSON.stringify({
847
+ isDiffKeys,
848
+ currentKeys,
849
+ newKeys
850
+ });
851
+ console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
852
+ }
853
+ } catch (err) {
854
+ const error = err;
855
+ console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${error.message}`);
856
+ }
857
+ return currentRegExp;
858
+ }
438
859
  var UN_NAMED_SEGMENT = "__UN_NAMED_SEGMENT__";
439
860
  function getCleanUrls(filePaths) {
440
861
  const htmlFiles = filePaths.map(toRoute).filter((f) => f.endsWith(".html")).map((f) => ({
@@ -590,7 +1011,7 @@ var require_superstatic = __commonJS({
590
1011
  }
591
1012
  function sourceToRegex(source) {
592
1013
  const keys = [];
593
- const r = (0, import_path_to_regexp.pathToRegexp)(source, keys, {
1014
+ const r = pathToRegexp("632", source, keys, {
594
1015
  strict: true,
595
1016
  sensitive: true,
596
1017
  delimiter: "/"
@@ -663,9 +1084,9 @@ var require_superstatic = __commonJS({
663
1084
  const hashKeys = [];
664
1085
  const hostnameKeys = [];
665
1086
  try {
666
- (0, import_path_to_regexp.pathToRegexp)(pathname, pathnameKeys);
667
- (0, import_path_to_regexp.pathToRegexp)(hash || "", hashKeys);
668
- (0, import_path_to_regexp.pathToRegexp)(hostname || "", hostnameKeys);
1087
+ pathToRegexp("528", pathname, pathnameKeys);
1088
+ pathToRegexp("834", hash || "", hashKeys);
1089
+ pathToRegexp("712", hostname || "", hostnameKeys);
669
1090
  } catch (_) {
670
1091
  }
671
1092
  destParams = new Set(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.4.4",
3
+ "version": "4.4.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -30,8 +30,8 @@
30
30
  "@types/semver": "6.0.0",
31
31
  "@types/text-table": "0.2.1",
32
32
  "@types/webpack-sources": "3.2.0",
33
- "@vercel/build-utils": "9.1.0",
34
- "@vercel/routing-utils": "5.0.0",
33
+ "@vercel/build-utils": "9.1.1",
34
+ "@vercel/routing-utils": "5.0.2",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",
37
37
  "bytes": "3.1.2",