lib/coffee_script/narwhal/coffee-script.coffee in coffee-script-0.2.1 vs lib/coffee_script/narwhal/coffee-script.coffee in coffee-script-0.2.2
- old
+ new
@@ -27,11 +27,11 @@
return true
while true
try
system.stdout.write('coffee> ').flush()
- result: exports.evalCS(Readline.readline())
+ result: exports.evalCS(Readline.readline(), ['--globals'])
print(result) if result isnt undefined
catch e
print(e)
# Compile a given CoffeeScript file into JavaScript.
@@ -39,18 +39,18 @@
coffee: OS.popen([coffeePath, "--print", "--no-wrap", path])
checkForErrors(coffee)
coffee.stdout.read()
# Compile a string of CoffeeScript into JavaScript.
-exports.compile: source =>
- coffee: OS.popen([coffeePath, "--eval", "--no-wrap"])
+exports.compile: source, flags =>
+ coffee: OS.popen([coffeePath, "--eval", "--no-wrap"].concat(flags or []))
coffee.stdin.write(source).flush().close()
checkForErrors(coffee)
coffee.stdout.read()
# Evaluating a string of CoffeeScript first compiles it externally.
-exports.evalCS: source =>
- eval(exports.compile(source))
+exports.evalCS: source, flags =>
+ eval(exports.compile(source, flags))
# Make a factory for the CoffeeScript environment.
exports.makeNarwhalFactory: path =>
code: exports.compileFile(path)
factoryText: "function(require,exports,module,system,print){" + code + "/**/\n}"