{"name":"jest-haste-map","version":"30.1.0","license":"MIT","_id":"jest-haste-map@30.1.0","maintainers":[{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"simenb","email":"sbekkhus91@gmail.com"},{"name":"rickhanlonii","email":"rickhanlonii@gmail.com"},{"name":"openjs-operations","email":"operations@openjsf.org"},{"name":"cpojer","email":"christoph.pojer@gmail.com"}],"dist":{"shasum":"e54d84e07fac15ea3a98903b735048e36d7d2ed3","tarball":"http://registry-npm.ywwl.com/jest-haste-map/download/jest-haste-map-30.1.0.tgz","fileCount":10,"integrity":"sha512-JLeM84kNjpRkggcGpQLsV7B8W4LNUWz7oDNVnY1Vjj22b5/fAb3kk3htiD+4Na8bmJmjJR7rBtS2Rmq/NEcADg==","signatures":[{"sig":"MEUCIG/aQzOcLL7cFR0+rnFSitfi4YTPBVD8pU4q2q00LkiDAiEAinBI3OJet7DE8MgUFYRVfd9x1YSqbj0SirDAbvWH4k0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":134935,"size":31773,"noattachment":false,"key":"/jest-haste-map/-/jest-haste-map-30.1.0.tgz"},"main":"./build/index.js","types":"./build/index.d.ts","engines":{"node":"^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/index.mjs","default":"./build/index.js","require":"./build/index.js"},"./package.json":"./package.json"},"gitHead":"4d5f41d0885c1d9630c81b4fd47f74ab0615e18f","_npmUser":{"name":"cpojer","email":"christoph.pojer@gmail.com"},"repository":{"url":"https://github.com/jestjs/jest.git","type":"git","directory":"packages/jest-haste-map"},"_npmVersion":"lerna/4.3.0/node@v24.6.0+arm64 (darwin)","directories":{},"_nodeVersion":"24.6.0","dependencies":{"walker":"^1.0.8","anymatch":"^3.1.3","jest-util":"30.0.5","micromatch":"^4.0.8","@jest/types":"30.0.5","@types/node":"*","fb-watchman":"^2.0.2","graceful-fs":"^4.2.11","jest-worker":"30.1.0","jest-regex-util":"30.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"slash":"^3.0.0","@types/micromatch":"^4.0.9","@types/fb-watchman":"^2.0.5","@types/graceful-fs":"^4.1.9"},"optionalDependencies":{"fsevents":"^2.3.3"},"_npmOperationalInternal":{"tmp":"tmp/jest-haste-map_30.1.0_1756270291235_0.5165242612380667","host":"s3://npm-registry-packages-npm-production"},"readme":"# jest-haste-map\n\n`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.\n\n## why jest-haste-map ?\n\n- **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.\n- **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.\n- **Minimal work**: jest-haste-map only does the minimal amount of work necessary when files change. When using [watchman](https://facebook.github.io/watchman/) (recommended for large projects), Jest asks watchman for changed files instead of crawling the file system. Without watchman, [@parcel/watcher](https://github.com/parcel-bundler/watcher) is used — it picks the best native backend for the platform (`fs-events` on macOS, `inotify` on Linux, `windows` on Windows).\n- **File system watching:** jest-haste-map can watch the file system for changes. This is useful for building interactive tools, such as watch mode.\n\n## Installation\n\nwith npm :\n\n```bash\nnpm install jest-haste-map --save-dev\n```\n\nwith yarn :\n\n```bash\nyarn add jest-haste-map --dev\n```\n\n## usage\n\n`jest-haste-map` is compatible with both `ES modules` and `CommonJS`\n\n### simple usage\n\n```javascript\nconst map = new HasteMap.default({\n  // options\n});\n```\n\n### Example usage (get all files with .js extension in the project)\n\n```javascript\nimport HasteMap from 'jest-haste-map';\nimport os from 'os';\nimport {dirname} from 'path';\nimport {fileURLToPath} from 'url';\n\nconst root = dirname(fileURLToPath(import.meta.url));\n\nconst map = new HasteMap.default({\n  id: 'myproject', //Used for caching.\n  extensions: ['js'], // Tells jest-haste-map to only crawl .js files.\n  maxWorkers: os.availableParallelism(), //Parallelizes across all available CPUs.\n  platforms: [], // This is only used for React Native, you can leave it empty.\n  roots: [root], // Can be used to only search a subset of files within `rootDir`\n  retainAllFiles: true,\n  rootDir: root, //The project root.\n});\n\nconst {hasteFS} = await map.build();\n\nconst files = hasteFS.getAllFiles();\n\nconsole.log(files);\n```\n\n### options\n\n| Option                 | Type                | Required | Default Value |\n| ---------------------- | ------------------- | -------- | ------------- |\n| cacheDirectory         | string              | No       | `os.tmpdir()` |\n| computeDependencies    | boolean             | No       | `true`        |\n| computeSha1            | boolean             | No       | `false`       |\n| console                | Console             | No       | -             |\n| dependencyExtractor    | string \\| null      | No       | `null`        |\n| enableSymlinks         | boolean             | No       | `false`       |\n| extensions             | Array&lt;string&gt; | Yes      | -             |\n| forceNodeFilesystemAPI | boolean             | No       | `false`       |\n| hasteImplModulePath    | string              | No       | -             |\n| hasteMapModulePath     | string              | No       | -             |\n| id                     | string              | Yes      | -             |\n| ignorePattern          | HasteRegExp         | No       | -             |\n| maxWorkers             | number              | Yes      | -             |\n| mocksPattern           | string              | No       | -             |\n| platforms              | Array&lt;string&gt; | Yes      | -             |\n| resetCache             | boolean             | No       | -             |\n| retainAllFiles         | boolean             | Yes      | -             |\n| rootDir                | string              | Yes      | -             |\n| roots                  | Array&lt;string&gt; | Yes      | -             |\n| skipPackageJson        | boolean             | No       | `false`       |\n| throwOnModuleCollision | boolean             | No       | `false`       |\n| useWatchman            | boolean             | No       | `true`        |\n\nFor more, you can check [github](https://github.com/jestjs/jest/tree/main/packages/jest-haste-map)\n","publish_time":1756270291436,"_cnpm_publish_time":1756270291436,"dist-tags":{"alpha":"20.0.5","latest":"30.5.1","next":"30.0.0-rc.1"}}