visaljs 0.0.7 → 0.0.9

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 (434) hide show
  1. package/README.md +68 -4
  2. package/THIRD_PARTY_LICENSES +1216 -0
  3. package/cli.js +4461 -321
  4. package/node/include/js_node.h +57 -1
  5. package/node/include/js_uv.h +8 -1
  6. package/node/prelude/_http_agent.js +5 -0
  7. package/node/prelude/_http_server.js +7 -0
  8. package/node/prelude/_stream_duplex.js +4 -0
  9. package/node/prelude/_stream_passthrough.js +4 -0
  10. package/node/prelude/_stream_readable.js +4 -0
  11. package/node/prelude/_stream_transform.js +4 -0
  12. package/node/prelude/_stream_writable.js +4 -0
  13. package/node/prelude/assert.js +1334 -0
  14. package/node/prelude/assert_strict.js +12 -0
  15. package/node/prelude/async_hooks.js +1 -1
  16. package/node/prelude/buffer.js +43 -3
  17. package/node/prelude/child_process.js +1098 -0
  18. package/node/prelude/cluster.js +52 -0
  19. package/node/prelude/console.js +328 -0
  20. package/node/prelude/constants.js +10 -0
  21. package/node/prelude/crypto.js +1 -1
  22. package/node/prelude/diagnostics_channel.js +1 -1
  23. package/node/prelude/dns.js +8 -2
  24. package/node/prelude/domain.js +115 -0
  25. package/node/prelude/events.js +148 -16
  26. package/node/prelude/fs.js +1138 -151
  27. package/node/prelude/fs_promises.js +117 -11
  28. package/node/prelude/http.js +784 -301
  29. package/node/prelude/http2.js +1 -1
  30. package/node/prelude/https.js +159 -0
  31. package/node/prelude/inspector.js +27 -0
  32. package/node/prelude/inspector_promises.js +4 -0
  33. package/node/prelude/internal/async_context.js +1 -1
  34. package/node/prelude/internal/buffer_transcode.js +44 -0
  35. package/node/prelude/internal/comparisons.js +916 -0
  36. package/node/prelude/internal/compression_streams.js +153 -0
  37. package/node/prelude/internal/crypto/asym.js +27 -14
  38. package/node/prelude/internal/crypto/cipher.js +16 -5
  39. package/node/prelude/internal/crypto/diffiehellman.js +3 -2
  40. package/node/prelude/internal/crypto/hash.js +2 -1
  41. package/node/prelude/internal/crypto/kdf.js +14 -9
  42. package/node/prelude/internal/crypto/keys.js +63 -50
  43. package/node/prelude/internal/crypto/random.js +2 -1
  44. package/node/prelude/internal/crypto/util.js +4 -4
  45. package/node/prelude/internal/dotenv.js +98 -0
  46. package/node/prelude/internal/errors.js +21 -5
  47. package/node/prelude/internal/events_extras.js +113 -0
  48. package/node/prelude/internal/events_on.js +100 -0
  49. package/node/prelude/internal/features.js +72 -0
  50. package/node/prelude/internal/fetch.js +364 -0
  51. package/node/prelude/internal/form_data.js +376 -0
  52. package/node/prelude/internal/fs_bigint_stats.js +41 -0
  53. package/node/prelude/internal/fs_blob.js +19 -0
  54. package/node/prelude/internal/fs_cp.js +709 -0
  55. package/node/prelude/internal/fs_dir.js +166 -0
  56. package/node/prelude/internal/fs_filehandle.js +287 -0
  57. package/node/prelude/internal/fs_glob.js +296 -0
  58. package/node/prelude/internal/fs_statfs.js +42 -0
  59. package/node/prelude/internal/fs_stats.js +89 -0
  60. package/node/prelude/internal/fs_streams.js +541 -0
  61. package/node/prelude/internal/fs_utils.js +286 -0
  62. package/node/prelude/internal/fs_watch.js +580 -0
  63. package/node/prelude/internal/http_agent.js +114 -2
  64. package/node/prelude/internal/http_symbols.js +3 -0
  65. package/node/prelude/internal/mime.js +249 -0
  66. package/node/prelude/internal/net.js +1 -0
  67. package/node/prelude/internal/net_bound.js +123 -0
  68. package/node/prelude/internal/net_onread.js +73 -0
  69. package/node/prelude/internal/net_tos.js +54 -0
  70. package/node/prelude/internal/parse_args.js +288 -0
  71. package/node/prelude/internal/perf_histogram.js +435 -0
  72. package/node/prelude/internal/perf_observe.js +125 -0
  73. package/node/prelude/internal/performance_global.js +19 -0
  74. package/node/prelude/internal/process_events.js +49 -1
  75. package/node/prelude/internal/process_memory.js +14 -0
  76. package/node/prelude/internal/process_more.js +414 -0
  77. package/node/prelude/internal/process_signals.js +2 -1
  78. package/node/prelude/internal/process_stdin.js +52 -0
  79. package/node/prelude/internal/process_stdio.js +36 -0
  80. package/node/prelude/internal/querystring.js +0 -0
  81. package/node/prelude/internal/readline.js +338 -0
  82. package/node/prelude/internal/socketaddress.js +8 -4
  83. package/node/prelude/internal/source_map.js +122 -0
  84. package/node/prelude/internal/stream_compose.js +74 -0
  85. package/node/prelude/internal/stream_from.js +6 -0
  86. package/node/prelude/internal/stream_operators.js +23 -0
  87. package/node/prelude/internal/stream_pipeline.js +7 -0
  88. package/node/prelude/internal/stream_transform.js +10 -0
  89. package/node/prelude/internal/stream_web_adapters.js +143 -0
  90. package/node/prelude/internal/streams/add_abort_signal.js +58 -0
  91. package/node/prelude/internal/streams/compose.js +244 -0
  92. package/node/prelude/internal/streams/destroy.js +358 -0
  93. package/node/prelude/internal/streams/duplex.js +199 -0
  94. package/node/prelude/internal/streams/duplexify.js +378 -0
  95. package/node/prelude/internal/streams/end_of_stream.js +387 -0
  96. package/node/prelude/internal/streams/errors.js +216 -0
  97. package/node/prelude/internal/streams/from.js +211 -0
  98. package/node/prelude/internal/streams/legacy.js +120 -0
  99. package/node/prelude/internal/streams/operators.js +375 -0
  100. package/node/prelude/internal/streams/passthrough.js +45 -0
  101. package/node/prelude/internal/streams/pipeline.js +468 -0
  102. package/node/prelude/internal/streams/readable.js +1835 -0
  103. package/node/prelude/internal/streams/state.js +48 -0
  104. package/node/prelude/internal/streams/transform.js +203 -0
  105. package/node/prelude/internal/streams/utils.js +355 -0
  106. package/node/prelude/internal/streams/validators.js +108 -0
  107. package/node/prelude/internal/streams/writable.js +1160 -0
  108. package/node/prelude/internal/structured_clone.js +238 -0
  109. package/node/prelude/internal/system_errors.js +37 -0
  110. package/node/prelude/internal/test_runner/mock.js +431 -0
  111. package/node/prelude/internal/test_runner/reporters.js +404 -0
  112. package/node/prelude/internal/test_runner/test.js +1571 -0
  113. package/node/prelude/internal/timers.js +38 -7
  114. package/node/prelude/internal/timers_global.js +1 -1
  115. package/node/prelude/internal/tls/common.js +8 -2
  116. package/node/prelude/internal/tls/wrap.js +5 -16
  117. package/node/prelude/internal/tls/x509.js +1 -1
  118. package/node/prelude/internal/tty_read_stream.js +39 -0
  119. package/node/prelude/internal/tty_streams.js +3 -0
  120. package/node/prelude/internal/util_debuglog.js +68 -0
  121. package/node/prelude/internal/util_diff.js +63 -0
  122. package/node/prelude/internal/util_more.js +111 -0
  123. package/node/prelude/internal/util_styles.js +76 -0
  124. package/node/prelude/internal/zlib_engines.js +1 -1
  125. package/node/prelude/module.js +219 -8
  126. package/node/prelude/net.js +197 -49
  127. package/node/prelude/os.js +88 -11
  128. package/node/prelude/path.js +11 -7
  129. package/node/prelude/path_posix.js +1 -1
  130. package/node/prelude/path_win32.js +1 -1
  131. package/node/prelude/perf_hooks.js +151 -0
  132. package/node/prelude/process.js +36 -1
  133. package/node/prelude/punycode.js +188 -0
  134. package/node/prelude/querystring.js +1 -1
  135. package/node/prelude/readline.js +8 -0
  136. package/node/prelude/readline_promises.js +88 -0
  137. package/node/prelude/repl.js +38 -0
  138. package/node/prelude/sea.js +23 -0
  139. package/node/prelude/stream.js +70 -1332
  140. package/node/prelude/stream_consumers.js +34 -0
  141. package/node/prelude/stream_promises.js +1 -1
  142. package/node/prelude/stream_web.js +15 -2
  143. package/node/prelude/string_decoder.js +1 -1
  144. package/node/prelude/sys.js +7 -0
  145. package/node/prelude/test.js +56 -0
  146. package/node/prelude/test_reporters.js +269 -0
  147. package/node/prelude/timers.js +7 -84
  148. package/node/prelude/timers_promises.js +1 -1
  149. package/node/prelude/tls.js +2 -1
  150. package/node/prelude/trace_events.js +52 -0
  151. package/node/prelude/tty.js +10 -4
  152. package/node/prelude/url.js +88 -27
  153. package/node/prelude/util.js +121 -5
  154. package/node/prelude/util_types.js +4 -3
  155. package/node/prelude/v8.js +814 -0
  156. package/node/prelude/vm.js +86 -0
  157. package/node/prelude/wasi.js +10 -0
  158. package/node/prelude/worker_threads.js +56 -0
  159. package/node/prelude/zlib.js +58 -25
  160. package/node/src/host_brotli.c +59 -11
  161. package/node/src/host_fs.c +342 -11
  162. package/node/src/host_fswatch.c +170 -0
  163. package/node/src/host_http.c +292 -39
  164. package/node/src/host_loop.c +25 -2
  165. package/node/src/host_net.c +130 -16
  166. package/node/src/host_os.c +55 -1
  167. package/node/src/host_proc.c +291 -0
  168. package/node/src/host_process.c +488 -0
  169. package/node/src/host_sys.c +64 -2
  170. package/node/src/host_zlib.c +27 -7
  171. package/node/src/host_zstd.c +41 -6
  172. package/node/third_party/hdrhistogram/LICENSE +42 -0
  173. package/node/third_party/hdrhistogram/README.md +5 -0
  174. package/node/third_party/libuv/LICENSE +0 -0
  175. package/node/third_party/libuv/LICENSE-extra +36 -0
  176. package/node/third_party/libuv/include/uv/aix.h +0 -0
  177. package/node/third_party/libuv/include/uv/bsd.h +0 -0
  178. package/node/third_party/libuv/include/uv/darwin.h +0 -0
  179. package/node/third_party/libuv/include/uv/errno.h +0 -0
  180. package/node/third_party/libuv/include/uv/linux.h +0 -0
  181. package/node/third_party/libuv/include/uv/os390.h +0 -0
  182. package/node/third_party/libuv/include/uv/posix.h +0 -0
  183. package/node/third_party/libuv/include/uv/sunos.h +0 -0
  184. package/node/third_party/libuv/include/uv/threadpool.h +0 -0
  185. package/node/third_party/libuv/include/uv/tree.h +0 -0
  186. package/node/third_party/libuv/include/uv/unix.h +0 -0
  187. package/node/third_party/libuv/include/uv/version.h +0 -0
  188. package/node/third_party/libuv/include/uv/win.h +0 -0
  189. package/node/third_party/libuv/include/uv.h +0 -0
  190. package/node/third_party/libuv/src/fs-poll.c +0 -0
  191. package/node/third_party/libuv/src/heap-inl.h +0 -0
  192. package/node/third_party/libuv/src/idna.c +0 -0
  193. package/node/third_party/libuv/src/idna.h +0 -0
  194. package/node/third_party/libuv/src/inet.c +0 -0
  195. package/node/third_party/libuv/src/queue.h +0 -0
  196. package/node/third_party/libuv/src/random.c +0 -0
  197. package/node/third_party/libuv/src/strscpy.c +0 -0
  198. package/node/third_party/libuv/src/strscpy.h +0 -0
  199. package/node/third_party/libuv/src/strtok.c +0 -0
  200. package/node/third_party/libuv/src/strtok.h +0 -0
  201. package/node/third_party/libuv/src/thread-common.c +0 -0
  202. package/node/third_party/libuv/src/threadpool.c +0 -0
  203. package/node/third_party/libuv/src/timer.c +0 -0
  204. package/node/third_party/libuv/src/unix/async.c +0 -0
  205. package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +0 -0
  206. package/node/third_party/libuv/src/unix/core.c +0 -0
  207. package/node/third_party/libuv/src/unix/darwin-proctitle.c +0 -0
  208. package/node/third_party/libuv/src/unix/darwin-stub.h +0 -0
  209. package/node/third_party/libuv/src/unix/darwin-syscalls.h +0 -0
  210. package/node/third_party/libuv/src/unix/darwin.c +0 -0
  211. package/node/third_party/libuv/src/unix/dl.c +0 -0
  212. package/node/third_party/libuv/src/unix/fs.c +0 -0
  213. package/node/third_party/libuv/src/unix/fsevents.c +0 -0
  214. package/node/third_party/libuv/src/unix/getaddrinfo.c +0 -0
  215. package/node/third_party/libuv/src/unix/getnameinfo.c +0 -0
  216. package/node/third_party/libuv/src/unix/internal.h +0 -0
  217. package/node/third_party/libuv/src/unix/kqueue.c +0 -0
  218. package/node/third_party/libuv/src/unix/linux.c +0 -0
  219. package/node/third_party/libuv/src/unix/loop-watcher.c +0 -0
  220. package/node/third_party/libuv/src/unix/loop.c +0 -0
  221. package/node/third_party/libuv/src/unix/pipe.c +0 -0
  222. package/node/third_party/libuv/src/unix/poll.c +0 -0
  223. package/node/third_party/libuv/src/unix/process.c +0 -0
  224. package/node/third_party/libuv/src/unix/procfs-exepath.c +0 -0
  225. package/node/third_party/libuv/src/unix/proctitle.c +0 -0
  226. package/node/third_party/libuv/src/unix/random-devurandom.c +0 -0
  227. package/node/third_party/libuv/src/unix/random-getentropy.c +0 -0
  228. package/node/third_party/libuv/src/unix/random-getrandom.c +0 -0
  229. package/node/third_party/libuv/src/unix/random-sysctl-linux.c +0 -0
  230. package/node/third_party/libuv/src/unix/signal.c +0 -0
  231. package/node/third_party/libuv/src/unix/stream.c +0 -0
  232. package/node/third_party/libuv/src/unix/tcp.c +0 -0
  233. package/node/third_party/libuv/src/unix/thread.c +0 -0
  234. package/node/third_party/libuv/src/unix/tty.c +0 -0
  235. package/node/third_party/libuv/src/unix/udp.c +0 -0
  236. package/node/third_party/libuv/src/uv-common.c +0 -0
  237. package/node/third_party/libuv/src/uv-common.h +0 -0
  238. package/node/third_party/libuv/src/uv-data-getter-setters.c +0 -0
  239. package/node/third_party/libuv/src/version.c +0 -0
  240. package/node/third_party/llhttp/LICENSE +0 -0
  241. package/node/third_party/llhttp/api.c +0 -0
  242. package/node/third_party/llhttp/http.c +0 -0
  243. package/node/third_party/llhttp/llhttp.c +0 -0
  244. package/node/third_party/llhttp/llhttp.h +0 -0
  245. package/node/third_party/nodejs/LICENSE +47 -0
  246. package/node/third_party/nodejs/README.md +5 -0
  247. package/node/third_party/parseargs/LICENSE +21 -0
  248. package/node/third_party/parseargs/README.md +5 -0
  249. package/node/third_party/punycode/LICENSE +20 -0
  250. package/node/third_party/punycode/README.md +5 -0
  251. package/node/third_party/zlib/LICENSE.chromium +27 -0
  252. package/package.json +1 -1
  253. package/prebuilt/darwin-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
  254. package/prebuilt/darwin-arm64/brotli-7995bbdacc52e51c.a +0 -0
  255. package/prebuilt/darwin-arm64/uv-72ab666eae197cd8.a +0 -0
  256. package/prebuilt/darwin-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
  257. package/prebuilt/darwin-arm64/zstd-015315ac7c784c73.a +0 -0
  258. package/prebuilt/darwin-x64/boringssl-4a47438eaf7e73ba.a +0 -0
  259. package/prebuilt/darwin-x64/brotli-7995bbdacc52e51c.a +0 -0
  260. package/prebuilt/darwin-x64/uv-72ab666eae197cd8.a +0 -0
  261. package/prebuilt/darwin-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  262. package/prebuilt/darwin-x64/zstd-015315ac7c784c73.a +0 -0
  263. package/prebuilt/linux-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
  264. package/prebuilt/linux-arm64/brotli-65481ff838ce9def.a +0 -0
  265. package/prebuilt/linux-arm64/uv-f1353f50ff983f3c.a +0 -0
  266. package/prebuilt/linux-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
  267. package/prebuilt/linux-arm64/zstd-015315ac7c784c73.a +0 -0
  268. package/prebuilt/linux-arm64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
  269. package/prebuilt/linux-arm64-musl/brotli-65481ff838ce9def.a +0 -0
  270. package/prebuilt/linux-arm64-musl/uv-f1353f50ff983f3c.a +0 -0
  271. package/prebuilt/linux-arm64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
  272. package/prebuilt/linux-arm64-musl/zstd-015315ac7c784c73.a +0 -0
  273. package/prebuilt/linux-x64/boringssl-4a47438eaf7e73ba.a +0 -0
  274. package/prebuilt/linux-x64/brotli-65481ff838ce9def.a +0 -0
  275. package/prebuilt/linux-x64/uv-f1353f50ff983f3c.a +0 -0
  276. package/prebuilt/linux-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  277. package/prebuilt/linux-x64/zstd-015315ac7c784c73.a +0 -0
  278. package/prebuilt/linux-x64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
  279. package/prebuilt/linux-x64-musl/brotli-65481ff838ce9def.a +0 -0
  280. package/prebuilt/linux-x64-musl/uv-f1353f50ff983f3c.a +0 -0
  281. package/prebuilt/linux-x64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
  282. package/prebuilt/linux-x64-musl/zstd-015315ac7c784c73.a +0 -0
  283. package/prebuilt/win32-x64/boringssl-ce573858472b7fc9.a +0 -0
  284. package/prebuilt/win32-x64/brotli-20d86a61f30baeb3.a +0 -0
  285. package/prebuilt/win32-x64/uv-b11bae65d7fced82.a +0 -0
  286. package/prebuilt/win32-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
  287. package/prebuilt/win32-x64/zstd-015315ac7c784c73.a +0 -0
  288. package/runtime/include/js_atoms.gen.h +0 -0
  289. package/runtime/include/js_atoms.h +5 -1
  290. package/runtime/include/js_bigint.h +1 -1
  291. package/runtime/include/js_buffer.h +4 -4
  292. package/runtime/include/js_builtins.h +41 -3
  293. package/runtime/include/js_console.h +9 -4
  294. package/runtime/include/js_convert.h +1 -1
  295. package/runtime/include/js_core.def +5 -4
  296. package/runtime/include/js_crypto.h +1 -1
  297. package/runtime/include/js_error.h +1 -1
  298. package/runtime/include/js_exception.h +21 -1
  299. package/runtime/include/js_function.h +33 -9
  300. package/runtime/include/js_gc.h +172 -30
  301. package/runtime/include/js_generator.h +2 -2
  302. package/runtime/include/js_host.h +19 -1
  303. package/runtime/include/js_jobs.h +5 -5
  304. package/runtime/include/js_module.h +1 -1
  305. package/runtime/include/js_object.h +142 -15
  306. package/runtime/include/js_ops.h +107 -5
  307. package/runtime/include/js_promise.h +3 -3
  308. package/runtime/include/js_regexp.h +1 -1
  309. package/runtime/include/js_runtime.h +0 -0
  310. package/runtime/include/js_symbol.h +1 -1
  311. package/runtime/include/js_web.h +5 -1
  312. package/runtime/include/jscell.h +22 -15
  313. package/runtime/include/jscontext.h +82 -39
  314. package/runtime/include/jsnum.h +1 -1
  315. package/runtime/include/jsstring.h +19 -6
  316. package/runtime/include/jsvalue.h +7 -3
  317. package/runtime/src/arguments.c +2 -2
  318. package/runtime/src/array.c +4 -1
  319. package/runtime/src/arraybuffer.c +19 -7
  320. package/runtime/src/async_iter.c +4 -3
  321. package/runtime/src/atoms.c +38 -4
  322. package/runtime/src/base64.c +2 -2
  323. package/runtime/src/bigint.c +1 -1
  324. package/runtime/src/blob.c +22 -9
  325. package/runtime/src/boringssl_support.cc +1 -1
  326. package/runtime/src/buffer.c +299 -91
  327. package/runtime/src/builtin_table.c +1 -1
  328. package/runtime/src/builtins.c +30 -4
  329. package/runtime/src/builtins_util.h +0 -0
  330. package/runtime/src/collections.c +18 -3
  331. package/runtime/src/components.c +1 -1
  332. package/runtime/src/console.c +14 -7
  333. package/runtime/src/convert.c +0 -0
  334. package/runtime/src/core_all.c +1 -1
  335. package/runtime/src/crypto.c +1 -1
  336. package/runtime/src/crypto_asym.c +1 -1
  337. package/runtime/src/crypto_bn.c +1 -1
  338. package/runtime/src/crypto_cipher.c +10 -3
  339. package/runtime/src/crypto_hash.c +1 -1
  340. package/runtime/src/crypto_host.c +1 -1
  341. package/runtime/src/crypto_internal.h +1 -1
  342. package/runtime/src/crypto_kdf.c +1 -1
  343. package/runtime/src/crypto_key.c +14 -1
  344. package/runtime/src/crypto_pkey.c +1 -1
  345. package/runtime/src/crypto_subtle.c +142 -58
  346. package/runtime/src/crypto_tls.c +1 -1
  347. package/runtime/src/date.c +5 -2
  348. package/runtime/src/domexception.c +2 -2
  349. package/runtime/src/elements.c +56 -17
  350. package/runtime/src/elements.h +7 -2
  351. package/runtime/src/encoding.c +1 -1
  352. package/runtime/src/error.c +4 -4
  353. package/runtime/src/events.c +42 -14
  354. package/runtime/src/exception.c +1 -1
  355. package/runtime/src/fetch.c +241 -17
  356. package/runtime/src/function.c +31 -19
  357. package/runtime/src/gc.c +1720 -211
  358. package/runtime/src/gc_visit.h +87 -0
  359. package/runtime/src/generator.c +5 -3
  360. package/runtime/src/global.c +14 -6
  361. package/runtime/src/headers.c +10 -10
  362. package/runtime/src/inspect.c +76 -17
  363. package/runtime/src/internal.h +9 -6
  364. package/runtime/src/iterate.c +94 -2
  365. package/runtime/src/iterator.c +1 -1
  366. package/runtime/src/jobs.c +11 -5
  367. package/runtime/src/jsnum.c +2 -2
  368. package/runtime/src/json.c +1 -1
  369. package/runtime/src/math.c +9 -1
  370. package/runtime/src/module.c +3 -3
  371. package/runtime/src/number.c +0 -0
  372. package/runtime/src/object.c +107 -74
  373. package/runtime/src/ops.c +21 -3
  374. package/runtime/src/os.c +192 -1
  375. package/runtime/src/os.h +33 -2
  376. package/runtime/src/process.c +73 -8
  377. package/runtime/src/promise.c +4 -4
  378. package/runtime/src/proxy.c +1 -1
  379. package/runtime/src/reflect.c +1 -1
  380. package/runtime/src/regexp.c +700 -11
  381. package/runtime/src/regexp_anchor.h +1 -1
  382. package/runtime/src/regexp_message.h +1 -1
  383. package/runtime/src/shape.c +78 -20
  384. package/runtime/src/shape.h +0 -0
  385. package/runtime/src/streams.c +22 -8
  386. package/runtime/src/streams.h +0 -0
  387. package/runtime/src/string.c +64 -25
  388. package/runtime/src/string_builtins.c +7 -7
  389. package/runtime/src/symbol.c +2 -7
  390. package/runtime/src/test_host.c +3 -3
  391. package/runtime/src/tls_roots.gen.h +102 -620
  392. package/runtime/src/typedarray.c +8 -3
  393. package/runtime/src/tznames.gen.h +2 -1
  394. package/runtime/src/uri.c +1 -1
  395. package/runtime/src/url.c +42 -39
  396. package/runtime/src/weak.c +110 -36
  397. package/runtime/src/web.c +21 -3
  398. package/runtime/src/wrapper.c +0 -0
  399. package/runtime/src/writable.c +7 -6
  400. package/runtime/third_party/ada-idna/LICENSE-MIT +0 -0
  401. package/runtime/third_party/ada-idna/README.md +7 -7
  402. package/runtime/third_party/ada-idna/convert.mjs +89 -27
  403. package/runtime/third_party/ada-idna/idna.c +30 -31
  404. package/runtime/third_party/ada-idna/idna.h +0 -0
  405. package/runtime/third_party/ada-idna/idna_tables.h +2272 -1952
  406. package/runtime/third_party/boringssl/third_party/fiat/LICENSE +15 -0
  407. package/runtime/third_party/mozilla-ca/LICENSE +373 -0
  408. package/runtime/third_party/mozilla-ca/README.md +9 -0
  409. package/runtime/third_party/nodejs/LICENSE +47 -0
  410. package/runtime/third_party/nodejs/README.md +7 -0
  411. package/runtime/third_party/quickjs-dtoa/LICENSE +0 -0
  412. package/runtime/third_party/quickjs-dtoa/README.md +1 -1
  413. package/runtime/third_party/quickjs-dtoa/dtoa.c +0 -0
  414. package/runtime/third_party/quickjs-dtoa/dtoa.h +0 -0
  415. package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +0 -0
  416. package/runtime/third_party/quickjs-regexp/LICENSE +0 -0
  417. package/runtime/third_party/quickjs-regexp/README.md +2 -2
  418. package/runtime/third_party/quickjs-regexp/cutils.c +0 -0
  419. package/runtime/third_party/quickjs-regexp/cutils.h +0 -0
  420. package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +0 -0
  421. package/runtime/third_party/quickjs-regexp/libregexp.c +0 -0
  422. package/runtime/third_party/quickjs-regexp/libregexp.h +0 -0
  423. package/runtime/third_party/quickjs-regexp/libunicode-table.h +0 -0
  424. package/runtime/third_party/quickjs-regexp/libunicode.c +0 -0
  425. package/runtime/third_party/quickjs-regexp/libunicode.h +0 -0
  426. package/runtime/third_party/unicode/LICENSE +39 -0
  427. package/runtime/third_party/unicode/README.md +9 -0
  428. package/runtime/third_party/v8-ieee754/LICENSE +0 -0
  429. package/runtime/third_party/v8-ieee754/LICENSE.fdlibm +10 -0
  430. package/runtime/third_party/v8-ieee754/README.md +3 -2
  431. package/runtime/third_party/v8-ieee754/convert.py +0 -0
  432. package/runtime/third_party/v8-ieee754/ieee754.c +0 -0
  433. package/runtime/third_party/v8-ieee754/ieee754.h +0 -0
  434. package/runtime/tools/regexp_compile.c +2 -2
@@ -0,0 +1,358 @@
1
+ import * as __internal_errors from "./errors.js";
2
+ import * as __internal_streams_utils from "./utils.js";
3
+
4
+ const {
5
+ AbortError,
6
+ aggregateTwoErrors,
7
+ codes: {
8
+ ERR_MULTIPLE_CALLBACK,
9
+ },
10
+ } = __internal_errors;
11
+ const {
12
+ kIsDestroyed,
13
+ isDestroyed,
14
+ isFinished,
15
+ isServerRequest,
16
+ kState,
17
+ kErrorEmitted,
18
+ kEmitClose,
19
+ kClosed,
20
+ kCloseEmitted,
21
+ kConstructed,
22
+ kDestroyed,
23
+ kAutoDestroy,
24
+ kErrored,
25
+ } = __internal_streams_utils;
26
+
27
+ const kDestroy = Symbol('kDestroy');
28
+ const kConstruct = Symbol('kConstruct');
29
+
30
+ function checkError(err, w, r) {
31
+ if (err) {
32
+ // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364
33
+ err.stack; // eslint-disable-line no-unused-expressions
34
+
35
+ if (w && !w.errored) {
36
+ w.errored = err;
37
+ }
38
+ if (r && !r.errored) {
39
+ r.errored = err;
40
+ }
41
+ }
42
+ }
43
+
44
+ // Backwards compat. cb() is undocumented and unused in core but
45
+ // unfortunately might be used by modules.
46
+ function destroy(err, cb) {
47
+ const r = this._readableState;
48
+ const w = this._writableState;
49
+ // With duplex streams we use the writable side for state.
50
+ const s = w || r;
51
+
52
+ if (
53
+ (w && (w[kState] & kDestroyed) !== 0) ||
54
+ (r && (r[kState] & kDestroyed) !== 0)
55
+ ) {
56
+ if (typeof cb === 'function') {
57
+ cb();
58
+ }
59
+
60
+ return this;
61
+ }
62
+
63
+
64
+ // We set destroyed to true before firing error callbacks in order
65
+ // to make it re-entrance safe in case destroy() is called within callbacks
66
+ checkError(err, w, r);
67
+
68
+ if (w) {
69
+ w[kState] |= kDestroyed;
70
+ }
71
+ if (r) {
72
+ r[kState] |= kDestroyed;
73
+ }
74
+
75
+ // If still constructing then defer calling _destroy.
76
+ if ((s[kState] & kConstructed) === 0) {
77
+ this.once(kDestroy, function(er) {
78
+ _destroy(this, aggregateTwoErrors(er, err), cb);
79
+ });
80
+ } else {
81
+ _destroy(this, err, cb);
82
+ }
83
+
84
+ return this;
85
+ }
86
+
87
+ function _destroy(self, err, cb) {
88
+ let called = false;
89
+
90
+ function onDestroy(err) {
91
+ if (called) {
92
+ return;
93
+ }
94
+ called = true;
95
+
96
+ const r = self._readableState;
97
+ const w = self._writableState;
98
+
99
+ checkError(err, w, r);
100
+
101
+ if (w) {
102
+ w[kState] |= kClosed;
103
+ }
104
+ if (r) {
105
+ r[kState] |= kClosed;
106
+ }
107
+
108
+ if (typeof cb === 'function') {
109
+ cb(err);
110
+ }
111
+
112
+ if (err) {
113
+ process.nextTick(emitErrorCloseNT, self, err);
114
+ } else {
115
+ process.nextTick(emitCloseNT, self);
116
+ }
117
+ }
118
+ try {
119
+ self._destroy(err || null, onDestroy);
120
+ } catch (err) {
121
+ onDestroy(err);
122
+ }
123
+ }
124
+
125
+ function emitErrorCloseNT(self, err) {
126
+ emitErrorNT(self, err);
127
+ emitCloseNT(self);
128
+ }
129
+
130
+ function emitCloseNT(self) {
131
+ const r = self._readableState;
132
+ const w = self._writableState;
133
+
134
+ if (w) {
135
+ w[kState] |= kCloseEmitted;
136
+ }
137
+ if (r) {
138
+ r[kState] |= kCloseEmitted;
139
+ }
140
+
141
+ if (
142
+ (w && (w[kState] & kEmitClose) !== 0) ||
143
+ (r && (r[kState] & kEmitClose) !== 0)
144
+ ) {
145
+ self.emit('close');
146
+ }
147
+ }
148
+
149
+ function emitErrorNT(self, err) {
150
+ const r = self._readableState;
151
+ const w = self._writableState;
152
+
153
+ if (
154
+ (w && (w[kState] & kErrorEmitted) !== 0) ||
155
+ (r && (r[kState] & kErrorEmitted) !== 0)
156
+ ) {
157
+ return;
158
+ }
159
+
160
+ if (w) {
161
+ w[kState] |= kErrorEmitted;
162
+ }
163
+ if (r) {
164
+ r[kState] |= kErrorEmitted;
165
+ }
166
+
167
+ self.emit('error', err);
168
+ }
169
+
170
+ function undestroy() {
171
+ const r = this._readableState;
172
+ const w = this._writableState;
173
+
174
+ if (r) {
175
+ r.constructed = true;
176
+ r.closed = false;
177
+ r.closeEmitted = false;
178
+ r.destroyed = false;
179
+ r.errored = null;
180
+ r.errorEmitted = false;
181
+ r.reading = false;
182
+ r.ended = r.readable === false;
183
+ r.endEmitted = r.readable === false;
184
+ }
185
+
186
+ if (w) {
187
+ w.constructed = true;
188
+ w.destroyed = false;
189
+ w.closed = false;
190
+ w.closeEmitted = false;
191
+ w.errored = null;
192
+ w.errorEmitted = false;
193
+ w.finalCalled = false;
194
+ w.prefinished = false;
195
+ w.ended = w.writable === false;
196
+ w.ending = w.writable === false;
197
+ w.finished = w.writable === false;
198
+ }
199
+ }
200
+
201
+ function errorOrDestroy(stream, err, sync) {
202
+ // We have tests that rely on errors being emitted
203
+ // in the same tick, so changing this is semver major.
204
+ // For now when you opt-in to autoDestroy we allow
205
+ // the error to be emitted nextTick. In a future
206
+ // semver major update we should change the default to this.
207
+
208
+ const r = stream._readableState;
209
+ const w = stream._writableState;
210
+
211
+ if (
212
+ (w && (w[kState] ? (w[kState] & kDestroyed) !== 0 : w.destroyed)) ||
213
+ (r && (r[kState] ? (r[kState] & kDestroyed) !== 0 : r.destroyed))
214
+ ) {
215
+ return this;
216
+ }
217
+
218
+ if (
219
+ (r && (r[kState] & kAutoDestroy) !== 0) ||
220
+ (w && (w[kState] & kAutoDestroy) !== 0)
221
+ ) {
222
+ stream.destroy(err);
223
+ } else if (err) {
224
+ // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364
225
+ err.stack; // eslint-disable-line no-unused-expressions
226
+
227
+ if (w && (w[kState] & kErrored) === 0) {
228
+ w.errored = err;
229
+ }
230
+ if (r && (r[kState] & kErrored) === 0) {
231
+ r.errored = err;
232
+ }
233
+ if (sync) {
234
+ process.nextTick(emitErrorNT, stream, err);
235
+ } else {
236
+ emitErrorNT(stream, err);
237
+ }
238
+ }
239
+ }
240
+
241
+ function construct(stream, cb) {
242
+ if (typeof stream._construct !== 'function') {
243
+ return;
244
+ }
245
+
246
+ const r = stream._readableState;
247
+ const w = stream._writableState;
248
+
249
+ if (r) {
250
+ r[kState] &= ~kConstructed;
251
+ }
252
+ if (w) {
253
+ w[kState] &= ~kConstructed;
254
+ }
255
+
256
+ stream.once(kConstruct, cb);
257
+
258
+ if (stream.listenerCount(kConstruct) > 1) {
259
+ // Duplex
260
+ return;
261
+ }
262
+
263
+ process.nextTick(constructNT, stream);
264
+ }
265
+
266
+ function constructNT(stream) {
267
+ let called = false;
268
+
269
+ function onConstruct(err) {
270
+ if (called) {
271
+ errorOrDestroy(stream, err ?? new ERR_MULTIPLE_CALLBACK());
272
+ return;
273
+ }
274
+ called = true;
275
+
276
+ const r = stream._readableState;
277
+ const w = stream._writableState;
278
+ const s = w || r;
279
+
280
+ if (r) {
281
+ r[kState] |= kConstructed;
282
+ }
283
+ if (w) {
284
+ w[kState] |= kConstructed;
285
+ }
286
+
287
+ if (s.destroyed) {
288
+ stream.emit(kDestroy, err);
289
+ } else if (err) {
290
+ errorOrDestroy(stream, err, true);
291
+ } else {
292
+ stream.emit(kConstruct);
293
+ }
294
+ }
295
+
296
+ try {
297
+ stream._construct((err) => {
298
+ process.nextTick(onConstruct, err);
299
+ });
300
+ } catch (err) {
301
+ process.nextTick(onConstruct, err);
302
+ }
303
+ }
304
+
305
+ function isRequest(stream) {
306
+ return stream?.setHeader && typeof stream.abort === 'function';
307
+ }
308
+
309
+ function emitCloseLegacy(stream) {
310
+ stream.emit('close');
311
+ }
312
+
313
+ function emitErrorCloseLegacy(stream, err) {
314
+ stream.emit('error', err);
315
+ process.nextTick(emitCloseLegacy, stream);
316
+ }
317
+
318
+ // Normalize destroy for legacy.
319
+ function destroyer(stream, err) {
320
+ if (!stream || isDestroyed(stream)) {
321
+ return;
322
+ }
323
+
324
+ if (!err && !isFinished(stream)) {
325
+ err = new AbortError();
326
+ }
327
+
328
+ // TODO: Remove isRequest branches.
329
+ if (isServerRequest(stream)) {
330
+ stream.socket = null;
331
+ stream.destroy(err);
332
+ } else if (isRequest(stream)) {
333
+ stream.abort();
334
+ } else if (isRequest(stream.req)) {
335
+ stream.req.abort();
336
+ } else if (typeof stream.destroy === 'function') {
337
+ stream.destroy(err);
338
+ } else if (typeof stream.close === 'function') {
339
+ // TODO: Don't lose err?
340
+ stream.close();
341
+ } else if (err) {
342
+ process.nextTick(emitErrorCloseLegacy, stream, err);
343
+ } else {
344
+ process.nextTick(emitCloseLegacy, stream);
345
+ }
346
+
347
+ if (!stream.destroyed) {
348
+ stream[kIsDestroyed] = true;
349
+ }
350
+ }
351
+
352
+ export {
353
+ construct,
354
+ destroyer,
355
+ destroy,
356
+ undestroy,
357
+ errorOrDestroy,
358
+ };
@@ -0,0 +1,199 @@
1
+ import { feature } from "../features.js";
2
+ import * as __internal_streams_legacy from "./legacy.js";
3
+ import * as __internal_streams_readable from "./readable.js";
4
+ import * as __internal_streams_writable from "./writable.js";
5
+ import * as __internal_streams_add_abort_signal from "./add_abort_signal.js";
6
+ import * as __internal_streams_destroy from "./destroy.js";
7
+ import * as __internal_streams_utils from "./utils.js";
8
+
9
+ // Copyright Joyent, Inc. and other Node contributors.
10
+ //
11
+ // Permission is hereby granted, free of charge, to any person obtaining a
12
+ // copy of this software and associated documentation files (the
13
+ // "Software"), to deal in the Software without restriction, including
14
+ // without limitation the rights to use, copy, modify, merge, publish,
15
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
16
+ // persons to whom the Software is furnished to do so, subject to the
17
+ // following conditions:
18
+ //
19
+ // The above copyright notice and this permission notice shall be included
20
+ // in all copies or substantial portions of the Software.
21
+ //
22
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
28
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+ // a duplex stream is just a stream that is both readable and writable.
31
+ // Since JS doesn't have multiple prototype inheritance, this class
32
+ // prototypically inherits from Readable, and then parasitically from
33
+ // Writable.
34
+
35
+ 'use strict';
36
+
37
+ export { Duplex, Duplex as default };
38
+
39
+ const { Stream } = __internal_streams_legacy;
40
+ const Readable = __internal_streams_readable.default;
41
+ const Writable = __internal_streams_writable.default;
42
+
43
+ const {
44
+ addAbortSignal,
45
+ } = __internal_streams_add_abort_signal;
46
+
47
+ const destroyImpl = __internal_streams_destroy;
48
+ const { kOnConstructed } = __internal_streams_utils;
49
+
50
+ Object.setPrototypeOf(Duplex.prototype, Readable.prototype);
51
+ Object.setPrototypeOf(Duplex, Readable);
52
+
53
+ {
54
+ const keys = Object.keys(Writable.prototype);
55
+ // Allow the keys array to be GC'ed.
56
+ for (let i = 0; i < keys.length; i++) {
57
+ const method = keys[i];
58
+ Duplex.prototype[method] ||= Writable.prototype[method];
59
+ }
60
+ }
61
+
62
+ // Use the `destroy` method of `Writable`.
63
+ Duplex.prototype.destroy = Writable.prototype.destroy;
64
+
65
+ function Duplex(options) {
66
+ if (!(this instanceof Duplex))
67
+ return new Duplex(options);
68
+
69
+ this._events ??= {
70
+ close: undefined,
71
+ error: undefined,
72
+ prefinish: undefined,
73
+ finish: undefined,
74
+ drain: undefined,
75
+ data: undefined,
76
+ end: undefined,
77
+ readable: undefined,
78
+ // Skip uncommon events...
79
+ // pause: undefined,
80
+ // resume: undefined,
81
+ // pipe: undefined,
82
+ // unpipe: undefined,
83
+ // [destroyImpl.kConstruct]: undefined,
84
+ // [destroyImpl.kDestroy]: undefined,
85
+ };
86
+
87
+ this._readableState = new Readable.ReadableState(options, this, true);
88
+ this._writableState = new Writable.WritableState(options, this, true);
89
+
90
+ if (options) {
91
+ this.allowHalfOpen = options.allowHalfOpen !== false;
92
+
93
+ if (options.readable === false) {
94
+ this._readableState.readable = false;
95
+ this._readableState.ended = true;
96
+ this._readableState.endEmitted = true;
97
+ }
98
+
99
+ if (options.writable === false) {
100
+ this._writableState.writable = false;
101
+ this._writableState.ending = true;
102
+ this._writableState.ended = true;
103
+ this._writableState.finished = true;
104
+ }
105
+
106
+ if (typeof options.read === 'function')
107
+ this._read = options.read;
108
+
109
+ if (typeof options.write === 'function')
110
+ this._write = options.write;
111
+
112
+ if (typeof options.writev === 'function')
113
+ this._writev = options.writev;
114
+
115
+ if (typeof options.destroy === 'function')
116
+ this._destroy = options.destroy;
117
+
118
+ if (typeof options.final === 'function')
119
+ this._final = options.final;
120
+
121
+ if (typeof options.construct === 'function')
122
+ this._construct = options.construct;
123
+
124
+ if (options.signal)
125
+ addAbortSignal(options.signal, this);
126
+ } else {
127
+ this.allowHalfOpen = true;
128
+ }
129
+
130
+ Stream.call(this, options);
131
+
132
+ if (this._construct != null) {
133
+ destroyImpl.construct(this, () => {
134
+ this._readableState[kOnConstructed](this);
135
+ this._writableState[kOnConstructed](this);
136
+ });
137
+ }
138
+ }
139
+
140
+ Object.defineProperties(Duplex.prototype, {
141
+ writable:
142
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writable') },
143
+ writableHighWaterMark:
144
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') },
145
+ writableObjectMode:
146
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') },
147
+ writableBuffer:
148
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') },
149
+ writableLength:
150
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableLength') },
151
+ writableFinished:
152
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableFinished') },
153
+ writableCorked:
154
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableCorked') },
155
+ writableEnded:
156
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableEnded') },
157
+ writableNeedDrain:
158
+ { __proto__: null, ...Object.getOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') },
159
+
160
+ destroyed: {
161
+ __proto__: null,
162
+ get() {
163
+ if (this._readableState === undefined ||
164
+ this._writableState === undefined) {
165
+ return false;
166
+ }
167
+ return this._readableState.destroyed && this._writableState.destroyed;
168
+ },
169
+ set(value) {
170
+ // Backward compatibility, the user is explicitly
171
+ // managing destroyed.
172
+ if (this._readableState && this._writableState) {
173
+ this._readableState.destroyed = value;
174
+ this._writableState.destroyed = value;
175
+ }
176
+ },
177
+ },
178
+ });
179
+
180
+ /* the conversions to and from web streams: internal/stream_web_adapters.js, linked into programs
181
+ * that name them (internal/features.js) */
182
+ function lazyWebStreams() {
183
+ return feature('webStreamsAdapters');
184
+ }
185
+
186
+ Duplex.fromWeb = function(pair, options) {
187
+ return lazyWebStreams().newStreamDuplexFromReadableWritablePair(
188
+ pair,
189
+ options);
190
+ };
191
+
192
+ Duplex.toWeb = function(duplex, options) {
193
+ return lazyWebStreams().newReadableWritablePairFromDuplex(duplex, options);
194
+ };
195
+
196
+ /* duplexify: internal/streams/duplexify.js, with compose, linked into programs that name them */
197
+ Duplex.from = function(body) {
198
+ return feature('duplexify')(body, 'body');
199
+ };