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 UpgradeToolkit TemplateAnalysis 1 imports 3 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  2dcceaf3_4383_df7d_023d_fa36fab3c61a["args.ts"]
  9e2c226f_eeca_d965_15aa_c3a84aa017d9["mri"]
  2dcceaf3_4383_df7d_023d_fa36fab3c61a --> 9e2c226f_eeca_d965_15aa_c3a84aa017d9
  c2db3112_cd69_dad3_1ec1_c1fb9b72a560["index.ts"]
  c2db3112_cd69_dad3_1ec1_c1fb9b72a560 --> 2dcceaf3_4383_df7d_023d_fa36fab3c61a
  b2eb6cbf_d28d_9ec7_61c1_8992d8f4efb8["index.ts"]
  b2eb6cbf_d28d_9ec7_61c1_8992d8f4efb8 --> 2dcceaf3_4383_df7d_023d_fa36fab3c61a
  3309a8f3_407e_4bea_ab9e_70e2950d42fa["args.test.ts"]
  3309a8f3_407e_4bea_ab9e_70e2950d42fa --> 2dcceaf3_4383_df7d_023d_fa36fab3c61a
  style 2dcceaf3_4383_df7d_023d_fa36fab3c61a 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]
  }
}

// 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 }
    ? undefined extends T[K]['default']
// ... (101 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 UpgradeToolkit domain, TemplateAnalysis 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-upgrade/src/utils/args.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