From c035fda5cfff1eea0a6d36a582b80833007e7bfe Mon Sep 17 00:00:00 2001 From: Snazzah Date: Mon, 6 Nov 2023 15:31:13 -0600 Subject: [PATCH] fix: fix external typings being exported --- package.json | 1 - pnpm-lock.yaml | 7 ------- src/constants.ts | 2 +- src/servers/bun.ts | 6 +++--- src/servers/cfworker.ts | 6 ++---- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e41fc892..8bfcde37 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "undici": "^5.27.0" }, "devDependencies": { - "@cloudflare/workers-types": "^4.20231025.0", "@microsoft/eslint-formatter-sarif": "^3.0.0", "@sinonjs/fake-timers": "6.0.1", "@types/aws-lambda": "^8.10.125 ", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa83435f..43ea58a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,9 +19,6 @@ dependencies: version: 5.27.1 devDependencies: - '@cloudflare/workers-types': - specifier: ^4.20231025.0 - version: 4.20231025.0 '@microsoft/eslint-formatter-sarif': specifier: ^3.0.0 version: 3.0.0 @@ -123,10 +120,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /@cloudflare/workers-types@4.20231025.0: - resolution: {integrity: sha512-TkcZkntUTOcvJ4vgmwpNfLTclpMbmbClZCe62B25/VTukmyv91joRa4eKzSjzCZUXTbFHNmVdOpmGaaJU2U3+A==} - dev: true - /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} diff --git a/src/constants.ts b/src/constants.ts index dff7dfc8..9e70cfff 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -318,7 +318,7 @@ export interface RawRequest { files: FileContent[] | undefined; latency: number; method: string; - response: Response; + response: any; url: URL; } diff --git a/src/servers/bun.ts b/src/servers/bun.ts index 650ac754..ea629ce1 100644 --- a/src/servers/bun.ts +++ b/src/servers/bun.ts @@ -24,14 +24,14 @@ export class BunServer extends Server { * creator.withServer(workerServer); * export default workerServer; */ - readonly fetch = async (request: Request) => { + readonly fetch = async (request: any) => { if (!this._handler) return new Response('Server has no handler.', { status: 503 }); if (request.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 }); const body = await request.text(); return new Promise((resolve, reject) => { this._handler!( { - headers: Object.fromEntries((request as any).headers.entries()), + headers: Object.fromEntries(request.headers.entries()), body: body ? JSON.parse(body) : body, request, response: null @@ -59,7 +59,7 @@ export class BunServer extends Server { ); } ).catch(reject); - }) as Promise; + }) as Promise; }; /** @private */ diff --git a/src/servers/cfworker.ts b/src/servers/cfworker.ts index f243a2eb..a2191919 100644 --- a/src/servers/cfworker.ts +++ b/src/servers/cfworker.ts @@ -1,6 +1,4 @@ import { Server, ServerRequestHandler } from '../server'; -// @ts-ignore -import type { Request as WorkerRequest, ExecutionContext } from '@cloudflare/workers-types'; /** * A server for Cloudflare Workers. @@ -20,7 +18,7 @@ export class CloudflareWorkerServer extends Server { * creator.withServer(workerServer); * export default workerServer; */ - readonly fetch = async (request: WorkerRequest, env: Record, ctx: ExecutionContext) => { + readonly fetch = async (request: any, env: any, ctx: any) => { if (!this._handler) return new Response('Server has no handler.', { status: 503 }); if (request.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 }); const body = await request.text(); @@ -57,7 +55,7 @@ export class CloudflareWorkerServer extends Server { } ).catch(reject) ); - }) as Promise; + }) as Promise; }; /** @private */