@ohos-ports/html-minifier-next 8.4.2-beta.0 → 8.10.8-beta.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 (46) hide show
  1. package/README.md +147 -33
  2. package/cli.js +70 -54
  3. package/dist/types/htmlminifier.d.ts +87 -33
  4. package/dist/types/htmlminifier.d.ts.map +1 -1
  5. package/dist/types/htmlparser.d.ts +4 -1
  6. package/dist/types/htmlparser.d.ts.map +1 -1
  7. package/dist/types/lib/attributes.d.ts +12 -10
  8. package/dist/types/lib/attributes.d.ts.map +1 -1
  9. package/dist/types/lib/constants.d.ts +38 -3
  10. package/dist/types/lib/constants.d.ts.map +1 -1
  11. package/dist/types/lib/content.d.ts.map +1 -1
  12. package/dist/types/lib/elements.d.ts.map +1 -1
  13. package/dist/types/lib/fragments.d.ts +1 -0
  14. package/dist/types/lib/fragments.d.ts.map +1 -1
  15. package/dist/types/lib/option-definitions.d.ts.map +1 -1
  16. package/dist/types/lib/options.d.ts +14 -46
  17. package/dist/types/lib/options.d.ts.map +1 -1
  18. package/dist/types/lib/unused-css.d.ts +34 -4
  19. package/dist/types/lib/unused-css.d.ts.map +1 -1
  20. package/dist/types/lib/urls.d.ts.map +1 -1
  21. package/dist/types/lib/utils.d.ts +31 -1
  22. package/dist/types/lib/utils.d.ts.map +1 -1
  23. package/dist/types/lib/whitespace.d.ts +57 -5
  24. package/dist/types/lib/whitespace.d.ts.map +1 -1
  25. package/dist/types/presets.d.ts +1 -2
  26. package/dist/types/presets.d.ts.map +1 -1
  27. package/dist/types/tokenchain.d.ts.map +1 -1
  28. package/html-minifier-next.schema.json +15 -7
  29. package/package.json +17 -18
  30. package/src/htmlminifier.js +1103 -392
  31. package/src/htmlparser.js +452 -200
  32. package/src/lib/attributes.js +201 -112
  33. package/src/lib/constants.js +130 -19
  34. package/src/lib/content.js +1 -6
  35. package/src/lib/elements.js +17 -12
  36. package/src/lib/file-pool.js +18 -2
  37. package/src/lib/file-write.js +87 -0
  38. package/src/lib/fragments.js +74 -8
  39. package/src/lib/option-definitions.js +17 -10
  40. package/src/lib/options.js +151 -71
  41. package/src/lib/unused-css.js +145 -27
  42. package/src/lib/urls.js +0 -9
  43. package/src/lib/utils.js +210 -45
  44. package/src/lib/whitespace.js +173 -63
  45. package/src/presets.js +1 -2
  46. package/src/tokenchain.js +1 -4
package/cli.js CHANGED
@@ -38,11 +38,10 @@ import { Command, Option } from 'commander';
38
38
  /** @param {string} str */
39
39
  const camelCase = (str) => paramCase(str).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
40
40
 
41
- // Commander derives its internal option key by applying paramCase then camelCase to the flag name,
42
- // stripping a leading `no-` first for negated flags (e.g., `--no-foo-bar` → `fooBar`);
43
- // because option definition keys may differ from the result of that round-trip (e.g.,
44
- // `minifyURLs` → Commander key `minifyUrls`, `noNewlinesBeforeTagClose` → `newlinesBeforeTagClose`),
45
- // `commanderOptionKey` uses the same paramCase + camelCase path to compute the key Commander will use
41
+ // Commander derives its option key by applying paramCase then camelCase to the flag name, after
42
+ // stripping a leading `no-` for negated flags (`--no-foo-bar` → `fooBar`); as option definition
43
+ // keys may not survive that round-trip (`minifyURLs` → `minifyUrls`, `noNewlinesBeforeTagClose` →
44
+ // `newlinesBeforeTagClose`), `commanderOptionKey` takes the same path to get Commander’s key
46
45
  /** @param {string} key */
