html-minifier-next 4.17.0 → 4.17.1
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/cli.js +2 -1
- package/dist/htmlminifier.cjs +16 -1
- package/dist/htmlminifier.esm.bundle.js +16 -1
- package/dist/types/lib/options.d.ts.map +1 -1
- package/dist/types/presets.d.ts +0 -1
- package/dist/types/presets.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/lib/options.js +17 -0
- package/src/presets.js +0 -1
package/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* html-minifier-next CLI tool
|
|
4
5
|
*
|
|
@@ -324,7 +325,7 @@ program.option('--file-ext <extensions>', 'Specify file extension(s) to process
|
|
|
324
325
|
if (presetName) {
|
|
325
326
|
const preset = getPreset(presetName);
|
|
326
327
|
if (!preset) {
|
|
327
|
-
fatal(`Unknown preset
|
|
328
|
+
fatal(`Unknown preset “${presetName}”. Available presets: ${getPresetNames().join(', ')}`);
|
|
328
329
|
}
|
|
329
330
|
Object.assign(options, preset);
|
|
330
331
|
}
|
package/dist/htmlminifier.cjs
CHANGED
|
@@ -778,7 +778,6 @@ const presets = {
|
|
|
778
778
|
comprehensive: {
|
|
779
779
|
caseSensitive: true,
|
|
780
780
|
collapseBooleanAttributes: true,
|
|
781
|
-
collapseInlineTagWhitespace: true,
|
|
782
781
|
collapseWhitespace: true,
|
|
783
782
|
continueOnParseError: true,
|
|
784
783
|
decodeEntities: true,
|
|
@@ -1830,9 +1829,25 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, cssM
|
|
|
1830
1829
|
});
|
|
1831
1830
|
};
|
|
1832
1831
|
|
|
1832
|
+
// Apply preset first if specified (so user options can override preset values)
|
|
1833
|
+
if (inputOptions.preset) {
|
|
1834
|
+
const preset = getPreset(inputOptions.preset);
|
|
1835
|
+
if (preset) {
|
|
1836
|
+
Object.assign(options, preset);
|
|
1837
|
+
} else {
|
|
1838
|
+
const available = getPresetNames().join(', ');
|
|
1839
|
+
console.warn(`HTML Minifier Next: Unknown preset “${inputOptions.preset}”. Available presets: ${available}`);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1833
1843
|
Object.keys(inputOptions).forEach(function (key) {
|
|
1834
1844
|
const option = inputOptions[key];
|
|
1835
1845
|
|
|
1846
|
+
// Skip preset key—it’s already been processed
|
|
1847
|
+
if (key === 'preset') {
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1836
1851
|
if (key === 'caseSensitive') {
|
|
1837
1852
|
if (option) {
|
|
1838
1853
|
options.name = identity;
|
|
@@ -3390,7 +3390,6 @@ const presets = {
|
|
|
3390
3390
|
comprehensive: {
|
|
3391
3391
|
caseSensitive: true,
|
|
3392
3392
|
collapseBooleanAttributes: true,
|
|
3393
|
-
collapseInlineTagWhitespace: true,
|
|
3394
3393
|
collapseWhitespace: true,
|
|
3395
3394
|
continueOnParseError: true,
|
|
3396
3395
|
decodeEntities: true,
|
|
@@ -6972,9 +6971,25 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, cssM
|
|
|
6972
6971
|
});
|
|
6973
6972
|
};
|
|
6974
6973
|
|
|
6974
|
+
// Apply preset first if specified (so user options can override preset values)
|
|
6975
|
+
if (inputOptions.preset) {
|
|
6976
|
+
const preset = getPreset(inputOptions.preset);
|
|
6977
|
+
if (preset) {
|
|
6978
|
+
Object.assign(options, preset);
|
|
6979
|
+
} else {
|
|
6980
|
+
const available = getPresetNames().join(', ');
|
|
6981
|
+
console.warn(`HTML Minifier Next: Unknown preset “${inputOptions.preset}”. Available presets: ${available}`);
|
|
6982
|
+
}
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6975
6985
|
Object.keys(inputOptions).forEach(function (key) {
|
|
6976
6986
|
const option = inputOptions[key];
|
|
6977
6987
|
|
|
6988
|
+
// Skip preset key—it’s already been processed
|
|
6989
|
+
if (key === 'preset') {
|
|
6990
|
+
return;
|
|
6991
|
+
}
|
|
6992
|
+
|
|
6978
6993
|
if (key === 'caseSensitive') {
|
|
6979
6994
|
if (option) {
|
|
6980
6995
|
options.name = identity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/lib/options.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/lib/options.js"],"names":[],"mappings":"AAYA,6DAUC;AAID;;;;;;;;;;GAUG;AACH,6CAVW,OAAO,CAAC,eAAe,CAAC,0FAEhC;IAAuB,eAAe;IACf,SAAS;IACT,MAAM;CAA2B,GAI9C,eAAe,CA4V3B"}
|
package/dist/types/presets.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export namespace presets {
|
|
|
28
28
|
export let caseSensitive: boolean;
|
|
29
29
|
let collapseBooleanAttributes_1: boolean;
|
|
30
30
|
export { collapseBooleanAttributes_1 as collapseBooleanAttributes };
|
|
31
|
-
export let collapseInlineTagWhitespace: boolean;
|
|
32
31
|
let collapseWhitespace_1: boolean;
|
|
33
32
|
export { collapseWhitespace_1 as collapseWhitespace };
|
|
34
33
|
let continueOnParseError_1: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/presets.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/presets.js"],"names":[],"mappings":"AAgDA;;;;GAIG;AACH,gCAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAMvB;AAED;;;GAGG;AACH,kCAFa,MAAM,EAAE,CAIpB"}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"description": "Super-configurable, well-tested, JavaScript-based HTML minifier (enhanced successor of HTML Minifier)",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@commitlint/cli": "^20.
|
|
18
|
+
"@commitlint/cli": "^20.3.0",
|
|
19
19
|
"@eslint/js": "^9.39.2",
|
|
20
20
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
21
21
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
},
|
|
99
99
|
"type": "module",
|
|
100
100
|
"types": "./dist/types/htmlminifier.d.ts",
|
|
101
|
-
"version": "4.17.
|
|
101
|
+
"version": "4.17.1"
|
|
102
102
|
}
|
package/src/lib/options.js
CHANGED
|
@@ -6,6 +6,7 @@ import { RE_TRAILING_SEMICOLON } from './constants.js';
|
|
|
6
6
|
import { canCollapseWhitespace, canTrimWhitespace } from './whitespace.js';
|
|
7
7
|
import { wrapCSS, unwrapCSS } from './content.js';
|
|
8
8
|
import { getSVGMinifierOptions } from './svg.js';
|
|
9
|
+
import { getPreset, getPresetNames } from '../presets.js';
|
|
9
10
|
|
|
10
11
|
// Helper functions
|
|
11
12
|
|
|
@@ -84,9 +85,25 @@ const processOptions = (inputOptions, { getLightningCSS, getTerser, getSwc, cssM
|
|
|
84
85
|
});
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
// Apply preset first if specified (so user options can override preset values)
|
|
89
|
+
if (inputOptions.preset) {
|
|
90
|
+
const preset = getPreset(inputOptions.preset);
|
|
91
|
+
if (preset) {
|
|
92
|
+
Object.assign(options, preset);
|
|
93
|
+
} else {
|
|
94
|
+
const available = getPresetNames().join(', ');
|
|
95
|
+
console.warn(`HTML Minifier Next: Unknown preset “${inputOptions.preset}”. Available presets: ${available}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
87
99
|
Object.keys(inputOptions).forEach(function (key) {
|
|
88
100
|
const option = inputOptions[key];
|
|
89
101
|
|
|
102
|
+
// Skip preset key—it’s already been processed
|
|
103
|
+
if (key === 'preset') {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
90
107
|
if (key === 'caseSensitive') {
|
|
91
108
|
if (option) {
|
|
92
109
|
options.name = identity;
|