html-crush 6.0.15 → 6.0.16

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.
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.15
4
+ * @version 6.0.16
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
8
8
  */
9
9
 
10
- import{rApply as ne}from"ranges-apply";import{Ranges as le}from"ranges-push";import{matchLeft as oe,matchRight as F,matchRightIncl as X}from"string-match-left-right";import{expander as _}from"string-range-expander";import{left as G,right as a}from"string-left-right";import{isStr as A,isLetter as y,isPlainObject as te}from"codsen-utils";var Y="6.0.15";var be=Y,$=new le({limitToBeAddedWhitespace:!0}),ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function he(n,E){let x=Date.now();if(!A(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
10
+ import{rApply as ne}from"ranges-apply";import{Ranges as le}from"ranges-push";import{matchLeft as oe,matchRight as F,matchRightIncl as X}from"string-match-left-right";import{expander as _}from"string-range-expander";import{left as G,right as a}from"string-left-right";import{isStr as A,isLetter as y,isPlainObject as te}from"codsen-utils";var Y="6.0.16";var be=Y,$=new le({limitToBeAddedWhitespace:!0}),ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function he(n,E){let x=Date.now();if(!A(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
11
11
  ${JSON.stringify(n,null,4)}`);if(E&&!te(E))throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof E}, equal to ${JSON.stringify(E,null,4)}`);if(E&&Array.isArray(E.breakToTheLeftOf)&&E.breakToTheLeftOf.length){for(let e=0,w=E.breakToTheLeftOf.length;e<w;e++)if(!A(E.breakToTheLeftOf[e]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${e} is of a type "${typeof E.breakToTheLeftOf[e]}" and is equal to:
12
12
  ${JSON.stringify(E.breakToTheLeftOf[e],null,4)}`)}let l={...ie,...E};typeof l.removeHTMLComments=="boolean"&&(l.removeHTMLComments=l.removeHTMLComments?1:0);let v="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(v=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let L={removeHTMLComments:!1,removeCSSComments:!1},p=null,i=null,S=!1,m=0,H=0,g=!1,O=!1,c=null,f=null,V=null,U=null,u,t=null,s=null,r=null,T=null,D=null,M=null,P=">};",I="<",K="!",q=">",z="<",W="{},:;<>~+",k=W,J=W,C=!0,h=n.length,Q=Math.floor(h/2),B=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*B-l.reportProgressFuncFrom));let d,R=0,b=`
13
13
  `;if(n.includes(`\r
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.15
4
+ * @version 6.0.16
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
@@ -23,7 +23,7 @@ ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] In
23
23
  \r`.includes(e[s])||t&&e[s]===B)return s;return null}function L(e,o=0){return Qe({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Xe({str:e,idx:o,stopAtNewlines:u,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!o||typeof o!="number")&&(o=0),o<1))return null;if(e[~-o]&&(e[~-o].trim()||u&&`
24
24
  \r`.includes(e[~-o])||t&&e[~-o]===B))return~-o;if(e[o-2]&&(e[o-2].trim()||u&&`
25
25
  \r`.includes(e[o-2])||t&&e[o-2]===B))return o-2;for(let s=o;s--;)if(e[s]&&(e[s].trim()||u&&`
26
- \r`.includes(e[s])||t&&e[s]===B))return s;return null}function z(e,o=0){return Xe({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ae="6.0.15";var et=Ae,E=new Se({limitToBeAddedWhitespace:!0}),Ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function tt(e,o){var ae,ue;let u=Date.now();if(!S(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
+ \r`.includes(e[s])||t&&e[s]===B))return s;return null}function z(e,o=0){return Xe({str:e,idx:o,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ae="6.0.16";var et=Ae,E=new Se({limitToBeAddedWhitespace:!0}),Ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function tt(e,o){var ae,ue;let u=Date.now();if(!S(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
27
27
  ${JSON.stringify(e,null,4)}`);if(o&&!R(o))throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof o}, equal to ${JSON.stringify(o,null,4)}`);if(o&&Array.isArray(o.breakToTheLeftOf)&&o.breakToTheLeftOf.length){for(let n=0,k=o.breakToTheLeftOf.length;n<k;n++)if(!S(o.breakToTheLeftOf[n]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${n} is of a type "${typeof o.breakToTheLeftOf[n]}" and is equal to:
28
28
  ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let s="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(s=[...new Set(t.breakToTheLeftOf.map(n=>n[0]))].join(""));let r={removeHTMLComments:!1,removeCSSComments:!1},a=null,l=null,g=!1,i=0,$=0,d=!1,b=!1,f=null,c=null,O=null,D=null,T,h=null,p=null,y=null,A=null,C=null,M=null,j=">};",U="<",Ce="!",ve=">",Ne="<",oe="{},:;<>~+",Q=oe,X=oe,_=!0,v=e.length,Re=Math.floor(v/2),le=.01,se;t.reportProgressFunc&&(se=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*le-t.reportProgressFuncFrom));let P,q=0,I=`
29
29
  `;if(e.includes(`\r
@@ -49,7 +49,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
49
49
  /**
50
50
  * @name ranges-merge
51
51
  * @fileoverview Merge and sort string index ranges
52
- * @version 9.0.12
52
+ * @version 9.0.13
53
53
  * @author Roy Revelt, Codsen Ltd
54
54
  * @license MIT
55
55
  * {@link https://codsen.com/os/ranges-merge/}
@@ -57,7 +57,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
57
57
  /**
58
58
  * @name ranges-apply
59
59
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
60
- * @version 7.0.12
60
+ * @version 7.0.13
61
61
  * @author Roy Revelt, Codsen Ltd
62
62
  * @license MIT
63
63
  * {@link https://codsen.com/os/ranges-apply/}
@@ -81,7 +81,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
81
81
  /**
82
82
  * @name ranges-push
83
83
  * @fileoverview Gather string index ranges
84
- * @version 7.0.12
84
+ * @version 7.0.13
85
85
  * @author Roy Revelt, Codsen Ltd
86
86
  * @license MIT
87
87
  * {@link https://codsen.com/os/ranges-push/}
@@ -89,7 +89,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
89
89
  /**
90
90
  * @name arrayiffy-if-string
91
91
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
92
- * @version 5.0.6
92
+ * @version 5.0.7
93
93
  * @author Roy Revelt, Codsen Ltd
94
94
  * @license MIT
95
95
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -97,7 +97,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
97
97
  /**
98
98
  * @name string-match-left-right
99
99
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
100
- * @version 9.0.15
100
+ * @version 9.0.16
101
101
  * @author Roy Revelt, Codsen Ltd
102
102
  * @license MIT
103
103
  * {@link https://codsen.com/os/string-match-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-crush",
3
- "version": "6.0.15",
3
+ "version": "6.0.16",
4
4
  "description": "Minify email templates",
5
5
  "keywords": [
6
6
  "breaks",
@@ -81,10 +81,10 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "codsen-utils": "^1.6.2",
84
- "ranges-apply": "^7.0.12",
85
- "ranges-push": "^7.0.12",
84
+ "ranges-apply": "^7.0.13",
85
+ "ranges-push": "^7.0.13",
86
86
  "string-left-right": "^6.0.15",
87
- "string-match-left-right": "^9.0.15",
87
+ "string-match-left-right": "^9.0.16",
88
88
  "string-range-expander": "^4.0.12",
89
89
  "test-mixer": "^4.1.12"
90
90
  }