html-minifier-next 6.2.10 → 7.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.
package/README.md CHANGED
@@ -4,10 +4,12 @@
4
4
 
5
5
  Your web page optimization precision tool: HTML Minifier Next (HMN) is a **super-configurable, well-tested, JavaScript-based HTML minifier** able to also handle in-document CSS, JavaScript, and SVG minification.
6
6
 
7
- The project was based on [HTML Minifier Terser (HMT)](https://github.com/terser/html-minifier-terser), which in turn had been based on [Juriy “kangax” Zaytsev’s HTML Minifier (HM)](https://github.com/kangax/html-minifier). It is now **the official successor to HTML Minifier**. HMN is maintained, easier to use, offers new features, and has been optimized for speed.
7
+ The project was based on [HTML Minifier Terser (HMT)](https://github.com/terser/html-minifier-terser), which in turn had been based on [Juriy “kangax” Zaytsev’s HTML Minifier (HM)](https://github.com/kangax/html-minifier). HMN is **the official successor to HTML Minifier**: It’s maintained, easier to use, offers new features, and has been optimized for speed. Note that HMN is largely compatible with HM and HMT but has evolved—find [migration guidance in the changelog](https://github.com/j9t/html-minifier-next/blob/main/CHANGELOG.md).
8
8
 
9
9
  ## Installation
10
10
 
11
+ HTML Minifier Next is ESM-only and requires Node.js ≥22.
12
+
11
13
  For use as a command-line app, use npx:
12
14
 
13
15
  ```shell
@@ -44,7 +46,7 @@ Use `npx html-minifier-next --help` to check all available options:
44
46
 
45
47
  ### Configuration file
46
48
 
47
- You can use a configuration file to specify options. The file can be either JSON format or a JavaScript module that exports the configuration object:
49
+ You can use a configuration file to specify options. The file can be either in JSON format or a JavaScript module that exports the configuration object:
48
50
 
49
51
  **JSON configuration example:**
50
52
 
@@ -57,10 +59,10 @@ You can use a configuration file to specify options. The file can be either JSON
57
59
  }
58
60
  ```
59
61
 
60
- **JavaScript module configuration example:**
62
+ **JavaScript module configuration example** (requires `"type": "module"` in the project’s package.json, or use a .mjs extension):
61
63
 
62
64
  ```javascript
63
- module.exports = {
65
+ export default {
64
66
  collapseWhitespace: true,
65
67
  removeComments: true,
66
68
  fileExt: "html,php",
@@ -70,8 +72,6 @@ module.exports = {
70
72
 
71
73
  ### Node.js
72
74
 
73
- ESM with Node.js ≥16.14:
74
-
75
75
  ```javascript
76
76
  import { minify } from 'html-minifier-next';
77
77
 
@@ -82,17 +82,6 @@ const result = await minify('<p title="example" id="moo">foo</p>', {
82
82
  console.log(result); // “<p title=example id=moo>foo”
83
83
  ```
84
84
 
85
- CommonJS:
86
-
87
- ```javascript
88
- const { minify } = require('html-minifier-next');
89
-
90
- (async () => {
91
- const result = await minify('<p title="example" id="moo">foo</p>', { preset: 'comprehensive' });
92
- console.log(result); // “<p id=moo title=example>foo”
93
- })();
94
- ```
95
-
96
85
  See [the original blog post](https://perfectionkills.com/experimenting-with-html-minifier/) for details of [how it works](https://perfectionkills.com/experimenting-with-html-minifier/#how_it_works), [descriptions of most options](https://perfectionkills.com/experimenting-with-html-minifier/#options), [testing results](https://perfectionkills.com/experimenting-with-html-minifier/#field_testing), and [conclusions](https://perfectionkills.com/experimenting-with-html-minifier/#cost_and_benefits).
97
86
 
98
87
  ## Presets
@@ -165,19 +154,28 @@ Options can be used in config files (camelCase) or via CLI flags (kebab-case wit
165
154
  | `quoteCharacter`<br>`--quote-character` | Type of quote to use for attribute values (`'` or `"`) | Auto-detected (uses the quote requiring less escaping; defaults to `"` when equal) |
166
155
  | `removeAttributeQuotes`<br>`--remove-attribute-quotes` | [Remove quotes around attributes when possible](https://perfectionkills.com/experimenting-with-html-minifier/#remove_attribute_quotes) | `false` |
167
156
  | `removeComments`<br>`--remove-comments` | [Strip HTML comments](https://perfectionkills.com/experimenting-with-html-minifier/#remove_comments) | `false` |
157
+ | `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` |
168
158
  | `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)`) |
169
159
  | `removeEmptyElements`<br>`--remove-empty-elements` | [Remove all elements with empty contents](https://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements) | `false` |
170
160
  | `removeEmptyElementsExcept`<br>`--remove-empty-elements-except` | Array of elements to preserve when `removeEmptyElements` is enabled; 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 | `[]` |
171
161
  | `removeOptionalTags`<br>`--remove-optional-tags` | [Remove optional tags](https://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags) | `false` |
172
162
  | `removeRedundantAttributes`<br>`--remove-redundant-attributes` | [Remove attributes when value matches default](https://meiert.com/blog/optional-html/#toc-attribute-values) | `false` |
173
- | `removeScriptTypeAttributes`<br>`--remove-script-type-attributes` | Remove `type="text/javascript"` from `script` elements; other `type` attribute values are left intact | `false` |
174
- | `removeStyleLinkTypeAttributes`<br>`--remove-style-link-type-attributes` | Remove `type="text/css"` from `style` and `link` elements; other `type` attribute values are left intact | `false` |
175
163
  | `removeTagWhitespace`<br>`--remove-tag-whitespace` | Remove space between attributes whenever possible; **note that this will result in invalid HTML** | `false` |
176
164
  | `sortAttributes`<br>`--sort-attributes` | [Sort attributes by frequency](#sorting-attributes-and-style-classes) | `false` |
177
165
  | `sortClassNames`<br>`--sort-class-names` | [Sort style classes by frequency](#sorting-attributes-and-style-classes) | `false` |
178
166
  | `trimCustomFragments`<br>`--trim-custom-fragments` | Trim whitespace around custom fragments (`ignoreCustomFragments`) | `false` |
179
167
  | `useShortDoctype`<br>`--use-short-doctype` | [Replaces the doctype with the short HTML doctype](https://perfectionkills.com/experimenting-with-html-minifier/#use_short_doctype) | `false` |
180
168
 
169
+ ### API-only options
170
+
171
+ A few options take functions and are therefore only available programmatically, not via CLI flags or config files:
172
+
173
+ | Option | Description | Default |
174
+ | --- | --- | --- |
175
+ | `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.) |
176
+ | `canTrimWhitespace` | `Function(tag, attrs, defaultFn)` that determines whether leading and trailing whitespace around an element may be trimmed | Built-in handling |
177
+ | `log` | `Function(message)` called with warnings and errors, including minification errors swallowed by `continueOnMinifyError` (e.g., pass `console.error` to surface them) | No-op (errors are silent) |
178
+
181
179
  ### Sorting attributes and style classes
182
180
 
183
181
  Minifier options like `sortAttributes` and `sortClassNames` won’t impact the plain-text size of the output. However, using these options for more consistent ordering improves the compression ratio for Gzip and Brotli used over HTTP.
@@ -374,7 +372,7 @@ The caches persist across multiple `minify()` calls, making them particularly ef
374
372
 
375
373
  ## Minification comparison
376
374
 
377
- Please see [**the Minifier Benchmarks project**](https://github.com/j9t/minifier-benchmarks) for details on how HMN compares to other minifiers.
375
+ Please see [**the Minifier Benchmarks project**](https://github.com/j9t/minifier-benchmarks) for details on how HTML Minifier Next compares to other minifiers.
378
376
 
379
377
  ## Examples
380
378
 
@@ -622,7 +620,7 @@ To profile the current working tree, run the benchmark with Node’s built-in CP
622
620
  node --cpu-prof benchmark.js
623
621
  ```
624
622
 
625
- This writes a `.cpuprofile` file to the working directory. Load it with `npx speedscope *.cpuprofile` for a flamegraph, or drag it into Chrome DevTools → Sources → JavaScript Profiler. Compare self-time per function against a clean baseline run on `main`. Pay attention to unexpectedly heavy callbacks in hot paths—V8 de-optimization from variable object shapes or unnecessary method calls can show up there.
623
+ This writes a .cpuprofile file to the working directory. Load it with `npx speedscope *.cpuprofile` for a flamegraph, or drag it into Chrome DevTools → Sources → JavaScript Profiler. Compare self-time per function against a clean baseline run on `main`. Pay attention to unexpectedly heavy callbacks in hot paths—V8 de-optimization from variable object shapes or unnecessary method calls can show up there.
626
624
 
627
625
  ## Acknowledgements
628
626
 
package/cli.js CHANGED
@@ -33,7 +33,6 @@ import path from 'path';
33
33
  import { pathToFileURL } from 'url';
34
34
  import os from 'os';
35
35
  import readline from 'readline';
36
- import { createRequire } from 'module';
37
36
  import { Command, Option } from 'commander';
38
37
 
39
38
  // Simple case conversion for CLI option names (ASCII-only, no Unicode needed)
@@ -55,10 +54,10 @@ import { getPreset, getPresetNames } from './src/presets.js';
55
54
  import { parseRegExp } from './src/lib/utils.js';
56
55
  import { optionDefinitions } from './src/lib/option-definitions.js';
57
56
 
58
- const require = createRequire(import.meta.url);
59
- const pkg = require('./package.json');
57
+ const pkg = JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
60
58
 
61
- const DEFAULT_FILE_EXTENSIONS = ['html', 'htm', 'shtml', 'shtm'];
59
+ const EXTENSIONS_DEFAULT = ['html', 'htm', 'shtml', 'shtm'];
60
+ const EXTENSIONS_NON_HTML = new Set(['css', 'js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'svg']);
62
61
 
63
62
  const MARK_ERROR = process.stderr.isTTY ? '\x1b[31m' : '';
64
63
  const MARK_SUCCESS = process.stderr.isTTY ? '\x1b[32m' : '';
@@ -195,9 +194,8 @@ function readFile(file) {
195
194
  }
196
195
 
197
196
  /**
198
- * Load config from a file path—for unambiguous extensions (.json, .cjs, .mjs) only the
199
- * matching format is attempted and its error shown on failure; for .js or unknown extensions
200
- * all formats are tried and the most relevant error is reported
197
+ * Load config from a file path. Extensions .json, .js, and .mjs are handled
198
+ * directly; for unknown extensions, JSON is tried first, then module import.
201
199
  * @param {string} configPath - Path to config file
202
200
  * @returns {Promise<object>} Loaded config object
203
201
  */
@@ -210,37 +208,27 @@ async function loadConfigFromPath(configPath) {
210
208
  catch (err) { fatal(`Cannot parse config file as JSON: ${err.message}`); }
211
209
  }
212
210
 
213
- if (ext === '.cjs') {
214
- try {
215
- const result = require(abs);
216
- return (result && typeof result === 'object' && result.__esModule === true) ? result.default : result;
217
- } catch (err) { fatal(`Cannot load config file: ${err.message}`); }
218
- }
219
-
220
- if (ext === '.mjs') {
211
+ if (ext === '.js' || ext === '.mjs') {
212
+ // `import()` handles both ESM and CJS .js files—Node resolves the type via the
213
+ // nearest package.json `type` field, same as it does for regular module loading
221
214
  try { const mod = await import(pathToFileURL(abs).href); return 'default' in mod ? mod.default : mod; }
222
215
  catch (err) { fatal(`Cannot load config file: ${err.message}`); }
223
216
  }
224
217
 
225
- // For .js or extension-less files, try JSON first, then CJS, then ESM
218
+ // Unknown extension: Try JSON, then module import
226
219
  let jsonErr;
227
220
  try { return JSON.parse(readFile(abs).replace(/^\uFEFF/, '')); }
228
221
  catch (err) { jsonErr = err; }
229
222
 
230
- try {
231
- const result = require(abs);
232
- // Handle ESM interop: If `require()` loads an ESM file, it may return `{__esModule: true, default: }`
233
- return (result && typeof result === 'object' && result.__esModule === true) ? result.default : result;
234
- } catch (cjsErr) {
235
- try { const mod = await import(pathToFileURL(abs).href); return 'default' in mod ? mod.default : mod; }
236
- catch (esmErr) {
237
- fatal(ext === '.js'
238
- ? `Cannot load config file: ${cjsErr.message}\nAs module: ${esmErr.message}`
239
- : `Cannot read the specified config file.\nAs JSON: ${jsonErr.message}\nAs CJS: ${cjsErr.message}\nAs module: ${esmErr.message}`);
240
- }
223
+ try { const mod = await import(pathToFileURL(abs).href); return 'default' in mod ? mod.default : mod; }
224
+ catch (esmErr) {
225
+ fatal(`Cannot read the specified config file.\nAs JSON: ${jsonErr.message}\nAs module: ${esmErr.message}`);
241
226
  }
242
227
  }
243
228
 
229
+ // Config keys the CLI handles itself, beyond the options in `optionDefinitions`
230
+ const CONFIG_KEYS_EXTRA = new Set(['preset', 'fileExt', 'ignoreDir']);
231
+
244
232
  /**
245
233
  * Normalize and validate config object by applying parsers and transforming values.
246
234
  * @param {object} config - Raw config object
@@ -249,6 +237,13 @@ async function loadConfigFromPath(configPath) {
249
237
  function normalizeConfig(config) {
250
238
  const normalized = { ...config };
251
239
 
240
+ // Warn about unrecognized config keys—catches typos as well as options removed in earlier versions
241
+ Object.keys(normalized).forEach(function (key) {
242
+ if (!Object.hasOwn(optionDefinitions, key) && !CONFIG_KEYS_EXTRA.has(key)) {
243
+ console.error(`Ignoring unknown or deprecated config option “${key}” (see \`--help\` or README for available options)`);
244
+ }
245
+ });
246
+
252
247
  // Apply parsers to main options
253
248
  mainOptionKeys.forEach(function (key) {
254
249
  if (key in normalized) {
@@ -362,7 +357,7 @@ program.helpOption('-h, --help', 'Display help for command');
362
357
  programOptions.preset = 'comprehensive';
363
358
 
364
359
  const inputDirResolved = await fs.promises.realpath(cwd).catch(() => cwd);
365
- const extensions = DEFAULT_FILE_EXTENSIONS;
360
+ const extensions = EXTENSIONS_DEFAULT;
366
361
  const ignorePatterns = ['node_modules'];
367
362
 
368
363
  const showProgress = process.stderr.isTTY;
@@ -732,7 +727,7 @@ program.helpOption('-h, --help', 'Display help for command');
732
727
 
733
728
  // Resolve file extensions: CLI argument > config file > defaults
734
729
  const hasCliFileExt = program.getOptionValueSource('fileExt') === 'cli';
735
- const resolvedFileExt = hasCliFileExt ? (fileExt || '*') : (config.fileExt || DEFAULT_FILE_EXTENSIONS);
730
+ const resolvedFileExt = hasCliFileExt ? (fileExt || '*') : (config.fileExt || EXTENSIONS_DEFAULT);
736
731
 
737
732
  // Resolve ignore patterns: CLI argument takes priority over config file
738
733
  const hasCliIgnoreDir = program.getOptionValueSource('ignoreDir') === 'cli';
@@ -745,6 +740,16 @@ program.helpOption('-h, --help', 'Display help for command');
745
740
  fatal('You need to specify where to write the output files with the option `--output-dir`');
746
741
  }
747
742
 
743
+ {
744
+ const extList = Array.isArray(resolvedFileExt) ? resolvedFileExt : parseFileExtensions(String(resolvedFileExt || ''));
745
+ const isWildcard = extList.includes('*');
746
+ const nonHtmlExts = isWildcard ? [] : extList.filter(e => EXTENSIONS_NON_HTML.has(e));
747
+ if (isWildcard || nonHtmlExts.length > 0) {
748
+ const label = isWildcard ? 'all file types' : nonHtmlExts.map(e => `.${e}`).join(', ');
749
+ console.error(`${MARK_WARNING}Warning: Processing ${label}—HTML Minifier Next processes CSS, JavaScript, and SVG only when embedded in HTML. Non-HTML files may produce incomplete or broken output.${MARK_RESET}`);
750
+ }
751
+ }
752
+
748
753
  await (async () => {
749
754
  // `--dry` automatically enables verbose mode
750
755
  const isVerbose = programOptions.verbose || programOptions.dry;
@@ -833,13 +838,20 @@ program.helpOption('-h, --help', 'Display help for command');
833
838
  }
834
839
  })();
835
840
  } else if (filesProvided) { // Minifying one or more files specified on the CMD line
836
- // Process each file independently, then concatenate outputs to preserve current behavior
841
+ // Process each file independently, then concatenate outputs
837
842
  const minifierOptions = createOptions();
838
843
  // Show config info if verbose/dry
839
844
  if (programOptions.verbose || programOptions.dry) {
840
845
  getActiveOptionsDisplay(minifierOptions);
841
846
  }
842
847
 
848
+ for (const file of capturedFiles) {
849
+ const ext = path.extname(file).replace(/^\./, '').toLowerCase();
850
+ if (EXTENSIONS_NON_HTML.has(ext)) {
851
+ console.error(`${MARK_WARNING}Warning: “${path.basename(file)}” does not appear to be an HTML file—HTML Minifier Next processes CSS, JavaScript, and SVG only when embedded in HTML. The output may be incomplete or broken.${MARK_RESET}`);
852
+ }
853
+ }
854
+
843
855
  const concurrency = Math.max(1, Math.min(os.cpus().length || 4, 8));
844
856
  const inputs = capturedFiles.slice();
845
857
 
@@ -133,7 +133,7 @@ export type MinifierOptions = {
133
133
  continueOnParseError?: boolean;
134
134
  /**
135
135
  * Array of regexes used to recognise custom attribute assignment
136
- * operators (e.g. `'<div flex?="{{mode != cover}}"></div>'`).
136
+ * operators (e.g., `'<div flex?="{{mode != cover}}"></div>'`).
137
137
  * These are concatenated with the built-in assignment patterns.
138
138
  *
139
139
  * Default: `[]`
@@ -142,18 +142,18 @@ export type MinifierOptions = {
142
142
  /**
143
143
  * Regex matching attribute names whose values should be collapsed.
144
144
  * Basically used to remove newlines and excess spaces inside attribute values,
145
- * e.g. `/ng-class/`.
145
+ * e.g., `/ng-class/`.
146
146
  */
147
147
  customAttrCollapse?: RegExp;
148
148
  /**
149
149
  * Array of `[openRegExp, closeRegExp]` pairs used by the parser to
150
150
  * detect custom attribute surround patterns (for non-standard syntaxes,
151
- * e.g. `<input {{#if value}}checked="checked"{{/if}}>`).
151
+ * e.g., `<input {{#if value}}checked="checked"{{/if}}>`).
152
152
  */
153
153
  customAttrSurround?: [RegExp, RegExp][];
154
154
  /**
155
155
  * Array of regexes used to detect event handler attributes for `minifyJS`
156
- * (e.g. `ng-click`). The default matches standard `on…` event attributes.
156
+ * (e.g., `ng-click`). The default matches standard `on…` event attributes.
157
157
  *
158
158
  * Default: `[/^on[a-z]{3,}$/]`
159
159
  */
@@ -288,14 +288,6 @@ export type MinifierOptions = {
288
288
  * Default: `false`
289
289
  */
290
290
  minifySVG?: boolean | Object;
291
- /**
292
- * Function used to normalise tag/attribute names. By default, this lowercases
293
- * names, unless `caseSensitive` is enabled.
294
- *
295
- * Default: `(name) => name.toLowerCase()`,
296
- * or `(name) => name` (no-op function) if `caseSensitive` is enabled.
297
- */
298
- name?: (name: string) => string;
299
291
  /**
300
292
  * When wrapping lines, prevent inserting a newline directly before a
301
293
  * closing tag (useful to keep tags like `</a>` on the same line).
@@ -321,6 +313,14 @@ export type MinifierOptions = {
321
313
  * Default: `false`
322
314
  */
323
315
  preserveLineBreaks?: boolean;
316
+ /**
317
+ * Name of a preset configuration to use as a base (`conservative` or
318
+ * `comprehensive`). Explicitly provided options take precedence over
319
+ * preset values. Unknown preset names are ignored (with a warning).
320
+ *
321
+ * Default: No preset
322
+ */
323
+ preset?: string;
324
324
  /**
325
325
  * When true, attribute values will not be HTML-escaped (dangerous for
326
326
  * untrusted input). By default, attributes are escaped.
@@ -331,7 +331,7 @@ export type MinifierOptions = {
331
331
  /**
332
332
  * Array of `type` attribute values for `<script>` elements whose contents
333
333
  * should be processed as HTML
334
- * (e.g. `text/ng-template`, `text/x-handlebars-template`, etc.).
334
+ * (e.g., `text/ng-template`, `text/x-handlebars-template`, etc.).
335
335
  * When present, the contents of matching script tags are recursively minified,
336
336
  * like normal HTML content.
337
337
  *
@@ -360,6 +360,13 @@ export type MinifierOptions = {
360
360
  * Default: `false`
361
361
  */
362
362
  removeComments?: boolean;
363
+ /**
364
+ * Remove default `type` attributes from `<style>`/`<link>` (e.g., `type="text/css"`)
365
+ * and `<script>` (e.g., `type="text/javascript"`) elements.
366
+ *
367
+ * Default: `false`
368
+ */
369
+ removeDefaultTypeAttributes?: boolean;
363
370
  /**
364
371
  * If true, removes attributes whose values are empty (some attributes
365
372
  * are excluded by name). Can also be a function to customise which empty
@@ -419,20 +426,6 @@ export type MinifierOptions = {
419
426
  * Default: `false`
420
427
  */
421
428
  removeRedundantAttributes?: boolean;
422
- /**
423
- * Remove `type` attributes from `<script>` when they are unnecessary
424
- * (e.g. `type="text/javascript"`).
425
- *
426
- * Default: `false`
427
- */
428
- removeScriptTypeAttributes?: boolean;
429
- /**
430
- * Remove `type` attributes from `<style>` and `<link>` elements when
431
- * they are unnecessary (e.g. `type="text/css"`).
432
- *
433
- * Default: `false`
434
- */
435
- removeStyleLinkTypeAttributes?: boolean;
436
429
  /**
437
430
  * **Note that this will result in invalid HTML!**
438
431
  *
@@ -476,22 +469,6 @@ export type MinifierOptions = {
476
469
  * Default: `false`
477
470
  */
478
471
  useShortDoctype?: boolean;
479
- /**
480
- * - Internal: Set when inside SVG/MathML context
481
- */
482
- insideSVG?: boolean;
483
- /**
484
- * - Internal: Set when inside SVG `foreignObject`
485
- */
486
- insideForeignContent?: boolean;
487
- /**
488
- * - Internal: Preserved name function during namespace transitions
489
- */
490
- parentName?: Function;
491
- /**
492
- * - Internal: HTML name function preserved from outer context
493
- */
494
- htmlName?: Function;
495
472
  };
496
473
  import { presets } from './presets.js';
497
474
  import { getPreset } from './presets.js';
@@ -1 +1 @@
1
- {"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"AA62DO,8BAJI,MAAM,YACN,eAAe,GACb,OAAO,CAAC,MAAM,CAAC,CA0B3B;;;;;;;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;;;;;gCAOP,OAAO;;;;;;;;;;0BAOP,OAAO;;;;;;;;;qBASP,OAAO,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;;;;;;;;;qBAQzD,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;;;;;;;;0BAQrC,OAAO;;;;;;;sBAOP,OAAO;;wBA5ckC,cAAc;0BAAd,cAAc;+BAAd,cAAc"}
@@ -11,11 +11,9 @@ export type HTMLAttribute = {
11
11
  };
12
12
  /**
13
13
  * @param {string} text
14
- * @param {{ignoreCustomComments: RegExp[]}} options
14
+ * @param {ProcessedOptions} options
15
15
  */
16
- export function isIgnoredComment(text: string, options: {
17
- ignoreCustomComments: RegExp[];
18
- }): boolean;
16
+ export function isIgnoredComment(text: string, options: ProcessedOptions): boolean;
19
17
  /**
20
18
  * @param {string} attrName
21
19
  * @param {{customEventAttributes?: RegExp[]}} options
@@ -110,31 +108,39 @@ export function hasAttrName(name: string, attrs: HTMLAttribute[]): boolean;
110
108
  * @param {string} tag
111
109
  * @param {string} attrName
112
110
  * @param {string} attrValue
113
- * @param {Record<string, any>} options
111
+ * @param {ProcessedOptions} options
114
112
  * @param {HTMLAttribute[]} attrs
115
113
  * @param {Function} minifyHTMLSelf
116
114
  */
117
- export function cleanAttributeValue(tag: string, attrName: string, attrValue: string, options: Record<string, any>, attrs: HTMLAttribute[], minifyHTMLSelf: Function): any;
115
+ export function cleanAttributeValue(tag: string, attrName: string, attrValue: string, options: ProcessedOptions, attrs: HTMLAttribute[], minifyHTMLSelf: Function): any;
118
116
  /**
119
117
  * @param {HTMLAttribute} attr
120
118
  * @param {HTMLAttribute[]} attrs
121
119
  * @param {string} tag
122
- * @param {Record<string, any>} options
120
+ * @param {ProcessedOptions} options
123
121
  * @param {Function} minifyHTML
124
122
  */
125
- export function normalizeAttr(attr: HTMLAttribute, attrs: HTMLAttribute[], tag: string, options: Record<string, any>, minifyHTML: Function): any;
123
+ export function normalizeAttr(attr: HTMLAttribute, attrs: HTMLAttribute[], tag: string, options: ProcessedOptions, minifyHTML: Function): {
124
+ attr: HTMLAttribute;
125
+ name: string;
126
+ value: string | undefined;
127
+ } | PromiseLike<{
128
+ attr: HTMLAttribute;
129
+ name: string;
130
+ value: string | undefined;
131
+ } | undefined> | undefined;
126
132
  /**
127
- * @param {{name: string, value?: string, attr: HTMLAttribute}} normalized
133
+ * @param {{name: string, value: string | undefined, attr: HTMLAttribute}} normalized
128
134
  * @param {string | boolean | undefined} hasUnarySlash
129
- * @param {Record<string, any>} options
135
+ * @param {ProcessedOptions} options
130
136
  * @param {boolean} isLast
131
137
  * @param {string | undefined} uidAttr
132
138
  */
133
139
  export function buildAttr(normalized: {
134
140
  name: string;
135
- value?: string;
141
+ value: string | undefined;
136
142
  attr: HTMLAttribute;
137
- }, hasUnarySlash: string | boolean | undefined, options: Record<string, any>, isLast: boolean, uidAttr: string | undefined): string;
143
+ }, hasUnarySlash: string | boolean | undefined, options: ProcessedOptions, isLast: boolean, uidAttr: string | undefined): string;
138
144
  /**
139
145
  * Remove duplicate attributes from an attribute list.
140
146
  * Per HTML spec, when an attribute appears multiple times, the first occurrence wins.
@@ -144,4 +150,5 @@ export function buildAttr(normalized: {
144
150
  * @returns {HTMLAttribute[]} Deduplicated attribute array (modifies in place and returns)
145
151
  */
146
152
  export function deduplicateAttributes(attrs: HTMLAttribute[], caseSensitive: boolean): HTMLAttribute[];
153
+ import type { ProcessedOptions } from './options.js';
147
154
  //# sourceMappingURL=attributes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/lib/attributes.js"],"names":[],"mappings":";;;4BAwBa;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CA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AE,iBACf,OAAO,GACL,aAAa,EAAE,CAqB3B;sCAlGqC,cAAc"}
@@ -1,13 +1,14 @@
1
+ /** @import { ProcessedOptions } from './options.js' */
1
2
  /**
2
3
  * @param {string} text
3
- * @param {string} type
4
+ * @param {string} [type]
4
5
  */
5
- export function wrapCSS(text: string, type: string): string;
6
+ export function wrapCSS(text: string, type?: string): string;
6
7
  /**
7
8
  * @param {string} text
8
- * @param {string} type
9
+ * @param {string} [type]
9
10
  */
10
- export function unwrapCSS(text: string, type: string): string;
11
+ export function unwrapCSS(text: string, type?: string): string;
11
12
  /**
12
13
  * @param {string} text
13
14
  * @param {{continueOnMinifyError?: boolean, log?: Function}} options
@@ -23,16 +24,13 @@ export function hasJsonScriptType(attrs: Array<{
23
24
  }>): boolean;
24
25
  /**
25
26
  * @param {string} text
26
- * @param {{continueOnMinifyError?: boolean, log?: Function, processScripts?: string[]}} options
27
+ * @param {ProcessedOptions} options
27
28
  * @param {Array<{name: string, value?: string | undefined}>} currentAttrs
28
29
  * @param {Function} minifyHTML
29
30
  */
30
- export function processScript(text: string, options: {
31
- continueOnMinifyError?: boolean;
32
- log?: Function;
33
- processScripts?: string[];
34
- }, currentAttrs: Array<{
31
+ export function processScript(text: string, options: ProcessedOptions, currentAttrs: Array<{
35
32
  name: string;
36
33
  value?: string | undefined;
37
34
  }>, minifyHTML: Function): Promise<any>;
35
+ import type { ProcessedOptions } from './options.js';
38
36
  //# sourceMappingURL=content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/lib/content.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,8BAHW,MAAM,QACN,MAAM,UAWhB;AAED;;;GAGG;AACH,gCAHW,MAAM,QACN,MAAM,UAahB;AAID;;;GAGG;AACH,iCAHW,MAAM,WACN;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,WAAU;CAAC,UAa3D;AAED,2DAA2D;AAC3D,yCADY,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,WAWhD;AAED;;;;;GAKG;AACH,oCALW,MAAM,WACN;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,WAAW;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,gBAC5E,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC,sCAoB3D"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/lib/content.js"],"names":[],"mappings":"AAKA,uDAAuD;AAMvD;;;GAGG;AACH,8BAHW,MAAM,SACN,MAAM,UAWhB;AAED;;;GAGG;AACH,gCAHW,MAAM,SACN,MAAM,UAahB;AAID;;;GAGG;AACH,iCAHW,MAAM,WACN;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,WAAU;CAAC,UAa3D;AAED,2DAA2D;AAC3D,yCADY,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,WAWhD;AAED;;;;;GAKG;AACH,oCALW,MAAM,WACN,gBAAgB,gBAChB,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC,sCAoB3D;sCA7FqC,cAAc"}
@@ -1,11 +1,5 @@
1
- export type MinifierOptions = {
2
- name: (str: string) => string;
3
- log?: Function;
4
- };
5
1
  /** @import { HTMLAttribute } from './attributes.js' */
6
- /**
7
- * @typedef {{ name: (str: string) => string, log?: Function }} MinifierOptions
8
- */
2
+ /** @import { ProcessedOptions } from './options.js' */
9
3
  /**
10
4
  * @param {string} optionalStartTag
11
5
  * @param {string} tag
@@ -28,10 +22,10 @@ export function canRemovePrecedingTag(optionalEndTag: string, tag: string): bool
28
22
  export function canRemoveElement(tag: string, attrs: HTMLAttribute[]): boolean;
29
23
  /**
30
24
  * @param {string} str - Tag name or HTML-like element spec (e.g., “td” or “<span aria-hidden='true'>”)
31
- * @param {MinifierOptions} options - Options object for name normalization
25
+ * @param {ProcessedOptions} options - Options object for name normalization
32
26
  * @returns {{tag: string, attrs: Object.<string, string|undefined>|null}|null} Parsed spec or null if invalid
33
27
  */
34
- export function parseElementSpec(str: string, options: MinifierOptions): {
28
+ export function parseElementSpec(str: string, options: ProcessedOptions): {
35
29
  tag: string;
36
30
  attrs: {
37
31
  [x: string]: string | undefined;
@@ -39,10 +33,10 @@ export function parseElementSpec(str: string, options: MinifierOptions): {
39
33
  } | null;
40
34
  /**
41
35
  * @param {string[]} input - Array of element specifications from `removeEmptyElementsExcept` option
42
- * @param {MinifierOptions} options - Options object for parsing
36
+ * @param {ProcessedOptions} options - Options object for parsing
43
37
  * @returns {Array<{tag: string, attrs: Object.<string, string|undefined>|null}>} Array of parsed element specs
44
38
  */
45
- export function parseRemoveEmptyElementsExcept(input: string[], options: MinifierOptions): Array<{
39
+ export function parseRemoveEmptyElementsExcept(input: string[], options: ProcessedOptions): Array<{
46
40
  tag: string;
47
41
  attrs: {
48
42
  [x: string]: string | undefined;
@@ -61,4 +55,5 @@ export function shouldPreserveEmptyElement(tag: string, attrs: HTMLAttribute[],
61
55
  } | null;
62
56
  }>): boolean;
63
57
  import type { HTMLAttribute } from './attributes.js';
58
+ import type { ProcessedOptions } from './options.js';
64
59
  //# sourceMappingURL=elements.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/lib/elements.js"],"names":[],"mappings":"8BAkBa;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,GAAG,CAAC,WAAU;CAAE;AAL9D,uDAAuD;AAIvD;;GAEG;AAIH;;;GAGG;AACH,qDAHW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