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
  483bc469_09cd_2782_6511_f5eb78cfc4c1["run()"]
  6cbdbfb1_59a5_9e77_288e_4b086c9e78b1["toRawSourceMap()"]
  483bc469_09cd_2782_6511_f5eb78cfc4c1 -->|calls| 6cbdbfb1_59a5_9e77_288e_4b086c9e78b1
  e1431d4b_1885_1204_7955_59de26dd3eea["formattedMappings()"]
  483bc469_09cd_2782_6511_f5eb78cfc4c1 -->|calls| e1431d4b_1885_1204_7955_59de26dd3eea
  style 483bc469_09cd_2782_6511_f5eb78cfc4c1 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 }
}

Subdomains

Frequently Asked Questions

What does run() do?
run() is a function in the tailwindcss codebase.
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