nestworker 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ # Contributing to `nestworker`
2
+
3
+ Contributions are always welcome.
4
+ To contribute, [fork](https://help.github.com/articles/fork-a-repo/) nestworker, commit your changes, & [send a pull request](https://help.github.com/articles/using-pull-requests/).
5
+
6
+ ## Feature Requests
7
+
8
+ Feature requests should be submitted in the [issue tracker](https://github.com/VaheHak/nestworker/issues), with a description of
9
+ the expected behavior & use case.
10
+
11
+ ## Pull Requests
12
+
13
+ For additions or bug fixes, please modify the relevant files. Include updated unit tests in the `test` directory as part of your pull request. Unit test files should be named `[filename].test.js`.
14
+
15
+ Before running the unit tests you’ll need to install, `npm i`, [development dependencies](https://docs.npmjs.com/files/package.json#devdependencies). Run unit tests from the command-line via `npm test`.
16
+
17
+ ## Coding Guidelines
18
+
19
+ In addition to the following guidelines, please follow the conventions already established in the code.
20
+
21
+ - **Spacing**:<br>
22
+ Use two spaces for indentation. No tabs.
23
+
24
+ - **Quotes**:<br>
25
+ Single-quoted strings are preferred to double-quoted strings; however,
26
+ please use a double-quoted string if the value contains a single-quote
27
+ character to avoid unnecessary escaping.
28
+
29
+ Guidelines are enforced using [ESLint](https://www.npmjs.com/package/eslint):
30
+
31
+ ```bash
32
+ $ npm run lint
33
+ ```
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Vahe Hakobyan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ ![](https://img.shields.io/badge/dependencies-none-brightgreen.svg)
2
+ ![](https://img.shields.io/npm/dt/nestworker.svg)
3
+ ![](https://img.shields.io/npm/l/nestworker.svg)
4
+
5
+ # nestworker
6
+ A simple library that provides an abstraction for the Node.js `worker_threads` module. You can run your function in a dedicated thread by working with Promises.
7
+
8
+ ### Example
9
+ ```ts
10
+ import { executeInThread } from 'nestworker';
11
+
12
+ async function calculate(): Promise<void> {
13
+ const values = await Promise.all([
14
+ executeInThread(() => 2 ** 10),
15
+ executeInThread(() => 3 ** 10),
16
+ ]);
17
+
18
+ console.log(values);
19
+ }
20
+
21
+ calculate();
22
+ ```
23
+
24
+ This example demonstrates the optimization of two resource-intensive calculations through parallel execution in distinct threads.
25
+ By distributing the tasks across separate threads, significant time savings are achieved.
26
+
27
+ Nestworker's takes a task function as its parameter, orchestrates its execution in a new thread, and subsequently delivers a Promise.
28
+
29
+ **Surprisingly simple, isn't it?**
30
+
31
+ ## Installation
32
+
33
+ ```shell
34
+ $ npm i nestworker
35
+ ```
36
+
37
+ ## All examples:
38
+ - [Basic example](https://github.com/VaheHak/nestworker/tree/master/examples/basic.ts)
39
+ - [Parameters for the thread task](https://github.com/VaheHak/nestworker/blob/master/examples/multi-params.ts)
40
+ - [Async function inside the thread](https://github.com/VaheHak/nestworker/blob/master/examples/async-task.ts)
41
+ - [Error handling](https://github.com/VaheHak/nestworker/blob/master/examples/error-handling.ts)
42
+ - [Use modules inside the thread](https://github.com/VaheHak/nestworker/blob/master/examples/modules-in-thread.ts)
43
+
44
+ ## Contributing
45
+
46
+ See the [contributing guide](https://github.com/VaheHak/nestworker/blob/master/CONTRIBUTING.md) for detailed instructions on how to get started with our project.
47
+
48
+ ## API
49
+
50
+ ### executeInThread(task, { args: any[] }
51
+ Runs the specified function in a separate thread.
52
+
53
+ #### Parameters
54
+ - `Task (Function)`: The function to be executed in a thread.
55
+ - This can also be a async function (promise).
56
+ - `...params (Any)`: Additional arguments to be passed to the Task function.
57
+ - Parameter cann't be a function.
58
+
59
+ ```ts
60
+ const task = function([a, b, c]) { ... };
61
+ executeInThread(task, { args: [1, {}, true] })
62
+ ```
63
+
64
+ The `executeInThread` function allows you to execute a given task function in a dedicated thread, similar to the behavior of `setTimeout` or `setInterval`. You provide the main function to be executed, along with any additional arguments (...args) that should be passed to the given function.
65
+
66
+ #### Returns
67
+ `Promise<any>`: A Promise that resolves with the return value of the callback.
68
+
69
+ Inside the provided function, you have the flexibility to return any value, including a Promise. The returned value, whether it's a standard value or a Promise, will be passed back to you as the resolved result of the `Promise` returned by the `executeInThread` function.
70
+
71
+ ```ts
72
+ const number = await executeInThread(() => 123); // 123
73
+ const name = await executeInThread(() => Promise.resolve('John')); // John
74
+ ```
75
+
76
+ #### Important (limitation)
77
+
78
+ Access to data outside of the task function is restricted. If you require the use of a module, it should be required within the task function. The sole method for accessing data within a task function from external sources is through the utilization of the parameters. Closures do not function in this context.
79
+
80
+ In this example, we're reading a file in a separate thread and returning the data in string format. We start by defining a task function that will run within the thread, and then we prepare the necessary parameters to be passed as inputs to that function.
81
+
82
+ ```ts
83
+ import { executeInThread } from 'nestworker';
84
+
85
+ async function task(fileName) {
86
+ // Closure doesn't work here
87
+ const { readFile } = await import('fs/promises');
88
+ const content = await readFile(__filename);
89
+ return content.toString();
90
+ }
91
+
92
+ async function read() {
93
+ const content = await executeInThread(task, fileName);
94
+ console.log(content);
95
+ }
96
+
97
+ read();
98
+ ```
99
+
100
+ There is also another option if you don't want to use `import` inside the function.
101
+
102
+ ```ts
103
+ import { executeInThread } from 'nestworker';
104
+
105
+ // this will be executed in a dedicated thread
106
+ async function task(modules: string[]) {
107
+ // Closure doesn't work here
108
+ const { readFile } = modules['fs/promises'];
109
+
110
+ const content = await readFile(__filename);
111
+
112
+ return content.toString();
113
+ }
114
+
115
+ async function read() {
116
+ const content = await executeInThread(task, {
117
+ threadModules: ['fs/promises'],
118
+ });
119
+
120
+ console.log(content);
121
+ }
122
+
123
+ read();
124
+ ```
125
+
126
+ The `ThreadModules` class lets you set up modules for the thread. You can provide it only thorough the second argument, and you'll have access to the libraries through the `modules` object.
127
+
128
+ You should only provide the `ThreadModules` type of object once through the second parameter. Attempting to provide it multiple times will result in an error. Additionally, avoid returning the `modules` object from the task function, as it will also lead to errors.
package/dist/main.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { ITaskOption, TaskFunction } from './models';
2
+ export declare const executeInThread: <T, P>(task: TaskFunction<T, P>, { threadModules, args }?: ITaskOption<P>) => Promise<any>;
3
+ declare function DeprecatedExecuteInThread<P>(options?: ITaskOption<P>): MethodDecorator;
4
+ export declare const ExecuteInThread: typeof DeprecatedExecuteInThread;
5
+ export {};
package/dist/main.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecuteInThread = exports.executeInThread = void 0;
4
+ const node_util_1 = require("node:util");
5
+ const skeleton_1 = require("./worker/skeleton");
6
+ const executor_1 = require("./worker/executor");
7
+ const executeInThread = (task, { threadModules = [], args = [] } = {}) => {
8
+ const params = [...args];
9
+ const modules = [...threadModules];
10
+ const workerSchema = (0, skeleton_1.createWorker)(task, params, modules);
11
+ return (0, executor_1.startWorker)(workerSchema);
12
+ };
13
+ exports.executeInThread = executeInThread;
14
+ function DeprecatedExecuteInThread(options) {
15
+ return function (target, propertyKey, descriptor) {
16
+ const originalMethod = descriptor.value;
17
+ const { threadModules = [], args: taskArgs = [] } = options || {};
18
+ descriptor.value = function (...args) {
19
+ const task = originalMethod.bind(this);
20
+ return (0, exports.executeInThread)(task, {
21
+ threadModules,
22
+ args: [...taskArgs, ...args],
23
+ });
24
+ };
25
+ return descriptor;
26
+ };
27
+ }
28
+ exports.ExecuteInThread = (0, node_util_1.deprecate)(DeprecatedExecuteInThread, 'The `ExecuteInThread` decorator is deprecated. Use an alternative method.');
29
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC,gDAAiD;AACjD,gDAAgD;AAQzC,MAAM,eAAe,GAAG,CAC7B,IAAwB,EACxB,EAAE,aAAa,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,KAAqB,EAAE,EACxC,EAAE;IAChB,MAAM,MAAM,GAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAa,CAAC,GAAG,aAAa,CAAC,CAAC;IAE7C,MAAM,YAAY,GAAG,IAAA,uBAAY,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,IAAA,sBAAW,EAAC,YAAY,CAAC,CAAC;AACnC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAOF,SAAS,yBAAyB,CAChC,OAAwB;IAExB,OAAO,UACL,MAAW,EACX,WAA4B,EAC5B,UAA8B;QAE9B,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,MAAM,EAAE,aAAa,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAElE,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;YAEzC,MAAM,IAAI,GAAsB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE1D,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE;gBAC3B,aAAa;gBACb,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;aAC7B,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAEY,QAAA,eAAe,GAAG,IAAA,qBAAS,EACtC,yBAAyB,EACzB,2EAA2E,CAC5E,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './task';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./task"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB"}
@@ -0,0 +1,5 @@
1
+ export type TaskFunction<T, P = any> = (...args: P[]) => T;
2
+ export interface ITaskOption<P> {
3
+ threadModules?: string[];
4
+ args?: P[];
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/models/task.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/typescript/lib/lib.es2021.full.d.ts","../src/models/task.ts","../src/models/index.ts","../src/worker/skeleton.ts","../src/worker/executor.ts","../src/main.ts","../src/worker/worker.ts","../node_modules/@types/eslint/helpers.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/eslint/index.d.ts","../node_modules/@types/eslint-scope/index.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/buffer/index.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/file.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/filereader.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/sea.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/semver/classes/semver.d.ts","../node_modules/@types/semver/functions/parse.d.ts","../node_modules/@types/semver/functions/valid.d.ts","../node_modules/@types/semver/functions/clean.d.ts","../node_modules/@types/semver/functions/inc.d.ts","../node_modules/@types/semver/functions/diff.d.ts","../node_modules/@types/semver/functions/major.d.ts","../node_modules/@types/semver/functions/minor.d.ts","../node_modules/@types/semver/functions/patch.d.ts","../node_modules/@types/semver/functions/prerelease.d.ts","../node_modules/@types/semver/functions/compare.d.ts","../node_modules/@types/semver/functions/rcompare.d.ts","../node_modules/@types/semver/functions/compare-loose.d.ts","../node_modules/@types/semver/functions/compare-build.d.ts","../node_modules/@types/semver/functions/sort.d.ts","../node_modules/@types/semver/functions/rsort.d.ts","../node_modules/@types/semver/functions/gt.d.ts","../node_modules/@types/semver/functions/lt.d.ts","../node_modules/@types/semver/functions/eq.d.ts","../node_modules/@types/semver/functions/neq.d.ts","../node_modules/@types/semver/functions/gte.d.ts","../node_modules/@types/semver/functions/lte.d.ts","../node_modules/@types/semver/functions/cmp.d.ts","../node_modules/@types/semver/functions/coerce.d.ts","../node_modules/@types/semver/classes/comparator.d.ts","../node_modules/@types/semver/classes/range.d.ts","../node_modules/@types/semver/functions/satisfies.d.ts","../node_modules/@types/semver/ranges/max-satisfying.d.ts","../node_modules/@types/semver/ranges/min-satisfying.d.ts","../node_modules/@types/semver/ranges/to-comparators.d.ts","../node_modules/@types/semver/ranges/min-version.d.ts","../node_modules/@types/semver/ranges/valid.d.ts","../node_modules/@types/semver/ranges/outside.d.ts","../node_modules/@types/semver/ranges/gtr.d.ts","../node_modules/@types/semver/ranges/ltr.d.ts","../node_modules/@types/semver/ranges/intersects.d.ts","../node_modules/@types/semver/ranges/simplify.d.ts","../node_modules/@types/semver/ranges/subset.d.ts","../node_modules/@types/semver/internals/identifiers.d.ts","../node_modules/@types/semver/index.d.ts"],"fileInfos":[{"version":"824cb491a40f7e8fdeb56f1df5edf91b23f3e3ee6b4cde84d4a99be32338faee","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569",{"version":"87d693a4920d794a73384b3c779cadcb8548ac6945aa7a925832fe2418c9527a","affectsGlobalScope":true},{"version":"76f838d5d49b65de83bc345c04aa54c62a3cfdb72a477dc0c0fce89a30596c30","affectsGlobalScope":true},{"version":"73e370058f82add1fdbc78ef3d1aab110108f2d5d9c857cb55d3361982347ace","affectsGlobalScope":true},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true},{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"b20fe0eca9a4e405f1a5ae24a2b3290b37cf7f21eba6cbe4fc3fab979237d4f3","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"8073890e29d2f46fdbc19b8d6d2eb9ea58db9a2052f8640af20baff9afbc8640","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"4a66df3ab5de5cfcda11538cffddd67ff6a174e003788e270914c1e0248483cf","0544f58ee96cf7d0ec7334d6a9b6fbface21b05b111b7879b4549335e4b98dd1","228cead7b0435ca50575e5f2cb79be3eb8f2d8e33f34ed1b69189ea14ec1dcf6","a2cfb94aa0c09158612ed42fd22f903dc2ec826b6cd284e56d4d420c865df238","1a3cfa94242fbf1f6362ac9c21ab4afd3f9f912192fc74d0316dfad547a07a07","65bf4fbc13709aa8962398d7fe07f24b76af7b8bb69233f7d12322479a1715ee","8dd95536ad01583dd4dca6c3335b8e3686859ceaa1305c044f81c8ad6dbc7f64",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe","acdc9fb9638a235a69bd270003d8db4d6153ada2b7ccbea741ade36b295e431e","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"a14ed46fa3f5ffc7a8336b497cd07b45c2084213aaca933a22443fcb2eef0d07","affectsGlobalScope":true},"cce1f5f86974c1e916ec4a8cab6eec9aa8e31e8148845bf07fbaa8e1d97b1a2c",{"version":"7fd7fcbf021a5845bdd9397d4649fcf2fe17152d2098140fc723099a215d19ad","affectsGlobalScope":true},"df3389f71a71a38bc931aaf1ef97a65fada98f0a27f19dd12f8b8de2b0f4e461","d69a3298a197fe5d59edba0ec23b4abf2c8e7b8c6718eac97833633cd664e4c9",{"version":"a9544f6f8af0d046565e8dde585502698ebc99eef28b715bad7c2bded62e4a32","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"8b809082dfeffc8cc4f3b9c59f55c0ff52ba12f5ae0766cb5c35deee83b8552e","affectsGlobalScope":true},"bd3f5d05b6b5e4bfcea7739a45f3ffb4a7f4a3442ba7baf93e0200799285b8f1","4c775c2fccabf49483c03cd5e3673f87c1ffb6079d98e7b81089c3def79e29c6","d4f9d3ae2fe1ae199e1c832cca2c44f45e0b305dfa2808afdd51249b6f4a5163","7525257b4aa35efc7a1bbc00f205a9a96c4e4ab791da90db41b77938c4e0c18e","b7fe70be794e13d1b7940e318b8770cd1fb3eced7707805318a2e3aaac2c3e9e",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"9c611eff81287837680c1f4496daf9e737d6f3a1ff17752207814b8f8e1265af","affectsGlobalScope":true},"fe1fd6afdfe77976d4c702f3746c05fb05a7e566845c890e0e970fe9376d6a90","b5d4e3e524f2eead4519c8e819eaf7fa44a27c22418eff1b7b2d0ebc5fdc510d","afb1701fd4be413a8a5a88df6befdd4510c30a31372c07a4138facf61594c66d","9bd8e5984676cf28ebffcc65620b4ab5cb38ab2ec0aac0825df8568856895653","396a8939b5e177542bdf9b5262b4eee85d29851b2d57681fa9d7eae30e225830","5e8dc64e7e68b2b3ea52ed685cf85239e0d5fb9df31aabc94370c6bc7e19077b",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"c07146dbbbd8b347241b5df250a51e48f2d7bef19b1e187b1a3f20c849988ff1","45b1053e691c5af9bfe85060a3e1542835f8d84a7e6e2e77ca305251eda0cb3c","0f05c06ff6196958d76b865ae17245b52d8fe01773626ac3c43214a2458ea7b7",{"version":"ae5507fc333d637dec9f37c6b3f4d423105421ea2820a64818de55db85214d66","affectsGlobalScope":true},{"version":"46755a4afc53df75f0bfce72259fb971daac826b0cdd8c4eaccad2755a817403","affectsGlobalScope":true},"8abd0566d2854c4bd1c5e48e05df5c74927187f1541e6770001d9637ac41542e","54e854615c4eafbdd3fd7688bd02a3aafd0ccf0e87c98f79d3e9109f047ce6b8","d8dba11dc34d50cb4202de5effa9a1b296d7a2f4a029eec871f894bddfb6430d","8b71dd18e7e63b6f991b511a201fad7c3bf8d1e0dd98acb5e3d844f335a73634","01d8e1419c84affad359cc240b2b551fb9812b450b4d3d456b64cda8102d4f60","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","8221b00f271cf7f535a8eeec03b0f80f0929c7a16116e2d2df089b41066de69b","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","7fa32887f8a97909fca35ebba3740f8caf8df146618d8fff957a3f89f67a2f6a","9a9634296cca836c3308923ba7aa094fa6ed76bb1e366d8ddcf5c65888ab1024",{"version":"bddce945d552a963c9733db106b17a25474eefcab7fc990157a2134ef55d4954","affectsGlobalScope":true},{"version":"7052b7b0c3829df3b4985bab2fd74531074b4835d5a7b263b75c82f0916ad62f","affectsGlobalScope":true},"aa34c3aa493d1c699601027c441b9664547c3024f9dbab1639df7701d63d18fa","4b55240c2a03b2c71e98a7fc528b16136faa762211c92e781a01c37821915ea6","7c651f8dce91a927ab62925e73f190763574c46098f2b11fb8ddc1b147a6709a","7440ab60f4cb031812940cc38166b8bb6fbf2540cfe599f87c41c08011f0c1df",{"version":"94c086dff8dbc5998749326bc69b520e8e4273fb5b7b58b50e0210e0885dfcde","affectsGlobalScope":true},{"version":"f5b5dc128973498b75f52b1b8c2d5f8629869104899733ae485100c2309b4c12","affectsGlobalScope":true},"ebe5facd12fd7745cda5f4bc3319f91fb29dc1f96e57e9c6f8b260a7cc5b67ee","79bad8541d5779c85e82a9fb119c1fe06af77a71cc40f869d62ad379473d4b75","21c56c6e8eeacef15f63f373a29fab6a2b36e4705be7a528aae8c51469e2737b",{"version":"629d20681ca284d9e38c0a019f647108f5fe02f9c59ac164d56f5694fc3faf4d","affectsGlobalScope":true},"e7dbf5716d76846c7522e910896c5747b6df1abd538fee8f5291bdc843461795",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a42be67ed1ddaec743582f41fc219db96a1b69719fccac6d1464321178d610fc","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4"],"root":[[57,62]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"emitDecoratorMetadata":true,"experimentalDecorators":true,"module":1,"noFallthroughCasesInSwitch":false,"noImplicitAny":false,"outDir":"./","removeComments":true,"skipLibCheck":true,"sourceMap":true,"strictBindCallApply":false,"strictNullChecks":false,"target":8},"fileIdsList":[[64,66],[63,64,65],[68],[104],[105,110,139],[106,117,118,125,136,147],[106,107,117,125],[108,148],[109,110,118,126],[110,136,144],[111,113,117,125],[104,112],[113,114],[117],[115,117],[104,117],[117,118,119,136,147],[117,118,119,132,136,139],[102,105,152],[113,117,120,125,136,147],[117,118,120,121,125,136,144,147],[120,122,136,144,147],[68,69,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154],[117,123],[124,147,152],[113,117,125,136],[126],[127],[104,128],[129,146,152],[130],[131],[117,132,133],[132,134,148,150],[105,117,136,137,138,139],[105,136,138],[136,137],[139],[140],[104,136],[117,142,143],[142,143],[110,125,136,144],[145],[125,146],[105,120,131,147],[110,148],[136,149],[124,150],[151],[105,110,117,119,128,136,147,150,152],[136,153],[156,195],[156,180,195],[195],[156],[156,181,195],[156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194],[181,195],[79,83,147],[79,136,147],[74],[76,79,144,147],[125,144],[155],[74,155],[76,79,125,147],[71,72,75,78,105,117,136,147],[71,77],[75,79,105,139,147,155],[105,155],[95,105,155],[73,74,155],[79],[73,74,75,76,77,78,79,80,81,83,84,85,86,87,88,89,90,91,92,93,94,96,97,98,99,100,101],[79,86,87],[77,79,87,88],[78],[71,74,79],[79,83,87,88],[83],[77,79,82,147],[71,76,77,79,83,86],[105,136],[74,79,95,105,152,155],[58,59,60,148],[57],[127,152],[58],[152]],"referencedMap":[[67,1],[66,2],[68,3],[69,3],[104,4],[105,5],[106,6],[107,7],[108,8],[109,9],[110,10],[111,11],[112,12],[113,13],[114,13],[116,14],[115,15],[117,16],[118,17],[119,18],[103,19],[120,20],[121,21],[122,22],[155,23],[123,24],[124,25],[125,26],[126,27],[127,28],[128,29],[129,30],[130,31],[131,32],[132,33],[133,33],[134,34],[136,35],[138,36],[137,37],[139,38],[140,39],[141,40],[142,41],[143,42],[144,43],[145,44],[146,45],[147,46],[148,47],[149,48],[150,49],[151,50],[152,51],[153,52],[180,53],[181,54],[156,55],[159,55],[178,53],[179,53],[169,53],[168,56],[166,53],[161,53],[174,53],[172,53],[176,53],[160,53],[173,53],[177,53],[162,53],[163,53],[175,53],[157,53],[164,53],[165,53],[167,53],[171,53],[182,57],[170,53],[158,53],[195,58],[189,57],[191,59],[190,57],[183,57],[184,57],[186,57],[188,57],[192,59],[193,59],[185,59],[187,59],[86,60],[93,61],[85,60],[100,62],[77,63],[76,64],[99,65],[94,66],[97,67],[79,68],[78,69],[74,70],[73,71],[96,72],[75,73],[80,74],[84,74],[102,75],[101,74],[88,76],[89,77],[91,78],[87,79],[90,80],[95,65],[82,81],[83,82],[92,83],[72,84],[98,85],[61,86],[58,87],[60,88],[59,89],[62,90]],"exportedModulesMap":[[67,1],[66,2],[68,3],[69,3],[104,4],[105,5],[106,6],[107,7],[108,8],[109,9],[110,10],[111,11],[112,12],[113,13],[114,13],[116,14],[115,15],[117,16],[118,17],[119,18],[103,19],[120,20],[121,21],[122,22],[155,23],[123,24],[124,25],[125,26],[126,27],[127,28],[128,29],[129,30],[130,31],[131,32],[132,33],[133,33],[134,34],[136,35],[138,36],[137,37],[139,38],[140,39],[141,40],[142,41],[143,42],[144,43],[145,44],[146,45],[147,46],[148,47],[149,48],[150,49],[151,50],[152,51],[153,52],[180,53],[181,54],[156,55],[159,55],[178,53],[179,53],[169,53],[168,56],[166,53],[161,53],[174,53],[172,53],[176,53],[160,53],[173,53],[177,53],[162,53],[163,53],[175,53],[157,53],[164,53],[165,53],[167,53],[171,53],[182,57],[170,53],[158,53],[195,58],[189,57],[191,59],[190,57],[183,57],[184,57],[186,57],[188,57],[192,59],[193,59],[185,59],[187,59],[86,60],[93,61],[85,60],[100,62],[77,63],[76,64],[99,65],[94,66],[97,67],[79,68],[78,69],[74,70],[73,71],[96,72],[75,73],[80,74],[84,74],[102,75],[101,74],[88,76],[89,77],[91,78],[87,79],[90,80],[95,65],[82,81],[83,82],[92,83],[72,84],[98,85],[61,86],[58,87],[60,88],[59,89],[62,90]]},"version":"5.4.5"}
@@ -0,0 +1,5 @@
1
+ export declare const startWorker: <P>(workerData: {
2
+ workerCode: string;
3
+ workerParams: P[];
4
+ workerModules: string[];
5
+ }) => Promise<any>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startWorker = void 0;
4
+ const path = require("node:path");
5
+ const node_worker_threads_1 = require("node:worker_threads");
6
+ const workerPath = path.join(__dirname, 'worker.js');
7
+ const startWorker = (workerData) => new Promise((resolve, reject) => {
8
+ const worker = new node_worker_threads_1.Worker(workerPath, {
9
+ workerData,
10
+ });
11
+ let finished = false;
12
+ worker.once('message', ({ errMessage, data }) => {
13
+ finished = true;
14
+ if (errMessage)
15
+ reject(new Error(`Thread ${errMessage}`));
16
+ else
17
+ resolve(data);
18
+ });
19
+ worker.once('error', reject);
20
+ worker.once('exit', () => {
21
+ if (!finished) {
22
+ finished = true;
23
+ resolve();
24
+ }
25
+ });
26
+ });
27
+ exports.startWorker = startWorker;
28
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/worker/executor.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,6DAA6C;AAE7C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAO9C,MAAM,WAAW,GAAG,CAAI,UAI9B,EAAgB,EAAE,CACjB,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IACpC,MAAM,MAAM,GAAG,IAAI,4BAAM,CAAC,UAAU,EAAE;QACpC,UAAU;KACX,CAAC,CAAC;IAEH,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,QAAQ,GAAG,IAAI,CAAC;QAEhB,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,UAAU,EAAE,CAAC,CAAC,CAAC;;YACrD,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE7B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;QACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AA3BQ,QAAA,WAAW,eA2BnB"}
@@ -0,0 +1,6 @@
1
+ import { TaskFunction } from '../models';
2
+ export declare const createWorker: <T, P>(task: TaskFunction<T>, params: P[], modules: string[]) => {
3
+ workerCode: string;
4
+ workerParams: P[];
5
+ workerModules: string[];
6
+ };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWorker = void 0;
4
+ const generateWorkerCode = (func) => `
5
+ (async () => {
6
+ const { parentPort, workerData } = await import('worker_threads');
7
+
8
+ async function loadModules(moduleNames) {
9
+ const modules = {};
10
+ for (const moduleName of moduleNames) {
11
+ modules[moduleName] = await import(moduleName);
12
+ }
13
+ return modules;
14
+ }
15
+
16
+ try {
17
+ const task = ${func};
18
+ const res = workerData.workerModules.length > 0
19
+ ? task(await loadModules(workerData.workerModules), ...workerData.workerParams)
20
+ : task(...workerData.workerParams);
21
+
22
+ const data = (res instanceof Promise) ? await res : res;
23
+ parentPort.postMessage({ data });
24
+ } catch(err) {
25
+ parentPort.postMessage({ errMessage: err.toString() });
26
+ }
27
+ })();
28
+ `;
29
+ const createWorker = (task, params, modules) => ({
30
+ workerCode: generateWorkerCode(task.toString()),
31
+ workerParams: params,
32
+ workerModules: modules,
33
+ });
34
+ exports.createWorker = createWorker;
35
+ //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../src/worker/skeleton.ts"],"names":[],"mappings":";;;AAOA,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC;;;;;;;;;;;;;qBAahC,IAAI;;;;;;;;;;;CAWxB,CAAC;AASK,MAAM,YAAY,GAAG,CAC1B,IAAqB,EACrB,MAAW,EACX,OAAiB,EACjB,EAAE,CAAC,CAAC;IACJ,UAAU,EAAE,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC/C,YAAY,EAAE,MAAM;IACpB,aAAa,EAAE,OAAO;CACvB,CAAC,CAAC;AARU,QAAA,YAAY,gBAQtB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_worker_threads_1 = require("node:worker_threads");
4
+ const { workerCode } = node_worker_threads_1.workerData;
5
+ eval(workerCode);
6
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/worker/worker.ts"],"names":[],"mappings":";;AAAA,6DAAiD;AAEjD,MAAM,EAAE,UAAU,EAAE,GAAG,gCAAU,CAAC;AAMlC,IAAI,CAAC,UAAU,CAAC,CAAC"}
package/nest-cli.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/nest-cli",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "compilerOptions": {
6
+ "deleteOutDir": true
7
+ }
8
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "nestworker",
3
+ "version": "1.1.0",
4
+ "description": "A lightweight tool built on top of Node.js worker_threads, enabling multithreading.",
5
+ "author": "Vahe Hakobyan",
6
+ "private": false,
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "prebuild": "rimraf dist",
10
+ "build": "nest build",
11
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
12
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
13
+ "prepublish": "npm run build"
14
+ },
15
+ "main": "dist/main.js",
16
+ "types": "dist/main.d.ts",
17
+ "engines": {
18
+ "node": ">=14.17.0"
19
+ },
20
+ "keywords": [
21
+ "nestjs",
22
+ "typescript",
23
+ "node",
24
+ "express",
25
+ "worker",
26
+ "workers",
27
+ "thread",
28
+ "worker_threads",
29
+ "multithreading"
30
+ ],
31
+ "bugs": {
32
+ "url": "https://github.com/VaheHak/nestworker/issues"
33
+ },
34
+ "homepage": "https://github.com/VaheHak/nestworker#readme",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/VaheHak/nestworker.git"
38
+ },
39
+ "dependencies": {
40
+ "@nestjs/common": "10.3.8"
41
+ },
42
+ "devDependencies": {
43
+ "@nestjs/cli": "10.3.2",
44
+ "@types/node": "^20.3.1",
45
+ "@typescript-eslint/eslint-plugin": "7.7.1",
46
+ "@typescript-eslint/parser": "7.7.1",
47
+ "eslint": "8.57.0",
48
+ "eslint-config-prettier": "9.1.0",
49
+ "eslint-plugin-prettier": "5.1.3",
50
+ "prettier": "3.2.5",
51
+ "ts-node": "10.9.2",
52
+ "tsconfig-paths": "^4.2.0",
53
+ "typescript": "5.4.5"
54
+ }
55
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts", "examples"]
4
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "target": "ES2021",
10
+ "sourceMap": true,
11
+ "outDir": "./dist",
12
+ "baseUrl": "./",
13
+ "incremental": true,
14
+ "skipLibCheck": true,
15
+ "strictNullChecks": false,
16
+ "noImplicitAny": false,
17
+ "strictBindCallApply": false,
18
+ "forceConsistentCasingInFileNames": false,
19
+ "noFallthroughCasesInSwitch": false
20
+ },
21
+ "exclude": [
22
+ "node_modules",
23
+ "dist"
24
+ ],
25
+ }