custom-serializer.ts — tailwindcss Source File
Architecture documentation for custom-serializer.ts, a typescript file in the tailwindcss codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9fa28cda_9316_110b_b56a_cb506aee9aca["custom-serializer.ts"] 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 9fa28cda_9316_110b_b56a_cb506aee9aca --> 696bd648_5f24_1b59_8e8b_7a97a692869e style 9fa28cda_9316_110b_b56a_cb506aee9aca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { SnapshotSerializer } from 'vitest'
// We're reducing the precision of parameters to the `oklab()` function from
// our snapshots as we've observed lightningcss generating different decimal
// places in the last position when run on different operating systems.
const HIGH_PRECISION_COLOR_FUNCTION =
/(oklab\(|oklch\(|lab\(|lch\()\d{1,2}\.?\d{0,4}% -?\d{0,2}\.(\d{4,8}) -?\d{0,2}.(\d{4,8}) \/ \.\d{1,2}\)/g
export default {
test(val) {
return typeof val === 'string' && val.match(HIGH_PRECISION_COLOR_FUNCTION) !== null
},
serialize(val, config, indentation, depth, refs, printer) {
if (typeof val !== 'string') {
throw new Error('This was already tested in the test() callback')
}
let replaced = val.replaceAll(HIGH_PRECISION_COLOR_FUNCTION, (match, _, first, second) => {
return match.replaceAll(first, first.slice(0, 3)).replaceAll(second, second.slice(0, 3))
})
return printer(replaced, config, indentation, depth, refs)
},
} satisfies SnapshotSerializer
Domain
Subdomains
Functions
Dependencies
- vitest
Source
Frequently Asked Questions
What does custom-serializer.ts do?
custom-serializer.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in custom-serializer.ts?
custom-serializer.ts defines 2 function(s): default.serialize, default.test.
What does custom-serializer.ts depend on?
custom-serializer.ts imports 1 module(s): vitest.
Where is custom-serializer.ts in the architecture?
custom-serializer.ts is located at packages/tailwindcss/src/test-utils/custom-serializer.ts (domain: OxideEngine, subdomain: PreProcessors, directory: packages/tailwindcss/src/test-utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free