Home / File/ index.ts — tailwindcss Source File

index.ts — tailwindcss Source File

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

File typescript CommandLineInterface Renderer 9 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  dedd6830_c180_a2b0_01d1_b5874e938eb8["index.ts"]
  f680db01_c2c6_090b_99ee_9df802d112b2["args.ts"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> f680db01_c2c6_090b_99ee_9df802d112b2
  f59ecd5a_ded5_04dd_49dd_3209180019c2["Arg"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> f59ecd5a_ded5_04dd_49dd_3209180019c2
  cc1a3f06_4b21_684c_487a_f342bd18d772["renderer.ts"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> cc1a3f06_4b21_684c_487a_f342bd18d772
  e596cbd7_5ac3_bb1f_974c_17f3c797c49f["header"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> e596cbd7_5ac3_bb1f_974c_17f3c797c49f
  91fd8834_d180_b2df_65bf_c35d13dac7a7["highlight"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> 91fd8834_d180_b2df_65bf_c35d13dac7a7
  7517bd35_5b87_fa68_a4ac_7d202b4cf436["indent"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> 7517bd35_5b87_fa68_a4ac_7d202b4cf436
  67ba9693_4314_1af0_b958_6866171fbded["println"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> 67ba9693_4314_1af0_b958_6866171fbded
  013ade5d_a705_2dda_2ed9_20a4f95c3a49["wordWrap"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> 013ade5d_a705_2dda_2ed9_20a4f95c3a49
  5e3a9e1b_c7c3_9356_dd16_9834c49660ab["picocolors"]
  dedd6830_c180_a2b0_01d1_b5874e938eb8 --> 5e3a9e1b_c7c3_9356_dd16_9834c49660ab
  2e62a025_c320_60cb_6b4c_aa1efeed2ed9["index.ts"]
  2e62a025_c320_60cb_6b4c_aa1efeed2ed9 --> dedd6830_c180_a2b0_01d1_b5874e938eb8
  style dedd6830_c180_a2b0_01d1_b5874e938eb8 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 CommandLineInterface domain, Renderer subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): help.
What does index.ts depend on?
index.ts imports 9 module(s): Arg, args.ts, header, highlight, indent, picocolors, println, renderer.ts, and 1 more.
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: CommandLineInterface, subdomain: Renderer, 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