rewrite the rewriter

This commit is contained in:
velzie 2024-07-18 20:26:13 -04:00
parent 73c1c8a5c8
commit 6a5ecc4efc
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
6 changed files with 62 additions and 128 deletions

View file

@ -2,6 +2,7 @@ import { decodeUrl } from "./url";
// i am a cat. i like to be petted. i like to be fed. i like to be
import {
init,
initSync,
rewrite_js,
rewrite_js_from_arraybuffer,
@ -14,6 +15,10 @@ initSync(
)
);
init();
Error.stackTraceLimit = 50
global.rws = rewriteJs;
export function rewriteJs(js: string | ArrayBuffer, origin?: URL) {
if ("window" in globalThis) origin ??= new URL(decodeUrl(location.href));