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 200c8408_4d17_9364_423b_0ce2d40b1e09["walk.ts"] e7639b6d_2132_7e05_9498_c732c7517772["format-nodes.ts"] e7639b6d_2132_7e05_9498_c732c7517772 --> 200c8408_4d17_9364_423b_0ce2d40b1e09 9e4e8a58_fb9b_d663_2880_954972aac787["migrate-at-layer-utilities.ts"] 9e4e8a58_fb9b_d663_2880_954972aac787 --> 200c8408_4d17_9364_423b_0ce2d40b1e09 ecf9faa2_4ccf_f16c_bb10_222be63faed0["sort-buckets.ts"] ecf9faa2_4ccf_f16c_bb10_222be63faed0 --> 200c8408_4d17_9364_423b_0ce2d40b1e09 e46aa0a1_8e0f_d880_965e_ea61032b8ef1["split.ts"] e46aa0a1_8e0f_d880_965e_ea61032b8ef1 --> 200c8408_4d17_9364_423b_0ce2d40b1e09 style 200c8408_4d17_9364_423b_0ce2d40b1e09 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 UpgradeToolkit domain, Codemods 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: UpgradeToolkit, subdomain: Codemods, 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