Commit 3b88a98c authored by Leo Iannacone's avatar Leo Iannacone

update external libs

parent 9a5e60ef
Copyright (c) 2009-2014 Jeremy Ashkenas
Copyright (c) 2009-2015 Jeremy Ashkenas
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
......
{
"name": "coffee-script",
"version": "1.9.1",
"main": [
"lib/coffee-script/coffee-script.js"
],
"description": "Unfancy JavaScript",
"keywords": [
"javascript",
"language",
"coffeescript",
"compiler"
],
"devDependencies": {
"uglify-js": "~2.2",
"jison": ">=0.2.0",
"highlight.js": "~8.0.0",
"underscore": "~1.5.2",
"docco": "~0.6.2"
},
"author": {
"name": "Jeremy Ashkenas"
},
"ignore": [
"test"
]
}
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(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; };
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; };
CoffeeScript = require('./coffee-script');
......@@ -34,14 +34,14 @@
if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) {
compile = function(code, options) {
var js, v3SourceMap, _ref;
var js, ref, v3SourceMap;
if (options == null) {
options = {};
}
options.sourceMap = true;
options.inline = true;
_ref = CoffeeScript.compile(code, options), js = _ref.js, v3SourceMap = _ref.v3SourceMap;
return "" + js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript";
ref = CoffeeScript.compile(code, options), js = ref.js, v3SourceMap = ref.v3SourceMap;
return js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript";
};
}
......@@ -60,9 +60,9 @@
xhr.overrideMimeType('text/plain');
}
xhr.onreadystatechange = function() {
var param, _ref;
var param, ref;
if (xhr.readyState === 4) {
if ((_ref = xhr.status) === 0 || _ref === 200) {
if ((ref = xhr.status) === 0 || ref === 200) {
param = [xhr.responseText, options];
if (!hold) {
CoffeeScript.run.apply(CoffeeScript, param);
......@@ -79,19 +79,19 @@
};
runScripts = function() {
var coffees, coffeetypes, execute, i, index, s, script, scripts, _fn, _i, _len;
var coffees, coffeetypes, execute, fn, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var _i, _len, _ref, _results;
_results = [];
for (_i = 0, _len = scripts.length; _i < _len; _i++) {
s = scripts[_i];
if (_ref = s.type, __indexOf.call(coffeetypes, _ref) >= 0) {
_results.push(s);
var j, len, ref, results;
results = [];
for (j = 0, len = scripts.length; j < len; j++) {
s = scripts[j];
if (ref = s.type, indexOf.call(coffeetypes, ref) >= 0) {
results.push(s);
}
}
return _results;
return results;
})();
index = 0;
execute = function() {
......@@ -103,7 +103,7 @@
return execute();
}
};
_fn = function(script, i) {
fn = function(script, i) {
var options;
options = {
literate: script.type === coffeetypes[1]
......@@ -118,9 +118,9 @@
return coffees[i] = [script.innerHTML, options];
}
};
for (i = _i = 0, _len = coffees.length; _i < _len; i = ++_i) {
for (i = j = 0, len = coffees.length; j < len; i = ++j) {
script = coffees[i];
_fn(script, i);
fn(script, i);
}
return execute();
};
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
......@@ -24,9 +24,9 @@
helpers.extend(global, {
task: function(name, description, action) {
var _ref;
var ref;
if (!action) {
_ref = [description, action], action = _ref[0], description = _ref[1];
ref = [description, action], action = ref[0], description = ref[1];
}
return tasks[name] = {
name: name,
......@@ -46,7 +46,7 @@
});
exports.run = function() {
var arg, args, e, _i, _len, _ref, _results;
var arg, args, e, i, len, ref, results;
global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2);
......@@ -63,20 +63,20 @@
e = _error;
return fatalError("" + e);
}
_ref = options["arguments"];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
arg = _ref[_i];
_results.push(invoke(arg));
ref = options["arguments"];
results = [];
for (i = 0, len = ref.length; i < len; i++) {
arg = ref[i];
results.push(invoke(arg));
}
return _results;
return results;
};
printTasks = function() {
var cakefilePath, desc, name, relative, spaces, task;
relative = path.relative || path.resolve;
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
console.log("" + cakefilePath + " defines the following tasks:\n");
console.log(cakefilePath + " defines the following tasks:\n");
for (name in tasks) {
task = tasks[name];
spaces = 20 - name.length;
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
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,
__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; };
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,
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');
......@@ -13,9 +13,7 @@
CoffeeScript = require('./coffee-script');
mkdirp = require('mkdirp');
_ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec;
ref = require('child_process'), spawn = ref.spawn, exec = ref.exec;
EventEmitter = require('events').EventEmitter;
......@@ -51,8 +49,10 @@
optionParser = null;
jsToSources = {};
exports.run = function() {
var literals, replCliOpts, source, _i, _len, _ref1, _results;
var i, len, literals, ref1, replCliOpts, results, source;
parseOptions();
replCliOpts = {
useGlobal: true
......@@ -88,19 +88,19 @@
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');
}
_ref1 = opts["arguments"];
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
source = _ref1[_i];
ref1 = opts["arguments"];
results = [];
for (i = 0, len = ref1.length; i < len; i++) {
source = ref1[i];
source = path.resolve(source);
_results.push(compilePath(source, true, source));
results.push(compilePath(source, true, source));
}
return _results;
return results;
};
compilePath = function(source, topLevel, base) {
var code, err, file, files, stats, _i, _len, _results;
if (__indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) {
var code, err, file, files, i, len, results, stats;
if (indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) {
return;
}
try {
......@@ -135,12 +135,12 @@
throw err;
}
}
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_results.push(compilePath(path.join(source, file), false, base));
results = [];
for (i = 0, len = files.length; i < len; i++) {
file = files[i];
results.push(compilePath(path.join(source, file), false, base));
}
return _results;
return results;
} else if (topLevel || helpers.isCoffee(source)) {
sources.push(source);
sourceCode.push(null);
......@@ -165,10 +165,10 @@
};
findDirectoryIndex = function(source) {
var err, ext, index, _i, _len, _ref1;
_ref1 = CoffeeScript.FILE_EXTENSIONS;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
ext = _ref1[_i];
var err, ext, i, index, len, ref1;
ref1 = CoffeeScript.FILE_EXTENSIONS;
for (i = 0, len = ref1.length; i < len; i++) {
ext = ref1[i];
index = path.join(source, "index" + ext);
try {
if ((fs.statSync(index)).isFile()) {
......@@ -281,7 +281,7 @@
if (err.code !== 'ENOENT') {
throw err;
}
if (__indexOf.call(sources, source) < 0) {
if (indexOf.call(sources, source) < 0) {
return;
}
try {
......@@ -348,7 +348,7 @@
}).on('change', function() {
clearTimeout(readdirTimeout);
return readdirTimeout = wait(25, function() {
var err, file, files, _i, _len, _results;
var err, file, files, i, len, results;
try {
files = fs.readdirSync(source);
} catch (_error) {
......@@ -358,12 +358,12 @@
}
return stopWatcher();
}
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_results.push(compilePath(path.join(source, file), false, base));
results = [];
for (i = 0, len = files.length; i < len; i++) {
file = files[i];
results.push(compilePath(path.join(source, file), false, base));
}
return _results;
return results;
});
});
};
......@@ -383,11 +383,11 @@
};
removeSourceDir = function(source, base) {
var file, sourcesChanged, _i, _len;
var file, i, len, sourcesChanged;
delete watchedDirs[source];
sourcesChanged = false;
for (_i = 0, _len = sources.length; _i < _len; _i++) {
file = sources[_i];
for (i = 0, len = sources.length; i < len; i++) {
file = sources[i];
if (!(source === path.dirname(file))) {
continue;
}
......@@ -412,12 +412,12 @@
};
silentUnlink = function(path) {
var err, _ref1;
var err, ref1;
try {
return fs.unlinkSync(path);
} catch (_error) {
err = _error;
if ((_ref1 = err.code) !== 'ENOENT' && _ref1 !== 'EPERM') {
if ((ref1 = err.code) !== 'ENOENT' && ref1 !== 'EPERM') {
throw err;
}
}
......@@ -440,6 +440,27 @@
return path.join(dir, basename + extension);
};
mkdirp = function(dir, fn) {
var mkdirs, mode;
mode = 0x1ff & ~process.umask();
return (mkdirs = function(p, fn) {
return fs.exists(p, function(exists) {
if (exists) {
return fn();
} else {
return mkdirs(path.dirname(p), function() {
return fs.mkdir(p, mode, function(err) {
if (err) {
return fn(err);
}
return fn();
});
});
}
});
})(dir, fn);
};
writeJs = function(base, sourcePath, js, jsPath, generatedSourceMap) {
var compile, jsDir, sourceMapPath;
if (generatedSourceMap == null) {
......@@ -447,13 +468,20 @@
}
sourceMapPath = outputPath(sourcePath, base, ".js.map");
jsDir = path.dirname(jsPath);
if (jsPath in jsToSources) {
printLine("Error: The two following source files have the same output file:");
printLine(" " + jsToSources[jsPath]);
printLine(" " + sourcePath);
process.exit(1);
}
jsToSources[jsPath] = sourcePath;
compile = function() {
if (opts.compile) {
if (js.length <= 0) {
js = ' ';
}
if (generatedSourceMap) {
js = "" + js + "\n//# sourceMappingURL=" + (helpers.baseFileName(sourceMapPath, false, useWinPathSep)) + "\n";
js = js + "\n//# sourceMappingURL=" + (helpers.baseFileName(sourceMapPath, false, useWinPathSep)) + "\n";
}
fs.writeFile(jsPath, js, function(err) {
if (err) {
......@@ -487,21 +515,21 @@
};
timeLog = function(message) {
return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message);
return console.log(((new Date).toLocaleTimeString()) + " - " + message);
};
printTokens = function(tokens) {
var strings, tag, token, value;
strings = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
token = tokens[_i];
var i, len, results;
results = [];
for (i = 0, len = tokens.length; i < len; i++) {
token = tokens[i];
tag = token[0];
value = token[1].toString().replace(/\n/, '\\n');
_results.push("[" + tag + " " + value + "]");
results.push("[" + tag + " " + value + "]");
}
return _results;
return results;
})();
return printLine(strings.join(' '));
};
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
......@@ -63,16 +63,26 @@
AlphaNumeric: [
o('NUMBER', function() {
return new Literal($1);
}), o('STRING', function() {
}), o('String')
],
String: [
o('STRING', function() {
return new Literal($1);
}), o('STRING_START Body STRING_END', function() {
return new Parens($2);
})
],
Regex: [
o('REGEX', function() {
return new Literal($1);
}), o('REGEX_START Invocation REGEX_END', function() {
return $2;
})
],
Literal: [
o('AlphaNumeric'), o('JS', function() {
return new Literal($1);
}), o('REGEX', function() {
return new Literal($1);
}), o('DEBUGGER', function() {
}), o('Regex'), o('DEBUGGER', function() {
return new Literal($1);
}), o('UNDEFINED', function() {
return new Undefined;
......@@ -421,6 +431,11 @@
return {
source: LOC(2)(new Value($2))
};
}), o('FOR Range BY Expression', function() {
return {
source: LOC(2)(new Value($2)),
step: $4
};
}), o('ForStart ForSource', function() {
$2.own = $1.own;
$2.name = $1[0];
......@@ -552,6 +567,12 @@
return new Op('+', $2);
}), {
prec: 'UNARY_MATH'
}), o('YIELD Statement', function() {
return new Op($1, $2);
}), o('YIELD Expression', function() {
return new Op($1, $2);
}), o('YIELD FROM Expression', function() {
return new Op($1.concat($2), $3);
}), o('-- SimpleAssignable', function() {
return new Op('--', $2);
}), o('++ SimpleAssignable', function() {
......@@ -594,20 +615,20 @@
]
};
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['left', 'POST_IF']];
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', 'YIELD'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['left', 'POST_IF']];
tokens = [];
for (name in grammar) {
alternatives = grammar[name];
grammar[name] = (function() {
var _i, _j, _len, _len1, _ref, _results;
_results = [];
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
alt = alternatives[_i];
_ref = alt[0].split(' ');
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
token = _ref[_j];
var i, j, len, len1, ref, results;
results = [];
for (i = 0, len = alternatives.length; i < len; i++) {
alt = alternatives[i];
ref = alt[0].split(' ');
for (j = 0, len1 = ref.length; j < len1; j++) {
token = ref[j];
if (!grammar[token]) {
tokens.push(token);
}
......@@ -615,9 +636,9 @@
if (name === 'Root') {
alt[1] = "return " + alt[1];
}
_results.push(alt);
results.push(alt);
}
return _results;
return results;
})();
}
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref;
var buildLocationData, extend, flatten, ref, repeat, syntaxErrorToString;
exports.starts = function(string, literal, start) {
return literal === string.substr(start, literal.length);
......@@ -26,15 +26,15 @@
};
exports.compact = function(array) {
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
var i, item, len1, results;
results = [];
for (i = 0, len1 = array.length; i < len1; i++) {
item = array[i];
if (item) {
_results.push(item);
results.push(item);
}
}
return _results;
return results;
};
exports.count = function(string, substr) {
......@@ -63,10 +63,10 @@
};
exports.flatten = flatten = function(array) {
var element, flattened, _i, _len;
var element, flattened, i, len1;
flattened = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
element = array[_i];
for (i = 0, len1 = array.length; i < len1; i++) {
element = array[i];
if (element instanceof Array) {
flattened = flattened.concat(flatten(element));
} else {
......@@ -83,14 +83,10 @@
return val;
};
exports.last = last = function(array, back) {
return array[array.length - (back || 0) - 1];
};
exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
var e, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) {
e = this[_i];
exports.some = (ref = Array.prototype.some) != null ? ref : function(fn) {
var e, i, len1;
for (i = 0, len1 = this.length; i < len1; i++) {
e = this[i];
if (fn(e)) {
return true;
}
......@@ -102,20 +98,20 @@
var line, lines, maybe_code;
maybe_code = true;
lines = (function() {
var _i, _len, _ref1, _results;
_ref1 = code.split('\n');
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
line = _ref1[_i];
var i, len1, ref1, results;
ref1 = code.split('\n');
results = [];
for (i = 0, len1 = ref1.length; i < len1; i++) {
line = ref1[i];
if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
_results.push(line);
results.push(line);
} else if (maybe_code = /^\s*$/.test(line)) {
_results.push(line);
results.push(line);
} else {
_results.push('# ' + line);
results.push('# ' + line);
}
}
return _results;
return results;
})();
return lines.join('\n');
};
......@@ -150,7 +146,7 @@
locationData = obj;
}
if (locationData) {
return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1));
return ((locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ((locationData.last_line + 1) + ":" + (locationData.last_column + 1));
} else {
return "No location data";
}
......@@ -205,11 +201,11 @@
};
syntaxErrorToString = function() {
var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, start, _ref1, _ref2;
var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, ref1, ref2, start;
if (!(this.code && this.location)) {
return Error.prototype.toString.call(this);
}
_ref1 = this.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
ref1 = this.location, first_line = ref1.first_line, first_column = ref1.first_column, last_line = ref1.last_line, last_column = ref1.last_column;
if (last_line == null) {
last_line = first_line;
}
......@@ -224,14 +220,14 @@
if (typeof process !== "undefined" && process !== null) {
colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS;
}
if ((_ref2 = this.colorful) != null ? _ref2 : colorsEnabled) {
if ((ref2 = this.colorful) != null ? ref2 : colorsEnabled) {
colorize = function(str) {
return "\x1B[1;31m" + str + "\x1B[0m";
};
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
marker = colorize(marker);
}
return "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
return filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
};
exports.nameWhitespaceCharacter = function(string) {
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var key, val, _ref;
var key, ref, val;
_ref = require('./coffee-script');
for (key in _ref) {
val = _ref[key];
ref = require('./coffee-script');
for (key in ref) {
val = ref[key];
exports[key] = val;
}
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat;
......@@ -11,14 +11,14 @@
}
OptionParser.prototype.parse = function(args) {
var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref;
var arg, i, isOption, j, k, len, len1, matchedRule, options, originalArgs, pos, ref, rule, seenNonOptionArg, skippingArgument, value;
options = {
"arguments": []
};
skippingArgument = false;
originalArgs = args;
args = normalizeArguments(args);
for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) {
for (i = j = 0, len = args.length; j < len; i = ++j) {
arg = args[i];
if (skippingArgument) {
skippingArgument = false;
......@@ -33,9 +33,9 @@
seenNonOptionArg = options["arguments"].length > 0;
if (!seenNonOptionArg) {
matchedRule = false;
_ref = this.rules;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
rule = _ref[_j];
ref = this.rules;
for (k = 0, len1 = ref.length; k < len1; k++) {
rule = ref[k];
if (rule.shortFlag === arg || rule.longFlag === arg) {
value = true;
if (rule.hasArgument) {
......@@ -59,14 +59,14 @@
};
OptionParser.prototype.help = function() {
var letPart, lines, rule, spaces, _i, _len, _ref;
var j, len, letPart, lines, ref, rule, spaces;
lines = [];
if (this.banner) {
lines.unshift("" + this.banner + "\n");
lines.unshift(this.banner + "\n");
}
_ref = this.rules;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
rule = _ref[_i];
ref = this.rules;
for (j = 0, len = ref.length; j < len; j++) {
rule = ref[j];
spaces = 15 - rule.longFlag.length;
spaces = spaces > 0 ? repeat(' ', spaces) : '';
letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' ';
......@@ -88,16 +88,16 @@
OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) {
var tuple, _i, _len, _results;
_results = [];
for (_i = 0, _len = rules.length; _i < _len; _i++) {
tuple = rules[_i];
var j, len, results, tuple;
results = [];
for (j = 0, len = rules.length; j < len; j++) {
tuple = rules[j];
if (tuple.length < 3) {
tuple.unshift(null);
}
_results.push(buildRule.apply(null, tuple));
results.push(buildRule.apply(null, tuple));
}
return _results;
return results;
};
buildRule = function(shortFlag, longFlag, description, options) {
......@@ -118,15 +118,15 @@
};
normalizeArguments = function(args) {
var arg, l, match, result, _i, _j, _len, _len1, _ref;
var arg, j, k, l, len, len1, match, ref, result;
args = args.slice(0);
result = [];
for (_i = 0, _len = args.length; _i < _len; _i++) {
arg = args[_i];
for (j = 0, len = args.length; j < len; j++) {
arg = args[j];
if (match = arg.match(MULTI_FLAG)) {
_ref = match[1].split('');
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
l = _ref[_j];
ref = match[1].split('');
for (k = 0, len1 = ref.length; k < len1; k++) {
l = ref[k];
result.push('-' + l);
}
} else {
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, loadFile, path, _i, _len, _ref;
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;
CoffeeScript = require('./coffee-script');
......@@ -17,9 +17,9 @@
};
if (require.extensions) {
_ref = CoffeeScript.FILE_EXTENSIONS;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
ext = _ref[_i];
ref = CoffeeScript.FILE_EXTENSIONS;
for (i = 0, len = ref.length; i < len; i++) {
ext = ref[i];
require.extensions[ext] = loadFile;
}
Module = require('module');
......
// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, updateSyntaxError, vm, _ref;
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, ref, replDefaults, updateSyntaxError, vm;
fs = require('fs');
......@@ -12,23 +12,36 @@
CoffeeScript = require('./coffee-script');
_ref = require('./helpers'), merge = _ref.merge, updateSyntaxError = _ref.updateSyntaxError;
ref = require('./helpers'), merge = ref.merge, updateSyntaxError = ref.updateSyntaxError;
replDefaults = {
prompt: 'coffee> ',
historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0,
historyMaxInputSize: 10240,
"eval": function(input, context, filename, cb) {
var Assign, Block, Literal, Value, ast, err, js, result, _ref1;
var Assign, Block, Literal, Value, ast, err, js, ref1, referencedVars, result, token, tokens;
input = input.replace(/\uFF00/g, '\n');
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
_ref1 = require('./nodes'), Block = _ref1.Block, Assign = _ref1.Assign, Value = _ref1.Value, Literal = _ref1.Literal;
ref1 = require('./nodes'), Block = ref1.Block, Assign = ref1.Assign, Value = ref1.Value, Literal = ref1.Literal;
try {
ast = CoffeeScript.nodes(input);
tokens = CoffeeScript.tokens(input);
referencedVars = (function() {
var i, len, results;
results = [];
for (i = 0, len = tokens.length; i < len; i++) {
token = tokens[i];
if (token.variable) {
results.push(token[1]);
}
}
return results;
})();
ast = CoffeeScript.nodes(tokens);
ast = new Block([new Assign(new Value(new Literal('_')), ast, '=')]);
js = ast.compile({
bare: true,
locals: Object.keys(context)
locals: Object.keys(context),
referencedVars: referencedVars
});
result = context === global ? vm.runInThisContext(js, filename) : vm.runInContext(js, context, filename);
return cb(null, result);
......@@ -41,9 +54,9 @@
};
addMultilineHandler = function(repl) {
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, rli, _ref1;
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, ref1, rli;
rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream;
origPrompt = (_ref1 = repl._prompt) != null ? _ref1 : repl.prompt;
origPrompt = (ref1 = repl._prompt) != null ? ref1 : repl.prompt;
multiline = {
enabled: false,
initialPrompt: origPrompt.replace(/^[^> ]*/, function(x) {
......@@ -58,7 +71,7 @@
rli.removeListener('line', nodeLineListener);
rli.on('line', function(cmd) {
if (multiline.enabled) {
multiline.buffer += "" + cmd + "\n";
multiline.buffer += cmd + "\n";
rli.setPrompt(multiline.prompt);
rli.prompt(true);
} else {
......@@ -118,7 +131,7 @@
fd = fs.openSync(filename, 'a');
repl.rli.addListener('line', function(code) {
if (code && code.length && code !== '.history' && lastLine !== code) {
fs.write(fd, "" + code + "\n");
fs.write(fd, code + "\n");
return lastLine = code;
}
});
......@@ -128,7 +141,7 @@
return repl.commands[getCommandId(repl, 'history')] = {
help: 'Show command history',
action: function() {
repl.outputStream.write("" + (repl.rli.history.slice(0).reverse().join('\n')) + "\n");
repl.outputStream.write((repl.rli.history.slice(0).reverse().join('\n')) + "\n");
return repl.displayPrompt();
}
};
......@@ -146,13 +159,13 @@
module.exports = {
start: function(opts) {
var build, major, minor, repl, _ref1;
var build, major, minor, ref1, repl;
if (opts == null) {
opts = {};
}
_ref1 = process.versions.node.split('.').map(function(n) {
ref1 = process.versions.node.split('.').map(function(n) {
return parseInt(n);
}), major = _ref1[0], minor = _ref1[1], build = _ref1[2];
}), major = ref1[0], minor = ref1[1], build = ref1[2];
if (major === 0 && minor < 8) {
console.warn("Node 0.8.0+ required for CoffeeScript REPL");
process.exit(1);
......
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment