npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jest-haste-map

v30.5.1

Published

`jest-haste-map` is a module used by Jest, a popular JavaScript testing framework, to create a fast lookup of files in a project. It helps Jest efficiently locate and track changes in files during testing, making it particularly useful for large projects

Readme

jest-haste-map

jest-haste-map is a module used by Jest, a popular JavaScript testing framework, to create a fast lookup of files in a project. It helps Jest efficiently locate and track changes in files during testing, making it particularly useful for large projects with many files.

why jest-haste-map ?

  • Parallel crawling and analysis: jest-haste-map crawls the entire project, extracts dependencies, and analyzes files in parallel across worker processes.This can significantly improve the performance of the map building process.
  • Cached file system: jest-haste-map keeps a cache of the file system in memory and on disk. This allows for fast file related operations, such as resolving module imports and checking for changes.
  • Minimal work: jest-haste-map only does the minimal amount of work necessary when files change. When using watchman (recommended for large projects), Jest asks watchman for changed files instead of crawling the file system. Without watchman, @parcel/watcher is used — it picks the best native backend for the platform (fs-events on macOS, inotify on Linux, windows on Windows).
  • File system watching: jest-haste-map can watch the file system for changes. This is useful for building interactive tools, such as watch mode.

Installation

with npm :

npm install jest-haste-map --save-dev

with yarn :

yarn add jest-haste-map --dev

usage

jest-haste-map is compatible with both ES modules and CommonJS

simple usage

const map = new HasteMap.default({
  // options
});

Example usage (get all files with .js extension in the project)

import HasteMap from 'jest-haste-map';
import os from 'os';
import {dirname} from 'path';
import {fileURLToPath} from 'url';

const root = dirname(fileURLToPath(import.meta.url));

const map = new HasteMap.default({
  id: 'myproject', //Used for caching.
  extensions: ['js'], // Tells jest-haste-map to only crawl .js files.
  maxWorkers: os.availableParallelism(), //Parallelizes across all available CPUs.
  platforms: [], // This is only used for React Native, you can leave it empty.
  roots: [root], // Can be used to only search a subset of files within `rootDir`
  retainAllFiles: true,
  rootDir: root, //The project root.
});

const {hasteFS} = await map.build();

const files = hasteFS.getAllFiles();

console.log(files);

options

| Option | Type | Required | Default Value | | ---------------------- | ------------------- | -------- | ------------- | | cacheDirectory | string | No | os.tmpdir() | | computeDependencies | boolean | No | true | | computeSha1 | boolean | No | false | | console | Console | No | - | | dependencyExtractor | string | null | No | null | | enableSymlinks | boolean | No | false | | extensions | Array<string> | Yes | - | | forceNodeFilesystemAPI | boolean | No | false | | hasteImplModulePath | string | No | - | | hasteMapModulePath | string | No | - | | id | string | Yes | - | | ignorePattern | HasteRegExp | No | - | | maxWorkers | number | Yes | - | | mocksPattern | string | No | - | | platforms | Array<string> | Yes | - | | resetCache | boolean | No | - | | retainAllFiles | boolean | Yes | - | | rootDir | string | Yes | - | | roots | Array<string> | Yes | - | | skipPackageJson | boolean | No | false | | throwOnModuleCollision | boolean | No | false | | useWatchman | boolean | No | true |

For more, you can check github