Skip to content

Commit

Permalink
Fix Biome format
Browse files Browse the repository at this point in the history
  • Loading branch information
MovByte committed Jul 25, 2024
1 parent b05984c commit 93368cf
Show file tree
Hide file tree
Showing 48 changed files with 1,727 additions and 1,631 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
insert_final_newline = false
end_of_line = lf
indent_style = space
indent_size = 2

[*.{md,xit}]
trim_trailing_whitespace = true

[*.ts]
indent_style = "tab"
indent_size = 4
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.wordWrap": "on",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"files.exclude": {
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
}
},
"files": {
"ignore": ["/src/AeroSandbox", "/dev_server", "/**/dist"]
"ignore": ["/**/dist"]
}
}
15 changes: 15 additions & 0 deletions src/AeroSandbox/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
insert_final_newline = false
end_of_line = lf
indent_style = space
indent_size = 2

[*.{md,xit}]
trim_trailing_whitespace = true

[*.ts]
indent_style = "tab"
indent_size = 4
22 changes: 11 additions & 11 deletions src/AeroSandbox/build/AeroSandboxBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export default class AeroSandbox {
config: AeroSandboxConfig;
fakeOrigin(
apiIncludeBitwiseEnum: APIBitwiseEnum | "all",
apiExcludeBitwiseEnum: APIBitwiseEnum | "none",
rewriterModesBitwiseEnum: rewriterModesBitwiseEnum,
isWorker = false,
proxyOrigin: string
): ResultAsync<boolean> {}
/** This API isn't implemented yet and is here to serve as a placeholder */
faker: {};
rewriters;
config: AeroSandboxConfig;
fakeOrigin(
apiIncludeBitwiseEnum: APIBitwiseEnum | "all",
apiExcludeBitwiseEnum: APIBitwiseEnum | "none",
rewriterModesBitwiseEnum: rewriterModesBitwiseEnum,
isWorker = false,
proxyOrigin: string
): ResultAsync<boolean> {}
/** This API isn't implemented yet and is here to serve as a placeholder */
faker: {};
rewriters;
}
8 changes: 4 additions & 4 deletions src/AeroSandbox/build/customBuilds/aero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import config from "$aero/config";
import AeroSandbox from "../AeroSandboxBuilder";

const buildConfig = {
proxyConfig: {
...config,
},
specialInterceptionFeatures: defaultSWProxyFeatures,
proxyConfig: {
...config
},
specialInterceptionFeatures: defaultSWProxyFeatures
};

const fakeOriginSettings = ["all", "all", "none"];
Expand Down
10 changes: 5 additions & 5 deletions src/AeroSandbox/build/customBuilds/frankenUV.inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ enum UVRewriterMembers {}
let __uv$config: UVConfig;

const buildConfig = {
proxyConfig: {
encodeUrl: __uv$config.encodeUrl,
decodeUrl: __uv$config.decodeUrl,
},
specialInterceptionFeatures: defaultProxyFeatures,
proxyConfig: {
encodeUrl: __uv$config.encodeUrl,
decodeUrl: __uv$config.decodeUrl
},
specialInterceptionFeatures: defaultProxyFeatures
};

const fakeOriginSettings = ["all", UVRewriterMembers, "none"];
Expand Down
10 changes: 5 additions & 5 deletions src/AeroSandbox/build/customBuilds/frankenUV.workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import AeroSandbox from "../AeroSandboxBuilder";
let __uv$config: UVConfig;

const buildConfig = {
proxyConfig: {
encodeUrl: __uv$config.encodeUrl,
decodeUrl: __uv$config.decodeUrl,
},
specialInterceptionFeatures: defaultProxyFeatures,
proxyConfig: {
encodeUrl: __uv$config.encodeUrl,
decodeUrl: __uv$config.decodeUrl
},
specialInterceptionFeatures: defaultProxyFeatures
};

const fakeOriginSettings = ["all", UVRewriterWorkerMembers, "none", true];
Expand Down
24 changes: 12 additions & 12 deletions src/AeroSandbox/build/featureMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import { InterceptionFeaturesEnum } from "$types/apiInterceptors";

/** @note: These do not cover Origin Isolation although Origin Emulation is a type of Origin Isolation. Origin Emulation is a superset of Origin Isolation. */
const originEmulationFeatures =
InterceptionFeaturesEnum.corsEmulation |
InterceptionFeaturesEnum.cacheEmulation |
InterceptionFeaturesEnum.privacySandbox |
InterceptionFeaturesEnum.nestedSWs;
InterceptionFeaturesEnum.corsEmulation |
InterceptionFeaturesEnum.cacheEmulation |
InterceptionFeaturesEnum.privacySandbox |
InterceptionFeaturesEnum.nestedSWs;
/** @note: These do not cover Origin Concealers although Origin Isolation is a type of Origin Concealing. Origin Isolation is a superset of Origin Concealment. */
const miscOriginIsolators = InterceptionFeaturesEnum.messageIsolation;
const miscOriginConcealers =
InterceptionFeaturesEnum.elementConcealment |
InterceptionFeaturesEnum.errorConcealment;
InterceptionFeaturesEnum.elementConcealment |
InterceptionFeaturesEnum.errorConcealment;
const defaultSWProxyFeatures = originEmulationFeatures | miscOriginConcealers;
const defaultProxyFeatures =
defaultSWProxyFeatures | InterceptionFeaturesEnum.requestUrlProxifier;
defaultSWProxyFeatures | InterceptionFeaturesEnum.requestUrlProxifier;

