This commit is contained in:
Adria Navarro 2024-02-05 10:20:12 +01:00
parent 75f8b40cc4
commit 62994c2026
1 changed files with 17 additions and 16 deletions

View File

@ -33,7 +33,8 @@ export function init() {
})
const jsContext = jsIsolate.createContextSync()
const injectedRequire = `const require = function(val){
const injectedRequire = `
const require = function(val){
switch (val) {
case "url":
return {
@ -83,9 +84,9 @@ export function init() {
`${injectedRequire};${helpersSource}`
)
const cryptoModule = jsIsolate.compileModuleSync(`export default {
randomUUID: cryptoRandomUUIDCb,
}`)
const cryptoModule = jsIsolate.compileModuleSync(
`export default { randomUUID: cryptoRandomUUIDCb }`
)
cryptoModule.instantiateSync(jsContext, specifier => {
throw new Error(`No imports allowed. Required: ${specifier}`)
})