@xylabs/threads 3.5.1 → 3.5.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.
Files changed (123) hide show
  1. package/dist/common.js +3 -5
  2. package/{dist-esm → dist/esm}/common.js +0 -1
  3. package/{dist-esm → dist/esm}/index.js +0 -1
  4. package/{dist-esm → dist/esm}/master/get-bundle-url.browser.js +0 -2
  5. package/{dist-esm → dist/esm}/master/implementation.browser.js +1 -5
  6. package/{dist-esm → dist/esm}/master/implementation.js +0 -8
  7. package/{dist-esm → dist/esm}/master/implementation.node.js +0 -26
  8. package/{dist-esm → dist/esm}/master/index.js +0 -2
  9. package/{dist-esm → dist/esm}/master/invocation-proxy.js +0 -8
  10. package/{dist-esm → dist/esm}/master/pool-types.js +0 -1
  11. package/{dist-esm → dist/esm}/master/pool.js +2 -21
  12. package/{dist-esm → dist/esm}/master/register.js +0 -1
  13. package/{dist-esm → dist/esm}/master/spawn.js +0 -13
  14. package/{dist-esm → dist/esm}/master/thread.js +0 -4
  15. package/{dist-esm → dist/esm}/observable-promise.js +0 -24
  16. package/{dist-esm → dist/esm}/observable.js +0 -10
  17. package/{dist-esm → dist/esm}/ponyfills.js +0 -1
  18. package/{dist-esm → dist/esm}/promise.js +0 -5
  19. package/{dist-esm → dist/esm}/transferable.js +0 -2
  20. package/{dist-esm → dist/esm}/types/master.js +0 -4
  21. package/{dist-esm → dist/esm}/types/messages.js +0 -4
  22. package/{dist-esm → dist/esm}/worker/bundle-entry.js +0 -1
  23. package/{dist-esm → dist/esm}/worker/implementation.browser.js +0 -4
  24. package/{dist-esm → dist/esm}/worker/implementation.js +0 -5
  25. package/{dist-esm → dist/esm}/worker/implementation.tiny-worker.js +0 -7
  26. package/{dist-esm → dist/esm}/worker/implementation.worker_threads.js +0 -1
  27. package/{dist-esm → dist/esm}/worker/index.js +0 -19
  28. package/{dist-esm → dist/esm}/worker_threads.js +0 -4
  29. package/dist/index.js +0 -1
  30. package/dist/master/get-bundle-url.browser.js +2 -5
  31. package/dist/master/implementation.browser.js +4 -8
  32. package/dist/master/implementation.d.ts +0 -2
  33. package/dist/master/implementation.js +0 -8
  34. package/dist/master/implementation.node.d.ts +0 -1
  35. package/dist/master/implementation.node.js +3 -29
  36. package/dist/master/index.d.ts +0 -2
  37. package/dist/master/index.js +0 -2
  38. package/dist/master/invocation-proxy.js +2 -11
  39. package/dist/master/pool-types.d.ts +0 -14
  40. package/dist/master/pool-types.js +0 -1
  41. package/dist/master/pool.d.ts +0 -41
  42. package/dist/master/pool.js +2 -21
  43. package/dist/master/register.js +0 -1
  44. package/dist/master/spawn.d.ts +0 -9
  45. package/dist/master/spawn.js +1 -15
  46. package/dist/master/thread.d.ts +2 -6
  47. package/dist/master/thread.js +0 -4
  48. package/dist/observable-promise.d.ts +0 -13
  49. package/dist/observable-promise.js +0 -24
  50. package/dist/observable.d.ts +0 -9
  51. package/dist/observable.js +0 -10
  52. package/dist/ponyfills.js +1 -3
  53. package/dist/promise.d.ts +0 -4
  54. package/dist/promise.js +1 -7
  55. package/dist/serializers.js +2 -2
  56. package/dist/transferable.d.ts +0 -33
  57. package/dist/transferable.js +2 -5
  58. package/dist/types/master.d.ts +0 -14
  59. package/dist/types/master.js +0 -4
  60. package/dist/types/messages.js +0 -4
  61. package/dist/worker/bundle-entry.js +0 -1
  62. package/dist/worker/implementation.browser.d.ts +1 -2
  63. package/dist/worker/implementation.browser.js +0 -4
  64. package/dist/worker/implementation.js +0 -5
  65. package/dist/worker/implementation.tiny-worker.d.ts +1 -2
  66. package/dist/worker/implementation.tiny-worker.js +0 -7
  67. package/dist/worker/implementation.worker_threads.d.ts +1 -1
  68. package/dist/worker/implementation.worker_threads.js +0 -1
  69. package/dist/worker/index.d.ts +0 -8
  70. package/dist/worker/index.js +2 -21
  71. package/dist/worker_threads.js +1 -5
  72. package/index.mjs +0 -1
  73. package/observable.d.ts +0 -1
  74. package/observable.js +0 -2
  75. package/observable.mjs +0 -1
  76. package/package.json +16 -17
  77. package/register.d.ts +0 -2
  78. package/register.js +0 -2
  79. package/register.mjs +0 -1
  80. package/rollup.config.js +0 -1
  81. package/src/index.ts +0 -1
  82. package/src/master/pool.ts +2 -1
  83. package/src/master/spawn.ts +1 -2
  84. package/src/observable-promise.ts +1 -0
  85. package/src/worker/implementation.browser.ts +1 -1
  86. package/src/worker/implementation.tiny-worker.ts +1 -1
  87. package/src/worker/implementation.ts +1 -1
  88. package/src/worker/implementation.worker_threads.ts +1 -1
  89. package/src/worker/index.ts +1 -1
  90. package/src/worker_threads.ts +1 -1
  91. package/test/lib/serialization.ts +1 -1
  92. package/test/observable-promise.test.ts +0 -1
  93. package/test/observable.test.ts +1 -1
  94. package/test/pool.test.ts +3 -2
  95. package/test/serialization.test.ts +0 -1
  96. package/test/spawn.chromium.mocha.ts +0 -1
  97. package/test/spawn.test.ts +2 -3
  98. package/test/streaming.test.ts +0 -1
  99. package/test/transferables.test.ts +1 -1
  100. package/test/workers/arraybuffer-xor.ts +0 -1
  101. package/test/workers/count-to-five.ts +0 -1
  102. package/test/workers/counter.ts +0 -1
  103. package/test/workers/faulty-function.ts +0 -1
  104. package/test/workers/hello-world.ts +0 -1
  105. package/test/workers/increment.ts +0 -1
  106. package/test/workers/minmax.ts +0 -1
  107. package/test/workers/serialization.ts +1 -1
  108. package/test-tooling/rollup/app.js +0 -1
  109. package/test-tooling/rollup/rollup.config.ts +1 -1
  110. package/test-tooling/rollup/worker.js +2 -2
  111. package/test-tooling/tsconfig/minimal.ts +1 -1
  112. package/test-tooling/webpack/addition-worker.ts +0 -1
  113. package/test-tooling/webpack/app-with-inlined-worker.ts +3 -3
  114. package/test-tooling/webpack/app.ts +2 -2
  115. package/test-tooling/webpack/pool-worker.ts +0 -1
  116. package/test-tooling/webpack/webpack.node.config.js +0 -1
  117. package/test-tooling/webpack/webpack.web.config.js +0 -1
  118. package/worker.d.ts +0 -1
  119. package/worker.js +0 -2
  120. package/worker.mjs +0 -1
  121. /package/{dist-esm → dist/esm}/serializers.js +0 -0
  122. /package/{dist-esm → dist/esm}/symbols.js +0 -0
  123. /package/{dist-esm → dist/esm}/types/worker.js +0 -0
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable unicorn/no-thenable */
2
- /* eslint-disable @typescript-eslint/no-floating-promises */
2
+
3
3
  /* eslint-disable require-await */
4
4
  /* eslint-disable @typescript-eslint/member-ordering */
5
5
  /* eslint-disable unicorn/no-array-reduce */
6
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
7
7
  /* eslint-disable import/export */
8
8
  /* eslint-disable @typescript-eslint/no-namespace */
9
+ /* eslint-disable @typescript-eslint/no-floating-promises */
9
10
  import DebugLogger from 'debug'
10
11
  import { multicast, Observable, Subject } from 'observable-fns'
11
12
 
@@ -1,5 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-floating-promises */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/no-floating-promises */
3
3
  import DebugLogger from 'debug'
4
4
  import { Observable } from 'observable-fns'
5
5
 
@@ -124,7 +124,6 @@ function setPrivateThreadProps<T>(
124
124
  .filter((event) => event.type === WorkerEventType.internalError)
125
125
  .map((errorEvent) => (errorEvent as WorkerInternalErrorEvent).error)
126
126
 
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
127
  return Object.assign(raw as any, {
129
128
  [$errors]: workerErrors,
130
129
  [$events]: workerEvents,
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable unicorn/no-thenable */
2
2
  /* eslint-disable @typescript-eslint/member-ordering */
3
3
  /* eslint-disable @typescript-eslint/no-floating-promises */
4
+
4
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
6
  /* eslint-disable @typescript-eslint/no-this-alias */
6
7
  /* eslint-disable unicorn/no-this-assignment */
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-default-export */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  /// <reference lib="dom" />
4
3
  // tslint:disable no-shadowed-variable
@@ -33,6 +32,7 @@ const subscribeToMasterMessages: AbstractedWorkerAPI['subscribeToMasterMessages'
33
32
  return unsubscribe
34
33
  }
35
34
 
35
+ // eslint-disable-next-line import/no-default-export
36
36
  export default {
37
37
  isWorkerRuntime,
38
38
  postMessageToMaster,
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-default-export */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  /// <reference lib="dom" />
4
3
  // tslint:disable no-shadowed-variable
@@ -48,6 +47,7 @@ const subscribeToMasterMessages: AbstractedWorkerAPI['subscribeToMasterMessages'
48
47
  return unsubscribe
49
48
  }
50
49
 
50
+ // eslint-disable-next-line import/no-default-export
51
51
  export default {
52
52
  isWorkerRuntime,
53
53
  postMessageToMaster,
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-default-export */
2
1
  // tslint:disable no-var-requires
3
2
  /*
4
3
  * This file is only a stub to make './implementation' resolve to the right module.
@@ -20,4 +19,5 @@ function selectNodeImplementation(): AbstractedWorkerAPI {
20
19
  }
21
20
  }
22
21
 
22
+ // eslint-disable-next-line import/no-default-export
23
23
  export default runningInNode ? selectNodeImplementation() : WebWorkerImplementation
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-default-export */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  // tslint:disable no-shadowed-variable
4
3
  import { MessagePort } from 'node:worker_threads'
@@ -42,6 +41,7 @@ function testImplementation() {
42
41
  WorkerThreads()
43
42
  }
44
43
 
44
+ // eslint-disable-next-line import/no-default-export
45
45
  export default {
46
46
  isWorkerRuntime,
47
47
  postMessageToMaster,
@@ -1,5 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-floating-promises */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/no-floating-promises */
3
3
  import isSomeObservable from 'is-observable-2-1-0'
4
4
  import { Observable, Subscription } from 'observable-fns'
5
5
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-default-export */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  // Webpack hack
4
3
  // tslint:disable no-eval
@@ -20,6 +19,7 @@ function selectImplementation(): WorkerThreadsModule {
20
19
  return typeof __non_webpack_require__ === 'function' ? __non_webpack_require__('worker_threads') : eval('require')('worker_threads')
21
20
  }
22
21
 
22
+ // eslint-disable-next-line import/no-default-export
23
23
  export default function getImplementation(): WorkerThreadsModule {
24
24
  if (!implementation) {
25
25
  implementation = selectImplementation()
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable import/no-internal-modules */
2
+
3
3
  import { JsonSerializable, SerializerImplementation } from '../../src/index'
4
4
 
5
5
  export class Foo<T> {
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable import/no-internal-modules */
3
2
  import test from 'ava'
4
3
  import { Observable } from 'observable-fns'
5
4
 
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable require-await */
2
- /* eslint-disable import/no-internal-modules */
2
+
3
3
  import test from 'ava'
4
4
 
5
5
  import { Observable, Subject } from '../src/observable'
package/test/pool.test.ts CHANGED
@@ -1,7 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-floating-promises */
1
2
  /* eslint-disable require-await */
2
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable @typescript-eslint/no-floating-promises */
4
- /* eslint-disable import/no-internal-modules */
4
+
5
+ // eslint-disable import/no-internal-modules
5
6
  import test from 'ava'
6
7
 
7
8
  import { Pool, spawn, Worker } from '../src/index'
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import test from 'ava'
3
2
 
4
3
  import { registerSerializer, spawn, Thread, Worker } from '../src/index'
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable no-restricted-imports */
2
- /* eslint-disable import/no-internal-modules */
3
2
  /*
4
3
  * This code here will be run in a headless Chromium browser using `puppet-run`.
5
4
  * Check the package.json scripts `test:puppeteer:*`.
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable import/no-internal-modules */
4
3
  import test from 'ava'
5
4
  import { Observable } from 'observable-fns'
6
5
 
@@ -47,7 +46,7 @@ test('can spawn a module thread', async (t) => {
47
46
 
48
47
  test('thread job errors are handled', async (t) => {
49
48
  const fail = await spawn<() => Promise<never>>(new Worker('./workers/faulty-function'))
50
- await t.throwsAsync(fail(), null, 'I am supposed to fail.')
49
+ await t.throwsAsync(fail(), undefined, 'I am supposed to fail.')
51
50
  await Thread.terminate(fail)
52
51
  })
53
52
 
@@ -65,7 +64,7 @@ test('thread transfer errors are handled', async (t) => {
65
64
  })
66
65
 
67
66
  test('catches top-level thread errors', async (t) => {
68
- await t.throwsAsync(spawn(new Worker('./workers/top-level-throw')), null, 'Top-level worker error')
67
+ await t.throwsAsync(spawn(new Worker('./workers/top-level-throw')), undefined, 'Top-level worker error')
69
68
  })
70
69
 
71
70
  test.todo('can subscribe to thread events')
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import test from 'ava'
3
2
 
4
3
  import { spawn, Thread, Worker } from '../src/index'
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable import/no-internal-modules */
3
+
4
4
  import test from 'ava'
5
5
 
6
6
  import { spawn, Thread, Transfer, Worker } from '../src/index'
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose, Transfer } from '../../src/worker'
3
2
 
4
3
  function xor(buffer: ArrayBuffer, value: number) {
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { Observable } from 'observable-fns'
3
2
 
4
3
  import { expose } from '../../src/worker'
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose } from '../../src/worker'
3
2
 
4
3
  let currentCount = 0
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose } from '../../src/worker'
3
2
 
4
3
  expose(function fail() {
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose } from '../../src/worker'
3
2
 
4
3
  expose(function helloWorld() {
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose } from '../../src/worker'
3
2
 
4
3
  let counter = 0
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { Observable, Subject } from '../../src/observable'
3
2
  import { expose } from '../../src/worker'
4
3
 
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable require-await */
2
- /* eslint-disable import/no-internal-modules */
2
+
3
3
  import { expose, registerSerializer } from '../../src/worker'
4
4
  import { Foo, fooSerializer } from '../lib/serialization'
5
5
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  /* eslint-disable no-restricted-imports */
3
2
  import { spawn, Thread, Worker } from '../..'
4
3
 
@@ -1,7 +1,7 @@
1
- /* eslint-disable import/no-default-export */
2
1
  import commonjs from '@rollup/plugin-commonjs'
3
2
  import { nodeResolve } from '@rollup/plugin-node-resolve'
4
3
 
4
+ // eslint-disable-next-line import/no-default-export
5
5
  export default {
6
6
  plugins: [
7
7
  nodeResolve({
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable require-await */
2
- /* eslint-disable import/no-internal-modules */
3
- import { expose } from '../../dist-esm/worker'
2
+
3
+ import { expose } from '../../dist/esm/worker'
4
4
 
5
5
  expose(async function add(a, b) {
6
6
  return a + b
@@ -1,5 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-floating-promises */
2
1
  /* eslint-disable no-restricted-imports */
2
+ /* eslint-disable @typescript-eslint/no-floating-promises */
3
3
  import { spawn, Thread, Worker } from '../..'
4
4
 
5
5
  async function main() {
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose, isWorkerRuntime } from '../../src/worker'
3
2
 
4
3
  if (!isWorkerRuntime()) {
@@ -1,7 +1,6 @@
1
- /* eslint-disable import/no-default-export */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable import/no-internal-modules */
4
1
  /* eslint-disable import/no-unresolved */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+
5
4
  /// <reference types="./raw-loader" />
6
5
 
7
6
  import AdditionWorkerNodeBundle from 'raw-loader!./dist/addition-worker.node/worker.js'
@@ -26,4 +25,5 @@ async function test() {
26
25
  return 'test succeeded'
27
26
  }
28
27
 
28
+ // eslint-disable-next-line import/no-default-export
29
29
  export default test
@@ -1,6 +1,5 @@
1
- /* eslint-disable import/no-default-export */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable import/no-internal-modules */
2
+
4
3
  import { isWorkerRuntime, Pool, spawn, Worker } from '../../src/index'
5
4
 
6
5
  type AdditionWorker = (a: number, b: number) => number
@@ -57,4 +56,5 @@ function test4() {
57
56
 
58
57
  const testAll = () => Promise.all([test(), test2(), test3(), test4()])
59
58
 
59
+ // eslint-disable-next-line import/no-default-export
60
60
  export default testAll
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { expose } from '../../src/worker'
3
2
 
4
3
  expose(function hello(text: string) {
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  /* eslint-disable @typescript-eslint/no-var-requires */
3
2
  const path = require('node:path')
4
3
  const ThreadsPlugin = require('threads-plugin')
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  /* eslint-disable @typescript-eslint/no-var-requires */
3
2
  const path = require('node:path')
4
3
  const ThreadsPlugin = require('threads-plugin')
package/worker.d.ts CHANGED
@@ -1,2 +1 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  export * from './dist/worker/index'
package/worker.js CHANGED
@@ -1,3 +1 @@
1
- /* eslint-disable import/no-internal-modules */
2
- /* eslint-disable no-undef */
3
1
  module.exports = require('./dist/worker/index')
package/worker.mjs CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import * as WorkerContext from './dist/worker/index.js'
3
2
 
4
3
  export const expose = WorkerContext.expose
File without changes
File without changes
File without changes