This package provides a utility function, `visitParents`, to recursively walk a Unist syntax tree with depth-first traversal while also passing the full stack of ancestor nodes to your visitor callback. It is useful when you need to process nodes based on their context in the tree, such as handling a node type while also knowing every parent type.
Project status
- The repository appears actively maintained, with a recent update on 2025-10-16 (6.0.2) and prior maintenance activity in 2023 (6.0.0 and 6.0.1).
- Update cadence looks low but ongoing, with a gap from 2023-07-07 to 2025-10-16 for the most recent update, suggesting a mostly maintenance-driven pattern rather than frequent releases.
AI summary generated Today
Recent updates
6.0.2
7 months agoRelease 6.0.2 is described as a TypeScript type fix for readonly arrays. The code changes confirm this by updating the internal conditional types so readonly arrays are handled correctly in the match-check typing for `visitParents`. In addition, the release includes several build and tooling changes that are not mentioned in the release notes.
6.0.1
7/7/2023Release 6.0.1 is a small maintenance release focused on fixing TypeScript declaration (.d.ts) generation. The published version changes from 6.0.0 to 6.0.1, with code changes limited to JSDoc typedefs in the main entry file.
6.0.0
7/7/2023unist-util-visit-parents 6.0.0 is a major release that updates the package export mechanism (exports map), drops support for older Node.js versions, and heavily revises the TypeScript types used to infer visitor parameters. It also removes complex-types.d.ts and reworks the internal type-level descendant/ancestor utilities for better performance.
BreakingFeatures5.1.3
1/24/2023Release 5.1.3 is a very small change focused on TypeScript type exports. The only functional change visible in the diff is adjusting where complex type aliases are re-exported from, plus the normal version bump.
5.1.2
1/24/2023Release 5.1.2 is primarily described as documentation and code-style refactors. The actual diff shows a larger internal restructuring, including moving the runtime implementation under a new lib/ folder and significantly reorganizing TypeScript declaration files and published file layout.
5.1.1
8/21/2022Release 5.1.1 is a small patch that focuses on TypeScript Node16 and ESM compatibility, plus documentation updates. The code diff shows no runtime logic changes to `visitParents`, but it does include TypeScript typing and build configuration adjustments intended to improve module resolution under Node16.
5.1.0
9/21/2021Release 5.1.0 focuses on improving TypeScript typing for the `parents` argument (ancestors) passed to `visitParents`. The runtime code changes are minimal, but the type definitions were refactored and made more precise, and the test/development toolchain dependencies were bumped.
BreakingFeatures5.0.0
7/29/2021Version 5.0.0 of unist-util-visit-parents primarily updates the TypeScript typings for `visitParents` so the `visitor` callback type is inferred from the provided `tree` and `test`. The runtime traversal logic appears effectively unchanged, with changes concentrated in type-level utilities and test/typing infrastructure. A few repository-level build and CI configuration changes also landed but were not mentioned in the release notes.
BreakingSecurity4.1.1
5/10/2021Release 4.1.1 makes a small change in `visitParents` to use a `name` property instead of `displayName` when constructing the visited node object. The version bump is reflected in `package.json`.
4.1.0
5/10/2021Release 4.1.0 updates the package version and typing surface by introducing a `VisitorResult` type intended to standardize what visitor functions may return. The code diff also refactors the JSDoc type definitions to rely on `Test` from `unist-util-is` and adjusts the `visitParents` and internal result handling typings accordingly.
Features