Home / Function/ run() — tailwindcss Function Reference

run() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  efd01c94_d25c_cc34_c144_f7242c307fca["run()"]
  b481c171_0dab_e8e5_e9d7_4ad779fa96da["source-map.test.ts"]
  efd01c94_d25c_cc34_c144_f7242c307fca -->|defined in| b481c171_0dab_e8e5_e9d7_4ad779fa96da
  9c772429_5486_9990_999c_bcc7710fe7ae["toRawSourceMap()"]
  efd01c94_d25c_cc34_c144_f7242c307fca -->|calls| 9c772429_5486_9990_999c_bcc7710fe7ae
  2a01344b_c5b0_dcf1_e07d_40f1d5d4790e["formattedMappings()"]
  efd01c94_d25c_cc34_c144_f7242c307fca -->|calls| 2a01344b_c5b0_dcf1_e07d_40f1d5d4790e
  style efd01c94_d25c_cc34_c144_f7242c307fca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/source-maps/source-map.test.ts lines 20–48

async function run({ input, candidates, options }: RunOptions) {
  let source = new MagicString(input)
  let root = path.resolve(__dirname, '../..')

  let compiler = await compile(source.toString(), {
    from: 'input.css',
    async loadStylesheet(id, base) {
      let resolvedPath = path.resolve(root, id === 'tailwindcss' ? 'index.css' : id)

      return {
        path: path.relative(root, resolvedPath),
        base,
        content: await fs.readFile(resolvedPath, 'utf-8'),
      }
    },
    ...options,
  })

  let css = compiler.build(candidates ?? [])
  let decoded = compiler.buildSourceMap()
  let rawMap = toRawSourceMap(decoded)
  let combined = remapping(rawMap, () => null)
  let map = JSON.parse(rawMap.toString()) as RawSourceMap

  let sources = combined.sources
  let annotations = formattedMappings(map)

  return { css, map, sources, annotations }
}

Domain

Subdomains

Frequently Asked Questions

What does run() do?
run() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/source-maps/source-map.test.ts.
Where is run() defined?
run() is defined in packages/tailwindcss/src/source-maps/source-map.test.ts at line 20.
What does run() call?
run() calls 2 function(s): formattedMappings, toRawSourceMap.

Analyze Your Own Codebase

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

Try Supermodel Free