thread-stream 3.0.2 → 3.1.0

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.
@@ -62,7 +62,7 @@ jobs:
62
62
  run: npm run test:ci
63
63
 
64
64
  - name: Coveralls Parallel
65
- uses: coverallsapp/github-action@v2.2.3
65
+ uses: coverallsapp/github-action@v2.3.0
66
66
  with:
67
67
  github-token: ${{ secrets.github_token }}
68
68
  parallel: true
@@ -73,7 +73,7 @@ jobs:
73
73
  runs-on: ubuntu-latest
74
74
  steps:
75
75
  - name: Coveralls Finished
76
- uses: coverallsapp/github-action@v2.2.3
76
+ uses: coverallsapp/github-action@v2.3.0
77
77
  with:
78
78
  github-token: ${{ secrets.GITHUB_TOKEN }}
79
79
  parallel-finished: true
package/lib/worker.js CHANGED
@@ -48,7 +48,11 @@ async function start () {
48
48
  // When bundled with pkg, an undefined error is thrown when called with realImport
49
49
  // When bundled with pkg and using node v20, an ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING error is thrown when called with realImport
50
50
  // More info at: https://github.com/pinojs/thread-stream/issues/143
51
- worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', '')))
51
+ try {
52
+ worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', '')))
53
+ } catch {
54
+ throw error
55
+ }
52
56
  } else {
53
57
  throw error
54
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thread-stream",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "A streaming way to send data to a Node.js Worker Thread",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -34,7 +34,8 @@
34
34
  },
35
35
  "standard": {
36
36
  "ignore": [
37
- "test/ts/**/*"
37
+ "test/ts/**/*",
38
+ "test/syntax-error.mjs"
38
39
  ]
39
40
  },
40
41
  "repository": {
package/test/base.test.js CHANGED
@@ -271,3 +271,15 @@ test('destroy does not error', function (t) {
271
271
  t.doesNotThrow(() => stream.end())
272
272
  })
273
273
  })
274
+
275
+ test('syntax error', function (t) {
276
+ t.plan(1)
277
+
278
+ const stream = new ThreadStream({
279
+ filename: join(__dirname, 'syntax-error.mjs')
280
+ })
281
+
282
+ stream.on('error', (err) => {
283
+ t.equal(err.message, 'Unexpected end of input')
284
+ })
285
+ })
@@ -0,0 +1,2 @@
1
+ // this is a syntax error
2
+ import