index.ts — tailwindcss Source File
Architecture documentation for index.ts, a typescript file in the tailwindcss codebase. 14 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc["index.ts"] 42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 42640952_ea63_55f1_1ff1_00816e2980ae 2da63033_d079_7b37_5cfb_3877674a70b9["toCss"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 2da63033_d079_7b37_5cfb_3877674a70b9 25f462e7_c718_35c5_7ff1_b1b41cc176bf["ast.ts"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 25f462e7_c718_35c5_7ff1_b1b41cc176bf 2b13c224_9fb8_311a_1669_17e838226ea5["cssAstToPostCssAst"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 2b13c224_9fb8_311a_1669_17e838226ea5 117741fb_51f9_63e4_669e_170efd25ca86["postCssAstToCssAst"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 117741fb_51f9_63e4_669e_170efd25ca86 db071d11_4cec_4513_1261_677ffd86ce6e["index.ts"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> db071d11_4cec_4513_1261_677ffd86ce6e 06a6b835_65ff_54fa_2194_b15613c95964["fixRelativePathsPlugin"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 06a6b835_65ff_54fa_2194_b15613c95964 cd5f5247_00f3_e4ea_a13f_929385cecd28["quick-lru"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> cd5f5247_00f3_e4ea_a13f_929385cecd28 92f2d961_72a4_d195_92d7_2e66972f8894["node"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 92f2d961_72a4_d195_92d7_2e66972f8894 134090e5_ea6f_b3c6_efa7_d9202c52de69["require-cache"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 134090e5_ea6f_b3c6_efa7_d9202c52de69 8f3a837a_4918_fced_fe0d_2cfdb0bd2b31["oxide"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 8f3a837a_4918_fced_fe0d_2cfdb0bd2b31 6390fa3b_300d_6028_9e96_c869157db42d["node:fs"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 6390fa3b_300d_6028_9e96_c869157db42d 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5 ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 style 4d87ade3_79e3_f749_8b40_7a0e8f43b9dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import QuickLRU from '@alloc/quick-lru'
import {
compileAst,
env,
Features,
Instrumentation,
optimize as optimizeCss,
Polyfills,
} from '@tailwindcss/node'
import { clearRequireCache } from '@tailwindcss/node/require-cache'
import { Scanner } from '@tailwindcss/oxide'
import fs from 'node:fs'
import path, { relative } from 'node:path'
import type { AcceptedPlugin, PluginCreator, Postcss, Root } from 'postcss'
import { toCss, type AstNode } from '../../tailwindcss/src/ast'
import { cssAstToPostCssAst, postCssAstToCssAst } from './ast'
import fixRelativePathsPlugin from './postcss-fix-relative-paths'
const DEBUG = env.DEBUG
interface CacheEntry {
mtimes: Map<string, number>
compiler: null | ReturnType<typeof compileAst>
scanner: null | Scanner
tailwindCssAst: AstNode[]
cachedPostCssAst: Root
optimizedPostCssAst: Root
fullRebuildPaths: string[]
}
const cache = new QuickLRU<string, CacheEntry>({ maxSize: 50 })
function getContextFromCache(postcss: Postcss, inputFile: string, opts: PluginOptions): CacheEntry {
let key = `${inputFile}:${opts.base ?? ''}:${JSON.stringify(opts.optimize)}`
if (cache.has(key)) return cache.get(key)!
let entry = {
mtimes: new Map<string, number>(),
compiler: null,
scanner: null,
tailwindCssAst: [],
cachedPostCssAst: postcss.root(),
optimizedPostCssAst: postcss.root(),
fullRebuildPaths: [] as string[],
}
cache.set(key, entry)
return entry
}
export type PluginOptions = {
/**
* The base directory to scan for class candidates.
*
* Defaults to the current working directory.
*/
base?: string
/**
* Optimize and minify the output CSS.
*/
// ... (306 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ast.ts
- ast.ts
- cssAstToPostCssAst
- fixRelativePathsPlugin
- index.ts
- node
- node:fs
- node:path
- oxide
- postCssAstToCssAst
- postcss
- quick-lru
- require-cache
- toCss
Imported By
Source
Frequently Asked Questions
What does index.ts do?
index.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.ts?
index.ts defines 2 function(s): getContextFromCache, tailwindcss.
What does index.ts depend on?
index.ts imports 14 module(s): ast.ts, ast.ts, cssAstToPostCssAst, fixRelativePathsPlugin, index.ts, node, node:fs, node:path, and 6 more.
What files import index.ts?
index.ts is imported by 1 file(s): index.test.ts.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-postcss/src/index.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