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,291 @@
|
|
|
1
|
+
/* Host primitives for the program's own process (node:process beyond the runtime's process object):
|
|
2
|
+
* the working directory, the file mode mask, uptime, CPU and resource usage, the parent, memory
|
|
3
|
+
* limits, user and group ids (POSIX), abort, exit and execve. Child processes are host_process.c's.
|
|
4
|
+
*
|
|
5
|
+
* procChdir(path) → 0 | -errno procUmask(mask | -1) → the old mask (-1: only read it)
|
|
6
|
+
* procUptime() → seconds since the program started
|
|
7
|
+
* procCpuUsage(thread) → [user µs, system µs] | -errno procResourceUsage() → [16 numbers] | -errno
|
|
8
|
+
* procPpid() → pid procMemory() → [available, constrained] bytes
|
|
9
|
+
* procSetId(kind, id) → 0 | -errno kind 0 setuid, 1 setgid, 2 seteuid, 3 setegid
|
|
10
|
+
* procUserId(name) → id | -1 procGroupId(name) → id | -1
|
|
11
|
+
* procUserName(id) → name | null procGetGroups() → [gid, …] | -errno
|
|
12
|
+
* procSetGroups([gid, …]) → 0 | -errno procInitGroups(user, gid) → 0 | -errno
|
|
13
|
+
* procAbort() procReallyExit(code): output flushed, no 'exit'
|
|
14
|
+
* procExecve(file, [arg, …], [key=value, …]) → -errno (it returns only when it fails) */
|
|
15
|
+
#define _POSIX_C_SOURCE 200809L
|
|
16
|
+
#define _DEFAULT_SOURCE /* getgroups, setgroups, initgroups */
|
|
17
|
+
#define _DARWIN_C_SOURCE /* the same, on macOS */
|
|
18
|
+
#include "js_node.h"
|
|
19
|
+
|
|
20
|
+
#include <errno.h>
|
|
21
|
+
#include <stdio.h>
|
|
22
|
+
#include <stdlib.h>
|
|
23
|
+
#include <string.h>
|
|
24
|
+
#include <sys/stat.h>
|
|
25
|
+
#include <uv.h>
|
|
26
|
+
#ifdef _WIN32
|
|
27
|
+
#include <io.h>
|
|
28
|
+
#else
|
|
29
|
+
#include <grp.h>
|
|
30
|
+
#include <pwd.h>
|
|
31
|
+
#include <unistd.h>
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#include "js_atoms.h"
|
|
35
|
+
#include "js_buffer.h"
|
|
36
|
+
#include "js_convert.h"
|
|
37
|
+
#include "js_exception.h"
|
|
38
|
+
#include "js_object.h"
|
|
39
|
+
#include "jscontext.h"
|
|
40
|
+
#include "jsstring.h"
|
|
41
|
+
|
|
42
|
+
#define HOST_FN(name) JSValue name(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc, const JSValue *argv, JSValue new_target)
|
|
43
|
+
#define UNUSED (void)ctx, (void)callee, (void)this_val, (void)new_target
|
|
44
|
+
|
|
45
|
+
/* when the program started: set before main, in a program that links this file */
|
|
46
|
+
static uint64_t start_ns;
|
|
47
|
+
__attribute__((constructor)) static void record_start(void) { start_ns = uv_hrtime(); }
|
|
48
|
+
|
|
49
|
+
/* A string argument as UTF-8, malloc'd; NULL for anything else. */
|
|
50
|
+
static char *string_arg(JSContext *ctx, JSValue v) {
|
|
51
|
+
if (!js_is_string(v)) return NULL;
|
|
52
|
+
JSStrView view = js_string_view(ctx, v);
|
|
53
|
+
size_t n = js_view_to_utf8(view, NULL, 0);
|
|
54
|
+
char *s = malloc(n + 1);
|
|
55
|
+
if (!s) js_fatal("out of memory");
|
|
56
|
+
js_view_to_utf8(view, s, n);
|
|
57
|
+
s[n] = '\0';
|
|
58
|
+
return s;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static JSValue numbers(JSContext *ctx, const double *v, uint32_t n) {
|
|
62
|
+
JSValue values[16];
|
|
63
|
+
for (uint32_t i = 0; i < n; i++) values[i] = js_number(v[i]);
|
|
64
|
+
return js_new_array_from(ctx, values, n);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
HOST_FN(js_host_proc_chdir) {
|
|
68
|
+
UNUSED;
|
|
69
|
+
char *path = argc > 0 ? string_arg(ctx, argv[0]) : NULL;
|
|
70
|
+
if (!path) return js_int32(UV_EINVAL);
|
|
71
|
+
int r = uv_chdir(path);
|
|
72
|
+
free(path);
|
|
73
|
+
return js_int32(r);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
HOST_FN(js_host_proc_umask) {
|
|
77
|
+
UNUSED;
|
|
78
|
+
int mask = argc > 0 && js_is_int32(argv[0]) ? js_as_int32(argv[0]) : -1;
|
|
79
|
+
if (mask < 0) { /* read: set it, then back */
|
|
80
|
+
int old = (int)umask(0);
|
|
81
|
+
umask((mode_t)old);
|
|
82
|
+
return js_int32(old);
|
|
83
|
+
}
|
|
84
|
+
return js_int32((int)umask((mode_t)(mask & 0777)));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
HOST_FN(js_host_proc_uptime) {
|
|
88
|
+
UNUSED, (void)argc, (void)argv;
|
|
89
|
+
return js_number((double)(uv_hrtime() - start_ns) / 1e9);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static double usec(uv_timeval_t t) { return (double)t.tv_sec * 1e6 + (double)t.tv_usec; }
|
|
93
|
+
|
|
94
|
+
HOST_FN(js_host_proc_cpu_usage) {
|
|
95
|
+
UNUSED;
|
|
96
|
+
uv_rusage_t ru;
|
|
97
|
+
int r = argc > 0 && js_truthy(argv[0]) ? uv_getrusage_thread(&ru) : uv_getrusage(&ru);
|
|
98
|
+
if (r < 0) return js_int32(r);
|
|
99
|
+
double v[2] = { usec(ru.ru_utime), usec(ru.ru_stime) };
|
|
100
|
+
return numbers(ctx, v, 2);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* in Node's order: userCPUTime, systemCPUTime, maxRSS (KiB), sharedMemorySize, unsharedDataSize,
|
|
104
|
+
* unsharedStackSize, minorPageFault, majorPageFault, swappedOut, fsRead, fsWrite, ipcSent,
|
|
105
|
+
* ipcReceived, signalsCount, voluntaryContextSwitches, involuntaryContextSwitches */
|
|
106
|
+
HOST_FN(js_host_proc_resource_usage) {
|
|
107
|
+
UNUSED, (void)argc, (void)argv;
|
|
108
|
+
uv_rusage_t ru;
|
|
109
|
+
int r = uv_getrusage(&ru);
|
|
110
|
+
if (r < 0) return js_int32(r);
|
|
111
|
+
double v[16] = {
|
|
112
|
+
usec(ru.ru_utime), usec(ru.ru_stime), (double)ru.ru_maxrss, (double)ru.ru_ixrss, (double)ru.ru_idrss, (double)ru.ru_isrss,
|
|
113
|
+
(double)ru.ru_minflt, (double)ru.ru_majflt, (double)ru.ru_nswap, (double)ru.ru_inblock, (double)ru.ru_oublock,
|
|
114
|
+
(double)ru.ru_msgsnd, (double)ru.ru_msgrcv, (double)ru.ru_nsignals, (double)ru.ru_nvcsw, (double)ru.ru_nivcsw,
|
|
115
|
+
};
|
|
116
|
+
return numbers(ctx, v, 16);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
HOST_FN(js_host_proc_ppid) {
|
|
120
|
+
UNUSED, (void)argc, (void)argv;
|
|
121
|
+
return js_number((double)uv_os_getppid());
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
HOST_FN(js_host_proc_memory) {
|
|
125
|
+
UNUSED, (void)argc, (void)argv;
|
|
126
|
+
double v[2] = { (double)uv_get_available_memory(), (double)uv_get_constrained_memory() };
|
|
127
|
+
return numbers(ctx, v, 2);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
HOST_FN(js_host_proc_abort) {
|
|
131
|
+
UNUSED, (void)argc, (void)argv;
|
|
132
|
+
fflush(stdout);
|
|
133
|
+
fflush(stderr);
|
|
134
|
+
abort();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
HOST_FN(js_host_proc_really_exit) {
|
|
138
|
+
UNUSED;
|
|
139
|
+
int code = argc > 0 && js_is_int32(argv[0]) ? js_as_int32(argv[0]) : 0;
|
|
140
|
+
fflush(stdout);
|
|
141
|
+
fflush(stderr);
|
|
142
|
+
exit(code);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
#ifndef _WIN32
|
|
146
|
+
|
|
147
|
+
HOST_FN(js_host_proc_set_id) {
|
|
148
|
+
UNUSED;
|
|
149
|
+
if (argc < 2 || !js_is_int32(argv[0]) || !js_is_number(argv[1])) return js_int32(UV_EINVAL);
|
|
150
|
+
double d = js_as_number(argv[1]);
|
|
151
|
+
int r;
|
|
152
|
+
switch (js_as_int32(argv[0])) {
|
|
153
|
+
case 0: r = setuid((uid_t)d); break;
|
|
154
|
+
case 1: r = setgid((gid_t)d); break;
|
|
155
|
+
case 2: r = seteuid((uid_t)d); break;
|
|
156
|
+
case 3: r = setegid((gid_t)d); break;
|
|
157
|
+
default: return js_int32(UV_EINVAL);
|
|
158
|
+
}
|
|
159
|
+
return js_int32(r < 0 ? -errno : 0);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
HOST_FN(js_host_proc_user_id) {
|
|
163
|
+
UNUSED;
|
|
164
|
+
char *name = argc > 0 ? string_arg(ctx, argv[0]) : NULL;
|
|
165
|
+
if (!name) return js_int32(-1);
|
|
166
|
+
struct passwd *pw = getpwnam(name);
|
|
167
|
+
free(name);
|
|
168
|
+
return pw ? js_number((double)pw->pw_uid) : js_int32(-1);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
HOST_FN(js_host_proc_group_id) {
|
|
172
|
+
UNUSED;
|
|
173
|
+
char *name = argc > 0 ? string_arg(ctx, argv[0]) : NULL;
|
|
174
|
+
if (!name) return js_int32(-1);
|
|
175
|
+
struct group *gr = getgrnam(name);
|
|
176
|
+
free(name);
|
|
177
|
+
return gr ? js_number((double)gr->gr_gid) : js_int32(-1);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
HOST_FN(js_host_proc_user_name) {
|
|
181
|
+
UNUSED;
|
|
182
|
+
if (argc < 1 || !js_is_number(argv[0])) return JS_NULL;
|
|
183
|
+
struct passwd *pw = getpwuid((uid_t)js_as_number(argv[0]));
|
|
184
|
+
return pw ? js_new_string_cstr(ctx, pw->pw_name) : JS_NULL;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
HOST_FN(js_host_proc_get_groups) {
|
|
188
|
+
UNUSED, (void)argc, (void)argv;
|
|
189
|
+
int n = getgroups(0, NULL);
|
|
190
|
+
if (n < 0) return js_int32(-errno);
|
|
191
|
+
gid_t *groups = malloc(((size_t)n + 1) * sizeof *groups);
|
|
192
|
+
if (!groups) js_fatal("out of memory");
|
|
193
|
+
n = getgroups(n, groups);
|
|
194
|
+
if (n < 0) {
|
|
195
|
+
free(groups);
|
|
196
|
+
return js_int32(-errno);
|
|
197
|
+
}
|
|
198
|
+
/* the effective group too, as Node lists it */
|
|
199
|
+
gid_t egid = getegid();
|
|
200
|
+
bool listed = false;
|
|
201
|
+
for (int i = 0; i < n; i++) listed |= groups[i] == egid;
|
|
202
|
+
if (!listed) groups[n++] = egid;
|
|
203
|
+
JSValue list = js_new_array(ctx, (uint32_t)n);
|
|
204
|
+
for (int i = 0; i < n && !js_is_exception(list); i++) {
|
|
205
|
+
if (js_array_push(ctx, js_as_object(list), js_number((double)groups[i])) < 0) list = JS_EXCEPTION;
|
|
206
|
+
}
|
|
207
|
+
free(groups);
|
|
208
|
+
return list;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
HOST_FN(js_host_proc_set_groups) {
|
|
212
|
+
UNUSED;
|
|
213
|
+
if (argc < 1 || !js_is_object(argv[0])) return js_int32(UV_EINVAL);
|
|
214
|
+
JSValue len = js_get_value(ctx, argv[0], JS_ATOM(length));
|
|
215
|
+
if (!js_is_number(len)) return js_int32(UV_EINVAL);
|
|
216
|
+
size_t n = (size_t)js_as_number(len);
|
|
217
|
+
gid_t *groups = malloc((n + 1) * sizeof *groups);
|
|
218
|
+
if (!groups) js_fatal("out of memory");
|
|
219
|
+
for (size_t i = 0; i < n; i++) {
|
|
220
|
+
JSValue v = js_get_index(ctx, argv[0], js_int32((int32_t)i));
|
|
221
|
+
if (!js_is_number(v)) {
|
|
222
|
+
free(groups);
|
|
223
|
+
return js_int32(UV_EINVAL);
|
|
224
|
+
}
|
|
225
|
+
groups[i] = (gid_t)js_as_number(v);
|
|
226
|
+
}
|
|
227
|
+
int r = setgroups(n, groups);
|
|
228
|
+
free(groups);
|
|
229
|
+
return js_int32(r < 0 ? -errno : 0);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
HOST_FN(js_host_proc_init_groups) {
|
|
233
|
+
UNUSED;
|
|
234
|
+
char *user = argc > 0 ? string_arg(ctx, argv[0]) : NULL;
|
|
235
|
+
if (!user || argc < 2 || !js_is_number(argv[1])) {
|
|
236
|
+
free(user);
|
|
237
|
+
return js_int32(UV_EINVAL);
|
|
238
|
+
}
|
|
239
|
+
int r = initgroups(user, (gid_t)js_as_number(argv[1]));
|
|
240
|
+
free(user);
|
|
241
|
+
return js_int32(r < 0 ? -errno : 0);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* the strings of an array, NULL-terminated, malloc'd */
|
|
245
|
+
static char **string_list(JSContext *ctx, JSValue array) {
|
|
246
|
+
if (!js_is_object(array)) return NULL;
|
|
247
|
+
JSValue len = js_get_value(ctx, array, JS_ATOM(length));
|
|
248
|
+
size_t n = js_is_number(len) ? (size_t)js_as_number(len) : 0;
|
|
249
|
+
char **list = calloc(n + 1, sizeof *list);
|
|
250
|
+
if (!list) js_fatal("out of memory");
|
|
251
|
+
for (size_t i = 0; i < n; i++) {
|
|
252
|
+
list[i] = string_arg(ctx, js_get_index(ctx, array, js_int32((int32_t)i)));
|
|
253
|
+
if (!list[i]) list[i] = strdup("");
|
|
254
|
+
}
|
|
255
|
+
return list;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static void free_list(char **list) {
|
|
259
|
+
for (size_t i = 0; list && list[i]; i++) free(list[i]);
|
|
260
|
+
free(list);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
HOST_FN(js_host_proc_execve) {
|
|
264
|
+
UNUSED;
|
|
265
|
+
char *file = argc > 0 ? string_arg(ctx, argv[0]) : NULL;
|
|
266
|
+
char **args = argc > 1 ? string_list(ctx, argv[1]) : NULL;
|
|
267
|
+
char **env = argc > 2 ? string_list(ctx, argv[2]) : NULL;
|
|
268
|
+
if (!file || !args || !env) {
|
|
269
|
+
free(file), free_list(args), free_list(env);
|
|
270
|
+
return js_int32(UV_EINVAL);
|
|
271
|
+
}
|
|
272
|
+
fflush(stdout);
|
|
273
|
+
fflush(stderr);
|
|
274
|
+
execve(file, args, env);
|
|
275
|
+
int e = errno;
|
|
276
|
+
free(file), free_list(args), free_list(env);
|
|
277
|
+
return js_int32(-e);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
#else /* Windows: Node has none of these */
|
|
281
|
+
|
|
282
|
+
HOST_FN(js_host_proc_set_id) { UNUSED, (void)argc, (void)argv; return js_int32(UV_ENOSYS); }
|
|
283
|
+
HOST_FN(js_host_proc_user_id) { UNUSED, (void)argc, (void)argv; return js_int32(-1); }
|
|
284
|
+
HOST_FN(js_host_proc_group_id) { UNUSED, (void)argc, (void)argv; return js_int32(-1); }
|
|
285
|
+
HOST_FN(js_host_proc_user_name) { UNUSED, (void)argc, (void)argv; return JS_NULL; }
|
|
286
|
+
HOST_FN(js_host_proc_get_groups) { UNUSED, (void)argc, (void)argv; return js_int32(UV_ENOSYS); }
|
|
287
|
+
HOST_FN(js_host_proc_set_groups) { UNUSED, (void)argc, (void)argv; return js_int32(UV_ENOSYS); }
|
|
288
|
+
HOST_FN(js_host_proc_init_groups) { UNUSED, (void)argc, (void)argv; return js_int32(UV_ENOSYS); }
|
|
289
|
+
HOST_FN(js_host_proc_execve) { UNUSED, (void)argc, (void)argv; return js_int32(UV_ENOSYS); }
|
|
290
|
+
|
|
291
|
+
#endif
|