Lint
This commit is contained in:
parent
75f8b40cc4
commit
62994c2026
|
@ -33,19 +33,20 @@ export function init() {
|
||||||
})
|
})
|
||||||
const jsContext = jsIsolate.createContextSync()
|
const jsContext = jsIsolate.createContextSync()
|
||||||
|
|
||||||
const injectedRequire = `const require = function(val){
|
const injectedRequire = `
|
||||||
switch (val) {
|
const require = function(val){
|
||||||
case "url":
|
switch (val) {
|
||||||
return {
|
case "url":
|
||||||
resolve: (...params) => urlResolveCb(...params),
|
return {
|
||||||
parse: (...params) => urlParseCb(...params),
|
resolve: (...params) => urlResolveCb(...params),
|
||||||
}
|
parse: (...params) => urlParseCb(...params),
|
||||||
case "querystring":
|
}
|
||||||
return {
|
case "querystring":
|
||||||
escape: (...params) => querystringEscapeCb(...params),
|
return {
|
||||||
}
|
escape: (...params) => querystringEscapeCb(...params),
|
||||||
}
|
}
|
||||||
};`
|
}
|
||||||
|
};`
|
||||||
|
|
||||||
const global = jsContext.global
|
const global = jsContext.global
|
||||||
global.setSync(
|
global.setSync(
|
||||||
|
@ -83,9 +84,9 @@ export function init() {
|
||||||
`${injectedRequire};${helpersSource}`
|
`${injectedRequire};${helpersSource}`
|
||||||
)
|
)
|
||||||
|
|
||||||
const cryptoModule = jsIsolate.compileModuleSync(`export default {
|
const cryptoModule = jsIsolate.compileModuleSync(
|
||||||
randomUUID: cryptoRandomUUIDCb,
|
`export default { randomUUID: cryptoRandomUUIDCb }`
|
||||||
}`)
|
)
|
||||||
cryptoModule.instantiateSync(jsContext, specifier => {
|
cryptoModule.instantiateSync(jsContext, specifier => {
|
||||||
throw new Error(`No imports allowed. Required: ${specifier}`)
|
throw new Error(`No imports allowed. Required: ${specifier}`)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue