bare-worker 4.2.0 → 4.2.1
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/lib/message-port.js +4 -0
- package/lib/worker-thread.js +8 -2
- package/package.json +2 -2
package/lib/message-port.js
CHANGED
|
@@ -84,6 +84,10 @@ module.exports = exports = class MessagePort extends EventEmitter {
|
|
|
84
84
|
return handle
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
static get [Symbol.for('bare.interface')]() {
|
|
88
|
+
return Symbol.for('bare.worker.message-port')
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
static [Symbol.for('bare.attach')](handle) {
|
|
88
92
|
return new MessagePort(Channel.from(handle, { interfaces: [MessagePort] }))
|
|
89
93
|
}
|
package/lib/worker-thread.js
CHANGED
|
@@ -8,11 +8,17 @@ Bare.on('newListener', onnewlistener)
|
|
|
8
8
|
.on('uncaughtException', onerror)
|
|
9
9
|
.on('unhandledRejection', onerror)
|
|
10
10
|
|
|
11
|
+
const cache = Object.create(null)
|
|
12
|
+
|
|
11
13
|
for (const [, source] of state.preloads) {
|
|
12
|
-
Module.load(
|
|
14
|
+
Module.load(
|
|
15
|
+
new URL(`bare:/worker/preload-${Math.random().toString(16).slice(2)}.bundle`),
|
|
16
|
+
source,
|
|
17
|
+
{ cache }
|
|
18
|
+
)
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
Module.load(new URL('bare:/worker.bundle'), state.source)
|
|
21
|
+
Module.load(new URL('bare:/worker.bundle'), state.source, { cache })
|
|
16
22
|
|
|
17
23
|
function onnewlistener(name, fn) {
|
|
18
24
|
if (fn === onremovelistener || fn === onerror) return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-worker",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Higher-level worker threads for JavaScript",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"bare-broadcast-channel": "^0.2.0",
|
|
37
37
|
"bare-channel": "^5.1.5",
|
|
38
38
|
"bare-events": "^2.2.1",
|
|
39
|
-
"bare-module": "^6.0
|
|
39
|
+
"bare-module": "^6.4.0",
|
|
40
40
|
"bare-thread": "^1.2.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|