diff --git a/bin/cmd.js b/bin/cmd.js
index 1859849..0c3a4ef 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -26,6 +26,7 @@ var path = require('path');
var prelude = fs.readFileSync(__dirname + '/../bundle/prelude.js', 'utf8');
var bundle, launch;
+var bundleId = Math.floor(Math.pow(16,8)*Math.random()).toString(16);
var scripts = [];
var htmlQueue = [];
var pending = 4;
@@ -61,7 +62,6 @@ if ((process.stdin.isTTY || argv._.length) && argv._[0] !== '-') {
);
return;
}
- var bundleId = Math.floor(Math.pow(16,8)*Math.random()).toString(16);
if (pkg.testling.preprocess) {
pending += 1;
@@ -160,6 +160,10 @@ var server = http.createServer(function (req, res) {
res.setHeader('content-type', 'text/html');
getHTML(function (html) { res.end(html) });
}
+ else if (u.replace(/\/$/, '') === '/__testling/' + bundleId + '.js') {
+ res.setHeader('content-type', 'application/javascript');
+ res.end(bundle);
+ }
else if (u.split('/')[1] === '__testling') {
req.url = req.url.replace(/^\/__testling/, '');
ecstatic(req, res);
@@ -313,7 +317,7 @@ function getHTML (cb) {
+ ent.encode(s) + '">'
;
}).join('\n')
- + ''
+ + ''
+ after
+ '