html-minifier-next 7.5.2 → 7.6.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/src/lib/utils.js CHANGED
@@ -109,7 +109,7 @@ function lowercase(value) {
109
109
  // Replace async helper
110
110
 
111
111
  /**
112
- * Asynchronously replace matches in a string
112
+ * Asynchronously replace matches in a string.
113
113
  * @param {string} str - Input string
114
114
  * @param {RegExp} regex - Regular expression with global flag
115
115
  * @param {Function} asyncFn - Async function to process each match
@@ -146,8 +146,31 @@ function parseRegExp(value) {
146
146
 
147
147
  // Exports
148
148
 
149
+ /**
150
+ * Find the index of the `>` that closes an opening tag, correctly skipping
151
+ * over quoted attribute values (which may contain `>`).
152
+ * @param {string} html
153
+ * @param {number} pos - Start position (just after the tag name)
154
+ * @returns {number} Index of the closing `>`, or -1 if not found
155
+ */
156
+ function findTagEnd(html, pos) {
157
+ let i = pos;
158
+ while (i < html.length) {
159
+ const ch = html[i];
160
+ if (ch === '>') return i;
161
+ if (ch === '"' || ch === "'") {
162
+ const q = ch;
163
+ i++;
164
+ while (i < html.length && html[i] !== q) i++;
165
+ }
166
+ i++;
167
+ }
168
+ return -1;
169
+ }
170
+
149
171
  export {
150
172
  stableStringify,
173
+ findTagEnd,
151
174
  LRU,
152
175
  MAX_CACHE_ENTRY_SIZE,
153
176
  hashContent,
package/src/presets.js CHANGED
@@ -38,7 +38,7 @@ export const presets = {
38
38
  };
39
39
 
40
40
  /**
41
- * Get preset configuration by name
41
+ * Get preset configuration by name.
42
42
  * @param {string} name - Preset name (“conservative” or “comprehensive”)
43
43
  * @returns {object|null} Preset options object or null if not found
44
44
  */