Home / Function/ formatPostcssSourceMap() — vite Function Reference

formatPostcssSourceMap() — vite Function Reference

Architecture documentation for the formatPostcssSourceMap() function in css.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  644077f9_8498_35f7_2717_1202c598eccc["formatPostcssSourceMap()"]
  c3eb47df_971b_0616_6c9f_29b3ded72224["css.ts"]
  644077f9_8498_35f7_2717_1202c598eccc -->|defined in| c3eb47df_971b_0616_6c9f_29b3ded72224
  bfb7f285_fb76_2283_e68f_d806d799034d["runPostCSS()"]
  bfb7f285_fb76_2283_e68f_d806d799034d -->|calls| 644077f9_8498_35f7_2717_1202c598eccc
  10b9dea8_362c_1af2_93be_afa4dd9aed9e["cleanUrl()"]
  644077f9_8498_35f7_2717_1202c598eccc -->|calls| 10b9dea8_362c_1af2_93be_afa4dd9aed9e
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath()"]
  644077f9_8498_35f7_2717_1202c598eccc -->|calls| a4adb1a7_cf54_091f_eb63_8217e684a8e1
  dfa2b928_25a4_a78f_1e11_1e7e643cae09["resolve()"]
  644077f9_8498_35f7_2717_1202c598eccc -->|calls| dfa2b928_25a4_a78f_1e11_1e7e643cae09
  style 644077f9_8498_35f7_2717_1202c598eccc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/css.ts lines 1850–1876

export async function formatPostcssSourceMap(
  rawMap: ExistingRawSourceMap,
  file: string,
): Promise<ExistingRawSourceMap> {
  const inputFileDir = path.dirname(file)

  // Note: the real `Sourcemap#sources` maybe `null`, but rollup typing is not handle it.
  const sources = rawMap.sources!.map((source) => {
    const cleanSource = cleanUrl(decodeURIComponent(source!))

    // postcss virtual files
    if (cleanSource[0] === '<' && cleanSource.endsWith('>')) {
      return `\0${cleanSource}`
    }

    return normalizePath(path.resolve(inputFileDir, cleanSource))
  })

  return {
    file,
    mappings: rawMap.mappings,
    names: rawMap.names,
    sources,
    sourcesContent: rawMap.sourcesContent,
    version: rawMap.version,
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does formatPostcssSourceMap() do?
formatPostcssSourceMap() is a function in the vite codebase, defined in packages/vite/src/node/plugins/css.ts.
Where is formatPostcssSourceMap() defined?
formatPostcssSourceMap() is defined in packages/vite/src/node/plugins/css.ts at line 1850.
What does formatPostcssSourceMap() call?
formatPostcssSourceMap() calls 3 function(s): cleanUrl, normalizePath, resolve.
What calls formatPostcssSourceMap()?
formatPostcssSourceMap() is called by 1 function(s): runPostCSS.

Analyze Your Own Codebase

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

Try Supermodel Free