Function
walk
packages/tailwindcss/src/walk.ts:44–55
· packages/tailwindcss/src/walk.ts::walk
(
ast: T[],
hooks:
| ((node: T, ctx: VisitContext<T>) => EnterResult<T> | void) // Old API, enter only
| {
enter?: (node: T, ctx: VisitContext<T>) => EnterResult<T> | void
exit?: (node: T, ctx: VisitContext<T>) => ExitResult<T> | void
},
)
Source from the content-addressed store, hash-verified
| 42 | } |
| 43 | |
| 44 | export function walk<T extends object>( |
| 45 | ast: T[], |
| 46 | hooks: |
| 47 | | ((node: T, ctx: VisitContext<T>) => EnterResult<T> | void) class="cm">// Old API, enter only |
| 48 | | { |
| 49 | enter?: (node: T, ctx: VisitContext<T>) => EnterResult<T> | void |
| 50 | exit?: (node: T, ctx: VisitContext<T>) => ExitResult<T> | void |
| 51 | }, |
| 52 | ): void { |
| 53 | if (typeof hooks === class="st">'function') walkImplementation(ast, hooks) |
| 54 | else walkImplementation(ast, hooks.enter, hooks.exit) |
| 55 | } |
| 56 | |
| 57 | interface Stack<T> { |
| 58 | value: T |