visaljs 0.0.7 → 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 +4413 -324
  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 -1
  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,916 @@
1
+ // Deep equality for node:assert and util.isDeepStrictEqual: Node's
2
+ // lib/internal/util/comparisons.js (MIT; Node v24.21.0), ported: primordials are the methods they
3
+ // stand for, Node's bindings JS (getOwnNonIndexProperties, Buffer's compare). Loose (deepEqual),
4
+ // strict (deepStrictEqual) and partial (partialDeepStrictEqual) modes, with Node's set and map
5
+ // matching and its cycle handling (tried without memos first; a stack overflow, a RangeError the
6
+ // runtime throws, switches to them).
7
+ // Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
8
+ import {
9
+ isAnyArrayBuffer, isArrayBufferView, isBigIntObject, isBooleanObject, isBoxedPrimitive, isCryptoKey, isDate,
10
+ isFloat16Array, isFloat32Array, isFloat64Array, isKeyObject, isMap, isNativeError, isNumberObject, isPromise, isRegExp,
11
+ isSet, isStringObject, isSymbolObject, isWeakMap, isWeakSet,
12
+ } from "../util_types.js";
13
+
14
+ const hasOwn = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
15
+ const hasEnumerable = (o, k) => Object.prototype.propertyIsEnumerable.call(o, k);
16
+ const getOwnSymbols = Object.getOwnPropertySymbols;
17
+ const objectToString = (o) => Object.prototype.toString.call(o);
18
+ const TypedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
19
+ const getByteLength = (a) => Object.getOwnPropertyDescriptor(TypedArrayPrototype, "byteLength").get.call(a);
20
+ const typedArrayTag = (a) => Object.getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag).get.call(a);
21
+
22
+ /** Node's internal isError: a native error, or anything inheriting from Error. */
23
+ export function isError(e) {
24
+ return isNativeError(e) || e instanceof Error;
25
+ }
26
+
27
+ /** Node's internal isURL: a URL-shaped object (href and protocol, not a legacy url.parse result). */
28
+ function isURL(self) {
29
+ return Boolean(self?.href && self.protocol && self.auth === undefined && self.path === undefined);
30
+ }
31
+
32
+ const wellKnownConstructors = new Set([
33
+ Array, ArrayBuffer, BigInt, BigInt64Array, BigUint64Array, Boolean, DataView, Date, Error, Float32Array,
34
+ Float64Array, Function, Int16Array, Int32Array, Int8Array, Map, Number, Object, Promise, RegExp, Set, String,
35
+ Symbol, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet,
36
+ ]);
37
+ /* Buffer, when the program has one (no Buffer exists otherwise), and Float16Array where present */
38
+ if (typeof globalThis.Buffer === "function") wellKnownConstructors.add(globalThis.Buffer);
39
+ if (typeof globalThis.Float16Array === "function") wellKnownConstructors.add(globalThis.Float16Array);
40
+
41
+ const kStrict = 2;
42
+ const kStrictWithoutPrototypes = 3;
43
+ const kLoose = 0;
44
+ const kPartial = 1;
45
+
46
+ const kNoIterator = 0;
47
+ const kIsArray = 1;
48
+ const kIsSet = 2;
49
+ const kIsMap = 3;
50
+
51
+ const ONLY_ENUMERABLE = 2;
52
+ const SKIP_SYMBOLS = 16;
53
+
54
+ /** V8's GetOwnNonIndexProperties: own keys that aren't array indices, enumerable ones only
55
+ * (ONLY_ENUMERABLE), without symbols (SKIP_SYMBOLS). */
56
+ function getOwnNonIndexProperties(obj, filter) {
57
+ const out = [];
58
+ for (const key of Reflect.ownKeys(obj)) {
59
+ if (typeof key === "symbol") {
60
+ if (filter & SKIP_SYMBOLS) continue;
61
+ } else if (String(Number(key) >>> 0) === key && Number(key) >>> 0 !== 4294967295) {
62
+ continue;
63
+ }
64
+ if ((filter & ONLY_ENUMERABLE) && !hasEnumerable(obj, key)) continue;
65
+ out.push(key);
66
+ }
67
+ return out;
68
+ }
69
+
70
+ /** Buffer's compare on two Uint8Arrays: 0 when the bytes are the same. */
71
+ function compare(a, b) {
72
+ const n = Math.min(a.length, b.length);
73
+ for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;
74
+ return a.length === b.length ? 0 : a.length < b.length ? -1 : 1;
75
+ }
76
+
77
+ // Check if they have the same source and flags
78
+ function areSimilarRegExps(a, b) {
79
+ return a.source === b.source && a.flags === b.flags && a.lastIndex === b.lastIndex;
80
+ }
81
+
82
+ function isPartialUint8Array(a, b) {
83
+ const lenA = getByteLength(a);
84
+ const lenB = getByteLength(b);
85
+ if (lenA < lenB) {
86
+ return false;
87
+ }
88
+ let offsetA = 0;
89
+ for (let offsetB = 0; offsetB < lenB; offsetB++) {
90
+ while (a[offsetA] !== b[offsetB]) {
91
+ offsetA++;
92
+ if (offsetA > lenA - lenB + offsetB) {
93
+ return false;
94
+ }
95
+ }
96
+ offsetA++;
97
+ }
98
+ return true;
99
+ }
100
+
101
+ function isPartialArrayBufferView(a, b) {
102
+ if (a.byteLength < b.byteLength) {
103
+ return false;
104
+ }
105
+ return isPartialUint8Array(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
106
+ }
107
+
108
+ function areSimilarFloatArrays(a, b) {
109
+ const len = getByteLength(a);
110
+ if (len !== getByteLength(b)) {
111
+ return false;
112
+ }
113
+ for (let offset = 0; offset < len; offset++) {
114
+ if (a[offset] !== b[offset]) {
115
+ return false;
116
+ }
117
+ }
118
+ return true;
119
+ }
120
+
121
+ /* Node's compare reads any view's bytes; this one reads Uint8Arrays */
122
+ function areSimilarTypedArrays(a, b) {
123
+ return a.byteLength === b.byteLength &&
124
+ compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
125
+ }
126
+
127
+ function areEqualArrayBuffers(buf1, buf2) {
128
+ return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
129
+ }
130
+
131
+ function isEqualBoxedPrimitive(val1, val2) {
132
+ if (isNumberObject(val1)) {
133
+ return isNumberObject(val2) && Object.is(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));
134
+ }
135
+ if (isStringObject(val1)) {
136
+ return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
137
+ }
138
+ if (isBooleanObject(val1)) {
139
+ return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
140
+ }
141
+ if (isBigIntObject(val1)) {
142
+ return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
143
+ }
144
+ if (isSymbolObject(val1)) {
145
+ return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
146
+ }
147
+ throw new Error(`Unknown boxed type ${val1}`);
148
+ }
149
+
150
+ function isEnumerableOrIdentical(val1, val2, prop, mode, memos) {
151
+ return hasEnumerable(val2, prop) || // This is handled by Object.keys()
152
+ (mode === kPartial && (val2[prop] === undefined || (prop === "message" && val2[prop] === ""))) ||
153
+ innerDeepEqual(val1[prop], val2[prop], mode, memos);
154
+ }
155
+
156
+ function innerDeepEqual(val1, val2, mode, memos) {
157
+ // All identical values are equivalent, as determined by ===.
158
+ if (val1 === val2) {
159
+ return val1 !== 0 || Object.is(val1, val2) || mode === kLoose;
160
+ }
161
+
162
+ // Check more closely if val1 and val2 are equal.
163
+ if (mode !== kLoose) {
164
+ if (typeof val1 === "number") {
165
+ // Check for NaN
166
+ return val1 !== val1 && val2 !== val2;
167
+ }
168
+ if (typeof val2 !== "object" || typeof val1 !== "object" || val1 === null || val2 === null) {
169
+ return false;
170
+ }
171
+ } else {
172
+ if (val1 === null || typeof val1 !== "object") {
173
+ return (val2 === null || typeof val2 !== "object") &&
174
+ // Check for NaN
175
+ (val1 == val2 || (val1 !== val1 && val2 !== val2));
176
+ }
177
+ if (val2 === null || typeof val2 !== "object") {
178
+ return false;
179
+ }
180
+ }
181
+ return objectComparisonStart(val1, val2, mode, memos);
182
+ }
183
+
184
+ function hasUnequalTag(val1, val2) {
185
+ return val1[Symbol.toStringTag] !== val2[Symbol.toStringTag];
186
+ }
187
+
188
+ function slowHasUnequalTag(val1Tag, val1, val2) {
189
+ if (val1[Symbol.toStringTag] !== undefined && val2[Symbol.toStringTag] !== undefined) {
190
+ return val1[Symbol.toStringTag] !== val2[Symbol.toStringTag];
191
+ }
192
+ return val1Tag !== objectToString(val2);
193
+ }
194
+
195
+ function objectComparisonStart(val1, val2, mode, memos) {
196
+ if (mode === kStrict) {
197
+ if (wellKnownConstructors.has(val1.constructor) || (val1.constructor !== undefined && !hasOwn(val1, "constructor"))) {
198
+ if (val1.constructor !== val2.constructor) {
199
+ return false;
200
+ }
201
+ } else if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
202
+ return false;
203
+ }
204
+ }
205
+
206
+ if (Array.isArray(val1)) {
207
+ if (!Array.isArray(val2) || (val1.length !== val2.length && (mode !== kPartial || val1.length < val2.length)) ||
208
+ hasUnequalTag(val1, val2)) {
209
+ return false;
210
+ }
211
+
212
+ const filter = mode !== kLoose ? ONLY_ENUMERABLE : ONLY_ENUMERABLE | SKIP_SYMBOLS;
213
+ const keys2 = getOwnNonIndexProperties(val2, filter);
214
+ if (mode !== kPartial && keys2.length !== getOwnNonIndexProperties(val1, filter).length) {
215
+ return false;
216
+ }
217
+ return keyCheck(val1, val2, mode, memos, kIsArray, keys2);
218
+ }
219
+
220
+ let val1Tag;
221
+ if (val1[Symbol.toStringTag] === undefined && (val1Tag = objectToString(val1)) === "[object Object]") {
222
+ if (slowHasUnequalTag(val1Tag, val1, val2)) {
223
+ return false;
224
+ }
225
+ return keyCheck(val1, val2, mode, memos, kNoIterator);
226
+ } else if (isSet(val1)) {
227
+ if (!isSet(val2) || (val1.size !== val2.size && (mode !== kPartial || val1.size < val2.size)) || hasUnequalTag(val1, val2)) {
228
+ return false;
229
+ }
230
+ return keyCheck(val1, val2, mode, memos, kIsSet);
231
+ } else if (isMap(val1)) {
232
+ if (!isMap(val2) || (val1.size !== val2.size && (mode !== kPartial || val1.size < val2.size)) || hasUnequalTag(val1, val2)) {
233
+ return false;
234
+ }
235
+ return keyCheck(val1, val2, mode, memos, kIsMap);
236
+ } else if (isArrayBufferView(val1)) {
237
+ if (typedArrayTag(val1) !== typedArrayTag(val2)) {
238
+ return false;
239
+ }
240
+ if (mode === kPartial && val1.byteLength !== val2.byteLength) {
241
+ if (!isPartialArrayBufferView(val1, val2)) {
242
+ return false;
243
+ }
244
+ } else if (mode === kLoose && (isFloat32Array(val1) || isFloat64Array(val1) || isFloat16Array(val1))) {
245
+ if (!areSimilarFloatArrays(val1, val2)) {
246
+ return false;
247
+ }
248
+ } else if (!areSimilarTypedArrays(val1, val2)) {
249
+ return false;
250
+ }
251
+ // Buffer.compare returns true, so val1.length === val2.length. If they both
252
+ // only contain numeric keys, we don't need to exam further than checking
253
+ // the symbols.
254
+ const filter = mode !== kLoose ? ONLY_ENUMERABLE : ONLY_ENUMERABLE | SKIP_SYMBOLS;
255
+ const keys2 = getOwnNonIndexProperties(val2, filter);
256
+ if (mode !== kPartial && keys2.length !== getOwnNonIndexProperties(val1, filter).length) {
257
+ return false;
258
+ }
259
+ return keyCheck(val1, val2, mode, memos, kNoIterator, keys2);
260
+ } else if (isDate(val1)) {
261
+ if (!isDate(val2) || hasUnequalTag(val1, val2)) {
262
+ return false;
263
+ }
264
+ const time1 = Date.prototype.getTime.call(val1);
265
+ const time2 = Date.prototype.getTime.call(val2);
266
+ // two invalid dates (NaN) are equal
267
+ if (time1 !== time2 && (time1 === time1 || time2 === time2)) {
268
+ return false;
269
+ }
270
+ } else if (isRegExp(val1)) {
271
+ if (!isRegExp(val2) || !areSimilarRegExps(val1, val2) || hasUnequalTag(val1, val2)) {
272
+ return false;
273
+ }
274
+ } else if (isAnyArrayBuffer(val1)) {
275
+ if (!isAnyArrayBuffer(val2) || hasUnequalTag(val1, val2)) {
276
+ return false;
277
+ }
278
+ if (mode !== kPartial || val1.byteLength === val2.byteLength) {
279
+ if (!areEqualArrayBuffers(val1, val2)) {
280
+ return false;
281
+ }
282
+ } else if (!isPartialUint8Array(new Uint8Array(val1), new Uint8Array(val2))) {
283
+ return false;
284
+ }
285
+ } else if (slowHasUnequalTag(val1Tag ?? objectToString(val1), val1, val2) || Array.isArray(val2) || isArrayBufferView(val2) ||
286
+ isSet(val2) || isMap(val2) || isDate(val2) || isRegExp(val2) || isAnyArrayBuffer(val2)) {
287
+ return false;
288
+ } else if (isError(val1)) {
289
+ // Do not compare the stack as it might differ even though the error itself
290
+ // is otherwise identical.
291
+ if (!isError(val2) ||
292
+ !isEnumerableOrIdentical(val1, val2, "message", mode, memos) ||
293
+ !isEnumerableOrIdentical(val1, val2, "name", mode, memos) ||
294
+ !isEnumerableOrIdentical(val1, val2, "cause", mode, memos) ||
295
+ !isEnumerableOrIdentical(val1, val2, "errors", mode, memos)) {
296
+ return false;
297
+ }
298
+ const hasOwnVal2Cause = hasOwn(val2, "cause");
299
+ if (hasOwnVal2Cause !== hasOwn(val1, "cause") && (mode !== kPartial || hasOwnVal2Cause)) {
300
+ return false;
301
+ }
302
+ } else if (isBoxedPrimitive(val1)) {
303
+ if (!isEqualBoxedPrimitive(val1, val2)) {
304
+ return false;
305
+ }
306
+ } else if (isURL(val1)) {
307
+ if (!isURL(val2) || val1.href !== val2.href) {
308
+ return false;
309
+ }
310
+ } else if (isKeyObject(val1)) {
311
+ /* KeyObject.equals compares the types and the keys, as Node 24's handles do */
312
+ if (!isKeyObject(val2) || !val1.equals(val2)) {
313
+ return false;
314
+ }
315
+ } else if (isCryptoKey(val1)) {
316
+ /* Node 24 compares the type, extractability, algorithm, usages and key; the key's material
317
+ isn't reachable here without linking the crypto component into every program that compares */
318
+ if (!isCryptoKey(val2) ||
319
+ val1.type !== val2.type ||
320
+ val1.extractable !== val2.extractable ||
321
+ !innerDeepEqual(val1.algorithm, val2.algorithm, mode, memos) ||
322
+ !innerDeepEqual(val1.usages, val2.usages, mode, memos)) {
323
+ return false;
324
+ }
325
+ } else if (isBoxedPrimitive(val2) || isNativeError(val2) || val2 instanceof Error || isWeakMap(val1) || isWeakSet(val1) ||
326
+ isPromise(val1)) {
327
+ return false;
328
+ }
329
+
330
+ return keyCheck(val1, val2, mode, memos, kNoIterator);
331
+ }
332
+
333
+ function partialSymbolEquiv(val1, val2, keys2) {
334
+ const symbolKeys = getOwnSymbols(val2);
335
+ if (symbolKeys.length !== 0) {
336
+ for (const key of symbolKeys) {
337
+ if (hasEnumerable(val2, key)) {
338
+ keys2.push(key);
339
+ }
340
+ }
341
+ }
342
+ return true;
343
+ }
344
+
345
+ function keyCheck(val1, val2, mode, memos, iterationType, keys2) {
346
+ // For all remaining Object pairs, including Array, objects and Maps,
347
+ // equivalence is determined by having:
348
+ // a) The same number of owned enumerable properties
349
+ // b) The same set of keys/indexes (although not necessarily the same order)
350
+ // c) Equivalent values for every corresponding key/index
351
+ // d) For Sets and Maps, equal contents
352
+ // Note: this accounts for both named and indexed properties on Arrays.
353
+ const isArrayLikeObject = keys2 !== undefined;
354
+
355
+ if (keys2 === undefined) {
356
+ keys2 = Object.keys(val2);
357
+ }
358
+ let keys1;
359
+
360
+ if (!isArrayLikeObject) {
361
+ // The pair must have the same number of owned properties.
362
+ if (mode === kPartial) {
363
+ if (!partialSymbolEquiv(val1, val2, keys2)) {
364
+ return false;
365
+ }
366
+ } else if (keys2.length !== (keys1 = Object.keys(val1)).length) {
367
+ return false;
368
+ } else if (mode === kStrict || mode === kStrictWithoutPrototypes) {
369
+ for (const key of getOwnSymbols(val1)) {
370
+ if (hasEnumerable(val1, key)) {
371
+ keys1.push(key);
372
+ }
373
+ }
374
+ for (const key of getOwnSymbols(val2)) {
375
+ if (hasEnumerable(val2, key)) {
376
+ keys2.push(key);
377
+ }
378
+ }
379
+ if (keys1.length !== keys2.length) {
380
+ return false;
381
+ }
382
+ }
383
+ }
384
+
385
+ if (keys2.length === 0 &&
386
+ (iterationType === kNoIterator || (iterationType === kIsArray && val2.length === 0) || val2.size === 0)) {
387
+ return true;
388
+ }
389
+
390
+ if (memos === null) {
391
+ return objEquiv(val1, val2, mode, keys1, keys2, memos, iterationType);
392
+ }
393
+ return handleCycles(val1, val2, mode, keys1, keys2, memos, iterationType);
394
+ }
395
+
396
+ function handleCycles(val1, val2, mode, keys1, keys2, memos, iterationType) {
397
+ // Use memos to handle cycles.
398
+ if (memos === undefined) {
399
+ memos = { set: undefined, a: val1, b: val2, c: undefined, d: undefined, deep: false };
400
+ return objEquiv(val1, val2, mode, keys1, keys2, memos, iterationType);
401
+ }
402
+
403
+ if (memos.set === undefined) {
404
+ if (memos.deep === false) {
405
+ if (memos.a === val1) {
406
+ return memos.b === val2;
407
+ }
408
+ if (memos.b === val2) {
409
+ return false;
410
+ }
411
+ memos.c = val1;
412
+ memos.d = val2;
413
+ memos.deep = true;
414
+ const result = objEquiv(val1, val2, mode, keys1, keys2, memos, iterationType);
415
+ memos.deep = false;
416
+ if (memos.set !== undefined) {
417
+ memos.set.delete(memos.c);
418
+ memos.set.delete(memos.d);
419
+ }
420
+ return result;
421
+ }
422
+ memos.set = new Set();
423
+ memos.set.add(memos.a);
424
+ memos.set.add(memos.b);
425
+ memos.set.add(memos.c);
426
+ memos.set.add(memos.d);
427
+ }
428
+
429
+ const { set } = memos;
430
+
431
+ const originalSize = set.size;
432
+ set.add(val1);
433
+ set.add(val2);
434
+ if (originalSize !== set.size - 2) {
435
+ return originalSize === set.size;
436
+ }
437
+
438
+ const areEq = objEquiv(val1, val2, mode, keys1, keys2, memos, iterationType);
439
+
440
+ set.delete(val1);
441
+ set.delete(val2);
442
+
443
+ return areEq;
444
+ }
445
+
446
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
447
+ // Sadly it is not possible to detect corresponding values properly in case the
448
+ // type is a string, number, bigint or boolean. The reason is that those values
449
+ // can match lots of different string values (e.g., 1n == '+00001').
450
+ function findLooseMatchingPrimitives(prim) {
451
+ switch (typeof prim) {
452
+ case "undefined":
453
+ return null;
454
+ case "object": // Only pass in null as object!
455
+ return undefined;
456
+ case "symbol":
457
+ return false;
458
+ case "string":
459
+ prim = +prim;
460
+ // Loose equal entries exist only if the string is possible to convert to
461
+ // a regular number and not NaN.
462
+ // Fall through
463
+ case "number":
464
+ // Check for NaN
465
+ if (prim !== prim) {
466
+ return false;
467
+ }
468
+ }
469
+ return true;
470
+ }
471
+
472
+ function setMightHaveLoosePrim(a, b, prim) {
473
+ const altValue = findLooseMatchingPrimitives(prim);
474
+ if (altValue != null) return altValue;
475
+
476
+ return !b.has(altValue) && a.has(altValue);
477
+ }
478
+
479
+ function mapMightHaveLoosePrim(a, b, prim, item2, memo) {
480
+ const altValue = findLooseMatchingPrimitives(prim);
481
+ if (altValue != null) {
482
+ return altValue;
483
+ }
484
+ const item1 = a.get(altValue);
485
+ if ((item1 === undefined && !a.has(altValue)) || !innerDeepEqual(item1, item2, kLoose, memo)) {
486
+ return false;
487
+ }
488
+ return !b.has(altValue) && innerDeepEqual(item1, item2, kLoose, memo);
489
+ }
490
+
491
+ function partialObjectSetEquiv(array, a, b, mode, memo) {
492
+ let aPos = 0;
493
+ let direction = 1;
494
+ let start = 0;
495
+ let end = array.length - 1;
496
+ for (const val1 of a) {
497
+ aPos++;
498
+ if (!b.has(val1)) {
499
+ let innerStart = start;
500
+ if (direction === 1) {
501
+ if (innerDeepEqual(val1, array[start], mode, memo)) {
502
+ if (start === end) {
503
+ return true;
504
+ }
505
+ start += 1;
506
+ continue;
507
+ }
508
+ if (start === end) {
509
+ // The last element of set b might match a later element in set a.
510
+ continue;
511
+ }
512
+ direction = -1;
513
+ innerStart += 1;
514
+ }
515
+ let matched = true;
516
+ if (!innerDeepEqual(val1, array[end], mode, memo)) {
517
+ direction = 1;
518
+ matched = arrayHasEqualElement(array, val1, mode, memo, innerDeepEqual, innerStart, end);
519
+ }
520
+ if (matched) {
521
+ if (start === end) {
522
+ return true;
523
+ }
524
+ end -= 1;
525
+ }
526
+ }
527
+ if (a.size - aPos <= end - start) {
528
+ return false;
529
+ }
530
+ }
531
+ return false;
532
+ }
533
+
534
+ function arrayHasEqualElement(array, val1, mode, memo, comparator, start, end) {
535
+ for (let i = end - 1; i >= start; i--) {
536
+ if (comparator(val1, array[i], mode, memo)) {
537
+ // Move the matching element to make sure we do not check that again.
538
+ array[i] = array[end];
539
+ return true;
540
+ }
541
+ }
542
+ return false;
543
+ }
544
+
545
+ function setObjectEquiv(array, a, b, mode, memo) {
546
+ let direction = 1;
547
+ let start = 0;
548
+ let end = array.length - 1;
549
+ const comparator = mode !== kLoose ? objectComparisonStart : innerDeepEqual;
550
+ const extraChecks = mode === kLoose || array.length !== a.size;
551
+ for (const val1 of a) {
552
+ if (extraChecks) {
553
+ if (typeof val1 === "object") {
554
+ if (b.has(val1)) {
555
+ continue;
556
+ }
557
+ } else if (b.has(val1)) {
558
+ continue;
559
+ } else if (mode !== kLoose) {
560
+ return false;
561
+ }
562
+ }
563
+
564
+ let innerStart = start;
565
+ if (direction === 1) {
566
+ if (comparator(val1, array[start], mode, memo)) {
567
+ start += 1;
568
+ continue;
569
+ }
570
+ if (start === end) {
571
+ return false;
572
+ }
573
+ direction = -1;
574
+ innerStart += 1;
575
+ }
576
+ if (!comparator(val1, array[end], mode, memo)) {
577
+ direction = 1;
578
+ if (!arrayHasEqualElement(array, val1, mode, memo, comparator, innerStart, end)) {
579
+ return false;
580
+ }
581
+ }
582
+ end -= 1;
583
+ }
584
+ return true;
585
+ }
586
+
587
+ function compareSmallSets(a, b, val, iteratorB, mode, memo) {
588
+ const iteratorA = a.values();
589
+ const firstA = iteratorA.next().value;
590
+ const first = innerDeepEqual(firstA, val, mode, memo);
591
+ if (first) {
592
+ if (b.size === 1) { // Partial mode && a.size === 1 || b.size === 1
593
+ return true;
594
+ }
595
+ const secondA = iteratorA.next().value;
596
+ return b.has(secondA) || innerDeepEqual(secondA, iteratorB.next().value, mode, memo);
597
+ }
598
+ return a.size !== 1 && innerDeepEqual(iteratorA.next().value, val, mode, memo) && (
599
+ b.size === 1 || // Partial mode
600
+ b.has(firstA) || // Primitive or reference equal
601
+ innerDeepEqual(firstA, iteratorB.next().value, mode, memo)
602
+ );
603
+ }
604
+
605
+ function setEquiv(a, b, mode, memo) {
606
+ // This is a lazily initiated Set of entries which have to be compared
607
+ // pairwise.
608
+ let array;
609
+
610
+ const iteratorB = b.values();
611
+ for (const val of iteratorB) {
612
+ if (!a.has(val)) {
613
+ if ((typeof val !== "object" || val === null) && (mode !== kLoose || !setMightHaveLoosePrim(a, b, val))) {
614
+ return false;
615
+ }
616
+
617
+ if (array === undefined) {
618
+ if (a.size < 3) {
619
+ return compareSmallSets(a, b, val, iteratorB, mode, memo);
620
+ }
621
+ array = [];
622
+ }
623
+ // If the specified value doesn't exist in the second set it's a object
624
+ // (or in loose mode: a non-matching primitive). Find the
625
+ // deep-(mode-)equal element in a set copy to reduce duplicate checks.
626
+ array.push(val);
627
+ }
628
+ }
629
+
630
+ if (array === undefined) {
631
+ return true;
632
+ }
633
+ if (mode === kPartial) {
634
+ return partialObjectSetEquiv(array, a, b, mode, memo);
635
+ }
636
+ return setObjectEquiv(array, a, b, mode, memo);
637
+ }
638
+
639
+ function partialObjectMapEquiv(array, a, b, mode, memo) {
640
+ let aPos = 0;
641
+ let direction = 1;
642
+ let start = 0;
643
+ let end = array.length - 1;
644
+ for (const { 0: key1, 1: item1 } of a) {
645
+ aPos++;
646
+ if (typeof key1 === "object" && key1 !== null) {
647
+ let innerStart = start;
648
+ if (direction === 1) {
649
+ const key2 = array[start];
650
+ if (objectComparisonStart(key1, key2, mode, memo) && innerDeepEqual(item1, b.get(key2), mode, memo)) {
651
+ if (start === end) {
652
+ return true;
653
+ }
654
+ start += 1;
655
+ continue;
656
+ }
657
+ if (start === end) {
658
+ // The last element of map b might match a later element in map a.
659
+ continue;
660
+ }
661
+ direction = -1;
662
+ innerStart += 1;
663
+ }
664
+ let matched = true;
665
+ const key2 = array[end];
666
+ if (!objectComparisonStart(key1, key2, mode, memo) || !innerDeepEqual(item1, b.get(key2), mode, memo)) {
667
+ direction = 1;
668
+ matched = arrayHasEqualMapElement(array, key1, item1, b, mode, memo, objectComparisonStart, innerStart, end);
669
+ }
670
+ if (matched) {
671
+ if (start === end) {
672
+ return true;
673
+ }
674
+ end -= 1;
675
+ }
676
+ }
677
+ if (a.size - aPos <= end - start) {
678
+ return false;
679
+ }
680
+ }
681
+ return false;
682
+ }
683
+
684
+ function arrayHasEqualMapElement(array, key1, item1, b, mode, memo, comparator, start, end) {
685
+ for (let i = end - 1; i >= start; i--) {
686
+ const key2 = array[i];
687
+ if (comparator(key1, key2, mode, memo) && innerDeepEqual(item1, b.get(key2), mode, memo)) {
688
+ // Move the matching element to make sure we do not check that again.
689
+ array[i] = array[end];
690
+ return true;
691
+ }
692
+ }
693
+ return false;
694
+ }
695
+
696
+ function mapObjectEquiv(array, a, b, mode, memo) {
697
+ let direction = 1;
698
+ let start = 0;
699
+ let end = array.length - 1;
700
+ const comparator = mode !== kLoose ? objectComparisonStart : innerDeepEqual;
701
+
702
+ for (const { 0: key1, 1: item1 } of a) {
703
+ // Primitive and `null` keys can never match an object key collected in
704
+ // `array`, so resolve them directly against `b`. `null` is `typeof
705
+ // "object"`, so without this it would reach the object comparator, which
706
+ // reads `key1.constructor` and throws a `TypeError`.
707
+ if (typeof key1 !== "object" || key1 === null) {
708
+ if (b.has(key1)) {
709
+ if (mode !== kLoose || innerDeepEqual(item1, b.get(key1), mode, memo)) {
710
+ continue;
711
+ }
712
+ } else if (mode !== kLoose) {
713
+ return false;
714
+ }
715
+ }
716
+
717
+ let innerStart = start;
718
+ if (direction === 1) {
719
+ const key2 = array[start];
720
+ if (comparator(key1, key2, mode, memo) && innerDeepEqual(item1, b.get(key2), mode, memo)) {
721
+ start += 1;
722
+ continue;
723
+ }
724
+ if (start === end) {
725
+ return false;
726
+ }
727
+ direction = -1;
728
+ innerStart += 1;
729
+ }
730
+ const key2 = array[end];
731
+ if (!comparator(key1, key2, mode, memo) || !innerDeepEqual(item1, b.get(key2), mode, memo)) {
732
+ direction = 1;
733
+ if (!arrayHasEqualMapElement(array, key1, item1, b, mode, memo, comparator, innerStart, end)) {
734
+ return false;
735
+ }
736
+ }
737
+ end -= 1;
738
+ }
739
+ return true;
740
+ }
741
+
742
+ function mapEquiv(a, b, mode, memo) {
743
+ let array;
744
+
745
+ for (const { 0: key2, 1: item2 } of b) {
746
+ if (typeof key2 === "object" && key2 !== null) {
747
+ if (array === undefined) {
748
+ if (a.size === 1) {
749
+ const { 0: key1, 1: item1 } = a.entries().next().value;
750
+ return innerDeepEqual(key1, key2, mode, memo) && innerDeepEqual(item1, item2, mode, memo);
751
+ }
752
+ array = [];
753
+ }
754
+ array.push(key2);
755
+ } else {
756
+ // By directly retrieving the value we prevent another b.has(key2) check in
757
+ // almost all possible cases.
758
+ const item1 = a.get(key2);
759
+ if ((item1 === undefined && !a.has(key2)) || !innerDeepEqual(item1, item2, mode, memo)) {
760
+ if (mode !== kLoose) return false;
761
+ // Fast path to detect missing string, symbol, undefined and null
762
+ // keys.
763
+ if (!mapMightHaveLoosePrim(a, b, key2, item2, memo)) return false;
764
+ if (array === undefined) {
765
+ array = [];
766
+ }
767
+ array.push(key2);
768
+ }
769
+ }
770
+ }
771
+
772
+ if (array === undefined) {
773
+ return true;
774
+ }
775
+
776
+ if (mode === kPartial) {
777
+ return partialObjectMapEquiv(array, a, b, mode, memo);
778
+ }
779
+
780
+ return mapObjectEquiv(array, a, b, mode, memo);
781
+ }
782
+
783
+ function partialSparseArrayEquiv(a, b, mode, memos, startA, startB) {
784
+ let aPos = startA;
785
+ const keysA = Object.keys(a);
786
+ const keysB = Object.keys(b);
787
+ const lenA = keysA.length - startA;
788
+ const lenB = keysB.length - startB;
789
+ if (lenA < lenB) {
790
+ return false;
791
+ }
792
+ for (let i = 0; i < lenB; i++) {
793
+ const keyB = keysB[startB + i];
794
+ while (!innerDeepEqual(a[keysA[aPos]], b[keyB], mode, memos)) {
795
+ aPos++;
796
+ if (aPos > keysA.length - lenB + i) {
797
+ return false;
798
+ }
799
+ }
800
+ aPos++;
801
+ }
802
+ return true;
803
+ }
804
+
805
+ function partialArrayEquiv(a, b, mode, memos) {
806
+ let aPos = 0;
807
+ for (let i = 0; i < b.length; i++) {
808
+ let isSparse = b[i] === undefined && !hasOwn(b, i);
809
+ if (isSparse) {
810
+ return partialSparseArrayEquiv(a, b, mode, memos, aPos, i);
811
+ }
812
+ while (!(isSparse = a[aPos] === undefined && !hasOwn(a, aPos)) && !innerDeepEqual(a[aPos], b[i], mode, memos)) {
813
+ aPos++;
814
+ if (aPos > a.length - b.length + i) {
815
+ return false;
816
+ }
817
+ }
818
+ if (isSparse) {
819
+ return partialSparseArrayEquiv(a, b, mode, memos, aPos, i);
820
+ }
821
+ aPos++;
822
+ }
823
+ return true;
824
+ }
825
+
826
+ function sparseArrayEquiv(a, b, mode, memos, i) {
827
+ const keysA = Object.keys(a);
828
+ const keysB = Object.keys(b);
829
+ if (keysA.length !== keysB.length) {
830
+ return false;
831
+ }
832
+ for (; i < keysB.length; i++) {
833
+ const key = keysB[i];
834
+ if ((a[key] === undefined && !hasOwn(a, key)) || !innerDeepEqual(a[key], b[key], mode, memos)) {
835
+ return false;
836
+ }
837
+ }
838
+ return true;
839
+ }
840
+
841
+ function objEquiv(a, b, mode, keys1, keys2, memos, iterationType) {
842
+ // The pair must have equivalent values for every corresponding key.
843
+ if (keys2.length > 0) {
844
+ let i = 0;
845
+ // Ordered keys
846
+ if (keys1 !== undefined) {
847
+ for (; i < keys2.length; i++) {
848
+ const key = keys2[i];
849
+ if (keys1[i] !== key) {
850
+ break;
851
+ }
852
+ if (!innerDeepEqual(a[key], b[key], mode, memos)) {
853
+ return false;
854
+ }
855
+ }
856
+ }
857
+ // Unordered keys
858
+ for (; i < keys2.length; i++) {
859
+ const key = keys2[i];
860
+ const descriptor = Object.getOwnPropertyDescriptor(a, key);
861
+ if (descriptor === undefined || descriptor.enumerable !== true) {
862
+ return false;
863
+ }
864
+ const value = descriptor.writable !== undefined ? descriptor.value : a[key];
865
+ if (!innerDeepEqual(value, b[key], mode, memos)) {
866
+ return false;
867
+ }
868
+ }
869
+ }
870
+
871
+ if (iterationType === kIsArray) {
872
+ if (mode === kPartial) {
873
+ return partialArrayEquiv(a, b, mode, memos);
874
+ }
875
+ for (let i = 0; i < a.length; i++) {
876
+ if (b[i] === undefined) {
877
+ if (!hasOwn(b, i)) return sparseArrayEquiv(a, b, mode, memos, i);
878
+ if ((a[i] !== undefined || !hasOwn(a, i)) && (mode !== kLoose || a[i] !== null)) return false;
879
+ } else if ((a[i] === undefined || !innerDeepEqual(a[i], b[i], mode, memos)) && (mode !== kLoose || b[i] !== null)) {
880
+ return false;
881
+ }
882
+ }
883
+ } else if (iterationType === kIsSet) {
884
+ if (!setEquiv(a, b, mode, memos)) {
885
+ return false;
886
+ }
887
+ } else if (iterationType === kIsMap) {
888
+ if (!mapEquiv(a, b, mode, memos)) {
889
+ return false;
890
+ }
891
+ }
892
+
893
+ return true;
894
+ }
895
+
896
+ // Only handle cycles when they are detected.
897
+ let detectCycles = function (val1, val2, mode) {
898
+ try {
899
+ return innerDeepEqual(val1, val2, mode, null);
900
+ } catch {
901
+ detectCycles = innerDeepEqual;
902
+ return innerDeepEqual(val1, val2, mode, undefined);
903
+ }
904
+ };
905
+
906
+ export function isDeepEqual(val1, val2) {
907
+ return detectCycles(val1, val2, kLoose);
908
+ }
909
+
910
+ export function isDeepStrictEqual(val1, val2, skipPrototype) {
911
+ return detectCycles(val1, val2, skipPrototype ? kStrictWithoutPrototypes : kStrict);
912
+ }
913
+
914
+ export function isPartialStrictEqual(val1, val2) {
915
+ return detectCycles(val1, val2, kPartial);
916
+ }