Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vercel/routing-utils

Package Overview
Dependencies
Maintainers
8
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/routing-utils - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

4

dist/append.js

@@ -13,3 +13,3 @@ "use strict";

routes.forEach((r, i) => {
if (index_1.isHandler(r)) {
if ((0, index_1.isHandler)(r)) {
if (r.handle === phase) {

@@ -29,3 +29,3 @@ isInPhase = true;

// If the phase is null, we want to insert the routes at the beginning
const lastPhase = routes.findIndex(r => index_1.isHandler(r) && r.handle);
const lastPhase = routes.findIndex(r => (0, index_1.isHandler)(r) && r.handle);
if (lastPhase === -1) {

@@ -32,0 +32,0 @@ routes.push(...newRoutes);

@@ -8,3 +8,3 @@ import { GetRoutesProps, NormalizedRoutes, Route, RouteWithHandle } from './types';

declare const VALID_HANDLE_VALUES: readonly ["filesystem", "hit", "miss", "rewrite", "error", "resource"];
export declare type HandleValue = typeof VALID_HANDLE_VALUES[number];
export type HandleValue = typeof VALID_HANDLE_VALUES[number];
export declare function isHandler(route: Route): route is RouteWithHandle;

@@ -11,0 +11,0 @@ export declare function isValidHandleValue(handle: string): handle is HandleValue;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -129,3 +133,3 @@ if (k2 === undefined) k2 = k;

try {
sourceSegments = new Set(superstatic_1.sourceToRegex(source).segments);
sourceSegments = new Set((0, superstatic_1.sourceToRegex)(source).segments);
}

@@ -140,8 +144,8 @@ catch (err) {

try {
const { hostname, pathname, query } = url_1.parse(destination, true);
superstatic_1.sourceToRegex(hostname || '').segments.forEach(name => destinationSegments.add(name));
superstatic_1.sourceToRegex(pathname || '').segments.forEach(name => destinationSegments.add(name));
const { hostname, pathname, query } = (0, url_1.parse)(destination, true);
(0, superstatic_1.sourceToRegex)(hostname || '').segments.forEach(name => destinationSegments.add(name));
(0, superstatic_1.sourceToRegex)(pathname || '').segments.forEach(name => destinationSegments.add(name));
for (const strOrArray of Object.values(query)) {
const value = Array.isArray(strOrArray) ? strOrArray[0] : strOrArray;
superstatic_1.sourceToRegex(value || '').segments.forEach(name => destinationSegments.add(name));
(0, superstatic_1.sourceToRegex)(value || '').segments.forEach(name => destinationSegments.add(name));
}

@@ -154,3 +158,3 @@ }

}
const hasSegments = superstatic_1.collectHasSegments(has);
const hasSegments = (0, superstatic_1.collectHasSegments)(has);
for (const segment of destinationSegments) {

@@ -206,3 +210,3 @@ if (!sourceSegments.has(segment) && !hasSegments.includes(segment)) {

if (typeof cleanUrls !== 'undefined') {
const normalized = normalizeRoutes(superstatic_1.convertCleanUrls(cleanUrls, trailingSlash));
const normalized = normalizeRoutes((0, superstatic_1.convertCleanUrls)(cleanUrls, trailingSlash));
if (normalized.error) {

@@ -216,3 +220,3 @@ normalized.error.code = 'invalid_clean_urls';

if (typeof trailingSlash !== 'undefined') {
const normalized = normalizeRoutes(superstatic_1.convertTrailingSlash(trailingSlash));
const normalized = normalizeRoutes((0, superstatic_1.convertTrailingSlash)(trailingSlash));
if (normalized.error) {

@@ -252,3 +256,3 @@ normalized.error.code = 'invalid_trailing_slash';

}
const normalized = normalizeRoutes(superstatic_1.convertRedirects(redirects));
const normalized = normalizeRoutes((0, superstatic_1.convertRedirects)(redirects));
if (normalized.error) {

@@ -281,3 +285,3 @@ normalized.error.code = code;

}
const normalized = normalizeRoutes(superstatic_1.convertHeaders(headers));
const normalized = normalizeRoutes((0, superstatic_1.convertHeaders)(headers));
if (normalized.error) {

@@ -310,3 +314,3 @@ normalized.error.code = code;

}
const normalized = normalizeRoutes(superstatic_1.convertRewrites(rewrites));
const normalized = normalizeRoutes((0, superstatic_1.convertRewrites)(rewrites));
if (normalized.error) {

@@ -313,0 +317,0 @@ normalized.error.code = code;

@@ -22,3 +22,3 @@ "use strict";

for (const route of routes) {
if (index_1.isHandler(route)) {
if ((0, index_1.isHandler)(route)) {
// Should never happen, only here to make TS happy

@@ -43,3 +43,3 @@ throw new Error(`Unexpected route found in getCheckAndContinue(): ${JSON.stringify(route)}`);

(userRoutes || []).forEach(route => {
if (index_1.isHandler(route)) {
if ((0, index_1.isHandler)(route)) {
userPrevHandle = route.handle;

@@ -66,3 +66,3 @@ }

br[use].forEach(route => {
if (index_1.isHandler(route)) {
if ((0, index_1.isHandler)(route)) {
builderPrevHandle = route.handle;

@@ -69,0 +69,0 @@ }

@@ -170,3 +170,3 @@ "use strict";

const keys = [];
const r = path_to_regexp_1.pathToRegexp(source, keys, {
const r = (0, path_to_regexp_1.pathToRegexp)(source, keys, {
strict: true,

@@ -237,3 +237,3 @@ sensitive: true,

});
const parsedDestination = url_1.parse(escapedDestination, true);
const parsedDestination = (0, url_1.parse)(escapedDestination, true);
delete parsedDestination.href;

@@ -253,5 +253,5 @@ delete parsedDestination.path;

try {
path_to_regexp_1.pathToRegexp(pathname, pathnameKeys);
path_to_regexp_1.pathToRegexp(hash || '', hashKeys);
path_to_regexp_1.pathToRegexp(hostname || '', hostnameKeys);
(0, path_to_regexp_1.pathToRegexp)(pathname, pathnameKeys);
(0, path_to_regexp_1.pathToRegexp)(hash || '', hashKeys);
(0, path_to_regexp_1.pathToRegexp)(hostname || '', hostnameKeys);
}

@@ -293,3 +293,3 @@ catch (_) {

}
destination = url_1.format({
destination = (0, url_1.format)({
...rest,

@@ -313,3 +313,3 @@ hostname,

// fails
return path_to_regexp_1.compile(value, { validate: false })(indexes);
return (0, path_to_regexp_1.compile)(value, { validate: false })(indexes);
}

@@ -337,3 +337,3 @@ catch (e) {

// correctly
return path_to_regexp_1.compile(`/${value}`, { validate: false })(indexes).slice(1);
return (0, path_to_regexp_1.compile)(`/${value}`, { validate: false })(indexes).slice(1);
}

@@ -340,0 +340,0 @@ function toSegmentDest(index) {

import { HandleValue } from './index';
export declare type RouteApiError = {
export type RouteApiError = {
name: string;

@@ -10,3 +10,3 @@ code: string;

};
export declare type HasField = Array<{
export type HasField = Array<{
type: 'host';

@@ -19,3 +19,3 @@ value: string;

}>;
export declare type RouteWithSrc = {
export type RouteWithSrc = {
src: string;

@@ -53,3 +53,3 @@ dest?: string;

};
export declare type RouteWithHandle = {
export type RouteWithHandle = {
handle: HandleValue;

@@ -60,4 +60,4 @@ src?: string;

};
export declare type Route = RouteWithSrc | RouteWithHandle;
export declare type NormalizedRoutes = {
export type Route = RouteWithSrc | RouteWithHandle;
export type NormalizedRoutes = {
routes: Route[] | null;

@@ -64,0 +64,0 @@ error: RouteApiError | null;

{
"name": "@vercel/routing-utils",
"version": "2.2.0",
"version": "2.2.1",
"description": "Vercel routing utilities",

@@ -28,3 +28,3 @@ "main": "./dist/index.js",

"ajv": "^6.0.0",
"typescript": "4.3.4"
"typescript": "4.9.5"
},

@@ -34,3 +34,3 @@ "optionalDependencies": {

},
"gitHead": "925c8ba18ceec80174d9440cd2cad0e725ed4f56"
"gitHead": "2de365f9cfea3ce283d2bf855507c71209f1e3d8"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc