Skip to content

Commit 09ee60c

Browse files
committed
WIP - this commit does not work, threadsjs is likely needs to be incorporated into our libraries and rewritten
1 parent 303b926 commit 09ee60c

12 files changed

+223
-33
lines changed

package-lock.json

+131-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"@matrixai/async-init": "^2.0.0",
4141
"@matrixai/errors": "^2.0.1",
4242
"@matrixai/logger": "^4.0.1",
43-
"threads": "^1.7.0"
43+
"threads": "^1.7.0",
44+
"ts-node": "^10.9.1"
4445
},
4546
"devDependencies": {
4647
"@swc/core": "^1.3.76",

src/WorkerManager.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import type { ModuleThread } from 'threads';
2-
import type { ModuleMethods } from 'threads/dist/types/master';
31
import type WorkerManagerInterface from './WorkerManagerInterface.js';
4-
import type { QueuedTask } from 'threads/dist/master/pool-types';
5-
import { Pool } from 'threads';
2+
import type {
3+
ModuleMethods,
4+
ModuleThread,
5+
QueuedTask,
6+
} from './types.js';
67
import Logger from '@matrixai/logger';
78
import { CreateDestroy, ready } from '@matrixai/async-init/CreateDestroy.js';
9+
import { Pool } from 'threads';
810
import * as errors from './errors.js';
911

12+
1013
@CreateDestroy()
1114
class WorkerManager<W extends ModuleMethods>
1215
implements WorkerManagerInterface<W>

src/WorkerManagerInterface.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import type { ModuleThread } from 'threads';
2-
import type { ModuleMethods } from 'threads/dist/types/master';
3-
import type { QueuedTask } from 'threads/dist/master/pool-types';
1+
import type {
2+
ModuleMethods,
3+
ModuleThread,
4+
QueuedTask,
5+
} from './types.js';
46

57
interface WorkerManagerInterface<W extends ModuleMethods> {
68
destroy(options?: { force?: boolean }): Promise<void>;

src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export { default as workerModule } from './workerModule.js';
33
export * as errors from './errors.js';
44

55
export type { default as WorkerManagerInterface } from './WorkerManagerInterface.js';
6-
export type { WorkerModule } from './workerModule.js';
6+
// export type { WorkerModule } from './workerModule.js';
7+
export type { ModuleMethods, ModuleThread, QueuedTask } from './types.js';

src/worker.ts renamed to src/oldworker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ import worker from '../src/workerModule.js';
66

77
expose(worker);
88

9-
export type { WorkerModule } from '../src/workerModule.js';
9+
export type { WorkerModule } from '../src/oldworkerModule.js';
File renamed without changes.

0 commit comments

Comments
 (0)