1- import * as CleanCSS from "clean-css" ;
2- import RelateUrl = require ( "relateurl" ) ;
1+ import type * as CleanCSS from "clean-css" ;
2+ import type * as RelateUrl from "relateurl" ;
33import type * as Terser from "terser" with { "resolution-mode" : "import" } ;
44
5- export function minify ( value : string , options ?: MinifierOptions ) : Promise < string > ;
6-
7- declare namespace _default {
8- export { type MinifierOptions , minify } ;
9- }
10-
11- export { _default as default } ;
12-
135/**
146 * Most of the options are disabled by default
157 */
168export interface MinifierOptions {
179 /**
18- * Treat attributes in case sensitive manner (useful for custom HTML tags)
10+ * Treat attributes in case- sensitive manner (useful for custom HTML tags)
1911 * @default false
2012 */
2113 caseSensitive ?: boolean ;
@@ -119,12 +111,24 @@ export interface MinifierOptions {
119111 */
120112 includeAutoGeneratedTags ?: boolean ;
121113
114+ /**
115+ * Array of custom element names to treat as inline, along with the built-in ones
116+ * @default []
117+ */
118+ inlineCustomElements ?: ArrayLike < string > ;
119+
122120 /**
123121 * Keep the trailing slash on singleton elements
124122 * @default false
125123 */
126124 keepClosingSlash ?: boolean ;
127125
126+ /**
127+ * Function for logging (`message` is usually a string or an Error)
128+ * @default undefined
129+ */
130+ log ?: ( message : unknown ) => void ;
131+
128132 /**
129133 * Maximum input length to prevent ReDoS attacks (disabled by default)
130134 * @default undefined
@@ -143,26 +147,23 @@ export interface MinifierOptions {
143147 *
144148 * @default false
145149 */
146- minifyCSS ?: boolean | CleanCSS . Options | ( ( text : string , type ?: string ) => string ) ;
150+ minifyCSS ?: boolean | CleanCSS . Options | ( ( text : string , type ?: string ) => string | Promise < string > ) ;
147151
148152 /**
149153 * Minify JavaScript in script elements and event attributes
150154 * (uses [Terser](https://github.com/terser/terser))
151155 *
152- * This property is loosely typed due to dtslint restrictions.
153- * It also accepts `import("terser").MinifyOptions`
154- *
155156 * @default false
156157 */
157- minifyJS ?: boolean | Terser . MinifyOptions | ( ( text : string , inline ?: boolean ) => string ) ;
158+ minifyJS ?: boolean | Terser . MinifyOptions | ( ( text : string , inline ?: boolean ) => string | Promise < string > ) ;
158159
159160 /**
160161 * Minify URLs in various attributes
161162 * (uses [relateurl](https://github.com/stevenvachon/relateurl))
162163 *
163164 * @default false
164165 */
165- minifyURLs ?: boolean | string | RelateUrl . Options | ( ( text : string ) => string ) ;
166+ minifyURLs ?: boolean | string | RelateUrl . Options | ( ( text : string ) => string | Promise < string > ) ;
166167
167168 /**
168169 * Never add a newline before a tag that closes an element
@@ -199,9 +200,9 @@ export interface MinifierOptions {
199200 processScripts ?: string [ ] ;
200201
201202 /**
202- * Type of quote to use for attribute values (“'” or “"” )
203+ * Type of quote to use for attribute values (`'` or `"` )
203204 */
204- quoteCharacter ?: string ;
205+ quoteCharacter ?: "'" | "\"" ;
205206
206207 /**
207208 * [Remove quotes around attributes when possible](http://perfectionkills.com/experimenting-with-html-minifier#remove_attribute_quotes)
@@ -285,3 +286,8 @@ export interface MinifierOptions {
285286 */
286287 useShortDoctype ?: boolean ;
287288}
289+
290+ export function minify ( value : string , options ?: MinifierOptions ) : Promise < string > ;
291+
292+ declare const _default : { minify : typeof minify } ;
293+ export default _default ;
0 commit comments