From ce91f2cd95067661c7bbf499618c38b77c6ea253 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Fri, 26 Apr 2019 19:32:47 -0500 Subject: [PATCH] 1.0.7 --- dist/dropcss.cjs.js | 2 +- dist/dropcss.js | 2 +- dist/dropcss.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/dropcss.cjs.js b/dist/dropcss.cjs.js index b0f1fd8..5b383fc 100644 --- a/dist/dropcss.cjs.js +++ b/dist/dropcss.cjs.js @@ -4,7 +4,7 @@ * * dropcss.js (DropCSS) * An exceptionally fast, thorough and tiny unused-CSS cleaner -* https://github.com/leeoniya/dropcss (v1.0.7-dev) +* https://github.com/leeoniya/dropcss (v1.0.7) */ 'use strict'; diff --git a/dist/dropcss.js b/dist/dropcss.js index 57049b6..b6521b0 100644 --- a/dist/dropcss.js +++ b/dist/dropcss.js @@ -4,7 +4,7 @@ * * dropcss.js (DropCSS) * An exceptionally fast, thorough and tiny unused-CSS cleaner -* https://github.com/leeoniya/dropcss (v1.0.7-dev) +* https://github.com/leeoniya/dropcss (v1.0.7) */ (function (global, factory) { diff --git a/dist/dropcss.min.js b/dist/dropcss.min.js index 3213ff5..470f031 100644 --- a/dist/dropcss.min.js +++ b/dist/dropcss.min.js @@ -1,2 +1,2 @@ -/*! https://github.com/leeoniya/dropcss (v1.0.7-dev) */ +/*! https://github.com/leeoniya/dropcss (v1.0.7) */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).dropcss=t()}(this,function(){"use strict";function e(e,t,r){throw new Error(e+' parser stopped here: "'+t.substring(r,r+100)+'"')}var t=1,r=2,n=3,a=new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),s=/]*>||]*>[\s\S]*?<\/script>|]*>[\s\S]*?<\/style>|]*>|]*>/gim,i=/([\w-]+)(?:="([^"]*)"|='([^']*)'|=(\S+))?/gm,c={TAG_HEAD:/\s*<([\w-]+)(?:\s*([^>]*))?>\s*/imy,TEXT:/\s*[^<]*/my,TAG_CLOSE:/\s*<\/[\w-]+>\s*/imy};var o=new Set;function u(e,t,r){return{tagName:t,attributes:r,classList:null!=r&&r.has("class")?new Set(r.get("class").split(/\s+/g)):o,parentNode:e,childNodes:[]}}var l=[];function d(e,t){if(null!=e){var r=e._ofTypes=e._ofTypes||{};if(!(t in r)){var n=0;r[t]=e.childNodes.filter(function(e){if(e.tagName==t)return e._typeIdx=n++,!0})}return r[t]}return l}var f=function(l){var d=function(s){var o,u=0,l=[];function d(e){for(var t in u=e.lastIndex,c)c[t].lastIndex=u}function f(){if(null!=(o=c.TAG_CLOSE.exec(s)))return d(c.TAG_CLOSE),void l.push(n);if(null==(o=c.TAG_HEAD.exec(s)))null!=(o=c.TEXT.exec(s))&&d(c.TEXT);else{d(c.TAG_HEAD);var e=o[1];l.push(t,e);var u=o[2];if(null!=u){for(var f,h=new Map;f=i.exec(u);)h.set(f[1],(f[2]||f[3]||f[4]||"").trim());l.push(r,h)}(a.has(e)||u&&u.endsWith("/"))&&l.push(n)}}for(var h=u;u~+.#]\s*|\[[^\]]+\]|\s+/gm,v=1,x=2,m=3,g=4,y=5;function b(e){var t=e.split(/\s*,\s*/gm);return t.push(t.map(function(e){return function(e){for(var t=e.length;(e=e.replace(k,"")).length!=t;)t=e.length;return e.replace(/:?:[a-z-]+/gm,"")}(e).trim().replace(p,function(e,t){return e=e.trim(),0==t?e:"."==e||"#"==e?"`"+e:e.length<=1?"`":"`"+e.replace(/['"]/gm,"")}).split(/`+/gm)})),t}var k=/:[a-z-]+\([^()]*\)/;function E(e,t,r,n){for(var a="",s=1;e[t]==r?s++:e[t]==n&&s--,0!=s;)a+=e[t++];return a}function T(t){return function(t){var r,n={RULE_HEAD:/\s*([^{;]+?)\s*[{;]\s*/my,RULE_TAIL:/\s*([^}]*?)\s*\}/my,AT_TAIL:/\s*\}/my,RULE_FULL:/\s*([^{]*?)\{([^}]+?)\}/my},a=0,s=0,i=[];function c(e){for(var t in s=e.lastIndex,n)n[t].lastIndex=s}function o(){if(a>0&&null!=(r=n.AT_TAIL.exec(t)))return a--,i.push(x),void c(n.AT_TAIL);if(null!=(r=n.RULE_HEAD.exec(t))){var e=r[1];if(c(n.RULE_HEAD),"@"==e[0])switch(e.match(/@[a-z-]+/)[0]){case"@media":case"@supports":case"@document":a++,i.push(v,e);break;case"@import":case"@charset":case"@namespace":i.push(y,e+";");break;default:a++;var o=E(t,s,"{","}");c({lastIndex:s+o.length}),i.push(v,e,y,o)}else i.push(m,b(r[1])),r=n.RULE_TAIL.exec(t),i.push(g,r[1]),c(n.RULE_TAIL)}else s=t.length}for(var u=s;s=t;var n=t%e;return n<0&&(n+=e),e>1?r>=t&&r%e===n:(e*=-1,r<=t&&r%e===n)}(n[0],n[1],e)}return r}function L(e,t){return e.some(function(e){return function e(t,r){for(var n,a,s,i,c,o;r.idx>-1;){switch(t[r.idx]){case"_":n=t[--r.idx],o=A(r.node,n),r.idx--;break;case"#":a=t[--r.idx],o=S(r.node,"id",a,"="),r.idx--;break;case".":n=t[--r.idx],o=_(r.node,n),r.idx--;break;case"[":n=t[--r.idx],s=t[--r.idx],a=t[--r.idx],o=S(r.node,n,a,s),r.idx--;break;case":":n=t[--r.idx],a=t[--r.idx];var u=r.node,l=u.tagName;c=u.idx;var f=(i=u.parentNode)?i.childNodes.length:1,h=void 0;switch(n){case"not":o=!e(a,{node:r.node,idx:a.length-1});break;case"first-child":o=0==c;break;case"last-child":o=c==f-1;break;case"only-child":o=1==f;break;case"nth-child":o=N(c+1,a);break;case"nth-last-child":o=N(f-c,a);break;case"first-of-type":h=d(i,l),o=0==u._typeIdx;break;case"last-of-type":h=d(i,l),o=u._typeIdx==h.length-1;break;case"only-of-type":o=1==(h=d(i,l)).length;break;case"nth-of-type":h=d(i,l),o=N(u._typeIdx+1,a);break;case"nth-last-of-type":o=N((h=d(i,l)).length-u._typeIdx,a)}r.idx--;break;case" ":for(c=--r.idx,o=!1;!o&&null!=(i=r.node.parentNode);)r.idx=c,r.node=i,o=e(t,r);break;case">":r.idx--,null!=(i=r.node.parentNode)?(r.node=i,o=e(t,r)):o=!1;break;case"+":r.idx--,null!=(i=r.node.parentNode)&&r.node.idx>0?(r.node=i.childNodes[r.node.idx-1],o=e(t,r)):o=!1;break;case"~":if(r.idx--,o=!1,c=r.node.idx,null!=(i=r.node.parentNode)&&c>0)for(var p=0;p~+]\s*|\s+/iy},a=0,s=[],i=-1;function c(e){for(var t in a=e.lastIndex,n)n[t].lastIndex=a}function o(){var a=!1;if(r=n.COMB.exec(t)){a=!0;var o=r[0].trim();""==o&&(o=" "),s.push(o),c(n.COMB),i=s.length-1}else if(r=n.MODE.exec(t)){a=!0;var u=r[0].trim();if(c(n.MODE),":"==u){if("("==(r=n.PSEUDO.exec(t))[2]){var l=E(t,n.PSEUDO.lastIndex,"(",")");n.PSEUDO.lastIndex+=l.length+1,r[2]="not"==r[1]?e(l):l}s.splice(i+1,0,r[2],r[1],u),c(n.PSEUDO)}else"["==u?(r=n.ATTR.exec(t),s.splice(i+1,0,r[3],r[2],r[1],u),c(n.ATTR)):(r=n.IDENT.exec(t),s.push(r[1],u),c(n.IDENT))}else(r=n.IDENT.exec(t))&&(a=!0,s.push(r[1],"_"),c(n.IDENT));return a}for(;a-1;s--){var i=t[s];r.has(i[2])||!0!==n(a+i[2])||(c=e,o=i[0],u=i[1],l="",e=c.slice(0,o)+l+c.slice(o+u))}var c,o,u,l;return e}var M=function(e){return!0};return function(e){for(var t=f(e.html,!e.keepText),r=e.shouldDrop||M,n=T(e.css),a={},s=0;s0&&(s.forEach(function(e){return t.add(e)}),r+=s.join());break;case g:n>0&&(r+="{"+e[++a]+"}");break;case v:r+=e[++a]+"{";break;case x:r+="}";break;case y:r+=e[++a]}return w(r)}(n,I);return{css:w(A=function(e,t){for(var r,n=[],a=new Set,s=/@font-face[\s\S]+?font-family:\s*(['"\w-]+)[^}]+\}/gm;r=s.exec(e);){var i=r[1].replace(/['"]/gm,"");n.push([r.index,r[0].length,i])}for(var c=/font-family:([^;!}]+)/gm;r=c.exec(e);)n.some(function(e){return r.index>e[0]&&r.index