html-crush 6.0.16 → 6.0.17
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/html-crush.esm.js +2 -2
- package/dist/html-crush.umd.js +12 -12
- package/package.json +8 -8
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2024 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -65,6 +65,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
65
65
|
|
|
66
66
|
MIT License.
|
|
67
67
|
|
|
68
|
-
Copyright © 2010-
|
|
68
|
+
Copyright © 2010-2024 Roy Revelt and other contributors.
|
|
69
69
|
|
|
70
70
|
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
|
package/dist/html-crush.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.0.
|
|
4
|
+
* @version 6.0.17
|
|
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.
|
|
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.17";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
|
package/dist/html-crush.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name html-crush
|
|
3
3
|
* @fileoverview Minify email templates
|
|
4
|
-
* @version 6.0.
|
|
4
|
+
* @version 6.0.17
|
|
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.
|
|
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.17";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
|
|
@@ -41,7 +41,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
|
|
|
41
41
|
/**
|
|
42
42
|
* @name ranges-sort
|
|
43
43
|
* @fileoverview Sort string index ranges
|
|
44
|
-
* @version 6.0.
|
|
44
|
+
* @version 6.0.11
|
|
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(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.
|
|
52
|
+
* @version 9.0.14
|
|
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.
|
|
60
|
+
* @version 7.0.14
|
|
61
61
|
* @author Roy Revelt, Codsen Ltd
|
|
62
62
|
* @license MIT
|
|
63
63
|
* {@link https://codsen.com/os/ranges-apply/}
|
|
@@ -65,7 +65,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
|
|
|
65
65
|
/**
|
|
66
66
|
* @name string-collapse-leading-whitespace
|
|
67
67
|
* @fileoverview Collapse the leading and trailing whitespace of a string
|
|
68
|
-
* @version 7.0.
|
|
68
|
+
* @version 7.0.7
|
|
69
69
|
* @author Roy Revelt, Codsen Ltd
|
|
70
70
|
* @license MIT
|
|
71
71
|
* {@link https://codsen.com/os/string-collapse-leading-whitespace/}
|
|
@@ -73,7 +73,7 @@ ${JSON.stringify(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);typeof t.r
|
|
|
73
73
|
/**
|
|
74
74
|
* @name codsen-utils
|
|
75
75
|
* @fileoverview Various utility functions
|
|
76
|
-
* @version 1.6.
|
|
76
|
+
* @version 1.6.3
|
|
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(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.
|
|
84
|
+
* @version 7.0.14
|
|
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.
|
|
92
|
+
* @version 5.0.8
|
|
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.
|
|
100
|
+
* @version 9.0.17
|
|
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(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);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.
|
|
108
|
+
* @version 4.0.13
|
|
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(o.breakToTheLeftOf[n],null,4)}`)}let t=w(w({},Ie),o);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.
|
|
116
|
+
* @version 6.0.16
|
|
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.
|
|
3
|
+
"version": "6.0.17",
|
|
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.
|
|
84
|
-
"ranges-apply": "^7.0.
|
|
85
|
-
"ranges-push": "^7.0.
|
|
86
|
-
"string-left-right": "^6.0.
|
|
87
|
-
"string-match-left-right": "^9.0.
|
|
88
|
-
"string-range-expander": "^4.0.
|
|
89
|
-
"test-mixer": "^4.1.
|
|
83
|
+
"codsen-utils": "^1.6.3",
|
|
84
|
+
"ranges-apply": "^7.0.14",
|
|
85
|
+
"ranges-push": "^7.0.14",
|
|
86
|
+
"string-left-right": "^6.0.16",
|
|
87
|
+
"string-match-left-right": "^9.0.17",
|
|
88
|
+
"string-range-expander": "^4.0.13",
|
|
89
|
+
"test-mixer": "^4.1.13"
|
|
90
90
|
}
|
|
91
91
|
}
|