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 OxideEngine Scanner calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b["formattedMappings()"]
  685d98f0_f223_dedf_cfba_bbdb2dc11d1d["source-map.test.ts"]
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b -->|defined in| 685d98f0_f223_dedf_cfba_bbdb2dc11d1d
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb["run()"]
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb -->|calls| bcca3c2e_b934_8f1e_1d12_56bb89daae2b
  f28c8284_0ba1_baec_355a_ee2413e33842["formatRange()"]
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b -->|calls| f28c8284_0ba1_baec_355a_ee2413e33842
  style bcca3c2e_b934_8f1e_1d12_56bb89daae2b 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