Socket
Socket
Sign inDemoInstall

6to5

Package Overview
Dependencies
23
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.12.6 to 2.13.0

lib/6to5/to-fast-properties.js

2

bin/6to5/file.js

@@ -31,3 +31,3 @@ var sourceMap = require("source-map");

consumer.eachMapping(function (mapping) {
map._mappings.push({
map._mappings.add({
generatedLine: mapping.generatedLine + offset,

@@ -34,0 +34,0 @@ generatedColumn: mapping.generatedColumn,

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

(function t(t,n,e){function r(i,c){if(!n[i]){if(!t[i]){var f=typeof require=="function"&&require;if(!c&&f)return f(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var o=n[i]={exports:{}};t[i][0].call(o.exports,function(n){var e=t[i][1][n];return r(e?e:n)},o,o.exports,t,t,n,e)}return n[i].exports}var u=typeof require=="function"&&require;for(var i=0;i<e.length;i++)r(e[i]);return r})({1:[function(t,n,e){t("core-js/shim");t("regenerator/runtime")},{"core-js/shim":2,"regenerator/runtime":3}],2:[function(n,t,e){(function(n){!function(n,A,r){"use strict";var R="Object",Ce="Function",C="Array",fn="String",ye="Number",H="RegExp",Pe="Date",Bn="Map",Fn="Set",ue="WeakMap",be="WeakSet",O="Symbol",En="Promise",jn="Math",Je="Arguments",u="prototype",$n="constructor",J="toString",Hn=J+"Tag",He="toLocaleString",We="hasOwnProperty",te="forEach",q="iterator",xn="@@"+q,ee="process",oe="createElement",le=n[Ce],i=n[R],S=n[C],p=n[fn],Ne=n[ye],W=n[H],Ze=n[Pe],Wn=n[Bn],ge=n[Fn],qn=n[ue],de=n[be],v=n[O],c=n[jn],wn=n.TypeError,Ee=n.setTimeout,mn=n.setImmediate,Dn=n.clearImmediate,Gn=n[ee],Un=Gn&&Gn.nextTick,B=n.document,me=B&&B.documentElement,er=n.navigator,Nn=n.define,a=S[u],k=i[u],en=le[u],rn=1/0,K=".";function l(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function h(t){return typeof t=="function"}var G=f(/./.test,/\[native code\]\s*\}\s*$/,1);var Se={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},ke=k[J];function I(t,n,e){if(t&&!s(t=e?t:t[u],Y))o(t,Y,n)}function V(t){return t==r?t===r?"Undefined":"Null":ke.call(t).slice(8,-1)}function Pn(n){var e=V(n),t;return e==R&&(t=n[Y])?s(Se,t)?"~"+t:t:e}var Z=en.call,ce=en.apply,vn;function An(){var t=arguments.length,e=S(t),n=0,r=ze._,i=false;while(t>n)if((e[n]=arguments[n++])===r)i=true;return Ie(this,e,t,i,r,false)}function Ie(t,n,r,e,i,u,o){un(t);return function(){var s=u?o:this,l=arguments.length,a=0,c=0,f;if(!e&&!l)return ln(t,n,s);f=n.slice();if(e)for(;r>a;a++)if(f[a]===i)f[a]=arguments[c++];while(l>c)f.push(arguments[c++]);return ln(t,f,s)}}function f(t,n,e){un(t);if(~e&&n===r)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,i){return t.call(n,e,r,i)}}return function(){return t.apply(n,arguments)}}function ln(n,t,e){var i=e===r;switch(t.length|0){case 0:return i?n():n.call(e);case 1:return i?n(t[0]):n.call(e,t[0]);case 2:return i?n(t[0],t[1]):n.call(e,t[0],t[1]);case 3:return i?n(t[0],t[1],t[2]):n.call(e,t[0],t[1],t[2]);case 4:return i?n(t[0],t[1],t[2],t[3]):n.call(e,t[0],t[1],t[2],t[3]);case 5:return i?n(t[0],t[1],t[2],t[3],t[4]):n.call(e,t[0],t[1],t[2],t[3],t[4])}return n.apply(e,t)}function Fe(t,r){var n=yn(t[u]),e=ce.call(t,n,r);return l(e)?e:n}var yn=i.create,an=i.getPrototypeOf,sn=i.setPrototypeOf,w=i.defineProperty,Be=i.defineProperties,$=i.getOwnPropertyDescriptor,Sn=i.keys,_n=i.getOwnPropertyNames,Jn=i.getOwnPropertySymbols,s=f(Z,k[We],2),In=i;function F(t){return In(y(t))}function Ae(t){return t}function cn(){return this}function On(t,n){if(s(t,n))return t[n]}function ie(t){return Jn?_n(t).concat(Jn(t)):_n(t)}var Ye=i.assign||function(f,s){var t=i(y(f)),a=arguments.length,n=1;while(a>n){var e=In(arguments[n++]),r=Sn(e),c=r.length,u=0,o;while(c>u)t[o=r[u++]]=e[o]}return t};function Me(i,u){var t=F(i),n=Sn(t),o=n.length,e=0,r;while(o>e)if(t[r=n[e++]]===u)return r}function Tn(t){return p(t).split(",")}var Ge=a.push,tr=a.unshift,nr=a.slice,Qe=a.splice,Xe=a.indexOf,nn=a[te];function we(t){var e=t==1,o=t==2,a=t==3,n=t==4,u=t==6,c=t==5||u;return function(m){var g=i(y(this)),w=arguments[1],h=In(g),x=f(m,w,3),d=L(h.length),s=0,v=e?S(d):o?[]:r,l,p;for(;d>s;s++)if(c||s in h){l=h[s];p=x(l,s,g);if(t){if(e)v[s]=p;else if(p)switch(t){case 3:return true;case 5:return l;case 6:return s;case 2:v.push(l)}else if(n)return false}}return u?-1:a||n?n:v}}function Ke(t){return function(r){var e=F(this),i=L(e.length),n=M(arguments[1],i);if(t&&r!=r){for(;i>n;n++)if(Zn(e[n]))return t||n}else for(;i>n;n++)if(t||n in e){if(e[n]===r)return t||n}return!t&&-1}}function Yn(t,n){return typeof t=="function"?t:n}var Ln=9007199254740991,Ue=c.ceil,Xn=c.floor,$e=c.max,X=c.min,Te=c.random,Vn=c.trunc||function(t){return(t>0?Xn:Ue)(t)};function Zn(t){return t!=t}function bn(t){return isNaN(t)?0:Vn(t)}function L(t){return t>0?X(bn(t),Ln):0}function M(t,n){var t=bn(t);return t<0?$e(t+n,0):X(t,n)}function re(n,t,e){var r=l(t)?function(n){return t[n]}:t;return function(t){return p(e?t:this).replace(n,r)}}function Mn(t){return function(f){var e=p(y(this)),n=bn(f),o=e.length,i,u;if(n<0||n>=o)return t?"":r;i=e.charCodeAt(n);return i<55296||i>56319||n+1===o||(u=e.charCodeAt(n+1))<56320||u>57343?t?e.charAt(n):i:t?e.slice(n,n+2):(i-55296<<10)+(u-56320)+65536}}var Ve="Reduce of empty object with no initial value";function on(e,t,n){if(!e)throw wn(n?t+n:t)}function y(t){if(t==r)throw wn("Function called on null or undefined");return t}function un(t){on(h(t),t," is not a function!");return t}function b(t){on(l(t),t," is not an object!");return t}function hn(t,n,e){on(t instanceof n,e,": use the 'new' operator!")}function tn(t,n){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:n}}function se(t,n,e){t[n]=e;return t}function je(t){return pn?function(n,e,r){return w(n,e,tn(t,r))}:se}function he(t){return O+"("+t+")_"+(++Oe+Te())[J](36)}function P(t,n){return v&&v[t]||(n?v:x)(O+K+t)}var pn=!!function(){try{return w({},K,k)}catch(t){}}(),Oe=0,o=je(1),m=v?se:o,x=v||he;function gn(t,n){for(var e in n)o(t,e,n[e]);return t}var dn=P("unscopables"),xe=a[dn]||{};var D=P(q),Y=P(Hn),Le=xn in a,N=x("iter"),Q=1,j=2,z={},pe={},_e=D in a,ve="keys"in a&&!("next"in[].keys());zn(pe,cn);function zn(t,n){o(t,D,n);Le&&o(t,xn,n)}function ae(t,n,e,r){t[u]=yn(r||pe,{next:tn(1,e)});I(t,n+" Iterator")}function fe(r,e,i,o){var t=r[u],n=On(t,D)||On(t,xn)||o&&On(t,o)||i;if(A){zn(t,n);if(n!==i){var f=an(n.call(new r));I(f,e+" Iterator",true);s(t,xn)&&zn(f,cn)}}z[e]=n;z[e+" Iterator"]=cn;return n}function Rn(u,t,o,a,f,c){function r(t){return function(){return new o(this,t)}}ae(o,t,a);var i=r(Q+j),n=r(j);if(f==j)n=fe(u,t,n,"values");else i=fe(u,t,i,"entries");if(f){e(T+U*ve,t,{entries:i,keys:c?n:r(Q),values:n})}}function d(t,n){return{value:n,done:!!t}}function Re(r){var t=i(r),e=n[O],u=!!(e&&e[q]&&e[q]in t);return u||D in t||s(z,Pn(t))}function ne(t){var e=n[O],r=e&&e[q]&&t[e[q]],i=r||t[D]||z[Pn(t)];return b(i.call(t))}function De(t,n,e){return e?ln(t,n):t(n)}function kn(e,t,r,i){var u=ne(e),o=f(r,i,t?2:1),n;while(!(n=u.next()).done)if(De(o,n.value,t)===false)return}var Qn=V(Gn)==ee,E={},ze=A?n:E,qe=n.core,U=1,_=2,g=4,T=8,Kn=16,Cn=32;function e(i,a,v){var e,s,t,c,l=i&_,r=l?n:i&g?n[a]:(n[a]||k)[u],p=l?E:E[a]||(E[a]={});if(l)v=a;for(e in v){s=!(i&U)&&r&&e in r&&(!h(r[e])||G(r[e]));t=(s?r:v)[e];if(i&Kn&&s)c=f(t,n);else if(i&Cn&&!A&&r[e]==t){c=function(n){return this instanceof t?new t(n):t(n)};c[u]=t[u]}else c=i&T&&h(t)?f(Z,t):t;if(p[e]!=t)o(p,e,c);if(A&&r&&!s){if(l)r[e]=t;else delete r[e]&&o(r,e,t)}}}if(typeof t!="undefined"&&t.exports)t.exports=E;if(h(Nn)&&Nn.amd)Nn(function(){return E});if(!Qn||A){E.noConflict=function(){n.core=qe;return E};n.core=E}e(_+U,{global:n});!function(r,t,n){if(!G(v)){v=function(e){on(!(this instanceof v),O+" is not a "+$n);var t=he(e);pn&&n&&w(k,t,{configurable:true,set:function(n){o(this,t,n)}});return m(yn(v[u]),r,t)};o(v[u],J,function(){return this[r]})}e(_+Cn,{Symbol:v});var i={"for":function(n){return s(t,n+="")?t[n]:t[n]=v(n)},iterator:D,keyFor:An.call(Me,t),toStringTag:Y=P(Hn,true),unscopables:dn,pure:x,set:m,useSetter:function(){n=true},useSimple:function(){n=false}};nn.call(Tn("hasInstance,isConcatSpreadable,match,replace,search,"+"species,split,toPrimitive"),function(t){i[t]=P(t)});e(g,O,i);I(v,O);e(_,{Reflect:{ownKeys:ie}})}(x("tag"),{},true);!function(_,P,ln,v){var un=n.RangeError,gn=Ne.isInteger||function(t){return!l(t)&&P(t)&&Xn(t)===t},q=c.sign||function xn(t){return(t=+t)==0||t!=t?t:t<0?-1:1},an=c.pow,cn=c.abs,h=c.exp,x=c.log,D=c.sqrt,yn=p.fromCharCode,mn=Mn(true);var hn={assign:Ye,is:function(t,n){return t===n?t!==0||1/t===1/n:t!=t&&n!=n}};"__proto__"in k&&function(n,t){try{t=f(Z,$(k,"__proto__").set,2);t({},a)}catch(e){n=true}hn.setPrototypeOf=sn=sn||function(r,e){b(r);on(e===null||l(e),e,": can't set as prototype!");if(n)r.__proto__=e;else t(r,e);return r}}();e(g,R,hn);function vn(t){return!P(t=+t)||t==0?t:t<0?-vn(-t):x(t+D(t*t+1))}e(g,ye,{EPSILON:an(2,-52),isFinite:function(t){return typeof t=="number"&&P(t)},isInteger:gn,isNaN:Zn,isSafeInteger:function(t){return gn(t)&&cn(t)<=Ln},MAX_SAFE_INTEGER:Ln,MIN_SAFE_INTEGER:-Ln,parseFloat:parseFloat,parseInt:parseInt});e(g,jn,{acosh:function(t){return t<1?NaN:x(t+D(t*t-1))},asinh:vn,atanh:function(t){return t==0?+t:x((1+ +t)/(1-t))/2},cbrt:function(t){return q(t)*an(cn(t),1/3)},clz32:function(t){return(t>>>=0)?32-t[J](2).length:32},cosh:function(t){return(h(t)+h(-t))/2},expm1:function(t){return t==0?+t:t>-1e-6&&t<1e-6?+t+t*t/2:h(t)-1},fround:function(t){return new Float32Array([t])[0]},hypot:function(r,i){var n=0,e=arguments.length,t;while(e--){t=+arguments[e];if(t==rn||t==-rn)return rn;n+=t*t}return D(n)},imul:function(u,o){var t=65535,n=+u,e=+o,r=t&n,i=t&e;return 0|r*i+((t&n>>>16)*i+r*(t&e>>>16)<<16>>>0)},log1p:function(t){return t>-1e-8&&t<1e-8?t-t*t/2:x(1+ +t)},log10:function(t){return x(t)/c.LN10},log2:function(t){return x(t)/c.LN2},sign:q,sinh:function(t){return t==0?+t:(h(t)-h(-t))/2},tanh:function(t){return P(t)?t==0?+t:(h(t)-h(-t))/(h(t)+h(-t)):q(t)},trunc:Vn});I(c,jn,true);function B(t){if(V(t)==H)throw wn()}e(g,fn,{fromCodePoint:function(i){var n=[],r=arguments.length,e=0,t;while(r>e){t=+arguments[e++];if(M(t,1114111)!==t)throw un(t+" is not a valid code point");n.push(t<65536?yn(t):yn(((t-=65536)>>10)+55296,t%1024+56320))}return n.join("")},raw:function(r){var e=F(r.raw),i=L(e.length),u=arguments.length,n=[],t=0;while(i>t){n.push(p(e[t++]));if(t<u)n.push(p(arguments[t]))}return n.join("")}});e(T,fn,{codePointAt:Mn(false),endsWith:function(t){B(t);var n=p(y(this)),e=arguments[1],i=L(n.length),u=e===r?i:X(L(e),i);t+="";return n.slice(u-t.length,u)===t},includes:function(t){B(t);return!!~p(y(this)).indexOf(t,arguments[1])},repeat:function(r){var n=p(y(this)),e="",t=bn(r);if(0>t||t==rn)throw un("Count can't be negative");for(;t>0;(t>>>=1)&&(n+=n))if(t&1)e+=n;return e},startsWith:function(t){B(t);var n=p(y(this)),e=L(X(arguments[1],n.length));t+="";return n.slice(e,e+t.length)===t}});Rn(p,fn,function(t){m(this,N,{o:p(t),i:0})},function(){var t=this[N],e=t.o,r=t.i,n;if(r>=e.length)return d(1);n=mn.call(e,r);t.i+=n.length;return d(0,n)});e(g,C,{from:function(v){var n=i(y(v)),e=new(Yn(this,S)),c=arguments[1],l=arguments[2],u=c!==r,a=u?f(c,l,2):r,t=0,s;if(Re(n))for(var h=ne(n),o;!(o=h.next()).done;t++){e[t]=u?a(o.value,t):o.value}else for(s=L(n.length);s>t;t++){e[t]=u?a(n[t],t):n[t]}e.length=t;return e},of:function(){var t=0,n=arguments.length,e=new(Yn(this,S))(n);while(n>t)e[t]=arguments[t++];e.length=n;return e}});e(T,C,{copyWithin:function(c,s){var e=i(y(this)),u=L(e.length),t=M(c,u),n=M(s,u),a=arguments[2],l=a===r?u:M(a,u),o=X(l-n,u-t),f=1;if(n<t&&t<n+o){f=-1;n=n+o-1;t=t+o-1}while(o-->0){if(n in e)e[t]=e[n];else delete e[t];t+=f;n+=f}return e},fill:function(o){var t=i(y(this)),n=L(t.length),e=M(arguments[1],n),u=arguments[2],f=u===r?n:M(u,n);while(f>e)t[e++]=o;return t},find:we(5),findIndex:we(6)});Rn(S,C,function(t,n){m(this,N,{o:F(t),i:0,k:n})},function(){var n=this[N],e=n.o,i=n.k,t=n.i++;if(!e||t>=e.length)return n.o=r,d(1);if(i==Q)return d(0,t);if(i==j)return d(0,e[t]);return d(0,[t,e[t]])},j);z[Je]=z[C];I(n.JSON,"JSON",true);function t(r,n){var t=i[r],u=E[R][r],o=0,f={};if(!u||G(u)){f[r]=n==1?function(n){return l(n)?t(n):n}:n==2?function(n){return l(n)?t(n):true}:n==3?function(n){return l(n)?t(n):false}:n==4?function(n,e){return t(F(n),e)}:function(n){return t(F(n))};try{t(K)}catch(a){o=1}e(g+U*o,R,f)}}t("freeze",1);t("seal",1);t("preventExtensions",1);t("isFrozen",2);t("isSealed",2);t("isExtensible",3);t("getOwnPropertyDescriptor",4);t("getPrototypeOf");t("keys");t("getOwnPropertyNames");function O(t,n){return new W(V(t)==H&&n!==r?t.source:t,n)}if(A){ln[Y]=K;if(V(ln)!=K)o(k,J,function(){return"[object "+Pn(this)+"]"});v in en||w(en,v,{configurable:true,get:function(){var t=p(this).match(/^\s*function ([^ (]*)/),n=t?t[1]:"";s(this,v)||w(this,v,tn(5,n));return n},set:function(t){s(this,v)||w(this,v,tn(0,t))}});if(pn&&!function(){try{return W(/a/g,"i")=="/a/i"}catch(t){}}()){nn.call(_n(W),function(t){t in O||w(O,t,{configurable:true,get:function(){return W[t]},set:function(n){W[t]=n}})});_[$n]=O;O[u]=_;o(n,H,O)}if(/./g.flags!="g")w(_,"flags",{configurable:true,get:re(/^.*\/(\w*)$/,"$1")});nn.call(Tn("find,findIndex,fill,copyWithin,entries,keys,values"),function(t){xe[t]=true});dn in a||o(a,dn,xe)}}(W[u],isFinite,{},"name");h(mn)&&h(Dn)||function(l){var v=n.postMessage,a=n.addEventListener,c=n.MessageChannel,i=0,e={},t,u,o;mn=function(n){var r=[],u=1;while(arguments.length>u)r.push(arguments[u++]);e[++i]=function(){ln(h(n)?n:le(n),r)};t(i);return i};Dn=function(t){delete e[t]};function r(t){if(s(e,t)){var n=e[t];delete e[t];n()}}function p(t){r(t.data)}if(Qn){t=function(t){Un(An.call(r,t))}}else if(a&&h(v)&&!n.importScripts){t=function(t){v(t,"*")};a("message",p,false)}else if(h(c)){u=new c;o=u.port2;u.port1.onmessage=p;t=f(o.postMessage,o,1)}else if(B&&l in B[oe]("script")){t=function(t){me.appendChild(B[oe]("script"))[l]=function(){me.removeChild(this);r(t)}}}else{t=function(t){Ee(An.call(r,t),0)}}}("onreadystatechange");e(_+Kn,{setImmediate:mn,clearImmediate:Dn});!function(t,n){h(t)&&h(t.resolve)&&t.resolve(n=new t(function(){}))==n||function(s,i){function a(n){var t;if(l(n))t=n.then;return h(t)?t:false}function e(n){var t=n.chain;t.length&&s(function(){var e=n.msg,i=n.state==1,r=0;while(t.length>r)!function(t){var r=i?t.ok:t.fail,n,u;try{if(r){n=r===true?e:r(e);if(n===t.P){t.rej(wn(En+"-chain cycle"))}else if(u=a(n)){u.call(n,t.res,t.rej)}else t.res(n)}else t.rej(e)}catch(o){t.rej(o)}}(t[r++]);t.length=0})}function c(i){var t=this,u,r;if(t.done)return;t.done=true;t=t.def||t;try{if(u=a(i)){r={def:t,done:false};u.call(i,f(c,r,1),f(n,r,1))}else{t.msg=i;t.state=1;e(t)}}catch(o){n.call(r||{def:t,done:false},o)}}function n(n){var t=this;if(t.done)return;t.done=true;t=t.def||t;t.msg=n;t.state=2;e(t)}t=function(u){un(u);hn(this,t,En);var e={chain:[],state:0,done:false,msg:r};o(this,i,e);try{u(f(c,e,1),f(n,e,1))}catch(a){n.call(e,a)}};gn(t[u],{then:function(r,u){var t={ok:h(r)?r:true,fail:h(u)?u:false},o=t.P=new this[$n](function(n,e){t.res=un(n);t.rej=un(e)}),n=this[i];n.chain.push(t);n.state&&e(n);return o},"catch":function(t){return this.then(r,t)}});gn(t,{all:function(e){var n=this,t=[];return new n(function(u,o){kn(e,false,Ge,t);var r=t.length,i=S(r);if(r)nn.call(t,function(t,e){n.resolve(t).then(function(t){i[e]=t;--r||u(i)},o)});else u(i)})},race:function(n){var t=this;return new t(function(e,r){kn(n,false,function(n){t.resolve(n).then(e,r)})})},reject:function(t){return new this(function(e,n){n(t)})},resolve:function(t){return l(t)&&an(t)===this[u]?t:new this(function(n,e){n(t)})}})}(Un||mn,x("def"));I(t,En);e(_+U*!G(t),{Promise:t})}(n[En]);!function(){var t=x("uid"),a=x("data"),n=x("weak"),c=x("last"),i=x("first"),h=pn?x("size"):"size",g=0;function p(n,f,k,S,v,l){var b=v?"set":"add",x=n&&n[u],P={};function E(t,n){if(n!=r)kn(n,v,t[b],t);return t}function p(t,n){var e=x[t];A&&o(x,t,function(t,r){var i=e.call(this,t===0?0:t,r);return n?this:i})}if(!G(n)||!(l||!ve&&s(x,"entries"))){n=l?function(e){hn(this,n,f);m(this,t,g++);E(this,e)}:function(e){var t=this;hn(t,n,f);m(t,a,yn(null));m(t,h,0);m(t,c,r);m(t,i,r);E(t,e)};gn(gn(n[u],k),S);l||w(n[u],"size",{get:function(){return y(this[h])}})}else{var F=n,L=new n,C=L[b](l?{}:-0,1),O;if(!_e||!n.length){n=function(t){hn(this,n,f);return E(new F,t)};n[u]=x}l||L[te](function(n,t){O=1/t===-rn});if(O){p("delete");p("has");v&&p("get")}if(O||C!==L)p(b,true)}I(n,f);P[f]=n;e(_+Cn+U*!G(n),P);l||Rn(n,f,function(t,n){m(this,N,{o:t,k:n})},function(){var n=this[N],e=n.o,u=n.k,t=n.l;while(t&&t.r)t=t.p;if(!e||!(n.l=t=t?t.n:e[i]))return n.o=r,d(1);if(u==Q)return d(0,t.k);if(u==j)return d(0,t.v);return d(0,[t.k,t.v])},v?Q+j:j,!v);return n}function v(n,e){if(!l(n))return(typeof n=="string"?"S":"P")+n;if(!s(n,t)){if(e)o(n,t,++g);else return""}return"O"+n[t]}function E(t,o,f){var e=v(o,true),r=t[a],u=t[c],n;if(e in r)r[e].v=f;else{n=r[e]={k:o,v:f,p:u};if(!t[i])t[i]=n;if(u)u.n=n;t[c]=n;t[h]++}return t}function L(t,u){var o=t[a],n=o[u],e=n.n,r=n.p;delete o[u];n.r=true;if(r)r.n=e;if(e)e.p=r;if(t[i]==n)t[i]=e;if(t[c]==n)t[c]=r;t[h]--}var O={clear:function(){for(var t in this[a])L(this,t)},"delete":function(e){var t=v(e),n=t in this[a];if(n)L(this,t);return n},forEach:function(n){var e=f(n,arguments[1],3),t;while(t=t?t.n:this[i]){e(t.v,t.k,this);while(t&&t.r)t=t.p}},has:function(t){return v(t)in this[a]}};Wn=p(Wn,Bn,{get:function(n){var t=this[a][v(n)];return t&&t.v},set:function(t,n){return E(this,t===0?0:t,n)}},O,true);ge=p(ge,Fn,{add:function(t){return E(this,t=t===0?0:t,t)}},O);function P(r,e,i){s(b(e),n)||o(e,n,{});e[n][r[t]]=i;return r}function S(e){return l(e)&&s(e,n)&&s(e[n],this[t])}var k={"delete":function(e){return S.call(this,e)&&delete e[n][this[t]]},has:S};qn=p(qn,ue,{get:function(e){if(l(e)&&s(e,n))return e[n][this[t]]},set:function(t,n){return P(this,t,n)}},k,true,true);de=p(de,be,{add:function(t){return P(this,t,true)}},k,false,true)}();!function(){function t(t){var n=[],e;for(e in t)n.push(e);m(this,N,{o:t,a:n,i:0})}ae(t,R,function(){var t=this[N],n=t.a,e;do{if(t.i>=n.length)return d(1)}while(!((e=n[t.i++])in t.o));return d(0,e)});function n(t){return function(n){b(n);try{return t.apply(r,arguments),true}catch(e){return false}}}function u(n,e){var i=arguments.length<3?n:arguments[2],t=$(b(n),e),o;if(t)return t.get?t.get.call(i):t.value;return l(o=an(n))?u(o,e,i):r}function o(r,n,i){var e=arguments.length<4?r:arguments[3],t=$(b(r),n),u;if(t){if(t.writable===false)return false;if(t.set)return t.set.call(e,i),true}if(l(u=an(r)))return o(u,n,i,e);t=$(e,n)||tn(0);t.value=i;return w(e,n,t),true}var a={apply:f(Z,ce,3),construct:Fe,defineProperty:n(w),deleteProperty:function(t,n){var e=$(b(t),n);return e&&!e.configurable?false:delete t[n]},enumerate:function(n){return new t(b(n))},get:u,getOwnPropertyDescriptor:$,getPrototypeOf:an,has:function(t,n){return n in t},isExtensible:i.isExtensible||function(t){return!!b(t)},ownKeys:ie,preventExtensions:n(i.preventExtensions||Ae),set:o};if(sn)a.setPrototypeOf=function(t,n){return sn(b(t),n),true};e(_,{Reflect:{}});e(g,"Reflect",a)}();!function(){e(T,C,{includes:Ke(true)});e(T,fn,{at:Mn(true)});function t(t){return function(u){var o=F(u),e=Sn(u),r=e.length,n=0,i=S(r),f;if(t)while(r>n)i[n]=[f=e[n++],o[f]];else while(r>n)i[n]=o[e[n++]];return i}}e(g,R,{values:t(false),entries:t(true)});e(g,H,{escape:re(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(t){vn=P(t+"Get",true);var n=P(t+Fn,true),r=P(t+"Delete",true);e(g,O,{referenceGet:vn,referenceSet:n,referenceDelete:r});o(en,vn,cn);function i(e){if(e){var t=e[u];o(t,vn,t.get);o(t,n,t.set);o(t,r,t["delete"])}}i(Wn);i(qn)}("reference");!function(n){function t(t,e){nn.call(Tn(t),function(t){if(t in a)n[t]=f(Z,a[t],e)})}t("pop,reverse,shift,keys,values,entries",1);t("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);t("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");e(g,C,n)}({})}(typeof window!="undefined"&&window.Math===Math?window:n,true)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],3:[function(n,e,t){!function(){var r=Object.prototype.hasOwnProperty;var e;var v=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";if(typeof regeneratorRuntime==="object"){return}var n=regeneratorRuntime=typeof t==="undefined"?{}:t;function y(t,n,e,r){return new h(t,n,e||null,r||[])}n.wrap=y;var c="suspendedStart";var s="suspendedYield";var p="executing";var a="completed";var i={};function o(){}function u(){}var f=u.prototype=h.prototype;o.prototype=f.constructor=u;u.constructor=o;o.displayName="GeneratorFunction";n.isGeneratorFunction=function(n){var t=typeof n==="function"&&n.constructor;return t?t===o||(t.displayName||t.name)==="GeneratorFunction":false};n.mark=function(t){t.__proto__=u;t.prototype=Object.create(f);return t};n.async=function(t,n,e,r){return new Promise(function(f,a){var i=y(t,n,e,r);var u=o.bind(i.next);var c=o.bind(i["throw"]);function o(e){try{var t=this(e);var n=t.value}catch(r){return a(r)}if(t.done){f(n)}else{Promise.resolve(n).then(u,c)}}u()})};function h(f,o,h,v){var r=o?Object.create(o.prototype):this;var t=new l(v);var n=c;function u(u,r){if(n===p){throw new Error("Generator is already running")}if(n===a){return m()}while(true){var o=t.delegate;if(o){try{var l=o.iterator[u](r);u="next";r=e}catch(d){t.delegate=null;u="throw";r=d;continue}if(l.done){t[o.resultName]=l.value;t.next=o.nextLoc}else{n=s;return l}t.delegate=null}if(u==="next"){if(n===c&&typeof r!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(r)+" to newborn generator")}if(n===s){t.sent=r}else{delete t.sent}}else if(u==="throw"){if(n===c){n=a;throw r}if(t.dispatchException(r)){u="next";r=e}}else if(u==="return"){t.abrupt("return",r)}n=p;try{var v=f.call(h,t);n=t.done?a:s;var l={value:v,done:t.done};if(v===i){if(t.delegate&&u==="next"){r=e}}else{return l}}catch(g){n=a;if(u==="next"){t.dispatchException(g)}else{r=g}}}}r.next=u.bind(r,"next");r["throw"]=u.bind(r,"throw");r["return"]=u.bind(r,"return");return r}f[v]=function(){return this};f.toString=function(){return"[object Generator]"};function w(t){var n={tryLoc:t[0]};if(1 in t){n.catchLoc=t[1]}if(2 in t){n.finallyLoc=t[2]}this.tryEntries.push(n)}function d(n,e){var t=n.completion||{};t.type=e===0?"normal":"return";delete t.arg;n.completion=t}function l(t){this.tryEntries=[{tryLoc:"root"}];t.forEach(w,this);this.reset()}n.keys=function(n){var t=[];for(var e in n){t.push(e)}t.reverse();return function r(){while(t.length){var e=t.pop();if(e in n){r.value=e;r.done=false;return r}}r.done=true;return r}};function g(t){if(t){var u=t[v];if(u){return u.call(t)}if(typeof t.next==="function"){return t}if(!isNaN(t.length)){var i=-1;function n(){while(++i<t.length){if(r.call(t,i)){n.value=t[i];n.done=false;return n}}n.value=e;n.done=true;return n}return n.next=n}}return{next:m}}n.values=g;function m(){return{value:e,done:true}}l.prototype={constructor:l,reset:function(){this.prev=0;this.next=0;this.sent=e;this.done=false;this.delegate=null;this.tryEntries.forEach(d);for(var t=0,n;r.call(this,n="t"+t)||t<20;++t){this[n]=null}},stop:function(){this.done=true;var n=this.tryEntries[0];var t=n.completion;if(t.type==="throw"){throw t.arg}return this.rval},dispatchException:function(i){if(this.done){throw i}var a=this;function n(t,n){u.type="throw";u.arg=i;a.next=t;return!!n}for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];var u=t.completion;if(t.tryLoc==="root"){return n("end")}if(t.tryLoc<=this.prev){var o=r.call(t,"catchLoc");var f=r.call(t,"finallyLoc");if(o&&f){if(this.prev<t.catchLoc){return n(t.catchLoc,true)}else if(this.prev<t.finallyLoc){return n(t.finallyLoc)}}else if(o){if(this.prev<t.catchLoc){return n(t.catchLoc,true)}}else if(f){if(this.prev<t.finallyLoc){return n(t.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc<=this.prev&&r.call(t,"finallyLoc")&&(t.finallyLoc===e||this.prev<t.finallyLoc)){return t}}},abrupt:function(e,r){var t=this._findFinallyEntry();var n=t?t.completion:{};n.type=e;n.arg=r;if(t){this.next=t.finallyLoc}else{this.complete(n)}return i},complete:function(t){if(t.type==="throw"){throw t.arg}if(t.type==="break"||t.type==="continue"){this.next=t.arg}else if(t.type==="return"){this.rval=t.arg;this.next="end"}return i},finish:function(t){var n=this._findFinallyEntry(t);return this.complete(n.completion)},"catch":function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===r){var e=n.completion;if(e.type==="throw"){var i=e.arg;d(n,t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){this.delegate={iterator:g(t),resultName:n,nextLoc:e};return i}}}()},{}]},{},[1]);
(function t(t,e,n){function r(i,c){if(!e[i]){if(!t[i]){var f=typeof require=="function"&&require;if(!c&&f)return f(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var o=e[i]={exports:{}};t[i][0].call(o.exports,function(e){var n=t[i][1][e];return r(n?n:e)},o,o.exports,t,t,e,n)}return e[i].exports}var u=typeof require=="function"&&require;for(var i=0;i<n.length;i++)r(n[i]);return r})({1:[function(t,e,n){"use strict";t("core-js/shim");t("regenerator/runtime")},{"core-js/shim":2,"regenerator/runtime":3}],2:[function(e,t,n){!function(e,I,r){"use strict";var F="Object",Rn="Function",R="Array",ie="String",yn="Number",X="RegExp",Pn="Date",Ke="Map",je="Set",rn="WeakMap",$e="WeakSet",N="Symbol",be="Promise",ke="Math",Kn="Arguments",u="prototype",ze="constructor",D="toString",Be=D+"Tag",Qn="toLocaleString",Wn="hasOwnProperty",He="forEach",we="iterator",z="@@"+we,tn="process",un="createElement",ln=e[Rn],i=e[F],O=e[R],v=e[ie],Nn=e[yn],q=e[X],Zn=e[Pn],De=e[Ke],gn=e[je],We=e[rn],dn=e[$e],g=e[N],c=e[ke],me=e.TypeError,En=e.setTimeout,ae=e.setImmediate,Re=e.clearImmediate,Me=e[tn],bn=Me&&Me.nextTick,ue=e.document,mn=ue&&ue.documentElement,rr=e.navigator,Oe=e.define,a=O[u],S=i[u],ee=ln[u],Y=1/0,B=".";function l(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function h(t){return typeof t=="function"}var T=f(/./.test,/\[native code\]\s*\}\s*$/,1);var Sn={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},kn=S[D];function A(t,e,n){if(t&&!s(t=n?t:t[u],re))o(t,re,e)}function V(t){return t==r?t===r?"Undefined":"Null":kn.call(t).slice(8,-1)}function Ne(e){var n=V(e),t;return n==F&&(t=e[re])?s(Sn,t)?"~"+t:t:n}var Z=ee.call,cn=ee.apply,he;function Ie(){var t=arguments.length,n=O(t),e=0,r=zn._,i=false;while(t>e)if((n[e]=arguments[e++])===r)i=true;return In(this,n,t,i,r,false)}function In(t,e,r,n,i,u,o){K(t);return function(){var s=u?o:this,l=arguments.length,a=0,c=0,f;if(!n&&!l)return se(t,e,s);f=e.slice();if(n)for(;r>a;a++)if(f[a]===i)f[a]=arguments[c++];while(l>c)f.push(arguments[c++]);return se(t,f,s)}}function f(t,e,n){K(t);if(~n&&e===r)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}function se(e,t,n){var i=n===r;switch(t.length|0){case 0:return i?e():e.call(n);case 1:return i?e(t[0]):e.call(n,t[0]);case 2:return i?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return i?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return i?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3]);case 5:return i?e(t[0],t[1],t[2],t[3],t[4]):e.call(n,t[0],t[1],t[2],t[3],t[4])}return e.apply(n,t)}function Fn(t,r){var e=de((arguments.length<3?t:K(arguments[2]))[u]),n=cn.call(t,e,r);return l(n)?n:e}var de=i.create,fe=i.getPrototypeOf,ce=i.setPrototypeOf,m=i.defineProperty,nr=i.defineProperties,U=i.getOwnPropertyDescriptor,Pe=i.keys,Se=i.getOwnPropertyNames,on=i.getOwnPropertySymbols,s=f(Z,S[Wn],2),qe=i;function M(t){return qe(d(t))}function An(t){return t}function ye(){return this}function Le(t,e){if(s(t,e))return t[e]}function en(t){return on?Se(t).concat(on(t)):Se(t)}var Cn=i.assign||function(f,s){var t=i(d(f)),a=arguments.length,e=1;while(a>e){var n=qe(arguments[e++]),r=Pe(n),c=r.length,u=0,o;while(c>u)t[o=r[u++]]=n[o]}return t};function Mn(i,u){var t=M(i),e=Pe(t),o=e.length,n=0,r;while(o>n)if(t[r=e[n++]]===u)return r}function Ge(t){return v(t).split(",")}var $n=a.push,Xn=a.unshift,tr=a.slice,er=a.splice,Hn=a.indexOf,Q=a[He];function wn(t){var n=t==1,o=t==2,a=t==3,e=t==4,u=t==6,c=t==5||u;return function(m){var g=i(d(this)),w=arguments[1],h=qe(g),x=f(m,w,3),y=L(h.length),s=0,v=n?O(y):o?[]:r,l,p;for(;y>s;s++)if(c||s in h){l=h[s];p=x(l,s,g);if(t){if(n)v[s]=p;else if(p)switch(t){case 3:return true;case 5:return l;case 6:return s;case 2:v.push(l)}else if(e)return false}}return u?-1:a||e?e:v}}function Yn(t){return function(r){var n=M(this),i=L(n.length),e=C(arguments[1],i);if(t&&r!=r){for(;i>e;e++)if(Ve(n[e]))return t||e}else for(;i>e;e++)if(t||e in n){if(n[e]===r)return t||e}return!t&&-1}}function Je(t,e){return typeof t=="function"?t:e}var Ee=9007199254740991,Jn=c.ceil,Ye=c.floor,Un=c.max,oe=c.min,Gn=c.random,Qe=c.trunc||function(t){return(t>0?Ye:Jn)(t)};function Ve(t){return t!=t}function xe(t){return isNaN(t)?0:Qe(t)}function L(t){return t>0?oe(xe(t),Ee):0}function C(t,e){var t=xe(t);return t<0?Un(t+e,0):oe(t,e)}function nn(e,t,n){var r=l(t)?function(e){return t[e]}:t;return function(t){return v(n?t:this).replace(e,r)}}function Ce(t){return function(f){var n=v(d(this)),e=xe(f),o=n.length,i,u;if(e<0||e>=o)return t?"":r;i=n.charCodeAt(e);return i<55296||i>56319||e+1===o||(u=n.charCodeAt(e+1))<56320||u>57343?t?n.charAt(e):i:t?n.slice(e,e+2):(i-55296<<10)+(u-56320)+65536}}var Vn="Reduce of empty object with no initial value";function ne(n,t,e){if(!n)throw me(e?t+e:t)}function d(t){if(t==r)throw me("Function called on null or undefined");return t}function K(t){ne(h(t),t," is not a function!");return t}function E(t){ne(l(t),t," is not an object!");return t}function le(t,e,n){ne(t instanceof e,n,": use the 'new' operator!")}function te(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}function sn(t,e,n){t[e]=n;return t}function jn(t){return ve?function(e,n,r){return m(e,n,te(t,r))}:sn}function hn(t){return N+"("+t+")_"+(++On+Gn())[D](36)}function k(t,e){return g&&g[t]||(e?g:x)(N+B+t)}var ve=!!function(){try{return m({},B,S)}catch(t){}}(),On=0,o=jn(1),w=g?sn:o,x=g||hn;function pe(t,e){for(var n in e)o(t,n,e[n]);return t}var ge=k("unscopables"),xn=a[ge]||{};var W=k(we),re=k(Be),Ln=z in a,_=x("iter"),H=1,P=2,J={},pn={},_n=W in a,vn="keys"in a&&!("next"in[].keys());Te(pn,ye);function Te(t,e){o(t,W,e);Ln&&o(t,z,e)}function an(t,e,n,r){t[u]=de(r||pn,{next:te(1,n)});A(t,e+" Iterator")}function fn(r,n,i,o){var t=r[u],e=Le(t,W)||Le(t,z)||o&&Le(t,o)||i;if(I){Te(t,e);if(e!==i){var f=fe(e.call(new r));A(f,n+" Iterator",true);s(t,z)&&Te(f,ye)}}J[n]=e;J[n+" Iterator"]=ye;return e}function Ae(u,t,o,a,f,c){function r(t){return function(){return new o(this,t)}}an(o,t,a);var i=r(H+P),e=r(P);if(f==P)e=fn(u,t,e,"values");else i=fn(u,t,i,"entries");if(f){n(G+$*vn,t,{entries:i,keys:c?e:r(H),values:e})}}function y(t,e){return{value:e,done:!!t}}function Bn(r){var t=i(r),n=e[N],u=(n&&n[we]||z)in t;return u||W in t||s(J,Ne(t))}function Ze(t){var n=e[N],r=t[n&&n[we]||z],i=r||t[W]||J[Ne(t)];return E(i.call(t))}function Dn(t,e,n){return n?se(t,e):t(e)}function _e(n,t,r,i){var u=Ze(n),o=f(r,i,t?2:1),e;while(!(e=u.next()).done)if(Dn(o,e.value,t)===false)return}var Tn=V(Me)==tn,b={},zn=I?e:b,qn=e.core,Xe,$=1,j=2,p=4,G=8,Ue=16,Fe=32;function n(i,a,v){var n,s,t,c,l=i&j,r=l?e:i&p?e[a]:(e[a]||S)[u],g=l?b:b[a]||(b[a]={});if(l)v=a;for(n in v){s=!(i&$)&&r&&n in r&&(!h(r[n])||T(r[n]));t=(s?r:v)[n];if(i&Ue&&s)c=f(t,e);else if(i&Fe&&!I&&r[n]==t){c=function(e){return this instanceof t?new t(e):t(e)};c[u]=t[u]}else c=i&G&&h(t)?f(Z,t):t;if(g[n]!=t)o(g,n,c);if(I&&r&&!s){if(l)r[n]=t;else delete r[n]&&o(r,n,t)}}}if(typeof t!="undefined"&&t.exports)t.exports=b;else if(h(Oe)&&Oe.amd)Oe(function(){return b});else Xe=true;if(Xe||I){b.noConflict=function(){e.core=qn;return b};e.core=b}n(j+$,{global:e});!function(r,t,e){if(!T(g)){g=function(n){ne(!(this instanceof g),N+" is not a "+ze);var t=hn(n);ve&&e&&m(S,t,{configurable:true,set:function(e){o(this,t,e)}});return w(de(g[u]),r,t)};o(g[u],D,function(){return this[r]})}n(j+Fe,{Symbol:g});var i={"for":function(e){return s(t,e+="")?t[e]:t[e]=g(e)},iterator:W,keyFor:Ie.call(Mn,t),toStringTag:re=k(Be,true),unscopables:ge,pure:x,set:w,useSetter:function(){e=true},useSimple:function(){e=false}};Q.call(Ge("hasInstance,isConcatSpreadable,match,replace,search,"+"species,split,toPrimitive"),function(t){i[t]=k(t)});n(p,N,i);A(g,N);n(j,{Reflect:{ownKeys:en}})}(x("tag"),{},true);!function(j,k,se,x){var ae=e.RangeError,pe=Nn.isInteger||function(t){return!l(t)&&k(t)&&Ye(t)===t},K=c.sign||function be(t){return(t=+t)==0||t!=t?t:t<0?-1:1},W=c.pow,fe=c.abs,h=c.exp,g=c.log,z=c.sqrt,de=v.fromCharCode,ye=Ce(true);var le={assign:Cn,is:function(t,e){return t===e?t!==0||1/t===1/e:t!=t&&e!=e}};"__proto__"in S&&function(e,t){try{t=f(Z,U(S,"__proto__").set,2);t({},a)}catch(n){e=true}le.setPrototypeOf=ce=ce||function(r,n){E(r);ne(n===null||l(n),n,": can't set as prototype!");if(e)r.__proto__=n;else t(r,n);return r}}();n(p,F,le);function he(t){return!k(t=+t)||t==0?t:t<0?-he(-t):g(t+z(t*t+1))}n(p,yn,{EPSILON:W(2,-52),isFinite:function(t){return typeof t=="number"&&k(t)},isInteger:pe,isNaN:Ve,isSafeInteger:function(t){return pe(t)&&fe(t)<=Ee},MAX_SAFE_INTEGER:Ee,MIN_SAFE_INTEGER:-Ee,parseFloat:parseFloat,parseInt:parseInt});n(p,ke,{acosh:function(t){return(t=+t)<1?NaN:g(t+z(t*t-1))},asinh:he,atanh:function(t){return(t=+t)==0?t:g((1+t)/(1-t))/2},cbrt:function(t){return K(t=+t)*W(fe(t),1/3)},clz32:function(t){return(t>>>=0)?32-t[D](2).length:32},cosh:function(t){return(h(t=+t)+h(-t))/2},expm1:function(t){return(t=+t)==0?t:t>-1e-6&&t<1e-6?t+t*t/2:h(t)-1},fround:function(t){return new Float32Array([t])[0]},hypot:function(o,f){var r=0,e=arguments.length,i=e,u=O(e),n=-Y,t;while(e--){t=u[e]=+arguments[e];if(t==Y||t==-Y)return Y;if(t>n)n=t}n=t||1;while(i--)r+=W(u[i]/n,2);return n*z(r)},imul:function(u,o){var t=65535,e=+u,n=+o,r=t&e,i=t&n;return 0|r*i+((t&e>>>16)*i+r*(t&n>>>16)<<16>>>0)},log1p:function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:g(1+t)},log10:function(t){return g(t)/c.LN10},log2:function(t){return g(t)/c.LN2},sign:K,sinh:function(t){return(t=+t)==0?t:(h(t)-h(-t))/2},tanh:function(t){return k(t=+t)?t==0?t:(h(t)-h(-t))/(h(t)+h(-t)):K(t)},trunc:Qe});A(c,ke,true);function ue(t){if(V(t)==X)throw me()}n(p,ie,{fromCodePoint:function(i){var e=[],r=arguments.length,n=0,t;while(r>n){t=+arguments[n++];if(C(t,1114111)!==t)throw ae(t+" is not a valid code point");e.push(t<65536?de(t):de(((t-=65536)>>10)+55296,t%1024+56320))}return e.join("")},raw:function(r){var n=M(r.raw),i=L(n.length),u=arguments.length,e=[],t=0;while(i>t){e.push(v(n[t++]));if(t<u)e.push(v(arguments[t]))}return e.join("")}});n(G,ie,{codePointAt:Ce(false),endsWith:function(t){ue(t);var e=v(d(this)),n=arguments[1],i=L(e.length),u=n===r?i:oe(L(n),i);t+="";return e.slice(u-t.length,u)===t},includes:function(t){ue(t);return!!~v(d(this)).indexOf(t,arguments[1])},repeat:function(r){var e=v(d(this)),n="",t=xe(r);if(0>t||t==Y)throw ae("Count can't be negative");for(;t>0;(t>>>=1)&&(e+=e))if(t&1)n+=e;return n},startsWith:function(t){ue(t);var e=v(d(this)),n=L(oe(arguments[1],e.length));t+="";return e.slice(n,n+t.length)===t}});Ae(v,ie,function(t){w(this,_,{o:v(t),i:0})},function(){var t=this[_],n=t.o,r=t.i,e;if(r>=n.length)return y(1);e=ye.call(n,r);t.i+=e.length;return y(0,e)});n(p,R,{from:function(v){var e=i(d(v)),n=new(Je(this,O)),c=arguments[1],l=arguments[2],u=c!==r,a=u?f(c,l,2):r,t=0,s;if(Bn(e))for(var h=Ze(e),o;!(o=h.next()).done;t++){n[t]=u?a(o.value,t):o.value}else for(s=L(e.length);s>t;t++){n[t]=u?a(e[t],t):e[t]}n.length=t;return n},of:function(){var t=0,e=arguments.length,n=new(Je(this,O))(e);while(e>t)n[t]=arguments[t++];n.length=e;return n}});n(G,R,{copyWithin:function(c,s){var n=i(d(this)),u=L(n.length),t=C(c,u),e=C(s,u),a=arguments[2],l=a===r?u:C(a,u),o=oe(l-e,u-t),f=1;if(e<t&&t<e+o){f=-1;e=e+o-1;t=t+o-1}while(o-->0){if(e in n)n[t]=n[e];else delete n[t];t+=f;e+=f}return n},fill:function(o){var t=i(d(this)),e=L(t.length),n=C(arguments[1],e),u=arguments[2],f=u===r?e:C(u,e);while(f>n)t[n++]=o;return t},find:wn(5),findIndex:wn(6)});Ae(O,R,function(t,e){w(this,_,{o:M(t),i:0,k:e})},function(){var e=this[_],n=e.o,i=e.k,t=e.i++;if(!n||t>=n.length)return e.o=r,y(1);if(i==H)return y(0,t);if(i==P)return y(0,n[t]);return y(0,[t,n[t]])},P);J[Kn]=J[R];A(e.JSON,"JSON",true);function t(r,e){var t=i[r],u=b[F][r],o=0,f={};if(!u||T(u)){f[r]=e==1?function(e){return l(e)?t(e):e}:e==2?function(e){return l(e)?t(e):true}:e==3?function(e){return l(e)?t(e):false}:e==4?function(e,n){return t(M(e),n)}:function(e){return t(M(e))};try{t(B)}catch(a){o=1}n(p+$*o,F,f)}}t("freeze",1);t("seal",1);t("preventExtensions",1);t("isFrozen",2);t("isSealed",2);t("isExtensible",3);t("getOwnPropertyDescriptor",4);t("getPrototypeOf");t("keys");t("getOwnPropertyNames");if(I){se[re]=B;if(V(se)!=B)o(S,D,function(){return"[object "+Ne(this)+"]"});x in ee||m(ee,x,{configurable:true,get:function(){var t=v(this).match(/^\s*function ([^ (]*)/),e=t?t[1]:"";s(this,x)||m(this,x,te(5,e));return e},set:function(t){s(this,x)||m(this,x,te(0,t))}});var we=q;var N=function Le(t,e){return new we(V(t)==X&&e!==r?t.source:t,e)};if(ve&&!function(){try{return q(/a/g,"i")=="/a/i"}catch(t){}}()){Q.call(Se(q),function(t){t in N||m(N,t,{configurable:true,get:function(){return q[t]},set:function(e){q[t]=e}})});j[ze]=N;N[u]=j;o(e,X,N)}if(/./g.flags!="g")m(j,"flags",{configurable:true,get:nn(/^.*\/(\w*)$/,"$1")});Q.call(Ge("find,findIndex,fill,copyWithin,entries,keys,values"),function(t){xn[t]=true});ge in a||o(a,ge,xn)}}(q[u],isFinite,{},"name");h(ae)&&h(Re)||function(l){var v=e.postMessage,a=e.addEventListener,c=e.MessageChannel,i=0,n={},t,u,o;ae=function(e){var r=[],u=1;while(arguments.length>u)r.push(arguments[u++]);n[++i]=function(){se(h(e)?e:ln(e),r)};t(i);return i};Re=function(t){delete n[t]};function r(t){if(s(n,t)){var e=n[t];delete n[t];e()}}function p(t){r(t.data)}if(Tn){t=function(t){bn(Ie.call(r,t))}}else if(a&&h(v)&&!e.importScripts){t=function(t){v(t,"*")};a("message",p,false)}else if(h(c)){u=new c;o=u.port2;u.port1.onmessage=p;t=f(o.postMessage,o,1)}else if(ue&&l in ue[un]("script")){t=function(t){mn.appendChild(ue[un]("script"))[l]=function(){mn.removeChild(this);r(t)}}}else{t=function(t){En(Ie.call(r,t),0)}}}("onreadystatechange");n(j+Ue,{setImmediate:ae,clearImmediate:Re});!function(t,e){h(t)&&h(t.resolve)&&t.resolve(e=new t(function(){}))==e||function(s,i){function a(e){var t;if(l(e))t=e.then;return h(t)?t:false}function n(e){var t=e.chain;t.length&&s(function(){var n=e.msg,i=e.state==1,r=0;while(t.length>r)!function(t){var r=i?t.ok:t.fail,e,u;try{if(r){e=r===true?n:r(n);if(e===t.P){t.rej(me(be+"-chain cycle"))}else if(u=a(e)){u.call(e,t.res,t.rej)}else t.res(e)}else t.rej(n)}catch(o){t.rej(o)}}(t[r++]);t.length=0})}function c(i){var t=this,u,r;if(t.done)return;t.done=true;t=t.def||t;try{if(u=a(i)){r={def:t,done:false};u.call(i,f(c,r,1),f(e,r,1))}else{t.msg=i;t.state=1;n(t)}}catch(o){e.call(r||{def:t,done:false},o)}}function e(e){var t=this;if(t.done)return;t.done=true;t=t.def||t;t.msg=e;t.state=2;n(t)}t=function(u){K(u);le(this,t,be);var n={chain:[],state:0,done:false,msg:r};o(this,i,n);try{u(f(c,n,1),f(e,n,1))}catch(a){e.call(n,a)}};pe(t[u],{then:function(r,u){var t={ok:h(r)?r:true,fail:h(u)?u:false},o=t.P=new this[ze](function(e,n){t.res=K(e);t.rej=K(n)}),e=this[i];e.chain.push(t);e.state&&n(e);return o},"catch":function(t){return this.then(r,t)}});pe(t,{all:function(n){var e=this,t=[];return new e(function(u,o){_e(n,false,$n,t);var r=t.length,i=O(r);if(r)Q.call(t,function(t,n){e.resolve(t).then(function(t){i[n]=t;--r||u(i)},o)});else u(i)})},race:function(e){var t=this;return new t(function(n,r){_e(e,false,function(e){t.resolve(e).then(n,r)})})},reject:function(t){return new this(function(n,e){e(t)})},resolve:function(t){return l(t)&&fe(t)===this[u]?t:new this(function(e,n){e(t)})}})}(bn||ae,x("def"));A(t,be);n(j+$*!T(t),{Promise:t})}(e[be]);!function(){var t=x("uid"),a=x("data"),e=x("weak"),c=x("last"),i=x("first"),h=ve?x("size"):"size",g=0;function p(e,f,k,S,v,l){var b=v?"set":"add",x=e&&e[u],N={};function E(t,e){if(e!=r)_e(e,v,t[b],t);return t}function p(t,e){var n=x[t];I&&o(x,t,function(t,r){var i=n.call(this,t===0?0:t,r);return e?this:i})}if(!T(e)||!(l||!vn&&s(x,"entries"))){e=l?function(n){le(this,e,f);w(this,t,g++);E(this,n)}:function(n){var t=this;le(t,e,f);w(t,a,de(null));w(t,h,0);w(t,c,r);w(t,i,r);E(t,n)};pe(pe(e[u],k),S);l||m(e[u],"size",{get:function(){return d(this[h])}})}else{var F=e,L=new e,C=L[b](l?{}:-0,1),O;if(!_n||!e.length){e=function(t){le(this,e,f);return E(new F,t)};e[u]=x}l||L[He](function(e,t){O=1/t===-Y});if(O){p("delete");p("has");v&&p("get")}if(O||C!==L)p(b,true)}A(e,f);N[f]=e;n(j+Fe+$*!T(e),N);l||Ae(e,f,function(t,e){w(this,_,{o:t,k:e})},function(){var e=this[_],n=e.o,u=e.k,t=e.l;while(t&&t.r)t=t.p;if(!n||!(e.l=t=t?t.n:n[i]))return e.o=r,y(1);if(u==H)return y(0,t.k);if(u==P)return y(0,t.v);return y(0,[t.k,t.v])},v?H+P:P,!v);return e}function v(e,n){if(!l(e))return(typeof e=="string"?"S":"P")+e;if(!s(e,t)){if(n)o(e,t,++g);else return""}return"O"+e[t]}function b(t,o,f){var n=v(o,true),r=t[a],u=t[c],e;if(n in r)r[n].v=f;else{e=r[n]={k:o,v:f,p:u};if(!t[i])t[i]=e;if(u)u.n=e;t[c]=e;t[h]++}return t}function L(t,u){var o=t[a],e=o[u],n=e.n,r=e.p;delete o[u];e.r=true;if(r)r.n=n;if(n)n.p=r;if(t[i]==e)t[i]=n;if(t[c]==e)t[c]=r;t[h]--}var O={clear:function(){for(var t in this[a])L(this,t)},"delete":function(n){var t=v(n),e=t in this[a];if(e)L(this,t);return e},forEach:function(e){var n=f(e,arguments[1],3),t;while(t=t?t.n:this[i]){n(t.v,t.k,this);while(t&&t.r)t=t.p}},has:function(t){return v(t)in this[a]}};De=p(De,Ke,{get:function(e){var t=this[a][v(e)];return t&&t.v},set:function(t,e){return b(this,t===0?0:t,e)}},O,true);gn=p(gn,je,{add:function(t){return b(this,t=t===0?0:t,t)}},O);function N(r,n,i){s(E(n),e)||o(n,e,{});n[e][r[t]]=i;return r}function S(n){return l(n)&&s(n,e)&&s(n[e],this[t])}var k={"delete":function(n){return S.call(this,n)&&delete n[e][this[t]]},has:S};We=p(We,rn,{get:function(n){if(l(n)&&s(n,e))return n[e][this[t]]},set:function(t,e){return N(this,t,e)}},k,true,true);dn=p(dn,$e,{add:function(t){return N(this,t,true)}},k,false,true)}();!function(){function t(t){var e=[],n;for(n in t)e.push(n);w(this,_,{o:t,a:e,i:0})}an(t,F,function(){var t=this[_],e=t.a,n;do{if(t.i>=e.length)return y(1)}while(!((n=e[t.i++])in t.o));return y(0,n)});function e(t){return function(e){E(e);try{return t.apply(r,arguments),true}catch(n){return false}}}function u(e,n){var i=arguments.length<3?e:arguments[2],t=U(E(e),n),o;if(t)return t.get?t.get.call(i):t.value;return l(o=fe(e))?u(o,n,i):r}function o(r,e,i){var n=arguments.length<4?r:arguments[3],t=U(E(r),e),u;if(t){if(t.writable===false)return false;if(t.set)return t.set.call(n,i),true}if(l(u=fe(r)))return o(u,e,i,n);t=U(n,e)||te(0);t.value=i;return m(n,e,t),true}var a={apply:f(Z,cn,3),construct:Fn,defineProperty:e(m),deleteProperty:function(t,e){var n=U(E(t),e);return n&&!n.configurable?false:delete t[e]},enumerate:function(e){return new t(E(e))},get:u,getOwnPropertyDescriptor:U,getPrototypeOf:fe,has:function(t,e){return e in t},isExtensible:i.isExtensible||function(t){return!!E(t)},ownKeys:en,preventExtensions:e(i.preventExtensions||An),set:o};if(ce)a.setPrototypeOf=function(t,e){return ce(E(t),e),true};n(j,{Reflect:{}});n(p,"Reflect",a)}();!function(){n(G,R,{includes:Yn(true)});n(G,ie,{at:Ce(true)});function t(t){return function(u){var o=M(u),n=Pe(u),r=n.length,e=0,i=O(r),f;if(t)while(r>e)i[e]=[f=n[e++],o[f]];else while(r>e)i[e]=o[n[e++]];return i}}n(p,F,{values:t(false),entries:t(true)});n(p,X,{escape:nn(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(t){he=k(t+"Get",true);var e=k(t+je,true),r=k(t+"Delete",true);n(p,N,{referenceGet:he,referenceSet:e,referenceDelete:r});o(ee,he,ye);function i(n){if(n){var t=n[u];o(t,he,t.get);o(t,e,t.set);o(t,r,t["delete"])}}i(De);i(We)}("reference");!function(e){function t(t,n){Q.call(Ge(t),function(t){if(t in a)e[t]=f(Z,a[t],n)})}t("pop,reverse,shift,keys,values,entries",1);t("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);t("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");n(p,R,e)}({})}(typeof self!="undefined"&&self.Math===Math?self:Function("return this")(),true)},{}],3:[function(e,t,n){(function(e){!function(g){"use strict";var r=Object.prototype.hasOwnProperty;var n;var v=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var p=typeof t==="object";var e=g.regeneratorRuntime;if(e){if(p){t.exports=e}return}e=g.regeneratorRuntime=p?t.exports:{};function x(t,e,n,r){return new y(t,e,n||null,r||[])}e.wrap=x;function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(r){return{type:"throw",arg:r}}}var s="suspendedStart";var c="suspendedYield";var d="executing";var f="completed";var a={};function o(){}function u(){}var i=u.prototype=y.prototype;o.prototype=i.constructor=u;u.constructor=o;o.displayName="GeneratorFunction";e.isGeneratorFunction=function(e){var t=typeof e==="function"&&e.constructor;return t?t===o||(t.displayName||t.name)==="GeneratorFunction":false};e.mark=function(t){t.__proto__=u;t.prototype=Object.create(i);return t};e.async=function(t,e,n,r){return new Promise(function(f,a){var i=x(t,e,n,r);var u=o.bind(i.next);var c=o.bind(i["throw"]);function o(n){var t=l(this,null,n);if(t.type==="throw"){a(t.arg);return}var e=t.arg;if(e.done){f(e.value)}else{Promise.resolve(e.value).then(u,c)}}u()})};function y(o,u,v,p){var r=u?Object.create(u.prototype):this;var t=new h(p);var e=s;function i(i,r){if(e===d){throw new Error("Generator is already running")}if(e===f){return b()}while(true){var h=t.delegate;if(h){var u=l(h.iterator[i],h.iterator,r);if(u.type==="throw"){t.delegate=null;i="throw";r=u.arg;continue}i="next";r=n;var p=u.arg;if(p.done){t[h.resultName]=p.value;t.next=h.nextLoc}else{e=c;return p}t.delegate=null}if(i==="next"){if(e===s&&typeof r!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(r)+" to newborn generator")}if(e===c){t.sent=r}else{delete t.sent}}else if(i==="throw"){if(e===s){e=f;throw r}if(t.dispatchException(r)){i="next";r=n}}else if(i==="return"){t.abrupt("return",r)}e=d;var u=l(o,v,t);if(u.type==="normal"){e=t.done?f:c;var p={value:u.arg,done:t.done};if(u.arg===a){if(t.delegate&&i==="next"){r=n}}else{return p}}else if(u.type==="throw"){e=f;if(i==="next"){t.dispatchException(u.arg)}else{r=u.arg}}}}r.next=i.bind(r,"next");r["throw"]=i.bind(r,"throw");r["return"]=i.bind(r,"return");return r}i[v]=function(){return this};i.toString=function(){return"[object Generator]"};function E(t){var e={tryLoc:t[0]};if(1 in t){e.catchLoc=t[1]}if(2 in t){e.finallyLoc=t[2]}this.tryEntries.push(e)}function w(e,n){var t=e.completion||{};t.type=n===0?"normal":"return";delete t.arg;e.completion=t}function h(t){this.tryEntries=[{tryLoc:"root"}];t.forEach(E,this);this.reset()}e.keys=function(e){var t=[];for(var n in e){t.push(n)}t.reverse();return function r(){while(t.length){var n=t.pop();if(n in e){r.value=n;r.done=false;return r}}r.done=true;return r}};function m(t){if(t){var i=t[v];if(i){return i.call(t)}if(typeof t.next==="function"){return t}if(!isNaN(t.length)){var e=-1,u=function o(){while(++e<t.length){if(r.call(t,e)){o.value=t[e];o.done=false;return o}}o.value=n;o.done=true;return o};return u.next=u}}return{next:b}}e.values=m;function b(){return{value:n,done:true}}h.prototype={constructor:h,reset:function(){this.prev=0;this.next=0;this.sent=n;this.done=false;this.delegate=null;this.tryEntries.forEach(w);for(var t=0,e;r.call(this,e="t"+t)||t<20;++t){this[e]=null}},stop:function(){this.done=true;var e=this.tryEntries[0];var t=e.completion;if(t.type==="throw"){throw t.arg}return this.rval},dispatchException:function(i){if(this.done){throw i}var a=this;function e(t,e){u.type="throw";u.arg=i;a.next=t;return!!e}for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];var u=t.completion;if(t.tryLoc==="root"){return e("end")}if(t.tryLoc<=this.prev){var o=r.call(t,"catchLoc");var f=r.call(t,"finallyLoc");if(o&&f){if(this.prev<t.catchLoc){return e(t.catchLoc,true)}else if(this.prev<t.finallyLoc){return e(t.finallyLoc)}}else if(o){if(this.prev<t.catchLoc){return e(t.catchLoc,true)}}else if(f){if(this.prev<t.finallyLoc){return e(t.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(n){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.tryLoc<=this.prev&&r.call(t,"finallyLoc")&&(t.finallyLoc===n||this.prev<t.finallyLoc)){return t}}},abrupt:function(n,r){var t=this._findFinallyEntry();var e=t?t.completion:{};e.type=n;e.arg=r;if(t){this.next=t.finallyLoc}else{this.complete(e)}return a},complete:function(t){if(t.type==="throw"){throw t.arg}if(t.type==="break"||t.type==="continue"){this.next=t.arg}else if(t.type==="return"){this.rval=t.arg;this.next="end"}return a},finish:function(t){var e=this._findFinallyEntry(t);return this.complete(e.completion)},"catch":function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e.tryLoc===r){var n=e.completion;if(n.type==="throw"){var i=n.arg;w(e,t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){this.delegate={iterator:m(t),resultName:e,nextLoc:n};return a}}}(typeof e==="object"?e:typeof window==="object"?window:this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]);

@@ -0,1 +1,3 @@

"use strict";
var transform = module.exports = require("./transformation/transform");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = File;

@@ -81,2 +83,6 @@

if (_.contains(opts.loose, "all")) {
opts.loose = Object.keys(transform.transformers);
}
// todo: remove in 3.0.0

@@ -329,3 +335,6 @@ _.each({

File.prototype.generateUidIdentifier = function (name, scope) {
return t.identifier(this.generateUid(name, scope));
scope = scope || this.scope;
var id = t.identifier(this.generateUid(name, scope));
scope.add(id);
return id;
};

@@ -332,0 +341,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = Buffer;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = function (ast, opts, code) {

@@ -2,0 +4,0 @@ var gen = new CodeGenerator(ast, opts, code);

@@ -0,1 +1,3 @@

"use strict";
exports.File = function (node, print) {

@@ -2,0 +4,0 @@ print(node.program);

@@ -0,1 +1,3 @@

"use strict";
exports.ClassExpression =

@@ -2,0 +4,0 @@ exports.ClassDeclaration = function (node, print) {

@@ -0,1 +1,3 @@

"use strict";
exports.ComprehensionBlock = function (node, print) {

@@ -2,0 +4,0 @@ this.keyword("for");

@@ -0,1 +1,3 @@

"use strict";
var util = require("../../util");

@@ -2,0 +4,0 @@ var t = require("../../types");

@@ -0,1 +1,3 @@

"use strict";
exports.AnyTypeAnnotation =

@@ -2,0 +4,0 @@ exports.ArrayTypeAnnotation =

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,1 +1,3 @@

"use strict";
var _ = require("lodash");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var util = require("../../util");

@@ -172,7 +174,9 @@ var t = require("../../types");

var noInits = 0;
for (var i = 0; i < node.declarations.length; i++) {
if (node.declarations[i].init) {
inits++;
} else {
noInits++;
if (!t.isFor(parent)) {
for (var i = 0; i < node.declarations.length; i++) {
if (node.declarations[i].init) {
inits++;
} else {
noInits++;
}
}

@@ -182,3 +186,3 @@ }

var sep = ",";
if (inits > noInits) { // more inits than noinits
if (inits > noInits) { // more inits than no inits so let's add a newline
sep += "\n" + util.repeat(node.kind.length + 1);

@@ -185,0 +189,0 @@ } else {

@@ -0,1 +1,3 @@

"use strict";
var _ = require("lodash");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var _ = require("lodash");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = Node;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,1 +1,3 @@

"use strict";
var _ = require("lodash");

@@ -2,0 +4,0 @@ var t = require("../../types");

@@ -0,1 +1,3 @@

"use strict";
module.exports = Position;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = SourceMap;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = Whitespace;

@@ -109,2 +111,2 @@

return lines;
};
};

@@ -0,1 +1,3 @@

"use strict";
var transform = require("./transformation/transform");

@@ -2,0 +4,0 @@ var util = require("./util");

@@ -0,1 +1,3 @@

"use strict";
var t = require("./types");

@@ -2,0 +4,0 @@ var _ = require("lodash");

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

"use strict";
require("core-js/shim");
require("regenerator/runtime");

@@ -0,1 +1,3 @@

"use strict";
// required to safely use 6to5/register within a browserify codebase

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
require("./polyfill");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var generator = require("./generation/generator");

@@ -2,0 +4,0 @@ var util = require("./util");

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -5,3 +7,21 @@ var util = require("../../util");

module.exports = function (node, file, scope) {
var traverser = {
enter: function (node, parent, scope, context, state) {
// check if this node is an identifier that matches the same as our function id
if (!t.isIdentifier(node, { name: state.id })) return;
// check if this node is the one referenced
if (!t.isReferenced(node, parent)) return;
// check that we don't have a local variable declared as that removes the need
// for the wrapper
var localDeclar = scope.get(state.id, true);
if (localDeclar !== state.outerDeclar) return;
state.selfReference = true;
context.stop();
}
};
exports.property = function (node, file, scope) {
var key = t.toComputedKey(node, node.key);

@@ -13,24 +33,11 @@ if (!t.isLiteral(key)) return node; // we can't set a function id with this

var selfReference = false;
var outerDeclar = scope.get(id, true);
var state = {
id: id,
selfReference: false,
outerDeclar: scope.get(id, true),
};
traverse(node, {
enter: function (node, parent, scope) {
// check if this node is an identifier that matches the same as our function id
if (!t.isIdentifier(node, { name: id })) return;
traverse(node, traverser, scope, state);
// check if this node is the one referenced
if (!t.isReferenced(node, parent)) return;
// check that we don't have a local variable declared as that removes the need
// for the wrapper
var localDeclar = scope.get(id, true);
if (localDeclar !== outerDeclar) return;
selfReference = true;
this.stop();
}
}, scope);
if (selfReference) {
if (state.selfReference) {
node.value = util.template("property-method-assignment-wrapper", {

@@ -37,0 +44,0 @@ FUNCTION: node.value,

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -9,4 +11,4 @@ var t = require("../../types");

traverse(node, {
enter: function (node) {
if (t.isFunction(node)) this.skip();
enter: function (node, parent, scope, context) {
if (t.isFunction(node)) context.skip();

@@ -13,0 +15,0 @@ if (t.isAwaitExpression(node)) {

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = DefaultFormatter;

@@ -19,15 +21,23 @@

var exportsTraverser = {
enter: function (node, parent, scope, context, localExports) {
var declar = node && node.declaration;
if (t.isExportDeclaration(node) && declar && t.isStatement(declar)) {
_.extend(localExports, t.getIds(declar, true));
}
}
};
DefaultFormatter.prototype.getLocalExports = function () {
var localExports = {};
traverse(this.file.ast, exportsTraverser, null, localExports);
return localExports;
};
traverse(this.file.ast, {
enter: function (node) {
var declar = node && node.declaration;
if (t.isExportDeclaration(node) && declar && t.isStatement(declar)) {
_.extend(localExports, t.getIds(declar, true));
}
var importsTraverser = {
enter: function (node, parent, scope, context, localImports) {
if (t.isImportDeclaration(node)) {
_.extend(localImports, t.getIds(node, true));
}
});
return localExports;
}
};

@@ -37,12 +47,20 @@

var localImports = {};
traverse(this.file.ast, importsTraverser, null, localImports);
return localImports;
};
traverse(this.file.ast, {
enter: function (node) {
if (t.isImportDeclaration(node)) {
_.extend(localImports, t.getIds(node, true));
var collissionsTraverser = {
enter: function (node, parent, scope, context, check) {
if (t.isAssignmentExpression(node)) {
var left = node.left;
if (t.isMemberExpression(left)) {
while (left.object) left = left.object;
}
check(left);
} else if (t.isDeclaration(node)) {
_.each(t.getIds(node, true), check);
}
});
return localImports;
}
};

@@ -66,17 +84,3 @@

traverse(file.ast, {
enter: function (node) {
if (t.isAssignmentExpression(node)) {
var left = node.left;
if (t.isMemberExpression(left)) {
while (left.object) left = left.object;
}
check(left);
} else if (t.isDeclaration(node)) {
_.each(t.getIds(node, true), check);
}
}
});
traverse(file.ast, collissionsTraverser, null, check);
};

@@ -106,5 +110,5 @@

traverse(this.file.ast, {
enter: function (node, parent, scope) {
enter: function (node, parent, scope, context, isLocalReference) {
if (t.isUpdateExpression(node) && isLocalReference(node.argument, scope)) {
this.skip();
context.skip();

@@ -137,7 +141,7 @@ // expand to long file assignment expression

if (t.isAssignmentExpression(node) && isLocalReference(node.left, scope)) {
this.skip();
context.skip();
return self.remapExportAssignment(node);
}
}
});
}, null, isLocalReference);
};

@@ -144,0 +148,0 @@

@@ -0,1 +1,3 @@

"use strict";
var util = require("../../util");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = require("./_strict")(require("./amd"));

@@ -0,1 +1,3 @@

"use strict";
module.exports = AMDFormatter;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = require("./_strict")(require("./common"));

@@ -0,1 +1,3 @@

"use strict";
module.exports = CommonJSFormatter;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = IgnoreFormatter;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = SystemFormatter;

@@ -66,11 +68,14 @@

return t.arrayExpression(_.map(this.ids, function (uid, source) {
var nodes = [];
var state = {
nodes: [],
hoistDeclarators: hoistDeclarators
};
traverse(block, {
enter: function (node) {
enter: function (node, parent, scope, context, state) {
if (node._importSource === source) {
if (t.isVariableDeclaration(node)) {
_.each(node.declarations, function (declar) {
hoistDeclarators.push(t.variableDeclarator(declar.id));
nodes.push(t.expressionStatement(
state.hoistDeclarators.push(t.variableDeclarator(declar.id));
state.nodes.push(t.expressionStatement(
t.assignmentExpression("=", declar.id, declar.init)

@@ -80,11 +85,11 @@ ));

} else {
nodes.push(node);
state.nodes.push(node);
}
this.remove();
context.remove();
}
}
});
}, null, state);
return t.functionExpression(null, [uid], t.blockStatement(nodes));
return t.functionExpression(null, [uid], t.blockStatement(state.nodes));
}));

@@ -117,6 +122,6 @@ };

traverse(block, {
enter: function (node, parent, scope) {
enter: function (node, parent, scope, context, hoistDeclarators) {
if (t.isFunction(node)) {
// nothing inside is accessible
return this.skip();
return context.skip();
}

@@ -156,3 +161,4 @@

}
});
}, null, hoistDeclarators);
if (hoistDeclarators.length) {

@@ -166,11 +172,11 @@ var hoistDeclar = t.variableDeclaration("var", hoistDeclarators);

traverse(block, {
enter: function (node) {
if (t.isFunction(node)) this.skip();
enter: function (node, parent, scope, context, handlerBody) {
if (t.isFunction(node)) context.skip();
if (t.isFunctionDeclaration(node) || node._blockHoist) {
handlerBody.push(node);
this.remove();
context.remove();
}
}
});
}, null, handlerBody);

@@ -177,0 +183,0 @@ handlerBody.push(returnStatement);

@@ -0,1 +1,3 @@

"use strict";
module.exports = require("./_strict")(require("./umd"));

@@ -0,1 +1,3 @@

"use strict";
module.exports = UMDFormatter;

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
module.exports = transform;

@@ -47,4 +49,6 @@

specSetters: require("./transformers/spec-setters"),
specBlockScopedFunctions: require("./transformers/spec-block-scoped-functions"),
// playground
malletOperator: require("./transformers/playground-mallet-operator"),
methodBinding: require("./transformers/playground-method-binding"),

@@ -51,0 +55,0 @@ memoizationOperator: require("./transformers/playground-memoization-operator"),

@@ -0,1 +1,3 @@

"use strict";
module.exports = Transformer;

@@ -7,2 +9,21 @@

function noop() { }
function enter(node, parent, scope, context, args) {
var fns = args[1][node.type];
if (!fns) return;
return fns.enter(node, parent, scope, context, args[0]);
}
function exit(node, parent, scope, context, args) {
var fns = args[1][node.type];
if (!fns) return;
return fns.exit(node, parent, scope, context, args[0]);
}
var traverseOpts = {
enter: enter,
exit: exit
};
function Transformer(key, transformer, opts) {

@@ -36,2 +57,5 @@ this.manipulateOptions = transformer.manipulateOptions;

if (!fns.enter) fns.enter = noop;
if (!fns.exit) fns.exit = noop;
transformer[type] = fns;

@@ -59,24 +83,4 @@

Transformer.prototype.transform = function (file) {
var transformer = this.transformer;
var build = function (exit) {
return function (node, parent, scope) {
var fns = transformer[node.type];
if (!fns) return;
var fn = fns.enter;
if (exit) fn = fns.exit;
if (!fn) return;
return fn.call(this, node, parent, file, scope);
};
};
this.astRun(file, "before");
traverse(file.ast, {
enter: build(),
exit: build(true)
});
traverse(file.ast, traverseOpts, null, [file, this.transformer]);
this.astRun(file, "after");

@@ -83,0 +87,0 @@ };

@@ -0,56 +1,63 @@

"use strict";
var traverse = require("../../traverse");
var t = require("../../types");
var go = function (getBody, node, file, scope) {
var argumentsId;
var thisId;
var functionChildrenTraverser = {
enter: function (node, parent, scope, context, state) {
if (t.isFunction(node) && !node._aliasFunction) {
return context.skip();
}
var getArgumentsId = function () {
return argumentsId = argumentsId || file.generateUidIdentifier("arguments", scope);
};
if (node._ignoreAliasFunctions) return context.skip();
var getThisId = function () {
return thisId = thisId || file.generateUidIdentifier("this", scope);
};
var getId;
// traverse the function and find all alias functions so we can alias
// `arguments` and `this` if necessary
traverse(node, {
enter: function (node) {
if (!node._aliasFunction) {
if (t.isFunction(node)) {
// stop traversal of this node as it'll be hit again by this transformer
return this.skip();
} else {
return;
}
}
if (t.isIdentifier(node) && node.name === "arguments") {
getId = state.getArgumentsId;
} else if (t.isThisExpression(node)) {
getId = state.getThisId;
} else {
return;
}
// traverse all child nodes of this function and find `arguments` and `this`
traverse(node, {
enter: function (node, parent) {
if (t.isFunction(node) && !node._aliasFunction) {
return this.skip();
}
if (t.isReferenced(node, parent)) return getId();
}
};
if (node._ignoreAliasFunctions) return this.skip();
var functionTraverser = {
enter: function (node, parent, scope, context, state) {
if (!node._aliasFunction) {
if (t.isFunction(node)) {
// stop traversal of this node as it'll be hit again by this transformer
return context.skip();
} else {
return;
}
}
var getId;
// traverse all child nodes of this function and find `arguments` and `this`
traverse(node, functionChildrenTraverser, null, state);
if (t.isIdentifier(node) && node.name === "arguments") {
getId = getArgumentsId;
} else if (t.isThisExpression(node)) {
getId = getThisId;
} else {
return;
}
return context.skip();
}
};
if (t.isReferenced(node, parent)) return getId();
}
});
var go = function (getBody, node, file, scope) {
var argumentsId;
var thisId;
return this.skip();
var state = {
getArgumentsId: function () {
return argumentsId = argumentsId || file.generateUidIdentifier("arguments", scope);
},
getThisId: function () {
return thisId = thisId || file.generateUidIdentifier("this", scope);
}
});
};
// traverse the function and find all alias functions so we can alias
// `arguments` and `this` if necessary
traverse(node, functionTraverser, null, state);
var body;

@@ -74,3 +81,3 @@

exports.Program = function (node, parent, file, scope) {
exports.Program = function (node, parent, scope, context, file) {
go(function () {

@@ -82,3 +89,3 @@ return node.body;

exports.FunctionDeclaration =
exports.FunctionExpression = function (node, parent, file, scope) {
exports.FunctionExpression = function (node, parent, scope, context, file) {
go(function () {

@@ -85,0 +92,0 @@ t.ensureBlock(node);

@@ -0,1 +1,3 @@

"use strict";
var useStrict = require("../helpers/use-strict");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,1 +1,3 @@

"use strict";
var useStrict = require("../helpers/use-strict");

@@ -2,0 +4,0 @@ var t = require("../../types");

@@ -0,1 +1,3 @@

"use strict";
var transform = require("../transform");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -1,11 +0,13 @@

var nameMethod = require("../helpers/name-method");
var traverse = require("../../traverse");
var util = require("../../util");
var t = require("../../types");
"use strict";
exports.ClassDeclaration = function (node, parent, file, scope) {
var ReplaceSupers = require("../helpers/replace-supers");
var nameMethod = require("../helpers/name-method");
var util = require("../../util");
var t = require("../../types");
exports.ClassDeclaration = function (node, parent, scope, context, file) {
return new Class(node, file, scope, true).run();
};
exports.ClassExpression = function (node, parent, file, scope) {
exports.ClassExpression = function (node, parent, scope, context, file) {
if (!node.id) {

@@ -138,3 +140,4 @@ if (t.isProperty(parent) && parent.value === node && !parent.computed && t.isIdentifier(parent.key)) {

if (t.isMethodDefinition(node)) {
this.replaceSuperReferences(node);
var replaceSupers = new ReplaceSupers(node, this.className, this.superName, this.isLoose, this.file);
replaceSupers.replace();

@@ -198,3 +201,3 @@ if (node.key.name === "constructor") {

if (kind === "") {
nameMethod(node, this.file, this.scope);
nameMethod.property(node, this.file, this.scope);

@@ -229,194 +232,2 @@ if (this.isLoose) {

/**
* Gets a node representing the super class value of the named property.
*
* @example
*
* _get(Object.getPrototypeOf(CLASS.prototype), "METHOD", this)
*
* @param {Node} property
* @param {boolean} isStatic
* @param {boolean} isComputed
*
* @returns {Node}
*/
Class.prototype.superProperty = function (property, isStatic, isComputed, thisExpression) {
return t.callExpression(
this.file.addHelper("get"),
[
t.callExpression(
t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")),
[
isStatic ? this.className : t.memberExpression(this.className, t.identifier("prototype"))
]
),
isComputed ? property : t.literal(property.name),
thisExpression
]
);
};
/**
* Description
*
* @param {Object} node
* @param {Object} id
* @param {Object} parent
* @returns {Object}
*/
Class.prototype.looseSuperProperty = function (methodNode, id, parent) {
var methodName = methodNode.key;
var superName = this.superName || t.identifier("Function");
if (parent.property === id) {
return;
} else if (t.isCallExpression(parent, { callee: id })) {
// super(); -> ClassName.prototype.MethodName.call(this);
parent.arguments.unshift(t.thisExpression());
if (methodName.name === "constructor") {
// constructor() { super(); }
return t.memberExpression(superName, t.identifier("call"));
} else {
id = superName;
// foo() { super(); }
if (!methodNode.static) {
id = t.memberExpression(id, t.identifier("prototype"));
}
id = t.memberExpression(id, methodName, methodNode.computed);
return t.memberExpression(id, t.identifier("call"));
}
} else if (t.isMemberExpression(parent) && !methodNode.static) {
// super.test -> ClassName.prototype.test
return t.memberExpression(superName, t.identifier("prototype"));
} else {
return superName;
}
};
/**
* Replace all `super` references with a reference to our `superClass`.
*
* @param {Node} methodNode MethodDefinition
*/
Class.prototype.replaceSuperReferences = function (methodNode) {
var method = methodNode.value;
var self = this;
var topLevelThisReference;
traverseLevel(method, true);
if (topLevelThisReference) {
method.body.body.unshift(t.variableDeclaration("var", [
t.variableDeclarator(topLevelThisReference, t.thisExpression())
]));
}
function traverseLevel(node, topLevel) {
traverse(node, {
enter: function (node, parent) {
if (t.isFunction(node) && !t.isArrowFunctionExpression(node)) {
// we need to call traverseLevel again so we're context aware
traverseLevel(node, false);
return this.skip();
}
if (t.isProperty(node, { method: true }) || t.isMethodDefinition(node)) {
// break on object methods
return this.skip();
}
var getThisReference = function () {
if (topLevel) {
// top level so `this` is the instance
return t.thisExpression();
} else {
// not in the top level so we need to create a reference
return topLevelThisReference = topLevelThisReference || self.file.generateUidIdentifier("this");
}
};
var callback = specHandle;
if (self.isLoose) callback = looseHandle;
return callback(getThisReference, node, parent);
}
});
}
function looseHandle(getThisReference, node, parent) {
if (t.isIdentifier(node, { name: "super" })) {
return self.looseSuperProperty(methodNode, node, parent);
} else if (t.isCallExpression(node)) {
var callee = node.callee;
if (!t.isMemberExpression(callee)) return;
if (callee.object.name !== "super") return;
// super.test(); -> ClassName.prototype.MethodName.call(this);
t.appendToMemberExpression(callee, t.identifier("call"));
node.arguments.unshift(getThisReference());
}
}
function specHandle(getThisReference, node, parent) {
var property;
var computed;
var args;
if (t.isIdentifier(node, { name: "super" })) {
if (!(t.isMemberExpression(parent) && !parent.computed && parent.property === node)) {
throw self.file.errorWithNode(node, "illegal use of bare super");
}
} else if (t.isCallExpression(node)) {
var callee = node.callee;
if (t.isIdentifier(callee, { name: "super" })) {
// super(); -> _get(Object.getPrototypeOf(ClassName), "MethodName", this).call(this);
property = methodNode.key;
computed = methodNode.computed;
args = node.arguments;
} else {
if (!t.isMemberExpression(callee)) return;
if (callee.object.name !== "super") return;
// super.test(); -> _get(Object.getPrototypeOf(ClassName.prototype), "test", this).call(this);
property = callee.property;
computed = callee.computed;
args = node.arguments;
}
} else if (t.isMemberExpression(node)) {
if (!t.isIdentifier(node.object, { name: "super" })) return;
// super.name; -> _get(Object.getPrototypeOf(ClassName.prototype), "name", this);
property = node.property;
computed = node.computed;
}
if (!property) return;
var thisReference = getThisReference();
var superProperty = self.superProperty(property, methodNode.static, computed, thisReference);
if (args) {
if (args.length === 1 && t.isSpreadElement(args[0])) {
// super(...arguments);
return t.callExpression(
t.memberExpression(superProperty, t.identifier("apply")),
[thisReference, args[0].argument]
);
} else {
return t.callExpression(
t.memberExpression(superProperty, t.identifier("call")),
[thisReference].concat(args)
);
}
} else {
return superProperty;
}
}
};
/**
* Replace the constructor body of our class.

@@ -423,0 +234,0 @@ *

@@ -0,4 +1,6 @@

"use strict";
var t = require("../../types");
exports.ObjectExpression = function (node, parent, file, scope) {
exports.ObjectExpression = function (node, parent, scope, context, file) {
var hasComputed = false;

@@ -5,0 +7,0 @@

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -9,3 +11,3 @@ var t = require("../../types");

exports.ForOfStatement =
exports.ForStatement = function (node, parent, file) {
exports.ForStatement = function (node, parent, scope, context, file) {
var hasConstants = false;

@@ -73,4 +75,9 @@ var constants = {};

var state = {
check: check,
getIds: getIds
};
traverse(node, {
enter: function (child, parent, scope) {
enter: function (child, parent, scope, context, state) {
if (child._ignoreConstant) return;

@@ -80,6 +87,6 @@ if (t.isVariableDeclaration(child)) return;

if (t.isVariableDeclarator(child) || t.isDeclaration(child) || t.isAssignmentExpression(child)) {
check(parent, getIds(child), scope);
state.check(parent, state.getIds(child), scope);
}
}
});
}, null, state);
};

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -5,3 +7,3 @@ var util = require("../../util");

exports.Function = function (node, parent, file, scope) {
exports.Function = function (node, parent, scope, context, file) {
if (!node.defaults || !node.defaults.length) return;

@@ -8,0 +10,0 @@ t.ensureBlock(node);

@@ -0,1 +1,3 @@

"use strict";
// TODO: Clean up

@@ -10,3 +12,3 @@

if (op) {
return t.expressionStatement(t.assignmentExpression("=", id, init));
return t.expressionStatement(t.assignmentExpression(op, id, init));
} else {

@@ -152,3 +154,3 @@ return t.variableDeclaration(opts.kind, [

exports.ForInStatement =
exports.ForOfStatement = function (node, parent, file, scope) {
exports.ForOfStatement = function (node, parent, scope, context, file) {
var declar = node.left;

@@ -179,3 +181,3 @@ if (!t.isVariableDeclaration(declar)) return;

exports.Function = function (node, parent, file, scope) {
exports.Function = function (node, parent, scope, context, file) {
var nodes = [];

@@ -211,3 +213,3 @@

exports.CatchClause = function (node, parent, file, scope) {
exports.CatchClause = function (node, parent, scope, context, file) {
var pattern = node.param;

@@ -230,3 +232,3 @@ if (!t.isPattern(pattern)) return;

exports.ExpressionStatement = function (node, parent, file, scope) {
exports.ExpressionStatement = function (node, parent, scope, context, file) {
var expr = node.expression;

@@ -253,10 +255,9 @@ if (expr.type !== "AssignmentExpression") return;

exports.AssignmentExpression = function (node, parent, file, scope) {
exports.AssignmentExpression = function (node, parent, scope, context, file) {
if (parent.type === "ExpressionStatement") return;
if (!t.isPattern(node.left)) return;
var tempName = file.generateUid("temp", scope);
var ref = t.identifier(tempName);
var ref = file.generateUidIdentifier("temp", scope);
scope.push({
key: tempName,
key: ref.name,
id: ref

@@ -279,3 +280,3 @@ });

exports.VariableDeclaration = function (node, parent, file, scope) {
exports.VariableDeclaration = function (node, parent, scope, context, file) {
if (t.isForInStatement(parent) || t.isForOfStatement(parent)) return;

@@ -282,0 +283,0 @@

@@ -0,9 +1,11 @@

"use strict";
var util = require("../../util");
var t = require("../../types");
exports.ForOfStatement = function (node, parent, file, scope) {
exports.ForOfStatement = function (node, parent, scope, context, file) {
var callback = spec;
if (file.isLoose("forOf")) callback = loose;
var build = callback(node, parent, file, scope);
var build = callback(node, parent, scope, context, file);
var declar = build.declar;

@@ -34,3 +36,3 @@ var loop = build.loop;

var loose = function (node, parent, file, scope) {
var loose = function (node, parent, scope, context, file) {
var left = node.left;

@@ -67,3 +69,3 @@ var declar, id;

var spec = function (node, parent, file, scope) {
var spec = function (node, parent, scope, context, file) {
var left = node.left;

@@ -70,0 +72,0 @@ var declar;

@@ -0,1 +1,3 @@

"use strict";
var regenerator = require("regenerator");

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -37,3 +39,3 @@ var util = require("../../util");

exports.Loop = function (node, parent, file, scope) {
exports.Loop = function (node, parent, scope, context, file) {
var init = node.left || node.init;

@@ -50,3 +52,3 @@ if (isLet(init, node)) {

var letScoping = new LetScoping(node, node.body, parent, file, scope);
var letScoping = new LetScoping(node, node.body, parent, scope, file);
letScoping.run();

@@ -60,5 +62,5 @@

exports.BlockStatement = function (block, parent, file, scope) {
exports.BlockStatement = function (block, parent, scope, context, file) {
if (!t.isLoop(parent)) {
var letScoping = new LetScoping(false, block, parent, file, scope);
var letScoping = new LetScoping(false, block, parent, scope, file);
letScoping.run();

@@ -74,7 +76,7 @@ }

* @param {Node} parent
* @param {Scope} scope
* @param {File} file
* @param {Scope} scope
*/
function LetScoping(loopParent, block, parent, file, scope) {
function LetScoping(loopParent, block, parent, scope, file) {
this.loopParent = loopParent;

@@ -86,4 +88,5 @@ this.parent = parent;

this.letReferences = {};
this.body = [];
this.outsideLetReferences = {};
this.letReferences = {};
this.body = [];
}

@@ -97,24 +100,88 @@

var block = this.block;
if (block._letDone) return;
block._letDone = true;
this.info = this.getInfo();
// this is a block within a `Function` so we can safely leave it be
if (t.isFunction(this.parent)) return;
// remap all let references that exist in upper scopes to their uid
this.remap();
var needsClosure = this.getLetReferences();
if (needsClosure) {
this.needsClosure();
} else {
this.remap();
}
};
// this is a block within a `Function` so we can safely leave it be
if (t.isFunction(this.parent)) return this.noClosure();
/**
* Description
*/
// this block has no let references so let's clean up
if (!this.info.keys.length) return this.noClosure();
LetScoping.prototype.remap = function () {
var letRefs = this.letReferences;
var scope = this.scope;
var file = this.file;
// returns whether or not there are any outside let references within any
// functions
var referencesInClosure = this.getLetReferences();
// alright, so since we aren't wrapping this block in a closure
// we have to check if any of our let variables collide with
// those in upper scopes and then if they do, generate a uid
// for them and replace all references with it
var remaps = {};
// no need for a closure so let's clean up
if (!referencesInClosure) return this.noClosure();
for (var key in letRefs) {
// just an Identifier node we collected in `getLetReferences`
// this is the defining identifier of a declaration
var ref = letRefs[key];
if (scope.parentHas(key)) {
var uid = file.generateUidIdentifier(ref.name, scope).name;
ref.name = uid;
remaps[key] = {
node: ref,
uid: uid
};
}
}
//
var replace = function (node, parent, scope, context, remaps) {
if (!t.isIdentifier(node)) return;
if (!t.isReferenced(node, parent)) return;
var remap = remaps[node.name];
if (!remap) return;
var own = scope.get(node.name, true);
if (own === remap.node) {
node.name = remap.uid;
} else {
// scope already has it's own declaration that doesn't
// match the one we have a stored replacement for
if (context) context.skip();
}
};
var traverseReplace = function (node, parent) {
replace(node, parent, scope, null, remaps);
traverse(node, { enter: replace }, scope, remaps);
};
var loopParent = this.loopParent;
if (loopParent) {
traverseReplace(loopParent.right, loopParent);
traverseReplace(loopParent.test, loopParent);
traverseReplace(loopParent.update, loopParent);
}
traverse(this.block, { enter: replace }, scope, remaps);
};
/**
* Description
*/
LetScoping.prototype.needsClosure = function () {
var block = this.block;
// if we're inside of a for loop then we search to see if there are any

@@ -127,10 +194,7 @@ // `break`s, `continue`s, `return`s etc

// set let references to plain var references
standardiseLets(this.info.declarators);
// turn outsideLetReferences into an array
var params = _.values(this.outsideLetReferences);
// turn letReferences into an array
var letReferences = _.values(this.letReferences);
// build the closure that we're going to wrap the block with
var fn = t.functionExpression(null, letReferences, t.blockStatement(block.body));
var fn = t.functionExpression(null, params, t.blockStatement(block.body));
fn._aliasFunction = true;

@@ -141,5 +205,2 @@

// change upper scope references with their uid if they have one
var params = this.getParams(letReferences);
// build a call and a unique id that we can assign the return value to

@@ -159,112 +220,72 @@ var call = t.callExpression(fn, params);

/**
* There are no let references accessed within a closure so we can just turn the
* lets into vars.
*/
LetScoping.prototype.noClosure = function () {
standardiseLets(this.info.declarators);
};
/**
* Traverse through block and replace all references that exist in a higher
* scope to their uids.
*/
LetScoping.prototype.remap = function () {
var replacements = this.info.duplicates;
var block = this.block;
if (!this.info.hasDuplicates) return;
var replace = function (node, parent, scope) {
if (!t.isIdentifier(node)) return;
if (!t.isReferenced(node, parent)) return;
if (scope && scope.hasOwn(node.name)) return;
node.name = replacements[node.name] || node.name;
};
var traverseReplace = function (node, parent) {
replace(node, parent);
traverse(node, { enter: replace });
};
var loopParent = this.loopParent;
if (loopParent) {
traverseReplace(loopParent.right, loopParent);
traverseReplace(loopParent.test, loopParent);
traverseReplace(loopParent.update, loopParent);
}
traverse(block, { enter: replace });
};
/**
* Description
*
* @returns {Object}
*/
LetScoping.prototype.getInfo = function () {
LetScoping.prototype.getLetReferences = function () {
var block = this.block;
var scope = this.scope;
var file = this.file;
var opts = {
// array of `Identifier` names of let variables that appear lexically out of
// this scope but should be accessible - eg. `ForOfStatement`.left
outsideKeys: [],
var declarators = block._letDeclars || [];
var declar;
// array of let `VariableDeclarator`s that are a part of this block
declarators: block._letDeclars || [],
//
for (var i = 0; i < declarators.length; i++) {
declar = declarators[i];
_.extend(this.outsideLetReferences, t.getIds(declar, true));
}
// object of duplicate ids and their aliases - if there's an `Identifier`
// name that's used in an upper scope we generate a unique id and replace
// all references with it
duplicates: {},
//
if (block.body) {
for (i = 0; i < block.body.length; i++) {
declar = block.body[i];
if (isLet(declar, block)) {
declarators = declarators.concat(declar.declarations);
}
}
}
hasDuplicates: false,
//
for (i = 0; i < declarators.length; i++) {
declar = declarators[i];
var keys = t.getIds(declar, true);
_.extend(this.letReferences, keys);
}
// array of `Identifier` names of let variables that are accessible within
// the current block
keys: []
};
// set let references to plain var references
standardiseLets(declarators);
var duplicates = function (id, key) {
var has = scope.parentGet(key);
if (has && has !== id) {
// there's a variable with this exact name in an upper scope so we need
// to generate a new name
opts.duplicates[key] = id.name = file.generateUid(key, scope);
opts.hasDuplicates = true;
}
var state = {
letReferences: this.letReferences,
closurify: false
};
var declar;
// traverse through this block, stopping on functions and checking if they
// contain any local let references
traverse(this.block, {
enter: function (node, parent, scope, context, state) {
if (t.isFunction(node)) {
traverse(node, {
enter: function (node, parent) {
// not an identifier so we have no use
if (!t.isIdentifier(node)) return;
for (var i = 0; i < opts.declarators.length; i++) {
declar = opts.declarators[i];
// not a direct reference
if (!t.isReferenced(node, parent)) return;
var keys = t.getIds(declar, true);
_.each(keys, duplicates);
keys = Object.keys(keys);
// this scope has a variable with the same name so it couldn't belong
// to our let scope
if (scope.hasOwn(node.name, true)) return;
opts.outsideKeys = opts.outsideKeys.concat(keys);
opts.keys = opts.keys.concat(keys);
}
// not a part of our scope
if (!state.letReferences[node.name]) return;
if (block.body) {
for (i = 0; i < block.body.length; i++) {
declar = block.body[i];
if (!isLet(declar, block)) continue;
state.closurify = true;
}
}, scope, state);
var declars = t.getIds(declar, true);
for (var key in declars) {
duplicates(declars[key], key);
opts.keys.push(key);
return context.skip();
}
}
}
}, this.scope, state);
return opts;
return state.closurify;
};

@@ -289,7 +310,7 @@

traverse(this.block, {
enter: function (node, parent) {
enter: function (node, parent, scope, context) {
var replace;
if (t.isFunction(node) || t.isLoop(node)) {
return this.skip();
return context.skip();
}

@@ -318,3 +339,3 @@

}
});
}, this.scope, has);

@@ -330,5 +351,4 @@ return has;

LetScoping.prototype.hoistVarDeclarations = function () {
var self = this;
traverse(this.block, {
enter: function (node, parent) {
enter: function (node, parent, scope, context, self) {
if (t.isForStatement(node)) {

@@ -345,70 +365,9 @@ if (isVar(node.init, node)) {

} else if (t.isFunction(node)) {
return this.skip();
return context.skip();
}
}
});
}, this.scope, this);
};
/**
* Build up a parameter list that we'll call our closure wrapper with, replacing
* all duplicate ids with their uid.
*
* @param {Array} params
* @returns {Array}
*/
LetScoping.prototype.getParams = function (params) {
var info = this.info;
params = _.cloneDeep(params);
_.each(params, function (param) {
param.name = info.duplicates[param.name] || param.name;
});
return params;
};
/**
* Get all let references within this block. Stopping whenever we reach another
* block.
*/
LetScoping.prototype.getLetReferences = function () {
var closurify = false;
var self = this;
// traverse through this block, stopping on functions and checking if they
// contain any outside let references
traverse(this.block, {
enter: function (node, parent, scope) {
if (t.isFunction(node)) {
traverse(node, {
enter: function (node, parent) {
// not an identifier so we have no use
if (!t.isIdentifier(node)) return;
// not a direct reference
if (!t.isReferenced(node, parent)) return;
// this scope has a variable with the same name so it couldn't belong
// to our let scope
if (scope.hasOwn(node.name, true)) return;
closurify = true;
// this key doesn't appear just outside our scope
if (!_.contains(self.info.outsideKeys, node.name)) return;
// push this badboy
self.letReferences[node.name] = node;
}
});
return this.skip();
}
}
});
return closurify;
};
/**
* Turn a `VariableDeclaration` into an array of `AssignmentExpressions` with

@@ -415,0 +374,0 @@ * their declarations hoisted to before the closure wrapper.

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -9,3 +11,3 @@

exports.ImportDeclaration = function (node, parent, file) {
exports.ImportDeclaration = function (node, parent, scope, context, file) {
var nodes = [];

@@ -30,3 +32,3 @@

exports.ExportDeclaration = function (node, parent, file) {
exports.ExportDeclaration = function (node, parent, scope, context, file) {
var nodes = [];

@@ -33,0 +35,0 @@

@@ -0,1 +1,3 @@

"use strict";
var nameMethod = require("../helpers/name-method");

@@ -5,3 +7,3 @@ var util = require("../../util");

exports.Property = function (node, parent, file, scope) {
exports.Property = function (node, parent, scope, context, file) {
if (!node.method) return;

@@ -11,3 +13,3 @@

nameMethod(node, file, scope);
nameMethod.property(node, file, scope);
};

@@ -14,0 +16,0 @@

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,9 +1,11 @@

"use strict";
var util = require("../../util");
var t = require("../../types");
exports.Function = function (node, parent, file) {
exports.Function = function (node, parent, scope, context, file) {
if (!node.rest) return;
var rest = node.rest;
delete node.rest;
node.rest = null;

@@ -30,5 +32,7 @@ t.ensureBlock(node);

// we need to work out the size of the array that we're
// going to store all the rest parameters in, if there
// are less arguments than params then the array can be
// constructed with <1 which will cause an error
// going to store all the rest parameters
//
// we need to add a check to avoid constructing the array
// with <0 if there are less arguments than params as it'll
// cause an error
arrLen = t.conditionalExpression(

@@ -35,0 +39,0 @@ t.binaryExpression(">", len, start),

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -43,3 +45,3 @@ var _ = require("lodash");

exports.ArrayExpression = function (node, parent, file) {
exports.ArrayExpression = function (node, parent, scope, context, file) {
var elements = node.elements;

@@ -59,3 +61,3 @@ if (!hasSpread(elements)) return;

exports.CallExpression = function (node, parent, file, scope) {
exports.CallExpression = function (node, parent, scope, context, file) {
var args = node.arguments;

@@ -100,3 +102,3 @@ if (!hasSpread(args)) return;

exports.NewExpression = function (node, parent, file) {
exports.NewExpression = function (node, parent, scope, context, file) {
var args = node.arguments;

@@ -103,0 +105,0 @@ if (!hasSpread(args)) return;

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -7,3 +9,3 @@

exports.TaggedTemplateExpression = function (node, parent, file) {
exports.TaggedTemplateExpression = function (node, parent, scope, context, file) {
var args = [];

@@ -10,0 +12,0 @@ var quasi = node.quasi;

@@ -0,1 +1,3 @@

"use strict";
var rewritePattern = require("regexpu/rewrite-pattern");

@@ -2,0 +4,0 @@ var _ = require("lodash");

@@ -0,1 +1,3 @@

"use strict";
// https://github.com/zenparsing/es-abstract-refs

@@ -24,3 +26,3 @@

exports.AssignmentExpression = function (node, parent, file, scope) {
exports.AssignmentExpression = function (node, parent, scope, context, file) {
var left = node.left;

@@ -78,3 +80,3 @@ if (!t.isVirtualPropertyExpression(left)) return;

exports.CallExpression = function (node, parent, file, scope) {
exports.CallExpression = function (node, parent, scope, context, file) {
var callee = node.callee;

@@ -81,0 +83,0 @@ if (!t.isVirtualPropertyExpression(callee)) return;

@@ -0,1 +1,3 @@

"use strict";
var buildComprehension = require("../helpers/build-comprehension");

@@ -8,3 +10,3 @@ var traverse = require("../../traverse");

var build = function (node, parent, file, scope) {
var build = function (node, parent, scope, context, file) {
var uid = scope.generateUidBasedOnNode(parent, file);

@@ -38,6 +40,6 @@

exports.ComprehensionExpression = function (node, parent, file, scope) {
exports.ComprehensionExpression = function (node, parent, scope, context, file) {
if (node.generator) return;
return build(node, parent, file, scope);
return build(node, parent, scope, context, file);
};

@@ -0,1 +1,3 @@

"use strict";
// https://github.com/rwaldron/exponentiation-operator

@@ -5,15 +7,13 @@

var t = require("../../types");
var pow = t.memberExpression(t.identifier("Math"), t.identifier("pow"));
var build = require("../helpers/build-binary-assignment-operator-transformer");
var t = require("../../types");
exports.AssignmentExpression = function (node) {
if (node.operator !== "**=") return;
node.operator = "=";
node.right = t.callExpression(pow, [node.left, node.right]);
};
var MATH_POW = t.memberExpression(t.identifier("Math"), t.identifier("pow"));
exports.BinaryExpression = function (node) {
if (node.operator !== "**") return;
build(exports, {
operator: "**",
return t.callExpression(pow, [node.left, node.right]);
};
build: function (left, right) {
return t.callExpression(MATH_POW, [left, right]);
}
});

@@ -0,1 +1,3 @@

"use strict";
var buildComprehension = require("../helpers/build-comprehension");

@@ -2,0 +4,0 @@ var t = require("../../types");

@@ -0,1 +1,3 @@

"use strict";
// https://github.com/sebmarkbage/ecmascript-rest-spread

@@ -7,3 +9,3 @@

exports.ObjectExpression = function (node, parent, file) {
exports.ObjectExpression = function (node, parent, scope, context, file) {
var hasSpread = false;

@@ -10,0 +12,0 @@ var i;

@@ -0,1 +1,3 @@

"use strict";
var remapAsyncToGenerator = require("../helpers/remap-async-to-generator");

@@ -8,3 +10,3 @@ var bluebirdCoroutines = require("./optional-bluebird-coroutines");

exports.Function = function (node, parent, file) {
exports.Function = function (node, parent, scope, context, file) {
if (!node.async || node.generator) return;

@@ -11,0 +13,0 @@

@@ -0,1 +1,3 @@

"use strict";
var remapAsyncToGenerator = require("../helpers/remap-async-to-generator");

@@ -12,3 +14,3 @@ var t = require("../../types");

exports.Function = function (node, parent, file) {
exports.Function = function (node, parent, scope, context, file) {
if (!node.async || node.generator) return;

@@ -15,0 +17,0 @@

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -29,3 +31,3 @@ var util = require("../../util");

traverse(ast, {
enter: function (node, parent) {
enter: function (node, parent, scope, context) {
var prop;

@@ -41,3 +43,3 @@

if (!node.computed && coreHas(obj) && _.has(core[obj.name], prop.name)) {
this.skip();
context.skip();
return t.prependToMemberExpression(node, file._coreId);

@@ -44,0 +46,0 @@ }

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -20,3 +22,3 @@ var _ = require("lodash");

exports.AssignmentExpression = function (node, parent, file, scope) {
exports.AssignmentExpression = function (node, parent, scope, context, file) {
if (t.isExpressionStatement(parent)) return;

@@ -36,3 +38,3 @@ if (!isProtoAssignmentExpression(node)) return;

exports.ExpressionStatement = function (node, parent, file) {
exports.ExpressionStatement = function (node, parent, scope, context, file) {
var expr = node.expression;

@@ -46,3 +48,3 @@ if (!t.isAssignmentExpression(expr, { operator: "=" })) return;

exports.ObjectExpression = function (node, parent, file) {
exports.ObjectExpression = function (node, parent, scope, context, file) {
var proto;

@@ -49,0 +51,0 @@

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -5,4 +7,4 @@

exports.UnaryExpression = function (node, parent, file) {
this.skip();
exports.UnaryExpression = function (node, parent, scope, context, file) {
context.skip();

@@ -9,0 +11,0 @@ if (node.operator === "typeof") {

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -1,88 +0,23 @@

var t = require("../../types");
"use strict";
var isMemo = function (node) {
var is = t.isAssignmentExpression(node) && node.operator === "?=";
if (is) t.assertMemberExpression(node.left);
return is;
};
var build = require("../helpers/build-conditional-assignment-operator-transformer");
var t = require("../../types");
var getPropRef = function (nodes, member, file, scope) {
var prop = member.property;
var key = t.toComputedKey(member, member.property);
if (t.isLiteral(key)) {
return key;
} else {
var temp = scope.generateUidBasedOnNode(prop, file);
nodes.push(t.variableDeclaration("var", [
t.variableDeclarator(temp, prop)
]));
return temp;
build(exports, {
is: function (node) {
var is = t.isAssignmentExpression(node) && node.operator === "?=";
if (is) t.assertMemberExpression(node.left);
return is;
},
build: function (node, file) {
return t.unaryExpression(
"!",
t.callExpression(
t.memberExpression(file.addHelper("has-own"), t.identifier("call")),
[node.object, node.property]
),
true
);
}
};
var getObjRef = function (nodes, obj, file, scope) {
var temp = scope.generateUidBasedOnNode(obj, file);
nodes.push(t.variableDeclaration("var", [
t.variableDeclarator(temp, obj)
]));
return temp;
};
var buildHasOwn = function (obj, prop, file) {
return t.unaryExpression(
"!",
t.callExpression(
t.memberExpression(file.addHelper("has-own"), t.identifier("call")),
[obj, prop]
),
true
);
};
var buildAbsoluteRef = function (left, obj, prop) {
var computed = left.computed || t.isLiteral(prop);
return t.memberExpression(obj, prop, computed);
};
var buildAssignment = function (expr, obj, prop) {
return t.assignmentExpression("=", buildAbsoluteRef(expr.left, obj, prop), expr.right);
};
exports.ExpressionStatement = function (node, parent, file, scope) {
var expr = node.expression;
if (!isMemo(expr)) return;
var nodes = [];
var left = expr.left;
var obj = getObjRef(nodes, left.object, file, scope);
var prop = getPropRef(nodes, left, file, scope);
nodes.push(t.ifStatement(
buildHasOwn(obj, prop, file),
t.expressionStatement(buildAssignment(expr, obj, prop))
));
return nodes;
};
exports.AssignmentExpression = function (node, parent, file, scope) {
if (t.isExpressionStatement(parent)) return;
if (!isMemo(node)) return;
var nodes = [];
var left = node.left;
var obj = getObjRef(nodes, left.object, file, scope);
var prop = getPropRef(nodes, left, file, scope);
nodes.push(t.logicalExpression(
"&&",
buildHasOwn(obj, prop, file),
buildAssignment(node, obj, prop)
));
nodes.push(buildAbsoluteRef(left, obj, prop));
return t.toSequenceExpression(nodes, scope);
};
});

@@ -0,4 +1,6 @@

"use strict";
var t = require("../../types");
exports.BindMemberExpression = function (node, parent, file, scope) {
exports.BindMemberExpression = function (node, parent, scope, context, file) {
var object = node.object;

@@ -25,3 +27,3 @@ var prop = node.property;

exports.BindFunctionExpression = function (node, parent, file, scope) {
exports.BindFunctionExpression = function (node, parent, scope, context, file) {
var buildCall = function (args) {

@@ -28,0 +30,0 @@ var param = file.generateUidIdentifier("val", scope);

@@ -0,1 +1,3 @@

"use strict";
var traverse = require("../../traverse");

@@ -5,3 +7,3 @@ var t = require("../../types");

exports.Property =
exports.MethodDefinition = function (node, parent, file) {
exports.MethodDefinition = function (node, parent, scope, context, file) {
if (node.kind !== "memo") return;

@@ -8,0 +10,0 @@ node.kind = "get";

@@ -0,1 +1,3 @@

"use strict";
// Based upon the excellent jsx-transpiler by Ingvar Stepanyan (RReverser)

@@ -18,3 +20,3 @@ // https://github.com/RReverser/jsx-transpiler

exports.XJSNamespacedName = function (node, parent, file) {
exports.XJSNamespacedName = function (node, parent, scope, context, file) {
throw file.errorWithNode(node, "Namespace tags are not supported. ReactJSX is not XML.");

@@ -41,8 +43,8 @@ };

var isTag = function(tagName) {
return (/^[a-z]|\-/).test(tagName);
var isCompatTag = function(tagName) {
return /^[a-z]|\-/.test(tagName);
};
exports.XJSOpeningElement = {
exit: function (node, parent, file) {
exit: function (node, parent, scope, context, file) {
var reactCompat = file.opts.reactCompat;

@@ -60,3 +62,3 @@ var tagExpr = node.name;

if (!reactCompat) {
if (tagName && isTag(tagName)) {
if (tagName && isCompatTag(tagName)) {
args.push(t.literal(tagName));

@@ -70,44 +72,3 @@ } else {

if (attribs.length) {
var _props = [];
var objs = [];
// so basically in order to support spread elements we
// loop over all the attributes, breaking on spreads
// we then push a new object containing all prior attributes
// to an array for later processing
var pushProps = function () {
if (!_props.length) return;
objs.push(t.objectExpression(_props));
_props = [];
};
while (attribs.length) {
var prop = attribs.shift();
if (t.isXJSSpreadAttribute(prop)) {
pushProps();
objs.push(prop.argument);
} else {
_props.push(prop);
}
}
pushProps();
if (objs.length === 1) {
// only one object
attribs = objs[0];
} else {
// looks like we have multiple objects
if (!t.isObjectExpression(objs[0])) {
objs.unshift(t.objectExpression([]));
}
// spread it
attribs = t.callExpression(
t.memberExpression(t.identifier("React"), t.identifier("__spread")),
objs
);
}
attribs = buildXJSOpeningElementAttributes(attribs);
} else {

@@ -120,3 +81,3 @@ attribs = t.literal(null);

if (reactCompat) {
if (tagName && isTag(tagName)) {
if (tagName && isCompatTag(tagName)) {
return t.callExpression(

@@ -139,36 +100,60 @@ t.memberExpression(

exports.XJSElement = {
exit: function (node) {
var callExpr = node.openingElement;
/**
* The logic for this is quite terse. It's because we need to
* support spread elements. We loop over all attributes,
* breaking on spreads, we then push a new object containg
* all prior attributes to an array for later processing.
*/
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
var buildXJSOpeningElementAttributes = function (attribs) {
var _props = [];
var objs = [];
if (t.isLiteral(child) && _.isString(child.value)) {
var lines = child.value.split(/\r\n|\n|\r/);
var pushProps = function () {
if (!_props.length) return;
for (var i2 = 0; i2 < lines.length; i2++) {
var line = lines[i2];
objs.push(t.objectExpression(_props));
_props = [];
};
var isFirstLine = i2 === 0;
var isLastLine = i2 === lines.length - 1;
while (attribs.length) {
var prop = attribs.shift();
if (t.isXJSSpreadAttribute(prop)) {
pushProps();
objs.push(prop.argument);
} else {
_props.push(prop);
}
}
// replace rendered whitespace tabs with spaces
var trimmedLine = line.replace(/\t/g, " ");
pushProps();
// trim whitespace touching a newline
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
}
if (objs.length === 1) {
// only one object
attribs = objs[0];
} else {
// looks like we have multiple objects
if (!t.isObjectExpression(objs[0])) {
objs.unshift(t.objectExpression([]));
}
// trim whitespace touching an endline
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
}
// spread it
attribs = t.callExpression(
t.memberExpression(t.identifier("React"), t.identifier("__spread")),
objs
);
}
if (trimmedLine) {
callExpr.arguments.push(t.literal(trimmedLine));
}
}
return attribs;
};
exports.XJSElement = {
exit: function (node) {
var callExpr = node.openingElement;
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
if (t.isLiteral(child) && _.isString(child.value)) {
cleanXJSElementLiteralChild(child, callExpr.arguments);
continue;

@@ -190,31 +175,65 @@ } else if (t.isXJSEmptyExpression(child)) {

var cleanXJSElementLiteralChild = function (child, args) {
var lines = child.value.split(/\r\n|\n|\r/);
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var isFirstLine = i === 0;
var isLastLine = i === lines.length - 1;
// replace rendered whitespace tabs with spaces
var trimmedLine = line.replace(/\t/g, " ");
// trim whitespace touching a newline
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
}
// trim whitespace touching an endline
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
}
if (trimmedLine) {
args.push(t.literal(trimmedLine));
}
}
};
// display names
var addDisplayName = function (id, call) {
if (!call || !t.isCallExpression(call)) return;
var isCreateClass = function (call) {
if (!call || !t.isCallExpression(call)) return false;
var callee = call.callee;
if (!t.isMemberExpression(callee)) return;
if (!t.isMemberExpression(callee)) return false;
// not React
// not React call member object
var obj = callee.object;
if (!t.isIdentifier(obj, { name: "React" })) return;
if (!t.isIdentifier(obj, { name: "React" })) return false;
// not createClass
// not createClass call member property
var prop = callee.property;
if (!t.isIdentifier(prop, { name: "createClass" })) return;
if (!t.isIdentifier(prop, { name: "createClass" })) return false;
// no arguments
// no call arguments
var args = call.arguments;
if (args.length !== 1) return;
if (args.length !== 1) return false;
// not an object
// first call arg is not an object
var first = args[0];
if (!t.isObjectExpression(first)) return;
var props = first.properties;
return true;
};
var addDisplayName = function (id, call) {
if (!isCreateClass(call)) return;
var props = call.arguments[0].properties;
var safe = true;
for (var i = 0; i < props.length; i++) {
prop = props[i];
var prop = props[i];
if (t.isIdentifier(prop.key, { name: "displayName" })) {

@@ -221,0 +240,0 @@ safe = false;

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -0,5 +1,7 @@

"use strict";
var t = require("../../types");
exports.ForInStatement =
exports.ForOfStatement = function (node, parent, file) {
exports.ForOfStatement = function (node, parent, scope, context, file) {
var left = node.left;

@@ -6,0 +8,0 @@ if (t.isVariableDeclaration(left)) {

@@ -0,1 +1,3 @@

"use strict";
var t = require("../../types");

@@ -2,0 +4,0 @@

@@ -0,3 +1,5 @@

"use strict";
exports.MethodDefinition =
exports.Property = function (node, parent, file) {
exports.Property = function (node, parent, scope, context, file) {
if (node.kind === "set" && node.value.params.length !== 1) {

@@ -4,0 +6,0 @@ throw file.errorWithNode(node.value, "Setters must have only one parameter");

@@ -0,1 +1,3 @@

"use strict";
var useStrict = require("../helpers/use-strict");

@@ -2,0 +4,0 @@ var t = require("../../types");

@@ -0,3 +1,7 @@

"use strict";
module.exports = traverse;
/* jshint maxparams:7 */
var Scope = require("./scope");

@@ -7,31 +11,36 @@ var t = require("../types");

function TraversalContext(previousContext) {
this.didSkip = false;
this.didRemove = false;
this.didStop = false;
this.didFlatten = previousContext ? previousContext.didFlatten : false;
function noop() { }
function TraversalContext() {
this.shouldFlatten = false;
this.shouldRemove = false;
this.shouldSkip = false;
this.shouldStop = false;
}
TraversalContext.prototype.flatten = function () {
this.didFlatten = true;
this.shouldFlatten = true;
};
TraversalContext.prototype.remove = function () {
this.didRemove = true;
this.skip();
this.shouldRemove = true;
this.shouldSkip = true;
};
TraversalContext.prototype.skip = function () {
this.didSkip = true;
this.shouldSkip = true;
};
TraversalContext.prototype.stop = function () {
this.didStop = true;
this.skip();
this.shouldStop = true;
this.shouldSkip = true;
};
TraversalContext.prototype.maybeReplace = function (result, obj, key, node) {
if (result === false) return node;
if (result == null) return node;
TraversalContext.prototype.reset = function () {
this.shouldRemove = false;
this.shouldSkip = false;
this.shouldStop = false;
};
function replaceNode(obj, key, node, result) {
var isArray = Array.isArray(result);

@@ -45,3 +54,3 @@

// replace the node
node = obj[key] = result;
obj[key] = result;

@@ -55,11 +64,47 @@ // we're replacing a statement or block node with an array of statements so we better

if (isArray) {
this.flatten();
return true;
}
}
TraversalContext.prototype.enterNode = function (obj, key, node, enter, parent, scope, state) {
var result = enter(node, parent, scope, this, state);
var flatten = false;
if (result) {
flatten = replaceNode(obj, key, node, result);
node = result;
if (flatten) {
this.shouldFlatten = true;
}
}
if (this.shouldRemove) {
obj[key] = null;
this.shouldFlatten = true;
}
return node;
};
TraversalContext.prototype.visit = function (obj, key, opts, scope, parent) {
TraversalContext.prototype.exitNode = function (obj, key, node, exit, parent, scope, state) {
var result = exit(node, parent, scope, this, state);
var flatten = false;
if (result) {
flatten = replaceNode(obj, key, node, result);
node = result;
if (flatten) {
this.shouldFlatten = true;
}
}
return node;
};
TraversalContext.prototype.visitNode = function (obj, key, opts, scope, parent, state) {
this.reset();
var node = obj[key];
if (!node) return;

@@ -69,73 +114,71 @@ // type is blacklisted

var result;
var ourScope = scope;
if (t.isScope(node)) ourScope = new Scope(node, scope);
if (t.isScope(node)) {
ourScope = new Scope(node, scope);
}
// enter
if (opts.enter) {
result = opts.enter.call(this, node, parent, ourScope);
node = this.maybeReplace(result, obj, key, node);
node = this.enterNode(obj, key, node, opts.enter, parent, ourScope, state);
if (this.didRemove) {
obj[key] = null;
this.flatten();
}
if (this.shouldSkip) return this.shouldStop;
// stop traversal
if (this.didSkip) return;
traverseNode(node, opts, ourScope, state);
this.exitNode(obj, key, node, opts.exit, parent, ourScope, state);
return this.shouldStop;
};
TraversalContext.prototype.visit = function (node, key, opts, scope, state) {
var nodes = node[key];
if (!nodes) return;
if (!Array.isArray(nodes)) {
return this.visitNode(node, key, opts, scope, node, state);
}
// traverse node
traverse(node, opts, ourScope);
if (nodes.length === 0) {
return;
}
// exit
if (opts.exit) {
result = opts.exit.call(this, node, parent, ourScope);
node = this.maybeReplace(result, obj, key, node);
for (var k = 0; k < nodes.length; k++) {
if (nodes[k] && this.visitNode(nodes, k, opts, scope, node, state))
return true;
}
};
function traverse(parent, opts, scope) {
// falsy node
if (!parent) return;
if (this.shouldFlatten) {
node[key] = _.flatten(node[key]);
// array of nodes
if (Array.isArray(parent)) {
for (var i = 0; i < parent.length; i++)
traverse(parent[i], opts, scope);
return;
if (key === "body") {
// we can safely compact this
node[key] = _.compact(node[key]);
}
}
};
// unknown node type to traverse
var keys = t.VISITOR_KEYS[parent.type];
function traverseNode(node, opts, scope, state) {
var keys = t.VISITOR_KEYS[node.type];
if (!keys) return;
opts = opts || {};
var context = null;
var context = new TraversalContext();
for (var j = 0; j < keys.length; j++) {
var key = keys[j];
var nodes = parent[key];
if (!nodes) continue;
if (context.visit(node, keys[j], opts, scope, state)) {
return;
}
}
}
if (Array.isArray(nodes)) {
for (var k = 0; k < nodes.length; k++) {
context = new TraversalContext(context);
context.visit(nodes, k, opts, scope, parent);
if (context.didStop) return;
}
function traverse(parent, opts, scope, state) {
// falsy node
if (!parent) return;
if (context && context.didFlatten) {
parent[key] = _.flatten(parent[key]);
if (!opts) opts = {};
if (!opts.enter) opts.enter = noop;
if (!opts.exit) opts.exit = noop;
if (key === "body") {
// we can safely compact this
parent[key] = _.compact(parent[key]);
}
}
} else {
context = new TraversalContext(context);
context.visit(parent, key, opts, scope, parent);
if (context.didStop) return;
// array of nodes
if (Array.isArray(parent)) {
for (var i = 0; i < parent.length; i++) {
traverseNode(parent[i], opts, scope, state);
}
} else {
traverseNode(parent, opts, scope, state);
}

@@ -146,11 +189,11 @@ }

var clear = function (node) {
delete node._declarations;
delete node.extendedRange;
delete node._scopeInfo;
delete node.tokens;
delete node.range;
delete node.start;
delete node.end;
delete node.loc;
delete node.raw;
node._declarations = null;
node.extendedRange = null;
node._scopeInfo = null;
node.tokens = null;
node.range = null;
node.start = null;
node.end = null;
node.loc = null;
node.raw = null;

@@ -174,4 +217,2 @@ clearComments(node.trailingComments);

var has = false;
// the node we're searching in is blacklisted

@@ -183,13 +224,17 @@ if (_.contains(blacklistTypes, tree.type)) return false;

var state = {
has: false
};
traverse(tree, {
blacklist: blacklistTypes,
enter: function (node) {
enter: function (node, parent, scope, context, state) {
if (node.type === type) {
has = true;
this.skip();
state.has = true;
context.skip();
}
}
});
}, null, state);
return has;
return state.has;
};

@@ -0,1 +1,3 @@

"use strict";
module.exports = Scope;

@@ -138,6 +140,4 @@

var node = block[key];
if (t.isLet(node)) add(node);
if (t.isBlockScoped(node)) add(node);
});
block = block.body;
}

@@ -150,3 +150,3 @@

// check for non-var `VariableDeclaration`s
if (t.isLet(node)) add(node);
if (t.isBlockScoped(node)) add(node);
});

@@ -161,7 +161,18 @@ }

// ComprehensionExpression - blocks
if (t.isComprehensionExpression(block)) {
add(block);
}
// Program, Function - var variables
if (t.isProgram(block) || t.isFunction(block)) {
var state = {
blockId: block.id,
add: add
};
traverse(block, {
enter: function (node, parent, scope) {
enter: function (node, parent, scope, context, state) {
if (t.isFor(node)) {

@@ -176,9 +187,9 @@ _.each(FOR_KEYS, function (key) {

// declared within are accessible
if (t.isFunction(node)) return this.skip();
if (t.isFunction(node)) return context.skip();
// function identifier doesn't belong to this scope
if (block.id && node === block.id) return;
if (state.blockId && node === state.blockId) return;
if (t.isIdentifier(node) && t.isReferenced(node, parent) && !scope.has(node.name)) {
add(node, true);
state.add(node, true);
}

@@ -188,7 +199,7 @@

// we'll let the BlockStatement scope deal with `let` declarations unless
if (t.isDeclaration(node) && !t.isLet(node)) {
add(node);
if (t.isDeclaration(node) && !t.isBlockScoped(node)) {
state.add(node);
}
}
}, this);
}, this, state);
}

@@ -195,0 +206,0 @@

@@ -19,2 +19,3 @@ {

"ImportDeclaration": ["Statement", "Declaration"],
"PrivateDeclaration": ["Statement", "Declaration"],

@@ -56,3 +57,3 @@ "ArrowFunctionExpression": ["Scope", "Function", "Expression"],

"CallExpression": ["Expression"],
"ComprehensionExpression": ["Expression"],
"ComprehensionExpression": ["Expression", "Scope"],
"ConditionalExpression": ["Expression"],

@@ -59,0 +60,0 @@ "Identifier": ["Expression"],

@@ -1,4 +0,7 @@

var esutils = require("esutils");
var _ = require("lodash");
"use strict";
var toFastProperties = require("../to-fast-properties");
var esutils = require("esutils");
var _ = require("lodash");
var t = exports;

@@ -17,2 +20,3 @@

*/
function registerType(type, skipAliasCheck) {

@@ -68,2 +72,3 @@ var is = t["is" + type] = function (node, opts) {

*/
t.is = function (type, node, opts, skipAliasCheck) {

@@ -474,6 +479,9 @@ if (!node) return;

SpreadElement: ["argument"],
Property: ["value"]
Property: ["value"],
ComprehensionBlock: ["left"]
};
t.getIds.arrays = {
PrivateDeclaration: ["declarations"],
ComprehensionExpression: ["blocks"],
ExportDeclaration: ["specifiers", "declaration"],

@@ -504,2 +512,13 @@ ImportDeclaration: ["specifiers"],

t.isBlockScoped = function (node) {
return t.isFunctionDeclaration(node) || t.isLet(node);
};
/**
* Description
*
* @param {Object} node
* @returns {Boolean}
*/
t.isVar = function (node) {

@@ -551,6 +570,6 @@ return t.isVariableDeclaration(node, { kind: "var" }) && !node._let;

t.inherits = function (child, parent) {
child.range = parent.range;
child.start = parent.start;
child.loc = parent.loc;
child.end = parent.end;
child.range = parent.range;
child.start = parent.start;
t.inheritsComments(child, parent);

@@ -581,1 +600,4 @@ return child;

};
toFastProperties(t);
toFastProperties(t.VISITOR_KEYS);

@@ -0,1 +1,3 @@

"use strict";
require("./patch");

@@ -132,2 +134,10 @@

var templateTraverser = {
enter: function (node, parent, scope, context, nodes) {
if (t.isIdentifier(node) && _.has(nodes, node.name)) {
return nodes[node.name];
}
}
};
exports.template = function (name, nodes, keepExpression) {

@@ -145,9 +155,3 @@ var template = exports.templates[name];

if (!_.isEmpty(nodes)) {
traverse(template, {
enter: function (node) {
if (t.isIdentifier(node) && _.has(nodes, node.name)) {
return nodes[node.name];
}
}
});
traverse(template, templateTraverser, null, nodes);
}

@@ -154,0 +158,0 @@

{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "2.12.6",
"version": "2.13.0",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

@@ -36,30 +36,30 @@ "homepage": "https://6to5.org/",

"dependencies": {
"acorn-6to5": "0.11.1-16",
"acorn-6to5": "0.11.1-18",
"ast-types": "~0.6.1",
"chokidar": "0.11.1",
"commander": "2.5.0",
"core-js": "0.4.4",
"estraverse": "1.8.0",
"chokidar": "0.12.6",
"commander": "2.6.0",
"core-js": "0.4.5",
"estraverse": "1.9.1",
"esutils": "1.1.6",
"esvalid": "1.1.0",
"fs-readdir-recursive": "0.1.0",
"jshint": "2.5.10",
"jshint": "2.5.11",
"lodash": "2.4.1",
"output-file-sync": "^1.1.0",
"private": "0.1.6",
"regenerator": "0.8.3",
"regexpu": "0.3.0",
"regenerator": "0.8.9",
"regexpu": "1.0.0",
"roadrunner": "1.0.4",
"source-map": "0.1.40",
"source-map-support": "0.2.8"
"source-map": "0.1.43",
"source-map-support": "0.2.9"
},
"devDependencies": {
"browserify": "6.3.2",
"chai": "1.9.2",
"istanbul": "0.3.2",
"browserify": "8.1.1",
"chai": "1.10.0",
"istanbul": "0.3.5",
"jshint-stylish": "1.0.0",
"matcha": "0.6.0",
"mocha": "1.21.4",
"mocha": "2.1.0",
"rimraf": "2.2.8",
"uglify-js": "2.4.15"
"uglify-js": "2.4.16"
},

@@ -66,0 +66,0 @@ "optionalDependencies": {

{
"name": "traceur",
"version": "0.0.80",
"version": "0.0.81",
"description": "ES6 to ES5 compiler",

@@ -49,3 +49,3 @@ "keywords": [

"devDependencies": {
"source-map": "0.1.34",
"source-map": "0.1.43",
"express": "4.x",

@@ -58,3 +58,2 @@ "serve-index": "1.x",

"requirejs": "2.x",
"semver": "2.x",
"traceur": "0.0.79",

@@ -61,0 +60,0 @@ "promises-aplus-tests": "2.x"

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc