Initial commit

This commit is contained in:
Brian McGonagill 2026-03-18 09:02:21 -05:00
commit b3a51a4115
10336 changed files with 2381973 additions and 0 deletions

View file

@ -0,0 +1,20 @@
// src/adapter/service-worker/handler.ts
var handle = (app, opts = {
// To use `fetch` on a Service Worker correctly, bind it to `globalThis`.
fetch: globalThis.fetch.bind(globalThis)
}) => {
return (evt) => {
evt.respondWith(
(async () => {
const res = await app.fetch(evt.request, {}, evt);
if (opts.fetch && res.status === 404) {
return await opts.fetch(evt.request);
}
return res;
})()
);
};
};
export {
handle
};

11
node_modules/hono/dist/adapter/service-worker/index.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
// src/adapter/service-worker/index.ts
import { handle } from "./handler.js";
var fire = (app, options = {
fetch: void 0
}) => {
addEventListener("fetch", handle(app, options));
};
export {
fire,
handle
};

View file