47
46
  const commanderOptionKey = (key) => {
48
47
  const pc = paramCase(key);
@@ -53,6 +52,7 @@ const commanderOptionKey = (key) => {
53
52
  import { getPreset, getPresetNames } from './src/presets.js';
54
53
  import { paramCase, parseRegExp } from './src/lib/utils.js';
55
54
  import { optionDefinitions } from './src/lib/option-definitions.js';
55
+ import { writeFileAtomic } from './src/lib/file-write.js';
56
56
 
57
57
  const pkg = JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
58
58
 
@@ -242,7 +242,6 @@ async function loadConfigFromPath(configPath) {
242
242
  catch (err) { fatal(`Cannot load config file: ${errorMessage(err)}`); }
243
243
  }
244
244
 
245
- // Unknown extension: Try JSON, then module import
246
245
  /** @type {unknown} */
247
246
  let jsonErr;
248
247
  try { return JSON.parse(readFile(abs).replace(/^\uFEFF/, '')); }
@@ -261,6 +260,28 @@ const CONFIG_KEYS_EXTRA = new Set(['$schema', 'preset', 'fileExt', 'ignoreDir'])
261
260
  // `--config-file` isn’t specified
262
261
  const CONFIG_FILES_DEFAULT = ['html-minifier-next.config.json', 'htmlminifier.config.json'];
263
262
 
263
+ /**
264
+ * Parse a config value—strings as on the command line, anything else as it is, since
265
+ * a JSON round trip would drop what only a module config can hold (functions, regexes)
266
+ * @param {string} key Option definition key
267
+ * @param {string} type Option definition type
268
+ * @param {unknown} value
269
+ */
270
+ function parseConfigValue(key, type, value) {
271
+ if (typeof value === 'string') return getParser(key, type)(value);
272
+ switch (type) {
273
+ case 'int':
274
+ return getParser(key, type)(String(value));
275
+ // A single value is wrapped as its string form is; `null` and `undefined` leave it unset
276
+ case 'regexpArray':
277
+ return value == null ? undefined : (Array.isArray(value) ? value : [value]).map(parseRegExp);
278
+ case 'jsonArray':
279
+ return value == null ? undefined : (Array.isArray(value) ? value : [value]);
280
+ default:
281
+ return value;
282
+ }
283
+ }
284
+
264
285
  /**
265
286
  * Normalize and validate config object by applying parsers and transforming values.
266
287
  * @param {Record<string, any>} config - Raw config object
@@ -270,7 +291,7 @@ function normalizeConfig(config) {
270
291
  /** @type {Record<string, any>} */
271
292
  const normalized = { ...config };
272
293
 
273
- // Warn about unrecognized config keys—catches typos as well as options removed in earlier versions
294
+ // Warn about unrecognized config keys—catches typos and options removed in earlier versions
274
295
  Object.keys(normalized).forEach(function (key) {
275
296
  if (!Object.hasOwn(optionDefinitions, key) && !CONFIG_KEYS_EXTRA.has(key)) {
276
297
  console.error(`Ignoring unknown or deprecated config option \`${key}\` (see \`--help\` or README for available options)`);
@@ -281,13 +302,11 @@ function normalizeConfig(config) {
281
302
  Object.entries(optionDefinitions).forEach(function ([key, { type }]) {
282
303
  if (key in normalized) {
283
304
  if (type !== 'boolean' && type !== 'invertedBoolean') {
284
- const value = normalized[key];
285
- normalized[key] = getParser(key, type)(typeof value === 'string' ? value : JSON.stringify(value));
305
+ normalized[key] = parseConfigValue(key, type, normalized[key]);
286
306
  }
287
307
  }
288
308
  });
289
309
 
290
- // Handle `fileExt` in config file
291
310
  if ('fileExt' in normalized) {
292
311
  // Support both string (`html,htm`) and array (`["html", "htm"]`) formats
293
312
  if (Array.isArray(normalized.fileExt)) {
@@ -295,7 +314,6 @@ function normalizeConfig(config) {
295
314
  }
296
315
  }
297
316
 
298
- // Handle `ignoreDir` in config file
299
317
  if ('ignoreDir' in normalized) {
300
318
  // Support both string (`libs,vendor`) and array (`["libs", "vendor"]`) formats
301
319
  if (Array.isArray(normalized.ignoreDir)) {
@@ -308,7 +326,7 @@ function normalizeConfig(config) {
308
326
 
309
327
  /** @type {Record<string, any>} */
310
328
  let config = {};
311
- program.option('-z, --zero', 'Minify all HTML files in the current folder and its subfolders in place (except node_modules), using comprehensive settings (standalone—flag is ignored when combined with other options)');
329
+ program.option('-z, --zero', 'Minify all HTML files in the current folder and its subfolders in place (except node_modules), using comprehensive settings (standalone—the flag is ignored when combined with other options)');
312
330
  program.option('-I --input-dir <dir>', 'Specify an input directory');
313
331
  program.option('-X --ignore-dir <patterns>', 'Exclude directories—relative to input directory—from processing (comma-separated, overrides config file setting)');
314
332
  program.option('-O --output-dir <dir>', 'Specify an output directory');
@@ -339,20 +357,18 @@ program.helpOption('-h, --help', 'Display help for command');
339
357
 
340
358
  const programOptions = program.opts();
341
359
 
342
- // Check if any `parseJSON` options consumed a filename as their value
343
- // If so, treat the option as boolean true and add the filename back to the files list
360
+ // A `parseJSON` option that consumed a filename as its value is `true`, and the
361
+ // file goes back on the list
344
362
  const jsonOptionKeys = ['minifyCss', 'minifyJs', 'minifyUrls'];
345
363
  for (const key of jsonOptionKeys) {
346
364
  const value = programOptions[key];
347
365
  if (typeof value === 'string' && /\.(html?|shtml?|xhtml?|php|xml|svg|jsx|tsx|vue|ejs|hbs|mustache|twig)$/i.test(value)) {
348
- // The option consumed a filename—inject it back
349
366
  programOptions[key] = true;
350
367
  capturedFiles.push(value);
351
368
  filesProvided = true;
352
369
  }
353
370
  }
354
371
 
355
- // If `--input` was specified, treat it as a positional file argument
356
372
  if (programOptions.input) {
357
373
  capturedFiles.unshift(programOptions.input);
358
374
  filesProvided = true;
@@ -392,7 +408,6 @@ program.helpOption('-h, --help', 'Display help for command');
392
408
  process.exit(0);
393
409
  }
394
410
 
395
- // Apply comprehensive preset for all processing
396
411
  programOptions.preset = 'comprehensive';
397
412
 
398
413
  const inputDirResolved = await fs.promises.realpath(cwd).catch(() => cwd);
@@ -551,9 +566,26 @@ program.helpOption('-h, --help', 'Display help for command');
551
566
  // Each worker warms up its own JIT, so the useful count tops out well short of the cores
552
567
  const WORKERS_MAX = 6;
553
568
 
569
+ /** @type {WeakMap<string[], Promise<number[]>>} */
570
+ const fileSizesByList = new WeakMap();
571
+
572
+ /**
573
+ * Byte size per file, read once per list whichever step asks first; a failed stat counts
574
+ * as 0, leaving normal file processing to report the read error with its usual wording
575
+ * @param {string[]} files
576
+ */
577
+ function getFileSizes(files) {
578
+ let sizes = fileSizesByList.get(files);
579
+ if (!sizes) {
580
+ sizes = Promise.all(files.map(file => fs.promises.stat(file).then(stat => stat.size, () => 0)));
581
+ fileSizesByList.set(files, sizes);
582
+ }
583
+ return sizes;
584
+ }
585
+
554
586
  /**
555
587
  * A pool for this run, or `null` where one wouldn’t pay or wouldn’t work—in which case
556
- * the caller minifies in process exactly as before
588
+ * the caller minifies in-process exactly as before
557
589
  * @param {string[]} files
558
590
  */
559
591
  async function createPool(files) {
@@ -563,7 +595,7 @@ program.helpOption('-h, --help', 'Display help for command');
563
595
  // Whether the run went wide is worth saying, since the default weighs the file
564
596
  // count and the bytes there are to share out, neither of which the caller sees
565
597
  const inProcess = () => {
566
- if (isVerbose) console.error('Worker threads: none (minifying in process)');
598
+ if (isVerbose) console.error('Worker threads: none (minifying in-process)');
567
599
  return null;
568
600
  };
569
601
  // `availableParallelism` reports what this process may actually use, which under a
@@ -580,10 +612,8 @@ program.helpOption('-h, --help', 'Display help for command');
580
612
  }
581
613
 
582
614
  if (isDefault && fileCount < FILES_PER_RUN_MIN) {
583
- // `stat()` is cheaper than starting workers and is only needed for a run that
584
- // would otherwise stay in-process. A failed stat leaves normal file processing
585
- // to report the read error with its usual filename and wording.
586
- const sizes = await Promise.all(files.map(file => fs.promises.stat(file).then(stat => stat.size, () => 0)));
615
+ // `stat()` is cheaper than starting workers, and a pooled run reuses the sizes
616
+ const sizes = await getFileSizes(files);
587
617
  // No single file is split across workers, so the largest one sets a floor no
588
618
  // pool can beat; what the rest carry is the work there is to share out
589
619
  const parallelBytes = sizes.reduce((sum, byteSize) => sum + byteSize, 0) - Math.max(0, ...sizes);
@@ -593,7 +623,7 @@ program.helpOption('-h, --help', 'Display help for command');
593
623
  }
594
624
 
595
625
  // `log` is a closure over this process’s console and is rebuilt inside the worker;
596
- // anything else unclonable (which the CLI itself never produces) stays in process
626
+ // anything else unclonable (such as a function from a module config) stays in-process
597
627
  const { log, ...options } = createOptions();
598
628
  try {
599
629
  structuredClone(options);
@@ -602,7 +632,7 @@ program.helpOption('-h, --help', 'Display help for command');
602
632
  }
603
633
 
604
634
  // A pool this small has nothing to share out and still pays for its workers, so an
605
- // explicit request for them lands in process as `--workers=1` does
635
+ // explicit request for them lands in-process as `--workers=1` does
606
636
  const poolSize = Math.min(size, fileCount);
607
637
  if (poolSize <= 1) {
608
638
  return inProcess();
@@ -626,8 +656,6 @@ program.helpOption('-h, --help', 'Display help for command');
626
656
  }
627
657
  }
628
658
 
629
- // Print a one-line-per-cache hits/misses/size summary to STDERR, skipping caches
630
- // that were never touched (e.g., their minifier is disabled)
631
659
  async function printCacheStats() {
632
660
  const { getCacheStats } = await import('./src/htmlminifier.js');
633
661
  const cacheStats = getCacheStats();
@@ -637,6 +665,7 @@ program.helpOption('-h, --help', 'Display help for command');
637
665
  /** @type {string[]} */
638
666
  const lines = [];
639
667
  for (const [key, { gets, hits, size, limit }] of Object.entries(cacheStats)) {
668
+ // Untouched caches (e.g., with their minifier disabled) are left out
640
669
  if (gets === 0) continue;
641
670
  const misses = gets - hits;
642
671
  lines.push(` ${labels[key]} cache: ${hits.toLocaleString()} hit${hits === 1 ? '' : 's'}, ${misses.toLocaleString()} miss${misses === 1 ? '' : 'es'}, ${size.toLocaleString()}/${limit.toLocaleString()} entries`);
@@ -672,7 +701,6 @@ program.helpOption('-h, --help', 'Display help for command');
672
701
 
673
702
  const stats = calculateStats(data, minified);
674
703
 
675
- // Show stats if dry run or verbose mode
676
704
  if (isDryRun || isVerbose) {
677
705
  console.error(` ${MARK_SUCCESS}✓${MARK_RESET} ${path.relative(process.cwd(), inputFile)}: ${stats.originalSize.toLocaleString()} → ${stats.minifiedSize.toLocaleString()} bytes (${stats.sign}${Math.abs(stats.saved).toLocaleString()}, ${stats.percentage}%)`);
678
706
  }
@@ -681,7 +709,7 @@ program.helpOption('-h, --help', 'Display help for command');
681
709
  return { originalSize: stats.originalSize, minifiedSize: stats.minifiedSize, saved: stats.saved };
682
710
  }
683
711
 
684
- await fs.promises.writeFile(outputFile, minified, { encoding: 'utf8' }).catch(err => {
712
+ await writeFileAtomic(outputFile, minified).catch(err => {
685
713
  fatal('Cannot write ' + outputFile + '\n' + err.message);
686
714
  });
687
715
 
@@ -707,7 +735,6 @@ program.helpOption('-h, --help', 'Display help for command');
707
735
  * @param {string[]} fileExtensions
708
736
  */
709
737
  function shouldProcessFile(filename, fileExtensions) {
710
- // Wildcard: process all files
711
738
  if (fileExtensions.includes('*')) {
712
739
  return true;
713
740
  }
@@ -717,7 +744,6 @@ program.helpOption('-h, --help', 'Display help for command');
717
744
  }
718
745
 
719
746
  /**
720
- * Parse comma-separated ignore patterns into an array.
721
747
  * @param {string} patterns - Comma-separated directory patterns (e.g., "libs,vendor")
722
748
  * @returns {string[]} Array of trimmed pattern strings with normalized separators
723
749
  */
@@ -780,7 +806,6 @@ program.helpOption('-h, --help', 'Display help for command');
780
806
  }
781
807
 
782
808
  if (lst.isDirectory()) {
783
- // Skip ignored directories
784
809
  if (shouldIgnoreDirectory(filePath, ignorePatterns, baseDir)) {
785
810
  continue;
786
811
  }
@@ -805,7 +830,7 @@ program.helpOption('-h, --help', 'Display help for command');
805
830
  const percentage = (ratio * 100).toFixed(1);
806
831
  process.stderr.write(`Processing ${current.toLocaleString()}/${total.toLocaleString()} (${percentage}%)`);
807
832
  } else {
808
- // Indeterminate progress - no total known yet
833
+ // Indeterminate progress—no total known yet
809
834
  process.stderr.write(`Processing ${current.toLocaleString()} files…`);
810
835
  }
811
836
  }
@@ -814,7 +839,6 @@ program.helpOption('-h, --help', 'Display help for command');
814
839
  process.stderr.write('\r\x1b[K'); // Clear the line
815
840
  }
816
841
 
817
- // Utility: concurrency runner
818
842
  /**
819
843
  * @template T, R
820
844
  * @param {T[]} items
@@ -926,8 +950,13 @@ program.helpOption('-h, --help', 'Display help for command');
926
950
  const pool = await createPool(list);
927
951
  if (pool) {
928
952
  try {
929
- await Promise.all(list.map(async (inputFile, idx) => {
930
- const outFile = await prepareOutDir(inputFile);
953
+ const { orderLargestFirst } = await import('./src/lib/file-pool.js');
954
+ const [fileSizes, tasks] = await Promise.all([
955
+ getFileSizes(list),
956
+ Promise.all(list.map(async (inputFile, idx) => ({ inputFile, outFile: await prepareOutDir(inputFile), idx })))
957
+ ]);
958
+ // `run()` queues synchronously, so the files reach the pool in exactly this order
959
+ await Promise.all(orderLargestFirst(tasks, fileSizes).map(async ({ inputFile, outFile, idx }) => {
931
960
  const sizes = await pool.run({ inputFile, outputFile: outFile, dryRun: isDryRun })
932
961
  .catch(err => {
933
962
  // A worker names the step it failed at, so the wording matches what this
@@ -962,7 +991,6 @@ program.helpOption('-h, --help', 'Display help for command');
962
991
  const writeMinify = async () => {
963
992
  const minifierOptions = createOptions();
964
993
 
965
- // Show config info if verbose
966
994
  if (programOptions.verbose || programOptions.dry) {
967
995
  getActiveOptionsDisplay(minifierOptions);
968
996
  }
@@ -990,7 +1018,6 @@ program.helpOption('-h, --help', 'Display help for command');
990
1018
  return;
991
1019
  }
992
1020
 
993
- // Show stats if verbose
994
1021
  if (programOptions.verbose) {
995
1022
  const inputSource = program.args.length > 0 ? program.args.join(', ') : 'STDIN';
996
1023
  console.error(` ${MARK_SUCCESS}✓${MARK_RESET} ${inputSource}: ${stats.originalSize.toLocaleString()} → ${stats.minifiedSize.toLocaleString()} bytes (${stats.sign}${Math.abs(stats.saved).toLocaleString()}, ${stats.percentage}%)`);
@@ -1000,7 +1027,7 @@ program.helpOption('-h, --help', 'Display help for command');
1000
1027
  if (programOptions.output) {
1001
1028
  try {
1002
1029
  await fs.promises.mkdir(path.dirname(programOptions.output), { recursive: true });
1003
- await fs.promises.writeFile(programOptions.output, minified, { encoding: 'utf8' });
1030
+ await writeFileAtomic(programOptions.output, minified);
1004
1031
  } catch (err) {
1005
1032
  fatal('Cannot write ' + programOptions.output + '\n' + errorMessage(err));
1006
1033
  }
@@ -1041,7 +1068,6 @@ program.helpOption('-h, --help', 'Display help for command');
1041
1068
  // `--dry` automatically enables verbose mode
1042
1069
  const isVerbose = programOptions.verbose || programOptions.dry;
1043
1070
 
1044
- // Show config info if verbose
1045
1071
  if (isVerbose) {
1046
1072
  const minifierOptions = createOptions();
1047
1073
  getActiveOptionsDisplay(minifierOptions);
@@ -1057,7 +1083,6 @@ program.helpOption('-h, --help', 'Display help for command');
1057
1083
  }
1058
1084
  let skipRootAbs;
1059
1085
  if (inputReal && outputReal && outputReal !== inputReal && outputReal.startsWith(inputReal + path.sep)) {
1060
- // Skip traversing into the output directory when it is nested inside the input directory
1061
1086
  skipRootAbs = outputReal;
1062
1087
  }
1063
1088
 
@@ -1065,15 +1090,12 @@ program.helpOption('-h, --help', 'Display help for command');
1065
1090
  console.error(`[DRY RUN] Would process directory: ${inputDir} → ${outputDir}`);
1066
1091
  }
1067
1092
 
1068
- // Set up progress indicator (only in TTY and when not verbose/dry)
1069
1093
  const showProgress = process.stderr.isTTY && !isVerbose;
1070
1094
  /** @type {Progress | null} */
1071
1095
  let progress = null;
1072
1096
 
1073
- // Parse ignore patterns
1074
1097
  const ignorePatterns = parseIgnorePatterns(resolvedIgnoreDir);
1075
1098
 
1076
- // Validate that the input directory exists and is readable
1077
1099
  try {
1078
1100
  const stat = await fs.promises.stat(inputDir);
1079
1101
  if (!stat.isDirectory()) {
@@ -1090,11 +1112,8 @@ program.helpOption('-h, --help', 'Display help for command');
1090
1112
  // Start with indeterminate progress, count in background
1091
1113
  progress = {current: 0, total: null};
1092
1114
 
1093
- // Note: `countFiles` runs asynchronously and mutates `progress.total` when complete.
1094
- // This shared-state mutation is safe because JavaScript is single-threaded—
1095
- // `updateProgress` may read `progress.total` as `null` initially,
1096
- // then see the updated value once `countFiles` resolves,
1097
- // transitioning the indicator from indeterminate to determinate progress without race conditions.
1115
+ // `countFiles` sets `progress.total` once it resolves (safe, as JavaScript is
1116
+ // single-threaded); until then, `updateProgress` reads `null` and shows no total
1098
1117
  const extensions = typeof resolvedFileExt === 'string' ? parseFileExtensions(resolvedFileExt) : resolvedFileExt;
1099
1118
  countFiles(inputDir, extensions, skipRootAbs, ignorePatterns, inputDirResolved).then(total => {
1100
1119
  if (progress) {
@@ -1107,7 +1126,6 @@ program.helpOption('-h, --help', 'Display help for command');
1107
1126
 
1108
1127
  const stats = await processDirectory(inputDir, outputDir, resolvedFileExt, programOptions.dry, isVerbose, skipRootAbs, progress, ignorePatterns, inputDirResolved);
1109
1128
 
1110
- // Show completion message and clear progress indicator
1111
1129
  if (progress) {
1112
1130
  clearProgress();
1113
1131
  console.error(`${MARK_SUCCESS}Processed ${progress.current.toLocaleString()} file${progress.current === 1 ? '' : 's'}.${MARK_RESET}`);
@@ -1128,10 +1146,9 @@ program.helpOption('-h, --help', 'Display help for command');
1128
1146
  await printCacheStats();
1129
1147
  }
1130
1148
  })();
1131
- } else if (filesProvided) { // Minifying one or more files specified on the CMD line
1149
+ } else if (filesProvided) { // Minifying one or more files specified on the command line
1132
1150
  // Process each file independently, then concatenate outputs
1133
1151
  const minifierOptions = createOptions();
1134
- // Show config info if verbose/dry
1135
1152
  if (programOptions.verbose || programOptions.dry) {
1136
1153
  getActiveOptionsDisplay(minifierOptions);
1137
1154
  }
@@ -1146,7 +1163,6 @@ program.helpOption('-h, --help', 'Display help for command');
1146
1163
  const concurrency = Math.max(1, Math.min(os.cpus().length || 4, 8));
1147
1164
  const inputs = capturedFiles.slice();
1148
1165
 
1149
- // Read originals and minify in parallel with bounded concurrency
1150
1166
  const originals = new Array(inputs.length);
1151
1167
  const outputs = new Array(inputs.length);
1152
1168
 
@@ -1188,7 +1204,7 @@ program.helpOption('-h, --help', 'Display help for command');
1188
1204
  if (programOptions.output) {
1189
1205
  try {
1190
1206
  await fs.promises.mkdir(path.dirname(programOptions.output), { recursive: true });
1191
- await fs.promises.writeFile(programOptions.output, minifiedCombined, 'utf8');
1207
+ await writeFileAtomic(programOptions.output, minifiedCombined);
1192
1208
  } catch (err) {
1193
1209
  fatal('Cannot write ' + programOptions.output + '\n' + errorMessage(err));
1194
1210
  }
@@ -9,15 +9,43 @@ export type HTMLAttribute = {
9
9
  };
10
10
  export type MinifierOptions = {
11
11
  /**
12
- * Predicate that determines whether whitespace inside a given element
13
- * can be collapsed.
12
+ * Predicate that determines whether runs of whitespace inside a given element
13
+ * can be collapsed (whether its content may be trimmed is up to `canTrimWhitespace`).
14
14
  *
15
15
  * Default: Built-in `canCollapseWhitespace` function
16
16
  */
17
17
  canCollapseWhitespace?: (tag: string, attrs: HTMLAttribute[], canCollapseWhitespace: (tag: string) => boolean) => boolean;
18
18
  /**
19
- * Predicate that determines whether leading/trailing whitespace around
20
- * the element may be trimmed.
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;
46
+ /**
47
+ * Predicate that determines whether whitespace inside the element may be
48
+ * trimmed; where not, it stays as written, as in `pre`.
21
49
  *
22
50
  * Default: Built-in `canTrimWhitespace` function
23
51
  */
@@ -53,9 +81,9 @@ export type MinifierOptions = {
53
81
  */
54
82
  cacheSVG?: number;
55
83
  /**
56
- * When true, tag and attribute names are treated as case-sensitive.
57
- * Useful for custom HTML tags.
58
- * If false (default) names are lower-cased via the `name` function.
84
+ * When true, tag and attribute names are written as in the source rather than in lowercase.
85
+ * Useful for framework components like `<MyButton>`. HTML names are still read in any case,
86
+ * so every option applies to them as without it; hooks get names as written.
59
87
  *
60
88
  * Default: `false`
61
89
  */
@@ -77,14 +105,33 @@ export type MinifierOptions = {
77
105
  * Default: `false`
78
106
  */
79
107
  collapseBooleanAttributes?: boolean;
108
+ /**
109
+ * Collapse attributes with empty values to their name only (for example
110
+ * `alt=""` → `alt`), which the HTML parser reads the same way.
111
+ *
112
+ * Default: `false`
113
+ */
114
+ collapseEmptyAttributes?: boolean;
80
115
  /**
81
116
  * When false (default) whitespace around `inline` tags is preserved in
82
- * more cases. When true, whitespace around inline tags may be collapsed.
117
+ * more cases. When true, whitespace between inline tags may be collapsed,
118
+ * except around text-level elements (like `a`, `code`, or `em`); whitespace
119
+ * next to text is kept as without the option.
83
120
  * Must also enable `collapseWhitespace` to have effect.
84
121
  *
85
122
  * Default: `false`
86
123
  */
87
124
  collapseInlineTagWhitespace?: boolean;
125
+ /**
126
+ * Remove whitespace next to a no-break space (`U+00A0`), narrow no-break
127
+ * space (`U+202F`), or figure space (`U+2007`) in text (for example
128
+ * `a &nbsp; b` → `a&nbsp;b`), which changes how the text renders. Runs of
129
+ * no-break spaces are kept.
130
+ * Must also enable `collapseWhitespace` to have effect.
131
+ *
132
+ * Default: `false`
133
+ */
134
+ collapseNoBreakSpaces?: boolean;
88
135
  /**
89
136
  * Collapse multiple whitespace characters into one where allowed. Also
90
137
  * controls trimming behaviour in several code paths.
@@ -171,9 +218,9 @@ export type MinifierOptions = {
171
218
  * Array of regexes used to identify fragments that should be
172
219
  * preserved (for example server templates). These fragments are temporarily
173
220
  * replaced during minification to avoid corrupting template code.
174
- * The default preserves ASP/PHP-style tags.
221
+ * The default preserves ASP/PHP-style tags and XML declarations.
175
222
  *
176
- * Default: `[/<%[\s\S]*?%>/, /<\?[\s\S]*?\?>/]`
223
+ * Default: `[/<%[\s\S]*?%>/, /<\?(?:php[\t\n\r ]|=|\$|xml(?:-stylesheet)?(?![\w-])|\s)[\s\S]*?\?>/i]`
177
224
  */
178
225
  ignoreCustomFragments?: RegExp[];
179
226
  /**
@@ -216,7 +263,8 @@ export type MinifierOptions = {
216
263
  maxInputLength?: number;
217
264
  /**
218
265
  * Maximum line length for the output. When set the minifier will wrap
219
- * output to the given number of characters where possible.
266
+ * output to the given number of characters where possible, splitting
267
+ * lines only in tags—between attributes or before a tag’s `>`.
220
268
  *
221
269
  * Default: No limit
222
270
  */
@@ -238,7 +286,7 @@ export type MinifierOptions = {
238
286
  *
239
287
  * Default: `false`
240
288
  */
241
- minifyCSS?: boolean | Partial<import("lightningcss").TransformOptions<import("lightningcss").CustomAtRules>> | ((text: string, type?: string) => Promise<string> | string);
289
+ minifyCSS?: boolean | Partial<import("@ohos-ports/lightningcss").TransformOptions<import("@ohos-ports/lightningcss").CustomAtRules>> | ((text: string, type?: string) => Promise<string> | string);
242
290
  /**
243
291
  * When true, enables JS minification for `<script>` contents and
244
292
  * event handler attributes. If an object is provided, it can include:
@@ -270,16 +318,18 @@ export type MinifierOptions = {
270
318
  } | ((text: string) => Promise<string> | string);
271
319
  /**
272
320
  * 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.
321
+ * Complete SVG subtrees are extracted and optimized as a block, with the SVGO
322
+ * plugins that assume a standalone SVG file turned off.
323
+ * If an object is provided, it is passed to SVGO as configuration options; unless
324
+ * it sets `plugins`, it keeps that plugin set.
275
325
  * If disabled, SVG content is minified using standard HTML rules only.
276
326
  *
277
327
  * Default: `false`
278
328
  */
279
329
  minifySVG?: boolean | Object;
280
330
  /**
281
- * When wrapping lines, prevent inserting a newline directly before a
282
- * closing tag (useful to keep tags like `</a>` on the same line).
331
+ * When wrapping lines, never split a line in an end tag (e.g., keeps
332
+ * `</a>` from becoming `</a` and `>` on two lines).
283
333
  *
284
334
  * Default: `false`
285
335
  */
@@ -367,7 +417,7 @@ export type MinifierOptions = {
367
417
  removeEmptyAttributes?: boolean | ((attrName: string, tag: string) => boolean);
368
418
  /**
369
419
  * Remove elements that are empty and safe to remove (for example
370
- * `<script />` without `src`).
420
+ * `<script />` without `src`), including elements left empty that way.
371
421
  * See also: https://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements
372
422
  *
373
423
  * Default: `false`
@@ -380,21 +430,23 @@ export type MinifierOptions = {
380
430
  * Accepts tag names or HTML-like element specifications:
381
431
  *
382
432
  * * Tag name only: `["td", "span"]`—preserves all empty elements of these types
383
- * * With valued attributes: `["<span aria-hidden='true'>"]`—preserves only when attribute values match
384
- * * With boolean attributes: `["<input disabled>"]`—preserves only when boolean attribute is present
433
+ * * With valued attributes: `["<i class='test'>"]`—preserves only when attribute values match
434
+ * * With boolean attributes: `["<input disabled>"]`—preserves only when the
435
+ * boolean attribute is present
385
436
  * * Mixed: `["<button type='button' disabled>"]`—all specified attributes must match
386
437
  *
387
438
  * Attribute matching:
388
439
  *
389
440
  * * All specified attributes must be present and match (valued attributes must have exact values)
390
441
  * * Additional attributes on the element are allowed
391
- * * Attribute name matching respects the `caseSensitive` option
442
+ * * Element and attribute names match in any case
392
443
  * * Supports double quotes, single quotes, and unquoted attribute values in specifications
393
444
  *
394
445
  * Limitations:
395
446
  *
396
447
  * * Self-closing syntax (e.g., `["<span/>"]`) is not supported; use `["span"]` instead
397
- * * Definitions containing `>` within quoted attribute values (e.g., `["<span title='a>b'>"]`) are not supported
448
+ * * Definitions containing `>` within quoted attribute values (e.g.,
449
+ * `["<span title='a>b'>"]`) are not supported
398
450
  *
399
451
  * Default: `[]`
400
452
  */
@@ -426,16 +478,16 @@ export type MinifierOptions = {
426
478
  */
427
479
  removeTagWhitespace?: boolean;
428
480
  /**
429
- * **Note that this can change how a document renders!**
430
- *
431
- * Remove rules from `style` elements whose class or ID selectors the document
432
- * never references. Requires `minifyCSS` (removal runs through Lightning CSS)
433
- * and has no effect on `style` or `media` attributes.
481
+ * Remove selectors from `style` elements that name an element, class, or ID the
482
+ * document doesn’t reference, as well as rules that are left without selectors.
483
+ * Requires `minifyCSS` (removal runs through Lightning CSS) and has no effect on
484
+ * `style` or `media` attributes.
434
485
  *
435
- * Class names and IDs are collected from the markup, from `data-*` attributes,
436
- * and—unless `scripts` is set to `false`—from inline `script` elements. Names
437
- * that only ever appear in external scripts cannot be detected; list those
438
- * under `safelist` (strings or regular expressions) to keep them.
486
+ * Element, class, and ID names are collected from the markup and—unless `scripts`
487
+ * is set to `false`—from inline `script` elements; class names and IDs also from
488
+ * `data-*` attributes. Names that only ever appear in external scripts cannot
489
+ * be detected; list those under `safelist` (strings or regular expressions) to
490
+ * keep them.
439
491
  *
440
492
  * Default: `false`
441
493
  */
@@ -462,9 +514,10 @@ export type MinifierOptions = {
462
514
  */
463
515
  sortClassNames?: boolean | ((value: string) => string);
464
516
  /**
465
- * When true, whitespace around ignored custom fragments may be trimmed
466
- * more aggressively. This affects how preserved fragments interact with
467
- * surrounding whitespace collapse.
517
+ * When true, whitespace around ignored custom fragments is removed rather
518
+ * than collapsed where the minifier removes whitespace anyway (e.g., between
519
+ * block-level elements). Whitespace in tags, attribute values, CSS, and
520
+ * JavaScript is kept.
468
521
  *
469
522
  * Default: `false`
470
523
  */
@@ -532,6 +585,7 @@ declare const _default: {
532
585
  comprehensive: {
533
586
  collapseAttributeWhitespace: boolean;
534
587
  collapseBooleanAttributes: boolean;
588
+ collapseEmptyAttributes: boolean;
535
589
  collapseWhitespace: boolean;
536
590
  decodeEntities: boolean;
537
591
  mergeScripts: boolean;
@@ -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;AAsE/D,YAAkB,aAAa,GAI/B;IAAe,IAAI,EAAZ,MAAM,CACb;IAAgB,KAAK,AAArB,CACA,EADO,MAAM,CACb;IAAgB,KAAK,AAArB,CACA,EADO,MAAM,CACb;IAAgB,YAAY,AAA5B,CACA,EADO,MAAM,CACb;IAAgB,UAAU,AAA1B,CACA,EADO,MAAM,CACb;IAAgB,WAAW,AAA3B,CAA4B,EAArB,MAAM,CAAe;CAAA,CAAA;AAI5B,YAAkB,eAAe,GAIjC;;;;;;;IAA2G,qBAAqB,AAAhI,CAMA,EANO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,qBAAqB,EAAE,CA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