{"name":"jest-haste-map","version":"30.0.0-alpha.7","repository":{"type":"git","url":"https://github.com/jestjs/jest.git","directory":"packages/jest-haste-map"},"license":"MIT","main":"./build/index.js","types":"./build/index.d.ts","exports":{".":{"types":"./build/index.d.ts","require":"./build/index.js","import":"./build/index.mjs","default":"./build/index.js"},"./package.json":"./package.json"},"dependencies":{"@jest/types":"30.0.0-alpha.7","@types/node":"*","anymatch":"^3.0.3","fb-watchman":"^2.0.0","graceful-fs":"^4.2.9","jest-regex-util":"30.0.0-alpha.7","jest-util":"30.0.0-alpha.7","jest-worker":"30.0.0-alpha.7","micromatch":"^4.0.8","walker":"^1.0.8"},"devDependencies":{"@types/fb-watchman":"^2.0.0","@types/graceful-fs":"^4.1.3","@types/micromatch":"^4.0.7","slash":"^3.0.0"},"optionalDependencies":{"fsevents":"^2.3.2"},"engines":{"node":"^16.10.0 || ^18.12.0 || >=20.0.0"},"publishConfig":{"access":"public"},"gitHead":"bacb7de30d053cd87181294b0c8a8576632a8b02","_nodeVersion":"20.18.0","_npmVersion":"lerna/3.11.0/node@v20.18.0+arm64 (darwin)","_id":"jest-haste-map@30.0.0-alpha.7","dist":{"integrity":"sha512-Yxxbsm00ne7b1kis8WEkCl1gf+7/TQl8S25iyGp+mDHvhzP8SFpX7Pi1Mi1D+Y0kAO8A0S+6s5UO9QXj9CKCcg==","shasum":"bb8a3f31f501d2645a10b642e3454d7732f129a0","tarball":"http://registry-npm.ywwl.com/jest-haste-map/download/jest-haste-map-30.0.0-alpha.7.tgz","fileCount":7,"unpackedSize":125227,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCrziAsvhLvWGap2dmaBs0v63QC61G6420wlf7m9aKscwIhANvn9TLpkUHO99/jb2Timc038cJIngGlS4DtVxpgL95e"}],"size":30781,"noattachment":false,"key":"/jest-haste-map/-/jest-haste-map-30.0.0-alpha.7.tgz"},"_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jest-haste-map_30.0.0-alpha.7_1738225717299_0.2854696679258657"},"_hasShrinkwrap":false,"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":1738225717466,"maintainers":[{"name":"simenb","email":"sbekkhus91@gmail.com"},{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"openjs-operations","email":"operations@openjsf.org"}],"_cnpm_publish_time":1738225717466,"dist-tags":{"alpha":"20.0.5","latest":"30.5.1","next":"30.0.0-rc.1"}}