chore: prettier

This commit is contained in:
Percs 2024-10-10 19:19:47 -05:00
parent 3138baf2c8
commit 4d7fa7abb6
6 changed files with 18 additions and 15 deletions

View file

@ -18,7 +18,10 @@
"lint": "eslint ./src/ --ext .ts", "lint": "eslint ./src/ --ext .ts",
"lint:fix": "eslint ./src/ --ext .ts --fix" "lint:fix": "eslint ./src/ --ext .ts --fix"
}, },
"files": ["dist", "lib"], "files": [
"dist",
"lib"
],
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",

View file

@ -108,7 +108,7 @@ export class ScramjetClient {
resolve(data.port); resolve(data.port);
} }
}); });
}), })
); );
} }
@ -239,7 +239,7 @@ export class ScramjetClient {
h.construct = function ( h.construct = function (
constructor: any, constructor: any,
argArray: any[], argArray: any[],
newTarget: AnyFunction, newTarget: AnyFunction
) { ) {
let returnValue: any = undefined; let returnValue: any = undefined;
let earlyreturn = false; let earlyreturn = false;
@ -354,7 +354,7 @@ export class ScramjetClient {
RawTrap<T>( RawTrap<T>(
target: any, target: any,
prop: string, prop: string,
descriptor: Trap<T>, descriptor: Trap<T>
): PropertyDescriptor { ): PropertyDescriptor {
if (!target) return; if (!target) return;
if (!prop) return; if (!prop) return;

View file

@ -52,7 +52,7 @@ export default function (client: ScramjetClient, self: typeof window) {
for (const element of attrObject[attr]) { for (const element of attrObject[attr]) {
const descriptor = nativeGetOwnPropertyDescriptor( const descriptor = nativeGetOwnPropertyDescriptor(
element.prototype, element.prototype,
attr, attr
); );
Object.defineProperty(element.prototype, attr, { Object.defineProperty(element.prototype, attr, {
get() { get() {
@ -80,7 +80,7 @@ export default function (client: ScramjetClient, self: typeof window) {
base: new URL(client.url.origin), base: new URL(client.url.origin),
origin: new URL(client.url.origin), origin: new URL(client.url.origin),
} as URLMeta, } as URLMeta,
true, true
); );
} else if (["srcset", "imagesrcset"].includes(attr)) { } else if (["srcset", "imagesrcset"].includes(attr)) {
value = rewriteSrcset(value, client.meta); value = rewriteSrcset(value, client.meta);
@ -216,8 +216,8 @@ export default function (client: ScramjetClient, self: typeof window) {
return atob( return atob(
client.natives["Element.prototype.getAttribute"].call( client.natives["Element.prototype.getAttribute"].call(
ctx.this, ctx.this,
"data-scramjet-script-source-src", "data-scramjet-script-source-src"
), )
); );
} }
if (ctx.this instanceof self.HTMLStyleElement) { if (ctx.this instanceof self.HTMLStyleElement) {
@ -307,7 +307,7 @@ export default function (client: ScramjetClient, self: typeof window) {
ctx.args[0], ctx.args[0],
client.cookieStore, client.cookieStore,
client.meta, client.meta,
false, false
); );
} }
}, },
@ -319,7 +319,7 @@ export default function (client: ScramjetClient, self: typeof window) {
ctx.args[0], ctx.args[0],
client.cookieStore, client.cookieStore,
client.meta, client.meta,
true, true
); );
}, },
}); });
@ -330,7 +330,7 @@ export default function (client: ScramjetClient, self: typeof window) {
ctx.args[0], ctx.args[0],
client.cookieStore, client.cookieStore,
client.meta, client.meta,
false, false
); );
}, },
}); });

View file

@ -11,7 +11,7 @@ export default function (client: ScramjetClient, self: Self) {
const url = stack[i].getFileName(); const url = stack[i].getFileName();
try { try {
newstack = newstack.replaceAll(url, decodeUrl(url)); newstack = newstack.replaceAll(url, decodeUrl(url));
} catch { } } catch {}
} }
return newstack; return newstack;

View file

@ -45,7 +45,7 @@ export function decodeUrl(url: string | URL) {
if ( if (
tryCanParseURL(url)?.pathname.startsWith( tryCanParseURL(url)?.pathname.startsWith(
self.$scramjet.config.prefix + "worker", self.$scramjet.config.prefix + "worker"
) )
) { ) {
return new URL(new URL(url).searchParams.get("origin")).href; return new URL(new URL(url).searchParams.get("origin")).href;
@ -55,7 +55,7 @@ export function decodeUrl(url: string | URL) {
return url; return url;
} else if (tryCanParseURL(url)) { } else if (tryCanParseURL(url)) {
return self.$scramjet.codec.decode( return self.$scramjet.codec.decode(
url.slice((location.origin + self.$scramjet.config.prefix).length), url.slice((location.origin + self.$scramjet.config.prefix).length)
); );
} else { } else {
return url; return url;

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Scramjet</title> <title>Scramjet</title>
<link rel="icon" href="favicon.webp"> <link rel="icon" href="favicon.webp" />
<link rel="prefetch" href="/scram/scramjet.worker.js" /> <link rel="prefetch" href="/scram/scramjet.worker.js" />
<link rel="prefetch" href="/scram/scramjet.shared.js" /> <link rel="prefetch" href="/scram/scramjet.shared.js" />
<link <link