coffee-script
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -35,12 +35,9 @@ var CoffeeScript, compile, runScripts, | ||
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)) { | ||
compile = function(code, options) { | ||
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"; | ||
options.inlineMap = true; | ||
return CoffeeScript.compile(code, options); | ||
}; | ||
@@ -47,0 +44,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -49,3 +49,3 @@ var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; | ||
exports.run = function() { | ||
var arg, args, e, error, i, len, ref, results; | ||
var arg, args, e, i, len, ref, results; | ||
global.__originalDirname = fs.realpathSync('.'); | ||
@@ -52,0 +52,0 @@ process.chdir(cakefileDirectory(__originalDirname)); |
@@ -1,6 +0,5 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
var Lexer, SourceMap, base, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors, | ||
hasProp = {}.hasOwnProperty, | ||
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 Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -21,3 +20,3 @@ fs = require('fs'); | ||
exports.VERSION = '1.10.0'; | ||
exports.VERSION = '1.11.0'; | ||
@@ -28,5 +27,16 @@ exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md']; | ||
base64encode = function(src) { | ||
switch (false) { | ||
case typeof Buffer !== 'function': | ||
return new Buffer(src).toString('base64'); | ||
case typeof btoa !== 'function': | ||
return btoa(src); | ||
default: | ||
throw new Error('Unable to base64 encode inline sourcemap.'); | ||
} | ||
}; | ||
withPrettyErrors = function(fn) { | ||
return function(code, options) { | ||
var err, error; | ||
var err; | ||
if (options == null) { | ||
@@ -48,6 +58,7 @@ options = {}; | ||
exports.compile = compile = withPrettyErrors(function(code, options) { | ||
var answer, currentColumn, currentLine, extend, fragment, fragments, header, i, js, len, map, merge, newLines, token, tokens; | ||
var currentColumn, currentLine, encoded, extend, fragment, fragments, generateSourceMap, header, i, j, js, len, len1, map, merge, newLines, ref, ref1, sourceMapDataURI, sourceURL, token, tokens, v3SourceMap; | ||
merge = helpers.merge, extend = helpers.extend; | ||
options = extend({}, options); | ||
if (options.sourceMap) { | ||
generateSourceMap = options.sourceMap || options.inlineMap; | ||
if (generateSourceMap) { | ||
map = new SourceMap; | ||
@@ -61,3 +72,3 @@ } | ||
token = tokens[i]; | ||
if (token.variable) { | ||
if (token[0] === 'IDENTIFIER') { | ||
results.push(token[1]); | ||
@@ -68,2 +79,11 @@ } | ||
})(); | ||
if (!((options.bare != null) && options.bare === true)) { | ||
for (i = 0, len = tokens.length; i < len; i++) { | ||
token = tokens[i]; | ||
if ((ref = token[0]) === 'IMPORT' || ref === 'EXPORT') { | ||
options.bare = true; | ||
break; | ||
} | ||
} | ||
} | ||
fragments = parser.parse(tokens).compileToFragments(options); | ||
@@ -79,5 +99,5 @@ currentLine = 0; | ||
js = ""; | ||
for (i = 0, len = fragments.length; i < len; i++) { | ||
fragment = fragments[i]; | ||
if (options.sourceMap) { | ||
for (j = 0, len1 = fragments.length; j < len1; j++) { | ||
fragment = fragments[j]; | ||
if (generateSourceMap) { | ||
if (fragment.locationData && !/^[;\s]*$/.test(fragment.code)) { | ||
@@ -102,9 +122,17 @@ map.add([fragment.locationData.first_line, fragment.locationData.first_column], [currentLine, currentColumn], { | ||
} | ||
if (generateSourceMap) { | ||
v3SourceMap = map.generate(options, code); | ||
} | ||
if (options.inlineMap) { | ||
encoded = base64encode(JSON.stringify(v3SourceMap)); | ||
sourceMapDataURI = "//# sourceMappingURL=data:application/json;base64," + encoded; | ||
sourceURL = "//# sourceURL=" + ((ref1 = options.filename) != null ? ref1 : 'coffeescript'); | ||
js = js + "\n" + sourceMapDataURI + "\n" + sourceURL; | ||
} | ||
if (options.sourceMap) { | ||
answer = { | ||
js: js | ||
return { | ||
js: js, | ||
sourceMap: map, | ||
v3SourceMap: JSON.stringify(v3SourceMap, null, 2) | ||
}; | ||
answer.sourceMap = map; | ||
answer.v3SourceMap = map.generate(options, code); | ||
return answer; | ||
} else { | ||
@@ -216,17 +244,22 @@ return js; | ||
ref = this.FILE_EXTENSIONS; | ||
fn1 = function(ext) { | ||
var base; | ||
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() { | ||
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files."); | ||
}; | ||
}; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
ext = ref[i]; | ||
if ((base = require.extensions)[ext] == null) { | ||
base[ext] = function() { | ||
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files."); | ||
}; | ||
} | ||
fn1(ext); | ||
} | ||
} | ||
exports._compileFile = function(filename, sourceMap) { | ||
var answer, err, error, raw, stripped; | ||
exports._compileFile = function(filename, sourceMap, inlineMap) { | ||
var answer, err, raw, stripped; | ||
if (sourceMap == null) { | ||
sourceMap = false; | ||
} | ||
if (inlineMap == null) { | ||
inlineMap = false; | ||
} | ||
raw = fs.readFileSync(filename, 'utf8'); | ||
@@ -238,2 +271,4 @@ stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw; | ||
sourceMap: sourceMap, | ||
inlineMap: inlineMap, | ||
sourceFiles: [filename], | ||
literate: helpers.isLiterate(filename) | ||
@@ -285,3 +320,3 @@ }); | ||
return 'indentation'; | ||
case errorTag !== 'IDENTIFIER' && errorTag !== 'NUMBER' && errorTag !== 'STRING' && errorTag !== 'STRING_START' && errorTag !== 'REGEX' && errorTag !== 'REGEX_START': | ||
case errorTag !== 'IDENTIFIER' && errorTag !== 'NUMBER' && errorTag !== 'INFINITY' && errorTag !== 'STRING' && errorTag !== 'STRING_START' && errorTag !== 'REGEX' && errorTag !== 'REGEX_START': | ||
return errorTag.replace(/_START$/, '').toLowerCase(); | ||
@@ -346,11 +381,15 @@ default: | ||
getSourceMap = function(filename) { | ||
var answer, ref1; | ||
var answer, j, len1, ref1; | ||
if (sourceMaps[filename]) { | ||
return sourceMaps[filename]; | ||
} | ||
if (ref1 = path != null ? path.extname(filename) : void 0, indexOf.call(exports.FILE_EXTENSIONS, ref1) < 0) { | ||
return; | ||
ref1 = exports.FILE_EXTENSIONS; | ||
for (j = 0, len1 = ref1.length; j < len1; j++) { | ||
ext = ref1[j]; | ||
if (helpers.ends(filename, ext)) { | ||
answer = exports._compileFile(filename, true); | ||
return sourceMaps[filename] = answer.sourceMap; | ||
} | ||
} | ||
answer = exports._compileFile(filename, true); | ||
return sourceMaps[filename] = answer.sourceMap; | ||
return null; | ||
}; | ||
@@ -357,0 +396,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -38,3 +38,3 @@ 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, | ||
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']]; | ||
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'], ['-M', '--inline-map', 'generate source map and include it directly in output'], ['-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']]; | ||
@@ -116,3 +116,3 @@ opts = {}; | ||
compilePath = function(source, topLevel, base) { | ||
var code, err, error, error1, error2, file, files, i, len, results, stats; | ||
var code, err, file, files, i, len, results, stats; | ||
if (indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) { | ||
@@ -145,4 +145,4 @@ return; | ||
files = fs.readdirSync(source); | ||
} catch (error1) { | ||
err = error1; | ||
} catch (error) { | ||
err = error; | ||
if (err.code === 'ENOENT') { | ||
@@ -169,4 +169,4 @@ return; | ||
code = fs.readFileSync(source); | ||
} catch (error2) { | ||
err = error2; | ||
} catch (error) { | ||
err = error; | ||
if (err.code === 'ENOENT') { | ||
@@ -185,3 +185,3 @@ return; | ||
findDirectoryIndex = function(source) { | ||
var err, error, ext, i, index, len, ref1; | ||
var err, ext, i, index, len, ref1; | ||
ref1 = CoffeeScript.FILE_EXTENSIONS; | ||
@@ -207,3 +207,3 @@ for (i = 0, len = ref1.length; i < len; i++) { | ||
compileScript = function(file, input, base) { | ||
var compiled, err, error, message, o, options, t, task; | ||
var compiled, err, message, o, options, t, task; | ||
if (base == null) { | ||
@@ -257,3 +257,3 @@ base = null; | ||
} | ||
message = err.stack || ("" + err); | ||
message = (err != null ? err.stack : void 0) || ("" + err); | ||
if (o.watch) { | ||
@@ -269,12 +269,12 @@ return printLine(message + '\x07'); | ||
compileStdio = function() { | ||
var code, stdin; | ||
code = ''; | ||
var buffers, stdin; | ||
buffers = []; | ||
stdin = process.openStdin(); | ||
stdin.on('data', function(buffer) { | ||
if (buffer) { | ||
return code += buffer.toString(); | ||
return buffers.push(buffer); | ||
} | ||
}); | ||
return stdin.on('end', function() { | ||
return compileScript(null, code); | ||
return compileScript(null, Buffer.concat(buffers).toString()); | ||
}); | ||
@@ -300,3 +300,3 @@ }; | ||
watch = function(source, base) { | ||
var compile, compileTimeout, err, error, prevStats, rewatch, startWatcher, watchErr, watcher; | ||
var compile, compileTimeout, err, prevStats, rewatch, startWatcher, watchErr, watcher; | ||
watcher = null; | ||
@@ -306,3 +306,2 @@ prevStats = null; | ||
watchErr = function(err) { | ||
var error; | ||
if (err.code !== 'ENOENT') { | ||
@@ -366,3 +365,3 @@ throw err; | ||
watchDir = function(source, base) { | ||
var err, error, readdirTimeout, startWatcher, stopWatcher, watcher; | ||
var err, readdirTimeout, startWatcher, stopWatcher, watcher; | ||
watcher = null; | ||
@@ -379,3 +378,3 @@ readdirTimeout = null; | ||
return readdirTimeout = wait(25, function() { | ||
var err, error, file, files, i, len, results; | ||
var err, file, files, i, len, results; | ||
try { | ||
@@ -444,3 +443,3 @@ files = fs.readdirSync(source); | ||
silentUnlink = function(path) { | ||
var err, error, ref1; | ||
var err, ref1; | ||
try { | ||
@@ -576,3 +575,4 @@ return fs.unlinkSync(path); | ||
header: opts.compile && !opts['no-header'], | ||
sourceMap: opts.map | ||
sourceMap: opts.map, | ||
inlineMap: opts['inline-map'] | ||
}; | ||
@@ -579,0 +579,0 @@ if (filename) { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -44,9 +44,18 @@ var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; | ||
], | ||
Line: [o('Expression'), o('Statement')], | ||
Line: [o('Expression'), o('Statement'), o('YieldReturn')], | ||
Statement: [ | ||
o('Return'), o('Comment'), o('STATEMENT', function() { | ||
return new Literal($1); | ||
return new StatementLiteral($1); | ||
}), o('Import'), o('Export') | ||
], | ||
Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw'), o('Yield')], | ||
Yield: [ | ||
o('YIELD', function() { | ||
return new Op($1, new Value(new Literal(''))); | ||
}), o('YIELD Expression', function() { | ||
return new Op($1, $2); | ||
}), o('YIELD FROM Expression', function() { | ||
return new Op($1.concat($2), $3); | ||
}) | ||
], | ||
Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')], | ||
Block: [ | ||
@@ -61,8 +70,13 @@ o('INDENT OUTDENT', function() { | ||
o('IDENTIFIER', function() { | ||
return new Literal($1); | ||
return new IdentifierLiteral($1); | ||
}) | ||
], | ||
Property: [ | ||
o('PROPERTY', function() { | ||
return new PropertyName($1); | ||
}) | ||
], | ||
AlphaNumeric: [ | ||
o('NUMBER', function() { | ||
return new Literal($1); | ||
return new NumberLiteral($1); | ||
}), o('String') | ||
@@ -72,5 +86,5 @@ ], | ||
o('STRING', function() { | ||
return new Literal($1); | ||
return new StringLiteral($1); | ||
}), o('STRING_START Body STRING_END', function() { | ||
return new Parens($2); | ||
return new StringWithInterpolations($2); | ||
}) | ||
@@ -80,5 +94,5 @@ ], | ||
o('REGEX', function() { | ||
return new Literal($1); | ||
return new RegexLiteral($1); | ||
}), o('REGEX_START Invocation REGEX_END', function() { | ||
return $2; | ||
return new RegexWithInterpolations($2.args); | ||
}) | ||
@@ -88,11 +102,13 @@ ], | ||
o('AlphaNumeric'), o('JS', function() { | ||
return new Literal($1); | ||
}), o('Regex'), o('DEBUGGER', function() { | ||
return new Literal($1); | ||
}), o('UNDEFINED', function() { | ||
return new Undefined; | ||
return new PassthroughLiteral($1); | ||
}), o('Regex'), o('UNDEFINED', function() { | ||
return new UndefinedLiteral; | ||
}), o('NULL', function() { | ||
return new Null; | ||
return new NullLiteral; | ||
}), o('BOOL', function() { | ||
return new Bool($1); | ||
return new BooleanLiteral($1); | ||
}), o('INFINITY', function() { | ||
return new InfinityLiteral($1); | ||
}), o('NAN', function() { | ||
return new NaNLiteral; | ||
}) | ||
@@ -130,3 +146,3 @@ ], | ||
], | ||
SimpleObjAssignable: [o('Identifier'), o('ThisProperty')], | ||
SimpleObjAssignable: [o('Identifier'), o('Property'), o('ThisProperty')], | ||
ObjAssignable: [o('SimpleObjAssignable'), o('AlphaNumeric')], | ||
@@ -140,2 +156,9 @@ Return: [ | ||
], | ||
YieldReturn: [ | ||
o('YIELD RETURN Expression', function() { | ||
return new YieldReturn($3); | ||
}), o('YIELD RETURN', function() { | ||
return new YieldReturn; | ||
}) | ||
], | ||
Comment: [ | ||
@@ -217,12 +240,12 @@ o('HERECOMMENT', function() { | ||
Accessor: [ | ||
o('. Identifier', function() { | ||
o('. Property', function() { | ||
return new Access($2); | ||
}), o('?. Identifier', function() { | ||
}), o('?. Property', function() { | ||
return new Access($2, 'soak'); | ||
}), o(':: Identifier', function() { | ||
return [LOC(1)(new Access(new Literal('prototype'))), LOC(2)(new Access($2))]; | ||
}), o('?:: Identifier', function() { | ||
return [LOC(1)(new Access(new Literal('prototype'), 'soak')), LOC(2)(new Access($2))]; | ||
}), o(':: Property', function() { | ||
return [LOC(1)(new Access(new PropertyName('prototype'))), LOC(2)(new Access($2))]; | ||
}), o('?:: Property', function() { | ||
return [LOC(1)(new Access(new PropertyName('prototype'), 'soak')), LOC(2)(new Access($2))]; | ||
}), o('::', function() { | ||
return new Access(new Literal('prototype')); | ||
return new Access(new PropertyName('prototype')); | ||
}), o('Index') | ||
@@ -283,2 +306,98 @@ ], | ||
], | ||
Import: [ | ||
o('IMPORT String', function() { | ||
return new ImportDeclaration(null, $2); | ||
}), o('IMPORT ImportDefaultSpecifier FROM String', function() { | ||
return new ImportDeclaration(new ImportClause($2, null), $4); | ||
}), o('IMPORT ImportNamespaceSpecifier FROM String', function() { | ||
return new ImportDeclaration(new ImportClause(null, $2), $4); | ||
}), o('IMPORT { } FROM String', function() { | ||
return new ImportDeclaration(new ImportClause(null, new ImportSpecifierList([])), $5); | ||
}), o('IMPORT { ImportSpecifierList OptComma } FROM String', function() { | ||
return new ImportDeclaration(new ImportClause(null, new ImportSpecifierList($3)), $7); | ||
}), o('IMPORT ImportDefaultSpecifier , ImportNamespaceSpecifier FROM String', function() { | ||
return new ImportDeclaration(new ImportClause($2, $4), $6); | ||
}), o('IMPORT ImportDefaultSpecifier , { ImportSpecifierList OptComma } FROM String', function() { | ||
return new ImportDeclaration(new ImportClause($2, new ImportSpecifierList($5)), $9); | ||
}) | ||
], | ||
ImportSpecifierList: [ | ||
o('ImportSpecifier', function() { | ||
return [$1]; | ||
}), o('ImportSpecifierList , ImportSpecifier', function() { | ||
return $1.concat($3); | ||
}), o('ImportSpecifierList OptComma TERMINATOR ImportSpecifier', function() { | ||
return $1.concat($4); | ||
}), o('INDENT ImportSpecifierList OptComma OUTDENT', function() { | ||
return $2; | ||
}), o('ImportSpecifierList OptComma INDENT ImportSpecifierList OptComma OUTDENT', function() { | ||
return $1.concat($4); | ||
}) | ||
], | ||
ImportSpecifier: [ | ||
o('Identifier', function() { | ||
return new ImportSpecifier($1); | ||
}), o('Identifier AS Identifier', function() { | ||
return new ImportSpecifier($1, $3); | ||
}) | ||
], | ||
ImportDefaultSpecifier: [ | ||
o('Identifier', function() { | ||
return new ImportDefaultSpecifier($1); | ||
}) | ||
], | ||
ImportNamespaceSpecifier: [ | ||
o('IMPORT_ALL AS Identifier', function() { | ||
return new ImportNamespaceSpecifier(new Literal($1), $3); | ||
}) | ||
], | ||
Export: [ | ||
o('EXPORT { }', function() { | ||
return new ExportNamedDeclaration(new ExportSpecifierList([])); | ||
}), o('EXPORT { ExportSpecifierList OptComma }', function() { | ||
return new ExportNamedDeclaration(new ExportSpecifierList($3)); | ||
}), o('EXPORT Class', function() { | ||
return new ExportNamedDeclaration($2); | ||
}), o('EXPORT Identifier = Expression', function() { | ||
return new ExportNamedDeclaration(new Assign($2, $4, null, { | ||
moduleDeclaration: 'export' | ||
})); | ||
}), o('EXPORT Identifier = TERMINATOR Expression', function() { | ||
return new ExportNamedDeclaration(new Assign($2, $5, null, { | ||
moduleDeclaration: 'export' | ||
})); | ||
}), o('EXPORT Identifier = INDENT Expression OUTDENT', function() { | ||
return new ExportNamedDeclaration(new Assign($2, $5, null, { | ||
moduleDeclaration: 'export' | ||
})); | ||
}), o('EXPORT DEFAULT Expression', function() { | ||
return new ExportDefaultDeclaration($3); | ||
}), o('EXPORT EXPORT_ALL FROM String', function() { | ||
return new ExportAllDeclaration(new Literal($2), $4); | ||
}), o('EXPORT { ExportSpecifierList OptComma } FROM String', function() { | ||
return new ExportNamedDeclaration(new ExportSpecifierList($3), $7); | ||
}) | ||
], | ||
ExportSpecifierList: [ | ||
o('ExportSpecifier', function() { | ||
return [$1]; | ||
}), o('ExportSpecifierList , ExportSpecifier', function() { | ||
return $1.concat($3); | ||
}), o('ExportSpecifierList OptComma TERMINATOR ExportSpecifier', function() { | ||
return $1.concat($4); | ||
}), o('INDENT ExportSpecifierList OptComma OUTDENT', function() { | ||
return $2; | ||
}), o('ExportSpecifierList OptComma INDENT ExportSpecifierList OptComma OUTDENT', function() { | ||
return $1.concat($4); | ||
}) | ||
], | ||
ExportSpecifier: [ | ||
o('Identifier', function() { | ||
return new ExportSpecifier($1); | ||
}), o('Identifier AS Identifier', function() { | ||
return new ExportSpecifier($1, $3); | ||
}), o('Identifier AS DEFAULT', function() { | ||
return new ExportSpecifier($1, new Literal($3)); | ||
}) | ||
], | ||
Invocation: [ | ||
@@ -289,6 +408,9 @@ o('Value OptFuncExist Arguments', function() { | ||
return new Call($1, $3, $2); | ||
}), o('SUPER', function() { | ||
return new Call('super', [new Splat(new Literal('arguments'))]); | ||
}), o('Super') | ||
], | ||
Super: [ | ||
o('SUPER', function() { | ||
return new SuperCall; | ||
}), o('SUPER Arguments', function() { | ||
return new Call('super', $2); | ||
return new SuperCall($2); | ||
}) | ||
@@ -312,10 +434,10 @@ ], | ||
o('THIS', function() { | ||
return new Value(new Literal('this')); | ||
return new Value(new ThisLiteral); | ||
}), o('@', function() { | ||
return new Value(new Literal('this')); | ||
return new Value(new ThisLiteral); | ||
}) | ||
], | ||
ThisProperty: [ | ||
o('@ Identifier', function() { | ||
return new Value(LOC(1)(new Literal('this')), [LOC(2)(new Access($2))], 'this'); | ||
o('@ Property', function() { | ||
return new Value(LOC(1)(new ThisLiteral), [LOC(2)(new Access($2))], 'this'); | ||
}) | ||
@@ -439,5 +561,5 @@ ], | ||
o('LOOP Block', function() { | ||
return new While(LOC(1)(new Literal('true'))).addBody($2); | ||
return new While(LOC(1)(new BooleanLiteral('true'))).addBody($2); | ||
}), o('LOOP Expression', function() { | ||
return new While(LOC(1)(new Literal('true'))).addBody(LOC(2)(Block.wrap([$2]))); | ||
return new While(LOC(1)(new BooleanLiteral('true'))).addBody(LOC(2)(Block.wrap([$2]))); | ||
}) | ||
@@ -595,8 +717,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() { | ||
@@ -644,3 +760,3 @@ return new Op('--', $2); | ||
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']]; | ||
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', 'IMPORT', 'EXPORT'], ['left', 'POST_IF']]; | ||
@@ -647,0 +763,0 @@ tokens = []; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -87,5 +87,6 @@ var buildLocationData, extend, flatten, ref, repeat, syntaxErrorToString; | ||
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]; | ||
var e, i, len1, ref1; | ||
ref1 = this; | ||
for (i = 0, len1 = ref1.length; i < len1; i++) { | ||
e = ref1[i]; | ||
if (fn(e)) { | ||
@@ -92,0 +93,0 @@ return true; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var key, ref, val; |
@@ -1,5 +0,6 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVALID_ESCAPE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, key, locationDataToString, ref, ref1, repeat, starts, throwSyntaxError, | ||
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 BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVALID_ESCAPE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isUnassignable, key, locationDataToString, ref, ref1, repeat, starts, throwSyntaxError, | ||
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; }, | ||
slice = [].slice; | ||
@@ -27,2 +28,4 @@ ref = require('./rewriter'), Rewriter = ref.Rewriter, INVERSES = ref.INVERSES; | ||
this.seenFor = false; | ||
this.seenImport = false; | ||
this.seenExport = false; | ||
this.chunkLine = opts.line || 0; | ||
@@ -69,3 +72,3 @@ this.chunkColumn = opts.column || 0; | ||
Lexer.prototype.identifierToken = function() { | ||
var alias, colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, ref2, ref3, ref4, ref5, tag, tagToken; | ||
var alias, colon, colonOffset, id, idLength, input, match, poppedToken, prev, ref2, ref3, ref4, ref5, tag, tagToken; | ||
if (!(match = IDENTIFIER.exec(this.chunk))) { | ||
@@ -85,6 +88,20 @@ return 0; | ||
} | ||
if (id === 'as' && this.seenImport && (this.tag() === 'IDENTIFIER' || this.value() === '*')) { | ||
if (this.value() === '*') { | ||
this.tokens[this.tokens.length - 1][0] = 'IMPORT_ALL'; | ||
} | ||
this.token('AS', id); | ||
return id.length; | ||
} | ||
if (id === 'as' && this.seenExport && this.tag() === 'IDENTIFIER') { | ||
this.token('AS', id); | ||
return id.length; | ||
} | ||
if (id === 'default' && this.seenExport) { | ||
this.token('DEFAULT', id); | ||
return id.length; | ||
} | ||
ref2 = this.tokens, prev = ref2[ref2.length - 1]; | ||
forcedIdentifier = colon || (prev != null) && (((ref3 = prev[0]) === '.' || ref3 === '?.' || ref3 === '::' || ref3 === '?::') || !prev.spaced && prev[0] === '@'); | ||
tag = 'IDENTIFIER'; | ||
if (!forcedIdentifier && (indexOf.call(JS_KEYWORDS, id) >= 0 || indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { | ||
tag = colon || (prev != null) && (((ref3 = prev[0]) === '.' || ref3 === '?.' || ref3 === '::' || ref3 === '?::') || !prev.spaced && prev[0] === '@') ? 'PROPERTY' : 'IDENTIFIER'; | ||
if (tag === 'IDENTIFIER' && (indexOf.call(JS_KEYWORDS, id) >= 0 || indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { | ||
tag = id.toUpperCase(); | ||
@@ -97,2 +114,6 @@ if (tag === 'WHEN' && (ref4 = this.tag(), indexOf.call(LINE_BREAK, ref4) >= 0)) { | ||
tag = 'IF'; | ||
} else if (tag === 'IMPORT') { | ||
this.seenImport = true; | ||
} else if (tag === 'EXPORT') { | ||
this.seenExport = true; | ||
} else if (indexOf.call(UNARY, tag) >= 0) { | ||
@@ -113,14 +134,8 @@ tag = 'UNARY'; | ||
} | ||
if (indexOf.call(JS_FORBIDDEN, id) >= 0) { | ||
if (forcedIdentifier) { | ||
tag = 'IDENTIFIER'; | ||
id = new String(id); | ||
id.reserved = true; | ||
} else if (indexOf.call(RESERVED, id) >= 0) { | ||
this.error("reserved word '" + id + "'", { | ||
length: id.length | ||
}); | ||
} | ||
if (tag === 'IDENTIFIER' && indexOf.call(RESERVED, id) >= 0) { | ||
this.error("reserved word '" + id + "'", { | ||
length: id.length | ||
}); | ||
} | ||
if (!forcedIdentifier) { | ||
if (tag !== 'PROPERTY') { | ||
if (indexOf.call(COFFEE_ALIASES, id) >= 0) { | ||
@@ -145,2 +160,3 @@ alias = id; | ||
case 'continue': | ||
case 'debugger': | ||
return 'STATEMENT'; | ||
@@ -156,3 +172,2 @@ default: | ||
} | ||
tagToken.variable = !forcedIdentifier; | ||
if (poppedToken) { | ||
@@ -169,3 +184,3 @@ ref5 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = ref5[0], tagToken[2].first_column = ref5[1]; | ||
Lexer.prototype.numberToken = function() { | ||
var binaryLiteral, lexedLength, match, number, octalLiteral; | ||
var binaryLiteral, lexedLength, match, number, numberValue, octalLiteral, tag; | ||
if (!(match = NUMBER.exec(this.chunk))) { | ||
@@ -194,8 +209,12 @@ return 0; | ||
if (octalLiteral = /^0o([0-7]+)/.exec(number)) { | ||
number = '0x' + parseInt(octalLiteral[1], 8).toString(16); | ||
numberValue = parseInt(octalLiteral[1], 8); | ||
number = "0x" + (numberValue.toString(16)); | ||
} else if (binaryLiteral = /^0b([01]+)/.exec(number)) { | ||
numberValue = parseInt(binaryLiteral[1], 2); | ||
number = "0x" + (numberValue.toString(16)); | ||
} else { | ||
numberValue = parseFloat(number); | ||
} | ||
if (binaryLiteral = /^0b([01]+)/.exec(number)) { | ||
number = '0x' + parseInt(binaryLiteral[1], 2).toString(16); | ||
} | ||
this.token('NUMBER', number, 0, lexedLength); | ||
tag = numberValue === 2e308 ? 'INFINITY' : 'NUMBER'; | ||
this.token(tag, number, 0, lexedLength); | ||
return lexedLength; | ||
@@ -210,2 +229,5 @@ }; | ||
} | ||
if (this.tokens.length && this.value() === 'from' && (this.seenImport || this.seenExport)) { | ||
this.tokens[this.tokens.length - 1][0] = 'FROM'; | ||
} | ||
regex = (function() { | ||
@@ -505,3 +527,3 @@ switch (quote) { | ||
Lexer.prototype.literalToken = function() { | ||
var match, prev, ref2, ref3, ref4, ref5, ref6, tag, token, value; | ||
var match, message, origin, prev, ref2, ref3, ref4, ref5, ref6, skipToken, tag, token, value; | ||
if (match = OPERATOR.exec(this.chunk)) { | ||
@@ -517,12 +539,18 @@ value = match[0]; | ||
ref2 = this.tokens, prev = ref2[ref2.length - 1]; | ||
if (value === '=' && prev) { | ||
if (!prev[1].reserved && (ref3 = prev[1], indexOf.call(JS_FORBIDDEN, ref3) >= 0)) { | ||
if (prev.origin) { | ||
prev = prev.origin; | ||
if (prev && indexOf.call(['='].concat(slice.call(COMPOUND_ASSIGN)), value) >= 0) { | ||
skipToken = false; | ||
if (value === '=' && ((ref3 = prev[1]) === '||' || ref3 === '&&') && !prev.spaced) { | ||
prev[0] = 'COMPOUND_ASSIGN'; | ||
prev[1] += '='; | ||
prev = this.tokens[this.tokens.length - 2]; | ||
skipToken = true; | ||
} | ||
if (prev && prev[0] !== 'PROPERTY') { | ||
origin = (ref4 = prev.origin) != null ? ref4 : prev; | ||
message = isUnassignable(prev[1], origin[1]); | ||
if (message) { | ||
this.error(message, origin[2]); | ||
} | ||
this.error("reserved word '" + prev[1] + "' can't be assigned", prev[2]); | ||
} | ||
if ((ref4 = prev[1]) === '||' || ref4 === '&&') { | ||
prev[0] = 'COMPOUND_ASSIGN'; | ||
prev[1] += '='; | ||
if (skipToken) { | ||
return value.length; | ||
@@ -532,4 +560,6 @@ } | ||
if (value === ';') { | ||
this.seenFor = false; | ||
this.seenFor = this.seenImport = this.seenExport = false; | ||
tag = 'TERMINATOR'; | ||
} else if (value === '*' && prev[0] === 'EXPORT') { | ||
tag = 'EXPORT_ALL'; | ||
} else if (indexOf.call(MATH, value) >= 0) { | ||
@@ -780,3 +810,3 @@ tag = 'MATH'; | ||
ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = ref2[0], locationData.first_column = ref2[1]; | ||
lastCharacter = Math.max(0, length - 1); | ||
lastCharacter = length > 0 ? length - 1 : 0; | ||
ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = ref3[0], locationData.last_column = ref3[1]; | ||
@@ -811,3 +841,3 @@ token = [tag, value, locationData]; | ||
var ref2; | ||
return LINE_CONTINUER.test(this.chunk) || ((ref2 = this.tag()) === '\\' || ref2 === '.' || ref2 === '?.' || ref2 === '?::' || ref2 === 'UNARY' || ref2 === 'MATH' || ref2 === 'UNARY_MATH' || ref2 === '+' || ref2 === '-' || ref2 === 'YIELD' || ref2 === '**' || ref2 === 'SHIFT' || ref2 === 'RELATION' || ref2 === 'COMPARE' || ref2 === 'LOGIC' || ref2 === 'THROW' || ref2 === 'EXTENDS'); | ||
return LINE_CONTINUER.test(this.chunk) || ((ref2 = this.tag()) === '\\' || ref2 === '.' || ref2 === '?.' || ref2 === '?::' || ref2 === 'UNARY' || ref2 === 'MATH' || ref2 === 'UNARY_MATH' || ref2 === '+' || ref2 === '-' || ref2 === '**' || ref2 === 'SHIFT' || ref2 === 'RELATION' || ref2 === 'COMPARE' || ref2 === 'LOGIC' || ref2 === 'THROW' || ref2 === 'EXTENDS'); | ||
}; | ||
@@ -901,6 +931,24 @@ | ||
JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'yield', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; | ||
isUnassignable = function(name, displayName) { | ||
if (displayName == null) { | ||
displayName = name; | ||
} | ||
switch (false) { | ||
case indexOf.call(slice.call(JS_KEYWORDS).concat(slice.call(COFFEE_KEYWORDS)), name) < 0: | ||
return "keyword '" + displayName + "' can't be assigned"; | ||
case indexOf.call(STRICT_PROSCRIBED, name) < 0: | ||
return "'" + displayName + "' can't be assigned"; | ||
case indexOf.call(RESERVED, name) < 0: | ||
return "reserved word '" + displayName + "' can't be assigned"; | ||
default: | ||
return false; | ||
} | ||
}; | ||
COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; | ||
exports.isUnassignable = isUnassignable; | ||
JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'yield', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super', 'import', 'export', 'default']; | ||
COFFEE_KEYWORDS = ['undefined', 'Infinity', 'NaN', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; | ||
COFFEE_ALIAS_MAP = { | ||
@@ -929,12 +977,8 @@ and: '&&', | ||
RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static']; | ||
RESERVED = ['case', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'native', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static']; | ||
STRICT_PROSCRIBED = ['arguments', 'eval', 'yield*']; | ||
STRICT_PROSCRIBED = ['arguments', 'eval']; | ||
JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); | ||
exports.JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); | ||
exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); | ||
exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; | ||
BOM = 65279; | ||
@@ -1018,5 +1062,5 @@ | ||
CALLABLE = ['IDENTIFIER', ')', ']', '?', '@', 'THIS', 'SUPER']; | ||
CALLABLE = ['IDENTIFIER', 'PROPERTY', ')', ']', '?', '@', 'THIS', 'SUPER']; | ||
INDEXABLE = CALLABLE.concat(['NUMBER', 'STRING', 'STRING_END', 'REGEX', 'REGEX_END', 'BOOL', 'NULL', 'UNDEFINED', '}', '::']); | ||
INDEXABLE = CALLABLE.concat(['NUMBER', 'INFINITY', 'NAN', 'STRING', 'STRING_END', 'REGEX', 'REGEX_END', 'BOOL', 'NULL', 'UNDEFINED', '}', '::']); | ||
@@ -1023,0 +1067,0 @@ NOT_REGEX = INDEXABLE.concat(['++', '--']); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -15,3 +15,3 @@ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref; | ||
var answer; | ||
answer = CoffeeScript._compileFile(filename, false); | ||
answer = CoffeeScript._compileFile(filename, false, true); | ||
return module._compile(answer, filename); | ||
@@ -18,0 +18,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -22,3 +22,3 @@ var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, ref, replDefaults, runInContext, updateSyntaxError, vm; | ||
"eval": function(input, context, filename, cb) { | ||
var Assign, Block, Literal, Value, ast, err, error, js, ref1, referencedVars, token, tokens; | ||
var Assign, Block, Literal, Value, ast, err, js, ref1, referencedVars, token, tokens; | ||
input = input.replace(/\uFF00/g, '\n'); | ||
@@ -34,3 +34,3 @@ input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); | ||
token = tokens[i]; | ||
if (token.variable) { | ||
if (token[0] === 'IDENTIFIER') { | ||
results.push(token[1]); | ||
@@ -140,6 +140,6 @@ } | ||
lastLine = repl.rli.history[0]; | ||
} catch (undefined) {} | ||
} catch (error) {} | ||
fd = fs.openSync(filename, 'a'); | ||
repl.rli.addListener('line', function(code) { | ||
if (code && code.length && code !== '.history' && lastLine !== code) { | ||
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) { | ||
fs.write(fd, code + "\n"); | ||
@@ -146,0 +146,0 @@ return lastLine = code; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -488,5 +488,5 @@ var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, k, left, len, ref, rite, | ||
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; | ||
IMPLICIT_FUNC = ['IDENTIFIER', 'PROPERTY', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; | ||
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'STRING_START', 'JS', 'REGEX', 'REGEX_START', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'YIELD', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++']; | ||
IMPLICIT_CALL = ['IDENTIFIER', 'PROPERTY', 'NUMBER', 'INFINITY', 'NAN', 'STRING', 'STRING_START', 'REGEX', 'REGEX_START', 'JS', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'UNDEFINED', 'NULL', 'BOOL', 'UNARY', 'YIELD', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++']; | ||
@@ -493,0 +493,0 @@ IMPLICIT_UNSPACED_CALL = ['+', '-']; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -69,2 +69,3 @@ var Scope, | ||
Scope.prototype.temporary = function(name, index, single) { | ||
var diff, endCode, letter, newCode, num, startCode; | ||
if (single == null) { | ||
@@ -74,5 +75,11 @@ single = false; | ||
if (single) { | ||
return (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); | ||
startCode = name.charCodeAt(0); | ||
endCode = 'z'.charCodeAt(0); | ||
diff = endCode - startCode; | ||
newCode = startCode + index % (diff + 1); | ||
letter = String.fromCharCode(newCode); | ||
num = Math.floor(index / (diff + 1)); | ||
return "" + letter + (num || ''); | ||
} else { | ||
return name + (index || ''); | ||
return "" + name + (index || ''); | ||
} | ||
@@ -79,0 +86,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.10.0 | ||
// Generated by CoffeeScript 1.11.0 | ||
(function() { | ||
@@ -119,6 +119,6 @@ var LineMap, SourceMap; | ||
}; | ||
if (options.inline) { | ||
if (options.inlineMap) { | ||
v3.sourcesContent = [code]; | ||
} | ||
return JSON.stringify(v3, null, 2); | ||
return v3; | ||
}; | ||
@@ -125,0 +125,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"author": "Jeremy Ashkenas", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"license": "MIT", | ||
@@ -25,2 +25,8 @@ "engines": { | ||
}, | ||
"files": [ | ||
"bin", | ||
"lib", | ||
"register.js", | ||
"repl.js" | ||
], | ||
"preferGlobal": true, | ||
@@ -40,3 +46,3 @@ "scripts": { | ||
"jison": ">=0.2.0", | ||
"highlight.js": "~8.0.0", | ||
"highlight.js": "~9.6.0", | ||
"underscore": "~1.5.2", | ||
@@ -43,0 +49,0 @@ "docco": "~0.7.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
375754
8681
23
5