unifying the CoffeeScript.compile and CoffeeScript.run apis to be the same -- source code and options hash.

This commit is contained in:
Jeremy Ashkenas
2010-03-07 22:17:45 -05:00
parent 5b9ebd19d5
commit 1cf0326183
9 changed files with 31 additions and 28 deletions

View File

@@ -41,10 +41,9 @@ exports.nodes: (code) ->
# Compile and execute a string of CoffeeScript (on the server), correctly
# setting `__filename`, `__dirname`, and relative `require()`.
exports.run: (code, source, options) ->
options ||= {}
module.filename: __filename: options.source: source
__dirname: path.dirname source
exports.run: (code, options) ->
module.filename: __filename: options.source
__dirname: path.dirname __filename
eval exports.compile code, options
# The real Lexer produces a generic stream of tokens. This object provides a