@unrouted/core
Advanced tools
Comparing version
import * as h3 from 'h3'; | ||
import { EventHandler, H3Event, App, Router, RouterMethod, CompatibilityEventHandler, HTTPMethod, H3Error } from 'h3'; | ||
import { EventHandler, H3Event, Router, RouterMethod, CompatibilityEventHandler, HTTPMethod, H3Error } from 'h3'; | ||
import { Hookable } from 'hookable'; | ||
import { Consola } from 'consola'; | ||
import { ConsolaInstance } from 'consola'; | ||
import { Import } from 'unimport'; | ||
@@ -43,3 +43,3 @@ import { QueryObject } from 'ufo'; | ||
interface ResolvedConfig { | ||
app?: App; | ||
app?: any; | ||
prefix: string; | ||
@@ -78,3 +78,3 @@ name: string; | ||
*/ | ||
app: App; | ||
app: any; | ||
/** | ||
@@ -88,3 +88,3 @@ * A flat copy of the normalised routes being used. | ||
*/ | ||
logger: Consola; | ||
logger: ConsolaInstance; | ||
/** | ||
@@ -152,15 +152,3 @@ * The hookable instance, allows hooking into core functionality. | ||
declare function defineConfig(config: ConfigPartial): { | ||
app?: { | ||
stack?: ({ | ||
route?: string | undefined; | ||
match?: h3.Matcher | undefined; | ||
handler?: h3.EventHandler<any> | undefined; | ||
} | undefined)[] | undefined; | ||
handler?: h3.EventHandler<any> | undefined; | ||
options?: { | ||
debug?: boolean | undefined; | ||
onError?: ((error: Error, event: h3.H3Event) => any) | undefined; | ||
} | undefined; | ||
use?: h3.AppUse | undefined; | ||
} | undefined; | ||
app?: any; | ||
prefix?: string | undefined; | ||
@@ -183,3 +171,3 @@ name?: string | undefined; | ||
} | undefined)[] | undefined; | ||
middleware?: (h3.EventHandler<any> | undefined)[] | undefined; | ||
middleware?: (h3.EventHandler<h3.EventHandlerRequest, any> | undefined)[] | undefined; | ||
hooks?: { | ||
@@ -189,5 +177,5 @@ 'setup:after'?: ((ctx: UnroutedContext) => HookResult<void>) | undefined; | ||
'setup:routes'?: ((routes: Route[]) => HookResult<void>) | undefined; | ||
'response:before'?: ((handler: h3.EventHandler<any>, payload: any) => HookResult<void>) | undefined; | ||
'request:handle:before'?: ((e: h3.H3Event) => HookResult<void>) | undefined; | ||
'request:error:404'?: ((e: h3.H3Event) => HookResult<void>) | undefined; | ||
'response:before'?: ((handler: h3.EventHandler<h3.EventHandlerRequest, any>, payload: any) => HookResult<void>) | undefined; | ||
'request:handle:before'?: ((e: h3.H3Event<h3.EventHandlerRequest>) => HookResult<void>) | undefined; | ||
'request:error:404'?: ((e: h3.H3Event<h3.EventHandlerRequest>) => HookResult<void>) | undefined; | ||
} | undefined; | ||
@@ -205,4 +193,4 @@ }; | ||
declare const resolveStackPrefix: () => string; | ||
declare const resolveStackRouteMeta: () => {}; | ||
declare function resolveStackPrefix(): string; | ||
declare function resolveStackRouteMeta(): {}; | ||
declare function unroutedEventHandler(handle: any): EventHandler; | ||
@@ -221,4 +209,4 @@ /** | ||
declare const redirect: (route: string, location: string, code?: 301 | 302 | 307 | 410 | 451) => void; | ||
declare const permanentRedirect: (route: string, location: string) => void; | ||
declare function redirect(route: string, location: string, code?: 301 | 302 | 307 | 410 | 451): void; | ||
declare function permanentRedirect(route: string, location: string): void; | ||
@@ -236,5 +224,5 @@ type MatchFn = (methods: RouterMethod, route: string, handle: UnroutedEventHandler) => void; | ||
declare const group: (attributes: GroupAttributes, cb: (() => void)) => void; | ||
declare const middleware: (middleware: EventHandler[], cb: (() => void)) => void; | ||
declare const prefix: (prefix: string, cb: (() => void)) => void; | ||
declare function group(attributes: GroupAttributes, cb: (() => void)): void; | ||
declare function middleware(middleware: EventHandler[], cb: (() => void)): void; | ||
declare function prefix(prefix: string, cb: (() => void)): void; | ||
@@ -244,3 +232,3 @@ type Nullable<T> = { | ||
}; | ||
declare function readRawBody(encoding?: false | 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex'): Promise<string | Buffer | undefined>; | ||
declare function readRawBody(encoding?: false | 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex'): Promise<Buffer | undefined> | Promise<string | undefined>; | ||
declare function useQuery<T extends QueryObject>(): Nullable<T>; | ||
@@ -262,2 +250,2 @@ declare function useMethod(defaultMethod?: HTTPMethod): HTTPMethod; | ||
export { ConfigPartial, DeepPartial, DeleteRoutes, GetRoutes, GroupAttributes, HookResult, HttpMethodInput, NormaliseRouteFn, Nullable$1 as Nullable, OptionsRoutes, PatchRoutes, PostRoutes, PutRoutes, RegisterRouteFn, ResolvedConfig, ResolvedPlugin, Route, RouteMeta, RouteSchema, SimpleOptions, UnroutedContext, UnroutedEventHandler, UnroutedHookable, UnroutedHooks, UnroutedMiddleware, UnroutedPlugin, UnroutedPreset, any, appendHeader, assertMethod, createUnrouted, defineConfig, defineUnroutedMiddleware, defineUnroutedPlugin, defineUnroutedPreset, del, deleteCookie, errorNotFound, errorUnprocessableEntity, get, getHeader, group, head, isMethod, match, middleware, normaliseRoute, options, permanentRedirect, post, prefix, put, readRawBody, redirect, registerRoute, resolveConfig, resolveStackPrefix, resolveStackRouteMeta, sendError, sendRedirect, setCookie, setStatusCode, unroutedEventHandler, useBody, useCookies, useEvent, useMethod, useParams, useQuery, useUnrouted }; | ||
export { type ConfigPartial, type DeepPartial, type DeleteRoutes, type GetRoutes, type GroupAttributes, type HookResult, type HttpMethodInput, type NormaliseRouteFn, type Nullable$1 as Nullable, type OptionsRoutes, type PatchRoutes, type PostRoutes, type PutRoutes, type RegisterRouteFn, type ResolvedConfig, type ResolvedPlugin, type Route, type RouteMeta, type RouteSchema, type SimpleOptions, type UnroutedContext, type UnroutedEventHandler, type UnroutedHookable, type UnroutedHooks, type UnroutedMiddleware, type UnroutedPlugin, type UnroutedPreset, any, appendHeader, assertMethod, createUnrouted, defineConfig, defineUnroutedMiddleware, defineUnroutedPlugin, defineUnroutedPreset, del, deleteCookie, errorNotFound, errorUnprocessableEntity, get, getHeader, group, head, isMethod, match, middleware, normaliseRoute, options, permanentRedirect, post, prefix, put, readRawBody, redirect, registerRoute, resolveConfig, resolveStackPrefix, resolveStackRouteMeta, sendError, sendRedirect, setCookie, setStatusCode, unroutedEventHandler, useBody, useCookies, useEvent, useMethod, useParams, useQuery, useUnrouted }; |
{ | ||
"name": "@unrouted/core", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"author": "Harlan Wilton <harlan@harlanzw.com>", | ||
@@ -20,4 +20,4 @@ "license": "MIT", | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.mjs" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
@@ -29,16 +29,16 @@ }, | ||
"files": [ | ||
"dist", | ||
"*.d.ts" | ||
"*.d.ts", | ||
"dist" | ||
], | ||
"dependencies": { | ||
"consola": "^2.15.3", | ||
"defu": "^6.1.1", | ||
"h3": "^1.0.1", | ||
"hookable": "^5.4.2", | ||
"mlly": "^1.0.0", | ||
"ohash": "^1.0.0", | ||
"pathe": "^1.0.0", | ||
"radix3": "^1.0.0", | ||
"ufo": "^1.0.0", | ||
"unctx": "^2.1.0" | ||
"consola": "^3.2.3", | ||
"defu": "^6.1.4", | ||
"h3": "^1.11.1", | ||
"hookable": "^5.5.3", | ||
"mlly": "^1.6.1", | ||
"ohash": "^1.1.3", | ||
"pathe": "^1.1.2", | ||
"radix3": "^1.1.0", | ||
"ufo": "^1.4.0", | ||
"unctx": "^2.3.1" | ||
}, | ||
@@ -45,0 +45,0 @@ "scripts": { |
@@ -11,3 +11,2 @@ # @unrouted/core | ||
const unrouted = await createUnrouted({ /* user options */ }, { /* provider options */ }) | ||
``` | ||
@@ -14,0 +13,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
54050
59.54%7
40%884
-1.12%16
-5.88%1
Infinity%+ Added
- Removed
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated