ember-fastboot-server
Advanced tools
Comparing version 0.5.3 to 0.5.4
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", |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5978277
30
71503
2
1
5
+ Addedexpress-cluster@0.0.4
+ Addedexpress-cluster@0.0.4(transitive)
- Removedcontextify@^0.1.11
- Removedbindings@1.5.0(transitive)
- Removedcontextify@0.1.15(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removednan@2.20.0(transitive)