index.test.ts — tailwindcss Source File
Architecture documentation for index.test.ts, a typescript file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 931292f3_44be_9c39_22ac_98ee000dcd8c["index.test.ts"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc["index.ts"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc 7e4891ad_b5c5_f083_e9e1_3dc43422517d["tailwindcss"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 7e4891ad_b5c5_f083_e9e1_3dc43422517d 211db6bb_9759_d0cf_acda_36d7f5733ce2["dedent"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 211db6bb_9759_d0cf_acda_36d7f5733ce2 8118fcf2_a51d_d1a1_93d3_c71d3a646692["promises"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 8118fcf2_a51d_d1a1_93d3_c71d3a646692 6697e014_f05e_326e_fc13_a0cc17f46c5d["node:os"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 6697e014_f05e_326e_fc13_a0cc17f46c5d 2a0cc545_d907_0543_e426_954a85e60ee7["path"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 2a0cc545_d907_0543_e426_954a85e60ee7 ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 931292f3_44be_9c39_22ac_98ee000dcd8c --> 696bd648_5f24_1b59_8e8b_7a97a692869e style 931292f3_44be_9c39_22ac_98ee000dcd8c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import dedent from 'dedent'
import { mkdir, mkdtemp, readFile, rm, unlink, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'path'
import postcss from 'postcss'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import tailwindcss from './index'
// We give this file path to PostCSS for processing.
// This file doesn't exist, but the path is used to resolve imports.
// We place it in packages/ because Vitest runs in the monorepo root,
// and packages/tailwindcss must be a sub-folder for
// @import 'tailwindcss' to work.
function inputCssFilePath() {
// Including the current test name to ensure that the cache is invalidated per
// test otherwise the cache will be used across tests.
return `${__dirname}/fixtures/example-project/input.css?test=${expect.getState().currentTestName}`
}
const css = dedent
test("`@import 'tailwindcss'` is replaced with the generated CSS", async () => {
let processor = postcss([
tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }),
])
let result = await processor.process(`@import 'tailwindcss'`, { from: inputCssFilePath() })
expect(result.css.trim()).toMatchSnapshot()
// Check for dependency messages
expect(result.messages).toContainEqual({
type: 'dependency',
file: expect.stringMatching(/index.html$/g),
parent: expect.any(String),
plugin: expect.any(String),
})
expect(result.messages).toContainEqual({
type: 'dependency',
file: expect.stringMatching(/index.js$/g),
parent: expect.any(String),
plugin: expect.any(String),
})
expect(result.messages).toContainEqual({
type: 'dir-dependency',
dir: expect.stringMatching(/example-project[\/|\\]src$/g),
glob: expect.stringMatching(/^\*\*\/\*/g),
parent: expect.any(String),
plugin: expect.any(String),
})
})
test('output is optimized by Lightning CSS', async () => {
let processor = postcss([
tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }),
])
let result = await processor.process(
css`
@layer utilities {
// ... (385 more lines)
Domain
Subdomains
Functions
Dependencies
- dedent
- index.ts
- node:os
- path
- postcss
- promises
- tailwindcss
- vitest
Source
Frequently Asked Questions
What does index.test.ts do?
index.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the BuildIntegrations domain, PostCSSPlugin subdomain.
What functions are defined in index.test.ts?
index.test.ts defines 1 function(s): inputCssFilePath.
What does index.test.ts depend on?
index.test.ts imports 8 module(s): dedent, index.ts, node:os, path, postcss, promises, tailwindcss, vitest.
Where is index.test.ts in the architecture?
index.test.ts is located at packages/@tailwindcss-postcss/src/index.test.ts (domain: BuildIntegrations, subdomain: PostCSSPlugin, directory: packages/@tailwindcss-postcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free