HUGE refactore, once again.

This commit is contained in:
Zef Hemel
2022-03-15 14:03:00 +01:00
parent 9d41c9e3d6
commit 97b9d3a3e0
19 changed files with 530 additions and 453 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ async function run() {
.parse();
let generatedManifest = await bundle(args._[0], !!args.debug);
writeFile(args._[1], JSON.stringify(generatedManifest, null, 2));
await writeFile(args._[1], JSON.stringify(generatedManifest, null, 2));
}
run().catch((e) => {
-1
View File
@@ -20,7 +20,6 @@ export class NodeSandbox implements Sandbox {
constructor(readonly system: System<any>, workerScript: string) {
this.worker = new Worker(workerScript);
this.worker.on("message", this.onmessage.bind(this));
}
+1 -1
View File
@@ -42,6 +42,6 @@ test("Run a Node sandbox", async () => {
for (let i = 0; i < 100; i++) {
expect(await plug.invoke("addNumbersSyscall", [10, i])).toBe(10 + i);
}
console.log(plug.sandbox);
// console.log(plug.sandbox);
await system.stop();
});
-1
View File
@@ -31,7 +31,6 @@ export class Plug<HookT> {
if (!this.sandbox.isLoaded(name)) {
await this.sandbox.load(name, this.manifest!.functions[name].code!);
}
console.log("Loaded", name);
return await this.sandbox.invoke(name, args);
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { ControllerMessage, WorkerMessage } from "./types";
import { Plug, Sandbox, System } from "./runtime";
import { Sandbox, System } from "./runtime";
export class WebworkerSandbox implements Sandbox {
private worker: Worker;