@zuplo/cli 6.69.9 → 6.69.11

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.
Files changed (200) hide show
  1. package/dist/__tests__/integration/jest-mocks-setup.js +3 -0
  2. package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
  3. package/dist/cli.js +4 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cmds/bucket/list.d.ts.map +1 -1
  6. package/dist/cmds/bucket/list.js +1 -8
  7. package/dist/cmds/bucket/list.js.map +1 -1
  8. package/dist/cmds/build.d.ts.map +1 -1
  9. package/dist/cmds/build.js +1 -2
  10. package/dist/cmds/build.js.map +1 -1
  11. package/dist/cmds/compile.d.ts.map +1 -1
  12. package/dist/cmds/compile.js +1 -2
  13. package/dist/cmds/compile.js.map +1 -1
  14. package/dist/cmds/custom-domain/create.d.ts.map +1 -1
  15. package/dist/cmds/custom-domain/create.js +1 -8
  16. package/dist/cmds/custom-domain/create.js.map +1 -1
  17. package/dist/cmds/custom-domain/delete.d.ts.map +1 -1
  18. package/dist/cmds/custom-domain/delete.js +1 -8
  19. package/dist/cmds/custom-domain/delete.js.map +1 -1
  20. package/dist/cmds/custom-domain/list.d.ts.map +1 -1
  21. package/dist/cmds/custom-domain/list.js +1 -8
  22. package/dist/cmds/custom-domain/list.js.map +1 -1
  23. package/dist/cmds/custom-domain/update.d.ts.map +1 -1
  24. package/dist/cmds/custom-domain/update.js +1 -8
  25. package/dist/cmds/custom-domain/update.js.map +1 -1
  26. package/dist/cmds/delete.d.ts.map +1 -1
  27. package/dist/cmds/delete.js +0 -2
  28. package/dist/cmds/delete.js.map +1 -1
  29. package/dist/cmds/deploy.d.ts.map +1 -1
  30. package/dist/cmds/deploy.js +0 -2
  31. package/dist/cmds/deploy.js.map +1 -1
  32. package/dist/cmds/dev.d.ts.map +1 -1
  33. package/dist/cmds/dev.js +1 -2
  34. package/dist/cmds/dev.js.map +1 -1
  35. package/dist/cmds/docs.d.ts.map +1 -1
  36. package/dist/cmds/docs.js +1 -2
  37. package/dist/cmds/docs.js.map +1 -1
  38. package/dist/cmds/editor.d.ts.map +1 -1
  39. package/dist/cmds/editor.js +1 -2
  40. package/dist/cmds/editor.js.map +1 -1
  41. package/dist/cmds/init.d.ts.map +1 -1
  42. package/dist/cmds/init.js +1 -3
  43. package/dist/cmds/init.js.map +1 -1
  44. package/dist/cmds/link.d.ts.map +1 -1
  45. package/dist/cmds/link.js +0 -2
  46. package/dist/cmds/link.js.map +1 -1
  47. package/dist/cmds/list.d.ts.map +1 -1
  48. package/dist/cmds/list.js +0 -2
  49. package/dist/cmds/list.js.map +1 -1
  50. package/dist/cmds/login.d.ts.map +1 -1
  51. package/dist/cmds/login.js +2 -2
  52. package/dist/cmds/login.js.map +1 -1
  53. package/dist/cmds/logout.d.ts.map +1 -1
  54. package/dist/cmds/logout.js +2 -3
  55. package/dist/cmds/logout.js.map +1 -1
  56. package/dist/cmds/mtls-certificates/create.d.ts.map +1 -1
  57. package/dist/cmds/mtls-certificates/create.js +0 -2
  58. package/dist/cmds/mtls-certificates/create.js.map +1 -1
  59. package/dist/cmds/mtls-certificates/delete.d.ts.map +1 -1
  60. package/dist/cmds/mtls-certificates/delete.js +0 -2
  61. package/dist/cmds/mtls-certificates/delete.js.map +1 -1
  62. package/dist/cmds/mtls-certificates/describe.d.ts.map +1 -1
  63. package/dist/cmds/mtls-certificates/describe.js +0 -2
  64. package/dist/cmds/mtls-certificates/describe.js.map +1 -1
  65. package/dist/cmds/mtls-certificates/disable.d.ts.map +1 -1
  66. package/dist/cmds/mtls-certificates/disable.js +0 -2
  67. package/dist/cmds/mtls-certificates/disable.js.map +1 -1
  68. package/dist/cmds/mtls-certificates/list.d.ts.map +1 -1
  69. package/dist/cmds/mtls-certificates/list.js +0 -2
  70. package/dist/cmds/mtls-certificates/list.js.map +1 -1
  71. package/dist/cmds/mtls-certificates/update.d.ts.map +1 -1
  72. package/dist/cmds/mtls-certificates/update.js +0 -2
  73. package/dist/cmds/mtls-certificates/update.js.map +1 -1
  74. package/dist/cmds/project/create.d.ts.map +1 -1
  75. package/dist/cmds/project/create.js +1 -8
  76. package/dist/cmds/project/create.js.map +1 -1
  77. package/dist/cmds/project/info.d.ts.map +1 -1
  78. package/dist/cmds/project/info.js +1 -2
  79. package/dist/cmds/project/info.js.map +1 -1
  80. package/dist/cmds/proxies/create.d.ts.map +1 -1
  81. package/dist/cmds/proxies/create.js +0 -2
  82. package/dist/cmds/proxies/create.js.map +1 -1
  83. package/dist/cmds/proxies/delete.d.ts.map +1 -1
  84. package/dist/cmds/proxies/delete.js +0 -2
  85. package/dist/cmds/proxies/delete.js.map +1 -1
  86. package/dist/cmds/proxies/describe.d.ts.map +1 -1
  87. package/dist/cmds/proxies/describe.js +0 -2
  88. package/dist/cmds/proxies/describe.js.map +1 -1
  89. package/dist/cmds/proxies/update.d.ts.map +1 -1
  90. package/dist/cmds/proxies/update.js +0 -2
  91. package/dist/cmds/proxies/update.js.map +1 -1
  92. package/dist/cmds/source/migrate.d.ts.map +1 -1
  93. package/dist/cmds/source/migrate.js +1 -2
  94. package/dist/cmds/source/migrate.js.map +1 -1
  95. package/dist/cmds/source/upgrade.d.ts.map +1 -1
  96. package/dist/cmds/source/upgrade.js +1 -2
  97. package/dist/cmds/source/upgrade.js.map +1 -1
  98. package/dist/cmds/test.d.ts.map +1 -1
  99. package/dist/cmds/test.js +1 -2
  100. package/dist/cmds/test.js.map +1 -1
  101. package/dist/cmds/tunnel/create.d.ts.map +1 -1
  102. package/dist/cmds/tunnel/create.js +1 -8
  103. package/dist/cmds/tunnel/create.js.map +1 -1
  104. package/dist/cmds/tunnel/delete.d.ts.map +1 -1
  105. package/dist/cmds/tunnel/delete.js +1 -8
  106. package/dist/cmds/tunnel/delete.js.map +1 -1
  107. package/dist/cmds/tunnel/describe.d.ts.map +1 -1
  108. package/dist/cmds/tunnel/describe.js +1 -8
  109. package/dist/cmds/tunnel/describe.js.map +1 -1
  110. package/dist/cmds/tunnel/list.d.ts.map +1 -1
  111. package/dist/cmds/tunnel/list.js +1 -8
  112. package/dist/cmds/tunnel/list.js.map +1 -1
  113. package/dist/cmds/tunnel/rotate-token.d.ts.map +1 -1
  114. package/dist/cmds/tunnel/rotate-token.js +1 -8
  115. package/dist/cmds/tunnel/rotate-token.js.map +1 -1
  116. package/dist/cmds/tunnel/services/describe.d.ts.map +1 -1
  117. package/dist/cmds/tunnel/services/describe.js +1 -8
  118. package/dist/cmds/tunnel/services/describe.js.map +1 -1
  119. package/dist/cmds/tunnel/services/update.d.ts.map +1 -1
  120. package/dist/cmds/tunnel/services/update.js +1 -8
  121. package/dist/cmds/tunnel/services/update.js.map +1 -1
  122. package/dist/cmds/variable/create.d.ts.map +1 -1
  123. package/dist/cmds/variable/create.js +0 -2
  124. package/dist/cmds/variable/create.js.map +1 -1
  125. package/dist/cmds/variable/update.d.ts.map +1 -1
  126. package/dist/cmds/variable/update.js +0 -2
  127. package/dist/cmds/variable/update.js.map +1 -1
  128. package/dist/cmds/whoami.d.ts.map +1 -1
  129. package/dist/cmds/whoami.js +1 -2
  130. package/dist/cmds/whoami.js.map +1 -1
  131. package/dist/common/middleware/check-pnpm-lifecycle.d.ts +17 -0
  132. package/dist/common/middleware/check-pnpm-lifecycle.d.ts.map +1 -0
  133. package/dist/common/middleware/check-pnpm-lifecycle.js +96 -0
  134. package/dist/common/middleware/check-pnpm-lifecycle.js.map +1 -0
  135. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +2 -0
  136. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +1 -0
  137. package/dist/common/middleware/check-pnpm-lifecycle.test.js +125 -0
  138. package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +1 -0
  139. package/dist/common/utils/pnpm-lifecycle.d.ts +13 -0
  140. package/dist/common/utils/pnpm-lifecycle.d.ts.map +1 -0
  141. package/dist/common/utils/pnpm-lifecycle.js +100 -0
  142. package/dist/common/utils/pnpm-lifecycle.js.map +1 -0
  143. package/dist/common/utils/pnpm-lifecycle.test.d.ts +2 -0
  144. package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +1 -0
  145. package/dist/common/utils/pnpm-lifecycle.test.js +177 -0
  146. package/dist/common/utils/pnpm-lifecycle.test.js.map +1 -0
  147. package/dist/tsconfig.tsbuildinfo +1 -1
  148. package/node_modules/@types/node/README.md +1 -1
  149. package/node_modules/@types/node/http2.d.ts +80 -12
  150. package/node_modules/@types/node/package.json +2 -2
  151. package/node_modules/@zuplo/core/package.json +1 -1
  152. package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
  153. package/node_modules/@zuplo/graphql/out/types/index.d.ts +3 -0
  154. package/node_modules/@zuplo/graphql/package.json +1 -1
  155. package/node_modules/@zuplo/openapi-tools/package.json +2 -2
  156. package/node_modules/@zuplo/otel/package.json +1 -1
  157. package/node_modules/@zuplo/runtime/out/esm/index.js +94 -94
  158. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  159. package/node_modules/@zuplo/runtime/out/types/index.d.ts +72 -0
  160. package/node_modules/@zuplo/runtime/package.json +2 -2
  161. package/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  162. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  163. package/node_modules/brace-expansion/dist/esm/index.js +1 -1
  164. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  165. package/node_modules/brace-expansion/package.json +1 -1
  166. package/node_modules/get-east-asian-width/lookup-data.js +15 -12
  167. package/node_modules/get-east-asian-width/lookup.js +25 -22
  168. package/node_modules/get-east-asian-width/package.json +1 -1
  169. package/node_modules/pino-http/node_modules/thread-stream/.github/workflows/ci.yml +4 -4
  170. package/node_modules/pino-http/node_modules/thread-stream/README.md +4 -1
  171. package/node_modules/pino-http/node_modules/thread-stream/index.d.ts +7 -0
  172. package/node_modules/pino-http/node_modules/thread-stream/index.js +120 -21
  173. package/node_modules/pino-http/node_modules/thread-stream/lib/worker.js +101 -0
  174. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/LICENSE.md +21 -0
  175. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/README.md +51 -0
  176. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/package.json +38 -0
  177. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/src/index.js +14 -0
  178. package/node_modules/pino-http/node_modules/thread-stream/package.json +10 -12
  179. package/node_modules/pino-http/node_modules/thread-stream/test/flush-worker.js +68 -0
  180. package/node_modules/pino-http/node_modules/thread-stream/test/flush.test.js +112 -0
  181. package/node_modules/pino-http/node_modules/thread-stream/test/message-without-code.js +19 -0
  182. package/node_modules/pino-http/node_modules/thread-stream/test/report-thread-name.js +16 -0
  183. package/node_modules/pino-http/node_modules/thread-stream/test/thread-management.test.js +12 -0
  184. package/node_modules/pino-http/node_modules/thread-stream/test/watch-mode.test.js +30 -0
  185. package/node_modules/pino-http/node_modules/thread-stream/test/worker-name.test.js +43 -0
  186. package/node_modules/protobufjs/dist/light/protobuf.js +5 -3
  187. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  188. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  189. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  190. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  191. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  192. package/node_modules/protobufjs/dist/protobuf.js +5 -3
  193. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  194. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  195. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  196. package/node_modules/protobufjs/package.json +1 -1
  197. package/node_modules/protobufjs/src/namespace.js +3 -1
  198. package/package.json +7 -7
  199. package/node_modules/pino-http/node_modules/thread-stream/.husky/pre-commit +0 -4
  200. package/node_modules/pino-http/node_modules/thread-stream/CLAUDE.md +0 -53
@@ -0,0 +1,51 @@
1
+ # real-require
2
+
3
+ Keep require and import consistent after bundling or transpiling.
4
+
5
+ ## Installation
6
+
7
+ Just run:
8
+
9
+ ```bash
10
+ npm install real-require
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ The package provides two drop-ins functions, `realRequire` and `realImport`,
16
+ which can be used in scenarios where tools like transpilers or bundlers change
17
+ the native `require` or `await import` calls.
18
+
19
+ The current `realRequire` functions only handles webpack at the moment, wrapping
20
+ the `__non_webpack__require__` implementation that webpack provides for the
21
+ final bundle.
22
+
23
+ ### Example
24
+
25
+ ```js
26
+ // After bundling, real-require will be embedded in the bundle
27
+ const { realImport, realRequire } = require('real-require')
28
+
29
+ /*
30
+ By using realRequire, at build time the module will not be embedded and at runtime it will try to load path from the local filesytem.
31
+ This is useful in situations where the build tool does not support skipping modules to embed.
32
+ */
33
+ const { join } = realRequire('path')
34
+
35
+ async function main() {
36
+ // Similarly, this make sure the import call is not modified by the build tools
37
+ const localFunction = await realImport('./source.js')
38
+
39
+ localFunction()
40
+ }
41
+
42
+ main().catch(console.error)
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ See [CONTRIBUTING.md](./CONTRIBUTING.md)
48
+
49
+ ## License
50
+
51
+ Copyright Paolo Insogna and real-require contributors 2021. Licensed under the [MIT License](http://www.apache.org/licenses/MIT).
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "real-require",
3
+ "version": "1.0.0",
4
+ "description": "Keep require and import consistent after bundling or transpiling",
5
+ "author": "Paolo Insogna <shogun@cowtech.it>",
6
+ "homepage": "https://github.com/pinojs/real-require",
7
+ "contributors": [
8
+ {
9
+ "name": "Paolo Insogna",
10
+ "url": "https://github.com/ShogunPanda"
11
+ }
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/pinojs/real-require.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/pinojs/real-require/issues"
20
+ },
21
+ "main": "src/index.js",
22
+ "files": [
23
+ "src"
24
+ ],
25
+ "scripts": {
26
+ "lint": "eslint .",
27
+ "lint:fix": "eslint --fix .",
28
+ "test": "c8 --reporter=text --reporter=html borp 'test/*.test.js'",
29
+ "test:ci": "c8 --reporter=text --reporter=json --check-coverage --branches 90 --functions 90 --lines 90 --statements 90 borp 'test/*.test.js'",
30
+ "ci": "npm run lint && npm run test:ci"
31
+ },
32
+ "devDependencies": {
33
+ "borp": "^1.0.0",
34
+ "c8": "^8.0.0",
35
+ "eslint": "^9.39.4",
36
+ "neostandard": "^0.13.0"
37
+ }
38
+ }
@@ -0,0 +1,14 @@
1
+ /* eslint-disable no-new-func */
2
+ /* globals __non_webpack__require__ */
3
+
4
+ const realImport = new Function('modulePath', 'return import(modulePath)')
5
+
6
+ function realRequire (modulePath) {
7
+ if (typeof __non_webpack__require__ === 'function') {
8
+ return __non_webpack__require__(modulePath)
9
+ }
10
+
11
+ return require(modulePath)
12
+ }
13
+
14
+ module.exports = { realImport, realRequire }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thread-stream",
3
- "version": "4.0.0",
3
+ "version": "4.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",
@@ -8,30 +8,28 @@
8
8
  "node": ">=20"
9
9
  },
10
10
  "dependencies": {
11
- "real-require": "^0.2.0"
11
+ "real-require": "^1.0.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@types/node": "^22.0.0",
14
+ "@types/node": "^25.0.2",
15
15
  "@yao-pkg/pkg": "^6.0.0",
16
- "borp": "^0.21.0",
16
+ "borp": "^1.0.0",
17
17
  "desm": "^1.3.0",
18
18
  "eslint": "^9.39.1",
19
19
  "fastbench": "^1.0.1",
20
- "husky": "^9.0.6",
21
- "neostandard": "^0.12.2",
20
+ "neostandard": "^0.13.0",
22
21
  "pino-elasticsearch": "^8.0.0",
23
- "sonic-boom": "^4.0.1",
22
+ "sonic-boom": "^5.0.0",
24
23
  "ts-node": "^10.8.0",
25
24
  "typescript": "~5.7.3"
26
25
  },
27
26
  "scripts": {
28
27
  "build": "tsc --noEmit",
29
28
  "lint": "eslint",
30
- "test": "npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'",
31
- "test:ci": "npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'",
32
- "test:yarn": "npm run transpile && borp --pattern 'test/*.test.js'",
33
- "transpile": "sh ./test/ts/transpile.sh",
34
- "prepare": "husky install"
29
+ "test": "npm run lint && npm run build && npm run transpile && borp --pattern \"test/*.test.{js,mjs}\"",
30
+ "test:ci": "npm run lint && npm run transpile && borp --pattern \"test/*.test.{js,mjs}\"",
31
+ "test:yarn": "npm run transpile && borp --pattern \"test/*.test.js\"",
32
+ "transpile": "sh ./test/ts/transpile.sh"
35
33
  },
