UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

99 lines (98 loc) 4.83 kB
{ "_args": [ [ { "raw": "run-queue@^1.0.3", "scope": null, "escapedName": "run-queue", "name": "run-queue", "rawSpec": "^1.0.3", "spec": ">=1.0.3 <2.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/move-concurrently" ] ], "_from": "run-queue@>=1.0.3 <2.0.0", "_id": "run-queue@1.0.3", "_inCache": true, "_location": "/run-queue", "_nodeVersion": "0.12.13", "_npmOperationalInternal": { "host": "packages-18-east.internal.npmjs.com", "tmp": "tmp/run-queue-1.0.3.tgz_1488161288446_0.14580746600404382" }, "_npmUser": { "name": "iarna", "email": "me@re-becca.org" }, "_npmVersion": "2.15.0", "_phantomChildren": {}, "_requested": { "raw": "run-queue@^1.0.3", "scope": null, "escapedName": "run-queue", "name": "run-queue", "rawSpec": "^1.0.3", "spec": ">=1.0.3 <2.0.0", "type": "range" }, "_requiredBy": [ "/copy-concurrently", "/move-concurrently" ], "_resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", "_shasum": "e848396f057d223f24386924618e25694161ec47", "_shrinkwrap": null, "_spec": "run-queue@^1.0.3", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/move-concurrently", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org", "url": "http://re-becca.org/" }, "bugs": { "url": "https://github.com/iarna/run-queue/issues" }, "dependencies": { "aproba": "^1.1.1" }, "description": "A promise based, dynamic priority queue runner, with concurrency limiting.", "devDependencies": { "standard": "^8.6.0", "tap": "^10.2.0" }, "directories": { "test": "test" }, "dist": { "shasum": "e848396f057d223f24386924618e25694161ec47", "tarball": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz" }, "files": [ "queue.js" ], "gitHead": "3c315b738d0578c2c54be2beb0469d00ccf1dc25", "homepage": "https://npmjs.com/package/run-queue", "keywords": [], "license": "ISC", "main": "queue.js", "maintainers": [ { "name": "iarna", "email": "me@re-becca.org" } ], "name": "run-queue", "optionalDependencies": {}, "readme": "# run-queue\n\nA promise based, dynamic priority queue runner, with concurrency limiting.\n\n```js\nconst RunQueue = require('run-queue')\n\nconst queue = new RunQueue({\n maxConcurrency: 1\n})\n\nqueue.add(1, example, [-1])\nfor (let ii = 0; ii < 5; ++ii) {\n queue.add(0, example, [ii])\n}\nconst finished = []\nqueue.run().then(\n console.log(finished)\n})\n\nfunction example (num, next) {\n setTimeout(() => {\n finished.push(num)\n next()\n }, 5 - Math.abs(num))\n}\n```\n\nwould output\n\n```\n[ 0, 1, 2, 3, 4, -1 ]\n```\n\nIf you bump concurrency to `2`, then you get:\n\n```\n[ 1, 0, 3, 2, 4, -1 ]\n```\n\nThe concurrency means that they don't finish in order, because some take\nlonger than others. Each priority level must finish entirely before the\nnext priority level is run. See\n[PRIORITIES](https://github.com/iarna/run-queue#priorities) below. This is\neven true if concurrency is set high enough that all of the regular queue\ncan execute at once, for instance, with `maxConcurrency: 10`:\n\n```\n[ 4, 3, 2, 1, 0, -1 ]\n```\n\n## API\n\n### const queue = new RunQueue(options)\n\nCreate a new queue. Options may contain:\n\n* maxConcurrency - (Default: `1`) The maximum number of jobs to execute at once.\n* Promise - (Default: global.Promise) The promise implementation to use.\n\n### queue.add (prio, fn, args)\n\nAdd a new job to the end of the queue at priority `prio` that will run `fn`\nwith `args`. If `fn` is async then it should return a Promise.\n\n### queue.run ()\n\nStart running the job queue. Returns a Promise that resolves when either\nall the jobs are complete or a job ends in error (throws or returns a\nrejected promise). If a job ended in error then this Promise will be rejected\nwith that error and no further queue running will be done.\n\n## PRIORITIES\n\nPriorities are any integer value >= 0.\n\nLowest is executed first.\n\nPriorities essentially represent distinct job queues. All jobs in a queue\nmust complete before the next highest priority job queue is executed.\n\nThis means that if you have two queues, `0` and `1` then ALL jobs in `0`\nmust complete before ANY execute in `1`. If you add new `0` level jobs\nwhile `1` level jobs are running then it will switch back processing the `0`\nqueue and won't execute any more `1` jobs till all of the new `0` jobs\ncomplete.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/iarna/run-queue.git" }, "scripts": { "test": "standard && tap -J test" }, "version": "1.0.3" }