This commit is contained in:
Toshit Chawda 2025-03-06 20:53:11 -08:00
parent 0995fea192
commit fc948fa394
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
2 changed files with 4 additions and 5 deletions

View file

@ -29,7 +29,7 @@ function rewriteJsWasm(
source: string | null, source: string | null,
meta: URLMeta, meta: URLMeta,
module: boolean module: boolean
): { js: string | ArrayBuffer; map: Uint8Array | null; tag: string } { ): { js: string | Uint8Array; map: Uint8Array | null; tag: string } {
initSync({ initSync({
module: new WebAssembly.Module(self.REAL_WASM), module: new WebAssembly.Module(self.REAL_WASM),
}); });

View file

@ -1,16 +1,14 @@
import { BareResponseFetch } from "@mercuryworkshop/bare-mux"; import { BareResponseFetch } from "@mercuryworkshop/bare-mux";
import { MessageW2C, ScramjetServiceWorker } from "."; import { ScramjetServiceWorker } from ".";
import { renderError } from "./error"; import { renderError } from "./error";
import { FakeServiceWorker } from "./fakesw"; import { FakeServiceWorker } from "./fakesw";
import { CookieStore } from "../shared/cookie"; import { CookieStore } from "../shared/cookie";
import { import {
ScramjetHeaders, ScramjetHeaders,
unrewriteUrl, unrewriteUrl,
rewriteUrl,
rewriteCss, rewriteCss,
rewriteHeaders, rewriteHeaders,
rewriteHtml, rewriteHtml,
rewriteJs,
rewriteWorkers, rewriteWorkers,
unrewriteBlob, unrewriteBlob,
} from "../shared"; } from "../shared";
@ -368,9 +366,10 @@ async function rewriteBody(
workertype === "module" workertype === "module"
); );
if (flagEnabled("sourcemaps", meta.base) && map) { if (flagEnabled("sourcemaps", meta.base) && map) {
console.log(js);
js = js =
`${globalThis.$scramjet.config.globals.pushsourcemapfn}([${map.join(",")}], "${tag}");` + `${globalThis.$scramjet.config.globals.pushsourcemapfn}([${map.join(",")}], "${tag}");` +
js; (js instanceof Uint8Array ? new TextDecoder().decode(js) : js);
} }
return js; return js;
case "style": case "style":