coffeescript
Advanced tools
Comparing version 1.7.0 to 1.8.0
## How to contribute to CoffeeScript | ||
* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffee-script/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. | ||
* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffeescript/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. | ||
* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffee-script/tree/master/test). | ||
* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffeescript/tree/master/test). | ||
* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffee-script/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). | ||
* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffeescript/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). | ||
* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CoffeeScript, compile, runScripts, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -15,2 +15,4 @@ var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; | ||
CoffeeScript.register(); | ||
tasks = {}; | ||
@@ -17,0 +19,0 @@ |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var Lexer, SourceMap, compile, formatSourcePosition, fs, getSourceMap, helpers, lexer, parser, path, sourceMaps, vm, withPrettyErrors, | ||
var Lexer, SourceMap, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, lexer, parser, path, sourceMaps, vm, withPrettyErrors, _base, _i, _len, _ref, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -21,3 +21,3 @@ __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; }; | ||
exports.VERSION = '1.7.0'; | ||
exports.VERSION = '1.8.0'; | ||
@@ -114,3 +114,3 @@ exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md']; | ||
mainModule.moduleCache && (mainModule.moduleCache = {}); | ||
dir = options.fileName ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.'); | ||
dir = options.filename ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.'); | ||
mainModule.paths = require('module')._nodeModulePaths(dir); | ||
@@ -191,2 +191,14 @@ if (!helpers.isCoffee(mainModule.filename) || require.extensions) { | ||
if (require.extensions) { | ||
_ref = this.FILE_EXTENSIONS; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
ext = _ref[_i]; | ||
if ((_base = require.extensions)[ext] == null) { | ||
_base[ext] = function() { | ||
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files."); | ||
}; | ||
} | ||
} | ||
} | ||
exports._compileFile = function(filename, sourceMap) { | ||
@@ -239,5 +251,5 @@ var answer, err, raw, stripped; | ||
parser.yy.parseError = function(message, _arg) { | ||
var errorLoc, errorTag, errorText, errorToken, token, tokens, _ref; | ||
var errorLoc, errorTag, errorText, errorToken, token, tokens, _ref1; | ||
token = _arg.token; | ||
_ref = parser.lexer, errorToken = _ref.errorToken, tokens = _ref.tokens; | ||
_ref1 = parser.lexer, errorToken = _ref1.errorToken, tokens = _ref1.tokens; | ||
errorTag = errorToken[0], errorText = errorToken[1], errorLoc = errorToken[2]; | ||
@@ -299,7 +311,7 @@ errorText = errorToken === tokens[tokens.length - 1] ? 'end of input' : errorTag === 'INDENT' || errorTag === 'OUTDENT' ? 'indentation' : helpers.nameWhitespaceCharacter(errorText); | ||
getSourceMap = function(filename) { | ||
var answer, _ref; | ||
var answer, _ref1; | ||
if (sourceMaps[filename]) { | ||
return sourceMaps[filename]; | ||
} | ||
if (_ref = path != null ? path.extname(filename) : void 0, __indexOf.call(exports.FILE_EXTENSIONS, _ref) < 0) { | ||
if (_ref1 = path != null ? path.extname(filename) : void 0, __indexOf.call(exports.FILE_EXTENSIONS, _ref1) < 0) { | ||
return; | ||
@@ -312,3 +324,3 @@ } | ||
Error.prepareStackTrace = function(err, stack) { | ||
var frame, frames, getSourceMapping, _ref; | ||
var frame, frames, getSourceMapping; | ||
getSourceMapping = function(filename, line, column) { | ||
@@ -327,6 +339,6 @@ var answer, sourceMap; | ||
frames = (function() { | ||
var _i, _len, _results; | ||
var _j, _len1, _results; | ||
_results = []; | ||
for (_i = 0, _len = stack.length; _i < _len; _i++) { | ||
frame = stack[_i]; | ||
for (_j = 0, _len1 = stack.length; _j < _len1; _j++) { | ||
frame = stack[_j]; | ||
if (frame.getFunction() === exports.run) { | ||
@@ -339,5 +351,5 @@ break; | ||
})(); | ||
return "" + err.name + ": " + ((_ref = err.message) != null ? _ref : '') + "\n" + (frames.join('\n')) + "\n"; | ||
return "" + (err.toString()) + "\n" + (frames.join('\n')) + "\n"; | ||
}; | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -40,3 +40,3 @@ var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs, _ref, | ||
SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-m', '--map', 'generate source map and save as .map files'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['--no-header', 'suppress the "Generated by" header'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-l', '--literate', 'treat stdio as literate style coffee-script'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']]; | ||
SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-m', '--map', 'generate source map and save as .js.map files'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['--no-header', 'suppress the "Generated by" header'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-l', '--literate', 'treat stdio as literate style coffee-script'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']]; | ||
@@ -90,2 +90,3 @@ opts = {}; | ||
opts.join = path.resolve(opts.join); | ||
console.error('\nThe --join option is deprecated and will be removed in a future version.\n\nIf for some reason it\'s necessary to share local variables between files,\nreplace...\n\n $ coffee --compile --join bundle.js -- a.coffee b.coffee c.coffee\n\nwith...\n\n $ cat a.coffee b.coffee c.coffee | coffee --compile --stdio > bundle.js\n'); | ||
} | ||
@@ -410,3 +411,3 @@ _ref1 = opts["arguments"]; | ||
silentUnlink(outputPath(source, base)); | ||
silentUnlink(outputPath(source, base, '.map')); | ||
silentUnlink(outputPath(source, base, '.js.map')); | ||
return timeLog("removed " + source); | ||
@@ -450,3 +451,3 @@ } | ||
} | ||
sourceMapPath = outputPath(sourcePath, base, ".map"); | ||
sourceMapPath = outputPath(sourcePath, base, ".js.map"); | ||
jsDir = path.dirname(jsPath); | ||
@@ -463,3 +464,4 @@ compile = function() { | ||
if (err) { | ||
return printLine(err.message); | ||
printLine(err.message); | ||
return process.exit(1); | ||
} else if (opts.compile && opts.watch) { | ||
@@ -473,3 +475,4 @@ return timeLog("compiled " + sourcePath); | ||
if (err) { | ||
return printLine("Could not write source map: " + err.message); | ||
printLine("Could not write source map: " + err.message); | ||
return process.exit(1); | ||
} | ||
@@ -476,0 +479,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -223,3 +223,3 @@ var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref; | ||
end = first_line === last_line ? last_column + 1 : codeLine.length; | ||
marker = repeat(' ', start) + repeat('^', end - start); | ||
marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start); | ||
if (typeof process !== "undefined" && process !== null) { | ||
@@ -226,0 +226,0 @@ colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var key, val, _ref; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -169,6 +169,6 @@ var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, UNARY_MATH, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _ref, _ref1, | ||
Lexer.prototype.stringToken = function() { | ||
var octalEsc, quote, string, trimmed; | ||
var inner, innerLen, numBreak, octalEsc, pos, quote, string, trimmed; | ||
switch (quote = this.chunk.charAt(0)) { | ||
case "'": | ||
string = SIMPLESTR.exec(this.chunk)[0]; | ||
string = (SIMPLESTR.exec(this.chunk) || [])[0]; | ||
break; | ||
@@ -181,6 +181,12 @@ case '"': | ||
} | ||
trimmed = this.removeNewlines(string.slice(1, -1)); | ||
inner = string.slice(1, -1); | ||
trimmed = this.removeNewlines(inner); | ||
if (quote === '"' && 0 < string.indexOf('#{', 1)) { | ||
numBreak = pos = 0; | ||
innerLen = inner.length; | ||
while (inner.charAt(pos++) === '\n' && pos < innerLen) { | ||
numBreak++; | ||
} | ||
this.interpolateString(trimmed, { | ||
strOffset: 1, | ||
strOffset: 1 + numBreak, | ||
lexedLength: string.length | ||
@@ -198,3 +204,3 @@ }); | ||
Lexer.prototype.heredocToken = function() { | ||
var doc, heredoc, match, quote; | ||
var doc, heredoc, match, quote, strOffset; | ||
if (!(match = HEREDOC.exec(this.chunk))) { | ||
@@ -210,5 +216,6 @@ return 0; | ||
if (quote === '"' && 0 <= doc.indexOf('#{')) { | ||
strOffset = match[2].charAt(0) === '\n' ? 4 : 3; | ||
this.interpolateString(doc, { | ||
heredoc: true, | ||
strOffset: 3, | ||
strOffset: strOffset, | ||
lexedLength: heredoc.length | ||
@@ -290,3 +297,4 @@ }); | ||
_ref2 = this.interpolateString(body, { | ||
regex: true | ||
regex: true, | ||
strOffset: 3 | ||
}); | ||
@@ -633,3 +641,3 @@ for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
if (inner.length) { | ||
_ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1]; | ||
_ref2 = this.getLineAndColumnFromChunk(strOffset + i + 2), line = _ref2[0], column = _ref2[1]; | ||
nested = new Lexer().tokenize(inner, { | ||
@@ -636,0 +644,0 @@ line: line, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, loadFile, path, _i, _len, _ref; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var CoffeeScript, addHistory, addMultilineHandler, fs, merge, nodeREPL, path, replDefaults, updateSyntaxError, vm, _ref; | ||
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, updateSyntaxError, vm, _ref; | ||
@@ -44,10 +44,11 @@ fs = require('fs'); | ||
addMultilineHandler = function(repl) { | ||
var inputStream, multiline, nodeLineListener, outputStream, rli; | ||
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, rli, _ref1; | ||
rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream; | ||
origPrompt = (_ref1 = repl._prompt) != null ? _ref1 : repl.prompt; | ||
multiline = { | ||
enabled: false, | ||
initialPrompt: repl.prompt.replace(/^[^> ]*/, function(x) { | ||
initialPrompt: origPrompt.replace(/^[^> ]*/, function(x) { | ||
return x.replace(/./g, '-'); | ||
}), | ||
prompt: repl.prompt.replace(/^[^> ]*>?/, function(x) { | ||
prompt: origPrompt.replace(/^[^> ]*>?/, function(x) { | ||
return x.replace(/./g, '.'); | ||
@@ -65,2 +66,3 @@ }), | ||
} else { | ||
rli.setPrompt(origPrompt); | ||
nodeLineListener(cmd); | ||
@@ -76,3 +78,3 @@ } | ||
multiline.enabled = !multiline.enabled; | ||
rli.setPrompt(repl.prompt); | ||
rli.setPrompt(origPrompt); | ||
rli.prompt(true); | ||
@@ -129,3 +131,3 @@ return; | ||
}); | ||
return repl.commands['.history'] = { | ||
return repl.commands[getCommandId(repl, 'history')] = { | ||
help: 'Show command history', | ||
@@ -139,2 +141,12 @@ action: function() { | ||
getCommandId = function(repl, commandName) { | ||
var commandsHaveLeadingDot; | ||
commandsHaveLeadingDot = repl.commands['.help'] != null; | ||
if (commandsHaveLeadingDot) { | ||
return "." + commandName; | ||
} else { | ||
return commandName; | ||
} | ||
}; | ||
module.exports = { | ||
@@ -164,2 +176,3 @@ start: function(opts) { | ||
} | ||
repl.commands[getCommandId(repl, 'load')].help = 'Load code from a file into this REPL session'; | ||
return repl; | ||
@@ -166,0 +179,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Scope, extend, last, _ref; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.0 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var LineMap, SourceMap; |
@@ -11,3 +11,3 @@ { | ||
"author": "Jeremy Ashkenas", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"license": "MIT", | ||
@@ -25,2 +25,3 @@ "engines": { | ||
}, | ||
"preferGlobal": true, | ||
"scripts": { | ||
@@ -30,6 +31,6 @@ "test": "node ./bin/cake test" | ||
"homepage": "http://coffeescript.org", | ||
"bugs": "https://github.com/jashkenas/coffee-script/issues", | ||
"bugs": "https://github.com/jashkenas/coffeescript/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jashkenas/coffee-script.git" | ||
"url": "git://github.com/jashkenas/coffeescript.git" | ||
}, | ||
@@ -40,3 +41,4 @@ "devDependencies": { | ||
"highlight.js": "~8.0.0", | ||
"underscore": "~1.5.2" | ||
"underscore": "~1.5.2", | ||
"docco": "~0.6.2" | ||
}, | ||
@@ -43,0 +45,0 @@ "dependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
370524
27
7711
5