Home / File/ index.ts — tailwindcss Source File

index.ts — tailwindcss Source File

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

File typescript Oxide Scanner 6 imports 4 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  2edc6732_180e_8223_de2c_856c87ce7657["index.ts"]
  08129f89_e6ef_0092_629d_821c60228c89["node"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> 08129f89_e6ef_0092_629d_821c60228c89
  dbd6cafa_0f98_d90d_0f9e_9485619e679e["require-cache"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> dbd6cafa_0f98_d90d_0f9e_9485619e679e
  5a22a82e_ea42_a956_7900_a189873ab04d["oxide"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> 5a22a82e_ea42_a956_7900_a189873ab04d
  b75e8457_6610_e7ce_eeaf_9a1dd10fc510["promises"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> b75e8457_6610_e7ce_eeaf_9a1dd10fc510
  89aef3dd_1eed_c141_d425_b8949215a653["node:path"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> 89aef3dd_1eed_c141_d425_b8949215a653
  fd097120_a1a1_b063_ef4b_43b51c07591c["vite"]
  2edc6732_180e_8223_de2c_856c87ce7657 --> fd097120_a1a1_b063_ef4b_43b51c07591c
  style 2edc6732_180e_8223_de2c_856c87ce7657 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
  compile,
  env,
  Features,
  Instrumentation,
  normalizePath,
  optimize,
  toSourceMap,
} from '@tailwindcss/node'
import { clearRequireCache } from '@tailwindcss/node/require-cache'
import { Scanner } from '@tailwindcss/oxide'
import fs from 'node:fs/promises'
import path from 'node:path'
import type { Environment, Plugin, ResolvedConfig, ViteDevServer } from 'vite'
import * as vite from 'vite'

const DEBUG = env.DEBUG
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/
const COMMON_JS_PROXY_RE = /\?commonjs-proxy/
const INLINE_STYLE_ID_RE = /[?&]index\=\d+\.css$/

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

export default function tailwindcss(opts: PluginOptions = {}): Plugin[] {
  let servers: ViteDevServer[] = []
  let config: ResolvedConfig | null = null
  let rootsByEnv = new DefaultMap<string, Map<string, Root>>((env: string) => new Map())

  let isSSR = false
  let shouldOptimize = true
  let minify = true

  function createRoot(env: Environment | null, id: string) {
    type ResolveFn = (id: string, base: string) => Promise<string | false | undefined>

    let customCssResolver: ResolveFn
    let customJsResolver: ResolveFn

    if (!env) {
      // Older, pre-environment Vite API
      // TODO: Can we drop this??
      let cssResolver = config!.createResolver({
        ...config!.resolve,
        extensions: ['.css'],
        mainFields: ['style'],
        conditions: ['style', 'development|production'],
        tryIndex: false,
        preferRelative: true,
      })

      let jsResolver = config!.createResolver(config!.resolve)

      customCssResolver = (id: string, base: string) => cssResolver(id, base, true, isSSR)
      customJsResolver = (id: string, base: string) => jsResolver(id, base, true, isSSR)
    } else {
// ... (395 more lines)

Domain

Subdomains

Classes

Dependencies

  • node
  • node:path
  • oxide
  • promises
  • require-cache
  • vite

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, Scanner subdomain.
What functions are defined in index.ts?
index.ts defines 4 function(s): getExtension, idToPath, isPotentialCssRootFile, tailwindcss.
What does index.ts depend on?
index.ts imports 6 module(s): node, node:path, oxide, promises, require-cache, vite.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-vite/src/index.ts (domain: Oxide, subdomain: Scanner, directory: packages/@tailwindcss-vite/src).

Analyze Your Own Codebase

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

Try Supermodel Free