estree-util-visit is a core utility within the unified (syntax-tree) ecosystem designed for traversing ESTree (and esast) abstract syntax trees. It enables developers to visit nodes in a depth-first traversal (preorder and/or postorder) for analysis or transformation. The current stable version is 2.0.0. The package distinguishes itself by duck-typing fields for node identification, eliminating the need for a predefined dictionary of node fields, which can simplify usage compared to other walkers. It provides symbolic controls (CONTINUE, EXIT, SKIP) for fine-grained traversal management. Releases are generally tied to ecosystem-wide updates or targeted feature enhancements. Since v2, it is an ESM-only package and requires Node.js 16 or newer.
npm install estree-util-visitVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing an ESTree with Acorn and then traversing it with `estree-util-visit` to find and log literal values, showcasing traversal control with `EXIT`.
Ensure your Node.js environment is version 16 or newer. Update your `package.json` engines field or CI/CD pipelines accordingly.
Refactor your codebase to use ES module `import` statements (e.g., `import { visit } from 'estree-util-visit'`). Adjust build configurations (e.g., Webpack, Rollup) or Jest setups to handle ESM correctly.Update your visitor functions to expect and handle `undefined` instead of `null` for these arguments, e.g., `if (field !== undefined)`.
Ensure that your project's `@types/unist` dependency (if any) is updated to a compatible version, or remove it if it's implicitly handled by `estree-util-visit`.
Change your import statement from `const { visit } = require('estree-util-visit')` to `import { visit } from 'estree-util-visit'`. Ensure your project is configured for ESM.Verify that you are using `import { visit } from 'estree-util-visit'` and not `import visit from 'estree-util-visit'` (there is no default export). Check your Babel/TypeScript configuration if transpiling.Add `CONTINUE` (and any other control symbols you use) to your named import: `import { visit, CONTINUE } from 'estree-util-visit'`.No dependency data recorded yet.