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

Entity Profile

Dependency Diagram

graph TD
  b8973deb_e07f_d1e1_e7f9_7a680d9120d4["createTranslationMap()"]
  94f6a4ae_3b1f_8e71_a096_1f7d17efc49a["source-map.ts"]
  b8973deb_e07f_d1e1_e7f9_7a680d9120d4 -->|defined in| 94f6a4ae_3b1f_8e71_a096_1f7d17efc49a
  5bda8ff2_4761_4c27_d724_a4e36f403452["analyze()"]
  5bda8ff2_4761_4c27_d724_a4e36f403452 -->|calls| b8973deb_e07f_d1e1_e7f9_7a680d9120d4
  0204f9b9_80aa_c3e8_eb61_22170d608d65["createLineTable()"]
  b8973deb_e07f_d1e1_e7f9_7a680d9120d4 -->|calls| 0204f9b9_80aa_c3e8_eb61_22170d608d65
  style b8973deb_e07f_d1e1_e7f9_7a680d9120d4 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, defined in packages/tailwindcss/src/source-maps/source-map.ts.
Where is createTranslationMap() defined?
createTranslationMap() is defined in packages/tailwindcss/src/source-maps/source-map.ts at line 165.
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