Home / Function/ formattedMappings() — tailwindcss Function Reference

formattedMappings() — tailwindcss Function Reference

Architecture documentation for the formattedMappings() function in source-map.test.ts from the tailwindcss codebase.

Function typescript OxideCore Scanner calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  04267aa2_616f_ba33_2ef5_6f8ad86d4dd3["formattedMappings()"]
  dc201492_c44d_eb89_f00f_16255f344c27["run()"]
  dc201492_c44d_eb89_f00f_16255f344c27 -->|calls| 04267aa2_616f_ba33_2ef5_6f8ad86d4dd3
  ab728c6b_ae2a_ac38_c6ab_c4cadb282ea4["formatRange()"]
  04267aa2_616f_ba33_2ef5_6f8ad86d4dd3 -->|calls| ab728c6b_ae2a_ac38_c6ab_c4cadb282ea4
  style 04267aa2_616f_ba33_2ef5_6f8ad86d4dd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/source-maps/source-map.test.ts lines 92–130

function formattedMappings(map: RawSourceMap) {
  const smc = new SourceMapConsumer(map)
  const annotations: Record<
    number,
    {
      original: { start: [number, number]; end: [number, number] }
      generated: { start: [number, number]; end: [number, number] }
      source: string
    }
  > = {}

  smc.eachMapping((mapping) => {
    let annotation = (annotations[mapping.generatedLine] = annotations[mapping.generatedLine] || {
      ...mapping,

      original: {
        start: [mapping.originalLine, mapping.originalColumn],
        end: [mapping.originalLine, mapping.originalColumn],
      },

      generated: {
        start: [mapping.generatedLine, mapping.generatedColumn],
        end: [mapping.generatedLine, mapping.generatedColumn],
      },

      source: mapping.source,
    })

    annotation.generated.end[0] = mapping.generatedLine
    annotation.generated.end[1] = mapping.generatedColumn

    annotation.original.end[0] = mapping.originalLine!
    annotation.original.end[1] = mapping.originalColumn!
  })

  return Object.values(annotations).map((annotation) => {
    return `${annotation.source}: ${formatRange(annotation.generated)} <- ${formatRange(annotation.original)}`
  })
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does formattedMappings() do?
formattedMappings() is a function in the tailwindcss codebase.
What does formattedMappings() call?
formattedMappings() calls 1 function(s): formatRange.
What calls formattedMappings()?
formattedMappings() is called by 1 function(s): run.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free