fix: remove eval usage so that chrome extension MV3 can run properly (#1941)

This commit is contained in:
AntiMoron 2024-12-30 14:30:38 +08:00 committed by GitHub
parent 547afa26f7
commit f2ccb99922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,12 +8,17 @@ module.exports = inquire;
* @returns {?Object} Required module if available and not empty, otherwise `null`
*/
function inquire(moduleName) {
try {
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
if (mod && (mod.length || Object.keys(mod).length))
return mod;
} catch (e) {} // eslint-disable-line no-empty
try {
if (typeof require !== "function") {
return null;
}
var mod = require(moduleName);
if (mod && (mod.length || Object.keys(mod).length)) return mod;
return null;
} catch (err) {
// ignore
return null;
}
}
/*