1
0
Fork 0
mirror of synced 2024-09-09 06:01:08 +12:00

Instantiate module

This commit is contained in:
Adria Navarro 2024-02-07 13:47:43 +01:00
parent 395e4b9484
commit 6cafbbf036

View file

@ -94,15 +94,13 @@ class IsolatedVM {
} }
runScript(): void { runScript(): void {
if (this.#bsonModule) {
this.#script.instantiateSync(this.#vm, specifier => { this.#script.instantiateSync(this.#vm, specifier => {
if (specifier === "compiled_module") { if (specifier === "compiled_module" && this.#bsonModule) {
return this.#bsonModule! return this.#bsonModule!
} }
throw new Error(`"${specifier}" import not allowed`) throw new Error(`"${specifier}" import not allowed`)
}) })
}
this.#script.evaluateSync({ timeout: JS_TIMEOUT_MS }) this.#script.evaluateSync({ timeout: JS_TIMEOUT_MS })
} }