html-minifier 3.5.21 → 5.0.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.
Files changed (55) hide show
  1. package/LICENSE.txt +23 -0
  2. package/README.md +851 -109
  3. package/cli.js +991 -206
  4. package/dist/types/htmlminifier.d.ts +629 -0
  5. package/dist/types/htmlminifier.d.ts.map +1 -0
  6. package/dist/types/htmlparser.d.ts +28 -0
  7. package/dist/types/htmlparser.d.ts.map +1 -0
  8. package/dist/types/lib/attributes.d.ts +87 -0
  9. package/dist/types/lib/attributes.d.ts.map +1 -0
  10. package/dist/types/lib/constants.d.ts +421 -0
  11. package/dist/types/lib/constants.d.ts.map +1 -0
  12. package/dist/types/lib/content.d.ts +44 -0
  13. package/dist/types/lib/content.d.ts.map +1 -0
  14. package/dist/types/lib/elements.d.ts +48 -0
  15. package/dist/types/lib/elements.d.ts.map +1 -0
  16. package/dist/types/lib/fragments.d.ts +47 -0
  17. package/dist/types/lib/fragments.d.ts.map +1 -0
  18. package/dist/types/lib/option-definitions.d.ts +33 -0
  19. package/dist/types/lib/option-definitions.d.ts.map +1 -0
  20. package/dist/types/lib/options.d.ts +93 -0
  21. package/dist/types/lib/options.d.ts.map +1 -0
  22. package/dist/types/lib/unused-css.d.ts +76 -0
  23. package/dist/types/lib/unused-css.d.ts.map +1 -0
  24. package/dist/types/lib/urls.d.ts +15 -0
  25. package/dist/types/lib/urls.d.ts.map +1 -0
  26. package/dist/types/lib/utils.d.ts +132 -0
  27. package/dist/types/lib/utils.d.ts.map +1 -0
  28. package/dist/types/lib/whitespace.d.ts +97 -0
  29. package/dist/types/lib/whitespace.d.ts.map +1 -0
  30. package/dist/types/presets.d.ts +50 -0
  31. package/dist/types/presets.d.ts.map +1 -0
  32. package/dist/types/tokenchain.d.ts +36 -0
  33. package/dist/types/tokenchain.d.ts.map +1 -0
  34. package/html-minifier.schema.json +322 -0
  35. package/package.json +70 -58
  36. package/src/htmlminifier.js +2848 -1095
  37. package/src/htmlparser.js +1165 -450
  38. package/src/lib/attributes.js +1196 -0
  39. package/src/lib/constants.js +521 -0
  40. package/src/lib/content.js +237 -0
  41. package/src/lib/elements.js +268 -0
  42. package/src/lib/file-pool.js +193 -0
  43. package/src/lib/file-write.js +87 -0
  44. package/src/lib/fragments.js +340 -0
  45. package/src/lib/option-definitions.js +246 -0
  46. package/src/lib/options.js +841 -0
  47. package/src/lib/unused-css.js +499 -0
  48. package/src/lib/urls.js +146 -0
  49. package/src/lib/utils.js +1026 -0
  50. package/src/lib/whitespace.js +431 -0
  51. package/src/presets.js +58 -0
  52. package/src/tokenchain.js +142 -56
  53. package/LICENSE +0 -22
  54. package/sample-cli-config-file.conf +0 -39
  55. package/src/utils.js +0 -18
