coffeescript
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -7,3 +7,3 @@ // This **Browser** compatibility layer extends core CoffeeScript functions | ||
// `text/coffeescript` script tags, source maps via data-URLs, and so on. | ||
var CoffeeScript, compile, runScripts, | ||
var CoffeeScript, compile, | ||
indexOf = [].indexOf; | ||
@@ -85,3 +85,3 @@ | ||
// This happens on page load. | ||
runScripts = function() { | ||
CoffeeScript.runScripts = function() { | ||
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts; | ||
@@ -141,8 +141,14 @@ scripts = window.document.getElementsByTagName('script'); | ||
// Listen for window load, both in decent browsers and in IE. | ||
if (window.addEventListener) { | ||
window.addEventListener('DOMContentLoaded', runScripts, false); | ||
} else { | ||
window.attachEvent('onload', runScripts); | ||
// Only attach this event handler on startup for the | ||
// non-ES module version of the browser compiler, to preserve | ||
// backward compatibility while letting the ES module version | ||
// be importable without side effects. | ||
if (this === window) { | ||
if (window.addEventListener) { | ||
window.addEventListener('DOMContentLoaded', CoffeeScript.runScripts, false); | ||
} else { | ||
window.attachEvent('onload', CoffeeScript.runScripts); | ||
} | ||
} | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // `cake` is a simplified version of [Make](http://www.gnu.org/software/make/) |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -7,3 +7,3 @@ // CoffeeScript can be used both on the server, as a command-line compiler based | ||
// source CoffeeScript into JavaScript. | ||
var FILE_EXTENSIONS, Lexer, SourceMap, base64encode, checkShebangLine, compile, formatSourcePosition, getSourceMap, helpers, lexer, packageJson, parser, sourceMaps, sources, withPrettyErrors, | ||
var FILE_EXTENSIONS, Lexer, SourceMap, base64encode, checkShebangLine, compile, formatSourcePosition, getSourceMap, helpers, lexer, packageJson, parser, registerCompiled, sourceMaps, sources, withPrettyErrors, | ||
indexOf = [].indexOf; | ||
@@ -78,2 +78,20 @@ | ||
// This is exported to enable an external module to implement caching of | ||
// compilation results. When the compiled js source is loaded from cache, the | ||
// original coffee code should be added with this method in order to enable the | ||
// Error.prepareStackTrace below to correctly adjust the stack trace for the | ||
// corresponding file (the source map will be generated on demand). | ||
exports.registerCompiled = registerCompiled = function(filename, source, sourcemap) { | ||
if (sources[filename] == null) { | ||
sources[filename] = []; | ||
} | ||
sources[filename].push(source); | ||
if (sourcemap != null) { | ||
if (sourceMaps[filename] == null) { | ||
sourceMaps[filename] = []; | ||
} | ||
return sourceMaps[filename].push(sourcemap); | ||
} | ||
}; | ||
// Compile CoffeeScript code to JavaScript, using the Coffee/Jison compiler. | ||
@@ -99,6 +117,2 @@ | ||
checkShebangLine(filename, code); | ||
if (sources[filename] == null) { | ||
sources[filename] = []; | ||
} | ||
sources[filename].push(code); | ||
if (generateSourceMap) { | ||
@@ -168,6 +182,2 @@ map = new SourceMap; | ||
v3SourceMap = map.generate(options, code); | ||
if (sourceMaps[filename] == null) { | ||
sourceMaps[filename] = []; | ||
} | ||
sourceMaps[filename].push(map); | ||
} | ||
@@ -203,2 +213,3 @@ if (options.transpile) { | ||
} | ||
registerCompiled(filename, code, map); | ||
if (options.sourceMap) { | ||
@@ -205,0 +216,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // The `coffee` utility. Handles command-line compilation of CoffeeScript |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -335,2 +335,7 @@ // The CoffeeScript parser is generated by [Jison](https://github.com/zaach/jison) | ||
}), | ||
o('DYNAMIC_IMPORT Arguments', | ||
function() { | ||
return new DynamicImportCall(LOC(1)(new DynamicImport), | ||
$2); | ||
}), | ||
o('SimpleObjAssignable Arguments', | ||
@@ -945,2 +950,7 @@ function() { | ||
$1); | ||
}), | ||
o('DYNAMIC_IMPORT Arguments', | ||
function() { | ||
return new DynamicImportCall(LOC(1)(new DynamicImport), | ||
$2); | ||
}) | ||
@@ -2118,3 +2128,3 @@ ], | ||
// (2 + 3) * 4 | ||
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['right', 'AWAIT'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', '&'], ['left', '^'], ['left', '|'], ['left', '&&'], ['left', '||'], ['left', 'BIN?'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', 'YIELD'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'FORFROM', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'IMPORT', 'EXPORT'], ['left', 'POST_IF']]; | ||
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['right', 'AWAIT'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', '&'], ['left', '^'], ['left', '|'], ['left', '&&'], ['left', '||'], ['left', 'BIN?'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', 'YIELD'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'FORFROM', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'IMPORT', 'EXPORT', 'DYNAMIC_IMPORT'], ['left', 'POST_IF']]; | ||
@@ -2121,0 +2131,0 @@ // Wrapping Up |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // This file contains the common helper functions that we'd like to share among |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -155,5 +155,4 @@ // Node.js Implementation | ||
CoffeeScript._compileFile = function(filename, options = {}) { | ||
var answer, err, raw, stripped; | ||
raw = fs.readFileSync(filename, 'utf8'); | ||
CoffeeScript._compileRawFileContent = function(raw, filename, options = {}) { | ||
var answer, err, stripped; | ||
// Strip the Unicode byte order mark, if this file begins with one. | ||
@@ -179,4 +178,10 @@ stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw; | ||
CoffeeScript._compileFile = function(filename, options = {}) { | ||
var raw; | ||
raw = fs.readFileSync(filename, 'utf8'); | ||
return CoffeeScript._compileRawFileContent(raw, filename, options); | ||
}; | ||
module.exports = CoffeeScript; | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.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 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, getRootModule, helpers, i, len, loadFile, path, ref; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -116,4 +116,4 @@ var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, runInContext, sawSIGINT, transpile, updateSyntaxError, vm; | ||
addMultilineHandler = function(repl) { | ||
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, ref, rli; | ||
({rli, inputStream, outputStream} = repl); | ||
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, ref; | ||
({inputStream, outputStream} = repl); | ||
// Node 0.11.12 changed API, prompt is now _prompt. | ||
@@ -132,11 +132,11 @@ origPrompt = (ref = repl._prompt) != null ? ref : repl.prompt; | ||
// Proxy node's line listener | ||
nodeLineListener = rli.listeners('line')[0]; | ||
rli.removeListener('line', nodeLineListener); | ||
rli.on('line', function(cmd) { | ||
nodeLineListener = repl.listeners('line')[0]; | ||
repl.removeListener('line', nodeLineListener); | ||
repl.on('line', function(cmd) { | ||
if (multiline.enabled) { | ||
multiline.buffer += `${cmd}\n`; | ||
rli.setPrompt(multiline.prompt); | ||
rli.prompt(true); | ||
repl.setPrompt(multiline.prompt); | ||
repl.prompt(true); | ||
} else { | ||
rli.setPrompt(origPrompt); | ||
repl.setPrompt(origPrompt); | ||
nodeLineListener(cmd); | ||
@@ -154,8 +154,8 @@ } | ||
multiline.enabled = !multiline.enabled; | ||
rli.setPrompt(origPrompt); | ||
rli.prompt(true); | ||
repl.setPrompt(origPrompt); | ||
repl.prompt(true); | ||
return; | ||
} | ||
// no-op unless the current line is empty | ||
if ((rli.line != null) && !rli.line.match(/^\s*$/)) { | ||
if ((repl.line != null) && !repl.line.match(/^\s*$/)) { | ||
return; | ||
@@ -165,14 +165,14 @@ } | ||
multiline.enabled = !multiline.enabled; | ||
rli.line = ''; | ||
rli.cursor = 0; | ||
rli.output.cursorTo(0); | ||
rli.output.clearLine(1); | ||
repl.line = ''; | ||
repl.cursor = 0; | ||
repl.output.cursorTo(0); | ||
repl.output.clearLine(1); | ||
// XXX: multiline hack | ||
multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00'); | ||
rli.emit('line', multiline.buffer); | ||
repl.emit('line', multiline.buffer); | ||
multiline.buffer = ''; | ||
} else { | ||
multiline.enabled = !multiline.enabled; | ||
rli.setPrompt(multiline.initialPrompt); | ||
rli.prompt(true); | ||
repl.setPrompt(multiline.initialPrompt); | ||
repl.prompt(true); | ||
} | ||
@@ -196,16 +196,16 @@ }); | ||
// Set the history on the interpreter | ||
repl.rli.history = buffer.toString().split('\n').reverse(); | ||
repl.history = buffer.toString().split('\n').reverse(); | ||
if (stat.size > maxSize) { | ||
// If the history file was truncated we should pop off a potential partial line | ||
repl.rli.history.pop(); | ||
repl.history.pop(); | ||
} | ||
if (repl.rli.history[0] === '') { | ||
if (repl.history[0] === '') { | ||
// Shift off the final blank newline | ||
repl.rli.history.shift(); | ||
repl.history.shift(); | ||
} | ||
repl.rli.historyIndex = -1; | ||
lastLine = repl.rli.history[0]; | ||
repl.historyIndex = -1; | ||
lastLine = repl.history[0]; | ||
} catch (error) {} | ||
fd = fs.openSync(filename, 'a'); | ||
repl.rli.addListener('line', function(code) { | ||
repl.addListener('line', function(code) { | ||
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) { | ||
@@ -228,3 +228,3 @@ // Save the latest command in the file | ||
action: function() { | ||
repl.outputStream.write(`${repl.rli.history.slice(0).reverse().join('\n')}\n`); | ||
repl.outputStream.write(`${repl.history.slice(0).reverse().join('\n')}\n`); | ||
return repl.displayPrompt(); | ||
@@ -292,3 +292,3 @@ } | ||
repl.on('exit', function() { | ||
if (!repl.rli.closed) { | ||
if (!repl.closed) { | ||
return repl.outputStream.write('\n'); | ||
@@ -295,0 +295,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // The CoffeeScript language has a good deal of optional syntax, implicit syntax, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // The **Scope** class regulates lexical scoping within CoffeeScript. As you |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.3.2 | ||
// Generated by CoffeeScript 2.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ // Source maps allow JavaScript runtimes to match running JavaScript back to |
@@ -11,3 +11,3 @@ { | ||
"author": "Jeremy Ashkenas", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"license": "MIT", | ||
@@ -21,2 +21,3 @@ "engines": { | ||
"main": "./lib/coffeescript/index", | ||
"module": "./docs/v2/browser-compiler-modern/coffeescript.js", | ||
"browser": "./lib/coffeescript/browser", | ||
@@ -44,14 +45,14 @@ "bin": { | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-preset-minify": "^0.4.3", | ||
"codemirror": "^5.39.2", | ||
"@babel/core": "^7.4.0", | ||
"@babel/preset-env": "^7.4.2", | ||
"babel-preset-minify": "^0.5.0", | ||
"codemirror": "^5.45.0", | ||
"docco": "~0.8.0", | ||
"highlight.js": "~9.12.0", | ||
"jison": ">=0.4.18", | ||
"highlight.js": "~9.15.6", | ||
"jison": "^0.4.18", | ||
"markdown-it": "~8.4.2", | ||
"underscore": "~1.9.1", | ||
"webpack": "~4.17.2" | ||
"webpack": "~4.29.6" | ||
}, | ||
"dependencies": {} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
671679
14434