Skip to content

Commit

Permalink
chore: fix type issues
Browse files Browse the repository at this point in the history
bun-types messes up with global types such as Buffer and Request
  • Loading branch information
pi0 committed Sep 20, 2024
1 parent 710765e commit 2615d39
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 41 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"@scalar/api-reference": "^1.25.13",
"@types/archiver": "^6.0.2",
"@types/aws-lambda": "^8.10.145",
"@types/bun": "^1.1.9",
"@types/estree": "^1.0.6",
"@types/etag": "^1.8.3",
"@types/fs-extra": "^11.0.4",
Expand Down
37 changes: 0 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/presets/_nitro/runtime/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { isPublicAssetURL } from "#nitro-internal-virtual/public-assets";

const nitroApp = useNitroApp();

// @ts-expect-error
addEventListener("fetch", (event: FetchEvent) => {
const url = new URL(event.request.url);
if (isPublicAssetURL(url.pathname) || url.pathname.includes("/_server/")) {
Expand Down
4 changes: 2 additions & 2 deletions src/presets/bun/runtime/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "#nitro-internal-pollyfills";
import { useNitroApp } from "nitropack/runtime";
import { startScheduleRunner } from "nitropack/runtime/internal";

import type {} from "bun";
import wsAdapter from "crossws/adapters/bun";

const nitroApp = useNitroApp();
Expand All @@ -11,10 +10,11 @@ const ws = import.meta._websocket
? wsAdapter(nitroApp.h3App.websocket)
: undefined;

// @ts-expect-error
const server = Bun.serve({
port: process.env.NITRO_PORT || process.env.PORT || 3000,
websocket: import.meta._websocket ? ws!.websocket : (undefined as any),
async fetch(req, server) {
async fetch(req: Request, server: any) {
if (import.meta._websocket && (await ws!.handleUpgrade(req, server))) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/presets/netlify/legacy/runtime/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const handler: Handler = async function handler(event, context) {

if (routeRules.isr) {
const builder = await import("@netlify/functions").then(
(r) => r.builder || r.default.builder
(r) => r.builder || (r as any).default.builder
);
const ttl = typeof routeRules.isr === "number" ? routeRules.isr : false;
const builderHandler = ttl
Expand Down

0 comments on commit 2615d39

Please sign in to comment.