prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
29 lines (22 loc) • 954 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (realm) {
// Extract the bootstrap source code from the hosting Node version.
let nodeSourceCode = process.binding("natives");
let bootstrapSource = nodeSourceCode["internal/bootstrap_node"];
let bootstrapFilename = "bootstrap_node.js";
if (!bootstrapSource) {
throw new _errors.FatalError("The node-cli mode is only compatible with Node 7.");
}
// We evaluate bootstrap script to get the bootstrap function.
let bootstrapFn = realm.$GlobalEnv.execute(bootstrapSource, bootstrapFilename, "");
if (!(bootstrapFn instanceof _index.FunctionValue) || !bootstrapFn.$Call) {
throw new _errors.FatalError("The node bootstrap script should always yield a function.");
}
return bootstrapFn;
};
var _errors = require("../../errors.js");
var _index = require("../../values/index.js");
//# sourceMappingURL=bootstrap.js.map