Skip to content

Commit

Permalink
feat: allow named export usage
Browse files Browse the repository at this point in the history
The main exports of the package are now available both as named exports
from the package as well as the previously available properties from
the default export. This removes the requirement to use the `esModuleInterop`
TypeScript option but retains backward compatiblity for existing usage.
  • Loading branch information
clydin committed Feb 20, 2024
1 parent 436b6ce commit 1b20470
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ class ThreadPool {
}
}

class Piscina extends EventEmitterAsyncResource {
export default class Piscina extends EventEmitterAsyncResource {
#pool : ThreadPool;

constructor (options : Options = {}) {
Expand Down Expand Up @@ -1346,4 +1346,14 @@ class Piscina extends EventEmitterAsyncResource {
static get queueOptionsSymbol () { return kQueueOptions; }
}

export = Piscina;
export const move = Piscina.move;
export const isWorkerThread = Piscina.isWorkerThread;
export const workerData = Piscina.workerData;

export {
Piscina,
kTransferable as transferableSymbol,
kValue as valueSymbol,
kQueueOptions as queueOptionsSymbol,
version,
}

0 comments on commit 1b20470

Please sign in to comment.