Home / Function/ createTranslationMap() — tailwindcss Function Reference

createTranslationMap() — tailwindcss Function Reference

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

Function typescript OxideCore Scanner calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  bb31abbc_7fee_b057_cbe4_7ee1725378c5["createTranslationMap()"]
  5898a47f_729b_b30c_bf7b_865876b2750a["analyze()"]
  5898a47f_729b_b30c_bf7b_865876b2750a -->|calls| bb31abbc_7fee_b057_cbe4_7ee1725378c5
  85813fc9_ab7d_8f75_33b7_a217e8daf5ee["createLineTable()"]
  bb31abbc_7fee_b057_cbe4_7ee1725378c5 -->|calls| 85813fc9_ab7d_8f75_33b7_a217e8daf5ee
  style bb31abbc_7fee_b057_cbe4_7ee1725378c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/source-maps/source-map.ts lines 165–198

export function createTranslationMap({
  original,
  generated,
}: {
  original: string
  generated: string
}) {
  // Compute line tables for both the original and generated source lazily so we
  // don't have to do it during parsing or printing.
  let originalTable = createLineTable(original)
  let generatedTable = createLineTable(generated)

  type Translation = [
    originalStart: Position,
    originalEnd: Position,
    generatedStart: Position | null,
    generatedEnd: Position | null,
  ]

  return (node: AstNode) => {
    if (!node.src) return []

    let translations: Translation[] = []

    translations.push([
      originalTable.find(node.src[1]),
      originalTable.find(node.src[2]),
      node.dst ? generatedTable.find(node.dst[1]) : null,
      node.dst ? generatedTable.find(node.dst[2]) : null,
    ])

    return translations
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does createTranslationMap() do?
createTranslationMap() is a function in the tailwindcss codebase.
What does createTranslationMap() call?
createTranslationMap() calls 1 function(s): createLineTable.
What calls createTranslationMap()?
createTranslationMap() is called by 1 function(s): analyze.

Analyze Your Own Codebase

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

Try Supermodel Free