thread-stream 0.13.0 → 0.13.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.
@@ -2,6 +2,10 @@ version: 2
2
2
  updates:
3
3
  - package-ecosystem: github-actions
4
4
  directory: '/'
5
+ ignore:
6
+ - dependency-name: 'actions/*'
7
+ update-types:
8
+ ['version-update:semver-minor', 'version-update:semver-patch']
5
9
  schedule:
6
10
  interval: daily
7
11
  open-pull-requests-limit: 10
@@ -19,10 +19,10 @@ jobs:
19
19
 
20
20
  steps:
21
21
 
22
- - uses: actions/checkout@v2.4.0
22
+ - uses: actions/checkout@v2
23
23
 
24
24
  - name: Use Node.js
25
- uses: actions/setup-node@v2.4.1
25
+ uses: actions/setup-node@v2
26
26
  with:
27
27
  node-version: ${{ matrix.node-version }}
28
28
 
@@ -55,6 +55,6 @@ jobs:
55
55
  needs: test
56
56
  runs-on: ubuntu-latest
57
57
  steps:
58
- - uses: fastify/github-action-merge-dependabot@v2.5.0
58
+ - uses: fastify/github-action-merge-dependabot@v2.7.1
59
59
  with:
60
60
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -17,9 +17,9 @@ jobs:
17
17
  os: [macOS-latest, windows-latest]
18
18
  node-version: [12, 14, 16]
19
19
  steps:
20
- - uses: actions/checkout@v2.4.0
20
+ - uses: actions/checkout@v2
21
21
  - name: Use Node.js ${{ matrix.node-version }}
22
- uses: actions/setup-node@v2.4.1
22
+ uses: actions/setup-node@v2
23
23
  with:
24
24
  node-version: ${{ matrix.node-version }}
25
25
  - name: Use pnpm
@@ -39,9 +39,9 @@ jobs:
39
39
  os: [macOS-latest]
40
40
  node-version: [12, 14, 16]
41
41
  steps:
42
- - uses: actions/checkout@v2.4.0
42
+ - uses: actions/checkout@v2
43
43
  - name: Use Node.js ${{ matrix.node-version }}
44
- uses: actions/setup-node@v2.4.1
44
+ uses: actions/setup-node@v2
45
45
  with:
46
46
  node-version: ${{ matrix.node-version }}
47
47
  - name: Use yarn
package/lib/worker.js CHANGED
@@ -30,7 +30,7 @@ async function start () {
30
30
  // The error codes may change based on the node.js version (ENOTDIR > 12, ERR_MODULE_NOT_FOUND <= 12 )
31
31
  if ((error.code === 'ENOTDIR' || error.code === 'ERR_MODULE_NOT_FOUND') &&
32
32
  workerData.filename.startsWith('file://')) {
33
- fn = realRequire(workerData.filename.replace('file://', ''))
33
+ fn = realRequire(decodeURIComponent(workerData.filename.replace('file://', '')))
34
34
  } else {
35
35
  throw error
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thread-stream",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "A streaming way to send data to a Node.js Worker Thread",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -1,6 +1,9 @@
1
1
  'use strict'
2
2
 
3
3
  const { test } = require('tap')
4
+ const { join } = require('path')
5
+ const { MessageChannel } = require('worker_threads')
6
+ const { once } = require('events')
4
7
  const ThreadStream = require('..')
5
8
 
6
9
  const isYarnPnp = process.versions.pnp !== undefined
@@ -27,3 +30,27 @@ test('yarn module resolution', { skip: !isYarnPnp }, t => {
27
30
  t.ok(stream.writable)
28
31
  stream.end()
29
32
  })
33
+
34
+ test('yarn module resolution for directories with special characters', { skip: !isYarnPnp }, async t => {
35
+ t.plan(3)
36
+
37
+ const { port1, port2 } = new MessageChannel()
38
+ const stream = new ThreadStream({
39
+ filename: join(__dirname, 'dir with spaces', 'test-package.zip', 'worker.js'),
40
+ workerData: { port: port1 },
41
+ workerOpts: {
42
+ transferList: [port1]
43
+ },
44
+ sync: false
45
+ })
46
+ t.teardown(() => {
47
+ stream.end()
48
+ })
49
+
50
+ t.ok(stream.write('hello world\n'))
51
+ t.ok(stream.write('something else\n'))
52
+
53
+ const [strings] = await once(port2, 'message')
54
+
55
+ t.equal(strings, 'hello world\nsomething else\n')
56
+ })