@@ -0,0 +1,87 @@
1
+ /**
2
+ * HTML attribute parsing, decoding, and minification
3
+ */
4
+ import type { ProcessedOptions } from './options.js';
5
+ export type HTMLAttribute = {
6
+ name: string;
7
+ value?: string | undefined;
8
+ quote?: string;
9
+ customAssign?: string;
10
+ customOpen?: string;
11
+ customClose?: string;
12
+ };
13
+ /**
14
+ * @param {string} text
15
+ * @param {ProcessedOptions} options
16
+ */
17
+ declare function isIgnoredComment(text: string, options: ProcessedOptions): boolean;
18
+ /**
19
+ * Remove duplicate attributes from an attribute list.
20
+ * Per HTML spec, when an attribute appears multiple times, the first occurrence wins.
21
+ * Duplicate attributes result in invalid HTML, so only the first is kept.
22
+ * @param {HTMLAttribute[]} attrs - Array of attribute objects with `name` property
23
+ * @param {boolean} caseSensitive - Whether to compare names case-sensitively (for XML/SVG)
24
+ * @returns {HTMLAttribute[]} Deduplicated attribute array (modifies in place and returns)
25
+ */
26
+ declare function deduplicateAttributes(attrs: HTMLAttribute[], caseSensitive: boolean): HTMLAttribute[];
27
+ /**
28
+ * @param {string} tag
29
+ * @param {HTMLAttribute[]} attrs
30
+ */
31
+ declare function isExecutableScript(tag: string, attrs: HTMLAttribute[]): boolean;
32
+ /**
33
+ * @param {string} tag
34
+ * @param {HTMLAttribute[]} attrs
35
+ */
36
+ declare function isStyleElement(tag: string, attrs: HTMLAttribute[]): boolean;
37
+ /**
38
+ * Whether a `meta` element has no effect in any current browser, holding no more than the
39
+ * `http-equiv` or `name` that says so, and `content`
40
+ * @param {HTMLAttribute[]} attrs - Deduplicated
41
+ * @param {string[]} markers - What custom fragment and `htmlmin:ignore` placeholders hold
42
+ */
43
+ declare function isMetaWithoutEffect(attrs: HTMLAttribute[], markers: string[]): boolean;
44
+ /**
45
+ * Replace a `meta` element’s `http-equiv=Content-Type` and `content` with the `charset` they
46
+ * declare, which browsers read the same
47
+ * @param {HTMLAttribute[]} attrs - Deduplicated; changed in place
48
+ * @param {string[]} markers - What custom fragment and `htmlmin:ignore` placeholders hold
49
+ */
50
+ declare function replaceContentTypePragma(attrs: HTMLAttribute[], markers: string[]): void;
51
+ /**
52
+ * @param {string} name
53
+ * @param {HTMLAttribute[]} attrs
54
+ */
55
+ declare function hasAttrName(name: string, attrs: HTMLAttribute[]): boolean;
56
+ /**
57
+ * @param {HTMLAttribute} attr
58
+ * @param {HTMLAttribute[]} attrs
59
+ * @param {string} tag
60
+ * @param {string} tagOut - The tag name as written, for hooks
61
+ * @param {ProcessedOptions} options
62
+ * @param {Function} minifyHTML
63
+ * @param {string[]} [markers] - What custom fragment and `htmlmin:ignore` placeholders hold
64
+ */
65
+ declare function normalizeAttr(attr: HTMLAttribute, attrs: HTMLAttribute[], tag: string, tagOut: string, options: ProcessedOptions, minifyHTML: Function, markers?: string[]): Promise<{
66
+ attr: HTMLAttribute;
67
+ name: string;
68
+ value: string | undefined;
69
+ } | undefined> | {
70
+ attr: HTMLAttribute;
71
+ name: string;
72
+ value: string | undefined;
73
+ } | undefined;
74
+ /**
75
+ * @param {{name: string, value: string | undefined, attr: HTMLAttribute}} normalized
76
+ * @param {string | boolean | undefined} hasUnarySlash
77
+ * @param {ProcessedOptions} options
78
+ * @param {boolean} isLast
79
+ * @param {string | undefined} uidAttr
80
+ */
81
+ declare function buildAttr(normalized: {
82
+ name: string;
83
+ value: string | undefined;
84
+ attr: HTMLAttribute;
85
+ }, hasUnarySlash: string | boolean | undefined, options: ProcessedOptions, isLast: boolean, uidAttr: string | undefined): string;
86
+ export { isIgnoredComment, isExecutableScript, isStyleElement, isMetaWithoutEffect, hasAttrName, normalizeAttr, buildAttr, deduplicateAttributes, replaceContentTypePragma };
87
+ //# sourceMappingURL=attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/lib/attributes.js"],"names":[],"mappings":"AAAA;;GAEG;AAoCC,OAAQ,KAAA,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAGjD,YAA0I,aAAa,GAA7I;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAE1I;AA8BD;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,IAAI,EAHnB,MAGmB,EAAE,OAAO,EAF5B,gBAE4B,WAOtC;AAuCD;;;;;;;GAOG;AACH,iBAAS,qBAAqB,CAAC,KAAK,EAJzB,aAAa,EAIY,EAAE,aAAa,EAHxC,OAGwC,GAFtC,aAAa,EAAE,CAqB3B;AA4JD;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,GAAG,EAHpB,MAGoB,EAAE,KAAK,EAF3B,aAAa,EAEc,WAUrC;AAOD;;;GAGG;AACH,iBAAS,cAAc,CAAC,GAAG,EAHhB,MAGgB,EAAE,KAAK,EAFvB,aAAa,EAEU,WAUjC;AA6JD;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,KAAK,EAHvB,aAAa,EAGU,EAAE,OAAO,EAFhC,MAAM,EAE0B,WAkB1C;AA0BD;;;;;GAKG;AACH,iBAAS,wBAAwB,CAAC,KAAK,EAH5B,aAAa,EAGe,EAAE,OAAO,EAFrC,MAAM,EAE+B,QAe/C;AAmDD;;;GAGG;AACH,iBAAS,WAAW,CAAC,IAAI,EAHd,MAGc,EAAE,KAAK,EAFrB,aAAa,EAEQ,WAO/B;AAmUD;;;;;;;;GAQG;AACH,iBAAS,aAAa,CAAC,IAAI,EARhB,aAQgB,EAAE,KAAK,EAPvB,aAAa,EAOU,EAAE,GAAG,EAN5B,MAM4B,EAAE,MAAM,EALpC,MAKoC,EAAE,OAAO,EAJ7C,gBAI6C,EAAE,UAAU,UAAA,EAAE,OAAO,AAF1E,CACF,EADU,MAAM,EAE4D;;;;;;;;cAkB5E;AAsED;;;;;;GAMG;AACH,iBAAS,SAAS,CAAC,UAAU,EANlB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAM3C,EAAE,aAAa,EALjC,MAAM,GAAG,OAAO,GAAG,SAKc,EAAE,OAAO,EAJ1C,gBAI0C,EAAE,MAAM,EAHlD,OAGkD,EAAE,OAAO,EAF3D,MAAM,GAAG,SAEkD,UA0HrE;AAED,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,WAAW,EAGX,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,wBAAwB,EACzB,CAAC"}
@@ -0,0 +1,421 @@
1
+ /**
2
+ * Regex patterns, element sets, and default configuration
3
+ */
4
+ declare const RE_WS_START: RegExp;
5
+ declare const RE_WS_END: RegExp;
6
+ declare const RE_WS_ONLY: RegExp;
7
+ declare const RE_WS_NBSP_END: RegExp;
8
+ declare const RE_ALL_WS_NBSP: RegExp;
9
+ declare const RE_NBSP_LEADING_GROUP: RegExp;
10
+ declare const RE_NBSP_LEAD_GROUP: RegExp;
11
+ declare const RE_NBSP_TRAILING_GROUP: RegExp;
12
+ declare const RE_NBSP_TRAILING_STRIP: RegExp;
13
+ declare const RE_EVENT_ATTR_DEFAULT: RegExp;
14
+ declare const RE_CAN_REMOVE_ATTR_QUOTES: RegExp;
15
+ declare const RE_TRAILING_SEMICOLON: RegExp;
16
+ declare const RE_CR: RegExp;
17
+ declare const RE_LINE_BREAK_CR: RegExp;
18
+ declare const RE_LEGACY_ENTITIES: RegExp;
19
+ declare const RE_AMP_REFERENCE_ATTR: RegExp;
20
+ declare const RE_ESCAPE_LT: RegExp;
21
+ declare const RE_BASE_ELEMENT: RegExp;
22
+ declare const RE_XML_ESCAPE_TEXT: RegExp;
23
+ declare const RE_XML_ESCAPE_ATTR: RegExp;
24
+ declare const RE_ESCAPE_LT_RAW_TEXT: Record<string, RegExp>;
25
+ declare const RE_HTML_ENCODING: RegExp;
26
+ declare const RE_DOCTYPE: RegExp;
27
+ declare const RE_ATTR_WS_CHECK: RegExp;
28
+ declare const RE_ATTR_WS_COLLAPSE: RegExp;
29
+ declare const RE_WS_CHAR: RegExp;
30
+ declare const RE_STYLE_ELEMENT: RegExp;
31
+ declare const RE_EMPTY_ATTRIBUTE: RegExp;
32
+ declare const inlineElementsToKeepWhitespaceAround: Set<string>;
33
+ declare const inlineElementsToKeepWhitespaceWithin: Set<string>;
34
+ declare const inlineElementsToKeepWhitespaceBetween: Set<string>;
35
+ declare const inlineElementsTransparent: Set<string>;
36
+ declare const processingInstructionTag = "?";
37
+ declare const inlineElementsToKeepWhitespace: Set<string>;
38
+ declare const formattingElements: Set<string>;
39
+ /** @param {Iterable<string>} names */
40
+ declare const toEndTags: (names: Iterable<string>) => Set<string>;
41
+ declare const formControlElementsEither: Set<string>;
42
+ declare const inlineElementsToKeepWhitespaceBetweenEnd: Set<string>;
43
+ declare const inlineElementsTransparentAfter: Set<string>;
44
+ declare const generalDefaults: {
45
+ autocorrect: string;
46
+ fetchpriority: string;
47
+ loading: string;
48
+ popovertargetaction: string;
49
+ };
50
+ declare const tagDefaults: {
51
+ area: {
52
+ shape: string;
53
+ };
54
+ button: {
55
+ type: string;
56
+ };
57
+ col: {
58
+ span: string;
59
+ };
60
+ colgroup: {
61
+ span: string;
62
+ };
63
+ form: {
64
+ autocomplete: string;
65
+ enctype: string;
66
+ method: string;
67
+ };
68
+ html: {
69
+ dir: string;
70
+ };
71
+ iframe: {
72
+ scrolling: string;
73
+ };
74
+ img: {
75
+ decoding: string;
76
+ };
77
+ input: {
78
+ colorspace: string;
79
+ type: string;
80
+ };
81
+ link: {
82
+ media: string;
83
+ };
84
+ marquee: {
85
+ behavior: string;
86
+ direction: string;
87
+ };
88
+ meta: {
89
+ media: string;
90
+ };
91
+ meter: {
92
+ max: string;
93
+ min: string;
94
+ };
95
+ ol: {
96
+ start: string;
97
+ type: string;
98
+ };
99
+ progress: {
100
+ max: string;
101
+ };
102
+ source: {
103
+ media: string;
104
+ };
105
+ style: {
106
+ media: string;
107
+ };
108
+ td: {
109
+ colspan: string;
110
+ rowspan: string;
111
+ };
112
+ textarea: {
113
+ cols: string;
114
+ rows: string;
115
+ wrap: string;
116
+ };
117
+ th: {
118
+ colspan: string;
119
+ rowspan: string;
120
+ scope: string;
121
+ };
122
+ track: {
123
+ kind: string;
124
+ };
125
+ };
126
+ declare const integrationPointsForeign: {
127
+ svg: Set<string>;
128
+ math: Set<string>;
129
+ };
130
+ declare const metaHttpEquivNoEffect: Set<string>;
131
+ declare const metaNamesNoEffect: Set<string>;
132
+ declare const targetSelfElements: Set<string>;
133
+ declare const tagDefaultsSVG: {
134
+ animatemotion: {
135
+ rotate: string;
136
+ };
137
+ animatetransform: {
138
+ type: string;
139
+ };
140
+ circle: {
141
+ cx: string;
142
+ cy: string;
143
+ };
144
+ clippath: {
145
+ clippathunits: string;
146
+ };
147
+ ellipse: {
148
+ cx: string;
149
+ cy: string;
150
+ };
151
+ feblend: {
152
+ mode: string;
153
+ };
154
+ fecolormatrix: {
155
+ type: string;
156
+ };
157
+ fecomposite: {
158
+ k1: string;
159
+ k2: string;
160
+ k3: string;
161
+ k4: string;
162
+ operator: string;
163
+ };
164
+ feconvolvematrix: {
165
+ bias: string;
166
+ edgemode: string;
167
+ order: string;
168
+ preservealpha: string;
169
+ };
170
+ fediffuselighting: {
171
+ diffuseconstant: string;
172
+ surfacescale: string;
173
+ };
174
+ fedisplacementmap: {
175
+ scale: string;
176
+ xchannelselector: string;
177
+ ychannelselector: string;
178
+ };
179
+ fedistantlight: {
180
+ azimuth: string;
181
+ elevation: string;
182
+ };
183
+ fedropshadow: {
184
+ dx: string;
185
+ dy: string;
186
+ stddeviation: string;
187
+ };
188
+ fefunca: {
189
+ amplitude: string;
190
+ exponent: string;
191
+ intercept: string;
192
+ offset: string;
193
+ slope: string;
194
+ type: string;
195
+ };
196
+ fefuncb: {
197
+ amplitude: string;
198
+ exponent: string;
199
+ intercept: string;
200
+ offset: string;
201
+ slope: string;
202
+ type: string;
203
+ };
204
+ fefuncg: {
205
+ amplitude: string;
206
+ exponent: string;
207
+ intercept: string;
208
+ offset: string;
209
+ slope: string;
210
+ type: string;
211
+ };
212
+ fefuncr: {
213
+ amplitude: string;
214
+ exponent: string;
215
+ intercept: string;
216
+ offset: string;
217
+ slope: string;
218
+ type: string;
219
+ };
220
+ fegaussianblur: {
221
+ stddeviation: string;
222
+ };
223
+ feimage: {
224
+ preserveaspectratio: string;
225
+ };
226
+ femorphology: {
227
+ operator: string;
228
+ radius: string;
229
+ };
230
+ feoffset: {
231
+ dx: string;
232
+ dy: string;
233
+ };
234
+ fepointlight: {
235
+ x: string;
236
+ y: string;
237
+ z: string;
238
+ };
239
+ fespecularlighting: {
240
+ specularconstant: string;
241
+ specularexponent: string;
242
+ surfacescale: string;
243
+ };
244
+ fespotlight: {
245
+ pointsatx: string;
246
+ pointsaty: string;
247
+ pointsatz: string;
248
+ specularexponent: string;
249
+ x: string;
250
+ y: string;
251
+ z: string;
252
+ };
253
+ feturbulence: {
254
+ basefrequency: string;
255
+ numoctaves: string;
256
+ seed: string;
257
+ stitchtiles: string;
258
+ type: string;
259
+ };
260
+ filter: {
261
+ filterunits: string;
262
+ height: string;
263
+ primitiveunits: string;
264
+ width: string;
265
+ x: string;
266
+ y: string;
267
+ };
268
+ foreignobject: {
269
+ x: string;
270
+ y: string;
271
+ };
272
+ image: {
273
+ preserveaspectratio: string;
274
+ x: string;
275
+ y: string;
276
+ };
277
+ line: {
278
+ x1: string;
279
+ x2: string;
280
+ y1: string;
281
+ y2: string;
282
+ };
283
+ lineargradient: {
284
+ gradientunits: string;
285
+ spreadmethod: string;
286
+ x1: string[];
287
+ x2: string;
288
+ y1: string[];
289
+ y2: string[];
290
+ };
291
+ marker: {
292
+ markerheight: string;
293
+ markerunits: string;
294
+ markerwidth: string;
295
+ orient: string;
296
+ preserveaspectratio: string;
297
+ refx: string;
298
+ refy: string;
299
+ };
300
+ mask: {
301
+ height: string;
302
+ maskcontentunits: string;
303
+ maskunits: string;
304
+ width: string;
305
+ x: string;
306
+ y: string;
307
+ };
308
+ pattern: {
309
+ height: string;
310
+ patterncontentunits: string;
311
+ patternunits: string;
312
+ preserveaspectratio: string;
313
+ width: string;
314
+ x: string;
315
+ y: string;
316
+ };
317
+ radialgradient: {
318
+ cx: string;
319
+ cy: string;
320
+ fr: string[];
321
+ gradientunits: string;
322
+ r: string;
323
+ spreadmethod: string;
324
+ };
325
+ rect: {
326
+ x: string;
327
+ y: string;
328
+ };
329
+ stop: {
330
+ offset: string;
331
+ };
332
+ svg: {
333
+ preserveaspectratio: string;
334
+ version: string;
335
+ x: string;
336
+ y: string;
337
+ };
338
+ symbol: {
339
+ preserveaspectratio: string;
340
+ };
341
+ text: {
342
+ lengthadjust: string;
343
+ x: string;
344
+ y: string;
345
+ };
346
+ textpath: {
347
+ lengthadjust: string;
348
+ method: string;
349
+ spacing: string;
350
+ startoffset: string;
351
+ };
352
+ tspan: {
353
+ lengthadjust: string;
354
+ };
355
+ use: {
356
+ x: string;
357
+ y: string;
358
+ };
359
+ view: {
360
+ preserveaspectratio: string;
361
+ };
362
+ };
363
+ declare const svgElementsInheritingByReference: Set<string>;
364
+ declare const namespaceHTML = "http://www.w3.org/1999/xhtml";
365
+ declare const namespaceSVG = "http://www.w3.org/2000/svg";
366
+ declare const namespaceMathML = "http://www.w3.org/1998/Math/MathML";
367
+ declare const namespaceXLink = "http://www.w3.org/1999/xlink";
368
+ declare const executableScriptsMimetypes: Set<string>;
369
+ declare const keepScriptsMimetypes: Set<string>;
370
+ declare const isSimpleBoolean: Set<string>;
371
+ declare const isBooleanValue: Set<string>;
372
+ declare const collapsibleValues: Map<string, Set<string>>;
373
+ declare const srcsetElements: Set<string>;
374
+ declare const jsonScriptTypes: Set<string>;
375
+ declare const optionalStartTags: Set<string>;
376
+ declare const optionalEndTags: Set<string>;
377
+ declare const headerElements: Set<string>;
378
+ declare const descriptionElements: Set<string>;
379
+ declare const pBlockElements: Set<string>;
380
+ declare const pClosingParents: Set<string>;
381
+ declare const rubyEndTagOmission: Set<string>;
382
+ declare const rubyRtcEndTagOmission: Set<string>;
383
+ declare const optionElements: Set<string>;
384
+ declare const tableContentElements: Set<string>;
385
+ declare const tableSectionElements: Set<string>;
386
+ declare const cellElements: Set<string>;
387
+ declare const topLevelElements: Set<string>;
388
+ declare const compactElements: Set<string>;
389
+ declare const looseElements: Set<string>;
390
+ declare const trailingElements: Set<string>;
391
+ declare const htmlElements: Set<string>;
392
+ declare const quirksPublicIds: Set<string>;
393
+ declare const quirksSystemIds: Set<string>;
394
+ declare const quirksPublicIdPrefixes: string[];
395
+ declare const quirksPublicIdPrefixesNoSystemId: string[];
396
+ declare const specialContentElements: Set<string>;
397
+ declare const genericRawTextElements: Set<string>;
398
+ declare const endlessRawTextElements: Set<string>;
399
+ declare const escapableRawTextElements: Set<string>;
400
+ declare const rawTextElements: Set<string>;
401
+ declare const MISSING_DEPENDENCY = "HM_MISSING_DEPENDENCY";
402
+ declare const svgoPluginsInline: {
403
+ name: string;
404
+ params: {
405
+ overrides: {
406
+ cleanupIds: boolean;
407
+ inlineStyles: boolean;
408
+ minifyStyles: {
409
+ usage: boolean;
410
+ };
411
+ removeEmptyAttrs: boolean;
412
+ removeHiddenElems: boolean;
413
+ removeUnknownsAndDefaults: {
414
+ keepRoleAttr: boolean;
415
+ };
416
+ };
417
+ };
418
+ }[];
419
+ declare const namesForeignMixedCase: Map<string, string>;
420
+ export { RE_WS_START, RE_WS_END, RE_WS_ONLY, RE_WS_NBSP_END, RE_ALL_WS_NBSP, RE_NBSP_LEADING_GROUP, RE_NBSP_LEAD_GROUP, RE_NBSP_TRAILING_GROUP, RE_NBSP_TRAILING_STRIP, RE_EVENT_ATTR_DEFAULT, RE_CAN_REMOVE_ATTR_QUOTES, RE_TRAILING_SEMICOLON, RE_AMP_REFERENCE_ATTR, RE_CR, RE_LINE_BREAK_CR, RE_LEGACY_ENTITIES, RE_ESCAPE_LT, RE_BASE_ELEMENT, RE_ESCAPE_LT_RAW_TEXT, RE_XML_ESCAPE_TEXT, RE_XML_ESCAPE_ATTR, RE_HTML_ENCODING, RE_DOCTYPE, RE_ATTR_WS_CHECK, RE_ATTR_WS_COLLAPSE, RE_WS_CHAR, RE_STYLE_ELEMENT, RE_EMPTY_ATTRIBUTE, formattingElements, inlineElementsToKeepWhitespaceAround, inlineElementsToKeepWhitespaceWithin, inlineElementsToKeepWhitespaceBetween, inlineElementsToKeepWhitespaceBetweenEnd, inlineElementsTransparent, inlineElementsTransparentAfter, inlineElementsToKeepWhitespace, processingInstructionTag, formControlElementsEither, toEndTags, generalDefaults, tagDefaults, metaHttpEquivNoEffect, metaNamesNoEffect, targetSelfElements, integrationPointsForeign, tagDefaultsSVG, svgElementsInheritingByReference, namespaceHTML, namespaceSVG, namespaceMathML, namespaceXLink, executableScriptsMimetypes, keepScriptsMimetypes, jsonScriptTypes, isSimpleBoolean, isBooleanValue, collapsibleValues, srcsetElements, MISSING_DEPENDENCY, namesForeignMixedCase, svgoPluginsInline, optionalStartTags, optionalEndTags, headerElements, descriptionElements, pBlockElements, pClosingParents, rubyEndTagOmission, rubyRtcEndTagOmission, optionElements, tableContentElements, tableSectionElements, cellElements, topLevelElements, compactElements, looseElements, trailingElements, htmlElements, quirksPublicIds, quirksSystemIds, quirksPublicIdPrefixes, quirksPublicIdPrefixesNoSystemId, specialContentElements, genericRawTextElements, endlessRawTextElements, escapableRawTextElements, rawTextElements };
421
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH,QAAA,MAAM,WAAW,QAAkB,CAAC;AACpC,QAAA,MAAM,SAAS,QAAkB,CAAC;AAClC,QAAA,MAAM,UAAU,QAAmB,CAAC;AACpC,QAAA,MAAM,cAAc,QAAqB,CAAC;AAC1C,QAAA,MAAM,cAAc,QAAsB,CAAC;AAC3C,QAAA,MAAM,qBAAqB,QAAuB,CAAC;AACnD,QAAA,MAAM,kBAAkB,QAAqB,CAAC;AAC9C,QAAA,MAAM,sBAAsB,QAAqB,CAAC;AAClD,QAAA,MAAM,sBAAsB,QAAc,CAAC;AAC3C,QAAA,MAAM,qBAAqB,QAAkB,CAAC;AAC9C,QAAA,MAAM,yBAAyB,QAA0B,CAAC;AAC1D,QAAA,MAAM,qBAAqB,QAAO,CAAC;AAEnC,QAAA,MAAM,KAAK,QAAQ,CAAC;AACpB,QAAA,MAAM,gBAAgB,QAAW,CAAC;AAIlC,QAAA,MAAM,kBAAkB,QAAiG,CAAC;AAG1H,QAAA,MAAM,qBAAqB,QAA8G,CAAC;AAC1I,QAAA,MAAM,YAAY,QAAO,CAAC;AAG1B,QAAA,MAAM,eAAe,QAA4D,CAAC;AAGlF,QAAA,MAAM,kBAAkB,QAAgB,CAAC;AACzC,QAAA,MAAM,kBAAkB,QAAgB,CAAC;AAKzC,QAAA,MAAM,qBAAqB,EAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAG3D,CAAC;AAGJ,QAAA,MAAM,gBAAgB,QAA4C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B,wBAAwB,EACxB,cAAc,EACd,gCAAgC,EAChC,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EAGd,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EAGf,eAAe,EACf,cAAc,EACd,iBAAiB,EAGjB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EAGjB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,YAAY,EAGZ,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,gCAAgC,EAGhC,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EAChB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * CSS and script content wrapping for minification
3
+ */
4
+ import type { ProcessedOptions } from './options.js';
5
+ /** @import { ProcessedOptions } from './options.js' */
6
+ /**
7
+ * @param {string} text
8
+ * @param {string} [type]
9
+ */
10
+ declare function wrapCSS(text: string, type?: string): string;
11
+ /**
12
+ * @param {string} text
13
+ * @param {string} [type]
14
+ */
15
+ declare function unwrapCSS(text: string, type?: string): string;
16
+ /** @param {Array<{name: string, value?: string}>} attrs */
17
+ declare function hasJsonScriptType(attrs: Array<{
18
+ name: string;
19
+ value?: string;
20
+ }>): boolean;
21
+ /**
22
+ * @param {string} text
23
+ * @param {ProcessedOptions} options
24
+ * @param {string} tag
25
+ * @param {Array<{name: string, value?: string | undefined}>} currentAttrs
26
+ * @param {Function} minifyHTML
27
+ */
28
+ declare function processScript(text: string, options: ProcessedOptions, tag: string, currentAttrs: Array<{
29
+ name: string;
30
+ value?: string | undefined;
31
+ }>, minifyHTML: Function): Promise<any>;
32
+ /**
33
+ * Collects the bodies of executable inline scripts, in document order, so they can be
34
+ * minified as one batch ahead of the parse. Duplicates are dropped: The minifier is
35
+ * content-keyed, so the same body only needs dispatching once.
36
+ * @param {string} html
37
+ * @returns {Array<{code: string, isModule: boolean}>}
38
+ */
39
+ declare function extractScriptBodies(html: string): Array<{
40
+ code: string;
41
+ isModule: boolean;
42
+ }>;
43
+ export { wrapCSS, unwrapCSS, hasJsonScriptType, extractScriptBodies, processScript };
44
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/lib/content.js"],"names":[],"mappings":"AAAA;;GAEG;AAUC,OAAQ,KAAA,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAApD,uDAAuD;AAKvD;;;GAGG;AACH,iBAAS,OAAO,CAAC,IAAI,EAHV,MAGU,EAAE,IAAI,AAFxB,CAAsB,EAAd,MAEgB,UAS1B;AAED;;;GAGG;AACH,iBAAS,SAAS,CAAC,IAAI,EAHZ,MAGY,EAAE,IAAI,AAF1B,CAAsB,EAAd,MAEkB,UAW5B;AAyED,2DAA2D;AAC3D,iBAAS,iBAAiB,CAAC,KAAK,EADpB,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAChB,WAU/B;AAED;;;;;;GAMG;AACH,iBAAe,aAAa,CAAC,IAAI,EANtB,MAMsB,EAAE,OAAO,EAL/B,gBAK+B,EAAE,GAAG,EAJpC,MAIoC,EAAE,YAAY,EAHlD,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAGE,EAAE,UAAU,UAAA,gBAexE;AAWD;;;;;;GAMG;AACH,iBAAS,mBAAmB,CAAC,IAAI,EAHtB,MAGsB,GAFpB,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,CAAC,CAsDpD;AAED,OAAO,EAEL,OAAO,EACP,SAAS,EAGT,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACd,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * HTML element tag omission rules
3
+ */
4
+ import type { HTMLAttribute } from './attributes.js';
5
+ import type { ProcessedOptions } from './options.js';
6
+ /** @import { HTMLAttribute } from './attributes.js' */
7
+ /** @import { ProcessedOptions } from './options.js' */
8
+ /**
9
+ * @param {string} optionalStartTag
10
+ * @param {string} tag
11
+ */
12
+ declare function canRemoveParentTag(optionalStartTag: string, tag: string): boolean;
13
+ /**
14
+ * @param {string} optionalEndTag
15
+ * @param {string} tag
16
+ */
17
+ declare function isStartTagMandatory(optionalEndTag: string, tag: string): boolean;
18
+ /**
19
+ * @param {string} optionalEndTag
20
+ * @param {string} tag
21
+ */
22
+ declare function canRemovePrecedingTag(optionalEndTag: string, tag: string): boolean;
23
+ /**
24
+ * @param {string} tag
25
+ * @param {HTMLAttribute[]} attrs
26
+ */
27
+ declare function canRemoveElement(tag: string, attrs: HTMLAttribute[]): boolean;
28
+ /**
29
+ * @param {string[]} input - Array of element specifications from `removeEmptyElementsExcept` option
30
+ * @param {ProcessedOptions} options - Options object for parsing
31
+ * @returns {Array<{tag: string, attrs: Object.<string, string|undefined>|null}>} Array of parsed element specs
32
+ */
33
+ declare function parseRemoveEmptyElementsExcept(input: string[], options: ProcessedOptions): Array<{
34
+ tag: string;
35
+ attrs: Record<string, string | undefined> | null;
36
+ }>;
37
+ /**
38
+ * @param {string} tag - Element tag name
39
+ * @param {HTMLAttribute[]} attrs - Array of element attributes
40
+ * @param {Array<{tag: string, attrs: Object.<string, string|undefined>|null}>} preserveList - Parsed preserve specs
41
+ * @returns {boolean} True if the empty element should be preserved
42
+ */
43
+ declare function shouldPreserveEmptyElement(tag: string, attrs: HTMLAttribute[], preserveList: Array<{
44
+ tag: string;
45
+ attrs: Record<string, string | undefined> | null;
46
+ }>): boolean;
47
+ export { canRemoveParentTag, isStartTagMandatory, canRemovePrecedingTag, canRemoveElement, parseRemoveEmptyElementsExcept, shouldPreserveEmptyElement };
48
+ //# sourceMappingURL=elements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/lib/elements.js"],"names":[],"mappings":"AAAA;;GAEG;AAeC,OAAQ,KAAA,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAQ,KAAA,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AADpD,uDAAuD;AACvD,uDAAuD;AAEvD;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,gBAAgB,EAHjC,MAGiC,EAAE,GAAG,EAFtC,MAEsC,WAahD;AAED;;;GAGG;AACH,iBAAS,mBAAmB,CAAC,cAAc,EAHhC,MAGgC,EAAE,GAAG,EAFrC,MAEqC,WAQ/C;AAED;;;GAGG;AACH,iBAAS,qBAAqB,CAAC,cAAc,EAHlC,MAGkC,EAAE,GAAG,EAFvC,MAEuC,WAmCjD;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,GAAG,EAHlB,MAGkB,EAAE,KAAK,EAFzB,aAAa,EAEY,WAuDnC;AAiDD;;;;GAIG;AACH,iBAAS,8BAA8B,CAAC,KAAK,EAJlC,MAAM,EAI4B,EAAE,OAAO,EAH3C,gBAG2C,GAFzC,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,qCAAkC,IAAI,CAAA;CAAC,CAAC,CAc/E;AAED;;;;;GAKG;AACH,iBAAS,0BAA0B,CAAC,GAAG,EAL5B,MAK4B,EAAE,KAAK,EAJnC,aAAa,EAIsB,EAAE,YAAY,EAHjD,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,qCAAkC,IAAI,CAAA;CAAC,CAGjB,GAF/C,OAAO,CA8BnB;AAED,OAAO,EAEL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EAGrB,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,EAC3B,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Custom fragment matching
3
+ *
4
+ * `ignoreCustomFragments` patterns nearly always describe the same shape: a literal
5
+ * opening delimiter, an any-character or negated-class body, and a literal closing
6
+ * delimiter, as in `<%[\s\S]*?%>` or `\{\{[^}]*?\}\}`. Such a fragment can be found
7
+ * with `indexOf` in linear time, where running the pattern as a regex costs O(n²)
8
+ * on input that opens fragments it never closes—and can cost far more than that when
9
+ * the pattern itself backtracks. Patterns of other shapes keep running as regexes,
10
+ * one per pattern, so each keeps its own flags.
11
+ */
12
+ export type DelimitedFragment = {
13
+ open: string;
14
+ close: string;
15
+ min: number;
16
+ max: number;
17
+ excluded: RegExp | null;
18
+ };
19
+ export type PatternFragment = {
20
+ search: RegExp;
21
+ anchored: RegExp;
22
+ close: string | null;
23
+ };
24
+ /**
25
+ * Describe a fragment pattern as literal delimiters around an any-character body
26
+ * @param {RegExp} pattern
27
+ * @returns {DelimitedFragment | null} Null when the pattern has another shape, which
28
+ * the caller answers by running it as a regex
29
+ */
30
+ declare function toDelimitedFragment(pattern: RegExp): DelimitedFragment | null;
31
+ /**
32
+ * Prepare a fragment pattern for matching, by scanning where the shape allows it
33
+ * @param {RegExp} pattern
34
+ * @returns {DelimitedFragment | PatternFragment}
35
+ */
36
+ declare function toFragment(pattern: RegExp): DelimitedFragment | PatternFragment;
37
+ /**
38
+ * Replace runs of custom fragments, and the whitespace padding them
39
+ * @param {string} value - Document to scan
40
+ * @param {(DelimitedFragment | PatternFragment)[]} fragments - In the order the patterns
41
+ * were given, since the earliest match wins and ties go to the pattern listed first
42
+ * @param {(match: string) => string} replacer - Called with each match, as `replace` would
43
+ * @returns {string}
44
+ */
45
+ declare function replaceCustomFragments(value: string, fragments: (DelimitedFragment | PatternFragment)[], replacer: (match: string) => string): string;
46
+ export { toDelimitedFragment, toFragment, replaceCustomFragments };
47
+ //# sourceMappingURL=fragments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/fragments.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaA,YAA4F,iBAAiB,GAAnG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,CAI1F;AAAA,YAAoE,eAAe,GAAzE;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,CAGpE;AAmCD;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,OAAO,EAJzB,MAIyB,GAHvB,iBAAiB,GAAG,IAAI,CAwBpC;AA8CD;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAHhB,MAGgB,GAFd,iBAAiB,GAAG,eAAe,CAa/C;AAED;;;;;;;GAOG;AACH,iBAAS,sBAAsB,CAAC,KAAK,EAN1B,MAM0B,EAAE,SAAS,EALrC,CAAC,iBAAiB,GAAG,eAAe,CAAC,EAKA,EAAE,QAAQ,EAH/C,CAAC,KAAK,EAAE,MAAM,KAAK,MAG4B,GAF7C,MAAM,CA2KlB;AAED,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACvB,CAAC"}