From deb0349b313de3262c791f997d73c63de29a3d66 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Mon, 8 Apr 2019 18:50:15 -0500 Subject: [PATCH] 1.0.0 --- dist/dropcss.cjs.js | 2 +- dist/dropcss.js | 2 +- dist/dropcss.min.js | 2 +- package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/dropcss.cjs.js b/dist/dropcss.cjs.js index 58816f1..cb130d8 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 (v0.5.0) +* https://github.com/leeoniya/dropcss (v1.0.0) */ 'use strict'; diff --git a/dist/dropcss.js b/dist/dropcss.js index 253af4f..e3ae8c6 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 (v0.5.0) +* https://github.com/leeoniya/dropcss (v1.0.0) */ (function (global, factory) { diff --git a/dist/dropcss.min.js b/dist/dropcss.min.js index 0332215..fcb2813 100644 --- a/dist/dropcss.min.js +++ b/dist/dropcss.min.js @@ -1,2 +1,2 @@ -/*! https://github.com/leeoniya/dropcss (v0.5.0) */ +/*! https://github.com/leeoniya/dropcss (v1.0.0) */ !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";var e=1,t=2,r=3,n=new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),a=/]*>||]*>[\s\S]*?<\/script>|]*>[\s\S]*?<\/style>|]*>|]*>/gim,s=/([\w-]+)(?:="([^"]*)"|='([^']*)'|=(\S+))?/gm,i={TAG_HEAD:/\s*<([a-z0-9_-]+)(?:\s+([^>]*))?>\s*/my,TEXT:/\s*[^<]*/my,TAG_CLOSE:/\s*<\/[a-z0-9_-]+>\s*/my};var c=new Set;function o(e,t,r){return{tagName:t,attributes:r,classList:null!=r&&r.has("class")?new Set(r.get("class").split(/\s+/g)):c,parentNode:e,childNodes:[]}}function l(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 null}var u=function(l){var u=function(a){var c,o=0,l=[];function u(e){for(var t in o=e.lastIndex,i)i[t].lastIndex=o}function d(){if(null!=(c=i.TAG_CLOSE.exec(a)))return u(i.TAG_CLOSE),void l.push(r);if(null==(c=i.TAG_HEAD.exec(a)))null!=(c=i.TEXT.exec(a))&&u(i.TEXT);else{u(i.TAG_HEAD);var o=c[1];l.push(e,o);var d=c[2];if(null!=d){for(var f,h=new Map;f=s.exec(d);)h.set(f[1],(f[2]||f[3]||f[4]||"").trim());l.push(t,h)}n.has(o)&&l.push(r)}}for(;o~+]\s*|\s+/g,h=1,p=2,x=3,v=4,m=5;function g(e,t){for(var r="",n=1;"{"==e[t]?n++:"}"==e[t]&&n--,0!=n;)r+=e[t++];return r}function y(e){var t,r={RULE_HEAD:/\s*([^{;]+?)\s*[{;]\s*/my,RULE_TAIL:/\s*([^}]*?)\s*\}/my,AT_TAIL:/\s*\}/my,RULE_FULL:/\s*([^{]*?)\{([^}]+?)\}/my},n=0,a=0,s=[];function i(e){for(var t in a=e.lastIndex,r)r[t].lastIndex=a}function c(){if(n>0&&null!=(t=r.AT_TAIL.exec(e)))return n--,s.push(p),void i(r.AT_TAIL);if(null!=(t=r.RULE_HEAD.exec(e))){var c=t[1];if(i(r.RULE_HEAD),"@"==c[0])switch(c.match(/@[a-z-]+/)[0]){case"@media":case"@supports":case"@document":n++,s.push(h,c);break;case"@import":case"@charset":case"@namespace":s.push(m,c+";");break;default:n++;var o=g(e,a);i({lastIndex:a+o.length}),s.push(h,c,m,o)}else s.push(x,(l=t[1],(u=l.split(/\s*,\s*/gm)).push(u.map(function(e){return function(e){return e.replace(/:?:[a-z-]+(?:\([^()]+\))?/gm,"")}(e).trim().replace(/(\.|#|\[)/gm," $1").replace(/\]/gm,"] ").trim().split(f)})),u)),t=r.RULE_TAIL.exec(e),s.push(v,t[1]),i(r.RULE_TAIL)}else a=e.length;var l,u}for(;a":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=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}var A=function(e,t){return E(e,Array.isArray(t)?t:function e(t){var r,n={IDENT:/([\w*-]+)/iy,ATTR:/([\w-]+)(?:(.?=)"?([^\]]*?)"?)?\]/iy,PSEUDO:/([\w-]+)(?:\(([^)]*)\))?/iy,MODE:/\s*[:.#\[]\s*/iy,COMB:/\s*[>~+]\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 o=!1;if(r=n.COMB.exec(t)){o=!0;var l=r[0].trim();""==l&&(l=" "),s.push(l),c(n.COMB),i=a}else if(r=n.MODE.exec(t)){o=!0;var u=r[0].trim();c(n.MODE),":"==u?(r=n.PSEUDO.exec(t),s.splice(i+1,0,null!=r[2]&&"not"==r[1]?e(r[2]):r[2],r[1],u),c(n.PSEUDO)):"["==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))&&(o=!0,s.push(r[1],"_"),c(n.IDENT));return o}for(;a-1;n--){var a=t[n];r.has(a[2])||(s=e,i=a[0],c=a[1],o="",e=s.slice(0,i)+o+s.slice(i+c))}var s,i,c,o;return e}var S=function(e){return!0};return function(e){for(var t=u(e.html,!e.keepText),r=e.shouldDrop||S,n=y(e.css.replace(d,"")),a={},s=0;s0&&(t+=a.join());break;case v:r>0&&(t+="{"+e[++n]+"}");break;case h:t+=e[++n]+"{";break;case p:t+="}";break;case m:t+=e[++n]}return t.replace(/@[a-z-]+\s+[^{]+\{\s*\}/gm,"")}(n);return{css:D=function(e){for(var t,r=[],n=new Set,a=/@font-face[\s\S]+?font-family:\s*(['"\w-]+)[^}]+\}/gm;t=a.exec(e);){var s=t[1].replace(/['"]/gm,"");r.push([t.index,t[0].length,s])}for(var i=/font-family:([^;!}]+)/gm;t=i.exec(e);)r.some(function(e){return t.index>e[0]&&t.index