Ghost/core/server/services/apps/sandbox.js
Fabien O'Carroll ad9d142174 Refactored Sandbox to be singleton
no-issue
2019-04-16 11:05:33 +02:00

14 lines
403 B
JavaScript

const Module = require('module');
module.exports.loadApp = function loadAppSandboxed(appPath) {
// Resolve the modules path
const resolvedModulePath = Module._resolveFilename(appPath, module.parent);
// Instantiate a Node Module class
const currentModule = new Module(resolvedModulePath, module.parent);
currentModule.load(currentModule.id);
return currentModule.exports;
};