36
34
  "repository": {
37
35
  "type": "git",
@@ -0,0 +1,68 @@
1
+ 'use strict'
2
+
3
+ const { EventEmitter } = require('events')
4
+ const { parentPort } = require('worker_threads')
5
+
6
+ function createDestination (mode) {
7
+ const destination = new EventEmitter()
8
+ destination.writableEnded = false
9
+ destination.writableNeedDrain = false
10
+
11
+ destination.write = function () {
12
+ if (mode === 'drain') {
13
+ destination.writableNeedDrain = true
14
+ setTimeout(() => {
15
+ destination.writableNeedDrain = false
16
+ parentPort.postMessage({
17
+ code: 'EVENT',
18
+ name: 'destination-drain'
19
+ })
20
+ destination.emit('drain')
21
+ }, 50)
22
+ }
23
+
24
+ return true
25
+ }
26
+
27
+ destination.end = function () {
28
+ destination.writableEnded = true
29
+ destination.emit('close')
30
+ }
31
+
32
+ if (mode === 'flush') {
33
+ destination.flush = function (cb) {
34
+ setTimeout(() => {
35
+ parentPort.postMessage({
36
+ code: 'EVENT',
37
+ name: 'destination-flushed'
38
+ })
39
+ cb()
40
+ }, 50)
41
+ }
42
+ }
43
+
44
+ if (mode === 'flush-sync') {
45
+ destination.flushSync = function () {
46
+ parentPort.postMessage({
47
+ code: 'EVENT',
48
+ name: 'destination-flush-sync'
49
+ })
50
+ }
51
+ }
52
+
53
+ if (mode === 'exit-on-flush') {
54
+ destination.flush = function (_cb) {
55
+ setTimeout(() => {
56
+ process.exit(0)
57
+ }, 20)
58
+ }
59
+ }
60
+
61
+ return destination
62
+ }
63
+
64
+ async function run (opts) {
65
+ return createDestination(opts.mode)
66
+ }
67
+
68
+ module.exports = run
@@ -0,0 +1,112 @@
1
+ 'use strict'
2
+
3
+ const { test } = require('node:test')
4
+ const assert = require('node:assert')
5
+ const { once } = require('node:events')
6
+ const { join } = require('node:path')
7
+ const ThreadStream = require('..')
8
+
9
+ function createStream (mode) {
10
+ return new ThreadStream({
11
+ filename: join(__dirname, 'flush-worker.js'),
12
+ workerData: { mode },
13
+ sync: false
14
+ })
15
+ }
16
+
17
+ test('flush waits for worker destination.flush(cb)', async function () {
18
+ const stream = createStream('flush')
19
+ let flushed = false
20
+
21
+ stream.on('destination-flushed', () => {
22
+ flushed = true
23
+ })
24
+
25
+ assert.ok(stream.write('hello'))
26
+
27
+ await new Promise((resolve, reject) => {
28
+ stream.flush((err) => {
29
+ if (err) {
30
+ reject(err)
31
+ return
32
+ }
33
+ resolve()
34
+ })
35
+ })
36
+
37
+ assert.strictEqual(flushed, true)
38
+
39
+ const close = once(stream, 'close')
40
+ stream.end()
41
+ await close
42
+ })
43
+
44
+ test('flush falls back to destination.flushSync()', async function () {
45
+ const stream = createStream('flush-sync')
46
+ let called = false
47
+
48
+ stream.on('destination-flush-sync', () => {
49
+ called = true
50
+ })
51
+
52
+ assert.ok(stream.write('hello'))
53
+
54
+ await new Promise((resolve, reject) => {
55
+ stream.flush((err) => {
56
+ if (err) {
57
+ reject(err)
58
+ return
59
+ }
60
+ resolve()
61
+ })
62
+ })
63
+
64
+ assert.strictEqual(called, true)
65
+
66
+ const close = once(stream, 'close')
67
+ stream.end()
68
+ await close
69
+ })
70
+
71
+ test('flush waits for drain when destination has no flush API', async function () {
72
+ const stream = createStream('drain')
73
+ let drained = false
74
+
75
+ stream.on('destination-drain', () => {
76
+ drained = true
77
+ })
78
+
79
+ assert.ok(stream.write('hello'))
80
+
81
+ await new Promise((resolve, reject) => {
82
+ stream.flush((err) => {
83
+ if (err) {
84
+ reject(err)
85
+ return
86
+ }
87
+ resolve()
88
+ })
89
+ })
90
+
91
+ assert.strictEqual(drained, true)
92
+
93
+ const close = once(stream, 'close')
94
+ stream.end()
95
+ await close
96
+ })
97
+
98
+ test('pending flush callbacks fail when worker exits', async function () {
99
+ const stream = createStream('exit-on-flush')
100
+ const close = once(stream, 'close')
101
+
102
+ assert.ok(stream.write('hello'))
103
+
104
+ const err = await new Promise((resolve) => {
105
+ stream.flush(resolve)
106
+ })
107
+
108
+ assert.ok(err)
109
+ assert.strictEqual(err.message, 'the worker has exited')
110
+
111
+ await close
112
+ })
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+
3
+ const { Writable } = require('stream')
4
+ const { parentPort } = require('worker_threads')
5
+
6
+ async function run () {
7
+ parentPort.postMessage({
8
+ internal: 'watch-mode'
9
+ })
10
+
11
+ return new Writable({
12
+ autoDestroy: true,
13
+ write (chunk, enc, cb) {
14
+ cb()
15
+ }
16
+ })
17
+ }
18
+
19
+ module.exports = run
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const { Writable } = require('stream')
4
+ const { threadName, parentPort } = require('worker_threads')
5
+
6
+ module.exports = function () {
7
+ parentPort.once('message', function ({ port }) {
8
+ port.postMessage({ threadName })
9
+ })
10
+
11
+ return new Writable({
12
+ write (chunk, encoding, callback) {
13
+ callback()
14
+ }
15
+ })
16
+ }
@@ -27,6 +27,9 @@ test('emit error if thread exits', async function (t) {
27
27
  })
28
28
 
29
29
  const closed = once(stream, 'close').catch(() => {})
30
+ // Keep a persistent error listener to avoid unhandled late error events
31
+ // reported as asynchronous activity by stricter test runners.
32
+ stream.on('error', () => {})
30
33
 
31
34
  stream.on('ready', () => {
32
35
  stream.write('hello world\n')
@@ -53,6 +56,9 @@ test('emit error if thread have unhandledRejection', async function (t) {
53
56
  })
54
57
 
55
58
  const closed = once(stream, 'close').catch(() => {})
59
+ // Keep a persistent error listener to avoid unhandled late error events
60
+ // reported as asynchronous activity by stricter test runners.
61
+ stream.on('error', () => {})
56
62
 
57
63
  stream.on('ready', () => {
58
64
  stream.write('hello world\n')
@@ -79,6 +85,9 @@ test('emit error if worker stream emit error', async function (t) {
79
85
  })
80
86
 
81
87
  const closed = once(stream, 'close').catch(() => {})
88
+ // Keep a persistent error listener to avoid unhandled late error events
89
+ // reported as asynchronous activity by stricter test runners.
90
+ stream.on('error', () => {})
82
91
 
83
92
  stream.on('ready', () => {
84
93
  stream.write('hello world\n')
@@ -105,6 +114,9 @@ test('emit error if thread have uncaughtException', async function (t) {
105
114
  })
106
115
 
107
116
  const closed = once(stream, 'close').catch(() => {})
117
+ // Keep a persistent error listener to avoid unhandled late error events
118
+ // reported as asynchronous activity by stricter test runners.
119
+ stream.on('error', () => {})
108
120
 
109
121
  stream.on('ready', () => {
110
122
  stream.write('hello world\n')
@@ -0,0 +1,30 @@
1
+ 'use strict'
2
+
3
+ const { test } = require('node:test')
4
+ const assert = require('node:assert')
5
+ const { once } = require('events')
6
+ const { join } = require('path')
7
+ const ThreadStream = require('..')
8
+
9
+ test('ignores worker messages without a protocol code', async function () {
10
+ const stream = new ThreadStream({
11
+ filename: join(__dirname, 'message-without-code.js'),
12
+ sync: false
13
+ })
14
+
15
+ const errors = []
16
+ stream.on('error', err => {
17
+ errors.push(err)
18
+ })
19
+
20
+ const ready = once(stream, 'ready')
21
+ const close = once(stream, 'close')
22
+
23
+ assert.ok(stream.write('hello world\n'))
24
+ stream.end()
25
+
26
+ await ready
27
+ await close
28
+
29
+ assert.deepStrictEqual(errors, [])
30
+ })
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ const { test } = require('node:test')
4
+ const assert = require('node:assert')
5
+ const { join } = require('path')
6
+ const { once } = require('events')
7
+ const { MessageChannel } = require('worker_threads')
8
+ const ThreadStream = require('..')
9
+
10
+ // threadName was added in Node.js v22.20.0 and v24.6.0
11
+ const [major, minor] = process.versions.node.split('.').map(Number)
12
+ const supportsThreadName = (major === 22 && minor >= 20) || major >= 24
13
+
14
+ test('worker has default name "thread-stream"', { skip: !supportsThreadName }, async function (t) {
15
+ const { port1, port2 } = new MessageChannel()
16
+ const stream = new ThreadStream({
17
+ filename: join(__dirname, 'report-thread-name.js'),
18
+ sync: true
19
+ })
20
+
21
+ t.after(() => stream.end())
22
+
23
+ stream.emit('message', { port: port1 }, [port1])
24
+ const [{ threadName }] = await once(port2, 'message')
25
+ assert.strictEqual(threadName, 'thread-stream')
26
+ })
27
+
28
+ test('worker name can be overridden via workerOpts', { skip: !supportsThreadName }, async function (t) {
29
+ const { port1, port2 } = new MessageChannel()
30
+ const stream = new ThreadStream({
31
+ filename: join(__dirname, 'report-thread-name.js'),
32
+ workerOpts: {
33
+ name: 'my-custom-worker'
34
+ },
35
+ sync: true
36
+ })
37
+
38
+ t.after(() => stream.end())
39
+
40
+ stream.emit('message', { port: port1 }, [port1])
41
+ const [{ threadName }] = await once(port2, 'message')
42
+ assert.strictEqual(threadName, 'my-custom-worker')
43
+ })
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.5.6 (c) 2016, daniel wirtz
3
- * compiled tue, 28 apr 2026 00:45:19 utc
2
+ * protobuf.js v7.5.7 (c) 2016, daniel wirtz
3
+ * compiled sat, 09 may 2026 05:45:39 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -3422,8 +3422,10 @@ Namespace.prototype._lookupImpl = function lookup(path, flatPath) {
3422
3422
  // Otherwise try each nested namespace
3423
3423
  } else {
3424
3424
  for (var i = 0; i < this.nestedArray.length; ++i)
3425
- if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path, flatPath)))
3425
+ if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path, flatPath))) {
3426
3426
  exact = found;
3427
+ break;
3428
+ }
3427
3429
  }
3428
3430
 
3429
3431
  // Set this even when null, so that when we walk up the tree we can quickly bail on repeated checks back down.