6to5
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -57,3 +57,6 @@ "use strict"; | ||
"class-call-check", | ||
"object-destructuring-empty" | ||
"object-destructuring-empty", | ||
"temporal-undefined", | ||
"temporal-assert-defined", | ||
"tail-call" | ||
]; | ||
@@ -301,3 +304,3 @@ | ||
if (!contains(File.helpers, name)) { | ||
throw new ReferenceError("unknown declaration " + name); | ||
throw new ReferenceError("Unknown helper " + name); | ||
} | ||
@@ -304,0 +307,0 @@ |
@@ -11,9 +11,13 @@ "use strict"; | ||
* @param {Object} opts | ||
* @param {Boolean} [inClass] | ||
*/ | ||
function ReplaceSupers(opts) { | ||
this.topLevelThisReference = null; | ||
function ReplaceSupers(opts, inClass) { | ||
this.topLevelThisReference = opts.topLevelThisReference; | ||
this.methodNode = opts.methodNode; | ||
this.className = opts.className; | ||
this.superName = opts.superName; | ||
this.isStatic = opts.isStatic; | ||
this.hasSuper = false; | ||
this.inClass = inClass; | ||
this.isLoose = opts.isLoose; | ||
@@ -32,8 +36,10 @@ this.scope = opts.scope; | ||
* @param {Node} property | ||
* @param {boolean} isStatic | ||
* @param {boolean} isComputed | ||
* @param {Node} value | ||
* @param {Boolean} isComputed | ||
* @param {Node} thisExpression | ||
* | ||
* @returns {Node} | ||
*/ | ||
ReplaceSupers.prototype.setSuperProperty = function (property, value, isStatic, isComputed, thisExpression) { | ||
ReplaceSupers.prototype.setSuperProperty = function (property, value, isComputed, thisExpression) { | ||
return t.callExpression( | ||
@@ -45,3 +51,3 @@ this.file.addHelper("set"), | ||
[ | ||
isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype")) | ||
this.isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype")) | ||
] | ||
@@ -64,4 +70,4 @@ ), | ||
* @param {Node} property | ||
* @param {boolean} isStatic | ||
* @param {boolean} isComputed | ||
* @param {Boolean} isComputed | ||
* @param {Node} thisExpression | ||
* | ||
@@ -71,3 +77,3 @@ * @returns {Node} | ||
ReplaceSupers.prototype.getSuperProperty = function (property, isStatic, isComputed, thisExpression) { | ||
ReplaceSupers.prototype.getSuperProperty = function (property, isComputed, thisExpression) { | ||
return t.callExpression( | ||
@@ -79,3 +85,3 @@ this.file.addHelper("get"), | ||
[ | ||
isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype")) | ||
this.isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype")) | ||
] | ||
@@ -162,3 +168,4 @@ ), | ||
ReplaceSupers.prototype.getLooseSuperProperty = function (methodNode, id, parent) { | ||
ReplaceSupers.prototype.getLooseSuperProperty = function (id, parent) { | ||
var methodNode = this.methodNode; | ||
var methodName = methodNode.key; | ||
@@ -205,3 +212,4 @@ var superName = this.superName || t.identifier("Function"); | ||
if (t.isIdentifier(node, { name: "super" })) { | ||
return this.getLooseSuperProperty(this.methodNode, node, parent); | ||
this.hasSuper = true; | ||
return this.getLooseSuperProperty(node, parent); | ||
} else if (t.isCallExpression(node)) { | ||
@@ -213,2 +221,3 @@ var callee = node.callee; | ||
// super.test(); -> ClassName.prototype.MethodName.call(this); | ||
this.hasSuper = true; | ||
t.appendToMemberExpression(callee, t.identifier("call")); | ||
@@ -249,3 +258,3 @@ node.arguments.unshift(getThisReference()); | ||
// - https://twitter.com/wycats/status/544553184396836864 | ||
if (methodNode.key.name !== "constructor") { | ||
if (methodNode.key.name !== "constructor" || !this.inClass) { | ||
var methodName = methodNode.key.name || "METHOD_NAME"; | ||
@@ -266,3 +275,4 @@ throw this.file.errorWithNode(node, "Direct super call is illegal in non-constructor, use super." + methodName + "() instead"); | ||
// super.name = "val"; -> _set(Object.getPrototypeOf(ClassName.prototype), "name", this); | ||
return this.setSuperProperty(node.left.property, node.right, methodNode.static, node.left.computed, getThisReference()); | ||
this.hasSuper = true; | ||
return this.setSuperProperty(node.left.property, node.right, node.left.computed, getThisReference()); | ||
} | ||
@@ -272,4 +282,6 @@ | ||
this.hasSuper = true; | ||
thisReference = getThisReference(); | ||
var superProperty = this.getSuperProperty(property, methodNode.static, computed, thisReference); | ||
var superProperty = this.getSuperProperty(property, computed, thisReference); | ||
if (args) { | ||
@@ -276,0 +288,0 @@ if (args.length === 1 && t.isSpreadElement(args[0])) { |
@@ -32,3 +32,3 @@ module.exports = TransformerPass; | ||
var whitelist = opts.whitelist; | ||
if (whitelist.length && !contains(whitelist, key)) return false; | ||
if (whitelist.length) return contains(whitelist, key); | ||
@@ -35,0 +35,0 @@ // optional |
@@ -15,19 +15,15 @@ "use strict"; | ||
var declaredLoc = declared.loc; | ||
var referenceLoc = node.loc; | ||
var assert = t.callExpression( | ||
state.file.addHelper("temporal-assert-defined"), | ||
[node, t.literal(node.name), state.file.addHelper("temporal-undefined")] | ||
); | ||
if (!declaredLoc || !referenceLoc) return; | ||
this.skip(); | ||
// does this reference appear on a line before the declaration? | ||
var before = referenceLoc.start.line < declaredLoc.start.line; | ||
if (referenceLoc.start.line === declaredLoc.start.line) { | ||
// this reference appears on the same line | ||
// check it appears before the declaration | ||
before = referenceLoc.start.col < declaredLoc.start.col; | ||
if (t.isAssignmentExpression(parent) || t.isUpdateExpression(parent)) { | ||
if (parent._ignoreBlockScopingTDZ) return; | ||
this.parentPath.replaceNode(t.sequenceExpression([assert, parent])); | ||
} else { | ||
return t.logicalExpression("&&", assert, node); | ||
} | ||
if (before) { | ||
throw state.file.errorWithNode(node, "Temporal dead zone - accessing a variable before it's initialized"); | ||
} | ||
} | ||
@@ -34,0 +30,0 @@ }; |
@@ -20,3 +20,3 @@ "use strict"; | ||
// https://github.com/6to5/6to5/issues/255 | ||
if (!t.isFor(parent) || t.isFor(parent) && parent.left !== node) { | ||
if (isLetInitable(node, parent)) { | ||
for (var i = 0; i < node.declarations.length; i++) { | ||
@@ -33,2 +33,6 @@ var declar = node.declarations[i]; | ||
var isLetInitable = function (node, parent) { | ||
return !t.isFor(parent) || t.isFor(parent) && parent.left !== node; | ||
}; | ||
var isVar = function (node, parent) { | ||
@@ -44,4 +48,22 @@ return t.isVariableDeclaration(node, { kind: "var" }) && !isLet(node, parent); | ||
exports.VariableDeclaration = function (node, parent) { | ||
isLet(node, parent); | ||
exports.VariableDeclaration = function (node, parent, scope, file) { | ||
if (!isLet(node, parent)) return; | ||
if (isLetInitable(node) && file.transformers["es6.blockScopingTDZ"].canRun()) { | ||
var nodes = [node]; | ||
for (var i = 0; i < node.declarations.length; i++) { | ||
var decl = node.declarations[i]; | ||
if (decl.init) { | ||
var assign = t.assignmentExpression("=", decl.id, decl.init); | ||
assign._ignoreBlockScopingTDZ = true; | ||
nodes.push(t.expressionStatement(assign)); | ||
} | ||
decl.init = file.addHelper("temporal-undefined"); | ||
} | ||
node._blockHoist = 2; | ||
return nodes; | ||
} | ||
}; | ||
@@ -48,0 +70,0 @@ |
@@ -155,6 +155,7 @@ "use strict"; | ||
superName: this.superName, | ||
isStatic: node.static, | ||
isLoose: this.isLoose, | ||
scope: this.scope, | ||
file: this.file | ||
}); | ||
}, true); | ||
replaceSupers.replace(); | ||
@@ -161,0 +162,0 @@ |
@@ -182,10 +182,29 @@ "use strict"; | ||
exports.ForOfStatement = function (node, parent, scope, file) { | ||
var declar = node.left; | ||
if (!t.isVariableDeclaration(declar)) return; | ||
var left = node.left; | ||
var pattern = declar.declarations[0].id; | ||
if (t.isPattern(left)) { | ||
// for ({ length: k } in { abc: 3 }); | ||
var temp = scope.generateUidIdentifier("ref"); | ||
node.left = t.variableDeclaration("var", [ | ||
t.variableDeclarator(temp) | ||
]); | ||
t.ensureBlock(node); | ||
node.body.body.unshift(t.variableDeclaration("var", [ | ||
t.variableDeclarator(left, temp) | ||
])); | ||
return; | ||
} | ||
if (!t.isVariableDeclaration(left)) return; | ||
var pattern = left.declarations[0].id; | ||
if (!t.isPattern(pattern)) return; | ||
var key = scope.generateUidIdentifier("ref"); | ||
node.left = t.variableDeclaration(declar.kind, [ | ||
node.left = t.variableDeclaration(left.kind, [ | ||
t.variableDeclarator(key, null) | ||
@@ -197,3 +216,3 @@ ]); | ||
var destructuring = new Destructuring({ | ||
kind: declar.kind, | ||
kind: left.kind, | ||
file: file, | ||
@@ -253,3 +272,3 @@ scope: scope, | ||
var destructuring = new Destructuring({ | ||
kind: "var", | ||
kind: "let", | ||
file: file, | ||
@@ -262,2 +281,4 @@ scope: scope, | ||
node.body.body = nodes.concat(node.body.body); | ||
return node; | ||
}; | ||
@@ -264,0 +285,0 @@ |
@@ -30,2 +30,3 @@ "use strict"; | ||
block.body = block.body.concat(node.body.body); | ||
block._declarations = node.body._declarations; | ||
@@ -32,0 +33,0 @@ // todo: find out why this is necessary? #538 |
@@ -12,3 +12,3 @@ "use strict"; | ||
for (var i = 0; i < node.params.length; i++) { | ||
if (t.isAssignmentPattern(node.params[i])) return true; | ||
if (!t.isIdentifier(node.params[i])) return true; | ||
} | ||
@@ -20,10 +20,12 @@ return false; | ||
enter: function (node, parent, scope, state) { | ||
if (t.isReferencedIdentifier(node, parent) && state.scope.hasOwnReference(node.name)) { | ||
state.iife = true; | ||
this.stop(); | ||
} | ||
if (!t.isReferencedIdentifier(node, parent)) return; | ||
if (!state.scope.hasOwnBinding(node.name)) return; | ||
if (state.scope.bindingEquals(node.name, node)) return; | ||
state.iife = true; | ||
this.stop(); | ||
} | ||
}; | ||
exports.Function = function (node, parent, scope) { | ||
exports.Function = function (node, parent, scope, file) { | ||
if (!hasDefaults(node)) return; | ||
@@ -42,2 +44,14 @@ | ||
var pushDefNode = function (left, right, i) { | ||
var defNode = util.template("default-parameter", { | ||
VARIABLE_NAME: left, | ||
DEFAULT_VALUE: right, | ||
ARGUMENT_KEY: t.literal(i), | ||
ARGUMENTS: argsIdentifier | ||
}, true); | ||
file.checkNode(defNode); | ||
defNode._blockHoist = node.params.length - i; | ||
body.push(defNode); | ||
}; | ||
for (var i = 0; i < node.params.length; i++) { | ||
@@ -47,3 +61,12 @@ var param = node.params[i]; | ||
if (!t.isAssignmentPattern(param)) { | ||
lastNonDefaultParam = +i + 1; | ||
lastNonDefaultParam = i + 1; | ||
if (!t.isIdentifier(param)) { | ||
scope.traverse(param, iifeVisitor, state); | ||
} | ||
if (file.transformers["es6.blockScopingTDZ"].canRun()) { | ||
pushDefNode(param, t.identifier("undefined"), i); | ||
} | ||
continue; | ||
@@ -65,10 +88,3 @@ } | ||
var defNode = util.template("default-parameter", { | ||
VARIABLE_NAME: left, | ||
DEFAULT_VALUE: right, | ||
ARGUMENT_KEY: t.literal(+i), | ||
ARGUMENTS: argsIdentifier | ||
}, true); | ||
defNode._blockHoist = node.params.length - i; | ||
body.push(defNode); | ||
pushDefNode(left, right, i); | ||
} | ||
@@ -75,0 +91,0 @@ |
@@ -76,4 +76,4 @@ "use strict"; | ||
} | ||
var first = nodes.shift(); | ||
if (nodes.length) { | ||
@@ -80,0 +80,0 @@ node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes)); |
@@ -31,2 +31,3 @@ module.exports = { | ||
"es6.objectSuper": require("./es6/object-super"), | ||
"es7.objectRestSpread": require("./es7/object-rest-spread"), | ||
@@ -50,2 +51,10 @@ "es7.exponentiationOperator": require("./es7/exponentiation-operator"), | ||
// needs to be before `es6.blockScoping` as default parameters have a TDZ | ||
"es6.parameters.default": require("./es6/parameters.default"), | ||
"es6.parameters.rest": require("./es6/parameters.rest"), | ||
// needs to be before `es6.blockScoping` as let variables may be produced | ||
"es6.destructuring": require("./es6/destructuring"), | ||
// needs to be before `_aliasFunction` due to block scopes sometimes being wrapped in a | ||
@@ -58,7 +67,4 @@ // closure | ||
"es6.parameters.default": require("./es6/parameters.default"), | ||
"es6.parameters.rest": require("./es6/parameters.rest"), | ||
"es6.tailCall": require("./es6/tail-call"), | ||
"es6.destructuring": require("./es6/destructuring"), | ||
regenerator: require("./other/regenerator"), | ||
@@ -65,0 +71,0 @@ |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.BlockStatement = function (node, parent) { | ||
exports.BlockStatement = function (node, parent, scope, file) { | ||
if ((t.isFunction(parent) && parent.body === node) || t.isExportDeclaration(parent)) { | ||
@@ -26,3 +26,5 @@ return; | ||
node.body[i] = declar; | ||
file.checkNode(declar); | ||
} | ||
}; |
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.check = t.isFor; | ||
exports.ForInStatement = | ||
@@ -7,0 +9,0 @@ exports.ForOfStatement = function (node, parent, scope, file) { |
"use strict"; | ||
exports.check = function (node) { | ||
return node.kind === "set"; | ||
}; | ||
exports.MethodDefinition = | ||
@@ -4,0 +8,0 @@ exports.Property = function (node, parent, scope, file) { |
@@ -11,4 +11,5 @@ "use strict"; | ||
function TraversalContext(scope, opts, state) { | ||
function TraversalContext(scope, opts, state, parentPath) { | ||
this.shouldFlatten = false; | ||
this.parentPath = parentPath; | ||
@@ -18,4 +19,2 @@ this.scope = scope; | ||
this.opts = opts; | ||
this.reset(); | ||
} | ||
@@ -27,24 +26,3 @@ | ||
TraversalContext.prototype.remove = function () { | ||
this.shouldRemove = true; | ||
this.shouldSkip = true; | ||
}; | ||
TraversalContext.prototype.skip = function () { | ||
this.shouldSkip = true; | ||
}; | ||
TraversalContext.prototype.stop = function () { | ||
this.shouldStop = true; | ||
this.shouldSkip = true; | ||
}; | ||
TraversalContext.prototype.reset = function () { | ||
this.shouldRemove = false; | ||
this.shouldSkip = false; | ||
this.shouldStop = false; | ||
}; | ||
TraversalContext.prototype.visitNode = function (node, obj, key) { | ||
this.reset(); | ||
var iteration = new TraversalPath(this, node, obj, key); | ||
@@ -51,0 +29,0 @@ return iteration.visit(); |
@@ -32,7 +32,7 @@ "use strict"; | ||
traverse.node = function (node, opts, scope, state) { | ||
traverse.node = function (node, opts, scope, state, parentPath) { | ||
var keys = t.VISITOR_KEYS[node.type]; | ||
if (!keys) return; | ||
var context = new TraversalContext(scope, opts, state); | ||
var context = new TraversalContext(scope, opts, state, parentPath); | ||
for (var i = 0; i < keys.length; i++) { | ||
@@ -39,0 +39,0 @@ if (context.visit(node, keys[i])) { |
@@ -17,5 +17,6 @@ "use strict"; | ||
this.context = context; | ||
this.state = this.context.state; | ||
this.opts = this.context.opts; | ||
this.parentPath = context.parentPath; | ||
this.context = context; | ||
this.state = this.context.state; | ||
this.opts = this.context.opts; | ||
@@ -25,5 +26,5 @@ this.key = key; | ||
this.parent = parent; | ||
this.scope = TraversalPath.getScope(this.getNode(), parent, context.scope); | ||
this.state = context.state; | ||
this.parent = parent; | ||
this.scope = TraversalPath.getScope(this.getNode(), parent, context.scope); | ||
this.state = context.state; | ||
} | ||
@@ -75,3 +76,3 @@ | ||
TraversalPath.prototype.replaceNode = function (replacement, scope) { | ||
TraversalPath.prototype.replaceNode = function (replacement) { | ||
var isArray = Array.isArray(replacement); | ||
@@ -91,6 +92,6 @@ | ||
for (var i = 0; i < replacement.length; i++) { | ||
file.checkNode(replacement[i], scope); | ||
file.checkNode(replacement[i], this.scope); | ||
} | ||
} else { | ||
file.checkNode(replacement, scope); | ||
file.checkNode(replacement, this.scope); | ||
} | ||
@@ -151,6 +152,6 @@ } | ||
for (var i = 0; i < node.length; i++) { | ||
traverse.node(node[i], opts, this.scope, this.state); | ||
traverse.node(node[i], opts, this.scope, this.state, this); | ||
} | ||
} else { | ||
traverse.node(node, opts, this.scope, this.state); | ||
traverse.node(node, opts, this.scope, this.state, this); | ||
this.call("exit"); | ||
@@ -157,0 +158,0 @@ } |
@@ -323,2 +323,3 @@ "use strict"; | ||
} | ||
this.traverse(block.body, blockVariableVisitor, this); | ||
} | ||
@@ -328,3 +329,3 @@ | ||
if (t.isBlockStatement(block) || t.isProgram(block) || t.isFunction(block)) { | ||
if (t.isBlockStatement(block) || t.isProgram(block)) { | ||
this.traverse(block, blockVariableVisitor, this); | ||
@@ -331,0 +332,0 @@ } |
@@ -343,4 +343,4 @@ "use strict"; | ||
t.isReferencedIdentifier = function (node, parent) { | ||
return t.isIdentifier(node) && t.isReferenced(node, parent); | ||
t.isReferencedIdentifier = function (node, parent, opts) { | ||
return t.isIdentifier(node, opts) && t.isReferenced(node, parent); | ||
}; | ||
@@ -399,3 +399,3 @@ | ||
key = key || "body"; | ||
node[key] = t.toBlock(node[key], node); | ||
return node[key] = t.toBlock(node[key], node); | ||
}; | ||
@@ -402,0 +402,0 @@ |
{ | ||
"name": "6to5", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -36,3 +36,3 @@ "homepage": "https://6to5.org/", | ||
"dependencies": { | ||
"acorn-6to5": "0.11.1-25", | ||
"acorn-6to5": "0.11.1-27", | ||
"ast-types": "~0.6.1", | ||
@@ -39,0 +39,0 @@ "chalk": "^0.5.1", |
@@ -1,1 +0,1 @@ | ||
(function(global){var to5Runtime=global.to5Runtime={};to5Runtime.inherits=function(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)subClass.__proto__=superClass};to5Runtime.defaults=function(obj,defaults){for(var key in defaults){if(obj[key]===undefined){obj[key]=defaults[key]}}return obj};to5Runtime.prototypeProperties=function(child,staticProps,instanceProps){if(staticProps)Object.defineProperties(child,staticProps);if(instanceProps)Object.defineProperties(child.prototype,instanceProps)};to5Runtime.applyConstructor=function(Constructor,args){var instance=Object.create(Constructor.prototype);var result=Constructor.apply(instance,args);return result!=null&&(typeof result=="object"||typeof result=="function")?result:instance};to5Runtime.taggedTemplateLiteral=function(strings,raw){return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))};to5Runtime.taggedTemplateLiteralLoose=function(strings,raw){strings.raw=raw;return strings};to5Runtime.interopRequire=function(obj){return obj&&obj.__esModule?obj.default:obj};to5Runtime.toArray=function(arr){return Array.isArray(arr)?arr:Array.from(arr)};to5Runtime.slicedToArray=function(arr,i){if(Array.isArray(arr)){return arr}else{var _arr=[];for(var _iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done;){_arr.push(_step.value);if(i&&_arr.length===i)break}return _arr}};to5Runtime.objectWithoutProperties=function(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target};to5Runtime.hasOwn=Object.prototype.hasOwnProperty;to5Runtime.slice=Array.prototype.slice;to5Runtime.bind=Function.prototype.bind;to5Runtime.defineProperty=function(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})};to5Runtime.asyncToGenerator=function(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){var callNext=step.bind(null,"next");var callThrow=step.bind(null,"throw");function step(key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(callNext,callThrow)}}callNext()})}};to5Runtime.interopRequireWildcard=function(obj){return obj&&obj.__esModule?obj:{"default":obj}};to5Runtime._typeof=function(obj){return obj&&obj.constructor===Symbol?"symbol":typeof obj};to5Runtime._extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};to5Runtime.get=function get(object,property,receiver){var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined}else{return get(parent,property,receiver)}}else if("value"in desc&&desc.writable){return desc.value}else{var getter=desc.get;if(getter===undefined){return undefined}return getter.call(receiver)}};to5Runtime.set=function set(object,property,value,receiver){var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return}else{return set(parent,property,value,receiver)}}else if("value"in desc&&desc.writable){desc.value=value;return}else{var setter=desc.set;if(setter===undefined){return}return setter.call(receiver,value)}};to5Runtime.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}};to5Runtime.objectDestructuringEmpty=function(obj){if(obj==null)throw new TypeError("Cannot destructure undefined")}})(typeof global==="undefined"?self:global); | ||
(function(global){var to5Runtime=global.to5Runtime={};to5Runtime.inherits=function(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)subClass.__proto__=superClass};to5Runtime.defaults=function(obj,defaults){for(var key in defaults){if(obj[key]===undefined){obj[key]=defaults[key]}}return obj};to5Runtime.prototypeProperties=function(child,staticProps,instanceProps){if(staticProps)Object.defineProperties(child,staticProps);if(instanceProps)Object.defineProperties(child.prototype,instanceProps)};to5Runtime.applyConstructor=function(Constructor,args){var instance=Object.create(Constructor.prototype);var result=Constructor.apply(instance,args);return result!=null&&(typeof result=="object"||typeof result=="function")?result:instance};to5Runtime.taggedTemplateLiteral=function(strings,raw){return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))};to5Runtime.taggedTemplateLiteralLoose=function(strings,raw){strings.raw=raw;return strings};to5Runtime.interopRequire=function(obj){return obj&&obj.__esModule?obj.default:obj};to5Runtime.toArray=function(arr){return Array.isArray(arr)?arr:Array.from(arr)};to5Runtime.slicedToArray=function(arr,i){if(Array.isArray(arr)){return arr}else{var _arr=[];for(var _iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done;){_arr.push(_step.value);if(i&&_arr.length===i)break}return _arr}};to5Runtime.objectWithoutProperties=function(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target};to5Runtime.hasOwn=Object.prototype.hasOwnProperty;to5Runtime.slice=Array.prototype.slice;to5Runtime.bind=Function.prototype.bind;to5Runtime.defineProperty=function(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})};to5Runtime.asyncToGenerator=function(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){var callNext=step.bind(null,"next");var callThrow=step.bind(null,"throw");function step(key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(callNext,callThrow)}}callNext()})}};to5Runtime.interopRequireWildcard=function(obj){return obj&&obj.__esModule?obj:{"default":obj}};to5Runtime._typeof=function(obj){return obj&&obj.constructor===Symbol?"symbol":typeof obj};to5Runtime._extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};to5Runtime.get=function get(object,property,receiver){var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined}else{return get(parent,property,receiver)}}else if("value"in desc&&desc.writable){return desc.value}else{var getter=desc.get;if(getter===undefined){return undefined}return getter.call(receiver)}};to5Runtime.set=function set(object,property,value,receiver){var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return}else{return set(parent,property,value,receiver)}}else if("value"in desc&&desc.writable){desc.value=value;return}else{var setter=desc.set;if(setter===undefined){return}return setter.call(receiver,value)}};to5Runtime.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}};to5Runtime.objectDestructuringEmpty=function(obj){if(obj==null)throw new TypeError("Cannot destructure undefined")};to5Runtime.temporalUndefined={};to5Runtime.temporalAssertDefined=function(val,name,undef){if(val===undef){throw new ReferenceError(name+" is not defined - temporal dead zone")}return true};to5Runtime.tailCall=function(){function Tail(func,args,context){this.func=func;this.args=args;this.context=context}var isRunning=false;return function(func,args,context){var result=new Tail(func,args,context);if(!isRunning){isRunning=true;do{result=result.func.apply(result.context,result.args)}while(result instanceof Tail);isRunning=false}return result}}()})(typeof global==="undefined"?self:global); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1474995
155
12585
+ Addedacorn-6to5@0.11.1-27(transitive)
- Removedacorn-6to5@0.11.1-25(transitive)
Updatedacorn-6to5@0.11.1-27