Home / File/ args.ts — tailwindcss Source File

args.ts — tailwindcss Source File

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

File typescript BuildIntegrations PostCSSPlugin 1 imports 3 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  9bf716c1_a944_1eb2_180b_5c0151e992ba["args.ts"]
  9e2c226f_eeca_d965_15aa_c3a84aa017d9["mri"]
  9bf716c1_a944_1eb2_180b_5c0151e992ba --> 9e2c226f_eeca_d965_15aa_c3a84aa017d9
  48860a26_2cb5_7783_52eb_1425db7e2b6a["index.ts"]
  48860a26_2cb5_7783_52eb_1425db7e2b6a --> 9bf716c1_a944_1eb2_180b_5c0151e992ba
  41320a40_1fd8_59af_1c95_f0b1d87cda08["index.ts"]
  41320a40_1fd8_59af_1c95_f0b1d87cda08 --> 9bf716c1_a944_1eb2_180b_5c0151e992ba
  178128be_b200_b167_fd45_771e707a3af7["args.test.ts"]
  178128be_b200_b167_fd45_771e707a3af7 --> 9bf716c1_a944_1eb2_180b_5c0151e992ba
  style 9bf716c1_a944_1eb2_180b_5c0151e992ba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import parse from 'mri'

// Definition of the arguments for a command in the CLI.
export type Arg = {
  [key: `--${string}`]: {
    type: keyof Types
    description: string
    alias?: `-${string}`
    default?: Types[keyof Types]
    values?: string[]
  }
}

// Each argument will have a type and we want to convert the incoming raw string
// based value to the correct type. We can't use pure TypeScript types because
// these don't exist at runtime. Instead, we define a string-based type that
// maps to a TypeScript type.
type Types = {
  boolean: boolean
  number: number | null
  string: string | null
  'boolean | string': boolean | string | null
  'number | string': number | string | null
  'boolean | number': boolean | number | null
  'boolean | number | string': boolean | number | string | null
}

// Convert the `Arg` type to a type that can be used at runtime.
//
// E.g.:
//
// Arg:
// ```
// { '--input': { type: 'string', description: 'Input file', alias: '-i' } }
// ```
//
// Command:
// ```
// ./tailwindcss -i input.css
// ./tailwindcss --input input.css
// ```
//
// Result type:
// ```
// {
//   _: string[],             // All non-flag arguments
//   '--input': string | null // The `--input` flag will be filled with `null`, if the flag is not used.
//                            // The `null` type will not be there if `default` is provided.
// }
// ```
//
// Result runtime object:
// ```
// {
//   _: [],
//   '--input': 'input.css'
// }
// ```
export type Result<T extends Arg> = {
  [K in keyof T]: T[K] extends { type: keyof Types; default?: any }
// ... (122 more lines)

Subdomains

Dependencies

  • mri

Frequently Asked Questions

What does args.ts do?
args.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 args.ts?
args.ts defines 5 function(s): args, convert, convertBoolean, convertNumber, convertString.
What does args.ts depend on?
args.ts imports 1 module(s): mri.
What files import args.ts?
args.ts is imported by 3 file(s): args.test.ts, index.ts, index.ts.
Where is args.ts in the architecture?
args.ts is located at packages/@tailwindcss-cli/src/utils/args.ts (domain: BuildIntegrations, subdomain: PostCSSPlugin, directory: packages/@tailwindcss-cli/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free