Socket
Socket
Sign inDemoInstall

coffeescript

Package Overview
Dependencies
0
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.1 to 2.5.0

4

lib/coffeescript/browser.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -129,3 +129,3 @@ // This **Browser** compatibility layer extends core CoffeeScript functions

// only one CoffeeScript script block to parse.
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${i !== 0 ? i : ''}`;
options.sourceFiles = ['embedded'];

@@ -132,0 +132,0 @@ return coffees[i] = [script.innerHTML, options];

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -3,0 +3,0 @@ // `cake` is a simplified version of [Make](http://www.gnu.org/software/make/)

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -106,3 +106,3 @@ // CoffeeScript can be used both on the server, as a command-line compiler based

exports.compile = compile = withPrettyErrors(function(code, options = {}) {
var currentColumn, currentLine, encoded, filename, fragment, fragments, generateSourceMap, header, i, j, js, len, len1, map, newLines, ref, ref1, sourceMapDataURI, sourceURL, token, tokens, transpiler, transpilerOptions, transpilerOutput, v3SourceMap;
var ast, currentColumn, currentLine, encoded, filename, fragment, fragments, generateSourceMap, header, i, j, js, len, len1, map, newLines, nodes, range, ref, ref1, sourceCodeLastLine, sourceCodeNumberOfLines, sourceMapDataURI, sourceURL, token, tokens, transpiler, transpilerOptions, transpilerOutput, v3SourceMap;
// Clone `options`, to avoid mutating the `options` object passed in.

@@ -117,3 +117,3 @@ options = Object.assign({}, options);

if (generateSourceMap) {
map = new SourceMap;
map = new SourceMap();
}

@@ -144,3 +144,27 @@ tokens = lexer.tokenize(code, options);

}
fragments = parser.parse(tokens).compileToFragments(options);
nodes = parser.parse(tokens);
// If all that was requested was a POJO representation of the nodes, e.g.
// the abstract syntax tree (AST), we can stop now and just return that
// (after fixing the location data for the root/`File`»`Program` node,
// which might’ve gotten misaligned from the original source due to the
// `clean` function in the lexer).
if (options.ast) {
nodes.allCommentTokens = helpers.extractAllCommentTokens(tokens);
sourceCodeNumberOfLines = (code.match(/\r?\n/g) || '').length + 1;
sourceCodeLastLine = /.*$/.exec(code)[0];
ast = nodes.ast(options);
range = [0, code.length];
ast.start = ast.program.start = range[0];
ast.end = ast.program.end = range[1];
ast.range = ast.program.range = range;
ast.loc.start = ast.program.loc.start = {
line: 1,
column: 0
};
ast.loc.end.line = ast.program.loc.end.line = sourceCodeNumberOfLines;
ast.loc.end.column = ast.program.loc.end.column = sourceCodeLastLine.length;
ast.tokens = tokens;
return ast;
}
fragments = nodes.compileToFragments(options);
currentLine = 0;

@@ -234,6 +258,5 @@ if (options.header) {

if (typeof source === 'string') {
return parser.parse(lexer.tokenize(source, options));
} else {
return parser.parse(source);
source = lexer.tokenize(source, options);
}
return parser.parse(source);
});

@@ -251,3 +274,3 @@

// Instantiate a Lexer for our use here.
lexer = new Lexer;
lexer = new Lexer();

@@ -258,2 +281,8 @@ // The real Lexer produces a generic stream of tokens. This object provides a

parser.lexer = {
yylloc: {
range: []
},
options: {
ranges: true
},
lex: function() {

@@ -449,3 +478,5 @@ var tag, token;

if ((args != null ? args.length : void 0) > 1) {
console.error('The script to be run begins with a shebang line with more than one\nargument. This script will fail on platforms such as Linux which only\nallow a single argument.');
console.error(`The script to be run begins with a shebang line with more than one
argument. This script will fail on platforms such as Linux which only
allow a single argument.`);
console.error(`The shebang line was: '${firstLine}' in file '${file}'`);

@@ -452,0 +483,0 @@ return console.error(`The arguments were: ${JSON.stringify(args)}`);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -30,3 +30,3 @@ // The `coffee` utility. Handles command-line compilation of CoffeeScript

// Allow CoffeeScript to emit Node.js events.
helpers.extend(CoffeeScript, new EventEmitter);
helpers.extend(CoffeeScript, new EventEmitter());

@@ -46,6 +46,8 @@ printLine = function(line) {

// The help banner that is printed in conjunction with `-h`/`--help`.
BANNER = 'Usage: coffee [options] path/to/script.coffee [args]\n\nIf called without options, `coffee` will run your script.';
BANNER = `Usage: coffee [options] path/to/script.coffee [args]
If called without options, \`coffee\` will run your script.`;
// The list of all the valid option flags that `coffee` knows how to handle.
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 [PATH]', 'set the output path or path/filename 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 coffeescript'], ['-t', '--transpile', 'pipe generated JavaScript through Babel'], ['--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 = [['--ast', 'generate an abstract syntax tree of nodes'], ['-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'], ['-l', '--literate', 'treat stdio as literate style coffeescript'], ['-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 [PATH]', 'set the output path or path/filename 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'], ['-t', '--transpile', 'pipe generated JavaScript through Babel'], ['--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']];

@@ -83,3 +85,7 @@ // Top-level objects shared by all the functions.

if ((!opts.doubleDashed) && (opts.arguments[1] === '--')) {
printWarn('coffee was invoked with \'--\' as the second positional argument, which is\nnow deprecated. To pass \'--\' as an argument to a script to run, put an\nadditional \'--\' before the path to your script.\n\n\'--\' will be removed from the argument list.');
printWarn(`coffee was invoked with '--' as the second positional argument, which is
now deprecated. To pass '--' as an argument to a script to run, put an
additional '--' before the path to your script.
'--' will be removed from the argument list.`);
printWarn(`The positional arguments were: ${JSON.stringify(opts.arguments)}`);

@@ -137,3 +143,14 @@ opts.arguments = [opts.arguments[0]].concat(opts.arguments.slice(2));

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(`
The --join option is deprecated and will be removed in a future version.
If for some reason it's necessary to share local variables between files,
replace...
$ coffee --compile --join bundle.js -- a.coffee b.coffee c.coffee
with...
$ cat a.coffee b.coffee c.coffee | coffee --compile --stdio > bundle.js
`);
}

@@ -264,2 +281,5 @@ ref = opts.arguments;

return printLine(CoffeeScript.nodes(task.input, task.options).toString().trim());
} else if (opts.ast) {
compiled = CoffeeScript.compile(task.input, task.options);
return printLine(JSON.stringify(compiled, null, 2));
} else if (opts.run) {

@@ -586,3 +606,3 @@ CoffeeScript.register();

timeLog = function(message) {
return console.log(`${(new Date).toLocaleTimeString()} - ${message}`);
return console.log(`${(new Date()).toLocaleTimeString()} - ${message}`);
};

@@ -636,5 +656,11 @@

if (require.resolve('.').indexOf(process.cwd()) === 0) {
console.error('To use --transpile, you must have @babel/core installed:\n npm install --save-dev @babel/core\nAnd you must save options to configure Babel in one of the places it looks to find its options.\nSee https://coffeescript.org/#transpilation');
console.error(`To use --transpile, you must have @babel/core installed:
npm install --save-dev @babel/core
And you must save options to configure Babel in one of the places it looks to find its options.
See https://coffeescript.org/#transpilation`);
} else {
console.error('To use --transpile with globally-installed CoffeeScript, you must have @babel/core installed globally:\n npm install --global @babel/core\nAnd you must save options to configure Babel in one of the places it looks to find its options, relative to the file being compiled or to the current folder.\nSee https://coffeescript.org/#transpilation');
console.error(`To use --transpile with globally-installed CoffeeScript, you must have @babel/core installed globally:
npm install --global @babel/core
And you must save options to configure Babel in one of the places it looks to find its options, relative to the file being compiled or to the current folder.
See https://coffeescript.org/#transpilation`);
}

@@ -669,3 +695,4 @@ process.exit(1);

sourceMap: opts.map,
inlineMap: opts['inline-map']
inlineMap: opts['inline-map'],
ast: opts.ast
};

@@ -672,0 +699,0 @@ if (filename) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -38,3 +38,3 @@ // The CoffeeScript parser is generated by [Jison](https://github.com/zaach/jison)

o = function(patternString, action, options) {
var getAddDataToNodeFunctionString, match, patternCount, performActionFunctionString;
var getAddDataToNodeFunctionString, match, patternCount, performActionFunctionString, returnsLoc;
patternString = patternString.replace(/\s{2,}/g, ' ');

@@ -51,8 +51,9 @@ patternCount = patternString.split(' ').length;

// If the parameter is not a node, it will just be passed through unaffected.
getAddDataToNodeFunctionString = function(first, last) {
return `yy.addDataToNode(yy, @${first}${(last ? `, @${last}` : '')})`;
getAddDataToNodeFunctionString = function(first, last, forceUpdateLocation = true) {
return `yy.addDataToNode(yy, @${first}, ${first[0] === '$' ? '$$' : '$'}${first}, ${last ? `@${last}, ${last[0] === '$' ? '$$' : '$'}${last}` : 'null, null'}, ${forceUpdateLocation ? 'true' : 'false'})`;
};
returnsLoc = /^LOC/.test(action);
action = action.replace(/LOC\(([0-9]*)\)/g, getAddDataToNodeFunctionString('$1'));
action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, getAddDataToNodeFunctionString('$1', '$2'));
performActionFunctionString = `$$ = ${getAddDataToNodeFunctionString(1, patternCount)}(${action});`;
performActionFunctionString = `$$ = ${getAddDataToNodeFunctionString(1, patternCount, !returnsLoc)}(${action});`;
} else {

@@ -83,5 +84,8 @@ performActionFunctionString = '$$ = $1;';

function() {
return new Block;
return new Root(new Block());
}),
o('Body')
o('Body',
function() {
return new Root($1);
})
],

@@ -152,3 +156,3 @@ // Any list of statements and expressions, separated by line breaks or semicolons.

function() {
return new Block;
return new Block();
}),

@@ -165,5 +169,16 @@ o('INDENT Body OUTDENT',

}),
o('CSX_TAG',
o('JSX_TAG',
function() {
return new CSXTag($1);
var ref,
ref1,
ref2,
ref3;
return new JSXTag($1.toString(),
{
tagNameLocationData: $1.tagNameToken[2],
closingTagOpeningBracketLocationData: (ref = $1.closingTagOpeningBracketToken) != null ? ref[2] : void 0,
closingTagSlashLocationData: (ref1 = $1.closingTagSlashToken) != null ? ref1[2] : void 0,
closingTagNameLocationData: (ref2 = $1.closingTagNameToken) != null ? ref2[2] : void 0,
closingTagClosingBracketLocationData: (ref3 = $1.closingTagClosingBracketToken) != null ? ref3[2] : void 0
});
})

@@ -174,3 +189,3 @@ ],

function() {
return new PropertyName($1);
return new PropertyName($1.toString());
})

@@ -183,3 +198,6 @@ ],

function() {
return new NumberLiteral($1);
return new NumberLiteral($1.toString(),
{
parsedValue: $1.parsedValue
});
}),

@@ -191,17 +209,67 @@ o('String')

function() {
return new StringLiteral($1);
return new StringLiteral($1.slice(1,
-1), // strip artificial quotes and unwrap to primitive string
{
quote: $1.quote,
initialChunk: $1.initialChunk,
finalChunk: $1.finalChunk,
indent: $1.indent,
double: $1.double,
heregex: $1.heregex
});
}),
o('STRING_START Body STRING_END',
o('STRING_START Interpolations STRING_END',
function() {
return new StringWithInterpolations($2);
return new StringWithInterpolations(Block.wrap($2),
{
quote: $1.quote,
startQuote: LOC(1)(new Literal($1.toString()))
});
})
],
Interpolations: [
o('InterpolationChunk',
function() {
return [$1];
}),
o('Interpolations InterpolationChunk',
function() {
return $1.concat($2);
})
],
InterpolationChunk: [
o('INTERPOLATION_START Body INTERPOLATION_END',
function() {
return new Interpolation($2);
}),
o('INTERPOLATION_START INDENT Body OUTDENT INTERPOLATION_END',
function() {
return new Interpolation($3);
}),
o('INTERPOLATION_START INTERPOLATION_END',
function() {
return new Interpolation();
}),
o('String',
function() {
return $1;
})
],
// The .toString() calls here and elsewhere are to convert `String` objects
// back to primitive strings now that we've retrieved stowaway extra properties
Regex: [
o('REGEX',
function() {
return new RegexLiteral($1);
return new RegexLiteral($1.toString(),
{
delimiter: $1.delimiter,
heregexCommentTokens: $1.heregexCommentTokens
});
}),
o('REGEX_START Invocation REGEX_END',
function() {
return new RegexWithInterpolations($2.args);
return new RegexWithInterpolations($2,
{
heregexCommentTokens: $3.heregexCommentTokens
});
})

@@ -215,3 +283,7 @@ ],

function() {
return new PassthroughLiteral($1);
return new PassthroughLiteral($1.toString(),
{
here: $1.here,
generated: $1.generated
});
}),

@@ -229,7 +301,13 @@ o('Regex'),

function() {
return new BooleanLiteral($1);
return new BooleanLiteral($1.toString(),
{
originalValue: $1.original
});
}),
o('INFINITY',
function() {
return new InfinityLiteral($1);
return new InfinityLiteral($1.toString(),
{
originalValue: $1.original
});
}),

@@ -311,2 +389,8 @@ o('NAN',

}),
o('@ [ Expression ]',
function() {
return new Value(LOC(1)(new ThisLiteral($1)),
[LOC(3)(new ComputedPropertyName($3))],
'this');
}),
o('AlphaNumeric')

@@ -322,3 +406,6 @@ ],

function() {
return new Splat(new Value($2));
return new Splat(new Value($2),
{
postfix: false
});
}),

@@ -331,3 +418,6 @@ o('ObjSpreadExpr ...',

function() {
return new Splat($2);
return new Splat($2,
{
postfix: false
});
})

@@ -343,3 +433,3 @@ ],

function() {
return new SuperCall(LOC(1)(new Super),
return new SuperCall(LOC(1)(new Super()),
$2,

@@ -351,3 +441,3 @@ false,

function() {
return new DynamicImportCall(LOC(1)(new DynamicImport),
return new DynamicImportCall(LOC(1)(new DynamicImport()),
$2);

@@ -384,2 +474,6 @@ }),

return $2;
}),
o('INDEX_START INDENT IndexValue OUTDENT INDEX_END',
function() {
return $3;
})

@@ -399,3 +493,3 @@ ],

function() {
return new Return;
return new Return();
})

@@ -406,7 +500,13 @@ ],

function() {
return new YieldReturn($3);
return new YieldReturn($3,
{
returnKeyword: LOC(2)(new Literal($2))
});
}),
o('YIELD RETURN',
function() {
return new YieldReturn;
return new YieldReturn(null,
{
returnKeyword: LOC(2)(new Literal($2))
});
})

@@ -417,7 +517,13 @@ ],

function() {
return new AwaitReturn($3);
return new AwaitReturn($3,
{
returnKeyword: LOC(2)(new Literal($2))
});
}),
o('AWAIT RETURN',
function() {
return new AwaitReturn;
return new AwaitReturn(null,
{
returnKeyword: LOC(2)(new Literal($2))
});
})

@@ -512,3 +618,5 @@ ],

null,
true);
{
postfix: false
});
}),

@@ -522,3 +630,3 @@ o('ParamVar = Expression',

function() {
return new Expansion;
return new Expansion();
})

@@ -536,3 +644,6 @@ ],

function() {
return new Splat($2);
return new Splat($2,
{
postfix: false
});
})

@@ -588,2 +699,6 @@ ],

}),
o('DoIife',
function() {
return new Value($1);
}),
o('This'),

@@ -593,2 +708,6 @@ o('Super',

return new Value($1);
}),
o('MetaProperty',
function() {
return new Value($1);
})

@@ -601,5 +720,3 @@ ],

return new Super(LOC(3)(new Access($3)),
[],
false,
$1);
LOC(1)(new Literal($1)));
}),

@@ -609,7 +726,18 @@ o('SUPER INDEX_START Expression INDEX_END',

return new Super(LOC(3)(new Index($3)),
[],
false,
$1);
LOC(1)(new Literal($1)));
}),
o('SUPER INDEX_START INDENT Expression OUTDENT INDEX_END',
function() {
return new Super(LOC(4)(new Index($4)),
LOC(1)(new Literal($1)));
})
],
// A "meta-property" access e.g. `new.target`
MetaProperty: [
o('NEW_TARGET . Property',
function() {
return new MetaProperty(LOC(1)(new IdentifierLiteral($1)),
LOC(3)(new Access($3)));
})
],
// The general group of accessors into an object, by property, by prototype

@@ -625,18 +753,33 @@ // or by array index or slice.

return new Access($2,
'soak');
{
soak: true
});
}),
o(':: Property',
function() {
return [LOC(1)(new Access(new PropertyName('prototype'))),
LOC(2)(new Access($2))];
return [
LOC(1)(new Access(new PropertyName('prototype'),
{
shorthand: true
})),
LOC(2)(new Access($2))
];
}),
o('?:: Property',
function() {
return [LOC(1)(new Access(new PropertyName('prototype'),
'soak')),
LOC(2)(new Access($2))];
return [
LOC(1)(new Access(new PropertyName('prototype'),
{
shorthand: true,
soak: true
})),
LOC(2)(new Access($2))
];
}),
o('::',
function() {
return new Access(new PropertyName('prototype'));
return new Access(new PropertyName('prototype'),
{
shorthand: true
});
}),

@@ -646,3 +789,6 @@ o('?::',

return new Access(new PropertyName('prototype'),
'soak');
{
shorthand: true,
soak: true
});
}),

@@ -657,2 +803,6 @@ o('Index')

}),
o('INDEX_START INDENT IndexValue OUTDENT INDEX_END',
function() {
return $3;
}),
o('INDEX_SOAK Index',

@@ -713,3 +863,3 @@ function() {

function() {
return new Class;
return new Class();
}),

@@ -832,7 +982,7 @@ o('CLASS Block',

function() {
return new ImportSpecifier(new Literal($1));
return new ImportSpecifier(LOC(1)(new DefaultLiteral($1)));
}),
o('DEFAULT AS Identifier',
function() {
return new ImportSpecifier(new Literal($1),
return new ImportSpecifier(LOC(1)(new DefaultLiteral($1)),
$3);

@@ -869,3 +1019,4 @@ })

function() {
return new ExportNamedDeclaration(new Assign($2,
return new ExportNamedDeclaration(LOC(2,
4)(new Assign($2,
$4,

@@ -875,7 +1026,8 @@ null,

moduleDeclaration: 'export'
}));
})));
}),
o('EXPORT Identifier = TERMINATOR Expression',
function() {
return new ExportNamedDeclaration(new Assign($2,
return new ExportNamedDeclaration(LOC(2,
5)(new Assign($2,
$5,

@@ -885,7 +1037,8 @@ null,

moduleDeclaration: 'export'
}));
})));
}),
o('EXPORT Identifier = INDENT Expression OUTDENT',
function() {
return new ExportNamedDeclaration(new Assign($2,
return new ExportNamedDeclaration(LOC(2,
6)(new Assign($2,
$5,

@@ -895,3 +1048,3 @@ null,

moduleDeclaration: 'export'
}));
})));
}),

@@ -911,2 +1064,7 @@ o('EXPORT DEFAULT Expression',

}),
o('EXPORT { } FROM String',
function() {
return new ExportNamedDeclaration(new ExportSpecifierList([]),
$5);
}),
o('EXPORT { ExportSpecifierList OptComma } FROM String',

@@ -953,11 +1111,11 @@ function() {

return new ExportSpecifier($1,
new Literal($3));
LOC(3)(new DefaultLiteral($3)));
}),
o('DEFAULT',
function() {
return new ExportSpecifier(new Literal($1));
return new ExportSpecifier(LOC(1)(new DefaultLiteral($1)));
}),
o('DEFAULT AS Identifier',
function() {
return new ExportSpecifier(new Literal($1),
return new ExportSpecifier(LOC(1)(new DefaultLiteral($1)),
$3);

@@ -972,3 +1130,3 @@ })

$3,
$2);
$2.soak);
}),

@@ -979,9 +1137,9 @@ o('Value OptFuncExist Arguments',

$3,
$2);
$2.soak);
}),
o('SUPER OptFuncExist Arguments',
function() {
return new SuperCall(LOC(1)(new Super),
return new SuperCall(LOC(1)(new Super()),
$3,
$2,
$2.soak,
$1);

@@ -991,3 +1149,3 @@ }),

function() {
return new DynamicImportCall(LOC(1)(new DynamicImport),
return new DynamicImportCall(LOC(1)(new DynamicImport()),
$2);

@@ -1000,7 +1158,11 @@ })

function() {
return false;
return {
soak: false
};
}),
o('FUNC_EXIST',
function() {
return true;
return {
soak: true
};
})

@@ -1016,2 +1178,3 @@ ],

function() {
$2.implicit = $1.generated;
return $2;

@@ -1060,7 +1223,11 @@ })

function() {
return 'inclusive';
return {
exclusive: false
};
}),
o('...',
function() {
return 'exclusive';
return {
exclusive: true
};
})

@@ -1074,3 +1241,3 @@ ],

$4,
$3);
$3.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1081,3 +1248,3 @@ o('[ ExpressionLine RangeDots Expression ]',

$4,
$3);
$3.exclusive ? 'exclusive' : 'inclusive');
})

@@ -1091,3 +1258,3 @@ ],

$3,
$2);
$2.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1098,3 +1265,3 @@ o('Expression RangeDots',

null,
$2);
$2.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1105,3 +1272,3 @@ o('ExpressionLine RangeDots Expression',

$3,
$2);
$2.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1112,3 +1279,3 @@ o('ExpressionLine RangeDots',

null,
$2);
$2.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1119,3 +1286,3 @@ o('RangeDots Expression',

$2,
$1);
$1.exclusive ? 'exclusive' : 'inclusive');
}),

@@ -1126,3 +1293,3 @@ o('RangeDots',

null,
$1);
$1.exclusive ? 'exclusive' : 'inclusive');
})

@@ -1161,3 +1328,3 @@ ],

function() {
return new Expansion;
return new Expansion();
})

@@ -1173,6 +1340,5 @@ ],

}),
o('ArgElisionList OptElisions TERMINATOR ArgElision',
o('ArgElisionList OptComma TERMINATOR ArgElision',
function() {
return $1.concat($2,
$4);
return $1.concat($4);
}),

@@ -1223,3 +1389,7 @@ o('INDENT ArgElisionList OptElisions OUTDENT',

function() {
return new Elision;
return new Elision();
}),
o('Elision TERMINATOR',
function() {
return $1;
})

@@ -1253,4 +1423,3 @@ ],

return new Try($2,
$3[0],
$3[1]);
$3);
}),

@@ -1261,4 +1430,4 @@ o('TRY Block FINALLY Block',

null,
null,
$4);
$4,
LOC(3)(new Literal($3)));
}),

@@ -1268,5 +1437,5 @@ o('TRY Block Catch FINALLY Block',

return new Try($2,
$3[0],
$3[1],
$5);
$3,
$5,
LOC(4)(new Literal($4)));
})

@@ -1278,14 +1447,13 @@ ],

function() {
return [$2,
$3];
return new Catch($3,
$2);
}),
o('CATCH Object Block',
function() {
return [LOC(2)(new Value($2)),
$3];
return new Catch($3,
LOC(2)(new Value($2)));
}),
o('CATCH Block',
function() {
return [null,
$2];
return new Catch($2);
})

@@ -1403,7 +1571,13 @@ ],

function() {
return $2.addBody(LOC(1)(Block.wrap([$1])));
return (Object.assign($2,
{
postfix: true
})).addBody(LOC(1)(Block.wrap([$1])));
}),
o('Expression WhileSource',
function() {
return $2.addBody(LOC(1)(Block.wrap([$1])));
return (Object.assign($2,
{
postfix: true
})).addBody(LOC(1)(Block.wrap([$1])));
}),

@@ -1418,7 +1592,13 @@ o('Loop',

function() {
return new While(LOC(1)(new BooleanLiteral('true'))).addBody($2);
return new While(LOC(1)(new BooleanLiteral('true')),
{
isLoop: true
}).addBody($2);
}),
o('LOOP Expression',
function() {
return new While(LOC(1)(new BooleanLiteral('true'))).addBody(LOC(2)(Block.wrap([$2])));
return new While(LOC(1)(new BooleanLiteral('true')),
{
isLoop: true
}).addBody(LOC(2)(Block.wrap([$2])));
})

@@ -1432,2 +1612,3 @@ ],

function() {
$2.postfix = true;
return $2.addBody($1);

@@ -1437,2 +1618,3 @@ }),

function() {
$2.postfix = true;
return $2.addBody($1);

@@ -1860,3 +2042,4 @@ }),

$4,
$6);
LOC(5,
6)($6));
}),

@@ -1867,3 +2050,4 @@ o('SWITCH ExpressionLine INDENT Whens ELSE Block OUTDENT',

$4,
$6);
LOC(5,
6)($6));
}),

@@ -1879,7 +2063,11 @@ o('SWITCH INDENT Whens OUTDENT',

$3,
$5);
LOC(4,
5)($5));
})
],
Whens: [
o('When'),
o('When',
function() {
return [$1];
}),
o('Whens When',

@@ -1894,9 +2082,10 @@ function() {

function() {
return [[$2,
$3]];
return new SwitchWhen($2,
$3);
}),
o('LEADING_WHEN SimpleArgs Block TERMINATOR',
function() {
return [[$2,
$3]];
return LOC(1,
3)(new SwitchWhen($2,
$3));
})

@@ -1940,3 +2129,3 @@ ],

type: $2,
statement: true
postfix: true
});

@@ -1950,3 +2139,3 @@ }),

type: $2,
statement: true
postfix: true
});

@@ -1986,3 +2175,3 @@ })

type: $2,
statement: true
postfix: true
});

@@ -1996,3 +2185,3 @@ }),

type: $2,
statement: true
postfix: true
});

@@ -2012,2 +2201,12 @@ })

$2);
}),
o('DO ExpressionLine',
function() {
return new Op($1,
$2);
}),
o('DO_IIFE CodeLine',
function() {
return new Op($1,
$2);
})

@@ -2018,2 +2217,12 @@ ],

function() {
return new Op($1.toString(),
$2,
void 0,
void 0,
{
originalOperator: $1.original
});
}),
o('DO Expression',
function() {
return new Op($1,

@@ -2114,5 +2323,9 @@ $2);

function() {
return new Op($2,
return new Op($2.toString(),
$1,
$3);
$3,
void 0,
{
originalOperator: $2.original
});
}),

@@ -2139,11 +2352,19 @@ o('Expression & Expression',

function() {
return new Op($2,
return new Op($2.toString(),
$1,
$3);
$3,
void 0,
{
originalOperator: $2.original
});
}),
o('Expression || Expression',
function() {
return new Op($2,
return new Op($2.toString(),
$1,
$3);
$3,
void 0,
{
originalOperator: $2.original
});
}),

@@ -2158,11 +2379,11 @@ o('Expression BIN? Expression',

function() {
if ($2.charAt(0) === '!') {
return new Op($2.slice(1),
var ref,
ref1;
return new Op($2.toString(),
$1,
$3).invert();
} else {
return new Op($2,
$1,
$3);
}
$3,
void 0,
{
invertOperator: (ref = (ref1 = $2.invert) != null ? ref1.original : void 0) != null ? ref : $2.invert
});
}),

@@ -2173,3 +2394,6 @@ o('SimpleAssignable COMPOUND_ASSIGN Expression',

$3,
$2);
$2.toString(),
{
originalContext: $2.original
});
}),

@@ -2180,3 +2404,6 @@ o('SimpleAssignable COMPOUND_ASSIGN INDENT Expression OUTDENT',

$4,
$2);
$2.toString(),
{
originalContext: $2.original
});
}),

@@ -2187,2 +2414,12 @@ o('SimpleAssignable COMPOUND_ASSIGN TERMINATOR Expression',

$4,
$2.toString(),
{
originalContext: $2.original
});
})
],
DoIife: [
o('DO_IIFE Code',
function() {
return new Op($1,
$2);

@@ -2204,3 +2441,3 @@ })

// (2 + 3) * 4
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['right', 'AWAIT'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', '&'], ['left', '^'], ['left', '|'], ['left', '&&'], ['left', '||'], ['left', 'BIN?'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', 'YIELD'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'FORFROM', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'IMPORT', 'EXPORT', 'DYNAMIC_IMPORT'], ['left', 'POST_IF']];
operators = [['right', 'DO_IIFE'], ['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY', 'DO'], ['right', 'AWAIT'], ['right', '**'], ['right', 'UNARY_MATH'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', '&'], ['left', '^'], ['left', '|'], ['left', '&&'], ['left', '||'], ['left', 'BIN?'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', 'YIELD'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'FORFROM', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'IMPORT', 'EXPORT', 'DYNAMIC_IMPORT'], ['left', 'POST_IF']];

@@ -2207,0 +2444,0 @@ // Wrapping Up

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -8,3 +8,4 @@ // This file contains the common helper functions that we'd like to share among

// Peek at the beginning of a given string to see if it matches a sequence.
var attachCommentsToNode, buildLocationData, buildLocationHash, buildTokenDataDictionary, extend, flatten, ref, repeat, syntaxErrorToString;
var UNICODE_CODE_POINT_ESCAPE, attachCommentsToNode, buildLocationData, buildLocationHash, buildTokenDataDictionary, extend, flatten, isBoolean, isNumber, isString, ref, repeat, syntaxErrorToString, unicodeCodePointToUnicodeEscapes,
indexOf = [].indexOf;

@@ -160,3 +161,6 @@ exports.starts = function(string, literal, start) {

last_line: last.last_line,
last_column: last.last_column
last_column: last.last_column,
last_line_exclusive: last.last_line_exclusive,
last_column_exclusive: last.last_column_exclusive,
range: [first.range[0], last.range[1]]
};

@@ -166,4 +170,34 @@ }

// Build a list of all comments attached to tokens.
exports.extractAllCommentTokens = function(tokens) {
var allCommentsObj, comment, commentKey, i, j, k, key, len1, len2, len3, ref1, results, sortedKeys, token;
allCommentsObj = {};
for (i = 0, len1 = tokens.length; i < len1; i++) {
token = tokens[i];
if (token.comments) {
ref1 = token.comments;
for (j = 0, len2 = ref1.length; j < len2; j++) {
comment = ref1[j];
commentKey = comment.locationData.range[0];
allCommentsObj[commentKey] = comment;
}
}
}
sortedKeys = Object.keys(allCommentsObj).sort(function(a, b) {
return a - b;
});
results = [];
for (k = 0, len3 = sortedKeys.length; k < len3; k++) {
key = sortedKeys[k];
results.push(allCommentsObj[key]);
}
return results;
};
// Get a lookup hash for a token based on its location data.
// Multiple tokens might have the same location hash, but using exclusive
// location data distinguishes e.g. zero-length generated tokens from
// actual source tokens.
buildLocationHash = function(loc) {
return `${loc.first_line}x${loc.first_column}-${loc.last_line}x${loc.last_column}`;
return `${loc.range[0]}-${loc.range[1]}`;
};

@@ -173,8 +207,7 @@

