Home / File/ index.test.ts — tailwindcss Source File

index.test.ts — tailwindcss Source File

Architecture documentation for index.test.ts, a typescript file in the tailwindcss codebase. 8 imports, 0 dependents.

File typescript PostCSSPlugin AST 8 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  6ff01c2b_9eec_ac97_d6e1_826656abbb92["index.test.ts"]
  2bc39c56_196b_12bc_1a08_0896427ab477["index.ts"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 2bc39c56_196b_12bc_1a08_0896427ab477
  6d05b300_c6ad_6d9d_74a4_394205536160["tailwindcss"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 6d05b300_c6ad_6d9d_74a4_394205536160
  8ff4bb92_b963_efb6_cca2_1da4b3ea849b["dedent"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 8ff4bb92_b963_efb6_cca2_1da4b3ea849b
  b75e8457_6610_e7ce_eeaf_9a1dd10fc510["promises"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> b75e8457_6610_e7ce_eeaf_9a1dd10fc510
  05950b06_34e4_40bd_2622_1cfda03546ff["node:os"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 05950b06_34e4_40bd_2622_1cfda03546ff
  0a0a7fa3_39a9_57ab_f77d_387bf6d51e1a["path"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 0a0a7fa3_39a9_57ab_f77d_387bf6d51e1a
  7c3c22f8_be1a_4490_9f3e_622280887fe1["postcss"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> 7c3c22f8_be1a_4490_9f3e_622280887fe1
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  6ff01c2b_9eec_ac97_d6e1_826656abbb92 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 6ff01c2b_9eec_ac97_d6e1_826656abbb92 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

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 PostCSSPlugin domain, AST 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: PostCSSPlugin, subdomain: AST, 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