{"name":"jest-haste-map","version":"30.0.0-beta.2","license":"MIT","_id":"jest-haste-map@30.0.0-beta.2","maintainers":[{"name":"simenb","email":"sbekkhus91@gmail.com"},{"name":"cpojer","email":"christoph.pojer@gmail.com"},{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"openjs-operations","email":"operations@openjsf.org"}],"dist":{"shasum":"c6d860d773f3ce002292e44a6e45956ad1106c95","tarball":"http://registry-npm.ywwl.com/jest-haste-map/download/jest-haste-map-30.0.0-beta.2.tgz","fileCount":7,"integrity":"sha512-s1u5iNXy03mv1EQyF6c4+orqikxUJAwE3zLlGKZZTVD8rRJQfrQ3wy5GYLhj/eyd/CGIne2FbCp6CCC/wJLb5A==","signatures":[{"sig":"MEYCIQCImvSRhYHbZNuV26lDX0CFSptH80QnOpV/dEXoKlzY6gIhALkNU25GNSBSx4jDz92Udr3Bdg9r5G5/gfkkQ5RJHpSk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":123338,"size":30339,"noattachment":false,"key":"/jest-haste-map/-/jest-haste-map-30.0.0-beta.2.tgz"},"main":"./build/index.js","types":"./build/index.d.ts","engines":{"node":"^18.14.0 || ^20.0.0 || >=22.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":"53a5635ac9a43099033f6103e179b13a5465e017","_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/3.12.3/node@v23.11.0+arm64 (darwin)","directories":{},"_nodeVersion":"23.11.0","dependencies":{"walker":"^1.0.8","anymatch":"^3.0.3","jest-util":"30.0.0-beta.1","micromatch":"^4.0.8","@jest/types":"30.0.0-beta.1","@types/node":"*","fb-watchman":"^2.0.0","graceful-fs":"^4.2.9","jest-worker":"30.0.0-beta.2","jest-regex-util":"30.0.0-beta.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"slash":"^3.0.0","@types/micromatch":"^4.0.7","@types/fb-watchman":"^2.0.0","@types/graceful-fs":"^4.1.3"},"optionalDependencies":{"fsevents":"^2.3.2"},"_npmOperationalInternal":{"tmp":"tmp/jest-haste-map_30.0.0-beta.2_1748309000921_0.00630701271113665","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":1748309001106,"_cnpm_publish_time":1748309001106,"dist-tags":{"alpha":"20.0.5","latest":"30.5.1","next":"30.0.0-rc.1"}}