coffee-script-redux
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0-beta2
@@ -1,3 +0,3 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
var $0, $0, additionalArgs, additionalArgs, additionalArgs, arg, args, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, formatOptions, fs, humanReadable, input, input, inputSource, inspect, leftColumnWidth, longOptionArguments, longParameterArguments, match, match, match, maxWidth, numberLines, o, o, o, Optimiser, optionArguments, optionMap, optionRows, options, opts, opts, parameterArguments, parameterRows, path, pkg, positionalArgs, positionalArgs, Preprocessor, processInput, reLongOption, reLongParameter, reShortOptions, reShortOptionsShortParameter, reShortParameter, row, rows, runMain, shortOptionArguments, shortParameterArguments, wrap; | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var $0, $0, additionalArgs, additionalArgs, additionalArgs, arg, args, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, formatOptions, fs, humanReadable, input, input, inputSource, inspect, leftColumnWidth, longOptionArguments, longParameterArguments, match, match, match, maxWidth, numberLines, o, o, o, Optimiser, optionArguments, optionMap, optionRows, options, opts, opts, output, parameterArguments, parameterRows, path, pkg, positionalArgs, positionalArgs, Preprocessor, processInput, reLongOption, reLongParameter, Repl, reShortOptions, reShortOptionsShortParameter, reShortParameter, row, rows, runMain, shortOptionArguments, shortParameterArguments, wrap; | ||
fs = require('fs'); | ||
@@ -15,2 +15,3 @@ path = require('path'); | ||
CoffeeScript = require('./module'); | ||
Repl = require('./repl'); | ||
cscodegen = function () { | ||
@@ -284,2 +285,12 @@ try { | ||
} | ||
output = function (out) { | ||
if (options.output) { | ||
return fs.writeFile(options.output, '' + out + '\n', function (err) { | ||
if (null != err) | ||
throw err; | ||
}); | ||
} else { | ||
return process.stdout.write('' + out + '\n'); | ||
} | ||
}; | ||
if (options.help) { | ||
@@ -320,3 +331,3 @@ $0 = process.argv[0] === 'node' ? process.argv[1] : process.argv[0]; | ||
}; | ||
console.log('\n Usage:\n ' + $0 + ' FILE ARG* [-- ARG*]\n ' + $0 + ' OPT* [--repl] OPT*\n ' + $0 + ' OPT* -{-parse,p,-compile,c,-js,j,-cscodegen} OPT*\n ' + $0 + ' {OPT,ARG}* -{-eval,e} {OPT,ARG}* -- ARG*\n\n '); | ||
console.log('\n Usage: (OPT is interpreted by ' + $0 + ', ARG is passed to FILE)\n\n ' + $0 + ' OPT* -{p,c,j,f} OPT*\n example: ' + $0 + ' --js --no-optimise <input.coffee >output.js\n ' + $0 + ' [-e] FILE {OPT,ARG}* [-- ARG*]\n example: ' + $0 + ' myfile.coffee arg0 arg1\n ' + $0 + ' OPT* [--repl] OPT*\n example: ' + $0 + '\n '); | ||
optionRows = function (accum$) { | ||
@@ -365,3 +376,3 @@ var opt; | ||
} | ||
console.log('\n\n Unless instructed otherwise (--{input,watch,cli}), `' + $0 + '` will operate on stdin/stdout.\n When none of -{-parse,p,-compile,c,-js,j,-eval,e,-cscodegen,-repl} are given\n If positional arguments were given\n * --eval is implied\n * the first positional argument is used as an input filename\n * additional positional arguments are passed as arguments to the script\n Else --repl is implied\n '); | ||
console.log('\n Unless given --input or --cli flags, `' + $0 + '` will operate on stdin/stdout.\n When none of --{parse,compile,js,eval,cscodegen,repl} are given,\n If positional arguments were given\n * --eval is implied\n * the first positional argument is used as an input filename\n * additional positional arguments are passed as arguments to the script\n Else --repl is implied\n '); | ||
} else if (options.version) { | ||
@@ -371,4 +382,3 @@ pkg = require('./../../package.json'); | ||
} else if (options.repl) { | ||
console.error('TODO: REPL'); | ||
process.exit(1); | ||
Repl.start(); | ||
} else { | ||
@@ -410,4 +420,4 @@ input = ''; | ||
if (null != result) { | ||
console.log(inspect(result.toJSON())); | ||
process.exit(0); | ||
output(inspect(result.toJSON())); | ||
return; | ||
} else { | ||
@@ -429,4 +439,4 @@ process.exit(1); | ||
if (null != result) { | ||
console.log(result); | ||
process.exit(0); | ||
output(result); | ||
return; | ||
} else { | ||
@@ -439,4 +449,4 @@ process.exit(1); | ||
if (null != jsAST) { | ||
console.log(inspect(jsAST.toJSON())); | ||
process.exit(0); | ||
output(inspect(jsAST.toJSON())); | ||
return; | ||
} else { | ||
@@ -466,4 +476,4 @@ process.exit(1); | ||
if (null != sourceMap) { | ||
process.stdout.write('' + sourceMap + '\n'); | ||
process.exit(0); | ||
output('' + sourceMap); | ||
return; | ||
} else { | ||
@@ -475,2 +485,4 @@ process.exit(1); | ||
js = CoffeeScript.js(jsAST, { compact: options.minify }); | ||
if (null != options.input) | ||
js = '' + js + '\n//@ sourceURL=' + options.input; | ||
} catch (e$5) { | ||
@@ -481,11 +493,10 @@ e = e$5; | ||
} | ||
if (options.js) | ||
if (null != js) { | ||
console.log(js); | ||
process.exit(0); | ||
} else { | ||
process.exit(1); | ||
} | ||
if (options['eval']) | ||
return runMain(input, js, jsAST, inputSource); | ||
if (options.js) { | ||
output(js); | ||
return; | ||
} | ||
if (options['eval']) { | ||
runMain(input, js, jsAST, inputSource); | ||
return; | ||
} | ||
}; | ||
@@ -525,1 +536,2 @@ if (null != options.input) { | ||
} | ||
//@ sourceURL=src/command.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var concat, foldl, map, nub, span; | ||
@@ -156,1 +156,2 @@ this.any = function (list, fn) { | ||
} | ||
//@ sourceURL=src/functional-helpers.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var beingDeclared, cleanMarkers, concat, concatMap, CS, difference, envEnrichments, envEnrichments_, foldl, humanReadable, map, nub, numberLines, pointToErrorLocation, usedAsExpression, usedAsExpression_; | ||
@@ -174,1 +174,2 @@ cache$ = require('./functional-helpers'); | ||
} | ||
//@ sourceURL=src/helpers.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; | ||
@@ -470,1 +470,2 @@ difference = require('./functional-helpers').difference; | ||
} | ||
//@ sourceURL=src/js-nodes.coffee |
@@ -1,3 +0,3 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
var CoffeeScript, Compiler, cscodegen, escodegen, escodegenCompactDefaults, escodegenFormatDefaults, formatParserError, fs, Nodes, Optimiser, Parser, path, pkg, Preprocessor; | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var CoffeeScript, Compiler, cscodegen, escodegen, escodegenCompactDefaults, escodegenFormatDefaults, formatParserError, fs, noBrowserifyRequire, Nodes, Optimiser, Parser, path, pkg, Preprocessor; | ||
fs = require('fs'); | ||
@@ -105,5 +105,21 @@ path = require('path'); | ||
}); | ||
}, | ||
cs2js: function (input, options) { | ||
var csAST, jsAST; | ||
if (null == options) | ||
options = {}; | ||
if (null != options.optimise) | ||
options.optimise; | ||
else | ||
options.optimise = true; | ||
csAST = CoffeeScript.parse(input, options); | ||
jsAST = CoffeeScript.compile(csAST, { bare: options.bare }); | ||
return CoffeeScript.js(jsAST, { compact: options.compact || options.minify }); | ||
} | ||
}; | ||
CoffeeScript = module.exports.CoffeeScript = module.exports; | ||
require('./run'); | ||
if (process.title === 'node') { | ||
noBrowserifyRequire = require; | ||
noBrowserifyRequire('./run'); | ||
} | ||
//@ sourceURL=src/module.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var ArrayInitialiser, Block, Bool, Class, CompoundAssignOp, concat, concatMap, Conditional, createNodes, difference, exports, ForOf, FunctionApplications, Functions, GenSym, handleLists, handlePrimitives, HeregExp, Identifier, Identifiers, map, NegatedConditional, NewOp, Nodes, nub, ObjectInitialiser, Primitives, Range, RegExp, RegExps, Slice, StaticMemberAccessOps, Super, Switch, SwitchCase, union, While; | ||
@@ -588,1 +588,2 @@ cache$ = require('./functional-helpers'); | ||
} | ||
//@ sourceURL=src/nodes.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var all, any, beingDeclared, concat, concatMap, CS, declarationsFor, difference, envEnrichments, exports, foldl, foldl1, isFalsey, isTruthy, makeDispatcher, mayHaveSideEffects, union, usedAsExpression; | ||
@@ -810,1 +810,2 @@ cache$ = require('./functional-helpers'); | ||
} | ||
//@ sourceURL=src/optimiser.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var EventEmitter, fs, inspect, pointToErrorLocation, Preprocessor, StringScanner; | ||
@@ -13,3 +13,3 @@ fs = require('fs'); | ||
extends$(Preprocessor, super$); | ||
ws = '\\t\\x0B\\f \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; | ||
ws = '\\t\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; | ||
INDENT = '\uefef'; | ||
@@ -19,3 +19,4 @@ DEDENT = '\ueffe'; | ||
function Preprocessor() { | ||
this.base = this.indent = null; | ||
this.base = null; | ||
this.indents = []; | ||
this.context = []; | ||
@@ -113,3 +114,3 @@ this.context.peek = function () { | ||
return function (data) { | ||
var context, delta, lastChar, level, lines, message, newLevel, nonIdentifierBefore, pos, spaceBefore, tok; | ||
var context, indent, indentIndex, lastChar, lineLen, lines, message, nonIdentifierBefore, pos, spaceBefore, tok; | ||
if (!isEnd) | ||
@@ -136,37 +137,25 @@ this.ss.concat(data); | ||
} | ||
if (null != this.indent) { | ||
level = function (accum$) { | ||
var c; | ||
for (var i$ = 0, length$ = this.context.length; i$ < length$; ++i$) { | ||
c = this.context[i$]; | ||
if (!(c === INDENT)) | ||
continue; | ||
accum$.push(0); | ||
} | ||
return accum$; | ||
}.call(this, []).length; | ||
if (this.ss.check(new RegExp('(?:' + this.indent + '){' + (level + 1) + '}[^' + ws + '#]'))) { | ||
this.scan(new RegExp('(?:' + this.indent + '){' + (level + 1) + '}')); | ||
this.context.observe(INDENT); | ||
this.p(INDENT); | ||
} else if (level > 0 && this.ss.check(new RegExp('(?:' + this.indent + '){0,' + (level - 1) + '}[^' + ws + ']'))) { | ||
newLevel = 0; | ||
while (this.scan(new RegExp('' + this.indent + ''))) { | ||
++newLevel; | ||
} | ||
delta = level - newLevel; | ||
while (delta--) { | ||
this.context.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
} | ||
} else if (this.ss.check(new RegExp('(?:' + this.indent + '){' + level + '}[^' + ws + ']'))) { | ||
this.scan(new RegExp('(?:' + this.indent + '){' + level + '}')); | ||
indentIndex = 0; | ||
while (indentIndex < this.indents.length) { | ||
indent = this.indents[indentIndex]; | ||
if (this.ss.check(new RegExp('' + indent + ''))) { | ||
this.scan(new RegExp('' + indent + '')); | ||
} else if (this.ss.check(new RegExp('[^' + ws + ']'))) { | ||
this.indents.splice(indentIndex, 1); | ||
--indentIndex; | ||
this.context.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
} else { | ||
lines = this.ss.str.substr(0, this.ss.pos).split(/\n/) || ['']; | ||
message = 'Syntax error on line ' + lines.length + ': invalid indentation'; | ||
context = pointToErrorLocation(this.ss.str, lines.length, 1 + (level + 1) * this.indent.length); | ||
message = 'Syntax error on line ' + lines.length + ': indention is ambiguous'; | ||
lineLen = this.indents.reduce(function (l, r) { | ||
return l + r.length; | ||
}, 0); | ||
context = pointToErrorLocation(this.ss.str, lines.length, lineLen); | ||
throw new Error('' + message + '\n' + context); | ||
} | ||
} else if (this.ss.check(new RegExp('[' + ws + ']+[^' + ws + '#]'))) { | ||
this.indent = this.scan(new RegExp('[' + ws + ']+')); | ||
++indentIndex; | ||
} | ||
if (this.ss.check(new RegExp('[' + ws + ']+[^' + ws + '#]'))) { | ||
this.indents.push(this.scan(new RegExp('[' + ws + ']+'))); | ||
this.context.observe(INDENT); | ||
@@ -336,1 +325,2 @@ this.p(INDENT); | ||
} | ||
//@ sourceURL=src/preprocessor.coffee |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-dev | ||
// Generated by CoffeeScript 2.0.0-beta1 | ||
var CoffeeScript, formatSourcePosition, fs, Module, patched, patchStackTrace, path, runModule, SourceMapConsumer; | ||
@@ -109,1 +109,2 @@ fs = require('fs'); | ||
}; | ||
//@ sourceURL=src/run.coffee |
{ | ||
"name": "coffee-script-redux", | ||
"author": "Michael Ficarra", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0-beta2", | ||
"homepage": "https://github.com/michaelficarra/CoffeeScriptRedux", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/michaelficarra/CoffeeScriptRedux/issues", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
1194699
64
28884
10
2