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.
- package/README.md +68 -4
- package/THIRD_PARTY_LICENSES +1216 -0
- package/cli.js +4461 -321
- package/node/include/js_node.h +57 -1
- package/node/include/js_uv.h +8 -1
- package/node/prelude/_http_agent.js +5 -0
- package/node/prelude/_http_server.js +7 -0
- package/node/prelude/_stream_duplex.js +4 -0
- package/node/prelude/_stream_passthrough.js +4 -0
- package/node/prelude/_stream_readable.js +4 -0
- package/node/prelude/_stream_transform.js +4 -0
- package/node/prelude/_stream_writable.js +4 -0
- package/node/prelude/assert.js +1334 -0
- package/node/prelude/assert_strict.js +12 -0
- package/node/prelude/async_hooks.js +1 -1
- package/node/prelude/buffer.js +43 -3
- package/node/prelude/child_process.js +1098 -0
- package/node/prelude/cluster.js +52 -0
- package/node/prelude/console.js +328 -0
- package/node/prelude/constants.js +10 -0
- package/node/prelude/crypto.js +1 -1
- package/node/prelude/diagnostics_channel.js +1 -1
- package/node/prelude/dns.js +8 -2
- package/node/prelude/domain.js +115 -0
- package/node/prelude/events.js +148 -16
- package/node/prelude/fs.js +1138 -151
- package/node/prelude/fs_promises.js +117 -11
- package/node/prelude/http.js +784 -301
- package/node/prelude/http2.js +1 -1
- package/node/prelude/https.js +159 -0
- package/node/prelude/inspector.js +27 -0
- package/node/prelude/inspector_promises.js +4 -0
- package/node/prelude/internal/async_context.js +1 -1
- package/node/prelude/internal/buffer_transcode.js +44 -0
- package/node/prelude/internal/comparisons.js +916 -0
- package/node/prelude/internal/compression_streams.js +153 -0
- package/node/prelude/internal/crypto/asym.js +27 -14
- package/node/prelude/internal/crypto/cipher.js +16 -5
- package/node/prelude/internal/crypto/diffiehellman.js +3 -2
- package/node/prelude/internal/crypto/hash.js +2 -1
- package/node/prelude/internal/crypto/kdf.js +14 -9
- package/node/prelude/internal/crypto/keys.js +63 -50
- package/node/prelude/internal/crypto/random.js +2 -1
- package/node/prelude/internal/crypto/util.js +4 -4
- package/node/prelude/internal/dotenv.js +98 -0
- package/node/prelude/internal/errors.js +21 -5
- package/node/prelude/internal/events_extras.js +113 -0
- package/node/prelude/internal/events_on.js +100 -0
- package/node/prelude/internal/features.js +72 -0
- package/node/prelude/internal/fetch.js +364 -0
- package/node/prelude/internal/form_data.js +376 -0
- package/node/prelude/internal/fs_bigint_stats.js +41 -0
- package/node/prelude/internal/fs_blob.js +19 -0
- package/node/prelude/internal/fs_cp.js +709 -0
- package/node/prelude/internal/fs_dir.js +166 -0
- package/node/prelude/internal/fs_filehandle.js +287 -0
- package/node/prelude/internal/fs_glob.js +296 -0
- package/node/prelude/internal/fs_statfs.js +42 -0
- package/node/prelude/internal/fs_stats.js +89 -0
- package/node/prelude/internal/fs_streams.js +541 -0
- package/node/prelude/internal/fs_utils.js +286 -0
- package/node/prelude/internal/fs_watch.js +580 -0
- package/node/prelude/internal/http_agent.js +114 -2
- package/node/prelude/internal/http_symbols.js +3 -0
- package/node/prelude/internal/mime.js +249 -0
- package/node/prelude/internal/net.js +1 -0
- package/node/prelude/internal/net_bound.js +123 -0
- package/node/prelude/internal/net_onread.js +73 -0
- package/node/prelude/internal/net_tos.js +54 -0
- package/node/prelude/internal/parse_args.js +288 -0
- package/node/prelude/internal/perf_histogram.js +435 -0
- package/node/prelude/internal/perf_observe.js +125 -0
- package/node/prelude/internal/performance_global.js +19 -0
- package/node/prelude/internal/process_events.js +49 -1
- package/node/prelude/internal/process_memory.js +14 -0
- package/node/prelude/internal/process_more.js +414 -0
- package/node/prelude/internal/process_signals.js +2 -1
- package/node/prelude/internal/process_stdin.js +52 -0
- package/node/prelude/internal/process_stdio.js +36 -0
- package/node/prelude/internal/querystring.js +0 -0
- package/node/prelude/internal/readline.js +338 -0
- package/node/prelude/internal/socketaddress.js +8 -4
- package/node/prelude/internal/source_map.js +122 -0
- package/node/prelude/internal/stream_compose.js +74 -0
- package/node/prelude/internal/stream_from.js +6 -0
- package/node/prelude/internal/stream_operators.js +23 -0
- package/node/prelude/internal/stream_pipeline.js +7 -0
- package/node/prelude/internal/stream_transform.js +10 -0
- package/node/prelude/internal/stream_web_adapters.js +143 -0
- package/node/prelude/internal/streams/add_abort_signal.js +58 -0
- package/node/prelude/internal/streams/compose.js +244 -0
- package/node/prelude/internal/streams/destroy.js +358 -0
- package/node/prelude/internal/streams/duplex.js +199 -0
- package/node/prelude/internal/streams/duplexify.js +378 -0
- package/node/prelude/internal/streams/end_of_stream.js +387 -0
- package/node/prelude/internal/streams/errors.js +216 -0
- package/node/prelude/internal/streams/from.js +211 -0
- package/node/prelude/internal/streams/legacy.js +120 -0
- package/node/prelude/internal/streams/operators.js +375 -0
- package/node/prelude/internal/streams/passthrough.js +45 -0
- package/node/prelude/internal/streams/pipeline.js +468 -0
- package/node/prelude/internal/streams/readable.js +1835 -0
- package/node/prelude/internal/streams/state.js +48 -0
- package/node/prelude/internal/streams/transform.js +203 -0
- package/node/prelude/internal/streams/utils.js +355 -0
- package/node/prelude/internal/streams/validators.js +108 -0
- package/node/prelude/internal/streams/writable.js +1160 -0
- package/node/prelude/internal/structured_clone.js +238 -0
- package/node/prelude/internal/system_errors.js +37 -0
- package/node/prelude/internal/test_runner/mock.js +431 -0
- package/node/prelude/internal/test_runner/reporters.js +404 -0
- package/node/prelude/internal/test_runner/test.js +1571 -0
- package/node/prelude/internal/timers.js +38 -7
- package/node/prelude/internal/timers_global.js +1 -1
- package/node/prelude/internal/tls/common.js +8 -2
- package/node/prelude/internal/tls/wrap.js +5 -16
- package/node/prelude/internal/tls/x509.js +1 -1
- package/node/prelude/internal/tty_read_stream.js +39 -0
- package/node/prelude/internal/tty_streams.js +3 -0
- package/node/prelude/internal/util_debuglog.js +68 -0
- package/node/prelude/internal/util_diff.js +63 -0
- package/node/prelude/internal/util_more.js +111 -0
- package/node/prelude/internal/util_styles.js +76 -0
- package/node/prelude/internal/zlib_engines.js +1 -1
- package/node/prelude/module.js +219 -8
- package/node/prelude/net.js +197 -49
- package/node/prelude/os.js +88 -11
- package/node/prelude/path.js +11 -7
- package/node/prelude/path_posix.js +1 -1
- package/node/prelude/path_win32.js +1 -1
- package/node/prelude/perf_hooks.js +151 -0
- package/node/prelude/process.js +36 -1
- package/node/prelude/punycode.js +188 -0
- package/node/prelude/querystring.js +1 -1
- package/node/prelude/readline.js +8 -0
- package/node/prelude/readline_promises.js +88 -0
- package/node/prelude/repl.js +38 -0
- package/node/prelude/sea.js +23 -0
- package/node/prelude/stream.js +70 -1332
- package/node/prelude/stream_consumers.js +34 -0
- package/node/prelude/stream_promises.js +1 -1
- package/node/prelude/stream_web.js +15 -2
- package/node/prelude/string_decoder.js +1 -1
- package/node/prelude/sys.js +7 -0
- package/node/prelude/test.js +56 -0
- package/node/prelude/test_reporters.js +269 -0
- package/node/prelude/timers.js +7 -84
- package/node/prelude/timers_promises.js +1 -1
- package/node/prelude/tls.js +2 -1
- package/node/prelude/trace_events.js +52 -0
- package/node/prelude/tty.js +10 -4
- package/node/prelude/url.js +88 -27
- package/node/prelude/util.js +121 -5
- package/node/prelude/util_types.js +4 -3
- package/node/prelude/v8.js +814 -0
- package/node/prelude/vm.js +86 -0
- package/node/prelude/wasi.js +10 -0
- package/node/prelude/worker_threads.js +56 -0
- package/node/prelude/zlib.js +58 -25
- package/node/src/host_brotli.c +59 -11
- package/node/src/host_fs.c +342 -11
- package/node/src/host_fswatch.c +170 -0
- package/node/src/host_http.c +292 -39
- package/node/src/host_loop.c +25 -2
- package/node/src/host_net.c +130 -16
- package/node/src/host_os.c +55 -1
- package/node/src/host_proc.c +291 -0
- package/node/src/host_process.c +488 -0
- package/node/src/host_sys.c +64 -2
- package/node/src/host_zlib.c +27 -7
- package/node/src/host_zstd.c +41 -6
- package/node/third_party/hdrhistogram/LICENSE +42 -0
- package/node/third_party/hdrhistogram/README.md +5 -0
- package/node/third_party/libuv/LICENSE +0 -0
- package/node/third_party/libuv/LICENSE-extra +36 -0
- package/node/third_party/libuv/include/uv/aix.h +0 -0
- package/node/third_party/libuv/include/uv/bsd.h +0 -0
- package/node/third_party/libuv/include/uv/darwin.h +0 -0
- package/node/third_party/libuv/include/uv/errno.h +0 -0
- package/node/third_party/libuv/include/uv/linux.h +0 -0
- package/node/third_party/libuv/include/uv/os390.h +0 -0
- package/node/third_party/libuv/include/uv/posix.h +0 -0
- package/node/third_party/libuv/include/uv/sunos.h +0 -0
- package/node/third_party/libuv/include/uv/threadpool.h +0 -0
- package/node/third_party/libuv/include/uv/tree.h +0 -0
- package/node/third_party/libuv/include/uv/unix.h +0 -0
- package/node/third_party/libuv/include/uv/version.h +0 -0
- package/node/third_party/libuv/include/uv/win.h +0 -0
- package/node/third_party/libuv/include/uv.h +0 -0
- package/node/third_party/libuv/src/fs-poll.c +0 -0
- package/node/third_party/libuv/src/heap-inl.h +0 -0
- package/node/third_party/libuv/src/idna.c +0 -0
- package/node/third_party/libuv/src/idna.h +0 -0
- package/node/third_party/libuv/src/inet.c +0 -0
- package/node/third_party/libuv/src/queue.h +0 -0
- package/node/third_party/libuv/src/random.c +0 -0
- package/node/third_party/libuv/src/strscpy.c +0 -0
- package/node/third_party/libuv/src/strscpy.h +0 -0
- package/node/third_party/libuv/src/strtok.c +0 -0
- package/node/third_party/libuv/src/strtok.h +0 -0
- package/node/third_party/libuv/src/thread-common.c +0 -0
- package/node/third_party/libuv/src/threadpool.c +0 -0
- package/node/third_party/libuv/src/timer.c +0 -0
- package/node/third_party/libuv/src/unix/async.c +0 -0
- package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +0 -0
- package/node/third_party/libuv/src/unix/core.c +0 -0
- package/node/third_party/libuv/src/unix/darwin-proctitle.c +0 -0
- package/node/third_party/libuv/src/unix/darwin-stub.h +0 -0
- package/node/third_party/libuv/src/unix/darwin-syscalls.h +0 -0
- package/node/third_party/libuv/src/unix/darwin.c +0 -0
- package/node/third_party/libuv/src/unix/dl.c +0 -0
- package/node/third_party/libuv/src/unix/fs.c +0 -0
- package/node/third_party/libuv/src/unix/fsevents.c +0 -0
- package/node/third_party/libuv/src/unix/getaddrinfo.c +0 -0
- package/node/third_party/libuv/src/unix/getnameinfo.c +0 -0
- package/node/third_party/libuv/src/unix/internal.h +0 -0
- package/node/third_party/libuv/src/unix/kqueue.c +0 -0
- package/node/third_party/libuv/src/unix/linux.c +0 -0
- package/node/third_party/libuv/src/unix/loop-watcher.c +0 -0
- package/node/third_party/libuv/src/unix/loop.c +0 -0
- package/node/third_party/libuv/src/unix/pipe.c +0 -0
- package/node/third_party/libuv/src/unix/poll.c +0 -0
- package/node/third_party/libuv/src/unix/process.c +0 -0
- package/node/third_party/libuv/src/unix/procfs-exepath.c +0 -0
- package/node/third_party/libuv/src/unix/proctitle.c +0 -0
- package/node/third_party/libuv/src/unix/random-devurandom.c +0 -0
- package/node/third_party/libuv/src/unix/random-getentropy.c +0 -0
- package/node/third_party/libuv/src/unix/random-getrandom.c +0 -0
- package/node/third_party/libuv/src/unix/random-sysctl-linux.c +0 -0
- package/node/third_party/libuv/src/unix/signal.c +0 -0
- package/node/third_party/libuv/src/unix/stream.c +0 -0
- package/node/third_party/libuv/src/unix/tcp.c +0 -0
- package/node/third_party/libuv/src/unix/thread.c +0 -0
- package/node/third_party/libuv/src/unix/tty.c +0 -0
- package/node/third_party/libuv/src/unix/udp.c +0 -0
- package/node/third_party/libuv/src/uv-common.c +0 -0
- package/node/third_party/libuv/src/uv-common.h +0 -0
- package/node/third_party/libuv/src/uv-data-getter-setters.c +0 -0
- package/node/third_party/libuv/src/version.c +0 -0
- package/node/third_party/llhttp/LICENSE +0 -0
- package/node/third_party/llhttp/api.c +0 -0
- package/node/third_party/llhttp/http.c +0 -0
- package/node/third_party/llhttp/llhttp.c +0 -0
- package/node/third_party/llhttp/llhttp.h +0 -0
- package/node/third_party/nodejs/LICENSE +47 -0
- package/node/third_party/nodejs/README.md +5 -0
- package/node/third_party/parseargs/LICENSE +21 -0
- package/node/third_party/parseargs/README.md +5 -0
- package/node/third_party/punycode/LICENSE +20 -0
- package/node/third_party/punycode/README.md +5 -0
- package/node/third_party/zlib/LICENSE.chromium +27 -0
- package/package.json +1 -1
- package/prebuilt/darwin-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/darwin-arm64/brotli-7995bbdacc52e51c.a +0 -0
- package/prebuilt/darwin-arm64/uv-72ab666eae197cd8.a +0 -0
- package/prebuilt/darwin-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/darwin-arm64/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/darwin-x64/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/darwin-x64/brotli-7995bbdacc52e51c.a +0 -0
- package/prebuilt/darwin-x64/uv-72ab666eae197cd8.a +0 -0
- package/prebuilt/darwin-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/darwin-x64/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/linux-arm64/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/linux-arm64/brotli-65481ff838ce9def.a +0 -0
- package/prebuilt/linux-arm64/uv-f1353f50ff983f3c.a +0 -0
- package/prebuilt/linux-arm64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/linux-arm64/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/linux-arm64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/linux-arm64-musl/brotli-65481ff838ce9def.a +0 -0
- package/prebuilt/linux-arm64-musl/uv-f1353f50ff983f3c.a +0 -0
- package/prebuilt/linux-arm64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/linux-arm64-musl/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/linux-x64/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/linux-x64/brotli-65481ff838ce9def.a +0 -0
- package/prebuilt/linux-x64/uv-f1353f50ff983f3c.a +0 -0
- package/prebuilt/linux-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/linux-x64/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/linux-x64-musl/boringssl-4a47438eaf7e73ba.a +0 -0
- package/prebuilt/linux-x64-musl/brotli-65481ff838ce9def.a +0 -0
- package/prebuilt/linux-x64-musl/uv-f1353f50ff983f3c.a +0 -0
- package/prebuilt/linux-x64-musl/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/linux-x64-musl/zstd-015315ac7c784c73.a +0 -0
- package/prebuilt/win32-x64/boringssl-ce573858472b7fc9.a +0 -0
- package/prebuilt/win32-x64/brotli-20d86a61f30baeb3.a +0 -0
- package/prebuilt/win32-x64/uv-b11bae65d7fced82.a +0 -0
- package/prebuilt/win32-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/win32-x64/zstd-015315ac7c784c73.a +0 -0
- package/runtime/include/js_atoms.gen.h +0 -0
- package/runtime/include/js_atoms.h +5 -1
- package/runtime/include/js_bigint.h +1 -1
- package/runtime/include/js_buffer.h +4 -4
- package/runtime/include/js_builtins.h +41 -3
- package/runtime/include/js_console.h +9 -4
- package/runtime/include/js_convert.h +1 -1
- package/runtime/include/js_core.def +5 -4
- package/runtime/include/js_crypto.h +1 -1
- package/runtime/include/js_error.h +1 -1
- package/runtime/include/js_exception.h +21 -1
- package/runtime/include/js_function.h +33 -9
- package/runtime/include/js_gc.h +172 -30
- package/runtime/include/js_generator.h +2 -2
- package/runtime/include/js_host.h +19 -1
- package/runtime/include/js_jobs.h +5 -5
- package/runtime/include/js_module.h +1 -1
- package/runtime/include/js_object.h +142 -15
- package/runtime/include/js_ops.h +107 -5
- package/runtime/include/js_promise.h +3 -3
- package/runtime/include/js_regexp.h +1 -1
- package/runtime/include/js_runtime.h +0 -0
- package/runtime/include/js_symbol.h +1 -1
- package/runtime/include/js_web.h +5 -1
- package/runtime/include/jscell.h +22 -15
- package/runtime/include/jscontext.h +82 -39
- package/runtime/include/jsnum.h +1 -1
- package/runtime/include/jsstring.h +19 -6
- package/runtime/include/jsvalue.h +7 -3
- package/runtime/src/arguments.c +2 -2
- package/runtime/src/array.c +4 -1
- package/runtime/src/arraybuffer.c +19 -7
- package/runtime/src/async_iter.c +4 -3
- package/runtime/src/atoms.c +38 -4
- package/runtime/src/base64.c +2 -2
- package/runtime/src/bigint.c +1 -1
- package/runtime/src/blob.c +22 -9
- package/runtime/src/boringssl_support.cc +1 -1
- package/runtime/src/buffer.c +299 -91
- package/runtime/src/builtin_table.c +1 -1
- package/runtime/src/builtins.c +30 -4
- package/runtime/src/builtins_util.h +0 -0
- package/runtime/src/collections.c +18 -3
- package/runtime/src/components.c +1 -1
- package/runtime/src/console.c +14 -7
- package/runtime/src/convert.c +0 -0
- package/runtime/src/core_all.c +1 -1
- package/runtime/src/crypto.c +1 -1
- package/runtime/src/crypto_asym.c +1 -1
- package/runtime/src/crypto_bn.c +1 -1
- package/runtime/src/crypto_cipher.c +10 -3
- package/runtime/src/crypto_hash.c +1 -1
- package/runtime/src/crypto_host.c +1 -1
- package/runtime/src/crypto_internal.h +1 -1
- package/runtime/src/crypto_kdf.c +1 -1
- package/runtime/src/crypto_key.c +14 -1
- package/runtime/src/crypto_pkey.c +1 -1
- package/runtime/src/crypto_subtle.c +142 -58
- package/runtime/src/crypto_tls.c +1 -1
- package/runtime/src/date.c +5 -2
- package/runtime/src/domexception.c +2 -2
- package/runtime/src/elements.c +56 -17
- package/runtime/src/elements.h +7 -2
- package/runtime/src/encoding.c +1 -1
- package/runtime/src/error.c +4 -4
- package/runtime/src/events.c +42 -14
- package/runtime/src/exception.c +1 -1
- package/runtime/src/fetch.c +241 -17
- package/runtime/src/function.c +31 -19
- package/runtime/src/gc.c +1720 -211
- package/runtime/src/gc_visit.h +87 -0
- package/runtime/src/generator.c +5 -3
- package/runtime/src/global.c +14 -6
- package/runtime/src/headers.c +10 -10
- package/runtime/src/inspect.c +76 -17
- package/runtime/src/internal.h +9 -6
- package/runtime/src/iterate.c +94 -2
- package/runtime/src/iterator.c +1 -1
- package/runtime/src/jobs.c +11 -5
- package/runtime/src/jsnum.c +2 -2
- package/runtime/src/json.c +1 -1
- package/runtime/src/math.c +9 -1
- package/runtime/src/module.c +3 -3
- package/runtime/src/number.c +0 -0
- package/runtime/src/object.c +107 -74
- package/runtime/src/ops.c +21 -3
- package/runtime/src/os.c +192 -1
- package/runtime/src/os.h +33 -2
- package/runtime/src/process.c +73 -8
- package/runtime/src/promise.c +4 -4
- package/runtime/src/proxy.c +1 -1
- package/runtime/src/reflect.c +1 -1
- package/runtime/src/regexp.c +700 -11
- package/runtime/src/regexp_anchor.h +1 -1
- package/runtime/src/regexp_message.h +1 -1
- package/runtime/src/shape.c +78 -20
- package/runtime/src/shape.h +0 -0
- package/runtime/src/streams.c +22 -8
- package/runtime/src/streams.h +0 -0
- package/runtime/src/string.c +64 -25
- package/runtime/src/string_builtins.c +7 -7
- package/runtime/src/symbol.c +2 -7
- package/runtime/src/test_host.c +3 -3
- package/runtime/src/tls_roots.gen.h +102 -620
- package/runtime/src/typedarray.c +8 -3
- package/runtime/src/tznames.gen.h +2 -1
- package/runtime/src/uri.c +1 -1
- package/runtime/src/url.c +42 -39
- package/runtime/src/weak.c +110 -36
- package/runtime/src/web.c +21 -3
- package/runtime/src/wrapper.c +0 -0
- package/runtime/src/writable.c +7 -6
- package/runtime/third_party/ada-idna/LICENSE-MIT +0 -0
- package/runtime/third_party/ada-idna/README.md +7 -7
- package/runtime/third_party/ada-idna/convert.mjs +89 -27
- package/runtime/third_party/ada-idna/idna.c +30 -31
- package/runtime/third_party/ada-idna/idna.h +0 -0
- package/runtime/third_party/ada-idna/idna_tables.h +2272 -1952
- package/runtime/third_party/boringssl/third_party/fiat/LICENSE +15 -0
- package/runtime/third_party/mozilla-ca/LICENSE +373 -0
- package/runtime/third_party/mozilla-ca/README.md +9 -0
- package/runtime/third_party/nodejs/LICENSE +47 -0
- package/runtime/third_party/nodejs/README.md +7 -0
- package/runtime/third_party/quickjs-dtoa/LICENSE +0 -0
- package/runtime/third_party/quickjs-dtoa/README.md +1 -1
- package/runtime/third_party/quickjs-dtoa/dtoa.c +0 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.h +0 -0
- package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +0 -0
- package/runtime/third_party/quickjs-regexp/LICENSE +0 -0
- package/runtime/third_party/quickjs-regexp/README.md +2 -2
- package/runtime/third_party/quickjs-regexp/cutils.c +0 -0
- package/runtime/third_party/quickjs-regexp/cutils.h +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp.c +0 -0
- package/runtime/third_party/quickjs-regexp/libregexp.h +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode-table.h +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode.c +0 -0
- package/runtime/third_party/quickjs-regexp/libunicode.h +0 -0
- package/runtime/third_party/unicode/LICENSE +39 -0
- package/runtime/third_party/unicode/README.md +9 -0
- package/runtime/third_party/v8-ieee754/LICENSE +0 -0
- package/runtime/third_party/v8-ieee754/LICENSE.fdlibm +10 -0
- package/runtime/third_party/v8-ieee754/README.md +3 -2
- package/runtime/third_party/v8-ieee754/convert.py +0 -0
- package/runtime/third_party/v8-ieee754/ieee754.c +0 -0
- package/runtime/third_party/v8-ieee754/ieee754.h +0 -0
- package/runtime/tools/regexp_compile.c +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node:timers' core
|
|
1
|
+
// node:timers' core: Timeout and Immediate on the runtime's timers (timerStart and
|
|
2
2
|
// friends, runtime/src/jobs.c). Each object holds one native one-shot timer, armed under one id
|
|
3
3
|
// (also its primitive), which an interval re-arms after its callback. node:timers and
|
|
4
4
|
// node:timers/promises build on it; a program that uses them gets them as its globals too
|
|
@@ -19,15 +19,27 @@ const knownTimersById = new Map();
|
|
|
19
19
|
/* every armed Timeout: a number that names one whose primitive wasn't taken clears nothing */
|
|
20
20
|
export const armed = new Map();
|
|
21
21
|
|
|
22
|
-
function emitWarning(message) {
|
|
23
|
-
if (typeof process.emitWarning === "function") process.emitWarning(message,
|
|
22
|
+
function emitWarning(message, type) {
|
|
23
|
+
if (typeof process.emitWarning === "function") process.emitWarning(message, type);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/* Node 24 also warns, once each, about a negative delay and one that isn't a number */
|
|
27
|
+
let warnedNegativeNumber = false;
|
|
28
|
+
let warnedNotNumber = false;
|
|
29
|
+
|
|
26
30
|
/* the delay as Node takes it: 1 when below 1 ms, not a number or past 2^31 - 1 */
|
|
27
31
|
export function duration(after) {
|
|
28
32
|
after *= 1;
|
|
29
33
|
if (!(after >= 1 && after <= TIMEOUT_MAX)) {
|
|
30
|
-
if (after > TIMEOUT_MAX)
|
|
34
|
+
if (after > TIMEOUT_MAX) {
|
|
35
|
+
emitWarning(`${after} does not fit into a 32-bit signed integer.\nTimeout duration was set to 1.`, "TimeoutOverflowWarning");
|
|
36
|
+
} else if (after < 0 && !warnedNegativeNumber) {
|
|
37
|
+
warnedNegativeNumber = true;
|
|
38
|
+
emitWarning(`${after} is a negative number.\nTimeout duration was set to 1.`, "TimeoutNegativeWarning");
|
|
39
|
+
} else if (Number.isNaN(after) && !warnedNotNumber) {
|
|
40
|
+
warnedNotNumber = true;
|
|
41
|
+
emitWarning(`${after} is not a number.\nTimeout duration was set to 1.`, "TimeoutNaNWarning");
|
|
42
|
+
}
|
|
31
43
|
after = 1;
|
|
32
44
|
}
|
|
33
45
|
return after;
|
|
@@ -115,6 +127,14 @@ if (typeof Symbol.dispose === "symbol") {
|
|
|
115
127
|
function fireTimeout(timer) {
|
|
116
128
|
timer[kPending] = false;
|
|
117
129
|
armed.delete(timer[kId]);
|
|
130
|
+
/* listOnTimeout: a timer whose callback was taken away (an interval's _onTimeout = null) ends */
|
|
131
|
+
if (!timer._onTimeout) {
|
|
132
|
+
if (!timer._destroyed) {
|
|
133
|
+
timer._destroyed = true;
|
|
134
|
+
if (timer[kHasPrimitive]) knownTimersById.delete(timer[kId]);
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
118
138
|
const args = timer._timerArgs;
|
|
119
139
|
try {
|
|
120
140
|
if (args === undefined) timer._onTimeout();
|
|
@@ -130,11 +150,21 @@ function fireTimeout(timer) {
|
|
|
130
150
|
}
|
|
131
151
|
}
|
|
132
152
|
|
|
153
|
+
/* Node 24's cleanTimer: a cancelled timer lets go of its callback and arguments */
|
|
154
|
+
function cleanTimer(item) {
|
|
155
|
+
item._onTimeout = undefined;
|
|
156
|
+
item._timerArgs = undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
133
159
|
export function unenrollTimeout(item) {
|
|
134
|
-
if (item._destroyed)
|
|
160
|
+
if (item._destroyed) {
|
|
161
|
+
cleanTimer(item);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
135
164
|
item._destroyed = true;
|
|
136
165
|
if (item[kHasPrimitive]) knownTimersById.delete(item[kId]);
|
|
137
166
|
disarm(item);
|
|
167
|
+
cleanTimer(item);
|
|
138
168
|
item._idleTimeout = -1;
|
|
139
169
|
}
|
|
140
170
|
|
|
@@ -225,9 +255,10 @@ export function setImmediate(callback, ...args) {
|
|
|
225
255
|
}
|
|
226
256
|
|
|
227
257
|
export function clearImmediate(immediate) {
|
|
228
|
-
if (!immediate || immediate._destroyed) return;
|
|
258
|
+
if (!immediate?._onImmediate || immediate._destroyed) return;
|
|
229
259
|
immediate._destroyed = true;
|
|
230
260
|
immediate[kRefed] = null;
|
|
231
|
-
immediate._onImmediate =
|
|
261
|
+
immediate._onImmediate = undefined; /* Node 24's cleanImmediate */
|
|
262
|
+
immediate._argv = undefined;
|
|
232
263
|
timerClear(immediate[kId]);
|
|
233
264
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The Node timer globals
|
|
1
|
+
// The Node timer globals: the runtime's setTimeout and friends, in every binary,
|
|
2
2
|
// return numbers. A program that may use what Node's return (a Timeout's unref(), refresh(),
|
|
3
3
|
// hasRef(), or node:timers itself, whose clearTimeout must take the globals' timers) gets this
|
|
4
4
|
// module first (implicitModules in node/index.ts), so that setTimeout === timers.setTimeout.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// node:tls's shared parts
|
|
1
|
+
// node:tls's shared parts: SecureContext and createSecureContext (Node's
|
|
2
2
|
// internal/tls/common.js and secure-context.js) over the runtime's contexts (BoringSSL's SSL_CTX);
|
|
3
3
|
// protocol versions; and Node's errors for what BoringSSL reports (OpenSSL 3's codes and messages,
|
|
4
4
|
// as Node shows them: BoringSSL's reasons are OpenSSL's, its numbers aren't).
|
|
5
|
+
// Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
|
|
5
6
|
import {
|
|
6
7
|
fsReadFile, tlsCiphers, tlsContextAddCA, tlsContextAddRoots, tlsContextNew, tlsContextSetCert, tlsContextSetKey,
|
|
7
8
|
} from "visaljs:host";
|
|
@@ -110,11 +111,16 @@ const VERIFY_MESSAGES = {
|
|
|
110
111
|
HOSTNAME_MISMATCH: "hostname mismatch",
|
|
111
112
|
};
|
|
112
113
|
|
|
114
|
+
const SYSTEM_CA_HINTED = new Set(["UNABLE_TO_VERIFY_LEAF_SIGNATURE", "DEPTH_ZERO_SELF_SIGNED_CERT", "UNABLE_TO_GET_ISSUER_CERT"]);
|
|
115
|
+
|
|
113
116
|
/** A certificate verification error (Node's: message, and the code that authorizationError gets),
|
|
114
117
|
* from X509_V_ERR_* or a name */
|
|
115
118
|
export function verifyError(code) {
|
|
116
119
|
const name = typeof code === "number" ? VERIFY_CODES[code] ?? "CERT_REJECTED" : code;
|
|
117
|
-
|
|
120
|
+
let message = VERIFY_MESSAGES[name] ?? name.toLowerCase().replace(/_/g, " ");
|
|
121
|
+
/* Node 24's hint (GetValidationErrorReason), for the errors a locally installed root CA may cause */
|
|
122
|
+
if (SYSTEM_CA_HINTED.has(name)) message += "; if the root CA is installed locally, try running Node.js with --use-system-ca";
|
|
123
|
+
const error = new Error(message);
|
|
118
124
|
error.code = name;
|
|
119
125
|
return error;
|
|
120
126
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// TLSSocket, tls.Server and tls.connect
|
|
1
|
+
// TLSSocket, tls.Server and tls.connect, following Node's internal/tls/wrap.js: the
|
|
2
2
|
// same events and the same order ('secure', then the client's verification and 'secureConnect',
|
|
3
3
|
// or the server's 'secureConnection'; errors before control is released go to the server's
|
|
4
4
|
// 'tlsClientError'). Where Node's TLSWrap (C++) sits between the socket's handle and OpenSSL,
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
// (tlsRun), application data comes out and is pushed; written data goes in and records come out
|
|
7
7
|
// to the transport. The transport is a net.Socket's handle, taken over as Node's TLSWrap takes
|
|
8
8
|
// it (its events come to the TLSSocket), or any Duplex stream (Node's JSStreamSocket case).
|
|
9
|
+
// Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
|
|
9
10
|
import {
|
|
10
11
|
errnoName, netReadStart, netReadStop, netShutdown, netWrite, tlsExportKeyingMaterial, tlsFinished, tlsInfo, tlsNew, tlsPeerCerts,
|
|
11
12
|
tlsRootCertificates, tlsRun, tlsSession, tlsSetNoRenegotiation, tlsShutdown, tlsVerifyError,
|
|
12
13
|
} from "visaljs:host";
|
|
13
14
|
import { codeError, invalidArgType, outOfRange, validateFunction, validateString } from "../errors.js";
|
|
15
|
+
import { features } from "../features.js";
|
|
14
16
|
import { isIP } from "../net.js";
|
|
15
17
|
import { Server as NetServer, Socket } from "../../net.js";
|
|
16
18
|
import { createSecureContext, SecureContext, sslError, tlsFailure, VERSION_NAMES, verifyError } from "./common.js";
|
|
@@ -323,23 +325,13 @@ export class TLSSocket extends Socket {
|
|
|
323
325
|
if (state & TLS_NEW_SESSION && !this._tlsOptions.isServer) this._onNewSession();
|
|
324
326
|
if (state & TLS_FAILED && !this._tlsClosed) {
|
|
325
327
|
this._tlsClosed = true;
|
|
326
|
-
this._onTlsError(
|
|
328
|
+
this._onTlsError(tlsFailure(err));
|
|
327
329
|
} else if (state & TLS_PEER_CLOSED) {
|
|
328
330
|
this._peerEnded();
|
|
329
331
|
}
|
|
330
332
|
return taken;
|
|
331
333
|
}
|
|
332
334
|
|
|
333
|
-
/* OpenSSL 3 reads a first record that isn't TLS ("HTTP/1.1 400 …") as too long where BoringSSL
|
|
334
|
-
* sees its version: Node's code is OpenSSL's */
|
|
335
|
-
_failure(err) {
|
|
336
|
-
const b = this._firstBytes;
|
|
337
|
-
if (Array.isArray(err) && err[2] === "WRONG_VERSION_NUMBER" && !this._secureEstablished && b && b.length >= 5 && ((b[3] << 8) | b[4]) > 16384 + 2048) {
|
|
338
|
-
return sslError(0x0A0000C6, "packet length too long");
|
|
339
|
-
}
|
|
340
|
-
return tlsFailure(err);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
335
|
/* a session the server gave (a TLS 1.3 ticket comes after the handshake): 'session', once the
|
|
344
336
|
* server is verified (Node's onnewsessionclient) */
|
|
345
337
|
_onNewSession() {
|
|
@@ -352,7 +344,7 @@ export class TLSSocket extends Socket {
|
|
|
352
344
|
_pushPlain(bytes) {
|
|
353
345
|
this._unrefTimer();
|
|
354
346
|
let more;
|
|
355
|
-
if (this._onread) more =
|
|
347
|
+
if (this._onread) more = features.onread.deliverAll(this, bytes);
|
|
356
348
|
else more = this.push(bytes);
|
|
357
349
|
if (!more && this._secureEstablished) this._stopReading();
|
|
358
350
|
}
|
|
@@ -408,9 +400,6 @@ export class TLSSocket extends Socket {
|
|
|
408
400
|
_onCipher(bytes) {
|
|
409
401
|
if (this.destroyed) return;
|
|
410
402
|
this._unrefTimer();
|
|
411
|
-
if (!this._secureEstablished && (!this._firstBytes || this._firstBytes.length < 5)) {
|
|
412
|
-
this._firstBytes = Buffer.concat([this._firstBytes ?? Buffer.alloc(0), bytes]).subarray(0, 5);
|
|
413
|
-
}
|
|
414
403
|
if (this._tlsOptions.isServer && this._conn === null) {
|
|
415
404
|
this._hello = this._hello ? Buffer.concat([this._hello, bytes]) : Buffer.from(bytes);
|
|
416
405
|
if (this._helloPending) return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// X.509 certificates
|
|
1
|
+
// X.509 certificates as Node shows them: the legacy object of getPeerCertificate()
|
|
2
2
|
// and X509Certificate's toLegacyObject() (OpenSSL's printing: short attribute names, "IP Address:",
|
|
3
3
|
// "Oct 6 22:08:31 2026 GMT", colon-separated fingerprints), from a small DER reader of our own.
|
|
4
4
|
// PEM bundles split into DER here too, for SecureContext's `ca` and `cert`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// node:tty's ReadStream, for programs whose code names it, or process.stdin (it links node:net and
|
|
2
|
+
// libuv, which tty.isatty alone doesn't need): a terminal read as node:net's Socket, on libuv's
|
|
3
|
+
// terminal handle (ttyOpen). tty.ReadStream builds this class, and is its prototype's constructor.
|
|
4
|
+
import { ttyOpen, ttySetRawMode } from "visaljs:host";
|
|
5
|
+
import { errnoException } from "./errors.js";
|
|
6
|
+
import { Socket } from "../net.js";
|
|
7
|
+
import { ReadStream, isatty } from "../tty.js";
|
|
8
|
+
import { streams } from "./tty_streams.js";
|
|
9
|
+
|
|
10
|
+
/** A terminal, read: Node's, a Socket on its handle that reads once something reads from it. */
|
|
11
|
+
class TTYReadStream extends Socket {
|
|
12
|
+
constructor(fd, options) {
|
|
13
|
+
if (!isatty(fd)) throw errnoException(-22, "TTY initialization"); /* EINVAL, as Node's */
|
|
14
|
+
const id = ttyOpen(fd);
|
|
15
|
+
if (id < 0) throw errnoException(id, "TTY initialization");
|
|
16
|
+
super({ readableHighWaterMark: 0, ...options, handle: id, manualStart: true });
|
|
17
|
+
this.fd = fd;
|
|
18
|
+
this.isRaw = false;
|
|
19
|
+
this.isTTY = true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Keys as they're typed, unechoed (raw), or lines the terminal edits (normal). */
|
|
23
|
+
setRawMode(flag) {
|
|
24
|
+
flag = Boolean(flag);
|
|
25
|
+
const err = this._handle === null ? -9 : ttySetRawMode(this._handle, flag);
|
|
26
|
+
if (err) {
|
|
27
|
+
this.emit("error", errnoException(err, "setRawMode"));
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
this.isRaw = flag;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* instanceof tty.ReadStream holds, and its constructor is tty.ReadStream */
|
|
36
|
+
ReadStream.prototype = TTYReadStream.prototype;
|
|
37
|
+
Object.defineProperty(TTYReadStream.prototype, "constructor", { value: ReadStream, writable: true, configurable: true });
|
|
38
|
+
Object.setPrototypeOf(ReadStream, Socket);
|
|
39
|
+
streams.ReadStream = TTYReadStream;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// util.debuglog (util.debug): loggers for NODE_DEBUG's sections. Linked into programs that name it
|
|
2
|
+
// (internal/features.js).
|
|
3
|
+
import { format, formatWithOptions, inspect } from "../util.js";
|
|
4
|
+
import { features } from "./features.js";
|
|
5
|
+
|
|
6
|
+
/* NODE_DEBUG's sections, as a test: a comma-separated list, * a wildcard */
|
|
7
|
+
let debugEnabled;
|
|
8
|
+
const debugImpls = Object.create(null);
|
|
9
|
+
|
|
10
|
+
function testDebugEnabled(section) {
|
|
11
|
+
if (debugEnabled === undefined) {
|
|
12
|
+
const env = process.env.NODE_DEBUG;
|
|
13
|
+
if (env) {
|
|
14
|
+
const pattern = env.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replaceAll("*", ".*").replaceAll(",", "$|^");
|
|
15
|
+
const regex = new RegExp(`^${pattern}$`, "i");
|
|
16
|
+
debugEnabled = (str) => regex.exec(str) !== null;
|
|
17
|
+
} else debugEnabled = () => false;
|
|
18
|
+
}
|
|
19
|
+
return debugEnabled(section);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function debuglogImpl(enabled, set) {
|
|
23
|
+
if (debugImpls[set] === undefined) {
|
|
24
|
+
if (enabled) {
|
|
25
|
+
const pid = process.pid;
|
|
26
|
+
if (set === "HTTP" || set === "HTTP2") {
|
|
27
|
+
process.emitWarning("Setting the NODE_DEBUG environment variable to '" + set.toLowerCase() +
|
|
28
|
+
"' can expose sensitive data (such as passwords, tokens and authentication headers) in the resulting log.");
|
|
29
|
+
}
|
|
30
|
+
debugImpls[set] = function debug(...args) {
|
|
31
|
+
process.stderr.write(format("%s %s: %s\n", set, inspect(pid), formatWithOptions({ colors: false }, ...args)));
|
|
32
|
+
};
|
|
33
|
+
} else debugImpls[set] = () => {};
|
|
34
|
+
}
|
|
35
|
+
return debugImpls[set];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A logger for the section, writing to stderr when NODE_DEBUG names it (decided when first
|
|
39
|
+
* used); `enabled` says whether it does. */
|
|
40
|
+
function debuglog(set, cb) {
|
|
41
|
+
let enabled;
|
|
42
|
+
const init = () => {
|
|
43
|
+
set = set.toUpperCase();
|
|
44
|
+
enabled = testDebugEnabled(set);
|
|
45
|
+
};
|
|
46
|
+
let debug = (...args) => {
|
|
47
|
+
init();
|
|
48
|
+
debug = debuglogImpl(enabled, set);
|
|
49
|
+
if (typeof cb === "function") cb(debug);
|
|
50
|
+
debug(...args);
|
|
51
|
+
};
|
|
52
|
+
let test = () => {
|
|
53
|
+
init();
|
|
54
|
+
test = () => enabled;
|
|
55
|
+
return enabled;
|
|
56
|
+
};
|
|
57
|
+
const logger = (...args) => debug(...args);
|
|
58
|
+
Object.defineProperty(logger, "enabled", {
|
|
59
|
+
get() {
|
|
60
|
+
return test();
|
|
61
|
+
},
|
|
62
|
+
configurable: true,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
});
|
|
65
|
+
return logger;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
features.debuglog = debuglog;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// util.diff: the edits between two strings or arrays, by Myers's algorithm. Linked into programs
|
|
2
|
+
// that name it (internal/features.js).
|
|
3
|
+
import { invalidArgType } from "./errors.js";
|
|
4
|
+
import { features } from "./features.js";
|
|
5
|
+
|
|
6
|
+
/** The edits from expected to actual (strings by character, or arrays by element): [op, value],
|
|
7
|
+
* op 0 for both, 1 for actual's, -1 for expected's. Myers's algorithm, as node:assert's. */
|
|
8
|
+
function diff(actual, expected) {
|
|
9
|
+
if (actual === expected) return [];
|
|
10
|
+
if (typeof actual !== "string" && !Array.isArray(actual)) throw invalidArgType("actual", "of type string or an instance of Array", actual);
|
|
11
|
+
if (typeof expected !== "string" && !Array.isArray(expected)) throw invalidArgType("expected", "of type string or an instance of Array", expected);
|
|
12
|
+
const n = actual.length;
|
|
13
|
+
const m = expected.length;
|
|
14
|
+
const max = n + m;
|
|
15
|
+
const v = new Int32Array(2 * max + 1);
|
|
16
|
+
const trace = [];
|
|
17
|
+
let done = false;
|
|
18
|
+
for (let d = 0; d <= max && !done; d++) {
|
|
19
|
+
trace.push(new Int32Array(v));
|
|
20
|
+
for (let k = -d; k <= d; k += 2) {
|
|
21
|
+
const offset = k + max;
|
|
22
|
+
let x = k === -d || (k !== d && v[offset - 1] < v[offset + 1]) ? v[offset + 1] : v[offset - 1] + 1;
|
|
23
|
+
let y = x - k;
|
|
24
|
+
while (x < n && y < m && actual[x] === expected[y]) {
|
|
25
|
+
x++;
|
|
26
|
+
y++;
|
|
27
|
+
}
|
|
28
|
+
v[offset] = x;
|
|
29
|
+
if (x >= n && y >= m) {
|
|
30
|
+
done = true;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/* back from the end */
|
|
36
|
+
const result = [];
|
|
37
|
+
let x = n;
|
|
38
|
+
let y = m;
|
|
39
|
+
for (let d = trace.length - 1; d >= 0; d--) {
|
|
40
|
+
const tv = trace[d];
|
|
41
|
+
const k = x - y;
|
|
42
|
+
const prevK = k === -d || (k !== d && tv[k - 1 + max] < tv[k + 1 + max]) ? k + 1 : k - 1;
|
|
43
|
+
const prevX = tv[prevK + max];
|
|
44
|
+
const prevY = prevX - prevK;
|
|
45
|
+
while (x > prevX && y > prevY) {
|
|
46
|
+
result.push([0, actual[x - 1]]);
|
|
47
|
+
x--;
|
|
48
|
+
y--;
|
|
49
|
+
}
|
|
50
|
+
if (d > 0) {
|
|
51
|
+
if (x > prevX) {
|
|
52
|
+
result.push([1, actual[x - 1]]);
|
|
53
|
+
x--;
|
|
54
|
+
} else {
|
|
55
|
+
result.push([-1, expected[y - 1]]);
|
|
56
|
+
y--;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result.reverse();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
features.diff = diff;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// node:util's rarely used functions: callbackify, aborted, toUSVString, the
|
|
2
|
+
// transferable AbortController and signal, getCallSites, setTraceSigInt,
|
|
3
|
+
// convertProcessSignalToExitCode, and the deprecated isArray and _extend (Node 24 removed the other
|
|
4
|
+
// is* and log). Linked into programs that name them (internal/features.js).
|
|
5
|
+
import { osConstants } from "visaljs:host";
|
|
6
|
+
import { deprecate } from "../util.js";
|
|
7
|
+
import { codeError, invalidArgType, invalidArgValue, validateFunction } from "./errors.js";
|
|
8
|
+
import { features } from "./features.js";
|
|
9
|
+
|
|
10
|
+
/** A function returning a promise as one taking a callback (err, value) last. */
|
|
11
|
+
function callbackify(original) {
|
|
12
|
+
validateFunction(original, "original");
|
|
13
|
+
function callbackified(...args) {
|
|
14
|
+
const maybeCb = args.pop();
|
|
15
|
+
validateFunction(maybeCb, "last argument");
|
|
16
|
+
const cb = maybeCb.bind(this);
|
|
17
|
+
Reflect.apply(original, this, args).then(
|
|
18
|
+
(ret) => process.nextTick(cb, null, ret),
|
|
19
|
+
(rej) => process.nextTick(callbackifyOnRejected, rej, cb),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
const descriptors = Object.getOwnPropertyDescriptors(original);
|
|
23
|
+
if (typeof descriptors.length.value === "number") descriptors.length.value++;
|
|
24
|
+
if (typeof descriptors.name.value === "string") descriptors.name.value += "Callbackified";
|
|
25
|
+
for (const descriptor of Object.values(descriptors)) Object.setPrototypeOf(descriptor, null);
|
|
26
|
+
Object.defineProperties(callbackified, descriptors);
|
|
27
|
+
return callbackified;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* a falsy rejection becomes an Error, which keeps the value as its reason */
|
|
31
|
+
function callbackifyOnRejected(reason, cb) {
|
|
32
|
+
if (!reason) {
|
|
33
|
+
const err = codeError(Error, "ERR_FALSY_VALUE_REJECTION", "Promise was rejected with falsy value");
|
|
34
|
+
err.reason = reason;
|
|
35
|
+
reason = err;
|
|
36
|
+
}
|
|
37
|
+
return cb(reason);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/** The string with its lone surrogates replaced by U+FFFD. */
|
|
42
|
+
function toUSVString(input) {
|
|
43
|
+
return `${input}`.toWellFormed();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function validateAbortSignal(signal, name) {
|
|
47
|
+
if (signal === null || typeof signal !== "object" || !("aborted" in signal)) throw invalidArgType(name, "an instance of AbortSignal", signal);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* the resources whose signal a promise waits for: the listener goes when they do */
|
|
51
|
+
const abortedListeners = new WeakMap();
|
|
52
|
+
|
|
53
|
+
/** A promise resolved when the signal aborts, while the resource is alive. */
|
|
54
|
+
function aborted(signal, resource) {
|
|
55
|
+
validateAbortSignal(signal, "signal");
|
|
56
|
+
if (resource === null || (typeof resource !== "object" && typeof resource !== "function")) {
|
|
57
|
+
throw invalidArgType("resource", "of type object", resource);
|
|
58
|
+
}
|
|
59
|
+
if (signal.aborted) return Promise.resolve();
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
62
|
+
abortedListeners.set(resource, resolve);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Marks a signal as transferable to workers: a compiled program has none, so it's the signal. */
|
|
67
|
+
function transferableAbortSignal(signal) {
|
|
68
|
+
validateAbortSignal(signal, "signal");
|
|
69
|
+
return signal;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function transferableAbortController() {
|
|
73
|
+
return new AbortController();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The call sites: a compiled program has no stack frames to give. */
|
|
77
|
+
function getCallSites() {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The exit code of a process a signal ended: 128 and the signal's number, as a shell has it. */
|
|
82
|
+
function convertProcessSignalToExitCode(signalCode) {
|
|
83
|
+
const table = osConstants()[0]; /* os.constants.signals': name, number, … */
|
|
84
|
+
const at = table.indexOf(signalCode);
|
|
85
|
+
if (typeof signalCode !== "string" || at < 0 || at % 2) {
|
|
86
|
+
const names = table.filter((_, i) => i % 2 === 0);
|
|
87
|
+
throw invalidArgValue("signalCode", "must be one of: " + names.map((n) => `'${n}'`).join(", "), signalCode);
|
|
88
|
+
}
|
|
89
|
+
return 128 + table[at + 1];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Whether SIGINT prints a stack trace: a compiled program has none to print. */
|
|
93
|
+
function setTraceSigInt(enable) {
|
|
94
|
+
if (typeof enable !== "boolean") throw invalidArgType("enable", "of type boolean", enable);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ---- deprecated ---------------------------------------------------------------------------- */
|
|
98
|
+
|
|
99
|
+
const _extend = deprecate(function _extend(target, source) {
|
|
100
|
+
if (source === null || typeof source !== "object") return target;
|
|
101
|
+
const keys = Object.keys(source);
|
|
102
|
+
let i = keys.length;
|
|
103
|
+
while (i--) target[keys[i]] = source[keys[i]];
|
|
104
|
+
return target;
|
|
105
|
+
}, "The `util._extend` API is deprecated. Please use Object.assign() instead.", "DEP0060");
|
|
106
|
+
|
|
107
|
+
const isArray = deprecate(Array.isArray, "The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.", "DEP0044");
|
|
108
|
+
Object.assign(features, {
|
|
109
|
+
callbackify, toUSVString, aborted, transferableAbortSignal, transferableAbortController, getCallSites, setTraceSigInt,
|
|
110
|
+
convertProcessSignalToExitCode, _extend, isArray,
|
|
111
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// util.styleText, and util.inspect's colors and styles: the SGR codes of each style. Linked into
|
|
2
|
+
// programs that name them (internal/features.js).
|
|
3
|
+
import { utilInspect } from "visaljs:host";
|
|
4
|
+
import { inspect } from "../util.js";
|
|
5
|
+
import { codeError, invalidArgType, validateString } from "./errors.js";
|
|
6
|
+
import { features } from "./features.js";
|
|
7
|
+
|
|
8
|
+
/* the styles: [open, close] SGR codes, and aliases that aren't enumerated */
|
|
9
|
+
inspect.colors = Object.assign(Object.create(null), {
|
|
10
|
+
reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], blink: [5, 25], inverse: [7, 27], hidden: [8, 28],
|
|
11
|
+
strikethrough: [9, 29], doubleunderline: [21, 24], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39],
|
|
12
|
+
magenta: [35, 39], cyan: [36, 39], white: [37, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49],
|
|
13
|
+
bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], framed: [51, 54], overlined: [53, 55], gray: [90, 39],
|
|
14
|
+
redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39],
|
|
15
|
+
whiteBright: [97, 39], bgGray: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49],
|
|
16
|
+
bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49],
|
|
17
|
+
});
|
|
18
|
+
for (const [alias, name] of [["grey", "gray"], ["blackBright", "gray"], ["bgGrey", "bgGray"], ["bgBlackBright", "bgGray"], ["faint", "dim"],
|
|
19
|
+
["crossedout", "strikethrough"], ["strikeThrough", "strikethrough"], ["crossedOut", "strikethrough"], ["conceal", "hidden"],
|
|
20
|
+
["swapColors", "inverse"], ["swapcolors", "inverse"], ["doubleUnderline", "doubleunderline"]]) {
|
|
21
|
+
Object.defineProperty(inspect.colors, alias, {
|
|
22
|
+
get() {
|
|
23
|
+
return this[name];
|
|
24
|
+
},
|
|
25
|
+
set(value) {
|
|
26
|
+
Object.defineProperty(this, alias, { configurable: true, enumerable: true, writable: true, value });
|
|
27
|
+
},
|
|
28
|
+
configurable: true,
|
|
29
|
+
enumerable: false,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
inspect.styles = Object.assign(Object.create(null), {
|
|
33
|
+
special: "cyan", number: "yellow", bigint: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green",
|
|
34
|
+
symbol: "green", date: "magenta", regexp: "red", module: "underline",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/* whether a stream gets colors: FORCE_COLOR says, else a terminal that NO_COLOR, NODE_DISABLE_COLORS
|
|
38
|
+
* and TERM=dumb don't turn off */
|
|
39
|
+
function shouldColorize(stream) {
|
|
40
|
+
const env = process.env;
|
|
41
|
+
if (env.FORCE_COLOR !== undefined) return !["0", "false"].includes(env.FORCE_COLOR);
|
|
42
|
+
if (!stream?.isTTY) return false;
|
|
43
|
+
if (typeof stream.getColorDepth === "function") return stream.getColorDepth() > 2;
|
|
44
|
+
return env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The text in the styles (a name or an array of names from inspect.colors), when the stream
|
|
48
|
+
* shows colors (validateStream: false always styles it). */
|
|
49
|
+
function styleText(format, text, { validateStream = true, stream = process.stdout } = {}) {
|
|
50
|
+
validateString(text, "text");
|
|
51
|
+
if (typeof validateStream !== "boolean") throw invalidArgType("validateStream", "of type boolean", validateStream);
|
|
52
|
+
let skipColorize = false;
|
|
53
|
+
if (validateStream) {
|
|
54
|
+
if (stream === null || typeof stream !== "object" || (typeof stream.write !== "function" && typeof stream.getReader !== "function" && typeof stream.getWriter !== "function")) {
|
|
55
|
+
throw invalidArgType("stream", "an instance of ReadableStream, WritableStream, or Stream", stream);
|
|
56
|
+
}
|
|
57
|
+
skipColorize = !shouldColorize(stream);
|
|
58
|
+
}
|
|
59
|
+
const formats = Array.isArray(format) ? format : [format];
|
|
60
|
+
let left = "";
|
|
61
|
+
let right = "";
|
|
62
|
+
for (const key of formats) {
|
|
63
|
+
if (key === "none") continue;
|
|
64
|
+
const code = inspect.colors[key];
|
|
65
|
+
if (code === undefined) {
|
|
66
|
+
throw codeError(TypeError, "ERR_INVALID_ARG_VALUE", "The argument 'format' must be one of: " +
|
|
67
|
+
Object.keys(inspect.colors).map((k) => `'${k}'`).join(", ") + ". Received " + utilInspect(key));
|
|
68
|
+
}
|
|
69
|
+
if (skipColorize) continue;
|
|
70
|
+
left += `\u001b[${code[0]}m`;
|
|
71
|
+
right = `\u001b[${code[1]}m` + right;
|
|
72
|
+
}
|
|
73
|
+
return skipColorize ? text : `${left}${text}${right}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
features.styleText = styleText;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node:zlib's optional libraries
|
|
1
|
+
// node:zlib's optional libraries: Brotli's and zstd's host primitives are registered
|
|
2
2
|
// here by internal/zlib_brotli.js and internal/zlib_zstd.js, implicit modules a program gets when
|
|
3
3
|
// its own code names them, so a program that only gzips links neither (~800 and ~600 KB).
|
|
4
4
|
export const engines = { brotli: null, zstd: null };
|