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
@@ -1,9 +1,11 @@
1
- // node:path (ADR 0012, layer 3): Node's lib/path.js (MIT; Node v22), both its win32 and its
1
+ // node:path: Node's lib/path.js (MIT; Node v22), both its win32 and its
2
2
  // posix halves, ported: primordials are the methods they stand for, the working directory is the
3
- // host's, and matchesGlob (minimatch, which visaljs doesn't bundle) is a stub. Results match Node's
3
+ // host's, and matchesGlob is fs.glob's matcher (internal/fs_glob.js). Results match Node's
4
4
  // byte for byte; the default export is win32 on Windows, posix elsewhere, as Node's.
5
+ // Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
5
6
  import { cwd as hostCwd } from "visaljs:host";
6
- import { invalidArgType, notSupported, validateString } from "./internal/errors.js";
7
+ import { invalidArgType, validateString } from "./internal/errors.js";
8
+ import { feature } from "./internal/features.js";
7
9
 
8
10
  const CHAR_UPPERCASE_A = 65, CHAR_LOWERCASE_A = 97, CHAR_UPPERCASE_Z = 90, CHAR_LOWERCASE_Z = 122;
9
11
  const CHAR_DOT = 46, CHAR_FORWARD_SLASH = 47, CHAR_BACKWARD_SLASH = 92, CHAR_COLON = 58, CHAR_QUESTION_MARK = 63;
@@ -1162,8 +1164,9 @@ const win32 = {
1162
1164
  return ret;
1163
1165
  },
1164
1166
 
