Skip to content
Browse files

node: ensured bare compilation on `.run`

  • Loading branch information...
1 parent 4bbb522 commit e2b3eeeff11e424ee9626827ebda9046e6ac1f77 @satyr committed Apr 11, 2012
Showing with 8 additions and 3 deletions.
  1. +7 −2 lib/node.js
  2. +1 −1 src/node.co
View
9 lib/node.js
@@ -4,7 +4,7 @@ module.exports = function(Coco){
fs = require('fs');
path = require('path');
Coco.run = function(code, options, js){
- var filename, main, dirname;
+ var filename, main, dirname, __ref;
if (options != null) {
filename = options.filename;
}
@@ -16,7 +16,7 @@ module.exports = function(Coco){
}
main.paths = main.constructor._nodeModulePaths(dirname);
main.filename = filename;
- js || (code = Coco.compile(code, options));
+ js || (code = Coco.compile(code, (__ref = {}, __import(__ref, options), __ref.bare = true, __ref)));
try {
return main._compile(code, filename);
} catch (e) {
@@ -66,6 +66,11 @@ function hackTrace(error, js, filename){
}
return error.stack = traces.join('\n'), error;
}
+function __import(obj, src){
+ var own = {}.hasOwnProperty;
+ for (var key in src) if (own.call(src, key)) obj[key] = src[key];
+ return obj;
+}
function __importAll(obj, src){
for (var key in src) obj[key] = src[key];
return obj;
View
2 src/node.co
@@ -17,7 +17,7 @@ module.exports = !(Coco) ->
dirname = filename = \.
main.paths = main.._nodeModulePaths dirname
main <<< {filename}
- js or code = Coco.compile code, options
+ js or code = Coco.compile code, {...options, +bare}
try main._compile code, filename catch throw hackTrace e, code, filename
Coco import all require(\events)EventEmitter::

0 comments on commit e2b3eee

Please sign in to comment.
Something went wrong with that request. Please try again.