Socket
Socket
Sign inDemoInstall

itty-router

Package Overview
Dependencies
Maintainers
2
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itty-router - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

2

cjs/error.d.ts

@@ -5,3 +5,3 @@ interface ErrorLike extends Error {

}
export declare type ErrorBody = string | object;
export type ErrorBody = string | object;
export interface ErrorFormatter {

@@ -8,0 +8,0 @@ (statusCode?: number, body?: ErrorBody): Response;

@@ -1,9 +0,9 @@

export declare type GenericTraps = {
export type GenericTraps = {
[key: string]: any;
};
export declare type RequestLike = {
export type RequestLike = {
method: string;
url: string;
} & GenericTraps;
export declare type IRequestStrict = {
export type IRequestStrict = {
method: string;

@@ -20,18 +20,18 @@ url: string;

} & Request;
export declare type IRequest = IRequestStrict & GenericTraps;
export declare type RouterOptions = {
export type IRequest = IRequestStrict & GenericTraps;
export type RouterOptions = {
base?: string;
routes?: RouteEntry[];
};
export declare type RouteHandler<I = IRequest, A extends any[] = any[]> = {
export type RouteHandler<I = IRequest, A extends any[] = any[]> = {
(request: I, ...args: A): any;
};
export declare type RouteEntry = [string, RegExp, RouteHandler[], string];
export declare type Route = <RequestType = IRequest, Args extends any[] = any[], RT = RouterType>(path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RT;
export declare type UniversalRoute<RequestType = IRequest, Args extends any[] = any[]> = (path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RouterType<UniversalRoute<RequestType, Args>, Args>;
declare type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
export declare type CustomRoutes<R = Route> = {
export type RouteEntry = [string, RegExp, RouteHandler[], string];
export type Route = <RequestType = IRequest, Args extends any[] = any[], RT = RouterType>(path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RT;
export type UniversalRoute<RequestType = IRequest, Args extends any[] = any[]> = (path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RouterType<UniversalRoute<RequestType, Args>, Args>;
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
export type CustomRoutes<R = Route> = {
[key: string]: R;
};
export declare type RouterType<R = Route, Args extends any[] = any[]> = {
export type RouterType<R = Route, Args extends any[] = any[]> = {
__proto__: RouterType<R>;

@@ -38,0 +38,0 @@ routes: RouteEntry[];

@@ -1,2 +0,2 @@

declare type StatusErrorObject = {
type StatusErrorObject = {
error?: string;

@@ -3,0 +3,0 @@ [key: string]: any;

@@ -5,3 +5,3 @@ interface ErrorLike extends Error {

}
export declare type ErrorBody = string | object;
export type ErrorBody = string | object;
export interface ErrorFormatter {

@@ -8,0 +8,0 @@ (statusCode?: number, body?: ErrorBody): Response;

{
"name": "itty-router",
"version": "4.0.2",
"version": "4.0.3",
"description": "A tiny, zero-dependency router, designed to make beautiful APIs in any environment.",

@@ -48,34 +48,34 @@ "type": "module",

"devDependencies": {
"@cloudflare/workers-types": "^4.20221111.1",
"@cloudflare/workers-types": "^4.20230518.0",
"@rollup/plugin-multi-entry": "^6.0.0",
"@rollup/plugin-terser": "^0.2.1",
"@rollup/plugin-typescript": "^10.0.1",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@skypack/package-check": "^0.2.2",
"@types/node": "^20.2.1",
"@vitejs/plugin-vue": "^2.2.4",
"@vitest/coverage-c8": "^0.24.3",
"@whatwg-node/server": "^0.7.6",
"@types/node": "^20.2.5",
"@vitejs/plugin-vue": "^4.2.3",
"@vitest/coverage-c8": "^0.31.1",
"@whatwg-node/server": "^0.8.0",
"coveralls": "^3.1.1",
"eslint": "^8.11.0",
"eslint-plugin-jest": "^26.1.2",
"eslint": "^8.41.0",
"eslint-plugin-jest": "^27.2.1",
"fetch-mock": "^9.11.0",
"fs-extra": "^10.0.1",
"globby": "^13.1.3",
"gzip-size": "^6.0.0",
"fs-extra": "^11.1.1",
"globby": "^13.1.4",
"gzip-size": "^7.0.0",
"http": "^0.0.1-security",
"isomorphic-fetch": "^3.0.0",
"itty-router": "^4.0.0-next.50",
"jsdom": "^20.0.1",
"itty-router": "^4.0.2",
"jsdom": "^22.1.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^3.8.1",
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-multi-input": "^1.3.3",
"rollup-plugin-multi-input": "^1.4.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"vite": "^2.8.6",
"vitest": "^0.24.3",
"yarn": "^1.22.18",
"yarn-release": "^1.10.3"
"typescript": "^5.0.4",
"vite": "^4.3.9",
"vitest": "^0.31.1",
"yarn": "^1.22.19",
"yarn-release": "^1.10.5"
}
}

@@ -1,9 +0,9 @@

export declare type GenericTraps = {
export type GenericTraps = {
[key: string]: any;
};
export declare type RequestLike = {
export type RequestLike = {
method: string;
url: string;
} & GenericTraps;
export declare type IRequestStrict = {
export type IRequestStrict = {
method: string;

@@ -20,18 +20,18 @@ url: string;

} & Request;
export declare type IRequest = IRequestStrict & GenericTraps;
export declare type RouterOptions = {
export type IRequest = IRequestStrict & GenericTraps;
export type RouterOptions = {
base?: string;
routes?: RouteEntry[];
};
export declare type RouteHandler<I = IRequest, A extends any[] = any[]> = {
export type RouteHandler<I = IRequest, A extends any[] = any[]> = {
(request: I, ...args: A): any;
};
export declare type RouteEntry = [string, RegExp, RouteHandler[], string];
export declare type Route = <RequestType = IRequest, Args extends any[] = any[], RT = RouterType>(path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RT;
export declare type UniversalRoute<RequestType = IRequest, Args extends any[] = any[]> = (path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RouterType<UniversalRoute<RequestType, Args>, Args>;
declare type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
export declare type CustomRoutes<R = Route> = {
export type RouteEntry = [string, RegExp, RouteHandler[], string];
export type Route = <RequestType = IRequest, Args extends any[] = any[], RT = RouterType>(path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RT;
export type UniversalRoute<RequestType = IRequest, Args extends any[] = any[]> = (path: string, ...handlers: RouteHandler<RequestType, Args>[]) => RouterType<UniversalRoute<RequestType, Args>, Args>;
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
export type CustomRoutes<R = Route> = {
[key: string]: R;
};
export declare type RouterType<R = Route, Args extends any[] = any[]> = {
export type RouterType<R = Route, Args extends any[] = any[]> = {
__proto__: RouterType<R>;

@@ -38,0 +38,0 @@ routes: RouteEntry[];

@@ -1,2 +0,2 @@

declare type StatusErrorObject = {
type StatusErrorObject = {
error?: string;

@@ -3,0 +3,0 @@ [key: string]: any;

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