ember-fastboot-server
Advanced tools
Comparing version 0.4.1 to 0.4.2
var fs = require('fs'); | ||
var path = require('path'); | ||
var createSandbox = require('./sandbox').createSandbox; | ||
var runInSandbox = require('./sandbox').runInSandbox; | ||
var Contextify = require('contextify'); | ||
var SimpleDOM = require('simple-dom'); | ||
@@ -36,6 +35,9 @@ var RSVP = require('rsvp'); | ||
runInSandbox(vendorFilePath, sandbox); | ||
var appFile = fs.readFileSync(appFilePath, 'utf8'); | ||
var vendorFile = fs.readFileSync(vendorFilePath, 'utf8'); | ||
sandbox.run(vendorFile, vendorFilePath); | ||
debug("vendor file evaluated"); | ||
runInSandbox(appFilePath, sandbox); | ||
sandbox.run(appFile, appFilePath); | ||
debug("app file evaluated"); | ||
@@ -74,2 +76,38 @@ | ||
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 = { | ||
// 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) { | ||
@@ -76,0 +114,0 @@ return function(moduleName) { |
@@ -104,3 +104,3 @@ var chalk = require('chalk'); | ||
return { | ||
appFile: path.join(distPath, manifest.appFile), | ||
appFile: path.join(distPath, manifest.appFile), | ||
vendorFile: path.join(distPath, manifest.vendorFile), | ||
@@ -111,3 +111,3 @@ htmlFile: path.join(distPath, manifest.htmlFile), | ||
} catch (e) { | ||
console.error("Couldn't find %s. You may need to update your version of ember-cli-fastboot.", pkgPath); | ||
console.log("Couldn't find %s. You may need to update your version of ember-cli-fastboot.", pkgPath); | ||
} | ||
@@ -114,0 +114,0 @@ } |
{ | ||
"name": "ember-fastboot-server", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Production server for running Ember applications using FastBoot", | ||
"main": "./lib/server", | ||
"scripts": { | ||
"postinstall": "scripts/is-legacy-vm && npm install contextify@^0.1.11", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -29,2 +28,3 @@ }, | ||
"chalk": "^0.5.1", | ||
"contextify": "^0.1.11", | ||
"debug": "^2.1.0", | ||
@@ -31,0 +31,0 @@ "express": "^4.13.3", |
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
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
0
3
10967
9
6
183
+ Addedcontextify@^0.1.11
+ Addedbindings@1.5.0(transitive)
+ Addedcontextify@0.1.15(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addednan@2.22.0(transitive)