{"name":"jest-haste-map","version":"30.5.0","license":"MIT","_id":"jest-haste-map@30.5.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"}],"homepage":"https://github.com/jestjs/jest#readme","bugs":{"url":"https://github.com/jestjs/jest/issues"},"dist":{"shasum":"c7f5ddcf9c4dce03d72fd23787b0d0cad2faa694","tarball":"http://registry-npm.ywwl.com/jest-haste-map/download/jest-haste-map-30.5.0.tgz","fileCount":8,"integrity":"sha512-0FStogBslBVOEqTOJr4oXMtFitmrWp9WscG6Gbns88i0YAuMXijCT2G5VMfg/HCR4QAnL+OF2C2ednag+HlDuA==","signatures":[{"sig":"MEUCIAmv2MW24Rd3K6bSJlJrfdJgPEZR1qtc3X1iUcrz02aOAiEAiAi//AnrFjyMlL6YxWYVbxlTKLCN1j4Iwfw82fx7xds=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCeNQIW3yUxLLkOHD+3U/HyvLyL0WpGJrPvSutcEvnhEQIgT3CID6d9xFBLrpwLtMiLhzBZNvJqVSM4MJxyYkT471Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":159406,"size":38977,"noattachment":false,"key":"/jest-haste-map/-/jest-haste-map-30.5.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":"912baa37afaa979e8179240c238cb493f960527a","_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"repository":{"url":"git+https://github.com/jestjs/jest.git","type":"git","directory":"packages/jest-haste-map"},"_npmVersion":"lerna/4.11.5/node@v26.8.1+arm64 (darwin)","description":"`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 ","directories":{},"_nodeVersion":"26.8.1","dependencies":{"fdir":"^6.5.0","anymatch":"^3.1.3","jest-util":"30.5.0","picomatch":"^4.0.3","@jest/types":"30.5.0","@types/node":"*","fb-watchman":"^2.0.2","graceful-fs":"^4.2.11","jest-worker":"30.5.0","@parcel/watcher":"^2.6.0","jest-regex-util":"30.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"slash":"^3.0.0","@types/picomatch":"^4.0.0","@types/fb-watchman":"^2.0.5","@types/graceful-fs":"^4.1.9"},"_npmOperationalInternal":{"tmp":"tmp/jest-haste-map_30.5.0_1787905725197_0.40690991992906644","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":1787905725296,"_cnpm_publish_time":1787905725296,"dist-tags":{"alpha":"20.0.5","latest":"30.5.1","next":"30.0.0-rc.1"}}