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 Oxide Extractor calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e["formattedMappings()"]
  b481c171_0dab_e8e5_e9d7_4ad779fa96da["source-map.test.ts"]
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e -->|defined in| b481c171_0dab_e8e5_e9d7_4ad779fa96da
  efd01c94_d25c_cc34_c144_f7242c307fca["run()"]
  efd01c94_d25c_cc34_c144_f7242c307fca -->|calls| 2a01344b_c5b0_dcf1_e07d_40f1d5d4790e
  507c448e_5842_d4c4_3fb0_f2bef2d0ea41["formatRange()"]
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e -->|calls| 507c448e_5842_d4c4_3fb0_f2bef2d0ea41
  style 2a01344b_c5b0_dcf1_e07d_40f1d5d4790e 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, defined in packages/tailwindcss/src/source-maps/source-map.test.ts.
Where is formattedMappings() defined?
formattedMappings() is defined in packages/tailwindcss/src/source-maps/source-map.test.ts at line 92.
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