86 lines
9.3 KiB
JSON
86 lines
9.3 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "jest-worker@22.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "jest-worker",
|
||
|
"name": "jest-worker",
|
||
|
"rawSpec": "22.1.0",
|
||
|
"spec": "22.1.0",
|
||
|
"type": "version"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/metro"
|
||
|
]
|
||
|
],
|
||
|
"_from": "jest-worker@22.1.0",
|
||
|
"_id": "jest-worker@22.1.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/jest-worker",
|
||
|
"_nodeVersion": "9.4.0",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "s3://npm-registry-packages",
|
||
|
"tmp": "tmp/jest-worker-22.1.0.tgz_1516017434237_0.7194203475955874"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "cpojer",
|
||
|
"email": "christoph.pojer@gmail.com"
|
||
|
},
|
||
|
"_npmVersion": "5.6.0",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "jest-worker@22.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "jest-worker",
|
||
|
"name": "jest-worker",
|
||
|
"rawSpec": "22.1.0",
|
||
|
"spec": "22.1.0",
|
||
|
"type": "version"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/jest-haste-map",
|
||
|
"/metro"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.1.0.tgz",
|
||
|
"_shasum": "0987832fe58fbdc205357f4c19b992446368cafb",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "jest-worker@22.1.0",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/metro",
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/facebook/jest/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"merge-stream": "^1.0.1"
|
||
|
},
|
||
|
"description": "Module for executing heavy tasks under forked processes in parallel, by providing a `Promise` based interface, minimum overhead, and bound workers.",
|
||
|
"devDependencies": {},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"integrity": "sha512-ezLueYAQowk5N6g2J7bNZfq4NWZvMNB5Qd24EmOZLcM5SXTdiFvxykZIoNiMj9C98cCbPaojX8tfR7b1LJwNig==",
|
||
|
"shasum": "0987832fe58fbdc205357f4c19b992446368cafb",
|
||
|
"tarball": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.1.0.tgz"
|
||
|
},
|
||
|
"homepage": "https://github.com/facebook/jest#readme",
|
||
|
"license": "MIT",
|
||
|
"main": "build/index.js",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "mjesun",
|
||
|
"email": "mjesun@hotmail.com"
|
||
|
},
|
||
|
{
|
||
|
"name": "cpojer",
|
||
|
"email": "christoph.pojer@gmail.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "jest-worker",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# jest-worker\n\nModule for executing heavy tasks under forked processes in parallel, by\nproviding a `Promise` based interface, minimum overhead, and bound workers.\n\nThe module works by providing an absolute path of the module to be loaded in all\nforked processes. Files relative to a node module are also accepted. All methods\nare exposed on the parent process as promises, so they can be `await`'ed. Child\n(worker) methods can either be synchronous or asynchronous.\n\nThe module also implements support for bound workers. Binding a worker means\nthat, based on certain parameters, the same task will always be executed by the\nsame worker. The way bound workers work is by using the returned string of the\n`computeWorkerKey` method. If the string was used before for a task, the call\nwill be queued to the related worker that processed the task earlier; if not, it\nwill be executed by the first available worker, then sticked to the worker that\nexecuted it; so the next time it will be processed by the same worker. If you\nhave no preference on the worker executing the task, but you have defined a\n`computeWorkerKey` method because you want _some_ of the tasks to be sticked,\nyou can return `null` from it.\n\nThe list of exposed methods can be explicitly provided via the `exposedMethods`\noption. If it is not provided, it will be obtained by requiring the child module\ninto the main process, and analyzed via reflection. Check the \"minimal example\"\nsection for a valid one.\n\n## Install\n\n```sh\n$ yarn add jest-worker\n```\n\n## Example\n\nThis example covers the minimal usage:\n\n### File `parent.js`\n\n```javascript\nimport Worker from 'jest-worker';\n\nasync function main() {\n const worker = new Worker(require.resolve('./worker'));\n const result = await worker.hello('Alice'); // \"Hello, Alice\"\n}\n\nmain();\n```\n\n### File `worker.js`\n\n```javascript\nexport function hello(param) {\n return 'Hello, ' + param;\n}\n```\n\n## API\n\nThe only exposed method is a constructor (`Worker`) that is initialized by\npassing the worker path, plus an options object.\n\n### `workerPath: string` (required)\n\nNode module name or absolute path of the file to be loaded in the child\nprocesses. Use `require.resolve` to transform a relative path into an absolute\none.\n\n### `options: Object` (optional)\n\n#### `exposedMethods: $ReadOnlyArray<string>` (optional)\n\nList of method names that can be called on the child processes from the parent\nprocess. You cannot expose any method named like a public `Worker` method, or\nstarting with `_`. If you use method auto-discovery, then these methods will not\nbe exposed, even if they exist.\n\n#### `numWorkers: number` (optional)\n\nAmount of workers to spwan. Defaults to the number of CPUs minus 1.\n\n#### `maxRetries: number` (optional)\n\nMaximum amount of times that a dead child can be re-spawned, per call. Defaults\nto `3`, pass `Infinity` to allow endless retries.\n\n#### `forkOptions: Object` (optional)\n\nAllow customizing all options passed to `childProcess.fork`. By default, some\nvalues are set (`cwd`, `env` and `execArgv`), but you can override them and\ncustomize the rest. For a list of valid values, check\n[the Node documentation](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options).\n\n#### `computeWorkerKey: (method: string, ...args: Array<any>) => ?string` (optional)\n\nEvery time a method exposed via the API is called, `computeWorkerKey` is also\ncalled in order to bound the call to a worker. This is useful for workers that\nare able to cache the result or part of it. You bound calls to a worker by\nmaking `computeWorkerKey` return the same identifier for all different calls. If\nyou do not want to bind the call to any worker, return `null`.\n\nThe callback you provide is called with the method name, plus all the rest of\nthe arguments of the call. Thus, you have full control to decide what to return.\nCheck a practical example on bound workers under the \"bound worker usage\"\nsection.\n\nBy default, no pro
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/facebook/jest.git"
|
||
|
},
|
||
|
"version": "22.1.0"
|
||
|
}
|