-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,727 additions
and
1,631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
} | ||
}, | ||
"files": { | ||
"ignore": ["/src/AeroSandbox", "/dev_server", "/**/dist"] | ||
"ignore": ["/**/dist"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}; |
Oops, something went wrong.