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

@serwist/routing

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serwist/routing - npm Package Compare versions

Comparing version 8.4.0 to 8.4.1

2

dist/index.d.ts
import type { NavigationRouteMatchOptions } from "./NavigationRoute.js";
import { NavigationRoute } from "./NavigationRoute.js";
import { RegExpRoute } from "./RegExpRoute.js";
import { registerRoute } from "./registerRoute.js";
import { Route } from "./Route.js";
import { Router } from "./Router.js";
import { registerRoute } from "./registerRoute.js";
import { setCatchHandler } from "./setCatchHandler.js";

@@ -8,0 +8,0 @@ import { setDefaultHandler } from "./setDefaultHandler.js";

@@ -49,15 +49,14 @@ import { assert, logger, getFriendlyURL, SerwistError } from '@serwist/core/internal';

return handler;
} else {
if (process.env.NODE_ENV !== "production") {
assert.isType(handler, "function", {
moduleName: "@serwist/routing",
className: "Route",
funcName: "constructor",
paramName: "handler"
});
}
return {
handle: handler
};
}
if (process.env.NODE_ENV !== "production") {
assert.isType(handler, "function", {
moduleName: "@serwist/routing",
className: "Route",
funcName: "constructor",
paramName: "handler"
});
}
return {
handle: handler
};
};

@@ -177,3 +176,3 @@

if (process.env.NODE_ENV !== "production") {
logger.log(`The navigation route ${pathnameAndSearch} is not ` + `being used, since the URL matches this denylist pattern: ` + `${regExp.toString()}`);
logger.log(`The navigation route ${pathnameAndSearch} is not being used, since the URL matches this denylist pattern: ${regExp.toString()}`);
}

@@ -185,3 +184,3 @@ return false;

if (process.env.NODE_ENV !== "production") {
logger.debug(`The navigation route ${pathnameAndSearch} ` + `is being used.`);
logger.debug(`The navigation route ${pathnameAndSearch} is being used.`);
}

@@ -191,3 +190,3 @@ return true;

if (process.env.NODE_ENV !== "production") {
logger.log(`The navigation route ${pathnameAndSearch} is not ` + `being used, since the URL being navigated to doesn't ` + `match the allowlist.`);
logger.log(`The navigation route ${pathnameAndSearch} is not being used, since the URL being navigated to doesn't match the allowlist.`);
}

@@ -235,3 +234,3 @@ return false;

if (process.env.NODE_ENV !== "production") {
logger.debug(`The regular expression '${regExp.toString()}' only partially matched ` + `against the cross-origin URL '${url.toString()}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);
logger.debug(`The regular expression '${regExp.toString()}' only partially matched against the cross-origin URL '${url.toString()}'. RegExpRoute's will only handle cross-origin requests if they match the entire URL.`);
}

@@ -323,3 +322,3 @@ return;

if (process.env.NODE_ENV !== "production") {
logger.debug(`Caching URLs from the window`, payload.urlsToCache);
logger.debug("Caching URLs from the window", payload.urlsToCache);
}

@@ -343,3 +342,3 @@ const requestPromises = Promise.all(payload.urlsToCache.map((entry)=>{

// If a MessageChannel was used, reply to the message on success.
if (event.ports && event.ports[0]) {
if (event.ports?.[0]) {
void requestPromises.then(()=>event.ports[0].postMessage(true));

@@ -381,3 +380,3 @@ }

});
let handler = route && route.handler;
let handler = route?.handler;
const debugMessages = [];

@@ -387,3 +386,3 @@ if (process.env.NODE_ENV !== "production") {

debugMessages.push([
`Found a route to handle this request:`,
"Found a route to handle this request:",
route

@@ -404,3 +403,3 @@ ]);

if (process.env.NODE_ENV !== "production") {
debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler for ${method}.`);
debugMessages.push(`Failed to find a matching route. Falling back to the default handler for ${method}.`);
}

@@ -421,3 +420,3 @@ handler = this._defaultHandlerMap.get(method);

logger.groupCollapsed(`Router is responding to: ${getFriendlyURL(url)}`);
debugMessages.forEach((msg)=>{
for (const msg of debugMessages){
if (Array.isArray(msg)) {

@@ -428,3 +427,3 @@ logger.log(...msg);

}
});
}
logger.groupEnd();

@@ -446,3 +445,3 @@ }

// Get route's catch handler, if it exists
const catchHandler = route && route.catchHandler;
const catchHandler = route?.catchHandler;
if (responsePromise instanceof Promise && (this._catchHandler || catchHandler)) {

@@ -455,4 +454,4 @@ responsePromise = responsePromise.catch(async (err)=>{

// and may not make sense without the URL
logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL(url)}. Falling back to route's Catch Handler.`);
logger.error(`Error thrown by:`, route);
logger.groupCollapsed(`Error thrown when responding to: ${getFriendlyURL(url)}. Falling back to route's Catch Handler.`);
logger.error("Error thrown by:", route);
logger.error(err);

@@ -478,4 +477,4 @@ logger.groupEnd();

// and may not make sense without the URL
logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL(url)}. Falling back to global Catch Handler.`);
logger.error(`Error thrown by:`, route);
logger.groupCollapsed(`Error thrown when responding to: ${getFriendlyURL(url)}. Falling back to global Catch Handler.`);
logger.error("Error thrown by:", route);
logger.error(err);

@@ -520,3 +519,3 @@ logger.groupEnd();

if (matchResult instanceof Promise) {
logger.warn(`While routing ${getFriendlyURL(url)}, an async ` + `matchCallback function was used. Please convert the ` + `following route to use a synchronous matchCallback function:`, route);
logger.warn(`While routing ${getFriendlyURL(url)}, an async matchCallback function was used. Please convert the following route to use a synchronous matchCallback function:`, route);
}

@@ -681,3 +680,3 @@ }

if (new RegExp(`${wildcards}`).exec(valueToCheck)) {
logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);
logger.debug(`The '$capture' parameter contains an Express-style wildcard character (${wildcards}). Strings are now always interpreted as exact matches; use a RegExp for partial or wildcard matches.`);
}

@@ -688,3 +687,3 @@ }

if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {
logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url.toString()}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);
logger.debug(`${capture} only partially matches the cross-origin URL ${url.toString()}. This route will only handle cross-origin requests if they match the entire URL.`);
}

@@ -691,0 +690,0 @@ }

{
"name": "@serwist/routing",
"version": "8.4.0",
"version": "8.4.1",
"type": "module",

@@ -40,7 +40,7 @@ "description": "A service worker helper library to route request URLs to handlers.",

"dependencies": {
"@serwist/core": "8.4.0"
"@serwist/core": "8.4.1"
},
"devDependencies": {
"rollup": "4.9.1",
"@serwist/constants": "8.4.0"
"@serwist/constants": "8.4.1"
},

@@ -50,5 +50,5 @@ "scripts": {

"dev": "rollup --config rollup.config.js --watch",
"lint": "eslint src --ext ts,tsx,js,jsx,cjs,mjs",
"lint": "biome lint ./src",
"typecheck": "tsc"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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