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 UpgradeToolkit TemplateAnalysis 8 imports 8 dependents 14 functions

Entity Profile

Dependency Diagram

graph LR
  9106c15d_cfb8_77f5_665e_9707020b48c8["renderer.ts"]
  8c8b43f7_0052_590f_b261_209a8ea9e585["resolve.ts"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 8c8b43f7_0052_590f_b261_209a8ea9e585
  01a6f221_d477_b741_83b5_c1b3c1826187["resolve"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 01a6f221_d477_b741_83b5_c1b3c1826187
  5962a7f5_fddb_2d83_4f12_66ebacc2e893["format-ns.ts"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 5962a7f5_fddb_2d83_4f12_66ebacc2e893
  f1036358_1349_9cc5_4378_7a8df38a3224["formatNanoseconds"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> f1036358_1349_9cc5_4378_7a8df38a3224
  6390fa3b_300d_6028_9e96_c869157db42d["node:fs"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 6390fa3b_300d_6028_9e96_c869157db42d
  2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5
  041a5d56_b2a1_1fbe_eb9b_b605f45324db["node:util"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> 041a5d56_b2a1_1fbe_eb9b_b605f45324db
  df14e640_fe39_56d9_0c45_b1a15ec4e9c9["picocolors"]
  9106c15d_cfb8_77f5_665e_9707020b48c8 --> df14e640_fe39_56d9_0c45_b1a15ec4e9c9
  b2ba3368_7330_fe20_4543_9cafa8cfedc0["migrate-js-config.ts"]
  b2ba3368_7330_fe20_4543_9cafa8cfedc0 --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  9c861556_2895_9b7c_50ec_d9aa3cfc5c68["migrate-postcss.ts"]
  9c861556_2895_9b7c_50ec_d9aa3cfc5c68 --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  764d02dc_895f_8f85_d274_59af948c9ebb["analyze.ts"]
  764d02dc_895f_8f85_d274_59af948c9ebb --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  9db14b70_46b7_0974_d9fd_49584e40ff70["link.ts"]
  9db14b70_46b7_0974_d9fd_49584e40ff70 --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  c8809718_3b35_1fdb_ff99_94e375c7360a["prepare-config.ts"]
  c8809718_3b35_1fdb_ff99_94e375c7360a --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  c2db3112_cd69_dad3_1ec1_c1fb9b72a560["index.ts"]
  c2db3112_cd69_dad3_1ec1_c1fb9b72a560 --> 9106c15d_cfb8_77f5_665e_9707020b48c8
  style 9106c15d_cfb8_77f5_665e_9707020b48c8 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 UpgradeToolkit domain, TemplateAnalysis 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: UpgradeToolkit, subdomain: TemplateAnalysis, 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