motion
Version:
motion - moving development forward
73 lines (72 loc) • 5.13 kB
JSON
{
"_args": [
[
"watchpack@https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "watchpack@>=0.2.1 <0.3.0",
"_id": "watchpack@0.2.9",
"_inCache": true,
"_location": "/watchpack",
"_phantomChildren": {},
"_requested": {
"name": "watchpack",
"raw": "watchpack@https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"rawSpec": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"type": "remote"
},
"_requiredBy": [
"/webpack"
],
"_resolved": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"_shasum": "62eaa4ab5e5ba35fdfc018275626e3c0f5e3fb0b",
"_shrinkwrap": null,
"_spec": "watchpack@https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"name": "Tobias Koppers @sokra"
},
"bugs": {
"url": "https://github.com/webpack/watchpack/issues"
},
"dependencies": {
"async": "^0.9.0",
"chokidar": "^1.0.0",
"graceful-fs": "^4.1.2"
},
"description": "Wrapper library for directory and file watching.",
"devDependencies": {
"coveralls": "^2.11.2",
"eslint": "^0.20.0",
"istanbul": "^0.3.13",
"mocha": "^2.1.0",
"rimraf": "^2.2.8",
"should": "^6.0.1"
},
"directories": {
"test": "test"
},
"homepage": "https://github.com/webpack/watchpack",
"license": "MIT",
"main": "./lib/watchpack.js",
"name": "watchpack",
"optionalDependencies": {},
"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 don'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 additonal change occured\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\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",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/watchpack.git"
},
"scripts": {
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
"lint": "eslint lib",
"precover": "npm run lint",
"pretest": "npm run lint",
"test": "mocha",
"travis": "npm run cover -- --report lcovonly"
},
"version": "0.2.9"
}