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.

File typescript Oxide Extractor 7 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  b294614b_1806_4c31_9786_09a2dbe0d909["index.ts"]
  78973828_b359_766f_59ac_7447f930192e["quick-lru"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 78973828_b359_766f_59ac_7447f930192e
  08129f89_e6ef_0092_629d_821c60228c89["node"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 08129f89_e6ef_0092_629d_821c60228c89
  dbd6cafa_0f98_d90d_0f9e_9485619e679e["require-cache"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> dbd6cafa_0f98_d90d_0f9e_9485619e679e
  5a22a82e_ea42_a956_7900_a189873ab04d["oxide"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 5a22a82e_ea42_a956_7900_a189873ab04d
  9c72d32d_a535_69d4_565b_b620ce2eaae1["node:fs"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 9c72d32d_a535_69d4_565b_b620ce2eaae1
  89aef3dd_1eed_c141_d425_b8949215a653["node:path"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 89aef3dd_1eed_c141_d425_b8949215a653
  8ec89651_97b1_8f48_6892_17729da2b1a4["webpack"]
  b294614b_1806_4c31_9786_09a2dbe0d909 --> 8ec89651_97b1_8f48_6892_17729da2b1a4
  style b294614b_1806_4c31_9786_09a2dbe0d909 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)

Domain

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 Oxide domain, Extractor 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: Oxide, subdomain: Extractor, 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