Comparing version 0.7.5 to 0.8.0
@@ -12,11 +12,2 @@ var http = require('http'); | ||
} | ||
else if (!res.finished) { | ||
process.nextTick(function () { | ||
if (!res.finished) { | ||
res.setCode = 404; | ||
res.setHeader('content-type', 'text/html'); | ||
res.end('not found'); | ||
} | ||
}); | ||
} | ||
}); | ||
@@ -23,0 +14,0 @@ |
@@ -8,5 +8,4 @@ var net = require('net'); | ||
var Lazy = require('lazy'); | ||
var SocketIO = require('./lib/stream_socketio'); | ||
var SocketIO = null; | ||
exports = module.exports = dnode; | ||
@@ -172,3 +171,2 @@ | ||
// a webserver, use socket.io | ||
if (!SocketIO) SocketIO = require('./lib/stream_socketio'); | ||
server = SocketIO( | ||
@@ -175,0 +173,0 @@ server || params.webserver, |
var EventEmitter = require('events').EventEmitter; | ||
var io = require('socket.io'); | ||
var fs = require('fs'); | ||
var browserify = require('browserify'); | ||
var dnodeSrc = 'var DNode = (function () {' | ||
+ browserify.bundle({ require : 'dnode' }) | ||
+ '; return require("dnode") })()' | ||
; | ||
var bundle = (function () { | ||
var cache = null; | ||
var file = __dirname + '/../browser/bundle.js'; | ||
return function (res) { | ||
if (cache) { | ||
res.statusCode = 200; | ||
res.setHeader('content-type', 'text/javascript'); | ||
res.end(cache); | ||
} | ||
else fs.readFile(file, function (err, src) { | ||
if (err) { | ||
console.error(err); | ||
res.statusCode = 500; | ||
res.setHeader('content-type', 'text/plain'); | ||
res.end('an error occured loading the bundle'); | ||
} | ||
else { | ||
cache = src; | ||
bundle(res); | ||
} | ||
}); | ||
}; | ||
})(); | ||
@@ -17,6 +36,4 @@ module.exports = function (webserver, mount, ioOptions) { | ||
webserver.use(function (req, res, next) { | ||
if (req.url === mount) { | ||
res.statusCode = 200; | ||
res.setHeader('content-type', 'text/javascript'); | ||
res.end(dnodeSrc); | ||
if (req.url.split('?')[0] === mount) { | ||
bundle(res); | ||
} | ||
@@ -34,6 +51,4 @@ else next() | ||
ev.request.push(function (req, res) { | ||
if (!res.finished && req.url === mount) { | ||
res.statusCode = 200; | ||
res.setHeader('content-type', 'text/javascript'); | ||
res.end(dnodeSrc); | ||
if (!res.finished && req.url.split('?')[0] === mount) { | ||
bundle(res); | ||
} | ||
@@ -40,0 +55,0 @@ }); |
{ | ||
"name" : "dnode", | ||
"version" : "0.7.5", | ||
"version" : "0.8.0", | ||
"description" : "freestyle RPC", | ||
@@ -27,8 +27,9 @@ "main" : "./index.js", | ||
"lazy" : ">=1.0.5 <1.1", | ||
"traverse" : ">=0.3.1 <0.4", | ||
"browserify" : ">=1.1.3 <1.2", | ||
"traverse" : "0.4.x", | ||
"dnode-protocol" : ">=0.0.12 <0.1" | ||
}, | ||
"devDependencies" : { | ||
"expresso" : ">=0.7.6 <0.8" | ||
"expresso" : "0.7.x", | ||
"browserify" : "1.4.x", | ||
"uglify-js" : "1.0.6" | ||
}, | ||
@@ -35,0 +36,0 @@ "browserify" : "browser/index.js", |
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
194913
4
65
3372
312
3
3
11
10
+ Addedtraverse@0.4.6(transitive)
- Removedbrowserify@>=1.1.3 <1.2
- Removedbrowserify@1.1.4(transitive)
- Removedburrito@0.2.12(transitive)
- Removedcoffee-script@1.1.3(transitive)
- Removeddetective@0.0.4(transitive)
- Removedresolve@0.0.4(transitive)
- Removedtraverse@0.3.90.5.2(transitive)
- Removeduglify-js@1.1.1(transitive)
Updatedtraverse@0.4.x