html-minifier
Version:
Highly effective, super-configurable, well-tested web page minifier
50 lines • 2.13 kB
TypeScript
/**
* HTML element tag omission rules
*/
import type { HTMLAttribute } from './attributes.js';
import type { ProcessedOptions } from './options.js';
/** @import { HTMLAttribute } from './attributes.js' */
/** @import { ProcessedOptions } from './options.js' */
/**
* @param {string} optionalStartTag
* @param {string} tag
*/
declare function canRemoveParentTag(optionalStartTag: string, tag: string): boolean;
/**
* @param {string} optionalEndTag
* @param {string} tag
*/
declare function isStartTagMandatory(optionalEndTag: string, tag: string): boolean;
/**
* @param {string} optionalEndTag
* @param {string} tag
*/
declare function canRemovePrecedingTag(optionalEndTag: string, tag: string): boolean;
/**
* @param {string} tag
* @param {HTMLAttribute[]} attrs
* @param {ProcessedOptions} options
* @param {string} [tagOut] - As hooks get it
*/
declare function canRemoveElement(tag: string, attrs: HTMLAttribute[], options: ProcessedOptions, tagOut?: string): boolean;
/**
* @param {string[]} input - Array of element specifications from `removeEmptyElementsExcept` option
* @param {ProcessedOptions} options - Options object for parsing
* @returns {Array<{tag: string, attrs: Object.<string, string|undefined>|null}>} Array of parsed element specs
*/
declare function parseRemoveEmptyElementsExcept(input: string[], options: ProcessedOptions): Array<{
tag: string;
attrs: Record<string, string | undefined> | null;
}>;
/**
* @param {string} tag - Element tag name
* @param {HTMLAttribute[]} attrs - Array of element attributes
* @param {Array<{tag: string, attrs: Object.<string, string|undefined>|null}>} preserveList - Parsed preserve specs
* @returns {boolean} True if the empty element should be preserved
*/
declare function shouldPreserveEmptyElement(tag: string, attrs: HTMLAttribute[], preserveList: Array<{
tag: string;
attrs: Record<string, string | undefined> | null;
}>): boolean;
export { canRemoveParentTag, isStartTagMandatory, canRemovePrecedingTag, canRemoveElement, parseRemoveEmptyElementsExcept, shouldPreserveEmptyElement };
//# sourceMappingURL=elements.d.ts.map