export {
originEmulationFeatures,
miscOriginIsolators,
miscOriginConcealers,
defaultSWProxyFeatures,
defaultProxyFeatures,
originEmulationFeatures,
miscOriginIsolators,
miscOriginConcealers,
defaultSWProxyFeatures,
defaultProxyFeatures
};
116 changes: 60 additions & 56 deletions src/AeroSandbox/build/init.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,99 @@
import {
APIInterceptor,
proxifiedObjType,
proxifiedObjGeneratorContext,
APIInterceptor,
proxifiedObjType,
proxifiedObjGeneratorContext
} from "../types";

import { buildConfig } from "./customBuilds/aero";
import { buildConfig as buildConfigFrakenUV } from "./customBuilds/frankenUV.inject.ts";

let proxifiedObjGenCtx: proxifiedObjGeneratorContext = {
...buildConfig.specialInterceptionFeatures,
...buildConfig.specialInterceptionFeatures
};

if (process.env.BUILD_UV_FRAKEN)
proxifiedObjGenCtx = {
...buildConfigFrakenUV.specialInterceptionFeatures,
};
proxifiedObjGenCtx = {
...buildConfigFrakenUV.specialInterceptionFeatures
};

if (process.env.BUILD_WOMBAT_SHIM) {
// TODO: Build
// TODO: Build
}

type level = number;
const insertLater = new Map<level, proxifiedObjType>();

// @ts-ignore TODO: Move this code to AeroSandbox
const ctx = import.meta.webpackContext("../src/interceptors", {
include: /\.ts$/,
include: /\.ts$/
});
for (const fileName of ctx.keys()) {
console.log(fileName);
const aI: APIInterceptor = ctx(fileName);
if (aI.insertLevel && aI.insertLevel !== 0)
insertLater.set(aI.insertLevel, aI);
else handleAI(aI);
console.log(fileName);
const aI: APIInterceptor = ctx(fileName);
if (aI.insertLevel && aI.insertLevel !== 0)
insertLater.set(aI.insertLevel, aI);
else handleAI(aI);
}

// @ts-ignore
const sortedInsertObj = Object.entries(
Array.from(insertLater.keys()).sort((a, b) => b[1] - a[1])
Array.from(insertLater.keys()).sort((a, b) => b[1] - a[1])
) as {
[key: string]: APIInterceptor;
[key: string]: APIInterceptor;
};

for (const aI of Object.values(sortedInsertObj)) {
handleAI(aI);
handleAI(aI);
}

function handleAI(aI: APIInterceptor): void {
if (aI.exposedContexts) {
if (Object.values(aI.exposedContexts).includes("window")) {
// @ts-ignore
if (aI.proxifiedObj) {
let proxyObject = resolveProxifiedObj(
// @ts-ignore
aI.proxifiedObj,
proxifiedObjGenCtx
);
if (aI.exposedContexts) {
if (Object.values(aI.exposedContexts).includes("window")) {
// @ts-ignore
if (aI.proxifiedObj) {
let proxyObject = resolveProxifiedObj(
// @ts-ignore
aI.proxifiedObj,
proxifiedObjGenCtx
);

window[aI.globalProp] = proxyObject;
} // @ts-ignore
else if (aI.proxifiedObjWorkerVersion) {
Object.defineProperty(
window,
aI.globalProp,
aI.proxifiedObjWorkerVersion
);
}
}
} else {
// @ts-ignore
if (aI.proxifiedObj) {
let proxyObject = resolveProxifiedObj(
// @ts-ignore
aI.proxifiedObj,
proxifiedObjGenCtx
);
window[aI.globalProp] = proxyObject;
} // @ts-ignore
else if (aI.proxifiedObjWorkerVersion) {
Object.defineProperty(
window,
aI.globalProp,
aI.proxifiedObjWorkerVersion
);
}
}
} else {
// @ts-ignore
if (aI.proxifiedObj) {
let proxyObject = resolveProxifiedObj(
// @ts-ignore
aI.proxifiedObj,
proxifiedObjGenCtx
);

self[aI.globalProp] = proxyObject;
} // @ts-ignore
else if (aI.proxifiedObjWorkerVersion) {
Object.defineProperty(self, aI.globalProp, aI.proxifiedObjWorkerVersion);
}
}
self[aI.globalProp] = proxyObject;
} // @ts-ignore
else if (aI.proxifiedObjWorkerVersion) {
Object.defineProperty(
self,
aI.globalProp,
aI.proxifiedObjWorkerVersion
);
}
}
}

function resolveProxifiedObj(
proxifiedObj: proxifiedObjType,
ctx: proxifiedObjGeneratorContext
proxifiedObj: proxifiedObjType,
ctx: proxifiedObjGeneratorContext
): proxifiedObjType {
let proxyObject = {};
if (typeof proxifiedObj === "function") proxyObject = proxifiedObj(ctx);
else if (typeof proxifiedObj === "object") proxyObject = proxifiedObj;
return proxyObject;
let proxyObject = {};
if (typeof proxifiedObj === "function") proxyObject = proxifiedObj(ctx);
else if (typeof proxifiedObj === "object") proxyObject = proxifiedObj;
return proxyObject;
}
2 changes: 1 addition & 1 deletion src/AeroSandbox/build/loader.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = content => {
return content.replace(/<proxyNamespace>/g, "$aero");
return content.replace(/<proxyNamespace>/g, "$aero");
};
Loading

0 comments on commit 93368cf

Please sign in to comment.