source-map.test.ts — tailwindcss Source File
Architecture documentation for source-map.test.ts, a typescript file in the tailwindcss codebase. 15 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b481c171_0dab_e8e5_e9d7_4ad779fa96da["source-map.test.ts"] 914a5326_dcdd_e839_bbc4_d6545cf4c5d5["plugin.ts"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 914a5326_dcdd_e839_bbc4_d6545cf4c5d5 4089a8b5_4817_1d8d_4818_6b91ee92855d["createPlugin"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 4089a8b5_4817_1d8d_4818_6b91ee92855d 28a2f72d_350c_6647_bf9d_77c69e637045["default-map.ts"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 28a2f72d_350c_6647_bf9d_77c69e637045 cfb4af0e_7b2d_34a1_693a_90088443cfec["DefaultMap"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> cfb4af0e_7b2d_34a1_693a_90088443cfec 2638fb39_6a36_5dfe_4705_961a0b5ff737["source-map.ts"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 2638fb39_6a36_5dfe_4705_961a0b5ff737 e646084f_9224_c7a3_3dec_3aeca30a37c1["DecodedSource"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> e646084f_9224_c7a3_3dec_3aeca30a37c1 5f0d8af7_c6b9_820e_1cf5_b5f68a72c816["DecodedSourceMap"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 5f0d8af7_c6b9_820e_1cf5_b5f68a72c816 1660b643_8c19_ccd6_9b97_2dc45d38e9dc["remapping"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 1660b643_8c19_ccd6_9b97_2dc45d38e9dc 8ff4bb92_b963_efb6_cca2_1da4b3ea849b["dedent"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 8ff4bb92_b963_efb6_cca2_1da4b3ea849b e4986020_2bce_a095_c378_5690f6f48a38["magic-string"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> e4986020_2bce_a095_c378_5690f6f48a38 b75e8457_6610_e7ce_eeaf_9a1dd10fc510["promises"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> b75e8457_6610_e7ce_eeaf_9a1dd10fc510 89aef3dd_1eed_c141_d425_b8949215a653["node:path"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 89aef3dd_1eed_c141_d425_b8949215a653 46377737_e2b8_a689_bbdf_90f37c3175a3["source-map-js"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> 46377737_e2b8_a689_bbdf_90f37c3175a3 f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"] b481c171_0dab_e8e5_e9d7_4ad779fa96da --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3 style b481c171_0dab_e8e5_e9d7_4ad779fa96da fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import remapping from '@jridgewell/remapping'
import dedent from 'dedent'
import MagicString from 'magic-string'
import * as fs from 'node:fs/promises'
import * as path from 'node:path'
import { SourceMapConsumer, SourceMapGenerator, type RawSourceMap } from 'source-map-js'
import { test } from 'vitest'
import { compile } from '..'
import createPlugin from '../plugin'
import { DefaultMap } from '../utils/default-map'
import type { DecodedSource, DecodedSourceMap } from './source-map'
const css = dedent
interface RunOptions {
input: string
candidates?: string[]
options?: Parameters<typeof compile>[1]
}
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 }
}
function toRawSourceMap(map: DecodedSourceMap): string {
let generator = new SourceMapGenerator()
let id = 1
let sourceTable = new DefaultMap<
DecodedSource | null,
{
url: string
content: string
}
>((src) => {
// ... (416 more lines)
Domain
Subdomains
Types
Dependencies
- ..
- DecodedSource
- DecodedSourceMap
- DefaultMap
- createPlugin
- dedent
- default-map.ts
- magic-string
- node:path
- plugin.ts
- promises
- remapping
- source-map-js
- source-map.ts
- vitest
Source
Frequently Asked Questions
What does source-map.test.ts do?
source-map.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Extractor subdomain.
What functions are defined in source-map.test.ts?
source-map.test.ts defines 4 function(s): formatRange, formattedMappings, run, toRawSourceMap.
What does source-map.test.ts depend on?
source-map.test.ts imports 15 module(s): .., DecodedSource, DecodedSourceMap, DefaultMap, createPlugin, dedent, default-map.ts, magic-string, and 7 more.
Where is source-map.test.ts in the architecture?
source-map.test.ts is located at packages/tailwindcss/src/source-maps/source-map.test.ts (domain: Oxide, subdomain: Extractor, directory: packages/tailwindcss/src/source-maps).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free