diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index 61f4a1da..b885f693 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -1,8 +1,7 @@ // Generated by CoffeeScript 1.10.0 (function() { var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors, - hasProp = {}.hasOwnProperty, - indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + hasProp = {}.hasOwnProperty; fs = require('fs'); @@ -369,15 +368,19 @@ sourceMaps = {}; getSourceMap = function(filename) { - var answer, ref1; + var answer, j, len1, ref1; if (sourceMaps[filename]) { return sourceMaps[filename]; } - if (ref1 = path != null ? path.extname(filename) : void 0, indexOf.call(exports.FILE_EXTENSIONS, ref1) < 0) { - return; + ref1 = exports.FILE_EXTENSIONS; + for (j = 0, len1 = ref1.length; j < len1; j++) { + ext = ref1[j]; + if (helpers.ends(filename, ext)) { + answer = exports._compileFile(filename, true); + return sourceMaps[filename] = answer.sourceMap; + } } - answer = exports._compileFile(filename, true); - return sourceMaps[filename] = answer.sourceMap; + return null; }; Error.prepareStackTrace = function(err, stack) { diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index eb3e3bd5..9cfd0acd 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -334,9 +334,11 @@ sourceMaps = {} # Generates the source map for a coffee file and stores it in the local cache variable. getSourceMap = (filename) -> return sourceMaps[filename] if sourceMaps[filename] - return unless path?.extname(filename) in exports.FILE_EXTENSIONS - answer = exports._compileFile filename, true - sourceMaps[filename] = answer.sourceMap + for ext in exports.FILE_EXTENSIONS + if helpers.ends filename, ext + answer = exports._compileFile filename, true + return sourceMaps[filename] = answer.sourceMap + return null # Based on [michaelficarra/CoffeeScriptRedux](http://goo.gl/ZTx1p) # NodeJS / V8 have no support for transforming positions in stack traces using