Home / File/ index.ts — tailwindcss Source File

index.ts — tailwindcss Source File

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

Entity Profile

Dependency Diagram

graph LR
  b43c8628_fc48_68ca_7913_f540a0f4bedd["index.ts"]
  cd5f5247_00f3_e4ea_a13f_929385cecd28["quick-lru"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> cd5f5247_00f3_e4ea_a13f_929385cecd28
  92f2d961_72a4_d195_92d7_2e66972f8894["node"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> 92f2d961_72a4_d195_92d7_2e66972f8894
  134090e5_ea6f_b3c6_efa7_d9202c52de69["require-cache"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> 134090e5_ea6f_b3c6_efa7_d9202c52de69
  8f3a837a_4918_fced_fe0d_2cfdb0bd2b31["oxide"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> 8f3a837a_4918_fced_fe0d_2cfdb0bd2b31
  6390fa3b_300d_6028_9e96_c869157db42d["node:fs"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> 6390fa3b_300d_6028_9e96_c869157db42d
  2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5
  a6e42564_21df_14f7_31a8_625feb6633e9["webpack"]
  b43c8628_fc48_68ca_7913_f540a0f4bedd --> a6e42564_21df_14f7_31a8_625feb6633e9
  style b43c8628_fc48_68ca_7913_f540a0f4bedd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import QuickLRU from '@alloc/quick-lru'
import {
  compile,
  env,
  Features,
  Instrumentation,
  normalizePath,
  optimize,
  Polyfills,
} from '@tailwindcss/node'
import { clearRequireCache } from '@tailwindcss/node/require-cache'
import { Scanner } from '@tailwindcss/oxide'
import fs from 'node:fs'
import path from 'node:path'
import type { LoaderContext } from 'webpack'

const DEBUG = env.DEBUG

export interface LoaderOptions {
  /**
   * The base directory to scan for class candidates.
   *
   * Defaults to the current working directory.
   */
  base?: string

  /**
   * Optimize and minify the output CSS.
   */
  optimize?: boolean | { minify?: boolean }
}

interface CacheEntry {
  mtimes: Map<string, number>
  compiler: null | Awaited<ReturnType<typeof compile>>
  scanner: null | Scanner
  candidates: Set<string>
  fullRebuildPaths: string[]
}

const cache = new QuickLRU<string, CacheEntry>({ maxSize: 50 })

function getContextFromCache(inputFile: string, opts: LoaderOptions): CacheEntry {
  let key = `${inputFile}:${opts.base ?? ''}:${JSON.stringify(opts.optimize)}`
  if (cache.has(key)) return cache.get(key)!
  let entry: CacheEntry = {
    mtimes: new Map<string, number>(),
    compiler: null,
    scanner: null,
    candidates: new Set<string>(),
    fullRebuildPaths: [],
  }
  cache.set(key, entry)
  return entry
}

export default async function tailwindLoader(
  this: LoaderContext<LoaderOptions>,
  source: string,
): Promise<void> {
// ... (223 more lines)

Subdomains

Dependencies

  • node
  • node:fs
  • node:path
  • oxide
  • quick-lru
  • require-cache
  • webpack

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, VitePlugin subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): getContextFromCache, tailwindLoader.
What does index.ts depend on?
index.ts imports 7 module(s): node, node:fs, node:path, oxide, quick-lru, require-cache, webpack.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-webpack/src/index.ts (domain: BuildIntegrations, subdomain: VitePlugin, directory: packages/@tailwindcss-webpack/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free