first draft of node.js REPL

This commit is contained in:
Jeremy Ashkenas
2010-01-29 22:51:51 -05:00
parent 83285fe170
commit ba2d9df25f
5 changed files with 95 additions and 1 deletions

15
src/coffee-script.coffee Normal file
View File

@@ -0,0 +1,15 @@
# Executes the `coffee` Ruby program to convert from CoffeeScript to JavaScript.
sys: require('sys')
exports.compile: (code, callback) ->
js: ''
coffee: process.createChildProcess 'coffee', ['--eval', '--no-wrap', '--globals']
coffee.addListener 'output', (results) ->
js += results if results?
coffee.addListener 'exit', ->
callback(js)
coffee.write(code)
coffee.close()