walk.ts — tailwindcss Source File
Architecture documentation for walk.ts, a typescript file in the tailwindcss codebase. 0 imports, 4 dependents.
Entity Profile
Dependency Diagram
graph LR 8c8c71d8_c9b0_02ac_73ec_950510adcf7a["walk.ts"] a088502e_f5da_0531_fbd0_c586a964c369["format-nodes.ts"] a088502e_f5da_0531_fbd0_c586a964c369 --> 8c8c71d8_c9b0_02ac_73ec_950510adcf7a 7de2c7a6_0dcf_0fb9_b7dd_c51f75983852["migrate-at-layer-utilities.ts"] 7de2c7a6_0dcf_0fb9_b7dd_c51f75983852 --> 8c8c71d8_c9b0_02ac_73ec_950510adcf7a a1d91fdc_e00f_534f_abf6_a58adf4778f1["sort-buckets.ts"] a1d91fdc_e00f_534f_abf6_a58adf4778f1 --> 8c8c71d8_c9b0_02ac_73ec_950510adcf7a 79c4e61a_7f2e_53a0_300b_705f6b159958["split.ts"] 79c4e61a_7f2e_53a0_300b_705f6b159958 --> 8c8c71d8_c9b0_02ac_73ec_950510adcf7a style 8c8c71d8_c9b0_02ac_73ec_950510adcf7a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
export const enum WalkAction {
// Continue walking the tree. Default behavior.
Continue,
// Skip walking into the current node.
Skip,
// Stop walking the tree entirely.
Stop,
}
interface Walkable<T> {
each(cb: (node: T, index: number) => void): void
}
// Custom walk implementation where we can skip going into nodes when we don't
// need to process them.
export function walk<T>(
rule: Walkable<T>,
cb: (rule: T, idx: number, parent: Walkable<T>) => void | WalkAction,
): undefined | false {
let result: undefined | false = undefined
rule.each?.((node, idx) => {
let action = cb(node, idx, rule) ?? WalkAction.Continue
if (action === WalkAction.Stop) {
result = false
return result
}
if (action !== WalkAction.Skip) {
result = walk(node as Walkable<T>, cb)
return result
}
})
return result
}
// Depth first walk reversal implementation.
export function walkDepth<T>(rule: Walkable<T>, cb: (rule: T) => void) {
rule?.each?.((node) => {
walkDepth(node as Walkable<T>, cb)
cb(node)
})
}
Domain
Subdomains
Functions
Types
Imported By
Source
Frequently Asked Questions
What does walk.ts do?
walk.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the CommandLineInterface domain, Renderer subdomain.
What functions are defined in walk.ts?
walk.ts defines 2 function(s): walk, walkDepth.
What files import walk.ts?
walk.ts is imported by 4 file(s): format-nodes.ts, migrate-at-layer-utilities.ts, sort-buckets.ts, split.ts.
Where is walk.ts in the architecture?
walk.ts is located at packages/@tailwindcss-upgrade/src/utils/walk.ts (domain: CommandLineInterface, subdomain: Renderer, 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