Instantiate module
This commit is contained in:
parent
395e4b9484
commit
6cafbbf036
1 changed files with 6 additions and 8 deletions
|
@ -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 })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue