Socket
Socket
Sign inDemoInstall

coffeescript

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeescript - npm Package Compare versions

Comparing version 2.0.0-beta4 to 2.0.0-beta5

2

lib/coffeescript/browser.js

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(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.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

// source CoffeeScript into JavaScript.
var Lexer, SourceMap, base64encode, checkShebangLine, compile, formatSourcePosition, getSourceMap, helpers, lexer, packageJson, parser, sourceMaps, sources, withPrettyErrors;
var FILE_EXTENSIONS, Lexer, SourceMap, base64encode, checkShebangLine, compile, formatSourcePosition, getSourceMap, helpers, lexer, packageJson, parser, sourceMaps, sources, withPrettyErrors,
indexOf = [].indexOf;

@@ -25,3 +26,3 @@ ({Lexer} = require('./lexer'));

exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md'];
exports.FILE_EXTENSIONS = FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md'];

@@ -72,6 +73,6 @@ // Expose helpers for testing.

// need a stack trace, rather than always generating a source map even when
// it’s not likely to be used. Save in form of `filename`: `(source)`
// it’s not likely to be used. Save in form of `filename`: [`(source)`]
sources = {};
// Also save source maps if generated, in form of `filename`: `(source map)`.
// Also save source maps if generated, in form of `(source)`: [`(source map)`].
sourceMaps = {};

@@ -99,3 +100,6 @@

checkShebangLine(filename, code);
sources[filename] = code;
if (sources[filename] == null) {
sources[filename] = [];
}
sources[filename].push(code);
if (generateSourceMap) {

@@ -165,3 +169,6 @@ map = new SourceMap;

v3SourceMap = map.generate(options, code);
sourceMaps[filename] = map;
if (sourceMaps[filename] == null) {
sourceMaps[filename] = [];
}
sourceMaps[filename].push(map);
}

@@ -319,13 +326,39 @@ if (options.inlineMap) {

getSourceMap = function(filename) {
var answer;
if (sourceMaps[filename] != null) {
return sourceMaps[filename];
// CoffeeScript compiled in a browser may get compiled with `options.filename`
// of `<anonymous>`, but the browser may request the stack trace with the
// filename of the script file.
getSourceMap = function(filename, line, column) {
var answer, i, map, ref, ref1, sourceLocation;
if (!(filename === '<anonymous>' || (ref = filename.slice(filename.lastIndexOf('.')), indexOf.call(FILE_EXTENSIONS, ref) >= 0))) {
// Skip files that we didn’t compile, like Node system files that appear in
// the stack trace, as they never have source maps.
return null;
}
if (filename !== '<anonymous>' && (sourceMaps[filename] != null)) {
return sourceMaps[filename][sourceMaps[filename].length - 1];
// CoffeeScript compiled in a browser or via `CoffeeScript.compile` or `.run`
// may get compiled with `options.filename` that’s missing, which becomes
// `<anonymous>`; but the runtime might request the stack trace with the
// filename of the script file. See if we have a source map cached under
// `<anonymous>` that matches the error.
} else if (sourceMaps['<anonymous>'] != null) {
return sourceMaps['<anonymous>'];
} else if (sources[filename] != null) {
answer = compile(sources[filename], {
ref1 = sourceMaps['<anonymous>'];
// Work backwards from the most recent anonymous source maps, until we find
// one that works. This isn’t foolproof; there is a chance that multiple
// source maps will have line/column pairs that match. But we have no other
// way to match them. `frame.getFunction().toString()` doesn’t always work,
// and it’s not foolproof either.
for (i = ref1.length - 1; i >= 0; i += -1) {
map = ref1[i];
sourceLocation = map.sourceLocation([line - 1, column - 1]);
if (((sourceLocation != null ? sourceLocation[0] : void 0) != null) && (sourceLocation[1] != null)) {
return map;
}
}
}
// If all else fails, recompile this source to get a source map. We need the
// previous section (for `<anonymous>`) despite this option, because after it
// gets compiled we will still need to look it up from
// `sourceMaps['<anonymous>']` in order to find and return it. That’s why we
// start searching from the end in the previous block, because most of the
// time the source map we want is the last one.
if (sources[filename] != null) {
answer = compile(sources[filename][sources[filename].length - 1], {
filename: filename,

@@ -349,3 +382,3 @@ sourceMap: true,

var answer, sourceMap;
sourceMap = getSourceMap(filename);
sourceMap = getSourceMap(filename, line, column);
if (sourceMap != null) {

@@ -352,0 +385,0 @@ answer = sourceMap.sourceLocation([line - 1, column - 1]);

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

// 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 [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 coffeescript'], ['-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 [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', '--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']];

@@ -72,3 +72,3 @@ // Top-level objects shared by all the functions.

exports.run = function() {
var err, i, len, literals, ref, replCliOpts, results, source;
var err, i, len, literals, outputBasename, ref, replCliOpts, results, source;
optionParser = buildCSOptionParser();

@@ -122,3 +122,12 @@ try {

if (opts.output) {
opts.output = path.resolve(opts.output);
outputBasename = path.basename(opts.output);
if (indexOf.call(outputBasename, '.') >= 0 && (outputBasename !== '.' && outputBasename !== '..') && !helpers.ends(opts.output, path.sep)) {
// An output filename was specified, e.g. `/dist/scripts.js`.
opts.outputFilename = outputBasename;
opts.outputPath = path.resolve(path.dirname(opts.output));
} else {
// An output path was specified, e.g. `/dist`.
opts.outputFilename = null;
opts.outputPath = path.resolve(opts.output);
}
}

@@ -141,8 +150,8 @@ if (opts.join) {

return requires.map(function(module) {
var _, match, name;
var full, match, name;
if (match = module.match(/^(.*)=(.*)$/)) {
[_, name, module] = match;
[full, name, module] = match;
}
name || (name = helpers.baseFileName(module, true, useWinPathSep));
return `${name} = require('${module}')`;
return `global['${name}'] = require('${module}')`;
}).join(';');

@@ -242,39 +251,39 @@ };

// Compile a single source script, containing the given code, according to the
// requested options. If evaluating the script directly sets `__filename`,
// requested options. If evaluating the script directly, set `__filename`,
// `__dirname` and `module.filename` to be correct relative to the script's path.
compileScript = function(file, input, base = null) {
var compiled, err, message, o, options, t, task;
o = opts;
var compiled, err, message, options, saveTo, task;
options = compileOptions(file, base);
try {
t = task = {file, input, options};
task = {file, input, options};
CoffeeScript.emit('compile', task);
if (o.tokens) {
return printTokens(CoffeeScript.tokens(t.input, t.options));
} else if (o.nodes) {
return printLine(CoffeeScript.nodes(t.input, t.options).toString().trim());
} else if (o.run) {
if (opts.tokens) {
return printTokens(CoffeeScript.tokens(task.input, task.options));
} else if (opts.nodes) {
return printLine(CoffeeScript.nodes(task.input, task.options).toString().trim());
} else if (opts.run) {
CoffeeScript.register();
if (opts.prelude) {
CoffeeScript.eval(opts.prelude, t.options);
CoffeeScript.eval(opts.prelude, task.options);
}
return CoffeeScript.run(t.input, t.options);
} else if (o.join && t.file !== o.join) {
return CoffeeScript.run(task.input, task.options);
} else if (opts.join && task.file !== opts.join) {
if (helpers.isLiterate(file)) {
t.input = helpers.invertLiterate(t.input);
task.input = helpers.invertLiterate(task.input);
}
sourceCode[sources.indexOf(t.file)] = t.input;
sourceCode[sources.indexOf(task.file)] = task.input;
return compileJoin();
} else {
compiled = CoffeeScript.compile(t.input, t.options);
t.output = compiled;
if (o.map) {
t.output = compiled.js;
t.sourceMap = compiled.v3SourceMap;
compiled = CoffeeScript.compile(task.input, task.options);
task.output = compiled;
if (opts.map) {
task.output = compiled.js;
task.sourceMap = compiled.v3SourceMap;
}
CoffeeScript.emit('success', task);
if (o.print) {
return printLine(t.output.trim());
} else if (o.compile || o.map) {
return writeJs(base, t.file, t.output, options.jsPath, t.sourceMap);
if (opts.print) {
return printLine(task.output.trim());
} else if (opts.compile || opts.map) {
saveTo = opts.outputFilename && sources.length === 1 ? path.join(opts.outputPath, opts.outputFilename) : options.jsPath;
return writeJs(base, task.file, task.output, saveTo, task.sourceMap);
}

@@ -289,3 +298,3 @@ }

message = (err != null ? err.stack : void 0) || `${err}`;
if (o.watch) {
if (opts.watch) {
return printLine(message + '\x07');

@@ -495,9 +504,3 @@ } else {

srcDir = path.dirname(source);
if (!opts.output) {
dir = srcDir;
} else if (source === base) {
dir = opts.output;
} else {
dir = path.join(opts.output, path.relative(base, srcDir));
}
dir = !opts.outputPath ? srcDir : source === base ? opts.outputPath : path.join(opts.outputPath, path.relative(base, srcDir));
return path.join(dir, basename + extension);

@@ -504,0 +507,0 @@ };

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

}),
o('Code Accessor',
function() {
return new Value($1).add($2);
}),
o('ThisProperty')

@@ -492,0 +496,0 @@ ],

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(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.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

historyMaxInputSize: 10240,
eval: async function(input, context, filename, cb) {
eval: function(input, context, filename, cb) {
var Assign, Block, Call, Code, Literal, Value, ast, err, isAsync, js, referencedVars, result, token, tokens;

@@ -75,6 +75,7 @@ // XXX: multiline hack.

if (isAsync) {
result = (await result);
if (!sawSIGINT) {
cb(null, result);
}
result.then(function(resolvedResult) {
if (!sawSIGINT) {
return cb(null, resolvedResult);
}
});
return sawSIGINT = false;

@@ -81,0 +82,0 @@ } else {

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

@@ -89,2 +89,3 @@ // The CoffeeScript language has a good deal of optional syntax, implicit syntax,

this.addImplicitBracesAndParens();
this.addParensToChainedDoIife();
this.rescueStowawayComments();

@@ -284,3 +285,3 @@ this.addLocationDataToGeneratedTokens();

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

@@ -427,3 +428,3 @@ [prevTag] = prevToken = i > 0 ? tokens[i - 1] : [];

// Added support for spread dots on the left side: f ...a
if ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || nextTag === '...' || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !nextToken.spaced && !nextToken.newLine)) {
if ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || (nextTag === '...' && (ref = this.tag(i + 2), indexOf.call(IMPLICIT_CALL, ref) >= 0) && !this.findTagsBackwards(i, ['INDEX_START', '['])) || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !nextToken.spaced && !nextToken.newLine)) {
if (tag === '?') {

@@ -462,5 +463,5 @@ tag = token[0] = 'FUNC_EXIST';

s = (function() {
var ref;
var ref1;
switch (false) {
case ref = this.tag(i - 1), indexOf.call(EXPRESSION_END, ref) < 0:
case ref1 = this.tag(i - 1), indexOf.call(EXPRESSION_END, ref1) < 0:
return start[1];

@@ -473,3 +474,3 @@ case this.tag(i - 2) !== '@':

}).call(this);
startsLine = s === 0 || (ref = this.tag(s - 1), indexOf.call(LINEBREAKS, ref) >= 0) || tokens[s - 1].newLine;
startsLine = s <= 0 || (ref1 = this.tag(s - 1), indexOf.call(LINEBREAKS, ref1) >= 0) || tokens[s - 1].newLine;
// Are we just continuing an already declared object?

@@ -742,2 +743,42 @@ if (stackTop()) {

// 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;
}
this.tokens.splice(doIndex, 0, generate('(', '(', this.tokens[doIndex]));
return this.tokens.splice(i + 1, 0, generate(')', ')', this.tokens[i]));
};
doIndex = null;
return this.scanTokens(function(token, i, tokens) {
var glyphIndex, ref;
if (token[1] !== 'do') {
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;
});
}
if (!((glyphIndex != null) && ((ref = this.tag(glyphIndex)) === '->' || ref === '=>') && this.tag(glyphIndex + 1) === 'INDENT')) {
return 1;
}
this.detectEnd(glyphIndex + 1, condition, action);
return 2;
});
}
// Because our grammar is LALR(1), it can’t handle some single-line

@@ -744,0 +785,0 @@ // expressions that lack ending delimiters. The **Rewriter** adds the implicit

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

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

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

// Generated by CoffeeScript 2.0.0-beta4
// Generated by CoffeeScript 2.0.0-beta5
(function() {

@@ -96,3 +96,3 @@ // Source maps allow JavaScript runtimes to match running JavaScript back to

generate(options = {}, code = null) {
var buffer, i, j, lastColumn, lastSourceColumn, lastSourceLine, len, len1, lineMap, lineNumber, mapping, needComma, ref, ref1, v3, writingline;
var buffer, i, j, lastColumn, lastSourceColumn, lastSourceLine, len, len1, lineMap, lineNumber, mapping, needComma, ref, ref1, sources, v3, writingline;
writingline = 0;

@@ -145,2 +145,3 @@ lastColumn = 0;

// Produce the canonical JSON object format for a "v3" source map.
sources = options.sourceFiles ? options.sourceFiles : options.filename ? [options.filename] : ['<anonymous>'];
v3 = {

@@ -150,3 +151,3 @@ version: 3,

sourceRoot: options.sourceRoot || '',
sources: options.sourceFiles || [''],
sources: sources,
names: [],

@@ -153,0 +154,0 @@ mappings: buffer

@@ -11,6 +11,6 @@ {

"author": "Jeremy Ashkenas",
"version": "2.0.0-beta4",
"version": "2.0.0-beta5",
"license": "MIT",
"engines": {
"node": ">=7.6.0"
"node": ">=6"
},

@@ -43,3 +43,3 @@ "directories": {

"devDependencies": {
"babel-core": "~6.25.0",
"babel-core": "~6.26.0",
"babel-preset-babili": "~0.1.4",

@@ -51,7 +51,7 @@ "babel-preset-env": "~1.6.0",

"jison": ">=0.4.17",
"markdown-it": "~8.3.1",
"markdown-it": "~8.4.0",
"underscore": "~1.8.3",
"webpack": "~3.2.0"
"webpack": "~3.5.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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc