@atlaspack/workers 2.14.5-canary.17 → 2.14.5-canary.171
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/CHANGELOG.md +210 -0
- package/index.d.ts +96 -3
- package/lib/Handle.js +0 -3
- package/lib/Worker.js +7 -1
- package/lib/WorkerFarm.js +15 -7
- package/lib/backend.js +5 -1
- package/lib/bus.js +1 -1
- package/lib/child.js +11 -4
- package/lib/cpuCount.js +6 -2
- package/lib/process/ProcessChild.js +6 -1
- package/lib/process/ProcessWorker.js +9 -2
- package/lib/threads/ThreadsChild.js +3 -0
- package/lib/threads/ThreadsWorker.js +10 -2
- package/lib/types/Handle.d.ts +19 -0
- package/lib/types/Worker.d.ts +40 -0
- package/lib/types/WorkerFarm.d.ts +93 -0
- package/lib/types/backend.d.ts +4 -0
- package/lib/types/bus.d.ts +6 -0
- package/lib/types/child.d.ts +43 -0
- package/lib/types/childState.d.ts +3 -0
- package/lib/types/cpuCount.d.ts +2 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/process/ProcessChild.d.ts +9 -0
- package/lib/types/process/ProcessWorker.d.ts +16 -0
- package/lib/types/threads/ThreadsChild.d.ts +8 -0
- package/lib/types/threads/ThreadsWorker.d.ts +15 -0
- package/lib/types/types.d.ts +52 -0
- package/lib/types/web/WebChild.d.ts +8 -0
- package/lib/types/web/WebWorker.d.ts +15 -0
- package/lib/web/WebChild.js +6 -1
- package/lib/web/WebWorker.js +20 -4
- package/package.json +15 -18
- package/src/{Handle.js → Handle.ts} +11 -11
- package/src/{Worker.js → Worker.ts} +66 -54
- package/src/{WorkerFarm.js → WorkerFarm.ts} +196 -141
- package/src/{backend.js → backend.ts} +6 -3
- package/src/{bus.js → bus.ts} +2 -3
- package/src/{child.js → child.ts} +55 -43
- package/src/{childState.js → childState.ts} +1 -2
- package/src/{cpuCount.js → cpuCount.ts} +10 -7
- package/src/{index.js → index.ts} +0 -1
- package/src/process/{ProcessChild.js → ProcessChild.ts} +5 -3
- package/src/process/{ProcessWorker.js → ProcessWorker.ts} +10 -7
- package/src/threads/{ThreadsChild.js → ThreadsChild.ts} +2 -2
- package/src/threads/{ThreadsWorker.js → ThreadsWorker.ts} +14 -8
- package/src/{types.js → types.ts} +34 -35
- package/src/web/{WebChild.js → WebChild.ts} +6 -2
- package/src/web/{WebWorker.js → WebWorker.ts} +19 -7
- package/test/{cpuCount.test.js → cpuCount.test.ts} +0 -1
- package/test/{workerfarm.test.cjs → workerfarm.test.js} +9 -2
- package/tsconfig.json +4 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// NOTE: @atlaspack/logger exports object instances from the module.
|
|
2
2
|
// If there are issues, check all imports are using the same module instance/path
|
|
3
|
+
//
|
|
4
|
+
// NOTE2: @atlaspack/babel-register needs to run on the fixtures under ./integration
|
|
5
|
+
// otherwise the fixtures will import "package.json#main" files rather than "package.json#source"
|
|
3
6
|
const Logger = require('@atlaspack/logger').default;
|
|
4
7
|
const assert = require('assert');
|
|
5
|
-
|
|
6
|
-
const WorkerFarm = require('@atlaspack/workers').default;
|
|
8
|
+
const WorkerFarm = require('../src/index.ts').default;
|
|
7
9
|
|
|
8
10
|
describe('WorkerFarm', function () {
|
|
9
11
|
this.timeout(30000);
|
|
@@ -292,6 +294,7 @@ describe('WorkerFarm', function () {
|
|
|
292
294
|
await dispose();
|
|
293
295
|
result = await workerfarm.run(ref);
|
|
294
296
|
assert.equal(result, 'Shared reference does not exist');
|
|
297
|
+
await workerfarm.end();
|
|
295
298
|
});
|
|
296
299
|
|
|
297
300
|
it('Should resolve shared references in workers', async () => {
|
|
@@ -311,6 +314,7 @@ describe('WorkerFarm', function () {
|
|
|
311
314
|
|
|
312
315
|
await dispose();
|
|
313
316
|
assert(workerfarm.workerApi.resolveSharedReference(sharedValue) == null);
|
|
317
|
+
await workerfarm.end();
|
|
314
318
|
});
|
|
315
319
|
|
|
316
320
|
it('Should support shared references in local worker', async () => {
|
|
@@ -329,6 +333,7 @@ describe('WorkerFarm', function () {
|
|
|
329
333
|
await dispose();
|
|
330
334
|
result = await workerfarm.run(ref);
|
|
331
335
|
assert.equal(result, 'Shared reference does not exist');
|
|
336
|
+
await workerfarm.end();
|
|
332
337
|
});
|
|
333
338
|
|
|
334
339
|
it('should resolve shared references in local worker', async () => {
|
|
@@ -348,6 +353,7 @@ describe('WorkerFarm', function () {
|
|
|
348
353
|
|
|
349
354
|
await dispose();
|
|
350
355
|
assert(workerfarm.workerApi.resolveSharedReference(sharedValue) == null);
|
|
356
|
+
await workerfarm.end();
|
|
351
357
|
});
|
|
352
358
|
|
|
353
359
|
it('Should dispose of shared references when ending', async () => {
|
|
@@ -361,5 +367,6 @@ describe('WorkerFarm', function () {
|
|
|
361
367
|
assert.equal(workerfarm.sharedReferences.size, 1);
|
|
362
368
|
await workerfarm.end();
|
|
363
369
|
assert.equal(workerfarm.sharedReferences.size, 0);
|
|
370
|
+
await workerfarm.end();
|
|
364
371
|
});
|
|
365
372
|
});
|
package/tsconfig.json
ADDED