visaljs 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -2
- package/THIRD_PARTY_LICENSES +1216 -0
- package/cli.js +4414 -325
- package/node/include/js_node.h +57 -1
- package/node/include/js_uv.h +8 -1
- 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 +1 -1
- package/node/prelude/domain.js +115 -0
- package/node/prelude/events.js +144 -16
- package/node/prelude/fs.js +1138 -151
- package/node/prelude/fs_promises.js +117 -11
- package/node/prelude/http.js +104 -27
- package/node/prelude/http2.js +1 -1
- package/node/prelude/https.js +148 -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 +116 -0
- package/node/prelude/internal/events_on.js +100 -0
- package/node/prelude/internal/features.js +55 -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 +26 -0
- package/node/prelude/internal/mime.js +249 -0
- package/node/prelude/internal/net.js +1 -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 +119 -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 +3 -15
- 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 +194 -7
- package/node/prelude/net.js +2 -1
- 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 +147 -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 +143 -20
- package/node/src/host_loop.c +25 -2
- package/node/src/host_net.c +55 -7
- 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 -5
- 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 +1 -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 +2 -1
- package/runtime/include/jscell.h +22 -15
- package/runtime/include/jscontext.h +74 -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 +1 -1
- 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 +23 -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 +1716 -207
- 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 +5 -2
- 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 +134 -2
- package/runtime/src/regexp_anchor.h +1 -1
- package/runtime/src/regexp_message.h +1 -1
- package/runtime/src/shape.c +10 -19
- 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 +15 -12
- 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
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
// node:test's mocks: Node's lib/internal/test_runner/mock/mock.js (MIT; Node
|
|
2
|
+
// v22.22.2), ported: mock functions and methods (fn, method, getter, setter) with their calls,
|
|
3
|
+
// mocked properties (property), reset and restoreAll. Not here: mock.module(), which Node only
|
|
4
|
+
// has with --experimental-test-module-mocks and which needs a module loader at run time, and
|
|
5
|
+
// mock.timers, which throws ERR_VISALJS_UNSUPPORTED.
|
|
6
|
+
// Ported from Node.js (Copyright Node.js contributors, MIT): node/third_party/nodejs/LICENSE.
|
|
7
|
+
import { invalidArgType, invalidArgValue, notSupported, outOfRange, validateFunction } from "../errors.js";
|
|
8
|
+
|
|
9
|
+
function kDefaultFunction() {}
|
|
10
|
+
|
|
11
|
+
function validateObject(value, name) {
|
|
12
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw invalidArgType(name, "of type object", value);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function validateBoolean(value, name) {
|
|
16
|
+
if (typeof value !== "boolean") throw invalidArgType(name, "of type boolean", value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function validateInteger(value, name, min = Number.MIN_SAFE_INTEGER) {
|
|
20
|
+
if (typeof value !== "number") throw invalidArgType(name, "of type number", value);
|
|
21
|
+
if (!Number.isInteger(value)) throw outOfRange(name, "an integer", value);
|
|
22
|
+
if (value < min || value > Number.MAX_SAFE_INTEGER) throw outOfRange(name, `>= ${min} && <= ${Number.MAX_SAFE_INTEGER}`, value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function validateStringOrSymbol(value, name) {
|
|
26
|
+
if (typeof value !== "string" && typeof value !== "symbol") throw invalidArgType(name, "of type string or symbol", value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function validateTimes(value, name) {
|
|
30
|
+
if (value === Infinity) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
validateInteger(value, name, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class MockFunctionContext {
|
|
38
|
+
#calls;
|
|
39
|
+
#mocks;
|
|
40
|
+
#implementation;
|
|
41
|
+
#restore;
|
|
42
|
+
#times;
|
|
43
|
+
|
|
44
|
+
constructor(implementation, restore, times) {
|
|
45
|
+
this.#calls = [];
|
|
46
|
+
this.#mocks = new Map();
|
|
47
|
+
this.#implementation = implementation;
|
|
48
|
+
this.#restore = restore;
|
|
49
|
+
this.#times = times;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The recorded calls to the mock function. */
|
|
53
|
+
get calls() {
|
|
54
|
+
return this.#calls.slice(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The number of times the mock function has been called. */
|
|
58
|
+
callCount() {
|
|
59
|
+
return this.#calls.length;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A new implementation for the mock function. */
|
|
63
|
+
mockImplementation(implementation) {
|
|
64
|
+
validateFunction(implementation, "implementation");
|
|
65
|
+
this.#implementation = implementation;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Replaces the implementation for one call: the next, or the call numbered `onCall`. */
|
|
69
|
+
mockImplementationOnce(implementation, onCall) {
|
|
70
|
+
validateFunction(implementation, "implementation");
|
|
71
|
+
const nextCall = this.#calls.length;
|
|
72
|
+
const call = onCall ?? nextCall;
|
|
73
|
+
validateInteger(call, "onCall", nextCall);
|
|
74
|
+
this.#mocks.set(call, implementation);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Restores the original function that was mocked. */
|
|
78
|
+
restore() {
|
|
79
|
+
const { descriptor, object, original, methodName } = this.#restore;
|
|
80
|
+
|
|
81
|
+
if (typeof methodName === "string") {
|
|
82
|
+
// This is an object method spy.
|
|
83
|
+
Object.defineProperty(object, methodName, descriptor);
|
|
84
|
+
} else {
|
|
85
|
+
// This is a bare function spy. There isn't much to do here but make
|
|
86
|
+
// the mock call the original function.
|
|
87
|
+
this.#implementation = original;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Forgets the recorded calls. */
|
|
92
|
+
resetCalls() {
|
|
93
|
+
this.#calls = [];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
trackCall(call) {
|
|
97
|
+
this.#calls.push(call);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
nextImpl() {
|
|
101
|
+
const nextCall = this.#calls.length;
|
|
102
|
+
const mock = this.#mocks.get(nextCall);
|
|
103
|
+
const impl = mock ?? this.#implementation;
|
|
104
|
+
|
|
105
|
+
if (nextCall + 1 === this.#times) {
|
|
106
|
+
this.restore();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.#mocks.delete(nextCall);
|
|
110
|
+
return impl;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const { nextImpl, restore: restoreFn, trackCall } = MockFunctionContext.prototype;
|
|
115
|
+
delete MockFunctionContext.prototype.trackCall;
|
|
116
|
+
delete MockFunctionContext.prototype.nextImpl;
|
|
117
|
+
|
|
118
|
+
class MockPropertyContext {
|
|
119
|
+
#object;
|
|
120
|
+
#propertyName;
|
|
121
|
+
#value;
|
|
122
|
+
#originalValue;
|
|
123
|
+
#descriptor;
|
|
124
|
+
#accesses;
|
|
125
|
+
#onceValues;
|
|
126
|
+
|
|
127
|
+
constructor(object, propertyName, value) {
|
|
128
|
+
this.#onceValues = new Map();
|
|
129
|
+
this.#accesses = [];
|
|
130
|
+
this.#object = object;
|
|
131
|
+
this.#propertyName = propertyName;
|
|
132
|
+
this.#originalValue = object[propertyName];
|
|
133
|
+
this.#value = arguments.length > 2 ? value : this.#originalValue;
|
|
134
|
+
this.#descriptor = Object.getOwnPropertyDescriptor(object, propertyName);
|
|
135
|
+
if (!this.#descriptor) {
|
|
136
|
+
throw invalidArgValue("propertyName", "is not a property of the object", propertyName);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const { configurable, enumerable } = this.#descriptor;
|
|
140
|
+
Object.defineProperty(object, propertyName, {
|
|
141
|
+
configurable,
|
|
142
|
+
enumerable,
|
|
143
|
+
get: () => {
|
|
144
|
+
const nextValue = this.#getAccessValue(this.#value);
|
|
145
|
+
const access = { __proto__: null, type: "get", value: nextValue, stack: new Error() };
|
|
146
|
+
this.#accesses.push(access);
|
|
147
|
+
return nextValue;
|
|
148
|
+
},
|
|
149
|
+
set: this.mockImplementation.bind(this),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The recorded accesses (get and set) to the property. */
|
|
154
|
+
get accesses() {
|
|
155
|
+
return this.#accesses.slice(0);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** The number of times the property was accessed. */
|
|
159
|
+
accessCount() {
|
|
160
|
+
return this.#accesses.length;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A new value for the property. */
|
|
164
|
+
mockImplementation(value) {
|
|
165
|
+
if (!this.#descriptor.writable) {
|
|
166
|
+
throw invalidArgValue("propertyName", "cannot be set", this.#propertyName);
|
|
167
|
+
}
|
|
168
|
+
const nextValue = this.#getAccessValue(value);
|
|
169
|
+
const access = { __proto__: null, type: "set", value: nextValue, stack: new Error() };
|
|
170
|
+
this.#accesses.push(access);
|
|
171
|
+
this.#value = nextValue;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
#getAccessValue(value) {
|
|
175
|
+
const accessIndex = this.#accesses.length;
|
|
176
|
+
let accessValue;
|
|
177
|
+
if (this.#onceValues.has(accessIndex)) {
|
|
178
|
+
accessValue = this.#onceValues.get(accessIndex);
|
|
179
|
+
this.#onceValues.delete(accessIndex);
|
|
180
|
+
} else {
|
|
181
|
+
accessValue = value;
|
|
182
|
+
}
|
|
183
|
+
return accessValue;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** A value for one access only: the next, or the access numbered `onAccess`. */
|
|
187
|
+
mockImplementationOnce(value, onAccess) {
|
|
188
|
+
const nextAccess = this.#accesses.length;
|
|
189
|
+
const accessIndex = onAccess ?? nextAccess;
|
|
190
|
+
validateInteger(accessIndex, "onAccess", nextAccess);
|
|
191
|
+
this.#onceValues.set(accessIndex, value);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Forgets the recorded accesses. */
|
|
195
|
+
resetAccesses() {
|
|
196
|
+
this.#accesses = [];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Restores the property's original value. */
|
|
200
|
+
restore() {
|
|
201
|
+
Object.defineProperty(this.#object, this.#propertyName, { ...this.#descriptor, value: this.#originalValue });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const { restore: restoreProperty } = MockPropertyContext.prototype;
|
|
206
|
+
|
|
207
|
+
function findMethodOnPrototypeChain(instance, methodName) {
|
|
208
|
+
let host = instance;
|
|
209
|
+
let descriptor;
|
|
210
|
+
|
|
211
|
+
while (host !== null) {
|
|
212
|
+
descriptor = Object.getOwnPropertyDescriptor(host, methodName);
|
|
213
|
+
|
|
214
|
+
if (descriptor) {
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
host = Object.getPrototypeOf(host);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return descriptor;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export class MockTracker {
|
|
225
|
+
#mocks = [];
|
|
226
|
+
|
|
227
|
+
/** Node's mock timers: not supported yet. */
|
|
228
|
+
get timers() {
|
|
229
|
+
throw notSupported("mock.timers");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** A mock function: `original` called through, or `implementation` instead; options.times. */
|
|
233
|
+
fn(original = function () {}, implementation = original, options = {}) {
|
|
234
|
+
if (original !== null && typeof original === "object") {
|
|
235
|
+
options = original;
|
|
236
|
+
original = function () {};
|
|
237
|
+
implementation = original;
|
|
238
|
+
} else if (implementation !== null && typeof implementation === "object") {
|
|
239
|
+
options = implementation;
|
|
240
|
+
implementation = original;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
validateFunction(original, "original");
|
|
244
|
+
validateFunction(implementation, "implementation");
|
|
245
|
+
validateObject(options, "options");
|
|
246
|
+
const { times = Infinity } = options;
|
|
247
|
+
validateTimes(times, "options.times");
|
|
248
|
+
const ctx = new MockFunctionContext(implementation, { __proto__: null, original }, times);
|
|
249
|
+
return this.#setupMock(ctx, original);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Replaces a method (or with options.getter / options.setter, an accessor) with a mock. */
|
|
253
|
+
method(objectOrFunction, methodName, implementation = kDefaultFunction, options = {}) {
|
|
254
|
+
validateStringOrSymbol(methodName, "methodName");
|
|
255
|
+
if (typeof objectOrFunction !== "function") {
|
|
256
|
+
validateObject(objectOrFunction, "object");
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
260
|
+
options = implementation;
|
|
261
|
+
implementation = kDefaultFunction;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
validateFunction(implementation, "implementation");
|
|
265
|
+
validateObject(options, "options");
|
|
266
|
+
|
|
267
|
+
const { getter = false, setter = false, times = Infinity } = options;
|
|
268
|
+
|
|
269
|
+
validateBoolean(getter, "options.getter");
|
|
270
|
+
validateBoolean(setter, "options.setter");
|
|
271
|
+
validateTimes(times, "options.times");
|
|
272
|
+
|
|
273
|
+
if (setter && getter) {
|
|
274
|
+
throw invalidArgValue("options.setter", "cannot be used with 'options.getter'", setter);
|
|
275
|
+
}
|
|
276
|
+
const descriptor = findMethodOnPrototypeChain(objectOrFunction, methodName);
|
|
277
|
+
|
|
278
|
+
let original;
|
|
279
|
+
|
|
280
|
+
if (getter) {
|
|
281
|
+
original = descriptor?.get;
|
|
282
|
+
} else if (setter) {
|
|
283
|
+
original = descriptor?.set;
|
|
284
|
+
} else {
|
|
285
|
+
original = descriptor?.value;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (typeof original !== "function") {
|
|
289
|
+
throw invalidArgValue("methodName", "must be a method", original);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const restore = { __proto__: null, descriptor, object: objectOrFunction, methodName };
|
|
293
|
+
const impl = implementation === kDefaultFunction ? original : implementation;
|
|
294
|
+
const ctx = new MockFunctionContext(impl, restore, times);
|
|
295
|
+
const mock = this.#setupMock(ctx, original);
|
|
296
|
+
const mockDescriptor = { __proto__: null, configurable: descriptor.configurable, enumerable: descriptor.enumerable };
|
|
297
|
+
|
|
298
|
+
if (getter) {
|
|
299
|
+
mockDescriptor.get = mock;
|
|
300
|
+
mockDescriptor.set = descriptor.set;
|
|
301
|
+
} else if (setter) {
|
|
302
|
+
mockDescriptor.get = descriptor.get;
|
|
303
|
+
mockDescriptor.set = mock;
|
|
304
|
+
} else {
|
|
305
|
+
mockDescriptor.writable = descriptor.writable;
|
|
306
|
+
mockDescriptor.value = mock;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
Object.defineProperty(objectOrFunction, methodName, mockDescriptor);
|
|
310
|
+
|
|
311
|
+
return mock;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** method() for a getter. */
|
|
315
|
+
getter(object, methodName, implementation = kDefaultFunction, options = {}) {
|
|
316
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
317
|
+
options = implementation;
|
|
318
|
+
implementation = kDefaultFunction;
|
|
319
|
+
} else {
|
|
320
|
+
validateObject(options, "options");
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const { getter = true } = options;
|
|
324
|
+
|
|
325
|
+
if (getter === false) {
|
|
326
|
+
throw invalidArgValue("options.getter", "cannot be false", getter);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return this.method(object, methodName, implementation, { __proto__: null, ...options, getter });
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** method() for a setter. */
|
|
333
|
+
setter(object, methodName, implementation = kDefaultFunction, options = {}) {
|
|
334
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
335
|
+
options = implementation;
|
|
336
|
+
implementation = kDefaultFunction;
|
|
337
|
+
} else {
|
|
338
|
+
validateObject(options, "options");
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const { setter = true } = options;
|
|
342
|
+
|
|
343
|
+
if (setter === false) {
|
|
344
|
+
throw invalidArgValue("options.setter", "cannot be false", setter);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return this.method(object, methodName, implementation, { __proto__: null, ...options, setter });
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** A property whose value is `value` (or its own) and whose accesses are recorded. */
|
|
351
|
+
property(object, propertyName, value) {
|
|
352
|
+
validateObject(object, "object");
|
|
353
|
+
validateStringOrSymbol(propertyName, "propertyName");
|
|
354
|
+
|
|
355
|
+
const ctx = arguments.length > 2 ? new MockPropertyContext(object, propertyName, value) : new MockPropertyContext(object, propertyName);
|
|
356
|
+
this.#mocks.push({ __proto__: null, ctx, restore: restoreProperty });
|
|
357
|
+
|
|
358
|
+
return new Proxy(object, {
|
|
359
|
+
__proto__: null,
|
|
360
|
+
get(target, property, receiver) {
|
|
361
|
+
if (property === "mock") {
|
|
362
|
+
return ctx;
|
|
363
|
+
}
|
|
364
|
+
return Reflect.get(target, property, receiver);
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Restores every mock, and forgets them. */
|
|
370
|
+
reset() {
|
|
371
|
+
this.restoreAll();
|
|
372
|
+
this.#mocks = [];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Restores every mock this tracker made. */
|
|
376
|
+
restoreAll() {
|
|
377
|
+
for (let i = 0; i < this.#mocks.length; i++) {
|
|
378
|
+
const { ctx, restore } = this.#mocks[i];
|
|
379
|
+
|
|
380
|
+
restore.call(ctx);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
#setupMock(ctx, fnToMatch) {
|
|
385
|
+
const mock = new Proxy(fnToMatch, {
|
|
386
|
+
__proto__: null,
|
|
387
|
+
apply(_fn, thisArg, argList) {
|
|
388
|
+
const fn = nextImpl.call(ctx);
|
|
389
|
+
let result;
|
|
390
|
+
let error;
|
|
391
|
+
|
|
392
|
+
try {
|
|
393
|
+
result = Reflect.apply(fn, thisArg, argList);
|
|
394
|
+
} catch (err) {
|
|
395
|
+
error = err;
|
|
396
|
+
throw err;
|
|
397
|
+
} finally {
|
|
398
|
+
trackCall.call(ctx, { __proto__: null, arguments: argList, error, result, stack: new Error(), target: undefined, this: thisArg });
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return result;
|
|
402
|
+
},
|
|
403
|
+
construct(target, argList, newTarget) {
|
|
404
|
+
const realTarget = nextImpl.call(ctx);
|
|
405
|
+
let result;
|
|
406
|
+
let error;
|
|
407
|
+
|
|
408
|
+
try {
|
|
409
|
+
result = Reflect.construct(realTarget, argList, newTarget);
|
|
410
|
+
} catch (err) {
|
|
411
|
+
error = err;
|
|
412
|
+
throw err;
|
|
413
|
+
} finally {
|
|
414
|
+
trackCall.call(ctx, { __proto__: null, arguments: argList, error, result, stack: new Error(), target, this: result });
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return result;
|
|
418
|
+
},
|
|
419
|
+
get(target, property, receiver) {
|
|
420
|
+
if (property === "mock") {
|
|
421
|
+
return ctx;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return Reflect.get(target, property, receiver);
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
this.#mocks.push({ __proto__: null, ctx, restore: restoreFn });
|
|
429
|
+
return mock;
|
|
430
|
+
}
|
|
431
|
+
}
|