Home / File/ expand-declaration.test.ts — tailwindcss Source File

expand-declaration.test.ts — tailwindcss Source File

Architecture documentation for expand-declaration.test.ts, a typescript file in the tailwindcss codebase. 12 imports, 0 dependents.

File typescript OxideEngine PreProcessors 12 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e["expand-declaration.test.ts"]
  42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 42640952_ea63_55f1_1ff1_00816e2980ae
  2da63033_d079_7b37_5cfb_3877674a70b9["toCss"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 2da63033_d079_7b37_5cfb_3877674a70b9
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e
  947e7889_6e74_3c2d_252b_f7030e7c14e0["SignatureFeatures"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 947e7889_6e74_3c2d_252b_f7030e7c14e0
  54851997_7544_bab2_96ab_548e5f5df205["css-parser.ts"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 54851997_7544_bab2_96ab_548e5f5df205
  b8a15b09_3dfb_7181_b1f8_368422e178e4["parse"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> b8a15b09_3dfb_7181_b1f8_368422e178e4
  6ad94eb5_5050_c104_6930_f586671c39b4["expand-declaration.ts"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 6ad94eb5_5050_c104_6930_f586671c39b4
  8e1f22b2_13b1_c4b5_7edd_423453055d39["expandDeclaration"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 8e1f22b2_13b1_c4b5_7edd_423453055d39
  d1b39b63_c9d5_6c28_0206_0ddc8b895876["walk.ts"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> d1b39b63_c9d5_6c28_0206_0ddc8b895876
  ed78da58_8727_ad98_120c_61f35cea357a["walk"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> ed78da58_8727_ad98_120c_61f35cea357a
  7b34c369_d799_30f1_b751_6e3fd5349f6b["WalkAction"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 7b34c369_d799_30f1_b751_6e3fd5349f6b
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  2aa0c849_e1bd_ca62_e1ac_c91753e5c84e --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style 2aa0c849_e1bd_ca62_e1ac_c91753e5c84e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, expect, test } from 'vitest'
import { toCss } from './ast'
import { SignatureFeatures } from './canonicalize-candidates'
import { parse } from './css-parser'
import { expandDeclaration } from './expand-declaration'
import { walk, WalkAction } from './walk'

const css = String.raw

function expand(input: string, options: SignatureFeatures): string {
  let ast = parse(input)

  walk(ast, (node) => {
    if (node.kind === 'declaration') {
      let result = expandDeclaration(node, options)
      if (result) return WalkAction.ReplaceSkip(result)
    }
  })

  return toCss(ast)
}

describe('expand declarations', () => {
  let options = SignatureFeatures.ExpandProperties

  test('expand to 4 properties', () => {
    let input = css`
      .one {
        inset: 10px;
      }

      .two {
        inset: 10px 20px;
      }

      .three {
        inset: 10px 20px 30px;
      }

      .four {
        inset: 10px 20px 30px 40px;
      }
    `

    expect(expand(input, options)).toMatchInlineSnapshot(`
      ".one {
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;
      }
      .two {
        top: 10px;
        right: 20px;
        bottom: 10px;
        left: 20px;
      }
      .three {
        top: 10px;
        right: 20px;
// ... (106 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does expand-declaration.test.ts do?
expand-declaration.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in expand-declaration.test.ts?
expand-declaration.test.ts defines 1 function(s): expand.
What does expand-declaration.test.ts depend on?
expand-declaration.test.ts imports 12 module(s): SignatureFeatures, WalkAction, ast.ts, canonicalize-candidates.ts, css-parser.ts, expand-declaration.ts, expandDeclaration, parse, and 4 more.
Where is expand-declaration.test.ts in the architecture?
expand-declaration.test.ts is located at packages/tailwindcss/src/expand-declaration.test.ts (domain: OxideEngine, subdomain: PreProcessors, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free