22 lines
741 B
JavaScript
22 lines
741 B
JavaScript
'use strict';
|
|
|
|
// Minimal shim for legacy Atom packages running in modern Pulsar/Electron.
|
|
// The real `loophole` package was historically used to bypass Atom's CSP
|
|
// restrictions around `eval`/`new Function`. For this package, it's used as:
|
|
// const loophole = require('loophole'); global.Function = loophole.Function;
|
|
// So we provide a compatible surface area without pulling the full dependency.
|
|
|
|
function passthrough(callback) {
|
|
if (typeof callback !== 'function') return callback;
|
|
return callback();
|
|
}
|
|
|
|
module.exports = {
|
|
// Provide the native Function constructor.
|
|
Function: global.Function,
|
|
|
|
// Common loophole API surface (no-op wrappers here).
|
|
allowUnsafeEval: passthrough,
|
|
allowUnsafeNewFunction: passthrough,
|
|
};
|