// used as lookup hashes.
buildTokenDataDictionary = function(parserState) {
var base, i, len1, ref1, token, tokenData, tokenHash;
exports.buildTokenDataDictionary = buildTokenDataDictionary = function(tokens) {
var base1, i, len1, token, tokenData, tokenHash;
tokenData = {};
ref1 = parserState.parser.tokens;
for (i = 0, len1 = ref1.length; i < len1; i++) {
token = ref1[i];
for (i = 0, len1 = tokens.length; i < len1; i++) {
token = tokens[i];
if (!token.comments) {

@@ -195,3 +228,3 @@ continue;

// they will get sorted out later.
((base = tokenData[tokenHash]).comments != null ? base.comments : base.comments = []).push(...token.comments);
((base1 = tokenData[tokenHash]).comments != null ? base1.comments : base1.comments = []).push(...token.comments);
}

@@ -205,8 +238,11 @@ }

// The object is returned either way.
exports.addDataToNode = function(parserState, first, last) {
exports.addDataToNode = function(parserState, firstLocationData, firstValue, lastLocationData, lastValue, forceUpdateLocation = true) {
return function(obj) {
var objHash, ref1;
var locationData, objHash, ref1, ref2, ref3;
// Add location data.
if (((obj != null ? obj.updateLocationDataIfMissing : void 0) != null) && (first != null)) {
obj.updateLocationDataIfMissing(buildLocationData(first, last));
locationData = buildLocationData((ref1 = firstValue != null ? firstValue.locationData : void 0) != null ? ref1 : firstLocationData, (ref2 = lastValue != null ? lastValue.locationData : void 0) != null ? ref2 : lastLocationData);
if (((obj != null ? obj.updateLocationDataIfMissing : void 0) != null) && (firstLocationData != null)) {
obj.updateLocationDataIfMissing(locationData, forceUpdateLocation);
} else {
obj.locationData = locationData;
}

@@ -216,7 +252,7 @@ // Add comments, building the dictionary of token data if it hasn’t been

if (parserState.tokenData == null) {
parserState.tokenData = buildTokenDataDictionary(parserState);
parserState.tokenData = buildTokenDataDictionary(parserState.parser.tokens);
}
if (obj.locationData != null) {
objHash = buildLocationHash(obj.locationData);
if (((ref1 = parserState.tokenData[objHash]) != null ? ref1.comments : void 0) != null) {
if (((ref3 = parserState.tokenData[objHash]) != null ? ref3.comments : void 0) != null) {
attachCommentsToNode(parserState.tokenData[objHash].comments, obj);

@@ -339,3 +375,5 @@ }

}
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}
${codeLine}
${marker}`;
};

@@ -358,2 +396,87 @@

exports.parseNumber = function(string) {
var base;
if (string == null) {
return 0/0;
}
base = (function() {
switch (string.charAt(1)) {
case 'b':
return 2;
case 'o':
return 8;
case 'x':
return 16;
default:
return null;
}
})();
if (base != null) {
return parseInt(string.slice(2).replace(/_/g, ''), base);
} else {
return parseFloat(string.replace(/_/g, ''));
}
};
exports.isFunction = function(obj) {
return Object.prototype.toString.call(obj) === '[object Function]';
};
exports.isNumber = isNumber = function(obj) {
return Object.prototype.toString.call(obj) === '[object Number]';
};
exports.isString = isString = function(obj) {
return Object.prototype.toString.call(obj) === '[object String]';
};
exports.isBoolean = isBoolean = function(obj) {
return obj === true || obj === false || Object.prototype.toString.call(obj) === '[object Boolean]';
};
exports.isPlainObject = function(obj) {
return typeof obj === 'object' && !!obj && !Array.isArray(obj) && !isNumber(obj) && !isString(obj) && !isBoolean(obj);
};
unicodeCodePointToUnicodeEscapes = function(codePoint) {
var high, low, toUnicodeEscape;
toUnicodeEscape = function(val) {
var str;
str = val.toString(16);
return `\\u${repeat('0', 4 - str.length)}${str}`;
};
if (codePoint < 0x10000) {
return toUnicodeEscape(codePoint);
}
// surrogate pair
high = Math.floor((codePoint - 0x10000) / 0x400) + 0xD800;
low = (codePoint - 0x10000) % 0x400 + 0xDC00;
return `${toUnicodeEscape(high)}${toUnicodeEscape(low)}`;
};
// Replace `\u{...}` with `\uxxxx[\uxxxx]` in regexes without `u` flag
exports.replaceUnicodeCodePointEscapes = function(str, {flags, error, delimiter = ''} = {}) {
var shouldReplace;
shouldReplace = (flags != null) && indexOf.call(flags, 'u') < 0;
return str.replace(UNICODE_CODE_POINT_ESCAPE, function(match, escapedBackslash, codePointHex, offset) {
var codePointDecimal;
if (escapedBackslash) {
return escapedBackslash;
}
codePointDecimal = parseInt(codePointHex, 16);
if (codePointDecimal > 0x10ffff) {
error("unicode code point escapes greater than \\u{10ffff} are not allowed", {
offset: offset + delimiter.length,
length: codePointHex.length + 4
});
}
if (!shouldReplace) {
return match;
}
return unicodeCodePointToUnicodeEscapes(codePointDecimal);
});
};
UNICODE_CODE_POINT_ESCAPE = /(\\\\)|\\u\{([\da-fA-F]+)\}/g; // Make sure the escape isn’t escaped.
}).call(this);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -3,0 +3,0 @@ // Node.js Implementation

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -3,0 +3,0 @@ var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat,

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -3,0 +3,0 @@ var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, getRootModule, helpers, i, len, loadFile, path, ref;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -32,3 +32,3 @@ var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, runInContext, sawSIGINT, transpile, updateSyntaxError, vm;

eval: function(input, context, filename, cb) {
var Assign, Block, Call, Code, Literal, Value, ast, err, isAsync, js, ref, ref1, referencedVars, result, token, tokens;
var Assign, Block, Call, Code, Literal, Root, Value, ast, err, isAsync, js, ref, ref1, referencedVars, result, token, tokens;
// XXX: multiline hack.

@@ -43,3 +43,3 @@ input = input.replace(/\uFF00/g, '\n');

// Require AST nodes to do some AST manipulation.
({Block, Assign, Value, Literal, Call, Code} = require('./nodes'));
({Block, Assign, Value, Literal, Call, Code, Root} = require('./nodes'));
try {

@@ -49,6 +49,6 @@ // Tokenize the clean input.

// Filter out tokens generated just to hold comments.
if (tokens.length >= 2 && tokens[0].generated && ((ref = tokens[0].comments) != null ? ref.length : void 0) !== 0 && tokens[0][1] === '' && tokens[1][0] === 'TERMINATOR') {
if (tokens.length >= 2 && tokens[0].generated && ((ref = tokens[0].comments) != null ? ref.length : void 0) !== 0 && `${tokens[0][1]}` === '' && tokens[1][0] === 'TERMINATOR') {
tokens = tokens.slice(2);
}
if (tokens.length >= 1 && tokens[tokens.length - 1].generated && ((ref1 = tokens[tokens.length - 1].comments) != null ? ref1.length : void 0) !== 0 && tokens[tokens.length - 1][1] === '') {
if (tokens.length >= 1 && tokens[tokens.length - 1].generated && ((ref1 = tokens[tokens.length - 1].comments) != null ? ref1.length : void 0) !== 0 && `${tokens[tokens.length - 1][1]}` === '') {
tokens.pop();

@@ -69,3 +69,3 @@ }

// Generate the AST of the tokens.
ast = CoffeeScript.nodes(tokens);
ast = CoffeeScript.nodes(tokens).body;
// Add assignment to `__` variable to force the input to be an expression.

@@ -77,3 +77,3 @@ ast = new Block([new Assign(new Value(new Literal('__')), ast, '=')]);

// Invoke the wrapping closure.
ast = new Block([new Call(ast)]);
ast = new Root(new Block([new Call(ast)]));
js = ast.compile({

@@ -265,3 +265,8 @@ bare: true,

} catch (error) {
console.error('To use --transpile with an interactive REPL, @babel/core must be installed either in the current folder or globally:\n npm install --save-dev @babel/core\nor\n npm install --global @babel/core\nAnd you must save options to configure Babel in one of the places it looks to find its options.\nSee https://coffeescript.org/#transpilation');
console.error(`To use --transpile with an interactive REPL, @babel/core must be installed either in the current folder or globally:
npm install --save-dev @babel/core
or
npm install --global @babel/core
And you must save options to configure Babel in one of the places it looks to find its options.
See https://coffeescript.org/#transpilation`);
process.exit(1);

@@ -268,0 +273,0 @@ }

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -9,6 +9,7 @@ // The CoffeeScript language has a good deal of optional syntax, implicit syntax,

// parentheses, and generally clean things up.
var BALANCED_PAIRS, CALL_CLOSERS, CONTROL_IN_IMPLICIT, DISCARDED, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, generate, k, left, len, moveComments, right, throwSyntaxError,
indexOf = [].indexOf;
var BALANCED_PAIRS, CALL_CLOSERS, CONTROL_IN_IMPLICIT, DISCARDED, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, extractAllCommentTokens, generate, k, left, len, moveComments, right, throwSyntaxError,
indexOf = [].indexOf,
hasProp = {}.hasOwnProperty;
({throwSyntaxError} = require('./helpers'));
({throwSyntaxError, extractAllCommentTokens} = require('./helpers'));

@@ -90,7 +91,7 @@ // Move attached comments from one token to another.

this.addImplicitBracesAndParens();
this.addParensToChainedDoIife();
this.rescueStowawayComments();
this.addLocationDataToGeneratedTokens();
this.enforceValidCSXAttributes();
this.fixOutdentLocationData();
this.enforceValidJSXAttributes();
this.fixIndentationLocationData();
this.exposeTokenDataToGrammar();
if (typeof process !== "undefined" && process !== null ? (ref1 = process.env) != null ? ref1.DEBUG_REWRITTEN_TOKEN_STREAM : void 0 : void 0) {

@@ -201,3 +202,4 @@ if (process.env.DEBUG_TOKEN_STREAM) {

closeOpenIndexes() {
var action, condition;
var action, condition, startToken;
startToken = null;
condition = function(token, i) {

@@ -208,6 +210,12 @@ var ref;

action = function(token, i) {
return token[0] = 'INDEX_END';
if (this.tokens.length >= i && this.tokens[i + 1][0] === ':') {
startToken[0] = '[';
return token[0] = ']';
} else {
return token[0] = 'INDEX_END';
}
};
return this.scanTokens(function(token, i) {
if (token[0] === 'INDEX_START') {
startToken = token;
this.detectEnd(i + 1, condition, action);

@@ -288,3 +296,3 @@ }

return this.scanTokens(function(token, i, tokens) {
var endImplicitCall, endImplicitObject, forward, implicitObjectContinues, inControlFlow, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, nextToken, offset, prevTag, prevToken, ref, ref1, ref2, s, sameLine, stackIdx, stackItem, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag;
var endImplicitCall, endImplicitObject, forward, implicitObjectContinues, inControlFlow, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, nextToken, offset, prevTag, prevToken, ref, ref1, ref2, s, sameLine, stackIdx, stackItem, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startIndex, startTag, startsLine, tag;
[tag] = token;

@@ -489,3 +497,9 @@ [prevTag] = prevToken = i > 0 ? tokens[i - 1] : [];

case ref1 = this.tag(i - 1), indexOf.call(EXPRESSION_END, ref1) < 0:
return start[1];
[startTag, startIndex] = start;
if (startTag === '[' && startIndex > 0 && this.tag(startIndex - 1) === '@' && !tokens[startIndex - 1].spaced) {
return startIndex - 1;
} else {
return startIndex;
}
break;
case this.tag(i - 2) !== '@':

@@ -586,7 +600,7 @@ return i - 2;

// Make sure only strings and wrapped expressions are used in CSX attributes.
enforceValidCSXAttributes() {
// Make sure only strings and wrapped expressions are used in JSX attributes.
enforceValidJSXAttributes() {
return this.scanTokens(function(token, i, tokens) {
var next, ref;
if (token.csxColon) {
if (token.jsxColon) {
next = tokens[i + 1];

@@ -605,3 +619,3 @@ if ((ref = next[0]) !== 'STRING_START' && ref !== 'STRING' && ref !== '(') {

rescueStowawayComments() {
var insertPlaceholder, shiftCommentsBackward, shiftCommentsForward;
var dontShiftForward, insertPlaceholder, shiftCommentsBackward, shiftCommentsForward;
insertPlaceholder = function(token, j, tokens, method) {

@@ -613,2 +627,13 @@ if (tokens[j][0] !== 'TERMINATOR') {

};
dontShiftForward = function(i, tokens) {
var j, ref;
j = i + 1;
while (j !== tokens.length && (ref = tokens[j][0], indexOf.call(DISCARDED, ref) >= 0)) {
if (tokens[j][0] === 'INTERPOLATION_END') {
return true;
}
j++;
}
return false;
};
shiftCommentsForward = function(token, i, tokens) {

@@ -683,3 +708,3 @@ var comment, j, k, len, ref, ref1, ref2;

}
} else {
} else if (!dontShiftForward(i, tokens)) {
// If any of this token’s comments start a line—there’s only

@@ -721,3 +746,3 @@ // whitespace between the preceding newline and the start of the

return this.scanTokens(function(token, i, tokens) {
var column, line, nextLocation, prevLocation, ref, ref1;
var column, line, nextLocation, prevLocation, rangeIndex, ref, ref1;
if (token[2]) {

@@ -729,6 +754,11 @@ return 1;

}
if (token.fromThen && token[0] === 'INDENT') {
token[2] = token.origin[2];
return 1;
}
if (token[0] === '{' && (nextLocation = (ref = tokens[i + 1]) != null ? ref[2] : void 0)) {
({
first_line: line,
first_column: column
first_column: column,
range: [rangeIndex]
} = nextLocation);

@@ -738,6 +768,9 @@ } else if (prevLocation = (ref1 = tokens[i - 1]) != null ? ref1[2] : void 0) {

last_line: line,
last_column: column
last_column: column,
range: [, rangeIndex]
} = prevLocation);
column += 1;
} else {
line = column = 0;
rangeIndex = 0;
}

@@ -748,3 +781,6 @@ token[2] = {

last_line: line,
last_column: column
last_column: column,
last_line_exclusive: line,
last_column_exclusive: column,
range: [rangeIndex, rangeIndex]
};

@@ -758,56 +794,97 @@ return 1;

// location corresponding to the last “real” token under the node.
fixOutdentLocationData() {
return this.scanTokens(function(token, i, tokens) {
var prevLocationData;
if (!(token[0] === 'OUTDENT' || (token.generated && token[0] === 'CALL_END') || (token.generated && token[0] === '}'))) {
return 1;
}
prevLocationData = tokens[i - 1][2];
token[2] = {
first_line: prevLocationData.last_line,
first_column: prevLocationData.last_column,
last_line: prevLocationData.last_line,
last_column: prevLocationData.last_column
fixIndentationLocationData() {
var findPrecedingComment;
if (this.allComments == null) {
this.allComments = extractAllCommentTokens(this.tokens);
}
findPrecedingComment = (token, {afterPosition, indentSize, first, indented}) => {
var comment, k, l, lastMatching, matches, ref, ref1, tokenStart;
tokenStart = token[2].range[0];
matches = function(comment) {
if (comment.outdented) {
if (!((indentSize != null) && comment.indentSize > indentSize)) {
return false;
}
}
if (indented && !comment.indented) {
return false;
}
if (!(comment.locationData.range[0] < tokenStart)) {
return false;
}
if (!(comment.locationData.range[0] > afterPosition)) {
return false;
}
return true;
};
return 1;
});
}
// Add parens around a `do` IIFE followed by a chained `.` so that the
// chaining applies to the executed function rather than the function
// object (see #3736)
addParensToChainedDoIife() {
var action, condition, doIndex;
condition = function(token, i) {
return this.tag(i - 1) === 'OUTDENT';
};
action = function(token, i) {
var ref;
if (ref = token[0], indexOf.call(CALL_CLOSERS, ref) < 0) {
return;
if (first) {
lastMatching = null;
ref = this.allComments;
for (k = ref.length - 1; k >= 0; k += -1) {
comment = ref[k];
if (matches(comment)) {
lastMatching = comment;
} else if (lastMatching) {
return lastMatching;
}
}
return lastMatching;
}
this.tokens.splice(doIndex, 0, generate('(', '(', this.tokens[doIndex]));
return this.tokens.splice(i + 1, 0, generate(')', ')', this.tokens[i]));
ref1 = this.allComments;
for (l = ref1.length - 1; l >= 0; l += -1) {
comment = ref1[l];
if (matches(comment)) {
return comment;
}
}
return null;
};
doIndex = null;
return this.scanTokens(function(token, i, tokens) {
var glyphIndex, ref;
if (token[1] !== 'do') {
var isIndent, nextToken, nextTokenIndex, precedingComment, prevLocationData, prevToken, ref, ref1, ref2, useNextToken;
if (!(((ref = token[0]) === 'INDENT' || ref === 'OUTDENT') || (token.generated && token[0] === 'CALL_END' && !((ref1 = token.data) != null ? ref1.closingTagNameToken : void 0)) || (token.generated && token[0] === '}'))) {
return 1;
}
doIndex = i;
glyphIndex = i + 1;
if (this.tag(i + 1) === 'PARAM_START') {
glyphIndex = null;
this.detectEnd(i + 1, function(token, i) {
return this.tag(i - 1) === 'PARAM_END';
}, function(token, i) {
return glyphIndex = i;
});
isIndent = token[0] === 'INDENT';
prevToken = (ref2 = token.prevToken) != null ? ref2 : tokens[i - 1];
prevLocationData = prevToken[2];
// addLocationDataToGeneratedTokens() set the outdent’s location data
// to the preceding token’s, but in order to detect comments inside an
// empty "block" we want to look for comments preceding the next token.
useNextToken = token.explicit || token.generated;
if (useNextToken) {
nextToken = token;
nextTokenIndex = i;
while ((nextToken.explicit || nextToken.generated) && nextTokenIndex !== tokens.length - 1) {
nextToken = tokens[nextTokenIndex++];
}
}
if (!((glyphIndex != null) && ((ref = this.tag(glyphIndex)) === '->' || ref === '=>') && this.tag(glyphIndex + 1) === 'INDENT')) {
precedingComment = findPrecedingComment(useNextToken ? nextToken : token, {
afterPosition: prevLocationData.range[0],
indentSize: token.indentSize,
first: isIndent,
indented: useNextToken
});
if (isIndent) {
if (!(precedingComment != null ? precedingComment.newLine : void 0)) {
return 1;
}
}
if (token.generated && token[0] === 'CALL_END' && (precedingComment != null ? precedingComment.indented : void 0)) {
// We don’t want e.g. an implicit call at the end of an `if` condition to
// include a following indented comment.
return 1;
}
this.detectEnd(glyphIndex + 1, condition, action);
return 2;
if (precedingComment != null) {
prevLocationData = precedingComment.locationData;
}
token[2] = {
first_line: precedingComment != null ? prevLocationData.first_line : prevLocationData.last_line,
first_column: precedingComment != null ? isIndent ? 0 : prevLocationData.first_column : prevLocationData.last_column,
last_line: prevLocationData.last_line,
last_column: prevLocationData.last_column,
last_line_exclusive: prevLocationData.last_line_exclusive,
last_column_exclusive: prevLocationData.last_column_exclusive,
range: isIndent && (precedingComment != null) ? [prevLocationData.range[0] - precedingComment.indentSize, prevLocationData.range[1]] : prevLocationData.range
};
return 1;
});

@@ -864,3 +941,3 @@ }

return this.scanTokens(function(token, i, tokens) {
var conditionTag, j, k, ref, ref1, tag;
var conditionTag, j, k, ref, ref1, ref2, tag;
[tag] = token;

@@ -874,2 +951,6 @@ conditionTag = (tag === '->' || tag === '=>') && this.findTagsBackwards(i, ['IF', 'WHILE', 'FOR', 'UNTIL', 'SWITCH', 'WHEN', 'LEADING_WHEN', '[', 'INDEX_START']) && !(this.findTagsBackwards(i, ['THEN', '..', '...']));

if (ref = this.tag(i + 1), indexOf.call(EXPRESSION_CLOSE, ref) >= 0) {
if (token[1] === ';' && this.tag(i + 1) === 'OUTDENT') {
tokens[i + 1].prevToken = token;
moveComments(token, tokens[i + 1]);
}
tokens.splice(i, 1);

@@ -888,3 +969,3 @@ return 0;

}
if ((tag === '->' || tag === '=>') && (this.tag(i + 1) === ',' || this.tag(i + 1) === '.' && token.newLine)) {
if ((tag === '->' || tag === '=>') && (((ref2 = this.tag(i + 1)) === ',' || ref2 === ']') || this.tag(i + 1) === '.' && token.newLine)) {
[indent, outdent] = this.indentation(tokens[i]);

@@ -948,2 +1029,26 @@ tokens.splice(i + 1, 0, indent, outdent);

// For tokens with extra data, we want to make that data visible to the grammar
// by wrapping the token value as a String() object and setting the data as
// properties of that object. The grammar should then be responsible for
// cleaning this up for the node constructor: unwrapping the token value to a
// primitive string and separately passing any expected token data properties
exposeTokenDataToGrammar() {
return this.scanTokens(function(token, i) {
var key, ref, ref1, val;
if (token.generated || (token.data && Object.keys(token.data).length !== 0)) {
token[1] = new String(token[1]);
ref1 = (ref = token.data) != null ? ref : {};
for (key in ref1) {
if (!hasProp.call(ref1, key)) continue;
val = ref1[key];
token[1][key] = val;
}
if (token.generated) {
token[1].generated = true;
}
}
return 1;
});
}
// Generate the indentation tokens, based on another token on the same line.

@@ -981,3 +1086,3 @@ indentation(origin) {

// List of the token pairs that must be balanced.
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END'], ['STRING_START', 'STRING_END'], ['REGEX_START', 'REGEX_END']];
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END'], ['STRING_START', 'STRING_END'], ['INTERPOLATION_START', 'INTERPOLATION_END'], ['REGEX_START', 'REGEX_END']];

@@ -1006,3 +1111,3 @@ // The inverse mappings of `BALANCED_PAIRS` we’re trying to fix up, so we can

// If preceded by an `IMPLICIT_FUNC`, indicates a function invocation.
IMPLICIT_CALL = ['IDENTIFIER', 'CSX_TAG', 'PROPERTY', 'NUMBER', 'INFINITY', 'NAN', 'STRING', 'STRING_START', 'REGEX', 'REGEX_START', 'JS', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'UNDEFINED', 'NULL', 'BOOL', 'UNARY', 'YIELD', 'AWAIT', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];
IMPLICIT_CALL = ['IDENTIFIER', 'JSX_TAG', 'PROPERTY', 'NUMBER', 'INFINITY', 'NAN', 'STRING', 'STRING_START', 'REGEX', 'REGEX_START', 'JS', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'UNDEFINED', 'NULL', 'BOOL', 'UNARY', 'DO', 'DO_IIFE', 'YIELD', 'AWAIT', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];

@@ -1035,4 +1140,4 @@ IMPLICIT_UNSPACED_CALL = ['+', '-'];

// `addDataToNode` attaches `STRING_START`’s tokens to that node.
DISCARDED = ['(', ')', '[', ']', '{', '}', '.', '..', '...', ',', '=', '++', '--', '?', 'AS', 'AWAIT', 'CALL_START', 'CALL_END', 'DEFAULT', 'ELSE', 'EXTENDS', 'EXPORT', 'FORIN', 'FOROF', 'FORFROM', 'IMPORT', 'INDENT', 'INDEX_SOAK', 'LEADING_WHEN', 'OUTDENT', 'PARAM_END', 'REGEX_START', 'REGEX_END', 'RETURN', 'STRING_END', 'THROW', 'UNARY', 'YIELD'].concat(IMPLICIT_UNSPACED_CALL.concat(IMPLICIT_END.concat(CALL_CLOSERS.concat(CONTROL_IN_IMPLICIT))));
DISCARDED = ['(', ')', '[', ']', '{', '}', ':', '.', '..', '...', ',', '=', '++', '--', '?', 'AS', 'AWAIT', 'CALL_START', 'CALL_END', 'DEFAULT', 'DO', 'DO_IIFE', 'ELSE', 'EXTENDS', 'EXPORT', 'FORIN', 'FOROF', 'FORFROM', 'IMPORT', 'INDENT', 'INDEX_SOAK', 'INTERPOLATION_START', 'INTERPOLATION_END', 'LEADING_WHEN', 'OUTDENT', 'PARAM_END', 'REGEX_START', 'REGEX_END', 'RETURN', 'STRING_END', 'THROW', 'UNARY', 'YIELD'].concat(IMPLICIT_UNSPACED_CALL.concat(IMPLICIT_END.concat(CALL_CLOSERS.concat(CONTROL_IN_IMPLICIT))));
}).call(this);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -3,0 +3,0 @@ // The **Scope** class regulates lexical scoping within CoffeeScript. As you

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.4.1
// Generated by CoffeeScript 2.5.0
(function() {

@@ -56,6 +56,6 @@ // Source maps allow JavaScript runtimes to match running JavaScript back to

// Maps locations in a single generated JavaScript file back to locations in
// Maps locations in a single generated JavaScript file back to locations in
// the original CoffeeScript source file.
// This is intentionally agnostic towards how a source map might be represented on
// This is intentionally agnostic towards how a source map might be represented on
// disk. Once the compiler is ready to produce a "v3"-style source map, we can walk

@@ -92,3 +92,3 @@ // through the arrays of line and column buffer to produce it.

// Builds up a V3 source map, returning the generated JSON as a string.
// Builds up a V3 source map, returning the generated JSON as a string.
// `options.sourceRoot` may be used to specify the sourceRoot written to the source

@@ -95,0 +95,0 @@ // map. Also, `options.sourceFiles` and `options.generatedFile` may be passed to

@@ -11,3 +11,3 @@ {

"author": "Jeremy Ashkenas",
"version": "2.4.1",
"version": "2.5.0",
"license": "MIT",

@@ -44,14 +44,14 @@ "engines": {

"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-preset-minify": "^0.5.0",
"codemirror": "^5.45.0",
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"babel-preset-minify": "^0.5.1",
"codemirror": "^5.50.0",
"docco": "~0.8.0",
"highlight.js": "~9.15.6",
"highlight.js": "~9.17.1",
"jison": "^0.4.18",
"markdown-it": "~8.4.2",
"markdown-it": "~10.0.0",
"underscore": "~1.9.1",
"webpack": "~4.29.6"
"webpack": "~4.41.5"
},
"dependencies": {}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc