@wbce/projen-d9 0.0.28 → 0.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.
Files changed (421) hide show
  1. package/.jsii +184 -45
  2. package/API.md +153 -37
  3. package/CHANGELOG.md +13 -0
  4. package/README.md +10 -3
  5. package/docs/D9-plumbing.md +189 -0
  6. package/lib/cli/atlas.d.ts +10 -0
  7. package/lib/cli/atlas.js +65 -0
  8. package/lib/cli/commands/cedar/cedar-format.d.ts +7 -0
  9. package/lib/cli/commands/cedar/cedar-format.js +75 -0
  10. package/lib/cli/commands/cedar/cedar-to-d9-translations.d.ts +12 -0
  11. package/lib/cli/commands/cedar/cedar-to-d9-translations.js +130 -0
  12. package/lib/cli/commands/cedar/cedar-to-d9.d.ts +57 -0
  13. package/lib/cli/commands/cedar/cedar-to-d9.js +221 -0
  14. package/lib/cli/commands/cedar/cedar-translations.d.ts +9 -0
  15. package/lib/cli/commands/cedar/cedar-translations.js +213 -0
  16. package/lib/cli/commands/cedar/d9-permission.d.ts +27 -0
  17. package/lib/cli/commands/cedar/d9-permission.js +45 -0
  18. package/lib/cli/commands/cedar/d9-to-cedar.d.ts +33 -0
  19. package/lib/cli/commands/cedar/d9-to-cedar.js +157 -0
  20. package/lib/cli/commands/cedar/roles-table.d.ts +14 -0
  21. package/lib/cli/commands/cedar/roles-table.js +29 -0
  22. package/lib/cli/commands/save/apply-snapshot.js +39 -30
  23. package/lib/cli/commands/save/check-unsaved.d.ts +9 -0
  24. package/lib/cli/commands/save/check-unsaved.js +81 -0
  25. package/lib/cli/commands/save/env.d.ts +33 -0
  26. package/lib/cli/commands/save/env.js +109 -0
  27. package/lib/cli/commands/save/save-snapshot.d.ts +9 -0
  28. package/lib/cli/commands/save/save-snapshot.js +232 -0
  29. package/lib/cli/commands/save/sync-files.d.ts +5 -0
  30. package/lib/cli/commands/save/sync-files.js +46 -0
  31. package/lib/cli/commands/save/transfer.d.ts +18 -0
  32. package/lib/cli/commands/save/transfer.js +96 -0
  33. package/lib/cli/commands/save/utils.d.ts +5 -0
  34. package/lib/cli/commands/save/utils.js +33 -3
  35. package/lib/cli/commands/sync.js +4 -3
  36. package/lib/cli/index.js +65 -25
  37. package/lib/cli/logger.d.ts +2 -0
  38. package/lib/cli/logger.js +10 -0
  39. package/lib/cli/plumbing-config.d.ts +11 -0
  40. package/lib/cli/plumbing-config.js +13 -0
  41. package/lib/index.d.ts +44 -5
  42. package/lib/index.js +54 -41
  43. package/node_modules/@cedar-policy/cedar-wasm/README.md +181 -0
  44. package/node_modules/@cedar-policy/cedar-wasm/esm/README.md +181 -0
  45. package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.d.ts +427 -0
  46. package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.js +9 -0
  47. package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.js +434 -0
  48. package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm +0 -0
  49. package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm.d.ts +34 -0
  50. package/node_modules/@cedar-policy/cedar-wasm/esm/package.json +23 -0
  51. package/node_modules/@cedar-policy/cedar-wasm/nodejs/README.md +181 -0
  52. package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.d.ts +427 -0
  53. package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.js +463 -0
  54. package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm +0 -0
  55. package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm.d.ts +34 -0
  56. package/node_modules/@cedar-policy/cedar-wasm/nodejs/package.json +18 -0
  57. package/node_modules/@cedar-policy/cedar-wasm/package.json +53 -0
  58. package/node_modules/@cedar-policy/cedar-wasm/web/README.md +181 -0
  59. package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.d.ts +486 -0
  60. package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.js +534 -0
  61. package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm +0 -0
  62. package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm.d.ts +34 -0
  63. package/node_modules/@cedar-policy/cedar-wasm/web/package.json +21 -0
  64. package/node_modules/@types/node/README.md +5 -6
  65. package/node_modules/@types/node/assert/strict.d.ts +111 -0
  66. package/node_modules/@types/node/assert.d.ts +1040 -79
  67. package/node_modules/@types/node/async_hooks.d.ts +476 -119
  68. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  69. package/node_modules/@types/node/buffer.d.ts +1925 -13
  70. package/node_modules/@types/node/child_process.d.ts +1204 -235
  71. package/node_modules/@types/node/cluster.d.ts +455 -137
  72. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  73. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  74. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  75. package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  76. package/node_modules/@types/node/console.d.ts +450 -1
  77. package/node_modules/@types/node/constants.d.ts +20 -447
  78. package/node_modules/@types/node/crypto.d.ts +3962 -600
  79. package/node_modules/@types/node/dgram.d.ts +515 -33
  80. package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  81. package/node_modules/@types/node/dns/promises.d.ts +503 -0
  82. package/node_modules/@types/node/dns.d.ts +798 -247
  83. package/node_modules/@types/node/domain.d.ts +164 -10
  84. package/node_modules/@types/node/events.d.ts +954 -25
  85. package/node_modules/@types/node/fs/promises.d.ts +1295 -0
  86. package/node_modules/@types/node/fs.d.ts +3463 -1569
  87. package/node_modules/@types/node/globals.d.ts +98 -1277
  88. package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  89. package/node_modules/@types/node/http.d.ts +1933 -300
  90. package/node_modules/@types/node/http2.d.ts +1946 -254
  91. package/node_modules/@types/node/https.d.ts +557 -134
  92. package/node_modules/@types/node/index.d.ts +54 -48
  93. package/node_modules/@types/node/inspector.d.ts +227 -3014
  94. package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  95. package/node_modules/@types/node/module.d.ts +890 -2
  96. package/node_modules/@types/node/net.d.ts +872 -105
  97. package/node_modules/@types/node/os.d.ts +452 -209
  98. package/node_modules/@types/node/package.json +78 -128
  99. package/node_modules/@types/node/path.d.ts +196 -155
  100. package/node_modules/@types/node/perf_hooks.d.ts +829 -120
  101. package/node_modules/@types/node/process.d.ts +2072 -3
  102. package/node_modules/@types/node/punycode.d.ts +69 -27
  103. package/node_modules/@types/node/querystring.d.ts +132 -9
  104. package/node_modules/@types/node/readline/promises.d.ts +161 -0
  105. package/node_modules/@types/node/readline.d.ts +485 -49
  106. package/node_modules/@types/node/repl.d.ts +121 -83
  107. package/node_modules/@types/node/sea.d.ts +153 -0
  108. package/node_modules/@types/node/sqlite.d.ts +721 -0
  109. package/node_modules/@types/node/stream/consumers.d.ts +38 -0
  110. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  111. package/node_modules/@types/node/stream/web.d.ts +622 -0
  112. package/node_modules/@types/node/stream.d.ts +1470 -140
  113. package/node_modules/@types/node/string_decoder.d.ts +64 -4
  114. package/node_modules/@types/node/test.d.ts +2163 -0
  115. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  116. package/node_modules/@types/node/timers.d.ts +284 -13
  117. package/node_modules/@types/node/tls.d.ts +850 -244
  118. package/node_modules/@types/node/trace_events.d.ts +147 -11
  119. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  120. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  121. package/node_modules/@types/node/ts5.6/index.d.ts +97 -0
  122. package/node_modules/@types/node/tty.d.ts +160 -18
  123. package/node_modules/@types/node/url.d.ts +890 -53
  124. package/node_modules/@types/node/util.d.ts +2566 -160
  125. package/node_modules/@types/node/v8.d.ts +806 -83
  126. package/node_modules/@types/node/vm.d.ts +932 -44
  127. package/node_modules/@types/node/wasi.d.ts +148 -22
  128. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  129. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  130. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  131. package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  132. package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
  133. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  134. package/node_modules/@types/node/worker_threads.d.ts +657 -80
  135. package/node_modules/@types/node/zlib.d.ts +510 -119
  136. package/node_modules/pino/.nojekyll +0 -0
  137. package/node_modules/pino/.prettierignore +1 -0
  138. package/node_modules/pino/CNAME +1 -0
  139. package/node_modules/pino/CONTRIBUTING.md +34 -0
  140. package/node_modules/pino/LICENSE +21 -0
  141. package/node_modules/pino/README.md +177 -0
  142. package/node_modules/pino/SECURITY.md +103 -0
  143. package/node_modules/pino/benchmarks/basic.bench.js +95 -0
  144. package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
  145. package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
  146. package/node_modules/pino/benchmarks/child.bench.js +62 -0
  147. package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
  148. package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
  149. package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
  150. package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
  151. package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
  152. package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
  153. package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
  154. package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
  155. package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
  156. package/node_modules/pino/benchmarks/multistream.js +98 -0
  157. package/node_modules/pino/benchmarks/object.bench.js +82 -0
  158. package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
  159. package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
  160. package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
  161. package/node_modules/pino/bin.js +6 -0
  162. package/node_modules/pino/browser.js +607 -0
  163. package/node_modules/pino/build/sync-version.js +25 -0
  164. package/node_modules/pino/docs/api.md +1664 -0
  165. package/node_modules/pino/docs/asynchronous.md +55 -0
  166. package/node_modules/pino/docs/benchmarks.md +55 -0
  167. package/node_modules/pino/docs/browser.md +341 -0
  168. package/node_modules/pino/docs/bundling.md +40 -0
  169. package/node_modules/pino/docs/child-loggers.md +116 -0
  170. package/node_modules/pino/docs/diagnostics.md +16 -0
  171. package/node_modules/pino/docs/ecosystem.md +87 -0
  172. package/node_modules/pino/docs/help.md +353 -0
  173. package/node_modules/pino/docs/lts.md +93 -0
  174. package/node_modules/pino/docs/pretty.md +38 -0
  175. package/node_modules/pino/docs/redaction.md +130 -0
  176. package/node_modules/pino/docs/transports.md +1447 -0
  177. package/node_modules/pino/docs/web.md +306 -0
  178. package/node_modules/pino/eslint.config.js +36 -0
  179. package/node_modules/pino/examples/basic.js +43 -0
  180. package/node_modules/pino/examples/transport.js +68 -0
  181. package/node_modules/pino/favicon.ico +0 -0
  182. package/node_modules/pino/file.js +12 -0
  183. package/node_modules/pino/inc-version.sh +42 -0
  184. package/node_modules/pino/index.html +55 -0
  185. package/node_modules/pino/lib/caller.js +40 -0
  186. package/node_modules/pino/lib/constants.js +28 -0
  187. package/node_modules/pino/lib/deprecations.js +8 -0
  188. package/node_modules/pino/lib/levels.js +241 -0
  189. package/node_modules/pino/lib/meta.js +3 -0
  190. package/node_modules/pino/lib/multistream.js +211 -0
  191. package/node_modules/pino/lib/proto.js +256 -0
  192. package/node_modules/pino/lib/redaction.js +119 -0
  193. package/node_modules/pino/lib/symbols.js +76 -0
  194. package/node_modules/pino/lib/time.js +39 -0
  195. package/node_modules/pino/lib/tools.js +427 -0
  196. package/node_modules/pino/lib/transport-stream.js +56 -0
  197. package/node_modules/pino/lib/transport.js +302 -0
  198. package/node_modules/pino/lib/worker.js +197 -0
  199. package/node_modules/pino/package.json +112 -0
  200. package/node_modules/pino/pino.d.ts +881 -0
  201. package/node_modules/pino/pino.js +259 -0
  202. package/node_modules/pino/test/basic.test.js +952 -0
  203. package/node_modules/pino/test/broken-pipe.test.js +59 -0
  204. package/node_modules/pino/test/browser-bindings.test.js +114 -0
  205. package/node_modules/pino/test/browser-child.test.js +132 -0
  206. package/node_modules/pino/test/browser-disabled.test.js +87 -0
  207. package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
  208. package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
  209. package/node_modules/pino/test/browser-levels.test.js +241 -0
  210. package/node_modules/pino/test/browser-redaction.test.js +264 -0
  211. package/node_modules/pino/test/browser-serializers.test.js +352 -0
  212. package/node_modules/pino/test/browser-set-bindings.test.js +99 -0
  213. package/node_modules/pino/test/browser-timestamp.test.js +88 -0
  214. package/node_modules/pino/test/browser-transmit.test.js +417 -0
  215. package/node_modules/pino/test/browser.test.js +698 -0
  216. package/node_modules/pino/test/caller.test.js +20 -0
  217. package/node_modules/pino/test/complex-objects.test.js +36 -0
  218. package/node_modules/pino/test/crlf.test.js +34 -0
  219. package/node_modules/pino/test/custom-levels.test.js +267 -0
  220. package/node_modules/pino/test/diagnostics.test.js +107 -0
  221. package/node_modules/pino/test/error-key.test.js +37 -0
  222. package/node_modules/pino/test/error.test.js +403 -0
  223. package/node_modules/pino/test/escaping.test.js +110 -0
  224. package/node_modules/pino/test/esm/esm.mjs +14 -0
  225. package/node_modules/pino/test/esm/index.test.js +21 -0
  226. package/node_modules/pino/test/esm/named-exports.mjs +29 -0
  227. package/node_modules/pino/test/exit.test.js +79 -0
  228. package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
  229. package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
  230. package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
  231. package/node_modules/pino/test/fixtures/caller-loop.js +6 -0
  232. package/node_modules/pino/test/fixtures/console-transport.js +13 -0
  233. package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
  234. package/node_modules/pino/test/fixtures/default-exit.js +8 -0
  235. package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
  236. package/node_modules/pino/test/fixtures/eval/index.js +13 -0
  237. package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
  238. package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
  239. package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
  240. package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
  241. package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
  242. package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
  243. package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
  244. package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
  245. package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
  246. package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
  247. package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
  248. package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
  249. package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
  250. package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
  251. package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
  252. package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
  253. package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
  254. package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
  255. package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
  256. package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
  257. package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
  258. package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
  259. package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
  260. package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
  261. package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
  262. package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
  263. package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
  264. package/node_modules/pino/test/fixtures/transport/index.js +12 -0
  265. package/node_modules/pino/test/fixtures/transport/package.json +5 -0
  266. package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
  267. package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
  268. package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
  269. package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
  270. package/node_modules/pino/test/fixtures/transport-main.js +9 -0
  271. package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
  272. package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
  273. package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
  274. package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
  275. package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
  276. package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
  277. package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
  278. package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
  279. package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
  280. package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
  281. package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
  282. package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
  283. package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
  284. package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
  285. package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
  286. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
  287. package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
  288. package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
  289. package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
  290. package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
  291. package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
  292. package/node_modules/pino/test/formatters.test.js +364 -0
  293. package/node_modules/pino/test/helper.d.ts +4 -0
  294. package/node_modules/pino/test/helper.js +159 -0
  295. package/node_modules/pino/test/hooks.test.js +114 -0
  296. package/node_modules/pino/test/http.test.js +214 -0
  297. package/node_modules/pino/test/internals/version.test.js +17 -0
  298. package/node_modules/pino/test/is-level-enabled.test.js +179 -0
  299. package/node_modules/pino/test/jest/basic.spec.js +10 -0
  300. package/node_modules/pino/test/levels.test.js +810 -0
  301. package/node_modules/pino/test/metadata.test.js +120 -0
  302. package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
  303. package/node_modules/pino/test/mixin.test.js +241 -0
  304. package/node_modules/pino/test/multistream.test.js +793 -0
  305. package/node_modules/pino/test/redact.test.js +923 -0
  306. package/node_modules/pino/test/serializers.test.js +257 -0
  307. package/node_modules/pino/test/smoke.js +59 -0
  308. package/node_modules/pino/test/stdout-protection.test.js +41 -0
  309. package/node_modules/pino/test/syncfalse.test.js +186 -0
  310. package/node_modules/pino/test/timestamp-nano.test.js +37 -0
  311. package/node_modules/pino/test/timestamp.test.js +124 -0
  312. package/node_modules/pino/test/transport/big.test.js +42 -0
  313. package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
  314. package/node_modules/pino/test/transport/caller.test.js +24 -0
  315. package/node_modules/pino/test/transport/core.test.js +818 -0
  316. package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
  317. package/node_modules/pino/test/transport/crash.test.js +36 -0
  318. package/node_modules/pino/test/transport/module-link.test.js +241 -0
  319. package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
  320. package/node_modules/pino/test/transport/node-options.test.js +116 -0
  321. package/node_modules/pino/test/transport/pipeline.test.js +137 -0
  322. package/node_modules/pino/test/transport/preload.test.js +54 -0
  323. package/node_modules/pino/test/transport/repl.test.js +15 -0
  324. package/node_modules/pino/test/transport/sync-false.test.js +79 -0
  325. package/node_modules/pino/test/transport/sync-true.test.js +57 -0
  326. package/node_modules/pino/test/transport/targets.test.js +48 -0
  327. package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
  328. package/node_modules/pino/test/transport-stream.test.js +40 -0
  329. package/node_modules/pino/test/types/pino-import.tst.cts +30 -0
  330. package/node_modules/pino/test/types/pino-import.tst.js +73 -0
  331. package/node_modules/pino/test/types/pino-multistream.tst.ts +49 -0
  332. package/node_modules/pino/test/types/pino-top-export.tst.ts +32 -0
  333. package/node_modules/pino/test/types/pino-transport.tst.ts +171 -0
  334. package/node_modules/pino/test/types/pino-type-only.tst.ts +77 -0
  335. package/node_modules/pino/test/types/pino.ts +98 -0
  336. package/node_modules/pino/test/types/pino.tst.ts +681 -0
  337. package/node_modules/pino/test/types/tsconfig.json +10 -0
  338. package/node_modules/pino/tsconfig.json +14 -0
  339. package/node_modules/pino-pretty/.borp.yaml +6 -0
  340. package/node_modules/pino-pretty/.editorconfig +13 -0
  341. package/node_modules/pino-pretty/.github/dependabot.yml +13 -0
  342. package/node_modules/pino-pretty/.github/workflows/ci.yml +83 -0
  343. package/node_modules/pino-pretty/LICENSE +21 -0
  344. package/node_modules/pino-pretty/Readme.md +425 -0
  345. package/node_modules/pino-pretty/SECURITY.md +146 -0
  346. package/node_modules/pino-pretty/benchmark.js +105 -0
  347. package/node_modules/pino-pretty/bin.js +113 -0
  348. package/node_modules/pino-pretty/demo.png +0 -0
  349. package/node_modules/pino-pretty/docs/help.md +24 -0
  350. package/node_modules/pino-pretty/eslint.config.js +5 -0
  351. package/node_modules/pino-pretty/help/help.txt +68 -0
  352. package/node_modules/pino-pretty/index.d.ts +227 -0
  353. package/node_modules/pino-pretty/index.js +234 -0
  354. package/node_modules/pino-pretty/lib/colors.js +134 -0
  355. package/node_modules/pino-pretty/lib/colors.test.js +132 -0
  356. package/node_modules/pino-pretty/lib/constants.js +55 -0
  357. package/node_modules/pino-pretty/lib/pretty.js +171 -0
  358. package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.js +69 -0
  359. package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.test.js +84 -0
  360. package/node_modules/pino-pretty/lib/utils/create-date.js +26 -0
  361. package/node_modules/pino-pretty/lib/utils/create-date.test.js +20 -0
  362. package/node_modules/pino-pretty/lib/utils/delete-log-property.js +28 -0
  363. package/node_modules/pino-pretty/lib/utils/delete-log-property.test.js +31 -0
  364. package/node_modules/pino-pretty/lib/utils/filter-log.js +99 -0
  365. package/node_modules/pino-pretty/lib/utils/filter-log.test.js +265 -0
  366. package/node_modules/pino-pretty/lib/utils/format-time.js +66 -0
  367. package/node_modules/pino-pretty/lib/utils/format-time.test.js +71 -0
  368. package/node_modules/pino-pretty/lib/utils/get-level-label-data.js +29 -0
  369. package/node_modules/pino-pretty/lib/utils/get-property-value.js +30 -0
  370. package/node_modules/pino-pretty/lib/utils/get-property-value.test.js +31 -0
  371. package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.js +38 -0
  372. package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.test.js +45 -0
  373. package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.js +39 -0
  374. package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.test.js +47 -0
  375. package/node_modules/pino-pretty/lib/utils/index.js +108 -0
  376. package/node_modules/pino-pretty/lib/utils/index.test.js +37 -0
  377. package/node_modules/pino-pretty/lib/utils/interpret-conditionals.js +41 -0
  378. package/node_modules/pino-pretty/lib/utils/interpret-conditionals.test.js +84 -0
  379. package/node_modules/pino-pretty/lib/utils/is-object.js +7 -0
  380. package/node_modules/pino-pretty/lib/utils/is-object.test.js +10 -0
  381. package/node_modules/pino-pretty/lib/utils/is-valid-date.js +14 -0
  382. package/node_modules/pino-pretty/lib/utils/is-valid-date.test.js +16 -0
  383. package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.js +29 -0
  384. package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.test.js +16 -0
  385. package/node_modules/pino-pretty/lib/utils/noop.js +3 -0
  386. package/node_modules/pino-pretty/lib/utils/noop.test.js +12 -0
  387. package/node_modules/pino-pretty/lib/utils/parse-factory-options.js +171 -0
  388. package/node_modules/pino-pretty/lib/utils/prettify-error-log.js +76 -0
  389. package/node_modules/pino-pretty/lib/utils/prettify-error-log.test.js +143 -0
  390. package/node_modules/pino-pretty/lib/utils/prettify-error.js +54 -0
  391. package/node_modules/pino-pretty/lib/utils/prettify-error.test.js +25 -0
  392. package/node_modules/pino-pretty/lib/utils/prettify-level.js +41 -0
  393. package/node_modules/pino-pretty/lib/utils/prettify-level.test.js +70 -0
  394. package/node_modules/pino-pretty/lib/utils/prettify-message.js +65 -0
  395. package/node_modules/pino-pretty/lib/utils/prettify-message.test.js +287 -0
  396. package/node_modules/pino-pretty/lib/utils/prettify-metadata.js +75 -0
  397. package/node_modules/pino-pretty/lib/utils/prettify-metadata.test.js +170 -0
  398. package/node_modules/pino-pretty/lib/utils/prettify-object.js +115 -0
  399. package/node_modules/pino-pretty/lib/utils/prettify-object.test.js +217 -0
  400. package/node_modules/pino-pretty/lib/utils/prettify-time.js +43 -0
  401. package/node_modules/pino-pretty/lib/utils/prettify-time.test.js +264 -0
  402. package/node_modules/pino-pretty/lib/utils/split-property-key.js +49 -0
  403. package/node_modules/pino-pretty/lib/utils/split-property-key.test.js +29 -0
  404. package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.js +18 -0
  405. package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.test.js +9 -0
  406. package/node_modules/pino-pretty/package.json +64 -0
  407. package/node_modules/pino-pretty/test/basic.test.js +1305 -0
  408. package/node_modules/pino-pretty/test/boolean-options.test.js +228 -0
  409. package/node_modules/pino-pretty/test/cli-rc.test.js +275 -0
  410. package/node_modules/pino-pretty/test/cli.test.js +360 -0
  411. package/node_modules/pino-pretty/test/crlf.test.js +33 -0
  412. package/node_modules/pino-pretty/test/error-objects.test.js +494 -0
  413. package/node_modules/pino-pretty/test/example/example.js +33 -0
  414. package/node_modules/pino-pretty/test/helper.js +19 -0
  415. package/node_modules/pino-pretty/test/types/exports.tst.ts +15 -0
  416. package/node_modules/pino-pretty/test/types/pino-pretty.tst.ts +140 -0
  417. package/node_modules/pino-pretty/test/types/tsconfig.json +9 -0
  418. package/package.json +12 -5
  419. package/lib/cli/commands/init.d.ts +0 -1
  420. package/lib/cli/commands/init.js +0 -8
  421. package/node_modules/@types/node/globals.global.d.ts +0 -1
@@ -1,66 +1,265 @@
1
- declare module 'worker_threads' {
2
- import { Context } from 'vm';
3
- import EventEmitter = require('events');
4
- import { Readable, Writable } from 'stream';
5
- import { promises } from 'fs';
6
-
1
+ /**
2
+ * The `node:worker_threads` module enables the use of threads that execute
3
+ * JavaScript in parallel. To access it:
4
+ *
5
+ * ```js
6
+ * import worker from 'node:worker_threads';
7
+ * ```
8
+ *
9
+ * Workers (threads) are useful for performing CPU-intensive JavaScript operations.
10
+ * They do not help much with I/O-intensive work. The Node.js built-in
11
+ * asynchronous I/O operations are more efficient than Workers can be.
12
+ *
13
+ * Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
14
+ * so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
15
+ *
16
+ * ```js
17
+ * import {
18
+ * Worker,
19
+ * isMainThread,
20
+ * parentPort,
21
+ * workerData,
22
+ * } from 'node:worker_threads';
23
+ *
24
+ * if (!isMainThread) {
25
+ * const { parse } = await import('some-js-parsing-library');
26
+ * const script = workerData;
27
+ * parentPort.postMessage(parse(script));
28
+ * }
29
+ *
30
+ * export default function parseJSAsync(script) {
31
+ * return new Promise((resolve, reject) => {
32
+ * const worker = new Worker(new URL(import.meta.url), {
33
+ * workerData: script,
34
+ * });
35
+ * worker.on('message', resolve);
36
+ * worker.on('error', reject);
37
+ * worker.on('exit', (code) => {
38
+ * if (code !== 0)
39
+ * reject(new Error(`Worker stopped with exit code ${code}`));
40
+ * });
41
+ * });
42
+ * };
43
+ * ```
44
+ *
45
+ * The above example spawns a Worker thread for each `parseJSAsync()` call. In
46
+ * practice, use a pool of Workers for these kinds of tasks. Otherwise, the
47
+ * overhead of creating Workers would likely exceed their benefit.
48
+ *
49
+ * When implementing a worker pool, use the `AsyncResource` API to inform
50
+ * diagnostic tools (e.g. to provide asynchronous stack traces) about the
51
+ * correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
52
+ *
53
+ * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
54
+ * specifically `argv` and `execArgv` options.
55
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/worker_threads.js)
56
+ */
57
+ declare module "worker_threads" {
58
+ import { Context } from "node:vm";
59
+ import { EventEmitter, NodeEventTarget } from "node:events";
60
+ import { EventLoopUtilityFunction } from "node:perf_hooks";
61
+ import { FileHandle } from "node:fs/promises";
62
+ import { Readable, Writable } from "node:stream";
63
+ import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
64
+ import { URL } from "node:url";
65
+ import { HeapInfo } from "node:v8";
66
+ import { MessageEvent } from "undici-types";
67
+ const isInternalThread: boolean;
7
68
  const isMainThread: boolean;
8
69
  const parentPort: null | MessagePort;
9
70
  const resourceLimits: ResourceLimits;
10
71
  const SHARE_ENV: unique symbol;
11
72
  const threadId: number;
12
73
  const workerData: any;
13
-
74
+ /**
75
+ * Instances of the `worker.MessageChannel` class represent an asynchronous,
76
+ * two-way communications channel.
77
+ * The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
78
+ *
79
+ * ```js
80
+ * import { MessageChannel } from 'node:worker_threads';
81
+ *
82
+ * const { port1, port2 } = new MessageChannel();
83
+ * port1.on('message', (message) => console.log('received', message));
84
+ * port2.postMessage({ foo: 'bar' });
85
+ * // Prints: received { foo: 'bar' } from the `port1.on('message')` listener
86
+ * ```
87
+ * @since v10.5.0
88
+ */
14
89
  class MessageChannel {
15
90
  readonly port1: MessagePort;
16
91
  readonly port2: MessagePort;
17
92
  }
18
-
19
- type TransferListItem = ArrayBuffer | MessagePort | promises.FileHandle;
20
-
21
- class MessagePort extends EventEmitter {
93
+ interface WorkerPerformance {
94
+ eventLoopUtilization: EventLoopUtilityFunction;
95
+ }
96
+ type Transferable =
97
+ | ArrayBuffer
98
+ | MessagePort
99
+ | AbortSignal
100
+ | FileHandle
101
+ | ReadableStream
102
+ | WritableStream
103
+ | TransformStream;
104
+ /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
105
+ type TransferListItem = Transferable;
106
+ /**
107
+ * Instances of the `worker.MessagePort` class represent one end of an
108
+ * asynchronous, two-way communications channel. It can be used to transfer
109
+ * structured data, memory regions and other `MessagePort`s between different `Worker`s.
110
+ *
111
+ * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
112
+ * @since v10.5.0
113
+ */
114
+ class MessagePort implements EventTarget {
115
+ /**
116
+ * Disables further sending of messages on either side of the connection.
117
+ * This method can be called when no further communication will happen over this `MessagePort`.
118
+ *
119
+ * The `'close' event` is emitted on both `MessagePort` instances that
120
+ * are part of the channel.
121
+ * @since v10.5.0
122
+ */
22
123
  close(): void;
23
- postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
124
+ /**
125
+ * Sends a JavaScript value to the receiving side of this channel. `value` is transferred in a way which is compatible with
126
+ * the [HTML structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
127
+ *
128
+ * In particular, the significant differences to `JSON` are:
129
+ *
130
+ * * `value` may contain circular references.
131
+ * * `value` may contain instances of builtin JS types such as `RegExp`s, `BigInt`s, `Map`s, `Set`s, etc.
132
+ * * `value` may contain typed arrays, both using `ArrayBuffer`s
133
+ * and `SharedArrayBuffer`s.
134
+ * * `value` may contain [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) instances.
135
+ * * `value` may not contain native (C++-backed) objects other than:
136
+ *
137
+ * ```js
138
+ * import { MessageChannel } from 'node:worker_threads';
139
+ * const { port1, port2 } = new MessageChannel();
140
+ *
141
+ * port1.on('message', (message) => console.log(message));
142
+ *
143
+ * const circularData = {};
144
+ * circularData.foo = circularData;
145
+ * // Prints: { foo: [Circular] }
146
+ * port2.postMessage(circularData);
147
+ * ```
148
+ *
149
+ * `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
150
+ * After transferring, they are not usable on the sending side of the channel
151
+ * anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
152
+ * not supported.
153
+ *
154
+ * If `value` contains [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances, those are accessible
155
+ * from either thread. They cannot be listed in `transferList`.
156
+ *
157
+ * `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
158
+ *
159
+ * ```js
160
+ * import { MessageChannel } from 'node:worker_threads';
161
+ * const { port1, port2 } = new MessageChannel();
162
+ *
163
+ * port1.on('message', (message) => console.log(message));
164
+ *
165
+ * const uint8Array = new Uint8Array([ 1, 2, 3, 4 ]);
166
+ * // This posts a copy of `uint8Array`:
167
+ * port2.postMessage(uint8Array);
168
+ * // This does not copy data, but renders `uint8Array` unusable:
169
+ * port2.postMessage(uint8Array, [ uint8Array.buffer ]);
170
+ *
171
+ * // The memory for the `sharedUint8Array` is accessible from both the
172
+ * // original and the copy received by `.on('message')`:
173
+ * const sharedUint8Array = new Uint8Array(new SharedArrayBuffer(4));
174
+ * port2.postMessage(sharedUint8Array);
175
+ *
176
+ * // This transfers a freshly created message port to the receiver.
177
+ * // This can be used, for example, to create communication channels between
178
+ * // multiple `Worker` threads that are children of the same parent thread.
179
+ * const otherChannel = new MessageChannel();
180
+ * port2.postMessage({ port: otherChannel.port1 }, [ otherChannel.port1 ]);
181
+ * ```
182
+ *
183
+ * The message object is cloned immediately, and can be modified after
184
+ * posting without having side effects.
185
+ *
186
+ * For more information on the serialization and deserialization mechanisms
187
+ * behind this API, see the `serialization API of the node:v8 module`.
188
+ * @since v10.5.0
189
+ */
190
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
191
+ /**
192
+ * If true, the `MessagePort` object will keep the Node.js event loop active.
193
+ * @since v18.1.0, v16.17.0
194
+ */
195
+ hasRef(): boolean;
196
+ /**
197
+ * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
198
+ * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
199
+ *
200
+ * If listeners are attached or removed using `.on('message')`, the port
201
+ * is `ref()`ed and `unref()`ed automatically depending on whether
202
+ * listeners for the event exist.
203
+ * @since v10.5.0
204
+ */
24
205
  ref(): void;
206
+ /**
207
+ * Calling `unref()` on a port allows the thread to exit if this is the only
208
+ * active handle in the event system. If the port is already `unref()`ed calling `unref()` again has no effect.
209
+ *
210
+ * If listeners are attached or removed using `.on('message')`, the port is `ref()`ed and `unref()`ed automatically depending on whether
211
+ * listeners for the event exist.
212
+ * @since v10.5.0
213
+ */
25
214
  unref(): void;
215
+ /**
216
+ * Starts receiving messages on this `MessagePort`. When using this port
217
+ * as an event emitter, this is called automatically once `'message'` listeners are attached.
218
+ *
219
+ * This method exists for parity with the Web `MessagePort` API. In Node.js,
220
+ * it is only useful for ignoring messages when no event listener is present.
221
+ * Node.js also diverges in its handling of `.onmessage`. Setting it
222
+ * automatically calls `.start()`, but unsetting it lets messages queue up
223
+ * until a new handler is set or the port is discarded.
224
+ * @since v10.5.0
225
+ */
26
226
  start(): void;
27
-
28
- addListener(event: "close", listener: () => void): this;
227
+ addListener(event: "close", listener: (ev: Event) => void): this;
29
228
  addListener(event: "message", listener: (value: any) => void): this;
30
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
31
-
32
- emit(event: "close"): boolean;
229
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
230
+ addListener(event: string, listener: (arg: any) => void): this;
231
+ emit(event: "close", ev: Event): boolean;
33
232
  emit(event: "message", value: any): boolean;
34
- emit(event: string | symbol, ...args: any[]): boolean;
35
-
36
- on(event: "close", listener: () => void): this;
233
+ emit(event: "messageerror", error: Error): boolean;
234
+ emit(event: string, arg: any): boolean;
235
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
236
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
237
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
238
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
239
+ on(event: "close", listener: (ev: Event) => void): this;
37
240
  on(event: "message", listener: (value: any) => void): this;
38
- on(event: string | symbol, listener: (...args: any[]) => void): this;
39
-
40
- once(event: "close", listener: () => void): this;
241
+ on(event: "messageerror", listener: (error: Error) => void): this;
242
+ on(event: string, listener: (arg: any) => void): this;
243
+ once(event: "close", listener: (ev: Event) => void): this;
41
244
  once(event: "message", listener: (value: any) => void): this;
42
- once(event: string | symbol, listener: (...args: any[]) => void): this;
43
-
44
- prependListener(event: "close", listener: () => void): this;
45
- prependListener(event: "message", listener: (value: any) => void): this;
46
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
47
-
48
- prependOnceListener(event: "close", listener: () => void): this;
49
- prependOnceListener(event: "message", listener: (value: any) => void): this;
50
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
51
-
52
- removeListener(event: "close", listener: () => void): this;
53
- removeListener(event: "message", listener: (value: any) => void): this;
54
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
55
-
56
- off(event: "close", listener: () => void): this;
57
- off(event: "message", listener: (value: any) => void): this;
58
- off(event: string | symbol, listener: (...args: any[]) => void): this;
245
+ once(event: "messageerror", listener: (error: Error) => void): this;
246
+ once(event: string, listener: (arg: any) => void): this;
247
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
248
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
249
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
250
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
59
251
  }
60
-
252
+ interface MessagePort extends NodeEventTarget {}
61
253
  interface WorkerOptions {
254
+ /**
255
+ * List of arguments which would be stringified and appended to
256
+ * `process.argv` in the worker. This is mostly similar to the `workerData`
257
+ * but the values will be available on the global `process.argv` as if they
258
+ * were passed as CLI options to the script.
259
+ */
260
+ argv?: any[] | undefined;
261
+ env?: NodeJS.Dict<string> | typeof SHARE_ENV | undefined;
62
262
  eval?: boolean | undefined;
63
- env?: NodeJS.ProcessEnv | typeof SHARE_ENV | undefined;
64
263
  workerData?: any;
65
264
  stdin?: boolean | undefined;
66
265
  stdout?: boolean | undefined;
@@ -70,10 +269,18 @@ declare module 'worker_threads' {
70
269
  /**
71
270
  * Additional data to send in the first worker message.
72
271
  */
73
- transferList?: TransferListItem[] | undefined;
272
+ transferList?: Transferable[] | undefined;
273
+ /**
274
+ * @default true
275
+ */
74
276
  trackUnmanagedFds?: boolean | undefined;
277
+ /**
278
+ * An optional `name` to be appended to the worker title
279
+ * for debugging/identification purposes, making the final title as
280
+ * `[worker ${id}] ${name}`.
281
+ */
282
+ name?: string | undefined;
75
283
  }
76
-
77
284
  interface ResourceLimits {
78
285
  /**
79
286
  * The maximum size of a heap space for recently created objects.
@@ -93,74 +300,221 @@ declare module 'worker_threads' {
93
300
  */
94
301
  stackSizeMb?: number | undefined;
95
302
  }
96
-
303
+ /**
304
+ * The `Worker` class represents an independent JavaScript execution thread.
305
+ * Most Node.js APIs are available inside of it.
306
+ *
307
+ * Notable differences inside a Worker environment are:
308
+ *
309
+ * * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
310
+ * * The `import { isMainThread } from 'node:worker_threads'` variable is set to `false`.
311
+ * * The `import { parentPort } from 'node:worker_threads'` message port is available.
312
+ * * `process.exit()` does not stop the whole program, just the single thread,
313
+ * and `process.abort()` is not available.
314
+ * * `process.chdir()` and `process` methods that set group or user ids
315
+ * are not available.
316
+ * * `process.env` is a copy of the parent thread's environment variables,
317
+ * unless otherwise specified. Changes to one copy are not visible in other
318
+ * threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
319
+ * environment variables operates in a case-sensitive manner.
320
+ * * `process.title` cannot be modified.
321
+ * * Signals are not delivered through `process.on('...')`.
322
+ * * Execution may stop at any point as a result of `worker.terminate()` being invoked.
323
+ * * IPC channels from parent processes are not accessible.
324
+ * * The `trace_events` module is not supported.
325
+ * * Native add-ons can only be loaded from multiple threads if they fulfill `certain conditions`.
326
+ *
327
+ * Creating `Worker` instances inside of other `Worker`s is possible.
328
+ *
329
+ * Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
330
+ * can be achieved through inter-thread message passing. Internally, a `Worker` has
331
+ * a built-in pair of `MessagePort` s that are already associated with each
332
+ * other when the `Worker` is created. While the `MessagePort` object on the parent
333
+ * side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
334
+ * on the `Worker` object for the parent thread.
335
+ *
336
+ * To create custom messaging channels (which is encouraged over using the default
337
+ * global channel because it facilitates separation of concerns), users can create
338
+ * a `MessageChannel` object on either thread and pass one of the`MessagePort`s on that `MessageChannel` to the other thread through a
339
+ * pre-existing channel, such as the global one.
340
+ *
341
+ * See `port.postMessage()` for more information on how messages are passed,
342
+ * and what kind of JavaScript values can be successfully transported through
343
+ * the thread barrier.
344
+ *
345
+ * ```js
346
+ * import assert from 'node:assert';
347
+ * import {
348
+ * Worker, MessageChannel, MessagePort, isMainThread, parentPort,
349
+ * } from 'node:worker_threads';
350
+ * if (isMainThread) {
351
+ * const worker = new Worker(__filename);
352
+ * const subChannel = new MessageChannel();
353
+ * worker.postMessage({ hereIsYourPort: subChannel.port1 }, [subChannel.port1]);
354
+ * subChannel.port2.on('message', (value) => {
355
+ * console.log('received:', value);
356
+ * });
357
+ * } else {
358
+ * parentPort.once('message', (value) => {
359
+ * assert(value.hereIsYourPort instanceof MessagePort);
360
+ * value.hereIsYourPort.postMessage('the worker is sending this');
361
+ * value.hereIsYourPort.close();
362
+ * });
363
+ * }
364
+ * ```
365
+ * @since v10.5.0
366
+ */
97
367
  class Worker extends EventEmitter {
368
+ /**
369
+ * If `stdin: true` was passed to the `Worker` constructor, this is a
370
+ * writable stream. The data written to this stream will be made available in
371
+ * the worker thread as `process.stdin`.
372
+ * @since v10.5.0
373
+ */
98
374
  readonly stdin: Writable | null;
375
+ /**
376
+ * This is a readable stream which contains data written to `process.stdout` inside the worker thread. If `stdout: true` was not passed to the `Worker` constructor, then data is piped to the
377
+ * parent thread's `process.stdout` stream.
378
+ * @since v10.5.0
379
+ */
99
380
  readonly stdout: Readable;
381
+ /**
382
+ * This is a readable stream which contains data written to `process.stderr` inside the worker thread. If `stderr: true` was not passed to the `Worker` constructor, then data is piped to the
383
+ * parent thread's `process.stderr` stream.
384
+ * @since v10.5.0
385
+ */
100
386
  readonly stderr: Readable;
387
+ /**
388
+ * An integer identifier for the referenced thread. Inside the worker thread,
389
+ * it is available as `import { threadId } from 'node:worker_threads'`.
390
+ * This value is unique for each `Worker` instance inside a single process.
391
+ * @since v10.5.0
392
+ */
101
393
  readonly threadId: number;
394
+ /**
395
+ * Provides the set of JS engine resource constraints for this Worker thread.
396
+ * If the `resourceLimits` option was passed to the `Worker` constructor,
397
+ * this matches its values.
398
+ *
399
+ * If the worker has stopped, the return value is an empty object.
400
+ * @since v13.2.0, v12.16.0
401
+ */
102
402
  readonly resourceLimits?: ResourceLimits | undefined;
103
-
104
- constructor(filename: string, options?: WorkerOptions);
105
-
106
- postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
403
+ /**
404
+ * An object that can be used to query performance information from a worker
405
+ * instance. Similar to `perf_hooks.performance`.
406
+ * @since v15.1.0, v14.17.0, v12.22.0
407
+ */
408
+ readonly performance: WorkerPerformance;
409
+ /**
410
+ * @param filename The path to the Worker’s main script or module.
411
+ * Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../,
412
+ * or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path.
413
+ */
414
+ constructor(filename: string | URL, options?: WorkerOptions);
415
+ /**
416
+ * Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
417
+ * See `port.postMessage()` for more details.
418
+ * @since v10.5.0
419
+ */
420
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
421
+ /**
422
+ * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
423
+ * behavior). If the worker is `ref()`ed, calling `ref()` again has
424
+ * no effect.
425
+ * @since v10.5.0
426
+ */
107
427
  ref(): void;
428
+ /**
429
+ * Calling `unref()` on a worker allows the thread to exit if this is the only
430
+ * active handle in the event system. If the worker is already `unref()`ed calling `unref()` again has no effect.
431
+ * @since v10.5.0
432
+ */
108
433
  unref(): void;
109
434
  /**
110
435
  * Stop all JavaScript execution in the worker thread as soon as possible.
111
- * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted.
436
+ * Returns a Promise for the exit code that is fulfilled when the `'exit' event` is emitted.
437
+ * @since v10.5.0
112
438
  */
113
439
  terminate(): Promise<number>;
114
-
440
+ /**
441
+ * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
442
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
443
+ * This methods allows the statistics to be observed from outside the actual thread.
444
+ * @since v22.19.0
445
+ */
446
+ cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
447
+ /**
448
+ * Returns a readable stream for a V8 snapshot of the current state of the Worker.
449
+ * See `v8.getHeapSnapshot()` for more details.
450
+ *
451
+ * If the Worker thread is no longer running, which may occur before the `'exit' event` is emitted, the returned `Promise` is rejected
452
+ * immediately with an `ERR_WORKER_NOT_RUNNING` error.
453
+ * @since v13.9.0, v12.17.0
454
+ * @return A promise for a Readable Stream containing a V8 heap snapshot
455
+ */
456
+ getHeapSnapshot(): Promise<Readable>;
457
+ /**
458
+ * This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
459
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
460
+ * This methods allows the statistics to be observed from outside the actual thread.
461
+ * @since v22.16.0
462
+ */
463
+ getHeapStatistics(): Promise<HeapInfo>;
464
+ /**
465
+ * Calls `worker.terminate()` when the dispose scope is exited.
466
+ *
467
+ * ```js
468
+ * async function example() {
469
+ * await using worker = new Worker('for (;;) {}', { eval: true });
470
+ * // Worker is automatically terminate when the scope is exited.
471
+ * }
472
+ * ```
473
+ * @since v22.18.0
474
+ */
475
+ [Symbol.asyncDispose](): Promise<void>;
115
476
  addListener(event: "error", listener: (err: Error) => void): this;
116
477
  addListener(event: "exit", listener: (exitCode: number) => void): this;
117
478
  addListener(event: "message", listener: (value: any) => void): this;
118
479
  addListener(event: "messageerror", listener: (error: Error) => void): this;
119
480
  addListener(event: "online", listener: () => void): this;
120
481
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
121
-
122
482
  emit(event: "error", err: Error): boolean;
123
483
  emit(event: "exit", exitCode: number): boolean;
124
484
  emit(event: "message", value: any): boolean;
125
485
  emit(event: "messageerror", error: Error): boolean;
126
486
  emit(event: "online"): boolean;
127
487
  emit(event: string | symbol, ...args: any[]): boolean;
128
-
129
488
  on(event: "error", listener: (err: Error) => void): this;
130
489
  on(event: "exit", listener: (exitCode: number) => void): this;
131
490
  on(event: "message", listener: (value: any) => void): this;
132
491
  on(event: "messageerror", listener: (error: Error) => void): this;
133
492
  on(event: "online", listener: () => void): this;
134
493
  on(event: string | symbol, listener: (...args: any[]) => void): this;
135
-
136
494
  once(event: "error", listener: (err: Error) => void): this;
137
495
  once(event: "exit", listener: (exitCode: number) => void): this;
138
496
  once(event: "message", listener: (value: any) => void): this;
139
497
  once(event: "messageerror", listener: (error: Error) => void): this;
140
498
  once(event: "online", listener: () => void): this;
141
499
  once(event: string | symbol, listener: (...args: any[]) => void): this;
142
-
143
500
  prependListener(event: "error", listener: (err: Error) => void): this;
144
501
  prependListener(event: "exit", listener: (exitCode: number) => void): this;
145
502
  prependListener(event: "message", listener: (value: any) => void): this;
146
503
  prependListener(event: "messageerror", listener: (error: Error) => void): this;
147
504
  prependListener(event: "online", listener: () => void): this;
148
505
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
149
-
150
506
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
151
507
  prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
152
508
  prependOnceListener(event: "message", listener: (value: any) => void): this;
153
509
  prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
154
510
  prependOnceListener(event: "online", listener: () => void): this;
155
511
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
156
-
157
512
  removeListener(event: "error", listener: (err: Error) => void): this;
158
513
  removeListener(event: "exit", listener: (exitCode: number) => void): this;
159
514
  removeListener(event: "message", listener: (value: any) => void): this;
160
515
  removeListener(event: "messageerror", listener: (error: Error) => void): this;
161
516
  removeListener(event: "online", listener: () => void): this;
162
517
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
163
-
164
518
  off(event: "error", listener: (err: Error) => void): this;
165
519
  off(event: "exit", listener: (exitCode: number) => void): this;
166
520
  off(event: "message", listener: (value: any) => void): this;
@@ -168,40 +522,263 @@ declare module 'worker_threads' {
168
522
  off(event: "online", listener: () => void): this;
169
523
  off(event: string | symbol, listener: (...args: any[]) => void): this;
170
524
  }
171
-
525
+ interface BroadcastChannel extends NodeJS.RefCounted {}
172
526
  /**
173
- * Mark an object as not transferable.
174
- * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
527
+ * Instances of `BroadcastChannel` allow asynchronous one-to-many communication
528
+ * with all other `BroadcastChannel` instances bound to the same channel name.
175
529
  *
176
- * In particular, this makes sense for objects that can be cloned, rather than transferred,
177
- * and which are used by other objects on the sending side. For example, Node.js marks
178
- * the `ArrayBuffer`s it uses for its Buffer pool with this.
530
+ * ```js
531
+ * 'use strict';
532
+ *
533
+ * import {
534
+ * isMainThread,
535
+ * BroadcastChannel,
536
+ * Worker,
537
+ * } from 'node:worker_threads';
538
+ *
539
+ * const bc = new BroadcastChannel('hello');
540
+ *
541
+ * if (isMainThread) {
542
+ * let c = 0;
543
+ * bc.onmessage = (event) => {
544
+ * console.log(event.data);
545
+ * if (++c === 10) bc.close();
546
+ * };
547
+ * for (let n = 0; n < 10; n++)
548
+ * new Worker(__filename);
549
+ * } else {
550
+ * bc.postMessage('hello from every worker');
551
+ * bc.close();
552
+ * }
553
+ * ```
554
+ * @since v15.4.0
555
+ */
556
+ class BroadcastChannel extends EventTarget {
557
+ readonly name: string;
558
+ /**
559
+ * Invoked with a single \`MessageEvent\` argument when a message is received.
560
+ * @since v15.4.0
561
+ */
562
+ onmessage: (message: MessageEvent) => void;
563
+ /**
564
+ * Invoked with a received message cannot be deserialized.
565
+ * @since v15.4.0
566
+ */
567
+ onmessageerror: (message: MessageEvent) => void;
568
+ constructor(name: string);
569
+ /**
570
+ * Closes the `BroadcastChannel` connection.
571
+ * @since v15.4.0
572
+ */
573
+ close(): void;
574
+ /**
575
+ * @since v15.4.0
576
+ * @param message Any cloneable JavaScript value.
577
+ */
578
+ postMessage(message: unknown): void;
579
+ }
580
+ /**
581
+ * Mark an object as not transferable. If `object` occurs in the transfer list of
582
+ * a `port.postMessage()` call, it is ignored.
583
+ *
584
+ * In particular, this makes sense for objects that can be cloned, rather than
585
+ * transferred, and which are used by other objects on the sending side.
586
+ * For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this.
179
587
  *
180
588
  * This operation cannot be undone.
589
+ *
590
+ * ```js
591
+ * import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
592
+ *
593
+ * const pooledBuffer = new ArrayBuffer(8);
594
+ * const typedArray1 = new Uint8Array(pooledBuffer);
595
+ * const typedArray2 = new Float64Array(pooledBuffer);
596
+ *
597
+ * markAsUntransferable(pooledBuffer);
598
+ *
599
+ * const { port1 } = new MessageChannel();
600
+ * port1.postMessage(typedArray1, [ typedArray1.buffer ]);
601
+ *
602
+ * // The following line prints the contents of typedArray1 -- it still owns
603
+ * // its memory and has been cloned, not transferred. Without
604
+ * // `markAsUntransferable()`, this would print an empty Uint8Array.
605
+ * // typedArray2 is intact as well.
606
+ * console.log(typedArray1);
607
+ * console.log(typedArray2);
608
+ * ```
609
+ *
610
+ * There is no equivalent to this API in browsers.
611
+ * @since v14.5.0, v12.19.0
181
612
  */
182
613
  function markAsUntransferable(object: object): void;
183
-
184
614
  /**
185
- * Transfer a `MessagePort` to a different `vm` Context. The original `port`
186
- * object will be rendered unusable, and the returned `MessagePort` instance will
187
- * take its place.
615
+ * Check if an object is marked as not transferable with
616
+ * {@link markAsUntransferable}.
617
+ * @since v21.0.0
618
+ */
619
+ function isMarkedAsUntransferable(object: object): boolean;
620
+ /**
621
+ * Mark an object as not cloneable. If `object` is used as `message` in
622
+ * a `port.postMessage()` call, an error is thrown. This is a no-op if `object` is a
623
+ * primitive value.
188
624
  *
189
- * The returned `MessagePort` will be an object in the target context, and will
190
- * inherit from its global `Object` class. Objects passed to the
191
- * `port.onmessage()` listener will also be created in the target context
625
+ * This has no effect on `ArrayBuffer`, or any `Buffer` like objects.
626
+ *
627
+ * This operation cannot be undone.
628
+ *
629
+ * ```js
630
+ * const { markAsUncloneable } = require('node:worker_threads');
631
+ *
632
+ * const anyObject = { foo: 'bar' };
633
+ * markAsUncloneable(anyObject);
634
+ * const { port1 } = new MessageChannel();
635
+ * try {
636
+ * // This will throw an error, because anyObject is not cloneable.
637
+ * port1.postMessage(anyObject)
638
+ * } catch (error) {
639
+ * // error.name === 'DataCloneError'
640
+ * }
641
+ * ```
642
+ *
643
+ * There is no equivalent to this API in browsers.
644
+ * @since v22.10.0
645
+ */
646
+ function markAsUncloneable(object: object): void;
647
+ /**
648
+ * Transfer a `MessagePort` to a different `vm` Context. The original `port` object is rendered unusable, and the returned `MessagePort` instance
649
+ * takes its place.
650
+ *
651
+ * The returned `MessagePort` is an object in the target context and
652
+ * inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
653
+ * target context
192
654
  * and inherit from its global `Object` class.
193
655
  *
194
- * However, the created `MessagePort` will no longer inherit from
195
- * `EventEmitter`, and only `port.onmessage()` can be used to receive
656
+ * However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
657
+ * [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
196
658
  * events using it.
659
+ * @since v11.13.0
660
+ * @param port The message port to transfer.
661
+ * @param contextifiedSandbox A `contextified` object as returned by the `vm.createContext()` method.
197
662
  */
198
- function moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
199
-
663
+ function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
200
664
  /**
201
- * Receive a single message from a given `MessagePort`. If no message is available,
202
- * `undefined` is returned, otherwise an object with a single `message` property
203
- * that contains the message payload, corresponding to the oldest message in the
204
- * `MessagePort`’s queue.
665
+ * Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
666
+ * that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
667
+ *
668
+ * ```js
669
+ * import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
670
+ * const { port1, port2 } = new MessageChannel();
671
+ * port1.postMessage({ hello: 'world' });
672
+ *
673
+ * console.log(receiveMessageOnPort(port2));
674
+ * // Prints: { message: { hello: 'world' } }
675
+ * console.log(receiveMessageOnPort(port2));
676
+ * // Prints: undefined
677
+ * ```
678
+ *
679
+ * When this function is used, no `'message'` event is emitted and the `onmessage` listener is not invoked.
680
+ * @since v12.3.0
681
+ */
682
+ function receiveMessageOnPort(port: MessagePort):
683
+ | {
684
+ message: any;
685
+ }
686
+ | undefined;
687
+ type Serializable = string | object | number | boolean | bigint;
688
+ /**
689
+ * Within a worker thread, `worker.getEnvironmentData()` returns a clone
690
+ * of data passed to the spawning thread's `worker.setEnvironmentData()`.
691
+ * Every new `Worker` receives its own copy of the environment data
692
+ * automatically.
693
+ *
694
+ * ```js
695
+ * import {
696
+ * Worker,
697
+ * isMainThread,
698
+ * setEnvironmentData,
699
+ * getEnvironmentData,
700
+ * } from 'node:worker_threads';
701
+ *
702
+ * if (isMainThread) {
703
+ * setEnvironmentData('Hello', 'World!');
704
+ * const worker = new Worker(__filename);
705
+ * } else {
706
+ * console.log(getEnvironmentData('Hello')); // Prints 'World!'.
707
+ * }
708
+ * ```
709
+ * @since v15.12.0, v14.18.0
710
+ * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
711
+ */
712
+ function getEnvironmentData(key: Serializable): Serializable;
713
+ /**
714
+ * The `worker.setEnvironmentData()` API sets the content of `worker.getEnvironmentData()` in the current thread and all new `Worker` instances spawned from the current context.
715
+ * @since v15.12.0, v14.18.0
716
+ * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
717
+ * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
718
+ * for the `key` will be deleted.
719
+ */
720
+ function setEnvironmentData(key: Serializable, value?: Serializable): void;
721
+ /**
722
+ * Sends a value to another worker, identified by its thread ID.
723
+ * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
724
+ * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
725
+ * @param value The value to send.
726
+ * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
727
+ * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
728
+ * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
729
+ * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
730
+ * @since v22.5.0
205
731
  */
206
- function receiveMessageOnPort(port: MessagePort): { message: any } | undefined;
732
+ function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
733
+ function postMessageToThread(
734
+ threadId: number,
735
+ value: any,
736
+ transferList: readonly Transferable[],
737
+ timeout?: number,
738
+ ): Promise<void>;
739
+
740
+ import {
741
+ BroadcastChannel as _BroadcastChannel,
742
+ MessageChannel as _MessageChannel,
743
+ MessagePort as _MessagePort,
744
+ } from "worker_threads";
745
+ global {
746
+ function structuredClone<T>(
747
+ value: T,
748
+ options?: { transfer?: Transferable[] },
749
+ ): T;
750
+ /**
751
+ * `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
752
+ * https://nodejs.org/api/globals.html#broadcastchannel
753
+ * @since v18.0.0
754
+ */
755
+ var BroadcastChannel: typeof globalThis extends {
756
+ onmessage: any;
757
+ BroadcastChannel: infer T;
758
+ } ? T
759
+ : typeof _BroadcastChannel;
760
+ /**
761
+ * `MessageChannel` class is a global reference for `import { MessageChannel } from 'worker_threads'`
762
+ * https://nodejs.org/api/globals.html#messagechannel
763
+ * @since v15.0.0
764
+ */
765
+ var MessageChannel: typeof globalThis extends {
766
+ onmessage: any;
767
+ MessageChannel: infer T;
768
+ } ? T
769
+ : typeof _MessageChannel;
770
+ /**
771
+ * `MessagePort` class is a global reference for `import { MessagePort } from 'worker_threads'`
772
+ * https://nodejs.org/api/globals.html#messageport
773
+ * @since v15.0.0
774
+ */
775
+ var MessagePort: typeof globalThis extends {
776
+ onmessage: any;
777
+ MessagePort: infer T;
778
+ } ? T
779
+ : typeof _MessagePort;
780
+ }
781
+ }
782
+ declare module "node:worker_threads" {
783
+ export * from "worker_threads";
207
784
  }