const native = globalThis.__ssqch.natives["ssqch/minify"];
const OPTIONS = [ "collapseWhitespace", "removeComments", "shortDoctype" ];
export function minifyPlugin( options = {} ) {
return { name: "ssqch/minify", builtin: "ssqch/minify", options };
}
export function minify( html, options = {} ) {
for ( const key of Object.keys( options ) ) {
if ( !OPTIONS.includes( key ) ) throw new TypeError( `minify(): unknown option "${ key }" (options: ${ OPTIONS.join( ", " ) })` );
}
const { collapseWhitespace = true, removeComments = true, shortDoctype = true } = options;
return native.minify( String( html ), Boolean( collapseWhitespace ), Boolean( removeComments ), Boolean( shortDoctype ) );
}