From fc948fa394e63f5bc49ccd0aaa0a8f36f1f06f9b Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Thu, 6 Mar 2025 20:53:11 -0800 Subject: [PATCH] fix --- src/shared/rewriters/js.ts | 2 +- src/worker/fetch.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shared/rewriters/js.ts b/src/shared/rewriters/js.ts index 30a2b53..1cd157b 100644 --- a/src/shared/rewriters/js.ts +++ b/src/shared/rewriters/js.ts @@ -29,7 +29,7 @@ function rewriteJsWasm( source: string | null, meta: URLMeta, module: boolean -): { js: string | ArrayBuffer; map: Uint8Array | null; tag: string } { +): { js: string | Uint8Array; map: Uint8Array | null; tag: string } { initSync({ module: new WebAssembly.Module(self.REAL_WASM), }); diff --git a/src/worker/fetch.ts b/src/worker/fetch.ts index 3e32307..b203847 100644 --- a/src/worker/fetch.ts +++ b/src/worker/fetch.ts @@ -1,16 +1,14 @@ import { BareResponseFetch } from "@mercuryworkshop/bare-mux"; -import { MessageW2C, ScramjetServiceWorker } from "."; +import { ScramjetServiceWorker } from "."; import { renderError } from "./error"; import { FakeServiceWorker } from "./fakesw"; import { CookieStore } from "../shared/cookie"; import { ScramjetHeaders, unrewriteUrl, - rewriteUrl, rewriteCss, rewriteHeaders, rewriteHtml, - rewriteJs, rewriteWorkers, unrewriteBlob, } from "../shared"; @@ -368,9 +366,10 @@ async function rewriteBody( workertype === "module" ); if (flagEnabled("sourcemaps", meta.base) && map) { + console.log(js); js = `${globalThis.$scramjet.config.globals.pushsourcemapfn}([${map.join(",")}], "${tag}");` + - js; + (js instanceof Uint8Array ? new TextDecoder().decode(js) : js); } return js; case "style":