Fix stripProtocol
This commit is contained in:
parent
d1cf13707d
commit
1439eb9b27
|
@ -70,6 +70,15 @@ export function init() {
|
|||
)
|
||||
)
|
||||
|
||||
global.setSync(
|
||||
"helpersStripProtocol",
|
||||
new ivm.Callback((str: string) => {
|
||||
var parsed = url.parse(str) as any
|
||||
parsed.protocol = ""
|
||||
return parsed.format()
|
||||
})
|
||||
)
|
||||
|
||||
const helpersModule = jsIsolate.compileModuleSync(
|
||||
`${injectedRequire};${helpersSource}`
|
||||
)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
const { getJsHelperList } = require("./helpers/list")
|
||||
|
||||
module.exports = getJsHelperList()
|
||||
const helpers = getJsHelperList()
|
||||
module.exports = {
|
||||
...helpers,
|
||||
// point stripProtocol to a unexisting function to be able to declare it on isolated-vm
|
||||
stripProtocol: helpersStripProtocol,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue