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 Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation 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() { (function() {
var CoffeeScript, compile, runScripts, 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'); CoffeeScript = require('./coffee-script');
...@@ -34,14 +34,14 @@ ...@@ -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)) { 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) { compile = function(code, options) {
var js, v3SourceMap, _ref; var js, ref, v3SourceMap;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
options.sourceMap = true; options.sourceMap = true;
options.inline = true; options.inline = true;
_ref = CoffeeScript.compile(code, options), js = _ref.js, v3SourceMap = _ref.v3SourceMap; 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"; return js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript";
}; };
} }
...@@ -60,9 +60,9 @@ ...@@ -60,9 +60,9 @@
xhr.overrideMimeType('text/plain'); xhr.overrideMimeType('text/plain');
} }
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
var param, _ref; var param, ref;
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if ((_ref = xhr.status) === 0 || _ref === 200) { if ((ref = xhr.status) === 0 || ref === 200) {
param = [xhr.responseText, options]; param = [xhr.responseText, options];
if (!hold) { if (!hold) {
CoffeeScript.run.apply(CoffeeScript, param); CoffeeScript.run.apply(CoffeeScript, param);
...@@ -79,19 +79,19 @@ ...@@ -79,19 +79,19 @@
}; };
runScripts = function() { 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'); scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']; coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() { coffees = (function() {
var _i, _len, _ref, _results; var j, len, ref, results;
_results = []; results = [];
for (_i = 0, _len = scripts.length; _i < _len; _i++) { for (j = 0, len = scripts.length; j < len; j++) {
s = scripts[_i]; s = scripts[j];
if (_ref = s.type, __indexOf.call(coffeetypes, _ref) >= 0) { if (ref = s.type, indexOf.call(coffeetypes, ref) >= 0) {
_results.push(s); results.push(s);
} }
} }
return _results; return results;
})(); })();
index = 0; index = 0;
execute = function() { execute = function() {
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
return execute(); return execute();
} }
}; };
_fn = function(script, i) { fn = function(script, i) {
var options; var options;
options = { options = {
literate: script.type === coffeetypes[1] literate: script.type === coffeetypes[1]
...@@ -118,9 +118,9 @@ ...@@ -118,9 +118,9 @@
return coffees[i] = [script.innerHTML, options]; 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]; script = coffees[i];
_fn(script, i); fn(script, i);
} }
return execute(); return execute();
}; };
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
helpers.extend(global, { helpers.extend(global, {
task: function(name, description, action) { task: function(name, description, action) {
var _ref; var ref;
if (!action) { if (!action) {
_ref = [description, action], action = _ref[0], description = _ref[1]; ref = [description, action], action = ref[0], description = ref[1];
} }
return tasks[name] = { return tasks[name] = {
name: name, name: name,
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
}); });
exports.run = function() { exports.run = function() {
var arg, args, e, _i, _len, _ref, _results; var arg, args, e, i, len, ref, results;
global.__originalDirname = fs.realpathSync('.'); global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname)); process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2); args = process.argv.slice(2);
...@@ -63,20 +63,20 @@ ...@@ -63,20 +63,20 @@
e = _error; e = _error;
return fatalError("" + e); return fatalError("" + e);
} }
_ref = options["arguments"]; ref = options["arguments"];
_results = []; results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (i = 0, len = ref.length; i < len; i++) {
arg = _ref[_i]; arg = ref[i];
_results.push(invoke(arg)); results.push(invoke(arg));
} }
return _results; return results;
}; };
printTasks = function() { printTasks = function() {
var cakefilePath, desc, name, relative, spaces, task; var cakefilePath, desc, name, relative, spaces, task;
relative = path.relative || path.resolve; relative = path.relative || path.resolve;
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile'); 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) { for (name in tasks) {
task = tasks[name]; task = tasks[name];
spaces = 20 - name.length; spaces = 20 - name.length;
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (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, 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; }; 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'); fs = require('fs');
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
CoffeeScript = require('./coffee-script'); 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; EventEmitter = require('events').EventEmitter;
...@@ -51,8 +49,10 @@ ...@@ -51,8 +49,10 @@
optionParser = null; optionParser = null;
jsToSources = {};
exports.run = function() { exports.run = function() {
var literals, replCliOpts, source, _i, _len, _ref1, _results; var i, len, literals, ref1, replCliOpts, results, source;
parseOptions(); parseOptions();
replCliOpts = { replCliOpts = {
useGlobal: true useGlobal: true
...@@ -88,19 +88,19 @@ ...@@ -88,19 +88,19 @@
opts.join = path.resolve(opts.join); 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'); 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"]; ref1 = opts["arguments"];
_results = []; results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (i = 0, len = ref1.length; i < len; i++) {
source = _ref1[_i]; source = ref1[i];
source = path.resolve(source); 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) { compilePath = function(source, topLevel, base) {
var code, err, file, files, stats, _i, _len, _results; var code, err, file, files, i, len, results, stats;
if (__indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) { if (indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) {
return; return;
} }
try { try {
...@@ -135,12 +135,12 @@ ...@@ -135,12 +135,12 @@
throw err; throw err;
} }
} }
_results = []; results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) { for (i = 0, len = files.length; i < len; i++) {
file = files[_i]; file = files[i];
_results.push(compilePath(path.join(source, file), false, base)); results.push(compilePath(path.join(source, file), false, base));
} }
return _results; return results;
} else if (topLevel || helpers.isCoffee(source)) { } else if (topLevel || helpers.isCoffee(source)) {
sources.push(source); sources.push(source);
sourceCode.push(null); sourceCode.push(null);
...@@ -165,10 +165,10 @@ ...@@ -165,10 +165,10 @@
}; };
findDirectoryIndex = function(source) { findDirectoryIndex = function(source) {
var err, ext, index, _i, _len, _ref1; var err, ext, i, index, len, ref1;
_ref1 = CoffeeScript.FILE_EXTENSIONS; ref1 = CoffeeScript.FILE_EXTENSIONS;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (i = 0, len = ref1.length; i < len; i++) {
ext = _ref1[_i]; ext = ref1[i];
index = path.join(source, "index" + ext); index = path.join(source, "index" + ext);
try { try {
if ((fs.statSync(index)).isFile()) { if ((fs.statSync(index)).isFile()) {
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
if (err.code !== 'ENOENT') { if (err.code !== 'ENOENT') {
throw err; throw err;
} }
if (__indexOf.call(sources, source) < 0) { if (indexOf.call(sources, source) < 0) {
return; return;
} }
try { try {
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
}).on('change', function() { }).on('change', function() {
clearTimeout(readdirTimeout); clearTimeout(readdirTimeout);
return readdirTimeout = wait(25, function() { return readdirTimeout = wait(25, function() {
var err, file, files, _i, _len, _results; var err, file, files, i, len, results;
try { try {
files = fs.readdirSync(source); files = fs.readdirSync(source);
} catch (_error) { } catch (_error) {
...@@ -358,12 +358,12 @@ ...@@ -358,12 +358,12 @@
} }
return stopWatcher(); return stopWatcher();
} }
_results = []; results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) { for (i = 0, len = files.length; i < len; i++) {
file = files[_i]; file = files[i];
_results.push(compilePath(path.join(source, file), false, base)); results.push(compilePath(path.join(source, file), false, base));
} }
return _results; return results;
}); });
}); });
}; };
...@@ -383,11 +383,11 @@ ...@@ -383,11 +383,11 @@
}; };
removeSourceDir = function(source, base) { removeSourceDir = function(source, base) {
var file, sourcesChanged, _i, _len; var file, i, len, sourcesChanged;
delete watchedDirs[source]; delete watchedDirs[source];
sourcesChanged = false; sourcesChanged = false;
for (_i = 0, _len = sources.length; _i < _len; _i++) { for (i = 0, len = sources.length; i < len; i++) {
file = sources[_i]; file = sources[i];
if (!(source === path.dirname(file))) { if (!(source === path.dirname(file))) {
continue; continue;
} }
...@@ -412,12 +412,12 @@ ...@@ -412,12 +412,12 @@
}; };
silentUnlink = function(path) { silentUnlink = function(path) {
var err, _ref1; var err, ref1;
try { try {
return fs.unlinkSync(path); return fs.unlinkSync(path);
} catch (_error) { } catch (_error) {
err = _error; err = _error;
if ((_ref1 = err.code) !== 'ENOENT' && _ref1 !== 'EPERM') { if ((ref1 = err.code) !== 'ENOENT' && ref1 !== 'EPERM') {
throw err; throw err;
} }
} }
...@@ -440,6 +440,27 @@ ...@@ -440,6 +440,27 @@
return path.join(dir, basename + extension); 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) { writeJs = function(base, sourcePath, js, jsPath, generatedSourceMap) {
var compile, jsDir, sourceMapPath; var compile, jsDir, sourceMapPath;
if (generatedSourceMap == null) { if (generatedSourceMap == null) {
...@@ -447,13 +468,20 @@ ...@@ -447,13 +468,20 @@
} }
sourceMapPath = outputPath(sourcePath, base, ".js.map"); sourceMapPath = outputPath(sourcePath, base, ".js.map");
jsDir = path.dirname(jsPath); 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() { compile = function() {
if (opts.compile) { if (opts.compile) {
if (js.length <= 0) { if (js.length <= 0) {
js = ' '; js = ' ';
} }
if (generatedSourceMap) { 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) { fs.writeFile(jsPath, js, function(err) {
if (err) { if (err) {
...@@ -487,21 +515,21 @@ ...@@ -487,21 +515,21 @@
}; };
timeLog = function(message) { timeLog = function(message) {
return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); return console.log(((new Date).toLocaleTimeString()) + " - " + message);
}; };
printTokens = function(tokens) { printTokens = function(tokens) {
var strings, tag, token, value; var strings, tag, token, value;
strings = (function() { strings = (function() {
var _i, _len, _results; var i, len, results;
_results = []; results = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) { for (i = 0, len = tokens.length; i < len; i++) {
token = tokens[_i]; token = tokens[i];
tag = token[0]; tag = token[0];
value = token[1].toString().replace(/\n/, '\\n'); value = token[1].toString().replace(/\n/, '\\n');
_results.push("[" + tag + " " + value + "]"); results.push("[" + tag + " " + value + "]");
} }
return _results; return results;
})(); })();
return printLine(strings.join(' ')); return printLine(strings.join(' '));
}; };
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
...@@ -63,16 +63,26 @@ ...@@ -63,16 +63,26 @@
AlphaNumeric: [ AlphaNumeric: [
o('NUMBER', function() { o('NUMBER', function() {
return new Literal($1); 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); return new Literal($1);
}), o('REGEX_START Invocation REGEX_END', function() {
return $2;
}) })
], ],
Literal: [ Literal: [
o('AlphaNumeric'), o('JS', function() { o('AlphaNumeric'), o('JS', function() {
return new Literal($1); return new Literal($1);
}), o('REGEX', function() { }), o('Regex'), o('DEBUGGER', function() {
return new Literal($1);
}), o('DEBUGGER', function() {
return new Literal($1); return new Literal($1);
}), o('UNDEFINED', function() { }), o('UNDEFINED', function() {
return new Undefined; return new Undefined;
...@@ -421,6 +431,11 @@ ...@@ -421,6 +431,11 @@
return { return {
source: LOC(2)(new Value($2)) 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() { }), o('ForStart ForSource', function() {
$2.own = $1.own; $2.own = $1.own;
$2.name = $1[0]; $2.name = $1[0];
...@@ -552,6 +567,12 @@ ...@@ -552,6 +567,12 @@
return new Op('+', $2); return new Op('+', $2);
}), { }), {
prec: 'UNARY_MATH' 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() { }), o('-- SimpleAssignable', function() {
return new Op('--', $2); return new Op('--', $2);
}), o('++ SimpleAssignable', function() { }), o('++ SimpleAssignable', function() {
...@@ -594,20 +615,20 @@ ...@@ -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 = []; tokens = [];
for (name in grammar) { for (name in grammar) {
alternatives = grammar[name]; alternatives = grammar[name];
grammar[name] = (function() { grammar[name] = (function() {
var _i, _j, _len, _len1, _ref, _results; var i, j, len, len1, ref, results;
_results = []; results = [];
for (_i = 0, _len = alternatives.length; _i < _len; _i++) { for (i = 0, len = alternatives.length; i < len; i++) {
alt = alternatives[_i]; alt = alternatives[i];
_ref = alt[0].split(' '); ref = alt[0].split(' ');
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { for (j = 0, len1 = ref.length; j < len1; j++) {
token = _ref[_j]; token = ref[j];
if (!grammar[token]) { if (!grammar[token]) {
tokens.push(token); tokens.push(token);
} }
...@@ -615,9 +636,9 @@ ...@@ -615,9 +636,9 @@
if (name === 'Root') { if (name === 'Root') {
alt[1] = "return " + alt[1]; 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() { (function() {
var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref; var buildLocationData, extend, flatten, ref, repeat, syntaxErrorToString;
exports.starts = function(string, literal, start) { exports.starts = function(string, literal, start) {
return literal === string.substr(start, literal.length); return literal === string.substr(start, literal.length);
...@@ -26,15 +26,15 @@ ...@@ -26,15 +26,15 @@
}; };
exports.compact = function(array) { exports.compact = function(array) {
var item, _i, _len, _results; var i, item, len1, results;
_results = []; results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) { for (i = 0, len1 = array.length; i < len1; i++) {
item = array[_i]; item = array[i];
if (item) { if (item) {
_results.push(item); results.push(item);
} }
} }
return _results; return results;
}; };
exports.count = function(string, substr) { exports.count = function(string, substr) {
...@@ -63,10 +63,10 @@ ...@@ -63,10 +63,10 @@
}; };
exports.flatten = flatten = function(array) { exports.flatten = flatten = function(array) {
var element, flattened, _i, _len; var element, flattened, i, len1;
flattened = []; flattened = [];
for (_i = 0, _len = array.length; _i < _len; _i++) { for (i = 0, len1 = array.length; i < len1; i++) {
element = array[_i]; element = array[i];
if (element instanceof Array) { if (element instanceof Array) {
flattened = flattened.concat(flatten(element)); flattened = flattened.concat(flatten(element));
} else { } else {
...@@ -83,14 +83,10 @@ ...@@ -83,14 +83,10 @@
return val; return val;
}; };
exports.last = last = function(array, back) { exports.some = (ref = Array.prototype.some) != null ? ref : function(fn) {
return array[array.length - (back || 0) - 1]; var e, i, len1;
}; for (i = 0, len1 = this.length; i < len1; i++) {
e = this[i];
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];
if (fn(e)) { if (fn(e)) {
return true; return true;
} }
...@@ -102,20 +98,20 @@ ...@@ -102,20 +98,20 @@
var line, lines, maybe_code; var line, lines, maybe_code;
maybe_code = true; maybe_code = true;
lines = (function() { lines = (function() {
var _i, _len, _ref1, _results; var i, len1, ref1, results;
_ref1 = code.split('\n'); ref1 = code.split('\n');
_results = []; results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (i = 0, len1 = ref1.length; i < len1; i++) {
line = _ref1[_i]; line = ref1[i];
if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) { if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
_results.push(line); results.push(line);
} else if (maybe_code = /^\s*$/.test(line)) { } else if (maybe_code = /^\s*$/.test(line)) {
_results.push(line); results.push(line);
} else { } else {
_results.push('# ' + line); results.push('# ' + line);
} }
} }
return _results; return results;
})(); })();
return lines.join('\n'); return lines.join('\n');
}; };
...@@ -150,7 +146,7 @@ ...@@ -150,7 +146,7 @@
locationData = obj; locationData = obj;
} }
if (locationData) { 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 { } else {
return "No location data"; return "No location data";
} }
...@@ -205,11 +201,11 @@ ...@@ -205,11 +201,11 @@
}; };
syntaxErrorToString = function() { 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)) { if (!(this.code && this.location)) {
return Error.prototype.toString.call(this); 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) { if (last_line == null) {
last_line = first_line; last_line = first_line;
} }
...@@ -224,14 +220,14 @@ ...@@ -224,14 +220,14 @@
if (typeof process !== "undefined" && process !== null) { if (typeof process !== "undefined" && process !== null) {
colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS; 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) { colorize = function(str) {
return "\x1B[1;31m" + str + "\x1B[0m"; return "\x1B[1;31m" + str + "\x1B[0m";
}; };
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end); codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
marker = colorize(marker); 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) { exports.nameWhitespaceCharacter = function(string) {
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var key, val, _ref; var key, ref, val;
_ref = require('./coffee-script'); ref = require('./coffee-script');
for (key in _ref) { for (key in ref) {
val = _ref[key]; val = ref[key];
exports[key] = val; exports[key] = val;
} }
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat; var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat;
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
} }
OptionParser.prototype.parse = function(args) { 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 = { options = {
"arguments": [] "arguments": []
}; };
skippingArgument = false; skippingArgument = false;
originalArgs = args; originalArgs = args;
args = normalizeArguments(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]; arg = args[i];
if (skippingArgument) { if (skippingArgument) {
skippingArgument = false; skippingArgument = false;
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
seenNonOptionArg = options["arguments"].length > 0; seenNonOptionArg = options["arguments"].length > 0;
if (!seenNonOptionArg) { if (!seenNonOptionArg) {
matchedRule = false; matchedRule = false;
_ref = this.rules; ref = this.rules;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { for (k = 0, len1 = ref.length; k < len1; k++) {
rule = _ref[_j]; rule = ref[k];
if (rule.shortFlag === arg || rule.longFlag === arg) { if (rule.shortFlag === arg || rule.longFlag === arg) {
value = true; value = true;
if (rule.hasArgument) { if (rule.hasArgument) {
...@@ -59,14 +59,14 @@ ...@@ -59,14 +59,14 @@
}; };
OptionParser.prototype.help = function() { OptionParser.prototype.help = function() {
var letPart, lines, rule, spaces, _i, _len, _ref; var j, len, letPart, lines, ref, rule, spaces;
lines = []; lines = [];
if (this.banner) { if (this.banner) {
lines.unshift("" + this.banner + "\n"); lines.unshift(this.banner + "\n");
} }
_ref = this.rules; ref = this.rules;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (j = 0, len = ref.length; j < len; j++) {
rule = _ref[_i]; rule = ref[j];
spaces = 15 - rule.longFlag.length; spaces = 15 - rule.longFlag.length;
spaces = spaces > 0 ? repeat(' ', spaces) : ''; spaces = spaces > 0 ? repeat(' ', spaces) : '';
letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' ';
...@@ -88,16 +88,16 @@ ...@@ -88,16 +88,16 @@
OPTIONAL = /\[(\w+(\*?))\]/; OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) { buildRules = function(rules) {
var tuple, _i, _len, _results; var j, len, results, tuple;
_results = []; results = [];
for (_i = 0, _len = rules.length; _i < _len; _i++) { for (j = 0, len = rules.length; j < len; j++) {
tuple = rules[_i]; tuple = rules[j];
if (tuple.length < 3) { if (tuple.length < 3) {
tuple.unshift(null); 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) { buildRule = function(shortFlag, longFlag, description, options) {
...@@ -118,15 +118,15 @@ ...@@ -118,15 +118,15 @@
}; };
normalizeArguments = function(args) { 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); args = args.slice(0);
result = []; result = [];
for (_i = 0, _len = args.length; _i < _len; _i++) { for (j = 0, len = args.length; j < len; j++) {
arg = args[_i]; arg = args[j];
if (match = arg.match(MULTI_FLAG)) { if (match = arg.match(MULTI_FLAG)) {
_ref = match[1].split(''); ref = match[1].split('');
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { for (k = 0, len1 = ref.length; k < len1; k++) {
l = _ref[_j]; l = ref[k];
result.push('-' + l); result.push('-' + l);
} }
} else { } else {
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (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'); CoffeeScript = require('./coffee-script');
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
}; };
if (require.extensions) { if (require.extensions) {
_ref = CoffeeScript.FILE_EXTENSIONS; ref = CoffeeScript.FILE_EXTENSIONS;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (i = 0, len = ref.length; i < len; i++) {
ext = _ref[_i]; ext = ref[i];
require.extensions[ext] = loadFile; require.extensions[ext] = loadFile;
} }
Module = require('module'); Module = require('module');
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (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'); fs = require('fs');
...@@ -12,23 +12,36 @@ ...@@ -12,23 +12,36 @@
CoffeeScript = require('./coffee-script'); CoffeeScript = require('./coffee-script');
_ref = require('./helpers'), merge = _ref.merge, updateSyntaxError = _ref.updateSyntaxError; ref = require('./helpers'), merge = ref.merge, updateSyntaxError = ref.updateSyntaxError;
replDefaults = { replDefaults = {
prompt: 'coffee> ', prompt: 'coffee> ',
historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0, historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0,
historyMaxInputSize: 10240, historyMaxInputSize: 10240,
"eval": function(input, context, filename, cb) { "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(/\uFF00/g, '\n');
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); 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 { 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, '=')]); ast = new Block([new Assign(new Value(new Literal('_')), ast, '=')]);
js = ast.compile({ js = ast.compile({
bare: true, bare: true,
locals: Object.keys(context) locals: Object.keys(context),
referencedVars: referencedVars
}); });
result = context === global ? vm.runInThisContext(js, filename) : vm.runInContext(js, context, filename); result = context === global ? vm.runInThisContext(js, filename) : vm.runInContext(js, context, filename);
return cb(null, result); return cb(null, result);
...@@ -41,9 +54,9 @@ ...@@ -41,9 +54,9 @@
}; };
addMultilineHandler = function(repl) { 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; 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 = { multiline = {
enabled: false, enabled: false,
initialPrompt: origPrompt.replace(/^[^> ]*/, function(x) { initialPrompt: origPrompt.replace(/^[^> ]*/, function(x) {
...@@ -58,7 +71,7 @@ ...@@ -58,7 +71,7 @@
rli.removeListener('line', nodeLineListener); rli.removeListener('line', nodeLineListener);
rli.on('line', function(cmd) { rli.on('line', function(cmd) {
if (multiline.enabled) { if (multiline.enabled) {
multiline.buffer += "" + cmd + "\n"; multiline.buffer += cmd + "\n";
rli.setPrompt(multiline.prompt); rli.setPrompt(multiline.prompt);
rli.prompt(true); rli.prompt(true);
} else { } else {
...@@ -118,7 +131,7 @@ ...@@ -118,7 +131,7 @@
fd = fs.openSync(filename, 'a'); fd = fs.openSync(filename, 'a');
repl.rli.addListener('line', function(code) { repl.rli.addListener('line', function(code) {
if (code && code.length && code !== '.history' && lastLine !== code) { if (code && code.length && code !== '.history' && lastLine !== code) {
fs.write(fd, "" + code + "\n"); fs.write(fd, code + "\n");
return lastLine = code; return lastLine = code;
} }
}); });
...@@ -128,7 +141,7 @@ ...@@ -128,7 +141,7 @@
return repl.commands[getCommandId(repl, 'history')] = { return repl.commands[getCommandId(repl, 'history')] = {
help: 'Show command history', help: 'Show command history',
action: function() { 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(); return repl.displayPrompt();
} }
}; };
...@@ -146,13 +159,13 @@ ...@@ -146,13 +159,13 @@
module.exports = { module.exports = {
start: function(opts) { start: function(opts) {
var build, major, minor, repl, _ref1; var build, major, minor, ref1, repl;
if (opts == null) { if (opts == null) {
opts = {}; opts = {};
} }
_ref1 = process.versions.node.split('.').map(function(n) { ref1 = process.versions.node.split('.').map(function(n) {
return parseInt(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) { if (major === 0 && minor < 8) {
console.warn("Node 0.8.0+ required for CoffeeScript REPL"); console.warn("Node 0.8.0+ required for CoffeeScript REPL");
process.exit(1); process.exit(1);
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var Scope, extend, last, _ref; var Scope,
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; };
_ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
exports.Scope = Scope = (function() { exports.Scope = Scope = (function() {
Scope.root = null; function Scope(parent, expressions, method, referencedVars) {
var ref, ref1;
function Scope(parent, expressions, method) {
this.parent = parent; this.parent = parent;
this.expressions = expressions; this.expressions = expressions;
this.method = method; this.method = method;
this.referencedVars = referencedVars;
this.variables = [ this.variables = [
{ {
name: 'arguments', name: 'arguments',
...@@ -19,8 +18,9 @@ ...@@ -19,8 +18,9 @@
]; ];
this.positions = {}; this.positions = {};
if (!this.parent) { if (!this.parent) {
Scope.root = this; this.utilities = {};
} }
this.root = (ref = (ref1 = this.parent) != null ? ref1.root : void 0) != null ? ref : this;
} }
Scope.prototype.add = function(name, type, immediate) { Scope.prototype.add = function(name, type, immediate) {
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
}; };
Scope.prototype.namedMethod = function() { Scope.prototype.namedMethod = function() {
var _ref1; var ref;
if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) { if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {
return this.method; return this.method;
} }
return this.parent.namedMethod(); return this.parent.namedMethod();
...@@ -61,23 +61,26 @@ ...@@ -61,23 +61,26 @@
}; };
Scope.prototype.check = function(name) { Scope.prototype.check = function(name) {
var _ref1; var ref;
return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); return !!(this.type(name) || ((ref = this.parent) != null ? ref.check(name) : void 0));
}; };
Scope.prototype.temporary = function(name, index) { Scope.prototype.temporary = function(name, index, single) {
if (name.length > 1) { if (single == null) {
return '_' + name + (index > 1 ? index - 1 : ''); single = false;
}
if (single) {
return (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a');
} else { } else {
return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); return name + (index || '');
} }
}; };
Scope.prototype.type = function(name) { Scope.prototype.type = function(name) {
var v, _i, _len, _ref1; var i, len, ref, v;
_ref1 = this.variables; ref = this.variables;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (i = 0, len = ref.length; i < len; i++) {
v = _ref1[_i]; v = ref[i];
if (v.name === name) { if (v.name === name) {
return v.type; return v.type;
} }
...@@ -85,16 +88,20 @@ ...@@ -85,16 +88,20 @@
return null; return null;
}; };
Scope.prototype.freeVariable = function(name, reserve) { Scope.prototype.freeVariable = function(name, options) {
var index, temp; var index, ref, temp;
if (reserve == null) { if (options == null) {
reserve = true; options = {};
} }
index = 0; index = 0;
while (this.check((temp = this.temporary(name, index)))) { while (true) {
temp = this.temporary(name, index, options.single);
if (!(this.check(temp) || indexOf.call(this.root.referencedVars, temp) >= 0)) {
break;
}
index++; index++;
} }
if (reserve) { if ((ref = options.reserve) != null ? ref : true) {
this.add(temp, 'var', true); this.add(temp, 'var', true);
} }
return temp; return temp;
...@@ -113,30 +120,32 @@ ...@@ -113,30 +120,32 @@
}; };
Scope.prototype.declaredVariables = function() { Scope.prototype.declaredVariables = function() {
var realVars, tempVars, v, _i, _len, _ref1; var v;
realVars = []; return ((function() {
tempVars = []; var i, len, ref, results;
_ref1 = this.variables; ref = this.variables;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { results = [];
v = _ref1[_i]; for (i = 0, len = ref.length; i < len; i++) {
if (v.type === 'var') { v = ref[i];
(v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); if (v.type === 'var') {
results.push(v.name);
}
} }
} return results;
return realVars.sort().concat(tempVars.sort()); }).call(this)).sort();
}; };
Scope.prototype.assignedVariables = function() { Scope.prototype.assignedVariables = function() {
var v, _i, _len, _ref1, _results; var i, len, ref, results, v;
_ref1 = this.variables; ref = this.variables;
_results = []; results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (i = 0, len = ref.length; i < len; i++) {
v = _ref1[_i]; v = ref[i];
if (v.type.assigned) { if (v.type.assigned) {
_results.push("" + v.name + " = " + v.type.value); results.push(v.name + " = " + v.type.value);
} }
} }
return _results; return results;
}; };
return Scope; return Scope;
......
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.9.1
(function() { (function() {
var LineMap, SourceMap; var LineMap, SourceMap;
LineMap = (function() { LineMap = (function() {
function LineMap(line) { function LineMap(line1) {
this.line = line; this.line = line1;
this.columns = []; this.columns = [];
} }
LineMap.prototype.add = function(column, _arg, options) { LineMap.prototype.add = function(column, arg, options) {
var sourceColumn, sourceLine; var sourceColumn, sourceLine;
sourceLine = _arg[0], sourceColumn = _arg[1]; sourceLine = arg[0], sourceColumn = arg[1];
if (options == null) { if (options == null) {
options = {}; options = {};
} }
...@@ -45,18 +45,18 @@ ...@@ -45,18 +45,18 @@
} }
SourceMap.prototype.add = function(sourceLocation, generatedLocation, options) { SourceMap.prototype.add = function(sourceLocation, generatedLocation, options) {
var column, line, lineMap, _base; var base, column, line, lineMap;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
line = generatedLocation[0], column = generatedLocation[1]; line = generatedLocation[0], column = generatedLocation[1];
lineMap = ((_base = this.lines)[line] || (_base[line] = new LineMap(line))); lineMap = ((base = this.lines)[line] || (base[line] = new LineMap(line)));
return lineMap.add(column, sourceLocation, options); return lineMap.add(column, sourceLocation, options);
}; };
SourceMap.prototype.sourceLocation = function(_arg) { SourceMap.prototype.sourceLocation = function(arg) {
var column, line, lineMap; var column, line, lineMap;
line = _arg[0], column = _arg[1]; line = arg[0], column = arg[1];
while (!((lineMap = this.lines[line]) || (line <= 0))) { while (!((lineMap = this.lines[line]) || (line <= 0))) {
line--; line--;
} }
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
}; };
SourceMap.prototype.generate = function(options, code) { SourceMap.prototype.generate = function(options, code) {
var buffer, lastColumn, lastSourceColumn, lastSourceLine, lineMap, lineNumber, mapping, needComma, v3, writingline, _i, _j, _len, _len1, _ref, _ref1; var buffer, i, j, lastColumn, lastSourceColumn, lastSourceLine, len, len1, lineMap, lineNumber, mapping, needComma, ref, ref1, v3, writingline;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
...@@ -77,13 +77,13 @@ ...@@ -77,13 +77,13 @@
lastSourceColumn = 0; lastSourceColumn = 0;
needComma = false; needComma = false;
buffer = ""; buffer = "";
_ref = this.lines; ref = this.lines;
for (lineNumber = _i = 0, _len = _ref.length; _i < _len; lineNumber = ++_i) { for (lineNumber = i = 0, len = ref.length; i < len; lineNumber = ++i) {
lineMap = _ref[lineNumber]; lineMap = ref[lineNumber];
if (lineMap) { if (lineMap) {
_ref1 = lineMap.columns; ref1 = lineMap.columns;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { for (j = 0, len1 = ref1.length; j < len1; j++) {
mapping = _ref1[_j]; mapping = ref1[j];
if (!(mapping)) { if (!(mapping)) {
continue; continue;
} }
......
Copyright 2010 James Halliday (mail@substack.net)
This project is free software released under the MIT/X11 license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});
var path = require('path');
var fs = require('fs');
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
function mkdirP (p, mode, f, made) {
if (typeof mode === 'function' || mode === undefined) {
f = mode;
mode = 0777 & (~process.umask());
}
if (!made) made = null;
var cb = f || function () {};
if (typeof mode === 'string') mode = parseInt(mode, 8);
p = path.resolve(p);
fs.mkdir(p, mode, function (er) {
if (!er) {
made = made || p;
return cb(null, made);
}
switch (er.code) {
case 'ENOENT':
mkdirP(path.dirname(p), mode, function (er, made) {
if (er) cb(er, made);
else mkdirP(p, mode, cb, made);
});
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
fs.stat(p, function (er2, stat) {
// if the stat fails, then that's super weird.
// let the original error be the failure reason.
if (er2 || !stat.isDirectory()) cb(er, made)
else cb(null, made);
});
break;
}
});
}
mkdirP.sync = function sync (p, mode, made) {
if (mode === undefined) {
mode = 0777 & (~process.umask());
}
if (!made) made = null;
if (typeof mode === 'string') mode = parseInt(mode, 8);
p = path.resolve(p);
try {
fs.mkdirSync(p, mode);
made = made || p;
}
catch (err0) {
switch (err0.code) {
case 'ENOENT' :
made = sync(path.dirname(p), mode, made);
sync(p, mode, made);
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
var stat;
try {
stat = fs.statSync(p);
}
catch (err1) {
throw err0;
}
if (!stat.isDirectory()) throw err0;
break;
}
}
return made;
};
{
"name": "mkdirp",
"description": "Recursively mkdir, like `mkdir -p`",
"version": "0.3.5",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"main": "./index",
"keywords": [
"mkdir",
"directory"
],
"repository": {
"type": "git",
"url": "http://github.com/substack/node-mkdirp.git"
},
"scripts": {
"test": "tap test/*.js"
},
"devDependencies": {
"tap": "~0.4.0"
},
"license": "MIT",
"_id": "mkdirp@0.3.5",
"dist": {
"shasum": "de3e5f8961c88c787ee1368df849ac4413eca8d7",
"tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
},
"_from": "mkdirp@~0.3.5",
"_npmVersion": "1.2.2",
"_npmUser": {
"name": "substack",
"email": "mail@substack.net"
},
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"directories": {},
"_shasum": "de3e5f8961c88c787ee1368df849ac4413eca8d7",
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz",
"bugs": {
"url": "https://github.com/substack/node-mkdirp/issues"
},
"readme": "ERROR: No README data found!"
}
(The MIT License) (The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> 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 Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the 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