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
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb["run()"]
  685d98f0_f223_dedf_cfba_bbdb2dc11d1d["source-map.test.ts"]
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb -->|defined in| 685d98f0_f223_dedf_cfba_bbdb2dc11d1d
  b8440a35_f3c7_053b_916b_27c5abf3d6e2["toRawSourceMap()"]
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb -->|calls| b8440a35_f3c7_053b_916b_27c5abf3d6e2
  bcca3c2e_b934_8f1e_1d12_56bb89daae2b["formattedMappings()"]
  2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb -->|calls| bcca3c2e_b934_8f1e_1d12_56bb89daae2b
  style 2d886dcd_8c34_0eb2_8fc8_a0ee9f8d23eb 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