html-minifier-next 8.4.4 → 8.5.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/README.md CHANGED
@@ -108,7 +108,7 @@ HTML Minifier Next provides presets for common use cases. Presets are pre-config
108
108
  * `conservative`: Basic minification with whitespace collapsing, comment removal, and removal of select attributes.
109
109
  * `comprehensive`: More advanced minification for better file size reduction, including relevant conservative options plus attribute quote removal, optional tag removal, and more.
110
110
 
111
- To review the specific options set, [presets.js](https://github.com/j9t/html-minifier-next/blob/main/src/presets.js) lists them in an accessible manner.
111
+ To review the specific options set, [presets.js](https://github.com/j9t/html-minifier-next/blob/main/src/presets.js) lists them in an accessible manner. For output served with Gzip or Brotli, see [“Optimizing for compression”](#optimizing-for-compression) for what to add.
112
112
 
113
113
  **Using presets:**
114
114
 
@@ -172,7 +172,7 @@ Options can be used in config files (camelCase) or via CLI flags (kebab-case wit
172
172
  | `removeComments`<br>`--remove-comments` | [Strip HTML comments](https://perfectionkills.com/experimenting-with-html-minifier/#remove_comments) | `false` |
173
173
  | `removeDefaultTypeAttributes`<br>`--remove-default-type-attributes` | Remove default `type` attributes from `style`/`link` (e.g., `type="text/css"`) and `script` (e.g., `type="text/javascript"`) elements; other `type` attribute values are left intact | `false` |
174
174
  | `removeEmptyAttributes`<br>`--remove-empty-attributes` | [Remove all attributes with whitespace-only values](https://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes) | `false` (could be `true`, `Function(attrName, tag)`) |
175
- | `removeEmptyElements`<br>`--remove-empty-elements` | [Remove all elements with empty contents](https://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements) | `false` |
175
+ | `removeEmptyElements`<br>`--remove-empty-elements` | [Remove all elements with empty contents](#removing-empty-elements) | `false` |
176
176
  | `removeEmptyElementsExcept`<br>`--remove-empty-elements-except` | Array of elements to preserve—use with `removeEmptyElements`; accepts simple tag names (e.g., `["td"]`) or HTML-like markup with attributes (e.g., `["<span aria-hidden='true'>"]`); supports double quotes, single quotes, and unquoted attribute values | `[]` |
177
177
  | `removeOptionalTags`<br>`--remove-optional-tags` | [Remove optional tags](https://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags) | `false` |
178
178
  | `removeRedundantAttributes`<br>`--remove-redundant-attributes` | [Remove attributes when value matches default](https://meiert.com/blog/optional-html/#toc-attribute-values) | `false` |
@@ -191,6 +191,9 @@ A few options take functions and are therefore only available programmatically,
191
191
  | Option | Description | Default |
192
192
  | --- | --- | --- |
193
193
  | `canCollapseWhitespace` | `Function(tag, attrs, defaultFn)` that determines whether whitespace inside an element can be collapsed—override to protect additional elements, delegating to `defaultFn` for the rest | Built-in handling (protects `pre`, `textarea`, etc.) |
194
+ | `canMinifyCSS` | Synchronous `Function(text, type)` that determines whether `minifyCSS` may process a given piece of CSS—returning `false` [leaves it as if `minifyCSS` were off](#css-minification) | All CSS is minified |
195
+ | `canMinifyJS` | Synchronous `Function(text, inline)` that determines whether `minifyJS` may process a given piece of JavaScript—returning `false` [leaves it unminified](#javascript-minification) | All JavaScript is minified |
196
+ | `canMinifySVG` | Synchronous `Function(text)` that determines whether `minifySVG` may pass a given outermost `svg` element to SVGO—returning `false` [skips SVGO for it](#svg-minification) | All SVG is minified |
194
197
  | `canTrimWhitespace` | `Function(tag, attrs, defaultFn)` that determines whether leading and trailing whitespace around an element may be trimmed | Built-in handling |
195
198
  | `log` | `Function(message)` called with warnings and errors, including minification errors swallowed by `continueOnMinifyError` (e.g., pass `console.error` to surface them); the CLI wires this up under `--verbose` and `--dry` | No-op (errors are silent) |
196
199
 
@@ -204,6 +207,9 @@ HTML Minifier Next: Ignoring `conservativeCollapse`—use with `collapseWhitespa
204
207
 
205
208
  | Option | Needs |
206
209
  | --- | --- |
210
+ | `canMinifyCSS` | `minifyCSS`, and not [a function of your own](#css-minification) |
211
+ | `canMinifyJS` | `minifyJS`, and not [a function of your own](#javascript-minification) |
212
+ | `canMinifySVG` | `minifySVG`, and not [a function of your own](#svg-minification) |
207
213
  | `collapseInlineTagWhitespace` | `collapseWhitespace` |
208
214
  | `conservativeCollapse` | `collapseWhitespace` |
209
215
  | `customEventAttributes` | `minifyJS` |
@@ -243,7 +249,44 @@ Where the modifiers disagree, the preserving one wins—`conservativeCollapse` a
243
249
 
244
250
  ### Sorting attributes and style classes
245
251
 
246
- Minifier options like `sortAttributes` and `sortClassNames` won’t impact the plain-text size of the output. However, `sortAttributes` (but not `sortClassNames`) improves the compression ratio for Gzip and Brotli used over HTTP.
252
+ `sortAttributes` and `sortClassNames` reorder attributes and class names by frequency, so that repeated markup looks more alike. This doesn’t change the plain-text size of the output, only how well it compresses: `sortAttributes` makes Gzip and Brotli output slightly smaller on average, though not on every page (see [“Optimizing for compression”](#optimizing-for-compression)); `sortClassNames` doesn’t help, and alongside `sortAttributes` cancels most of its gain with Brotli.
253
+
254
+ ### Optimizing for compression
255
+
256
+ Most HTML is served compressed, so the Gzip or Brotli size is often what counts—and it doesn’t always follow the raw size. Added to the `comprehensive` preset, these options changed output size as follows (average per page, relative to `comprehensive`):
257
+
258
+ | Added to `comprehensive` | Raw | Gzip (level 6) | Brotli (quality 6) | Brotli (quality 11) |
259
+ | --- | --- | --- | --- | --- |
260
+ | `sortAttributes` | ±0% | −0.20% | −0.21% | −0.16% |
261
+ | `sortAttributes`, `removeAttributeQuotes: false`, `quoteCharacter: '"'` | +1.75% | +0.08% | −0.15% | −0.39% |
262
+ | `removeEmptyElements` | −1.15% | −0.75% | −0.68% | −0.63% |
263
+
264
+ * **Gzip or on-the-fly Brotli:** Add `sortAttributes`. The gain is small and uneven, however, and sorting can double minification time for very large documents.
265
+ * **Brotli precompressed at quality 11** (as for static files compressed at build time): Add `sortAttributes`, don’t remove attribute quotes, and make the quotes double quotes. Raw and Gzip output grow, so this only pays off when clients receive the precompressed Brotli files.
266
+ * **`removeEmptyElements`** saves more than either, but may change the respective document—see [“Removing empty elements”](#removing-empty-elements) before enabling it.
267
+
268
+ ```shell
269
+ # Gzip or on-the-fly Brotli
270
+ npx html-minifier-next --preset comprehensive --sort-attributes input.html
271
+
272
+ # Brotli precompressed at quality 11
273
+ npx html-minifier-next --preset comprehensive --sort-attributes --no-remove-attribute-quotes --quote-character='"' input.html
274
+ ```
275
+
276
+ These figures were measured in September 2026 with HMN 8.4.5 on 31 pages of the [backtest corpus](#regression-tests) (retrieved February 2026). They are indications, not guarantees, as they depend on the markup and will shift as HMN and the minifiers it bundles change. The [benchmark](#working-tree-benchmarks) reports Gzip and Brotli (quality 6) sizes to re-check them.
277
+
278
+ ### Removing empty elements
279
+
280
+ `removeEmptyElements` removes elements without content—no text and no child elements (comments don’t count; whitespace does, unless `collapseWhitespace` removes it). It keeps:
281
+
282
+ * elements with an `id` attribute,
283
+ * `textarea` elements,
284
+ * `audio`, `video`, and `script` elements with a `src` attribute, `iframe` elements with `src` or `srcdoc`, `object` elements with `data`, and `applet` elements with `code`,
285
+ * elements inside SVG and MathML—though an empty `svg` or `math` element itself is removed, and HTML inside them (as in `foreignObject` or `annotation-xml`) is still processed.
286
+
287
+ Everything else goes, including elements that are empty on purpose: icons as well as icon links and buttons styled with CSS (e.g., `<i class="icon"></i>` or `<button aria-label="Close"></button>`), `canvas` elements that scripts draw into, empty `option` elements, and empty table cells (which shifts the cells that follow). Keep such elements with `removeEmptyElementsExcept`, for example `["td", "canvas", "<button aria-label>"]`. A parent that is left empty by the removal is kept.
288
+
289
+ Where the markup allows it, the option is effective: On a test corpus, it reduced output by 1.15% raw and 0.75% with Gzip on average (see [“Optimizing for compression”](#optimizing-for-compression)).
247
290
 
248
291
  ### CSS minification
249
292
 
@@ -284,9 +327,18 @@ const result = await minify(html, {
284
327
  });
285
328
  ```
286
329
 
330
+ To exempt individual pieces of CSS, pass `canMinifyCSS` a synchronous function. It receives the CSS and its type—`undefined` for `style` elements, `'inline'` for `style` attributes, and `'media'` for `media` attributes. CSS for which it returns `false` comes out as if `minifyCSS` were off, so its URLs are not minified and its unused rules not removed, either. (Within `svg` elements, `minifySVG` has SVGO minify CSS as well—exempt those with [`canMinifySVG`](#svg-minification).)
331
+
332
+ ```js
333
+ const result = await minify(html, {
334
+ minifyCSS: true,
335
+ canMinifyCSS: text => !text.includes('/* keep */')
336
+ });
337
+ ```
338
+
287
339
  ### Unused CSS removal
288
340
 
289
- `removeUnusedCSS` removes rules from `style` elements whose class or ID selectors the document doesn’t reference. It needs to be used with `minifyCSS`, because the removal runs through Lightning CSS—passing `minifyCSS` a function of your own replaces that step, so the removal does not apply, either. Both cases are reported through [the `log` hook](#api-only-options). It does not touch `style` or `media` attributes.
341
+ `removeUnusedCSS` removes rules from `style` elements whose class or ID selectors a document doesn’t reference. It needs to be used with `minifyCSS`, because the removal runs through Lightning CSS—passing `minifyCSS` a function of your own replaces that step, so the removal does not apply, either. Both cases are reported through [the `log` hook](#api-only-options). It does not touch `style` or `media` attributes.
290
342
 
291
343
  ```js
292
344
  const result = await minify(html, {
@@ -384,17 +436,28 @@ const result = await minify(html, {
384
436
  });
385
437
  ```
386
438
 
439
+ To exempt individual pieces of JavaScript, pass `canMinifyJS` a synchronous function. It receives the JavaScript and whether it is inline—`true` for event handler attributes (e.g., `onclick`), `false` for `script` elements. JavaScript for which it returns `false` is left unminified, though `mergeScripts` still merges it with adjacent scripts:
440
+
441
+ ```js
442
+ const result = await minify(html, {
443
+ minifyJS: true,
444
+ canMinifyJS: text => !text.includes('/* keep */')
445
+ });
446
+ ```
447
+
387
448
  ### SVG minification
388
449
 
389
450
  When `minifySVG` is set to `true`, HTML Minifier Next uses [SVGO](https://svgo.dev/) to optimize inline SVG elements. Complete `<svg>` subtrees are extracted and processed as a block, enabling deep structural optimization:
390
451
 
391
452
  ```js
392
453
  const result = await minify(html, {
393
- minifySVG: true // Enable with SVGO defaults
454
+ minifySVG: true // Enable with SVGO defaults fit for inline SVG
394
455
  });
395
456
  ```
396
457
 
397
- You can pass custom SVGO options:
458
+ Unlike an SVG file, an inline SVG is part of the page. HMN runs SVGO’s `preset-default` with the plugins that assume a standalone file turned off (see overrides below). `style` elements in SVG are minified through `minifyCSS` and SVGO.
459
+
460
+ You can pass custom SVGO options. Options without `plugins` (e.g., `{ floatPrecision: 2 }`) keep HMN’s plugin set; options with `plugins` replace it, so include the overrides for inline SVG unless the SVGs don’t depend on the rest of the page:
398
461
 
399
462
  ```js
400
463
  const result = await minify(html, {
@@ -403,6 +466,13 @@ const result = await minify(html, {
403
466
  name: 'preset-default',
404
467
  params: {
405
468
  overrides: {
469
+ // Inline SVG
470
+ cleanupIds: false,
471
+ inlineStyles: false,
472
+ minifyStyles: { usage: false },
473
+ removeHiddenElems: false,
474
+ removeUnknownsAndDefaults: { keepRoleAttr: true },
475
+ // Custom
406
476
  convertShapeToPath: false // Keep original shapes
407
477
  }
408
478
  }
@@ -411,10 +481,19 @@ const result = await minify(html, {
411
481
  });
412
482
  ```
413
483
 
484
+ To exempt individual `svg` elements, pass `canMinifySVG` a synchronous function. It receives each outermost `svg` element, including any `svg` elements nested in it, as the HTML pass wrote it (e.g., without comments under `removeComments`), and one for which it returns `false` skips SVGO. To keep an `svg` element exactly as written, [wrap it in `<!-- htmlmin:ignore -->`](#ignoring-chunks-of-markup) instead.
485
+
486
+ ```js
487
+ const result = await minify(html, {
488
+ minifySVG: true,
489
+ canMinifySVG: text => !text.includes('data-keep')
490
+ });
491
+ ```
492
+
414
493
  **Important:**
415
494
 
416
495
  * SVG minification only applies within `<svg>` elements
417
- * Case sensitivity and self-closing slashes are automatically preserved in SVG (regardless of global settings)
496
+ * Case sensitivity and self-closing slashes are automatically preserved in SVG (regardless of global settings); where SVGO reads, names are written the way HTML reads them (e.g., `viewbox` as `viewBox`)
418
497
  * For maximum compression, use `minifySVG` together with `collapseWhitespace` and other options
419
498
 
420
499
  ### CSS, JavaScript, and SVG cache configuration
@@ -722,7 +801,7 @@ npm i;
722
801
  npm run backtest
723
802
  ```
724
803
 
725
- The backtest tool tracks minification performance across Git history. Results are saved in the backtest folder as a JSON file, results.json.
804
+ The backtest tool tracks minification performance—output size (raw, Gzip, and Brotli) and processing time—across Git history. Results are saved in the backtest folder (results.json).
726
805
 
727
806
  Parameters:
728
807
 
@@ -740,7 +819,7 @@ npm i;
740
819
  npm run benchmark
741
820
  ```
742
821
 
743
- It reuses the backtest corpus (run `npm run backtest` once to download it) and reports per-file output size and processing time.
822
+ It reuses the backtest corpus (run `npm run backtest` once to download it) and reports per-file output size and processing time. Sizes are given raw and compressed—at common defaults for on-the-fly compression, i.e., Gzip at level 6 and Brotli at quality 6—since a change that shrinks raw output can still grow what is transferred.
744
823
 
745
824
  Parameters:
746
825
 
@@ -749,7 +828,8 @@ Parameters:
749
828
  * `--core`: Disables the external minifiers (CSS, JS, SVG, URLs) to isolate HMN’s processing time
750
829
  * `--cold`: Switches the minification caches off so CSS, JS, and SVG work is redone on every iteration—without it, warm caches serve those results from memory after the warm-up run and the benchmark cannot see changes to those minifiers
751
830
  * `--iterations=N`: Sets the number of timed iterations (default: 5)
752
- * `--config=PATH`: Uses an alternative options file (default: html-minifier-next.config.json)
831
+ * `--config=PATH`: Uses an alternative options file (default: html-minifier-next.config.json); the file can name a `preset` to start from
832
+ * `--preset=NAME`: Uses a preset instead of an options file (e.g., `--preset=comprehensive`)
753
833
 
754
834
  To compare branches (A/B run), execute `npm run benchmark -- --save` on `main`, then `npm run benchmark` on the branch to see the deltas. Add `--core` on both ends when measuring changes to HMN rather than bundled minifiers, or `--cold` when measuring changes to the CSS, JS, or SVG minification paths.
755
835
 
@@ -15,6 +15,34 @@ export type MinifierOptions = {
15
15
  * Default: Built-in `canCollapseWhitespace` function
16
16
  */
17
17
  canCollapseWhitespace?: (tag: string, attrs: HTMLAttribute[], canCollapseWhitespace: (tag: string) => boolean) => boolean;
18
+ /**
19
+ * Synchronous predicate that determines whether the built-in `minifyCSS` may
20
+ * process a given piece of CSS—`type` is `undefined` for `style` elements,
21
+ * `'inline'` for `style` attributes, and `'media'` for `media` attributes.
22
+ * Returning false leaves that CSS as if `minifyCSS` were off, including its URLs
23
+ * and unused rules (within `svg` elements, SVGO still minifies it under `minifySVG`).
24
+ *
25
+ * Default: `null` (all CSS is minified)
26
+ */
27
+ canMinifyCSS?: ((text: string, type?: 'inline' | 'media') => boolean) | null;
28
+ /**
29
+ * Synchronous predicate that determines whether the built-in `minifyJS` may
30
+ * process a given piece of JavaScript—`inline` is true for event handler
31
+ * attributes. Returning false leaves that JavaScript unminified (`mergeScripts`
32
+ * still applies).
33
+ *
34
+ * Default: `null` (all JavaScript is minified)
35
+ */
36
+ canMinifyJS?: ((text: string, inline?: boolean) => boolean) | null;
37
+ /**
38
+ * Synchronous predicate that determines whether the built-in `minifySVG` may
39
+ * pass a given outermost `svg` element, nested ones included, to SVGO. It
40
+ * receives the element as serialized by the HTML pass (e.g., without comments
41
+ * under `removeComments`); returning false leaves it as that pass wrote it.
42
+ *
43
+ * Default: `null` (all SVG is minified)
44
+ */
45
+ canMinifySVG?: ((text: string) => boolean) | null;
18
46
  /**
19
47
  * Predicate that determines whether leading/trailing whitespace around
20
48
  * the element may be trimmed.
@@ -270,8 +298,10 @@ export type MinifierOptions = {
270
298
  } | ((text: string) => Promise<string> | string);
271
299
  /**
272
300
  * When true, enables SVG minification using [SVGO](https://github.com/svg/svgo).
273
- * Complete SVG subtrees are extracted and optimized as a block.
274
- * If an object is provided, it is passed to SVGO as configuration options.
301
+ * Complete SVG subtrees are extracted and optimized as a block, with the SVGO
302
+ * plugins that assume a standalone SVG file turned off.
303
+ * If an object is provided, it is passed to SVGO as configuration options; unless
304
+ * it sets `plugins`, it keeps that plugin set.
275
305
  * If disabled, SVG content is minified using standard HTML rules only.
276
306
  *
277
307
  * Default: `false`
@@ -1 +1 @@
1
- {"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuE/D,YAAkB,aAAa,GAI/B;IAAe,IAAI,EAAZ,MA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D,CAQA,EARO,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAQ5C;;;;;;;;IAAiB,mBAAmB,AAApC,CAOA,EAPO,OAAO,CAOd;;;;;;;IAAiB,eAAe,AAAhC,CAKF,EALS,OAAO,CAKhB;CAAA,CAAA;AA0EE,YAAkB,UAAU,GAG5B;;;;IAAe,IAAI,EAAZ,MAAM,CACb;;;;IAAe,IAAI,EAAZ,MAAM,CACb;;;;IAAe,IAAI,EAAZ,MAAM,CACb;;;;IAAe,KAAK,EAAb,MAAM,CACf;CAAA,CAAA;AAwgDD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAFhB;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,CAQhE;AA2FD;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAJR,MAAM,YACN,eAAe,KACb,OAAO,CAAC,MAAM,CAsE1B,CAAC;AAIF,OAAO,EACL,OAAO,EACP,SAAS,EACT,cAAc,EACf,CAAC"}
@@ -107,5 +107,22 @@ declare const endlessRawTextElements: Set<string>;
107
107
  declare const escapableRawTextElements: Set<string>;
108
108
  declare const rawTextElements: Set<string>;
109
109
  declare const MISSING_DEPENDENCY = "HMN_MISSING_DEPENDENCY";
110
- 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_ENTITY, RE_LEGACY_ENTITIES, RE_ESCAPE_LT, RE_ESCAPE_LT_RAW_TEXT, RE_HTML_ENCODING, RE_ATTR_WS_CHECK, RE_ATTR_WS_COLLAPSE, RE_ATTR_WS_TRIM, RE_STYLE_ELEMENT, RE_EMPTY_ATTRIBUTE, inlineElementsToKeepWhitespaceAround, inlineElementsToKeepWhitespaceWithin, inlineElementsToKeepWhitespace, formControlElements, generalDefaults, tagDefaults, executableScriptsMimetypes, keepScriptsMimetypes, jsonScriptTypes, isSimpleBoolean, isBooleanValue, collapsibleValues, srcsetElements, MISSING_DEPENDENCY, optionalStartTags, optionalEndTags, headerElements, descriptionElements, pBlockElements, pInlineElements, rubyEndTagOmission, rubyRtcEndTagOmission, optionElements, tableContentElements, tableSectionElements, cellElements, topLevelElements, compactElements, looseElements, trailingElements, htmlElements, specialContentElements, genericRawTextElements, endlessRawTextElements, escapableRawTextElements, rawTextElements };
110
+ declare const svgoPluginsInline: {
111
+ name: string;
112
+ params: {
113
+ overrides: {
114
+ cleanupIds: boolean;
115
+ inlineStyles: boolean;
116
+ minifyStyles: {
117
+ usage: boolean;
118
+ };
119
+ removeHiddenElems: boolean;
120
+ removeUnknownsAndDefaults: {
121
+ keepRoleAttr: boolean;
122
+ };
123
+ };
124
+ };
125
+ }[];
126
+ declare const namesForeignMixedCase: Map<string, string>;
127
+ 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_ENTITY, RE_LEGACY_ENTITIES, RE_ESCAPE_LT, RE_ESCAPE_LT_RAW_TEXT, RE_HTML_ENCODING, RE_ATTR_WS_CHECK, RE_ATTR_WS_COLLAPSE, RE_ATTR_WS_TRIM, RE_STYLE_ELEMENT, RE_EMPTY_ATTRIBUTE, inlineElementsToKeepWhitespaceAround, inlineElementsToKeepWhitespaceWithin, inlineElementsToKeepWhitespace, formControlElements, generalDefaults, tagDefaults, executableScriptsMimetypes, keepScriptsMimetypes, jsonScriptTypes, isSimpleBoolean, isBooleanValue, collapsibleValues, srcsetElements, MISSING_DEPENDENCY, namesForeignMixedCase, svgoPluginsInline, optionalStartTags, optionalEndTags, headerElements, descriptionElements, pBlockElements, pInlineElements, rubyEndTagOmission, rubyRtcEndTagOmission, optionElements, tableContentElements, tableSectionElements, cellElements, topLevelElements, compactElements, looseElements, trailingElements, htmlElements, specialContentElements, genericRawTextElements, endlessRawTextElements, escapableRawTextElements, rawTextElements };
111
128
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +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;AACnC,QAAA,MAAM,aAAa,QAAwB,CAAC;AAC5C,QAAA,MAAM,kBAAkB,QAA+oB,CAAC;AACxqB,QAAA,MAAM,YAAY,QAAO,CAAC;AAK1B,QAAA,MAAM,qBAAqB,EAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAG3D,CAAC;AAGJ,QAAA,MAAM,gBAAgB,QAA4C,CAAC;AACnE,QAAA,MAAM,gBAAgB,QAAgB,CAAC;AACvC,QAAA,MAAM,mBAAmB,QAAkB,CAAC;AAC5C,QAAA,MAAM,eAAe,QAA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B,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,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EAChB,CAAC"}
@@ -21,6 +21,9 @@ export type ProcessedOptions = Omit<MinifierOptions, 'preset' | 'canCollapseWhit
21
21
  minifyJS: (text: string, inline?: boolean, isModule?: boolean) => string | Promise<string>;
22
22
  minifyURLs: (text: string) => string | Promise<string>;
23
23
  minifySVG: ((svgContent: string) => string | Promise<string>) | null;
24
+ canMinifyCSS: ((text: string, type?: 'inline' | 'media') => boolean) | null;
25
+ canMinifyJS: ((text: string, inline?: boolean) => boolean) | null;
26
+ canMinifySVG: ((text: string) => boolean) | null;
24
27
  removeUnusedCSS: {
25
28
  safelist: Array<string | RegExp>;
26
29
  scripts: boolean;
@@ -64,6 +67,9 @@ export type ProcessedOptions = Omit<MinifierOptions, 'preset' | 'canCollapseWhit
64
67
  * minifyJS: (text: string, inline?: boolean, isModule?: boolean) => string | Promise<string>,
65
68
  * minifyURLs: (text: string) => string | Promise<string>,
66
69
  * minifySVG: ((svgContent: string) => string | Promise<string>) | null,
70
+ * canMinifyCSS: ((text: string, type?: 'inline' | 'media') => boolean) | null,
71
+ * canMinifyJS: ((text: string, inline?: boolean) => boolean) | null,
72
+ * canMinifySVG: ((text: string) => boolean) | null,
67
73
  * removeUnusedCSS: {safelist: Array<string | RegExp>, scripts: boolean} | null,
68
74
  * cssContext?: CSSContext,
69
75
  * parallelJS?: boolean,
@@ -76,6 +82,7 @@ export type ProcessedOptions = Omit<MinifierOptions, 'preset' | 'canCollapseWhit
76
82
  */
77
83
  /** @param {ProcessedOptions} options */
78
84
  declare function shouldMinifyInnerHTML(options: ProcessedOptions): boolean;
85
+ declare const optionKeysExtra: Set<string>;
79
86
  export type OptionDependency = OptionDependency[];
80
87
  /**
81
88
  * Options that do nothing on their own, and the option each one needs to take effect
@@ -94,13 +101,13 @@ export type OptionDependency = OptionDependency[];
94
101
  declare const optionDependencies: ({
95
102
  option: string;
96
103
  requires: string;
104
+ unusable: (input: Record<string, any>) => "which a function of your own replaces" | false;
105
+ clear: boolean;
106
+ } | {
97
107
  unusable?: never;
98
108
  clear?: never;
99
- } | {
100
109
  option: string;
101
110
  requires: string;
102
- unusable: (/** @type {Record<string, any>} */ input: Record<string, any>) => "which a function of your own replaces" | false;
103
- clear: boolean;
104
111
  })[];
105
112
  /**
106
113
  * @param {MinifierOptions} inputOptions - User-provided options
@@ -116,5 +123,5 @@ declare const processOptions: (inputOptions: MinifierOptions, { getLightningCSS,
116
123
  jsMinifyCache?: LRU | undefined;
117
124
  svgMinifyCache?: LRU | undefined;
118
125
  }) => ProcessedOptions;
119
- export { optionDependencies, shouldMinifyInnerHTML, processOptions };
126
+ export { optionDependencies, optionKeysExtra, shouldMinifyInnerHTML, processOptions };
120
127
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/lib/options.js"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,GAAG,EAAmJ,MAAM,YAAY,CAAC;AAQ9K,OAAQ,KAAA,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AASrE,YAA4D,UAAU,GAA5D;IAAC,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAC,CAAY;AAOtE,YAA6C,SAAS,GAA5C;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;C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;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,wCAAwC;AACxC,iBAAS,qBAAqB,CAAC,OAAO,EAD1B,gBAC0B,WAUrC;AA0BD,QAAA,MAAM,eAAe,aAA0H,CAAC;AAyB7I,YAAkB,gBAAgB,GAM3B,gBAAgB,EAAE,CAAC;AAZ7B;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB;;;sBAhBV,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;;IAmChC,CAAC;AAmEF;;;;GAIG;AACH,QAAA,MAAM,cAAc,iBAJT,eAAe,mGACf;IAAC,eAAe,CAAC,EAAE,WAAW,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,WAAW,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,SAAS,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;IAAC,aAAa,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;CAAC,KAC5O,gBAukBZ,CAAC;AAIF,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACf,CAAC"}
package/package.json CHANGED
@@ -89,11 +89,11 @@
89
89
  "prepack": "npm run build",
90
90
  "prepare": "git config core.hooksPath .githooks || true",
91
91
  "serve": "vite",
92
- "test": "npm run test:types && node --test \"test/**/*.test.js\"",
92
+ "test": "npm run test:types && node --test \"test/**/*.test.js\" \"backtest/*.test.js\"",
93
93
  "test:types": "tsc --noEmit && tsc --project tsconfig.test.json",
94
- "test:watch": "node --test --watch \"test/**/*.test.js\""
94
+ "test:watch": "node --test --watch \"test/**/*.test.js\" \"backtest/*.test.js\""
95
95
  },
96
96
  "type": "module",
97
97
  "types": "dist/types/htmlminifier.d.ts",
98
- "version": "8.4.4"
98
+ "version": "8.5.0"
99
99
  }
@@ -27,6 +27,7 @@ import {
27
27
  looseElements,
28
28
  trailingElements,
29
29
  pInlineElements,
30
+ namesForeignMixedCase,
30
31
  MISSING_DEPENDENCY
31
32
  } from './lib/constants.js';
32
33
 
@@ -94,6 +95,31 @@ import { toFragment, replaceCustomFragments } from './lib/fragments.js';
94
95
  *
95
96
  * Default: Built-in `canCollapseWhitespace` function
96
97
  *
98
+ * @prop {((text: string, type?: 'inline' | 'media') => boolean) | null} [canMinifyCSS]
99
+ * Synchronous predicate that determines whether the built-in `minifyCSS` may
100
+ * process a given piece of CSS—`type` is `undefined` for `style` elements,
101
+ * `'inline'` for `style` attributes, and `'media'` for `media` attributes.
102
+ * Returning false leaves that CSS as if `minifyCSS` were off, including its URLs
103
+ * and unused rules (within `svg` elements, SVGO still minifies it under `minifySVG`).
104
+ *
105
+ * Default: `null` (all CSS is minified)
106
+ *
107
+ * @prop {((text: string, inline?: boolean) => boolean) | null} [canMinifyJS]
108
+ * Synchronous predicate that determines whether the built-in `minifyJS` may
109
+ * process a given piece of JavaScript—`inline` is true for event handler
110
+ * attributes. Returning false leaves that JavaScript unminified (`mergeScripts`
111
+ * still applies).
112
+ *
113
+ * Default: `null` (all JavaScript is minified)
114
+ *
115
+ * @prop {((text: string) => boolean) | null} [canMinifySVG]
116
+ * Synchronous predicate that determines whether the built-in `minifySVG` may
117
+ * pass a given outermost `svg` element, nested ones included, to SVGO. It
118
+ * receives the element as serialized by the HTML pass (e.g., without comments
119
+ * under `removeComments`); returning false leaves it as that pass wrote it.
120
+ *
121
+ * Default: `null` (all SVG is minified)
122
+ *
97
123
  * @prop {(tag: string | null, attrs: HTMLAttribute[] | undefined, canTrimWhitespace: (tag: string) => boolean) => boolean} [canTrimWhitespace]
98
124
  * Predicate that determines whether leading/trailing whitespace around
99
125
  * the element may be trimmed.
@@ -315,8 +341,10 @@ import { toFragment, replaceCustomFragments } from './lib/fragments.js';
315
341
  *
316
342
  * @prop {boolean | Object} [minifySVG]
317
343
  * When true, enables SVG minification using [SVGO](https://github.com/svg/svgo).
318
- * Complete SVG subtrees are extracted and optimized as a block.
319
- * If an object is provided, it is passed to SVGO as configuration options.
344
+ * Complete SVG subtrees are extracted and optimized as a block, with the SVGO
345
+ * plugins that assume a standalone SVG file turned off.
346
+ * If an object is provided, it is passed to SVGO as configuration options; unless
347
+ * it sets `plugins`, it keeps that plugin set.
320
348
  * If disabled, SVG content is minified using standard HTML rules only.
321
349
  *
322
350
  * Default: `false`
@@ -607,6 +635,13 @@ const RE_LAST_HTML_TAG = /[\s\S]*<(\/?[a-zA-Z][\w:-]*)/;
607
635
  // the per-tag foreign-content machinery can be skipped entirely
608
636
  const RE_FOREIGN_ELEMENT_PROBE = /<(?:svg|math)[\s/>]/i;
609
637
 
638
+ // A name in foreign content as the HTML parser reads it
639
+ /** @param {string} name */
640
+ function nameForeign(name) {
641
+ const nameLower = name.toLowerCase();
642
+ return namesForeignMixedCase.get(nameLower) ?? nameLower;
643
+ }
644
+
610
645
  // Script merging
611
646
 
612
647
  /**
@@ -1604,13 +1639,16 @@ async function minifyHTML(value, options, partialMarkup) {
1604
1639
  const nameHTML = options.name;
1605
1640
  const keepClosingSlashHTML = Boolean(options.keepClosingSlash);
1606
1641
  options = Object.create(options);
1607
- options.caseSensitive = true;
1642
+ // SVGO reads an SVG block whole, nested MathML included, so what the block is stays true inside it
1643
+ options.insideSVG = lowerTag === 'svg' || Boolean(options.insideSVG);
1644
+ // XML reads names as written, so wherever SVGO reads, they are written the way HTML reads
1645
+ // them (`viewbox` as `viewBox`), and attributes differing only in case are one attribute
1646
+ const readBySVGO = options.insideSVG && Boolean(options.minifySVG);
1647
+ options.caseSensitive = !readBySVGO;
1608
1648
  options.keepClosingSlash = true;
1609
- options.name = identity;
1649
+ options.name = readBySVGO ? nameForeign : identity;
1610
1650
  options.nameHTML = nameHTML;
1611
1651
  options.keepClosingSlashHTML = keepClosingSlashHTML;
1612
- // SVGO reads an SVG block whole, nested MathML included, so what the block is stays true inside it
1613
- options.insideSVG = lowerTag === 'svg' || Boolean(options.insideSVG);
1614
1652
  options.insideForeignContent = true;
1615
1653
  // Disable HTML-specific options that produce invalid XML:
1616
1654
  // SVG with `minifySVG` enabled is passed to SVGO, which requires valid XML input;
@@ -1780,6 +1818,9 @@ async function minifyHTML(value, options, partialMarkup) {
1780
1818
  end: function (/** @type {string} */ tag, /** @type {HTMLAttribute[]} */ attrs, /** @type {boolean} */ autoGenerated) {
1781
1819
  // As in `start`: `lowerTag` stays '' when no foreign content is around
1782
1820
  let lowerTag = '';
1821
+ // Named as the start tag was: an `svg` or `math` element in its own context,
1822
+ // a `foreignObject` or `annotation-xml` element in its parent’s
1823
+ let name = options.name;
1783
1824
  if (hasForeignContext) {
1784
1825
  lowerTag = tag.toLowerCase();
1785
1826
  // Restore parent context when exiting SVG/MathML or HTML-in-foreign-content elements
@@ -1788,9 +1829,10 @@ async function minifyHTML(value, options, partialMarkup) {
1788
1829
  } else if ((lowerTag === 'foreignobject' || lowerTag === 'annotation-xml') &&
1789
1830
  !options.insideForeignContent && Object.getPrototypeOf(options).insideForeignContent) {
1790
1831
  options = Object.getPrototypeOf(options);
1832
+ name = options.name;
1791
1833
  }
1792
1834
  }
1793
- tag = options.name(tag);
1835
+ tag = name(tag);
1794
1836
 
1795
1837
  // Check if current tag is in a whitespace stack
1796
1838
  if (options.collapseWhitespace) {
@@ -211,6 +211,49 @@ const rawTextElements = new Set([...specialContentElements, ...genericRawTextEle
211
211
  // configuration error, and so not one that `continueOnMinifyError` waves through
212
212
  const MISSING_DEPENDENCY = 'HMN_MISSING_DEPENDENCY';
213
213
 
214
+ // SVGO’s `preset-default` treats an SVG as a file of its own, but an inline SVG’s IDs, `style`
215
+ // rules, and hidden sprites reach into the rest of the document, so the plugins that assume
216
+ // otherwise stay off, and `minifyStyles` keeps the rules the SVG itself does not use
217
+ const svgoPluginsInline = [{
218
+ name: 'preset-default',
219
+ params: {
220
+ overrides: {
221
+ cleanupIds: false,
222
+ inlineStyles: false,
223
+ minifyStyles: { usage: false },
224
+ removeHiddenElems: false,
225
+ removeUnknownsAndDefaults: { keepRoleAttr: true }
226
+ }
227
+ }
228
+ }];
229
+
230
+ // Mixed-case names the HTML parser gives SVG elements and attributes and MathML attributes, keyed
231
+ // by the lowercase it reads every other name as (no lowercase name is both an element and an
232
+ // attribute of different case, so one table serves both)
233
+ // https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
234
+ const namesForeignMixedCase = new Map([
235
+ // SVG elements
236
+ 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animateColor', 'animateMotion', 'animateTransform',
237
+ 'clipPath', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix',
238
+ 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA',
239
+ 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode',
240
+ 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',
241
+ 'feTurbulence', 'foreignObject', 'glyphRef', 'linearGradient', 'radialGradient', 'textPath',
242
+ // SVG attributes
243
+ 'attributeName', 'attributeType', 'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits',
244
+ 'diffuseConstant', 'edgeMode', 'filterUnits', 'gradientTransform', 'gradientUnits',
245
+ 'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust',
246
+ 'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', 'maskUnits',
247
+ 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointsAtX',
248
+ 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'refX', 'refY',
249
+ 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'specularConstant',
250
+ 'specularExponent', 'spreadMethod', 'startOffset', 'stdDeviation', 'stitchTiles', 'surfaceScale',
251
+ 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textLength', 'viewBox', 'viewTarget',
252
+ 'xChannelSelector', 'yChannelSelector', 'zoomAndPan',
253
+ // MathML attributes
254
+ 'definitionURL'
255
+ ].map(name => [name.toLowerCase(), name]));
256
+
214
257
  // Exports
215
258
 
216
259
  export {
@@ -261,6 +304,8 @@ export {
261
304
  // Misc
262
305
  srcsetElements,
263
306
  MISSING_DEPENDENCY,
307
+ namesForeignMixedCase,
308
+ svgoPluginsInline,
264
309
 
265
310
  // Tag omission rules
266
311
  optionalStartTags,
@@ -3,8 +3,8 @@
3
3
  */
4
4
 
5
5
  import { createUrlMinifier } from './urls.js';
6
- import { LRU, MAX_CACHE_ENTRY_SIZE, stableStringify, hashContent, identity, lowercase, paramCase, replaceAsync, parseRegExp, describeQuantifierRisk, lostFlag } from './utils.js';
7
- import { RE_TRAILING_SEMICOLON, MISSING_DEPENDENCY } from './constants.js';
6
+ import { LRU, MAX_CACHE_ENTRY_SIZE, stableStringify, hashContent, identity, isThenable, lowercase, paramCase, replaceAsync, parseRegExp, describeQuantifierRisk, lostFlag } from './utils.js';
7
+ import { RE_TRAILING_SEMICOLON, MISSING_DEPENDENCY, svgoPluginsInline } from './constants.js';
8
8
  import { canCollapseWhitespace, canTrimWhitespace } from './whitespace.js';
9
9
  import { wrapCSS, unwrapCSS } from './content.js';
10
10
  import { findUnusedSymbols, normalizeUnusedCSSOptions } from './unused-css.js';
@@ -47,6 +47,9 @@ import { optionDefinitions, optionDefaults } from './option-definitions.js';
47
47
  * minifyJS: (text: string, inline?: boolean, isModule?: boolean) => string | Promise<string>,
48
48
  * minifyURLs: (text: string) => string | Promise<string>,
49
49
  * minifySVG: ((svgContent: string) => string | Promise<string>) | null,
50
+ * canMinifyCSS: ((text: string, type?: 'inline' | 'media') => boolean) | null,
51
+ * canMinifyJS: ((text: string, inline?: boolean) => boolean) | null,
52
+ * canMinifySVG: ((text: string) => boolean) | null,
50
53
  * removeUnusedCSS: {safelist: Array<string | RegExp>, scripts: boolean} | null,
51
54
  * cssContext?: CSSContext,
52
55
  * parallelJS?: boolean,
@@ -97,7 +100,7 @@ function getUrlMinifyCache(site) {
97
100
  }
98
101
 
99
102
  // User-facing option keys that are valid but not listed in `optionDefinitions`
100
- const optionKeysExtra = new Set(['preset', 'log', 'canCollapseWhitespace', 'canTrimWhitespace']);
103
+ const optionKeysExtra = new Set(['preset', 'log', 'canCollapseWhitespace', 'canTrimWhitespace', 'canMinifyCSS', 'canMinifyJS', 'canMinifySVG']);
101
104
 
102
105
  // Unknown option keys and preset names already warned about—warn once per
103
106
  // key per process, so repeated `minify` calls (e.g., batch runs) don’t flood STDERR
@@ -112,6 +115,10 @@ const unusedCSSWarned = new Set();
112
115
  // Object-valued options handed a string, warned about once per distinct value
113
116
  const stringValuesWarned = new Set();
114
117
 
118
+ // Clause for options that only the built-in minifier behind `key` reads
119
+ const replacedByOwnFunction = (/** @type {string} */ key) =>
120
+ (/** @type {Record<string, any>} */ input) => typeof input[key] === 'function' && 'which a function of your own replaces';
121
+
115
122
  /**
116
123
  * Options that do nothing on their own, and the option each one needs to take effect
117
124
  *
@@ -127,6 +134,9 @@ const stringValuesWarned = new Set();
127
134
  * @type {OptionDependency[]}
128
135
  */
129
136
  const optionDependencies = [
137
+ { option: 'canMinifyCSS', requires: 'minifyCSS', unusable: replacedByOwnFunction('minifyCSS'), clear: true },
138
+ { option: 'canMinifyJS', requires: 'minifyJS', unusable: replacedByOwnFunction('minifyJS'), clear: true },
139
+ { option: 'canMinifySVG', requires: 'minifySVG', unusable: replacedByOwnFunction('minifySVG'), clear: true },
130
140
  { option: 'collapseInlineTagWhitespace', requires: 'collapseWhitespace' },
131
141
  { option: 'conservativeCollapse', requires: 'collapseWhitespace' },
132
142
  { option: 'customEventAttributes', requires: 'minifyJS' },
@@ -138,7 +148,7 @@ const optionDependencies = [
138
148
  option: 'removeUnusedCSS',
139
149
  requires: 'minifyCSS',
140
150
  // Removal rides along with Lightning CSS, which a function of one’s own replaces
141
- unusable: (/** @type {Record<string, any>} */ input) => typeof input.minifyCSS === 'function' && 'which a function of your own replaces',
151
+ unusable: replacedByOwnFunction('minifyCSS'),
142
152
  clear: true
143
153
  },
144
154
  { option: 'trimCustomFragments', requires: 'collapseWhitespace' }
@@ -152,6 +162,34 @@ function isRequested(value) {
152
162
  return Array.isArray(value) ? value.length > 0 : Boolean(value);
153
163
  }
154
164
 
165
+ // A `canMinify…` hook that returns false leaves the content as is, as does one that
166
+ // throws under `continueOnMinifyError`; hooks are synchronous, so a promise counts as an error
167
+ /**
168
+ * @param {ProcessedOptions} options - Processed options
169
+ * @param {'canMinifyCSS' | 'canMinifyJS' | 'canMinifySVG'} name - Hook to consult
170
+ * @param {...any} args - Arguments for the hook
171
+ * @returns {boolean}
172
+ */
173
+ function declinesMinify(options, name, ...args) {
174
+ const hook = /** @type {((...args: any[]) => unknown) | null} */ (options[name]);
175
+ if (!hook) return false;
176
+ try {
177
+ const result = hook(...args);
178
+ if (isThenable(result)) {
179
+ // Keep a later rejection from surfacing as unhandled
180
+ /** @type {Promise<unknown>} */ (result).catch(() => {});
181
+ throw new TypeError(`\`${name}\` must return a boolean, not a promise`);
182
+ }
183
+ return !result;
184
+ } catch (err) {
185
+ if (!options.continueOnMinifyError) {
186
+ throw err;
187
+ }
188
+ options.log && options.log(err);
189
+ return true;
190
+ }
191
+ }
192
+
155
193
  /** @param {unknown} err - Error raised while minifying */
156
194
  function isMissingDependency(err) {
157
195
  return Boolean(err) && /** @type {any} */ (err).code === MISSING_DEPENDENCY;
@@ -198,6 +236,9 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
198
236
  minifyJS: identity,
199
237
  minifyURLs: identity,
200
238
  minifySVG: null,
239
+ canMinifyCSS: null,
240
+ canMinifyJS: null,
241
+ canMinifySVG: null,
201
242
  removeUnusedCSS: null
202
243
  };
203
244
 
@@ -291,6 +332,10 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
291
332
  if (typeof option === 'function') {
292
333
  options.log = option;
293
334
  }
335
+ } else if (key === 'canMinifyCSS' || key === 'canMinifyJS' || key === 'canMinifySVG') {
336
+ if (typeof option === 'function') {
337
+ optionsDynamic[key] = option;
338
+ }
294
339
  } else if (key === 'minifyCSS' && typeof option !== 'function') {
295
340
  if (!option || !getLightningCSS || !cssMinifyCache) {
296
341
  return;
@@ -307,6 +352,10 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
307
352
  return text;
308
353
  }
309
354
 
355
+ if (declinesMinify(options, 'canMinifyCSS', text, type)) {
356
+ return text;
357
+ }
358
+
310
359
  // Warnings are stored with the minified result and replayed on every hit, so a
311
360
  // second document with the same defect hears about it, too; `context.warned`
312
361
  // then keeps one document from repeating itself. Reporting from the cache
@@ -501,6 +550,10 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
501
550
  return '';
502
551
  }
503
552
 
553
+ if (declinesMinify(options, 'canMinifyJS', text, inline)) {
554
+ return text;
555
+ }
556
+
504
557
  // Hybrid strategy: Always use Terser for inline JS (needs bare returns support)
505
558
  // Use user’s chosen engine for script blocks
506
559
  const useEngine = inline ? 'terser' : engine;
@@ -624,7 +677,9 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
624
677
  const loadSvgo = getSvgo;
625
678
  const svgCache = svgMinifyCache;
626
679
 
627
- const svgoOptions = typeof option === 'object' ? option : {};
680
+ // A config without `plugins` of its own keeps the plugins fit for inline SVG
681
+ const svgoConfig = typeof option === 'object' ? /** @type {{plugins?: unknown[]}} */ (option) : {};
682
+ const svgoOptions = { ...svgoConfig, plugins: svgoConfig.plugins ?? svgoPluginsInline };
628
683
 
629
684
  // Pre-compute option signature for cache keys
630
685
  const svgSig = stableStringify({
@@ -637,6 +692,10 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
637
692
  return svgContent;
638
693
  }
639
694
 
695
+ if (declinesMinify(options, 'canMinifySVG', svgContent)) {
696
+ return svgContent;
697
+ }
698
+
640
699
  const isCacheable = svgContent.length <= MAX_CACHE_ENTRY_SIZE;
641
700
  const svgKey = isCacheable
642
701
  ? (svgContent.length > 2048
@@ -752,6 +811,7 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, getS
752
811
 
753
812
  export {
754
813
  optionDependencies,
814
+ optionKeysExtra,
755
815
  shouldMinifyInnerHTML,
756
816
  processOptions
757
817
  };