@vercel/routing-utils
Advanced tools
Comparing version 1.11.3-canary.0 to 1.11.3-canary.1
@@ -125,3 +125,3 @@ "use strict"; | ||
} | ||
function checkPatternSyntax(type, index, { source, destination, }) { | ||
function checkPatternSyntax(type, index, { source, destination, has, }) { | ||
let sourceSegments = new Set(); | ||
@@ -153,6 +153,7 @@ const destinationSegments = new Set(); | ||
} | ||
const hasSegments = superstatic_1.collectHasSegments(has); | ||
for (const segment of destinationSegments) { | ||
if (!sourceSegments.has(segment)) { | ||
if (!sourceSegments.has(segment) && !hasSegments.includes(segment)) { | ||
return { | ||
message: `${type} at index ${index} has segment ":${segment}" in \`destination\` property but not in \`source\` property.`, | ||
message: `${type} at index ${index} has segment ":${segment}" in \`destination\` property but not in \`source\` or \`has\` property.`, | ||
link: 'https://vercel.link/invalid-route-destination-segment', | ||
@@ -159,0 +160,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { Route, Redirect, Rewrite, Header } from './types'; | ||
import { Route, Redirect, Rewrite, HasField, Header } from './types'; | ||
export declare function getCleanUrls(filePaths: string[]): { | ||
@@ -15,1 +15,2 @@ html: string; | ||
}; | ||
export declare function collectHasSegments(has?: HasField): string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sourceToRegex = exports.convertTrailingSlash = exports.convertHeaders = exports.convertRewrites = exports.convertRedirects = exports.convertCleanUrls = exports.getCleanUrls = void 0; | ||
exports.collectHasSegments = exports.sourceToRegex = exports.convertTrailingSlash = exports.convertHeaders = exports.convertRewrites = exports.convertRedirects = exports.convertCleanUrls = exports.getCleanUrls = void 0; | ||
/** | ||
@@ -194,2 +194,3 @@ * This converts Superstatic configuration to vercel.json Routes | ||
} | ||
exports.collectHasSegments = collectHasSegments; | ||
function replaceSegments(segments, hasItemSegments, destination, isRedirect) { | ||
@@ -196,0 +197,0 @@ const parsedDestination = url_1.parse(destination, true); |
{ | ||
"name": "@vercel/routing-utils", | ||
"version": "1.11.3-canary.0", | ||
"version": "1.11.3-canary.1", | ||
"description": "Vercel routing utilities", | ||
@@ -33,3 +33,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "cf827a8b919ff6eed383863af39c26d51b2aa16e" | ||
"gitHead": "8f7c2f638539e25385f83beb056305c42294289d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76053
1609