{"_id":"threads","_rev":"100-d5f750ea3db15050581bf9b97b7b630c","name":"threads","time":{"modified":"2022-06-27T06:17:13.028Z","created":"2015-06-04T21:22:54.599Z","0.1.0":"2015-06-04T21:22:54.599Z","0.5.0":"2015-09-21T18:56:53.582Z","0.5.1":"2015-10-16T07:59:42.621Z","0.5.2":"2015-10-22T17:46:55.395Z","0.5.3":"2015-10-27T15:38:48.241Z","0.5.4":"2016-02-29T19:00:33.474Z","0.6.1":"2016-06-17T06:39:19.977Z","0.7.0":"2016-07-17T14:36:33.006Z","0.7.1":"2016-11-04T15:18:36.877Z","0.7.2":"2016-11-10T12:47:08.078Z","0.7.3":"2017-05-09T13:20:55.132Z","0.8.0":"2017-06-02T12:20:27.603Z","0.8.0-publish-test":"2017-06-02T15:59:53.451Z","0.8.1":"2017-06-02T16:08:28.884Z","0.9.0":"2017-11-28T19:42:18.617Z","0.10.0":"2017-12-03T12:23:26.019Z","0.10.1":"2018-01-19T09:08:11.690Z","0.11.0":"2018-04-28T09:56:38.307Z","0.11.0-umd":"2018-06-19T18:58:39.642Z","0.12.0":"2018-06-19T20:17:49.880Z","0.12.1":"2019-02-04T22:45:51.948Z","1.0.0-alpha":"2019-05-10T17:41:40.139Z","1.0.0-alpha.2":"2019-06-07T07:44:39.697Z","1.0.0-alpha.3":"2019-06-07T17:08:52.932Z","1.0.0-alpha.4":"2019-06-09T15:59:25.788Z","1.0.0-beta":"2019-06-23T09:40:07.804Z","1.0.0-beta-esm":"2019-06-25T21:21:04.631Z","1.0.0-beta-esm.1":"2019-06-27T20:05:05.539Z","1.0.0-beta.1":"2019-06-27T20:46:34.109Z","1.0.0-beta.2":"2019-07-01T21:27:16.038Z","1.0.0-beta-esm.2":"2019-07-08T18:11:12.395Z","1.0.0-beta.2-tsconfig":"2019-07-13T18:12:43.391Z","1.0.0-beta.2-ts-node-worker":"2019-07-14T14:53:31.862Z","1.0.0-beta.2-tsconfig.2":"2019-07-17T06:59:24.960Z","1.0.0-beta.3":"2019-07-22T07:27:44.324Z","1.0.0-beta.3-bugfix-148":"2019-08-14T20:00:07.938Z","1.0.0-beta.3-bugfix-147":"2019-08-15T07:15:16.723Z","1.0.0-beta.4":"2019-08-17T18:32:00.366Z","1.0.0-beta.5":"2019-08-28T06:42:22.987Z","1.0.0-beta.5-feature-156":"2019-09-08T09:08:20.208Z","1.0.0-beta.5-feature-156.1":"2019-09-09T06:22:57.423Z","1.0.0-beta.6":"2019-09-10T19:55:15.446Z","1.0.0-beta.7":"2019-11-14T07:44:19.105Z","1.0.0-beta.8":"2019-11-16T20:46:03.242Z","1.0.0-beta.9":"2019-12-14T11:21:53.332Z","1.0.0":"2019-12-28T10:04:31.878Z","1.0.1":"2020-01-22T18:56:13.155Z","1.0.2":"2020-01-25T10:40:45.226Z","1.1.0":"2020-02-07T09:50:48.350Z","1.2.0":"2020-02-14T17:30:01.849Z","1.2.1-test":"2020-02-16T00:58:58.790Z","1.3.0":"2020-02-26T20:40:58.813Z","1.3.1":"2020-03-11T08:04:37.574Z","1.3.1-asar.unpack":"2020-03-25T06:52:19.407Z","1.3.1-asar.unpack.2":"2020-03-31T19:46:05.925Z","1.3.1-asar.unpack.3":"2020-04-01T07:42:32.063Z","1.4.0":"2020-04-05T15:11:24.911Z","1.4.0-error-reporting-fix":"2020-04-18T19:29:55.637Z","1.4.0-resolve-asar-immediately":"2020-04-19T16:39:45.148Z","1.4.1":"2020-04-24T06:33:54.718Z","1.4.1-extended-error-reporting":"2020-05-01T13:51:51.711Z","1.4.1-test-ci-publish":"2020-06-10T15:25:16.950Z","1.4.1-test-ci-publish.2":"2020-06-11T03:03:33.211Z","1.5.0":"2020-06-11T08:58:19.047Z","1.6.0":"2020-06-12T10:18:52.401Z","1.6.0-conditional-exports":"2020-06-13T08:42:43.407Z","1.6.1":"2020-06-15T14:38:46.593Z","1.6.1-proxy-unsubscribe":"2020-06-16T13:39:18.744Z","1.6.2":"2020-06-21T09:57:12.482Z","1.6.3":"2020-06-27T09:02:28.007Z","1.6.3-callbacks":"2020-06-30T15:55:26.230Z","1.6.4":"2021-04-18T20:52:20.595Z","1.6.5":"2021-06-03T20:42:08.816Z","1.7.0":"2021-09-25T18:46:12.367Z"},"maintainers":[{"name":"andywer","email":"github@andywer.com"}],"dist-tags":{"latest":"1.7.0","next":"1.0.0-alpha.4","esm":"1.0.0-beta-esm.2","test":"1.0.0-beta.5-feature-156.1","testing":"1.6.3-callbacks"},"description":"Web workers & worker threads as simple as a function call","readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nNote: You'll need to be using Typescript version 4+, as the types generated by threads.js are not supported in Typescript 3.\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","versions":{"0.5.0":{"name":"threads","version":"0.5.0","keywords":["thread","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"compile":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"gitHead":"992c71cda24a5658645d4d65945f55217e597fe0","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.5.0","_shasum":"0629b8c4e1e2618802136fde931029e40e5f5c93","_from":".","_npmVersion":"2.13.5","_nodeVersion":"0.12.7","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"0629b8c4e1e2618802136fde931029e40e5f5c93","tarball":"https://registry.npmjs.org/threads/-/threads-0.5.0.tgz","integrity":"sha512-VrYj8deWP7F9+ncbMWVT5T1ssk43QjOwNaMbuZCefuAQYqP/Fnxvd9Y5uQmqVqyIlfAZZCPZPdQzmeSAPS+4vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+o1JM51sHptFaoVD5VkNBSTdzTb+v/c33tnsFCYpp0AiAa/D1Lvvgfy2eqM8fRlyqIOyjO2PHA7m8tcFmBkhPl2Q=="}]},"directories":{}},"0.5.1":{"name":"threads","version":"0.5.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"compile":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"gitHead":"4a9fbdd08380fa5865c3927467edd32eed523f5b","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.5.1","_shasum":"14fcdec0bb2a6b4b198b4e0f247463c390c3f12b","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.2","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"14fcdec0bb2a6b4b198b4e0f247463c390c3f12b","tarball":"https://registry.npmjs.org/threads/-/threads-0.5.1.tgz","integrity":"sha512-3weKj5FjUk/R3DwiMvgnWqAwYsuWHmqKoXr5vY2g5GYEw/SAlhsejzE74gI3sBUT5Josg4bcQ386NsIVywCRaQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDS44hr1yqw1yRD2zbeBUA7MPoCitdVo9ALdSE8DRU5uAIhAOltQ4nhWZ4YO+t/ulLt8KKF3untx/37mR91jEaZrWxy"}]},"directories":{}},"0.5.2":{"name":"threads","version":"0.5.2","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"compile":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"gitHead":"b668982655b9bc108949f8fe32c0c000f498f172","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.5.2","_shasum":"e92c2eafad09ed9f4d06c7c52d8a8ae05af2f459","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.2","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"e92c2eafad09ed9f4d06c7c52d8a8ae05af2f459","tarball":"https://registry.npmjs.org/threads/-/threads-0.5.2.tgz","integrity":"sha512-kKtwQZJQ0tCAtetkaf+7FCJlyCOD1MTpf/Mv1FHWVIJk16SQToD8OMqHuX0ksttjYq+sbFqV/jPo8JKVH4Re6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDoAfCBOPnWZ3+jgWFY+duf4nrPQRgFfbh+zlb7QJgAwIhAOCcZ1oGEtCNKJz2OzmsEth8xGXZYXLDb5jWLZ+knCYn"}]},"directories":{}},"0.5.3":{"name":"threads","version":"0.5.3","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"compile":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","codeclimate-test-reporter":"^0.1.1","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","istanbul":"^0.4.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"gitHead":"b8cd62db76fddc3ca886806490f4b6c34da7dc99","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.5.3","_shasum":"dca82fc5b83600859e2b49c658627ac2dfe1a097","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.2","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"dca82fc5b83600859e2b49c658627ac2dfe1a097","tarball":"https://registry.npmjs.org/threads/-/threads-0.5.3.tgz","integrity":"sha512-rVTMvDchA0m+FnyXeeGVMmJC1jOxTKpteHozli+ikXYirlwr1aQRoAZIXf4xFrK7fY66YQ4Fp4rm1+HUnyWCqA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID7vo+6hXFOpGsHvd39Sfn8hu59/avK3g5QS5QH0nRswAiEA/etNcXExF8H5cUOyF2XePnK76mMARyZGaWE/AnhxE04="}]},"directories":{}},"0.5.4":{"name":"threads","version":"0.5.4","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"compile":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","codeclimate-test-reporter":"^0.1.1","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","istanbul":"^0.4.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"aed40e17bea9348ab18dc8d68774a8df5c43f9b0","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.5.4","_shasum":"664e816820972e59dbb80617e34bb8b16e794e6c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"664e816820972e59dbb80617e34bb8b16e794e6c","tarball":"https://registry.npmjs.org/threads/-/threads-0.5.4.tgz","integrity":"sha512-yZZiDkgeTPMHou65uAbFAKCz6h7efednvm/CIlKpy7O6C5IjAVwy74RTGTQAY9r4NscRwaVmf30PyhbaH8AvoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6nzqTcX4zo0QFZtSl6WvkrKhmCW04DwOS6m+lQlBZ+wIhANmHjeP0DluXxgeMzttGGtGIRvjPS8gRCNhU3X+knxSq"}]},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/threads-0.5.4.tgz_1456772429956_0.8004661768209189"},"directories":{}},"0.6.1":{"name":"threads","version":"0.6.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"build":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","codeclimate-test-reporter":"^0.1.1","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","istanbul":"^0.4.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"d8874d0c79d687d4b984f83c127ac235f96721ad","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.6.1","_shasum":"b4da46c679299d143a7fb75cb43bfdab1080ccdb","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.1","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"b4da46c679299d143a7fb75cb43bfdab1080ccdb","tarball":"https://registry.npmjs.org/threads/-/threads-0.6.1.tgz","integrity":"sha512-KIAtEi3cLhnyvdlPSCqLfbKjaoHuHM2Pc7kcvo29j4tmNQh1Eb/lAE7XgXxzJS9A2nEwPovg3Kh64ceoaiZCyQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCl7e2fNh144zTM9GH6WmmzwDbvAyRHUfK7JLFeamM1RAIhAIad3Te4Zv2y7apS94kGwjSIDGZHzPEcQmVzFC+NPNUU"}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/threads-0.6.1.tgz_1466145558965_0.59181671240367"},"directories":{}},"0.7.0":{"name":"threads","version":"0.7.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"build":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","codeclimate-test-reporter":"^0.1.1","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","istanbul":"^0.4.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"58713a7a2c394d04bea37cc6b2af7a7a5ed10666","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.7.0","_shasum":"067cd8cc7358638e6f7594febd64ec0de0f5b44b","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.1","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"dist":{"shasum":"067cd8cc7358638e6f7594febd64ec0de0f5b44b","tarball":"https://registry.npmjs.org/threads/-/threads-0.7.0.tgz","integrity":"sha512-hqvmhrHfvLsv5fEXcRPmHvnTMHwCWtZPKbdLnqxWSxsDzbub7uHe4jtIzeDTB3sG/BOwGVAbVcOXwI1qfTTSGg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICF2eTM5vahrFSvVLFO1bFk9BIX6+eFMjAYy/R3vG7l/AiEA3j2T4Uc3HhT2fiZZk/zOv5IigDxA3LkXzVjDdO6tTJI="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/threads-0.7.0.tgz_1468766190502_0.6943339589051902"},"directories":{}},"0.7.1":{"name":"threads","version":"0.7.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"build":"gulp dist","test":"gulp test"},"devDependencies":{"async":"^1.4.2","browserify":"^9.0.8","codeclimate-test-reporter":"^0.1.1","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^5.2.0","gulp-concat":"^2.5.2","gulp-eslint":"^0.9.0","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^1.2.0","istanbul":"^0.4.0","karma":"^0.13.9","karma-browserify":"^4.3.0","karma-chrome-launcher":"^0.2.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^1.1.1","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"b72abb9120c444f179db5d3229a3495c87191fef","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.7.1","_shasum":"8216ff4f4c6b8fac3a2879ae97096ac6f032b4ee","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"8216ff4f4c6b8fac3a2879ae97096ac6f032b4ee","tarball":"https://registry.npmjs.org/threads/-/threads-0.7.1.tgz","integrity":"sha512-8G+JLDbRChWiMKxhSX4rkodEv6UBzFm2Kv0Rv9bKYIjwLvii4Ekm/t1H7/qFvVrg5yVd6NJitDnMkq81uvZaZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtloOBtQkSK2Za83VdvOalkVeKmwI+Z92nT03icjSTQwIhAIVu1lePwUOcXGm94iaEwSXfe0QRpWqLZzUVzTGc+vxC"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/threads-0.7.1.tgz_1478272714999_0.842258860822767"},"directories":{}},"0.7.2":{"name":"threads","version":"0.7.2","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"build":"gulp dist","test":"gulp test"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"d0c0f3e281cb8df233710860be95b075730e516e","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.7.2","_shasum":"852ab7053d43a1dd3b3ef88e1563abb6245068bf","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"852ab7053d43a1dd3b3ef88e1563abb6245068bf","tarball":"https://registry.npmjs.org/threads/-/threads-0.7.2.tgz","integrity":"sha512-jhVXxxoyn4d7TcK8uuPBNg0bZj86NrLyekdnicMPYm00GD7M7+Pp+BifBehiQqLDSV0jl4xEqn2QLD8K5mfysA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBnVttAUcznDcJNl/8eSJzZ+/gAXUvWmW+N5TTrKTwE8AiBArUUrmI9fgzs7ibISL0WTNsmiI4NeyyeaSEvEfJftmw=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/threads-0.7.2.tgz_1478782025956_0.02033776929602027"},"directories":{}},"0.7.3":{"name":"threads","version":"0.7.3","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","bugs":{"url":"https://github.com/andywer/thread.js/issues"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"scripts":{"build":"gulp dist","test":"gulp test"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"85d933f8e651b07d94a576256f37d2afe21cd7cd","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.7.3","_shasum":"ebd03093a3ed830185b916606fa46f932249b24d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"ebd03093a3ed830185b916606fa46f932249b24d","tarball":"https://registry.npmjs.org/threads/-/threads-0.7.3.tgz","integrity":"sha512-QzxU4qCxT8BCrjTyQ8xe3+2aof7b9QNTI+eG9wMXx6QO/00QfefnZwqoavtCti2J3oXnf0sO0hZW7HVKb3pmvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDj+v+FhA4GupOEO6wRQ1Vzb+58PFbsxR45fq1ownji5QIhAIWDYhUomTrnNz6AixmWQaBoUFP6LtoUnLVrSbgA2AyS"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/threads-0.7.3.tgz_1494336053784_0.04799614124931395"},"directories":{}},"0.8.0":{"name":"threads","version":"0.8.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"f74fda12a1e87bc2257934de723fbdeb3abd0c51","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.8.0","_shasum":"c22c21f5da1ac55e36e75a0573fc932576e46822","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"c22c21f5da1ac55e36e75a0573fc932576e46822","tarball":"https://registry.npmjs.org/threads/-/threads-0.8.0.tgz","integrity":"sha512-gfW9UStBnklJzpC9GpeTzCQqGGX2XwVeU9UYyGM+ryOTKpJi9eGELYGiugCNkqSKiP2BSOIaCOhbEelIwhUBRg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICvFX8lQwIFwnlnxaMbWYQqXA4DvDHpZXgDftP2TbJjSAiEA83Llm6iG2Uuou/Is27dLsLjZklj+Z2TVO00ct5kyGg8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.8.0.tgz_1496406026463_0.07161094504408538"},"directories":{}},"0.8.0-publish-test":{"name":"threads","version":"0.8.0-publish-test","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"f74fda12a1e87bc2257934de723fbdeb3abd0c51","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.8.0-publish-test","_shasum":"d2ffb172525ee2b99293c2a0141264a17b5527ce","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"d2ffb172525ee2b99293c2a0141264a17b5527ce","tarball":"https://registry.npmjs.org/threads/-/threads-0.8.0-publish-test.tgz","integrity":"sha512-qZvy9fB1RSk13o624XhoDAn+jjoHcdCWQbCaokLMzH0PSigO/FEKv+viPAlF1Cp0eZv5GvgnBaI/uoyhrAkK0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDO1yfCbJ63+TOFrFbkZ1nJi8TD6dpnivglgF5hvWrlXgIgL8+WAQsTw6EKEG0Q2VbQQ/ISrvEPW95zS4awsKQPRek="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.8.0-publish-test.tgz_1496419192343_0.4548491353634745"},"directories":{}},"0.8.1":{"name":"threads","version":"0.8.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"6e63f53f521f02896520704a578324c4e63e45f8","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.8.1","_shasum":"e340115b5947316d2f7ee3123c4c2c5bf9c76d72","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"shasum":"e340115b5947316d2f7ee3123c4c2c5bf9c76d72","tarball":"https://registry.npmjs.org/threads/-/threads-0.8.1.tgz","integrity":"sha512-PqXSaMWla5uksPmxg4sZpnzSrynGWdMzFIbJOQFUlCRRmveHCm9hW/uCgoCDXT1P7VN/uhqTGF1WKs0KVj4UTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/TqESCnO1DR6wB1c5CnEb7VfJMFwFuZmtbiKV2iXTFgIgBc0qmSPAv2fAVaPBLb2ui/TqBVygVRw9NJEYd+O1d74="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.8.1.tgz_1496419707734_0.2576294362079352"},"directories":{}},"0.9.0":{"name":"threads","version":"0.9.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":["es2015","es2015-loose"]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"afdee535ff34a63ce99878f7137173289850db06","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.9.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-5kyQA6vY9m5Uzu3sYwiwsC8pXh0/0GTIWq6j6HNGtcHfGPMoRqjQisrlL5xk6ew+OqE+R8xsRLnlBl98DNypzg==","shasum":"cf1132ee7b6b205253e8dedc13904cc7646dbcc4","tarball":"https://registry.npmjs.org/threads/-/threads-0.9.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9PC+ZQ5uHPJLlRWWTw1/Zz6UyzRnOMu5gySRkeZbqcwIgSOVje1bYp3wEpXByZu9/UZ0J/2rh/FO8gFiQqRtiYeE="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.9.0.tgz_1511898137448_0.044959219405427575"},"directories":{}},"0.10.0":{"name":"threads","version":"0.10.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"5148694546bc364ca9cd17a36eb3440f8b84752f","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.10.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-SQlMt7Uz/Klb9p1iKvl9A809j3CSX/xiiwIl3+FUVmsCYVnyzvR19Pn8XDJKIi6aSM5EwK32i2oGAsx1FaQTVg==","shasum":"a6b0bc5d916fa75434b166c612769684b65fead5","tarball":"https://registry.npmjs.org/threads/-/threads-0.10.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbSJJZ8SHkE4uPnqDo0Dwhzuvi9phEibxV0Z/WJmZeUgIhAIpXhq2IvtgoB6KjRp8MDx0p6pmHaXBFXimW69ZGQRfp"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.10.0.tgz_1512303804867_0.6283952216617763"},"directories":{}},"0.10.1":{"name":"threads","version":"0.10.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.8.11","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"634d4c1f33a2dfda304ec6b029b410170f438527","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.10.1","_npmVersion":"5.6.0","_nodeVersion":"8.7.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-80FvzE6ob/D06HQkwSSmp2NZKXvXP1t8c6Y8borLYKzIz1KxvkseMJonj/tLU+5fpQk9PMfeomhbKdrIKaBaZQ==","shasum":"637765dc434ab3373d3c14754c8f7ac6515d6815","tarball":"https://registry.npmjs.org/threads/-/threads-0.10.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNb4Fpq1VwRGF2151+Bbe5bIe0gA9dMrSyPxyTUheUHQIhANYR3KGGAHVQZYgIc3E8OFWPfkauei15/APqEE499XeU"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads-0.10.1.tgz_1516352891612_0.07058462151326239"},"directories":{}},"0.11.0":{"name":"threads","version":"0.11.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"1c96b7cc3cf06fbc4b97b5bb71775ce22ce14f28","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.11.0","_npmVersion":"6.0.0","_nodeVersion":"8.7.0","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-Wvr0ZrMchpyvQwwGaJWmtAryQTOHN3tvciuIgMG+OA1co18YwiZIW4lGPE0Z0+kFZbEzyIbIX5s2Lq7H46tCTA==","shasum":"070897e1e2a5630816a781132406daff78c3e024","tarball":"https://registry.npmjs.org/threads/-/threads-0.11.0.tgz","fileCount":59,"unpackedSize":211691,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa5EVXCRA9TVsSAnZWagAAHQkP/RUaTqSiEfXgZvq5E+Mn\nsYD/WEzMgeKJfudaZ5j+5jsGTEl6Q0LW/c2IZiDsV2JjQouEADWOdkznKtyH\ncrYM1UGJsgfoMEDaO2IDNxHyYEJdMmzN6lKef1QW7Z/6xXUhXD6QDSTV5iml\nPPZHSLm/249BEegCeXFKJdzXCXaSsuK/6J0HA7IY5MXwZyDtRi2mJIi/wIuH\nboDTN6Zmg5G/+yALZnW2gqDMtm/N+wJMo1/fO34416FAf/Z02SRZkSz/4Byy\nG7vzQ+UoAsxqASLhMePCve0v9Sg0VLahgW6/46xBDyFuC+qCd4AyVZhLuRTi\nNqV4nB6mEcS22Y+kbcATLsHVzItuWXsNP2ZSivW0tlMHj9b0aLoC9DsYcdlp\nAmVmP3WA7ok2M+79f6YXLUWqXerHvRBu4h9b50CzCf4UJUotUPFAN6FT3Ue4\n7drp9suVL7FYei+Blms+iMNiJfyBtSaJ4v1WJoM1f6EMGKNjZOkRzX1RNQjw\nZBr3XnHX8l182QGq9v8EyYQ463tEfzWApT/k561H6AbaopLdWY6uUydp1rHo\ny+ONNQ2KrsrPT72eEjJ7252RFDLAv6D/ZaEfM3H7RhWzlhtB65alPSDAQAXn\nKZBLipYdwBL9Y4Jfovn2YaNqmkjt5cXKA+EjBw9UX07mSiQ21DkbsHqKG0da\nB2pr\r\n=xzgc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEklz3fymyjzBl+dGzOthRoNoyxHWf2+v62YomB846baAiEAjdVyDTHvcoyroev50Rbs2WUJP1ff4ivJs7lqD/YySJw="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_0.11.0_1524909398170_0.9897613206149325"},"_hasShrinkwrap":false},"0.11.0-umd":{"name":"threads","version":"0.11.0-umd","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.1.2","phantomjs":"^1.9.18","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"readme":"# threads.js\n[![Build Status](https://travis-ci.org/andywer/threads.js.svg?branch=master)](https://travis-ci.org/andywer/threads.js)\n[![Coverage Status](https://coveralls.io/repos/github/andywer/threads.js/badge.svg?branch=master)](https://coveralls.io/github/andywer/threads.js?branch=master)\n[![Code Climate](https://codeclimate.com/github/andywer/threads.js/badges/gpa.svg)](https://codeclimate.com/github/andywer/threads.js)\n[![NPM Version](https://img.shields.io/npm/v/threads.svg)](https://www.npmjs.com/package/threads)\n\nJavascript thread library. Uses web workers when run in browsers and child processes\nwhen run by node.js. Also supports browsers which do not support web workers.\n\n- For client and server use\n- Use different APIs (web worker, node child_process) transparently\n- Thread pools\n- Built-in error handling\n- Well tested\n- ES6 and backwards-compatible\n\n\n## Basic usage\n\nSpawn threads to do the time-consuming work and let the parent thread focus on\ndaily business!\n\n```javascript\nconst spawn = require('threads').spawn;\n\nconst thread = spawn(function(input, done) {\n  // Everything we do here will be run in parallel in another execution context.\n  // Remember that this function will be executed in the thread's context,\n  // so you cannot reference any value of the surrounding code.\n  done({ string : input.string, integer : parseInt(input.string) });\n});\n\nthread\n  .send({ string : '123' })\n  // The handlers come here: (none of them is mandatory)\n  .on('message', function(response) {\n    console.log('123 * 2 = ', response.integer * 2);\n    thread.kill();\n  })\n  .on('error', function(error) {\n    console.error('Worker errored:', error);\n  })\n  .on('exit', function() {\n    console.log('Worker has been terminated.');\n  });\n```\n\n\n## Installation\n\n### NPM (Node.js, Browserify, Webpack)\n\n```bash\nnpm install --save threads\n```\n\n### Bower\n\n```bash\nbower install --save threads\n```\n\n### Script tag\n\n```html\n<script src=\"https://unpkg.com/threads@VERSION/dist/threads.browser.min.js\"></script>\n```\n\nNote: Replace `VERSION` with the library's version you want to use, like `v0.12.0`. The library will be exposed on the global window scope as `threads`.\n\n\n## How To\n\n### Thread code in separate files\n\nYou don't have to write the thread's code inline. The file is expected to be a\ncommonjs module (so something that uses `module.exports = ...`), for node and\nbrowser.\n\n```javascript\nconst threads = require('threads');\nconst config  = threads.config;\nconst spawn   = threads.spawn;\n\n// Set base paths to thread scripts\nconfig.set({\n  basepath : {\n    node : __dirname + '/../thread-scripts',\n    web  : 'http://myserver.local/thread-scripts'\n  }\n});\n\nconst thread = spawn('worker.js');\n\nthread\n  .send({ do : 'Something awesome!' })\n  .on('message', function(message) {\n    console.log('worker.js replied:', message);\n  });\n```\n\nworker.js:\n```javascript\n// Use CommonJS syntax (module.exports). Works in browser, too!\n// Only limitation: You won't have require() when run in the browser.\nmodule.exports = function(input, done) {\n  done('Awesome thread script may run in browser and node.js!');\n};\n```\n\n### Async functions\n\nYou can also pass async functions, a.k.a. functions returning a Promise, to spawn threads.\n\n```javascript\nconst spawn = require('threads').spawn;\n\nconst thread = spawn(function ([a, b]) {\n  // Remember that this function will be run in another execution context.\n  return new Promise(resolve => {\n    setTimeout(() => resolve(a + b), 1000)\n  })\n});\n\nthread\n  .send([ 9, 12 ])\n  // The handlers come here: (none of them is mandatory)\n  .on('message', function(response) {\n    console.log('9 + 12 = ', response);\n    thread.kill();\n  });\n```\n\n\n### Thread Pool\n\nYou can also create a thread pool that spawns a fixed no. of workers. Pass jobs\nto the thread pool which it will queue and pass to the next idle worker.\nYou can also pass the number threads to be spawned. Defaults to the number of\nCPU cores.\n\n```javascript\nconst Pool = require('threads').Pool;\n\nconst pool = new Pool();\n// Alternatively: new Pool(<number of threads to spawn>)\n\n// Run a script\nconst jobA = pool\n  .run('/path/to/worker')\n  .send({ do : 'something' });\n\n// Run the same script, but with a different parameter\nconst jobB = pool\n  .send({ do : 'something else' });\n\n// Run inline code\nconst jobC = pool.run(\n  function(input, done) {\n    const hash = md5(input);\n    done(hash, input);\n  }, {\n    // dependencies; resolved using node's require() or the web workers importScript()\n    md5 : 'js-md5'\n  }\n).send('Hash this string!');\n\njobC\n  .on('done', function(hash, input) {\n    console.log(`Job C hashed: md5(\"${input}\") = \"${hash}\"`);\n  });\n\npool\n  .on('done', function(job, message) {\n    console.log('Job done:', job);\n  })\n  .on('error', function(job, error) {\n    console.error('Job errored:', job);\n  })\n  .on('finished', function() {\n    console.log('Everything done, shutting down the thread pool.');\n    pool.killAll();\n  });\n```\n\n#### Job Abortion\n\nYou can abort a job by calling `job.abort()`.\n\n```javascript\nconst Pool = require('threads').Pool;\n\nconst pool = new Pool();\n\nconst job = pool\n  .run('/path/to/worker')\n  .send({ do : 'something' });\n  \njob.on('abort', () => { console.log('Job Aborted'); });\n  \n// somewhere else\njob.abort();\n```\n\n### Streaming\n\nYou can also spawn a thread for streaming purposes. The following example shows\na very simple use case where you keep feeding numbers to the background task\nand it will return the minimum and maximum of all values you ever passed.\n\n```javascript\nconst threads = require('threads');\nconst spawn   = threads.spawn;\nconst thread  = spawn(function() {});\n\nthread\n  .run(function minmax(int, done) {\n    if (typeof this.min === 'undefined') {\n      this.min = int;\n      this.max = int;\n    } else {\n      this.min = Math.min(this.min, int);\n      this.max = Math.max(this.max, int);\n    }\n    done({ min : this.min, max : this.max }});\n  })\n  .send(2)\n  .send(3)\n  .send(4)\n  .send(1)\n  .send(5)\n  .on('message', function(minmax) {\n    console.log('min:', minmax.min, ', max:', minmax.max);\n  })\n  .on('done', function() {\n    thread.kill();\n  });\n```\n\n### Retraining\n\nAs it turns out, `thread.run()` is no one-way road.\n\n```javascript\nthread\n  .run(function doThis(input, done) {\n    done('My first job!');\n  })\n  .send()\n  .run(function doThat(input, done) {\n    done('Old job was boring. Trying something new!');\n  })\n  .send();\n```\n\n### Promises\n\nInstead of using callbacks, you can also turn thread messages and pool jobs into\npromises.\n\n```javascript\nspawn(myThreadFile)\n  .send({ important : 'data' })\n  .promise()\n  .then(function success(message) {}, function error(error) {});\n```\n\n```javascript\npool.run(fancyThreadCode);\n\nPromise.all([\n  pool.send({ data : 1 }).promise(),\n  pool.send({ data : 2 }).promise()\n]).then(function allResolved() {\n  console.log('Everything done! It\\'s closing time...');\n});\n```\n\n### Transferable objects\n\nYou can also use transferable objects to improve performance when passing large\nbuffers (in browser). Add script files you want to run using importScripts()\n(if in browser) as second parameter to thread.run().\nSee [Transferable Objects: Lightning Fast!](http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast).\n\nBoth features will be ignored by node.js version for now.\n\n```javascript\nconst threads = require('threads');\nconst spawn   = threads.spawn;\nconst thread  = spawn(function() {});\n\nconst largeArrayBuffer = new Uint8Array(1024 * 1024 * 32); // 32MB\nconst jobData = { label : 'huge thing', data: largeArrayBuffer.buffer };\n\nthread\n  .run(function(input, done) {\n    // do something cool with input.label, input.data\n    // call done.transfer() if you want to use transferables in the thread's response\n    // (the node.js code simply ignores the transferables)\n    done.transfer({ some : { response : input.buffer } }, [input.data.buffer]);\n  }, [\n    // this file will be run in the thread using importScripts() if in browser\n    // the node.js code will ignore this second parameter\n    '/dependencies-bundle.js'\n  ])\n  // pass the buffers to transfer into thread context as 2nd parameter to send()\n  .send(jobData, [ largeArrayBuffer.buffer ]);\n```\n\n### Progress update\n\nThe thread can also notify the main thread about its current progress.\n\n```javascript\nconst threads = require('threads');\nconst spawn   = threads.spawn;\nconst thread  = spawn(function() {});\n\nthread\n  .run(function(input, done, progress) {\n    setTimeout(done, 1000);\n    setTimeout(function() { progress(25); }, 250);\n    setTimeout(function() { progress(50); }, 500);\n    setTimeout(function() { progress(75); }, 750);\n  })\n  .send()\n  .on('progress', function(progress) {\n    console.log(`Progress: ${progress}%`);\n  })\n  .on('done', function() {\n    console.log(`Done.`);\n    thread.kill();\n  });\n```\n\nOutput:\n\n```\nProgress: 25%\nProgress: 50%\nProgress: 75%\nDone.\n```\n\n### Web worker fallback\n\nYou can provide a fallback if the user's browser does not support web workers.\nSee [webworker-fallback](https://github.com/andywer/webworker-fallback). This will not have any effect if used by node.js code.\n\n### Debugging threads\n\nWhen the main process uses `--inspect` to debug Node.js, each thread will be started with the `--inspect` flag too, but\nin a different port so they don't interfere with the main process. Each created thread will have an incremental port, so\nyou can create and debug as many as you want.\n\nThis also works with `--inspect-brk`. As expected, each thread will pause on the first line when created.\n\nAll other flags are passed to the thread unchanged. To override this behaviour, you can pass your own `execArgv` array\nwhen creating a thread:\n\n```javascript\n// Always open an inspect port on 1234, no matter what the main process is doing.\nspawn(myThreadFile, { execArgv: ['--inspect=1234'] })\n\n// Pass this flag to the thread. Ignore any other flag provided by the main process.\nspawn(myThreadFile, { execArgv: ['--throw-deprecation'] })\n```\n\n### Use external dependencies\n\nNot yet completely implemented.\n\nTo do:\n- gulp task to bundle dependencies using browserify and expose all of them -> dependency bundle\n- dependency bundle can be imported by importScripts()\n- code can just call `var myDependency = require('my-dependency');`, no matter if browser or node.js\n\n\n## Configuration\n\n```javascript\nconst config = require('threads').config;\n\n// These configuration properties are all optional\nconfig.set({\n  basepath : {\n    node : 'path/to/my/worker/scripts/directory',\n    web  : 'path-or-url/to/my/worker/scripts/directory'\n  },\n  fallback : {\n    slaveScriptUrl : 'path-or-url/to/dist/slave.js'    // used for IE where you cannot pass code to a worker using a data URI\n  }\n});\n```\n\n\n## FAQ: Frequently Asked Questions\n\n#### Node: `require()`-ing relative paths in worker does not work (`Error: Cannot find module`)\nThank you, https://github.com/FlorianBruckner, for reporting the issues and helping to debug them!\n\n**Solution**: Pass down `__dirname` to worker and use it in `require()` (see [Issue 28](https://github.com/andywer/threads.js/issues/28#issuecomment-248505917))\n\n\n## Change log\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n\n## License\n\nThis library is published under the MIT license. See [LICENSE](./LICENSE) for details.\n\n\n__Have fun and build something awesome!__\n","readmeFilename":"README.md","gitHead":"d8a9dbf651a8c20aad2ab69e8cedb0c4f7a1d635","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.11.0-umd","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-kEJxQd7Ly34oBIs4fwYodE+P59XPXmqDPwxCC+kJbOn7idtoMHkhRU/QLKv4zMklGoYnvViLQlVLJudjnGrSIg==","shasum":"afcc55a2afe6fc61017f70f251e110b3746dda03","tarball":"https://registry.npmjs.org/threads/-/threads-0.11.0-umd.tgz","fileCount":58,"unpackedSize":191615,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKVJgCRA9TVsSAnZWagAAbm8P/0jSofmdu7S/ZS7TLJOu\n9NFuSooUOXDroPqHFKZ//A+QiqVHCHMbMHss1P6QgRk7c/yt7QqowXM79s5k\nphhfMOtNNm+6WoFKq/mnyD43UVfxrJ/uraJ3fQJNDriVmZzopo9ah+Dqp/gR\nOFyVW/MTTfX71d4gIYOCn5XARmk6B/rBi+vs76D8rVuH7RVsPmiFLvgH3coA\nDtS80iKGwFk6MnbpfrG0soabPYLEq80QZ3jOxKbshNAUkP7iMyDS1QvX26fQ\nAhw6gNHOLkSWESp0k+f1J9wfVDtI1r3QbY/9329cUGtb2eKHGDV/l2COKw/3\nch/ET/qjyyA6ZlsUif39WmU2skDx/SGi+urwHwoj95Mck23eQboVb+GJQuzB\nGQuHsg5/nMWd7dxnob3Kn8f/CeU+f2+z1cpaGQpDqqK7FbeYIrnX+NmYYuRa\n6FZTqDo93VPFCZbedmE7+oLSrmjzK8BTSzdZe8Tnrxktli5ZHN/TMSAc4QRN\n2AX7XFttHFbMHmRGynUxUSXlQ5RRr6dHzhwHdCmzY7VI26fV7zbU5oO6QUHV\n7RXJhqHrplFE2NeBOu/arDTNLf93pg/9euLbndpDKadQnuniLZskncg3Erg4\nteAL7Oi3jJ6Vxh1UvcspyLHyeM47p6/KXnGPW5+NHK35dJ6GCZR+nUJ1+p6t\nBLr0\r\n=6O+2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEgrztIbx5EiYvi3Z6OYhQkQ9qMlrdbk31aMHYbK5qJlAiAQ6sCLga7I/KLxcah9ufs29mRiYpCP409UC2suZIy6mg=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_0.11.0-umd_1529434719541_0.6085295801927946"},"_hasShrinkwrap":false},"0.12.0":{"name":"threads","version":"0.12.0","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","mocha":"^3.1.2","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"9c2d0d86c8ae3c0059538eedf95a2f63d3df75a1","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.12.0","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"andywer","email":"andy@dev.next-step-software.com"},"dist":{"integrity":"sha512-4B7hd61lDsVW1Z/+FAVX7D9QbiQYUbtGMHVkkwWT/nKPKas8u4FEc+Rg8E8h2erhNTQGNqNJ0TsholmhpKNPRg==","shasum":"d8ae23d929fcb8274a585b7bc333324fdfacef67","tarball":"https://registry.npmjs.org/threads/-/threads-0.12.0.tgz","fileCount":57,"unpackedSize":189887,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKWTvCRA9TVsSAnZWagAAiaQQAJ0Vr4AGZ0DN8iOOdHOQ\n7u0Jjh/v4ckaIP4XX0bEWW4HKM5a9XgImhU0GDZ8xNlvZRylYM0W0ZOUus43\ncoiJO92zfnaTRwuWuKYXqEO+hKqebsiQmfUAPh1F4nJKZp7OsiCEcxR3cOeW\nL8+fDCZW/rbNrdODHvTiARGHo03Qq8DyYMymKtB7LvHu6jzI4GaQw2UAJWj4\ntSfIYFDZXs8kdqgf3fPKI1DBjydPZSdlTlklsVjfQ9ji5S0WREU2pnV6fM1m\nPxGnpSRhD8RIdcpSfKBhdFQ0grqnlI/KI9ZHXjnVQJFSOnsQqd7UcyiISywk\n/VNi21dd4abyg17F31PekqzMe6P4QDU67Tc3ffwmkvDj5e6a+ofVnEcvWlG6\npIyobR/54ivVPWF3XAf0JrMwM0cSOX63a63MPJsyYtYsxGNXQZduD+CiZ4su\n4+0P55wYap9uNZCsJPMKj6eSGLNmgHaeH0xLDkBmoKnHsggp3WCRm8PlPm/h\nrVTqs4lZI7JrLFdN5g/CytzHieNmxbunKE6qEZ5y0veIgeqYKF8FlEtEmiAG\n5BZ024lUzR5Yda2scyTmKeERyhZNDjR7fCsTNbH57wGACJdRLIr9h0x3tdag\ntBlKKKIw5DBhn7lW+m2pvvy53ZjE7NGbGXNwd/Jne9WyCLaz5Y33irjCwvzH\nPiRI\r\n=vKAs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGgEfR59jxFis0cTp4ayvBn63Nxeql/nxLo731m7a7T4AiBOXrI2xn1MtlAD0lDR9lik9U9tV0Xmv9aD8nVB0pVCJQ=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_0.12.0_1529439469756_0.060244107085225096"},"_hasShrinkwrap":false},"0.12.1":{"name":"threads","version":"0.12.1","keywords":["threads","web worker","cluster","child_process","threadpool","spawn","fork","parallel"],"description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","author":{"name":"Andy Wermke","email":"andy@dev.next-step-software.com"},"license":"MIT","main":"lib/index.js","scripts":{"build":"gulp dist","test":"gulp test","prepublishOnly":"gulp dist test"},"engines":{"node":">= 4.0"},"repository":{"type":"git","url":"git+https://github.com/andywer/thread.js.git"},"bugs":{"url":"https://github.com/andywer/thread.js/issues"},"babel":{"presets":[["es2015",{"loose":true}]]},"devDependencies":{"async":"^1.4.2","babel-preset-es2015":"^6.18.0","babel-preset-es2015-loose":"^8.0.0","browserify":"^13.1.1","codeclimate-test-reporter":"^0.4.0","coveralls":"^2.11.4","expect.js":"^0.3.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-concat":"^2.5.2","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^1.5.2","gulp-uglify":"^2.0.0","istanbul":"^0.4.0","karma":"^1.3.0","karma-browserify":"^4.3.0","karma-chrome-launcher":"^2.0.0","karma-expect":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","mocha":"^3.1.2","natives":"^1.1.6","sinon":"^1.16.1","through2":"^2.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"eventemitter3":"^2.0.2","native-promise-only":"^0.8.1"},"browser":{"child_process":false,"os":false,"path":false},"gitHead":"2ffd6636dc9f39ca88f077e47661533479c39792","homepage":"https://github.com/andywer/thread.js#readme","_id":"threads@0.12.1","_nodeVersion":"10.13.0","_npmVersion":"6.7.0","_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"dist":{"integrity":"sha512-2USeV2FDNZtVP1xt3TW86solU7W6WYjaTMd+gvAHJat+dEMFh7of2DR9MEFLkhMerxc1t5b1DMJiVx1meRzk0w==","shasum":"fea772e573a0aa5fb05b108e122fdc69d2472b4c","tarball":"https://registry.npmjs.org/threads/-/threads-0.12.1.tgz","fileCount":57,"unpackedSize":190315,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWMChCRA9TVsSAnZWagAAsNcP/3ORuJa+Kl/muZx8YdCz\n6IPlzBxohev1INEurBP+cOdteOjCIesF791trIZBxMwazOyIOlFeRO6DHjWL\nVQhDhevc9hKfzvGhd/gxEN5T64lwbzUVCVKe9B9bFRzbAdh3YsKQR+Cht5WY\nw1BKnQgyFwwHH6MvJoEA3lClRDmS0ZQaPXybKFeJWrM2mHa8fvT53GdXObFO\nrzXzC9bmt3P7pu9KSvusv0AM/MEAD6jcntVfUwgwUdKEAAaRgpsPDZOouGAP\n2fPdqEovpr2wcfe1/0WtcPJkzpm9h1S1OfRPceyYB9BrqTHa9ePT7rzgeygL\nhD29WJA4hQaY+ROpp1w3oG3He4wqlsrtTVjNpW4ESYJjNY7Zyvk3g69+SNqS\nVeGm8hlbOixnKHL14uKTa/49ukRlJVlAFDOBp/+OHXqN12Dl9hjsWCRK3xOD\nwvmwFRQK1rJquCs9vFiEEoe6xAHWsBugdRHrOaSNegwl68MmR41sMFacEZ+2\n/nwykX/+uOc4kFjaikhF/WtIiXOEA4gTTkTd4rrfDcq03ofdlQilnnx5f1B1\n9IVI+pn8Y3uD9mqqFL+k+X/FDrmUjpWZlGjht5J/VM9Eh/bRhQUJCFtNSm/w\nB5IUNcqixwQsTfHai1hpTwvejdIFSe/Rn2o4cqzxZBbQuCydp3vujFFXo2ya\nuYng\r\n=Z2Iu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGcqsQGqvTMWkXAY2PR0BvjMSQ4bVlqk8wb1GLsbSZvvAiBIR5o8g2/EsyKT457j1s+CzTMM+YEI6Z0AjZe7ZcWV2A=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_0.12.1_1549320351824_0.011108984680539669"},"_hasShrinkwrap":false},"1.0.0-alpha":{"name":"threads","version":"1.0.0-alpha","description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"TS_NODE_FILES=true ava","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads/issues"},"homepage":"https://github.com/andywer/threads#readme","keywords":["thread","web worker","pool","spawn","isomorphic","parallel","observable"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/debug":"^4.1.4","@types/node":"^11.13.8","ava":"^1.4.1","npm-run-all":"^4.1.5","rimraf":"^2.6.3","tiny-worker":"^2.2.0","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5"},"optionalDependencies":{},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/*.test.ts"],"require":["ts-node/register"]},"browser":{"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n\nVersion 1.0 - Work in progress 🛠\n\nComplete rewrite of the library with a new robust API, all functional, and all statically typed. It's still fully isomorphic – run the same code in the browser, in node.js or an electron app!\n\nDevelopment progress is tracked in 👉 [#100](https://github.com/andywer/threads.js/issues/100). Feel free to leave feedback there!\n\n## Installation\n\nNot yet published to npm.\n\n## Compatibility\n\n#### Platform: Web (browsers)\n\nUses [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).\n\n#### Platform: Node.js 12+\n\nUses native [worker threads](https://nodejs.org/api/worker_threads.html).\n\n#### Platform: Node.js < 12\n\nUses [`tiny-worker`](https://github.com/avoidwork/tiny-worker) as fallback if native worker threads are not available.\n\n## New Paradigm\n\nWe dropped inline functions support and instead focus on worker code residing in their own files.\nRunning inlined functions in a worker was nice for concise code samples, but offered limited value in real-world applications. Those inlined functions also had some built-in limitations that could not be overcome and that frequently got users confused.\n\nFocussing on worker code in distinct source modules also means we are focussing on using `threads` with bundlers like Webpack or Parcel in the front-end. In a node.js context you should be able to use a bundler as well, but you probably won't need to.\n\nThese changes also mean that we shall have worker code with `import`/`require()` that works in node.js just as well as bundled in browsers.\n\n## Usage\n\n### Concept\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst add = await spawn(new Worker(\"./workers/add\"))\nconst sum = await add(2, 3)\n\nconsole.log(`2 + 3 = ${sum}`)\n\nawait Thread.terminate(sum)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n#### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n#### expose()\n\nYou can `expose()` either a function or an object. In case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n### Code Samples\n\n<details>\n<summary>Basics - Function thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst fetchGithubProfile = await spawn(new Worker(\"./workers/fetch-github-profile\"))\nconst andywer = await fetchGithubProfile(\"andywer\")\n\nconsole.log(`User \"andywer\" has signed up on ${new Date(andywer.created_at).toLocaleString()}`)\n\nawait Thread.terminate(fetchGithubProfile)\n```\n\n```js\n// workers/fetch-github-profile.js\nimport fetch from \"isomorphic-fetch\"\nimport { expose } from \"threads/worker\"\n\nexpose(async function fetchGithubProfile(username) {\n  const response = await fetch(`https://api.github.com/users/${username}`)\n  return response.json()\n})\n```\n</details>\n\n<details>\n<summary>Basics - Module thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst counter = await spawn(new Worker(\"./workers/counter\"))\nawait counter.increment()\nawait counter.increment()\nawait counter.decrement()\n\nconsole.log(`Counter is now at ${await counter.getCount()}`)\n\nawait Thread.terminate(counter)\n```\n\n```js\n// workers/counter.js\nimport { expose } from \"threads/worker\"\n\nlet currentCount = 0\n\nconst counter = {\n  getCount() {\n    return currentCount\n  },\n  increment() {\n    return ++currentCount\n  },\n  decrement() {\n    return --currentCount\n  }\n}\n\nexpose(counter)\n```\n</details>\n\n<details>\n<summary>TODO: Basics - Returning observables</summary>\n\nJust return an observable in your worker, subscribe to it in the master code. Fully transparent.\n</details>\n\n<details>\n<summary>TODO: Basics - Error handling</summary>\n\nFully transparent. The promise in the master code's call will be rejected with the error thrown in the worker, also yielding the worker error's stack trace.\n</details>\n\n<details>\n<summary>TODO: Cancelling a thread job</summary>\n</details>\n\n<details>\n<summary>TODO: Thread pool & Task queue</summary>\n</details>\n\n<details>\n<summary>Transferable objects</summary>\nUse `Transfer()` to mark [`transferable objects`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)) like ArrayBuffers to be transferred to the receiving thread. It can speed up your code a lot if you are working with big chunks of binary data.\n\n`Transfer()` comes in two flavors:\n* `Transfer(myBuffer: Transferable)`\n* `Transfer(someObjectOrArrayContainingMyBuffers: any, [myBuffer, /* ... */]: Transferable[])`\n\nUse it when calling a thread function or returning from a thread function:\n\n```js\n// master.js\nimport { spawn, Transfer, Worker } from \"threads\"\n\nconst xorBuffer = await spawn(new Worker(\"./workers/arraybuffer-xor\"))\nconst resultBuffer = await xorBuffer(Transfer(testData), 127)\n```\n\n```js\n// workers/arraybuffer-xor.js\nimport { expose, Transfer } from \"threads/worker\"\n\nexpose(function xorBuffer(username) {\n  const view = new Uint8Array(buffer)\n  view.forEach((byte, offset) => view.set([byte ^ value], offset))\n  return Transfer(buffer)\n})\n```\n\nWithout `Transfer()` the buffers would be copied on every call and every return. Using `Transfer()` only their ownership is transferred to the other thread instead to make sure it is accessible in a thread-safe way. This is a much faster operation.\n</details>\n\n<details>\n<summary>TODO: Subscribe to thread debugging events</summary>\n</details>\n\n<details>\n<summary>Tests</summary>\n\nCheck out the [integration tests](./test) and [their workers](./test/workers) to see it in action.\n</details>\n\n### Usage with node.js\n\nWorks out of the box. Note that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n### Usage with Webpack\n\nUse with the [`worker-plugin`](https://github.com/GoogleChromeLabs/worker-plugin), so all `new Worker(\"./unbundled-path\")` expressions are detected and properly transformed transparently, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\nTODO\n\n### Usage with Parcel\n\nShould work out of the box without any extra plugins.\n\nTODO\n\n## API\n\nTODO\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes.\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"67e18291a1dea00a122c1e7d2ff1d5a066459fcb","_id":"threads@1.0.0-alpha","_nodeVersion":"12.0.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-nyC+oLC3LctnPNqpDC9BZctOnt1X6+LzZnS1+W0jwt6OCgHR7cZkM4YM1i64wuoYu0gMeQ4wGYYQTylYEwzO0w==","shasum":"16d568a671b8d75f0ef38f3579167ce31ef12d67","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-alpha.tgz","fileCount":45,"unpackedSize":53869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc1bfUCRA9TVsSAnZWagAAeO4P/2Cu4hD1oPAzZ3fz4AD/\nQZ5tLmcqAhb/6W5nkSfC2zpxZOzbrQrsjC9LkbJ8HPq/+YC1V/pXVlMRNArx\n7UUdFcbM36Z9WbN2smAqXU0YjBchIwxuuv0+h36+pBfrWD6CAWhi3stHJHXY\nXaUQ296qCMgkUMBWFLY9Euxg8N++rxlZAH4l3fNxumYjljsAGBXGB5vCEr35\nfDOTgrl9Q0v0KErdMHFFDv0khbnSM4CitVaTjfPWLv22U19L5Gx46YGMzz8e\ng08F2fiWRug/I2pKGKLbBbe16UkjwsAp/b/8WXCr3v/Y1/xy/PnDSOW6DT3U\nZ6bp8W9GNPpsg+mxiSNgur8pV+3krqsFRYmjdhxH8zo5oRted/iCy9wDcUE+\nVe5WPZj6vwd2oMnVNtX47YzuQyDmEDSWEKunHTkqvKoJYASdzui8KvvMkMnj\nGfVtnytuX2vuiOOrOipj2aZl2SL3xv60aQMDK2a6uCsLWcBDW585KuYsHjJJ\nRdCTjdFet/e5nq+LRpBAUEma32uXysQOanH5TaNt9Cd2UY4BoiA/juJBVhSK\n6ltnI4iHt6QDMih1cl4ybSOV0g/cZygFz2H9wCe03hdRyfhz+EaexErsMwpb\n07d2dqDP6h2rphubDWGZN82UKK+zUWzO2Jl76AaIcEnLsNoru5S8X+T5OOlA\nUhmz\r\n=CSyw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiCbp+ED4+WLgrfH6xQT8eSRvuzeG/pGHxF7nApeJwiAIhAJIucGOiyk6IAde/uRHpx/bOtKmAbSY3iYP+rp14MWd5"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-alpha_1557510099997_0.9321875242757587"},"_hasShrinkwrap":false},"1.0.0-alpha.2":{"name":"threads","version":"1.0.0-alpha.2","description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer","test:ava":"TS_NODE_FILES=true ava","test:puppeteer":"puppet-run plugin:mocha ./test/*.chromium*.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads/issues"},"homepage":"https://github.com/andywer/threads#readme","keywords":["thread","web worker","pool","spawn","isomorphic","parallel","observable"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","ava":"^1.4.1","chai":"^4.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","tiny-worker":"^2.2.0","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads/v/next\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads/next.svg?style=flat-square\"></a>\n</p>\n\nVersion 1.0 - Work in progress 🛠\n\nComplete rewrite of the library with a new robust API, all functional, and all statically typed. It's still fully isomorphic – run the same code in the browser, in node.js or an electron app!\n\nDevelopment progress is tracked in 👉 [#100](https://github.com/andywer/threads.js/issues/100). Feel free to leave feedback there!\n\n## Installation\n\n```\nnpm install threads@next tiny-worker\n```\n\nIf you don't need to support node < 12 or you only want to build for the browser then you can also not install the `tiny-worker` package. It's an optional dependency and used as a fallback if `worker_threads` are not available.\n\n## Compatibility\n\n#### Platform: Web (browsers)\n\nUses [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).\n\n#### Platform: Node.js 12+\n\nUses native [worker threads](https://nodejs.org/api/worker_threads.html).\n\n#### Platform: Node.js < 12\n\nUses [`tiny-worker`](https://github.com/avoidwork/tiny-worker) as fallback if native worker threads are not available.\n\n## New Paradigm\n\nWe dropped inline functions support and instead focus on worker code residing in their own files.\nRunning inlined functions in a worker was nice for concise code samples, but offered limited value in real-world applications. Those inlined functions also had some built-in limitations that could not be overcome and that frequently got users confused.\n\nFocussing on worker code in distinct source modules also means we are focussing on using `threads` with bundlers like Webpack or Parcel in the front-end. In a node.js context you should be able to use a bundler as well, but you probably won't need to.\n\nThese changes also mean that we shall have worker code with `import`/`require()` that works in node.js just as well as bundled in browsers.\n\n## Usage\n\n### Concept\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(sum)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n#### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n#### expose()\n\nYou can `expose()` either a function or an object. In case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n### Code Samples\n\n<details>\n<summary>Basics - Function thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst fetchGithubProfile = await spawn(new Worker(\"./workers/fetch-github-profile\"))\nconst andywer = await fetchGithubProfile(\"andywer\")\n\nconsole.log(`User \"andywer\" has signed up on ${new Date(andywer.created_at).toLocaleString()}`)\n\nawait Thread.terminate(fetchGithubProfile)\n```\n\n```js\n// workers/fetch-github-profile.js\nimport fetch from \"isomorphic-fetch\"\nimport { expose } from \"threads/worker\"\n\nexpose(async function fetchGithubProfile(username) {\n  const response = await fetch(`https://api.github.com/users/${username}`)\n  return response.json()\n})\n```\n</details>\n\n<details>\n<summary>Basics - Module thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst counter = await spawn(new Worker(\"./workers/counter\"))\nawait counter.increment()\nawait counter.increment()\nawait counter.decrement()\n\nconsole.log(`Counter is now at ${await counter.getCount()}`)\n\nawait Thread.terminate(counter)\n```\n\n```js\n// workers/counter.js\nimport { expose } from \"threads/worker\"\n\nlet currentCount = 0\n\nconst counter = {\n  getCount() {\n    return currentCount\n  },\n  increment() {\n    return ++currentCount\n  },\n  decrement() {\n    return --currentCount\n  }\n}\n\nexpose(counter)\n```\n</details>\n\n<details>\n<summary>TODO: Basics - Returning observables</summary>\n\nJust return an observable in your worker, subscribe to it in the master code. Fully transparent.\n</details>\n\n<details>\n<summary>TODO: Basics - Error handling</summary>\n\nFully transparent. The promise in the master code's call will be rejected with the error thrown in the worker, also yielding the worker error's stack trace.\n</details>\n\n<details>\n<summary>Thread pool</summary>\n\nA `Pool` allows you to create a set of worker threads and queue thread calls. The queued tasks are pulled from the queue and executed as previous tasks have finished.\n\nUse it if you have a lot of work to offload to other threads and don't want to drown them in a huge pile of work at once, but run it in a controlled way with limited concurrency.\n\n```js\nimport { spawn, Pool } from \"threads\"\n\nconst pool = Pool(() => spawn(new Worker(\"./workers/multiplier\")), 8 /* optional size */)\n\npool.events.subscribe(console.log)\n\nawait pool.queue(async multiplier => {\n  const multiplied = await multiplier(2, 3)\n  console.log(`2 * 3 = ${multiplied}`)\n\n  // When this async call completes, the worker thread (`multiplier`) will\n  // be marked as available for new work scheduled via `pool.queue()`\n})\n\nawait pool.terminate()\n```\n\nNote that `pool.queue()` will schedule a task to be run in a deferred way. It might execute straight away or it might take a while until a new worker thread becomes available.\n\nThe promise returned by `pool.queue()` will resolve once the scheduled callback has been executed and completed. A failing scheduled callback will also make the promise returned by `pool.queue()` reject.\n\n</details>\n\n<details>\n<summary>Transferable objects</summary>\nUse `Transfer()` to mark [`transferable objects`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)) like ArrayBuffers to be transferred to the receiving thread. It can speed up your code a lot if you are working with big chunks of binary data.\n\n`Transfer()` comes in two flavors:\n* `Transfer(myBuffer: Transferable)`\n* `Transfer(someObjectOrArrayContainingMyBuffers: any, [myBuffer, /* ... */]: Transferable[])`\n\nUse it when calling a thread function or returning from a thread function:\n\n```js\n// master.js\nimport { spawn, Transfer, Worker } from \"threads\"\n\nconst xorBuffer = await spawn(new Worker(\"./workers/arraybuffer-xor\"))\nconst resultBuffer = await xorBuffer(Transfer(testData), 127)\n```\n\n```js\n// workers/arraybuffer-xor.js\nimport { expose, Transfer } from \"threads/worker\"\n\nexpose(function xorBuffer(username) {\n  const view = new Uint8Array(buffer)\n  view.forEach((byte, offset) => view.set([byte ^ value], offset))\n  return Transfer(buffer)\n})\n```\n\nWithout `Transfer()` the buffers would be copied on every call and every return. Using `Transfer()` only their ownership is transferred to the other thread instead to make sure it is accessible in a thread-safe way. This is a much faster operation.\n</details>\n\n<details>\n<summary>TODO: Cancelling a thread job</summary>\n</details>\n\n<details>\n<summary>TODO: Subscribe to thread debugging events</summary>\n</details>\n\n<details>\n<summary>Tests</summary>\n\nCheck out the [integration tests](./test) and [their workers](./test/workers) to see it in action.\n</details>\n\n### Usage with node.js\n\nWorks out of the box. Note that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n### Usage with Webpack\n\nUse with the [`worker-plugin`](https://github.com/GoogleChromeLabs/worker-plugin), so all `new Worker(\"./unbundled-path\")` expressions are detected and properly transformed transparently, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\nTODO\n\n### Usage with Parcel\n\nShould work out of the box without any extra plugins.\n\nThe only adjustment you need to do is to import `threads/register` once in the beginning (in the master code, not in the thread) to register the library's `Worker` for your platform as the global `Worker`.\n\nThis is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nTODO\n\n## API\n\nTODO\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes.\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"0b57a78cbebb8df92f840f5b8f6d9bdb94bf5ac2","_id":"threads@1.0.0-alpha.2","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-PM4yTp2adcHzoI+KqviRaLM59a3cgbv9n2OvrNlm9JsBFA3OskkVu5xrM76NFxcsN1h/JqAcndidIcP+tUoPQg==","shasum":"6c1311135c1c74b9d6e14b1d3f828bece1552a9c","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-alpha.2.tgz","fileCount":53,"unpackedSize":67507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc+hXoCRA9TVsSAnZWagAA+MUQAISppnsu/qmhUv1mo7+9\nhrNtoNcRuMA5wglesA+4+qm9LzOhd/wOZizwR1mRGkQ5NB8fLcE75jp8ralH\nOW50LeBL3JBaaNiju7V3td48LMnHyzhBVyW2eydmH/nG+qCW1PeV/APjwyyg\nwJ2V+8LilmUH570UgfvTw1B/IxXPvjGVk/92bxjhMJPYcWBj7D/I/FHqZS6m\naAH1rrdIzvN082pL8mvaOo6TIur2vO2ivJiCpuam+BEIzt2rvHzcTHEKro5W\nSrCwz60vaRY559IKY+gzCOr/gAbeVbCRMGnSBpmu/PeB5HtHt1z6BFweolW6\ndkPva291DpywBCbl8cCMLTExjqbzxGQMWjbxeewwX9aso6s1QHU4ZDIonCk0\nRFii+5zk/kbNFNH/QcEjmLZi73TQ9EhB96yORMi93/aKHBGvkNCBpErjpUzc\nhUnflMjEp2fapNNg8xDbmD6Scu85CCWJM7YOC3l+sguJ8fWhkpqK0zRMCZiH\n89fSMb62PZMLr50HSD/FkaqhEn9Sflc60/1yLJXYS3TbzAQv3p30IwkfLXHN\nobF15MnAp4Uk7Fkj1QrWrDHdKBmCfU0aw/fikgq0q4r7G5JIysPd9uxB26Cd\nlaMnL/4Csstt2Rf3Tp/tcxUnKy1O8ZIBzJZ2swrnNHXMt2lJ5wUD08FT66Zq\njD53\r\n=T07a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJb2yY4EUBCsBw36dBjHmvqYc6Vcbn4TKm8RaZXoWHYQIgMZlATyp13IbnHiYnaczUTTglxqAnFA+dSW5Od0jhoBw="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-alpha.2_1559893479579_0.0027104120566319168"},"_hasShrinkwrap":false},"1.0.0-alpha.3":{"name":"threads","version":"1.0.0-alpha.3","description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer","test:ava":"TS_NODE_FILES=true ava","test:puppeteer":"puppet-run plugin:mocha ./test/*.chromium*.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads/issues"},"homepage":"https://github.com/andywer/threads#readme","keywords":["thread","web worker","pool","spawn","isomorphic","parallel","observable"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","ava":"^1.4.1","chai":"^4.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","tiny-worker":"^2.2.0","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"79de0e346f915f45bddc646c5f18a31e468090c6","_id":"threads@1.0.0-alpha.3","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Al0cWcBkvrlIde96b6G0na+7C173rMX6F7c7x7+bHFWzb74KFaDAJ9yRFshEfQRN21EQe3ir62omj56bvv46ug==","shasum":"d9a8b3025096bfc3770ac6ebd11884f0815dee59","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-alpha.3.tgz","fileCount":53,"unpackedSize":67439,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc+polCRA9TVsSAnZWagAATqQP/29WoksI65d1WOaKpeZP\n0b7CWGgfXhYn9z351XcJB2FHE6b+RLhse1DEaEWwvAEvrl2p/9ocSWS22zEu\n6PY4t5+QQe9kH7tNZLOoWoijETTG/ciw8XC2KK9ShA+f3P6g8z2iDOYgEvHX\nOFpl9TT0i6wMxHG2pvE9jInogixM/sjYnLaZTY+nd7IRDsTHiS2965uLWAfb\ngo2O6uRZIDST2Df46GHYatWax+/Bf1jUfipkdBoADwYNvYkd54aC/RbjIU1k\nPFvM+HKVunT9DYIMSd79sijBC2ZN5TIqCjYV4jhrdCLGtfBvXnPjTWNM0Cgr\ndhhdzJDNWnBHp3v7ZFQQ5QLUOBDt1HDDRIpNZU4Oop2ys44g5plb4bHFWzSz\n5w7AMBjN5sOTV2eEjynrV8VLN8JTfz8Fa7Wr7jQr4ZuqZw7Ae78PernWqIep\nZ3QjIq/KtMyn3oGpRRF/qnr0lIju3xffb2ZLosQGlmw0/Hyxt6BBjOkT3aF8\ntlDRfk6ixoIdcyqGJiLT2AphlGqkovKy/ecODltzaGtcmF3JtmxqaXLoZtpx\ncrDB9M0gp+9FQu9RtKg7ZLSocV1Oe1wPeHxtHx0KZyN2Ewsm1BaNzw0axu//\n4DwiwvCYNjzYXBJ8+rJOuHQpLmMSv9WuKvgC8KPDEj5j7IpAmzTxcawL5tkr\nSLXj\r\n=6svj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSnzz1XOwkX88iyRvcmnImQM4yTI3E9mA9OVfs5nQI9wIgRc9307QRjteHDZ0orWyQxrsTChBVLFEH6rTNq+Hsxkw="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-alpha.3_1559927332779_0.30640227920347796"},"_hasShrinkwrap":false},"1.0.0-alpha.4":{"name":"threads","version":"1.0.0-alpha.4","description":"Easy to use, yet powerful multi-threading library for node.js and the browser!","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer","test:ava":"TS_NODE_FILES=true ava","test:puppeteer":"puppet-run plugin:mocha ./test/*.chromium*.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads/issues"},"homepage":"https://github.com/andywer/threads#readme","keywords":["thread","web worker","pool","spawn","isomorphic","parallel","observable"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","ava":"^1.4.1","chai":"^4.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","tiny-worker":"^2.2.0","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads/v/next\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads/next.svg?style=flat-square\"></a>\n</p>\n\nVersion 1.0 - Work in progress 🛠\n\nComplete rewrite of the library with a new robust API, all functional, and all statically typed. It's still fully isomorphic – run the same code in the browser, in node.js or an electron app!\n\nDevelopment progress is tracked in 👉 [#100](https://github.com/andywer/threads.js/issues/100). Feel free to leave feedback there!\n\n## Installation\n\n```\nnpm install threads@next tiny-worker\n```\n\nIf you don't need to support node < 12 or you only want to build for the browser then you can also not install the `tiny-worker` package. It's an optional dependency and used as a fallback if `worker_threads` are not available.\n\n## Compatibility\n\n#### Platform: Web (browsers)\n\nUses [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).\n\n#### Platform: Node.js 12+\n\nUses native [worker threads](https://nodejs.org/api/worker_threads.html).\n\n#### Platform: Node.js < 12\n\nUses [`tiny-worker`](https://github.com/avoidwork/tiny-worker) as fallback if native worker threads are not available.\n\n## New Paradigm\n\nWe dropped inline functions support and instead focus on worker code residing in their own files.\nRunning inlined functions in a worker was nice for concise code samples, but offered limited value in real-world applications. Those inlined functions also had some built-in limitations that could not be overcome and that frequently got users confused.\n\nFocussing on worker code in distinct source modules also means we are focussing on using `threads` with bundlers like Webpack or Parcel in the front-end. In a node.js context you should be able to use a bundler as well, but you probably won't need to.\n\nThese changes also mean that we shall have worker code with `import`/`require()` that works in node.js just as well as bundled in browsers.\n\n## Usage\n\n### Concept\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(sum)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n#### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n#### expose()\n\nYou can `expose()` either a function or an object. In case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n### Code Samples\n\n<details>\n<summary>Basics - Function thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst fetchGithubProfile = await spawn(new Worker(\"./workers/fetch-github-profile\"))\nconst andywer = await fetchGithubProfile(\"andywer\")\n\nconsole.log(`User \"andywer\" has signed up on ${new Date(andywer.created_at).toLocaleString()}`)\n\nawait Thread.terminate(fetchGithubProfile)\n```\n\n```js\n// workers/fetch-github-profile.js\nimport fetch from \"isomorphic-fetch\"\nimport { expose } from \"threads/worker\"\n\nexpose(async function fetchGithubProfile(username) {\n  const response = await fetch(`https://api.github.com/users/${username}`)\n  return response.json()\n})\n```\n</details>\n\n<details>\n<summary>Basics - Module thread</summary>\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst counter = await spawn(new Worker(\"./workers/counter\"))\nawait counter.increment()\nawait counter.increment()\nawait counter.decrement()\n\nconsole.log(`Counter is now at ${await counter.getCount()}`)\n\nawait Thread.terminate(counter)\n```\n\n```js\n// workers/counter.js\nimport { expose } from \"threads/worker\"\n\nlet currentCount = 0\n\nconst counter = {\n  getCount() {\n    return currentCount\n  },\n  increment() {\n    return ++currentCount\n  },\n  decrement() {\n    return --currentCount\n  }\n}\n\nexpose(counter)\n```\n</details>\n\n<details>\n<summary>TODO: Basics - Returning observables</summary>\n\nJust return an observable in your worker, subscribe to it in the master code. Fully transparent.\n</details>\n\n<details>\n<summary>TODO: Basics - Error handling</summary>\n\nFully transparent. The promise in the master code's call will be rejected with the error thrown in the worker, also yielding the worker error's stack trace.\n</details>\n\n<details>\n<summary>Thread pool</summary>\n\nA `Pool` allows you to create a set of worker threads and queue thread calls. The queued tasks are pulled from the queue and executed as previous tasks have finished.\n\nUse it if you have a lot of work to offload to other threads and don't want to drown them in a huge pile of work at once, but run it in a controlled way with limited concurrency.\n\n```js\nimport { spawn, Pool } from \"threads\"\n\nconst pool = Pool(() => spawn(new Worker(\"./workers/multiplier\")), 8 /* optional size */)\n\npool.events.subscribe(console.log)\n\npool.queue(async multiplier => {\n  const multiplied = await multiplier(2, 3)\n  console.log(`2 * 3 = ${multiplied}`)\n\n  // When this async call completes, the worker thread (`multiplier`) will\n  // be marked as available for new work scheduled via `pool.queue()`\n})\n\nawait pool.completed()\nawait pool.terminate()\n```\n\nNote that `pool.queue()` will schedule a task to be run in a deferred way. It might execute straight away or it might take a while until a new worker thread becomes available.\n\nThe promise returned by `pool.completed()` will resolve once the scheduled callbacks have been executed and completed. A failing job will also make the promise reject.\n\n</details>\n\n<details>\n<summary>Transferable objects</summary>\nUse `Transfer()` to mark [`transferable objects`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)) like ArrayBuffers to be transferred to the receiving thread. It can speed up your code a lot if you are working with big chunks of binary data.\n\n`Transfer()` comes in two flavors:\n* `Transfer(myBuffer: Transferable)`\n* `Transfer(someObjectOrArrayContainingMyBuffers: any, [myBuffer, /* ... */]: Transferable[])`\n\nUse it when calling a thread function or returning from a thread function:\n\n```js\n// master.js\nimport { spawn, Transfer, Worker } from \"threads\"\n\nconst xorBuffer = await spawn(new Worker(\"./workers/arraybuffer-xor\"))\nconst resultBuffer = await xorBuffer(Transfer(testData), 127)\n```\n\n```js\n// workers/arraybuffer-xor.js\nimport { expose, Transfer } from \"threads/worker\"\n\nexpose(function xorBuffer(username) {\n  const view = new Uint8Array(buffer)\n  view.forEach((byte, offset) => view.set([byte ^ value], offset))\n  return Transfer(buffer)\n})\n```\n\nWithout `Transfer()` the buffers would be copied on every call and every return. Using `Transfer()` only their ownership is transferred to the other thread instead to make sure it is accessible in a thread-safe way. This is a much faster operation.\n</details>\n\n<details>\n<summary>TODO: Cancelling a thread job</summary>\n</details>\n\n<details>\n<summary>TODO: Subscribe to thread debugging events</summary>\n</details>\n\n<details>\n<summary>Tests</summary>\n\nCheck out the [integration tests](./test) and [their workers](./test/workers) to see it in action.\n</details>\n\n### Usage with node.js\n\nWorks out of the box. Note that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n### Usage with Webpack\n\nUse with the [`worker-plugin`](https://github.com/GoogleChromeLabs/worker-plugin), so all `new Worker(\"./unbundled-path\")` expressions are detected and properly transformed transparently, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\nTODO\n\n### Usage with Parcel\n\nShould work out of the box without any extra plugins.\n\nThe only adjustment you need to do is to import `threads/register` once in the beginning (in the master code, not in the thread) to register the library's `Worker` for your platform as the global `Worker`.\n\nThis is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nTODO\n\n## API\n\nTODO\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes.\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"1bcd242721cfa9888e0e44d6ed88efc532b5ab3a","_id":"threads@1.0.0-alpha.4","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-kjOt05BnlGUlZOfK4BKZ0JyfBZ0Qj5LVny+1/7QbABdk4f5qzp3XSxkmOeGzDl8FV5CyKFjHIG+ONeRkuh0UQQ==","shasum":"64213d9969ec1718f3b604a06085e4d2e25c343f","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-alpha.4.tgz","fileCount":53,"unpackedSize":71781,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc/SzeCRA9TVsSAnZWagAA0MYP/1lqhtpiG6SIM6+NsrGU\n5+T9k9L2X7L00MvsoEm+cG9iB3Pd75gdVA61oJ1hqiuhXCp5MI3GtE0HSDGg\n29GW4fswTarFq6uWgRfVPSnxXrMhnuSLJZ4PorUHWS1sPbgy3+ttSBTkF6BM\nEkc5w4devcAEH9/WtnnLacN0mmtynsyRBQMZLj66CIPdU1FMBmo9APYXGwAT\nWSQLSKvkIXWMP7Mw+WrVJ7sPPZaMubNaKrSitdEB6feowzyOqOUPJ7Zdy5m/\nSofbzeT3LmJqEkukr7Klb7UNSlEEtvsnlI1q9Xl37emHBFRUogttpJMy1v+b\ngyDPaT29rstCFs152D/TWp6e55Fu/siP9xbDY0yCP+M386MNP0WuDqaQ5p+Q\nPlJrfKk1CllalLKhaARWp58XzYQ8w5pGpIxP/FGoeWn+X5guuZ4mj0ro6TC3\ntrrM8O8zO/O70klbwWV9OrLpL/uUCMtdCuoQ1LBRPkAz/TuhaROun7Q9mNnS\nlpBK+MrxlIwBv2kjL6Wz7NUOM5+WwTSrMaUgk8hCg5a0SiFGOuH2WW/qsHKo\nGnu/GSpUZ1NlEfVbAnM5mkl7/2/s442uuJxCWMWQsGA23YkXlzbiJ4CCNE5T\nJkLwCsdARaHxdkQbHnjJTXxzBF6fVRb7HNM4K0jk+ZbC+27CwSmulErpTC6A\nVtK9\r\n=E3Jw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDA1q7ubdcl7nRE/ieE7UPvyoBUK0yxjePlCaEahpkpyAIhAJ6R+rmSovgEpjnKctvA8ab4moRHCtqftAVX33OgAlR7"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-alpha.4_1560095965646_0.2955492445904906"},"_hasShrinkwrap":false},"1.0.0-beta":{"name":"threads","version":"1.0.0-beta","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads/issues"},"homepage":"https://github.com/andywer/threads#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"13e5b5b3cbee82e9ce9fd9b33e5ee9e247eea836","_id":"threads@1.0.0-beta","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-QohZtCg83H2x54ygy03N1TFCUeKPupiMZgbU5+S5ZUS/XTkjMAbnVHPVIER45ObvKlPG5N6B1qD/pCuYJyRJow==","shasum":"8bb6f49cac778d9551a54c9668958cd8f2d5bd5d","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.tgz","fileCount":59,"unpackedSize":84036,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdD0j4CRA9TVsSAnZWagAAOXkP/Rc9ScWBZxCY3StqtVDh\nHQkMKqOfEzaHlz69vKTGmT1IFde/sKmU5ckBOEJ3rL+xV5+mPX66gMIl4wHa\nBwyeUYnbUXCe5p46ax6kBUsRmIEQuHTvP4NVp50kj7Ip7jWyKFe5uZFVBy62\nOy16IAh6dh/etIOLqpyV7CMh1DN5D4ElhEt/umd5nh9ovwGkLB36codV3ID4\nUKFVFWj8ry8fIPnGvoapsaMkHyuc3V4Qdl+c6/RJmQ2pEpWJCo9tPYKY9exY\nNqWWdLJEf/gm/GGm4IXHjd0J8FmWfIYyOMDH/aXIQl4BeXgqEdxLqYBlvHlc\n4/vudhmu1s3xfrlZW6RrBFqLNjwsI57exbBsab/kp1KGtrnJAb/6k3gi9ZOq\nToXe9gh6XuM3kRM5Cd4yB4Wtj7xHbfj9R9IqY0uOS+u+d/rfhRRWMtnXLfi5\n25mhdf9DuYWDQMPz9f8dLFnwFxN8Fd89N5siNzMplanfCZnqeYvVvV6zxOzP\njrBzbeMAyUmw3YiTej0B8NemowhZqL9RjDbapnn9E68PsTDE2CyvMdJElC05\nn7aZNau4/sM1JBDm1Xr+dl8Z5AN6HZDj03yB3KVr/7lrK6JKRDBezqKRCRRV\n14tlbd6dIfnACYv1r2emYuLtgjbZdUmmSieUbhKqj0KIcCPS3YdInqGS70If\nZX5S\r\n=sJI1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmT30WuJrcc1EKQbfqenqpDasZ/oKjEMOJorIcrmR1iQIhAKAoqOSmBYKy0bn0jNKjxBoQRT8uBrE1kuWEgXkYBeQI"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta_1561282807664_0.8262580965642341"},"_hasShrinkwrap":false},"1.0.0-beta-esm":{"name":"threads","version":"1.0.0-beta-esm","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","module":"dist-es/index.js","scripts":{"prebuild":"rimraf dist/ dist-es/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-es.json","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(sum)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\"><b>website</b></a>.\n</p>\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"0bdf039796a6262204c31cff2742f0cbcf36e98a","_id":"threads@1.0.0-beta-esm","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-QaW6bLc5gs+UAxwaUtG+w2aTIGUmo8pl7nauDNK0Av2oExZrOKm3EJmjkin0gsa+xOndP37yhq87XQWXhkQbLA==","shasum":"3a992345e580ae62158e2c3e1c89fe3a18ccbd73","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta-esm.tgz","fileCount":84,"unpackedSize":117233,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdEpBBCRA9TVsSAnZWagAAaQAP+wVLoVz3SrxP+29Qju5j\nDnXDcuvmr76DZYO0L5XnGdFL5QI/YY6PnrLOGQkoCR+XMXwz6K7FU9xyBI2x\nr3IxOc70KiBDqJlVT8jw+MZ1rbJS4spnnnkUJiiKdVnsW0Z1eXBZ83+Dz/uD\nnvcr2X6zLHy3YTXqELMf2khQ4Q78DHFP9kliFyD5WlQFEjN8UK8bSA8XINwK\nrJPSXgpmVlaPGNepQewSnWNB++apk+sNg5Xswvktz8tTuYSvj3tThDobfR5m\n+xhWLvrUn6saJx3GSCiquvQ4wIv3ssJ+FnSh8ZgGQ9l3rXHaoTSDJKwt7Snn\nfMfoDfA0aAdEYn8ldMmGyWKuFWlHXCZyefkYOvaV+P2/tJFsmRnk1LAVHRNS\nd9Tj3HhZwkurd4Pm9gbUYZaqkXQ2ezGLycdV37wxK3Tc/BMppC9HpOSI+oAm\nK/qj8GOW3yXVAKOlEWQAc0Tj2K6qiEHWNsXaLdH4rKoGJiCyC+DtAGNcm83s\nVpKjKHFv4tqtDuOLIJybZvOMt2eGBoKrz2YEuQFNpb7m175vVaqMz/CoTk8F\nhBX7UzhMhr9lY0qxOFOaqTLIS25QKDY39Kq65yk5lvAkTUZKh5Y6amwHrFO9\nTiVG1uEOEmNoqLP925sBMOnLse2BchnGgx0sqRBQ1bXVDKBk449mWEXKqMgM\n+cq0\r\n=Mv2M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDs4n9Kf0YHDKshuTDWXV8OJAr5eBiEwYYjQ7GN/dCj5wIgKRyC8BT/uI11dbT3MIypuPXw18r9odvptxAgQepiJG8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta-esm_1561497664399_0.6108640528985179"},"_hasShrinkwrap":false},"1.0.0-beta-esm.1":{"name":"threads","version":"1.0.0-beta-esm.1","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.node.js":false,"./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(sum)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\"><b>website</b></a>.\n</p>\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"6fc7994e1176aa58b702b03ff6dccba089c39b44","_id":"threads@1.0.0-beta-esm.1","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Nnblolm51R167ws2Ipz8o35qumhSen78uWOdtBx/3Zq9mwaXsRGywRw5a2XAIQcRKUQdlUvBn8sxhajb9KWmgw==","shasum":"42b96d89e8f3663d19f933b62e27af2aa1543d9a","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta-esm.1.tgz","fileCount":84,"unpackedSize":118712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdFSFyCRA9TVsSAnZWagAAJoUP/1rKi80NXRyeYeFSBYfw\n04H0Cu93eyxlAH7k8q/urL0LRjCd6g1CoCnjGMpB/LaHT5lNqZBQyV6PCi1o\nM1PFITByhyUSJxlVop93OLeoCeTwfZr4jzbOCdNHCkOMQY0mNugpQ/G2Zhrh\nlfv7W4NHLKTGz+Ak5wdhc9LwfOB8/PjWttetzKq/rpB+EgxHPDPWxjwdILTF\n4Wa0lsVVwi+wrTQuTD6Y9tNPgpcdCtNyp2gZhz/Eb88sUqNO14d70hPkzUDf\np00vgkjiUtXkj/9UYJjrObsZuBC3i05I4MEH4zTv2F3CaGXMUfaTalpNW2jC\nJJx+3KZVsm5viDjZbWc2L3ks2E/LlCQwQkZ8DcVyAAcRk4iJDeePje4gIyKM\nnwRsuPM/CSuJaT+2lY6gytchFG+sa/pbYjy29dn7mE+xYi0UnXIEAjdpdg60\nt/i435ZYQgtkFZquTx7GgnuSwzrhua3lsDax9JP6FVFXSQB+85TXDhMbFAlf\nWCs/uXjDKaKfLYEC+DLvVMVYEbPnXe4+LuDCHpRoMPlILcd2Sv19a5kSZhpt\n4Q2AIJ0QoqeCJ4S7b4rFwkjgVRNN7DXIbHTs6nKkjg4LvHGeqndzUL245fBz\nqiD/vQSGtB1IG4NcnqXnFYRYeHr1lLtjD6lOH2pS+XN1xCuW64DXp6VBVQUD\n0htH\r\n=Oy1V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICJEE2vPIjmW0gRhWgWDSILsdHqKy7wDz1BcUGp8ilSWAiByItMXGhiMl+JFV5YCI1l7SYHRMrqEeWUGFzfSZLea3Q=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta-esm.1_1561665905345_0.5714959861533633"},"_hasShrinkwrap":false},"1.0.0-beta.1":{"name":"threads","version":"1.0.0-beta.1","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"73fc165d2fe28d10bb87419957d8efb05397fffa","_id":"threads@1.0.0-beta.1","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-TRysrIB1JCSAXb83wFgTHMWug9QcKzthsmcmuQZKQb6vcJHSp9ankAS8NUedVK2lKcgT7wbrNRW3eRI/IO7hTA==","shasum":"b2fc34a02c14cb5b16a8c615151685049fa884e1","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.1.tgz","fileCount":59,"unpackedSize":74871,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdFSsqCRA9TVsSAnZWagAAklEP/jDMsq1EoBO1TjxGFb4K\nfnT+otY1BJ1QY4ZDmvf/lIZdWtUE0ZsayQAOSUvofvhQeDiEq0baWcDNULRZ\nnH6WQxnHxNHXUic0Ap4163C1itk/OAvXiDqBFUWfd8kkyzU3hmE47naWT9XD\nunOfuMRhlBTWipM9JyBqaKH2ZJ6PdSFvCILzFCg5FKkAL8Aki0TJgm5jkE94\nfWEeWU6XIeyxFhxcXWlY5JUc207X5GlporlZIEztm3ea79ILvJ/ErQrdZozx\n+mmdchYa8KdmLaJVA5Ir+6qzWbV7DegiitloDajk5s3vb4ZtnORGeTHJEJ4J\nUN3kiY8bvIZTkoQMmmFUoG0y/wH5QQocI1XY8KgFQqBza+/PwKNflJe+UMU1\nVaJOQBx/S1WmNGDCJoTqDOT/rp6PewVA1FR/ZFB6tgWb91aZsFeWZE1FC16Q\nEp0WGQRhkBawCSLiQrA4LfnIyletNX48w97EcHfY2xQo1qgqGwYBf+V78WLe\nx08CfOpW68aX+l632qOO/+7HShCNeob2/9errb7oK4gMY6LNTRT0bAojhOxx\nzpsJPETHMkhjE5DKsw61LWSZx1va2bw2Ol9C5UnRIXh8+ejJJbpHAbJE9ILV\nxxhT6uW1Uo8B0aAwthXl4TY6r8p59mLHXGcex095C6y3Rc33HOxFu0seZk0z\n3NpK\r\n=eKSZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCI4aWX4v+0YrgVjjaNr11OUkkij2eYgb3STZV6S41rAiAxoJ5ruqUd3SxYlGyU/xD626OTXvrDHcND+lK5l49oHQ=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.1_1561668393963_0.30513084986598304"},"_hasShrinkwrap":false},"1.0.0-beta.2":{"name":"threads","version":"1.0.0-beta.2","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"e96eb74b16810b152c8c5788f26a0660798913c7","_id":"threads@1.0.0-beta.2","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-QruQi5uwS5q7qYLM7UB5/E0J1u5OdF/Y+jlBDWQkvidsuAx3iAHSmX65UuQNuCWqESe2f4dSc3v64AwUQHkgpg==","shasum":"d620aeeef53e984da54a36c16a267ced33ed83b4","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.2.tgz","fileCount":59,"unpackedSize":75687,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdGnq0CRA9TVsSAnZWagAAbUsP+wZt4mMyDjQ3aj/DKTlv\nOiB1gGWTR0XNkpuBMZw3bOZUqZ9jUl8ZqzmPDTnVSY+ei7I50Gp4vTSqkaE9\nRJt2CWQux2XFxotxirxZCVDrlvWVUAh+2tt4b1FXKWJsPe0EzfcN+d+eeHkX\nxk5qBKGMnF8KlZeml5+G6xjO/AoQgdCloBkscm0smIt7Z/K/4/kJjV8JHOF4\nURDZIvlgh7pqLaaAoF6ASR/fhMQ60dlBBK+gaEb1dHivP/DOwCwwX2Wkv19k\nP3UIL32FdS8eO01m6dg/+fa0a6dQ/8FCmpXW5Xue1lcGO27aMlqkJ5sdLzw1\nzNqi4C8J9gJpPOuIErR+1axZQsxtx0XFBBAfLGAJfJsd4UujqmljD7Iewdt7\nHHn9dSFsNGnLhapihpGutBJmtJsAaJXhA9EUxEY6LEu3ide8GcHeikaiO1W9\nmp6rlzGF343mGhkB+qYVaBKEVXWjm4zLMNjGp6SQj+3KPr3eVIa+fEbUuKVt\nWSuDFGJQ7OS19ZiK0UH7ab3sTE6ZwElJl0fLuwmDJs0zRDIEKO3cBPA3UwL/\nuT+tq7vWOgQXafHEUO+lx9AoBmDUnFYQGast2BJsAYE5rRKjFQ7u7gVbdzie\nUQsBAgCYaA0D+M8bNypAi1A42nEoH/Xx91szOTBNN6PG0wk3yRXFa+ByOGB2\n3HO1\r\n=BeAa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQcA+s3Rex7kKwFB315w6I/hzPu/wWkIZ3zqVqZtMT5AIgNv7VRA/ZXj3aVt9qOSSwFEgGWDEtaiiJeIVENWVi4e8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.2_1562016435815_0.5723641909350596"},"_hasShrinkwrap":false},"1.0.0-beta-esm.2":{"name":"threads","version":"1.0.0-beta-esm.2","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^2.0.1","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.node.js":false,"./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(sum)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"e27bb07bd99bcdb6fcb96462ff76b75274aec891","_id":"threads@1.0.0-beta-esm.2","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-eQjWbvQtkO9Ci5NcKwc7MfxJt1NGzJvEmRTyIo+FZ8GV7cnhZjuWXll1jLbiwFRxgfCGw4EiE3BRtOGutuKPxQ==","shasum":"dad183fc41889a7c5f830376a0f13f3db65672dc","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta-esm.2.tgz","fileCount":84,"unpackedSize":122588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdI4dACRA9TVsSAnZWagAAAGMP/jNEBYQ8qtFAQvirhn9h\nNnK9qti/CMG2AwQ8T2UGn4i4PwV70MTRGUvhyK0W3w449UCqo0UbDzMtf5R+\nLek4TxSO36HDK7DmQiPLVxDavZ1Ky04zG4G68Yhembpx8mP3OwM8fPdTYqdT\nMaLWK9rdRGSuXH/wNY/BYtuvUffLtmYHKLrNeqySCyNJwMV+3clGDc1RB13o\nycp6+Y/TpE4y+6Ka19cyijYtWtQLgLbzZ03Hrio9G91WFfWpDXNnm8iqJMvw\n55MNbC1KWWf6ZdL86T0SxX37VHQYhwZIphUgwpdh6updq/eAr/95wiZO6jGq\n2FZ7zDFSNQdWSR4cQXjRTmMmD0BSFjntbtfEnrTsVocGEYnJtDlX1r3zB76A\nlhhnF9EXFhn6M+n6oS8XP262Oz6t1+DQIQOBm4MAFhkMtj4YGNtqcft6iiIj\nwgJ8aOOlkrHGwBuirpLjYjVyS4mDkEDOtlWq+VKTB2pLxy37qjL/TD5PSTea\nqlE3nRdcSMG9hnhTBbq2dsTydYo742wZyzZxRZ/QcDe4ejQgCXtEM5qoUIv9\nxrtrNAF3zV65HNmcdwOVyg5itqe30zoFrQ3qvAridrUyBYcs+G98OwJ6+1cw\ntn89Iw6eP2aLkWc3qdPe+8QXGr+RCwEa9MJNSh3aHl9nA3CnTrk/fXLXxVeA\n6+cd\r\n=1dDc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDtB3FutqEIN08Jt8FC2kEm4BPonZWh65Db9//zn5R/nAiEAsK+KD414lv5nfoz5LRem4wit/CL9I2ZoRbsbnF5ULK0="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta-esm.2_1562609472291_0.1600335607256107"},"_hasShrinkwrap":false},"1.0.0-beta.2-tsconfig":{"name":"threads","version":"1.0.0-beta.2-tsconfig","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"0ac1cc45475929c1c77077ca6b1c9dd0307e2d85","_id":"threads@1.0.0-beta.2-tsconfig","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-7F6lckhNtCcdtEQCwTlaAda7dykoymXjjxFkJ0ol5wamVGuphs38TN9Q1309F+GvqjYav3LvP8IVhpBl19aTWQ==","shasum":"bb67fdea8d24f9997db4097230160d5326addaa5","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.2-tsconfig.tgz","fileCount":62,"unpackedSize":85004,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdKh8cCRA9TVsSAnZWagAA1qUP/337BMMjrz3QsrZTdEoc\ngQZgY5uczPCqfYciBkCa07m2rWpbfzJXzxV1Nm/OsVYBQKWS/6V3/VztOda3\nj/o12+K/2Oq7k83PYrTm5arDR5TvlnYrtwyDfvx57tWIsXsN7rN+1Yb/6dI7\npjicXo6JjE5vnzQ4IVdbxaWHzOFjz6jOEfsRP+Tz/KplgRVympqFkr5N6dBo\nOOrwrxzQwbmX8gy0HPzQyGgrZwZHanRne3gziApBVV6WusqA/Or4zJFWZ5Jk\nwA6AwR8+CN0OEYRVgaGvfrwaL/gsZzIvbGEJ4bUbqf1rsTg/oUfbDEKjyzlK\nnl0eh5cnOvn0ftOEv14GRPycrMeoJxjqPpAOXo6WgLzXHPNQvp9mfNfxvPe7\nc3CFOaUMnM4mi43abMYw74KMul373IpwZzGJclpirZU6TwAlD455M5/AaTA8\nxKV6QTBIIjf7gfLXWA6tvElhRu3Z4ydKjckUE+FYZBdWURVd8h9OAdhAimtw\nh20vyD/b70tVblrqCsRR4+tbzI8JBN/UbqKkybX28F+mwnNrK4P296qbwKxL\n5wvktuRN+1dS+uT/TjbUPDfa9xcouEEsBad++A69L3ChuqKeo1m8tJWzGCXj\nRQX4l31wtZD6GlbkYZXZbnzMyGXVpwhdN3QdcKdcTikTumVmFN0laNOp8NHC\nH8Uk\r\n=ssvv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICmg7JXFB0v6NlN8aS8qIEm8IiNyJgPiOxfeVrlFwi00AiBGvyyV5VLQm+yz9AjruXJ6s0vNR5Q5vehvGc+ryiKtWA=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.2-tsconfig_1563041563210_0.9021363265595459"},"_hasShrinkwrap":false},"1.0.0-beta.2-ts-node-worker":{"name":"threads","version":"1.0.0-beta.2-ts-node-worker","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"d011db813bb5af125f69330689f968d465a4c431","_id":"threads@1.0.0-beta.2-ts-node-worker","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-a/K7ssW2r36hdC/uYK8b3XoE/957WZpobZqG/bMJil6xJgGoJ5IEJWkw9xr4SA0X5m403lnQuUH5IfPEoum9Fw==","shasum":"3e6b7b0b6ec8f721f06f6a783f6da79367fb6037","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.2-ts-node-worker.tgz","fileCount":59,"unpackedSize":76216,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdK0HsCRA9TVsSAnZWagAAftwP/1EeedKeXNg0nA1+pDhq\nZQvMHFi4C82s80WPBbA4RYdR5XP1twmDagd51cVZ3X6T2lDjIj9zYaZzqzeB\ng6JjwtNFj75+C1jj5bPDOn1yyHhqzXJHA87Gl3txQGhtYVHsCvvUjd2rLvAf\nZjWetzF0dqvvP3HCxzo0lMKSq5eZZUOy2wVLwxleSxq9r4A8Ynro9w6YTtZn\n1sYLU2hqvgkepeQKeO44G5edDZxmRYUsUydOf0ejsm9hE5kfm/igxraWz5Xp\nSjBM7t3hn2ZgCbPQXOgszwMO3TPf8vZeTICLjPaIh1uk0IhiKSSSVTvbigzm\nalnRKloPMoyjuzbn1a8oAEHVGNvmWY5aZElA6znTVLZ1m4QcESQQOhAsMGPa\nDQZd3aDsf9b9HB7Ozi6dUxpa+E577TP5aufxMikXjqhEuFAagCkbMpykk7qo\nI1HvsDs6VhpkOlSlu1znRSSSAXyAADBpIAGZFbRdR54sh6BJii22gaqA5jOn\nAbJH12HSqdNvv7aqUPgjYTvBToXknldWNE4zK9zOo1p2xwlq4VWHkLnXFAqu\nqNJXYmn+RFy8Lq7pFeO/0h0SilBVUQDkR5SdkevGKwSvMrisErTTIsM+30rl\nTCgI5YnU06lVuCYKgoWyFoRlRI8lZ/ioAwFGj8fgXt5sYCyFFAoz6uYcmqtL\na+bQ\r\n=c/H/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUisu3SYRmK5anbbDwHwdv4AtzjzPQUBWWOW894lh0bQIhAOXBH+RWhiHJwG639+FV1pqx8zMsBdBcWtXsgaiS3Icn"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.2-ts-node-worker_1563116011728_0.2691362310327725"},"_hasShrinkwrap":false},"1.0.0-beta.2-tsconfig.2":{"name":"threads","version":"1.0.0-beta.2-tsconfig.2","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","pretest":"babel --plugins @babel/plugin-transform-typescript --plugins @babel/plugin-transform-modules-commonjs ./test/workers -d ./test/workers -x .ts","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run plugin:mocha ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js plugin:mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^2.0.3","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.5.0","puppet-run-plugin-mocha":"^0.1.1","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* **Keep UI responsive** by offloading work from rendering thread\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"330cf48f49678353e05641eae871beac5b4feeb9","_id":"threads@1.0.0-beta.2-tsconfig.2","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-UuTj6ArjSPdWcfz4aygpH/3vWMU0PLEE6qJxFuxYB2qbq2iYlEhzV/Cl+QgvFwQwozuay1MeZhtc9DgIQG2NaQ==","shasum":"c57135080875b16aff65a28851053738f00ab287","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.2-tsconfig.2.tgz","fileCount":66,"unpackedSize":91668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdLsdNCRA9TVsSAnZWagAAIW0P/1BMBmj3BJMOjMIGfVWZ\nwQTi+XoYI1SVYXeocuDzlJgn8yIcj5Kj4Tu9pOvy1Nmhx2edDp6RLhxG23RW\nPYD2+1cB9MiWX8kDU/ZPy3hbsMnJVfSMjKsMUWsOaTDAXmE5T1KK9a3ymPLW\ntNNl4vzX/b6hGph/IymndgprRVUghvtas/9U1ADITVUCRjFkLddWL2cLcFqj\naNdlobOWZ8Pkg20v3CcmS9Uwwd8t6FcRNlcX67dWMSHSuFbYuT2oKBs733Ku\nWkm6piNZ1V4UWemNAVw/JTOwm465ds80virs4HSYQDi+SCtF3R7/T9JU77qS\nrP6IDXXL5DSSkVjGGKX3HlmZ4YVzP3DpeSNkoEz88o+mv6P3cdg4dBiyvYQ0\nmNX/1vkbxnZDrUp4butqFE0+mp8AlpQ35uZVXPc3z949V3w1Ymg1tP9YJi81\nR4v5Nuqj+QDWJb0qF8GIjkbX+wRuorYCPFMLLwe0Dq27pdMZX7vKZsn0KRBf\n47dSsG5AckFySa0obDkK5089rUKHrOzyiOBrjxf9zyQTgH/HNMumej2Rr6Kp\nqYEATPE2wgIhpRvGwnaWfie7Z/HcCVe0o3vzkjMsx+AZoXJTmN4Ajm+TJPBP\n853/ehDclPPjjYAI9hUUPDSipSwTsfCSLmg797S1L+QE3wTNZ6IvJ4Hem3nQ\n8z5J\r\n=51CT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPq1MRWazIQi79qI3bGGt/qtAU/90fsNxx92/NF8VR8gIgeEmyCssTRcyCJT0A4kw+/VklDyRiz1kCTPEwvqWhF7c="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.2-tsconfig.2_1563346764778_0.511849031641294"},"_hasShrinkwrap":false},"1.0.0-beta.3":{"name":"threads","version":"1.0.0-beta.3","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://github.com/andywer/threads.js#readme","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"766ab183d6cbf48ca0af162b3ce7789e70241154","_id":"threads@1.0.0-beta.3","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-y12E1Vk6RKwZt50kQo0EyRHLiuMChnk/zEwssJp19FWnxHaKZVIsa5EMPffm7LSWE6qEFzamjqplnSSI4Fp1ww==","shasum":"4770730aa6280051fcd1d9cb5e506450cf7ac274","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.3.tgz","fileCount":60,"unpackedSize":81852,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdNWVwCRA9TVsSAnZWagAAhVQP/00C7hg623HswXXCo0F6\n9ww2CCmsG3FhBW7Kom4e2LBEfxnhGekSjIGd0UMFetu+ElPH4bshSHAGWVYj\n3TjqZ5S+EnJAzOF1OLlRdrB9o2CYEr+w789mHZmhOPPEaC/eKjfnR4OXp+M1\nOkCEkwK0WRUzR+2jc2cvKkmRoyZri237X9xhVk9cYgdF9B19b1AGdq5IXqcS\niMSZ1LpOTL2Z62YhW9RFay9LCx3q7VBaCADLz6ovVnaE+YHQ2A8NTZ6Q1aDU\nbJ/Xytf19/jurQXuyQmcKh69s7KKZwenPibmetvYxEww7xjhr+bxgKMgfHgh\nKMYLfWuEiOd/EX+lzNOqxHsttcNx+k58yxezKWGPxAKokn/cB4VZa7Cgo9XN\npfpt9HWfuedNfMBQfGATi2rpFTX6AsfQAlM3cxnS+1cOhpri9/prSqUhBA/R\nsSTle4tIjdSWKKq6MpHhTljlELwrFknJmmgUKk3w/s/qpGkmq4ta3uvaiciP\naIQ+qdW109ItOw3mnpkVg9WdBlgfucbCS0sCcKk3mWzxV/BkaHtGCjsVmRTS\nGhDpBVowuJQsF6WMdzOeE+YULmYq3mur+8enjccYWuzDwkAP8NrQJiHtEAAn\nZuLjnVu/SCi28sgn7+1CROwYbXRxA5d8SEZSZfD3wE/S0BlBeszwvA5vGeB1\ncaEw\r\n=nOiS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6U0tGdSqmqvfa+XKgihJEPLs3ym3wi0Y6bUDg5NqMhAIhAM9iRDlCraVX5lfCaNI4/SBaR/4v1tQ8Lb/WZpLe5CZn"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.3_1563780464159_0.9214064112226836"},"_hasShrinkwrap":false},"1.0.0-beta.3-bugfix-148":{"name":"threads","version":"1.0.0-beta.3-bugfix-148","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n* Allows using **require()** and **import**/**export** in workers\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**TypeScript**](https://threads.js.org/usage#typescript)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"cb7961a93071e473ea03c0b8b4e9588b68d353fe","_id":"threads@1.0.0-beta.3-bugfix-148","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-lGM5AeL68iYcGRm9HXAa935tTDxUPP2Eiojp5wtLdqRTXWu/n4IwSLDFUKJqlpxNDwb0XKqWXsMJzjsswQbw+Q==","shasum":"0073b2f15e087558c36f56b0daf25f2f60e9f8b8","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.3-bugfix-148.tgz","fileCount":60,"unpackedSize":81877,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdVGhICRA9TVsSAnZWagAA4W8P/3rM8h/VPqjiGLMlQf43\nK/WP1J3bAZOYpLBkJJLLSDdwB7WmqwHeco233dVWD1xDpPhKhIGB7VSVpXQX\ny/3u31sb/LRZQM+PBGTGdLii8rrOM2B+c+yG/tk4718CCY8sfOKcXSDHvABn\nFsbdDbPol71l3OR3HLbkCBO0NL/GnQ8kRgkv1ODf85Y5vVbwOIySPRjp+8Xh\n7qGP+GlXSLB3nenOOsh68BK7yzcHFBqzlrdEvN913He4nfP6ERzMdFwT8rE1\nX8ySi35Qp95ug7hAeKTtXztvevXdSeBAGaSbj6nz6aQyOoBNfEggvSTzykgQ\nAQEOTGDyDsgfnsauFgNkpAhwztO9xdpAHakB9i4+R0I8e4l5pE/BHQwTrTzc\nrTSrCHZIVFVyZep7MTbl2F0pAZV36ljlY9ymKEsC10YuyfRXHbYJNawFwz3V\nOce7Yjxdd1twEW++a327xYGGQDcgbCHCMkIp5IW7tIqa1ysJsdDOIe98tdUP\ndP/rqXgLHK1yvdVFZ1vEbLdlCdTBSKZX+BFxLtj5EnYCBfRqvHTfqddZkher\nWxPMuAfdNiaqOaXlZ0m9lrqU6ae69oOHM5m0PyCLyyk9FUITxq/u07ydlF8Y\n47IvvsdPWF3Lnv2SF4sS8THCIvac5/fSv8PJcAAcqb2LPnYDmchQtjrbhlTV\nE7Hr\r\n=phPF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF8wQ2AiBGBrtgTW52yUnIkCXchGNVHDL8m6nFNKofQQAiEAj2K2zar3XR4lF+w7BKPxbIDNwcOfxmpFKbGZGzVOTbY="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.3-bugfix-148_1565812807779_0.2368940227871863"},"_hasShrinkwrap":false},"1.0.0-beta.3-bugfix-147":{"name":"threads","version":"1.0.0-beta.3-bugfix-147","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n* Allows using **require()** and **import**/**export** in workers\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**TypeScript**](https://threads.js.org/usage#typescript)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"df3dfe6b008bca44a85b2689b88b1de8474fcb1d","_id":"threads@1.0.0-beta.3-bugfix-147","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-CIUbOKkxqfhZ0YvncOXTEwE/Gx/huVgznsXjWHEuXVCuG0Ng2+cDSAMs0dNJYVPk10l4YokNpU5cxsQDLBeCXg==","shasum":"760838141848149d4768c69aef85324754f7aead","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.3-bugfix-147.tgz","fileCount":60,"unpackedSize":82188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdVQaGCRA9TVsSAnZWagAAtswP/A4NVmeE1Zv1VB12RL1c\nJi17alJ67FFmz0jlOhiuau3syDGqX8W6VRnaJ/bkVUPpAzFRnRtU1Sf9mYzw\nVw5VUTlNZuCT29b/n4/5NoRCjGKDcUCWoEFjyqAnYmjdgkGtDi8yEbMlee41\nhqLmV1YjDlMMnbh3rmU+ntFAOwqYR2qmS4qVeyA4qJtoNHmWu3Ji7Q/Ba54+\nZKGOKiBAAZAw2E8eY9ud0lJ7omdp0UhEUX34zG121eOBOupC4EQAJIYBY9+e\nFffwiTGLPhBe3EzyLQOgE3ecTqYSDARuC9aaV0j3o1V6WvJrgptWHKKDll44\nFIZN+aoDg06c/xO08qW/GG3eSbTF4gen+FX+ytV0vEFAlT1Mcj3cuITfErGS\nn4tmj+IOWXsRUv7Dcml+UoHBdivJk5nNucowq+zSJBiUt5O1/qbXZ6ItbK4I\nF2CChPigBXYz1xwQLlo0ML5/UXPnD65/UVeLDp/xuejUUJQKbpGefODO2anK\nClj9Yd8e9UUM6X/T2IVAvfP5XpTQuExE5s44yD+PG2HJ1rs1NBYGQPizyHaa\nHTPE1G+o0oY6Gnr+RMJ2Psu/+tm7CD4fJlvkJmCgizgjcfPcj0sYVWyOhaTl\nVZ71Up7aSaYRVlRM9jxpjk8Ga/DaM60tAbcE+Pqqe/Pccg52Giyn9q2sPbhT\nSURL\r\n=AF3p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCICHixZPRl0rusyMHycAkQwo5Uw8cOkTSEW+TmuoUhFJTAh8SdbIYwscTEZ5Pn8LDRu7XrC6QkIeLjy9ayptqoer/"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.3-bugfix-147_1565853316584_0.0591390787233248"},"_hasShrinkwrap":false},"1.0.0-beta.4":{"name":"threads","version":"1.0.0-beta.4","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"2f3b9fe74665612ae0909bf7bde497c1d471568e","_id":"threads@1.0.0-beta.4","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-iQNEWLuOmdBwMLqKX357VT0hkFS8/fmHXntycnq24ZE8IRh+cAsLvriuhMuv2uRP/ftzK/G8GikyKHZov8nAmg==","shasum":"d96ef738580c0f0c2a9c274f9604b6a7e00d1ccc","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.4.tgz","fileCount":60,"unpackedSize":82213,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdWEggCRA9TVsSAnZWagAAL4cP/R4Ri6M1Jh6qc9VrSaDS\nLIgDBLBbLOrE48LvluksXDFR3Qr+drfI1/LkGZoveey/24SPgK4SGkspVO4y\nv3qvHa3Ege2JD1aC+LftJHnvfZsfSIrcsdapq4XNeHUaokOuJol8lCQ2HIpW\nbDmUK18Tq4syDG+Zx9hhxcYT7mTFx67r3Lt9R02OcmZM/3E4HVTE1iy65qvI\nFGlyAgiwXfqTst5EUquYKu0E4JqHD7h06XpOFzo9KZYkb5gBvBgw5pFSvN82\nCcdB5ELQEww00+Tot6TygXFt/7x8ZLCaqwBz4lyzn+i2usz82xrZAPQAhbWi\nzaDwV/uvsJXEwFfTfntXIoi00weBMpbFL+lRaAihcIIy85KGirgQu8+AKt9g\n6MetSOW6wyMHPaKK2dk9fmw39d2DGZ0WLiRbayX32yF5hhjOVHk/96dcFaOw\n/EiGvZgiAV2Tvib2ld49wZl13YqyEsDarbzOg/V49HIBsYBGQ62Js7YLObgo\n25R6PG/5U07lxX5l+TP+yGLfhAl0JCOvZ/mUxlrMABJqmibmfpOzQcE1+GCI\nV65yL4rIFhi/odXnKBGyCBWj0vmRbb3uklhF/m+uZ4/8/PTBQiJ/HtSXHgXX\nn5ytHZCT79hNc5ZKbWNW2pQxOHVPDbnhEWdY9KHSJFdJUaFNkBGZ46rhqBBU\n6OXt\r\n=J6Rf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGRYeQQgOp/q/I61mosrUY3PEcxJwHzNNVHYlfhnkaSgAiB3z8MfkuHzsddcGvBE6SvlQ4K8rSYcm0/4nNWr5yaZbw=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.4_1566066720221_0.3498631891228756"},"_hasShrinkwrap":false},"1.0.0-beta.5":{"name":"threads","version":"1.0.0-beta.5","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.0.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"837952d2cf4ec3696f3c43fe5690d9513a51ecce","_id":"threads@1.0.0-beta.5","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-zZZywp6nZ1cGOELQwtDB1h3M8YRroJjXazJs20xZNzZmmkE/r/qJPWev4/L0tkbYrl6Mm5O76OhMR9To5KP7tg==","shasum":"81e523518618797fe78d489ae52a4c17cc583a51","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.5.tgz","fileCount":60,"unpackedSize":82293,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdZiJPCRA9TVsSAnZWagAAugYP/Ap0iXDAlVk4J0OvQ8D4\nBJEQlDK1h2ZJUKh48737cRODTxPwjslIxwhDmCj5OppDJ20sLfknZ1OiU4N2\nCKFYwwIJWfpZOpRB3A6MIAj6NotbgJ32e7S2YbotXLJ3lf+R4oj9ua1mxD56\nFxSUwMKwLljrRcFjFTO2Y4eykvLJhzg7M/N1jM3OpGyhTMw8mXwJThUkMv7D\neHk3jgVDKsNJNXmrXZOZaZSYqElhPJ9uc//GjkAYhnWEnlalJPEQe92og/02\nZIAjxYoHDfwpfnf3igV/20ibQKmRi9GCPyDzjOcZf9DtuYs5hXHVu1KwIHtA\nJaRmjzkHTX4dl9w9BoMgczf1pZnfxQGj06p+A7eVlY+OqRLFQLK6AfVSB3hb\nkEldv253GUpK+iudKdidloHlntJ/jQzia2mOlF+jO9GSBRtWG+wSW9rnZH86\npp84ruHDEX5lkPgwecGrARETSnzraldvd7Y+VQmIun4KJwzgYb0e+8Ob+iXV\nUqMhL8hERNXi+Aac9ZWpBxD+RtmniAkaH8eDJufMa9DKhA/63t/IrGFI/dfC\n/gGam/vNSUUM8XzJBrTdKjV949coFc0QdrQ7n3z+j/V4Qzpw74zQDxDPKsim\n4tPATa8wucBiEBmV5K4eDtkzAQ+nx/RTi8Y7SyYTmhY0zVtPjY32CxfaGL1S\nb9b8\r\n=4QNO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFA7hnbhHgxX8wmMyMxqE1p6t5F5m9OYz9zwWyOPc9DvAiEAxvzAFEJi84+dFC3TF35RR2goFnhHKu6d060YIPK+Y3E="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.5_1566974542844_0.32954877532490756"},"_hasShrinkwrap":false},"1.0.0-beta.5-feature-156":{"name":"threads","version":"1.0.0-beta.5-feature-156","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n* Allows using **require()** and **import**/**export** in workers\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**TypeScript**](https://threads.js.org/usage#typescript)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"a212ab164edd61311657f7499aa05c19130c72ba","_id":"threads@1.0.0-beta.5-feature-156","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-guzw5MHqY3f8EP53uvtsV+FLmn2GglBhhmbXLxuYJzH2Cr+2Q3vkj4JVzHegVwDtylib4zLfI6LSoVU4MoV3wQ==","shasum":"790f1792b4bc98c4ea5e056bdb660ddb23d625cc","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.5-feature-156.tgz","fileCount":60,"unpackedSize":83176,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJddMUECRA9TVsSAnZWagAArgUP/iyoKFAmFNZ5ZgXb2x/S\n7NtKFEjjeiQhOGFXKohrbpqkw/N7j82ZccBNfOZVXQ8dHXLPP+IjrPqnv55I\nu6cZNSpJ3L9zTJluLPb0MGIRaSUs8q9FLhEfngXuWtnxybmDo+1nqjvYCHP6\ndS45fDdNL+jkvGUkL32pE+LZCTlW4Y3dtoy7TkMfLfcQeuSFQLn48jU2opw1\nBfMB4doL5dklsj+bDH/Bz7punQJfyigSoGVD1RFU2TP3EksY3RHmKIJ61kEz\n5m48bOAW+gWStGgWK7n7kZBEZszURtuucoQIyXgM48hmh+qu7SibpKF7wZof\nMRybi+Xhzrw3jSeBcevn60/XzmFFi9vdcy9QSRZPlBp1TcW0CG8NI0nd1+AL\nA30iRQOCqIitlr80WQSkZxokBNcY+BgSNbaVaol6vBKl2if1I0FKSsPAmqEP\nWBZF83RP5OujGDq/otMCPfrDViDCGX1+wuWxVEbBQWTIjyI7ALXBDLxElK7y\nem2mAQfhL+zzjj7RMP4Kp0RotLpahSO/FtmaFmgmtXwofb/e4kT7RhVHJrKJ\n0znOOGHetu0PUVzZXneXaV/NvYHGp5kOAscGDEiQuw3nWrUPam+9M5tfxv6A\nT6HRu7ID3NlFgPNKshczMPhvuAc/k2GS+QdU/xpx9/LXSNf/ypOkKLaciaJ/\ndvii\r\n=52c/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHYwcZvc5e3kne1wZKCGpfS1VT4YRXRBXpnU/j0FiDBlAiBQcUuVz9wgpgwnpVIqRFzIsI1+v2wvXr0vx2ikk5iuUA=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.5-feature-156_1567933700056_0.812301156864403"},"_hasShrinkwrap":false},"1.0.0-beta.5-feature-156.1":{"name":"threads","version":"1.0.0-beta.5-feature-156.1","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">threads</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* **Speed up** code by parallel processing\n* First-class support for **async functions** & **observables**\n* Manage bulk task executions with **thread pools**\n* Works great with **webpack**\n* Allows using **require()** and **import**/**export** in workers\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nasync function main() {\n  const add = await spawn(new Worker(\"./workers/add\"))\n  const sum = await add(2, 3)\n\n  console.log(`2 + 3 = ${sum}`)\n\n  await Thread.terminate(add)\n}\n\nmain().catch(console.error)\n```\n\n```js\n// workers/add.js\nimport { expose } from \"threads/worker\"\n\nexpose(function add(a, b) {\n  return a + b\n})\n```\n\n### spawn()\n\nThe return value of `add()` in the master code depends on the `add()` return value in the worker:\n\nIf the function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make either a function or an object callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions, following the same rules as functions directly `expose()`-ed.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Introduction**](https://threads.js.org/usage#introduction)\n- [**Basics**](https://threads.js.org/usage#basics)\n- [**TypeScript**](https://threads.js.org/usage#typescript)\n- [**Observables**](https://threads.js.org/usage#observables)\n- [**Thread pool**](https://threads.js.org/usage#thread-pool)\n- [**Transferable objects**](https://threads.js.org/usage#transferable-objects)\n- [**Thread events**](https://threads.js.org/usage#thread-events)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"b5c646d4115a58ea23face0ada05eac79b4571e3","_id":"threads@1.0.0-beta.5-feature-156.1","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-p9lXUG+0f0DDXPxmZ+utVAn90LSfFkb14kk8SjSUDoXgNfcx/WIdEiz4JlhTkhrgsuxbm1GZcS22Jc0Vl4LWkQ==","shasum":"89e5bedd0a309b06115f23b2e4adc7305c6033c2","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.5-feature-156.1.tgz","fileCount":60,"unpackedSize":83582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdde/BCRA9TVsSAnZWagAAUpwQAIe+qna16FxoWHlfB7XA\n1lumtbtgqvk0pqkNljK8fJFgsUHFXQSq6iy9iiYQ9BFp+fted0Up7C/UYU4v\n1JGDoAz+qXtw3uFDE6sf30/PyTwLnEGttu49hh6h283D1lQM+oPS2gc17MqB\nL6NDbDroarKniZpE1LiHbkS2b8lj44LhhrsLG+TuvcYEuHLMcrWhShx+h2f0\n3Zexp8ZMkRfLt2daM3jxS7TLWfWLn5m7oGl5QS5eMjEjk3pQHBkfIIzK9ywg\naUSz1qGzfYvvnDctEL5ze+lbcBquppH9guqQa9C3WzLgOGVALLHYz0L6/2vM\nTb2bbzb3ZRtWakYsN5Z/a6cQvz/Ndxb/2WqzC+iqtWIawlvicfxR6lWjrPfB\n5bb5DpAUFUnjrvB+CIsaO4o2105AxDndZYjda0cl09+fCQVH5HGmGeNCb5kE\nJ6a5eVaGP1etPYQxUxcykRkxzj3NhVrW/52c0TBnTYX6Y/OsyY+b+rZpMj+r\nUzgXayUxWXKMQxRuSJ7EaAyuutjv0VWrGR7Uet7yi1grSSfmC+RBoYXBdDO1\nCm2/XN+pxWXlpZ2Y2tgWtc0+ONl0orx0isLSiOZneqYFM/wpnv7UEKVhcm/s\noKwJjcOcsP95JXRXppxGtDUUucojh1FNzkygPLejrqM+UQikP5o+p1iUOIna\nGG05\r\n=31YJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDLTMkjyUqd58048I/SVkrvohQ/89s4B3g8FIp2+4lM8AiAvSxnAGbGqm2ZIpXB7u474dHd3Vu4EI1TFW8J1KmEyFw=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.5-feature-156.1_1568010177133_0.6988988098310804"},"_hasShrinkwrap":false},"1.0.0-beta.6":{"name":"threads","version":"1.0.0-beta.6","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"82d1b47144072b8d061ef10c0e786ef45a673efd","_id":"threads@1.0.0-beta.6","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-T2l1xC80mV6o9IY6BUdt45etcB57c1j7JMxlDyuZy2pP1NDwPP+avwd+53md1XFovrTnwf5St6+EyC1e6KDG6w==","shasum":"eac37a0b35800760c7e14d7d74c74f2c37bd49e5","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.6.tgz","fileCount":60,"unpackedSize":83568,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdd/+kCRA9TVsSAnZWagAA/lAP/im/qW8KpQ3nRFWGrJ5Y\n+6dDd6beM1Gp4W9p8pz0MW18X2ekvArm7MYeokmVEP9/PU3kW6BJlmA7yHhi\nbyhLTs6gbm9f1RI0rycK9E22h7A7YiwiG6WeH1zciAqN595TSiNsZl/MS5ws\n99nb0JugGec6WeRZiqcOqGdg8Mb2vrmzuyE2DG8ZlEFLyP0ioRcCVhC4Qb/g\nPCeOyb2AND/jzGP+WloS+oLQx4dIEQ59svKvEEpcX8ploaCYZZMpxidgYvlM\nerDzPeVvTIyMl4v/lU1g17l360t8hS7zEJZ5YhJocwN+f95eK4GsEmZXLLzo\nc/cW3KfSsoG7XmtmbR3CSUmAliZPWY1MuA0GyIO/IjTwgsMDbtPx8YNDtZ8d\nbefg+R1R7HKZg2OvqYiW3OoP/UUmtGVKgxOHemyGVoOkIrNOVtUwdQH236tK\nvmwFja+mNOgCb9Gku88IDMV4h6Hq36+Yv7TzCranKpYQl29qgquOhS2TBFdr\nOsxIGpHRQ8Mf+tq5Pr+V0NUmlWa49qv698kUTk8yEANgy2g7zgdk0yjYbzqu\nTUVUgp5uveAj/bNHq/ulb8l6w5O1wgcEhhMSVwdUK5cCEfsVWBTIKIe+pDPv\n1ehv/sPmEjXYkIoZQlK3fc9l5n0ypTWb2mZnJELuUzZ1xT+bjNguLNuQWFQ+\n8lWC\r\n=25dN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCp+xBs4M/Rm6uQizcjDmiW/tqwy/GZdIRnRcFsP4jahgIhANsBPP2aifK0A+80mQl1xc5Q9oHZuOvcQEaX1NXcXIDp"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.6_1568145315249_0.24169979833254573"},"_hasShrinkwrap":false},"1.0.0-beta.7":{"name":"threads","version":"1.0.0-beta.7","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"5040e9e97312797d00afc32e5f85ebb173ed0b2c","_id":"threads@1.0.0-beta.7","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-UTaC0T60kGcwmImOwcXQI4gk6oeS2pq91tyL3qJ5WK9NfXN1uAV91Wg02yvS245bDwZTV1SQNCXWxNBZv+tVfA==","shasum":"1f903a80e573d43959f5b9f1634514ca88d17c90","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.7.tgz","fileCount":60,"unpackedSize":84084,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzQXTCRA9TVsSAnZWagAAfNEP/0t0Qd9Ke9EYmHhMqaMJ\nXfTimyBehfVCfI8RsFuJsNNKtqHXtNn4uAcAX1XKIyU16r5wspB7NSLHXOlK\nooV6rwwidej7yHL3zguRMt9i/zbL2PxO032yB4D+QvqA0R85I2UW0wD1CGE7\nWu18PabuDxMReB61837Dih9xHA/rKOhoJYBAPu03wz87ciTFkpPdzfpmVGRq\nOY4bv5e9xglnbU4ajSLzE3/PVh6oq2j81u8TS+Pit3XasDCj4wGx9KD8784z\n0XdY3jOtN7jBNW7gJcYnAK+M4eIXSXxJbm6TkPc6sCwNtLrWU7Ilx7VMPnRA\nF9/2vJdNIhToeeCmboeZFivO+n9yboCgTIZIIahn3rOgdW+Vz+aJzIftsUR7\n/MAetWNuf4HKn8JnpTk5UNg+gNNIiKKcHxC5tarnWVWFxn9jpWst7FpOnDf8\nHM6FEGXL+DHVAdaerPv7BBRG6K5Exsp4JjDPBuvs6RS8LEQY+cSql6eU+s6J\nfcsSVy7rNLsuvioBxiGzqlhrKLl3IUuQnUJJxbqt5neTh3A8jtBzB/ol5lN0\nDvt/nKxGWgH5hhLntWVaqs0KnqJ4ydEoTRsg2/2sT0d4MwVhvw1ZPdEm8Rvu\nWUpzTiEZ8s1uqm0JJ9DTPhdzHbHfiyUY6q7wOMzSgL9jGzeZfxntBbArvjmd\n4yI0\r\n=ENT7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrCQqhZy6XTKkqGeOOQCPKGyewg1VETUG4LFE4ReRB9wIhANOXECMqA2JR6ZqkXy/lsq32EIAJrDVqnVwz4BTdKMAM"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.7_1573717458962_0.447491644659175"},"_hasShrinkwrap":false},"1.0.0-beta.8":{"name":"threads","version":"1.0.0-beta.8","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"46c4e1f6e7ddc2175ff7c0f1c861b56be66b4dfe","_id":"threads@1.0.0-beta.8","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-NxeopCbd5NretQKJr77glqWsjuZWrYhPgdL84/XtLi029EIAQxskueHd81jPPlvFSZGcWR5M53ccbi4LcdIWJA==","shasum":"aac231afce3c92e06914e324e6870ad60a5ffdbb","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.8.tgz","fileCount":62,"unpackedSize":86082,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0GALCRA9TVsSAnZWagAAXl4P/joNPWJ8fyzCI7s5tfdC\n3T8xN1Q+Bs5aueX38tMn1cAMa2sEHQ60UZeOSqHI8/E2mVGsYHBFfTHY6nhB\nAX2z6cTRYNWytqjQTJDiAY+PlzXuyEi2T2gxi8X3vSV9ZVsBrT6iIwkNjrpN\n5IhPTtcSOnSEWUD+p0DtyYPUanMiSoM67oF5s7RUYrZLWkSSOBjoiA+qD/gB\nS0N2rcHZ61gnuIc+6Vz7VRICPUFcUF/FsdiwrcIgFiJpnBPY05kB0d7f2TCk\nCSDSZnPO5UpZ1YUYe54+AJn8Dvg1Nyyo0M7R8dwG56D+9ni7SbeDGQzDAIOE\ngH44gmMGxaZrRX25SXcjUDdkDraNvgAwQ2LvjryaBykfHoNrAtG/xBBgKHii\nM9tNOBDX1YpYDOeY7RwvEt/kGy8b2Px0a4YP/+ZAhfUosh1+6j8+tBo7ZElN\n930/zTkiM3oGvwBwPERoN85lD465XYKuLtsaG8uRyewXnve7c+eqHs/6A6op\nBl5UhNdaZ5Ak6CFwr5+2JkWcjMHFX0ckDj1qF3XElR6onWwUbNHGFrkq4LC2\nU7TTL/+dJMreTptwvaU/2DvxNlpY3hPBqr6/c9p4JmikDQItTwwZP3kJ3i2o\nozgh7/kNOERjiHdvx9WowLqrlG/GDHx8MsLEJkVYL9Pmf8yHXyqW7GQJSBLL\nf1eM\r\n=moEf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQSgT1ZNDP5CJkJhf0QFIOih/pfT3KqHzyH64r+xdjzgIgJcZo9c1fC2/1qzPMMTxr9gq/6t7YextItA9afZm2bmQ="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.8_1573937163105_0.42396871199901387"},"_hasShrinkwrap":false},"1.0.0-beta.9":{"name":"threads","version":"1.0.0-beta.9","description":"Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron","main":"dist/index.js","scripts":{"prebuild":"rimraf dist/","build":"tsc","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"@types/zen-observable":"^0.8.0","callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.4.0","zen-observable":"^0.8.14","tiny-worker":">= 2"},"devDependencies":{"@babel/cli":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.4","@babel/plugin-transform-typescript":"^7.4.4","@types/callsites":"^3.0.0","@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^1.4.1","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^2.0.3","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false},"gitHead":"345d6cbb9a232ac3a740c6b1042c8fa3e6e3b82f","_id":"threads@1.0.0-beta.9","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-ZjpQvqA78p+y4jtlhnQsKc8V9AwUvrWwOhy9FkFKWO24JHKte3oWllmjvUw896YqrZymsJvqJwlbUHV1CpVtKw==","shasum":"f34f178175383ddb29a85201ab9f79e51a1afe6b","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0-beta.9.tgz","fileCount":62,"unpackedSize":86097,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd9MXRCRA9TVsSAnZWagAAVHwP/RiQFKe13K4piDxb0os3\nBANMmpCvHsUQRMXoUoPwLx5Hl5mdLJI/uw7rD+8eIbJjOaPns00etV+GY+/k\naoPdsvdxz94ruLRExvsxERhHuHNRtA9YfbgKcZcKqAMOxqiaV5ckATkIAVA1\nkJ429722RuOiMfOi3dq5isN8DjA2ENvoeVvl9jaXFdxMtjKp8a+LQGKvN7I5\nPGshhbw2ZmTfOdeWXlvwTaE8PljOzbQ2LFvi2YoTvTtKpKichQn1FIs4iFlU\nplF3b+MlWrLD2lOUuGwtCw6wydpFpT7wPNDMVmCB4o29NcKCAwRQgLdg6YKY\nIevoE4JSUbVaQG9TgXpdwkRp6bWSso8WiU5UczpHujtqrV9iuHZU/w64CT0w\nkFBrQcuR57A8+gsdPlGpo+IO/t57DSHNmbAcHw10dpmjzfpI/ePofPhIcxPA\nKTYQt2oolHrXoGydiyojd4n8Y5/r34F41A6LTvNh8kenajY0XJO8ZQaxrxmN\ni4Og9rd1iq3lqt/s39G3n+y8XreEizSLP2kR0u1sisVq/6/mCgzCMWdiCL/s\nJ1JaaiWhGL47ee4QLar5yomJ+2c5259H2X/cqeNli8EdQFxivShSkeW3CwUS\n7yCRVoinoTsxS5h380LeVX8VPxpj0ifeo1pfxvgQXCVRmG41SrK8tlbLPoek\nLlI9\r\n=Nd0v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGZZV0pTVgy4lqbsIhly5+S7X0cK6UrOM5RLRYvhJrUAIgFYLHhzUgieWuhx/EMO5Pd6oib4IxVtky/nIWVMv2YHs="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0-beta.9_1576322513188_0.6351367535396375"},"_hasShrinkwrap":false},"1.0.0":{"name":"threads","version":"1.0.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.0","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.node.js":false,"./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"77adfff6f0ed7a37d7778ec4703b1782095f8398","_id":"threads@1.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-E4qjYS3Za59Y+SVu4GNrnFwL4HbpimY9Co+In0PW5hSljIRo3z8b8ZmRy5V2f6J1fK6GsoVFSR61lzqmPnfKwQ==","shasum":"d4ae092673f566cc650f25aca8bccd749bafbffd","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.0.tgz","fileCount":94,"unpackedSize":140816,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeByiwCRA9TVsSAnZWagAAW4UP/Aj7cJfZkzJ6P2tRmU2n\n8fYILu/cGkP2TyoGid+jBfkO1QYGGxtOPVct57tugNgaUcoPCl/myOt25KPG\nkgiSBhswLaYB1CG6VR+kNzioCRkuaK7L+4U2TzMmikF8BrCjIPoq2ft3uxtq\n3/IuTkKDSRjZDPCHK/ydlLG3QU5gjHENKtkpRdtA4yicWwWYuMNbeVZheJY/\nMsvQXUj5aO7HnKIDJzqXqg0d/H0cIuDoaRRpHaPzHJxodTU7SAgwgjfLP4bc\nTrTrHI5znOd5kC1KXqMZ1oI/1rp3fWlgk62HFMD/COdAdSmXSsWtQH3/P3Se\nE0j53Kovx4vxpY88BOXuWNbT8SzSMkz1VjZRvgUZhJVYK/zxKsjozJ/P0aRr\nPG8AGl1ey7cAJsysRkRKVaPWg0SeWNIFM81BCOfk+peQ/mNzgq1kApTbgF5K\nOrsv9bHF1lqSLmHUSjqfPlPGvfxYgYX42STiUOZoaoS5G+/H2GpMLH4sFu3s\nhiNnK5czX8s3Tn3kCQZC6CSzeKHApmFdO+jVvuFp4BDUdZJZdDoQd1gEF5tW\n8aRRNSvAljBBz5ni0jITtyVVU8hJTfqos9KGk7JN1gOvHE3Le4NZj/jnVErB\nyaD6L1bmjqkRD+DnrspZa3d3TbTha8AQ2UKAHT0y9uHHIaAtqLOwGIQmlDD+\n7uZ3\r\n=OaT0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFR1btBEpMOkQWcy0Id9LTsBoRuEvne6zZow012ia0QWAiEAz5vzNqqmYP6y18EvJ2p9m4Ey//RT+7Ci/OS7Bby/jR0="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.0_1577527471785_0.849085223759348"},"_hasShrinkwrap":false},"1.0.1":{"name":"threads","version":"1.0.1","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.0","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"8662c0a5386bc26f0b38e320963f5f57d44238c0","_id":"threads@1.0.1","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-CObqh1mN+uGQueuB9YMYLSQgrkoQ+ybNkzdO4+kYRMIDjgh29U6kTQ0z3Xchd1VtbKWJiQ+r31D0fOR/UPbq3Q==","shasum":"760280fd9bdbdc862c5f540cbb1b47483749e7ee","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.1.tgz","fileCount":94,"unpackedSize":141896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKJrNCRA9TVsSAnZWagAAS3gP/2hkErg8dPkobEc5PHXV\n51xDh3GOlfGIR/v6RCRbn6/xPQe5TEFhyWmXsKjZe9p9pTc3s9aQ58NZsK4n\nF03pwA3UMUzHV/JHLQVtPbCzt6z2zdWmEaGRmdVlJs2dWuWpc/NUoEZre/IB\nnn2OP3Ppz+Qm0tjmoJ3aA6yHP+932SrjPVmL1N9o05hCqx8w5cQ6v65kUUtf\nVkGlEaSi05UndYw5oedm3Zh8TjCqQl/acBnJWNBR28ISQRh6P86UCseQoJFB\nSUXPiJDcZ9aDgrofDhLp3Qtmg1u+up5VVboTFhFHfP0bpB8iRB+tUv9pl3Ux\ntIkflTGN/ZiBc/opQdlyCwvDfg/gAPhOw+AJFfUkGDsjl3ICoITeIX5H6pzz\nkQZfea86kgrLs/jpzZUM+dCt0qXueFcsDix4ag9VhsDsIF474cfsVDrH8N/Z\nSkuIp6/vEo7SDB2mPbCp6Dd3KW5WLd6jKoBBm4BgCelUZ2wjaS7Njw5gcyAZ\nUJXRY9UURr7qWsXWi1d9e9tPakU+fhjmzuXv0bSDBvdNSORIlRZAWj1rhjm/\nn6KKdT7w76mqvv58BxihGhGjDtt+e6H4STmxhoi0fopoTFrlZBzVbrEnqP7Q\nL3q9K2iJMpU/deiszmUh6QfRX3D8xOKNzqGvHaAW4IIIEhQWJt1CZjCF9wkL\nhBLR\r\n=vLts\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAn3zL/orjE2n3seVFjcNymnt9puo6XRC1vzunOdPk0VAiEA1Ye/Oggeym3af+1e0wGXFMT1MYbjkq2Uw/u6Ir8U0tk="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.1_1579719372925_0.1737994127655471"},"_hasShrinkwrap":false},"1.0.2":{"name":"threads","version":"1.0.2","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.0","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"66f5ca6bb23f2be6d7c22034560104cfcef2128f","_id":"threads@1.0.2","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-+gzwo4X/66JloD6l+nb2QZpnpQ8hnW8sVHvGJpumyelR3qgA8GeTzybejXHQ2sfxc/yXfGMdY+MCx8q2oQRisw==","shasum":"1194091a3278ee010da7ba4ddd2f60037e800e1e","tarball":"https://registry.npmjs.org/threads/-/threads-1.0.2.tgz","fileCount":94,"unpackedSize":143634,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeLBstCRA9TVsSAnZWagAAEccQAJ8FQ3arxShT4PF0Wooa\nEGif9WxAFb5OoRO9sbngDPRf79eGWMDRjAC6juZcd1a8ns/SZO46pWeerAaE\nSeA+aOyf8uv/7+FS2AKIMBcMku7Qfx7Xrvs7GHxHAQqpdaVUZGfiem6uRGCA\nrqFKBBYVcyz4o+i6fFzo4TU0Bl5MVtlwrZv+b16lx/noGtESX/jps9dTZ6iL\nJVtwZerqbgdb5xD//a3xwLtPnobTIY5qtuWHlP5q8dNz4VrJ4xg1bSs5qN1V\n341CT273BdlrH/+Yk2++KAK+E2Dw9Oc5QzhfC3hna2nzKvXIukQ67LqPjZE8\no1pbzeS82GEwxl6jLQS+1Lg7JT/Xh1TqjCrUP7TItiHTlR5uKg5+orh9pI9P\nBa1t9NfavXbS0tDKFCqBUg89LsShZ3rnw6ADyrEimDEQ9J3lycXXQiHIhPg+\nWrbXdYdjT0w63m355An0jJTYpAEKAGd3pco04fA0gCHKSaLTVxZNxU/svmFd\nGfgryHf4PgnasCYZO6IREMkmYwaLQ+3D3WOAjvgqggB0HOuWCn03XPhRjENe\nV4sByjli/WRAdsX4dM7JLbJZTh+WZG9GLyGmtknnuJq4aw1/ICkolqCNjisd\noF31ceNsu9dnitH2ZB6svgor/8s8eWJ/UE30F44XbC9V7Je14Rk14pc+QMLL\nlJj1\r\n=Axuf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1VsZUqm9b6yNnFqkISRuMoOYVIDxIJxHB8h7OwFXY2wIgf0qCRjY3gy4oo5CAKcX2ihjSz6RjpsBTOGAELKJC714="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.0.2_1579948845046_0.8332262008738618"},"_hasShrinkwrap":false},"1.1.0":{"name":"threads","version":"1.1.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.0","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"e3a07127cadea32816f9c7b6eff5c57e43170ab1","_id":"threads@1.1.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-f7Pp6uULhxgrDhvXxU/AZpWq9ja9Bxgd0DhkWzIbChQCl7HbzMmtoEA+WhPklkbFPCDDHyxYVOiFcFPf0NkLXQ==","shasum":"431bcdec8d27392b8a6dff4bec9d5285c23f2b6a","tarball":"https://registry.npmjs.org/threads/-/threads-1.1.0.tgz","fileCount":97,"unpackedSize":149531,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJePTL4CRA9TVsSAnZWagAA574P/ibI5JoS+2odSKK9LbIi\nQfCDhuRzJ/wAUuc4r0kT0Urx8fo9Zzu2hd0Z/466KM2SesppdZEo9wxtaOfh\nXjfnFB6t16SZ9QjetcyU5sYkuTYPupRSkJJK/bx4KOkBZwH8sYYLOF5JW43m\ndIOstowuewXrsh/XX1Yoct53IbpjVOF/qqBSKsxXf8w9ErZz/RGmhQrgawSI\nzyNdPNfk4T8HkxFPf8KsyZxmAwVNVpgwxVlbELNi+SWcsTh/fFP30a9Gw81X\nwT/fJ70RrJDSZWedPXWtvmc3/VSED3zB9qcr7S3uoONgPcfSzuraem7dQgnd\nD8MwS6hkiCUGLQeKO+pZBCBWqjZNUtztQq/A08IR87NeghHnOCtJDEiTO+iY\nmhN+2LSt54Tcz1Q9t8vWXfarXqXSO+KvpEOO9Nib0XunSBo3qISq5FBNNccM\n8wIxADxIk6uF7vzzfhSQ25TPUa640YnNaM9lDGK+67pA7J+6yqHcE7Jrr+Hl\nzcba5KEwTlpJd3eRAa4p7CFg96vjDq4YrUaqAjU7/KDz0HjF+SJrGzEblHf1\n/edcZ/eIr7lCTRH/G8GR4bVJfDXhVZdNcaCFWGkEl6bJlZ1Il3UgkKp/rEL0\nUjkXnlcMTbLRv95xNgeKR2ZSbNqNWKVEV960mkkfj9laHp1HTITbrN9TjHh8\naam8\r\n=H1JG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE32uN3R9krwvu00ehRw/dvu1318vlC5FO9VGNcDFOF9AiEAwGwZEMqJqZ0yGK6HmA/4HiDaR2PH+ab4t43A68kBta8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.1.0_1581069048222_0.9844362070522297"},"_hasShrinkwrap":false},"1.2.0":{"name":"threads","version":"1.2.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.0","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"aeaa698d398e2c69f12a74285247995fbf9f7b81","_id":"threads@1.2.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-QGHWxkLA+5IYe+Z1d/uhfYk+AbproPFAZoW48vrd+1N3MP37+e4wsyntpwhSixlY42dGtqRgP4b/Fqy/D6QBEQ==","shasum":"f8a7a70aa355f003cccf894f85d55ff0bb87436b","tarball":"https://registry.npmjs.org/threads/-/threads-1.2.0.tgz","fileCount":100,"unpackedSize":154333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRtkaCRA9TVsSAnZWagAALaEP/17IdJHksZZKKlm71jDx\nzW7omCLLTRKSKMBM+KnpYjJdAG9LJk2+tR+AD1GWEdouHstgdW6NhS1yNdm5\nujF4bshAffCZ7QeGlni5Kqcw/wuNqEpEoY6mygFX6I8kti2stMaBEHBJPWet\nJqfCpRG4H3ksiZU2okhxDSl1ZRT+4QO+IokcVwPJmXPhjLUh5u7bHo6SqXQC\nMIVNDmP++T6P+vhxL0tsTsP2XrqmQKm69V8Qxbjs23x/KPZ52ncT8XetlmH/\n86NR0HIxG4QslpdI5+71vaL8VSk0aa4h4KIdVu67B/Kl25TagMvs7bRFYxYd\n5Wq68NdoPe+w/NYSLf0LaeWSoAlXlOq0RtnWvmLW6TzfzKOj9L67RdXd0S4o\n3RBXygn1DcMpVTMFKgUxdPeLcdG5v1By437P90mtU1HABwejLHthhIYqdyd1\nzTB8TC2r+ictHxdk77dbKBMpOQEt8HIxK3IxcXihJ+yS0cAlpNG2UDOu/+CZ\nTwX763q4SZaxjLVbJhXhu6OqT4VYEQsk5G0YRHaOxoaueBJL7ktK6CZ7uOHE\n08tf5zhIFGuXaW+v1EAnzF/FuQN3fcaTuQay+as62AClmXcJFKpcO/koNd7z\n2T9+AftB2zqf7RtXcaE9EZJn7vyZ2TEIQ988OpxakvdW40AVDFagUxr59Knc\n3BBR\r\n=4sxg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHs5seNHt6ZiNKxEkgWG2F/C/yy10aoRlrFs+xgt/++YAiEA5rQ7/h9Of4OelF0sJ+Y146hHwI0p0XoMiSJDX0VrFGs="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.2.0_1581701401720_0.40997468459791797"},"_hasShrinkwrap":false},"1.2.1-test":{"name":"threads","version":"1.2.1-test","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1-test","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"aeaa698d398e2c69f12a74285247995fbf9f7b81","_id":"threads@1.2.1-test","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-OyYevni5rf707zPmcRm8Avwm/LkWq4Fm68kNuErD6YWaTt9QZwXoQTD7iuSdVhTXbEqQGxiA0/LuuwJ0tFyFFg==","shasum":"e493fc3ae2095bcdb5d662c8a5e175992749e566","tarball":"https://registry.npmjs.org/threads/-/threads-1.2.1-test.tgz","fileCount":100,"unpackedSize":154343,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSJPTCRA9TVsSAnZWagAA6/IP/RAAkg4DBnmODkTuFcae\nxIoaVviE54JkjCNQe02Y0XreTPqU5tmv7B4Ujbfs7mtINsx8I8A2NZ95lK9c\nPtPKKh87KhuBBw7XTkQneIKthpq3N8HubcaXpoZjgjM2pQ8+LH/MsrTrgnZM\naEJBYMEmEhYQJwljLC9WMJnoCGcZva5LquT0lt/UHmXoAUbqUwOw0In/7br7\nA30vAwfMveJAaHj/O7PUYazhqG2dHOWNGbsQ8GZU2xpp1bNudAOCT4sStI94\nTQ5qVJ4sRZt7Kxa7BAMC4pG0mwmTsJnD9TYJ/d2Jzq5I8/k0GAWaop0JY8M+\ntPN9wSWVyeO7fCmwftP/l1OpyznTZHFau8KyDx4HNLkjvJwMa8HTix0Z4+Aq\n452VsuaZI0UcBOxNsCJOXT8CTSv1u4lTNKYkBrjacWFCMY4nGKzmB0nOSatl\ntjzOOVlBjHY84aZq4fk8u/K4Mj4/qgHKuQ5mTuuEgRwAwtw/Ng7uIJEBae8C\nixLPMJGG+CGUpPJTTKp5syjZOpwPolTMlRtyli1uh6mEwdP8UOf7E20FmxmF\ntFcBhxGQaEcqCCeHThTpD9GyYftlPaooqKnQMieugyPOUxpijxniHebDBo1+\n/fOFsGhAFQAj8rxojy1RequjL9UzrNnxkwXgUPjhNVZjba8pceO0ZMWjBu4N\nOX+m\r\n=Ya9E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4sI6QczfdWC2cZgEG5nQIARdc6jGeBeeaT3PFqJ5angIgJajJNQORMhZuo4TGch4Oq5bbtC0NPd3eg/X0jXRKhTM="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.2.1-test_1581814738685_0.38763909497059035"},"_hasShrinkwrap":false},"1.3.0":{"name":"threads","version":"1.3.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"a5a0af9fd8177775f51362590eb0ad7b85ff595b","_id":"threads@1.3.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-Z/sUxUDfwaNoDERcorYK+sGANn9i4PwMVAYdpCfpTiOmcNrLygb2c5BmQgizOnsPqXtXNlaRZRCNUr5h/eT8/Q==","shasum":"24e2ccd5f50c9df39ffedd61fba2c798c38886f8","tarball":"https://registry.npmjs.org/threads/-/threads-1.3.0.tgz","fileCount":100,"unpackedSize":154792,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeVtfbCRA9TVsSAnZWagAABigP/0E7VSh1jf8AhuY14+dv\nxhciT5cUBFw56AcR4qjpB7gGNvBMu/zpoLxuDVdgSKPF+/4Ktohx9I58Ul9i\nPOpMS4y3/HrJ2AWQQol8vEOb07X0xXQ8XojqNzKk3UoOhu7yGwEH4TU5o3vD\n5lte8f0umjYl3dPpLhSjfhaDCMC3nk+frKveX4wHTtSsCTc6NcPXFo+9Tn+V\nGV/EJKyFSUyUgQgu/9PYlITmq9OfbJsH3OBBdFKIY0cprR8+1VJFskbHUaR0\nJ6o2VPREdhNhj9qI+UUmbRiiWFkbr2zEAlIsn3HDIlMXceot+hV2AgoP0fM4\ntGu7iUfu7Gy8I/fkkARniOlXIE3QU6epNuP8scqIQpqZeiaDss8tm+hu4s0O\nML5yt1tpLyll3AAUpCADDadnvKf799gkeE74xf39fb2Qrronjm65b+AYf0Bh\n4SyUvmsK+Mrb1gwrPdlHzpWuvpH5IkOnhvva3j0xgW9pw/mMrx26Ayt0NzHG\no69GcWodYJFcV4jGoKAE/RT0vtDbI9W3sLjPaVb+PDBKdmW4Bj0ypUqKmUzm\nyUaZCkqxaPssQsQnMP6ltOZX5ICihtTUGExRbcsEvgK+obCOOVlaaZ+Jb7jf\ne0IdKJGriKW8P4Ua1tA1FTFHFG+e7d41jdh1jAOIfcluA5+n6i5yFIb0pe1m\n9l2k\r\n=2Dyd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmf+vgu52DCZ1ZFyKOAjgk8zLpwL8eBkq637KDokXRsgIhAP0S81aQotfuDk3k0LWAZnQ30fYsntxnlBziFJM9sUCC"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.3.0_1582749658650_0.9051849975864481"},"_hasShrinkwrap":false},"1.3.1":{"name":"threads","version":"1.3.1","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"30f9ef11b1af643226478bc76e6884032cb6720d","_id":"threads@1.3.1","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-uhNCUhxEMFVcJlKM0tYA4MHgOMoPaHmcoruWSGq1YV8RuuDbkwdfDbZToIUvf1YuXZj1Z8v1ePx08Cb5JWtjeg==","shasum":"c6a9f0328995fcf4fa0d3b35ed700f1e194f5d55","tarball":"https://registry.npmjs.org/threads/-/threads-1.3.1.tgz","fileCount":100,"unpackedSize":155366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeaJuWCRA9TVsSAnZWagAAKI0P/isR+1XR6y3sgjaOnCIb\nLfUg+xHeFv75BGRbIZnuIpZpyBe8212HUi+g5hXDkRItE/gNXAgGacbSi2Nz\n52gSl2MRtp/u3EdhHd3UmX5JkEbjsftHQQNvDECPkcJowc/l/Oq75dZXtbsX\nm11y+fSiUNVNxdkQXahZ3ui0yKvNvKpBZoqZz5oQIark4c28ODbDMwoW8BEZ\nHlropamqy4o9LhSU3hBhNMkWTAQ9b1wtByLfNA4NeXXY+EdDInV8W7sn0fDs\n2UwBFC5SNikBwugaZQZj/QWgVGn3/Yf4pSR7DupuOnUn5hWx8O16dM2zOgaa\nCZ+ZD+Y8kojt7+T3By0/GehNndFsI3jdBlJGnJjTsYKe0+4IQNwGykMnbTpp\n1lSFoZ88jpmm2uP8oPjel3TuWEAByCdwqIoD+655omj6fI4oCK01bTF9RSoy\nxTA5Hy2fJB2pmm9tSQJCBelzipYvOpqraboybExZPSqp1myZLtTc7+kJGRbS\nVnBoK420AVUIILls4f/DVotClWB86MnQitYaomEAPPla2IcPXy/JR9VWVCmq\n7akmgcVA3XZNpfNxPPx5m5WoJSc/yy9tyNLjysUD6oTxw9vtt+pQNLMrxKyg\nWQOC71L2HbbbyDQAonyyjWUbR3EZ2WxFmFcbfA5TkLA4OdvNRlzbTwP0GYRv\n4FmX\r\n=fbxx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDoHJe5UvD1ktf/9UF2MhYKuDDonhGxDfXxh/ftKlLHwAiAgDOa81QJ8IBqKGf3LvQo/xNhh86GLSHYFpNWzOKFr4A=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.3.1_1583913877429_0.13800661234046507"},"_hasShrinkwrap":false},"1.3.1-asar.unpack":{"name":"threads","version":"1.3.1-asar.unpack","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"0ca9768f76a5d37e7294c8cc80aee32926f8d86a","_id":"threads@1.3.1-asar.unpack","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-U4QWOhRx6T+EipyN8qk1pX1dYZUiAbYhUh5lgkNYrc1llWnireGTTzhTYYxdCOQY1i6TZpWQB7/agGBdXDWccw==","shasum":"618b5afe3c06c52762bfbeee084abee7f80014b8","tarball":"https://registry.npmjs.org/threads/-/threads-1.3.1-asar.unpack.tgz","fileCount":100,"unpackedSize":157010,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeev+jCRA9TVsSAnZWagAAgd0P/3KUYw5YDkAi3Os1jwlf\nKdHuPVaOFJgs9uszGgA1L377DcMMHDWgrkWL7E5iPk0I5o9RdDeAaAzW9I1A\nujWTSpgk4p7h/kMqWwFrW+v7BrGA9hrfDUZ728TGX51KEZfTh5WaZ4rH38tQ\nJCCppS8MLmlDh7evIypAAnCTFbPIpjKOxrvbppULjGMzBJyEeUtT7AsK3vFf\nRDUBbLsH/FvHFgbTIpXD1JrfAgki5SJN8leK05BeveMc+GRVxieHxi/Ne0WU\n/Xgfy9LUK0uz9lyUuZTfL224S2/UA2yLdVMn3OM4eQT4QpdNeJdWy6jR2Jhj\nUTrmCoWb5wffoS7nG5e93X3M5K/Rt/6pnFzS4WHjrjEjfV693i3nUrMMdgRl\nqRRQv3hzwt2fAEl1oRy0QxR4fgixVabBLeBFFl6bOSHxKjujFCaMcbNyeZmm\nZy6odfLs9UgzjnWYOTcEczpjOdKF3Cahw3eYRc/qQcW6CG6xU/NxGNOhbBW2\nt/KzOt7XC6Tm3zut4QdQs96zo1KlZ4YxJE2vaEEUN9Qepc8FMA7oe6DtvMob\nOJwZMZ6CBSpBdquR0E/+e8zf5Uwl7oW8vXNwwTh4lG5+BbRQlQTKND+5gD6i\nmn1xMBvuma5yjcA5rIGQd0IHJ28KvKT6IQJBk9NiwMwYNZxQUF8T6MWZYiUy\nq9tB\r\n=2EL4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEUdli4Cii2EFNVSuajkraR4C55cw8VqOJ52i9fia4fRAiB3EuKVmIMsyhz4ogHdrR8gI+7pcfXU9mD5DWCvpqBF+Q=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.3.1-asar.unpack_1585119139280_0.8206984937069282"},"_hasShrinkwrap":false},"1.3.1-asar.unpack.2":{"name":"threads","version":"1.3.1-asar.unpack.2","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"53d98d58cc6950f6616ced9d0c07b9270d8ceed8","_id":"threads@1.3.1-asar.unpack.2","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-smwLX6QqW/L7RhI3E/SYB8wj8QeEzIDOb9n1fwKozoSV3aeUAyCOX5+WdLOd3E4V+O1T5i0M3F+C9Sn+7Qq7RQ==","shasum":"7a08cd4f39cbc4774ccb33f3bffdc8a023de549f","tarball":"https://registry.npmjs.org/threads/-/threads-1.3.1-asar.unpack.2.tgz","fileCount":100,"unpackedSize":157050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeg53+CRA9TVsSAnZWagAAWAsP/3dzKJaeyMFE/AU8+wxV\nFhzJ9UIpeYaLxHcqu7xxgeWv3XFxIekisXFQSBKHYqJulRdXhSRi1p/hbrfa\nsYgBFomrStHsxFnl7bYZ28Iu0HqCIw1t/ZZa7TxXVSFP99SUdHBqe1ndxlbk\npOKCwW20zLL8X3IRHAs61Yw2eVwu1AJXnbCxVDjDOFV2DLxCjak1CWtWl/X/\nO0gkwapQJ2HVQnXS7xHw8WeejflWUF2Fj9hY25d6JBRqy68kHm8BSKhot0bK\nqorcwKfNuo3TlcBP/HsJ38eIPsyAl9Ur/3pXm2NAuCNtEh7UqfoDeS6/8eJA\nE26qQ5UUYVmORMPuk29fXi8E/nX+YxNEV18GjTFgnsZ5BjENIyfalaylIsas\nBM3kmweRxz0585SDlPJ4Edv4rrfWYfeZCAnx14eDFEpHPHvY+GZ9ivEVW4A7\n20n1bkttShi10Dt6PvOl319C1ob3M/aFtqZVzR+/4yxGHsQXPUZjwfKiA7HL\nXOpX+NC+w7AJrpIiuZ7l3s/QviZvMCPAVrz885lokMRB5DRWNt72VAha5pWP\n7Qpd+b8FG+3BLIS3Z3zg2mY3qHG4oUXztnjRvnSbv9fWYZs2+/BLbqG6gg97\nJEZhWrWFvowSa8RyMVn1bfTxK8Cew9f4dfXZFZLvdZjuEeNvJC26nLEbVmzv\nAUqm\r\n=mJEj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqsAiFr8iP57lVwejCpeEExhPXl8VvrGJ3gjSZoMl1zgIhAJaZUHt5bC0QhMH9gW7mCPFpbCQZhWDhhSGvKJRGrBOk"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.3.1-asar.unpack.2_1585683965782_0.4831911942247289"},"_hasShrinkwrap":false},"1.3.1-asar.unpack.3":{"name":"threads","version":"1.3.1-asar.unpack.3","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"57c989a124ab48c075da57340ebd0dbe4a6bf367","_id":"threads@1.3.1-asar.unpack.3","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-bKWJxJGWAzfl3ih08hOMKgEBaXdg1F280Hqnq5+KvTZjAM7VAD1ibSbNs6NqTXNkcCJhjBGdJBlNkJzPFr4ncA==","shasum":"e0c9393c3b1a8951bdf2d7167d14167f3e7e0311","tarball":"https://registry.npmjs.org/threads/-/threads-1.3.1-asar.unpack.3.tgz","fileCount":100,"unpackedSize":157690,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehEXoCRA9TVsSAnZWagAAmlgP/0aMszhF/HlLszcxB2na\nLZoOEd+1BaTFLWDsHkZxwIc8+sDIyA8x3EJecFqDdsNtt6r3hDfY6pjO6Qrs\n5ZnEIXQNwAFMyUgXKY9nzgEAF+2NAcxBT/9cyOA8FS+wFadqZI6FG+DlZSm8\nCzGrsrYrJfndD9Mi8l9hBGgCfJOGGOY0/n7nbQixUedx5hrWi6Z4nZrNwpFY\n4Amzk78Z5jsKmYyFlriRA649tTXzX3KgJTjcAG95G7oU36t0oXGadGPnjCWH\nLRMgpWsyJCjD+K9G7lh/mkY5TfQ3e5CbphKxy3erHhCL5Btarf5y8x5MdAt2\nkgT3+FJIBtY8MpZ/dg8PELGcofdTZ4/1fqSChom8jJvXd3hAWBwwjA86e1nm\n58A1lv74CBqpwGmLX9ufXWqi014knHMRb0uhgMIMCTTRD1Kzi6alu1JCdojn\nq2NfPvWQoS2eBvyu9wf6hqDnJhf7+1cieH9D97fCK/IfVcQFIdJh3WbPbNOe\njZf8YvoU38ExHWOIpQL76ihCrX1mYxvg16Ko6J5RmRQqvUVuSkue9oz/Cekc\n0/2+mWUOA7H0SIFcNmmRRgN10oDnahvpOrKXcrHBsHFKDlc0bOumqvqbNG3T\nNS1fAY3L81s5r3KyUzQhjDYfV2ALiXzO/hoU8bCpvlnNizSUNci8kyHyGc5i\ni+8G\r\n=1Nc5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB4SA0kenDmCCKuUp54IsZ1hy53/cAZhc7zM93/DXShNAiBvsFWd1VrxVPcD89Fh+TraJbe+ImG+LbGoNENILAvRlw=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.3.1-asar.unpack.3_1585726951790_0.01578117193169315"},"_hasShrinkwrap":false},"1.4.0":{"name":"threads","version":"1.4.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"07c4d3abd13f876a3845b21b25b1f61a3ee872f2","_id":"threads@1.4.0","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-vaKhZODDnciJn4Bjmkd1GbJ2dlzFbzxwcQNM1IZV1bsCXmlJpirSAKsYG7MT7MHgO+qQxTaIn6CMstmlYnGNWw==","shasum":"eb46dfcb194e7d5237febd6aa35eb226372dbef1","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.0.tgz","fileCount":100,"unpackedSize":157684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeifUdCRA9TVsSAnZWagAAL0YP/2UnafPIOHQEk4LiHXyo\nKXrqsHHwDotbhdp7RYddzulP9HRQWuyOhLuoctZdhRyEwdQ/8tXD05pAIEs8\nWG/qbyoN0RRiKSfeTPWo060WZpe6nptia37XitQOIQbTcjLjxNi3ZHEVhi/3\nxZs8wvd5T9hjONG6qg5P4ZRDf780bEo7LH/V5U6fmVTKhF3/CrfcMLtWg3l0\nS+YqYOpZ6q7zQWcXse+jNUrmnre93uLbZpDXKTFvBAQw3Sg5jyYx0V3T73IY\nG06dnbN2+WEl5FAU7WJ9QHmVfW8vz3u3+iRNKfFo9keJLKQX0AbUjBTaJRdH\nX/wrTGHZWLIxpWjDUwVh//HXxLU801tGRvSxKR4ttNrD2xh1aKLnQCCBC129\nANIU+Xu7DV9fT0laRRmXXQEdQ8pEPduGK+UUB7lsKofMTfxVUS/6aE8NqmQm\ndxYOmy227bV/wkOZ6tmTdTTv5ftS2VgT9bh40nAubDWH/+xWT+OYZgDDCilv\naY57r+guAXJ/eSQwSXoRT9cSE//ov0IIANq8PQqHBYd3lL3JQ/r8WWvjKQfN\n3fynH5sBJaXwyw23JC1txv3W3YBo8WsGO0UFiD7EdJ6oxnasWHMD68gF2G3D\n4DF7YQ9zShqCPDsec94KhFLHbXPg8Dr09m67IDeKDAMrInwDSTn+Mnba7Xr8\nsO7r\r\n=/1aH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDve7bjmnTNFgw/35Dnjum0s/esEF78cZhsXGv8QyqBHwIhAMAVn9YLljXnBVsNpYcjna0scncl7r6byDaD9skIVQTr"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.0_1586099484753_0.42334611326969895"},"_hasShrinkwrap":false},"1.4.0-error-reporting-fix":{"name":"threads","version":"1.4.0-error-reporting-fix","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"5894415d9662d515f56010014d96c376ae0ae42b","_id":"threads@1.4.0-error-reporting-fix","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-3KJt6YFDXFjD3celuDAER5VNmuZRsUFcrF9IO2A/hJwqebA413AxkgyBeC/YojNMhk/bS5T7WRj2H5xhB4HQOQ==","shasum":"1ffa2b03a064cfd928bbc9622539fc41989bad66","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.0-error-reporting-fix.tgz","fileCount":100,"unpackedSize":157796,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJem1U0CRA9TVsSAnZWagAAz0AP/i8t6rmoXVDI2otKi5bN\nSYrU7rFYxLAUEABj/U4b34HvNZYlIYz2nA2rwoQnEgxP9WyJRtzrXwlyx3U0\nklaeS1ce0mPTc5vIq+BnMosOVXuocfvLUmv6tvDeDdf24J0oDyVURq9XWdn8\nH4ncw+pvW2x958EhIPmxQia+p+afVQEZGCwq8j2jf8xnRLQoxw5d5tx4B206\n8mQ6gYRbnb0GINI48mbJYq7Mi8tYYr+G3w6Wi0g0zIcttmOTSFt3MZkQIBxy\nmigO1JnwBbOrmzUyRgIKCnyi62SdsaKiM/xm/TdIaz2AC6VN+dQmWgWSqYoL\nF9XPs/QfiK57tckx0m5DZavbIOpJjMGjSEP2U+EtdkdrqhnL+LdWzYl649el\nYDW3zvh3KqykAnxdA6pFyA7qzJl+mKy5PjReTa5kGac6/U/bd/SlcFbM+dum\n8ZSBDKOjVEmWNu9pOGIFxrIJBiX0mOMOnNy80r8oIG3fycFqDVteGG7aiGjg\nUA4N0XuriHp1stOxYz+vHZ3oNrPM5PzGWZV8GX+NM8NbQjUfGLVYLMv5+wmS\nJLoY50CN2wnk2UXkylRYdEPUFq1KSBPZAkKtkRUYaWVl1hdxqmnc2HRzpLTG\nmkqqaEZ8kq7opMaYMolJRr0XmRQ6MwkhXI4dIhYOCuOBOulk3sn05mwrO1Jl\nSX+E\r\n=0xRd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDS/6hqv2wev0pWJTb1AbRwuEyV9F5QEL/6HsNIFhC1KAiEAnYz5tfVyNyqMv+oxjvxQfeZXezIRkFnpWDGIA/dEtBo="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.0-error-reporting-fix_1587238195508_0.516193871223235"},"_hasShrinkwrap":false},"1.4.0-resolve-asar-immediately":{"name":"threads","version":"1.4.0-resolve-asar-immediately","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"f3ccef3cf0c03c52a85c227b309909526937a732","_id":"threads@1.4.0-resolve-asar-immediately","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-1esNuIjrIIEQAse7aRKIweJAs0akA4zkxkiKUzEerfYfBM6782DHT3wFytyVJXNMvX4UoabFbIeW9qh58OABdA==","shasum":"c86696381ff3015c25f44f7f654c03d192df2ea3","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.0-resolve-asar-immediately.tgz","fileCount":100,"unpackedSize":157085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJenH7RCRA9TVsSAnZWagAA+roP/0Q/5EcrUv1G8RrQPx0C\nghFCrB4lBX7l+2GID0+a2SaxQFwvabcd9ZK7oq+ZRWjeNZitgg9bwhgx6lfY\neS9+jn104e3Ac1GyfWMI0ZWi73B5ixpDSf5YuzPIagL7NSr5RHQHtJNvKmkW\nXM8X+mZYkFKLelNRh7bw/tUvS1ruKMwNz+ApiJT7NZRiu8EYUbwJ4v0n1Jh5\nyyNb3dD9TunqsvBt5BdQJKT8Pg021vFRhJTR9lODC7FrXsvDCRtFre4TEEDF\ntLhOql8f4uxChmmEY/u4CJbbYrQ6V5H5+Er7dDfOwanDzD0/aaD4SIIkKY4g\nfW6UytfT4e/nmRsUQb6G21yamga5AsRDsMP+pIxX9sLQw/Y2KxIsJ1J5KM8y\nRtXB+VWSVU11EW/fhrx8ShUVlN/6w15de3532lLIqDdN6+O/FIJz3l2KsLX2\nxTWn58P0dW9fifJQz1Ky55eaeF7NDhguiBvpBl8Tcp8xaEprd9cAuCiBBisI\nSr8T8FYmkbZsxRluS77Johqkuy1jXUEGAeBBtRK3cBMb4k61+G7vIG2qrJal\nYqrnArbLt5aWB7DgpTVs8j48DxtHGYV8a8BtzJhpj/TmJpA/wcL7w9GyE1yC\nKMxKgZgKejGJ6Rz6fhhJpV6xfsJb4GWPaOEHmBLvT2MDFILEhB45jKMmseqr\n++2A\r\n=r/PE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGUs+Adfkyfgq2k1ol6fCrr+5eRbGN9pg7Q/QMfDt/O8AiEAli54bZgRwWVHNVwNlVf8ZUAfksTSoiDp8VbObBZRImo="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.0-resolve-asar-immediately_1587314384942_0.18705703654322292"},"_hasShrinkwrap":false},"1.4.1":{"name":"threads","version":"1.4.1","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.10.0-alpha","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"1439a1ca90bffab321829d81fdabb1d911c362db","_id":"threads@1.4.1","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-LSgGCu2lwdrfqjYWmeqO+7fgxAbUtjlsa7UA5J6r4x8fCoMd015h19rMwXqz4/q8l3svdloE36Of41rpZWiYFg==","shasum":"7e840f25370658136fd2d4e27042a2960da7a8e9","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.1.tgz","fileCount":100,"unpackedSize":157152,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeoohTCRA9TVsSAnZWagAAHLMP/16jQW18zb9kgQKbIgxV\nccAHcDeahVRt8xIzaB5kMUPXS/BlH4OQBZbOgLYp1gXLDlVIQiY087/a66B7\ntwTJKQw+Uw2TWFpSAqvSEBcwre+hvrnH1nMrDVxKN/Q5wNnnFQoHt96wl02m\nmTh4PosnK3Zh/499YS4dbluBoWNq3BCDR6hlrohcikA3H3ApkV4setj7unok\nQecVNtSaNmeTyiUX4eJfMIIcKyb1vjw6Qrp9GsB4KnQMzlaMVvPHvVQY6ypG\npIwwTEA8HqxsucKXysEbhCwfpmB9iwPYq6h+q4pja/iX8nvlJRsYJXcgfO4I\n/O4DE16oifc8MdGtqo0eDsIb3zodmznepobjNydN2AGiIujIxznruOr5nsK5\nU8PkvePXCkvsjZqaygCbEhD/Kj1ysOU0rm0zE7FDK/7ezjnIzj03waVfWf+A\nmGYm4r+qwDznyfvW8mLASl1yWDM1yefUkXPcruzKXPw3IA7wE5COaiKsHE5Z\nC/DNET6KzGzhY5dl1JWfwgAMWr3MPmPJq3Jp7jmEHnEumT2TkX86lO8AMwPr\nU8Mmv1zGNTRwBkzYs0E+hZTOSGA9d53xFXAaDWZEBfLpvhhzm8wZKx3Ix4v8\nWrb+R+JVyGkQHMonThnk2IFq92kJyv64IaK/vfartuT9QmEzojxJexF37pD8\n54GP\r\n=dCEa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLDfZntIpSC738xQhSaEvpPynzXvTi4r9BlXBhFa2TQQIgPscp9N49K1cYpKr80aY2p8FTAk33Bmk8kHLu+j5VT7c="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.1_1587710034607_0.6485115517758269"},"_hasShrinkwrap":false},"1.4.1-extended-error-reporting":{"name":"threads","version":"1.4.1-extended-error-reporting","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.0","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"9ef4df34da2811933ac8671e0acb0e2dd3180281","_id":"threads@1.4.1-extended-error-reporting","_nodeVersion":"10.16.3","_npmVersion":"6.14.2","dist":{"integrity":"sha512-T7WxmyQjR9WRVMCIR7wWBcGh0p0JCh0hOiur6iWvzcB+951ZZknpMkisK9CUM+bajD+AhhRr/2v8AvCMrUsj2g==","shasum":"f1a2fdf5ac6051357142929c54d84936a0742a45","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.1-extended-error-reporting.tgz","fileCount":100,"unpackedSize":157773,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerCl4CRA9TVsSAnZWagAARVkQAJZcTINjTgannq515Rxq\nRGNT910KjbPvA5fBfALL4CAbcbYp7Dliv0MaSNWFSeAneR6s/ux/CltajOhR\n/u1zsFrLa0f/7kK+IbV/zkKh0Z9M5Dtw4QfSNoyeciHnKvHGlziAogev1+ja\nl1c6QwvKvJbsZynDTyu2fBffK0a5jEBxHoxxe6rAgkjr3evPmJXSGlUmI2E6\nvAWJ5Uh25z/39fKc1YdzOHuSJHxE2A1IhSMYD9QPb+s+uxxHo34KXHo6CZrn\nP7dmZDFVHrT+4yu0GgY8P5hGQXbnB2fU/0P5TY7RH7zbuSy300dWRv+wVM5L\n+ayzRxhh8DrUt35ggn1PGND/EITtUFardnh3UEn9dq7JERLA/tR4S4JtC0Am\npRIxNJuFPWf3VSY1q+NSrRrCTkVZMe3XYhxjPX2b+W4J3dHYqd9vkL3brmXU\nJZjo+js/N00A7uhrU+SOVY/pm5W+W+LW5jV1GsXkxkTe/fygHqoMCcX3XXR2\nu1kCRgRbxBXRT16x7Jqe6ic0G8jt7SEB4GAKbaKLdZVdrJrZHcT/0+z0mmM5\nFvmhCYR5RXMXzylWhjKNhb04h9NfcuJ9XomY5qhcaeCy7ilotlX21UHv6nfW\nyHgOIFYz6Ks1AmGpJkcZnUqaDlJPM7ESmh0JcGUwG1hM8qsVIotd1l7obY1A\nUT07\r\n=BT6f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA2BxLB049rz7ckYkY5Xl2Ht1o12SD6gUuGjHczI7mkuAiAl1gYaba0e2rh0Emi9k1Sy9h7IVq6PBG9xnOswoW5G6g=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"andy.dev@next-step-software.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.1-extended-error-reporting_1588341111594_0.6913530750731918"},"_hasShrinkwrap":false},"1.4.1-test-ci-publish":{"name":"threads","version":"1.4.1-test-ci-publish","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.0","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"d33aa60baaba7890185a1eeceb78cd2bdb3224eb","readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"threads@1.4.1-test-ci-publish","_nodeVersion":"14.4.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-blkVQDlbOTokscKvMD9J31wYjeaDYMxU6FFKwmmhqJ6MN3rUrFpdaMhBRcyyalBjgSsf5Umr/uVIbAS1FX68tg==","shasum":"63a5360b51e5a783a04ba99a4145aef211970b6e","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.1-test-ci-publish.tgz","fileCount":100,"unpackedSize":161284,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4PtdCRA9TVsSAnZWagAAdbcP/juOEjswogd1tiCLo/DM\nI7Msu0WfJfG8IT8j9k669wFwG40icKIDOHP7o4NCnyaBQecN/4xJKbZh1Hox\nyNQGjhaKY4wIurKCgR1ScaWpxjdAuOMTnovJqVH0bqSJhZ9TSGCBkmWcLHT0\nFOaxgDhwLPZjDEPG/pcdGwYAyGDp1msmkMU7W9k2B+TvIe5cl9h88VZqkog5\nMtH2iIL63bRjZvPoQ1RL0lht1HMX+LwmbBFprCddJEHRbnU2yq21lyyRGdaZ\n3Wk4T/e27dEF2xf33ILR9bHriCY7hsz1zkKniI3IDIo34VYgz5i82j+5uDJh\njB2bdNEOajXEw7GESsjS1mxsQcUdS+qOSJvXSg5PcJ9EYcDkey9DHUY23vei\nOMdzvaB7fL03kfL3eTJ3xVyOkX9evbuCIKa2PpUGFCYxNgzXqcjRCedn8LNg\nb+8G9ttqdRUekfICkv29b6JFbhMUjqNtV23E4PNiybMkEVi/xu9Gh8DVgEfr\nGReFOGcq+u1TsF9Tq92sBKccqbXz8ClbPLG4xM72NcS2lNqPhtMtnsMSfR3Q\n7MBHc+nvAr/hwlVfXqvxSl0ZaZ9drtPJMTwF20AvM+qh2MBxtTdbMFRqGx4f\nAI/BeNRGYozJ4QJvXbpA8CMYIMU8oxKYdSb4Y4c/n4QOfV/Qai77Tcsj/GOO\n0FiF\r\n=qg+q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/8u0/2oY4zvor1DKAY+o2TLReVOrueRDWAYn04qZDTAiEAtQQuKHwqZBvpz2TuWiuka9l/rzxggiiNBMU+jxJj+4A="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.1-test-ci-publish_1591802716814_0.7495529824741551"},"_hasShrinkwrap":false},"1.4.1-test-ci-publish.2":{"name":"threads","version":"1.4.1-test-ci-publish.2","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.0","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"77828f1786970a5c6e91edceec3331dade1e3fb0","readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"threads@1.4.1-test-ci-publish.2","_nodeVersion":"14.4.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-js4PADjXd51uIe53w8yQe0VGLhgt2fM2HS+bWrIl55WMS3Efd6bUDDNeOir7NjBYcYmqG4KiyO+oj5VNPcMPXA==","shasum":"ce12779376222c88f58ecd5f87ea60818224c20a","tarball":"https://registry.npmjs.org/threads/-/threads-1.4.1-test-ci-publish.2.tgz","fileCount":100,"unpackedSize":161286,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4Z8FCRA9TVsSAnZWagAAibAQAIvo+99e2+o3zcORL4yU\nUh7DbZ0rwg9Wr/Rv/B34hXHJcj5fieypwdbgFh9IFULNaysIMPFtbADdT8nK\n1TkLQKuHKm0cpixSgMQCZP26UINJo2yTytaHqWLXaNUyNQeMapfY9BG88MaU\ntEg7eR/UDvnwskAskkYigNFLaB/gmurjb9rOIVCmhxDPlmNLcDBH3L+O67mJ\nnw5pJCZl7wtvf/cj+NiCN2PyXxI/m6DearseahJ5HMp0JNEzebLxlQITvB1C\na8vRB68E8ACW3kd8/Pf5WO643G5vPat+aMIO3TiCa/mWEQYKyW71OGObvwdz\nzPNiOCMpLhvjTEPMRECT0jobyPpwzntJgsTdUFWQb9iDv2OXqXmfZG5eVqzX\n4iNzbREqxTLqM5Rl5Xi5wKQ8ssy5nM5R9tfie02QXhqPwQBFQMJNcuMZvEwY\nNYBrUditv98x5w2GisIJM+LfEMBHUWPQ0R2GMd/fJHU4oiv+8Y9m+iSjdJuR\n6Zauluvpan60ihB4x3AkLSwjGFfYAwIp8cfdM4rZWJ04i+Pg8qfkyEYHU3u1\nnQjfzHCF/Xu6VH11UtEFRNYIZvnFQR6Gv2ULvscVrgmCmm9fOlfsy7Fj5LvK\nENW+NEI8oH/KvZqRBikFvCXYsMu7z3TUdlBR7unqq0kMJsLBZODj8VKjs9s7\nLLoV\r\n=7mwV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcu+z/cK5KRHAK/wss3SnxJX8wReshMpmu6IEZ5s9ZIgIhAPgTBYUu6hsOkiWL+/BybtrAMlhimmVnW9sKry54SPx5"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.4.1-test-ci-publish.2_1591844613125_0.4266960572598959"},"_hasShrinkwrap":false},"1.5.0":{"name":"threads","version":"1.5.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","exports":{".":"./index.mjs","./observable":"./observable.mjs","./register":"./register.mjs","./worker":"./worker.mjs"},"scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist.web/0.worker.js --serve ./test/webpack/dist.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.0","puppet-run-plugin-mocha":"^0.10.0-alpha","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.1.0","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.4.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"5fd9188eeb8505d23a6371931af68c8d3f49b1fb","_id":"threads@1.5.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-Sr4EDwEdUIMVG+jnmsZxaxl0GIg+HM76yWQygDub6jSzT79VjJHfj/ICGnoOu9nOMJoHXdgQz0L6fcvDxwgkkg==","shasum":"517b2f192931883970691d56a1a564c55327fd8e","tarball":"https://registry.npmjs.org/threads/-/threads-1.5.0.tgz","fileCount":101,"unpackedSize":162200,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4fIrCRA9TVsSAnZWagAA9xYP/1LpUGIeCG/qDc5ETadO\nyiiAIT85A55BpNKrXIJxR/FJwvlTzZbvyUflTWnqAnIPnh1qTvB7T/nw+FOU\nHtspEo6BSx05KNVwtju4ovFQgMSpkfyQ1Un9cwrdC6bm2VJ0BmiSnf7ipN14\nJ/vxNwR7TWX/CGDRlm0t3ynFYaCfJDQ/2JarpGZi5HTaTj1eDm1FNkMg8VyX\nysi1IYQ9QSjulNw5eJS4jlFz8C6NZCqbOkOJeU0XhCjEc1vSzgsYiR3W7X/Z\n1hPwIlDMa9r+7egboDO8kN2HLzy6YoqSM5velDz6CQBd85tkZ1gFGKvY6Pue\nrPZIrKNKF5nbsPWxVDCqdlYjiLz9oYtGHugIn2kfLDaxut8hjZWa9KRl7fV/\n2/HZaw/loAjt/E6i2uECL1nScPiLN9xGXqS9ds+D1v0r/Iyi2s54qyrN+LHx\njYu5W3WO8Ls70e3lcbVT7Irys4TC32Qs/8z5hlCuS1jkPbPXn4dKv9kHaZr9\nNkHoqskt8ijW2mP05sGk/35eEFZm/oqvBH4LF3tH3KW01LIbbKWYMx+8sl+j\nCASisLKmprpP7nXcZFXzTFHGSFyq0IZ4CquFbfN0b/dg9fecvZQD8PcWxI7U\n6Mbg6Au89cuTUDPVR+yZyn4EApY+AbtIF5bkbeLXvFAocE1Y9mReTDrmzS4V\nb8uP\r\n=OyZj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCaKa1ZbOV4OcgUnCQi993BH5UeHd4b3OHD5/Lwx6H/hgIgYXdI4Td8ic3pY+5zYxtogBdxIHicib4d5QowF4L3yw8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.5.0_1591865898814_0.7630725423644742"},"_hasShrinkwrap":false},"1.6.0":{"name":"threads","version":"1.6.0","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","exports":{".":"./index.mjs","./observable":"./observable.mjs","./register":"./register.mjs","./worker":"./worker.mjs"},"scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"3d0b7c94c7e1ac8c6b0db92f41878a7b5934cccd","_id":"threads@1.6.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-S/QSzV/e6q+GyAuzY/QIfvzMFbN1ECMCKC8ScTw/9UNycTGQ/W6Rl6MnqRRexhvvUdR+k0l32gG8CIhdw81TLg==","shasum":"db062ced83384e2e01e30775f0802a26d1969b11","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.0.tgz","fileCount":105,"unpackedSize":172237,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe41aMCRA9TVsSAnZWagAAXJoQAJ9kRk9wokY7WMZOxgrL\nnrCa9G9fAPN7tZxFgZNZ59whveV0bhflxSysH0EVVY9qo/IZZ3IOuHJ7/jWh\ncyc5jGNLSitIAsUuGILqWeB6EL4lXc0Vuw1x/d4tStHPMjfB1vgXAmPgq0t/\nO2VnzhGAoDgCLXXj4biQ5HNP5p+f3+L5XmbAMaJr+CePF5HDJDUm3JGUGIJv\nKY4lAtcpigp9UqnMCojLvekfuCaXtH7SQJLtu5ewIaoSqs4Ric0nch7FkXuY\nalDviRE3HOTb2RbmpobmowOjCZcThFL0Lch5faP6bECYtRC+37Wyb9U0Kyk5\nZwrmvOKdV6PWLvmtSPKLYuCKU7QSzMsuSY3gNS4aCeexPE6gUDPjpzl0z2dr\nE4mgV7vO95hsM2jw3B1JN83wo+JnPjzYGoM/4xiWSdJPzNQo2OmIZDbOVmQc\n64j7ZZTdWsKpmJTSmL1xyBqLl3e33J0yjTn/yGyGorqT5cJA3xIvirjw35X0\nHzBxFQ96DGDtyaJjTEbMPwi4gR2Cc2K94o02m6EhOE+4BrZzd9oKqOgyPlFT\nuHlAT9Gsd73YLjg4vhw8ZvtH2dBnDNhFsv2vfYHcLvMoF6zeEwBa2+6WCs0m\n+z3AyJUYaVA2xOEgbguNUjaIqrKar9q5o6U97mGc7Zwk7GN5TeviuzHvriON\nmOfS\r\n=m5/Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0j8rT+SYZ+wPlioQqvOEl/6BMUe3ac5nVuFpfNFZ2rAIhAL4YR0ZWdRB9aM/8rZAclsbm+cQH5QXF1JCIIIRax8vl"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.0_1591957132164_0.976117349560389"},"_hasShrinkwrap":false},"1.6.0-conditional-exports":{"name":"threads","version":"1.6.0-conditional-exports","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"3240a43f581b133a6664ac3d842e2a199c7f957c","_id":"threads@1.6.0-conditional-exports","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-G/xAGxaUz7yPmcBfVXI8YVzZ/yyOgPhDLYjeOX7L49gJsaJsTTMesc2u6So1iIkxMNzOl0vohfPgQYpNvkvMcg==","shasum":"118ac1f968f1b4320d76b4a85fecd4ff5c523917","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.0-conditional-exports.tgz","fileCount":105,"unpackedSize":172495,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe5JGDCRA9TVsSAnZWagAAl+QP/12dg4TrMzQ/bVhAGLXA\nkWxBGTqHt1KkEFkgkg0NbPo8kVCe9sSsM/cgJe+Y8EFenAiHMQoL7cqwZG9c\ne5h2nj0F7fuhkRFFz7Wg/w7ZBXJVTHhBv0TDHjVRg5trt8NeB0+v93m06MsQ\n0Tpwjijft/JfvURtdHjhXZEOmJ9b9HD1xyNezlul2h3bACIm2ivT9laZ/2yi\nhLPv0TtAplIEcrtKnEOtlYaoz0/GL3O8R7fzmftlNpiXUTCH4NAs9fqvKYOm\nU50FkYoVoakFtqYe2Gb0Aq6kkz9lS5H7GtFdmcFfJ+F9impXbw6B9Vy/ar4J\nM4hoXfu+J+743Q1CIZ0iCQjqPDwhyL6F/CltmdOlXJZ6c8IHy/1bQTabqYGL\nZ+zlfBb37UE3acQAvkwBas8zAbfCAUiVuIHfLTlvvC0p+HKzF8X+HHT9Rw2G\nXdkjZFXidTJX6aN8dh/qZAPcFfUYqD1VeQRtGKAwvqHNtIlFo5go1a1Z8ekW\n5mUvBDhZz47KG7FpiLn0c+UId59rUpUm+PMK63rhjwbiSK3Vy4gi7X3L+ngd\nIbz2nXm1hpdZ5MVEdW2cZ82xWLMI+XxIWbTi+xQts2qF2WgHd11wKDEG6HwC\nMPOTqPW1L4y0nJ0p9OwxPUqH+jJ6UxF6XOYQwc5yK1uMyOvWaAZxqU2f5MyC\nN1lc\r\n=KtlW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEn3xPjFoJFhgFuA3bpNRv69mYzimefL34jVT9oqLTd+AiA/ix7xK49jXC5t0Mlw4YlcuKI3bZxJ/VOKA32+/BJM1g=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.0-conditional-exports_1592037763231_0.31235177546643556"},"_hasShrinkwrap":false},"1.6.1":{"name":"threads","version":"1.6.1","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"944bc8c83eaf00a09f2a5f2a21ca723966450ee5","_id":"threads@1.6.1","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-khaJCx6WnMHWdJo+8cANhnLYTbfO+Lv9ObvrI9QoxhRoMziB24Lbv3NoHNli+rJRzbO7BvPqsq3/icebeL30uA==","shasum":"85aef3f18b1f17c97b4535490550a57683dc113e","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.1.tgz","fileCount":105,"unpackedSize":172475,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe54f3CRA9TVsSAnZWagAAhTAP/3FysuxBAG7ZS5gxz357\nVhsdzCgypnX8hP/Iv/E3CyTb8WcBDnHGWUFGDByT0CAj/jY+8nUBj+Ab1vfc\npu2R/4qtdOElgFmzw+IWH4fRaEVCXq7HwndmxN3bwh0EdI5w7K8z76A4+GBG\nrwIDcIxeJFfPRDeOtMpqUk0eXUqFiWHaTfR1s7t8vC2VzusODfUjcPTDxRGI\nV7QdVHPwVPFRabNyB3t/+RdQ/JghR3BY6YOYbMZkwu8UnKqNIOp8Py9oJN8f\n7WlGn1yGq5fB+37KS8I2baNWEoPm8XzJW6pJVJ0ARBw/ETqxy4nobt3e9wSM\n64BMm7p7TTEZBj8FKm+8uZmY49fmkfeHbSPVPSF7JXgzm7IhEtILzhvxGz8l\nbruJcrcn6YID1H8bT2wVkyrEKKRdGjQ47C7R6Dh7g7GT7kI0RrSFUJ5YBMOW\nf3fgFKSe/d39MORPCo717ZybFVu3C6+eYCoARL2xIA1Q/aVZwfHvq38fbw4i\nLVdBF6f3Q6Q96m8h5/EIXJnT3aFVnijC9s/qIapwGWWTk5gxdeGspplPp5gM\nEYkPk/TjzaL6EXvvH04tOM1wXyEE4b6eGXYxjMeSEKJiR4CF/xRCG8oqOVmH\nmCfQ6hnfyS77fEreTh3Jxs/Xov1danTmshtDft/tuLowWbpmH56ghV6IL2bH\n1McI\r\n=5DDx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwdYa0pBk9h2c0PDQsBhp//1XDjYCmXb+eL9i8UyBxrQIgZ6RrhWuTK54zN24V6EbsIPbUM+PDBJYb5TLxKQU7mv8="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.1_1592231926475_0.6903081894747198"},"_hasShrinkwrap":false},"1.6.1-proxy-unsubscribe":{"name":"threads","version":"1.6.1-proxy-unsubscribe","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"309fb91cb420c7bd57249b0a29238742116e885c","_id":"threads@1.6.1-proxy-unsubscribe","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-fq7nghLUcXwEbMZhX8iFFSo1XsBBlWgON+tKS1E3TGEqggaIK0oq8iaMb8puP+lZ6xGglDFqyDC8+dQWQ28sbQ==","shasum":"fd3840a61de530c810c0f2c47372b498b786ae45","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.1-proxy-unsubscribe.tgz","fileCount":105,"unpackedSize":174698,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe6MuHCRA9TVsSAnZWagAAPEcQAKUZ1L7BDuF1ZjJSOGF6\nViUeq95J7LnwYIyK7Z+WJAAqbmhWJiUaOKHIi2Q7fjq/CAewuBBh3/aNRjvW\npVZn+kGeCacN3aYPTjjPbsztmt1S4mFpVq+Sd65R62j5AN6tsyktDappjfOU\nM2Xwz85VvVG1NoL09RuWlwMnfNxNTHv+xqCxxnOpEz86FIL1qoWBCa6RsARf\nYulG/aa/djJSVJDd9GYk9PXticRdXJ4fxBkXd7bgvT/9txSHj1mCEgEY+/gu\nmHkgd+0LxHbZWuyWANz1kUvkKm5e2KxRqoJxufFhQVpK4NK3M56iN1vxGCZq\ndFaX8EDyaqpKB0Ln/SXORCYl8XIiH/3gS2LM12tXi5MsMn+Kim+ho4BDPW+6\nB4gdlZYxki2cia3stuYirzmyU+xf4t9pS1OTTQ8EnjzKQS77jGTh5feFvJu2\n/rA9rTI2CNQcyzwAg0farugCGNez41qA/k/stXQIg2lSGKxKrhZV08PHZz7o\nFBF7cE4WmIC6Q9/Ej3PANGPiMuuqmNkEoQa17dqOPut3QigpSXrfjwcn13Bz\nOWVCikRF6apg9ymJiHCIn1o22FxV5AAG5H6oBxRve7MLzYp5PnQ/KM4p7Rjt\nsBcF3fAWAc4/km3qcy2DOo+4urgCawKZ/F2gm3uT0QaU04WuAxyTJJ+LiIqE\nJYPG\r\n=1j9g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHh75I9pG8rg16MAFsH6CeKsIDPuh6wJZnd21+gRITd8AiEA6N7YdC5ibDotEpUuPorJvXWo2jeFxmS4zYZPX7rCAtA="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.1-proxy-unsubscribe_1592314758636_0.6581916897044864"},"_hasShrinkwrap":false},"1.6.2":{"name":"threads","version":"1.6.2","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"e0769d6d38787d97acfeb3196cd161b30576ee6b","_id":"threads@1.6.2","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-SB3yJ3WcwGWYYsUg1Wg9IhQ88BUq1JwZlQsaBgmolSqet5wiBaFhg8cyfHFbHGRElZ/sl4bahrrSEz3Odmr1Vg==","shasum":"ef91053910a084aa99a1f460cb9978f577596d6f","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.2.tgz","fileCount":105,"unpackedSize":175424,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7y74CRA9TVsSAnZWagAA0qwP/3ybLkuSYjgXwsZ0gRVH\npld3CnfzchSsrfucQ75PHc/hUpoDodIDQUAIKJ3mOqGc3GUqOLMnsmSD9TJ5\nnk6VDWoh/t0EduLk4eQSrquZwTQLiVJEo3gYyINXdUUtA3DGfNGiwRk1lWdH\nNJzNFK7DNeBHdabzGtsf6y4eLHhesCospMfAPOWEbSbmOxNki1ttoDw3NP0j\nWqF0yXGtjLHZd0NHCzU1lr+ECO+3SvXshjk+z6bgmFo/HZGaK7lDj0VkspjD\n03chHHZGI71PEB7dm9IJV9xhXCQ5OUccm2bL1qDtNGQfwAOYXo9vi4wB2hAI\nDiryxR4b3h8x619dCCH7f2XHgjjzzwECD+dkGDMlxzGV4auPBV/A6Gi3dW+k\nbnuu+izVfxcUevUEcShUORReSUNt+JG50TUPHwUs7BJq1m5Kr+pSRJJXjpgi\nEjqDJbB4JuZj/YmMZbIKaG4WDbbf+xnqD3UQFdBYBxwNfylDvzZ1948CB6Tk\nJRlHL5+FvSgnz8dVIyc5QEoesqcvuf/SyyQ2tHHug4veCs9hZH70s1tQGXxb\ndqa7BxrzFepaQMqzvCGsb4iFURlsKDsf8w61LxOAO9xt2k1GeS3m7uUMrwBW\njk0pf3rchYnCoHPq5TARjgSi0KXGJw0jvD8x19JW4B72Cjn7W2i9lCIF0UN9\n2yfo\r\n=tB3n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB6o6NaC5sJS3vgwGiRE4POmtnVM48pVbRY5nCVtvuWIAiAyksy0nt7AI9np+ekRMNLKl8fgS5Luf9DryWq5/TFS/Q=="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.2_1592733432232_0.47407814936871895"},"_hasShrinkwrap":false},"1.6.3":{"name":"threads","version":"1.6.3","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.2.0","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"9fa13af4a99d11a844899f022590139d6fb101ac","_id":"threads@1.6.3","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-tKwFIWRgfAT85KGkrpDt2jWPO8IVH0sLNfB/pXad/VW9eUIY2Zlz+QyeizypXhPHv9IHfqRzvk2t3mPw+imhWw==","shasum":"89324a93509403c90a169344023151ae1fe4986b","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.3.tgz","fileCount":105,"unpackedSize":175534,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9wskCRA9TVsSAnZWagAAOZYQAJbkRIbCRzhTf0ULS0c6\nVr8zut/Jt3GOJZg4H9Tep/6kuTC0+OSwkdZkaXEs+naSek2vxXSIbHVm+bvd\nKYrPfTMiD2lgyaUGLkKbswDYPfpFZar4N3xbKVTnpl758r7r6qp+YcKEJ2/n\njQCdRXydoATMblZUpAwxEuSViPwHqHDnDuIlEVePn7Ms76uQ1j+J9M1KhiRx\nV4rB5C7HtDOa78vDUK/M9zy97aSc2oyO5/1b/COLNGmSKv/Lqr+DaFonb3wL\n+/8zCuT7+WVkABCzPd2dJH2cPpXmFOXvqEl0BdzvkkKruz7BqsvkXXyIZvqb\nQ6fHcLz9yCu+E9ko79CwJQIeGWnzV1mE1uajRuVTrlF1BqL1zmgdXUONHgPz\nhxSjMb0iVJR0BCctnfJwRhqcYMxj8FX8CUNHeNaEK+vzhgyQ3UZe3xwzH3Ms\ndLIzecPjwxNaYOlwDCnvefTPHQ7AYe95a2xnCrCGdXAzHaayPqzQsuM0SzfD\ndjCRl3mXD0SuMCrEMcQlXbhftZFBQeAGlchIsTqMJdcW3hyR5l41HRZ4mfUl\n/Lyb2Qm6Lz0nSNjI6L2PjRhxEK/lI3oenohIg5tNkkKCkQA56xRlSzCDRNn/\nXch8P0c2l9xGL6xZKjWlcf+bCmBYgUfotjHVCDGDJ6uf3V4rG3jdj24uhdoN\nh6fx\r\n=cliM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICSBu+6t/8wxeb+j1TLZ2W7Icf9TC1pZEzDa2CqcRoyVAiEAkFxLuIrJYzxBljOUjChxaAv0GidVNGGtW0QRnZ7lReA="}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.3_1593248547194_0.3365086628857572"},"_hasShrinkwrap":false},"1.6.3-callbacks":{"name":"threads","version":"1.6.3-callbacks","description":"Web workers & worker threads as simple as a function call","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"prebuild":"rimraf dist/ dist-esm/","build":"run-p build:cjs build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"run-s bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"run-s test:ava test:puppeteer:basic test:puppeteer:webpack","test:ava":"cross-env TS_NODE_FILES=true ava","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"run-s build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"license":"MIT","bugs":{"url":"https://github.com/andywer/threads.js/issues"},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.1.1","is-observable":"^1.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@types/chai":"^4.1.7","@types/debug":"^4.1.4","@types/execa":"^0.9.0","@types/mocha":"^5.2.6","@types/node":"^11.13.8","@types/webpack":"^4.4.32","ava":"^2.4.0","chai":"^4.2.0","cross-env":"^5.2.0","execa":"^3.4.0","mocha":"^5.2.0","npm-run-all":"^4.1.5","puppet-run":"^0.11.1","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.1","rimraf":"^2.6.3","rollup":"^1.16.2","rollup-plugin-commonjs":"^10.0.1","rollup-plugin-node-resolve":"^5.1.0","threads-plugin":"^1.3.2","tiny-worker":"^2.2.0","ts-loader":"^6.0.1","ts-node":"^8.10.2","tslint":"^5.16.0","tslint-config-prettier":"^1.18.0","typescript":"^3.9.5","wavy":"^1.0.4","webpack":"^4.32.2","worker-plugin":"^3.1.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"compileEnhancements":false,"extensions":["ts"],"files":["./test/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"readme":"<h1 align=\"center\">\n  <img alt=\"threads.js\" src=\"./docs/assets/logo-label.png\" width=\"75%\" />\n</h1>\n<p align=\"center\">\n  <a href=\"https://travis-ci.org/andywer/threads.js\" target=\"_blank\"><img alt=\"Build status\" src=\"https://img.shields.io/travis/andywer/threads.js/v1.svg?style=flat-square\"></a>\n  <a href=\"https://www.npmjs.com/package/threads\" target=\"_blank\"><img alt=\"npm (tag)\" src=\"https://img.shields.io/npm/v/threads.svg?style=flat-square\"></a>\n  <a href=\"https://gitter.im/threadsjs/community\" target=\"_blank\"><img alt=\"Chat room\" src=\"https://img.shields.io/badge/chat-gitter.im-orange\" /></a>\n</p>\n\n<br />\n\nOffload CPU-intensive tasks to worker threads in node.js, web browsers and electron using one uniform API.\n\nUses web workers in the browser, `worker_threads` in node 12+ and [`tiny-worker`](https://github.com/avoidwork/tiny-worker) in node 8 to 11.\n\n### Features\n\n* First-class support for **async functions** & **observables**\n* Write code once, run it **on all platforms**\n* Manage bulk task executions with **thread pools**\n* Use **require()** and **import**/**export** in workers\n* Works great with **webpack**\n\n### Version 0.x\n\nYou can find the old version 0.12 of threads.js on the [`v0` branch](https://github.com/andywer/threads.js/tree/v0). All the content on this page refers to version 1.0 which is a rewrite of the library with a whole new API.\n\n## Installation\n\n```\nnpm install threads tiny-worker\n```\n\n*You only need to install the `tiny-worker` package to support node.js < 12. It's an optional dependency and used as a fallback if `worker_threads` are not available.*\n\n## Platform support\n\n<details>\n<summary>Run on node.js</summary>\n\n<p></p>\n\nRunning code using threads.js in node works out of the box.\n\nNote that we wrap the native `Worker`, so `new Worker(\"./foo/bar\")` will resolve the path relative to the module that calls it, not relative to the current working directory.\n\nThat aligns it with the behavior when bundling the code with webpack or parcel.\n\n</details>\n\n<details>\n<summary>Webpack build setup</summary>\n\n#### Webpack config\n\nUse with the [`threads-plugin`](https://github.com/andywer/threads-plugin). It will transparently detect all `new Worker(\"./unbundled-path\")` expressions, bundles the worker code and replaces the `new Worker(...)` path with the worker bundle path, so you don't need to explicitly use the `worker-loader` or define extra entry points.\n\n```sh\n  npm install -D threads-plugin\n```\n\nThen add it to your `webpack.config.js`:\n\n```diff\n+ const ThreadsPlugin = require('threads-plugin');\n\n  module.exports = {\n    // ...\n    plugins: [\n+     new ThreadsPlugin()\n    ]\n    // ...\n  }\n```\n\n#### Node.js bundles\n\nIf you are using webpack to create a bundle that will be run in node (webpack config `target: \"node\"`), you also need to specify that the `tiny-worker` package used for node < 12 should not be bundled:\n\n```diff\n  module.exports = {\n    // ...\n+   externals: {\n+     \"tiny-worker\": \"tiny-worker\"\n+   }\n    // ...\n}\n```\n\nMake sure that `tiny-worker` is listed in your `package.json` `dependencies` in that case.\n\n#### When using TypeScript\n\nMake sure the TypeScript compiler keeps the `import` / `export` statements intact, so webpack resolves them. Otherwise the `threads-plugin` won't be able to do its job.\n\n```diff\n  module.exports = {\n    // ...\n    module: {\n      rules: [\n        {\n          test: /\\.ts$/,\n          loader: \"ts-loader\",\n+         options: {\n+           compilerOptions: {\n+             module: \"esnext\"\n+           }\n+         }\n        }\n      ]\n    },\n    // ...\n  }\n```\n\n</details>\n\n<details>\n<summary>Parcel bundler setup</summary>\n\n<p></p>\n\nYou need to import `threads/register` once at the beginning of your application code (in the master code, not in the workers):\n\n```diff\n  import { spawn } from \"threads\"\n+ import \"threads/register\"\n\n  // ...\n\n  const work = await spawn(new Worker(\"./worker\"))\n```\n\nThis registers the library's `Worker` implementation for your platform as the global `Worker`. This is necessary, since you cannot `import { Worker } from \"threads\"` or Parcel won't recognize `new Worker()` as a web worker anymore.\n\nBe aware that this might affect any code that tries to instantiate a normal web worker `Worker` and now instead instantiates a threads.js `Worker`. The threads.js `Worker` is just a web worker with some sugar on top, but that sugar might have unexpected side effects on third-party libraries.\n\nEverything else should work out of the box.\n\n</details>\n\n## Getting Started\n\n### Basics\n\n```js\n// master.js\nimport { spawn, Thread, Worker } from \"threads\"\n\nconst auth = await spawn(new Worker(\"./workers/auth\"))\nconst hashed = await auth.hashPassword(\"Super secret password\", \"1234\")\n\nconsole.log(\"Hashed password:\", hashed)\n\nawait Thread.terminate(auth)\n```\n\n```js\n// workers/auth.js\nimport sha256 from \"js-sha256\"\nimport { expose } from \"threads/worker\"\n\nexpose({\n  hashPassword(password, salt) {\n    return sha256(password + salt)\n  }\n})\n```\n\n### spawn()\n\nThe `hashPassword()` function of the `auth` object in the master code proxies the call to the `hashPassword()` function in the worker:\n\nIf the worker's function returns a promise or an observable then you can just use the return value as such in the master code. If the function returns a primitive value, expect the master function to return a promise resolving to that value.\n\n### expose()\n\nUse `expose()` to make a function or an object containing methods callable from the master thread.\n\nIn case of exposing an object, `spawn()` will asynchronously return an object exposing all the object's functions. If you `expose()` a function, `spawn` will also return a callable function, not an object.\n\n## Usage\n\n<p>\n  Find the full documentation on the <a href=\"https://threads.js.org/\" rel=\"nofollow\">website</a>:\n</p>\n\n- [**Quick start**](https://threads.js.org/getting-started)\n- [**Basic usage**](https://threads.js.org/usage)\n- [**Using observables**](https://threads.js.org/usage-observables)\n- [**Thread pools**](https://threads.js.org/usage-pool)\n- [**Advanced**](https://threads.js.org/usage-advanced)\n\n## Webpack\n\nThreads.js works with webpack. Usually all you need to do is adding the\n[`threads-plugin`](https://github.com/andywer/threads-plugin).\n\nSee [Build with webpack](https://threads.js.org/getting-started#build-with-webpack)\non the website for details.\n\n<!--\n## API\n\nTODO\n-->\n\n## Debug\n\nWe are using the [`debug`](https://github.com/visionmedia/debug) package to provide opt-in debug logging. All the package's debug messages have a scope starting with `threads:`, with different sub-scopes:\n\n- `threads:master:messages`\n- `threads:master:spawn`\n- `threads:master:thread-utils`\n- `threads:pool:${poolName || poolID}`\n\nSet it to `DEBUG=threads:*` to enable all the library's debug logging. To run its tests with full debug logging, for instance:\n\n```\nDEBUG=threads:* npm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"18968f96c3cac0528b4196370001f0b86e24f799","_id":"threads@1.6.3-callbacks","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-Sj8ERuptFizuE4Tlz0KIq3B+4jHm5pnGjJkXnMnmRW/bnzsezVhy/juvFXADZVWnRforasOAprZwRDTQWNnDsg==","shasum":"a503dbf9972597316df05fac02985f9310e55cb5","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.3-callbacks.tgz","fileCount":126,"unpackedSize":197937,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe+2BuCRA9TVsSAnZWagAAZQ4P/2mmRIqBFM6/UkSwbu6X\njeueEUJUGRgw87RPGdmGkjcpu81b7vZToMMIoCRXwvJQV7Z81AcPdIXK/gMS\nVd09qMdteufy2RtC6L5Tqlx9+99knEPuKGqb/hmmYfkhq/rRqqc75eHjOX7M\nUHd2NybY5O7z4L+hPHiovGMjb97UX/hBBYVG1ERe8Ou2udt/8WyLXDuFa7mf\nthYvBqTyI/EgxY86TYVnBlsQJt24euhIAMvSx441+xVDSXu9jYTVcb83Wbbx\nwS2UCetDOXQJLf/MMGT+M3EDDWff75HaatU8ZcZoX5I8/1rb4xfkIxUuND2+\n2uQRFqH1QwWZYlKir6aWcLemhInPQP3jI+V7Pf+4JcO/ixME2OgFjq5DwWJ/\nCWhKaT33tafn0K2mhRW+qVxOHOFfzkE6qjfpIAGB6Wuwo44fo/Q1v5UMikq5\n0o35CqEHKAv2CyyyGoKb3SDAYozRgscdftgsQUPYp5Su/y66Hnwk9EoQH3e1\nnbz2vdzqjwA8RlrLZgJFrdEU1kwouq+oY3l0YjJNttaiP818WL8JCxNP5g6g\nt3CVcFDtjP8mTtustx6rLPvwFhwVqLECfPbuoQ5v1hHRYOm3OyWoCJiB0xjm\nYLtk0jg2VBj2XE5m4yYTK43ZD4lXcYD8dlUTAZfqoZlSmxFYw88j+19M1Yev\nFR7o\r\n=uHJr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDM44DrtNh2EG9w2lMsGQeeIPHNLweAIvZVCQOoF/WJYAIhAMLh8ZDwkHW5akqo5M+pQExhFGIBrq/Bs1hwDP861QmI"}]},"maintainers":[{"name":"andywer","email":"andy@dev.next-step-software.com"}],"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.3-callbacks_1593532525889_0.8552597799529209"},"_hasShrinkwrap":false},"1.6.4":{"name":"threads","version":"1.6.4","description":"Web workers & worker threads as simple as a function call","license":"MIT","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"clean":"rimraf dist/ dist-esm/","dev":"npm run clean && tsc -p tsconfig.json --watch","build":"npm run clean && npm run build:cjs && npm run build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"npm run bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"npm run test:library && npm run test:tooling && npm run test:puppeteer:basic && npm run test:puppeteer:webpack","test:library":"cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts","test:tooling":"cross-env TS_NODE_FILES=true ava ./test-tooling/**/*.test.ts","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test-tooling/webpack/dist/app.web/0.worker.js --serve ./test-tooling/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-tooling/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"npm run build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"bugs":{"url":"https://github.com/andywer/threads.js/issues"},"funding":"https://github.com/andywer/threads.js?sponsor=1","homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.2.0","is-observable":"^2.1.0","observable-fns":"^0.5.1","tiny-worker":">= 2"},"devDependencies":{"@rollup/plugin-commonjs":"^16.0.0","@rollup/plugin-node-resolve":"^10.0.0","@types/chai":"^4.2.14","@types/debug":"^4.1.5","@types/execa":"^2.0.0","@types/mocha":"^8.0.3","@types/node":"^14.14.5","@types/webpack":"^4.41.23","ava":"^3.13.0","chai":"^4.2.0","cross-env":"^7.0.2","execa":"^4.0.3","mocha":"^8.2.0","puppet-run":"^0.11.3","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.2","rimraf":"^3.0.2","rollup":"^2.32.1","threads-plugin":"^1.3.3","tiny-worker":"^2.2.0","ts-loader":"^8.0.7","ts-node":"^9.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.2.3","wavy":"^1.0.4","webpack":"^4.44.2","worker-plugin":"^5.0.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"extensions":["ts"],"files":["./test/**/*.test.ts","./test-tooling/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"83d0859e929ae29b96211843f8d32b3540c0f315","_id":"threads@1.6.4","_nodeVersion":"12.16.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-A+9MQFAUha9W8MjIPmrvETy98qVmZFr5Unox9D95y7kvz3fBpGiFS7JOZs07B2KvTHoRNI5MrGudRVeCmv4Alw==","shasum":"cf8ad992d6014b492f20cf3566048475a3045192","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.4.tgz","fileCount":105,"unpackedSize":177530,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgfJwECRA9TVsSAnZWagAAH4YP/2gzctxn5YKJUZAugJdT\n95D/OliBxre/ENl7+Pr6j6RGqzJexi4p8bX1bQHMCCilIgelkjny4xi+qMmO\nqVzKwhyaB4smxuLm7WKqEdxKzhLl4E0LBNSlnrNWVJueEFlM/612prFq1zWI\nFicDS9Otb0cPfXCmRUUCePmqLlywZCH0xnPc+T+Rln3+YkIO/cDHlGGAZtIA\nQNhNZC+xgFhkUoTMJ6W+uTIEDK6ZrNGakbWAdGn21xU6bh9BeCZtF3ur04XW\nPGhhyUOTYSuG56X9By8F2GkisGXYVf9kTTcXfKp6HwmAB4X0S6fZOiB9NSNu\naNgakPmz0nXX4hzzNBCKtMzj8kvjm+G6ZZlm9nZVRCbZ8oCU/zRakAjwH0oA\nkJiJ3jh++q07OrQg6DIUt8rNcEFStmLH44LPOTvU0xFsBK2RZVc+vHb8o1nY\nS8+xT4GWCZ+QgttX/+B6wse94t5mbL0qriImes6/1NjAAIYmTDt8iHV+FKku\nqXJ41R2JHOhfDc53qSiJ0b0Vc5Y7o5Ugaaknr9wyDi9q5JOzEGmOr2ecEoRK\n40ybH+dkh26VVzhb1rTv3qWaH+0sxcERr2N+JIVOt0y4L6L7Z+5uX6tYChrX\nm8zSdRliDvQiLEMsH9hWnc2WXU/mst6NrHAdHSctNQWnsb40WQLL9ARXojIm\nUsEu\r\n=k2QU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2uFAeVXAr5QgcbogfBti7XepU7IrdVkmjj+ZsE2r2SwIhAK1ivuhFtP5XPMHVEd4kpEZ7sGSnFowOpcJrozuNp9UA"}]},"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"maintainers":[{"name":"andywer","email":"github@andywer.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.4_1618779140445_0.37516391782044645"},"_hasShrinkwrap":false},"1.6.5":{"name":"threads","version":"1.6.5","description":"Web workers & worker threads as simple as a function call","license":"MIT","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"clean":"rimraf dist/ dist-esm/","dev":"npm run clean && tsc -p tsconfig.json --watch","build":"npm run clean && npm run build:cjs && npm run build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"npm run bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"npm run test:library && npm run test:tooling && npm run test:puppeteer:basic && npm run test:puppeteer:webpack","test:library":"cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts","test:tooling":"cross-env TS_NODE_FILES=true ava ./test-tooling/**/*.test.ts","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test-tooling/webpack/dist/app.web/0.worker.js --serve ./test-tooling/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-tooling/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"npm run build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"bugs":{"url":"https://github.com/andywer/threads.js/issues"},"funding":"https://github.com/andywer/threads.js?sponsor=1","homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.2.0","is-observable":"^2.1.0","observable-fns":"^0.6.1","tiny-worker":">= 2"},"devDependencies":{"@rollup/plugin-commonjs":"^16.0.0","@rollup/plugin-node-resolve":"^10.0.0","@types/chai":"^4.2.14","@types/debug":"^4.1.5","@types/execa":"^2.0.0","@types/mocha":"^8.0.3","@types/node":"^14.14.5","@types/webpack":"^4.41.23","ava":"^3.13.0","chai":"^4.2.0","cross-env":"^7.0.2","execa":"^4.0.3","mocha":"^8.2.0","puppet-run":"^0.11.3","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.2","rimraf":"^3.0.2","rollup":"^2.32.1","threads-plugin":"^1.3.3","tiny-worker":"^2.2.0","ts-loader":"^8.0.7","ts-node":"^9.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.2.3","wavy":"^1.0.4","webpack":"^4.44.2","worker-plugin":"^5.0.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"extensions":["ts"],"files":["./test/**/*.test.ts","./test-tooling/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"2a3d58a9284147297f8ae8c74d0fcbf47658ec48","_id":"threads@1.6.5","_nodeVersion":"12.16.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-yL1NN4qZ25crW8wDoGn7TqbENJ69w3zCEjIGXpbqmQ4I+QHrG8+DLaZVKoX74OQUXWCI2lbbrUxDxAbr1xjDGQ==","shasum":"5cee7f139e3e147c5a64f0134844ee92469932a5","tarball":"https://registry.npmjs.org/threads/-/threads-1.6.5.tgz","fileCount":105,"unpackedSize":177660,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguT6gCRA9TVsSAnZWagAAN7gP/0YmuuF/zPwnkX+bPata\nGY9HKc//5alxuocig2+1fXb3b+qJAsUklm0iYhJ95t5U+KBhrQaKKp772plZ\niAS4tnd/EYAamSs9QaH1wpxEl4mVlA2mFc47qKMo4EzqbLWol8GkJEA7GjwH\nLtEKDu29s6c3C79WclsvQhEDOXNCFt30L8fGUGGApLnCWg1x9qAm5Z2+VN/P\nsR+n1uBgK5PkxbygqiVayg8mclao60MgWW5h5z1g6CAJR2Wt+MQUFy4LWC6J\nnUYx6+yu4Wj7mDMz4+W74wqLtIa0cZr8foOuDPjCxgQqpRIGJwF5OCsJGitp\nbErSMxyD/mN3VvisGH23eIhs8E3AMM4qidPsZ1Kc12/dQ9gWDaKnUsZOEMmT\nBt8TjWlM88mSaN/m+DQ5qWp9l6muQHu22/nkmAW0i9yl6ADiHHfqLT34uMY3\n0BcYVp6Bzpo/MHrDwhQsT6kgkHj4NFFjV/Lflhv9hVH3V2TKKiJZ0Rs/U8x2\nsk6B/0B6y2omZbbbND/V+VfNJQSwzGxNeomVPiG7JxNU5uzbZ1ozrUx9SQyi\nXXnEIVc2uOmCc7rslNgBQ1C+zoL/BWlZwkm8GKHLTvNzjLy03JX6HulOHI29\noWmHI6d0LWxhfrDY7H5aEDKFjJRLMNPGZRXgMMNksawApSMLhyBpTdc6X1x7\nXfH7\r\n=me8s\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAX0xcmBMN0zt3g1z7jgzsJrJHPGJMHl6ShVEsC2PanmAiEA5RncNNnXkGWSL9Qdsclid7aDc7cs8VLnz6GJq+hm4R0="}]},"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"maintainers":[{"name":"andywer","email":"github@andywer.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.6.5_1622752928628_0.5301487616851379"},"_hasShrinkwrap":false},"1.7.0":{"name":"threads","version":"1.7.0","description":"Web workers & worker threads as simple as a function call","license":"MIT","main":"dist/index.js","module":"dist-esm/index.js","scripts":{"clean":"rimraf dist/ dist-esm/","dev":"npm run clean && tsc -p tsconfig.json --watch","build":"npm run clean && npm run build:cjs && npm run build:es","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig-esm.json","postbuild":"npm run bundle","bundle":"rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js","test":"npm run test:library && npm run test:tooling && npm run test:puppeteer:basic && npm run test:puppeteer:webpack","test:library":"cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts","test:tooling":"cross-env TS_NODE_FILES=true ava ./test-tooling/**/*.test.ts","test:puppeteer:basic":"puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts","test:puppeteer:webpack":"puppet-run --serve ./test-tooling/webpack/dist/app.web/0.worker.js --serve ./test-tooling/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-tooling/webpack/webpack.chromium.mocha.ts","posttest":"tslint --project .","prepare":"npm run build"},"exports":{".":{"require":"./dist/index.js","default":"./index.mjs"},"./observable":{"require":"./observable.js","default":"./observable.mjs"},"./register":{"require":"./register.js","default":"./register.mjs"},"./worker":{"require":"./worker.js","default":"./worker.mjs"}},"sideEffects":["./dist*/master/register.js","./dist*/worker/index.js","./register.*js","./worker.*js"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"bugs":{"url":"https://github.com/andywer/threads.js/issues"},"funding":"https://github.com/andywer/threads.js?sponsor=1","homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"dependencies":{"callsites":"^3.1.0","debug":"^4.2.0","is-observable":"^2.1.0","observable-fns":"^0.6.1","tiny-worker":">= 2"},"devDependencies":{"@rollup/plugin-commonjs":"^16.0.0","@rollup/plugin-node-resolve":"^10.0.0","@types/chai":"^4.2.14","@types/debug":"^4.1.5","@types/execa":"^2.0.0","@types/mocha":"^8.0.3","@types/node":"^14.14.5","@types/webpack":"^4.41.23","ava":"^3.13.0","chai":"^4.2.0","cross-env":"^7.0.2","execa":"^4.0.3","mocha":"^8.2.0","puppet-run":"^0.11.3","puppet-run-plugin-mocha":"^0.10.0-alpha","raw-loader":"^4.0.2","rimraf":"^3.0.2","rollup":"^2.32.1","threads-plugin":"^1.3.3","tiny-worker":"^2.2.0","ts-loader":"^8.0.7","ts-node":"^9.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.2.3","wavy":"^1.0.4","webpack":"^4.44.2","worker-plugin":"^5.0.0"},"optionalDependencies":{"tiny-worker":">= 2"},"ava":{"extensions":["ts"],"files":["./test/**/*.test.ts","./test-tooling/**/*.test.ts"],"require":["ts-node/register"],"serial":true},"browser":{"callsites":false,"tiny-worker":false,"ts-node":false,"ts-node/register":false,"worker_threads":false,"./dist/master/implementation.js":"./dist/master/implementation.browser.js","./dist/master/implementation.node.js":false,"./dist/worker/implementation.js":"./dist/worker/implementation.browser.js","./dist/worker/implementation.tiny-worker.js":false,"./dist/worker/implementation.worker_threads.js":false,"./dist-esm/master/implementation.js":"./dist-esm/master/implementation.browser.js","./dist-esm/master/implementation.node.js":false,"./dist-esm/worker/implementation.js":"./dist-esm/worker/implementation.browser.js","./dist-esm/worker/implementation.tiny-worker.js":false,"./dist-esm/worker/implementation.worker_threads.js":false},"gitHead":"4f08abfad3059141c10ddabed213043229f5df08","_id":"threads@1.7.0","_nodeVersion":"12.22.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==","shasum":"d9e9627bfc1ef22ada3b733c2e7558bbe78e589c","tarball":"https://registry.npmjs.org/threads/-/threads-1.7.0.tgz","fileCount":105,"unpackedSize":178088,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh29x4CRA9TVsSAnZWagAA/vwP/A1WEms6SWg0vQQhkPMi\nSFqHtsOcciZ6ic3jH1OzHj8Tk2owvUiEyurbxEKP6oS9zmw9DiKbLWeJiOsL\nnb/eSLqLBJutw9GzUeNuT05mNRQjgwVLRx+hp8v4KaJsmfM/Au+44aI5aKBI\n6ygwMfqP+7fxEmy8Q8H78TMyF11fRNqvxgkyyUHAWi8wljSymPVM2WnYpwgI\ndWMiGdrb+KslUkPK2nZfuLTvWVzNatBuJNb0K7yh6aCcyRJIOV5kwMXJPqRV\niW3wLjnlalgo1fL9GuaIWmz2MLco3GuQSiql63vnNZGPEieART4gtwPSZR72\nR40nHnZZD6zAzPyXtomYqeUMgRzLRqxEWIaZ96NcOUar0a7YsOff3pUii6/+\nyiB2BV8e6xkTREsfraH21ujaGTV4S6XiO6YtGTIpXReU2nQWcTF39KwnURpo\ni6Bok138lcU0jGwz4A9M8EszVBIg24zf8NF3TLsybBwJL4V3rGuJ2iWAWp8j\nsg2Ha9vXGXW+LHdoQyO3Wgs2v0TBSdIGDadDTEAbEqCgWK/S7noQ4hd4D0Ep\nPHpZmkCeXxyGBiPfPdFL/a/BdjmQdArc4tRsXP08GObjnYRrqyTTCoronmh1\nRhRtFZ9KB6e0/mKMJqCBitKaPfkdkqt2k7uq13pMYFDJzhLC6BKfYXUWA7qi\nw3TN\r\n=8I2E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICqmWhD3OhxN3hCgrDbxmByq8NsLfcLqMojC9EfUpLE7AiEA+lXWI6b33jzOJEOKZF80vqE+jVOeGNaKPQZbBF7uqNQ="}]},"_npmUser":{"name":"andywer","email":"github@andywer.com"},"directories":{},"maintainers":[{"name":"andywer","email":"github@andywer.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/threads_1.7.0_1632595572176_0.5203379373258399"},"_hasShrinkwrap":false}},"homepage":"https://threads.js.org","keywords":["thread","worker","pool","spawn","isomorphic","parallel","observable","worker_threads"],"repository":{"type":"git","url":"git+https://github.com/andywer/threads.js.git"},"author":{"name":"Andy Wermke","url":"https://github.com/andywer"},"bugs":{"url":"https://github.com/andywer/threads.js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"preco21":true,"cantidio":true,"classicoldsong":true,"zdying":true,"andr":true,"scconway8":true,"morganz":true,"zoluzo":true,"luq":true,"xenira":true,"you21979":true,"nachbar90":true,"shanewholloway":true,"xinwangwang":true,"derrickbeining":true,"omkar.sheral.1989":true}}