{"name":"jest-haste-map","version":"13.3.0-alpha.ffc7404b","license":"BSD-3-Clause","_id":"jest-haste-map@13.3.0-alpha.ffc7404b","maintainers":[{"name":"cpojer","email":"christoph.pojer@gmail.com"},{"name":"dmitriiabramov","email":"dmitrii@rheia.us"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"kentaromiura","email":"kentaromiura@gmail.com"}],"homepage":"https://github.com/facebook/jest#readme","bugs":{"url":"https://github.com/facebook/jest/issues"},"dist":{"shasum":"22492bf2755bcebcc3975615fb485e9c59745b2d","tarball":"http://registry-npm.ywwl.com/jest-haste-map/download/jest-haste-map-13.3.0-alpha.ffc7404b.tgz","integrity":"sha512-Sw1sQ5Xy0TBfPEGoU0EwoEcUTwMO6skUTGB42S5FzIIyJbw1lKVsSsfJE3AOr0UvStGOG9nfaZU4ZTm/OlZqAg==","signatures":[{"sig":"MEUCIHDXqd4RkpseaXguLBidUUKb1a0vHMn+oR7aQWR2xuz8AiEAuOCIl5XJEQOx4yCHbD32XjR7j6wR6efujAPDXr1msTM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":14109,"noattachment":false,"key":"/jest-haste-map/-/jest-haste-map-13.3.0-alpha.ffc7404b.tgz"},"jest":{"rootDir":"./src","testEnvironment":"node","scriptPreprocessor":"../../babel-jest"},"main":"build/index.js","_from":".","_shasum":"22492bf2755bcebcc3975615fb485e9c59745b2d","scripts":{"test":"../../packages/jest-cli/bin/jest.js"},"_npmUser":{"name":"cpojer","email":"christoph.pojer@gmail.com"},"repository":{"url":"git+https://github.com/facebook/jest.git","type":"git"},"_npmVersion":"3.10.3","directories":{},"_nodeVersion":"6.3.0","dependencies":{"fb-watchman":"^1.9.0","graceful-fs":"^4.1.3","worker-farm":"^1.3.1"},"_npmOperationalInternal":{"tmp":"tmp/jest-haste-map-13.3.0-alpha.ffc7404b.tgz_1468232417492_0.6324440157040954","host":"packages-16-east.internal.npmjs.com"},"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":1468232420389,"_cnpm_publish_time":1468232420389,"dist-tags":{"alpha":"20.0.5","latest":"30.5.1","next":"30.0.0-rc.1"}}