@xylabs/threads 4.0.2 → 4.0.3
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/esm/master/spawn.js +1 -3
- package/dist/esm/worker/index.js +1 -3
- package/dist/index.d.ts +1 -1
- package/dist/master/pool.d.ts +1 -1
- package/dist/master/spawn.js +1 -3
- package/dist/worker/index.js +1 -3
- package/observable.js +1 -0
- package/package.json +8 -7
- package/register.js +1 -0
- package/rollup.config.js +2 -0
- package/src/common.ts +3 -1
- package/src/index.ts +3 -1
- package/src/master/implementation.browser.ts +1 -0
- package/src/master/implementation.node.ts +3 -1
- package/src/master/invocation-proxy.ts +5 -2
- package/src/master/pool.ts +9 -3
- package/src/master/spawn.ts +6 -7
- package/src/master/thread.ts +3 -1
- package/src/types/master.ts +3 -1
- package/src/worker/index.ts +3 -4
- package/test/pool.test.ts +4 -4
- package/test/serialization.test.ts +3 -1
- package/test/spawn.chromium.mocha.ts +3 -1
- package/test/spawn.test.ts +3 -1
- package/test/streaming.test.ts +3 -1
- package/test/transferables.test.ts +3 -1
- package/test-tooling/rollup/app.js +3 -1
- package/test-tooling/tsconfig/minimal.ts +3 -1
- package/test-tooling/webpack/app.ts +3 -1
- package/test-tooling/webpack/webpack.node.config.js +4 -11
- package/test-tooling/webpack/webpack.web.config.js +3 -8
- package/worker.js +1 -0
package/dist/esm/master/spawn.js
CHANGED
|
@@ -64,9 +64,7 @@ function createEventObservable(worker, workerTermination) {
|
|
|
64
64
|
worker.addEventListener('message', messageHandler);
|
|
65
65
|
worker.addEventListener('unhandledrejection', rejectionHandler);
|
|
66
66
|
workerTermination.then(() => {
|
|
67
|
-
const terminationEvent = {
|
|
68
|
-
type: master_1.WorkerEventType.termination,
|
|
69
|
-
};
|
|
67
|
+
const terminationEvent = { type: master_1.WorkerEventType.termination };
|
|
70
68
|
worker.removeEventListener('message', messageHandler);
|
|
71
69
|
worker.removeEventListener('unhandledrejection', rejectionHandler);
|
|
72
70
|
observer.next(terminationEvent);
|
package/dist/esm/worker/index.js
CHANGED
|
@@ -28,9 +28,7 @@ function deconstructTransfer(thing) {
|
|
|
28
28
|
}
|
|
29
29
|
function postFunctionInitMessage() {
|
|
30
30
|
const initMessage = {
|
|
31
|
-
exposed: {
|
|
32
|
-
type: 'function',
|
|
33
|
-
},
|
|
31
|
+
exposed: { type: 'function' },
|
|
34
32
|
type: messages_1.WorkerMessageType.init,
|
|
35
33
|
};
|
|
36
34
|
implementation_1.default.postMessageToMaster(initMessage);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { registerSerializer } from './common';
|
|
|
2
2
|
export * from './master/index';
|
|
3
3
|
export { QueuedTask } from './master/pool';
|
|
4
4
|
export { ExposedToThreadType as ExposedAs } from './master/spawn';
|
|
5
|
-
export { DefaultSerializer, JsonSerializable, Serializer, SerializerImplementation } from './serializers';
|
|
5
|
+
export { DefaultSerializer, JsonSerializable, Serializer, SerializerImplementation, } from './serializers';
|
|
6
6
|
export { Transfer, TransferDescriptor } from './transferable';
|
|
7
7
|
export { expose } from './worker/index';
|
package/dist/master/pool.d.ts
CHANGED
|
@@ -46,5 +46,5 @@ declare function PoolConstructor<ThreadType extends Thread>(spawnWorker: () => P
|
|
|
46
46
|
export declare const Pool: typeof PoolConstructor & {
|
|
47
47
|
EventType: typeof PoolEventType;
|
|
48
48
|
};
|
|
49
|
-
export { PoolEvent, PoolEventType, QueuedTask } from './pool-types';
|
|
49
|
+
export { PoolEvent, PoolEventType, QueuedTask, } from './pool-types';
|
|
50
50
|
export { Thread } from './thread';
|
package/dist/master/spawn.js
CHANGED
|
@@ -64,9 +64,7 @@ function createEventObservable(worker, workerTermination) {
|
|
|
64
64
|
worker.addEventListener('message', messageHandler);
|
|
65
65
|
worker.addEventListener('unhandledrejection', rejectionHandler);
|
|
66
66
|
workerTermination.then(() => {
|
|
67
|
-
const terminationEvent = {
|
|
68
|
-
type: master_1.WorkerEventType.termination,
|
|
69
|
-
};
|
|
67
|
+
const terminationEvent = { type: master_1.WorkerEventType.termination };
|
|
70
68
|
worker.removeEventListener('message', messageHandler);
|
|
71
69
|
worker.removeEventListener('unhandledrejection', rejectionHandler);
|
|
72
70
|
observer.next(terminationEvent);
|
package/dist/worker/index.js
CHANGED
|
@@ -28,9 +28,7 @@ function deconstructTransfer(thing) {
|
|
|
28
28
|
}
|
|
29
29
|
function postFunctionInitMessage() {
|
|
30
30
|
const initMessage = {
|
|
31
|
-
exposed: {
|
|
32
|
-
type: 'function',
|
|
33
|
-
},
|
|
31
|
+
exposed: { type: 'function' },
|
|
34
32
|
type: messages_1.WorkerMessageType.init,
|
|
35
33
|
};
|
|
36
34
|
implementation_1.default.postMessageToMaster(initMessage);
|
package/observable.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/threads",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Web workers & worker threads as simple as a function call",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"worker_threads"
|
|
85
85
|
],
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@babel/types": "^7.25.
|
|
87
|
+
"@babel/types": "^7.25.4",
|
|
88
88
|
"callsites-3-1-0": "npm:callsites@3.1.0",
|
|
89
89
|
"debug": "^4.3.6",
|
|
90
90
|
"is-observable-2-1-0": "npm:is-observable@2.1.0",
|
|
@@ -96,8 +96,9 @@
|
|
|
96
96
|
"@types/chai": "^4.3.17",
|
|
97
97
|
"@types/debug": "^4.1.12",
|
|
98
98
|
"@types/execa": "^2.0.0",
|
|
99
|
-
"@types/node": "^22.
|
|
99
|
+
"@types/node": "^22.5.0",
|
|
100
100
|
"@types/webpack": "^5.28.5",
|
|
101
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0",
|
|
101
102
|
"ava": "^6.1.3",
|
|
102
103
|
"chai": "^5.1.1",
|
|
103
104
|
"cross-env": "^7.0.3",
|
|
@@ -106,16 +107,16 @@
|
|
|
106
107
|
"puppet-run": "^0.11.4",
|
|
107
108
|
"puppet-run-plugin-mocha": "^0.1.1",
|
|
108
109
|
"raw-loader": "^4.0.2",
|
|
109
|
-
"rimraf": "^
|
|
110
|
-
"rollup": "^4.
|
|
110
|
+
"rimraf": "^5",
|
|
111
|
+
"rollup": "^4.21.0",
|
|
111
112
|
"threads-plugin": "^1.4.0",
|
|
112
113
|
"tiny-worker": "^2.3.0",
|
|
113
114
|
"ts-loader": "^9.5.1",
|
|
114
115
|
"ts-node": "^10.9.2",
|
|
115
116
|
"typescript": "^5.5.4",
|
|
116
|
-
"undici-types": "^6.19.
|
|
117
|
+
"undici-types": "^6.19.8",
|
|
117
118
|
"wavy": "^1.0.4",
|
|
118
|
-
"webpack": "^5.
|
|
119
|
+
"webpack": "^5.94.0",
|
|
119
120
|
"worker-plugin": "^5.0.1"
|
|
120
121
|
},
|
|
121
122
|
"optionalDependencies": {
|
package/register.js
CHANGED
package/rollup.config.js
CHANGED
package/src/common.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
JsonSerializable, Serializer, SerializerImplementation,
|
|
4
|
+
} from './serializers'
|
|
3
5
|
import { DefaultSerializer, extendSerializer } from './serializers'
|
|
4
6
|
|
|
5
7
|
let registeredSerializer: Serializer<JsonSerializable> = DefaultSerializer
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { registerSerializer } from './common'
|
|
|
3
3
|
export * from './master/index'
|
|
4
4
|
export { QueuedTask } from './master/pool'
|
|
5
5
|
export { ExposedToThreadType as ExposedAs } from './master/spawn'
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
DefaultSerializer, JsonSerializable, Serializer, SerializerImplementation,
|
|
8
|
+
} from './serializers'
|
|
7
9
|
export { Transfer, TransferDescriptor } from './transferable'
|
|
8
10
|
export { expose } from './worker/index'
|
|
@@ -18,7 +18,9 @@ import { fileURLToPath } from 'node:url'
|
|
|
18
18
|
import type { CallSite } from 'callsites-3-1-0'
|
|
19
19
|
import getCallsites from 'callsites-3-1-0'
|
|
20
20
|
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
ImplementationExport, ThreadsWorkerOptions, WorkerImplementation,
|
|
23
|
+
} from '../types/master'
|
|
22
24
|
|
|
23
25
|
interface WorkerGlobalScope {
|
|
24
26
|
addEventListener(eventName: string, listener: (event: Event) => void): void
|
|
@@ -13,13 +13,16 @@ import { multicast, Observable } from 'observable-fns'
|
|
|
13
13
|
import { deserialize, serialize } from '../common'
|
|
14
14
|
import { ObservablePromise } from '../observable-promise'
|
|
15
15
|
import { isTransferDescriptor } from '../transferable'
|
|
16
|
-
import type {
|
|
16
|
+
import type {
|
|
17
|
+
ModuleMethods, ModuleProxy, ProxyableFunction, Worker as WorkerType,
|
|
18
|
+
} from '../types/master'
|
|
17
19
|
import type {
|
|
18
20
|
MasterJobCancelMessage,
|
|
19
21
|
MasterJobRunMessage,
|
|
20
22
|
WorkerJobErrorMessage,
|
|
21
23
|
WorkerJobResultMessage,
|
|
22
|
-
WorkerJobStartMessage
|
|
24
|
+
WorkerJobStartMessage,
|
|
25
|
+
} from '../types/messages'
|
|
23
26
|
import {
|
|
24
27
|
MasterMessageType,
|
|
25
28
|
WorkerMessageType,
|
package/src/master/pool.ts
CHANGED
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
10
10
|
import DebugLogger from 'debug'
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
multicast, Observable, Subject,
|
|
13
|
+
} from 'observable-fns'
|
|
12
14
|
|
|
13
15
|
import { allSettled } from '../ponyfills'
|
|
14
16
|
import { defaultPoolSize } from './implementation'
|
|
15
|
-
import type {
|
|
17
|
+
import type {
|
|
18
|
+
PoolEvent, QueuedTask, TaskRunFunction, WorkerDescriptor,
|
|
19
|
+
} from './pool-types'
|
|
16
20
|
import { PoolEventType } from './pool-types'
|
|
17
21
|
import { Thread } from './thread'
|
|
18
22
|
|
|
@@ -389,5 +393,7 @@ function PoolConstructor<ThreadType extends Thread>(spawnWorker: () => Promise<T
|
|
|
389
393
|
*/
|
|
390
394
|
export const Pool = PoolConstructor as typeof PoolConstructor & { EventType: typeof PoolEventType }
|
|
391
395
|
|
|
392
|
-
export {
|
|
396
|
+
export {
|
|
397
|
+
PoolEvent, PoolEventType, QueuedTask,
|
|
398
|
+
} from './pool-types'
|
|
393
399
|
export { Thread } from './thread'
|
package/src/master/spawn.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { Observable } from 'observable-fns'
|
|
|
6
6
|
|
|
7
7
|
import { deserialize } from '../common'
|
|
8
8
|
import { createPromiseWithResolver } from '../promise'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
$errors, $events, $terminate, $worker,
|
|
11
|
+
} from '../symbols'
|
|
10
12
|
import type {
|
|
11
13
|
FunctionThread,
|
|
12
14
|
ModuleThread,
|
|
@@ -16,10 +18,9 @@ import type {
|
|
|
16
18
|
WorkerEvent,
|
|
17
19
|
WorkerInternalErrorEvent,
|
|
18
20
|
WorkerMessageEvent,
|
|
19
|
-
WorkerTerminationEvent
|
|
20
|
-
import {
|
|
21
|
-
WorkerEventType,
|
|
21
|
+
WorkerTerminationEvent,
|
|
22
22
|
} from '../types/master'
|
|
23
|
+
import { WorkerEventType } from '../types/master'
|
|
23
24
|
import type { WorkerInitMessage, WorkerUncaughtErrorMessage } from '../types/messages'
|
|
24
25
|
import type { WorkerFunction, WorkerModule } from '../types/worker'
|
|
25
26
|
import { createProxyFunction, createProxyModule } from './invocation-proxy'
|
|
@@ -94,9 +95,7 @@ function createEventObservable(worker: WorkerType, workerTermination: Promise<an
|
|
|
94
95
|
worker.addEventListener('unhandledrejection', rejectionHandler)
|
|
95
96
|
|
|
96
97
|
workerTermination.then(() => {
|
|
97
|
-
const terminationEvent: WorkerTerminationEvent = {
|
|
98
|
-
type: WorkerEventType.termination,
|
|
99
|
-
}
|
|
98
|
+
const terminationEvent: WorkerTerminationEvent = { type: WorkerEventType.termination }
|
|
100
99
|
worker.removeEventListener('message', messageHandler)
|
|
101
100
|
worker.removeEventListener('unhandledrejection', rejectionHandler)
|
|
102
101
|
observer.next(terminationEvent)
|
package/src/master/thread.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-internal-modules */
|
|
2
2
|
import type { Observable } from 'observable-fns'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
$errors, $events, $terminate,
|
|
6
|
+
} from '../symbols'
|
|
5
7
|
import type { Thread as ThreadType, WorkerEvent } from '../types/master'
|
|
6
8
|
|
|
7
9
|
function fail(message: string): never {
|
package/src/types/master.ts
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
import type { Observable } from 'observable-fns'
|
|
8
8
|
|
|
9
9
|
import type { ObservablePromise } from '../observable-promise'
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
$errors, $events, $terminate, $worker,
|
|
12
|
+
} from '../symbols'
|
|
11
13
|
import type { TransferDescriptor } from '../transferable'
|
|
12
14
|
|
|
13
15
|
interface ObservableLikeSubscription {
|
package/src/worker/index.ts
CHANGED
|
@@ -15,7 +15,8 @@ import type {
|
|
|
15
15
|
WorkerJobErrorMessage,
|
|
16
16
|
WorkerJobResultMessage,
|
|
17
17
|
WorkerJobStartMessage,
|
|
18
|
-
WorkerUncaughtErrorMessage
|
|
18
|
+
WorkerUncaughtErrorMessage,
|
|
19
|
+
} from '../types/messages'
|
|
19
20
|
import {
|
|
20
21
|
MasterMessageType,
|
|
21
22
|
WorkerMessageType,
|
|
@@ -52,9 +53,7 @@ function deconstructTransfer(thing: any) {
|
|
|
52
53
|
|
|
53
54
|
function postFunctionInitMessage() {
|
|
54
55
|
const initMessage: WorkerInitMessage = {
|
|
55
|
-
exposed: {
|
|
56
|
-
type: 'function',
|
|
57
|
-
},
|
|
56
|
+
exposed: { type: 'function' },
|
|
58
57
|
type: WorkerMessageType.init,
|
|
59
58
|
}
|
|
60
59
|
Implementation.postMessageToMaster(initMessage)
|
package/test/pool.test.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
// eslint-disable import-x/no-internal-modules
|
|
7
7
|
import test from 'ava'
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Pool, spawn, Worker,
|
|
11
|
+
} from '../src/index'
|
|
10
12
|
import type { QueuedTask } from '../src/master/pool'
|
|
11
13
|
import { PoolEventType } from '../src/master/pool'
|
|
12
14
|
|
|
@@ -65,9 +67,7 @@ test.serial('thread pool basics work and events are emitted', async (t) => {
|
|
|
65
67
|
type: Pool.EventType.taskCompleted,
|
|
66
68
|
workerID: 1,
|
|
67
69
|
},
|
|
68
|
-
{
|
|
69
|
-
type: Pool.EventType.taskQueueDrained,
|
|
70
|
-
},
|
|
70
|
+
{ type: Pool.EventType.taskQueueDrained },
|
|
71
71
|
{
|
|
72
72
|
remainingQueue: [],
|
|
73
73
|
type: Pool.EventType.terminated,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-internal-modules */
|
|
2
2
|
import test from 'ava'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
registerSerializer, spawn, Thread, Worker,
|
|
6
|
+
} from '../src/index'
|
|
5
7
|
import { Foo, fooSerializer } from './lib/serialization'
|
|
6
8
|
|
|
7
9
|
registerSerializer(fooSerializer)
|
|
@@ -11,7 +11,9 @@ import '../src/master/register'
|
|
|
11
11
|
|
|
12
12
|
import { expect } from 'chai'
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
BlobWorker, spawn, Thread,
|
|
16
|
+
} from '..'
|
|
15
17
|
|
|
16
18
|
describe('threads in browser', function () {
|
|
17
19
|
it('can spawn and terminate a thread', async function () {
|
package/test/spawn.test.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import test from 'ava'
|
|
5
5
|
import type { Observable } from 'observable-fns'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
spawn, Thread, Worker,
|
|
9
|
+
} from '../src/index'
|
|
8
10
|
import type { Counter } from './workers/counter'
|
|
9
11
|
|
|
10
12
|
test('can spawn and terminate a thread', async (t) => {
|
package/test/streaming.test.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import test from 'ava'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
spawn, Thread, Worker,
|
|
5
|
+
} from '../src/index'
|
|
4
6
|
|
|
5
7
|
test('can use worker returning an observable subject', async (t) => {
|
|
6
8
|
const captured: Array<{ max: number; min: number }> = []
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import test from 'ava'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
spawn, Thread, Transfer, Worker,
|
|
9
|
+
} from '../src/index'
|
|
8
10
|
import type { XorBuffer } from './workers/arraybuffer-xor'
|
|
9
11
|
|
|
10
12
|
type SpyInit<Args extends any[], OriginalReturn, NewReturn> = (originalFn: (...args: Args) => OriginalReturn) => (...args: Args) => NewReturn
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-imports */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
spawn, Thread, Worker,
|
|
5
|
+
} from '../..'
|
|
4
6
|
|
|
5
7
|
async function main() {
|
|
6
8
|
const helloWorld = await spawn(new Worker('./workers/hello-world'))
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isWorkerRuntime, Pool, spawn, Worker,
|
|
5
|
+
} from '../../src/index'
|
|
4
6
|
|
|
5
7
|
type AdditionWorker = (a: number, b: number) => number
|
|
6
8
|
type HelloWorker = (text: string) => string
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
1
2
|
const path = require('node:path')
|
|
2
3
|
const ThreadsPlugin = require('threads-plugin')
|
|
3
4
|
|
|
@@ -5,19 +6,13 @@ module.exports = {
|
|
|
5
6
|
context: __dirname,
|
|
6
7
|
devtool: false,
|
|
7
8
|
entry: require.resolve('./app.ts'),
|
|
8
|
-
externals: {
|
|
9
|
-
'tiny-worker': 'tiny-worker',
|
|
10
|
-
},
|
|
9
|
+
externals: { 'tiny-worker': 'tiny-worker' },
|
|
11
10
|
mode: 'development',
|
|
12
11
|
module: {
|
|
13
12
|
rules: [
|
|
14
13
|
{
|
|
15
14
|
loader: 'ts-loader',
|
|
16
|
-
options: {
|
|
17
|
-
compilerOptions: {
|
|
18
|
-
module: 'esnext',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
15
|
+
options: { compilerOptions: { module: 'esnext' } },
|
|
21
16
|
test: /\.ts$/,
|
|
22
17
|
},
|
|
23
18
|
],
|
|
@@ -29,8 +24,6 @@ module.exports = {
|
|
|
29
24
|
path: path.resolve(__dirname, './dist/app.node'),
|
|
30
25
|
},
|
|
31
26
|
plugins: [new ThreadsPlugin()],
|
|
32
|
-
resolve: {
|
|
33
|
-
extensions: ['.js', '.ts'],
|
|
34
|
-
},
|
|
27
|
+
resolve: { extensions: ['.js', '.ts'] },
|
|
35
28
|
target: 'node',
|
|
36
29
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
1
2
|
const path = require('node:path')
|
|
2
3
|
const ThreadsPlugin = require('threads-plugin')
|
|
3
4
|
|
|
@@ -10,11 +11,7 @@ module.exports = {
|
|
|
10
11
|
rules: [
|
|
11
12
|
{
|
|
12
13
|
loader: 'ts-loader',
|
|
13
|
-
options: {
|
|
14
|
-
compilerOptions: {
|
|
15
|
-
module: 'esnext',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
14
|
+
options: { compilerOptions: { module: 'esnext' } },
|
|
18
15
|
test: /\.ts$/,
|
|
19
16
|
},
|
|
20
17
|
],
|
|
@@ -26,8 +23,6 @@ module.exports = {
|
|
|
26
23
|
path: path.resolve(__dirname, './dist/app.web'),
|
|
27
24
|
},
|
|
28
25
|
plugins: [new ThreadsPlugin()],
|
|
29
|
-
resolve: {
|
|
30
|
-
extensions: ['.js', '.ts'],
|
|
31
|
-
},
|
|
26
|
+
resolve: { extensions: ['.js', '.ts'] },
|
|
32
27
|
target: 'web',
|
|
33
28
|
}
|
package/worker.js
CHANGED