walk.test.ts — tailwindcss Source File
Architecture documentation for walk.test.ts, a typescript file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8611a080_7ead_035d_afe7_f2469057bba8["walk.test.ts"] 247718b3_b5b8_7b17_49ec_2bb382291311["ast.ts"] 8611a080_7ead_035d_afe7_f2469057bba8 --> 247718b3_b5b8_7b17_49ec_2bb382291311 d1ff179c_bf25_4d61_2e4f_dc49962a07aa["decl"] 8611a080_7ead_035d_afe7_f2469057bba8 --> d1ff179c_bf25_4d61_2e4f_dc49962a07aa 6c2cd8f9_a144_c040_d511_b3a89a5968f3["rule"] 8611a080_7ead_035d_afe7_f2469057bba8 --> 6c2cd8f9_a144_c040_d511_b3a89a5968f3 a3d8a743_daba_13b1_78f3_470a016c5e47["toCss"] 8611a080_7ead_035d_afe7_f2469057bba8 --> a3d8a743_daba_13b1_78f3_470a016c5e47 de024372_c459_7fda_5f4a_06bad3d1cb60["walk.ts"] 8611a080_7ead_035d_afe7_f2469057bba8 --> de024372_c459_7fda_5f4a_06bad3d1cb60 bb379d5c_9fdc_b83c_4c2a_dc331ebe547a["walk"] 8611a080_7ead_035d_afe7_f2469057bba8 --> bb379d5c_9fdc_b83c_4c2a_dc331ebe547a 369f2f88_6301_c97e_f3c1_31ea3cbb7e71["WalkAction"] 8611a080_7ead_035d_afe7_f2469057bba8 --> 369f2f88_6301_c97e_f3c1_31ea3cbb7e71 bf24b5bb_feda_f89b_5870_232ac86e45a6["vitest"] 8611a080_7ead_035d_afe7_f2469057bba8 --> bf24b5bb_feda_f89b_5870_232ac86e45a6 style 8611a080_7ead_035d_afe7_f2469057bba8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, expect, test } from 'vitest'
import { decl, rule, toCss, type AstNode as CSSAstNode } from './ast'
import { walk, WalkAction } from './walk'
type AstNode = { kind: string } | { kind: string; nodes: AstNode[] }
describe('AST Enter (function)', () => {
test('visit all nodes in an AST', () => {
let ast: AstNode[] = [
{
kind: 'a',
nodes: [
{ kind: 'b', nodes: [{ kind: 'c' }] },
{ kind: 'd', nodes: [{ kind: 'e', nodes: [{ kind: 'f' }] }] },
{ kind: 'g', nodes: [{ kind: 'h' }] },
],
},
{ kind: 'i' },
]
let visited: string[] = []
walk(ast, (node) => {
visited.push(node.kind)
})
expect(visited).toEqual(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
})
test('visit all nodes in an AST and calculate their path', () => {
let ast: AstNode[] = [
{
kind: 'a',
nodes: [
{ kind: 'b', nodes: [{ kind: 'c' }] },
{ kind: 'd', nodes: [{ kind: 'e', nodes: [{ kind: 'f' }] }] },
{ kind: 'g', nodes: [{ kind: 'h' }] },
],
},
{ kind: 'i' },
]
let paths: string[] = []
walk(ast, (node, ctx) => {
let path = ctx.path().map((n) => n.kind)
if (path.length === 0) path.unshift('ø')
path.push(node.kind)
paths.push(path.join(' → ') || 'ø')
})
expect(`\n${paths.join('\n')}\n`).toMatchInlineSnapshot(`
"
ø → a
a → b
a → b → c
a → d
a → d → e
a → d → e → f
a → g
a → g → h
// ... (1537 more lines)
Domain
Types
Source
Frequently Asked Questions
What does walk.test.ts do?
walk.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the TailwindCore domain.
What does walk.test.ts depend on?
walk.test.ts imports 8 module(s): WalkAction, ast.ts, decl, rule, toCss, vitest, walk, walk.ts.
Where is walk.test.ts in the architecture?
walk.test.ts is located at packages/tailwindcss/src/walk.test.ts (domain: TailwindCore, directory: packages/tailwindcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free