emotion/scripts/test-utils/pretty-css.js
Mateusz Burzyński d8ff8a5990
Update Preconstruct and use import conditions (#3198)
* Update Preconstruct and use import conditions

* remove is-development redundant conditions

* is-browser condition

* default is-browser to a runtime check

* remove top-level browser fields

* remove top-level browser entries from extra entrypoints

* remove yet another top-level browser field from an entrypoint

* remove yet another top-level browser field from an entrypoint

* use modern moduleResolution

* fixes site config

* add paths to handle older ts versions in type tests

* fix dtslint, hopefully

* use development condiiton by default in tests

* try to run without the browser condition

* add prod tests

* fix gate types

* hijack insertedRules

* changesets
2024-07-19 14:50:01 +02:00

29 lines
552 B
JavaScript

import prettify from '@emotion/css-prettifier'
/*
type StyleSheet = {
tags: Array<HTMLStyleElement>
}
*/
export default {
test: val => val && val.tags !== undefined && Array.isArray(val.tags),
serialize(
val /* : StyleSheet */,
config,
indentation /* : string */,
depth /* : number */,
refs,
printer /* : Function */
) {
let styles = val.tags.map(tag => tag.textContent || '').join('')
return printer(
prettify(styles, config.indent),
config,
indentation,
depth,
refs
)
}
}