Permalink
Browse files

Get ready to launch this so that it can coexist with legacy

coffee-script
  • Loading branch information...
1 parent 6e38a46 commit 0efbce3fbfb7ad270399301f7f4f5ad2ef0f9bac @maxtaco committed Jan 18, 2012
Showing with 21 additions and 12 deletions.
  1. +7 −7 package.json
  2. +14 −5 src/coffee-script.coffee
View
@@ -1,8 +1,8 @@
{
- "name": "coffee-script",
- "description": "Unfancy JavaScript",
+ "name": "taco-script",
+ "description": "TAmed COffeeScript"
"keywords": ["javascript", "language", "coffeescript", "compiler"],
- "author": "Jeremy Ashkenas",
+ "author": "Maxwell Krohn",
"version": "1.2.1-pre",
"licenses": [{
"type": "MIT",
@@ -16,13 +16,13 @@
},
"main" : "./lib/coffee-script/coffee-script",
"bin": {
- "coffee": "./bin/coffee",
- "cake": "./bin/cake"
+ "taco": "./bin/coffee",
+ "take": "./bin/cake"
},
- "homepage": "http://coffeescript.org",
+ "homepage": "http://maxtaco.github.com/coffee-script",
"repository": {
"type": "git",
- "url": "git://github.com/jashkenas/coffee-script.git"
+ "url": "git://github.com/maxtaco/coffee-script.git"
},
"devDependencies": {
"uglify-js": ">=1.0.0",
View
@@ -13,14 +13,23 @@ path = require 'path'
tame = require './tame'
vm = require 'vm'
+# Native extensions we're willing to consider
+exports.EXTENSIONS = EXTENSIONS = [ ".coffee", ".toffee"]
+
+isCoffeeFile = (file) ->
+ for e in EXTENSIONS
+ return true if path.extname(file) is e
+ false
# TODO: Remove registerExtension when fully deprecated.
if require.extensions
- require.extensions['.coffee'] = (module, filename) ->
- content = compile fs.readFileSync(filename, 'utf8'), {filename}
- module._compile content, filename
+ for e in EXTENSIONS
+ require.extensions[e] = (module, filename) ->
+ content = compile fs.readFileSync(filename, 'utf8'), {filename}
+ module._compile content, filename
else if require.registerExtension
- require.registerExtension '.coffee', (content) -> compile content
+ for e in EXTENSIONS
+ require.registerExtension e, (content) -> compile content
# The current CoffeeScript version number.
exports.VERSION = '1.2.1-pre'
@@ -73,7 +82,7 @@ exports.run = (code, options = {}) ->
mainModule.paths = require('module')._nodeModulePaths path.dirname options.filename
# Compile.
- if path.extname(mainModule.filename) isnt '.coffee' or require.extensions
+ if not isCoffeeFile mainModule.filename or require.extensions
mainModule._compile compile(code, options), mainModule.filename
else
mainModule._compile code, mainModule.filename

0 comments on commit 0efbce3

Please sign in to comment.