@danielsimonjr/mathts-matrix 0.3.0 → 0.3.2
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.
- package/dist/index.d.ts +2 -92
- package/package.json +16 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as workerpool from 'workerpool';
|
|
2
2
|
import { ComputePool, ComputePoolConfig } from '@danielsimonjr/mathts-parallel';
|
|
3
3
|
import { GPUContextOptions, GPUCapabilities, GPUContext, BufferPool, ShaderManager } from '@danielsimonjr/mathts-gpu';
|
|
4
4
|
export { BufferPool, GPUCapabilities, GPUContext, GPUContextOptions, ShaderManager, destroyGlobalGPU, detectGPUCapabilities, getGlobalGPUContext, getRecommendedWorkgroupSize, hasWebGPU } from '@danielsimonjr/mathts-gpu';
|
|
@@ -857,96 +857,6 @@ declare class JSBackend implements MatrixBackend {
|
|
|
857
857
|
*/
|
|
858
858
|
declare const jsBackend: JSBackend;
|
|
859
859
|
|
|
860
|
-
/**
|
|
861
|
-
* Stub type declarations for workerpool.
|
|
862
|
-
* The actual workerpool package ships raw .ts sources without pre-built .d.ts files.
|
|
863
|
-
* This stub prevents TypeScript from diving into the raw source during type-checking.
|
|
864
|
-
*/
|
|
865
|
-
declare module 'workerpool' {
|
|
866
|
-
export interface ExecOptions<T = unknown> {
|
|
867
|
-
on?: (payload: unknown) => void;
|
|
868
|
-
transfer?: Transferable[];
|
|
869
|
-
metadata?: T;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
export interface PoolStats {
|
|
873
|
-
totalWorkers: number;
|
|
874
|
-
busyWorkers: number;
|
|
875
|
-
idleWorkers: number;
|
|
876
|
-
pendingTasks: number;
|
|
877
|
-
activeTasks: number;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
export interface PoolOptions {
|
|
881
|
-
minWorkers?: number | 'max';
|
|
882
|
-
maxWorkers?: number;
|
|
883
|
-
maxQueueSize?: number;
|
|
884
|
-
workerType?: 'auto' | 'web' | 'process' | 'thread';
|
|
885
|
-
queueStrategy?: 'fifo' | 'lifo';
|
|
886
|
-
script?: string;
|
|
887
|
-
workerTerminateTimeout?: number;
|
|
888
|
-
forkArgs?: string[];
|
|
889
|
-
forkOpts?: Record<string, unknown>;
|
|
890
|
-
workerOpts?: Record<string, unknown>;
|
|
891
|
-
workerThreadOpts?: Record<string, unknown>;
|
|
892
|
-
emitStdStreams?: boolean;
|
|
893
|
-
onCreateWorker?: (arg: Record<string, unknown>) => Record<string, unknown> | void;
|
|
894
|
-
onTerminateWorker?: (arg: Record<string, unknown>) => void;
|
|
895
|
-
debugPortStart?: number;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
export interface WorkerpoolPromise<T> extends Promise<T> {
|
|
899
|
-
readonly resolved: boolean;
|
|
900
|
-
readonly rejected: boolean;
|
|
901
|
-
readonly pending: boolean;
|
|
902
|
-
cancel(): this;
|
|
903
|
-
timeout(delay: number): this;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
export type WorkerProxy<T extends Record<string, (...args: unknown[]) => unknown>> = {
|
|
907
|
-
[K in keyof T]: (...args: Parameters<T[K]>) => WorkerpoolPromise<ReturnType<T[K]>>;
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
export class Pool {
|
|
911
|
-
constructor(script?: string | PoolOptions, options?: PoolOptions);
|
|
912
|
-
exec<T>(
|
|
913
|
-
method: string | ((...args: unknown[]) => T),
|
|
914
|
-
params?: unknown[],
|
|
915
|
-
options?: ExecOptions
|
|
916
|
-
): WorkerpoolPromise<T>;
|
|
917
|
-
proxy<T extends Record<string, (...args: unknown[]) => unknown>>(): Promise<WorkerProxy<T>>;
|
|
918
|
-
stats(): PoolStats;
|
|
919
|
-
terminate(force?: boolean, timeout?: number): Promise<void>;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
export interface TransferDescriptor<T = unknown> {
|
|
923
|
-
message: T;
|
|
924
|
-
transfer: Transferable[];
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
export class Transfer<T = unknown> {
|
|
928
|
-
message: T;
|
|
929
|
-
transfer: Transferable[];
|
|
930
|
-
constructor(message: T, transfer: Transferable[]);
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
export class CancellationError extends Error {}
|
|
934
|
-
export class TimeoutError extends Error {}
|
|
935
|
-
export class TerminateError extends Error {}
|
|
936
|
-
|
|
937
|
-
export function pool(script?: string | PoolOptions, options?: PoolOptions): Pool;
|
|
938
|
-
|
|
939
|
-
export function worker(
|
|
940
|
-
methods?: Record<string, (...args: unknown[]) => unknown>,
|
|
941
|
-
options?: {
|
|
942
|
-
onTerminate?: (code: number | undefined) => void | PromiseLike<void>;
|
|
943
|
-
abortListenerTimeout?: number;
|
|
944
|
-
}
|
|
945
|
-
): void;
|
|
946
|
-
|
|
947
|
-
export function workerEmit(payload: unknown): void;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
860
|
/**
|
|
951
861
|
* Configuration for ParallelBackend
|
|
952
862
|
*/
|
|
@@ -1053,7 +963,7 @@ declare class ParallelBackend {
|
|
|
1053
963
|
/**
|
|
1054
964
|
* Get pool statistics
|
|
1055
965
|
*/
|
|
1056
|
-
getStats():
|
|
966
|
+
getStats(): workerpool.PoolStats;
|
|
1057
967
|
private checkDimensionsMatch;
|
|
1058
968
|
private checkMultiplyDimensions;
|
|
1059
969
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-matrix",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Matrix operations for MathTS with WASM/WebGPU backend support",
|
|
5
5
|
"author": "Daniel Simon Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "tsup src/index.ts --format esm --dts --clean && node scripts/copy-wasm.mjs
|
|
22
|
+
"build": "tsup src/index.ts --format esm --dts --clean && node scripts/copy-wasm.mjs",
|
|
23
23
|
"copy:wasm": "node scripts/copy-wasm.mjs",
|
|
24
24
|
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
25
25
|
"test": "vitest run",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"lint": "eslint src --ext .ts",
|
|
30
30
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
31
31
|
"clean": "rm -rf dist",
|
|
32
|
-
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake && node scripts/copy-wasm.mjs
|
|
32
|
+
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake && node scripts/copy-wasm.mjs"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@danielsimonjr/mathts-core": "^0.6.0",
|
|
36
|
-
"@danielsimonjr/mathts-gpu": "^0.1.
|
|
37
|
-
"@danielsimonjr/mathts-parallel": "^0.3.
|
|
38
|
-
"@webgpu/types": "^0.1.67"
|
|
36
|
+
"@danielsimonjr/mathts-gpu": "^0.1.1",
|
|
37
|
+
"@danielsimonjr/mathts-parallel": "^0.3.4"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"@types/node": "^25.5.2",
|
|
42
41
|
"tsup": "^8.0.0",
|
|
43
42
|
"typescript": "^5.3.0",
|
|
44
|
-
"vitest": "^4.1.5"
|
|
43
|
+
"vitest": "^4.1.5",
|
|
44
|
+
"@webgpu/types": "^0.1.67"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -58,5 +58,13 @@
|
|
|
58
58
|
"typescript",
|
|
59
59
|
"wasm",
|
|
60
60
|
"webgpu"
|
|
61
|
-
]
|
|
61
|
+
],
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@webgpu/types": "^0.1.67"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"@webgpu/types": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
62
70
|
}
|