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,211 @@
1
+ import * as __buffer from "../../buffer.js";
2
+ import * as __internal_errors from "./errors.js";
3
+
4
+ const { Buffer } = __buffer;
5
+
6
+ const {
7
+ aggregateTwoErrors,
8
+ codes: {
9
+ ERR_INVALID_ARG_TYPE,
10
+ ERR_STREAM_NULL_VALUES,
11
+ },
12
+ } = __internal_errors;
13
+
14
+ function from(Readable, iterable, opts) {
15
+ let iterator;
16
+ if (typeof iterable === 'string' || iterable instanceof Buffer) {
17
+ return new Readable({
18
+ objectMode: true,
19
+ ...opts,
20
+ read() {
21
+ this.push(iterable);
22
+ this.push(null);
23
+ },
24
+ });
25
+ }
26
+
27
+ let isAsync;
28
+ if (iterable?.[Symbol.asyncIterator]) {
29
+ isAsync = true;
30
+ iterator = iterable[Symbol.asyncIterator]();
31
+ } else if (iterable?.[Symbol.iterator]) {
32
+ isAsync = false;
33
+ iterator = iterable[Symbol.iterator]();
34
+ } else {
35
+ throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
36
+ }
37
+
38
+
39
+ const readable = new Readable({
40
+ objectMode: true,
41
+ highWaterMark: 1,
42
+ // TODO(ronag): What options should be allowed?
43
+ ...opts,
44
+ });
45
+ const originalDestroy = readable._destroy;
46
+
47
+ // Flag to protect against _read
48
+ // being called before last iteration completion.
49
+ let reading = false;
50
+ let isAsyncValues = false;
51
+
52
+ readable._read = function() {
53
+ if (!reading) {
54
+ reading = true;
55
+
56
+ if (isAsync) {
57
+ nextAsync();
58
+ } else if (isAsyncValues) {
59
+ nextSyncWithAsyncValues();
60
+ } else {
61
+ nextSyncWithSyncValues();
62
+ }
63
+ }
64
+ };
65
+
66
+ readable._destroy = function(error, cb) {
67
+ originalDestroy.call(this, error, (destroyError) => {
68
+ const combinedError = destroyError || error;
69
+ (close(combinedError)).then(// nextTick is here in case cb throws
70
+ () => process.nextTick(cb, combinedError), (closeError) => process.nextTick(
71
+ cb,
72
+ aggregateTwoErrors(combinedError, closeError),
73
+ ), );
74
+ });
75
+ };
76
+
77
+ async function close(error) {
78
+ const hadError = (error !== undefined) && (error !== null);
79
+ const hasThrow = typeof iterator.throw === 'function';
80
+ if (hadError && hasThrow) {
81
+ const { value, done } = await iterator.throw(error);
82
+ await value;
83
+ if (done) {
84
+ return;
85
+ }
86
+ }
87
+ if (typeof iterator.return === 'function') {
88
+ const { value } = await iterator.return();
89
+ await value;
90
+ }
91
+ }
92
+
93
+ // There are a lot of duplication here, it's done on purpose for performance
94
+ // reasons - avoid await when not needed.
95
+
96
+ function nextSyncWithSyncValues() {
97
+ for (;;) {
98
+ try {
99
+ const { value, done } = iterator.next();
100
+
101
+ if (done) {
102
+ readable.push(null);
103
+ return;
104
+ }
105
+
106
+ if (value &&
107
+ typeof value.then === 'function') {
108
+ return changeToAsyncValues(value);
109
+ }
110
+
111
+ if (value === null) {
112
+ reading = false;
113
+ throw new ERR_STREAM_NULL_VALUES();
114
+ }
115
+
116
+ if (readable.push(value)) {
117
+ continue;
118
+ }
119
+
120
+ reading = false;
121
+ } catch (err) {
122
+ readable.destroy(err);
123
+ }
124
+ break;
125
+ }
126
+ }
127
+
128
+ async function changeToAsyncValues(value) {
129
+ isAsyncValues = true;
130
+
131
+ try {
132
+ const res = await value;
133
+
134
+ if (res === null) {
135
+ reading = false;
136
+ throw new ERR_STREAM_NULL_VALUES();
137
+ }
138
+
139
+ if (readable.push(res)) {
140
+ nextSyncWithAsyncValues();
141
+ return;
142
+ }
143
+
144
+ reading = false;
145
+ } catch (err) {
146
+ readable.destroy(err);
147
+ }
148
+ }
149
+
150
+ async function nextSyncWithAsyncValues() {
151
+ for (;;) {
152
+ try {
153
+ const { value, done } = iterator.next();
154
+
155
+ if (done) {
156
+ readable.push(null);
157
+ return;
158
+ }
159
+
160
+ const res = (value &&
161
+ typeof value.then === 'function') ?
162
+ await value :
163
+ value;
164
+
165
+ if (res === null) {
166
+ reading = false;
167
+ throw new ERR_STREAM_NULL_VALUES();
168
+ }
169
+
170
+ if (readable.push(res)) {
171
+ continue;
172
+ }
173
+
174
+ reading = false;
175
+ } catch (err) {
176
+ readable.destroy(err);
177
+ }
178
+ break;
179
+ }
180
+ }
181
+
182
+ async function nextAsync() {
183
+ for (;;) {
184
+ try {
185
+ const { value, done } = await iterator.next();
186
+
187
+ if (done) {
188
+ readable.push(null);
189
+ return;
190
+ }
191
+
192
+ if (value === null) {
193
+ reading = false;
194
+ throw new ERR_STREAM_NULL_VALUES();
195
+ }
196
+
197
+ if (readable.push(value)) {
198
+ continue;
199
+ }
200
+
201
+ reading = false;
202
+ } catch (err) {
203
+ readable.destroy(err);
204
+ }
205
+ break;
206
+ }
207
+ }
208
+ return readable;
209
+ }
210
+
211
+ export default from;
@@ -0,0 +1,120 @@
1
+ import * as __events from "../../events.js";
2
+
3
+ const EE = __events.default;
4
+
5
+ function Stream(opts) {
6
+ EE.call(this, opts);
7
+ }
8
+ Object.setPrototypeOf(Stream.prototype, EE.prototype);
9
+ Object.setPrototypeOf(Stream, EE);
10
+
11
+ Stream.prototype.pipe = function(dest, options) {
12
+ const source = this;
13
+
14
+ function ondata(chunk) {
15
+ if (dest.writable && dest.write(chunk) === false && source.pause) {
16
+ source.pause();
17
+ }
18
+ }
19
+
20
+ source.on('data', ondata);
21
+
22
+ function ondrain() {
23
+ if (source.readable && source.resume) {
24
+ source.resume();
25
+ }
26
+ }
27
+
28
+ dest.on('drain', ondrain);
29
+
30
+ // If the 'end' option is not supplied, dest.end() will be called when
31
+ // source gets the 'end' or 'close' events. Only dest.end() once.
32
+ if (!dest._isStdio && (!options || options.end !== false)) {
33
+ source.on('end', onend);
34
+ source.on('close', onclose);
35
+ }
36
+
37
+ let didOnEnd = false;
38
+ function onend() {
39
+ if (didOnEnd) return;
40
+ didOnEnd = true;
41
+
42
+ dest.end();
43
+ }
44
+
45
+
46
+ function onclose() {
47
+ if (didOnEnd) return;
48
+ didOnEnd = true;
49
+
50
+ if (typeof dest.destroy === 'function') dest.destroy();
51
+ }
52
+
53
+ // Don't leave dangling pipes when there are errors.
54
+ function onerror(er) {
55
+ cleanup();
56
+ // If we removed the last error handler, trigger an unhandled error event.
57
+ if (this.listenerCount?.('error') === 0) {
58
+ this.emit('error', er);
59
+ }
60
+ }
61
+
62
+ prependListener(source, 'error', onerror);
63
+ prependListener(dest, 'error', onerror);
64
+
65
+ // Remove all the event listeners that were added.
66
+ function cleanup() {
67
+ source.removeListener('data', ondata);
68
+ dest.removeListener('drain', ondrain);
69
+
70
+ source.removeListener('end', onend);
71
+ source.removeListener('close', onclose);
72
+
73
+ source.removeListener('error', onerror);
74
+ dest.removeListener('error', onerror);
75
+
76
+ source.removeListener('end', cleanup);
77
+ source.removeListener('close', cleanup);
78
+
79
+ dest.removeListener('close', cleanup);
80
+ }
81
+
82
+ source.on('end', cleanup);
83
+ source.on('close', cleanup);
84
+
85
+ dest.on('close', cleanup);
86
+ dest.emit('pipe', source);
87
+
88
+ // Allow for unix-like usage: A.pipe(B).pipe(C)
89
+ return dest;
90
+ };
91
+
92
+ Stream.prototype.eventNames = function eventNames() {
93
+ const names = [];
94
+ for (const key of Reflect.ownKeys(this._events)) {
95
+ if (typeof this._events[key] === 'function' || (Array.isArray(this._events[key]) && this._events[key].length > 0)) {
96
+ names.push(key);
97
+ }
98
+ }
99
+ return names;
100
+ };
101
+
102
+ function prependListener(emitter, event, fn) {
103
+ // Sadly this is not cacheable as some libraries bundle their own
104
+ // event emitter implementation with them.
105
+ if (typeof emitter.prependListener === 'function')
106
+ return emitter.prependListener(event, fn);
107
+
108
+ // This is a hack to make sure that our error handler is attached before any
109
+ // userland ones. NEVER DO THIS. This is here only because this code needs
110
+ // to continue to work with older versions of Node.js that do not include
111
+ // the prependListener() method. The goal is to eventually remove this hack.
112
+ if (!emitter._events || !emitter._events[event])
113
+ emitter.on(event, fn);
114
+ else if (Array.isArray(emitter._events[event]))
115
+ emitter._events[event].unshift(fn);
116
+ else
117
+ emitter._events[event] = [fn, emitter._events[event]];
118
+ }
119
+
120
+ export { Stream, prependListener };
@@ -0,0 +1,375 @@
1
+ import * as __internal_errors from "./errors.js";
2
+ import * as __internal_validators from "./validators.js";
3
+ import * as __internal_streams_end_of_stream from "./end_of_stream.js";
4
+
5
+ const {
6
+ AbortError,
7
+ codes: {
8
+ ERR_MISSING_ARGS,
9
+ ERR_OUT_OF_RANGE,
10
+ },
11
+ } = __internal_errors;
12
+ const {
13
+ validateAbortSignal,
14
+ validateInteger,
15
+ validateObject,
16
+ validateFunction,
17
+ } = __internal_validators;
18
+ const { finished } = __internal_streams_end_of_stream;
19
+
20
+ const kEmpty = Symbol('kEmpty');
21
+ const kEof = Symbol('kEof');
22
+
23
+ function map(fn, options) {
24
+ validateFunction(fn, 'fn');
25
+ if (options != null) {
26
+ validateObject(options, 'options');
27
+ }
28
+ if (options?.signal != null) {
29
+ validateAbortSignal(options.signal, 'options.signal');
30
+ }
31
+
32
+ let concurrency = 1;
33
+ if (options?.concurrency != null) {
34
+ concurrency = Math.floor(options.concurrency);
35
+ }
36
+
37
+ let highWaterMark = concurrency - 1;
38
+ if (options?.highWaterMark != null) {
39
+ highWaterMark = Math.floor(options.highWaterMark);
40
+ }
41
+
42
+ validateInteger(concurrency, 'options.concurrency', 1);
43
+ validateInteger(highWaterMark, 'options.highWaterMark', 0);
44
+
45
+ highWaterMark += concurrency;
46
+
47
+ return async function* map() {
48
+ const signal = AbortSignal.any([options?.signal].filter(Boolean));
49
+ const stream = this;
50
+ const queue = [];
51
+ const signalOpt = { signal };
52
+
53
+ let next;
54
+ let resume;
55
+ let done = false;
56
+ let cnt = 0;
57
+
58
+ function onCatch() {
59
+ done = true;
60
+ afterItemProcessed();
61
+ }
62
+
63
+ function afterItemProcessed() {
64
+ cnt -= 1;
65
+ maybeResume();
66
+ }
67
+
68
+ function maybeResume() {
69
+ if (
70
+ resume &&
71
+ !done &&
72
+ cnt < concurrency &&
73
+ queue.length < highWaterMark
74
+ ) {
75
+ resume();
76
+ resume = null;
77
+ }
78
+ }
79
+
80
+ async function pump() {
81
+ try {
82
+ for await (let val of stream) {
83
+ if (done) {
84
+ return;
85
+ }
86
+
87
+ if (signal.aborted) {
88
+ throw new AbortError();
89
+ }
90
+
91
+ try {
92
+ val = fn(val, signalOpt);
93
+
94
+ if (val === kEmpty) {
95
+ continue;
96
+ }
97
+
98
+ val = Promise.resolve(val);
99
+ } catch (err) {
100
+ val = Promise.reject(err);
101
+ }
102
+
103
+ cnt += 1;
104
+
105
+ val.then(afterItemProcessed, onCatch);
106
+
107
+ queue.push(val);
108
+ if (next) {
109
+ next();
110
+ next = null;
111
+ }
112
+
113
+ if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {
114
+ await new Promise((resolve) => {
115
+ resume = resolve;
116
+ });
117
+ }
118
+ }
119
+ queue.push(kEof);
120
+ } catch (err) {
121
+ const val = Promise.reject(err);
122
+ val.then(afterItemProcessed, onCatch);
123
+ queue.push(val);
124
+ } finally {
125
+ done = true;
126
+ if (next) {
127
+ next();
128
+ next = null;
129
+ }
130
+ }
131
+ }
132
+
133
+ pump();
134
+
135
+ try {
136
+ while (true) {
137
+ while (queue.length > 0) {
138
+ const val = await queue[0];
139
+
140
+ if (val === kEof) {
141
+ return;
142
+ }
143
+
144
+ if (signal.aborted) {
145
+ throw new AbortError();
146
+ }
147
+
148
+ if (val !== kEmpty) {
149
+ yield val;
150
+ }
151
+
152
+ queue.shift();
153
+ maybeResume();
154
+ }
155
+
156
+ await new Promise((resolve) => {
157
+ next = resolve;
158
+ });
159
+ }
160
+ } finally {
161
+ done = true;
162
+ if (resume) {
163
+ resume();
164
+ resume = null;
165
+ }
166
+ }
167
+ }.call(this);
168
+ }
169
+
170
+ async function some(fn, options = undefined) {
171
+ for await (const unused of filter.call(this, fn, options)) {
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+
177
+ async function every(fn, options = undefined) {
178
+ validateFunction(fn, 'fn');
179
+ // https://en.wikipedia.org/wiki/De_Morgan%27s_laws
180
+ return !(await some.call(this, async (...args) => {
181
+ return !(await fn(...args));
182
+ }, options));
183
+ }
184
+
185
+ async function find(fn, options) {
186
+ for await (const result of filter.call(this, fn, options)) {
187
+ return result;
188
+ }
189
+ return undefined;
190
+ }
191
+
192
+ async function forEach(fn, options) {
193
+ validateFunction(fn, 'fn');
194
+ async function forEachFn(value, options) {
195
+ await fn(value, options);
196
+ return kEmpty;
197
+ }
198
+ // eslint-disable-next-line no-unused-vars
199
+ for await (const unused of map.call(this, forEachFn, options));
200
+ }
201
+
202
+ function filter(fn, options) {
203
+ validateFunction(fn, 'fn');
204
+ async function filterFn(value, options) {
205
+ if (await fn(value, options)) {
206
+ return value;
207
+ }
208
+ return kEmpty;
209
+ }
210
+ return map.call(this, filterFn, options);
211
+ }
212
+
213
+ // Specific to provide better error to reduce since the argument is only
214
+ // missing if the stream has no items in it - but the code is still appropriate
215
+ class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS {
216
+ constructor() {
217
+ super('reduce');
218
+ this.message = 'Reduce of an empty stream requires an initial value';
219
+ }
220
+ }
221
+
222
+ async function reduce(reducer, initialValue, options) {
223
+ validateFunction(reducer, 'reducer');
224
+ if (options != null) {
225
+ validateObject(options, 'options');
226
+ }
227
+ if (options?.signal != null) {
228
+ validateAbortSignal(options.signal, 'options.signal');
229
+ }
230
+
231
+ let hasInitialValue = arguments.length > 1;
232
+ if (options?.signal?.aborted) {
233
+ const err = new AbortError(undefined, { cause: options.signal.reason });
234
+ this.once('error', () => {}); // The error is already propagated
235
+ await finished(this.destroy(err));
236
+ throw err;
237
+ }
238
+ const ac = new AbortController();
239
+ const signal = ac.signal;
240
+ if (options?.signal) {
241
+ const opts = { once: true };
242
+ options.signal.addEventListener('abort', () => ac.abort(), opts);
243
+ }
244
+ let gotAnyItemFromStream = false;
245
+ try {
246
+ for await (const value of this) {
247
+ gotAnyItemFromStream = true;
248
+ if (options?.signal?.aborted) {
249
+ throw new AbortError();
250
+ }
251
+ if (!hasInitialValue) {
252
+ initialValue = value;
253
+ hasInitialValue = true;
254
+ } else {
255
+ initialValue = await reducer(initialValue, value, { signal });
256
+ }
257
+ }
258
+ if (!gotAnyItemFromStream && !hasInitialValue) {
259
+ throw new ReduceAwareErrMissingArgs();
260
+ }
261
+ } finally {
262
+ ac.abort();
263
+ }
264
+ return initialValue;
265
+ }
266
+
267
+ async function toArray(options) {
268
+ if (options != null) {
269
+ validateObject(options, 'options');
270
+ }
271
+ if (options?.signal != null) {
272
+ validateAbortSignal(options.signal, 'options.signal');
273
+ }
274
+
275
+ const result = [];
276
+ for await (const val of this) {
277
+ if (options?.signal?.aborted) {
278
+ throw new AbortError(undefined, { cause: options.signal.reason });
279
+ }
280
+ result.push(val);
281
+ }
282
+ return result;
283
+ }
284
+
285
+ function flatMap(fn, options) {
286
+ const values = map.call(this, fn, options);
287
+ return async function* flatMap() {
288
+ for await (const val of values) {
289
+ yield* val;
290
+ }
291
+ }.call(this);
292
+ }
293
+
294
+ function toIntegerOrInfinity(number) {
295
+ // We coerce here to align with the spec
296
+ // https://github.com/tc39/proposal-iterator-helpers/issues/169
297
+ number = Number(number);
298
+ if (Number.isNaN(number)) {
299
+ return 0;
300
+ }
301
+ if (number < 0) {
302
+ throw new ERR_OUT_OF_RANGE('number', '>= 0', number);
303
+ }
304
+ return number;
305
+ }
306
+
307
+ function drop(number, options = undefined) {
308
+ if (options != null) {
309
+ validateObject(options, 'options');
310
+ }
311
+ if (options?.signal != null) {
312
+ validateAbortSignal(options.signal, 'options.signal');
313
+ }
314
+
315
+ number = toIntegerOrInfinity(number);
316
+ return async function* drop() {
317
+ if (options?.signal?.aborted) {
318
+ throw new AbortError();
319
+ }
320
+ for await (const val of this) {
321
+ if (options?.signal?.aborted) {
322
+ throw new AbortError();
323
+ }
324
+ if (number-- <= 0) {
325
+ yield val;
326
+ }
327
+ }
328
+ }.call(this);
329
+ }
330
+
331
+ function take(number, options = undefined) {
332
+ if (options != null) {
333
+ validateObject(options, 'options');
334
+ }
335
+ if (options?.signal != null) {
336
+ validateAbortSignal(options.signal, 'options.signal');
337
+ }
338
+
339
+ number = toIntegerOrInfinity(number);
340
+ return async function* take() {
341
+ if (options?.signal?.aborted) {
342
+ throw new AbortError();
343
+ }
344
+ for await (const val of this) {
345
+ if (options?.signal?.aborted) {
346
+ throw new AbortError();
347
+ }
348
+ if (number-- > 0) {
349
+ yield val;
350
+ }
351
+
352
+ // Don't get another item from iterator in case we reached the end
353
+ if (number <= 0) {
354
+ return;
355
+ }
356
+ }
357
+ }.call(this);
358
+ }
359
+
360
+ export const streamReturningOperators = {
361
+ drop,
362
+ filter,
363
+ flatMap,
364
+ map,
365
+ take,
366
+ };
367
+
368
+ export const promiseReturningOperators = {
369
+ every,
370
+ forEach,
371
+ reduce,
372
+ toArray,
373
+ some,
374
+ find,
375
+ };