File size: 1,587 Bytes
bee6636 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
import { ScramjetClient } from "./client/client";
import { ScramjetController } from "./controller";
import { ScramjetFrame } from "./controller/frame";
import { SCRAMJETCLIENT, SCRAMJETFRAME } from "./symbols";
export type ScramjetFlags = {
serviceworkers: boolean;
syncxhr: boolean;
naiiveRewriter: boolean;
strictRewrites: boolean;
rewriterLogs: boolean;
captureErrors: boolean;
cleanErrors: boolean;
scramitize: boolean;
sourcemaps: boolean;
};
export interface ScramjetConfig {
prefix: string;
globals: {
wrapfn: string;
wrapthisfn: string;
trysetfn: string;
importfn: string;
rewritefn: string;
metafn: string;
setrealmfn: string;
pushsourcemapfn: string;
};
files: {
wasm: string;
all: string;
sync: string;
};
flags: ScramjetFlags;
siteFlags: Record<string, Partial<ScramjetFlags>>;
codec: {
encode: string;
decode: string;
};
}
export interface ScramjetInitConfig
extends Omit<ScramjetConfig, "codec" | "flags"> {
flags: Partial<ScramjetFlags>;
codec: {
encode: (url: string) => string;
decode: (url: string) => string;
};
}
declare global {
interface Window {
COOKIE: string;
WASM: string;
REAL_WASM: Uint8Array;
// the scramjet client belonging to a window
[SCRAMJETCLIENT]: ScramjetClient;
}
interface HTMLDocument {
// should be the same as window
[SCRAMJETCLIENT]: ScramjetClient;
}
interface HTMLIFrameElement {
// the event target belonging to an <iframe> holding a /prefix/blah url
[SCRAMJETFRAME]: ScramjetFrame;
}
}
|