Comparing version 1.5.0 to 1.6.0
@@ -1,4 +0,4 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
var LiveScript; | ||
LiveScript = require('..'); | ||
LiveScript = require('./index'); | ||
LiveScript.stab = function(code, callback, filename){ | ||
@@ -5,0 +5,0 @@ var e; |
@@ -1,3 +0,3 @@ | ||
// Generated by LiveScript 1.5.0 | ||
var LiveScript, path, fs, util, prelude, each, breakList, lines, unlines, take, keys, filter, dasherize, map, ref$, parseOptions, generateHelp, nameFromPath, SourceNode, version, this$ = this, slice$ = [].slice; | ||
// Generated by LiveScript 1.6.0 | ||
var LiveScript, path, fs, util, prelude, each, breakList, ref$, parseOptions, generateHelp, nameFromPath, version, slice$ = [].slice, arrayFrom$ = Array.from || function(x){return slice$.call(x);}; | ||
LiveScript = require('..'); | ||
@@ -7,6 +7,5 @@ path = require('path'); | ||
util = require('util'); | ||
prelude = require('prelude-ls'), each = prelude.each, breakList = prelude.breakList, lines = prelude.lines, unlines = prelude.unlines, take = prelude.take, keys = prelude.keys, filter = prelude.filter, dasherize = prelude.dasherize, map = prelude.map; | ||
prelude = require('prelude-ls'), each = prelude.each, breakList = prelude.breakList; | ||
ref$ = require('./options'), parseOptions = ref$.parse, generateHelp = ref$.generateHelp; | ||
nameFromPath = require('./util').nameFromPath; | ||
SourceNode = require('source-map').SourceNode; | ||
version = LiveScript.VERSION; | ||
@@ -16,3 +15,3 @@ (function(it){ | ||
})(function(args, arg$){ | ||
var ref$, say, sayWithTimestamp, warn, die, p, pp, ppp, fileExists, dasherizeVars, startsWith, o, positional, e, validMapValues, toInsert, that, filename, jsonCallback; | ||
var ref$, say, sayWithTimestamp, warn, die, o, positional, e, validMapValues, that, filename, jsonCallback; | ||
ref$ = arg$ != null | ||
@@ -28,36 +27,2 @@ ? arg$ | ||
}); | ||
p = function(){ | ||
var args, res$, i$, to$; | ||
res$ = []; | ||
for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) { | ||
res$.push(arguments[i$]); | ||
} | ||
args = res$; | ||
each(console.dir, args); | ||
}; | ||
pp = function(x, showHidden, depth){ | ||
say(util.inspect(x, showHidden, depth, !process.env.NODE_DISABLE_COLORS)); | ||
}; | ||
ppp = function(it){ | ||
pp(it, true, null); | ||
}; | ||
fileExists = function(path){ | ||
try { | ||
fs.statSync(path); | ||
return true; | ||
} catch (e$) {} | ||
}; | ||
dasherizeVars = function(str){ | ||
if (/^[a-z]/.exec(str)) { | ||
return dasherize(str); | ||
} else { | ||
return str; | ||
} | ||
}; | ||
startsWith = function(str){ | ||
var this$ = this; | ||
return function(it){ | ||
return it.indexOf(str) === 0; | ||
}; | ||
}; | ||
try { | ||
@@ -85,15 +50,16 @@ o = parseOptions(args); | ||
default: | ||
validMapValues = ['none', 'linked', 'linked-src', 'embedded', 'debug']; | ||
if (!in$(o.map, validMapValues)) { | ||
die("Option --map must be either: " + validMapValues.join(', ')); | ||
o.compile || (o.compile = o.output); | ||
o.run = !(o.compile || o.ast || o.tokens || o.lex); | ||
if (o.map != null) { | ||
validMapValues = ['none', 'linked', 'linked-src', 'embedded', 'debug']; | ||
if (!in$(o.map, validMapValues)) { | ||
die("Option --map must be either: " + validMapValues.join(', ')); | ||
} | ||
} else { | ||
o.map = o.run ? 'embedded' : 'none'; | ||
} | ||
o.run = !(o.compile || (o.compile = o.output)); | ||
if (args === process.argv) { | ||
process.argv[0] = process.argv[1]; | ||
toInsert = o.stdin | ||
? positional | ||
: o.run | ||
? positional.splice(1, 9e9) | ||
: []; | ||
(ref$ = process.argv).splice.apply(ref$, [2, 9e9].concat(slice$.call(toInsert))); | ||
if (o.run && args === process.argv) { | ||
process.argv.lsc = o.stdin || o.eval | ||
? [void 8].concat(arrayFrom$(positional)) | ||
: [positional[0]].concat(arrayFrom$(positional.splice(1))); | ||
} | ||
@@ -121,3 +87,3 @@ if (that = o.require) { | ||
fshoot('readFile', positional[0], jsonCallback); | ||
} else if (o.json) { | ||
} else if (o.json && o.run) { | ||
getStdin(jsonCallback); | ||
@@ -136,3 +102,3 @@ } else { | ||
say("LiveScript " + version + " - use 'lsc --help' for more information"); | ||
repl(); | ||
require('./repl')(o); | ||
break; | ||
@@ -198,3 +164,4 @@ default: | ||
map: o.map, | ||
header: o.header | ||
header: o.header, | ||
warn: o.warn | ||
}; | ||
@@ -223,3 +190,3 @@ t = { | ||
json = o.json || /\.json\.ls$/.test(filename); | ||
run = o.run || o.eval; | ||
run = o.run || (json && o.print); | ||
if (run) { | ||
@@ -230,2 +197,5 @@ LiveScript.emit('compile', t); | ||
LiveScript.emit('run', t); | ||
require('source-map-support').install({ | ||
hookRequire: true | ||
}); | ||
t.result = LiveScript.run(o.map === 'none' | ||
@@ -400,156 +370,4 @@ ? t.output | ||
} | ||
function repl(){ | ||
var MAXHISTORYSIZE, historyFile, code, cont, rl, reset, _ttyWrite, prompt, that, vm, replCtx, server, ref$; | ||
MAXHISTORYSIZE = 500; | ||
historyFile = path.join(process.env.HOME, '/.lsc_history'); | ||
code = repl.infunc ? ' ' : ''; | ||
cont = 0; | ||
rl = require('readline').createInterface(process.stdin, process.stdout); | ||
reset = function(){ | ||
rl.line = code = ''; | ||
rl.prompt(); | ||
repl.inheredoc = false; | ||
}; | ||
(_ttyWrite = rl._ttyWrite, rl)._ttyWrite = function(char){ | ||
if (char === '\n' || char === '>') { | ||
cont += 1; | ||
} else { | ||
cont = 0; | ||
} | ||
return _ttyWrite.apply(this, arguments); | ||
}; | ||
prompt = 'ls'; | ||
if (that = repeatString$('b', !!o.bare) + repeatString$('c', !!o.compile)) { | ||
prompt += " -" + that; | ||
} | ||
try { | ||
rl.history = lines(fs.readFileSync(historyFile, 'utf-8').trim()); | ||
} catch (e$) {} | ||
if (LiveScript != null) { | ||
LiveScript.history = rl.history; | ||
} | ||
if (!o.compile) { | ||
module.paths = module.constructor._nodeModulePaths(module.filename = process.cwd() + '/repl'); | ||
vm = require('vm'); | ||
if (o.prelude) { | ||
import$(global, prelude); | ||
} | ||
replCtx = {}; | ||
import$(replCtx, global); | ||
replCtx.module = module; | ||
replCtx.exports = exports; | ||
replCtx.require = require; | ||
replCtx.LiveScript = LiveScript; | ||
replCtx.path = path; | ||
replCtx.fs = fs; | ||
replCtx.util = util; | ||
replCtx.say = say; | ||
replCtx.warn = warn; | ||
replCtx.die = die; | ||
replCtx.p = p; | ||
replCtx.pp = pp; | ||
replCtx.ppp = ppp; | ||
server = (ref$ = clone$(require('repl').REPLServer.prototype), ref$.context = replCtx, ref$.commands = [], ref$.useGlobal = true, ref$.useColors = process.env.NODE_DISABLE_COLORS, ref$.eval = function(code, ctx, arg$, cb){ | ||
var res, e; | ||
try { | ||
res = vm.runInNewContext(code, ctx, 'repl'); | ||
} catch (e$) { | ||
e = e$; | ||
} | ||
cb(e, res); | ||
}, ref$); | ||
rl.completer = function(line, cb){ | ||
var contextVars, matches; | ||
contextVars = map(dasherizeVars, keys(server.context)); | ||
matches = filter(startsWith(line), contextVars); | ||
return cb(null, [matches.length ? matches : contextVars, line]); | ||
}; | ||
} | ||
rl.on('SIGCONT', rl.prompt); | ||
rl.on('SIGINT', function(){ | ||
if (this.line || code) { | ||
say(''); | ||
reset(); | ||
} else { | ||
this.close(); | ||
} | ||
}); | ||
rl.on('close', function(){ | ||
say(''); | ||
return process.exit(); | ||
}); | ||
rl.on('line', function(it){ | ||
var isheredoc, ops, x, e; | ||
if (it.match(/^$/)) { | ||
repl.infunc = false; | ||
} | ||
if (it.match(/(\=|\~>|->|do|import|switch)\s*$/) || (it.match(/^!?(function|class|if|unless) /) && !it.match(/ then /))) { | ||
repl.infunc = true; | ||
} | ||
if (((0 < cont && cont < 3) || repl.infunc) && !repl.inheredoc) { | ||
code += it + '\n'; | ||
this.output.write(repeatString$('.', prompt.length) + '. '); | ||
return; | ||
} else { | ||
isheredoc = it.match(/(\'\'\'|\"\"\")/g); | ||
if (isheredoc && isheredoc.length % 2 === 1) { | ||
repl.inheredoc = !repl.inheredoc; | ||
} | ||
if (repl.inheredoc) { | ||
code += it + '\n'; | ||
rl.output.write(repeatString$('.', prompt.length) + '" '); | ||
return; | ||
} | ||
} | ||
repl.inheredoc = false; | ||
if (!(code += it)) { | ||
return reset(); | ||
} | ||
try { | ||
if (o.compile) { | ||
say(LiveScript.compile(code, { | ||
bare: o.bare | ||
})); | ||
} else { | ||
ops = { | ||
'eval': 'eval', | ||
bare: true, | ||
saveScope: LiveScript | ||
}; | ||
if (code.match(/^\s*!?function/)) { | ||
ops = { | ||
bare: true | ||
}; | ||
} | ||
x = vm.runInNewContext(LiveScript.compile(code, ops), replCtx, 'repl'); | ||
if (x != null) { | ||
replCtx._ = x; | ||
} | ||
pp(x); | ||
if (typeof x === 'function') { | ||
say(x); | ||
} | ||
} | ||
} catch (e$) { | ||
e = e$; | ||
say(e); | ||
} | ||
reset(); | ||
}); | ||
process.on('uncaughtException', function(it){ | ||
say("\n" + ((it != null ? it.stack : void 8) || it)); | ||
}); | ||
process.on('exit', function(){ | ||
if (code && rl.output.isTTY) { | ||
rl._ttyWrite('\r'); | ||
} | ||
if (fileExists(historyFile)) { | ||
fs.writeFileSync(historyFile, compose$(take(MAXHISTORYSIZE), unlines)(rl.history)); | ||
} | ||
}); | ||
rl.setPrompt(prompt + "> "); | ||
rl.prompt(); | ||
} | ||
function forkNode(){ | ||
var ref$, args, lsArgs, ref1$, nodeArgs, this$ = this; | ||
var ref$, args, lsArgs, ref1$, nodeArgs; | ||
ref$ = process.argv, args = slice$.call(ref$, 1); | ||
@@ -574,21 +392,2 @@ ref$ = breakList((function(it){ | ||
return obj; | ||
} | ||
function repeatString$(str, n){ | ||
for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str; | ||
return r; | ||
} | ||
function clone$(it){ | ||
function fun(){} fun.prototype = it; | ||
return new fun; | ||
} | ||
function compose$() { | ||
var functions = arguments; | ||
return function() { | ||
var i, result; | ||
result = functions[0].apply(this, arguments); | ||
for (i = 1; i < functions.length; ++i) { | ||
result = functions[i](result); | ||
} | ||
return result; | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
var ditto, last, o, bnf, operators, tokens, name, alts, alt, token; | ||
@@ -22,9 +22,9 @@ ditto = {}; | ||
return Chain(L(1, Var($1))); | ||
}), o('Parenthetical', function(){ | ||
}), o('KeyLike', function(){ | ||
return Chain($1); | ||
}), o('List', ditto), o('STRNUM', function(){ | ||
}), o('List', ditto), o('LITERAL', function(){ | ||
return Chain(L(1, Literal($1))); | ||
}), o('LITERAL', ditto), o('Chain DOT Key', function(){ | ||
return $1.add(L(2, 3, Index($3, $2, true))); | ||
}), o('Chain DOT List', ditto), o('Chain CALL( ArgList OptComma )CALL', function(){ | ||
}), o('Chain Index', function(){ | ||
return $1.add($2); | ||
}), o('Chain CALL( ArgList OptComma )CALL', function(){ | ||
return $1.add(L(2, 5, Call($3))); | ||
@@ -162,11 +162,18 @@ }), o('Chain ?', function(){ | ||
return Chain(L(1, 2, Cascade($2, $3, 'with'))); | ||
}), o('FOR Expression Block', function(){ | ||
return Chain(L(1, 2, new For({ | ||
kind: $1, | ||
source: $2, | ||
body: $3, | ||
ref: true | ||
}).addBody($3))); | ||
}), o('LoopHead Block Else', function(){ | ||
return Chain($1.addBody($2).addElse($3)); | ||
}) | ||
], | ||
KeyLike: [ | ||
o('STRNUM', function(){ | ||
return Literal($1); | ||
}), o('Parenthetical') | ||
], | ||
Index: [ | ||
o('DOT ID', function(){ | ||
return Index(L(2, Key($2)), $1, true); | ||
}), o('DOT KeyLike', function(){ | ||
return Index($2, $1, true); | ||
}), o('DOT List', ditto) | ||
], | ||
List: [ | ||
@@ -183,10 +190,2 @@ o('[ ArgList OptComma ]', function(){ | ||
], | ||
Key: [o('KeyBase'), o('Parenthetical')], | ||
KeyBase: [ | ||
o('ID', function(){ | ||
return Key($1); | ||
}), o('STRNUM', function(){ | ||
return Literal($1); | ||
}) | ||
], | ||
ArgList: [ | ||
@@ -307,7 +306,11 @@ o('', function(){ | ||
}), o('PARAM( ArgList OptComma )PARAM -> Block', function(){ | ||
return Fun($2, $6, /~/.test($5), /--|~~/.test($5), /!/.test($5), /\*/.test($5)); | ||
return Fun($2, $6, /~/.test($5), /--|~~/.test($5), /!/.test($5), /\*/.test($5), />>/.test($5)); | ||
}), o('FUNCTION CALL( ArgList OptComma )CALL Block', function(){ | ||
return Fun($3, $6).named($1); | ||
}), o('GENERATOR CALL( ArgList OptComma )CALL Block', function(){ | ||
return Fun($3, $6, false, false, false, true).named($1); | ||
return Fun($3, $6, false, false, false, true, false).named($1); | ||
}), o('ASYNC FUNCTION CALL( ArgList OptComma )CALL Block', function(){ | ||
return Fun($4, $7, false, false, false, false, true).named($2); | ||
}), o('ASYNC GENERATOR CALL( ArgList OptComma )CALL Block', function(){ | ||
return Fun($4, $7, false, false, false, true, true).named($2); | ||
}), o('IF Expression Block Else', function(){ | ||
@@ -317,4 +320,2 @@ return L(1, 2, If($2, $3, $1 === 'unless')).addElse($4); | ||
return L(2, 3, If($3, $1, $2 === 'unless')); | ||
}), o('LoopHead Block Else', function(){ | ||
return $1.addBody($2).addElse($3); | ||
}), o('DO Block WHILE Expression', function(){ | ||
@@ -388,30 +389,18 @@ return new While($4, $3 === 'until', true).addBody($2); | ||
], | ||
KeyValue: [ | ||
o('Key'), o('LITERAL', function(){ | ||
return Prop(L(1, Key($1, $1 !== 'arguments' && $1 !== 'eval')), L(1, Literal($1))); | ||
}), o('Key DOT KeyBase', function(){ | ||
return Prop($3, Chain($1, [L(2, 3, Index($3, $2))])); | ||
}), o('LITERAL DOT KeyBase', function(){ | ||
return Prop($3, Chain(L(1, Literal($1)), [L(2, 3, Index($3, $2))])); | ||
}), o('{ Properties OptComma } LABEL', function(){ | ||
return Prop(L(5, Key($5)), L(1, 4, Obj($2).named($5))); | ||
}), o('[ ArgList OptComma ] LABEL', function(){ | ||
return Prop(L(5, Key($5)), L(1, 4, Arr($2).named($5))); | ||
KeyColon: [ | ||
o('ID :', function(){ | ||
return Key($1); | ||
}), o('KeyLike :', function(){ | ||
return $1; | ||
}) | ||
], | ||
Property: [ | ||
o('Key : Expression', function(){ | ||
return Prop($1, $3); | ||
}), o('Key : INDENT ArgList OptComma DEDENT', function(){ | ||
return Prop($1, Arr.maybe($4)); | ||
}), o('KeyValue'), o('KeyValue LOGIC Expression', function(){ | ||
return L(2, Binary($2, $1, $3)); | ||
}), o('KeyValue ASSIGN Expression', function(){ | ||
return L(2, Binary($2, $1, $3, true)); | ||
}), o('+- Key', function(){ | ||
return Prop($2.maybeKey(), L(1, Literal($1 === '+'))); | ||
}), o('+- LITERAL', function(){ | ||
return Prop(L(2, Key($2, true)), L(1, Literal($1 === '+'))); | ||
o('KeyColon Expression', function(){ | ||
return Prop($1, $2); | ||
}), o('KeyColon INDENT ArgList OptComma DEDENT', function(){ | ||
return Prop($1, Arr.maybe($3)); | ||
}), o('Expression', function(){ | ||
return Prop(null, $1); | ||
}), o('... Expression', function(){ | ||
return Splat($2); | ||
return Prop(Splat(), $2); | ||
}), o('COMMENT', function(){ | ||
@@ -418,0 +407,0 @@ return JS($1, true, true); |
@@ -1,3 +0,3 @@ | ||
// Generated by LiveScript 1.5.0 | ||
var lexer, parser, ast, SourceNode, path, toString$ = {}.toString; | ||
// Generated by LiveScript 1.6.0 | ||
var lexer, parser, ast, SourceNode, path, bufferFrom, toString$ = {}.toString; | ||
lexer = require('./lexer'); | ||
@@ -31,7 +31,14 @@ parser = require('./parser').parser; | ||
}; | ||
exports.VERSION = '1.5.0'; | ||
bufferFrom = Buffer.alloc && Buffer.from || function(it){ | ||
return new Buffer(it); | ||
}; | ||
exports.VERSION = '1.6.0'; | ||
exports.compile = function(code, options){ | ||
var result, ast, output, filename, outputFilename, ref$, mapPath, e, that; | ||
options == null && (options = {}); | ||
options.warn == null && (options.warn = true); | ||
options.header == null && (options.header = true); | ||
if (options.header === true) { | ||
options.header = "// Generated by LiveScript " + exports.VERSION + "\n"; | ||
} | ||
try { | ||
@@ -51,5 +58,2 @@ if (options.json) { | ||
output = ast.compileRoot(options); | ||
if (options.header) { | ||
output = new SourceNode(null, null, null, ["// Generated by LiveScript " + exports.VERSION + "\n", output]); | ||
} | ||
if (options.map && options.map !== 'none') { | ||
@@ -60,3 +64,3 @@ filename = options.filename, outputFilename = options.outputFilename; | ||
} | ||
output.setFile(filename); | ||
output.setFile(path.basename(filename)); | ||
result = output.toStringWithSourceMap(); | ||
@@ -67,6 +71,6 @@ if (options.map === 'embedded') { | ||
if ((ref$ = options.map) === 'linked' || ref$ === 'debug') { | ||
mapPath = outputFilename + ".map"; | ||
mapPath = path.basename(outputFilename) + ".map"; | ||
result.code += "\n//# sourceMappingURL=" + mapPath + "\n"; | ||
} else { | ||
result.code += "\n//# sourceMappingURL=data:application/json;base64," + new Buffer(result.map.toString()).toString('base64') + "\n"; | ||
result.code += "\n//# sourceMappingURL=data:application/json;base64," + bufferFrom(result.map.toString()).toString('base64') + "\n"; | ||
} | ||
@@ -73,0 +77,0 @@ return result; |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
var tint, ident, kwend, interps, regexes; | ||
@@ -15,3 +15,3 @@ tint = function(ext, shortcuts, fallthroughs){ | ||
kwend = '(?!(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])'; | ||
tint('ls', [['str', /^'(?:''[\S\s]*?''|[^\\']*(?:\\[\S\s][^\\']*)*)'/, '\''], ['lang-ls-qq', /(^"(?:""[\S\s]*?""|[^\\"]*(?:\\[\S\s][^\\"]*)*)")/, '"'], ['lang-ls-qr', /(^\/\/[\S\s]*?\/\/[gimy$?]{0,4})/, '/'], ['lang-ls-at', RegExp('(^@@?' + ident + '?)'), '@'], ['com', /^#.*/, '#'], ['typ', /^(?:0x[\da-f][\da-f_]*|(?:[2-9]|[12]\d|3[0-6])r[\da-z][\da-z_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?[\w$]*)/i, '0123456789'], ['lang-js', /^`([^\\`]*(?:\\[\S\s][^\\`]*)*)`/, '`']], [['str', /^\\\S[^\s,;)}\]]*/], ['com', /^\/\*[\S\s]*\*\//], ['pln', RegExp('^(?:\\.{3}|(?:\\.\\s*(?:(?:[-+*/%&|^:]|>>>?|<<)?=|[~!@])?\\s*|[)}\\]?]|::)(?:' + ident + '[?~!@]?)+|' + ident + '[^\\n\\S]*:(?![:=]))')], ['kwd', RegExp('^(?![$_-])(?:t(?:ry|h(?:row|en)|ypeof!?)|f(?:or(?:[^\\n\\S]+(?:own|ever))?|inally|unction)|n(?:ew|ot|o)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:[fs]|n(?:stanceof)?|mp(?:ort(?:[^\\n\\S]+all)?|lements))|e(?:lse|x(?:tends|port))|d(?:e(?:fault|lete|bugger)|o)|un(?:less|til)|w(?:hile|ith|hen)|s(?:witch|uper)|o[frn]|off|return|break|and|let|var|loop|yes|yield)' + kwend)], ['typ', RegExp('^(?:true|false|null|void)' + kwend)], ['ctx', RegExp('^(?:t(?:h(?:is|at)|o|il)|f(?:rom|allthrough)|e(?:val)?|it|arguments|by|constructor|prototype|superclass)' + kwend)], ['glb', RegExp('^(?:Array|Boolean|Date|Error|Function|JSON|Math|Number|Object|RegExp|S(?:tring|yntaxError)|TypeError|is(?:NaN|Finite)|parse(?:Int|Float)|(?:en|de)codeURI(?:Component)?)' + kwend)], ['var', RegExp('^' + ident)], ['str', /^<\[[\S\s]*?]>/], ['lang-ls-r', /^[^\/](\/(?![\s\/])[^[\/\n\\]*(?:(?:\\.|\[[^\]\n\\]*(?:\\.[^\]\n\\]*)*\])[^[\/\n\\]*)*\/[gimy$]{0,4})(?!\d)/]]); | ||
tint('ls', [['str', /^'(?:''[\S\s]*?''|[^\\']*(?:\\[\S\s][^\\']*)*)'/, '\''], ['lang-ls-qq', /(^"(?:""[\S\s]*?""|[^\\"]*(?:\\[\S\s][^\\"]*)*)")/, '"'], ['lang-ls-qr', /(^\/\/[\S\s]*?\/\/[gimy$?]{0,4})/, '/'], ['lang-ls-at', RegExp('(^@@?' + ident + '?)'), '@'], ['com', /^#.*/, '#'], ['typ', /^(?:0x[\da-f][\da-f_]*|(?:[2-9]|[12]\d|3[0-6])r[\da-z][\da-z_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?[\w$]*)/i, '0123456789'], ['lang-js', /^`([^\\`]*(?:\\[\S\s][^\\`]*)*)`/, '`']], [['str', /^\\\S[^\s,;)}\]]*/], ['com', /^\/\*[\S\s]*\*\//], ['pln', RegExp('^(?:\\.{3}|(?:\\.\\s*(?:(?:[-+*/%&|^:]|>>>?|<<)?=|[~!@])?\\s*|[)}\\]?]|::)(?:' + ident + '[?~!@]?)+|' + ident + '[^\\n\\S]*:(?![:=]))')], ['kwd', RegExp('^(?![$_-])(?:t(?:ry|h(?:row|en)|ypeof!?)|f(?:or(?:[^\\n\\S]+(?:own|ever))?|inally|unction)|n(?:ew|ot|o)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:[fs]|n(?:stanceof)?|mp(?:ort(?:[^\\n\\S]+all)?|lements))|e(?:lse|x(?:tends|port))|d(?:e(?:fault|lete|bugger)|o)|un(?:less|til)|w(?:hile|ith|hen)|s(?:witch|uper)|a(?:nd|wait)|o[frn]|off|return|break|let|var|loop|yes|yield)' + kwend)], ['typ', RegExp('^(?:true|false|null|void)' + kwend)], ['ctx', RegExp('^(?:t(?:h(?:is|at)|o|il)|f(?:rom|allthrough)|e(?:val)?|it|arguments|by|constructor|prototype|superclass|async)' + kwend)], ['glb', RegExp('^(?:Array|Boolean|Date|Error|Function|JSON|Math|Number|Object|RegExp|S(?:tring|yntaxError)|TypeError|is(?:NaN|Finite)|parse(?:Int|Float)|(?:en|de)codeURI(?:Component)?)' + kwend)], ['var', RegExp('^' + ident)], ['str', /^<\[[\S\s]*?]>/], ['lang-ls-r', /^[^\/](\/(?![\s\/])[^[\/\n\\]*(?:(?:\\.|\[[^\]\n\\]*(?:\\.[^\]\n\\]*)*\])[^[\/\n\\]*)*\/[gimy$]{0,4})(?!\d)/]]); | ||
interps = ['lang-ls', RegExp('^#({[\\S\\s]*?}|' + ident + ')'), '#']; | ||
@@ -18,0 +18,0 @@ regexes = ['lit', /^[\S\s]+?/]; |
124
lib/lexer.js
@@ -1,3 +0,3 @@ | ||
// Generated by LiveScript 1.5.0 | ||
var string, TABS, unlines, enlines, enslash, reslash, camelize, deheregex, character, KEYWORDS_SHARED, KEYWORDS_UNUSED, JS_KEYWORDS, LS_KEYWORDS, ID, SYMBOL, SPACE, MULTIDENT, SIMPLESTR, JSTOKEN, BSTOKEN, NUMBER, NUMBER_OMIT, REGEX, HEREGEX_OMIT, LASTDENT, INLINEDENT, NONASCII, OPENERS, CLOSERS, INVERSES, i, o, c, CHAIN, ARG, BLOCK_USERS, this$ = this, slice$ = [].slice; | ||
// Generated by LiveScript 1.6.0 | ||
var string, TABS, unlines, enlines, enslash, reslash, camelize, deheregex, character, KEYWORDS_SHARED, KEYWORDS_UNUSED, JS_KEYWORDS, LS_KEYWORDS, ID, SYMBOL, SPACE, MULTIDENT, SIMPLESTR, JSTOKEN, BSTOKEN, NUMBER, NUMBER_OMIT, REGEX, HEREGEX_OMIT, LASTDENT, INLINEDENT, NONASCII, OPENERS, CLOSERS, INVERSES, i, o, c, CHAIN, ARG, BLOCK_USERS, slice$ = [].slice, arrayFrom$ = Array.from || function(x){return slice$.call(x);}; | ||
exports.lex = function(code, options){ | ||
@@ -107,2 +107,6 @@ return clone$(exports).tokenize(code || '', options || {}); | ||
exports.identifiers = {}; | ||
exports.reset = function(){ | ||
this.dent = 0; | ||
this.identifiers = {}; | ||
}; | ||
exports.hasOwn = Object.prototype.hasOwnProperty; | ||
@@ -162,2 +166,3 @@ exports.checkConsistency = function(camel, id){ | ||
case 'yield': | ||
case 'await': | ||
tag = 'YIELD'; | ||
@@ -283,3 +288,2 @@ break; | ||
case 'when': | ||
this.fset('for', false); | ||
tag = 'CASE'; | ||
@@ -587,3 +591,3 @@ // fallthrough | ||
tag = last[0], val = last[1]; | ||
if (tag === 'ASSIGN' && ((ref$ = val + '') !== '=' && ref$ !== ':=' && ref$ !== '+=') || val === '++' && (ref$ = this.tokens)[ref$.length - 2].spaced || (tag === '+-' || tag === 'PIPE' || tag === 'BACKPIPE' || tag === 'COMPOSE' || tag === 'DOT' || tag === 'LOGIC' || tag === 'MATH' || tag === 'COMPARE' || tag === 'RELATION' || tag === 'SHIFT' || tag === 'IN' || tag === 'OF' || tag === 'TO' || tag === 'BY' || tag === 'FROM' || tag === 'EXTENDS' || tag === 'IMPLEMENTS')) { | ||
if (tag === 'ASSIGN' && ((ref$ = val + '') !== '=' && ref$ !== ':=' && ref$ !== '+=') || tag === 'CREMENT' && val === '++' && (ref$ = this.tokens)[ref$.length - 2].spaced || (tag === '+-' || tag === 'PIPE' || tag === 'BACKPIPE' || tag === 'COMPOSE' || tag === 'DOT' || tag === 'LOGIC' || tag === 'MATH' || tag === 'COMPARE' || tag === 'RELATION' || tag === 'SHIFT' || tag === 'IN' || tag === 'OF' || tag === 'TO' || tag === 'BY' || tag === 'FROM' || tag === 'EXTENDS' || tag === 'IMPLEMENTS')) { | ||
return length; | ||
@@ -611,3 +615,3 @@ } | ||
var ref$, ref1$; | ||
this.seenFor = false; | ||
this.fset('for', false); | ||
if (((ref$ = this.last[0]) === 'ASSIGN' || ref$ === '->' || ref$ === ':') || (this.last[0] === 'INDENT' && ((ref$ = (ref1$ = this.tokens)[ref1$.length - 2][0]) === 'ASSIGN' || ref$ === '->' || ref$ === ':'))) { | ||
@@ -928,3 +932,3 @@ this.token('SWITCH', 'switch'); | ||
default: | ||
if (/^!?(?:--?|~~?)>\*?$/.test(val)) { | ||
if (/^!?(?:--?|~~?)>>?\*?$/.test(val)) { | ||
this.parameters(tag = '->'); | ||
@@ -983,3 +987,5 @@ } else if (/^\*?<(?:--?|~~?)!?$/.test(val)) { | ||
var ref$; | ||
this.last[1] === '\n' || this.tokens.push(this.last = (ref$ = ['NEWLINE', '\n', this.line, this.column], ref$.spaced = true, ref$)); | ||
if (!(this.last[0] === 'NEWLINE' && this.last[1] === '\n')) { | ||
this.tokens.push(this.last = (ref$ = ['NEWLINE', '\n', this.line, this.column], ref$.spaced = true, ref$)); | ||
} | ||
}; | ||
@@ -1044,3 +1050,3 @@ exports.unline = function(){ | ||
c1 = str.charAt(i + 1); | ||
id = in$(c1, ['@']) && c1 || (ID.lastIndex = i + 1, ID).exec(str)[1]; | ||
id = c1 === '@' && c1 || (ID.lastIndex = i + 1, ID).exec(str)[1]; | ||
if (!(id || c1 === '{')) { | ||
@@ -1065,3 +1071,3 @@ continue; | ||
} | ||
if (in$(id, ['this'])) { | ||
if (id === 'this') { | ||
tag = 'LITERAL'; | ||
@@ -1172,2 +1178,3 @@ } else { | ||
this.unline(); | ||
this.fclear(); | ||
return this.closes.pop(); | ||
@@ -1219,2 +1226,5 @@ }; | ||
}; | ||
exports.fclear = function(){ | ||
this.flags.splice(this.closes.length); | ||
}; | ||
exports.carp = function(it){ | ||
@@ -1331,3 +1341,3 @@ carp(it, this.line); | ||
function firstPass(tokens){ | ||
var prev, i, token, tag, val, line, column, next, ts, parens, i$, j; | ||
var prev, i, token, tag, val, line, column, next, parens, i$, j, ts, ref$; | ||
prev = ['NEWLINE', '\n', 0]; | ||
@@ -1337,19 +1347,50 @@ i = 0; | ||
tag = token[0], val = token[1], line = token[2], column = token[3]; | ||
switch (false) { | ||
case !(tag === 'ASSIGN' && in$(prev[1], LS_KEYWORDS) && tokens[i - 2][0] !== 'DOT'): | ||
carp("cannot assign to reserved word '" + prev[1] + "'", line); | ||
switch (tag) { | ||
case 'ASSIGN': | ||
if (in$(prev[1], LS_KEYWORDS) && tokens[i - 2][0] !== 'DOT') { | ||
carp("cannot assign to reserved word '" + prev[1] + "'", line); | ||
} | ||
break; | ||
case !(tag === 'DOT' && prev[0] === ']' && tokens[i - 2][0] === '[' && tokens[i - 3][0] === 'DOT'): | ||
tokens.splice(i - 2, 3); | ||
tokens[i - 3][1] = '[]'; | ||
case 'DOT': | ||
switch (false) { | ||
case !(prev[0] === ']' && tokens[i - 2][0] === '[' && tokens[i - 3][0] === 'DOT'): | ||
tokens.splice(i - 2, 3); | ||
tokens[i - 3][1] = '[]'; | ||
i -= 3; | ||
break; | ||
case !(prev[0] === '}' && tokens[i - 2][0] === '{' && tokens[i - 3][0] === 'DOT'): | ||
tokens.splice(i - 2, 3); | ||
tokens[i - 3][1] = '{}'; | ||
i -= 3; | ||
break; | ||
case !(val === '.' && token.spaced && prev.spaced): | ||
tokens[i] = ['COMPOSE', '<<', line, column]; | ||
break; | ||
default: | ||
next = tokens[i + 1]; | ||
if (prev[0] === '(' && next[0] === ')') { | ||
tokens[i][0] = 'BIOP'; | ||
} else if (prev[0] === '(') { | ||
tokens.splice(i, 0, ['PARAM(', '(', line, column], [')PARAM', ')', line, column], ['->', '~>', line, column], ['ID', 'it', line, column]); | ||
} else if (next[0] === ')') { | ||
tokens.splice(i + 1, 0, ['[', '[', line, column], ['ID', 'it', line, column], [']', ']', line, column]); | ||
parens = 1; | ||
LOOP: for (i$ = i + 1; i$ >= 0; --i$) { | ||
j = i$; | ||
switch (tokens[j][0]) { | ||
case ')': | ||
++parens; | ||
break; | ||
case '(': | ||
if (--parens === 0) { | ||
tokens.splice(j + 1, 0, ['PARAM(', '(', line, column], ['ID', 'it', line, column], [')PARAM', ')', line, column], ['->', '~>', line, column]); | ||
break LOOP; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
break; | ||
case !(tag === 'DOT' && prev[0] === '}' && tokens[i - 2][0] === '{' && tokens[i - 3][0] === 'DOT'): | ||
tokens.splice(i - 2, 3); | ||
tokens[i - 3][1] = '{}'; | ||
break; | ||
case !(val === '.' && token.spaced && prev.spaced): | ||
tokens[i] = ['COMPOSE', '<<', line, column]; | ||
break; | ||
case val !== '++': | ||
if (!(next = tokens[i + 1])) { | ||
case 'CREMENT': | ||
if (!(val === '++' && (next = tokens[i + 1]))) { | ||
break; | ||
@@ -1365,24 +1406,9 @@ } | ||
break; | ||
case tag !== 'DOT': | ||
case 'ID': | ||
if (val !== 'async') { | ||
break; | ||
} | ||
next = tokens[i + 1]; | ||
if (prev[0] === '(' && next[0] === ')') { | ||
tokens[i][0] = 'BIOP'; | ||
} else if (prev[0] === '(') { | ||
tokens.splice(i, 0, ['PARAM(', '(', line, column], [')PARAM', ')', line, column], ['->', '~>', line, column], ['ID', 'it', line, column]); | ||
} else if (next[0] === ')') { | ||
tokens.splice(i + 1, 0, ['[', '[', line, column], ['ID', 'it', line, column], [']', ']', line, column]); | ||
parens = 1; | ||
LOOP: for (i$ = i + 1; i$ >= 0; --i$) { | ||
j = i$; | ||
switch (tokens[j][0]) { | ||
case ')': | ||
++parens; | ||
break; | ||
case '(': | ||
if (--parens === 0) { | ||
tokens.splice(j + 1, 0, ['PARAM(', '(', line, column], ['ID', 'it', line, column], [')PARAM', ')', line, column], ['->', '~>', line, column]); | ||
break LOOP; | ||
} | ||
} | ||
} | ||
if ((ref$ = next[0]) === 'FUNCTION' || ref$ === 'GENERATOR') { | ||
token[0] = 'ASYNC'; | ||
} | ||
@@ -1727,3 +1753,3 @@ } | ||
ts.pop() || carp('empty range', lno); | ||
tokens.splice.apply(tokens, [i, 2 + 2 * byp].concat(slice$.call(ts))); | ||
tokens.splice.apply(tokens, [i, 2 + 2 * byp].concat(arrayFrom$(ts))); | ||
i += ts.length - 1; | ||
@@ -1745,3 +1771,3 @@ } else { | ||
} | ||
tokens.splice.apply(tokens, [i, 1].concat(slice$.call(ts), [[']', ']', lno, cno]])); | ||
tokens.splice.apply(tokens, [i, 1].concat(arrayFrom$(ts), [[']', ']', lno, cno]])); | ||
i += ts.length; | ||
@@ -1831,3 +1857,3 @@ break; | ||
ID = /((?!\s)[a-z_$\xAA-\uFFDC](?:(?!\s)[\w$\xAA-\uFFDC]|-[a-z])*)([^\n\S]*:(?![:=]))?|/ig; | ||
SYMBOL = /[-\/^]=|[%+:*]{1,2}=|\|>=|\.(?:[&\|\^]|<<|>>>?)\.=?|\.{1,3}|\^\^|\*?<(?:--?|~~?)!?|!?(?:--?|~~?)>\*?|([-+&|:])\1|%%|&|\([^\n\S]*\)|[!=]==?|!?\~=|@@?|<\[(?:[\s\S]*?\]>)?|<<<<?|<\||[<>]==|<<=|>>=|<<|>>|[<>]\??=?|\|>|\||=>|\*\*|\^|`|[^\s#]?/g; | ||
SYMBOL = /[-\/^]=|[%+:*]{1,2}=|\|>=|\.(?:[&\|\^]|<<|>>>?)\.=?|\.{1,3}|\^\^|\*?<(?:--?|~~?)!?|!?(?:--?|~~?)>>?\*?|([-+&|:])\1|%%|&|\([^\n\S]*\)|[!=]==?|!?\~=|@@?|<\[(?:[\s\S]*?\]>)?|<<<<?|<\||[<>]==|<<=|>>=|<<|>>|[<>]\??=?|\|>|\||=>|\*\*|\^|`|[^\s#]?/g; | ||
SPACE = /[^\n\S]*(?:#.*)?/g; | ||
@@ -1834,0 +1860,0 @@ MULTIDENT = /(?:\s*#.*)*(?:\n([^\n\S]*))*/g; |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
define('ace/mode/ls', function(require, exports, module){ | ||
@@ -62,3 +62,3 @@ var identifier, LiveScriptMode, keywordend, stringfill; | ||
token: 'keyword', | ||
regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop|yield)' + keywordend | ||
regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments|sync|wait)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop|yield)' + keywordend | ||
}, { | ||
@@ -65,0 +65,0 @@ token: 'constant.language', |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
module.exports = function(LiveScript){ | ||
@@ -8,3 +8,3 @@ var fs, path, events; | ||
LiveScript.run = function(code, options, arg$){ | ||
var filename, ref$, js, context, main, dirname, e; | ||
var filename, ref$, js, context, main, dirname, that, e; | ||
if (options != null) { | ||
@@ -17,7 +17,5 @@ filename = options.filename; | ||
main = require.main; | ||
if (filename) { | ||
dirname = path.dirname(fs.realpathSync(filename = process.argv[1] = path.resolve(filename))); | ||
} else { | ||
dirname = filename = '.'; | ||
} | ||
dirname = filename | ||
? path.dirname(fs.realpathSync(filename = path.resolve(filename))) | ||
: filename = '.'; | ||
main.paths = main.constructor._nodeModulePaths(dirname); | ||
@@ -27,2 +25,5 @@ main.filename = filename; | ||
code = LiveScript.compile(code, (ref$ = {}, import$(ref$, options), ref$.bare = true, ref$)); | ||
if (that = code.code) { | ||
code = that; | ||
} | ||
} | ||
@@ -33,2 +34,3 @@ if (context) { | ||
} | ||
filename += '(js)'; | ||
try { | ||
@@ -35,0 +37,0 @@ return main._compile(code, filename); |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
var optionator; | ||
@@ -115,6 +115,11 @@ optionator = require('optionator'); | ||
type: 'String', | ||
description: "generate source maps - either: 'none', 'linked', 'linked-src', 'embedded', or 'debug'", | ||
'default': 'none' | ||
description: "generate source maps - either: 'none', 'linked', 'linked-src', 'embedded', or 'debug'" | ||
}, { | ||
option: 'warn', | ||
type: 'Boolean', | ||
description: 'suppress compiler warnings', | ||
'default': 'true' | ||
} | ||
] | ||
], | ||
mutuallyExclusive: [[['compile', 'output'], 'ast', 'tokens', 'lex']] | ||
}); |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
var path, stripString, nameFromPath; | ||
@@ -3,0 +3,0 @@ path = require('path'); |
{ | ||
"name": "livescript", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.", | ||
@@ -38,3 +38,2 @@ "keywords": [ | ||
"test": "make test", | ||
"test-harmony": "make test-harmony", | ||
"posttest": "git checkout -- lib" | ||
@@ -49,11 +48,12 @@ }, | ||
"prelude-ls": "~1.1.2", | ||
"optionator": "~0.8.1", | ||
"source-map": "^0.5.6" | ||
"optionator": "~0.8.2", | ||
"source-map": "=0.6.1", | ||
"source-map-support": "=0.5.6" | ||
}, | ||
"devDependencies": { | ||
"jison": "0.4.17", | ||
"uglify-js": "~2.6.2", | ||
"jison": "0.4.18", | ||
"uglify-js": "~2.6.4", | ||
"istanbul": "~0.4.3", | ||
"browserify": "^13.0.1" | ||
"browserify": "^13.3.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
381728
18
10151
4
14
+ Addedsource-map-support@=0.5.6
- Removedsource-map@0.5.7(transitive)
Updatedoptionator@~0.8.2
Updatedsource-map@=0.6.1