Socket
Socket
Sign inDemoInstall

ember-fastboot-server

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-fastboot-server - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

lib/sandbox.js

60

lib/ember-app.js
var fs = require('fs');
var path = require('path');
var Contextify = require('contextify');
var SimpleDOM = require('simple-dom');
var chalk = require('chalk');
var najax = require('najax');
var debug = require('debug')('ember-cli-fastboot:ember-app');
var sourceMapSupport = require('./install-source-map-support');
var FastBootInfo = require('./fastboot-info');
var Sandbox = require('./sandbox');

@@ -31,9 +29,10 @@ var HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);

var sandboxRequire = buildWhitelistedRequire(moduleWhitelist, distPath);
var sandbox = createSandbox({
najax: najax,
FastBoot: { require: sandboxRequire }
var sandbox = new Sandbox({
globals: {
najax: najax,
FastBoot: { require: sandboxRequire }
}
});
sourceMapSupport.install(Error);
sandbox.run('sourceMapSupport.install(Error);');
sandbox.eval('sourceMapSupport.install(Error);');

@@ -43,9 +42,11 @@ var appFile = fs.readFileSync(appFilePath, 'utf8');

sandbox.run(vendorFile, vendorFilePath);
sandbox.eval(vendorFile, vendorFilePath);
debug("vendor file evaluated");
sandbox.run(appFile, appFilePath);
sandbox.eval(appFile, appFilePath);
debug("app file evaluated");
var AppFactory = sandbox.require('~fastboot/app-factory');
var AppFactory = sandbox.run(function(ctx) {
return ctx.require('~fastboot/app-factory');
});

@@ -140,39 +141,2 @@ if (!AppFactory || typeof AppFactory['default'] !== 'function') {

function createSandbox(dependencies) {
var wrappedConsole = Object.create(console);
wrappedConsole.error = function() {
console.error.apply(console, Array.prototype.map.call(arguments, function(a) {
return typeof a === 'string' ? chalk.red(a) : a;
}));
};
var sandbox = {
sourceMapSupport: sourceMapSupport,
// Expose the console to the FastBoot environment so we can debug
console: wrappedConsole,
// setTimeout and clearTimeout are an assumed part of JavaScript environments. Expose it.
setTimeout: setTimeout,
clearTimeout: clearTimeout,
// Convince jQuery not to assume it's in a browser
module: { exports: {} },
URL: require("url")
};
for (var dep in dependencies) {
sandbox[dep] = dependencies[dep];
}
// Set the global as `window`.
sandbox.window = sandbox;
sandbox.window.self = sandbox;
// The sandbox is now a JavaScript context O_o
Contextify(sandbox);
return sandbox;
}
function buildWhitelistedRequire(whitelist, distPath) {

@@ -179,0 +143,0 @@ return function(moduleName) {

{
"name": "ember-fastboot-server",
"version": "0.5.3",
"version": "0.5.4",
"description": "Production server for running Ember applications using FastBoot",
"main": "./lib/server",
"scripts": {
"postinstall": "scripts/is-not-legacy-vm || npm install contextify@^0.1.11",
"test": "mocha"

@@ -28,6 +29,6 @@ },

"chalk": "^0.5.1",
"contextify": "^0.1.11",
"cookie": "^0.2.3",
"debug": "^2.1.0",
"express": "^4.13.3",
"express-cluster": "0.0.4",
"glob": "^4.0.5",

@@ -34,0 +35,0 @@ "minimist": "^1.2.0",

4

test/helpers/cli-server.js

@@ -35,3 +35,3 @@ var RSVP = require('rsvp');

server.on('exit', function(statusCode, signal) {
if (signal === 'SIGTERM') {
if (signal === 'SIGTERM' || statusCode === 143) {
resolve();

@@ -41,3 +41,3 @@ return;

console.error('Server exited unexpectedly');
console.error('Server exited unexpectedly: ' + signal + ' ' + statusCode);
reject();

@@ -44,0 +44,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc