visaljs 0.0.6 → 0.0.8

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 (428) hide show
  1. package/README.md +63 -2
  2. package/THIRD_PARTY_LICENSES +1216 -0
  3. package/cli.js +4414 -325
  4. package/node/include/js_node.h +57 -1
  5. package/node/include/js_uv.h +8 -1
  6. package/node/prelude/_stream_duplex.js +4 -0
  7. package/node/prelude/_stream_passthrough.js +4 -0
  8. package/node/prelude/_stream_readable.js +4 -0
  9. package/node/prelude/_stream_transform.js +4 -0
  10. package/node/prelude/_stream_writable.js +4 -0
  11. package/node/prelude/assert.js +1334 -0
  12. package/node/prelude/assert_strict.js +12 -0
  13. package/node/prelude/async_hooks.js +1 -1
  14. package/node/prelude/buffer.js +43 -3
  15. package/node/prelude/child_process.js +1098 -0
  16. package/node/prelude/cluster.js +52 -0
  17. package/node/prelude/console.js +328 -0
  18. package/node/prelude/constants.js +10 -0
  19. package/node/prelude/crypto.js +1 -1
  20. package/node/prelude/diagnostics_channel.js +1 -1
  21. package/node/prelude/dns.js +1 -1
  22. package/node/prelude/domain.js +115 -0
  23. package/node/prelude/events.js +144 -16
  24. package/node/prelude/fs.js +1138 -151
  25. package/node/prelude/fs_promises.js +117 -11
  26. package/node/prelude/http.js +104 -27
  27. package/node/prelude/http2.js +1 -1
  28. package/node/prelude/https.js +148 -0
  29. package/node/prelude/inspector.js +27 -0
  30. package/node/prelude/inspector_promises.js +4 -0
  31. package/node/prelude/internal/async_context.js +1 -1
  32. package/node/prelude/internal/buffer_transcode.js +44 -0
  33. package/node/prelude/internal/comparisons.js +916 -0
  34. package/node/prelude/internal/compression_streams.js +153 -0
  35. package/node/prelude/internal/crypto/asym.js +27 -14
  36. package/node/prelude/internal/crypto/cipher.js +16 -5
  37. package/node/prelude/internal/crypto/diffiehellman.js +3 -2
  38. package/node/prelude/internal/crypto/hash.js +2 -1
  39. package/node/prelude/internal/crypto/kdf.js +14 -9
  40. package/node/prelude/internal/crypto/keys.js +63 -50
  41. package/node/prelude/internal/crypto/random.js +2 -1
  42. package/node/prelude/internal/crypto/util.js +4 -4
  43. package/node/prelude/internal/dotenv.js +98 -0
  44. package/node/prelude/internal/errors.js +21 -5
  45. package/node/prelude/internal/events_extras.js +116 -0
  46. package/node/prelude/internal/events_on.js +100 -0
  47. package/node/prelude/internal/features.js +55 -0
  48. package/node/prelude/internal/fetch.js +364 -0
  49. package/node/prelude/internal/form_data.js +376 -0
  50. package/node/prelude/internal/fs_bigint_stats.js +41 -0
  51. package/node/prelude/internal/fs_blob.js +19 -0
  52. package/node/prelude/internal/fs_cp.js +709 -0
  53. package/node/prelude/internal/fs_dir.js +166 -0
  54. package/node/prelude/internal/fs_filehandle.js +287 -0
  55. package/node/prelude/internal/fs_glob.js +296 -0
  56. package/node/prelude/internal/fs_statfs.js +42 -0
  57. package/node/prelude/internal/fs_stats.js +89 -0
  58. package/node/prelude/internal/fs_streams.js +541 -0
  59. package/node/prelude/internal/fs_utils.js +286 -0
  60. package/node/prelude/internal/fs_watch.js +580 -0
  61. package/node/prelude/internal/http_agent.js +26 -0
  62. package/node/prelude/internal/mime.js +249 -0
  63. package/node/prelude/internal/net.js +1 -0
  64. package/node/prelude/internal/parse_args.js +288 -0
  65. package/node/prelude/internal/perf_histogram.js +435 -0
  66. package/node/prelude/internal/perf_observe.js +119 -0
  67. package/node/prelude/internal/performance_global.js +19 -0
  68. package/node/prelude/internal/process_events.js +49 -1
  69. package/node/prelude/internal/process_memory.js +14 -0
  70. package/node/prelude/internal/process_more.js +414 -0
  71. package/node/prelude/internal/process_signals.js +2 -1
  72. package/node/prelude/internal/process_stdin.js +52 -0
  73. package/node/prelude/internal/process_stdio.js +36 -0
  74. package/node/prelude/internal/querystring.js +0 -0
  75. package/node/prelude/internal/readline.js +338 -0
  76. package/node/prelude/internal/socketaddress.js +8 -4
  77. package/node/prelude/internal/source_map.js +122 -0
  78. package/node/prelude/internal/stream_compose.js +74 -0
  79. package/node/prelude/internal/stream_from.js +6 -0
  80. package/node/prelude/internal/stream_operators.js +23 -0
  81. package/node/prelude/internal/stream_pipeline.js +7 -0
  82. package/node/prelude/internal/stream_transform.js +10 -0
  83. package/node/prelude/internal/stream_web_adapters.js +143 -0
  84. package/node/prelude/internal/streams/add_abort_signal.js +58 -0
  85. package/node/prelude/internal/streams/compose.js +244 -0
  86. package/node/prelude/internal/streams/destroy.js +358 -0
  87. package/node/prelude/internal/streams/duplex.js +199 -0
  88. package/node/prelude/internal/streams/duplexify.js +378 -0
  89. package/node/prelude/internal/streams/end_of_stream.js +387 -0
  90. package/node/prelude/internal/streams/errors.js +216 -0
  91. package/node/prelude/internal/streams/from.js +211 -0
  92. package/node/prelude/internal/streams/legacy.js +120 -0
  93. package/node/prelude/internal/streams/operators.js +375 -0
  94. package/node/prelude/internal/streams/passthrough.js +45 -0
  95. package/node/prelude/internal/streams/pipeline.js +468 -0
  96. package/node/prelude/internal/streams/readable.js +1835 -0
  97. package/node/prelude/internal/streams/state.js +48 -0
  98. package/node/prelude/internal/streams/transform.js +203 -0
  99. package/node/prelude/internal/streams/utils.js +355 -0
  100. package/node/prelude/internal/streams/validators.js +108 -0
  101. package/node/prelude/internal/streams/writable.js +1160 -0
  102. package/node/prelude/internal/structured_clone.js +238 -0
  103. package/node/prelude/internal/system_errors.js +37 -0
  104. package/node/prelude/internal/test_runner/mock.js +431 -0
  105. package/node/prelude/internal/test_runner/reporters.js +404 -0
  106. package/node/prelude/internal/test_runner/test.js +1571 -0
  107. package/node/prelude/internal/timers.js +38 -7
  108. package/node/prelude/internal/timers_global.js +1 -1
  109. package/node/prelude/internal/tls/common.js +8 -2
  110. package/node/prelude/internal/tls/wrap.js +3 -15
  111. package/node/prelude/internal/tls/x509.js +1 -1
  112. package/node/prelude/internal/tty_read_stream.js +39 -0
  113. package/node/prelude/internal/tty_streams.js +3 -0
  114. package/node/prelude/internal/util_debuglog.js +68 -0
  115. package/node/prelude/internal/util_diff.js +63 -0
  116. package/node/prelude/internal/util_more.js +111 -0
  117. package/node/prelude/internal/util_styles.js +76 -0
  118. package/node/prelude/internal/zlib_engines.js +1 -1
  119. package/node/prelude/module.js +194 -7
  120. package/node/prelude/net.js +2 -1
  121. package/node/prelude/os.js +88 -11
  122. package/node/prelude/path.js +11 -7
  123. package/node/prelude/path_posix.js +1 -1
  124. package/node/prelude/path_win32.js +1 -1
  125. package/node/prelude/perf_hooks.js +147 -0
  126. package/node/prelude/process.js +36 -1
  127. package/node/prelude/punycode.js +188 -0
  128. package/node/prelude/querystring.js +1 -1
  129. package/node/prelude/readline.js +8 -0
  130. package/node/prelude/readline_promises.js +88 -0
  131. package/node/prelude/repl.js +38 -0
  132. package/node/prelude/sea.js +23 -0
  133. package/node/prelude/stream.js +70 -1332
  134. package/node/prelude/stream_consumers.js +34 -0
  135. package/node/prelude/stream_promises.js +1 -1
  136. package/node/prelude/stream_web.js +15 -2
  137. package/node/prelude/string_decoder.js +1 -1
  138. package/node/prelude/sys.js +7 -0
  139. package/node/prelude/test.js +56 -0
  140. package/node/prelude/test_reporters.js +269 -0
  141. package/node/prelude/timers.js +7 -84
  142. package/node/prelude/timers_promises.js +1 -1
  143. package/node/prelude/tls.js +2 -1
  144. package/node/prelude/trace_events.js +52 -0
  145. package/node/prelude/tty.js +10 -4
  146. package/node/prelude/url.js +88 -27
  147. package/node/prelude/util.js +121 -5
  148. package/node/prelude/util_types.js +4 -3
  149. package/node/prelude/v8.js +814 -0
  150. package/node/prelude/vm.js +86 -0
  151. package/node/prelude/wasi.js +10 -0
  152. package/node/prelude/worker_threads.js +56 -0
  153. package/node/prelude/zlib.js +58 -25
  154. package/node/src/host_brotli.c +59 -11
  155. package/node/src/host_fs.c +342 -11
  156. package/node/src/host_fswatch.c +170 -0
  157. package/node/src/host_http.c +143 -20
  158. package/node/src/host_loop.c +25 -2
  159. package/node/src/host_net.c +55 -7
  160. package/node/src/host_os.c +55 -1
  161. package/node/src/host_proc.c +291 -0
  162. package/node/src/host_process.c +488 -0
  163. package/node/src/host_sys.c +64 -2
  164. package/node/src/host_zlib.c +27 -7
  165. package/node/src/host_zstd.c +41 -6
  166. package/node/third_party/hdrhistogram/LICENSE +42 -0
  167. package/node/third_party/hdrhistogram/README.md +5 -0
  168. package/node/third_party/libuv/LICENSE +0 -0
  169. package/node/third_party/libuv/LICENSE-extra +36 -0
  170. package/node/third_party/libuv/include/uv/aix.h +0 -0
  171. package/node/third_party/libuv/include/uv/bsd.h +0 -0
  172. package/node/third_party/libuv/include/uv/darwin.h +0 -0
  173. package/node/third_party/libuv/include/uv/errno.h +0 -0
  174. package/node/third_party/libuv/include/uv/linux.h +0 -0
  175. package/node/third_party/libuv/include/uv/os390.h +0 -0
  176. package/node/third_party/libuv/include/uv/posix.h +0 -0
  177. package/node/third_party/libuv/include/uv/sunos.h +0 -0
  178. package/node/third_party/libuv/include/uv/threadpool.h +0 -0
  179. package/node/third_party/libuv/include/uv/tree.h +0 -0
  180. package/node/third_party/libuv/include/uv/unix.h +0 -0
  181. package/node/third_party/libuv/include/uv/version.h +0 -0
  182. package/node/third_party/libuv/include/uv/win.h +0 -0
  183. package/node/third_party/libuv/include/uv.h +0 -0
  184. package/node/third_party/libuv/src/fs-poll.c +0 -0
  185. package/node/third_party/libuv/src/heap-inl.h +0 -0
  186. package/node/third_party/libuv/src/idna.c +0 -0
  187. package/node/third_party/libuv/src/idna.h +0 -0
  188. package/node/third_party/libuv/src/inet.c +0 -0
  189. package/node/third_party/libuv/src/queue.h +0 -0
  190. package/node/third_party/libuv/src/random.c +0 -0
  191. package/node/third_party/libuv/src/strscpy.c +0 -0
  192. package/node/third_party/libuv/src/strscpy.h +0 -0
  193. package/node/third_party/libuv/src/strtok.c +0 -0
  194. package/node/third_party/libuv/src/strtok.h +0 -0
  195. package/node/third_party/libuv/src/thread-common.c +0 -0
  196. package/node/third_party/libuv/src/threadpool.c +0 -0
  197. package/node/third_party/libuv/src/timer.c +0 -0
  198. package/node/third_party/libuv/src/unix/async.c +0 -0
  199. package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +0 -0
  200. package/node/third_party/libuv/src/unix/core.c +0 -0
  201. package/node/third_party/libuv/src/unix/darwin-proctitle.c +0 -0
  202. package/node/third_party/libuv/src/unix/darwin-stub.h +0 -0
  203. package/node/third_party/libuv/src/unix/darwin-syscalls.h +0 -0
  204. package/node/third_party/libuv/src/unix/darwin.c +0 -0
  205. package/node/third_party/libuv/src/unix/dl.c +0 -0
  206. package/node/third_party/libuv/src/unix/fs.c +0 -0
  207. package/node/third_party/libuv/src/unix/fsevents.c +0 -0
  208. package/node/third_party/libuv/src/unix/getaddrinfo.c +0 -0
  209. package/node/third_party/libuv/src/unix/getnameinfo.c +0 -0
  210. package/node/third_party/libuv/src/unix/internal.h +0 -0
  211. package/node/third_party/libuv/src/unix/kqueue.c +0 -0
  212. package/node/third_party/libuv/src/unix/linux.c +0 -0
  213. package/node/third_party/libuv/src/unix/loop-watcher.c +0 -0
  214. package/node/third_party/libuv/src/unix/loop.c +0 -0
  215. package/node/third_party/libuv/src/unix/pipe.c +0 -0
  216. package/node/third_party/libuv/src/unix/poll.c +0 -0
  217. package/node/third_party/libuv/src/unix/process.c +0 -0
  218. package/node/third_party/libuv/src/unix/procfs-exepath.c +0 -0
  219. package/node/third_party/libuv/src/unix/proctitle.c +0 -0
  220. package/node/third_party/libuv/src/unix/random-devurandom.c +0 -0
  221. package/node/third_party/libuv/src/unix/random-getentropy.c +0 -0
  222. package/node/third_party/libuv/src/unix/random-getrandom.c +0 -0
  223. package/node/third_party/libuv/src/unix/random-sysctl-linux.c +0 -0
  224. package/node/third_party/libuv/src/unix/signal.c +0 -0
  225. package/node/third_party/libuv/src/unix/stream.c +0 -0
  226. package/node/third_party/libuv/src/unix/tcp.c +0 -0
  227. package/node/third_party/libuv/src/unix/thread.c +0 -0
  228. package/node/third_party/libuv/src/unix/tty.c +0 -0
  229. package/node/third_party/libuv/src/unix/udp.c +0 -0
  230. package/node/third_party/libuv/src/uv-common.c +0 -0
  231. package/node/third_party/libuv/src/uv-common.h +0 -0
  232. package/node/third_party/libuv/src/uv-data-getter-setters.c +0 -0
  233. package/node/third_party/libuv/src/version.c +0 -0
  234. package/node/third_party/llhttp/LICENSE +0 -0
  235. package/node/third_party/llhttp/api.c +0 -0
  236. package/node/third_party/llhttp/http.c +0 -0
  237. package/node/third_party/llhttp/llhttp.c +0 -0
  238. package/node/third_party/llhttp/llhttp.h +0 -0
  239. package/node/third_party/nodejs/LICENSE +47 -0
  240. package/node/third_party/nodejs/README.md +5 -0
  241. package/node/third_party/parseargs/LICENSE +21 -0
  242. package/node/third_party/parseargs/README.md +5 -0
  243. package/node/third_party/punycode/LICENSE +20 -0
  244. package/node/third_party/punycode/README.md +5 -0
  245. package/node/third_party/zlib/LICENSE.chromium +27 -0
  246. package/package.json +1 -5
  247. package/prebuilt/darwin-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
  248. package/prebuilt/darwin-arm64/brotli-7995bbdacc52e51c.a +0 -0
  249. package/prebuilt/darwin-arm64/uv-72ab666eae197cd8.a +0 -0
  250. package/prebuilt/darwin-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
  251. package/prebuilt/darwin-arm64/zstd-015315ac7c784c73.a +0 -0
  252. package/prebuilt/darwin-x64/boringssl-4a47438eaf7e73ba.a +0 -0
  253. package/prebuilt/darwin-x64/brotli-7995bbdacc52e51c.a +0 -0
  254. package/prebuilt/darwin-x64/uv-72ab666eae197cd8.a +0 -0
  255. package/prebuilt/darwin-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  256. package/prebuilt/darwin-x64/zstd-015315ac7c784c73.a +0 -0
  257. package/prebuilt/linux-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
  258. package/prebuilt/linux-arm64/brotli-65481ff838ce9def.a +0 -0
  259. package/prebuilt/linux-arm64/uv-f1353f50ff983f3c.a +0 -0
  260. package/prebuilt/linux-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
  261. package/prebuilt/linux-arm64/zstd-015315ac7c784c73.a +0 -0
  262. package/prebuilt/linux-arm64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
  263. package/prebuilt/linux-arm64-musl/brotli-65481ff838ce9def.a +0 -0
  264. package/prebuilt/linux-arm64-musl/uv-f1353f50ff983f3c.a +0 -0
  265. package/prebuilt/linux-arm64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
  266. package/prebuilt/linux-arm64-musl/zstd-015315ac7c784c73.a +0 -0
  267. package/prebuilt/linux-x64/boringssl-4a47438eaf7e73ba.a +0 -0
  268. package/prebuilt/linux-x64/brotli-65481ff838ce9def.a +0 -0
  269. package/prebuilt/linux-x64/uv-f1353f50ff983f3c.a +0 -0
  270. package/prebuilt/linux-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  271. package/prebuilt/linux-x64/zstd-015315ac7c784c73.a +0 -0
  272. package/prebuilt/linux-x64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
  273. package/prebuilt/linux-x64-musl/brotli-65481ff838ce9def.a +0 -0
  274. package/prebuilt/linux-x64-musl/uv-f1353f50ff983f3c.a +0 -0
  275. package/prebuilt/linux-x64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
  276. package/prebuilt/linux-x64-musl/zstd-015315ac7c784c73.a +0 -0
  277. package/prebuilt/win32-x64/boringssl-ce573858472b7fc9.a +0 -0
  278. package/prebuilt/win32-x64/brotli-20d86a61f30baeb3.a +0 -0
  279. package/prebuilt/win32-x64/uv-b11bae65d7fced82.a +0 -0
  280. package/prebuilt/win32-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  281. package/prebuilt/win32-x64/zstd-015315ac7c784c73.a +0 -0
  282. package/runtime/include/js_atoms.gen.h +0 -0
  283. package/runtime/include/js_atoms.h +1 -1
  284. package/runtime/include/js_bigint.h +1 -1
  285. package/runtime/include/js_buffer.h +4 -4
  286. package/runtime/include/js_builtins.h +41 -3
  287. package/runtime/include/js_console.h +9 -4
  288. package/runtime/include/js_convert.h +1 -1
  289. package/runtime/include/js_core.def +5 -4
  290. package/runtime/include/js_crypto.h +1 -1
  291. package/runtime/include/js_error.h +1 -1
  292. package/runtime/include/js_exception.h +21 -1
  293. package/runtime/include/js_function.h +33 -9
  294. package/runtime/include/js_gc.h +172 -30
  295. package/runtime/include/js_generator.h +2 -2
  296. package/runtime/include/js_host.h +19 -1
  297. package/runtime/include/js_jobs.h +5 -5
  298. package/runtime/include/js_module.h +1 -1
  299. package/runtime/include/js_object.h +142 -15
  300. package/runtime/include/js_ops.h +107 -5
  301. package/runtime/include/js_promise.h +3 -3
  302. package/runtime/include/js_regexp.h +1 -1
  303. package/runtime/include/js_runtime.h +0 -0
  304. package/runtime/include/js_symbol.h +1 -1
  305. package/runtime/include/js_web.h +2 -1
  306. package/runtime/include/jscell.h +22 -15
  307. package/runtime/include/jscontext.h +74 -39
  308. package/runtime/include/jsnum.h +1 -1
  309. package/runtime/include/jsstring.h +19 -6
  310. package/runtime/include/jsvalue.h +7 -3
  311. package/runtime/src/arguments.c +2 -2
  312. package/runtime/src/array.c +4 -1
  313. package/runtime/src/arraybuffer.c +19 -7
  314. package/runtime/src/async_iter.c +4 -3
  315. package/runtime/src/atoms.c +1 -1
  316. package/runtime/src/base64.c +2 -2
  317. package/runtime/src/bigint.c +1 -1
  318. package/runtime/src/blob.c +22 -9
  319. package/runtime/src/boringssl_support.cc +1 -1
  320. package/runtime/src/buffer.c +299 -91
  321. package/runtime/src/builtin_table.c +1 -1
  322. package/runtime/src/builtins.c +30 -4
  323. package/runtime/src/builtins_util.h +0 -0
  324. package/runtime/src/collections.c +18 -3
  325. package/runtime/src/components.c +1 -1
  326. package/runtime/src/console.c +14 -7
  327. package/runtime/src/convert.c +0 -0
  328. package/runtime/src/core_all.c +1 -1
  329. package/runtime/src/crypto.c +1 -1
  330. package/runtime/src/crypto_asym.c +1 -1
  331. package/runtime/src/crypto_bn.c +1 -1
  332. package/runtime/src/crypto_cipher.c +10 -3
  333. package/runtime/src/crypto_hash.c +1 -1
  334. package/runtime/src/crypto_host.c +1 -1
  335. package/runtime/src/crypto_internal.h +1 -1
  336. package/runtime/src/crypto_kdf.c +1 -1
  337. package/runtime/src/crypto_key.c +14 -1
  338. package/runtime/src/crypto_pkey.c +1 -1
  339. package/runtime/src/crypto_subtle.c +142 -58
  340. package/runtime/src/crypto_tls.c +1 -1
  341. package/runtime/src/date.c +5 -2
  342. package/runtime/src/domexception.c +2 -2
  343. package/runtime/src/elements.c +56 -17
  344. package/runtime/src/elements.h +7 -2
  345. package/runtime/src/encoding.c +1 -1
  346. package/runtime/src/error.c +4 -4
  347. package/runtime/src/events.c +23 -14
  348. package/runtime/src/exception.c +1 -1
  349. package/runtime/src/fetch.c +241 -17
  350. package/runtime/src/function.c +31 -19
  351. package/runtime/src/gc.c +1716 -207
  352. package/runtime/src/gc_visit.h +87 -0
  353. package/runtime/src/generator.c +5 -3
  354. package/runtime/src/global.c +14 -6
  355. package/runtime/src/headers.c +10 -10
  356. package/runtime/src/inspect.c +76 -17
  357. package/runtime/src/internal.h +5 -2
  358. package/runtime/src/iterate.c +94 -2
  359. package/runtime/src/iterator.c +1 -1
  360. package/runtime/src/jobs.c +11 -5
  361. package/runtime/src/jsnum.c +2 -2
  362. package/runtime/src/json.c +1 -1
  363. package/runtime/src/math.c +9 -1
  364. package/runtime/src/module.c +3 -3
  365. package/runtime/src/number.c +0 -0
  366. package/runtime/src/object.c +107 -74
  367. package/runtime/src/ops.c +21 -3
  368. package/runtime/src/os.c +192 -1
  369. package/runtime/src/os.h +33 -2
  370. package/runtime/src/process.c +73 -8
  371. package/runtime/src/promise.c +4 -4
  372. package/runtime/src/proxy.c +1 -1
  373. package/runtime/src/reflect.c +1 -1
  374. package/runtime/src/regexp.c +134 -2
  375. package/runtime/src/regexp_anchor.h +1 -1
  376. package/runtime/src/regexp_message.h +1 -1
  377. package/runtime/src/shape.c +10 -19
  378. package/runtime/src/shape.h +0 -0
  379. package/runtime/src/streams.c +22 -8
  380. package/runtime/src/streams.h +0 -0
  381. package/runtime/src/string.c +64 -25
  382. package/runtime/src/string_builtins.c +7 -7
  383. package/runtime/src/symbol.c +2 -7
  384. package/runtime/src/test_host.c +3 -3
  385. package/runtime/src/tls_roots.gen.h +102 -620
  386. package/runtime/src/typedarray.c +8 -3
  387. package/runtime/src/tznames.gen.h +2 -1
  388. package/runtime/src/uri.c +1 -1
  389. package/runtime/src/url.c +42 -39
  390. package/runtime/src/weak.c +15 -12
  391. package/runtime/src/web.c +21 -3
  392. package/runtime/src/wrapper.c +0 -0
  393. package/runtime/src/writable.c +7 -6
  394. package/runtime/third_party/ada-idna/LICENSE-MIT +0 -0
  395. package/runtime/third_party/ada-idna/README.md +7 -7
  396. package/runtime/third_party/ada-idna/convert.mjs +89 -27
  397. package/runtime/third_party/ada-idna/idna.c +30 -31
  398. package/runtime/third_party/ada-idna/idna.h +0 -0
  399. package/runtime/third_party/ada-idna/idna_tables.h +2272 -1952
  400. package/runtime/third_party/boringssl/third_party/fiat/LICENSE +15 -0
  401. package/runtime/third_party/mozilla-ca/LICENSE +373 -0
  402. package/runtime/third_party/mozilla-ca/README.md +9 -0
  403. package/runtime/third_party/nodejs/LICENSE +47 -0
  404. package/runtime/third_party/nodejs/README.md +7 -0
  405. package/runtime/third_party/quickjs-dtoa/LICENSE +0 -0
  406. package/runtime/third_party/quickjs-dtoa/README.md +1 -1
  407. package/runtime/third_party/quickjs-dtoa/dtoa.c +0 -0
  408. package/runtime/third_party/quickjs-dtoa/dtoa.h +0 -0
  409. package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +0 -0
  410. package/runtime/third_party/quickjs-regexp/LICENSE +0 -0
  411. package/runtime/third_party/quickjs-regexp/README.md +2 -2
  412. package/runtime/third_party/quickjs-regexp/cutils.c +0 -0
  413. package/runtime/third_party/quickjs-regexp/cutils.h +0 -0
  414. package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +0 -0
  415. package/runtime/third_party/quickjs-regexp/libregexp.c +0 -0
  416. package/runtime/third_party/quickjs-regexp/libregexp.h +0 -0
  417. package/runtime/third_party/quickjs-regexp/libunicode-table.h +0 -0
  418. package/runtime/third_party/quickjs-regexp/libunicode.c +0 -0
  419. package/runtime/third_party/quickjs-regexp/libunicode.h +0 -0
  420. package/runtime/third_party/unicode/LICENSE +39 -0
  421. package/runtime/third_party/unicode/README.md +9 -0
  422. package/runtime/third_party/v8-ieee754/LICENSE +0 -0
  423. package/runtime/third_party/v8-ieee754/LICENSE.fdlibm +10 -0
  424. package/runtime/third_party/v8-ieee754/README.md +3 -2
  425. package/runtime/third_party/v8-ieee754/convert.py +0 -0
  426. package/runtime/third_party/v8-ieee754/ieee754.c +0 -0
  427. package/runtime/third_party/v8-ieee754/ieee754.h +0 -0
  428. package/runtime/tools/regexp_compile.c +2 -2
@@ -0,0 +1,34 @@
1
+ // node:stream/consumers: a stream read to its end as text, JSON, bytes or a Blob, as Node's: any
2
+ // async iterable of chunks (a Readable, a web ReadableStream, an async generator).
3
+
4
+ /** The chunks as a Blob. */
5
+ export async function blob(stream) {
6
+ const chunks = [];
7
+ for await (const chunk of stream) chunks.push(chunk);
8
+ return new globalThis.Blob(chunks);
9
+ }
10
+
11
+ export async function arrayBuffer(stream) {
12
+ return (await blob(stream)).arrayBuffer();
13
+ }
14
+
15
+ export async function buffer(stream) {
16
+ return Buffer.from(await arrayBuffer(stream));
17
+ }
18
+
19
+ /** The chunks as UTF-8 text: strings as they are, bytes decoded across chunk boundaries. */
20
+ export async function text(stream) {
21
+ const decoder = new TextDecoder();
22
+ let string = "";
23
+ for await (const chunk of stream) {
24
+ if (typeof chunk === "string") string += chunk;
25
+ else string += decoder.decode(chunk, { stream: true });
26
+ }
27
+ return string + decoder.decode(undefined, { stream: false });
28
+ }
29
+
30
+ export async function json(stream) {
31
+ return JSON.parse(await text(stream));
32
+ }
33
+
34
+ export default { arrayBuffer, blob, buffer, json, text };
@@ -1,4 +1,4 @@
1
- // node:stream/promises (ADR 0012, layer 3): pipeline and finished, as promises.
1
+ // node:stream/promises: pipeline and finished as promises (lib/stream/promises.js).
2
2
  import { promises } from "./stream.js";
3
3
 
4
4
  export const pipeline = promises.pipeline;
@@ -1,6 +1,19 @@
1
- // node:stream/web (ADR 0012, layer 3): the web streams the runtime provides as globals.
1
+ // node:stream/web: the web streams the runtime provides as globals, and the compression streams
2
+ // (internal/compression_streams.js, linked into programs that name them).
3
+ import { lazyClass } from "./internal/features.js";
4
+
2
5
  export const ReadableStream = globalThis.ReadableStream;
3
6
  export const ReadableStreamDefaultReader = globalThis.ReadableStreamDefaultReader;
4
7
  export const ReadableStreamDefaultController = globalThis.ReadableStreamDefaultController;
8
+ export const WritableStream = globalThis.WritableStream;
9
+ export const WritableStreamDefaultWriter = globalThis.WritableStreamDefaultWriter;
10
+ export const WritableStreamDefaultController = globalThis.WritableStreamDefaultController;
11
+ export const TransformStream = globalThis.TransformStream;
12
+ export const TransformStreamDefaultController = globalThis.TransformStreamDefaultController;
13
+ export const CompressionStream = lazyClass("CompressionStream");
14
+ export const DecompressionStream = lazyClass("DecompressionStream");
5
15
 
6
- export default { ReadableStream, ReadableStreamDefaultReader, ReadableStreamDefaultController };
16
+ export default {
17
+ ReadableStream, ReadableStreamDefaultReader, ReadableStreamDefaultController, WritableStream, WritableStreamDefaultWriter,
18
+ WritableStreamDefaultController, TransformStream, TransformStreamDefaultController, CompressionStream, DecompressionStream,
19
+ };
@@ -1,4 +1,4 @@
1
- // node:string_decoder (ADR 0012, layer 3): StringDecoder, which decodes Buffers to strings without
1
+ // node:string_decoder: StringDecoder, which decodes Buffers to strings without
2
2
  // splitting a character (UTF-8, UTF-16LE) or a base64 group across writes. Node's algorithm (its
3
3
  // JavaScript one, before it moved to C++); the other encodings decode chunk by chunk.
4
4
  import { codeError } from "./internal/errors.js";
@@ -0,0 +1,7 @@
1
+ // node:sys: node:util under its old name, deprecated (DEP0025): the same object.
2
+ import util from "./util.js";
3
+
4
+ process.emitWarning("sys is deprecated. Use util instead.", "DeprecationWarning", "DEP0025");
5
+
6
+ export * from "./util.js";
7
+ export default util;
@@ -0,0 +1,56 @@
1
+ // node:test: Node's test runner in a compiled program (lib/test.js; the runner
2
+ // is internal/test_runner/). test / it, describe / suite, the hooks, test contexts (subtests,
3
+ // plan, skip, todo, diagnostic, t.mock, t.assert, waitFor), mocks, and the tap and spec
4
+ // reporters. Not here: run() (a process per test file), snapshots, mock.timers and mock.module.
5
+ // Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
6
+ import { notSupported } from "./internal/errors.js";
7
+ import { MockTracker } from "./internal/test_runner/mock.js";
8
+ import { hook, registerAssertion, run, runInParentContext, Suite, Test } from "./internal/test_runner/test.js";
9
+
10
+ const test = runInParentContext(Test);
11
+ const suite = runInParentContext(Suite);
12
+ const before = hook("before");
13
+ const after = hook("after");
14
+ const beforeEach = hook("beforeEach");
15
+ const afterEach = hook("afterEach");
16
+
17
+ let lazyMock;
18
+ const testAssert = { __proto__: null, register: registerAssertion };
19
+
20
+ Object.assign(test, {
21
+ after,
22
+ afterEach,
23
+ before,
24
+ beforeEach,
25
+ describe: suite,
26
+ it: test,
27
+ run,
28
+ suite,
29
+ test,
30
+ });
31
+
32
+ Object.defineProperty(test, "mock", {
33
+ configurable: true,
34
+ enumerable: true,
35
+ get() {
36
+ lazyMock ??= new MockTracker();
37
+ return lazyMock;
38
+ },
39
+ });
40
+
41
+ const snapshot = {
42
+ __proto__: null,
43
+ setDefaultSnapshotSerializers() {
44
+ throw notSupported("node:test's snapshots");
45
+ },
46
+ setResolveSnapshotPath() {
47
+ throw notSupported("node:test's snapshots");
48
+ },
49
+ };
50
+ Object.defineProperty(test, "snapshot", { configurable: true, enumerable: true, value: snapshot });
51
+
52
+ Object.defineProperty(test, "assert", { configurable: true, enumerable: true, value: testAssert });
53
+
54
+ export default test;
55
+ export { after, afterEach, before, beforeEach, suite as describe, test as it, run, snapshot, suite, test, testAssert as assert };
56
+ export const mock = test.mock;
@@ -0,0 +1,269 @@
1
+ // node:test/reporters (Node's lib/test/reporters.js and lib/internal/test_runner/reporter/; MIT;
2
+ // Node v24.21.0): the reporters a program composes with a stream of test events. tap, dot and junit
3
+ // are async generators over the events; spec and lcov are Transforms from events to text. tap and
4
+ // spec are the runner's own (internal/test_runner/reporters.js); lcov writes the coverage events,
5
+ // which a compiled program doesn't produce.
6
+ // Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
7
+ import { hostname } from "./os.js";
8
+ import { relative } from "./path.js";
9
+ import Transform from "./internal/streams/transform.js";
10
+ import { SpecReporter, TapReporter, colorsFor, inspectWithNoCustomRetry } from "./internal/test_runner/reporters.js";
11
+
12
+ /* ---- tap, spec ----------------------------------------------------------------------------------- */
13
+
14
+ export async function* tap(source) {
15
+ const reporter = new TapReporter();
16
+ yield reporter.start();
17
+ for await (const event of source) {
18
+ const text = reporter.handle(event);
19
+ if (text) yield text;
20
+ }
21
+ const tail = reporter.flush();
22
+ if (tail) yield tail;
23
+ }
24
+ Object.defineProperty(tap, "name", { value: "tapReporter" });
25
+
26
+ class SpecTransform extends Transform {
27
+ #reporter = new SpecReporter();
28
+
29
+ constructor() {
30
+ super({ writableObjectMode: true });
31
+ }
32
+
33
+ _transform({ type, data }, _encoding, callback) {
34
+ callback(null, this.#reporter.handle({ type, data }) || undefined);
35
+ }
36
+
37
+ _flush(callback) {
38
+ callback(null, this.#reporter.flush());
39
+ }
40
+ }
41
+
42
+ /** Node's: a function that makes a spec Transform, with or without new. */
43
+ export const spec = function spec() {
44
+ return new SpecTransform();
45
+ };
46
+
47
+ /* ---- dot (reporter/dot.js) ----------------------------------------------------------------------- */
48
+
49
+ export async function* dot(source) {
50
+ const colors = colorsFor(process.stderr);
51
+ const lineLength = () => Math.max(process.stdout.columns ?? 20, 20);
52
+ let count = 0;
53
+ let columns = lineLength();
54
+ const failedTests = [];
55
+ for await (const { type, data } of source) {
56
+ if (type === "test:pass") {
57
+ yield `${colors.green}.${colors.reset}`;
58
+ }
59
+ if (type === "test:fail") {
60
+ yield `${colors.red}X${colors.reset}`;
61
+ failedTests.push(data);
62
+ }
63
+ if ((type === "test:fail" || type === "test:pass") && ++count === columns) {
64
+ yield "\n";
65
+ columns = lineLength(); /* again, in case the terminal was resized */
66
+ count = 0;
67
+ }
68
+ }
69
+ yield "\n";
70
+ if (failedTests.length > 0) {
71
+ yield `\n${colors.red}Failed tests:${colors.white}\n\n`;
72
+ const format = new SpecReporter();
73
+ for (const test of failedTests) {
74
+ yield format.formatTestReport("test:fail", test);
75
+ }
76
+ }
77
+ }
78
+
79
+ /* ---- junit (reporter/junit.js) ------------------------------------------------------------------- */
80
+
81
+ const junitInspectOptions = { __proto__: null, colors: false, breakLength: Infinity };
82
+
83
+ /* Node 24's: a newline as 
, and an & that begins a numeric character reference kept */
84
+ function escapeAttribute(s = "") {
85
+ return escapeContent(s.replaceAll("\n", "
").replaceAll('"', """));
86
+ }
87
+
88
+ function escapeContent(s = "") {
89
+ return s.replace(/(&)(?!#\d{1,7};)/g, "&amp;").replaceAll("<", "&lt;");
90
+ }
91
+
92
+ function escapeComment(s = "") {
93
+ return s.replaceAll("--", "&#45;&#45;");
94
+ }
95
+
96
+ function treeToXML(tree) {
97
+ if (typeof tree === "string") {
98
+ return `${escapeContent(tree)}\n`;
99
+ }
100
+ const { tag, attrs, nesting, children, comment } = tree;
101
+ const indent = "\t".repeat(nesting + 1);
102
+ if (comment != null) {
103
+ return `${indent}<!-- ${escapeComment(comment)} -->\n`;
104
+ }
105
+ const attrsString = Object.entries(attrs).map(([key, value]) => `${key}="${escapeAttribute(String(value))}"`).join(" ");
106
+ if (!children?.length) {
107
+ return `${indent}<${tag} ${attrsString}/>\n`;
108
+ }
109
+ const childrenString = (children ?? []).map(treeToXML).join("");
110
+ return `${indent}<${tag} ${attrsString}>\n${childrenString}${indent}</${tag}>\n`;
111
+ }
112
+
113
+ function isFailure(node) {
114
+ return (node?.children && node.children.some((c) => c.tag === "failure")) || node?.attrs?.failures;
115
+ }
116
+
117
+ function isSkipped(node) {
118
+ return (node?.children && node.children.some((c) => c.tag === "skipped")) || node?.attrs?.skipped;
119
+ }
120
+
121
+ export async function* junit(source) {
122
+ const HOSTNAME = hostname();
123
+ yield '<?xml version="1.0" encoding="utf-8"?>\n';
124
+ yield "<testsuites>\n";
125
+ let currentSuite = null;
126
+ const roots = [];
127
+
128
+ function startTest(event) {
129
+ const originalSuite = currentSuite;
130
+ currentSuite = { __proto__: null, attrs: { __proto__: null, name: event.data.name }, nesting: event.data.nesting, parent: currentSuite, children: [] };
131
+ if (originalSuite?.children) {
132
+ originalSuite.children.push(currentSuite);
133
+ }
134
+ if (!currentSuite.parent) {
135
+ roots.push(currentSuite);
136
+ }
137
+ }
138
+
139
+ for await (const event of source) {
140
+ switch (event.type) {
141
+ case "test:start": {
142
+ startTest(event);
143
+ break;
144
+ }
145
+ case "test:pass":
146
+ case "test:fail": {
147
+ if (!currentSuite) {
148
+ startTest({ __proto__: null, data: { __proto__: null, name: "root", nesting: 0 } });
149
+ }
150
+ if (currentSuite.attrs.name !== event.data.name || currentSuite.nesting !== event.data.nesting) {
151
+ startTest(event);
152
+ }
153
+ const currentTest = currentSuite;
154
+ if (currentSuite?.nesting === event.data.nesting) {
155
+ currentSuite = currentSuite.parent;
156
+ }
157
+ currentTest.attrs.time = (event.data.details.duration_ms / 1000).toFixed(6);
158
+ const nonCommentChildren = currentTest.children.filter((c) => c.comment == null);
159
+ if (nonCommentChildren.length > 0) {
160
+ currentTest.tag = "testsuite";
161
+ currentTest.attrs.disabled = 0;
162
+ currentTest.attrs.errors = 0;
163
+ currentTest.attrs.tests = nonCommentChildren.length;
164
+ currentTest.attrs.failures = currentTest.children.filter(isFailure).length;
165
+ currentTest.attrs.skipped = currentTest.children.filter(isSkipped).length;
166
+ /* when it started: its end less its duration (its test:start comes late, with its first test) */
167
+ currentTest.attrs.timestamp = new Date(Date.now() - event.data.details.duration_ms).toISOString();
168
+ currentTest.attrs.hostname = HOSTNAME;
169
+ } else {
170
+ currentTest.tag = "testcase";
171
+ currentTest.attrs.classname = event.data.classname ?? "test";
172
+ if (event.data.file) {
173
+ currentTest.attrs.file = event.data.file;
174
+ }
175
+ if (event.data.skip) {
176
+ currentTest.children.push({
177
+ __proto__: null, nesting: event.data.nesting + 1, tag: "skipped", attrs: { __proto__: null, type: "skipped", message: event.data.skip },
178
+ });
179
+ }
180
+ if (event.data.todo) {
181
+ currentTest.children.push({
182
+ __proto__: null, nesting: event.data.nesting + 1, tag: "skipped", attrs: { __proto__: null, type: "todo", message: event.data.todo },
183
+ });
184
+ }
185
+ if (event.type === "test:fail") {
186
+ const error = event.data.details?.error;
187
+ currentTest.children.push({
188
+ __proto__: null,
189
+ nesting: event.data.nesting + 1,
190
+ tag: "failure",
191
+ attrs: { __proto__: null, type: error?.failureType || error?.code, message: error?.message.trim() ?? "" },
192
+ children: [inspectWithNoCustomRetry(error, junitInspectOptions)],
193
+ });
194
+ currentTest.failures = 1;
195
+ currentTest.attrs.failure = error?.message ?? "";
196
+ }
197
+ }
198
+ break;
199
+ }
200
+ case "test:diagnostic":
201
+ case "test:log": {
202
+ const parent = currentSuite?.children ?? roots;
203
+ parent.push({ __proto__: null, nesting: event.data.nesting, comment: event.data.message });
204
+ break;
205
+ }
206
+ default:
207
+ break;
208
+ }
209
+ }
210
+ for (const suite of roots) {
211
+ yield treeToXML(suite);
212
+ }
213
+ yield "</testsuites>\n";
214
+ }
215
+ Object.defineProperty(junit, "name", { value: "junitReporter" });
216
+
217
+ /* ---- lcov (reporter/lcov.js) --------------------------------------------------------------------- */
218
+
219
+ /** The coverage events as an LCOV tracefile. */
220
+ class LcovReporter extends Transform {
221
+ constructor(options) {
222
+ super({ ...options, writableObjectMode: true, __proto__: null });
223
+ }
224
+
225
+ _transform(event, _encoding, callback) {
226
+ if (event.type !== "test:coverage") {
227
+ return callback(null);
228
+ }
229
+ let lcov = "TN:\n";
230
+ const { workingDirectory } = event.data.summary;
231
+ try {
232
+ for (const file of event.data.summary.files) {
233
+ lcov += `SF:${relative(workingDirectory, file.path)}\n`;
234
+ let fnda = "";
235
+ for (let j = 0; j < file.functions.length; j++) {
236
+ const func = file.functions[j];
237
+ const name = func.name || `anonymous_${j}`;
238
+ lcov += `FN:${func.line},${name}\n`;
239
+ fnda += `FNDA:${func.count},${name}\n`;
240
+ }
241
+ lcov += fnda;
242
+ lcov += `FNF:${file.totalFunctionCount}\n`;
243
+ lcov += `FNH:${file.coveredFunctionCount}\n`;
244
+ for (let j = 0; j < file.branches.length; j++) {
245
+ lcov += `BRDA:${file.branches[j].line},${j},0,${file.branches[j].count}\n`;
246
+ }
247
+ lcov += `BRF:${file.totalBranchCount}\n`;
248
+ lcov += `BRH:${file.coveredBranchCount}\n`;
249
+ for (const line of file.lines.toSorted((a, b) => a.line - b.line)) {
250
+ lcov += `DA:${line.line},${line.count}\n`;
251
+ }
252
+ lcov += `LH:${file.coveredLineCount}\n`;
253
+ lcov += `LF:${file.totalLineCount}\n`;
254
+ lcov += "end_of_record\n";
255
+ }
256
+ } catch (error) {
257
+ return callback(error);
258
+ }
259
+ return callback(null, lcov);
260
+ }
261
+ }
262
+
263
+ /** A new reporter on each call, with new or without, as spec. */
264
+ export function lcov(options) {
265
+ return new LcovReporter(options);
266
+ }
267
+
268
+ const reporters = { dot, junit, spec, tap, lcov };
269
+ export default reporters;
@@ -1,14 +1,9 @@
1
- // node:timers (ADR 0012, layer 3): setTimeout, setInterval and setImmediate as Node has them,
2
- // returning Timeout and Immediate objects (ref, unref, hasRef, refresh, close, a primitive id)
3
- // that call back with the object as `this` (internal/timers.js); and the legacy enroll,
4
- // unenroll, active and _unrefActive, on an object of the caller's with an _onTimeout.
5
- import { invalidArgType, outOfRange } from "./internal/errors.js";
6
- import {
7
- TIMEOUT_MAX, armed, arm, clearImmediate, clearInterval, clearTimeout, duration, kFire, kId, kPending, kRefed,
8
- setImmediate, setInterval, setTimeout, unenrollTimeout,
9
- } from "./internal/timers.js";
10
- import { deprecate } from "./util.js";
11
- import * as promises from "./timers_promises.js";
1
+ // node:timers: setTimeout, setInterval and setImmediate as Node has them, returning Timeout and
2
+ // Immediate objects (ref, unref, hasRef, refresh, close, a primitive id) that call back with the
3
+ // object as `this` (internal/timers.js).
4
+ import { clearImmediate, clearInterval, clearTimeout, setImmediate, setInterval, setTimeout } from "./internal/timers.js";
5
+ /* timers.promises is require("timers/promises") itself: the module's exports object */
6
+ import promises from "./timers_promises.js";
12
7
 
13
8
  export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
14
9
 
@@ -17,76 +12,4 @@ const promisifyCustom = Symbol.for("nodejs.util.promisify.custom");
17
12
  Object.defineProperty(setTimeout, promisifyCustom, { value: promises.setTimeout, enumerable: false, writable: true, configurable: true });
18
13
  Object.defineProperty(setImmediate, promisifyCustom, { value: promises.setImmediate, enumerable: false, writable: true, configurable: true });
19
14
 
20
- /* ---- The legacy API ------------------------------------------------------------------ */
21
-
22
- function getTimerDuration(msecs, name) {
23
- if (typeof msecs !== "number") throw invalidArgType(name, "of type number", msecs);
24
- if (msecs < 0 || !Number.isFinite(msecs)) throw outOfRange(name, "a non-negative finite number", msecs);
25
- if (msecs > TIMEOUT_MAX) {
26
- if (typeof process.emitWarning === "function") {
27
- process.emitWarning(`${msecs} does not fit into a 32-bit signed integer.\nTimer duration was truncated to ${TIMEOUT_MAX}.`, "TimeoutOverflowWarning");
28
- }
29
- return TIMEOUT_MAX;
30
- }
31
- return msecs;
32
- }
33
-
34
- function enrollItem(item, msecs) {
35
- if (item._idleNext) unenrollItem(item);
36
- item._idleNext = item;
37
- item._idlePrev = item;
38
- item._idleTimeout = getTimerDuration(msecs, "msecs");
39
- }
40
-
41
- function unenrollItem(item) {
42
- if (item[kFire] === undefined) { /* never activated */
43
- item._idleTimeout = -1;
44
- item._destroyed = true;
45
- return;
46
- }
47
- unenrollTimeout(item);
48
- }
49
-
50
- /* arms the item: its _onTimeout() after its _idleTimeout ms */
51
- function activeItem(item, refed) {
52
- const msecs = item._idleTimeout;
53
- if (msecs < 0 || msecs === undefined) return;
54
- if (item[kFire] === undefined) item[kFire] = () => fireItem(item);
55
- item._destroyed = false;
56
- item[kRefed] = refed;
57
- const saved = item._idleTimeout;
58
- item._idleTimeout = duration(msecs);
59
- arm(item, refed);
60
- item._idleTimeout = saved;
61
- }
62
-
63
- function fireItem(item) {
64
- item[kPending] = false;
65
- armed.delete(item[kId]);
66
- try {
67
- if (typeof item._onTimeout === "function") item._onTimeout();
68
- } finally {
69
- if (!item[kPending]) item._destroyed = true;
70
- }
71
- }
72
-
73
- export const enroll = deprecate(function enroll(item, msecs) {
74
- enrollItem(item, msecs);
75
- }, "timers.enroll() is deprecated. Please use setTimeout instead.", "DEP0095");
76
-
77
- export const unenroll = deprecate(function unenroll(item) {
78
- unenrollItem(item);
79
- }, "timers.unenroll() is deprecated. Please use clearTimeout instead.", "DEP0096");
80
-
81
- export const active = deprecate(function active(item) {
82
- activeItem(item, true);
83
- }, "timers.active() is deprecated. Please use timeout.refresh() instead.", "DEP0126");
84
-
85
- export const _unrefActive = deprecate(function _unrefActive(item) {
86
- activeItem(item, false);
87
- }, "timers._unrefActive() is deprecated. Please use timeout.refresh() instead.", "DEP0127");
88
-
89
- export default {
90
- setTimeout, clearTimeout, setImmediate, clearImmediate, setInterval, clearInterval,
91
- _unrefActive, active, unenroll, enroll, promises,
92
- };
15
+ export default { setTimeout, clearTimeout, setImmediate, clearImmediate, setInterval, clearInterval, promises };
@@ -1,4 +1,4 @@
1
- // node:timers/promises (ADR 0012, layer 3): setTimeout and setImmediate as promises,
1
+ // node:timers/promises: setTimeout and setImmediate as promises,
2
2
  // setInterval as an async iterator, and scheduler.wait and scheduler.yield; each takes an
3
3
  // AbortSignal, and ref: false for a timer that doesn't keep the program alive.
4
4
  import { codeError, invalidArgType } from "./internal/errors.js";
@@ -1,7 +1,8 @@
1
- // node:tls (ADR 0019): TLS 1.0–1.3 clients and servers on BoringSSL, following Node's lib/tls.js.
1
+ // node:tls: TLS 1.0–1.3 clients and servers on BoringSSL, following Node's lib/tls.js.
2
2
  // TLSSocket, Server and connect are in internal/tls/wrap.js; SecureContext, the cipher suites and
3
3
  // the errors in internal/tls/common.js; certificates in internal/tls/x509.js. The root
4
4
  // certificates are the ones Node bundles (Mozilla's), built into the runtime.
5
+ // Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
5
6
  import { fsReadFile, tlsRootCertificates } from "visaljs:host";
6
7
  import { EventEmitter } from "./events.js";
7
8
  import { invalidArgType, invalidArgValue, validateString } from "./internal/errors.js";
@@ -0,0 +1,52 @@
1
+ // node:trace_events: Tracing objects that enable and disable their categories, as Node's; a compiled
2
+ // program has no trace writer, so nothing is written (Node writes node_trace.*.log).
3
+ import { invalidArgType } from "./internal/errors.js";
4
+
5
+ /* the enabled categories, each counted by the Tracings that enable it */
6
+ const enabledCounts = new Map();
7
+
8
+ class Tracing {
9
+ #categories;
10
+ #enabled = false;
11
+
12
+ constructor(categories) {
13
+ this.#categories = categories;
14
+ }
15
+
16
+ get categories() {
17
+ return this.#categories.join(",");
18
+ }
19
+
20
+ get enabled() {
21
+ return this.#enabled;
22
+ }
23
+
24
+ enable() {
25
+ if (this.#enabled) return;
26
+ this.#enabled = true;
27
+ for (const c of this.#categories) enabledCounts.set(c, (enabledCounts.get(c) ?? 0) + 1);
28
+ }
29
+
30
+ disable() {
31
+ if (!this.#enabled) return;
32
+ this.#enabled = false;
33
+ for (const c of this.#categories) {
34
+ const n = enabledCounts.get(c) - 1;
35
+ if (n === 0) enabledCounts.delete(c);
36
+ else enabledCounts.set(c, n);
37
+ }
38
+ }
39
+ }
40
+
41
+ export function createTracing(options) {
42
+ if (options === null || typeof options !== "object") throw invalidArgType("options", "of type object", options);
43
+ if (!Array.isArray(options.categories)) throw invalidArgType("options.categories", "an instance of Array", options.categories);
44
+ return new Tracing(options.categories.map(String));
45
+ }
46
+
47
+ /** The enabled categories, comma-separated, or undefined. */
48
+ export function getEnabledCategories() {
49
+ return enabledCounts.size ? [...enabledCounts.keys()].join(",") : undefined;
50
+ }
51
+
52
+ export default { createTracing, getEnabledCategories };
@@ -1,14 +1,20 @@
1
- // node:tty (ADR 0012, layer 3): isatty. The terminal streams (ReadStream, WriteStream) aren't
2
- // provided yet: process.stdout and process.stderr have isTTY.
1
+ // node:tty: isatty, and ReadStream: a terminal read as node:net's Socket, which
2
+ // process.stdin is when it's a terminal. ReadStream links node:net and libuv: its class is
3
+ // internal/tty_read_stream.js, in programs whose code names it (a name only computed at run time
4
+ // throws ERR_VISALJS_UNSUPPORTED). WriteStream isn't provided yet: process.stdout and
5
+ // process.stderr have isTTY.
3
6
  import { ttyIsatty } from "visaljs:host";
4
7
  import { notSupported } from "./internal/errors.js";
8
+ import { streams } from "./internal/tty_streams.js";
5
9
 
6
10
  export function isatty(fd) {
7
11
  return Number.isInteger(fd) && fd >= 0 && fd <= 2147483647 && ttyIsatty(fd);
8
12
  }
9
13
 
10
- export function ReadStream() {
11
- throw notSupported("tty.ReadStream");
14
+ /** ReadStream(fd, options): a terminal, read. */
15
+ export function ReadStream(fd, options) {
16
+ if (streams.ReadStream === undefined) throw notSupported("tty.ReadStream (named only at run time)");
17
+ return Reflect.construct(streams.ReadStream, [fd, options], new.target ?? ReadStream);
12
18
  }
13
19
 
14
20
  export function WriteStream() {