Home / File/ renderer.ts — tailwindcss Source File

renderer.ts — tailwindcss Source File

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

File typescript CommandLineInterface Renderer 8 imports 8 dependents 14 functions

Entity Profile

Dependency Diagram

graph LR
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277["renderer.ts"]
  39d349ef_5aba_74f4_ed62_f866ab2288c7["resolve.ts"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 39d349ef_5aba_74f4_ed62_f866ab2288c7
  b3cb232d_fbe6_2b8e_5adc_9a50c60bc9e4["resolve"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> b3cb232d_fbe6_2b8e_5adc_9a50c60bc9e4
  563df76b_3493_d61f_154e_4c7cc1eb0d26["format-ns.ts"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 563df76b_3493_d61f_154e_4c7cc1eb0d26
  a3646bb8_6d98_7507_9794_aaae4a53752a["formatNanoseconds"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> a3646bb8_6d98_7507_9794_aaae4a53752a
  9c72d32d_a535_69d4_565b_b620ce2eaae1["node:fs"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 9c72d32d_a535_69d4_565b_b620ce2eaae1
  89aef3dd_1eed_c141_d425_b8949215a653["node:path"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 89aef3dd_1eed_c141_d425_b8949215a653
  f909665b_1fad_0830_f03c_620b7c9464c3["node:util"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> f909665b_1fad_0830_f03c_620b7c9464c3
  5e3a9e1b_c7c3_9356_dd16_9834c49660ab["picocolors"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 --> 5e3a9e1b_c7c3_9356_dd16_9834c49660ab
  ffe9c87e_35ad_f431_9625_80fc875792a7["migrate-js-config.ts"]
  ffe9c87e_35ad_f431_9625_80fc875792a7 --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  9434c276_afef_dc51_650b_a8b408f077fc["migrate-postcss.ts"]
  9434c276_afef_dc51_650b_a8b408f077fc --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  c30c28f2_b6df_e90d_67d1_db074bef35a5["analyze.ts"]
  c30c28f2_b6df_e90d_67d1_db074bef35a5 --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  391ead49_f8b5_2b23_a9fe_31a150c72620["link.ts"]
  391ead49_f8b5_2b23_a9fe_31a150c72620 --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  d58c78f4_5856_72aa_9dca_c418a7d7f31e["prepare-config.ts"]
  d58c78f4_5856_72aa_9dca_c418a7d7f31e --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  e757210f_6e73_5a13_a52e_f9675256ec53["index.ts"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  style 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs'
import path from 'node:path'
import { stripVTControlCharacters } from 'node:util'
import pc from 'picocolors'
import { resolve } from '../utils/resolve'
import { formatNanoseconds } from './format-ns'

export const UI = {
  indent: 2,
}
export function header() {
  return `${pc.italic(pc.bold(pc.blue('\u2248')))} tailwindcss ${pc.blue(`v${getVersion()}`)}`
}

export function highlight(file: string) {
  return `${pc.dim(pc.blue('`'))}${pc.blue(file)}${pc.dim(pc.blue('`'))}`
}

/**
 * Convert an `absolute` path to a `relative` path from the current working
 * directory.
 */
export function relative(
  to: string,
  from = process.cwd(),
  { preferAbsoluteIfShorter = true } = {},
) {
  let result = path.relative(from, to)
  if (!result.startsWith('..')) {
    result = `.${path.sep}${result}`
  }

  if (preferAbsoluteIfShorter && result.length > to.length) {
    return to
  }

  return result
}

/**
 * Wrap `text` into multiple lines based on the `width`.
 */
export function wordWrap(text: string, width: number): string[] {
  // Handle text with newlines by maintaining the newlines, then splitting
  // each line separately.
  if (text.includes('\n')) {
    return text.split('\n').flatMap((line) => (line ? wordWrap(line, width) : ['']))
  }

  let words = text.split(' ')
  let lines = []

  let line = ''
  let lineLength = 0
  for (let word of words) {
    let wordLength = stripVTControlCharacters(word).length

    if (lineLength + wordLength + 1 > width) {
      lines.push(line)
      line = ''
// ... (81 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does renderer.ts do?
renderer.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 renderer.ts?
renderer.ts defines 14 function(s): eprintln, error, formatDuration, getVersion, header, highlight, indent, info, log, println, and 4 more.
What does renderer.ts depend on?
renderer.ts imports 8 module(s): format-ns.ts, formatNanoseconds, node:fs, node:path, node:util, picocolors, resolve, resolve.ts.
What files import renderer.ts?
renderer.ts is imported by 8 file(s): analyze.ts, index.ts, index.ts, link.ts, migrate-js-config.ts, migrate-postcss.ts, packages.ts, prepare-config.ts.
Where is renderer.ts in the architecture?
renderer.ts is located at packages/@tailwindcss-upgrade/src/utils/renderer.ts (domain: CommandLineInterface, subdomain: Renderer, directory: packages/@tailwindcss-upgrade/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free