Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"problemMatcher": [],
"label": "npm: build",
"detail": "pwsh -Command \"npx tsc && copy src/workers.d.ts dist/\""
"detail": "Build package"
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"types": "dist/index.d.ts",
"main": "dist/index.js",
"scripts": {
"build": "pwsh -Command \"npx tsc && copy src/workers.d.ts dist/\"",
"build": "npx tsc",
"postbuild": "publint",
"deploy-pages": "cd ./pages && npm run deploy-pages",
"test": "npm run test:unit && npm run test:types",
Expand Down
2 changes: 1 addition & 1 deletion src/cancellation/CancellationSource.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Event } from "../sync/Event.js";
import { cancellationSourceIdentityData } from "../sync/identifiers.js";
import { isSignaled } from "../sync/ManualResetEvent.js";
import type { Token } from "../workers.js";
import type { Token } from "../types.js";
import { TaskCancelledError } from "./TaskCancelledError.js";

/**
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './workers/AsyncWorker.js';
export * from "./workers/workerListener.js";
export * from './workers/WorkerTerminatedMessage.js';
export * from "./workers/WorkItem.js";
export type * from "./types.js";
2 changes: 1 addition & 1 deletion src/sync/AutoResetEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.js";
import type { Token } from "../types.js";
import { Event } from "./Event.js";
import { autoResetEventIdentityData, checkToken } from "./identifiers.js";

Expand Down
2 changes: 1 addition & 1 deletion src/sync/ManualResetEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.js";
import type { Token } from "../types.js";
import { Event } from './Event.js';
import { checkToken, manualResetEventIdentityData, type IdentifierData } from "./identifiers.js";

Expand Down
2 changes: 1 addition & 1 deletion src/sync/Mutex.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.d.ts";
import type { Token } from "../types.js";
import { mutexIdentityData } from "./identifiers.js";
import { acquire, acquireAsync, SemaphoreInternal, type Releaser } from "./Semaphore.js";

Expand Down
2 changes: 1 addition & 1 deletion src/sync/Semaphore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.js";
import type { Token } from "../types.js";
import { checkToken, semaphoreIdentityData, type IdentifierData } from "./identifiers.js";
import { SyncObject } from "./SyncObject.js";

Expand Down
2 changes: 1 addition & 1 deletion src/sync/SyncObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.d.ts";
import type { Token } from "../types.js";

/**
* Base class for synchronization objects.
Expand Down
2 changes: 1 addition & 1 deletion src/sync/identifiers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Token } from "../workers.d.ts";
import type { Token } from "../types.js";

export type IdentifierData = [
number,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/workers/AsyncWorker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Queue } from "../misc/Queue.js";
import { nextWorkItemId } from "../misc/nextWorkItemId.js";
import type { IWorker, QueueingOptions, RejectFn, WorkerTasks, WorkItemData } from "../workers.js";
import type { IWorker, QueueingOptions, RejectFn, WorkerTasks, WorkItemData } from "../types.js";
import { InternalSharedWorker } from "./InternalSharedWorker.js";
import { InternalWorker } from "./InternalWorker.js";
import { WorkItem } from "./WorkItem.js";
Expand Down
2 changes: 1 addition & 1 deletion src/workers/InternalSharedWorker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CancelledMessage } from "../cancellation/CancelledMessage.js";
import type { AsyncMessageUntyped, AsyncResponse, DisconnectFn, IWorker, ProcessMessageFn, RejectFn, TaskCancelledMessage } from "../workers.js";
import type { AsyncMessageUntyped, AsyncResponse, DisconnectFn, IWorker, ProcessMessageFn, RejectFn, TaskCancelledMessage } from "../types.js";

function isTaskCancelledMessage(message: any): message is TaskCancelledMessage {
return message?.payload?._$cancelled === true && typeof message.workItemId === 'number';
Expand Down
2 changes: 1 addition & 1 deletion src/workers/InternalWorker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CancelledMessage } from "../cancellation/CancelledMessage.js";
import type { AsyncMessageUntyped, AsyncResponse, DisconnectFn, IWorker, ProcessMessageFn, RejectFn, TaskCancelledMessage } from "../workers.js";
import type { AsyncMessageUntyped, AsyncResponse, DisconnectFn, IWorker, ProcessMessageFn, RejectFn, TaskCancelledMessage } from "../types.js";
import { WorkerTerminatedMessage } from "./WorkerTerminatedMessage.js";

function isTaskCancelledMessage(message: any): message is TaskCancelledMessage {
Expand Down
2 changes: 1 addition & 1 deletion src/workers/WorkItemInternal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CancellationSource } from "../cancellation/CancellationSource.js";
import { CancelledMessage } from "../cancellation/CancelledMessage.js";
import type { AsyncMessageUntyped, DisconnectFn, IWorker, QueueingOptions, WorkItemData } from "../workers.js";
import type { AsyncMessageUntyped, DisconnectFn, IWorker, QueueingOptions, WorkItemData } from "../types.js";
import { WorkItemStatus, type WorkItemStatusEnum } from "./AsyncWorker.js";
import { WorkerTerminatedMessage } from "./WorkerTerminatedMessage.js";

Expand Down
2 changes: 1 addition & 1 deletion src/workers/workerListener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TaskCancelledError } from "../cancellation/TaskCancelledError.js";
import type { AsyncMessageUntyped, AsyncResponse } from "../workers.d.ts";
import type { AsyncMessageUntyped, AsyncResponse } from "../types.js";

/**
* Defines the function provided to worker tasks so workers can communicate back to the calling thread.
Expand Down
2 changes: 1 addition & 1 deletion tests/typetests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "tstyche";
import type { Token, WorkerTasks, AsyncMessage, QueueingOptions } from "../../src/workers.js";
import type { Token, WorkerTasks, AsyncMessage, QueueingOptions } from "../../src/types.js";
import { CancellationSource } from "../../src/cancellation/CancellationSource.js";
import { TaskCancelledError } from "../../src/cancellation/TaskCancelledError.js";
import { Queue } from "../../src/misc/Queue.js";
Expand Down
2 changes: 1 addition & 1 deletion tests/ut/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sinon } from "../../setup.js";
import Worker from 'web-worker';
import type { Token } from "../../../src/workers.js";
import type { Token } from "../../../src/types.js";
import { SyncObject } from "../../../src/sync/SyncObject.js";

export type StubbedAtomics = {
Expand Down
2 changes: 1 addition & 1 deletion tests/ut/workers/WorkItem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WorkItemInternal } from '../../../src/workers/WorkItemInternal.js';
import { WorkItemStatus } from '../../../src/workers/AsyncWorker.js';
import { CancelledMessage } from '../../../src/cancellation/CancelledMessage.js';
import { CancellationSource } from '../../../src/cancellation/CancellationSource.js';
import { WorkItemData, IWorker } from '../../../src/workers.js';
import type { WorkItemData, IWorker } from '../../../src/types.js';

describe('WorkItem', () => {
let workItem: WorkItem<string>;
Expand Down