1
0
Fork 0
mirror of synced 2024-07-11 17:26:01 +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 {
if (this.#bsonModule) {
this.#script.instantiateSync(this.#vm, specifier => {
if (specifier === "compiled_module") {
return this.#bsonModule!
}
this.#script.instantiateSync(this.#vm, specifier => {
if (specifier === "compiled_module" && 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 })
}