diff --git a/playwright.config.ts b/playwright.config.ts index 2b231a5..8ace47f 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -19,6 +19,7 @@ export default defineConfig({ showError: true, }, ], + ["github"], ] : "html", timeout: 20000, diff --git a/src/client/client.ts b/src/client/client.ts index dab6435..e3b6ec5 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -21,6 +21,16 @@ import type { URLMeta } from "../shared/rewriters/url"; //eslint-disable-next-line export type AnyFunction = Function; +export type ScramjetModule = { + enabled: (client: ScramjetClient) => boolean | undefined; + disabled: ( + client: ScramjetClient, + self: typeof globalThis + ) => void | undefined; + order: number | undefined; + default: (client: ScramjetClient, self: typeof globalThis) => void; +}; + export type ProxyCtx = { fn: AnyFunction; this: any; @@ -77,7 +87,7 @@ export class ScramjetClient { constructor(public global: typeof globalThis) { if (SCRAMJETCLIENT in global) { console.error( - "attempted to initialize a scramjet client, but one is already loaded - this is very bad" + "attempted to initialize a scramjet cl ient, but one is already loaded - this is very bad" ); throw new Error(); } @@ -171,10 +181,10 @@ export class ScramjetClient { recursive: true, }); - const modules = []; + const modules: ScramjetModule[] = []; for (const key of context.keys()) { - const module = context(key); + const module: ScramjetModule = context(key); if (!key.endsWith(".ts")) continue; if ( (key.startsWith("./dom/") && "window" in this.global) ||