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
package/runtime/src/typedarray.c
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* Typed arrays (ECMAScript §23.2, §10.4.5), the typedarray component
|
|
1
|
+
/* Typed arrays (ECMAScript §23.2, §10.4.5), the typedarray component, which needs the
|
|
2
2
|
* arraybuffer component: %TypedArray%, its prototype's methods, and one constructor per element
|
|
3
|
-
* type. BigInt64Array and BigUint64Array exist when the bigint component does
|
|
3
|
+
* type. BigInt64Array and BigUint64Array exist when the bigint component does, which
|
|
4
4
|
* is installed before this one; their elements are 64-bit integers read and written as BigInts.
|
|
5
5
|
*
|
|
6
6
|
* A typed array is an integer-indexed exotic object. Its class hooks and internal methods
|
|
@@ -94,7 +94,7 @@ static double load_number(const JSTypedArray *ta, size_t i) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/* An element: a Number, or for BigInt64Array and BigUint64Array its 64 bits
|
|
97
|
+
/* An element: a Number, or for BigInt64Array and BigUint64Array its 64 bits. */
|
|
98
98
|
typedef union {
|
|
99
99
|
double num;
|
|
100
100
|
uint64_t raw;
|
|
@@ -1234,6 +1234,10 @@ static double hook_typed_array_length(JSValue v) {
|
|
|
1234
1234
|
return out_of_bounds(as_ta(v)) ? -1 : (double)ta_length(as_ta(v));
|
|
1235
1235
|
}
|
|
1236
1236
|
|
|
1237
|
+
static bool hook_view_bytes(JSValue v, uint8_t **data, size_t *length) {
|
|
1238
|
+
return !js_is_array_buffer(v) && js_buffer_source_bytes(v, data, length);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1237
1241
|
/* ---- Realm ----------------------------------------------------------------------------------- */
|
|
1238
1242
|
|
|
1239
1243
|
static const JSBuiltin typed_array_statics[] = {
|
|
@@ -1325,6 +1329,7 @@ static void install_typedarray(JSContext *ctx, JSObject *global) {
|
|
|
1325
1329
|
}
|
|
1326
1330
|
ctx->rt->is_typed_array = hook_is_typed_array;
|
|
1327
1331
|
ctx->rt->typed_array_length = hook_typed_array_length;
|
|
1332
|
+
ctx->rt->view_bytes = hook_view_bytes;
|
|
1328
1333
|
}
|
|
1329
1334
|
|
|
1330
1335
|
const JSComponent js_component_typedarray = { "typedarray", install_typedarray };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/* Generated by runtime/tools/gen_tznames.mjs from the ICU data of Node
|
|
1
|
+
/* Generated by runtime/tools/gen_tznames.mjs from the ICU data of Node v24.21.0. Do not edit. */
|
|
2
|
+
/* CLDR data, Copyright Unicode, Inc. (Unicode License v3): runtime/third_party/unicode/LICENSE. */
|
|
2
3
|
/* Each zone's standard and daylight names (indices into tz_names), sorted by zone id. */
|
|
3
4
|
static const char *const tz_names[] = {
|
|
4
5
|
"Greenwich Mean Time",
|
package/runtime/src/uri.c
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* The URI handling functions (§19.2.6): encodeURI, encodeURIComponent, decodeURI and
|
|
2
|
-
* decodeURIComponent. Core built-ins
|
|
2
|
+
* decodeURIComponent. Core built-ins: their entries are in js_core.def. */
|
|
3
3
|
#include "builtins_util.h"
|
|
4
4
|
|
|
5
5
|
#include <stdlib.h>
|
package/runtime/src/url.c
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* URL and URLSearchParams (WHATWG URL), the url component
|
|
1
|
+
/* URL and URLSearchParams (WHATWG URL), the url component, which needs nothing else.
|
|
2
2
|
* The basic URL parser is the standard's state machine, in C, on code points; hosts go
|
|
3
3
|
* through IDNA as Ada does it (runtime/third_party/ada-idna), so results match Node's, whose
|
|
4
|
-
* URL is Ada (
|
|
4
|
+
* URL is Ada (4.0.0 in Node v24). A record keeps each component serialized (ASCII): a
|
|
5
5
|
* non-opaque path is its serialization, "/a/b", whose segments are what the slashes delimit.
|
|
6
6
|
* The API is Node's: its errors, its inspection, and URLSearchParams' iteration. */
|
|
7
7
|
#include <stdio.h>
|
|
@@ -122,8 +122,8 @@ static bool in_set(int set, uint32_t c) {
|
|
|
122
122
|
case SET_USERINFO:
|
|
123
123
|
if (c == '/' || c == ':' || c == ';' || c == '=' || c == '@' || (c >= '[' && c <= '^') || c == '|') return true;
|
|
124
124
|
/* fallthrough */
|
|
125
|
-
case SET_PATH:
|
|
126
|
-
if (c == '?' || c == '`' || c == '{' || c == '}') return true;
|
|
125
|
+
case SET_PATH:
|
|
126
|
+
if (c == '?' || c == '^' || c == '`' || c == '{' || c == '}') return true;
|
|
127
127
|
/* fallthrough */
|
|
128
128
|
case SET_QUERY:
|
|
129
129
|
return c == ' ' || c == '"' || c == '#' || c == '<' || c == '>';
|
|
@@ -724,12 +724,6 @@ static bool basic_parse(const uint32_t *in, size_t n, const URLRecord *base, URL
|
|
|
724
724
|
p--;
|
|
725
725
|
state = ST_FILE_HOST;
|
|
726
726
|
} else if (c == ':' && !inside_brackets) {
|
|
727
|
-
if (buffer.n == 0 && override == ST_HOST && !is_special(url)) { /* Ada: host "" and a port */
|
|
728
|
-
buf_clear(&url->host);
|
|
729
|
-
url->has_host = true;
|
|
730
|
-
state = ST_PORT;
|
|
731
|
-
break;
|
|
732
|
-
}
|
|
733
727
|
if (buffer.n == 0) FAIL();
|
|
734
728
|
if (override == ST_HOSTNAME) FAIL();
|
|
735
729
|
if (!parse_host(buffer.v, buffer.n, !is_special(url), &url->host)) FAIL();
|
|
@@ -863,9 +857,8 @@ static bool basic_parse(const uint32_t *in, size_t n, const URLRecord *base, URL
|
|
|
863
857
|
if (c == END || c == '/' || (is_special(url) && c == '\\') || (!override && (c == '?' || c == '#'))) {
|
|
864
858
|
bool slash = c == '/' || (is_special(url) && c == '\\');
|
|
865
859
|
if (is_double_dot(&pbuf)) {
|
|
866
|
-
bool was_empty = url->path.n == 0; /* Ada: nothing to shorten adds no segment, unless special */
|
|
867
860
|
shorten_path(url);
|
|
868
|
-
if (!slash
|
|
861
|
+
if (!slash) path_append(url, "", 0);
|
|
869
862
|
} else if (is_single_dot(&pbuf) && !slash) {
|
|
870
863
|
path_append(url, "", 0);
|
|
871
864
|
} else if (!is_single_dot(&pbuf)) {
|
|
@@ -890,6 +883,11 @@ static bool basic_parse(const uint32_t *in, size_t n, const URLRecord *base, URL
|
|
|
890
883
|
}
|
|
891
884
|
break;
|
|
892
885
|
case ST_OPAQUE_PATH:
|
|
886
|
+
/* a space just before the query or fragment: %20, so the path doesn't end in one */
|
|
887
|
+
if ((c == '?' || c == '#') && url->path.n && url->path.v[url->path.n - 1] == ' ') {
|
|
888
|
+
url->path.v[--url->path.n] = '\0';
|
|
889
|
+
buf_append(&url->path, "%20", 3);
|
|
890
|
+
}
|
|
893
891
|
if (c == '?') {
|
|
894
892
|
buf_clear(&url->query);
|
|
895
893
|
url->has_query = true;
|
|
@@ -1088,14 +1086,14 @@ static ParamsObject *as_params(JSValue v) {
|
|
|
1088
1086
|
static JSValue buf_string(JSContext *ctx, const char *s, size_t n) { return js_new_string_latin1(ctx, (const uint8_t *)(s ? s : ""), (uint32_t)n); }
|
|
1089
1087
|
|
|
1090
1088
|
/* Appends a name/value pair to a params list. */
|
|
1091
|
-
static void params_append(ParamsObject *p, JSValue name, JSValue value) {
|
|
1089
|
+
static void params_append(JSContext *ctx, ParamsObject *p, JSValue name, JSValue value) {
|
|
1092
1090
|
if (p->n + 2 > p->cap) {
|
|
1093
1091
|
size_t cap = p->cap;
|
|
1094
1092
|
p->list = grow(p->list, &cap, p->n + 2, sizeof *p->list);
|
|
1095
1093
|
p->cap = (uint32_t)cap;
|
|
1096
1094
|
}
|
|
1097
|
-
p->list[p->n++]
|
|
1098
|
-
p->list[p->n++]
|
|
1095
|
+
js_store(ctx, &p->obj.cell, &p->list[p->n++], name);
|
|
1096
|
+
js_store(ctx, &p->obj.cell, &p->list[p->n++], value);
|
|
1099
1097
|
}
|
|
1100
1098
|
|
|
1101
1099
|
/* The application/x-www-form-urlencoded parser (URL §5.1) into a params list. */
|
|
@@ -1121,7 +1119,7 @@ static int params_parse(JSContext *ctx, ParamsObject *p, const uint8_t *in, size
|
|
|
1121
1119
|
free(name.v);
|
|
1122
1120
|
free(value.v);
|
|
1123
1121
|
if (js_is_exception(vs)) return -1;
|
|
1124
|
-
params_append(p, ns, vs);
|
|
1122
|
+
params_append(ctx, p, ns, vs);
|
|
1125
1123
|
}
|
|
1126
1124
|
if (!amp) break;
|
|
1127
1125
|
start = end + 1;
|
|
@@ -1487,11 +1485,16 @@ BUILTIN(url_set_port) {
|
|
|
1487
1485
|
CPs in = { 0 };
|
|
1488
1486
|
if (setter_input(ctx, ARG(0), &in) < 0) return JS_EXCEPTION;
|
|
1489
1487
|
if (!cannot_have_credentials(u->rec)) {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
else
|
|
1488
|
+
/* the empty string clears the port; anything else is parsed, its tabs and newlines removed
|
|
1489
|
+
first (only those: nothing changes) */
|
|
1490
|
+
if (in.n == 0) {
|
|
1491
|
+
u->rec->port = -1;
|
|
1492
|
+
} else {
|
|
1493
|
+
size_t k = 0;
|
|
1494
|
+
for (size_t i = 0; i < in.n; i++)
|
|
1495
|
+
if (in.v[i] != '\t' && in.v[i] != '\n' && in.v[i] != '\r') in.v[k++] = in.v[i];
|
|
1496
|
+
if (k) parse_override(ctx, in.v, k, u->rec, ST_PORT);
|
|
1497
|
+
}
|
|
1495
1498
|
}
|
|
1496
1499
|
free(in.v);
|
|
1497
1500
|
return JS_UNDEFINED;
|
|
@@ -1552,7 +1555,7 @@ BUILTIN(url_search_params) {
|
|
|
1552
1555
|
THIS_URL();
|
|
1553
1556
|
if (js_is_empty(u->search_params)) {
|
|
1554
1557
|
JSValue p = new_params(ctx, ctx->intrinsics[JS_INTRINSIC_URL_SEARCH_PARAMS_PROTOTYPE]);
|
|
1555
|
-
js_store(ctx, &
|
|
1558
|
+
js_store(ctx, &js_as_object(p)->cell, &((ParamsObject *)js_as_object(p))->url, this_val);
|
|
1556
1559
|
js_store(ctx, &u->obj.cell, &u->search_params, p);
|
|
1557
1560
|
if (refresh_params(ctx, u) < 0) return JS_EXCEPTION;
|
|
1558
1561
|
}
|
|
@@ -1651,7 +1654,7 @@ static int pair_from_iterable(JSContext *ctx, ParamsObject *p, JSValue pair) {
|
|
|
1651
1654
|
if (js_is_exception(name) || js_is_exception(name = to_usv(ctx, name))) return -1;
|
|
1652
1655
|
JSValue value = js_get_value(ctx, pair, js_int32(1));
|
|
1653
1656
|
if (js_is_exception(value) || js_is_exception(value = to_usv(ctx, value))) return -1;
|
|
1654
|
-
params_append(p, name, value);
|
|
1657
|
+
params_append(ctx, p, name, value);
|
|
1655
1658
|
return 0;
|
|
1656
1659
|
}
|
|
1657
1660
|
if (!js_is_object(pair)) goto bad;
|
|
@@ -1673,7 +1676,7 @@ static int pair_from_iterable(JSContext *ctx, ParamsObject *p, JSValue pair) {
|
|
|
1673
1676
|
p->list = grow(p->list, &cap, p->n + 1, sizeof *p->list);
|
|
1674
1677
|
p->cap = (uint32_t)cap;
|
|
1675
1678
|
}
|
|
1676
|
-
p->list[p->n++]
|
|
1679
|
+
js_store(ctx, &p->obj.cell, &p->list[p->n++], e);
|
|
1677
1680
|
}
|
|
1678
1681
|
if (length != 2) goto bad;
|
|
1679
1682
|
return 0;
|
|
@@ -1691,13 +1694,13 @@ BUILTIN(params_ctor) {
|
|
|
1691
1694
|
JSValue self = new_params(ctx, proto);
|
|
1692
1695
|
ParamsObject *p = (ParamsObject *)js_as_object(self);
|
|
1693
1696
|
JSValue init = ARG(0);
|
|
1694
|
-
if (
|
|
1697
|
+
if (js_is_undefined(init)) return self; /* null is the string "null" (Node 24, the standard) */
|
|
1695
1698
|
if (js_is_object(init)) {
|
|
1696
1699
|
ParamsObject *other = as_params(init);
|
|
1697
1700
|
JSValue method = js_get_value(ctx, init, JS_SYMBOL(iterator));
|
|
1698
1701
|
if (js_is_exception(method)) return method;
|
|
1699
1702
|
if (other && js_same_bits(method, ctx->intrinsics[JS_INTRINSIC_URL_SEARCH_PARAMS_ENTRIES])) {
|
|
1700
|
-
for (uint32_t i = 0; i < other->n; i += 2) params_append(p, other->list[i], other->list[i + 1]);
|
|
1703
|
+
for (uint32_t i = 0; i < other->n; i += 2) params_append(ctx, p, other->list[i], other->list[i + 1]);
|
|
1701
1704
|
return self;
|
|
1702
1705
|
}
|
|
1703
1706
|
if (!js_is_nullish(method)) { /* sequence<sequence<USVString>> */
|
|
@@ -1729,8 +1732,8 @@ BUILTIN(params_ctor) {
|
|
|
1729
1732
|
if (js_is_exception(value) || js_is_exception(value = to_usv(ctx, value))) return JS_EXCEPTION;
|
|
1730
1733
|
uint32_t k = 0;
|
|
1731
1734
|
while (k < p->n && !js_string_equals(ctx, p->list[k], name)) k += 2;
|
|
1732
|
-
if (k < p->n) p->list[k + 1]
|
|
1733
|
-
else params_append(p, name, value);
|
|
1735
|
+
if (k < p->n) js_store(ctx, &p->obj.cell, &p->list[k + 1], value);
|
|
1736
|
+
else params_append(ctx, p, name, value);
|
|
1734
1737
|
}
|
|
1735
1738
|
return self;
|
|
1736
1739
|
}
|
|
@@ -1767,7 +1770,7 @@ BUILTIN(params_append_method) {
|
|
|
1767
1770
|
if (js_is_exception(name)) return name;
|
|
1768
1771
|
JSValue value = to_usv(ctx, argv[1]);
|
|
1769
1772
|
if (js_is_exception(value)) return value;
|
|
1770
|
-
params_append(sp, name, value);
|
|
1773
|
+
params_append(ctx, sp, name, value);
|
|
1771
1774
|
update_url(ctx, sp);
|
|
1772
1775
|
return JS_UNDEFINED;
|
|
1773
1776
|
}
|
|
@@ -1800,8 +1803,8 @@ BUILTIN(params_delete) {
|
|
|
1800
1803
|
uint32_t k = 0;
|
|
1801
1804
|
for (uint32_t i = 0; i < sp->n; i += 2) {
|
|
1802
1805
|
if (pair_matches(ctx, sp, i, name, value)) continue;
|
|
1803
|
-
sp->list[k++] = sp->list[i];
|
|
1804
|
-
sp->list[k++] = sp->list[i + 1];
|
|
1806
|
+
sp->list[k++] = sp->list[i]; /* barrier: same owner */
|
|
1807
|
+
sp->list[k++] = sp->list[i + 1]; /* barrier: same owner */
|
|
1805
1808
|
}
|
|
1806
1809
|
sp->n = k;
|
|
1807
1810
|
update_url(ctx, sp);
|
|
@@ -1855,13 +1858,13 @@ BUILTIN(params_set) {
|
|
|
1855
1858
|
if (js_string_equals(ctx, sp->list[i], name)) {
|
|
1856
1859
|
if (found) continue;
|
|
1857
1860
|
found = true;
|
|
1858
|
-
sp->list[i + 1]
|
|
1861
|
+
js_store(ctx, &sp->obj.cell, &sp->list[i + 1], value);
|
|
1859
1862
|
}
|
|
1860
|
-
sp->list[k++] = sp->list[i];
|
|
1861
|
-
sp->list[k++] = sp->list[i + 1];
|
|
1863
|
+
sp->list[k++] = sp->list[i]; /* barrier: same owner */
|
|
1864
|
+
sp->list[k++] = sp->list[i + 1]; /* barrier: same owner */
|
|
1862
1865
|
}
|
|
1863
1866
|
sp->n = k;
|
|
1864
|
-
if (!found) params_append(sp, name, value);
|
|
1867
|
+
if (!found) params_append(ctx, sp, name, value);
|
|
1865
1868
|
update_url(ctx, sp);
|
|
1866
1869
|
return JS_UNDEFINED;
|
|
1867
1870
|
}
|
|
@@ -1874,12 +1877,12 @@ BUILTIN(params_sort) {
|
|
|
1874
1877
|
JSValue name = sp->list[i], value = sp->list[i + 1];
|
|
1875
1878
|
uint32_t k = i;
|
|
1876
1879
|
while (k > 0 && js_string_compare(ctx, sp->list[k - 2], name) > 0) {
|
|
1877
|
-
sp->list[k] = sp->list[k - 2];
|
|
1878
|
-
sp->list[k + 1] = sp->list[k - 1];
|
|
1880
|
+
sp->list[k] = sp->list[k - 2]; /* barrier: same owner */
|
|
1881
|
+
sp->list[k + 1] = sp->list[k - 1]; /* barrier: same owner */
|
|
1879
1882
|
k -= 2;
|
|
1880
1883
|
}
|
|
1881
|
-
sp->list[k] = name;
|
|
1882
|
-
sp->list[k + 1] = value;
|
|
1884
|
+
sp->list[k] = name; /* barrier: same owner */
|
|
1885
|
+
sp->list[k + 1] = value; /* barrier: same owner */
|
|
1883
1886
|
}
|
|
1884
1887
|
update_url(ctx, sp);
|
|
1885
1888
|
return JS_UNDEFINED;
|
package/runtime/src/weak.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Weak collections and references (ECMAScript §24.3–24.4, §26.1–26.2
|
|
1
|
+
/* Weak collections and references (ECMAScript §24.3–24.4, §26.1–26.2): WeakMap
|
|
2
2
|
* and WeakSet (ephemerons), WeakRef with the kept-alive set, FinalizationRegistry.
|
|
3
3
|
*
|
|
4
4
|
* Each such object keeps its weak slots in malloc'd memory its class visit doesn't trace,
|
|
@@ -59,8 +59,10 @@ typedef struct WeakEntry {
|
|
|
59
59
|
|
|
60
60
|
typedef struct WeakTable {
|
|
61
61
|
JSObject obj;
|
|
62
|
-
WeakEntry *entries; /* malloc'd; NULL until the first key */
|
|
62
|
+
WeakEntry *entries; /* malloc'd, the heap's external memory; NULL until the first key */
|
|
63
63
|
uint32_t cap, count, used; /* used: count + tombstones */
|
|
64
|
+
uint32_t writes; /* entries set since the last collection, listed in rt->weak_writes */
|
|
65
|
+
bool all_written; /* too many to list: a young collection looks at every entry */
|
|
64
66
|
} WeakTable;
|
|
65
67
|
|
|
66
68
|
static uint32_t hash_key(JSValue k) {
|
|
@@ -83,10 +85,30 @@ static void insert_fresh(WeakEntry *entries, uint32_t cap, JSValue key, JSValue
|
|
|
83
85
|
entries[i] = (WeakEntry){ key, value };
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
/* Lists an entry set since the last collection. An entry set before has an old key and an old
|
|
89
|
+
* value (the last collection marked both, or dropped the entry), so a young collection can't free
|
|
90
|
+
* either: it looks only at the listed ones (js_weak_ephemerons, js_weak_sweep). Past a quarter of
|
|
91
|
+
* the table, the table is listed whole instead, which bounds the list. */
|
|
92
|
+
static void note_write(JSRuntime *rt, WeakTable *t, JSValue key) {
|
|
93
|
+
if (t->all_written) return;
|
|
94
|
+
if (t->writes >= 64 && t->writes >= t->count / 4) {
|
|
95
|
+
t->all_written = true;
|
|
96
|
+
key = JS_EMPTY;
|
|
97
|
+
}
|
|
98
|
+
t->writes++;
|
|
99
|
+
struct JSWeakWrites *l = &rt->weak_writes;
|
|
100
|
+
if (l->count == l->cap) {
|
|
101
|
+
l->cap = l->cap ? l->cap * 2 : 64;
|
|
102
|
+
l->items = xrealloc(l->items, l->cap * sizeof *l->items);
|
|
103
|
+
}
|
|
104
|
+
l->items[l->count++] = (struct JSWeakWrite){ &t->obj, key };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static void table_set(JSContext *ctx, WeakTable *t, JSValue key, JSValue value) {
|
|
108
|
+
note_write(ctx->rt, t, key);
|
|
87
109
|
WeakEntry *e = find(t, key);
|
|
88
110
|
if (e) {
|
|
89
|
-
e->value = value; /* malloc'd memory: no write barrier
|
|
111
|
+
e->value = value; /* malloc'd memory: no write barrier */
|
|
90
112
|
return;
|
|
91
113
|
}
|
|
92
114
|
if ((t->used + 1) * 4 > t->cap * 3) { /* grow (or just drop tombstones) at 3/4 */
|
|
@@ -99,6 +121,7 @@ static void table_set(WeakTable *t, JSValue key, JSValue value) {
|
|
|
99
121
|
if (!js_is_empty(k) && !js_same_bits(k, TOMBSTONE)) insert_fresh(entries, cap, k, t->entries[i].value);
|
|
100
122
|
}
|
|
101
123
|
free(t->entries);
|
|
124
|
+
js_gc_external_add(ctx->rt, ((size_t)cap - t->cap) * sizeof *entries); /* external memory */
|
|
102
125
|
t->entries = entries;
|
|
103
126
|
t->cap = cap;
|
|
104
127
|
t->used = t->count;
|
|
@@ -118,8 +141,9 @@ static bool table_delete(WeakTable *t, JSValue key) {
|
|
|
118
141
|
}
|
|
119
142
|
|
|
120
143
|
static void table_finalize(JSRuntime *rt, JSCell *c) {
|
|
121
|
-
(
|
|
122
|
-
|
|
144
|
+
WeakTable *t = (WeakTable *)c;
|
|
145
|
+
js_gc_external_sub(rt, (size_t)t->cap * sizeof *t->entries);
|
|
146
|
+
free(t->entries);
|
|
123
147
|
}
|
|
124
148
|
|
|
125
149
|
static const JSClass weak_map_class = { "WeakMap", sizeof(WeakTable), NULL, NULL, NULL, NULL, NULL, table_finalize, NULL };
|
|
@@ -200,7 +224,7 @@ BUILTIN(weak_map_set) {
|
|
|
200
224
|
WeakTable *t = this_table(ctx, this_val, &weak_map_class, "WeakMap.prototype.set");
|
|
201
225
|
if (!t) return JS_EXCEPTION;
|
|
202
226
|
if (!can_be_held_weakly(ARG(0))) return js_throw_type_error(ctx, "Invalid value used as weak map key");
|
|
203
|
-
table_set(t, ARG(0), ARG(1));
|
|
227
|
+
table_set(ctx, t, ARG(0), ARG(1));
|
|
204
228
|
return this_val;
|
|
205
229
|
}
|
|
206
230
|
|
|
@@ -209,7 +233,7 @@ BUILTIN(weak_set_add) {
|
|
|
209
233
|
WeakTable *t = this_table(ctx, this_val, &weak_set_class, "WeakSet.prototype.add");
|
|
210
234
|
if (!t) return JS_EXCEPTION;
|
|
211
235
|
if (!can_be_held_weakly(ARG(0))) return js_throw_type_error(ctx, "Invalid value used in weak set");
|
|
212
|
-
if (!find(t, ARG(0))) table_set(t, ARG(0), JS_UNDEFINED);
|
|
236
|
+
if (!find(t, ARG(0))) table_set(ctx, t, ARG(0), JS_UNDEFINED);
|
|
213
237
|
return this_val;
|
|
214
238
|
}
|
|
215
239
|
BUILTIN(weak_set_has) {
|
|
@@ -333,7 +357,8 @@ BUILTIN(registry_register) {
|
|
|
333
357
|
r->cap = r->cap ? r->cap * 2 : 8;
|
|
334
358
|
r->cells = xrealloc(r->cells, r->cap * sizeof *r->cells);
|
|
335
359
|
}
|
|
336
|
-
r->cells[r->count++] = (Registration){ target, held, token };
|
|
360
|
+
r->cells[r->count++] = (Registration){ target, held, token }; /* barrier: below */
|
|
361
|
+
js_write_barrier(ctx, &r->obj.cell, NULL, held); /* target and token are weak */
|
|
337
362
|
return JS_UNDEFINED;
|
|
338
363
|
}
|
|
339
364
|
|
|
@@ -347,7 +372,7 @@ BUILTIN(registry_unregister) {
|
|
|
347
372
|
uint32_t n = 0;
|
|
348
373
|
for (uint32_t i = 0; i < r->count; i++) {
|
|
349
374
|
if (js_same_bits(r->cells[i].token, token)) removed = true;
|
|
350
|
-
else r->cells[n++] = r->cells[i];
|
|
375
|
+
else r->cells[n++] = r->cells[i]; /* barrier: same owner */
|
|
351
376
|
}
|
|
352
377
|
r->count = n;
|
|
353
378
|
return js_bool(removed);
|
|
@@ -363,7 +388,7 @@ static int cleanup_registry(Registry *r) {
|
|
|
363
388
|
continue;
|
|
364
389
|
}
|
|
365
390
|
JSValue held = r->cells[i].held; /* on the C stack: still alive after the removal */
|
|
366
|
-
r->cells[i] = r->cells[--r->count];
|
|
391
|
+
r->cells[i] = r->cells[--r->count]; /* barrier: same owner */
|
|
367
392
|
JSValue result = js_call(ctx, r->cleanup, JS_UNDEFINED, 1, &held);
|
|
368
393
|
if (js_is_exception(result)) return -1;
|
|
369
394
|
i = 0; /* the callback may have registered or unregistered */
|
|
@@ -371,7 +396,7 @@ static int cleanup_registry(Registry *r) {
|
|
|
371
396
|
return 0;
|
|
372
397
|
}
|
|
373
398
|
|
|
374
|
-
/* The host's FINALIZATION_CLEANUP tasks
|
|
399
|
+
/* The host's FINALIZATION_CLEANUP tasks: one registry at a time, each followed by
|
|
375
400
|
* a checkpoint. 0, or -1 after an uncaught error (reported). */
|
|
376
401
|
int js_run_finalization_cleanups(JSContext *ctx) {
|
|
377
402
|
JSRuntime *rt = ctx->rt;
|
|
@@ -389,27 +414,83 @@ int js_run_finalization_cleanups(JSContext *ctx) {
|
|
|
389
414
|
|
|
390
415
|
/* ---- The collector's side (gc.c) ------------------------------------------------------- */
|
|
391
416
|
|
|
392
|
-
/*
|
|
393
|
-
|
|
394
|
-
|
|
417
|
+
/* An entry's ephemeron step: its value marked when its key is. Returns whether it marked it. */
|
|
418
|
+
static bool mark_value(JSTracer *trc, const WeakEntry *e) {
|
|
419
|
+
if (!js_is_cell(e->key) || !js_gc_is_marked(js_as_cell(e->key)) || is_live(e->value)) return false;
|
|
420
|
+
js_trace_value(trc, e->value);
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
static bool mark_values(JSTracer *trc, const WeakTable *t) {
|
|
395
425
|
bool marked = false;
|
|
396
|
-
for (
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
426
|
+
for (uint32_t k = 0; k < t->cap; k++) marked |= mark_value(trc, &t->entries[k]);
|
|
427
|
+
return marked;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/* Drops the entry if its key died. */
|
|
431
|
+
static void sweep_entry(WeakTable *t, WeakEntry *e) {
|
|
432
|
+
if (js_is_cell(e->key) && !js_gc_is_marked(js_as_cell(e->key))) {
|
|
433
|
+
e->key = TOMBSTONE;
|
|
434
|
+
e->value = JS_UNDEFINED;
|
|
435
|
+
t->count--;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
static void sweep_entries(WeakTable *t) {
|
|
440
|
+
for (uint32_t k = 0; k < t->cap; k++) sweep_entry(t, &t->entries[k]);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/* The ephemeron pass: marks the value of every live WeakMap entry whose key is marked; a young
|
|
444
|
+
* collection, of the entries set since the last collection (note_write). true if anything new was
|
|
445
|
+
* marked (the caller drains and calls again). */
|
|
446
|
+
bool js_weak_ephemerons(JSRuntime *rt, JSTracer *trc, bool full) {
|
|
447
|
+
bool marked = false;
|
|
448
|
+
if (full) {
|
|
449
|
+
for (size_t i = 0; i < rt->weak.count; i++) {
|
|
450
|
+
JSObject *o = rt->weak.items[i];
|
|
451
|
+
if (o->shape->cls == &weak_map_class && js_gc_is_marked(&o->cell)) marked |= mark_values(trc, (WeakTable *)o);
|
|
452
|
+
}
|
|
453
|
+
return marked;
|
|
454
|
+
}
|
|
455
|
+
for (size_t i = 0; i < rt->weak_writes.count; i++) {
|
|
456
|
+
struct JSWeakWrite w = rt->weak_writes.items[i];
|
|
457
|
+
if (w.table->shape->cls != &weak_map_class || !js_gc_is_marked(&w.table->cell)) continue;
|
|
458
|
+
WeakTable *t = (WeakTable *)w.table;
|
|
459
|
+
if (js_is_empty(w.key)) {
|
|
460
|
+
marked |= mark_values(trc, t);
|
|
461
|
+
} else {
|
|
462
|
+
WeakEntry *e = find(t, w.key);
|
|
463
|
+
if (e) marked |= mark_value(trc, e);
|
|
405
464
|
}
|
|
406
465
|
}
|
|
407
466
|
return marked;
|
|
408
467
|
}
|
|
409
468
|
|
|
410
|
-
/* After marking: forget dead containers, drop dead keys
|
|
411
|
-
* queue the registrations whose
|
|
412
|
-
|
|
469
|
+
/* After marking: forget dead containers, drop dead keys (a young collection: of the entries set
|
|
470
|
+
* since the last collection), clear dead WeakRef targets, and queue the registrations whose
|
|
471
|
+
* target died. Then the list of entries set starts anew. */
|
|
472
|
+
void js_weak_sweep(JSRuntime *rt, bool full) {
|
|
473
|
+
struct JSWeakWrites *writes = &rt->weak_writes;
|
|
474
|
+
if (!full) {
|
|
475
|
+
for (size_t i = 0; i < writes->count; i++) {
|
|
476
|
+
struct JSWeakWrite w = writes->items[i];
|
|
477
|
+
if (!js_gc_is_marked(&w.table->cell)) continue; /* dead: its entries go with it */
|
|
478
|
+
WeakTable *t = (WeakTable *)w.table;
|
|
479
|
+
if (js_is_empty(w.key)) {
|
|
480
|
+
sweep_entries(t);
|
|
481
|
+
} else {
|
|
482
|
+
WeakEntry *e = find(t, w.key);
|
|
483
|
+
if (e) sweep_entry(t, e);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
for (size_t i = 0; i < writes->count; i++) { /* dead tables too: they're finalized later */
|
|
488
|
+
WeakTable *t = (WeakTable *)writes->items[i].table;
|
|
489
|
+
t->writes = 0;
|
|
490
|
+
t->all_written = false;
|
|
491
|
+
}
|
|
492
|
+
writes->count = 0;
|
|
493
|
+
|
|
413
494
|
struct JSWeakList *l = &rt->weak;
|
|
414
495
|
size_t n = 0;
|
|
415
496
|
for (size_t i = 0; i < l->count; i++) {
|
|
@@ -418,15 +499,7 @@ void js_weak_sweep(JSRuntime *rt) {
|
|
|
418
499
|
l->items[n++] = o;
|
|
419
500
|
const JSClass *cls = o->shape->cls;
|
|
420
501
|
if (cls == &weak_map_class || cls == &weak_set_class) {
|
|
421
|
-
|
|
422
|
-
for (uint32_t k = 0; k < t->cap; k++) {
|
|
423
|
-
WeakEntry *e = &t->entries[k];
|
|
424
|
-
if (js_is_cell(e->key) && !js_gc_is_marked(js_as_cell(e->key))) {
|
|
425
|
-
e->key = TOMBSTONE;
|
|
426
|
-
e->value = JS_UNDEFINED;
|
|
427
|
-
t->count--;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
502
|
+
if (full) sweep_entries((WeakTable *)o);
|
|
430
503
|
} else if (cls == &weak_ref_class) {
|
|
431
504
|
WeakRef *w = (WeakRef *)o;
|
|
432
505
|
if (!is_live(w->target)) w->target = JS_UNDEFINED;
|
|
@@ -451,6 +524,7 @@ void js_weak_trace_roots(JSRuntime *rt, JSTracer *trc) {
|
|
|
451
524
|
|
|
452
525
|
void js_weak_free(JSRuntime *rt) {
|
|
453
526
|
free(rt->weak.items);
|
|
527
|
+
free(rt->weak_writes.items);
|
|
454
528
|
free(rt->kept_alive.items);
|
|
455
529
|
}
|
|
456
530
|
|
package/runtime/src/web.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Node's error shapes for the web-standard host layer
|
|
1
|
+
/* Node's error shapes for the web-standard host layer, written in C for the
|
|
2
2
|
* components that throw them (the prelude has the same in JS, node/prelude/internal/errors.js). */
|
|
3
3
|
#include "js_web.h"
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include "internal.h"
|
|
12
12
|
#include "js_bigint.h"
|
|
13
13
|
#include "js_console.h"
|
|
14
|
+
#include "js_host.h"
|
|
14
15
|
#include "js_symbol.h"
|
|
15
16
|
#include "js_atoms.h"
|
|
16
17
|
#include "js_convert.h"
|
|
@@ -70,8 +71,8 @@ void js_node_received(JSContext *ctx, JSValue v, char *buf, size_t cap) {
|
|
|
70
71
|
} else if (js_is_function(v)) {
|
|
71
72
|
JSValue n = js_get_value(ctx, v, JS_ATOM(name));
|
|
72
73
|
if (js_is_exception(n)) js_discard(js_take_exception(ctx));
|
|
73
|
-
if (js_is_string(n)
|
|
74
|
-
else
|
|
74
|
+
if (js_is_string(n)) to_utf8(ctx, n, s, sizeof s);
|
|
75
|
+
else s[0] = '\0'; /* determineSpecificType: `function ${value.name}`, empty when anonymous */
|
|
75
76
|
snprintf(buf, cap, " Received function %s", s);
|
|
76
77
|
} else if (js_is_object(v)) {
|
|
77
78
|
if (constructor_name(ctx, v, s, sizeof s)) snprintf(buf, cap, " Received an instance of %s", s);
|
|
@@ -212,3 +213,20 @@ JSValue js_decode_utf8_bytes(JSContext *ctx, const uint8_t *p, size_t n) {
|
|
|
212
213
|
return s;
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
|
|
217
|
+
/* cloneClass(value): an object's internal class, as structuredClone (node/prelude/internal/
|
|
218
|
+
* structured_clone.js) sorts values: "Object" (an ordinary object, a class instance's too),
|
|
219
|
+
* "Array", "Date", "Map", "TypedArray", "Proxy", "Arguments", "Function", a primitive wrapper's
|
|
220
|
+
* type ("Number", "String", …), a web class's name ("URL", "Blob", …); undefined for a primitive. */
|
|
221
|
+
JSValue js_host_clone_class(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc, const JSValue *argv, JSValue new_target) {
|
|
222
|
+
UNUSED_ARGS;
|
|
223
|
+
JSValue v = ARG(0);
|
|
224
|
+
if (!js_is_object(v)) return JS_UNDEFINED;
|
|
225
|
+
if (js_is_function(v)) return js_new_string_cstr(ctx, "Function");
|
|
226
|
+
if (js_is_wrapper(v)) {
|
|
227
|
+
JSValue p = js_wrapped_value(v);
|
|
228
|
+
return js_new_string_cstr(ctx, js_is_string(p) ? "String" : js_is_number(p) ? "Number" : js_is_bool(p) ? "Boolean"
|
|
229
|
+
: js_is_bigint(p) ? "BigInt" : "Symbol");
|
|
230
|
+
}
|
|
231
|
+
return js_new_string_cstr(ctx, js_as_object(v)->shape->cls->name);
|
|
232
|
+
}
|
package/runtime/src/wrapper.c
CHANGED
|
File without changes
|
package/runtime/src/writable.c
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* WritableStream and TransformStream (WHATWG Streams §5, §6), and ReadableStream's pipeTo and
|
|
2
|
-
* pipeThrough (§4.9.4), in the streams component
|
|
2
|
+
* pipeThrough (§4.9.4), in the streams component, as Node has them. The
|
|
3
3
|
* algorithms are the standard's, named as it names them: a writable stream's queue holds the
|
|
4
4
|
* chunks written and the close request (EMPTY), its controller hands them to the sink one at a
|
|
5
5
|
* time, and backpressure follows the queue's size against the highWaterMark. A transform stream
|
|
@@ -165,7 +165,7 @@ static WController *controller_of(WStream *s) { return as_wcontroller(s->control
|
|
|
165
165
|
static bool close_queued_or_in_flight(WStream *s) { return !js_is_undefined(s->close_request) || !js_is_undefined(s->in_flight_close); }
|
|
166
166
|
static bool has_operation_in_flight(WStream *s) { return !js_is_undefined(s->in_flight_write) || !js_is_undefined(s->in_flight_close); }
|
|
167
167
|
|
|
168
|
-
static void queue_push(WController *k, JSValue chunk, double size) {
|
|
168
|
+
static void queue_push(JSContext *ctx, WController *k, JSValue chunk, double size) {
|
|
169
169
|
if (k->head > 0 && k->n == k->cap) {
|
|
170
170
|
memmove(k->queue, k->queue + k->head, (k->n - k->head) * sizeof *k->queue);
|
|
171
171
|
k->n -= k->head;
|
|
@@ -178,8 +178,9 @@ static void queue_push(WController *k, JSValue chunk, double size) {
|
|
|
178
178
|
k->queue = q;
|
|
179
179
|
k->cap = cap;
|
|
180
180
|
}
|
|
181
|
-
k->queue[k->n++] = chunk;
|
|
182
|
-
k->
|
|
181
|
+
k->queue[k->n++] = chunk; /* barrier: below */
|
|
182
|
+
js_write_barrier(ctx, &k->obj.cell, NULL, chunk);
|
|
183
|
+
k->queue[k->n++] = js_number(size); /* barrier: not a cell */
|
|
183
184
|
k->queue_size += size;
|
|
184
185
|
}
|
|
185
186
|
static bool queue_empty(const WController *k) { return k->head == k->n; }
|
|
@@ -426,7 +427,7 @@ static JSValue stream_close(JSContext *ctx, WStream *s) {
|
|
|
426
427
|
Writer *w = as_writer(s->writer);
|
|
427
428
|
if (w && s->backpressure && s->state == W_WRITABLE) resolve(ctx, w->ready, JS_UNDEFINED);
|
|
428
429
|
WController *k = controller_of(s);
|
|
429
|
-
queue_push(k, JS_EMPTY, 0);
|
|
430
|
+
queue_push(ctx, k, JS_EMPTY, 0);
|
|
430
431
|
advance_queue_if_needed(ctx, k);
|
|
431
432
|
return promise;
|
|
432
433
|
}
|
|
@@ -458,7 +459,7 @@ static JSValue writer_write(JSContext *ctx, Writer *w, JSValue chunk) {
|
|
|
458
459
|
error_if_needed(ctx, k, js_new_error(ctx, JS_RANGE_ERROR, js_new_string_cstr(ctx, "Invalid size")));
|
|
459
460
|
return promise;
|
|
460
461
|
}
|
|
461
|
-
queue_push(k, chunk, size);
|
|
462
|
+
queue_push(ctx, k, chunk, size);
|
|
462
463
|
if (!close_queued_or_in_flight(s) && s->state == W_WRITABLE) update_backpressure(ctx, s, desired_size(k) <= 0);
|
|
463
464
|
advance_queue_if_needed(ctx, k);
|
|
464
465
|
return promise;
|
|
File without changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# ada-idna
|
|
2
2
|
|
|
3
3
|
UTS #46 domain-to-ASCII from [Ada](https://github.com/ada-url/ada) by Yagiz Nizipli and Daniel
|
|
4
|
-
Lemire, the URL library Node uses, ported to C: `URL` hosts come out exactly as Node's
|
|
4
|
+
Lemire, the URL library Node uses, ported to C: `URL` hosts come out exactly as Node's.
|
|
5
5
|
MIT license (`LICENSE-MIT`; Ada is also Apache-2.0).
|
|
6
6
|
|
|
7
|
-
- **Upstream:** `src/ada_idna.cpp` of Ada **
|
|
8
|
-
`
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
first code point, status and mapping length in 32 bits, the mapping's index apart),
|
|
12
|
-
classes, and the code point sets of the label rules as ranges.
|
|
7
|
+
- **Upstream:** `src/ada_idna.cpp` of Ada **v4.0.0**, the version Node v24 bundles
|
|
8
|
+
(`process.versions.ada`); IDNA 17.0.0.
|
|
9
|
+
- **`idna_tables.h`** is generated by `convert.mjs` from that file: Ada keeps its tables in a
|
|
10
|
+
raw-DEFLATE blob, which the script inflates and reads as Ada does, into the mapping table
|
|
11
|
+
(packed: first code point, status and mapping length in 32 bits, the mapping's index apart),
|
|
12
|
+
the bidi classes, and the code point sets of the label rules as ranges.
|
|
13
13
|
- **`idna.c`** is the algorithm (mapping, punycode, label validity, to-ASCII), converted by hand
|
|
14
14
|
from C++ to C step for step, Ada's quirks included (they are Node's behavior). Normalization to
|
|
15
15
|
NFC uses QuickJS's libunicode (`third_party/quickjs-regexp`) instead of Ada's tables.
|