{"name":"watchpack","version":"1.7.2","description":"Wrapper library for directory and file watching.","main":"./lib/watchpack.js","directories":{"test":"test"},"scripts":{"pretest":"npm run lint","test":"mocha","travis":"npm run cover -- --report lcovonly","lint":"eslint lib","precover":"npm run lint","cover":"istanbul cover node_modules/mocha/bin/_mocha"},"repository":{"type":"git","url":"git+https://github.com/webpack/watchpack.git"},"author":{"name":"Tobias Koppers @sokra"},"license":"MIT","bugs":{"url":"https://github.com/webpack/watchpack/issues"},"homepage":"https://github.com/webpack/watchpack","devDependencies":{"codecov.io":"^0.1.6","coveralls":"^3.0.0","eslint":"^4.18.1","istanbul":"^0.4.3","mocha":"^5.0.1","rimraf":"^2.6.2","should":"^8.3.1"},"optionalDependencies":{"chokidar":"^3.4.0","watchpack-chokidar2":"^2.0.0"},"dependencies":{"graceful-fs":"^4.1.2","neo-async":"^2.5.0","chokidar":"^3.4.0","watchpack-chokidar2":"^2.0.0"},"gitHead":"8d207e733d5d03062fda298ffe49f3e3c3d35594","_id":"watchpack@1.7.2","_nodeVersion":"14.0.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-ymVbbQP40MFTp+cNMvpyBpBtygHnPzPkHqoIwRRj/0B8KhqQwV8LaKjtbaxF2lK4vl8zN9wCxS46IFCU5K4W0g==","shasum":"c02e4d4d49913c3e7e122c3325365af9d331e9aa","tarball":"http://registry-npm.ywwl.com/watchpack/download/watchpack-1.7.2.tgz","fileCount":9,"unpackedSize":23182,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJev/2gCRA9TVsSAnZWagAA87kP/3anNVdElaD7TjXwJODw\nA/t/WncVPH3FmjpVb5bmqUvObTMnAd//0TJ2tYK0wku7MCkVhuLSN8MPQ2Zy\nW9u5iLwprNoAEsR6jzJ4304LHYdVQxdBb6zbtOi+uhtcdTTRDl//l5PKlJZD\np60X7E+aZH29B+P83LhEQXcCkbnj2kToKY2v7N8IBuoUCchiItcKt9i4i5tG\nMPlIzB0b5MM3Tx6NBvYsUZh/Pm39LM0BkpvW7wuiCBetB3Gde+I+YsliuuuC\nuAsK0ReqmX+Y3JHOooZVBuU0NXsyxoK9qMQij3u/iil2qTHDcQF+OBF9a1UR\nmqLwdc+NiCFXeutfXDJCk7RSk2CgkxoCUKn0N1aiLVawdZaVYBGB8L8DTbFL\nva0aq09/ofSCHGPnkbKwRqEFZ+x7e6JDyhESxBiwOSv6aKbOqOxOCKMvn65F\nLwMDCT/UU7aTdYQXDBkumCtbYAQnlVHDVhVIPwsXbAbFtrwukFgOex1wpUOi\nIoJeHtK6TEg8B7rSM+Q7b6G3OUU1EfsxB0S+ec1ucdHhSwTwB6SZrdP8I6Ui\nvXK+Io9VMV9WIYtIyo4S9b9D11+IHsGLitHybRAgqdSUoaD4pGDjkS+kEOd0\nVv2aOnlIR6xR2GtMTUXbU91Y/smMGlB9YfiDuHr47ZLNIG6ATwgD8IJbQe1S\nnzho\r\n=vnDC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC3zrbXhNGdKNOC9aMWXzlueNwKU3ke2bbN8UOALxUtxAiEA6jmdfUqGvEbITTkBIaAK3M1TgIffjO3PEguT1hthme8="}],"size":6311,"noattachment":false,"key":"/watchpack/-/watchpack-1.7.2.tgz"},"maintainers":[{"name":"sokra","email":"tobias.koppers@googlemail.com"}],"_npmUser":{"name":"sokra","email":"tobias.koppers@googlemail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/watchpack_1.7.2_1589640607781_0.28246862884922463"},"_hasShrinkwrap":false,"readme":"# watchpack\n\nWrapper library for directory and file watching.\n\n[![Test](https://github.com/webpack/watchpack/actions/workflows/test.yml/badge.svg)](https://github.com/webpack/watchpack/actions/workflows/test.yml)\n[![Codecov](https://codecov.io/gh/webpack/watchpack/graph/badge.svg?token=8xk2OrrxWm)](https://codecov.io/gh/webpack/watchpack)\n[![Downloads](https://img.shields.io/npm/dm/watchpack.svg)](https://www.npmjs.com/package/watchpack)\n\n## Concept\n\nwatchpack high level API doesn't map directly to watchers. Instead a three level architecture ensures that for each directory only a single watcher exists.\n\n- The high level API requests `DirectoryWatchers` from a `WatcherManager`, which ensures that only a single `DirectoryWatcher` per directory is created.\n- A user-faced `Watcher` can be obtained from a `DirectoryWatcher` and provides a filtered view on the `DirectoryWatcher`.\n- Reference-counting is used on the `DirectoryWatcher` and `Watcher` to decide when to close them.\n- The real watchers are created by the `DirectoryWatcher`.\n- Files are never watched directly. This should keep the watcher count low.\n- Watching can be started in the past. This way watching can start after file reading.\n- Symlinks are not followed, instead the symlink is watched.\n\n## API\n\n```javascript\nvar Watchpack = require(\"watchpack\");\n\nvar wp = new Watchpack({\n\t// options:\n\taggregateTimeout: 1000,\n\t// fire \"aggregated\" event when after a change for 1000ms no additional change occurred\n\t// aggregated defaults to undefined, which doesn't fire an \"aggregated\" event\n\n\tpoll: true,\n\t// poll: true - use polling with the default interval\n\t// poll: 10000 - use polling with an interval of 10s\n\t// poll defaults to undefined, which prefer native watching methods\n\t// Note: enable polling when watching on a network path\n\t// When WATCHPACK_POLLING environment variable is set it will override this option\n\n\tfollowSymlinks: true,\n\t// true: follows symlinks and watches symlinks and real files\n\t//   (This makes sense when symlinks has not been resolved yet, comes with a performance hit)\n\t// false (default): watches only specified item they may be real files or symlinks\n\t//   (This makes sense when symlinks has already been resolved)\n\n\tignored: \"**/.git\"\n\t// ignored: \"string\" - a glob pattern for files or folders that should not be watched\n\t// ignored: [\"string\", \"string\"] - multiple glob patterns that should be ignored\n\t// ignored: /regexp/ - a regular expression for files or folders that should not be watched\n\t// ignored: (entry) => boolean - an arbitrary function which must return truthy to ignore an entry\n\t// For all cases expect the arbitrary function the path will have path separator normalized to '/'.\n\t// All subdirectories are ignored too\n});\n\n// Watchpack.prototype.watch({\n//   files: Iterable<string>,\n//   directories: Iterable<string>,\n//   missing: Iterable<string>,\n//   startTime?: number\n// })\nwp.watch({\n\tfiles: listOfFiles,\n\tdirectories: listOfDirectories,\n\tmissing: listOfNotExistingItems,\n\tstartTime: Date.now() - 10000\n});\n// starts watching these files and directories\n// calling this again will override the files and directories\n// files: can be files or directories, for files: content and existence changes are tracked\n//        for directories: only existence and timestamp changes are tracked\n// directories: only directories, directory content (and content of children, ...) and\n//              existence changes are tracked.\n//              assumed to exist, when directory is not found without further information a remove event is emitted\n// missing: can be files or directorees,\n//          only existence changes are tracked\n//          expected to not exist, no remove event is emitted when not found initially\n// files and directories are assumed to exist, when they are not found without further information a remove event is emitted\n// missing is assumed to not exist and no remove event is emitted\n\nwp.on(\"change\", function(filePath, mtime, explanation) {\n\t// filePath: the changed file\n\t// mtime: last modified time for the changed file\n\t// explanation: textual information how this change was detected\n});\n\nwp.on(\"remove\", function(filePath, explanation) {\n\t// filePath: the removed file or directory\n\t// explanation: textual information how this change was detected\n});\n\nwp.on(\"aggregated\", function(changes, removals) {\n\t// changes: a Set of all changed files\n\t// removals: a Set of all removed files\n\t// watchpack gives up ownership on these Sets.\n});\n\n// Watchpack.prototype.pause()\nwp.pause();\n// stops emitting events, but keeps watchers open\n// next \"watch\" call can reuse the watchers\n// The watcher will keep aggregating events\n// which can be received with getAggregated()\n\n// Watchpack.prototype.close()\nwp.close();\n// stops emitting events and closes all watchers\n\n// Watchpack.prototype.getAggregated(): { changes: Set<string>, removals: Set<string> }\nconst { changes, removals } = wp.getAggregated();\n// returns the current aggregated info and removes that from the watcher\n// The next aggregated event won't include that info and will only emitted\n// when futher changes happen\n// Can also be used when paused.\n\n// Watchpack.prototype.collectTimeInfoEntries(fileInfoEntries: Map<string, Entry>, directoryInfoEntries: Map<string, Entry>)\nwp.collectTimeInfoEntries(fileInfoEntries, directoryInfoEntries);\n// collects time info objects for all known files and directories\n// this include info from files not directly watched\n// key: absolute path, value: object with { safeTime, timestamp }\n// safeTime: a point in time at which it is safe to say all changes happened before that\n// timestamp: only for files, the mtime timestamp of the file\n\n// Watchpack.prototype.getTimeInfoEntries()\nvar fileTimes = wp.getTimeInfoEntries();\n// returns a Map with all known time info objects for files and directories\n// similar to collectTimeInfoEntries but returns a single map with all entries\n\n// (deprecated)\n// Watchpack.prototype.getTimes()\nvar fileTimes = wp.getTimes();\n// returns an object with all known change times for files\n// this include timestamps from files not directly watched\n// key: absolute path, value: timestamp as number\n```\n","publish_time":1589640607913,"_cnpm_publish_time":1589640607913,"dist-tags":{"beta":"2.0.0-beta.15","latest":"2.6.3","watchpack-1":"1.7.5"}}