diff options
author | 2022-04-07 22:39:46 -0700 | |
---|---|---|
committer | 2022-04-07 22:39:46 -0700 | |
commit | 14def643f768cc3e68c1a8362c8a707c3685bfb4 (patch) | |
tree | e24c49254841f914dd56ebbcfd821646f7cb5487 | |
parent | a3398650b53b0c06d039c2f75e5d3febff79b81a (diff) | |
download | bun-14def643f768cc3e68c1a8362c8a707c3685bfb4.tar.gz bun-14def643f768cc3e68c1a8362c8a707c3685bfb4.tar.zst bun-14def643f768cc3e68c1a8362c8a707c3685bfb4.zip |
Outdated
-rw-r--r-- | types/globals.d.ts | 23 | ||||
-rw-r--r-- | types/index.d.ts | 4 | ||||
-rw-r--r-- | types/modules.d.ts | 47 |
3 files changed, 0 insertions, 74 deletions
diff --git a/types/globals.d.ts b/types/globals.d.ts deleted file mode 100644 index 4fb460128..000000000 --- a/types/globals.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// bun.js v - -declare global { - function addEventListener( - name: "fetch", - callback: (event: FetchEvent) => void - ): void; -} - -declare global { - export interface FetchEvent { - /** HTTP client metadata. This is not implemented yet, do not use. */ - readonly client: undefined; - - /** HTTP request */ - readonly request: InstanceType<Request>; - - /** Render the response in the active HTTP request */ - respondWith(response: Response): void; - } -} - -export {}; diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 83d1d6555..000000000 --- a/types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// <reference no-default-lib="true" /> -/// <reference lib="esnext" /> -/// <reference types="bun.js/types/globals" /> -/// <reference types="bun.js/types/modules" /> diff --git a/types/modules.d.ts b/types/modules.d.ts deleted file mode 100644 index 104b89482..000000000 --- a/types/modules.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -// bun.js v - -/** Filesystem Router supporting dynamic routes, exact routes, catch-all routes, and optional catch-all routes. Implemented in native code and only available with bun.js. */ -declare module "bun.js/router" { - /** Match a {@link https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent FetchEvent} to a `Route` from the local filesystem. Returns `null` if there is no match. */ - function match(event: FetchEvent): Route | null; - - /** Match a `pathname` to a `Route` from the local filesystem. Returns `null` if there is no match. */ - function match(pathname: string): Route | null; - - /** Match a {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Request} to a `Route` from the local filesystem. Returns `null` if there is no match. */ - function match(request: Request): Route | null; - /** Route matched from the filesystem. */ - export interface Route { - /** URL path as appears in a web browser's address bar */ - readonly pathname: string; - - /** Project-relative filesystem path to the route file. */ - readonly filepath: string; - - readonly kind: "exact" | "dynamic" | "catch-all" | "optional-catch-all"; - - /** - * Route name - * @example - * `"blog/posts/[id]"` - * `"blog/posts/[id]/[[...slug]]"` - * `"blog"` - */ - readonly name: string; - - /** - * Route parameters as a key-value object - * - * @example - * ```js - * console.assert(router.query.id === "123"); - * console.assert(router.pathname === "/blog/posts/123"); - * console.assert(router.route === "blog/posts/[id]"); - * ``` - */ - readonly query: Record<string, string | string[]>; - - /** Synchronously load & evaluate the file corresponding to the route. Returns the exports of the route. This is similar to `await import(route.filepath)`, except it's synchronous. It is recommended to use this function instead of `import`. */ - import(): Object; - } -} |