@letsrunit/executor 0.7.1 → 0.8.0
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/dist/index.js +62 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -106496,7 +106496,8 @@ function getDefaults(contentLength) {
|
|
|
106496
106496
|
normalizeWhitespace: true,
|
|
106497
106497
|
dropComments: true,
|
|
106498
106498
|
replaceBrInHeadings: true,
|
|
106499
|
-
limitLists: contentLength >= HTML_LIMIT_LISTS_THRESHOLD ? 20 : -1
|
|
106499
|
+
limitLists: contentLength >= HTML_LIMIT_LISTS_THRESHOLD ? 20 : -1,
|
|
106500
|
+
dropUtilityClasses: false
|
|
106500
106501
|
};
|
|
106501
106502
|
}
|
|
106502
106503
|
var ALLOWED_ATTRS = {
|
|
@@ -106610,6 +106611,7 @@ async function realScrubHtml({ html: html5, url: url2 }, opts = {}) {
|
|
|
106610
106611
|
if (o.dropComments) dropHtmlComments(doc);
|
|
106611
106612
|
if (o.replaceBrInHeadings) replaceBrsInHeadings(doc);
|
|
106612
106613
|
if (o.limitLists >= 0) limitListsAndRows(doc, o.limitLists);
|
|
106614
|
+
if (o.dropUtilityClasses) stripUtilityClasses(doc);
|
|
106613
106615
|
if (o.normalizeWhitespace) normalizeWhitespace(doc.body);
|
|
106614
106616
|
return doc.body.innerHTML;
|
|
106615
106617
|
}
|
|
@@ -106716,6 +106718,65 @@ function replaceBrsInHeadings(doc) {
|
|
|
106716
106718
|
});
|
|
106717
106719
|
});
|
|
106718
106720
|
}
|
|
106721
|
+
var UTILITY_VARIANT_RE = /:/;
|
|
106722
|
+
var UTILITY_PREFIX_RE = /^-?(?:p[xytblrse]?|m[xytblrse]?|gap|space-[xy]|w|h|min-w|min-h|max-w|max-h|size|basis|inset|top|right|bottom|left|start|end|z|text|bg|border|ring|shadow|outline|fill|stroke|divide|accent|caret|from|via|to|decoration|font|leading|tracking|indent|line-clamp|columns|aspect|object|opacity|rotate|scale|translate|skew|transition|duration|ease|delay|animate|rounded|overflow|overscroll|scroll|snap|touch|cursor|pointer-events|select|resize|flex|grid|col|row|order|auto-cols|auto-rows|items|justify|content|self|place|float|clear|list|whitespace|break|hyphens|mix-blend|bg-blend|backdrop|d|g|fs|fw|lh|align|position)-/i;
|
|
106723
|
+
var UTILITY_STANDALONE = /* @__PURE__ */ new Set([
|
|
106724
|
+
"flex",
|
|
106725
|
+
"grid",
|
|
106726
|
+
"block",
|
|
106727
|
+
"hidden",
|
|
106728
|
+
"inline",
|
|
106729
|
+
"inline-block",
|
|
106730
|
+
"inline-flex",
|
|
106731
|
+
"inline-grid",
|
|
106732
|
+
"contents",
|
|
106733
|
+
"flow-root",
|
|
106734
|
+
"list-item",
|
|
106735
|
+
"table",
|
|
106736
|
+
"container",
|
|
106737
|
+
"truncate",
|
|
106738
|
+
"grow",
|
|
106739
|
+
"shrink",
|
|
106740
|
+
"static",
|
|
106741
|
+
"relative",
|
|
106742
|
+
"absolute",
|
|
106743
|
+
"fixed",
|
|
106744
|
+
"sticky",
|
|
106745
|
+
"visible",
|
|
106746
|
+
"invisible",
|
|
106747
|
+
"collapse",
|
|
106748
|
+
"isolate",
|
|
106749
|
+
"underline",
|
|
106750
|
+
"overline",
|
|
106751
|
+
"line-through",
|
|
106752
|
+
"no-underline",
|
|
106753
|
+
"uppercase",
|
|
106754
|
+
"lowercase",
|
|
106755
|
+
"capitalize",
|
|
106756
|
+
"normal-case",
|
|
106757
|
+
"italic",
|
|
106758
|
+
"not-italic",
|
|
106759
|
+
"antialiased",
|
|
106760
|
+
"subpixel-antialiased",
|
|
106761
|
+
"sr-only",
|
|
106762
|
+
"not-sr-only",
|
|
106763
|
+
"clearfix",
|
|
106764
|
+
"row",
|
|
106765
|
+
"col"
|
|
106766
|
+
]);
|
|
106767
|
+
function isUtilityClass(token) {
|
|
106768
|
+
if (UTILITY_VARIANT_RE.test(token)) return true;
|
|
106769
|
+
const base2 = token.startsWith("-") ? token.slice(1) : token;
|
|
106770
|
+
if (UTILITY_STANDALONE.has(base2)) return true;
|
|
106771
|
+
return UTILITY_PREFIX_RE.test(token);
|
|
106772
|
+
}
|
|
106773
|
+
function stripUtilityClasses(doc) {
|
|
106774
|
+
for (const el of doc.body.querySelectorAll("[class]")) {
|
|
106775
|
+
const kept = el.className.split(/\s+/).filter((t) => t && !isUtilityClass(t));
|
|
106776
|
+
if (kept.length === 0) el.removeAttribute("class");
|
|
106777
|
+
else el.className = kept.join(" ");
|
|
106778
|
+
}
|
|
106779
|
+
}
|
|
106719
106780
|
function limitListsAndRows(doc, limit) {
|
|
106720
106781
|
doc.querySelectorAll("ul, ol").forEach((list2) => {
|
|
106721
106782
|
const items = Array.from(list2.children).filter((c) => c.tagName === "LI");
|