bare-worker 3.0.0 → 3.0.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/index.js CHANGED
@@ -1,4 +1,3 @@
1
- /* global Bare */
2
1
  const Channel = require('bare-channel')
3
2
  const MessageChannel = require('./lib/message-channel')
4
3
  const MessagePort = require('./lib/message-port')
@@ -17,7 +16,8 @@ module.exports = exports = class Worker extends MessagePort {
17
16
  data: {
18
17
  channel: channel.handle,
19
18
  filename,
20
- data: opts.workerData
19
+ data: opts.workerData,
20
+ imports: module.imports
21
21
  }
22
22
  })
23
23
 
@@ -1,4 +1,3 @@
1
- /* global Bare */
2
1
  const EventEmitter = require('bare-events')
3
2
  const Channel = require('bare-channel')
4
3
  const constants = require('./constants')
@@ -1,4 +1,3 @@
1
- /* global Bare */
2
1
  const Channel = require('bare-channel')
3
2
  const Module = require('bare-module')
4
3
  const os = require('bare-os')
@@ -7,7 +6,7 @@ const MessagePort = require('./message-port')
7
6
  const worker = require('..')
8
7
  const { Thread } = Bare
9
8
 
10
- const { channel: handle, filename, data } = Thread.self.data
9
+ const { channel: handle, filename, data, imports } = Thread.self.data
11
10
 
12
11
  const channel = Channel.from(handle, { interfaces: [MessagePort] })
13
12
 
@@ -21,7 +20,12 @@ worker.parentPort._online()
21
20
 
22
21
  worker.workerData = data
23
22
 
24
- Module.load(Module.resolve(filename, url.pathToFileURL(os.cwd() + '/')))
23
+ Module.load(
24
+ Module.resolve(filename, url.pathToFileURL(os.cwd() + '/'), {
25
+ imports
26
+ }),
27
+ { imports }
28
+ )
25
29
 
26
30
  function onnewlistener(name, fn) {
27
31
  if (fn === onremovelistener || fn === onerror) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-worker",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Higher-level worker threads for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "homepage": "https://github.com/holepunchto/bare-worker#readme",
30
30
  "dependencies": {
31
- "bare-channel": "^5.0.1",
31
+ "bare-channel": "^5.0.5",
32
32
  "bare-events": "^2.2.1",
33
- "bare-module": "^4.0.0",
33
+ "bare-module": "^5.0.0",
34
34
  "bare-os": "^3.0.1",
35
35
  "bare-url": "^2.0.1"
36
36
  },