1165
- matchesGlob(_path, _pattern) {
1166
- throw notSupported('path.matchesGlob');
1167
+ /* internal/fs_glob.js's, linked when the program names it */
1168
+ matchesGlob(path, pattern) {
1169
+ return feature("matchesGlob")(path, pattern);
1167
1170
  },
1168
1171
 
1169
1172
  sep: '\\',
@@ -1644,8 +1647,9 @@ const posix = {
1644
1647
  return ret;
1645
1648
  },
1646
1649
 
1647
- matchesGlob(_path, _pattern) {
1648
- throw notSupported('path.matchesGlob');
1650
+ /* internal/fs_glob.js's, linked when the program names it */
1651
+ matchesGlob(path, pattern) {
1652
+ return feature("matchesGlob")(path, pattern);
1649
1653
  },
1650
1654
 
1651
1655
  sep: '/',
@@ -1,4 +1,4 @@
1
- // node:path/posix (ADR 0012, layer 3): path.posix, on every platform.
1
+ // node:path/posix: path.posix, on every platform.
2
2
  import { posix } from "./path.js";
3
3
 
4
4
  export const {
@@ -1,4 +1,4 @@
1
- // node:path/win32 (ADR 0012, layer 3): path.win32, on every platform.
1
+ // node:path/win32: path.win32, on every platform.
2
2
  import { win32 } from "./path.js";
3
3
 
4
4
  export const {
@@ -0,0 +1,151 @@
1
+ // node:perf_hooks: `performance`'s clock, marks and measures. The clock is
2
+ // process.hrtime's, from when this module loads: timeOrigin is that time on the epoch clock.
3
+ // PerformanceObserver and the histograms are modules of their own (internal/perf_observe.js,
4
+ // internal/perf_histogram.js), linked when the program names them.
5
+ import { codeError, invalidArgType } from "./internal/errors.js";
6
+ import { features, lazyClass, lazyFunction } from "./internal/features.js";
7
+
8
+ const hrMs = () => {
9
+ const [s, ns] = process.hrtime();
10
+ return s * 1e3 + ns / 1e6;
11
+ };
12
+ const origin = hrMs();
13
+ const timeOrigin = Date.now();
14
+ const now = () => hrMs() - origin;
15
+
16
+ const kConstruct = Symbol("construct");
17
+
18
+ /* for internal/perf_observe.js's users: the clock, and an entry of another module's (net's 'connect') */
19
+ features.perfNow = now;
20
+ features.perfEntry = (name, entryType, startTime, duration, detail) => new PerformanceEntry(kConstruct, name, entryType, startTime, duration, detail);
21
+
22
+ export class PerformanceEntry {
23
+ constructor(key, name, entryType, startTime, duration, detail) {
24
+ if (key !== kConstruct) throw codeError(TypeError, "ERR_ILLEGAL_CONSTRUCTOR", "Illegal constructor");
25
+ this.name = name;
26
+ this.entryType = entryType;
27
+ this.startTime = startTime;
28
+ this.duration = duration;
29
+ this.detail = detail;
30
+ }
31
+
32
+ toJSON() {
33
+ return { name: this.name, entryType: this.entryType, startTime: this.startTime, duration: this.duration, detail: this.detail };
34
+ }
35
+ }
36
+
37
+ export class PerformanceMark extends PerformanceEntry {
38
+ constructor(name, options) {
39
+ if (name === undefined) throw codeError(TypeError, "ERR_MISSING_ARGS", 'The "name" argument must be specified');
40
+ const startTime = options?.startTime ?? now();
41
+ if (typeof startTime !== "number") throw invalidArgType("options.startTime", "of type number", startTime);
42
+ super(kConstruct, String(name), "mark", startTime, 0, options?.detail ?? null);
43
+ }
44
+ }
45
+
46
+ export class PerformanceMeasure extends PerformanceEntry {
47
+ constructor(key, name, startTime, duration, detail) {
48
+ super(key, name, "measure", startTime, duration, detail);
49
+ }
50
+ }
51
+
52
+ /* marks and measures, in the order they were made */
53
+ const entries = [];
54
+
55
+ /** A mark's time: a number as is, else the latest mark of that name. */
56
+ function markTime(mark) {
57
+ if (typeof mark === "number") return mark;
58
+ for (let i = entries.length - 1; i >= 0; i--) {
59
+ if (entries[i].entryType === "mark" && entries[i].name === mark) return entries[i].startTime;
60
+ }
61
+ throw new globalThis.DOMException('The "' + mark + '" performance mark has not been set', "SyntaxError");
62
+ }
63
+
64
+ export class Performance {
65
+ constructor(key) {
66
+ if (key !== kConstruct) throw codeError(TypeError, "ERR_ILLEGAL_CONSTRUCTOR", "Illegal constructor");
67
+ }
68
+
69
+ get timeOrigin() {
70
+ return timeOrigin;
71
+ }
72
+
73
+ now() {
74
+ return now();
75
+ }
76
+
77
+ mark(name, options) {
78
+ const mark = new PerformanceMark(name, options);
79
+ entries.push(mark);
80
+ features.perfObserve?.(mark);
81
+ return mark;
82
+ }
83
+
84
+ /** measure(name, startMark?, endMark?) or measure(name, { start, end, duration, detail }). */
85
+ measure(name, startOrOptions, endMark) {
86
+ let start = 0, end, detail = null;
87
+ if (startOrOptions !== null && typeof startOrOptions === "object") {
88
+ const { start: s, end: e, duration, detail: d } = startOrOptions;
89
+ if (s !== undefined) start = markTime(s);
90
+ end = e !== undefined ? markTime(e) : duration !== undefined ? start + duration : now();
91
+ detail = d ?? null;
92
+ } else {
93
+ if (startOrOptions !== undefined) start = markTime(startOrOptions);
94
+ end = endMark !== undefined ? markTime(endMark) : now();
95
+ }
96
+ const measure = new PerformanceMeasure(kConstruct, String(name), start, end - start, detail);
97
+ entries.push(measure);
98
+ features.perfObserve?.(measure);
99
+ return measure;
100
+ }
101
+
102
+ clearMarks(name) {
103
+ clear("mark", name);
104
+ }
105
+
106
+ clearMeasures(name) {
107
+ clear("measure", name);
108
+ }
109
+
110
+ getEntries() {
111
+ return entries.slice().sort((a, b) => a.startTime - b.startTime);
112
+ }
113
+
114
+ getEntriesByName(name, type) {
115
+ return this.getEntries().filter((e) => e.name === name && (type === undefined || e.entryType === type));
116
+ }
117
+
118
+ getEntriesByType(type) {
119
+ return this.getEntries().filter((e) => e.entryType === type);
120
+ }
121
+
122
+ toJSON() {
123
+ return { timeOrigin };
124
+ }
125
+ }
126
+
127
+ function clear(type, name) {
128
+ for (let i = entries.length - 1; i >= 0; i--) {
129
+ if (entries[i].entryType === type && (name === undefined || entries[i].name === name)) entries.splice(i, 1);
130
+ }
131
+ }
132
+
133
+ export const performance = new Performance(kConstruct);
134
+
135
+ export const constants = {
136
+ NODE_PERFORMANCE_GC_MAJOR: 4, NODE_PERFORMANCE_GC_MINOR: 1, NODE_PERFORMANCE_GC_INCREMENTAL: 8, NODE_PERFORMANCE_GC_WEAKCB: 16,
137
+ NODE_PERFORMANCE_GC_FLAGS_NO: 0, NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2, NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,
138
+ NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8, NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,
139
+ NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32, NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64,
140
+ };
141
+
142
+ export const PerformanceObserver = lazyClass("PerformanceObserver");
143
+ export const PerformanceObserverEntryList = lazyClass("PerformanceObserverEntryList");
144
+ export const PerformanceResourceTiming = lazyClass("PerformanceResourceTiming");
145
+ export const createHistogram = lazyFunction("createHistogram");
146
+ export const monitorEventLoopDelay = lazyFunction("monitorEventLoopDelay");
147
+
148
+ export default {
149
+ Performance, PerformanceEntry, PerformanceMark, PerformanceMeasure, PerformanceObserver, PerformanceObserverEntryList, PerformanceResourceTiming,
150
+ performance, constants, createHistogram, monitorEventLoopDelay,
151
+ };
@@ -1,4 +1,4 @@
1
- // node:process (ADR 0012, layer 3): the process global, as a module.
1
+ // node:process: the process global, as a module.
2
2
  const p = globalThis.process;
3
3
 
4
4
  export const argv = p.argv;
@@ -9,6 +9,8 @@ export const execPath = p.execPath;
9
9
  export const pid = p.pid;
10
10
  export const platform = p.platform;
11
11
  export const stderr = p.stderr;
12
+ /* made when read, by the module the driver adds when the program names it */
13
+ export const stdin = p.stdin;
12
14
  export const stdout = p.stdout;
13
15
  export const version = p.version;
14
16
  export const versions = p.versions;
@@ -18,6 +20,39 @@ export const exit = (...args) => p.exit(...args);
18
20
  export const hrtime = p.hrtime;
19
21
  export const nextTick = (...args) => p.nextTick(...args);
20
22
  export const kill = (...args) => p.kill(...args);
23
+ /* the members of internal/process_more.js, which the driver adds when the program names them:
24
+ * called through process, so a program that imports node:process links none of them */
25
+ export const chdir = (...args) => p.chdir(...args);
26
+ export const umask = (...args) => p.umask(...args);
27
+ export const memoryUsage = (...args) => p.memoryUsage(...args);
28
+ export const uptime = (...args) => p.uptime(...args);
29
+ export const cpuUsage = (...args) => p.cpuUsage(...args);
30
+ export const threadCpuUsage = (...args) => p.threadCpuUsage(...args);
31
+ export const resourceUsage = (...args) => p.resourceUsage(...args);
32
+ export const availableMemory = (...args) => p.availableMemory(...args);
33
+ export const constrainedMemory = (...args) => p.constrainedMemory(...args);
34
+ export const setuid = (...args) => p.setuid(...args);
35
+ export const setgid = (...args) => p.setgid(...args);
36
+ export const seteuid = (...args) => p.seteuid(...args);
37
+ export const setegid = (...args) => p.setegid(...args);
38
+ export const getgroups = (...args) => p.getgroups(...args);
39
+ export const setgroups = (...args) => p.setgroups(...args);
40
+ export const initgroups = (...args) => p.initgroups(...args);
41
+ export const abort = (...args) => p.abort(...args);
42
+ export const reallyExit = (...args) => p.reallyExit(...args);
43
+ export const execve = (...args) => p.execve(...args);
44
+ export const getBuiltinModule = (...args) => p.getBuiltinModule(...args);
45
+ export const loadEnvFile = (...args) => p.loadEnvFile(...args);
46
+ export const hasUncaughtExceptionCaptureCallback = (...args) => p.hasUncaughtExceptionCaptureCallback(...args);
47
+ export const setUncaughtExceptionCaptureCallback = (...args) => p.setUncaughtExceptionCaptureCallback(...args);
48
+ export const setSourceMapsEnabled = (...args) => p.setSourceMapsEnabled(...args);
49
+ export const getActiveResourcesInfo = (...args) => p.getActiveResourcesInfo(...args);
50
+ export const openStdin = (...args) => p.openStdin(...args);
51
+ export const ref = (...args) => p.ref(...args);
52
+ export const unref = (...args) => p.unref(...args);
53
+ export const assert = (...args) => p.assert(...args);
54
+ export const binding = (...args) => p.binding(...args);
55
+ export const dlopen = (...args) => p.dlopen(...args);
21
56
  /* using it gets the driver to add process's events (node/index.ts) */
22
57
  export const emit = (...args) => p.emit(...args);
23
58
 
@@ -0,0 +1,188 @@
1
+ // node:punycode: Punycode (RFC 3492) and IDNA's toASCII / toUnicode for domain names, as the
2
+ // punycode.js 2.1.0 Node bundles (deprecated in Node, still required by older packages).
3
+ // Ported from punycode.js 2.1.0 (Copyright Mathias Bynens, MIT): node/third_party/punycode/LICENSE.
4
+
5
+ const maxInt = 2147483647;
6
+ const base = 36;
7
+ const tMin = 1;
8
+ const tMax = 26;
9
+ const skew = 38;
10
+ const damp = 700;
11
+ const initialBias = 72;
12
+ const initialN = 128;
13
+ const delimiter = "-";
14
+
15
+ const regexPunycode = /^xn--/;
16
+ const regexNonASCII = /[^\0-\x7F]/;
17
+ const regexSeparators = /[\x2E。.。]/g; /* RFC 3490 separators */
18
+
19
+ const errors = {
20
+ overflow: "Overflow: input needs wider integers to process",
21
+ "not-basic": "Illegal input >= 0x80 (not a basic code point)",
22
+ "invalid-input": "Invalid input",
23
+ };
24
+
25
+ function error(type) {
26
+ throw new RangeError(errors[type]);
27
+ }
28
+
29
+ /* a domain name's labels mapped, an email address's local part kept */
30
+ function mapDomain(domain, fn) {
31
+ const parts = domain.split("@");
32
+ let result = "";
33
+ if (parts.length > 1) {
34
+ result = parts[0] + "@";
35
+ domain = parts[1];
36
+ }
37
+ domain = domain.replace(regexSeparators, "\x2E");
38
+ const encoded = domain.split(".").map(fn).join(".");
39
+ return result + encoded;
40
+ }
41
+
42
+ /** A string's code points: surrogate pairs joined, lone surrogates kept. */
43
+ function ucs2decode(string) {
44
+ const output = [];
45
+ let counter = 0;
46
+ const length = string.length;
47
+ while (counter < length) {
48
+ const value = string.charCodeAt(counter++);
49
+ if (value >= 0xd800 && value <= 0xdbff && counter < length) {
50
+ const extra = string.charCodeAt(counter++);
51
+ if ((extra & 0xfc00) === 0xdc00) output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
52
+ else {
53
+ output.push(value);
54
+ counter--;
55
+ }
56
+ } else output.push(value);
57
+ }
58
+ return output;
59
+ }
60
+
61
+ /** Code points as a string. */
62
+ const ucs2encode = (codePoints) => String.fromCodePoint(...codePoints);
63
+
64
+ /* a basic code point's digit value, or base for anything else */
65
+ function basicToDigit(codePoint) {
66
+ if (codePoint >= 0x30 && codePoint < 0x3a) return 26 + (codePoint - 0x30);
67
+ if (codePoint >= 0x41 && codePoint < 0x5b) return codePoint - 0x41;
68
+ if (codePoint >= 0x61 && codePoint < 0x7b) return codePoint - 0x61;
69
+ return base;
70
+ }
71
+
72
+ /* a digit's code point, lowercase (0..25 a..z, 26..35 0..9) */
73
+ const digitToBasic = (digit) => digit + 22 + 75 * (digit < 26);
74
+
75
+ /* RFC 3492 3.4 */
76
+ function adapt(delta, numPoints, firstTime) {
77
+ let k = 0;
78
+ delta = firstTime ? Math.floor(delta / damp) : delta >> 1;
79
+ delta += Math.floor(delta / numPoints);
80
+ for (; delta > ((base - tMin) * tMax) >> 1; k += base) delta = Math.floor(delta / (base - tMin));
81
+ return Math.floor(k + ((base - tMin + 1) * delta) / (delta + skew));
82
+ }
83
+
84
+ /** Punycode (ASCII only) to the Unicode string it encodes. */
85
+ export function decode(input) {
86
+ const output = [];
87
+ const inputLength = input.length;
88
+ let i = 0;
89
+ let n = initialN;
90
+ let bias = initialBias;
91
+
92
+ /* the basic code points: everything before the last delimiter */
93
+ let basic = input.lastIndexOf(delimiter);
94
+ if (basic < 0) basic = 0;
95
+ for (let j = 0; j < basic; ++j) {
96
+ if (input.charCodeAt(j) >= 0x80) error("not-basic");
97
+ output.push(input.charCodeAt(j));
98
+ }
99
+
100
+ /* the deltas, each inserting a code point */
101
+ for (let index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
102
+ const oldi = i;
103
+ for (let w = 1, k = base; ; k += base) {
104
+ if (index >= inputLength) error("invalid-input");
105
+ const digit = basicToDigit(input.charCodeAt(index++));
106
+ if (digit >= base) error("invalid-input");
107
+ if (digit > Math.floor((maxInt - i) / w)) error("overflow");
108
+ i += digit * w;
109
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
110
+ if (digit < t) break;
111
+ const baseMinusT = base - t;
112
+ if (w > Math.floor(maxInt / baseMinusT)) error("overflow");
113
+ w *= baseMinusT;
114
+ }
115
+ const out = output.length + 1;
116
+ bias = adapt(i - oldi, out, oldi === 0);
117
+ if (Math.floor(i / out) > maxInt - n) error("overflow");
118
+ n += Math.floor(i / out);
119
+ i %= out;
120
+ output.splice(i++, 0, n);
121
+ }
122
+ return String.fromCodePoint(...output);
123
+ }
124
+
125
+ /** A Unicode string as Punycode (ASCII only). */
126
+ export function encode(input) {
127
+ const output = [];
128
+ input = ucs2decode(input);
129
+ const inputLength = input.length;
130
+ let n = initialN;
131
+ let delta = 0;
132
+ let bias = initialBias;
133
+
134
+ for (const currentValue of input) {
135
+ if (currentValue < 0x80) output.push(String.fromCharCode(currentValue));
136
+ }
137
+ const basicLength = output.length;
138
+ let handledCPCount = basicLength;
139
+ if (basicLength) output.push(delimiter);
140
+
141
+ while (handledCPCount < inputLength) {
142
+ /* the next code point to insert: the smallest not yet handled */
143
+ let m = maxInt;
144
+ for (const currentValue of input) {
145
+ if (currentValue >= n && currentValue < m) m = currentValue;
146
+ }
147
+ const handledCPCountPlusOne = handledCPCount + 1;
148
+ if (m - n > Math.floor((maxInt - delta) / handledCPCountPlusOne)) error("overflow");
149
+ delta += (m - n) * handledCPCountPlusOne;
150
+ n = m;
151
+ for (const currentValue of input) {
152
+ if (currentValue < n && ++delta > maxInt) error("overflow");
153
+ if (currentValue === n) {
154
+ let q = delta;
155
+ for (let k = base; ; k += base) {
156
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
157
+ if (q < t) break;
158
+ const qMinusT = q - t;
159
+ const baseMinusT = base - t;
160
+ output.push(String.fromCharCode(digitToBasic(t + (qMinusT % baseMinusT))));
161
+ q = Math.floor(qMinusT / baseMinusT);
162
+ }
163
+ output.push(String.fromCharCode(digitToBasic(q)));
164
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
165
+ delta = 0;
166
+ ++handledCPCount;
167
+ }
168
+ }
169
+ ++delta;
170
+ ++n;
171
+ }
172
+ return output.join("");
173
+ }
174
+
175
+ /** A domain name (or email address) with its Punycode labels (xn--…) as Unicode. */
176
+ export function toUnicode(input) {
177
+ return mapDomain(input, (string) => (regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string));
178
+ }
179
+
180
+ /** A domain name (or email address) with its non-ASCII labels as Punycode (xn--…). */
181
+ export function toASCII(input) {
182
+ return mapDomain(input, (string) => (regexNonASCII.test(string) ? "xn--" + encode(string) : string));
183
+ }
184
+
185
+ export const version = "2.1.0";
186
+ export const ucs2 = { decode: ucs2decode, encode: ucs2encode };
187
+
188
+ export default { version, ucs2, decode, encode, toASCII, toUnicode };
@@ -1,4 +1,4 @@
1
- // node:querystring (ADR 0012, layer 3): Node's lib/querystring.js (v22.22.2), ported to the host
1
+ // node:querystring: Node's lib/querystring.js (v22.22.2), ported to the host
2
2
  // prelude: primordials as plain calls, its requires as imports. Node's notice:
3
3
  //
4
4
  // Copyright Joyent, Inc. and other Node contributors.
@@ -0,0 +1,8 @@
1
+ // node:readline (internal/readline.js): Interface, createInterface, the cursor's escapes, and
2
+ // node:readline/promises as promises.
3
+ import promises from "./readline_promises.js";
4
+ import { Interface, clearLine, clearScreenDown, createInterface, cursorTo, emitKeypressEvents, moveCursor } from "./internal/readline.js";
5
+
6
+ export { Interface, clearLine, clearScreenDown, createInterface, cursorTo, emitKeypressEvents, moveCursor, promises };
7
+
8
+ export default { Interface, clearLine, clearScreenDown, createInterface, cursorTo, emitKeypressEvents, moveCursor, promises };
@@ -0,0 +1,88 @@
1
+ // node:readline/promises: node:readline's Interface with question() as a promise, and Readline,
2
+ // cursor moves queued and written by commit().
3
+ import { codeError } from "./internal/errors.js";
4
+ import {
5
+ Interface as BaseInterface, abortError, clearLineEscape, cursorToEscape, kQuestion, kQuestionCancel, moveCursorEscape,
6
+ } from "./internal/readline.js";
7
+
8
+ export class Interface extends BaseInterface {
9
+ /** The next line, or an AbortError when the signal aborts first. */
10
+ question(query, options = {}) {
11
+ return new Promise((resolve, reject) => {
12
+ let cb = resolve;
13
+ const signal = options?.signal;
14
+ if (signal) {
15
+ if (signal === null || typeof signal !== "object" || !("aborted" in signal)) {
16
+ throw codeError(TypeError, "ERR_INVALID_ARG_TYPE", 'The "options.signal" property must be an instance of AbortSignal.');
17
+ }
18
+ if (signal.aborted) return reject(abortError(signal));
19
+ const onAbort = () => {
20
+ this[kQuestionCancel]();
21
+ reject(abortError(signal));
22
+ };
23
+ signal.addEventListener("abort", onAbort, { once: true });
24
+ cb = (answer) => {
25
+ signal.removeEventListener("abort", onAbort);
26
+ resolve(answer);
27
+ };
28
+ }
29
+ this[kQuestion](query, cb);
30
+ });
31
+ }
32
+ }
33
+
34
+ export function createInterface(input, output, completer, terminal) {
35
+ return new Interface(input, output, completer, terminal);
36
+ }
37
+
38
+ /** Cursor moves on a stream, queued until commit() (or written at once with autoCommit). */
39
+ export class Readline {
40
+ #stream;
41
+ #todo = [];
42
+ #autoCommit;
43
+
44
+ constructor(stream, options = undefined) {
45
+ if (stream === null || typeof stream !== "object" || typeof stream.write !== "function") {
46
+ throw codeError(TypeError, "ERR_INVALID_ARG_TYPE", 'The "stream" argument must be an instance of Writable.');
47
+ }
48
+ this.#stream = stream;
49
+ this.#autoCommit = Boolean(options?.autoCommit);
50
+ }
51
+
52
+ #add(data) {
53
+ if (this.#autoCommit) process.nextTick(() => this.#stream.write(data));
54
+ else this.#todo.push(data);
55
+ return this;
56
+ }
57
+
58
+ cursorTo(x, y = undefined) {
59
+ return this.#add(cursorToEscape(x, y));
60
+ }
61
+
62
+ moveCursor(dx, dy) {
63
+ if (!dx && !dy) return this;
64
+ return this.#add(moveCursorEscape(dx, dy));
65
+ }
66
+
67
+ clearLine(dir) {
68
+ return this.#add(clearLineEscape(dir));
69
+ }
70
+
71
+ clearScreenDown() {
72
+ return this.#add("\x1b[0J");
73
+ }
74
+
75
+ /** Writes what's queued: resolved once written. */
76
+ commit() {
77
+ const data = this.#todo.join("");
78
+ this.#todo = [];
79
+ return new Promise((resolve) => this.#stream.write(data, resolve));
80
+ }
81
+
82
+ rollback() {
83
+ this.#todo = [];
84
+ return this;
85
+ }
86
+ }
87
+
88
+ export default { Interface, Readline, createInterface };
@@ -0,0 +1,38 @@
1
+ // node:repl: a REPL evaluates what's typed, which needs a JavaScript engine a compiled program
2
+ // doesn't have: start() and REPLServer throw ERR_VISALJS_UNSUPPORTED. The constants, writer and
3
+ // Recoverable are Node's.
4
+ import { notSupported } from "./internal/errors.js";
5
+ import { inspect } from "./util.js";
6
+
7
+ export const REPL_MODE_SLOPPY = Symbol("repl-sloppy");
8
+ export const REPL_MODE_STRICT = Symbol("repl-strict");
9
+
10
+ /** How the REPL shows a result: util.inspect, with its options. */
11
+ export function writer(obj) {
12
+ return inspect(obj, writer.options);
13
+ }
14
+ writer.options = { ...inspect.defaultOptions, showProxy: true };
15
+
16
+ /** An error that more input could resolve. */
17
+ export class Recoverable extends SyntaxError {
18
+ constructor(err) {
19
+ super();
20
+ this.err = err;
21
+ }
22
+ }
23
+
24
+ export function start() {
25
+ throw notSupported("repl.start (evaluating input)");
26
+ }
27
+
28
+ export class REPLServer {
29
+ constructor() {
30
+ throw notSupported("repl.REPLServer (evaluating input)");
31
+ }
32
+ }
33
+
34
+ export function isValidSyntax() {
35
+ throw notSupported("repl.isValidSyntax (parsing source text)");
36
+ }
37
+
38
+ export default { REPL_MODE_SLOPPY, REPL_MODE_STRICT, REPLServer, Recoverable, isValidSyntax, start, writer };
@@ -0,0 +1,23 @@
1
+ // node:sea: a visaljs binary isn't one of Node's single executable applications: isSea() is false,
2
+ // and the asset calls throw ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION, as Node's do outside one.
3
+ import { codeError } from "./internal/errors.js";
4
+
5
+ const notInSea = () =>
6
+ codeError(Error, "ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION", "Operation cannot be invoked when not in a single-executable application");
7
+
8
+ export const isSea = () => false;
9
+
10
+ export function getAsset() {
11
+ throw notInSea();
12
+ }
13
+ export function getAssetAsBlob() {
14
+ throw notInSea();
15
+ }
16
+ export function getRawAsset() {
17
+ throw notInSea();
18
+ }
19
+ export function getAssetKeys() {
20
+ throw notInSea();
21
+ }
22
+
23
+ export default { isSea, getAsset, getAssetAsBlob, getRawAsset, getAssetKeys };