Home / File/ index.ts — tailwindcss Source File

index.ts — tailwindcss Source File

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

File typescript BuildIntegrations PostCSSPlugin 8 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  48860a26_2cb5_7783_52eb_1425db7e2b6a["index.ts"]
  9bf716c1_a944_1eb2_180b_5c0151e992ba["args.ts"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> 9bf716c1_a944_1eb2_180b_5c0151e992ba
  8715b8e3_2ef0_3a5f_beb9_7129d3febc3e["renderer.ts"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> 8715b8e3_2ef0_3a5f_beb9_7129d3febc3e
  40879e7c_6052_5415_9e87_08e9d72485cc["header"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> 40879e7c_6052_5415_9e87_08e9d72485cc
  2510a705_0f7b_6670_5f65_0e5ef7bde36c["highlight"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> 2510a705_0f7b_6670_5f65_0e5ef7bde36c
  b7302b8b_2a71_5858_7c85_180f6f8421ae["indent"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> b7302b8b_2a71_5858_7c85_180f6f8421ae
  f6a9bc09_432a_b5bb_eb44_bc4f13e8440c["println"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> f6a9bc09_432a_b5bb_eb44_bc4f13e8440c
  ae7c115f_7716_cd13_a2b3_1f18f0fb894b["wordWrap"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> ae7c115f_7716_cd13_a2b3_1f18f0fb894b
  df14e640_fe39_56d9_0c45_b1a15ec4e9c9["picocolors"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> df14e640_fe39_56d9_0c45_b1a15ec4e9c9
  41320a40_1fd8_59af_1c95_f0b1d87cda08["index.ts"]
  41320a40_1fd8_59af_1c95_f0b1d87cda08 --> 48860a26_2cb5_7783_52eb_1425db7e2b6a
  style 48860a26_2cb5_7783_52eb_1425db7e2b6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pc from 'picocolors'
import type { Arg } from '../../utils/args'
import { UI, header, highlight, indent, println, wordWrap } from '../../utils/renderer'

export function help({
  invalid,
  usage,
  options,
}: {
  invalid?: string
  usage?: string[]
  options?: Arg
}) {
  // Available terminal width
  let width = process.stdout.columns

  // Render header
  println(header())

  // Render the invalid command
  if (invalid) {
    println()
    println(`${pc.dim('Invalid command:')} ${invalid}`)
  }

  // Render usage
  if (usage && usage.length > 0) {
    println()
    println(pc.dim('Usage:'))
    for (let [idx, example] of usage.entries()) {
      // Split the usage example into the command and its options. This allows
      // us to wrap the options based on the available width of the terminal.
      let command = example.slice(0, example.indexOf('['))
      let options = example.slice(example.indexOf('['))

      // Make the options dimmed, to make them stand out less than the command
      // itself.
      options = options.replace(/\[.*?\]/g, (option) => pc.dim(option))

      // The space between the command and the options.
      let space = 1

      // Wrap the options based on the available width of the terminal.
      let lines = wordWrap(options, width - UI.indent - command.length - space)

      // Print an empty line between the usage examples if we need to split due
      // to width constraints. This ensures that the usage examples are visually
      // separated.
      //
      // E.g.: when enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss build [--input input.css] [--output output.css] [--watch] [options...]
      //     tailwindcss other [--watch] [options...]
      // ```
      //
      // E.g.: when not enough space is available
      //
      // ```
// ... (115 more lines)

Subdomains

Functions

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 1 function(s): help.
What does index.ts depend on?
index.ts imports 8 module(s): args.ts, header, highlight, indent, picocolors, println, renderer.ts, wordWrap.
What files import index.ts?
index.ts is imported by 1 file(s): index.ts.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-cli/src/commands/help/index.ts (domain: BuildIntegrations, subdomain: PostCSSPlugin, directory: packages/@tailwindcss-cli/src/commands/help).

Analyze Your Own Codebase

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

Try Supermodel Free