thread-stream 2.7.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/.github/workflows/ci.yml +2 -6
- package/index.d.ts +3 -4
- package/lib/worker.js +0 -1
- package/package.json +4 -3
- package/test/never-drain.test.js +3 -1
- package/test/pkg/pkg.test.js +2 -0
- package/tsconfig.json +8 -0
package/.github/workflows/ci.yml
CHANGED
|
@@ -38,15 +38,11 @@ jobs:
|
|
|
38
38
|
contents: read
|
|
39
39
|
strategy:
|
|
40
40
|
matrix:
|
|
41
|
-
node-version: [
|
|
41
|
+
node-version: [18, 20, 22]
|
|
42
42
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
43
43
|
exclude:
|
|
44
44
|
- os: windows-latest
|
|
45
|
-
node-version:
|
|
46
|
-
- os: macos-latest
|
|
47
|
-
node-version: 14
|
|
48
|
-
- os: macos-latest
|
|
49
|
-
node-version: 16
|
|
45
|
+
node-version: 22
|
|
50
46
|
|
|
51
47
|
steps:
|
|
52
48
|
- name: Check out repo
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events'
|
|
2
|
-
import workerThreads from 'worker_threads'
|
|
2
|
+
import * as workerThreads from 'worker_threads'
|
|
3
3
|
|
|
4
4
|
interface ThreadStreamOptions {
|
|
5
5
|
/**
|
|
@@ -76,9 +76,8 @@ declare class ThreadStream extends EventEmitter {
|
|
|
76
76
|
* @param args the arguments to be passed to the event handlers.
|
|
77
77
|
* @returns {boolean} `true` if the event had listeners, `false` otherwise.
|
|
78
78
|
*/
|
|
79
|
-
emit(eventName: string | symbol, ...args: any[]): boolean
|
|
80
|
-
|
|
81
|
-
}
|
|
79
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
80
|
+
|
|
82
81
|
/**
|
|
83
82
|
* Post a message to the Worker with specified data and an optional list of transferable objects.
|
|
84
83
|
*
|
package/lib/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thread-stream",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"fastbench": "^1.0.1",
|
|
16
16
|
"husky": "^9.0.6",
|
|
17
17
|
"pino-elasticsearch": "^8.0.0",
|
|
18
|
-
"sonic-boom": "^
|
|
18
|
+
"sonic-boom": "^4.0.1",
|
|
19
19
|
"standard": "^17.0.0",
|
|
20
20
|
"tap": "^16.2.0",
|
|
21
21
|
"ts-node": "^10.8.0",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"why-is-node-running": "^2.2.2"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"
|
|
26
|
+
"build": "tsc --noEmit",
|
|
27
|
+
"test": "standard && npm run build && npm run transpile && tap \"test/**/*.test.*js\" && tap --ts test/*.test.*ts",
|
|
27
28
|
"test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
|
|
28
29
|
"test:ci:js": "tap --no-check-coverage --timeout=120 --coverage-report=lcovonly \"test/**/*.test.*js\"",
|
|
29
30
|
"test:ci:ts": "tap --ts --no-check-coverage --coverage-report=lcovonly \"test/**/*.test.*ts\"",
|
package/test/never-drain.test.js
CHANGED
|
@@ -22,7 +22,9 @@ function retryUntilTimeout (fn, timeout) {
|
|
|
22
22
|
})
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const isNode18 = process.version.indexOf('v18') === 0
|
|
26
|
+
|
|
27
|
+
test('emit warning when the worker gracefully exit without the stream ended', { skip: !isNode18 }, async function (t) {
|
|
26
28
|
const expectedWarning = 'ThreadStream: process exited before destination stream was drained. this may indicate that the destination stream try to write to a another missing stream'
|
|
27
29
|
const stream = new ThreadStream({
|
|
28
30
|
filename: join(__dirname, 'to-next.js')
|
package/test/pkg/pkg.test.js
CHANGED
|
@@ -14,6 +14,8 @@ test('worker test when packaged into executable using pkg', async (t) => {
|
|
|
14
14
|
// package the app into several node versions, check config for more info
|
|
15
15
|
const filePath = `${join(__dirname, packageName)}.js`
|
|
16
16
|
const configPath = join(__dirname, 'pkg.config.json')
|
|
17
|
+
process.env.NODE_OPTIONS ||= ''
|
|
18
|
+
process.env.NODE_OPTIONS = '--no-warnings'
|
|
17
19
|
const { stderr } = await exec(`npx pkg ${filePath} --config ${configPath}`)
|
|
18
20
|
|
|
19
21
|
// there should be no error when packaging
|