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

unrouted

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unrouted - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

74

dist/index.d.ts

@@ -1,71 +0,7 @@

import * as h3 from 'h3';
import { Handle, LazyHandle, Middleware, HTTPMethod } from 'h3';
export { appendHeader, assertMethod, defaultContentType, isMethod, send, sendRedirect, setCookie, useBase, useCookie, useCookies, useMethod, useQuery, useRawBody } from 'h3';
import { ServerResponse, IncomingMessage } from 'http';
import { Hookable } from 'hookable';
import * as _unrouted_core from '@unrouted/core';
import { PresetUnroutedOptions } from '@unrouted/preset-unrouted';
export * from '@unrouted/preset-unrouted';
declare type RouteMethod = (route: string, handle: Handle | LazyHandle | string | object) => UnroutedRouter;
declare function createUnrouted(config?: Partial<PresetUnroutedOptions>): Promise<_unrouted_core.UnroutedContext>;
declare type UnroutedPlugin = (router: UnroutedRouter) => void;
declare type Hook = `serve:before-route:${string | ''}` | 'serve:before-route';
interface UnroutedResolvedConfig {
debug: boolean;
cors: boolean;
handle404: boolean;
plugins: UnroutedPlugin[];
middleware: Middleware[] | Handle[];
prefix: string;
hooks: Record<Hook, () => Promise<void> | void>;
}
declare type DeepPartial<T> = T extends Function ? T : (T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T);
declare type UnroutedUserConfig = DeepPartial<UnroutedResolvedConfig>;
interface UnroutedRouter {
config: UnroutedResolvedConfig;
use: (method: HttpMethodInput, urlPattern: string, handle: Handle | Middleware, options?: Record<string, any>) => UnroutedRouter;
prefix: string;
handle: (req: AbstractIncomingMessage | any, res: ServerResponse | any) => Promise<unknown>;
hooks: Hookable;
serve: (path: string, dirname: string) => UnroutedRouter;
group: (prefix: string, cb: (router: UnroutedRouter) => void) => void;
match: (methods: HttpMethodInput, route: string, action: Function | string | object) => void;
any: RouteMethod;
get: RouteMethod;
post: RouteMethod;
put: RouteMethod;
del: RouteMethod;
head: RouteMethod;
options: RouteMethod;
redirect: (route: string, location: string, code?: 301 | 302 | 307 | 410 | 451) => void;
permanentRedirect: (route: string, location: string) => void;
}
declare type HttpMethod = HTTPMethod | '*';
declare type HttpMethodInput = HttpMethod | HttpMethod[];
interface AbstractIncomingMessage extends IncomingMessage {
protocol?: string;
originalUrl?: string;
}
interface UnroutedRouteDefinition {
path: string;
handle: Handle;
match?: (req: IncomingMessage) => boolean;
options?: Record<string, any>;
}
declare const useParams: <T>() => T;
declare const useBody: <T>() => T;
declare function createUnrouted(config?: {
debug?: boolean | undefined;
cors?: boolean | undefined;
handle404?: boolean | undefined;
plugins?: (UnroutedPlugin | undefined)[] | undefined;
middleware?: (h3.Middleware | undefined)[] | (Handle<any> | undefined)[] | undefined;
prefix?: string | undefined;
hooks?: {
[x: `serve:before-route:${string}`]: (() => void | Promise<void>) | undefined;
"serve:before-route"?: (() => void | Promise<void>) | undefined;
} | undefined;
}): UnroutedRouter;
export { AbstractIncomingMessage, DeepPartial, Hook, HttpMethod, HttpMethodInput, UnroutedPlugin, UnroutedResolvedConfig, UnroutedRouteDefinition, UnroutedRouter, UnroutedUserConfig, createUnrouted, useBody, useParams };
export { createUnrouted };

88

package.json
{
"name": "unrouted",
"version": "0.1.2",
"description": "Expressive Universal Router",
"repository": "harlan-zw/unrouted",
"version": "0.2.0",
"homepage": "https://github.com/harlan-zw/unrouted#readme",
"bugs": {
"url": "https://github.com/harlan-zw/unrouted/issues"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/harlan-zw/unlighthouse.git",
"directory": "packages/unrouted"
},
"funding": "https://github.com/sponsors/harlan-zw",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"sideEffects": false,
"type": "module",
"files": [
"dist",
"*.d.ts"
],
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"./*": "./*"
},

@@ -17,58 +32,11 @@ "main": "dist/index.cjs",

"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "siroc build",
"dev": "jiti test/playground",
"lint": "eslint --fix --ext ts .",
"profile": "0x -o -D .profile -P 'autocannon -c 100 -p 10 -d 40 http://localhost:$PORT' ./hello.js",
"release": "yarn test && yarn build && standard-version && npm publish && git push --follow-tags",
"test": "jest"
},
"dependencies": {
"defu": "^5.0.0",
"h3": "^0.3.8",
"hookable": "^5.0.0",
"radix3": "^0.1.0",
"sirv": "^1.0.19",
"ufo": "^0.7.9",
"unctx": "^1.0.2"
"@unrouted/core": "0.2.0",
"@unrouted/preset-unrouted": "0.2.0",
"h3": "^0.3.9"
},
"devDependencies": {
"0x": "latest",
"@antfu/eslint-config": "^0.12.1",
"@babel/preset-env": "^7.16.4",
"@types/benchmark": "^2.1.1",
"@types/cookie": "latest",
"@types/cors": "^2.8.12",
"@types/express": "latest",
"@types/jest": "27.0.3",
"@types/koa": "^2.13.4",
"@types/node": "16.11.11",
"@types/supertest": "latest",
"autocannon": "7.5.0",
"babel-jest": "^27.4.2",
"benchmark": "^2.1.4",
"connect": "latest",
"cookie": "latest",
"cors": "^2.8.5",
"destr": "latest",
"eslint": "latest",
"eslint-plugin-jest": "^25.3.0",
"express": "latest",
"get-port": "latest",
"jest": "27.4.3",
"jiti": "1.12.9",
"koa": "^2.13.4",
"listhen": "0.2.5",
"release-it": "^14.11.8",
"siroc": "latest",
"standard-version": "9.3.2",
"supertest": "latest",
"ts-jest": "27.1.0",
"typescript": "4.5.2",
"unbuild": "^0.6.3",
"vite": "^2.6.14"
"scripts": {
"build": "unbuild",
"stub": "unbuild --stub"
}
}
}

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