escalade is a minimalistic and performant utility designed for synchronously or asynchronously traversing up parent directories to locate a specific file or directory. It continuously executes a provided callback function for each directory in the ancestry chain until the callback returns a truthy value, at which point the absolute path to the found item is returned, or until the system root directory is reached. The current stable version is `3.2.0`, with releases occurring a few times a year for patches, minor features, and ecosystem compatibility updates (e.g., Deno support, TypeScript resolution fixes). Its primary differentiators are its extremely small footprint (183-210 bytes gzipped) and its clear separation into synchronous and asynchronous execution modes, catering to a wide range of Node.js and Deno environments. It strictly searches direct parent directories and does not explore sibling directories of parents.
npm install escaladeVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use the async `escalade` function to traverse parent directories from a given starting path to find the nearest `package.json` file. It then logs the path and the package name if found.
If you need to search sibling directories or a broader filesystem scope, a different utility or manual directory traversal logic is required.
Ensure your `tsconfig.json`'s `moduleResolution` and `module` options are correctly configured for your environment (e.g., `Node16` or `NodeNext`). This change primarily resolves issues rather than introducing new ones, but older tooling might need updates.
Update to `escalade@3.1.1` or newer. Alternatively, avoid Node.js versions 13.0-13.6 if using older `escalade` versions with CommonJS `require()`.
When importing from `escalade/sync`, remove any `await` keywords and handle the return value directly, as it is synchronous. For asynchronous operations, import from the default `'escalade'` path.
Ensure you are importing the correct version of escalade. If you need asynchronous behavior, import from `'escalade'`. If you intend to use the synchronous version from `'escalade/sync'`, remove `await` keywords as it returns its value directly.
Ensure your `tsconfig.json` has appropriate `moduleResolution` settings (e.g., `Node16` or `NodeNext`). If using `escalade@3.1.2`, ensure `nodenext` is configured. For `escalade@3.2.0` and newer, separate ESM/CJS type definitions are provided, which should resolve most ambiguity issues. Clear `node_modules` and reinstall if issue persists.
Verify your Node.js version is compatible (>=12.17.0 for stable `exports` support). Ensure bundlers or module loaders are configured to handle `exports` maps. Updating `escalade` to the latest version (`v3.1.1` fixed some specific Node 13.x issues) can also help.
No dependency data recorded yet.