@@ -319,7 +319,6 @@ export function format(css, { minify = false } = {}) {
319319 . replace ( / c a l c \( ( [ ^ * ] * ) \* ( [ ^ * ] ) / g, 'calc($1 * $2' ) // force correct whitespace around * in calc()
320320 . replace ( / \s + / g, SPACE ) // collapse multiple whitespaces into one
321321 . replace ( / s e l e c t o r | u r l | s u p p o r t s | l a y e r \( / ig, ( match ) => lowercase ( match ) ) // lowercase function names
322-
323322 }
324323
325324 /** @param {import('css-tree').Declaration } node */
@@ -439,32 +438,26 @@ export function format(css, { minify = false } = {}) {
439438 return indent ( indent_level ) + substr ( node ) . trim ( )
440439 }
441440
442- /** @param {import('css-tree').CssNode } node */
443- function print ( node ) {
444- let buffer = EMPTY_STRING
445-
446- /** @type {import('css-tree').List<import('css-tree').CssNode> } */
447- // @ts -expect-error Property 'children' does not exist on type 'AnPlusB', but we're never using that
448- let children = node . children
449-
450- children . forEach ( ( child , item ) => {
451- if ( child . type === TYPE_RULE ) {
452- buffer += print_rule ( child )
453- } else if ( child . type === TYPE_ATRULE ) {
454- buffer += print_atrule ( child )
455- } else {
456- buffer += print_unknown ( child , indent_level )
457- }
441+ /** @type {import('css-tree').List<import('css-tree').CssNode> } */
442+ // @ts -expect-error Property 'children' does not exist on type 'AnPlusB', but we're never using that
443+ let children = ast . children
444+ let buffer = EMPTY_STRING
458445
459- if ( item . next !== null ) {
460- buffer += NEWLINE + NEWLINE
461- }
462- } )
446+ children . forEach ( ( child , item ) => {
447+ if ( child . type === TYPE_RULE ) {
448+ buffer += print_rule ( child )
449+ } else if ( child . type === TYPE_ATRULE ) {
450+ buffer += print_atrule ( child )
451+ } else {
452+ buffer += print_unknown ( child , indent_level )
453+ }
463454
464- return buffer
465- }
455+ if ( item . next !== null ) {
456+ buffer += NEWLINE + NEWLINE
457+ }
458+ } )
466459
467- return print ( ast )
460+ return buffer
468461}
469462
470463/**
0 commit comments