Commit 5cc07032 authored by Leo Iannacone's avatar Leo Iannacone

Update libraries

parent 5b77e1b2
{
} } {
{ { } }
} }{ {
{ }{ } } _____ __ __
{ }{ }{ { } / ____| / _|/ _|
.- { { } { }} -. | | ___ | |_| |_ ___ ___
( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \
|`-..________ ..-'| | |___| (_) | | | || __/ __/
| | \_____\___/|_| |_| \___|\___|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|
CoffeeScript is a little language that compiles into JavaScript.
If you have the Node Package Manager installed:
npm install -g coffee-script
(Leave off the -g if you don't wish to install globally.)
Or, if you don't wish to use npm:
sudo bin/cake install
Execute a script:
coffee /path/to/script.coffee
Compile a script:
coffee -c /path/to/script.coffee
For documentation, usage, and examples, see:
http://coffeescript.org/
To suggest a feature, report a bug, or general discussion:
http://github.com/jashkenas/coffeescript/issues/
If you'd like to chat, drop by #coffeescript on Freenode IRC,
or on webchat.freenode.net.
The source repository:
git://github.com/jashkenas/coffeescript.git
Top 100 contributors are listed here:
http://github.com/jashkenas/coffeescript/contributors
......@@ -57,4 +57,6 @@ If you'd like to chat, drop by #coffeescript on Freenode IRC.
The source repository: https://github.com/jashkenas/coffeescript.git
Changelog: http://coffeescript.org/#changelog
Our lovely and talented contributors are listed here: http://github.com/jashkenas/coffeescript/contributors
{
"name": "coffee-script",
"version": "1.9.1",
"version": "1.10.0",
"main": [
"lib/coffee-script/coffee-script.js"
],
......
// Generated by CoffeeScript 1.9.1
// Generated by CoffeeScript 1.10.0
(function() {
var CoffeeScript, compile, runScripts,
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; };
......@@ -104,12 +104,13 @@
}
};
fn = function(script, i) {
var options;
var options, source;
options = {
literate: script.type === coffeetypes[1]
};
if (script.src) {
return CoffeeScript.load(script.src, function(param) {
source = script.src || script.getAttribute('data-src');
if (source) {
return CoffeeScript.load(source, function(param) {
coffees[i] = param;
return execute();
}, options, true);
......
// Generated by CoffeeScript 1.9.1
// Generated by CoffeeScript 1.10.0
(function() {
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
......@@ -46,7 +46,7 @@
});
exports.run = function() {
var arg, args, e, i, len, ref, results;
var arg, args, e, error, i, len, ref, results;
global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2);
......@@ -59,8 +59,8 @@
}
try {
options = oparse.parse(args);
} catch (_error) {
e = _error;
} catch (error) {
e = error;
return fatalError("" + e);
}
ref = options["arguments"];
......
// Generated by CoffeeScript 1.9.1
// Generated by CoffeeScript 1.10.0
(function() {
var Lexer, SourceMap, base, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors,
hasProp = {}.hasOwnProperty,
......@@ -18,7 +18,7 @@
SourceMap = require('./sourcemap');
exports.VERSION = '1.9.1';
exports.VERSION = '1.10.0';
exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md'];
......@@ -26,14 +26,17 @@
withPrettyErrors = function(fn) {
return function(code, options) {
var err;
var err, error;
if (options == null) {
options = {};
}
try {
return fn.call(this, code, options);
} catch (_error) {
err = _error;
} catch (error) {
err = error;
if (typeof code !== 'string') {
throw err;
}
throw helpers.updateSyntaxError(err, code, options.filename);
}
};
......@@ -71,7 +74,7 @@
for (i = 0, len = fragments.length; i < len; i++) {
fragment = fragments[i];
if (options.sourceMap) {
if (fragment.locationData) {
if (fragment.locationData && !/^[;\s]*$/.test(fragment.code)) {
map.add([fragment.locationData.first_line, fragment.locationData.first_column], [currentLine, currentColumn], {
noReplace: true
});
......@@ -172,7 +175,7 @@
ref3 = Object.getOwnPropertyNames(require);
for (i = 0, len = ref3.length; i < len; i++) {
r = ref3[i];
if (r !== 'paths') {
if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {
_require[r] = require[r];
}
}
......@@ -214,7 +217,7 @@
}
exports._compileFile = function(filename, sourceMap) {
var answer, err, raw, stripped;
var answer, err, error, raw, stripped;
if (sourceMap == null) {
sourceMap = false;
}
......@@ -226,8 +229,8 @@
sourceMap: sourceMap,
literate: helpers.isLiterate(filename)
});
} catch (_error) {
err = _error;
} catch (error) {
err = error;
throw helpers.updateSyntaxError(err, stripped, filename);
}
return answer;
......
// Generated by CoffeeScript 1.9.1
// Generated by CoffeeScript 1.10.0
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, jsToSources, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, ref, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs,
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, makePrelude, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, ref, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs,
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; };
fs = require('fs');
......@@ -35,7 +35,7 @@
BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.';
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']];
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'], ['-r', '--require [MODULE*]', 'require the given module before eval or REPL'], ['-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']];
opts = {};
......@@ -49,14 +49,16 @@
optionParser = null;
jsToSources = {};
exports.run = function() {
var i, len, literals, ref1, replCliOpts, results, source;
parseOptions();
replCliOpts = {
useGlobal: true
};
if (opts.require) {
opts.prelude = makePrelude(opts.require);
}
replCliOpts.prelude = opts.prelude;
if (opts.nodejs) {
return forkNode();
}
......@@ -98,15 +100,26 @@
return results;
};
makePrelude = function(requires) {
return requires.map(function(module) {
var _, match, name;
if (match = module.match(/^(.*)=(.*)$/)) {
_ = match[0], name = match[1], module = match[2];
}
name || (name = helpers.baseFileName(module, true, useWinPathSep));
return name + " = require('" + module + "')";
}).join(';');
};
compilePath = function(source, topLevel, base) {
var code, err, file, files, i, len, results, stats;
var code, err, error, error1, error2, file, files, i, len, results, stats;
if (indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) {
return;
}
try {
stats = fs.statSync(source);
} catch (_error) {
err = _error;
} catch (error) {
err = error;
if (err.code === 'ENOENT') {
console.error("File not found: " + source);
process.exit(1);
......@@ -127,8 +140,8 @@
}
try {
files = fs.readdirSync(source);
} catch (_error) {
err = _error;
} catch (error1) {
err = error1;
if (err.code === 'ENOENT') {
return;
} else {
......@@ -150,8 +163,8 @@
}
try {
code = fs.readFileSync(source);
} catch (_error) {
err = _error;
} catch (error2) {
err = error2;
if (err.code === 'ENOENT') {
return;
} else {
......@@ -165,7 +178,7 @@
};
findDirectoryIndex = function(source) {
var err, ext, i, index, len, ref1;
var err, error, ext, i, index, len, ref1;
ref1 = CoffeeScript.FILE_EXTENSIONS;
for (i = 0, len = ref1.length; i < len; i++) {
ext = ref1[i];
......@@ -174,8 +187,8 @@
if ((fs.statSync(index)).isFile()) {
return index;
}
} catch (_error) {
err = _error;
} catch (error) {
err = error;
if (err.code !== 'ENOENT') {
throw err;
}
......@@ -186,7 +199,7 @@
};
compileScript = function(file, input, base) {
var compiled, err, message, o, options, t, task;
var compiled, err, error, message, o, options, t, task;
if (base == null) {
base = null;
}
......@@ -205,6 +218,9 @@
return printLine(CoffeeScript.nodes(t.input, t.options).toString().trim());
} else if (o.run) {
CoffeeScript.register();
if (opts.prelude) {
CoffeeScript["eval"](opts.prelude, t.options);
}
return CoffeeScript.run(t.input, t.options);
} else if (o.join && t.file !== o.join) {
if (helpers.isLiterate(file)) {
......@@ -226,8 +242,8 @@
return writeJs(base, t.file, t.output, options.jsPath, t.sourceMap);
}
}
} catch (_error) {
err = _error;
} catch (error) {
err = error;
CoffeeScript.emit('failure', err, task);
if (CoffeeScript.listeners('failure').length) {
return;
......@@ -273,11 +289,12 @@
};
watch = function(source, base) {
var compile, compileTimeout, err, prevStats, rewatch, startWatcher, watchErr, watcher;
var compile, compileTimeout, err, error, prevStats, rewatch, startWatcher, watchErr, watcher;
watcher = null;
prevStats = null;
compileTimeout = null;
watchErr = function(err) {
var error;
if (err.code !== 'ENOENT') {
throw err;
}
......@@ -287,7 +304,7 @@
try {
rewatch();
return compile();