@projectwallace/css-analyzer 5.1.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/analyzer.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("css-tree/parser"),t=require("css-tree/walker"),n=require("css-tree/generator");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/r(e),a=/*#__PURE__*/r(t),s=/*#__PURE__*/r(n);function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}const u=new Map,l=function(e){if(u.has(e))return u.get(e);let t=e,n=e[0];"/"===n?n="/"===e[1]?"//":"/":"_"!==n&&"*"!==n&&"$"!==n&&"#"!==n&&"+"!==n&&"&"!==n&&(n="");const r=(i=t).length-(a=(a=n.length)||0)>=2&&45===i.charCodeAt(a)&&45===i.charCodeAt(a+1);var i,a;if(!r&&(t=t.toLowerCase(),u.has(t))){const n=u.get(t);return u.set(e,n),n}const s=r?"":function(e,t){if(e.length-(t=t||0)>=3&&45===e.charCodeAt(t)&&45!==e.charCodeAt(t+1)){const n=e.indexOf("-",t+2);if(-1!==n)return e.substring(t,n+1)}return""}(t,n.length),o=t.substr(0,n.length+s.length),l=Object.freeze({basename:t.substr(o.length),name:t.substr(n.length),hack:n,vendor:s,prefix:o,custom:r});return u.set(e,l),l};function c(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}function h(e){var t=[];return a.default(e,{visit:"Selector",enter:function(e){t.push(d(e))}}),t.sort(function(e,t){return c(e.specificity,t.specificity)})}var d=function(e){var t=0,n=0,r=0,s=0,o=!1;return a.default(e,{enter:function(e){switch(e.type){case"IdSelector":t++,s++;break;case"ClassSelector":n++,s++;break;case"AttributeSelector":n++,s++,Boolean(e.value)&&s++,o="role"===e.name.name||e.name.name.startsWith("aria-");break;case"PseudoElementSelector":case"TypeSelector":"*"!==e.name&&r++,s++;break;case"PseudoClassSelector":if(["before","after","first-letter","first-line"].includes(e.name))return r++,s++,this.skip;if(["is","has","matches","-webkit-any","-moz-any"].includes(e.name)){var a=h(i.default(e.children.first.value,{context:"selectorList"})),u=a[0].specificity;t+=u[0],n+=u[1],r+=u[2];for(var l=0;l<a.length;l++)s+=a[l].complexity;return void s++}if("not"===e.name){var c=h(e),d=c[0].specificity;t+=d[0],n+=d[1],r+=d[2];for(var f=0;f<c.length;f++)s+=c[f].complexity;return s++,this.skip}if(["nth-child","nth-last-child"].includes(e.name)){n++;var m=h(e);if(0===m.length)return;var p=m[0].specificity;t+=p[0],n+=p[1],r+=p[2];for(var g=0;g<m.length;g++)s+=m[g].complexity;return void s++}if("where"===e.name){for(var y=h(i.default(e.children.first.value,{context:"selectorList"})),v=0;v<y.length;v++)s+=y[v].complexity;return void s++}s++,n++;break;case"Combinator":s++}}}),{specificity:[t,n,r],complexity:s,isId:t>0,isA11y:o}},f=/*#__PURE__*/function(){function e(e){this.items=new Uint8Array(e),this.sum=0,this.cursor=0}var t=e.prototype;return t.add=function(e){this.items[this.cursor]=e,this.sum+=e,this.cursor++},t.aggregate=function(){if(0===this.cursor)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};var e,t,n,r=new Uint8Array(this.items.slice(0,this.cursor)).sort(function(e,t){return e-t}),i=r[0],a=r[r.length-1],s=function(e){for(var t=Object.create(null),n=-1,r=0,i=0,a=0;a<e.length;a++){var s=e[a],o=(t[s]||0)+1;t[s]=o,o>n&&(n=o,r=0,i=0),o>=n&&(r++,i+=s)}return i/r}(r),o=(t=(e=r).length/2)!==(n=Math.floor(t))?e[n]:(e[n]+e[n-1])/2;return{min:i,max:a,mean:this.sum/this.cursor,mode:s,median:o,range:a-i,sum:this.sum}},t.toArray=function(){return Array.from(this.items.subarray(0,this.cursor))},e}(),m=function(e){for(var t=e.rules,n=t.length,r=new f(n),i=new f(n),s=0,u=function(e){var n=0,o=0;a.default(t[e],{enter:function(e){return"Selector"===e.type?(n++,this.skip):"Declaration"===e.type?(o++,this.skip):void 0}}),0===o&&s++,r.add(n),i.add(o)},l=0;l<n;l++)u(l);return{total:n,empty:{total:s,ratio:0===n?0:s/n},selectors:o({},r.aggregate(),{items:r.toArray()}),declarations:o({},i.aggregate(),{items:i.toArray()})}},p={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},g={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1},y=/*#__PURE__*/function(){function e(e){if(this.items={},this.total=0,this.totalUnique=0,e)for(var t=0;t<e.length;t++)this.push(e[t])}var t=e.prototype;return t.push=function(e){this.total++,this.items[e]?this.items[e]++:(this.items[e]=1,this.totalUnique++)},t.size=function(){return this.total},t.count=function(){return{total:this.total,totalUnique:this.totalUnique,unique:this.items,uniquenessRatio:0===this.total?0:this.totalUnique/this.total}},e}(),v={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},b={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1},k=function(e){for(var t=e.fontValues,n=new y(e.fontFamilyValues),r=function(e){var r=t[e],i=r.children.first;if("Identifier"===i.type&&v[i.name])return"continue";var o=[];a.default(r,{reverse:!0,enter:function(e){return"String"===e.type||"Operator"===e.type&&44===e.value.charCodeAt(0)?o.unshift(e):"Identifier"===e.type?b[e.name]?this.skip:o.unshift(e):void 0}}),n.push(o.map(s.default).join(""))},i=0;i<t.length;i++)r(i);return n.count()},w={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},x={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},q=function(e){for(var t=e.stringifyNode,n=e.fontValues,r=new y(e.fontSizeValues),i=function(e){var i=n[e],s=i.children.first;if("Identifier"===s.type&&x[s.name])return"continue";var o=!1,u=void 0;a.default(i,{enter:function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return u="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(o=!0);break;case"Dimension":if(!o)return u=t(e),this.break;case"Identifier":if(w[e.name])return u=e.name,this.break}}}),u&&r.push(u)},s=0;s<n.length;s++)i(s);return r.count()},z=function(e){for(var t=e.stringifyNode,n=e.declarations,r=n.length,i=Object.create(null),a=0,s=0,o=0,u=0;u<r;u++){var l=n[u];!0===l.important&&(a++,l.inKeyframe&&o++);var c=t(l);i[c]||(i[c]=1,s++)}return{total:r,unique:{total:s,ratio:0===r?0:s/r},importants:{total:a,ratio:0===r?0:a/r,inKeyframes:{total:o,ratio:0===a?0:o/a}}}},C=function(e){for(var t,n,r=e.stringifyNode,i=e.selectors,a=Object.create(null),s=Object.create(null),u=i.length,l=new f(u),h=new f(u),m=new f(u),p=0,g=new f(u),v=[],b=[],k=new y,w=new y,x=new y,q=0;q<u;q++){var z=i[q],C=r(z);if(z.isKeyframeSelector)x.push(C);else{var A=s[C]||d(z),O=A.specificity,N=A.complexity,S=A.isId,j=A.isA11y;S&&k.push(C),j&&w.push(C),s[C]?a[C]++:(s[C]={complexity:N,specificity:O,isId:S,isA11y:j},p++,a[C]=1),g.add(N),void 0===t&&(t=O),void 0===n&&(n=O),l.add(O[0]),h.add(O[1]),m.add(O[2]),void 0!==n&&c(n,O)<0&&(n=O),void 0!==t&&c(t,O)>0&&(t=O),v.push(O),b.push(N)}}var I=l.aggregate(),D=h.aggregate(),U=m.aggregate(),F=new y(b).count();return{total:u,totalUnique:p,uniquenessRatio:0===u?0:p/u,specificity:{min:n,max:t,sum:[I.sum,D.sum,U.sum],mean:[I.mean,D.mean,U.mean],mode:[I.mode,D.mode,U.mode],median:[I.median,D.median,U.median],items:v},complexity:o({},g.aggregate(),F,{items:b}),id:o({},k.count(),{ratio:0===u?0:k.size()/u}),accessibility:o({},w.count(),{ratio:0===u?0:w.size()/u}),keyframes:o({},x.count(),{ratio:0===u?0:x.size()/u})}},A=function(e){for(var t=e.properties,n=new y(t.map(function(e){return e.authored})),r=new y,i=new y,a=new y,s=t.length,u=0;u<s;u++){var l=t[u];l.vendor?r.push(l.authored):l.hack?i.push(l.authored):l.custom&&a.push(l.authored)}return o({},n.count(),{prefixed:o({},r.count(),{ratio:r.size()/s}),custom:o({},a.count(),{ratio:a.size()/s}),browserhacks:o({},i.count(),{ratio:i.size()/s})})},O={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1},N=function(e){for(var t=e.values,n=e.stringifyNode,r=new y,i=0;i<t.length;i++){var a=t[i],s=a.children.first;s&&("Identifier"===s.type&&O[s.name]||r.push(n(a)))}return r.count()},S={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1},j=function(e){for(var t=e.animations,n=e.timingFunctions,r=e.stringifyNode,i=new y(e.durations.map(r)),a=new y(n.map(r)),s=function(e){var n=!1;t[e].value.children.forEach(function(e){return"Operator"===e.type?n=!1:"Dimension"===e.type&&!1===n?(n=!0,i.push(r(e))):"Identifier"===e.type&&S[e.name]?a.push(r(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:a.push(r(e))})},o=0;o<t.length;o++)s(o);return{durations:i.count(),timingFunctions:a.count()}};function I(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function D(e){e=e.toArray();for(var t=0;t<e.length;t++){var n=e[t];if("Identifier"===n.type&&n.name.length>=3&&I(n.name))return!0;if("Function"===n.type){if(I(n.name))return!0;if(n.children&&D(n.children))return!0}}return!1}var U=function(e){for(var t=e.values,n=e.stringifyNode,r=new y,i=0;i<t.length;i++){var a=t[i];a.children&&D(a.children)&&r.push(n(a))}return r.count()},F=function(e){for(var t=e.atrules,n=e.stringifyNode,r=[],i=new y,a=new y,s=new y,u=new y,l=new y,c=new y,h=new y,d={"font-face":function(e){var t={};e.block.children.forEach(function(e){return t[e.property]=n(e.value)}),r.push(t)},media:function(e){return a.push(e.prelude.value)},supports:function(e){return u.push(e.prelude.value)},keyframes:function(e){return l.push("@"+e.name+" "+e.prelude.value)},import:function(e){return i.push(e.prelude.value)},charset:function(e){return s.push(e.prelude.value)},container:function(e){return h.push(e.prelude.value)}},f=0;f<t.length;f++){var m=t[f],p=m.name,g=d[p];if(g)g(m);else if(p.endsWith("keyframes")){var v="@"+p+" "+m.prelude.value;l.push(v),I(p)&&c.push(v)}}return{fontface:{total:r.length,totalUnique:r.length,unique:r,uniquenessRatio:1},import:i.count(),media:a.count(),charset:s.count(),supports:u.count(),keyframes:o({},l.count(),{prefixed:o({},c.count(),{ratio:0===l.size()?0:c.size()/l.size()})}),container:h.count()}},V=/*#__PURE__*/function(){function e(){this.list=new y,this.contexts={},this.contextCount=0}var t=e.prototype;return t.push=function(e,t){this.list.push(e),this.contexts[t]||(this.contexts[t]=new y,this.contextCount++),this.contexts[t].push(e)},t.count=function(){var e={};for(var t in this.contexts)e[t]=this.contexts[t].count();return Object.assign(this.list.count(),{itemsPerContext:e})},e}();exports.analyze=function(e){var t=new Date,n=e.split(/\r?\n/);function r(e){var t=e.loc.start,r=e.loc.end;if(0==r.line-t.line)return n[t.line-1].substring(t.column-1,r.column-1);for(var i=[],a=t.line;a<=r.line;a++){var s=n[a-1];i.push(a!==t.line?a!==r.line?s:s.substring(0,r.column-1):s.substring(t.column-1))}return i.join("\n")}var s=new Date,u=0,c=0,h=i.default(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){u++,c+=e.length}}),d=new Date,f=[],v=[],b=[],w=[],x=[],O=[],S=[],I=[],D=[],L=[],P=[],K=[],W=[],_=[],R=[],E=new V,T=new V,M=new y;a.default(h,{enter:function(e){switch(e.type){case"Atrule":f.push(e);break;case"Rule":v.push(e);break;case"Selector":return b.push(o({},e,{isKeyframeSelector:this.atrule&&this.atrule.name.endsWith("keyframes")})),this.skip;case"Dimension":if(!this.declaration)break;return T.push(e.unit,this.declaration.property),this.skip;case"Url":e.value.startsWith("data:")&&M.push(e.value);break;case"Declaration":w.push(o({},e,{inKeyframe:this.atrule&&this.atrule.name.endsWith("keyframes")}));var t=e.value,n=e.property,i=Object.assign({authored:n},l(n));switch(x.push(i),O.push(t),i.basename){case"z-index":S.push(t);break;case"text-shadow":I.push(t);break;case"box-shadow":D.push(t);break;case"font":L.push(t);break;case"font-family":return P.push(r(t)),this.skip;case"font-size":K.push(r(t));break;case"transition":case"animation":W.push(e);break;case"animation-duration":case"transition-duration":R.push(t);break;case"transition-timing-function":case"animation-timing-function":_.push(t)}a.default(t,{enter:function(e){switch(e.type){case"Hash":return E.push(r(e),n),this.skip;case"Identifier":var t=e.name;return t.length>20||t.length<3||p[t.toLowerCase()]&&E.push(r(e),n),this.skip;case"Function":g[e.name.toLowerCase()]&&E.push(r(e),n)}}})}}});var B=M.count(),H=Object.keys(B.unique).join("").length;return{stylesheet:{sourceLinesOfCode:f.length+b.length+w.length,linesOfCode:n.length,size:e.length,comments:{total:u,size:c},embeddedContent:Object.assign(B,{size:{total:H,ratio:0===e.length?0:H/e.length}})},atrules:F({atrules:f,stringifyNode:r}),rules:m({rules:v}),selectors:C({stringifyNode:r,selectors:b}),declarations:z({stringifyNode:r,declarations:w}),properties:A({properties:x}),values:{colors:E.count(),fontFamilies:k({stringifyNode:r,fontValues:L,fontFamilyValues:P}),fontSizes:q({stringifyNode:r,fontValues:L,fontSizeValues:K}),zindexes:N({values:S,stringifyNode:r}),textShadows:N({values:I,stringifyNode:r}),boxShadows:N({values:D,stringifyNode:r}),animations:j({animations:W,timingFunctions:_,durations:R,stringifyNode:r}),prefixes:U({values:O,stringifyNode:r}),units:T.count()},__meta__:{parseTime:d-s,analyzeTime:new Date-d,total:new Date-t}}},exports.compareSpecificity=c;
1
+ var e=require("css-tree/parser"),t=require("css-tree/walker");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/r(e),i=/*#__PURE__*/r(t);function a(e,t){return t>=65&&t<=90&&(t|=32),e===t}function o(e,t){var r=t.length-e.length;if(r<0)return!1;for(var n=t.length-1;n>=r;n--)if(!1===a(e.charCodeAt(n-r),t.charCodeAt(n)))return!1;return!0}function s(e,t){if(t.length<e.length)return!1;for(var r=0;r<e.length;r++)if(!1===a(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}function u(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}var l=function(e){var t=0,r=0,n=0,a=0,o=!1;return i.default(e,function(e){switch(e.type){case"IdSelector":t++,a++;break;case"ClassSelector":r++,a++;break;case"AttributeSelector":r++,a++,Boolean(e.value)&&a++,o="role"===e.name.name||s("aria-",e.name.name);break;case"PseudoElementSelector":case"TypeSelector":if(a++,42===e.name.charCodeAt(0)&&1===e.name.length)break;n++;break;case"PseudoClassSelector":switch(e.name){case"before":case"after":case"first-letter":case"first-line":return n++,a++,this.skip;case"where":case"is":case"has":case"matches":case"-webkit-any":case"-moz-any":case"not":case"nth-child":case"nth-last-child":"nth-child"!==e.name&&"nth-last-child"!==e.name||r++;var c=(m=[],i.default(e,{visit:"Selector",enter:function(e){m.push(l(e))}}),m.sort(function(e,t){return u(e.specificity,t.specificity)}));if(0===c.length)return;if("where"!==e.name){var f=c[0].specificity;t+=f[0],r+=f[1],n+=f[2]}for(var d=0;d<c.length;d++){var h=c[d];h.isA11y&&(o=!0),a+=h.complexity}return a++,this.skip;default:return a++,r++,this.skip}case"Combinator":a++}var m}),{specificity:[t,r,n],complexity:a,isId:t>0,isA11y:o}},c={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},f={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1},d={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},h={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1};function m(e){var t=e.children.first;return"Identifier"===t.type&&d[t.name]}var b={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},v={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1};function g(e){var t=e.children.first;return"Identifier"===t.type&&v[t.name]}var w={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1};function k(e){if(!e.children)return!1;var t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&w[t.name]}var p={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1};function y(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function x(e){if(!e.children)return!1;for(var t=e.children.toArray(),r=0;r<t.length;r++){var n=t[r],i=n.type,a=n.name;if("Identifier"===i&&y(a))return!0;if("Function"===i){if(y(a))return!0;if(x(n))return!0}}return!1}var q=/*#__PURE__*/function(){function e(e){if(this.t={},this.i=0,this.o=0,e)for(var t=0;t<e.length;t++)this.push(e[t])}var t=e.prototype;return t.push=function(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)},t.size=function(){return this.i},t.count=function(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}},e}(),S=/*#__PURE__*/function(){function e(){this.u=new q,this.l={}}var t=e.prototype;return t.push=function(e,t){this.u.push(e),this.l[t]||(this.l[t]=new q),this.l[t].push(e)},t.count=function(){var e={};for(var t in this.l)e[t]=this.l[t].count();return Object.assign(this.u.count(),{itemsPerContext:e})},e}(),z=/*#__PURE__*/function(){function e(){this.t=[]}var t=e.prototype;return t.add=function(e){this.t.push(e)},t.size=function(){return this.t.length},t.aggregate=function(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};var e,t,r,n=this.t.slice().sort(function(e,t){return e-t}),i=n[0],a=n[n.length-1],o=this.t.reduce(function(e,t){return e+t}),s=function(e){for(var t=Object.create(null),r=-1,n=0,i=0,a=0;a<e.length;a++){var o=e[a],s=(t[o]||0)+1;t[o]=s,s>r&&(r=s,n=0,i=0),s>=r&&(n++,i+=o)}return i/n}(this.t),u=(t=(e=n).length/2)!==(r=Math.floor(t))?e[r]:(e[r]+e[r-1])/2;return{min:i,max:a,mean:o/this.t.length,mode:s,median:u,range:a-i,sum:o}},t.toArray=function(){return this.t},e}();function O(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function D(e,t){return!O(t)&&o(e,t)}var I=/*#__PURE__*/function(){function e(){this.t=Object.create(null)}var t=e.prototype;return t.push=function(e){return this.t[e]?this.t[e]++:this.t[e]=1},t.count=function(){return Object.keys(this.t).length},e}();exports.analyze=function(e){var t=new Date,r=e.split(/\r?\n/);function d(e){var t=e.loc.start,n=e.loc.end;if(0==n.line-t.line)return r[t.line-1].substring(t.column-1,n.column-1);for(var i="",a=t.line;a<=n.line;a++){var o=r[a-1];i+=a!==t.line?a!==n.line?o+"\n":o.substring(0,n.column-1):o.substring(t.column-1)+"\n"}return i}var v,w,C=0,j=0,F=new q,P=new Date,A=n.default(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){C++,j+=e.length}}),R=new Date,U=0,_=[],T=new q,B=new q,E=new q,H=new q,K=new q,L=new q,M=new q,N=new q,V=0,G=0,J=new z,Q=new z,W=new q,X=new I,Y=new z,Z=new z,$=new z,ee=new z,te=[],re=new q,ne=new q,ie=new I,ae=0,oe=0,se=0,ue=new q,le=new q,ce=new q,fe=new q,de=new q,he=new q,me=new q,be=new q,ve=new q,ge=new q,we=new q,ke=new q,pe=new S,ye=new S;i.default(A,function(e){switch(e.type){case"Atrule":U++;var t=e.name;if("font-face"===t){var r={};e.block.children.forEach(function(e){return r[e.property]=d(e.value)}),_.push(r);break}if("media"===t){E.push(e.prelude.value);break}if("supports"===t){K.push(e.prelude.value);break}if(o("keyframes",t)){var n="@"+t+" "+e.prelude.value;y(t)&&M.push(n),L.push(n);break}if("import"===t){B.push(e.prelude.value);break}if("charset"===t){H.push(e.prelude.value);break}if("container"===t){N.push(e.prelude.value);break}"layer"===t&&N.push(e.prelude.value.trim().split(",").map(function(e){return e.trim()}).forEach(function(e){return T.push(e)}));break;case"Rule":var q=function(e){var t=0,r=0;return i.default(e,function(e){return"Selector"===e.type?(t++,this.skip):"Declaration"===e.type?(r++,this.skip):void 0}),[t,r]}(e),S=q[1];V++,0===S&&G++,J.add(q[0]),Q.add(S);break;case"Selector":var z=d(e);if(this.atrule&&o("keyframes",this.atrule.name))return W.push(z),this.skip;var I=l(e),C=I.specificity,j=I.complexity,P=I.isA11y;return I.isId&&re.push(z),P&&ne.push(z),X.push(z),ee.add(j),void 0===v&&(v=C),void 0===w&&(w=C),Y.add(C[0]),Z.add(C[1]),$.add(C[2]),void 0!==w&&u(w,C)<0&&(w=C),void 0!==v&&u(v,C)>0&&(v=C),te.push(C),this.skip;case"Dimension":if(!this.declaration)break;return ye.push(e.unit,this.declaration.property),this.skip;case"Url":s("data:",e.value)&&F.push(e.value);break;case"Value":if(k(e))break;var A=this.declaration.property;if(x(e)&&de.push(d(e)),D("z-index",A))return k(e)||he.push(d(e)),this.skip;if(D("font",A)){if(m(e)||ve.push(function(e,t){var r="";return i.default(e,{reverse:!0,enter:function(e){if("String"===e.type){var n=e.loc.start,i=t({loc:{start:{line:n.line,column:n.column},end:{line:n.line,column:n.column+1}}});return r=i+e.value+i+r}return"Operator"===e.type&&44===e.value.charCodeAt(0)?r=e.value+r:"Identifier"===e.type?h[e.name]?this.skip:r=e.name+r:void 0}}),r}(e,d)),!g(e)){var R=function(e){var t,r=!1;return i.default(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return t="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(r=!0);break;case"Dimension":if(!r)return t=e.value+e.unit,this.break;case"Identifier":if(b[e.name])return t=e.name,this.break}}),t}(e);R&&ge.push(R)}break}if(D("font-size",A)){g(e)||ge.push(d(e));break}if(D("font-family",A)){m(e)||ve.push(d(e));break}if(D("transition",A)||D("animation",A)){for(var xe=function(e,t){var r=!1,n=[],i=[];return e.forEach(function(e){return"Operator"===e.type?r=!1:"Dimension"===e.type&&!1===r?(r=!0,n.push(t(e))):"Identifier"===e.type&&p[e.name]?i.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:i.push(t(e))}),[n,i]}(e.children,d),qe=xe[0],Se=xe[1],ze=0;ze<qe.length;ze++)ke.push(qe[ze]);for(var Oe=0;Oe<Se.length;Oe++)we.push(Se[Oe]);break}if(D("animation-duration",A)||D("transition-duration",A)){ke.push(d(e));break}if(D("transition-timing-function",A)||D("animation-timing-function",A)){we.push(d(e));break}D("text-shadow",A)?k(e)||me.push(d(e)):D("box-shadow",A)&&(k(e)||be.push(d(e))),i.default(e,function(e){switch(e.type){case"Hash":return pe.push("#"+e.value,A),this.skip;case"Identifier":var t=e.name;return t.length>20||t.length<3||c[t.toLowerCase()]&&pe.push(d(e),A),this.skip;case"Function":if(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!1===a(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}("var",e.name))return this.skip;f[e.name.toLowerCase()]&&pe.push(d(e),A)}});break;case"Declaration":ae++;var De=d(e);ie.push(De),e.important&&(oe++,this.atrule&&o("keyframes",this.atrule.name)&&se++);var Ie=e.property;ue.push(Ie),y(Ie)?ce.push(Ie):function(e){if(O(e)||y(e))return!1;var t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(Ie)?le.push(Ie):O(Ie)&&fe.push(Ie)}});var xe=F.count(),qe=Object.keys(xe.unique).join("").length,Se=ie.count(),ze=ee.size(),Oe=Y.aggregate(),De=Z.aggregate(),Ie=$.aggregate(),Ce=new q(ee.toArray()).count(),je=X.count(),Fe=Object.assign;return{stylesheet:{sourceLinesOfCode:U+ze+ae+W.size(),linesOfCode:r.length,size:e.length,comments:{total:C,size:j},embeddedContent:Fe(xe,{size:{total:qe,ratio:0===e.length?0:qe/e.length}})},atrules:{fontface:{total:_.length,totalUnique:_.length,unique:_,uniquenessRatio:0===_.length?0:1},import:B.count(),media:E.count(),charset:H.count(),supports:K.count(),keyframes:Fe(L.count(),{prefixed:Fe(M.count(),{ratio:0===L.size()?0:M.size()/L.size()})}),container:N.count(),layer:T.count()},rules:{total:V,empty:{total:G,ratio:0===V?0:G/V},selectors:Fe(J.aggregate(),{items:J.toArray()}),declarations:Fe(Q.aggregate(),{items:Q.toArray()})},selectors:{total:ze,totalUnique:je,uniquenessRatio:0===ze?0:je/ze,specificity:{min:void 0===w?[0,0,0]:w,max:void 0===v?[0,0,0]:v,sum:[Oe.sum,De.sum,Ie.sum],mean:[Oe.mean,De.mean,Ie.mean],mode:[Oe.mode,De.mode,Ie.mode],median:[Oe.median,De.median,Ie.median],items:te},complexity:Fe(ee.aggregate(),Ce,{items:ee.toArray()}),id:Fe(re.count(),{ratio:0===ze?0:re.size()/ze}),accessibility:Fe(ne.count(),{ratio:0===ze?0:ne.size()/ze}),keyframes:W.count()},declarations:{total:ae,unique:{total:Se,ratio:0===ae?0:Se/ae},importants:{total:oe,ratio:0===ae?0:oe/ae,inKeyframes:{total:se,ratio:0===oe?0:se/oe}}},properties:Fe(ue.count(),{prefixed:Fe(ce.count(),{ratio:0===ue.size()?0:ce.size()/ue.size()}),custom:Fe(fe.count(),{ratio:0===ue.size()?0:fe.size()/ue.size()}),browserhacks:Fe(le.count(),{ratio:0===ue.size()?0:le.size()/ue.size()})}),values:{colors:pe.count(),fontFamilies:ve.count(),fontSizes:ge.count(),zindexes:he.count(),textShadows:me.count(),boxShadows:be.count(),animations:{durations:ke.count(),timingFunctions:we.count()},prefixes:de.count(),units:ye.count()},__meta__:{parseTime:R-P,analyzeTime:new Date-R,total:new Date-t}}},exports.compareSpecificity=u;
2
2
  //# sourceMappingURL=analyzer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer.cjs","sources":["../node_modules/css-tree/lib/utils/names.js","../src/selectors/specificity.js","../src/aggregate-collection.js","../src/rules/rules.js","../src/values/colors.js","../src/countable-collection.js","../src/values/font-families.js","../src/values/font-sizes.js","../src/declarations/declarations.js","../src/selectors/selectors.js","../src/properties/properties.js","../src/values/values.js","../src/values/animations.js","../src/vendor-prefix.js","../src/values/vendor-prefix.js","../src/atrules/atrules.js","../src/context-collection.js","../src/index.js"],"sourcesContent":["const keywords = new Map();\nconst properties = new Map();\nconst HYPHENMINUS = 45; // '-'.charCodeAt()\n\nexport const keyword = getKeywordDescriptor;\nexport const property = getPropertyDescriptor;\nexport const vendorPrefix = getVendorPrefix;\nexport function isCustomProperty(str, offset) {\n offset = offset || 0;\n\n return str.length - offset >= 2 &&\n str.charCodeAt(offset) === HYPHENMINUS &&\n str.charCodeAt(offset + 1) === HYPHENMINUS;\n}\n\nfunction getVendorPrefix(str, offset) {\n offset = offset || 0;\n\n // verdor prefix should be at least 3 chars length\n if (str.length - offset >= 3) {\n // vendor prefix starts with hyper minus following non-hyper minus\n if (str.charCodeAt(offset) === HYPHENMINUS &&\n str.charCodeAt(offset + 1) !== HYPHENMINUS) {\n // vendor prefix should contain a hyper minus at the ending\n const secondDashIndex = str.indexOf('-', offset + 2);\n\n if (secondDashIndex !== -1) {\n return str.substring(offset, secondDashIndex + 1);\n }\n }\n }\n\n return '';\n}\n\nfunction getKeywordDescriptor(keyword) {\n if (keywords.has(keyword)) {\n return keywords.get(keyword);\n }\n\n const name = keyword.toLowerCase();\n let descriptor = keywords.get(name);\n\n if (descriptor === undefined) {\n const custom = isCustomProperty(name, 0);\n const vendor = !custom ? getVendorPrefix(name, 0) : '';\n descriptor = Object.freeze({\n basename: name.substr(vendor.length),\n name,\n prefix: vendor,\n vendor,\n custom\n });\n }\n\n keywords.set(keyword, descriptor);\n\n return descriptor;\n}\n\nfunction getPropertyDescriptor(property) {\n if (properties.has(property)) {\n return properties.get(property);\n }\n\n let name = property;\n let hack = property[0];\n\n if (hack === '/') {\n hack = property[1] === '/' ? '//' : '/';\n } else if (hack !== '_' &&\n hack !== '*' &&\n hack !== '$' &&\n hack !== '#' &&\n hack !== '+' &&\n hack !== '&') {\n hack = '';\n }\n\n const custom = isCustomProperty(name, hack.length);\n\n // re-use result when possible (the same as for lower case)\n if (!custom) {\n name = name.toLowerCase();\n if (properties.has(name)) {\n const descriptor = properties.get(name);\n properties.set(property, descriptor);\n return descriptor;\n }\n }\n\n const vendor = !custom ? getVendorPrefix(name, hack.length) : '';\n const prefix = name.substr(0, hack.length + vendor.length);\n const descriptor = Object.freeze({\n basename: name.substr(prefix.length),\n name: name.substr(hack.length),\n hack,\n vendor,\n prefix,\n custom\n });\n\n properties.set(property, descriptor);\n\n return descriptor;\n}\n","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\n\n/**\n * Compare specificity A to Specificity B\n * @param {[number,number,number]} a - Specificity A\n * @param {[number,number,number]} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nfunction compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector} topSpecificitySelector\n */\nfunction selectorListSpecificities(selectorListAst) {\n const childSelectors = []\n walk(selectorListAst, {\n visit: 'Selector',\n enter(node) {\n childSelectors.push(analyzeSpecificity(node))\n }\n })\n\n return childSelectors.sort((a, b) => compareSpecificity(a.specificity, b.specificity))\n}\n\n/**\n * Get the Specificity for the AST of a Selector Node\n * @param {import('css-tree').Selector} ast - AST Node for a Selector\n * @return {Object}\n * @property {[number,number,number]} specificity\n * @property {number} complexity\n * @property {Boolean} isId\n * @property {Boolean} isA11y\n */\nconst analyzeSpecificity = (ast) => {\n let A = 0\n let B = 0\n let C = 0\n let complexity = 0\n let isA11y = false\n\n walk(ast, {\n enter: function (selector) {\n switch (selector.type) {\n case 'IdSelector': {\n A++\n complexity++\n break\n }\n case 'ClassSelector': {\n B++\n complexity++\n break\n }\n case 'AttributeSelector': {\n B++\n complexity++\n\n if (Boolean(selector.value)) {\n complexity++\n }\n isA11y = selector.name.name === 'role' || selector.name.name.startsWith('aria-')\n break\n }\n case 'PseudoElementSelector':\n case 'TypeSelector': {\n if (selector.name !== '*') {\n C++\n }\n complexity++\n break\n }\n case 'PseudoClassSelector': {\n if (['before', 'after', 'first-letter', 'first-line'].includes(selector.name)) {\n C++\n complexity++\n return this.skip\n }\n // The specificity of an :is(), :not(), or :has() pseudo-class is\n // replaced by the specificity of the most specific complex\n // selector in its selector list argument.\n\n // CSSTree doesn't parse the arguments of :is, :has and :matches,\n // so we need to create an AST out of them ourselves\n if (['is', 'has', 'matches', '-webkit-any', '-moz-any'].includes(selector.name)) {\n const childAst = parse(selector.children.first.value, { context: 'selectorList' })\n const selectorList = selectorListSpecificities(childAst)\n const [topA, topB, topC] = selectorList[0].specificity\n A += topA\n B += topB\n C += topC\n\n for (let i = 0; i < selectorList.length; i++) {\n complexity += selectorList[i].complexity\n }\n complexity++\n return\n }\n\n // CSSTree *does* parse the arguments of the :not() pseudo-class,\n // so we have direct access to the AST, instead of having to parse\n // the arguments ourselves.\n if (selector.name === 'not') {\n const selectorList = selectorListSpecificities(selector)\n const [topA, topB, topC] = selectorList[0].specificity\n A += topA\n B += topB\n C += topC\n\n for (let i = 0; i < selectorList.length; i++) {\n complexity += selectorList[i].complexity\n }\n complexity++\n return this.skip\n }\n\n // The specificity of an :nth-child() or :nth-last-child() selector\n // is the specificity of the pseudo class itself (counting as one\n // pseudo-class selector) plus the specificity of the most\n // specific complex selector in its selector list argument (if any).\n if (['nth-child', 'nth-last-child'].includes(selector.name)) {\n // +1 for the pseudo class itself\n B++\n\n const childSelectors = selectorListSpecificities(selector)\n\n if (childSelectors.length === 0) {\n return\n }\n\n const [topA, topB, topC] = childSelectors[0].specificity\n A += topA\n B += topB\n C += topC\n\n for (let i = 0; i < childSelectors.length; i++) {\n complexity += childSelectors[i].complexity;\n }\n\n complexity++\n return\n }\n\n // The specificity of a :where() pseudo-class is replaced by zero,\n // but it does count towards complexity.\n if (selector.name === 'where') {\n const childAst = parse(selector.children.first.value, { context: 'selectorList' })\n const childSelectors = selectorListSpecificities(childAst)\n\n for (let i = 0; i < childSelectors.length; i++) {\n complexity += childSelectors[i].complexity;\n }\n\n complexity++\n return\n }\n\n // Regular pseudo classes have specificity [0,1,0]\n complexity++\n B++\n break\n }\n case 'Combinator': {\n complexity++\n break\n }\n }\n }\n })\n\n return {\n /** @type {[number,number,number]} */\n specificity: [A, B, C],\n complexity,\n isId: A > 0,\n isA11y\n }\n}\n\nexport {\n analyzeSpecificity,\n compareSpecificity,\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n const frequencies = Object.create(null)\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n\n for (let i = 0; i < arr.length; i++) {\n const element = arr[i]\n const updatedCount = (frequencies[element] || 0) + 1\n frequencies[element] = updatedCount\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n const middle = arr.length / 2\n const lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor(size) {\n /** @type number[] */\n this.items = new Uint8Array(size)\n this.sum = 0\n this.cursor = 0\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n add(item) {\n this.items[this.cursor] = item\n this.sum += item\n this.cursor++\n }\n\n aggregate() {\n if (this.cursor === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n /** @type Number[] */\n const sorted = new Uint8Array(\n this.items.slice(0, this.cursor)\n ).sort((a, b) => a - b)\n const min = sorted[0]\n const max = sorted[sorted.length - 1]\n\n const mode = Mode(sorted)\n const median = Median(sorted)\n\n return {\n min,\n max,\n mean: this.sum / this.cursor,\n mode,\n median,\n range: max - min,\n sum: this.sum,\n }\n }\n\n /**\n * @returns {number[]} All items in this collection\n */\n toArray() {\n return Array.from(\n this.items.subarray(0, this.cursor)\n )\n }\n}\n\nexport {\n AggregateCollection\n}","import walk from 'css-tree/walker'\nimport { AggregateCollection } from '../aggregate-collection.js'\n\nconst analyzeRules = ({ rules }) => {\n /** @type number */\n const totalRules = rules.length\n const selectorsPerRule = new AggregateCollection(totalRules)\n const declarationsPerRule = new AggregateCollection(totalRules)\n\n let emptyRules = 0\n\n for (let i = 0; i < totalRules; i++) {\n let selectors = 0\n let declarations = 0\n\n walk(rules[i], {\n enter: function (childNode) {\n if (childNode.type === 'Selector') {\n selectors++\n return this.skip\n }\n\n if (childNode.type === 'Declaration') {\n declarations++\n return this.skip\n }\n }\n })\n\n if (declarations === 0) {\n emptyRules++\n }\n\n // For later aggregations\n selectorsPerRule.add(selectors)\n declarationsPerRule.add(declarations)\n }\n\n return {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: totalRules === 0 ? 0 : emptyRules / totalRules\n },\n selectors: {\n ...selectorsPerRule.aggregate(),\n items: selectorsPerRule.toArray(),\n },\n declarations: {\n ...declarationsPerRule.aggregate(),\n items: declarationsPerRule.toArray()\n },\n }\n}\n\nexport {\n analyzeRules\n}","export const colorNames = {\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n aliceblue: 1,\n antiquewhite: 1,\n aqua: 1,\n aquamarine: 1,\n azure: 1,\n beige: 1,\n bisque: 1,\n black: 1,\n blanchedalmond: 1,\n blue: 1,\n blueviolet: 1,\n brown: 1,\n burlywood: 1,\n cadetblue: 1,\n chartreuse: 1,\n chocolate: 1,\n coral: 1,\n cornflowerblue: 1,\n cornsilk: 1,\n crimson: 1,\n cyan: 1,\n darkblue: 1,\n darkcyan: 1,\n darkgoldenrod: 1,\n darkgray: 1,\n darkgreen: 1,\n darkgrey: 1,\n darkkhaki: 1,\n darkmagenta: 1,\n darkolivegreen: 1,\n darkorange: 1,\n darkorchid: 1,\n darkred: 1,\n darksalmon: 1,\n darkseagreen: 1,\n darkslateblue: 1,\n darkslategray: 1,\n darkslategrey: 1,\n darkturquoise: 1,\n darkviolet: 1,\n deeppink: 1,\n deepskyblue: 1,\n dimgray: 1,\n dimgrey: 1,\n dodgerblue: 1,\n firebrick: 1,\n floralwhite: 1,\n forestgreen: 1,\n fuchsia: 1,\n gainsboro: 1,\n ghostwhite: 1,\n gold: 1,\n goldenrod: 1,\n gray: 1,\n green: 1,\n greenyellow: 1,\n grey: 1,\n honeydew: 1,\n hotpink: 1,\n indianred: 1,\n indigo: 1,\n ivory: 1,\n khaki: 1,\n lavender: 1,\n lavenderblush: 1,\n lawngreen: 1,\n lemonchiffon: 1,\n lightblue: 1,\n lightcoral: 1,\n lightcyan: 1,\n lightgoldenrodyellow: 1,\n lightgray: 1,\n lightgreen: 1,\n lightgrey: 1,\n lightpink: 1,\n lightsalmon: 1,\n lightseagreen: 1,\n lightskyblue: 1,\n lightslategray: 1,\n lightslategrey: 1,\n lightsteelblue: 1,\n lightyellow: 1,\n lime: 1,\n limegreen: 1,\n linen: 1,\n magenta: 1,\n maroon: 1,\n mediumaquamarine: 1,\n mediumblue: 1,\n mediumorchid: 1,\n mediumpurple: 1,\n mediumseagreen: 1,\n mediumslateblue: 1,\n mediumspringgreen: 1,\n mediumturquoise: 1,\n mediumvioletred: 1,\n midnightblue: 1,\n mintcream: 1,\n mistyrose: 1,\n moccasin: 1,\n navajowhite: 1,\n navy: 1,\n oldlace: 1,\n olive: 1,\n olivedrab: 1,\n orange: 1,\n orangered: 1,\n orchid: 1,\n palegoldenrod: 1,\n palegreen: 1,\n paleturquoise: 1,\n palevioletred: 1,\n papayawhip: 1,\n peachpuff: 1,\n peru: 1,\n pink: 1,\n plum: 1,\n powderblue: 1,\n purple: 1,\n rebeccapurple: 1,\n red: 1,\n rosybrown: 1,\n royalblue: 1,\n saddlebrown: 1,\n salmon: 1,\n sandybrown: 1,\n seagreen: 1,\n seashell: 1,\n sienna: 1,\n silver: 1,\n skyblue: 1,\n slateblue: 1,\n slategray: 1,\n slategrey: 1,\n snow: 1,\n springgreen: 1,\n steelblue: 1,\n tan: 1,\n teal: 1,\n thistle: 1,\n tomato: 1,\n turquoise: 1,\n violet: 1,\n wheat: 1,\n white: 1,\n whitesmoke: 1,\n yellow: 1,\n yellowgreen: 1,\n\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n canvas: 1,\n canvastext: 1,\n linktext: 1,\n visitedtext: 1,\n activetext: 1,\n buttonface: 1,\n buttontext: 1,\n buttonborder: 1,\n field: 1,\n fieldtext: 1,\n highlight: 1,\n highlighttext: 1,\n selecteditem: 1,\n selecteditemtext: 1,\n mark: 1,\n marktext: 1,\n graytext: 1,\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n}\n\nexport const colorFunctions = {\n rgb: 1,\n rgba: 1,\n hsl: 1,\n hsla: 1,\n hwb: 1,\n lab: 1,\n lch: 1,\n oklab: 1,\n oklch: 1,\n color: 1,\n}\n","class CountableCollection {\n /**\n * @param {string[]} initial\n */\n constructor(initial) {\n /** @type [index: string]: string */\n this.items = {}\n /** @type number */\n this.total = 0\n /** @type number */\n this.totalUnique = 0\n\n if (initial) {\n for (let index = 0; index < initial.length; index++) {\n this.push(initial[index])\n }\n }\n }\n\n /**\n * Push an item to the end of this collection\n * @param {string} item\n * @returns {void}\n */\n push(item) {\n this.total++\n\n if (this.items[item]) {\n this.items[item]++\n return\n }\n\n this.items[item] = 1\n this.totalUnique++\n }\n\n /**\n * Get the size of this collection\n * @returns {number} the size of this collection\n */\n size() {\n return this.total\n }\n\n /**\n * Get the counts of this collection, like total, uniques, etc.\n */\n count() {\n return {\n total: this.total,\n totalUnique: this.totalUnique,\n unique: this.items,\n uniquenessRatio: this.total === 0 ? 0 : this.totalUnique / this.total,\n }\n }\n}\n\nexport {\n CountableCollection\n}","import walk from 'css-tree/walker'\nimport generate from 'css-tree/generator'\nimport { CountableCollection } from '../countable-collection.js'\n\nconst systemKeywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst keywordDisallowList = {\n // font-weight, font-stretch, font-style\n 'normal': 1,\n\n // font-size keywords\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n\n // font-weight keywords\n 'bold': 1,\n 'bolder': 1,\n 'lighter': 1,\n\n // font-stretch keywords\n 'ultra-condensed': 1,\n 'extra-condensed': 1,\n 'condensed': 1,\n 'semi-condensed': 1,\n 'semi-expanded': 1,\n 'expanded': 1,\n 'extra-expanded': 1,\n 'ultra-expanded': 1,\n\n // font-style keywords\n 'italic': 1,\n 'oblique': 1,\n}\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\n\nconst analyzeFontFamilies = ({ fontValues, fontFamilyValues }) => {\n const all = new CountableCollection(fontFamilyValues)\n\n for (let index = 0; index < fontValues.length; index++) {\n const value = fontValues[index]\n\n // Avoid tree traversal as soon as possible\n const firstChild = value.children.first\n\n if (firstChild.type === 'Identifier' && systemKeywords[firstChild.name]) {\n continue\n }\n\n const parts = []\n\n walk(value, {\n reverse: true,\n enter: function (fontNode) {\n if (fontNode.type === 'String') {\n return parts.unshift(fontNode)\n }\n if (fontNode.type === 'Operator' && fontNode.value.charCodeAt(0) === COMMA) {\n return parts.unshift(fontNode)\n }\n if (fontNode.type === 'Identifier') {\n if (keywordDisallowList[fontNode.name]) {\n return this.skip\n }\n return parts.unshift(fontNode)\n }\n }\n })\n\n all.push(parts.map(generate).join(''))\n }\n\n return all.count()\n}\n\nexport {\n analyzeFontFamilies\n}","import walk from 'css-tree/walker'\nimport { CountableCollection } from '../countable-collection.js'\n\nconst sizeKeywords = {\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n}\n\nconst keywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst ZERO = 48 // '0'.charCodeAt(0) === 48\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\nconst analyzeFontSizes = ({ stringifyNode, fontSizeValues, fontValues }) => {\n const all = new CountableCollection(fontSizeValues)\n\n for (let index = 0; index < fontValues.length; index++) {\n const fontNode = fontValues[index];\n // Try to eliminate a keyword before we continue\n const firstChild = fontNode.children.first\n\n if (firstChild.type === 'Identifier' && keywords[firstChild.name]) {\n continue\n }\n\n let operator = false\n let size\n\n walk(fontNode, {\n enter: function (fontNode) {\n switch (fontNode.type) {\n case 'Number': {\n // Special case for `font: 0/0 a`\n if (fontNode.value.charCodeAt(0) === ZERO) {\n size = '0'\n return this.break\n }\n }\n case 'Operator': {\n if (fontNode.value.charCodeAt(0) === SLASH) {\n operator = true\n }\n break\n }\n case 'Dimension': {\n if (!operator) {\n size = stringifyNode(fontNode)\n return this.break\n }\n }\n case 'Identifier': {\n if (sizeKeywords[fontNode.name]) {\n size = fontNode.name\n return this.break\n }\n }\n }\n }\n })\n\n if (size) {\n all.push(size)\n }\n }\n\n return all.count()\n}\n\nexport {\n analyzeFontSizes\n}","const analyzeDeclarations = ({ stringifyNode, declarations }) => {\n /** @type number */\n const total = declarations.length\n const cache = Object.create(null)\n let importants = 0\n let totalUnique = 0\n let totalInKeyframes = 0\n\n for (let i = 0; i < total; i++) {\n const declaration = declarations[i]\n\n if (declaration.important === true) {\n importants++\n\n if (declaration.inKeyframe) {\n totalInKeyframes++\n }\n }\n\n const stringified = stringifyNode(declaration)\n\n if (!cache[stringified]) {\n cache[stringified] = 1\n totalUnique++\n }\n }\n\n return {\n total,\n unique: {\n total: totalUnique,\n ratio: total === 0 ? 0 : totalUnique / total,\n },\n importants: {\n total: importants,\n ratio: total === 0 ? 0 : importants / total,\n inKeyframes: {\n total: totalInKeyframes,\n ratio: importants === 0 ? 0 : totalInKeyframes / importants,\n },\n },\n }\n}\n\nexport {\n analyzeDeclarations\n}","import { analyzeSpecificity, compareSpecificity } from './specificity.js'\nimport { AggregateCollection } from '../aggregate-collection.js'\nimport { CountableCollection } from '../countable-collection.js'\n\nconst analyzeSelectors = ({ stringifyNode, selectors }) => {\n const counts = Object.create(null)\n const cache = Object.create(null)\n /** @type number */\n const totalSelectors = selectors.length\n\n /** @type [number,number,number] */\n let maxSpecificity\n /** @type [number,number,number] */\n let minSpecificity\n let specificityA = new AggregateCollection(totalSelectors)\n let specificityB = new AggregateCollection(totalSelectors)\n let specificityC = new AggregateCollection(totalSelectors)\n let totalUnique = 0\n const complexityAggregator = new AggregateCollection(totalSelectors);\n\n /** @type [number,number,number][] */\n const specificities = []\n /** @type number[] */\n const complexities = []\n const ids = new CountableCollection()\n const a11y = new CountableCollection()\n const keyframes = new CountableCollection()\n\n for (let i = 0; i < totalSelectors; i++) {\n /** @type import('css-tree').Selector */\n const node = selectors[i];\n /** @type string */\n const value = stringifyNode(node)\n\n if (node.isKeyframeSelector) {\n keyframes.push(value)\n // Do not attempt to further analyze <keyframe-selectors>\n continue\n }\n\n const { specificity, complexity, isId, isA11y } = cache[value] || analyzeSpecificity(node)\n\n if (isId) {\n ids.push(value)\n }\n\n if (isA11y) {\n a11y.push(value)\n }\n\n if (!cache[value]) {\n cache[value] = { complexity, specificity, isId, isA11y }\n totalUnique++\n counts[value] = 1\n } else {\n counts[value]++\n }\n\n complexityAggregator.add(complexity)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n specificityA.add(specificity[0])\n specificityB.add(specificity[1])\n specificityC.add(specificity[2])\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n complexities.push(complexity)\n }\n\n const aggregatesA = specificityA.aggregate()\n const aggregatesB = specificityB.aggregate()\n const aggregatesC = specificityC.aggregate()\n const complexityCount = new CountableCollection(complexities).count()\n\n return {\n total: totalSelectors,\n totalUnique,\n uniquenessRatio: totalSelectors === 0 ? 0 : totalUnique / totalSelectors,\n specificity: {\n /** @type [number, number, number] */\n min: minSpecificity,\n /** @type [number, number, number] */\n max: maxSpecificity,\n /** @type [number, number, number] */\n sum: [aggregatesA.sum, aggregatesB.sum, aggregatesC.sum],\n /** @type [number, number, number] */\n mean: [aggregatesA.mean, aggregatesB.mean, aggregatesC.mean],\n /** @type [number, number, number] */\n mode: [aggregatesA.mode, aggregatesB.mode, aggregatesC.mode],\n /** @type [number, number, number] */\n median: [aggregatesA.median, aggregatesB.median, aggregatesC.median],\n /** @type [number, number, number][] */\n items: specificities\n },\n complexity: {\n ...complexityAggregator.aggregate(),\n ...complexityCount,\n items: complexities,\n },\n id: {\n ...ids.count(),\n ratio: totalSelectors === 0 ? 0 : ids.size() / totalSelectors,\n },\n accessibility: {\n ...a11y.count(),\n ratio: totalSelectors === 0 ? 0 : a11y.size() / totalSelectors,\n },\n keyframes: {\n ...keyframes.count(),\n ratio: totalSelectors === 0 ? 0 : keyframes.size() / totalSelectors,\n }\n }\n}\n\nexport {\n analyzeSelectors\n}","import { CountableCollection } from '../countable-collection.js'\n\nconst analyzeProperties = ({ properties }) => {\n const all = new CountableCollection(properties.map(p => p.authored))\n const prefixed = new CountableCollection()\n const hacks = new CountableCollection()\n const customs = new CountableCollection()\n const totalProperties = properties.length\n\n for (let i = 0; i < totalProperties; i++) {\n const property = properties[i]\n\n if (property.vendor) {\n prefixed.push(property.authored)\n continue\n }\n\n if (property.hack) {\n hacks.push(property.authored)\n continue\n }\n\n if (property.custom) {\n customs.push(property.authored)\n continue\n }\n }\n\n return {\n ...all.count(),\n prefixed: {\n ...prefixed.count(),\n ratio: prefixed.size() / totalProperties,\n },\n custom: {\n ...customs.count(),\n ratio: customs.size() / totalProperties,\n },\n browserhacks: {\n ...hacks.count(),\n ratio: hacks.size() / totalProperties,\n }\n }\n}\n\nexport {\n analyzeProperties\n}","import { CountableCollection } from '../countable-collection.js'\n\nconst keywords = {\n 'auto': 1,\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n 'none': 1, // for `text-shadow`\n}\n\nconst analyzeValues = ({ values, stringifyNode }) => {\n const all = new CountableCollection()\n\n for (let i = 0; i < values.length; i++) {\n const node = values[i]\n const firstChild = node.children.first\n\n if (!firstChild) continue\n if (firstChild.type === 'Identifier' && keywords[firstChild.name]) continue\n\n all.push(stringifyNode(node))\n }\n\n return all.count()\n}\n\nexport {\n analyzeValues\n}","import { CountableCollection } from '../countable-collection.js'\n\nconst timingKeywords = {\n 'linear': 1,\n 'ease': 1,\n 'ease-in': 1,\n 'ease-out': 1,\n 'ease-in-out': 1,\n 'step-start': 1,\n 'step-end': 1,\n}\n\nconst analyzeAnimations = ({ animations, durations, timingFunctions, stringifyNode }) => {\n const allDurations = new CountableCollection(durations.map(stringifyNode))\n const allTimingFunctions = new CountableCollection(timingFunctions.map(stringifyNode))\n\n for (let index = 0; index < animations.length; index++) {\n const node = animations[index]\n // Flag to know if we've grabbed the first Duration\n // yet (the first Dimension in a shorthand)\n let durationFound = false\n\n node.value.children.forEach(child => {\n // Right after a ',' we start over again\n if (child.type === 'Operator') {\n return durationFound = false\n }\n if (child.type === 'Dimension' && durationFound === false) {\n durationFound = true\n return allDurations.push(stringifyNode(child))\n }\n if (child.type === 'Identifier' && timingKeywords[child.name]) {\n return allTimingFunctions.push(stringifyNode(child))\n }\n if (child.type === 'Function'\n && (\n child.name === 'cubic-bezier' || child.name === 'steps'\n )\n ) {\n return allTimingFunctions.push(stringifyNode(child))\n }\n })\n }\n\n return {\n durations: allDurations.count(),\n timingFunctions: allTimingFunctions.count(),\n }\n}\n\nexport {\n analyzeAnimations\n}","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import { CountableCollection } from '../countable-collection.js'\nimport { hasVendorPrefix } from '../vendor-prefix.js'\n\nfunction isAstVendorPrefixed(children) {\n children = children.toArray()\n\n for (let index = 0; index < children.length; index++) {\n const child = children[index];\n\n if (child.type === 'Identifier' && child.name.length >= 3) {\n if (hasVendorPrefix(child.name)) {\n return true\n }\n }\n\n if (child.type === 'Function') {\n if (hasVendorPrefix(child.name)) {\n return true\n }\n\n if (child.children && isAstVendorPrefixed(child.children)) {\n return true\n }\n }\n }\n return false\n}\n\nconst analyzeVendorPrefixes = ({ values, stringifyNode }) => {\n const all = new CountableCollection()\n\n for (let i = 0; i < values.length; i++) {\n /** @type {import('css-tree').Value} */\n const value = values[i]\n\n if (value.children && isAstVendorPrefixed(value.children)) {\n all.push(stringifyNode(value))\n }\n }\n\n return all.count()\n}\n\nexport {\n analyzeVendorPrefixes\n}","import { CountableCollection } from '../countable-collection.js'\nimport { hasVendorPrefix } from '../vendor-prefix.js'\n\nconst analyzeAtRules = ({ atrules, stringifyNode }) => {\n /** @type {{[index: string]: string}[]} */\n const fontfaces = []\n const imports = new CountableCollection()\n const medias = new CountableCollection()\n const charsets = new CountableCollection()\n const supports = new CountableCollection()\n const keyframes = new CountableCollection()\n const prefixedKeyframes = new CountableCollection()\n const containers = new CountableCollection()\n\n const machine = {\n 'font-face': (node) => {\n /** @type {[index: string]: string} */\n const descriptors = {}\n\n node.block.children.forEach(\n /** @param {import('css-tree').Declaration} descriptor */\n descriptor => (descriptors[descriptor.property] = stringifyNode(descriptor.value))\n )\n\n fontfaces.push(descriptors)\n },\n 'media': node => medias.push(node.prelude.value),\n 'supports': node => supports.push(node.prelude.value),\n 'keyframes': node => keyframes.push(`@${node.name} ${node.prelude.value}`),\n 'import': node => imports.push(node.prelude.value),\n 'charset': node => charsets.push(node.prelude.value),\n 'container': node => containers.push(node.prelude.value),\n }\n\n for (let i = 0; i < atrules.length; i++) {\n /** @type {import('css-tree').Atrule} */\n const node = atrules[i]\n const nodeName = node.name\n const action = machine[nodeName]\n if (action) {\n action(node)\n continue\n }\n\n if (nodeName.endsWith('keyframes')) {\n const name = `@${nodeName} ${node.prelude.value}`\n keyframes.push(name)\n\n if (hasVendorPrefix(nodeName)) {\n prefixedKeyframes.push(name)\n }\n continue\n }\n }\n\n return {\n fontface: {\n total: fontfaces.length,\n totalUnique: fontfaces.length,\n unique: fontfaces,\n uniquenessRatio: 1\n },\n import: imports.count(),\n media: medias.count(),\n charset: charsets.count(),\n supports: supports.count(),\n keyframes: {\n ...keyframes.count(),\n prefixed: {\n ...prefixedKeyframes.count(),\n ratio: keyframes.size() === 0 ? 0 : prefixedKeyframes.size() / keyframes.size()\n }\n },\n container: containers.count(),\n }\n}\n\nexport {\n analyzeAtRules\n}","import { CountableCollection } from './countable-collection.js'\n\nclass ContextCollection {\n constructor() {\n this.list = new CountableCollection()\n /** @type {[index; string]: CountableCollection} */\n this.contexts = {}\n this.contextCount = 0\n }\n\n /**\n * Add an item to this list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n */\n push(item, context) {\n this.list.push(item)\n\n if (!this.contexts[context]) {\n this.contexts[context] = new CountableCollection()\n this.contextCount++\n }\n\n this.contexts[context].push(item)\n }\n\n count() {\n /** @type {[index: string]: string} */\n const itemsPerContext = {}\n\n for (let context in this.contexts) {\n itemsPerContext[context] = this.contexts[context].count()\n }\n\n return Object.assign(this.list.count(), {\n itemsPerContext\n })\n }\n}\n\nexport {\n ContextCollection\n}","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { property as getProperty } from '../node_modules/css-tree/lib/utils/names.js'\nimport { compareSpecificity } from './selectors/specificity.js'\nimport { analyzeRules } from './rules/rules.js'\nimport { colorFunctions, colorNames } from './values/colors.js'\nimport { analyzeFontFamilies } from './values/font-families.js'\nimport { analyzeFontSizes } from './values/font-sizes.js'\nimport { analyzeDeclarations } from './declarations/declarations.js'\nimport { analyzeSelectors } from './selectors/selectors.js'\nimport { analyzeProperties } from './properties/properties.js'\nimport { analyzeValues } from './values/values.js'\nimport { analyzeAnimations } from './values/animations.js'\nimport { analyzeVendorPrefixes } from './values/vendor-prefix.js'\nimport { analyzeAtRules } from './atrules/atrules.js'\nimport { ContextCollection } from './context-collection.js'\nimport { CountableCollection } from './countable-collection.js'\n\n/**\n * Analyze CSS\n * @param {string} css\n */\nconst analyze = (css) => {\n const start = new Date()\n\n // We need all lines later on when we need to stringify the AST again\n // e.g. for Selectors\n const lines = css.split(/\\r?\\n/)\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n const start = node.loc.start\n const end = node.loc.end\n const lineCount = end.line - start.line\n\n // Single-line nodes\n if (lineCount === 0) {\n return lines[start.line - 1].substring(start.column - 1, end.column - 1)\n }\n\n // Multi-line nodes\n const value = []\n\n for (let i = start.line; i <= end.line; i++) {\n const line = lines[i - 1]\n // First line\n if (i === start.line) {\n value.push(line.substring(start.column - 1))\n continue\n }\n // Last line\n if (i === end.line) {\n value.push(line.substring(0, end.column - 1))\n continue\n }\n // All lines in between first and last\n value.push(line)\n }\n\n return value.join('\\n')\n }\n\n const startParse = new Date()\n let totalComments = 0\n let commentsSize = 0\n\n const ast = parse(css, {\n parseAtrulePrelude: false,\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n const startAnalysis = new Date()\n const atrules = []\n const rules = []\n const selectors = []\n const declarations = []\n const properties = []\n const values = []\n const zindex = []\n const textShadows = []\n const boxShadows = []\n const fontValues = []\n const fontFamilyValues = []\n const fontSizeValues = []\n const animations = []\n const timingFunctions = []\n const durations = []\n const colors = new ContextCollection()\n const units = new ContextCollection()\n const embeds = new CountableCollection()\n\n walk(ast, {\n enter: function (node) {\n switch (node.type) {\n case 'Atrule': {\n atrules.push(node)\n break\n }\n case 'Rule': {\n rules.push(node)\n break\n }\n case 'Selector': {\n selectors.push({\n ...node,\n isKeyframeSelector: this.atrule && this.atrule.name.endsWith('keyframes')\n })\n\n // Avoid further walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case 'Dimension': {\n if (!this.declaration) {\n break\n }\n\n units.push(node.unit, this.declaration.property)\n\n return this.skip\n }\n case 'Url': {\n if (node.value.startsWith('data:')) {\n embeds.push(node.value)\n }\n break\n }\n case 'Declaration': {\n declarations.push({\n ...node,\n inKeyframe: this.atrule && this.atrule.name.endsWith('keyframes')\n })\n\n const { value, property } = node\n const fullProperty = Object.assign({\n authored: property\n }, getProperty(property))\n\n properties.push(fullProperty)\n values.push(value)\n\n switch (fullProperty.basename) {\n case 'z-index': {\n zindex.push(value)\n break\n }\n case 'text-shadow': {\n textShadows.push(value)\n break\n }\n case 'box-shadow': {\n boxShadows.push(value)\n break\n }\n case 'font': {\n fontValues.push(value)\n break\n }\n case 'font-family': {\n fontFamilyValues.push(stringifyNode(value))\n // Prevent analyzer to find color names in this property\n return this.skip\n }\n case 'font-size': {\n fontSizeValues.push(stringifyNode(value))\n break\n }\n case 'transition':\n case 'animation': {\n animations.push(node)\n break\n }\n case 'animation-duration':\n case 'transition-duration': {\n durations.push(value)\n break\n }\n case 'transition-timing-function':\n case 'animation-timing-function': {\n timingFunctions.push(value)\n break\n }\n }\n\n walk(value, {\n enter: function (valueNode) {\n switch (valueNode.type) {\n case 'Hash': {\n colors.push(stringifyNode(valueNode), property)\n\n return this.skip\n }\n case 'Identifier': {\n const { name } = valueNode\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n if (name.length > 20 || name.length < 3) {\n return this.skip\n }\n if (colorNames[name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n return this.skip\n }\n case 'Function': {\n if (colorFunctions[valueNode.name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n }\n })\n }\n }\n }\n })\n const embeddedContent = embeds.count()\n const embedSize = Object.keys(embeddedContent.unique).join('').length\n\n return {\n stylesheet: {\n sourceLinesOfCode: atrules.length + selectors.length + declarations.length,\n linesOfCode: lines.length,\n size: css.length,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: Object.assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: css.length === 0 ? 0 : embedSize / css.length,\n },\n }),\n },\n atrules: analyzeAtRules({ atrules, stringifyNode }),\n rules: analyzeRules({ rules }),\n selectors: analyzeSelectors({ stringifyNode, selectors }),\n declarations: analyzeDeclarations({ stringifyNode, declarations }),\n properties: analyzeProperties({ properties }),\n values: {\n colors: colors.count(),\n fontFamilies: analyzeFontFamilies({ stringifyNode, fontValues, fontFamilyValues }),\n fontSizes: analyzeFontSizes({ stringifyNode, fontValues, fontSizeValues }),\n zindexes: analyzeValues({ values: zindex, stringifyNode }),\n textShadows: analyzeValues({ values: textShadows, stringifyNode }),\n boxShadows: analyzeValues({ values: boxShadows, stringifyNode }),\n animations: analyzeAnimations({ animations, timingFunctions, durations, stringifyNode }),\n prefixes: analyzeVendorPrefixes({ values, stringifyNode }),\n units: units.count(),\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: new Date() - startAnalysis,\n total: new Date() - start\n }\n }\n}\n\nexport {\n analyze,\n compareSpecificity,\n}\n"],"names":["properties","Map","property","has","get","name","hack","custom","str","length","offset","charCodeAt","toLowerCase","descriptor","set","vendor","secondDashIndex","indexOf","substring","getVendorPrefix","prefix","substr","Object","freeze","basename","compareSpecificity","a","b","selectorListSpecificities","selectorListAst","childSelectors","walk","visit","enter","node","push","analyzeSpecificity","sort","specificity","ast","A","B","C","complexity","isA11y","selector","type","Boolean","value","startsWith","includes","skip","selectorList","parse","children","first","context","i","isId","AggregateCollection","size","this","items","Uint8Array","sum","cursor","add","item","aggregate","min","max","mean","mode","median","range","arr","middle","lowerMiddleRank","sorted","slice","frequencies","create","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","Math","floor","toArray","Array","from","subarray","analyzeRules","rules","totalRules","selectorsPerRule","declarationsPerRule","emptyRules","selectors","declarations","childNode","total","empty","ratio","colorNames","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","canvas","canvastext","linktext","visitedtext","activetext","buttonface","buttontext","buttonborder","field","fieldtext","highlight","highlighttext","selecteditem","selecteditemtext","mark","marktext","graytext","colorFunctions","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","CountableCollection","initial","totalUnique","index","count","unique","uniquenessRatio","systemKeywords","inherit","unset","revert","caption","icon","menu","keywordDisallowList","normal","small","medium","large","larger","smaller","bold","bolder","lighter","condensed","expanded","italic","oblique","analyzeFontFamilies","fontValues","all","fontFamilyValues","firstChild","parts","reverse","fontNode","unshift","map","generate","join","sizeKeywords","keywords","analyzeFontSizes","stringifyNode","fontSizeValues","operator","analyzeDeclarations","cache","importants","totalInKeyframes","declaration","important","inKeyframe","stringified","inKeyframes","analyzeSelectors","maxSpecificity","minSpecificity","counts","totalSelectors","specificityA","specificityB","specificityC","complexityAggregator","specificities","complexities","ids","a11y","keyframes","isKeyframeSelector","undefined","aggregatesA","aggregatesB","aggregatesC","complexityCount","id","accessibility","analyzeProperties","p","authored","prefixed","hacks","customs","totalProperties","browserhacks","auto","none","analyzeValues","values","timingKeywords","linear","ease","analyzeAnimations","animations","timingFunctions","allDurations","durations","allTimingFunctions","durationFound","forEach","child","hasVendorPrefix","keyword","isAstVendorPrefixed","analyzeVendorPrefixes","analyzeAtRules","atrules","fontfaces","imports","medias","charsets","supports","prefixedKeyframes","containers","machine","descriptors","block","media","prelude","import","charset","container","nodeName","action","endsWith","fontface","ContextCollection","list","contexts","contextCount","itemsPerContext","assign","css","start","Date","lines","split","loc","end","line","column","startParse","totalComments","commentsSize","parseAtrulePrelude","parseCustomProperty","positions","onComment","comment","startAnalysis","zindex","textShadows","boxShadows","colors","units","embeds","atrule","unit","fullProperty","getProperty","valueNode","embeddedContent","embedSize","keys","stylesheet","sourceLinesOfCode","linesOfCode","comments","fontFamilies","fontSizes","zindexes","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"sbACA,MAAMA,EAAa,IAAIC,IAIVC,EAuDb,SAA+BA,GAC3B,GAAIF,EAAWG,IAAID,GACf,OAAOF,EAAWI,IAAIF,GAG1B,IAAIG,EAAOH,EACPI,EAAOJ,EAAS,GAEP,MAATI,EACAA,EAAuB,MAAhBJ,EAAS,GAAa,KAAO,IACpB,MAATI,GACS,MAATA,GACS,MAATA,GACS,MAATA,GACS,MAATA,GACS,MAATA,IACPA,EAAO,IAGX,MAAMC,GAxEuBC,EAwEGH,GArErBI,QAFXC,GADkCA,EAwEIJ,EAAKG,SAvExB,IAEW,GARd,KASTD,EAAIG,WAAWD,IATN,KAUTF,EAAIG,WAAWD,EAAS,GAL5B,IAA0BF,EAAKE,EA2ElC,IAAKH,IACDF,EAAOA,EAAKO,cACRZ,EAAWG,IAAIE,IAAO,CACtB,MAAMQ,EAAab,EAAWI,IAAIC,GAElC,OADAL,EAAWc,IAAIZ,EAAUW,GAClBA,EAIf,MAAME,EAAUR,EAA8C,GA5ElE,SAAyBC,EAAKE,GAI1B,GAAIF,EAAIC,QAHRC,EAASA,GAAU,IAGQ,GAjBX,KAmBRF,EAAIG,WAAWD,IAnBP,KAoBRF,EAAIG,WAAWD,EAAS,GAAoB,CAE5C,MAAMM,EAAkBR,EAAIS,QAAQ,IAAKP,EAAS,GAElD,IAAyB,IAArBM,EACA,OAAOR,EAAIU,UAAUR,EAAQM,EAAkB,GAK3D,MAAO,GA2DkBG,CAAgBd,EAAMC,EAAKG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,EAAa5G,cAAAA,IAClD6G,WAAYjE,EAAc,CAAEC,OAAQgE,EAAY7G,cAAAA,IAChDkD,WAAYD,EAAkB,CAAEC,WAAAA,EAAYC,gBAAAA,EAAiBE,UAAAA,EAAWrD,cAAAA,IACxEgI,SAAUnE,EAAsB,CAAEhB,OAAAA,EAAQ7C,cAAAA,IAC1C+G,MAAOA,EAAMtJ,SAEfwK,SAAU,CACRC,UAAWxB,EAAgBR,EAC3BiC,YAAa,IAAIxC,KAASe,EAC1BzU,MAAO,IAAI0T,KAASD"}
1
+ {"version":3,"file":"analyzer.cjs","sources":["../src/string-utils.js","../src/selectors/specificity.js","../src/values/colors.js","../src/values/font-families.js","../src/values/font-sizes.js","../src/values/values.js","../src/values/animations.js","../src/vendor-prefix.js","../src/values/vendor-prefix.js","../src/countable-collection.js","../src/context-collection.js","../src/aggregate-collection.js","../src/properties/property-utils.js","../src/occurrence-counter.js","../src/index.js","../src/rules/rules.js"],"sourcesContent":["/**\n * Case-insensitive compare two character codes\n * @param {string} charA\n * @param {string} charB\n * @see https://github.com/csstree/csstree/blob/41f276e8862d8223eeaa01a3d113ab70bb13d2d9/lib/tokenizer/utils.js#L22\n */\nfunction compareChar(referenceCode, testCode) {\n // if uppercase\n if (testCode >= 0x0041 && testCode <= 0x005A) {\n // shifting the 6th bit makes a letter lowercase\n testCode = testCode | 32\n }\n return referenceCode === testCode\n}\n\n/**\n * Case-insensitive string-comparison\n * @param {string} base\n * @param {string} test\n * @returns {boolean} true if the two strings are the same, false otherwise\n */\nexport function strEquals(base, test) {\n if (base.length !== test.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string ends with a given substring\n * @param {string} base e.g. '-webkit-transform'\n * @param {string} cmp e.g. 'transform'\n * @returns {boolean} true if `test` ends with `base`, false otherwise\n */\nexport function endsWith(base, test) {\n const offset = test.length - base.length\n\n if (offset < 0) {\n return false\n }\n\n for (let i = test.length - 1; i >= offset; i--) {\n if (compareChar(base.charCodeAt(i - offset), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string starts with a given substring\n * @param {string} base\n * @param {test} test\n * @returns {boolean} true if `test` starts with `base`, false otherwise\n */\nexport function startsWith(base, test) {\n if (test.length < base.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n","import walk from 'css-tree/walker'\nimport { startsWith } from '../string-utils.js'\n\n/**\n * Compare specificity A to Specificity B\n * @param {[number,number,number]} a - Specificity A\n * @param {[number,number,number]} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nfunction compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector} topSpecificitySelector\n */\nfunction selectorListSpecificities(selectorListAst) {\n const childSelectors = []\n walk(selectorListAst, {\n visit: 'Selector',\n enter(node) {\n childSelectors.push(analyzeSpecificity(node))\n }\n })\n\n return childSelectors.sort((a, b) => compareSpecificity(a.specificity, b.specificity))\n}\n\n/**\n * Get the Specificity for the AST of a Selector Node\n * @param {import('css-tree').Selector} ast - AST Node for a Selector\n * @return {Object}\n * @property {[number,number,number]} specificity\n * @property {number} complexity\n * @property {Boolean} isId\n * @property {Boolean} isA11y\n */\nconst analyzeSpecificity = (node) => {\n let A = 0\n let B = 0\n let C = 0\n let complexity = 0\n let isA11y = false\n\n walk(node, function (selector) {\n switch (selector.type) {\n case 'IdSelector': {\n A++\n complexity++\n break\n }\n case 'ClassSelector': {\n B++\n complexity++\n break\n }\n case 'AttributeSelector': {\n B++\n complexity++\n\n // Add 1 for [attr=value] (or any variation using *= $= ^= |= )\n if (Boolean(selector.value)) {\n complexity++\n }\n\n isA11y = selector.name.name === 'role' || startsWith('aria-', selector.name.name)\n break\n }\n case 'PseudoElementSelector':\n case 'TypeSelector': {\n complexity++\n\n // 42 === '*'.charCodeAt(0)\n if (selector.name.charCodeAt(0) === 42 && selector.name.length === 1) {\n break\n }\n\n C++\n break\n }\n case 'PseudoClassSelector': {\n switch (selector.name) {\n case 'before':\n case 'after':\n case 'first-letter':\n case 'first-line': {\n C++\n complexity++\n return this.skip\n }\n\n // The specificity of an :is(), :not(), or :has() pseudo-class is\n // replaced by the specificity of the most specific complex\n // selector in its selector list argument.\n case 'where':\n case 'is':\n case 'has':\n case 'matches':\n case '-webkit-any':\n case '-moz-any':\n case 'not':\n case 'nth-child':\n case 'nth-last-child': {\n // The specificity of an :nth-child() or :nth-last-child() selector\n // is the specificity of the pseudo class itself (counting as one\n // pseudo-class selector) plus the specificity of the most\n // specific complex selector in its selector list argument (if any).\n if (selector.name === 'nth-child' || selector.name === 'nth-last-child') {\n // +1 for the pseudo class itself\n B++\n }\n\n const selectorList = selectorListSpecificities(selector)\n\n // Bail out for empty/non-existent :nth-child() params\n if (selectorList.length === 0) return\n\n // The specificity of a :where() pseudo-class is replaced by zero,\n // but it does count towards complexity.\n if (selector.name !== 'where') {\n const [topA, topB, topC] = selectorList[0].specificity\n A += topA\n B += topB\n C += topC\n }\n\n for (let i = 0; i < selectorList.length; i++) {\n const listItem = selectorList[i]\n if (listItem.isA11y) {\n isA11y = true\n }\n complexity += listItem.complexity\n }\n\n complexity++\n return this.skip\n }\n\n default: {\n // Regular pseudo classes have specificity [0,1,0]\n complexity++\n B++\n return this.skip\n }\n }\n }\n case 'Combinator': {\n complexity++\n break\n }\n }\n })\n\n return {\n /** @type {[number,number,number]} */\n specificity: [A, B, C],\n complexity,\n isId: A > 0,\n isA11y\n }\n}\n\nexport {\n analyzeSpecificity,\n compareSpecificity,\n}","export const colorNames = {\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n aliceblue: 1,\n antiquewhite: 1,\n aqua: 1,\n aquamarine: 1,\n azure: 1,\n beige: 1,\n bisque: 1,\n black: 1,\n blanchedalmond: 1,\n blue: 1,\n blueviolet: 1,\n brown: 1,\n burlywood: 1,\n cadetblue: 1,\n chartreuse: 1,\n chocolate: 1,\n coral: 1,\n cornflowerblue: 1,\n cornsilk: 1,\n crimson: 1,\n cyan: 1,\n darkblue: 1,\n darkcyan: 1,\n darkgoldenrod: 1,\n darkgray: 1,\n darkgreen: 1,\n darkgrey: 1,\n darkkhaki: 1,\n darkmagenta: 1,\n darkolivegreen: 1,\n darkorange: 1,\n darkorchid: 1,\n darkred: 1,\n darksalmon: 1,\n darkseagreen: 1,\n darkslateblue: 1,\n darkslategray: 1,\n darkslategrey: 1,\n darkturquoise: 1,\n darkviolet: 1,\n deeppink: 1,\n deepskyblue: 1,\n dimgray: 1,\n dimgrey: 1,\n dodgerblue: 1,\n firebrick: 1,\n floralwhite: 1,\n forestgreen: 1,\n fuchsia: 1,\n gainsboro: 1,\n ghostwhite: 1,\n gold: 1,\n goldenrod: 1,\n gray: 1,\n green: 1,\n greenyellow: 1,\n grey: 1,\n honeydew: 1,\n hotpink: 1,\n indianred: 1,\n indigo: 1,\n ivory: 1,\n khaki: 1,\n lavender: 1,\n lavenderblush: 1,\n lawngreen: 1,\n lemonchiffon: 1,\n lightblue: 1,\n lightcoral: 1,\n lightcyan: 1,\n lightgoldenrodyellow: 1,\n lightgray: 1,\n lightgreen: 1,\n lightgrey: 1,\n lightpink: 1,\n lightsalmon: 1,\n lightseagreen: 1,\n lightskyblue: 1,\n lightslategray: 1,\n lightslategrey: 1,\n lightsteelblue: 1,\n lightyellow: 1,\n lime: 1,\n limegreen: 1,\n linen: 1,\n magenta: 1,\n maroon: 1,\n mediumaquamarine: 1,\n mediumblue: 1,\n mediumorchid: 1,\n mediumpurple: 1,\n mediumseagreen: 1,\n mediumslateblue: 1,\n mediumspringgreen: 1,\n mediumturquoise: 1,\n mediumvioletred: 1,\n midnightblue: 1,\n mintcream: 1,\n mistyrose: 1,\n moccasin: 1,\n navajowhite: 1,\n navy: 1,\n oldlace: 1,\n olive: 1,\n olivedrab: 1,\n orange: 1,\n orangered: 1,\n orchid: 1,\n palegoldenrod: 1,\n palegreen: 1,\n paleturquoise: 1,\n palevioletred: 1,\n papayawhip: 1,\n peachpuff: 1,\n peru: 1,\n pink: 1,\n plum: 1,\n powderblue: 1,\n purple: 1,\n rebeccapurple: 1,\n red: 1,\n rosybrown: 1,\n royalblue: 1,\n saddlebrown: 1,\n salmon: 1,\n sandybrown: 1,\n seagreen: 1,\n seashell: 1,\n sienna: 1,\n silver: 1,\n skyblue: 1,\n slateblue: 1,\n slategray: 1,\n slategrey: 1,\n snow: 1,\n springgreen: 1,\n steelblue: 1,\n tan: 1,\n teal: 1,\n thistle: 1,\n tomato: 1,\n turquoise: 1,\n violet: 1,\n wheat: 1,\n white: 1,\n whitesmoke: 1,\n yellow: 1,\n yellowgreen: 1,\n\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n canvas: 1,\n canvastext: 1,\n linktext: 1,\n visitedtext: 1,\n activetext: 1,\n buttonface: 1,\n buttontext: 1,\n buttonborder: 1,\n field: 1,\n fieldtext: 1,\n highlight: 1,\n highlighttext: 1,\n selecteditem: 1,\n selecteditemtext: 1,\n mark: 1,\n marktext: 1,\n graytext: 1,\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n}\n\nexport const colorFunctions = {\n rgb: 1,\n rgba: 1,\n hsl: 1,\n hsla: 1,\n hwb: 1,\n lab: 1,\n lch: 1,\n oklab: 1,\n oklch: 1,\n color: 1,\n}\n","import walk from 'css-tree/walker'\n\nconst systemKeywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst keywordDisallowList = {\n // font-weight, font-stretch, font-style\n 'normal': 1,\n\n // font-size keywords\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n\n // font-weight keywords\n 'bold': 1,\n 'bolder': 1,\n 'lighter': 1,\n\n // font-stretch keywords\n 'ultra-condensed': 1,\n 'extra-condensed': 1,\n 'condensed': 1,\n 'semi-condensed': 1,\n 'semi-expanded': 1,\n 'expanded': 1,\n 'extra-expanded': 1,\n 'ultra-expanded': 1,\n\n // font-style keywords\n 'italic': 1,\n 'oblique': 1,\n}\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\n\nexport function isFontFamilyKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && systemKeywords[firstChild.name]\n}\n\nexport function getFamilyFromFont(node, stringifyNode) {\n let parts = ''\n\n walk(node, {\n reverse: true,\n enter: function (fontNode) {\n if (fontNode.type === 'String') {\n const loc = fontNode.loc.start\n // Stringify the first character to get the correct quote character\n const quote = stringifyNode({\n loc: {\n start: {\n line: loc.line,\n column: loc.column\n },\n end: {\n line: loc.line,\n column: loc.column + 1\n }\n }\n })\n return parts = quote + fontNode.value + quote + parts\n }\n if (fontNode.type === 'Operator' && fontNode.value.charCodeAt(0) === COMMA) {\n return parts = fontNode.value + parts\n }\n if (fontNode.type === 'Identifier') {\n if (keywordDisallowList[fontNode.name]) {\n return this.skip\n }\n return parts = fontNode.name + parts\n }\n }\n })\n\n return parts\n}\n","import walk from 'css-tree/walker'\n\nconst sizeKeywords = {\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n}\n\nconst keywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst ZERO = 48 // '0'.charCodeAt(0) === 48\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\nexport function isFontSizeKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && keywords[firstChild.name]\n}\n\nexport function getSizeFromFont(node) {\n let operator = false\n let size\n\n walk(node, function (fontNode) {\n switch (fontNode.type) {\n case 'Number': {\n // Special case for `font: 0/0 a`\n if (fontNode.value.charCodeAt(0) === ZERO) {\n size = '0'\n return this.break\n }\n }\n case 'Operator': {\n if (fontNode.value.charCodeAt(0) === SLASH) {\n operator = true\n }\n break\n }\n case 'Dimension': {\n if (!operator) {\n size = fontNode.value + fontNode.unit\n return this.break\n }\n }\n case 'Identifier': {\n if (sizeKeywords[fontNode.name]) {\n size = fontNode.name\n return this.break\n }\n }\n }\n })\n\n return size\n}\n","const keywords = {\n 'auto': 1,\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n 'none': 1, // for `text-shadow`, `box-shadow` and `background`\n}\n\nexport function isValueKeyword(node) {\n if (!node.children) return false\n const firstChild = node.children.first\n\n if (!firstChild) return false\n if (node.children.size > 1) return false\n return firstChild.type === 'Identifier' && keywords[firstChild.name]\n}\n","const timingKeywords = {\n 'linear': 1,\n 'ease': 1,\n 'ease-in': 1,\n 'ease-out': 1,\n 'ease-in-out': 1,\n 'step-start': 1,\n 'step-end': 1,\n}\n\nexport function analyzeAnimation(children, stringifyNode) {\n let durationFound = false\n const durations = []\n const timingFunctions = []\n\n children.forEach(child => {\n // Right after a ',' we start over again\n if (child.type === 'Operator') {\n return durationFound = false\n }\n if (child.type === 'Dimension' && durationFound === false) {\n durationFound = true\n return durations.push(stringifyNode(child))\n }\n if (child.type === 'Identifier' && timingKeywords[child.name]) {\n return timingFunctions.push(stringifyNode(child))\n }\n if (child.type === 'Function'\n && (\n child.name === 'cubic-bezier' || child.name === 'steps'\n )\n ) {\n return timingFunctions.push(stringifyNode(child))\n }\n })\n\n return [durations, timingFunctions]\n}\n","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\n\nexport function isAstVendorPrefixed(node) {\n if (!node.children) {\n return false\n }\n\n const children = node.children.toArray()\n\n for (let index = 0; index < children.length; index++) {\n const node = children[index]\n const { type, name } = node;\n\n if (type === 'Identifier' && hasVendorPrefix(name)) {\n return true\n }\n\n if (type === 'Function') {\n if (hasVendorPrefix(name)) {\n return true\n }\n\n if (isAstVendorPrefixed(node)) {\n return true\n }\n }\n }\n\n return false\n}\n","class CountableCollection {\n /**\n * @param {string[]} initial\n */\n constructor(initial) {\n /** @type [index: string]: string */\n this._items = {}\n /** @type number */\n this._total = 0\n /** @type number */\n this._totalUnique = 0\n\n if (initial) {\n for (let i = 0; i < initial.length; i++) {\n this.push(initial[i])\n }\n }\n }\n\n /**\n * Push an item to the end of this collection\n * @param {string} item\n * @returns {void}\n */\n push(item) {\n this._total++\n\n if (this._items[item]) {\n this._items[item]++\n return\n }\n\n this._items[item] = 1\n this._totalUnique++\n }\n\n /**\n * Get the size of this collection\n * @returns {number} the size of this collection\n */\n size() {\n return this._total\n }\n\n /**\n * Get the counts of this collection, like total, uniques, etc.\n */\n count() {\n return {\n total: this._total,\n totalUnique: this._totalUnique,\n unique: this._items,\n uniquenessRatio: this._total === 0 ? 0 : this._totalUnique / this._total,\n }\n }\n}\n\nexport {\n CountableCollection\n}","import { CountableCollection } from './countable-collection.js'\n\nclass ContextCollection {\n constructor() {\n this._list = new CountableCollection()\n /** @type {[index; string]: CountableCollection} */\n this._contexts = {}\n }\n\n /**\n * Add an item to this _list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n */\n push(item, context) {\n this._list.push(item)\n\n if (!this._contexts[context]) {\n this._contexts[context] = new CountableCollection()\n }\n\n this._contexts[context].push(item)\n }\n\n count() {\n /** @type {[index: string]: string} */\n const itemsPerContext = {}\n\n for (let context in this._contexts) {\n itemsPerContext[context] = this._contexts[context].count()\n }\n\n return Object.assign(this._list.count(), {\n itemsPerContext\n })\n }\n}\n\nexport {\n ContextCollection\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n const frequencies = Object.create(null)\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n\n for (let i = 0; i < arr.length; i++) {\n const element = arr[i]\n const updatedCount = (frequencies[element] || 0) + 1\n frequencies[element] = updatedCount\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n const middle = arr.length / 2\n const lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor() {\n /** @type number[] */\n this._items = []\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n add(item) {\n this._items.push(item)\n }\n\n size() {\n return this._items.length\n }\n\n aggregate() {\n if (this._items.length === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n // TODO: can we avoid this sort()? It's slow\n /** @type Number[] */\n const sorted = this._items.slice().sort((a, b) => a - b)\n const min = sorted[0]\n const max = sorted[sorted.length - 1]\n\n const sum = this._items.reduce((total, num) => (total += num))\n const mode = Mode(this._items)\n const median = Median(sorted)\n\n return {\n min,\n max,\n mean: sum / this._items.length,\n mode,\n median,\n range: max - min,\n sum,\n }\n }\n\n /**\n * @returns {number[]} All _items in this collection\n */\n toArray() {\n return this._items\n }\n}\n\nexport {\n AggregateCollection\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { endsWith } from '../string-utils.js'\n\n/**\n * @param {string} property\n * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69\n */\nexport function isHack(property) {\n if (isCustom(property) || hasVendorPrefix(property)) return false\n\n let code = property.charCodeAt(0)\n\n return code === 47 // /\n || code === 95 // _\n || code === 43 // +\n || code === 42 // *\n || code === 38 // &\n || code === 36 // $\n || code === 35 // #\n}\n\nexport function isCustom(property) {\n if (property.length < 3) return false\n // 45 === '-'.charCodeAt(0)\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45\n}\n\nexport function isProperty(basename, property) {\n if (isCustom(property)) return false\n return endsWith(basename, property)\n}","export class OccurrenceCounter {\n constructor() {\n this._items = Object.create(null)\n }\n\n push(item) {\n if (this._items[item]) {\n return this._items[item]++\n }\n\n return this._items[item] = 1\n }\n\n count() {\n return Object.keys(this._items).length\n }\n}\n","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { analyzeRule } from './rules/rules.js'\nimport { analyzeSpecificity, compareSpecificity } from './selectors/specificity.js'\nimport { colorFunctions, colorNames } from './values/colors.js'\nimport { isFontFamilyKeyword, getFamilyFromFont } from './values/font-families.js'\nimport { isFontSizeKeyword, getSizeFromFont } from './values/font-sizes.js'\nimport { isValueKeyword } from './values/values.js'\nimport { analyzeAnimation } from './values/animations.js'\nimport { isAstVendorPrefixed } from './values/vendor-prefix.js'\nimport { ContextCollection } from './context-collection.js'\nimport { CountableCollection } from './countable-collection.js'\nimport { AggregateCollection } from './aggregate-collection.js'\nimport { strEquals, startsWith, endsWith } from './string-utils.js'\nimport { hasVendorPrefix } from './vendor-prefix.js'\nimport { isCustom, isHack, isProperty } from './properties/property-utils.js'\nimport { OccurrenceCounter } from './occurrence-counter.js'\n\n/**\n * Analyze CSS\n * @param {string} css\n */\nconst analyze = (css) => {\n const start = new Date()\n\n // We need all lines later on when we need to stringify the AST again\n // e.g. for Selectors\n const lines = css.split(/\\r?\\n/)\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n const start = node.loc.start\n const end = node.loc.end\n const lineCount = end.line - start.line\n\n // Single-line nodes\n if (lineCount === 0) {\n return lines[start.line - 1].substring(start.column - 1, end.column - 1)\n }\n\n // Multi-line nodes\n let value = ''\n\n for (let i = start.line; i <= end.line; i++) {\n const line = lines[i - 1]\n // First line\n if (i === start.line) {\n value += line.substring(start.column - 1) + '\\n'\n continue\n }\n // Last line\n if (i === end.line) {\n value += line.substring(0, end.column - 1)\n continue\n }\n // All lines in between first and last\n value += line + '\\n'\n }\n\n return value\n }\n\n // Stylesheet\n let totalComments = 0\n let commentsSize = 0\n const embeds = new CountableCollection()\n\n const startParse = new Date()\n\n const ast = parse(css, {\n parseAtrulePrelude: false,\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n const startAnalysis = new Date()\n\n // Atrules\n let totalAtRules = 0\n /** @type {{[index: string]: string}[]} */\n const fontfaces = []\n const layers = new CountableCollection()\n const imports = new CountableCollection()\n const medias = new CountableCollection()\n const charsets = new CountableCollection()\n const supports = new CountableCollection()\n const keyframes = new CountableCollection()\n const prefixedKeyframes = new CountableCollection()\n const containers = new CountableCollection()\n\n // Rules\n let totalRules = 0\n let emptyRules = 0\n const selectorsPerRule = new AggregateCollection()\n const declarationsPerRule = new AggregateCollection()\n\n // SELECTORS\n const keyframeSelectors = new CountableCollection()\n /** @type number */\n const uniqueSelectors = new OccurrenceCounter()\n /** @type [number,number,number] */\n let maxSpecificity\n /** @type [number,number,number] */\n let minSpecificity\n let specificityA = new AggregateCollection()\n let specificityB = new AggregateCollection()\n let specificityC = new AggregateCollection()\n const selectorComplexities = new AggregateCollection()\n /** @type [number,number,number][] */\n const specificities = []\n const ids = new CountableCollection()\n const a11y = new CountableCollection()\n\n // Declarations\n const uniqueDeclarations = new OccurrenceCounter()\n let totalDeclarations = 0\n let importantDeclarations = 0\n let importantsInKeyframes = 0\n\n // Properties\n const properties = new CountableCollection()\n const propertyHacks = new CountableCollection()\n const propertyVendorPrefixes = new CountableCollection()\n const customProperties = new CountableCollection()\n\n // Values\n const vendorPrefixedValues = new CountableCollection()\n const zindex = new CountableCollection()\n const textShadows = new CountableCollection()\n const boxShadows = new CountableCollection()\n const fontFamilies = new CountableCollection()\n const fontSizes = new CountableCollection()\n const timingFunctions = new CountableCollection()\n const durations = new CountableCollection()\n const colors = new ContextCollection()\n const units = new ContextCollection()\n\n walk(ast, function (node) {\n switch (node.type) {\n case 'Atrule': {\n totalAtRules++\n const atRuleName = node.name\n\n if (atRuleName === 'font-face') {\n /** @type {[index: string]: string} */\n const descriptors = {}\n\n node.block.children.forEach(\n /** @param {import('css-tree').Declaration} descriptor */\n descriptor => (descriptors[descriptor.property] = stringifyNode(descriptor.value))\n )\n\n fontfaces.push(descriptors)\n break\n }\n if (atRuleName === 'media') {\n medias.push(node.prelude.value)\n break\n }\n if (atRuleName === 'supports') {\n supports.push(node.prelude.value)\n break\n }\n if (endsWith('keyframes', atRuleName)) {\n const name = '@' + atRuleName + ' ' + node.prelude.value\n if (hasVendorPrefix(atRuleName)) {\n prefixedKeyframes.push(name)\n }\n keyframes.push(name)\n break\n }\n if (atRuleName === 'import') {\n imports.push(node.prelude.value)\n break\n }\n if (atRuleName === 'charset') {\n charsets.push(node.prelude.value)\n break\n }\n if (atRuleName === 'container') {\n containers.push(node.prelude.value)\n break\n }\n if (atRuleName === 'layer') {\n containers.push(\n node.prelude.value.trim()\n .split(',')\n .map(name => name.trim())\n .forEach(name => layers.push(name))\n )\n }\n break\n }\n case 'Rule': {\n const [numSelectors, numDeclarations] = analyzeRule(node)\n\n totalRules++\n\n if (numDeclarations === 0) {\n emptyRules++\n }\n\n selectorsPerRule.add(numSelectors)\n declarationsPerRule.add(numDeclarations)\n break\n }\n case 'Selector': {\n const selector = stringifyNode(node)\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n keyframeSelectors.push(selector)\n return this.skip\n }\n\n const { specificity, complexity, isId, isA11y } = analyzeSpecificity(node)\n\n if (isId) {\n ids.push(selector)\n }\n\n if (isA11y) {\n a11y.push(selector)\n }\n\n uniqueSelectors.push(selector)\n selectorComplexities.add(complexity)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n specificityA.add(specificity[0])\n specificityB.add(specificity[1])\n specificityC.add(specificity[2])\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n\n // Avoid deeper walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case 'Dimension': {\n if (!this.declaration) {\n break\n }\n\n units.push(node.unit, this.declaration.property)\n\n return this.skip\n }\n case 'Url': {\n if (startsWith('data:', node.value)) {\n embeds.push(node.value)\n }\n break\n }\n case 'Value': {\n if (isValueKeyword(node)) {\n break\n }\n\n const property = this.declaration.property\n\n if (isAstVendorPrefixed(node)) {\n vendorPrefixedValues.push(stringifyNode(node))\n }\n\n // Process properties first that don't have colors,\n // so we can avoid further walking them;\n if (isProperty('z-index', property)) {\n if (!isValueKeyword(node)) {\n zindex.push(stringifyNode(node))\n }\n return this.skip\n } else if (isProperty('font', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(getFamilyFromFont(node, stringifyNode))\n }\n if (!isFontSizeKeyword(node)) {\n const size = getSizeFromFont(node)\n if (size) {\n fontSizes.push(size)\n }\n }\n break\n } else if (isProperty('font-size', property)) {\n if (!isFontSizeKeyword(node)) {\n fontSizes.push(stringifyNode(node))\n }\n break\n } else if (isProperty('font-family', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(stringifyNode(node))\n }\n break\n } else if (isProperty('transition', property) || isProperty('animation', property)) {\n const [times, fns] = analyzeAnimation(node.children, stringifyNode)\n for (let i = 0; i < times.length; i++) {\n durations.push(times[i])\n }\n for (let i = 0; i < fns.length; i++) {\n timingFunctions.push(fns[i])\n }\n break\n } else if (isProperty('animation-duration', property) || isProperty('transition-duration', property)) {\n durations.push(stringifyNode(node))\n break\n } else if (isProperty('transition-timing-function', property) || isProperty('animation-timing-function', property)) {\n timingFunctions.push(stringifyNode(node))\n break\n } else if (isProperty('text-shadow', property)) {\n if (!isValueKeyword(node)) {\n textShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n } else if (isProperty('box-shadow', property)) {\n if (!isValueKeyword(node)) {\n boxShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n }\n\n walk(node, function (valueNode) {\n switch (valueNode.type) {\n case 'Hash': {\n colors.push('#' + valueNode.value, property)\n\n return this.skip\n }\n case 'Identifier': {\n const { name } = valueNode\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n if (name.length > 20 || name.length < 3) {\n return this.skip\n }\n if (colorNames[name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n return this.skip\n }\n case 'Function': {\n // Don't walk var() multiple times\n if (strEquals('var', valueNode.name)) {\n return this.skip\n }\n if (colorFunctions[valueNode.name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n })\n break\n }\n case 'Declaration': {\n totalDeclarations++\n\n const declaration = stringifyNode(node)\n uniqueDeclarations.push(declaration)\n\n if (node.important) {\n importantDeclarations++\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n importantsInKeyframes++\n }\n }\n\n const { property } = node\n\n properties.push(property)\n\n if (hasVendorPrefix(property)) {\n propertyVendorPrefixes.push(property)\n } else if (isHack(property)) {\n propertyHacks.push(property)\n } else if (isCustom(property)) {\n customProperties.push(property)\n }\n break\n }\n }\n })\n\n const embeddedContent = embeds.count()\n const embedSize = Object.keys(embeddedContent.unique).join('').length\n\n const totalUniqueDeclarations = uniqueDeclarations.count()\n\n const totalSelectors = selectorComplexities.size()\n const specificitiesA = specificityA.aggregate()\n const specificitiesB = specificityB.aggregate()\n const specificitiesC = specificityC.aggregate()\n const complexityCount = new CountableCollection(selectorComplexities.toArray()).count()\n const totalUniqueSelectors = uniqueSelectors.count()\n const assign = Object.assign\n\n return {\n stylesheet: {\n sourceLinesOfCode: totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors.size(),\n linesOfCode: lines.length,\n size: css.length,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: css.length === 0 ? 0 : embedSize / css.length,\n },\n }),\n },\n atrules: {\n fontface: {\n total: fontfaces.length,\n totalUnique: fontfaces.length,\n unique: fontfaces,\n uniquenessRatio: fontfaces.length === 0 ? 0 : 1\n },\n import: imports.count(),\n media: medias.count(),\n charset: charsets.count(),\n supports: supports.count(),\n keyframes: assign(\n keyframes.count(), {\n prefixed: assign(\n prefixedKeyframes.count(), {\n ratio: keyframes.size() === 0 ? 0 : prefixedKeyframes.size() / keyframes.size()\n }),\n }),\n container: containers.count(),\n layer: layers.count(),\n },\n rules: {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: totalRules === 0 ? 0 : emptyRules / totalRules\n },\n selectors: assign(\n selectorsPerRule.aggregate(), {\n items: selectorsPerRule.toArray(),\n }),\n declarations: assign(\n declarationsPerRule.aggregate(), {\n items: declarationsPerRule.toArray()\n }),\n },\n selectors: {\n total: totalSelectors,\n totalUnique: totalUniqueSelectors,\n uniquenessRatio: totalSelectors === 0 ? 0 : totalUniqueSelectors / totalSelectors,\n specificity: {\n min: minSpecificity === undefined ? [0, 0, 0] : minSpecificity,\n max: maxSpecificity === undefined ? [0, 0, 0] : maxSpecificity,\n sum: [specificitiesA.sum, specificitiesB.sum, specificitiesC.sum],\n mean: [specificitiesA.mean, specificitiesB.mean, specificitiesC.mean],\n mode: [specificitiesA.mode, specificitiesB.mode, specificitiesC.mode],\n median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],\n items: specificities\n },\n complexity: assign(\n selectorComplexities.aggregate(),\n complexityCount, {\n items: selectorComplexities.toArray(),\n }),\n id: assign(\n ids.count(), {\n ratio: totalSelectors === 0 ? 0 : ids.size() / totalSelectors,\n }),\n accessibility: assign(\n a11y.count(), {\n ratio: totalSelectors === 0 ? 0 : a11y.size() / totalSelectors,\n }),\n keyframes: keyframeSelectors.count(),\n },\n declarations: {\n total: totalDeclarations,\n unique: {\n total: totalUniqueDeclarations,\n ratio: totalDeclarations === 0 ? 0 : totalUniqueDeclarations / totalDeclarations,\n },\n importants: {\n total: importantDeclarations,\n ratio: totalDeclarations === 0 ? 0 : importantDeclarations / totalDeclarations,\n inKeyframes: {\n total: importantsInKeyframes,\n ratio: importantDeclarations === 0 ? 0 : importantsInKeyframes / importantDeclarations,\n },\n },\n },\n properties: assign(\n properties.count(), {\n prefixed: assign(\n propertyVendorPrefixes.count(), {\n ratio: properties.size() === 0 ? 0 : propertyVendorPrefixes.size() / properties.size(),\n }),\n custom: assign(\n customProperties.count(), {\n ratio: properties.size() === 0 ? 0 : customProperties.size() / properties.size(),\n }),\n browserhacks: assign(\n propertyHacks.count(), {\n ratio: properties.size() === 0 ? 0 : propertyHacks.size() / properties.size(),\n }),\n }),\n values: {\n colors: colors.count(),\n fontFamilies: fontFamilies.count(),\n fontSizes: fontSizes.count(),\n zindexes: zindex.count(),\n textShadows: textShadows.count(),\n boxShadows: boxShadows.count(),\n animations: {\n durations: durations.count(),\n timingFunctions: timingFunctions.count(),\n },\n prefixes: vendorPrefixedValues.count(),\n units: units.count(),\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: new Date() - startAnalysis,\n total: new Date() - start\n }\n }\n}\n\nexport {\n analyze,\n compareSpecificity,\n}\n","import walk from 'css-tree/walker'\n\nconst analyzeRule = function (ruleNode) {\n let numSelectors = 0\n let numDeclarations = 0\n\n walk(ruleNode, function (childNode) {\n if (childNode.type === 'Selector') {\n numSelectors++\n return this.skip\n }\n\n if (childNode.type === 'Declaration') {\n numDeclarations++\n return this.skip\n }\n })\n\n return [numSelectors, numDeclarations]\n}\n\nexport {\n analyzeRule,\n}"],"names":["compareChar","referenceCode","testCode","endsWith","base","test","offset","length","i","charCodeAt","startsWith","compareSpecificity","a","b","analyzeSpecificity","node","A","B","C","complexity","isA11y","walk","selector","type","Boolean","value","name","skip","selectorList","childSelectors","visit","enter","push","sort","specificity","listItem","isId","colorNames","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","canvas","canvastext","linktext","visitedtext","activetext","buttonface","buttontext","buttonborder","field","fieldtext","highlight","highlighttext","selecteditem","selecteditemtext","mark","marktext","graytext","colorFunctions","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","systemKeywords","inherit","initial","unset","revert","caption","icon","menu","keywordDisallowList","normal","small","medium","large","larger","smaller","bold","bolder","lighter","condensed","expanded","italic","oblique","isFontFamilyKeyword","firstChild","children","first","sizeKeywords","keywords","isFontSizeKeyword","auto","none","isValueKeyword","size","timingKeywords","linear","ease","hasVendorPrefix","keyword","indexOf","isAstVendorPrefixed","toArray","index","CountableCollection","this","_items","_total","_totalUnique","item","count","total","totalUnique","unique","uniquenessRatio","ContextCollection","_list","_contexts","context","itemsPerContext","Object","assign","AggregateCollection","add","aggregate","min","max","mean","mode","median","range","sum","arr","middle","lowerMiddleRank","sorted","slice","reduce","num","frequencies","create","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","Math","floor","isCustom","property","isProperty","basename","OccurrenceCounter","keys","css","start","Date","lines","split","stringifyNode","loc","end","line","substring","column","maxSpecificity","minSpecificity","totalComments","commentsSize","embeds","startParse","ast","parse","parseAtrulePrelude","parseCustomProperty","positions","onComment","comment","startAnalysis","totalAtRules","fontfaces","layers","imports","medias","charsets","supports","keyframes","prefixedKeyframes","containers","totalRules","emptyRules","selectorsPerRule","declarationsPerRule","keyframeSelectors","uniqueSelectors","specificityA","specificityB","specificityC","selectorComplexities","specificities","ids","a11y","uniqueDeclarations","totalDeclarations","importantDeclarations","importantsInKeyframes","properties","propertyHacks","propertyVendorPrefixes","customProperties","vendorPrefixedValues","zindex","textShadows","boxShadows","fontFamilies","fontSizes","timingFunctions","durations","colors","units","atRuleName","descriptors","block","forEach","descriptor","prelude","trim","map","ruleNode","numSelectors","numDeclarations","childNode","analyzeRule","atrule","undefined","declaration","unit","parts","reverse","fontNode","quote","getFamilyFromFont","operator","getSizeFromFont","durationFound","child","analyzeAnimation","times","fns","valueNode","toLowerCase","strEquals","important","code","isHack","embeddedContent","embedSize","join","totalUniqueDeclarations","totalSelectors","specificitiesA","specificitiesB","specificitiesC","complexityCount","totalUniqueSelectors","stylesheet","sourceLinesOfCode","linesOfCode","comments","ratio","atrules","fontface","import","media","charset","prefixed","container","layer","rules","empty","selectors","items","declarations","id","accessibility","importants","inKeyframes","custom","browserhacks","values","zindexes","animations","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"kLAMA,SAASA,EAAYC,EAAeC,GAMlC,OAJIA,GAAY,IAAUA,GAAY,KAEpCA,GAAsB,IAEjBD,IAAkBC,WA2BXC,EAASC,EAAMC,GAC7B,IAAMC,EAASD,EAAKE,OAASH,EAAKG,OAElC,GAAID,EAAS,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ACRuF,GAAuBlG,QAAS,CAChC+J,MAA6B,IAAtB/D,GAAWhH,OAAe,EAAIkH,GAAuBlH,OAASgH,GAAWhH,SAElFiM,OAAQtK,GACNwF,GAAiBnG,QAAS,CAC1B+J,MAA6B,IAAtB/D,GAAWhH,OAAe,EAAImH,GAAiBnH,OAASgH,GAAWhH,SAE5EkM,aAAcvK,GACZsF,GAAcjG,QAAS,CACvB+J,MAA6B,IAAtB/D,GAAWhH,OAAe,EAAIiH,GAAcjH,OAASgH,GAAWhH,WAG3EmM,OAAQ,CACNvE,OAAQA,GAAO5G,QACfwG,aAAcA,GAAaxG,QAC3ByG,UAAWA,GAAUzG,QACrBoL,SAAU/E,GAAOrG,QACjBsG,YAAaA,GAAYtG,QACzBuG,WAAYA,GAAWvG,QACvBqL,WAAY,CACV1E,UAAWA,GAAU3G,QACrB0G,gBAAiBA,GAAgB1G,SAEnCsL,SAAUlF,GAAqBpG,QAC/B6G,MAAOA,GAAM7G,SAEfuL,SAAU,CACRC,UAAWpH,EAAgBR,EAC3B6H,YAAa,IAAI3I,KAASsB,EAC1BnE,MAAO,IAAI6C,KAASD"}
@@ -1,2 +1,2 @@
1
- import e from"css-tree/parser";import t from"css-tree/walker";import n from"css-tree/generator";function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},i.apply(this,arguments)}const s=new Map,r=function(e){if(s.has(e))return s.get(e);let t=e,n=e[0];"/"===n?n="/"===e[1]?"//":"/":"_"!==n&&"*"!==n&&"$"!==n&&"#"!==n&&"+"!==n&&"&"!==n&&(n="");const i=(r=t).length-(a=(a=n.length)||0)>=2&&45===r.charCodeAt(a)&&45===r.charCodeAt(a+1);var r,a;if(!i&&(t=t.toLowerCase(),s.has(t))){const n=s.get(t);return s.set(e,n),n}const o=i?"":function(e,t){if(e.length-(t=t||0)>=3&&45===e.charCodeAt(t)&&45!==e.charCodeAt(t+1)){const n=e.indexOf("-",t+2);if(-1!==n)return e.substring(t,n+1)}return""}(t,n.length),l=t.substr(0,n.length+o.length),u=Object.freeze({basename:t.substr(l.length),name:t.substr(n.length),hack:n,vendor:o,prefix:l,custom:i});return s.set(e,u),u};function a(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}function o(e){const n=[];return t(e,{visit:"Selector",enter(e){n.push(l(e))}}),n.sort((e,t)=>a(e.specificity,t.specificity))}const l=n=>{let i=0,s=0,r=0,a=0,l=!1;return t(n,{enter:function(t){switch(t.type){case"IdSelector":i++,a++;break;case"ClassSelector":s++,a++;break;case"AttributeSelector":s++,a++,Boolean(t.value)&&a++,l="role"===t.name.name||t.name.name.startsWith("aria-");break;case"PseudoElementSelector":case"TypeSelector":"*"!==t.name&&r++,a++;break;case"PseudoClassSelector":if(["before","after","first-letter","first-line"].includes(t.name))return r++,a++,this.skip;if(["is","has","matches","-webkit-any","-moz-any"].includes(t.name)){const n=o(e(t.children.first.value,{context:"selectorList"})),[l,u,c]=n[0].specificity;i+=l,s+=u,r+=c;for(let e=0;e<n.length;e++)a+=n[e].complexity;return void a++}if("not"===t.name){const e=o(t),[n,l,u]=e[0].specificity;i+=n,s+=l,r+=u;for(let t=0;t<e.length;t++)a+=e[t].complexity;return a++,this.skip}if(["nth-child","nth-last-child"].includes(t.name)){s++;const e=o(t);if(0===e.length)return;const[n,l,u]=e[0].specificity;i+=n,s+=l,r+=u;for(let t=0;t<e.length;t++)a+=e[t].complexity;return void a++}if("where"===t.name){const n=o(e(t.children.first.value,{context:"selectorList"}));for(let e=0;e<n.length;e++)a+=n[e].complexity;return void a++}a++,s++;break;case"Combinator":a++}}}),{specificity:[i,s,r],complexity:a,isId:i>0,isA11y:l}};class u{constructor(e){this.items=new Uint8Array(e),this.sum=0,this.cursor=0}add(e){this.items[this.cursor]=e,this.sum+=e,this.cursor++}aggregate(){if(0===this.cursor)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};const e=new Uint8Array(this.items.slice(0,this.cursor)).sort((e,t)=>e-t),t=e[0],n=e[e.length-1],i=function(e){const t=Object.create(null);let n=-1,i=0,s=0;for(let r=0;r<e.length;r++){const a=e[r],o=(t[a]||0)+1;t[a]=o,o>n&&(n=o,i=0,s=0),o>=n&&(i++,s+=a)}return s/i}(e),s=function(e){const t=e.length/2,n=Math.floor(t);return t!==n?e[n]:(e[n]+e[n-1])/2}(e);return{min:t,max:n,mean:this.sum/this.cursor,mode:i,median:s,range:n-t,sum:this.sum}}toArray(){return Array.from(this.items.subarray(0,this.cursor))}}const c=({rules:e})=>{const n=e.length,s=new u(n),r=new u(n);let a=0;for(let i=0;i<n;i++){let n=0,o=0;t(e[i],{enter:function(e){return"Selector"===e.type?(n++,this.skip):"Declaration"===e.type?(o++,this.skip):void 0}}),0===o&&a++,s.add(n),r.add(o)}return{total:n,empty:{total:a,ratio:0===n?0:a/n},selectors:i({},s.aggregate(),{items:s.toArray()}),declarations:i({},r.aggregate(),{items:r.toArray()})}},h={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},d={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1};class m{constructor(e){if(this.items={},this.total=0,this.totalUnique=0,e)for(let t=0;t<e.length;t++)this.push(e[t])}push(e){this.total++,this.items[e]?this.items[e]++:(this.items[e]=1,this.totalUnique++)}size(){return this.total}count(){return{total:this.total,totalUnique:this.totalUnique,unique:this.items,uniquenessRatio:0===this.total?0:this.totalUnique/this.total}}}const p={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},g={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1},f=({fontValues:e,fontFamilyValues:i})=>{const s=new m(i);for(let i=0;i<e.length;i++){const r=e[i],a=r.children.first;if("Identifier"===a.type&&p[a.name])continue;const o=[];t(r,{reverse:!0,enter:function(e){return"String"===e.type||"Operator"===e.type&&44===e.value.charCodeAt(0)?o.unshift(e):"Identifier"===e.type?g[e.name]?this.skip:o.unshift(e):void 0}}),s.push(o.map(n).join(""))}return s.count()},y={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},b={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},k=({stringifyNode:e,fontSizeValues:n,fontValues:i})=>{const s=new m(n);for(let n=0;n<i.length;n++){const r=i[n],a=r.children.first;if("Identifier"===a.type&&b[a.name])continue;let o,l=!1;t(r,{enter:function(t){switch(t.type){case"Number":if(48===t.value.charCodeAt(0))return o="0",this.break;case"Operator":47===t.value.charCodeAt(0)&&(l=!0);break;case"Dimension":if(!l)return o=e(t),this.break;case"Identifier":if(y[t.name])return o=t.name,this.break}}}),o&&s.push(o)}return s.count()},w=({stringifyNode:e,declarations:t})=>{const n=t.length,i=Object.create(null);let s=0,r=0,a=0;for(let o=0;o<n;o++){const n=t[o];!0===n.important&&(s++,n.inKeyframe&&a++);const l=e(n);i[l]||(i[l]=1,r++)}return{total:n,unique:{total:r,ratio:0===n?0:r/n},importants:{total:s,ratio:0===n?0:s/n,inKeyframes:{total:a,ratio:0===s?0:a/s}}}},x=({stringifyNode:e,selectors:t})=>{const n=Object.create(null),s=Object.create(null),r=t.length;let o,c,h=new u(r),d=new u(r),p=new u(r),g=0;const f=new u(r),y=[],b=[],k=new m,w=new m,x=new m;for(let i=0;i<r;i++){const r=t[i],u=e(r);if(r.isKeyframeSelector){x.push(u);continue}const{specificity:m,complexity:v,isId:q,isA11y:z}=s[u]||l(r);q&&k.push(u),z&&w.push(u),s[u]?n[u]++:(s[u]={complexity:v,specificity:m,isId:q,isA11y:z},g++,n[u]=1),f.add(v),void 0===o&&(o=m),void 0===c&&(c=m),h.add(m[0]),d.add(m[1]),p.add(m[2]),void 0!==c&&a(c,m)<0&&(c=m),void 0!==o&&a(o,m)>0&&(o=m),y.push(m),b.push(v)}const v=h.aggregate(),q=d.aggregate(),z=p.aggregate(),C=new m(b).count();return{total:r,totalUnique:g,uniquenessRatio:0===r?0:g/r,specificity:{min:c,max:o,sum:[v.sum,q.sum,z.sum],mean:[v.mean,q.mean,z.mean],mode:[v.mode,q.mode,z.mode],median:[v.median,q.median,z.median],items:y},complexity:i({},f.aggregate(),C,{items:b}),id:i({},k.count(),{ratio:0===r?0:k.size()/r}),accessibility:i({},w.count(),{ratio:0===r?0:w.size()/r}),keyframes:i({},x.count(),{ratio:0===r?0:x.size()/r})}},v=({properties:e})=>{const t=new m(e.map(e=>e.authored)),n=new m,s=new m,r=new m,a=e.length;for(let t=0;t<a;t++){const i=e[t];i.vendor?n.push(i.authored):i.hack?s.push(i.authored):i.custom&&r.push(i.authored)}return i({},t.count(),{prefixed:i({},n.count(),{ratio:n.size()/a}),custom:i({},r.count(),{ratio:r.size()/a}),browserhacks:i({},s.count(),{ratio:s.size()/a})})},q={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1},z=({values:e,stringifyNode:t})=>{const n=new m;for(let i=0;i<e.length;i++){const s=e[i],r=s.children.first;r&&("Identifier"===r.type&&q[r.name]||n.push(t(s)))}return n.count()},C={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1},A=({animations:e,durations:t,timingFunctions:n,stringifyNode:i})=>{const s=new m(t.map(i)),r=new m(n.map(i));for(let t=0;t<e.length;t++){let n=!1;e[t].value.children.forEach(e=>"Operator"===e.type?n=!1:"Dimension"===e.type&&!1===n?(n=!0,s.push(i(e))):"Identifier"===e.type&&C[e.name]?r.push(i(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:r.push(i(e)))}return{durations:s.count(),timingFunctions:r.count()}};function O(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function N(e){e=e.toArray();for(let t=0;t<e.length;t++){const n=e[t];if("Identifier"===n.type&&n.name.length>=3&&O(n.name))return!0;if("Function"===n.type){if(O(n.name))return!0;if(n.children&&N(n.children))return!0}}return!1}const S=({values:e,stringifyNode:t})=>{const n=new m;for(let i=0;i<e.length;i++){const s=e[i];s.children&&N(s.children)&&n.push(t(s))}return n.count()},j=({atrules:e,stringifyNode:t})=>{const n=[],s=new m,r=new m,a=new m,o=new m,l=new m,u=new m,c=new m,h={"font-face":e=>{const i={};e.block.children.forEach(e=>i[e.property]=t(e.value)),n.push(i)},media:e=>r.push(e.prelude.value),supports:e=>o.push(e.prelude.value),keyframes:e=>l.push(`@${e.name} ${e.prelude.value}`),import:e=>s.push(e.prelude.value),charset:e=>a.push(e.prelude.value),container:e=>c.push(e.prelude.value)};for(let t=0;t<e.length;t++){const n=e[t],i=n.name,s=h[i];if(s)s(n);else if(i.endsWith("keyframes")){const e=`@${i} ${n.prelude.value}`;l.push(e),O(i)&&u.push(e)}}return{fontface:{total:n.length,totalUnique:n.length,unique:n,uniquenessRatio:1},import:s.count(),media:r.count(),charset:a.count(),supports:o.count(),keyframes:i({},l.count(),{prefixed:i({},u.count(),{ratio:0===l.size()?0:u.size()/l.size()})}),container:c.count()}};class I{constructor(){this.list=new m,this.contexts={},this.contextCount=0}push(e,t){this.list.push(e),this.contexts[t]||(this.contexts[t]=new m,this.contextCount++),this.contexts[t].push(e)}count(){const e={};for(let t in this.contexts)e[t]=this.contexts[t].count();return Object.assign(this.list.count(),{itemsPerContext:e})}}const D=n=>{const s=new Date,a=n.split(/\r?\n/);function o(e){const t=e.loc.start,n=e.loc.end;if(0==n.line-t.line)return a[t.line-1].substring(t.column-1,n.column-1);const i=[];for(let e=t.line;e<=n.line;e++){const s=a[e-1];i.push(e!==t.line?e!==n.line?s:s.substring(0,n.column-1):s.substring(t.column-1))}return i.join("\n")}const l=new Date;let u=0,p=0;const g=e(n,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){u++,p+=e.length}}),y=new Date,b=[],q=[],C=[],O=[],N=[],D=[],U=[],F=[],V=[],L=[],P=[],K=[],W=[],$=[],_=[],R=new I,E=new I,T=new m;t(g,{enter:function(e){switch(e.type){case"Atrule":b.push(e);break;case"Rule":q.push(e);break;case"Selector":return C.push(i({},e,{isKeyframeSelector:this.atrule&&this.atrule.name.endsWith("keyframes")})),this.skip;case"Dimension":if(!this.declaration)break;return E.push(e.unit,this.declaration.property),this.skip;case"Url":e.value.startsWith("data:")&&T.push(e.value);break;case"Declaration":{O.push(i({},e,{inKeyframe:this.atrule&&this.atrule.name.endsWith("keyframes")}));const{value:n,property:s}=e,a=Object.assign({authored:s},r(s));switch(N.push(a),D.push(n),a.basename){case"z-index":U.push(n);break;case"text-shadow":F.push(n);break;case"box-shadow":V.push(n);break;case"font":L.push(n);break;case"font-family":return P.push(o(n)),this.skip;case"font-size":K.push(o(n));break;case"transition":case"animation":W.push(e);break;case"animation-duration":case"transition-duration":_.push(n);break;case"transition-timing-function":case"animation-timing-function":$.push(n)}t(n,{enter:function(e){switch(e.type){case"Hash":return R.push(o(e),s),this.skip;case"Identifier":{const{name:t}=e;return t.length>20||t.length<3||h[t.toLowerCase()]&&R.push(o(e),s),this.skip}case"Function":d[e.name.toLowerCase()]&&R.push(o(e),s)}}})}}}});const M=T.count(),B=Object.keys(M.unique).join("").length;return{stylesheet:{sourceLinesOfCode:b.length+C.length+O.length,linesOfCode:a.length,size:n.length,comments:{total:u,size:p},embeddedContent:Object.assign(M,{size:{total:B,ratio:0===n.length?0:B/n.length}})},atrules:j({atrules:b,stringifyNode:o}),rules:c({rules:q}),selectors:x({stringifyNode:o,selectors:C}),declarations:w({stringifyNode:o,declarations:O}),properties:v({properties:N}),values:{colors:R.count(),fontFamilies:f({stringifyNode:o,fontValues:L,fontFamilyValues:P}),fontSizes:k({stringifyNode:o,fontValues:L,fontSizeValues:K}),zindexes:z({values:U,stringifyNode:o}),textShadows:z({values:F,stringifyNode:o}),boxShadows:z({values:V,stringifyNode:o}),animations:A({animations:W,timingFunctions:$,durations:_,stringifyNode:o}),prefixes:S({values:D,stringifyNode:o}),units:E.count()},__meta__:{parseTime:y-l,analyzeTime:new Date-y,total:new Date-s}}};export{D as analyze,a as compareSpecificity};
1
+ import e from"css-tree/parser";import t from"css-tree/walker";function n(e,t){return t>=65&&t<=90&&(t|=32),e===t}function r(e,t){const r=t.length-e.length;if(r<0)return!1;for(let i=t.length-1;i>=r;i--)if(!1===n(e.charCodeAt(i-r),t.charCodeAt(i)))return!1;return!0}function i(e,t){if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!1===n(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}function a(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}const s=e=>{let n=0,r=0,o=0,l=0,c=!1;return t(e,function(e){switch(e.type){case"IdSelector":n++,l++;break;case"ClassSelector":r++,l++;break;case"AttributeSelector":r++,l++,Boolean(e.value)&&l++,c="role"===e.name.name||i("aria-",e.name.name);break;case"PseudoElementSelector":case"TypeSelector":if(l++,42===e.name.charCodeAt(0)&&1===e.name.length)break;o++;break;case"PseudoClassSelector":switch(e.name){case"before":case"after":case"first-letter":case"first-line":return o++,l++,this.skip;case"where":case"is":case"has":case"matches":case"-webkit-any":case"-moz-any":case"not":case"nth-child":case"nth-last-child":{"nth-child"!==e.name&&"nth-last-child"!==e.name||r++;const i=function(e){const n=[];return t(e,{visit:"Selector",enter(e){n.push(s(e))}}),n.sort((e,t)=>a(e.specificity,t.specificity))}(e);if(0===i.length)return;if("where"!==e.name){const[e,t,a]=i[0].specificity;n+=e,r+=t,o+=a}for(let e=0;e<i.length;e++){const t=i[e];t.isA11y&&(c=!0),l+=t.complexity}return l++,this.skip}default:return l++,r++,this.skip}case"Combinator":l++}}),{specificity:[n,r,o],complexity:l,isId:n>0,isA11y:c}},o={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},l={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1},c={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},u={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1};function d(e){const t=e.children.first;return"Identifier"===t.type&&c[t.name]}const h={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},m={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1};function f(e){const t=e.children.first;return"Identifier"===t.type&&m[t.name]}const b={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1};function g(e){if(!e.children)return!1;const t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&b[t.name]}const w={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1};function p(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function k(e){if(!e.children)return!1;const t=e.children.toArray();for(let e=0;e<t.length;e++){const n=t[e],{type:r,name:i}=n;if("Identifier"===r&&p(i))return!0;if("Function"===r){if(p(i))return!0;if(k(n))return!0}}return!1}class y{constructor(e){if(this.t={},this.i=0,this.o=0,e)for(let t=0;t<e.length;t++)this.push(e[t])}push(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)}size(){return this.i}count(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}}}class x{constructor(){this.l=new y,this.u={}}push(e,t){this.l.push(e),this.u[t]||(this.u[t]=new y),this.u[t].push(e)}count(){const e={};for(let t in this.u)e[t]=this.u[t].count();return Object.assign(this.l.count(),{itemsPerContext:e})}}class v{constructor(){this.t=[]}add(e){this.t.push(e)}size(){return this.t.length}aggregate(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};const e=this.t.slice().sort((e,t)=>e-t),t=e[0],n=e[e.length-1],r=this.t.reduce((e,t)=>e+t),i=function(e){const t=Object.create(null);let n=-1,r=0,i=0;for(let a=0;a<e.length;a++){const s=e[a],o=(t[s]||0)+1;t[s]=o,o>n&&(n=o,r=0,i=0),o>=n&&(r++,i+=s)}return i/r}(this.t),a=function(e){const t=e.length/2,n=Math.floor(t);return t!==n?e[n]:(e[n]+e[n-1])/2}(e);return{min:t,max:n,mean:r/this.t.length,mode:i,median:a,range:n-t,sum:r}}toArray(){return this.t}}function q(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function z(e,t){return!q(t)&&r(e,t)}class S{constructor(){this.t=Object.create(null)}push(e){return this.t[e]?this.t[e]++:this.t[e]=1}count(){return Object.keys(this.t).length}}const I=c=>{const m=new Date,b=c.split(/\r?\n/);function I(e){const t=e.loc.start,n=e.loc.end;if(0==n.line-t.line)return b[t.line-1].substring(t.column-1,n.column-1);let r="";for(let e=t.line;e<=n.line;e++){const i=b[e-1];r+=e!==t.line?e!==n.line?i+"\n":i.substring(0,n.column-1):i.substring(t.column-1)+"\n"}return r}let O=0,D=0;const C=new y,j=new Date,A=e(c,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){O++,D+=e.length}}),F=new Date;let P=0;const R=[],U=new y,_=new y,T=new y,B=new y,E=new y,H=new y,K=new y,L=new y;let M=0,N=0;const V=new v,G=new v,J=new y,Q=new S;let W,X,Y=new v,Z=new v,$=new v;const ee=new v,te=[],ne=new y,re=new y,ie=new S;let ae=0,se=0,oe=0;const le=new y,ce=new y,ue=new y,de=new y,he=new y,me=new y,fe=new y,be=new y,ge=new y,we=new y,pe=new y,ke=new y,ye=new x,xe=new x;t(A,function(e){switch(e.type){case"Atrule":{P++;const t=e.name;if("font-face"===t){const t={};e.block.children.forEach(e=>t[e.property]=I(e.value)),R.push(t);break}if("media"===t){T.push(e.prelude.value);break}if("supports"===t){E.push(e.prelude.value);break}if(r("keyframes",t)){const n="@"+t+" "+e.prelude.value;p(t)&&K.push(n),H.push(n);break}if("import"===t){_.push(e.prelude.value);break}if("charset"===t){B.push(e.prelude.value);break}if("container"===t){L.push(e.prelude.value);break}"layer"===t&&L.push(e.prelude.value.trim().split(",").map(e=>e.trim()).forEach(e=>U.push(e)));break}case"Rule":{const[n,r]=function(e){let n=0,r=0;return t(e,function(e){return"Selector"===e.type?(n++,this.skip):"Declaration"===e.type?(r++,this.skip):void 0}),[n,r]}(e);M++,0===r&&N++,V.add(n),G.add(r);break}case"Selector":{const t=I(e);if(this.atrule&&r("keyframes",this.atrule.name))return J.push(t),this.skip;const{specificity:n,complexity:i,isId:o,isA11y:l}=s(e);return o&&ne.push(t),l&&re.push(t),Q.push(t),ee.add(i),void 0===W&&(W=n),void 0===X&&(X=n),Y.add(n[0]),Z.add(n[1]),$.add(n[2]),void 0!==X&&a(X,n)<0&&(X=n),void 0!==W&&a(W,n)>0&&(W=n),te.push(n),this.skip}case"Dimension":if(!this.declaration)break;return xe.push(e.unit,this.declaration.property),this.skip;case"Url":i("data:",e.value)&&C.push(e.value);break;case"Value":{if(g(e))break;const r=this.declaration.property;if(k(e)&&he.push(I(e)),z("z-index",r))return g(e)||me.push(I(e)),this.skip;if(z("font",r)){if(d(e)||ge.push(function(e,n){let r="";return t(e,{reverse:!0,enter:function(e){if("String"===e.type){const t=e.loc.start,i=n({loc:{start:{line:t.line,column:t.column},end:{line:t.line,column:t.column+1}}});return r=i+e.value+i+r}return"Operator"===e.type&&44===e.value.charCodeAt(0)?r=e.value+r:"Identifier"===e.type?u[e.name]?this.skip:r=e.name+r:void 0}}),r}(e,I)),!f(e)){const n=function(e){let n,r=!1;return t(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return n="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(r=!0);break;case"Dimension":if(!r)return n=e.value+e.unit,this.break;case"Identifier":if(h[e.name])return n=e.name,this.break}}),n}(e);n&&we.push(n)}break}if(z("font-size",r)){f(e)||we.push(I(e));break}if(z("font-family",r)){d(e)||ge.push(I(e));break}if(z("transition",r)||z("animation",r)){const[t,n]=function(e,t){let n=!1;const r=[],i=[];return e.forEach(e=>"Operator"===e.type?n=!1:"Dimension"===e.type&&!1===n?(n=!0,r.push(t(e))):"Identifier"===e.type&&w[e.name]?i.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:i.push(t(e))),[r,i]}(e.children,I);for(let e=0;e<t.length;e++)ke.push(t[e]);for(let e=0;e<n.length;e++)pe.push(n[e]);break}if(z("animation-duration",r)||z("transition-duration",r)){ke.push(I(e));break}if(z("transition-timing-function",r)||z("animation-timing-function",r)){pe.push(I(e));break}z("text-shadow",r)?g(e)||fe.push(I(e)):z("box-shadow",r)&&(g(e)||be.push(I(e))),t(e,function(e){switch(e.type){case"Hash":return ye.push("#"+e.value,r),this.skip;case"Identifier":{const{name:t}=e;return t.length>20||t.length<3||o[t.toLowerCase()]&&ye.push(I(e),r),this.skip}case"Function":if(function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!1===n(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}("var",e.name))return this.skip;l[e.name.toLowerCase()]&&ye.push(I(e),r)}});break}case"Declaration":{ae++;const t=I(e);ie.push(t),e.important&&(se++,this.atrule&&r("keyframes",this.atrule.name)&&oe++);const{property:n}=e;le.push(n),p(n)?ue.push(n):function(e){if(q(e)||p(e))return!1;let t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(n)?ce.push(n):q(n)&&de.push(n);break}}});const ve=C.count(),qe=Object.keys(ve.unique).join("").length,ze=ie.count(),Se=ee.size(),Ie=Y.aggregate(),Oe=Z.aggregate(),De=$.aggregate(),Ce=new y(ee.toArray()).count(),je=Q.count(),Ae=Object.assign;return{stylesheet:{sourceLinesOfCode:P+Se+ae+J.size(),linesOfCode:b.length,size:c.length,comments:{total:O,size:D},embeddedContent:Ae(ve,{size:{total:qe,ratio:0===c.length?0:qe/c.length}})},atrules:{fontface:{total:R.length,totalUnique:R.length,unique:R,uniquenessRatio:0===R.length?0:1},import:_.count(),media:T.count(),charset:B.count(),supports:E.count(),keyframes:Ae(H.count(),{prefixed:Ae(K.count(),{ratio:0===H.size()?0:K.size()/H.size()})}),container:L.count(),layer:U.count()},rules:{total:M,empty:{total:N,ratio:0===M?0:N/M},selectors:Ae(V.aggregate(),{items:V.toArray()}),declarations:Ae(G.aggregate(),{items:G.toArray()})},selectors:{total:Se,totalUnique:je,uniquenessRatio:0===Se?0:je/Se,specificity:{min:void 0===X?[0,0,0]:X,max:void 0===W?[0,0,0]:W,sum:[Ie.sum,Oe.sum,De.sum],mean:[Ie.mean,Oe.mean,De.mean],mode:[Ie.mode,Oe.mode,De.mode],median:[Ie.median,Oe.median,De.median],items:te},complexity:Ae(ee.aggregate(),Ce,{items:ee.toArray()}),id:Ae(ne.count(),{ratio:0===Se?0:ne.size()/Se}),accessibility:Ae(re.count(),{ratio:0===Se?0:re.size()/Se}),keyframes:J.count()},declarations:{total:ae,unique:{total:ze,ratio:0===ae?0:ze/ae},importants:{total:se,ratio:0===ae?0:se/ae,inKeyframes:{total:oe,ratio:0===se?0:oe/se}}},properties:Ae(le.count(),{prefixed:Ae(ue.count(),{ratio:0===le.size()?0:ue.size()/le.size()}),custom:Ae(de.count(),{ratio:0===le.size()?0:de.size()/le.size()}),browserhacks:Ae(ce.count(),{ratio:0===le.size()?0:ce.size()/le.size()})}),values:{colors:ye.count(),fontFamilies:ge.count(),fontSizes:we.count(),zindexes:me.count(),textShadows:fe.count(),boxShadows:be.count(),animations:{durations:ke.count(),timingFunctions:pe.count()},prefixes:he.count(),units:xe.count()},__meta__:{parseTime:F-j,analyzeTime:new Date-F,total:new Date-m}}};export{I as analyze,a as compareSpecificity};
2
2
  //# sourceMappingURL=analyzer.modern.js.map