fix: auth magics eval

This commit is contained in:
Xmader 2020-11-18 14:00:43 -05:00
parent 7e66e131e9
commit 83befd2df4
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 7 additions and 3 deletions

View File

@ -27,9 +27,13 @@ const magicHookConstr = (type: FileType) => {
const m = mod.toString().match(AUTH_REG)
if (m) {
const code = m[1]
// eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
const magic = Function(`return (${code})`)()
resolve(magic)
try {
// eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
const magic = Function(`return (${code})`)()
resolve(magic)
} catch (err) {
console.error(err)
}
}
})
}