html-crush 6.0.22 → 6.0.23

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.22
4
+ * @version 6.0.23
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.22";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 W=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.23";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 W=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="<",x="{},:;<>~+",k=x,J=x,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.22
4
+ * @version 6.0.23
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[a])||t&&e[a]===B)return a;return null}function L(e,r=0){return Qe({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Xe({str:e,idx:r,stopAtNewlines:l,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!r||typeof r!="number")&&(r=0),r<1))return null;if(e[~-r]&&(e[~-r].trim()||l&&`
24
24
  \r`.includes(e[~-r])||t&&e[~-r]===B))return~-r;if(e[r-2]&&(e[r-2].trim()||l&&`
25
25
  \r`.includes(e[r-2])||t&&e[r-2]===B))return r-2;for(let a=r;a--;)if(e[a]&&(e[a].trim()||l&&`
26
- \r`.includes(e[a])||t&&e[a]===B))return a;return null}function z(e,r=0){return Xe({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ae="6.0.22";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,r){var ue,ae;let l=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[a])||t&&e[a]===B))return a;return null}function z(e,r=0){return Xe({str:e,idx:r,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ae="6.0.23";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,r){var ue,ae;let l=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(r&&!M(r))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 r}, equal to ${JSON.stringify(r,null,4)}`);if(r&&Array.isArray(r.breakToTheLeftOf)&&r.breakToTheLeftOf.length){for(let n=0,U=r.breakToTheLeftOf.length;n<U;n++)if(!S(r.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 r.breakToTheLeftOf[n]}" and is equal to:
28
28
  ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let a="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(a=[...new Set(t.breakToTheLeftOf.map(n=>n[0]))].join(""));let i={removeHTMLComments:!1,removeCSSComments:!1},u=null,s=null,g=!1,o=0,m=0,c=!1,y=!1,$=null,h=null,O=null,C=null,T,p=null,b=null,d=null,D=null,N=null,R=null,V=">};",j="<",Ce="!",Ne=">",ve="<",oe="{},:;<>~+",Q=oe,X=oe,_=!0,I=e.length,Re=Math.floor(I/2),se=.01,le;t.reportProgressFunc&&(le=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*se-t.reportProgressFuncFrom));let H,q=0,A=`
29
29
  `;if(e.includes(`\r
@@ -41,7 +41,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
41
41
  /**
42
42
  * @name ranges-sort
43
43
  * @fileoverview Sort string index ranges
44
- * @version 6.0.13
44
+ * @version 6.0.14
45
45
  * @author Roy Revelt, Codsen Ltd
46
46
  * @license MIT
47
47
  * {@link https://codsen.com/os/ranges-sort/}
@@ -49,7 +49,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
49
49
  /**
50
50
  * @name ranges-merge
51
51
  * @fileoverview Merge and sort string index ranges
52
- * @version 9.0.18
52
+ * @version 9.0.19
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(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);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.19
60
+ * @version 7.0.20
61
61
  * @author Roy Revelt, Codsen Ltd
62
62
  * @license MIT
63
63
  * {@link https://codsen.com/os/ranges-apply/}
@@ -73,7 +73,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
73
73
  /**
74
74
  * @name codsen-utils
75
75
  * @fileoverview Various utility functions
76
- * @version 1.6.7
76
+ * @version 1.6.8
77
77
  * @author Roy Revelt, Codsen Ltd
78
78
  * @license MIT
79
79
  * {@link https://codsen.com/os/codsen-utils/}
@@ -81,7 +81,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
81
81
  /**
82
82
  * @name ranges-push
83
83
  * @fileoverview Gather string index ranges
84
- * @version 7.0.18
84
+ * @version 7.0.19
85
85
  * @author Roy Revelt, Codsen Ltd
86
86
  * @license MIT
87
87
  * {@link https://codsen.com/os/ranges-push/}
@@ -97,7 +97,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);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.22
100
+ * @version 9.0.23
101
101
  * @author Roy Revelt, Codsen Ltd
102
102
  * @license MIT
103
103
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -105,7 +105,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
105
105
  /**
106
106
  * @name string-range-expander
107
107
  * @fileoverview Expands string index ranges within whitespace boundaries until letters are met
108
- * @version 4.0.17
108
+ * @version 4.0.18
109
109
  * @author Roy Revelt, Codsen Ltd
110
110
  * @license MIT
111
111
  * {@link https://codsen.com/os/string-range-expander/}
@@ -113,7 +113,7 @@ ${JSON.stringify(r.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),r);typeof t.r
113
113
  /**
114
114
  * @name string-left-right
115
115
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
116
- * @version 6.0.20
116
+ * @version 6.0.21
117
117
  * @author Roy Revelt, Codsen Ltd
118
118
  * @license MIT
119
119
  * {@link https://codsen.com/os/string-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-crush",
3
- "version": "6.0.22",
3
+ "version": "6.0.23",
4
4
  "description": "Minify email templates",
5
5
  "keywords": [
6
6
  "breaks",
@@ -80,12 +80,12 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "codsen-utils": "^1.6.7",
84
- "ranges-apply": "^7.0.19",
85
- "ranges-push": "^7.0.18",
86
- "string-left-right": "^6.0.20",
87
- "string-match-left-right": "^9.0.22",
88
- "string-range-expander": "^4.0.17",
89
- "test-mixer": "^4.1.17"
83
+ "codsen-utils": "^1.6.8",
84
+ "ranges-apply": "^7.0.20",
85
+ "ranges-push": "^7.0.19",
86
+ "string-left-right": "^6.0.21",
87
+ "string-match-left-right": "^9.0.23",
88
+ "string-range-expander": "^4.0.18",
89
+ "test-mixer": "^4.1.18"
90
90
  }
91
91
  }
package/types/index.d.ts CHANGED
@@ -37,4 +37,5 @@ interface Res {
37
37
  */
38
38
  declare function crush(str: string, opts?: Partial<Opts>): Res;
39
39
 
40
- export { type Opts, type Res, crush, defaults, version };
40
+ export { crush, defaults, version };
41
+ export type { Opts, Res };