File: //opt/code/node_modules/webpack/node_modules/watchpack/package.json
{
"name": "watchpack",
"version": "1.6.0",
"description": "Wrapper library for directory and file watching.",
"main": "./lib/watchpack.js",
"directories": {
"test": "test"
},
"files": [
"lib/"
],
"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": "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"
},
"dependencies": {
"chokidar": "^2.0.2",
"graceful-fs": "^4.1.2",
"neo-async": "^2.5.0"
},
"readme": "# watchpack\r\n\r\nWrapper library for directory and file watching.\r\n\r\n[](https://travis-ci.org/webpack/watchpack) [](https://ci.appveyor.com/project/sokra/watchpack/branch/master) [![Test coverage][coveralls-image]][coveralls-url]\r\n\r\n## Concept\r\n\r\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.\r\n\r\n* The high level API requests `DirectoryWatchers` from a `WatcherManager`, which ensures that only a single `DirectoryWatcher` per directory is created.\r\n* A user-faced `Watcher` can be obtained from a `DirectoryWatcher` and provides a filtered view on the `DirectoryWatcher`.\r\n* Reference-counting is used on the `DirectoryWatcher` and `Watcher` to decide when to close them.\r\n* The real watchers (currently chokidar) are created by the `DirectoryWatcher`.\r\n* Files are never watched directly. This should keep the watcher count low.\r\n* Watching can be started in the past. This way watching can start after file reading.\r\n* Symlinks are not followed, instead the symlink is watched.\r\n\r\n## API\r\n\r\n``` javascript\r\nvar Watchpack = require(\"watchpack\");\r\n\r\nvar wp = new Watchpack({\r\n\t// options:\r\n\taggregateTimeout: 1000\r\n\t// fire \"aggregated\" event when after a change for 1000ms no additional change occurred\r\n\t// aggregated defaults to undefined, which doesn't fire an \"aggregated\" event\r\n\r\n\tpoll: true\r\n\t// poll: true - use polling with the default interval\r\n\t// poll: 10000 - use polling with an interval of 10s\r\n\t// poll defaults to undefined, which prefer native watching methods\r\n\t// Note: enable polling when watching on a network path\r\n\r\n\tignored: /node_modules/,\r\n\t// anymatch-compatible definition of files/paths to be ignored\r\n\t// see https://github.com/paulmillr/chokidar#path-filtering\r\n});\r\n\r\n// Watchpack.prototype.watch(string[] files, string[] directories, [number startTime])\r\nwp.watch(listOfFiles, listOfDirectories, Date.now() - 10000);\r\n// starts watching these files and directories\r\n// calling this again will override the files and directories\r\n\r\nwp.on(\"change\", function(filePath, mtime) {\r\n\t// filePath: the changed file\r\n\t// mtime: last modified time for the changed file\r\n});\r\n\r\nwp.on(\"aggregated\", function(changes) {\r\n\t// changes: an array of all changed files\r\n});\r\n\r\n// Watchpack.prototype.pause()\r\nwp.pause();\r\n// stops emitting events, but keeps watchers open\r\n// next \"watch\" call can reuse the watchers\r\n\r\n// Watchpack.prototype.close()\r\nwp.close();\r\n// stops emitting events and closes all watchers\r\n\r\n// Watchpack.prototype.getTimes()\r\nvar fileTimes = wp.getTimes();\r\n// returns an object with all know change times for files\r\n// this include timestamps from files not directly watched\r\n// key: absolute path, value: timestamp as number\r\n```\r\n\r\n[coveralls-url]: https://coveralls.io/r/webpack/watchpack/\r\n[coveralls-image]: https://img.shields.io/coveralls/webpack/watchpack.svg\r\n",
"readmeFilename": "README.md",
"_id": "watchpack@1.6.0",
"dist": {
"shasum": "3f335d3177008bbf1f441680a691d313faf57656"
},
"_from": "watchpack@^1.3.1",
"_resolved": "http://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz"
}