visaljs 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +45 -2
- package/cli.js +8084 -0
- package/node/include/js_node.h +46 -0
- package/node/prelude/async_hooks.js +88 -0
- package/node/prelude/buffer.js +31 -0
- package/node/prelude/crypto.js +114 -0
- package/node/prelude/events.js +227 -0
- package/node/prelude/fs.js +79 -0
- package/node/prelude/http.js +536 -0
- package/node/prelude/http2.js +30 -0
- package/node/prelude/internal/crypto/asym.js +333 -0
- package/node/prelude/internal/crypto/cipher.js +205 -0
- package/node/prelude/internal/crypto/hash.js +137 -0
- package/node/prelude/internal/crypto/kdf.js +182 -0
- package/node/prelude/internal/crypto/keys.js +603 -0
- package/node/prelude/internal/crypto/random.js +118 -0
- package/node/prelude/internal/crypto/util.js +76 -0
- package/node/prelude/internal/errors.js +88 -0
- package/node/prelude/internal/querystring.js +105 -0
- package/node/prelude/module.js +53 -0
- package/node/prelude/net.js +51 -0
- package/node/prelude/os.js +129 -0
- package/node/prelude/path.js +257 -0
- package/node/prelude/process.js +21 -0
- package/node/prelude/querystring.js +469 -0
- package/node/prelude/stream.js +1327 -0
- package/node/prelude/stream_promises.js +7 -0
- package/node/prelude/stream_web.js +6 -0
- package/node/prelude/string_decoder.js +236 -0
- package/node/prelude/tty.js +18 -0
- package/node/prelude/url.js +1156 -0
- package/node/prelude/util.js +64 -0
- package/node/prelude/zlib.js +81 -0
- package/node/src/host_fs.c +126 -0
- package/node/src/host_http.c +486 -0
- package/node/src/host_os.c +505 -0
- package/node/src/host_sys.c +78 -0
- package/node/third_party/libuv/LICENSE +19 -0
- package/node/third_party/libuv/include/uv/aix.h +32 -0
- package/node/third_party/libuv/include/uv/bsd.h +34 -0
- package/node/third_party/libuv/include/uv/darwin.h +61 -0
- package/node/third_party/libuv/include/uv/errno.h +483 -0
- package/node/third_party/libuv/include/uv/linux.h +34 -0
- package/node/third_party/libuv/include/uv/os390.h +33 -0
- package/node/third_party/libuv/include/uv/posix.h +31 -0
- package/node/third_party/libuv/include/uv/sunos.h +44 -0
- package/node/third_party/libuv/include/uv/threadpool.h +37 -0
- package/node/third_party/libuv/include/uv/tree.h +521 -0
- package/node/third_party/libuv/include/uv/unix.h +512 -0
- package/node/third_party/libuv/include/uv/version.h +43 -0
- package/node/third_party/libuv/include/uv/win.h +698 -0
- package/node/third_party/libuv/include/uv.h +1990 -0
- package/node/third_party/libuv/src/fs-poll.c +290 -0
- package/node/third_party/libuv/src/heap-inl.h +245 -0
- package/node/third_party/libuv/src/idna.c +560 -0
- package/node/third_party/libuv/src/idna.h +31 -0
- package/node/third_party/libuv/src/inet.c +298 -0
- package/node/third_party/libuv/src/queue.h +90 -0
- package/node/third_party/libuv/src/random.c +123 -0
- package/node/third_party/libuv/src/strscpy.c +38 -0
- package/node/third_party/libuv/src/strscpy.h +39 -0
- package/node/third_party/libuv/src/strtok.c +52 -0
- package/node/third_party/libuv/src/strtok.h +27 -0
- package/node/third_party/libuv/src/thread-common.c +175 -0
- package/node/third_party/libuv/src/threadpool.c +419 -0
- package/node/third_party/libuv/src/timer.c +200 -0
- package/node/third_party/libuv/src/unix/async.c +418 -0
- package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +164 -0
- package/node/third_party/libuv/src/unix/core.c +2104 -0
- package/node/third_party/libuv/src/unix/darwin-proctitle.c +176 -0
- package/node/third_party/libuv/src/unix/darwin-stub.h +97 -0
- package/node/third_party/libuv/src/unix/darwin-syscalls.h +17 -0
- package/node/third_party/libuv/src/unix/darwin.c +237 -0
- package/node/third_party/libuv/src/unix/dl.c +80 -0
- package/node/third_party/libuv/src/unix/fs.c +2303 -0
- package/node/third_party/libuv/src/unix/fsevents.c +906 -0
- package/node/third_party/libuv/src/unix/getaddrinfo.c +252 -0
- package/node/third_party/libuv/src/unix/getnameinfo.c +121 -0
- package/node/third_party/libuv/src/unix/internal.h +530 -0
- package/node/third_party/libuv/src/unix/kqueue.c +667 -0
- package/node/third_party/libuv/src/unix/linux.c +2761 -0
- package/node/third_party/libuv/src/unix/loop-watcher.c +68 -0
- package/node/third_party/libuv/src/unix/loop.c +240 -0
- package/node/third_party/libuv/src/unix/pipe.c +555 -0
- package/node/third_party/libuv/src/unix/poll.c +159 -0
- package/node/third_party/libuv/src/unix/process.c +1123 -0
- package/node/third_party/libuv/src/unix/procfs-exepath.c +45 -0
- package/node/third_party/libuv/src/unix/proctitle.c +157 -0
- package/node/third_party/libuv/src/unix/random-devurandom.c +93 -0
- package/node/third_party/libuv/src/unix/random-getentropy.c +57 -0
- package/node/third_party/libuv/src/unix/random-getrandom.c +86 -0
- package/node/third_party/libuv/src/unix/random-sysctl-linux.c +99 -0
- package/node/third_party/libuv/src/unix/signal.c +581 -0
- package/node/third_party/libuv/src/unix/stream.c +1567 -0
- package/node/third_party/libuv/src/unix/tcp.c +673 -0
- package/node/third_party/libuv/src/unix/thread.c +975 -0
- package/node/third_party/libuv/src/unix/tty.c +510 -0
- package/node/third_party/libuv/src/unix/udp.c +1434 -0
- package/node/third_party/libuv/src/uv-common.c +1051 -0
- package/node/third_party/libuv/src/uv-common.h +474 -0
- package/node/third_party/libuv/src/uv-data-getter-setters.c +119 -0
- package/node/third_party/libuv/src/version.c +45 -0
- package/node/third_party/llhttp/LICENSE +22 -0
- package/node/third_party/llhttp/api.c +509 -0
- package/node/third_party/llhttp/http.c +170 -0
- package/node/third_party/llhttp/llhttp.c +10099 -0
- package/node/third_party/llhttp/llhttp.h +907 -0
- package/package.json +25 -4
- package/runtime/include/js_atoms.gen.h +68 -0
- package/runtime/include/js_atoms.h +54 -0
- package/runtime/include/js_bigint.h +93 -0
- package/runtime/include/js_buffer.h +79 -0
- package/runtime/include/js_builtins.h +168 -0
- package/runtime/include/js_console.h +58 -0
- package/runtime/include/js_convert.h +22 -0
- package/runtime/include/js_core.def +188 -0
- package/runtime/include/js_crypto.h +58 -0
- package/runtime/include/js_error.h +37 -0
- package/runtime/include/js_exception.h +65 -0
- package/runtime/include/js_function.h +167 -0
- package/runtime/include/js_gc.h +195 -0
- package/runtime/include/js_generator.h +96 -0
- package/runtime/include/js_host.h +19 -0
- package/runtime/include/js_jobs.h +84 -0
- package/runtime/include/js_module.h +16 -0
- package/runtime/include/js_object.h +384 -0
- package/runtime/include/js_ops.h +111 -0
- package/runtime/include/js_promise.h +45 -0
- package/runtime/include/js_regexp.h +25 -0
- package/runtime/include/js_runtime.h +30 -0
- package/runtime/include/js_symbol.h +62 -0
- package/runtime/include/js_web.h +110 -0
- package/runtime/include/jscell.h +48 -0
- package/runtime/include/jscontext.h +240 -0
- package/runtime/include/jsnum.h +42 -0
- package/runtime/include/jsstring.h +161 -0
- package/runtime/include/jsvalue.h +142 -0
- package/runtime/src/arguments.c +115 -0
- package/runtime/src/array.c +1145 -0
- package/runtime/src/arraybuffer.c +608 -0
- package/runtime/src/async_iter.c +479 -0
- package/runtime/src/atoms.c +157 -0
- package/runtime/src/base64.c +107 -0
- package/runtime/src/bigint.c +1189 -0
- package/runtime/src/blob.c +371 -0
- package/runtime/src/buffer.c +1357 -0
- package/runtime/src/builtin_table.c +100 -0
- package/runtime/src/builtins.c +987 -0
- package/runtime/src/builtins_util.h +53 -0
- package/runtime/src/collections.c +912 -0
- package/runtime/src/components.c +28 -0
- package/runtime/src/console.c +637 -0
- package/runtime/src/convert.c +82 -0
- package/runtime/src/core_all.c +21 -0
- package/runtime/src/crypto.c +116 -0
- package/runtime/src/crypto_asym.c +644 -0
- package/runtime/src/crypto_cipher.c +671 -0
- package/runtime/src/crypto_hash.c +260 -0
- package/runtime/src/crypto_host.c +414 -0
- package/runtime/src/crypto_internal.h +304 -0
- package/runtime/src/crypto_kdf.c +143 -0
- package/runtime/src/crypto_key.c +171 -0
- package/runtime/src/crypto_pkey.c +794 -0
- package/runtime/src/crypto_subtle.c +1675 -0
- package/runtime/src/date.c +940 -0
- package/runtime/src/domexception.c +169 -0
- package/runtime/src/elements.c +312 -0
- package/runtime/src/elements.h +45 -0
- package/runtime/src/encoding.c +485 -0
- package/runtime/src/error.c +297 -0
- package/runtime/src/events.c +793 -0
- package/runtime/src/exception.c +56 -0
- package/runtime/src/fetch.c +772 -0
- package/runtime/src/function.c +530 -0
- package/runtime/src/gc.c +803 -0
- package/runtime/src/generator.c +218 -0
- package/runtime/src/global.c +119 -0
- package/runtime/src/headers.c +557 -0
- package/runtime/src/inspect.c +1792 -0
- package/runtime/src/internal.h +80 -0
- package/runtime/src/iterate.c +94 -0
- package/runtime/src/iterator.c +409 -0
- package/runtime/src/jobs.c +337 -0
- package/runtime/src/jsnum.c +353 -0
- package/runtime/src/json.c +1028 -0
- package/runtime/src/math.c +243 -0
- package/runtime/src/module.c +336 -0
- package/runtime/src/number.c +176 -0
- package/runtime/src/object.c +1265 -0
- package/runtime/src/ops.c +322 -0
- package/runtime/src/os.c +196 -0
- package/runtime/src/os.h +29 -0
- package/runtime/src/process.c +432 -0
- package/runtime/src/promise.c +721 -0
- package/runtime/src/proxy.c +570 -0
- package/runtime/src/reflect.c +194 -0
- package/runtime/src/regexp.c +1141 -0
- package/runtime/src/regexp_anchor.h +34 -0
- package/runtime/src/regexp_message.h +32 -0
- package/runtime/src/shape.c +294 -0
- package/runtime/src/shape.h +46 -0
- package/runtime/src/streams.c +1046 -0
- package/runtime/src/streams.h +47 -0
- package/runtime/src/string.c +364 -0
- package/runtime/src/string_builtins.c +837 -0
- package/runtime/src/symbol.c +143 -0
- package/runtime/src/test_host.c +59 -0
- package/runtime/src/typedarray.c +1330 -0
- package/runtime/src/tznames.gen.h +712 -0
- package/runtime/src/uri.c +169 -0
- package/runtime/src/url.c +2116 -0
- package/runtime/src/weak.c +486 -0
- package/runtime/src/web.c +214 -0
- package/runtime/src/wrapper.c +59 -0
- package/runtime/src/writable.c +1486 -0
- package/runtime/third_party/ada-idna/LICENSE-MIT +18 -0
- package/runtime/third_party/ada-idna/README.md +27 -0
- package/runtime/third_party/ada-idna/convert.mjs +83 -0
- package/runtime/third_party/ada-idna/idna.c +416 -0
- package/runtime/third_party/ada-idna/idna.h +15 -0
- package/runtime/third_party/ada-idna/idna_tables.h +2657 -0
- package/runtime/third_party/bearssl/LICENSE.txt +21 -0
- package/runtime/third_party/bearssl/README.txt +136 -0
- package/runtime/third_party/bearssl/VERSION +1 -0
- package/runtime/third_party/bearssl/inc/bearssl.h +183 -0
- package/runtime/third_party/bearssl/inc/bearssl_aead.h +1059 -0
- package/runtime/third_party/bearssl/inc/bearssl_block.h +2618 -0
- package/runtime/third_party/bearssl/inc/bearssl_ec.h +967 -0
- package/runtime/third_party/bearssl/inc/bearssl_hash.h +1346 -0
- package/runtime/third_party/bearssl/inc/bearssl_hmac.h +241 -0
- package/runtime/third_party/bearssl/inc/bearssl_kdf.h +284 -0
- package/runtime/third_party/bearssl/inc/bearssl_pem.h +294 -0
- package/runtime/third_party/bearssl/inc/bearssl_prf.h +150 -0
- package/runtime/third_party/bearssl/inc/bearssl_rand.h +397 -0
- package/runtime/third_party/bearssl/inc/bearssl_rsa.h +1655 -0
- package/runtime/third_party/bearssl/inc/bearssl_ssl.h +4296 -0
- package/runtime/third_party/bearssl/inc/bearssl_x509.h +1474 -0
- package/runtime/third_party/bearssl/src/aead/ccm.c +346 -0
- package/runtime/third_party/bearssl/src/aead/eax.c +525 -0
- package/runtime/third_party/bearssl/src/aead/gcm.c +318 -0
- package/runtime/third_party/bearssl/src/codec/ccopy.c +44 -0
- package/runtime/third_party/bearssl/src/codec/dec16be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec16le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec32be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec32le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec64be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/dec64le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc16be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc16le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc32be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc32le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc64be.c +38 -0
- package/runtime/third_party/bearssl/src/codec/enc64le.c +38 -0
- package/runtime/third_party/bearssl/src/codec/pemdec.c +526 -0
- package/runtime/third_party/bearssl/src/codec/pemdec.t0 +314 -0
- package/runtime/third_party/bearssl/src/codec/pemenc.c +173 -0
- package/runtime/third_party/bearssl/src/config.h +247 -0
- package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +121 -0
- package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +171 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +398 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +390 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +1478 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +800 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +605 -0
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +831 -0
- package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +46 -0
- package/runtime/third_party/bearssl/src/ec/ec_default.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ec_keygen.c +86 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +2124 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +1469 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +1765 -0
- package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +1781 -0
- package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +824 -0
- package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +826 -0
- package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +85 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +51 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +57 -0
- package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +64 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +134 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +36 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +47 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +45 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +174 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +48 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +166 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +47 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +45 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +173 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +48 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +165 -0
- package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +121 -0
- package/runtime/third_party/bearssl/src/hash/dig_oid.c +84 -0
- package/runtime/third_party/bearssl/src/hash/dig_size.c +50 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +345 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +251 -0
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +154 -0
- package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +389 -0
- package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +411 -0
- package/runtime/third_party/bearssl/src/hash/md5.c +208 -0
- package/runtime/third_party/bearssl/src/hash/md5sha1.c +141 -0
- package/runtime/third_party/bearssl/src/hash/mgf1.c +56 -0
- package/runtime/third_party/bearssl/src/hash/multihash.c +166 -0
- package/runtime/third_party/bearssl/src/hash/sha1.c +191 -0
- package/runtime/third_party/bearssl/src/hash/sha2big.c +285 -0
- package/runtime/third_party/bearssl/src/hash/sha2small.c +341 -0
- package/runtime/third_party/bearssl/src/inner.h +2577 -0
- package/runtime/third_party/bearssl/src/int/i15_add.c +46 -0
- package/runtime/third_party/bearssl/src/int/i15_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i15_decmod.c +124 -0
- package/runtime/third_party/bearssl/src/int/i15_decode.c +56 -0
- package/runtime/third_party/bearssl/src/int/i15_decred.c +100 -0
- package/runtime/third_party/bearssl/src/int/i15_encode.c +56 -0
- package/runtime/third_party/bearssl/src/int/i15_fmont.c +59 -0
- package/runtime/third_party/bearssl/src/int/i15_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i15_moddiv.c +465 -0
- package/runtime/third_party/bearssl/src/int/i15_modpow.c +50 -0
- package/runtime/third_party/bearssl/src/int/i15_modpow2.c +160 -0
- package/runtime/third_party/bearssl/src/int/i15_montmul.c +184 -0
- package/runtime/third_party/bearssl/src/int/i15_mulacc.c +61 -0
- package/runtime/third_party/bearssl/src/int/i15_muladd.c +173 -0
- package/runtime/third_party/bearssl/src/int/i15_ninv15.c +38 -0
- package/runtime/third_party/bearssl/src/int/i15_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i15_rshift.c +47 -0
- package/runtime/third_party/bearssl/src/int/i15_sub.c +46 -0
- package/runtime/third_party/bearssl/src/int/i15_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i31_add.c +46 -0
- package/runtime/third_party/bearssl/src/int/i31_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i31_decmod.c +124 -0
- package/runtime/third_party/bearssl/src/int/i31_decode.c +57 -0
- package/runtime/third_party/bearssl/src/int/i31_decred.c +103 -0
- package/runtime/third_party/bearssl/src/int/i31_encode.c +79 -0
- package/runtime/third_party/bearssl/src/int/i31_fmont.c +60 -0
- package/runtime/third_party/bearssl/src/int/i31_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i31_moddiv.c +488 -0
- package/runtime/third_party/bearssl/src/int/i31_modpow.c +65 -0
- package/runtime/third_party/bearssl/src/int/i31_modpow2.c +160 -0
- package/runtime/third_party/bearssl/src/int/i31_montmul.c +127 -0
- package/runtime/third_party/bearssl/src/int/i31_mulacc.c +74 -0
- package/runtime/third_party/bearssl/src/int/i31_muladd.c +157 -0
- package/runtime/third_party/bearssl/src/int/i31_ninv31.c +39 -0
- package/runtime/third_party/bearssl/src/int/i31_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i31_rshift.c +47 -0
- package/runtime/third_party/bearssl/src/int/i31_sub.c +46 -0
- package/runtime/third_party/bearssl/src/int/i31_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i32_add.c +51 -0
- package/runtime/third_party/bearssl/src/int/i32_bitlen.c +44 -0
- package/runtime/third_party/bearssl/src/int/i32_decmod.c +77 -0
- package/runtime/third_party/bearssl/src/int/i32_decode.c +63 -0
- package/runtime/third_party/bearssl/src/int/i32_decred.c +107 -0
- package/runtime/third_party/bearssl/src/int/i32_div32.c +56 -0
- package/runtime/third_party/bearssl/src/int/i32_encode.c +72 -0
- package/runtime/third_party/bearssl/src/int/i32_fmont.c +60 -0
- package/runtime/third_party/bearssl/src/int/i32_iszero.c +39 -0
- package/runtime/third_party/bearssl/src/int/i32_modpow.c +65 -0
- package/runtime/third_party/bearssl/src/int/i32_montmul.c +69 -0
- package/runtime/third_party/bearssl/src/int/i32_mulacc.c +56 -0
- package/runtime/third_party/bearssl/src/int/i32_muladd.c +138 -0
- package/runtime/third_party/bearssl/src/int/i32_ninv32.c +39 -0
- package/runtime/third_party/bearssl/src/int/i32_reduce.c +66 -0
- package/runtime/third_party/bearssl/src/int/i32_sub.c +51 -0
- package/runtime/third_party/bearssl/src/int/i32_tmont.c +36 -0
- package/runtime/third_party/bearssl/src/int/i62_modpow2.c +493 -0
- package/runtime/third_party/bearssl/src/kdf/hkdf.c +107 -0
- package/runtime/third_party/bearssl/src/kdf/shake.c +590 -0
- package/runtime/third_party/bearssl/src/mac/hmac.c +122 -0
- package/runtime/third_party/bearssl/src/mac/hmac_ct.c +193 -0
- package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +206 -0
- package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +157 -0
- package/runtime/third_party/bearssl/src/rand/sysrng.c +252 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +38 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +36 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +583 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +99 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +209 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +320 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +113 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +152 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +608 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +99 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +203 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +318 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +106 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +152 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +41 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +37 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +43 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +160 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +40 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +44 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +77 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +57 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +61 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +64 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +57 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +63 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +223 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +60 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +64 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +125 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +112 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +145 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +100 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +121 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +106 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +121 -0
- package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +52 -0
- package/runtime/third_party/bearssl/src/settings.c +306 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +84 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +142 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +254 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +157 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_common.c +112 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +328 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +398 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +104 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +81 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +114 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +433 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +159 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +115 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +111 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +91 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +116 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +422 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +170 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +112 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +445 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +670 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +417 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +717 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +946 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +84 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +142 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +176 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +129 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +240 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +223 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +122 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +211 -0
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +596 -0
- package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +106 -0
- package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +237 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct.c +411 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +87 -0
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +69 -0
- package/runtime/third_party/bearssl/src/symcipher/des_support.c +166 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab.c +310 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +85 -0
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +67 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +260 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +297 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +475 -0
- package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +221 -0
- package/runtime/third_party/bearssl/src/x509/asn1.t0 +757 -0
- package/runtime/third_party/bearssl/src/x509/asn1enc.c +93 -0
- package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +110 -0
- package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +161 -0
- package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +97 -0
- package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +96 -0
- package/runtime/third_party/bearssl/src/x509/skey_decoder.c +653 -0
- package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +376 -0
- package/runtime/third_party/bearssl/src/x509/x509_decoder.c +776 -0
- package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +324 -0
- package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +105 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal.c +1722 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +1526 -0
- package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +59 -0
- package/runtime/third_party/quickjs-dtoa/LICENSE +22 -0
- package/runtime/third_party/quickjs-dtoa/README.md +23 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.c +1640 -0
- package/runtime/third_party/quickjs-dtoa/dtoa.h +83 -0
- package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +89 -0
- package/runtime/third_party/quickjs-regexp/LICENSE +22 -0
- package/runtime/third_party/quickjs-regexp/README.md +22 -0
- package/runtime/third_party/quickjs-regexp/cutils.c +641 -0
- package/runtime/third_party/quickjs-regexp/cutils.h +457 -0
- package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +73 -0
- package/runtime/third_party/quickjs-regexp/libregexp.c +3448 -0
- package/runtime/third_party/quickjs-regexp/libregexp.h +65 -0
- package/runtime/third_party/quickjs-regexp/libunicode-table.h +5206 -0
- package/runtime/third_party/quickjs-regexp/libunicode.c +2124 -0
- package/runtime/third_party/quickjs-regexp/libunicode.h +196 -0
- package/runtime/third_party/v8-ieee754/LICENSE +61 -0
- package/runtime/third_party/v8-ieee754/README.md +22 -0
- package/runtime/third_party/v8-ieee754/convert.py +84 -0
- package/runtime/third_party/v8-ieee754/ieee754.c +3030 -0
- package/runtime/third_party/v8-ieee754/ieee754.h +27 -0
- package/runtime/tools/regexp_compile.c +90 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
/* TextEncoder and TextDecoder (WHATWG Encoding), the encoding component (ADR 0012, layer 2),
|
|
2
|
+
* which needs the typedarray component. As in Node: TextEncoder writes UTF-8 (lone surrogates
|
|
3
|
+
* become U+FFFD); TextDecoder reads UTF-8, UTF-16LE, UTF-16BE and windows-1252 (the labels
|
|
4
|
+
* latin1, ascii, …), streaming, with `fatal` and `ignoreBOM`, and Node's errors and inspection.
|
|
5
|
+
* Node with ICU knows the legacy encodings too (Shift_JIS, GBK, …); they're RangeErrors here. */
|
|
6
|
+
#include <stdio.h>
|
|
7
|
+
#include <stdlib.h>
|
|
8
|
+
#include <string.h>
|
|
9
|
+
|
|
10
|
+
#include "builtins_util.h"
|
|
11
|
+
#include "internal.h"
|
|
12
|
+
#include "js_atoms.h"
|
|
13
|
+
#include "js_buffer.h"
|
|
14
|
+
#include "js_convert.h"
|
|
15
|
+
#include "js_exception.h"
|
|
16
|
+
#include "js_ops.h"
|
|
17
|
+
#include "js_symbol.h"
|
|
18
|
+
#include "js_web.h"
|
|
19
|
+
#include "jscontext.h"
|
|
20
|
+
#include "jsstring.h"
|
|
21
|
+
|
|
22
|
+
enum { ENC_UTF8, ENC_UTF16LE, ENC_UTF16BE, ENC_WINDOWS1252 };
|
|
23
|
+
static const char *const ENCODING_NAMES[] = { "utf-8", "utf-16le", "utf-16be", "windows-1252" };
|
|
24
|
+
|
|
25
|
+
/* The labels of each encoding (Encoding §4.2), ASCII lowercase. */
|
|
26
|
+
static const struct { const char *label; uint8_t encoding; } LABELS[] = {
|
|
27
|
+
{ "unicode-1-1-utf-8", ENC_UTF8 }, { "unicode11utf8", ENC_UTF8 }, { "unicode20utf8", ENC_UTF8 },
|
|
28
|
+
{ "utf-8", ENC_UTF8 }, { "utf8", ENC_UTF8 }, { "x-unicode20utf8", ENC_UTF8 },
|
|
29
|
+
{ "unicodefffe", ENC_UTF16BE }, { "utf-16be", ENC_UTF16BE },
|
|
30
|
+
{ "csunicode", ENC_UTF16LE }, { "iso-10646-ucs-2", ENC_UTF16LE }, { "ucs-2", ENC_UTF16LE },
|
|
31
|
+
{ "unicode", ENC_UTF16LE }, { "unicodefeff", ENC_UTF16LE }, { "utf-16", ENC_UTF16LE }, { "utf-16le", ENC_UTF16LE },
|
|
32
|
+
{ "ansi_x3.4-1968", ENC_WINDOWS1252 }, { "ascii", ENC_WINDOWS1252 }, { "cp1252", ENC_WINDOWS1252 },
|
|
33
|
+
{ "cp819", ENC_WINDOWS1252 }, { "csisolatin1", ENC_WINDOWS1252 }, { "ibm819", ENC_WINDOWS1252 },
|
|
34
|
+
{ "iso-8859-1", ENC_WINDOWS1252 }, { "iso-ir-100", ENC_WINDOWS1252 }, { "iso8859-1", ENC_WINDOWS1252 },
|
|
35
|
+
{ "iso88591", ENC_WINDOWS1252 }, { "iso_8859-1", ENC_WINDOWS1252 }, { "iso_8859-1:1987", ENC_WINDOWS1252 },
|
|
36
|
+
{ "l1", ENC_WINDOWS1252 }, { "latin1", ENC_WINDOWS1252 }, { "us-ascii", ENC_WINDOWS1252 },
|
|
37
|
+
{ "windows-1252", ENC_WINDOWS1252 }, { "x-cp1252", ENC_WINDOWS1252 },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/* windows-1252's 0x80…0x9F; the other bytes are their own code points. */
|
|
41
|
+
static const uint16_t WINDOWS1252_HIGH[32] = {
|
|
42
|
+
0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
|
|
43
|
+
0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
typedef struct TextDecoderObject {
|
|
47
|
+
JSObject obj;
|
|
48
|
+
uint8_t encoding;
|
|
49
|
+
bool fatal, ignore_bom;
|
|
50
|
+
bool bom_seen, do_not_flush;
|
|
51
|
+
/* the UTF-8 decoder (Encoding §8.1.2) */
|
|
52
|
+
uint8_t needed, seen, lower, upper;
|
|
53
|
+
uint32_t code_point;
|
|
54
|
+
/* the shared UTF-16 decoder (§14.2.1): -1 / 0 when none */
|
|
55
|
+
int16_t lead_byte;
|
|
56
|
+
uint16_t lead_surrogate;
|
|
57
|
+
} TextDecoderObject;
|
|
58
|
+
|
|
59
|
+
static const JSClass text_decoder_class = { "TextDecoder", sizeof(TextDecoderObject), NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
|
60
|
+
static const JSClass text_encoder_class = { "TextEncoder", sizeof(JSObject), NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
|
61
|
+
|
|
62
|
+
static TextDecoderObject *as_decoder(JSValue v) {
|
|
63
|
+
return js_is_object(v) && js_as_object(v)->shape->cls == &text_decoder_class ? (TextDecoderObject *)js_as_object(v) : NULL;
|
|
64
|
+
}
|
|
65
|
+
static bool is_encoder(JSValue v) { return js_is_object(v) && js_as_object(v)->shape->cls == &text_encoder_class; }
|
|
66
|
+
|
|
67
|
+
#define THIS_DECODER() \
|
|
68
|
+
TextDecoderObject *d = as_decoder(this_val); \
|
|
69
|
+
if (!d) return js_throw_invalid_this(ctx, "TextDecoder")
|
|
70
|
+
#define THIS_ENCODER() \
|
|
71
|
+
if (!is_encoder(this_val)) return js_throw_invalid_this(ctx, "TextEncoder")
|
|
72
|
+
|
|
73
|
+
static JSValue inspect_custom_key(JSContext *ctx) {
|
|
74
|
+
return js_symbol_for(ctx, js_new_string_cstr(ctx, "nodejs.util.inspect.custom"));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ---- Decoding ------------------------------------------------------------------------------ */
|
|
78
|
+
|
|
79
|
+
/* The decoder's output: UTF-16 code units. */
|
|
80
|
+
typedef struct {
|
|
81
|
+
uint16_t *units;
|
|
82
|
+
size_t n, cap;
|
|
83
|
+
} Out;
|
|
84
|
+
|
|
85
|
+
static void put_unit(Out *o, uint32_t u) {
|
|
86
|
+
if (o->n == o->cap) {
|
|
87
|
+
o->cap = o->cap ? o->cap * 2 : 64;
|
|
88
|
+
uint16_t *p = realloc(o->units, o->cap * sizeof *p);
|
|
89
|
+
if (!p) js_fatal("out of memory in TextDecoder");
|
|
90
|
+
o->units = p;
|
|
91
|
+
}
|
|
92
|
+
o->units[o->n++] = (uint16_t)u;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* A decoded code point, after the BOM check (Encoding §6, "serialize I/O queue"). */
|
|
96
|
+
static void put_code_point(TextDecoderObject *d, Out *o, uint32_t cp) {
|
|
97
|
+
if (!d->ignore_bom && !d->bom_seen && d->encoding != ENC_WINDOWS1252) {
|
|
98
|
+
d->bom_seen = true;
|
|
99
|
+
if (cp == 0xFEFF) return;
|
|
100
|
+
}
|
|
101
|
+
if (cp > 0xFFFF) {
|
|
102
|
+
cp -= 0x10000;
|
|
103
|
+
put_unit(o, 0xD800 + (cp >> 10));
|
|
104
|
+
put_unit(o, 0xDC00 + (cp & 0x3FF));
|
|
105
|
+
} else {
|
|
106
|
+
put_unit(o, cp);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* A decoding error: U+FFFD, or false when the decoder is fatal (the caller throws). */
|
|
111
|
+
static bool error(TextDecoderObject *d, Out *o) {
|
|
112
|
+
if (d->fatal) return false;
|
|
113
|
+
put_code_point(d, o, 0xFFFD);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static void reset_utf8(TextDecoderObject *d) {
|
|
118
|
+
d->needed = d->seen = 0;
|
|
119
|
+
d->code_point = 0;
|
|
120
|
+
d->lower = 0x80;
|
|
121
|
+
d->upper = 0xBF;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* The UTF-8 decoder's handler (Encoding §8.1.2), over bytes then (`flush`) the end of the queue. */
|
|
125
|
+
static bool decode_utf8(TextDecoderObject *d, Out *o, const uint8_t *p, size_t n, bool flush) {
|
|
126
|
+
for (size_t i = 0; i < n;) {
|
|
127
|
+
uint8_t b = p[i];
|
|
128
|
+
if (d->needed == 0) {
|
|
129
|
+
i++;
|
|
130
|
+
if (b <= 0x7F) {
|
|
131
|
+
put_code_point(d, o, b);
|
|
132
|
+
} else if (b >= 0xC2 && b <= 0xDF) {
|
|
133
|
+
d->needed = 1;
|
|
134
|
+
d->code_point = b & 0x1F;
|
|
135
|
+
} else if (b >= 0xE0 && b <= 0xEF) {
|
|
136
|
+
if (b == 0xE0) d->lower = 0xA0;
|
|
137
|
+
if (b == 0xED) d->upper = 0x9F;
|
|
138
|
+
d->needed = 2;
|
|
139
|
+
d->code_point = b & 0xF;
|
|
140
|
+
} else if (b >= 0xF0 && b <= 0xF4) {
|
|
141
|
+
if (b == 0xF0) d->lower = 0x90;
|
|
142
|
+
if (b == 0xF4) d->upper = 0x8F;
|
|
143
|
+
d->needed = 3;
|
|
144
|
+
d->code_point = b & 0x7;
|
|
145
|
+
} else if (!error(d, o)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (b < d->lower || b > d->upper) { /* the byte is processed again, as a lead */
|
|
151
|
+
reset_utf8(d);
|
|
152
|
+
if (!error(d, o)) return false;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
i++;
|
|
156
|
+
d->lower = 0x80;
|
|
157
|
+
d->upper = 0xBF;
|
|
158
|
+
d->code_point = (d->code_point << 6) | (b & 0x3F);
|
|
159
|
+
if (++d->seen == d->needed) {
|
|
160
|
+
put_code_point(d, o, d->code_point);
|
|
161
|
+
reset_utf8(d);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (flush && d->needed != 0) {
|
|
165
|
+
reset_utf8(d);
|
|
166
|
+
return error(d, o);
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* The shared UTF-16 decoder's handler (Encoding §14.2.1). */
|
|
172
|
+
static bool decode_utf16(TextDecoderObject *d, Out *o, const uint8_t *p, size_t n, bool flush) {
|
|
173
|
+
bool be = d->encoding == ENC_UTF16BE;
|
|
174
|
+
for (size_t i = 0; i < n; i++) {
|
|
175
|
+
if (d->lead_byte < 0) {
|
|
176
|
+
d->lead_byte = p[i];
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
uint32_t cu = be ? ((uint32_t)d->lead_byte << 8) | p[i] : ((uint32_t)p[i] << 8) | (uint32_t)d->lead_byte;
|
|
180
|
+
d->lead_byte = -1;
|
|
181
|
+
if (d->lead_surrogate) {
|
|
182
|
+
uint32_t lead = d->lead_surrogate;
|
|
183
|
+
d->lead_surrogate = 0;
|
|
184
|
+
if (cu >= 0xDC00 && cu <= 0xDFFF) {
|
|
185
|
+
put_code_point(d, o, 0x10000 + ((lead - 0xD800) << 10) + (cu - 0xDC00));
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
/* the unit's bytes are processed again: the same unit, with no lead surrogate */
|
|
189
|
+
if (!error(d, o)) return false;
|
|
190
|
+
}
|
|
191
|
+
if (cu >= 0xD800 && cu <= 0xDBFF) {
|
|
192
|
+
d->lead_surrogate = (uint16_t)cu;
|
|
193
|
+
} else if (cu >= 0xDC00 && cu <= 0xDFFF) {
|
|
194
|
+
if (!error(d, o)) return false;
|
|
195
|
+
} else {
|
|
196
|
+
put_code_point(d, o, cu);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (flush && (d->lead_byte >= 0 || d->lead_surrogate)) {
|
|
200
|
+
d->lead_byte = -1;
|
|
201
|
+
d->lead_surrogate = 0;
|
|
202
|
+
return error(d, o);
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static void reset_decoder(TextDecoderObject *d) {
|
|
208
|
+
reset_utf8(d);
|
|
209
|
+
d->lead_byte = -1;
|
|
210
|
+
d->lead_surrogate = 0;
|
|
211
|
+
d->bom_seen = false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* decode(input, options) (Encoding §7.2) */
|
|
215
|
+
BUILTIN(text_decoder_decode) {
|
|
216
|
+
UNUSED_ARGS;
|
|
217
|
+
THIS_DECODER();
|
|
218
|
+
bool stream = false;
|
|
219
|
+
if (js_is_object(ARG(1))) {
|
|
220
|
+
JSValue s = js_get_value(ctx, ARG(1), js_atom_from_cstr(ctx, "stream"));
|
|
221
|
+
if (js_is_exception(s)) return s;
|
|
222
|
+
stream = js_truthy(s);
|
|
223
|
+
}
|
|
224
|
+
uint8_t *bytes = NULL;
|
|
225
|
+
size_t n = 0;
|
|
226
|
+
if (!js_is_undefined(ARG(0)) && !js_buffer_source_bytes(ARG(0), &bytes, &n))
|
|
227
|
+
return js_throw_node_error(ctx, JS_TYPE_ERROR, "ERR_INVALID_ARG_TYPE",
|
|
228
|
+
"The \"list\" argument must be an instance of SharedArrayBuffer, ArrayBuffer or ArrayBufferView.");
|
|
229
|
+
if (!d->do_not_flush) reset_decoder(d);
|
|
230
|
+
d->do_not_flush = stream;
|
|
231
|
+
|
|
232
|
+
/* ASCII from a fresh decoder, all of it: the bytes are the string */
|
|
233
|
+
if (d->encoding != ENC_UTF16LE && d->encoding != ENC_UTF16BE && d->needed == 0) {
|
|
234
|
+
size_t k = 0;
|
|
235
|
+
while (k < n && bytes[k] < 0x80) k++;
|
|
236
|
+
if (k == n) {
|
|
237
|
+
if (n > 0) d->bom_seen = true;
|
|
238
|
+
return js_new_string_latin1(ctx, bytes, (uint32_t)n);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
Out o = { 0 };
|
|
242
|
+
bool ok;
|
|
243
|
+
if (d->encoding == ENC_UTF8) {
|
|
244
|
+
ok = decode_utf8(d, &o, bytes, n, !stream);
|
|
245
|
+
} else if (d->encoding == ENC_WINDOWS1252) {
|
|
246
|
+
for (size_t i = 0; i < n; i++) put_unit(&o, bytes[i] >= 0x80 && bytes[i] <= 0x9F ? WINDOWS1252_HIGH[bytes[i] - 0x80] : bytes[i]);
|
|
247
|
+
ok = true;
|
|
248
|
+
} else {
|
|
249
|
+
ok = decode_utf16(d, &o, bytes, n, !stream);
|
|
250
|
+
}
|
|
251
|
+
if (!ok) {
|
|
252
|
+
free(o.units);
|
|
253
|
+
return js_throw_node_error(ctx, JS_TYPE_ERROR, "ERR_ENCODING_INVALID_ENCODED_DATA",
|
|
254
|
+
"The encoded data was not valid for encoding %s", ENCODING_NAMES[d->encoding]);
|
|
255
|
+
}
|
|
256
|
+
if (o.n > JS_STRING_MAX_LENGTH) {
|
|
257
|
+
free(o.units);
|
|
258
|
+
return js_throw_range_error(ctx, "Invalid string length");
|
|
259
|
+
}
|
|
260
|
+
JSValue r = js_new_string_utf16(ctx, o.units, (uint32_t)o.n);
|
|
261
|
+
free(o.units);
|
|
262
|
+
return r;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* The encoding name for a label (Encoding §4.2, "get an encoding"): -1 when there is none. */
|
|
266
|
+
static int encoding_of_label(JSContext *ctx, JSValue label) {
|
|
267
|
+
JSStrView v = js_string_view(ctx, label);
|
|
268
|
+
uint32_t start = 0, end = v.length;
|
|
269
|
+
#define IS_WS(c) ((c) == 0x09 || (c) == 0x0A || (c) == 0x0C || (c) == 0x0D || (c) == 0x20)
|
|
270
|
+
while (start < end && IS_WS(js_view_at(v, start))) start++;
|
|
271
|
+
while (end > start && IS_WS(js_view_at(v, end - 1))) end--;
|
|
272
|
+
#undef IS_WS
|
|
273
|
+
char buf[24];
|
|
274
|
+
if (end - start >= sizeof buf) return -1;
|
|
275
|
+
for (uint32_t i = start; i < end; i++) {
|
|
276
|
+
uint32_t c = js_view_at(v, i);
|
|
277
|
+
if (c >= 0x80) return -1;
|
|
278
|
+
buf[i - start] = (char)(c >= 'A' && c <= 'Z' ? c + 32 : c);
|
|
279
|
+
}
|
|
280
|
+
buf[end - start] = '\0';
|
|
281
|
+
for (size_t i = 0; i < JS_COUNTOF(LABELS); i++)
|
|
282
|
+
if (strcmp(LABELS[i].label, buf) == 0) return LABELS[i].encoding;
|
|
283
|
+
return -1;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* new TextDecoder(label = "utf-8", options = {}) */
|
|
287
|
+
BUILTIN(text_decoder_ctor) {
|
|
288
|
+
(void)callee, (void)this_val;
|
|
289
|
+
if (js_is_undefined(new_target)) return js_throw_class_without_new(ctx, "TextDecoder");
|
|
290
|
+
JSValue label = js_is_undefined(ARG(0)) ? js_new_string_cstr(ctx, "utf-8") : js_to_string(ctx, ARG(0));
|
|
291
|
+
if (js_is_exception(label)) return label;
|
|
292
|
+
JSValue options = ARG(1);
|
|
293
|
+
if (!js_is_undefined(options) && !js_is_null(options) && !js_is_object(options))
|
|
294
|
+
return js_throw_invalid_arg_type(ctx, "options", "of type object", options);
|
|
295
|
+
int encoding = encoding_of_label(ctx, label);
|
|
296
|
+
if (encoding < 0) {
|
|
297
|
+
char s[200];
|
|
298
|
+
s[js_view_to_utf8(js_string_view(ctx, label), s, sizeof s - 1)] = '\0';
|
|
299
|
+
return js_throw_node_error(ctx, JS_RANGE_ERROR, "ERR_ENCODING_NOT_SUPPORTED", "The \"%s\" encoding is not supported", s);
|
|
300
|
+
}
|
|
301
|
+
bool fatal = false, ignore_bom = false;
|
|
302
|
+
if (js_is_object(options)) {
|
|
303
|
+
JSValue f = js_get_value(ctx, options, js_atom_from_cstr(ctx, "fatal"));
|
|
304
|
+
if (js_is_exception(f)) return f;
|
|
305
|
+
fatal = js_truthy(f);
|
|
306
|
+
JSValue b = js_get_value(ctx, options, js_atom_from_cstr(ctx, "ignoreBOM"));
|
|
307
|
+
if (js_is_exception(b)) return b;
|
|
308
|
+
ignore_bom = js_truthy(b);
|
|
309
|
+
}
|
|
310
|
+
JSValue proto = js_get_prototype_from_constructor(ctx, new_target, JS_INTRINSIC_TEXT_DECODER_PROTOTYPE);
|
|
311
|
+
if (js_is_exception(proto)) return proto;
|
|
312
|
+
TextDecoderObject *d = (TextDecoderObject *)js_alloc_object(ctx, JS_CELL_OBJECT, js_shape_root(ctx, &text_decoder_class, proto, 0));
|
|
313
|
+
d->encoding = (uint8_t)encoding;
|
|
314
|
+
d->fatal = fatal;
|
|
315
|
+
d->ignore_bom = ignore_bom;
|
|
316
|
+
d->do_not_flush = false;
|
|
317
|
+
reset_decoder(d);
|
|
318
|
+
return js_object_value(&d->obj);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
BUILTIN(text_decoder_encoding) {
|
|
322
|
+
UNUSED_ARGS;
|
|
323
|
+
THIS_DECODER();
|
|
324
|
+
return js_new_string_cstr(ctx, ENCODING_NAMES[d->encoding]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
BUILTIN(text_decoder_fatal) {
|
|
328
|
+
UNUSED_ARGS;
|
|
329
|
+
THIS_DECODER();
|
|
330
|
+
return js_bool(d->fatal);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
BUILTIN(text_decoder_ignore_bom) {
|
|
334
|
+
UNUSED_ARGS;
|
|
335
|
+
THIS_DECODER();
|
|
336
|
+
return js_bool(d->ignore_bom);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Node's inspection: `TextDecoder { encoding: 'utf-8', fatal: false, ignoreBOM: false }`, named
|
|
340
|
+
* after the instance's constructor (a subclass shows its name). */
|
|
341
|
+
BUILTIN(text_decoder_inspect) {
|
|
342
|
+
UNUSED_ARGS;
|
|
343
|
+
THIS_DECODER();
|
|
344
|
+
if (js_is_number(ARG(0)) && js_as_number(ARG(0)) < 0) return this_val;
|
|
345
|
+
char name[96] = "TextDecoder";
|
|
346
|
+
JSValue c = js_get_value(ctx, this_val, JS_ATOM(constructor));
|
|
347
|
+
if (js_is_exception(c)) return c;
|
|
348
|
+
if (js_is_object(c)) {
|
|
349
|
+
JSValue n = js_get_value(ctx, c, JS_ATOM(name));
|
|
350
|
+
if (js_is_exception(n)) return n;
|
|
351
|
+
if (js_is_string(n) && js_string_length(n) != 0) name[js_view_to_utf8(js_string_view(ctx, n), name, sizeof name - 1)] = '\0';
|
|
352
|
+
}
|
|
353
|
+
char s[256];
|
|
354
|
+
snprintf(s, sizeof s, "%s { encoding: '%s', fatal: %s, ignoreBOM: %s }", name, ENCODING_NAMES[d->encoding],
|
|
355
|
+
d->fatal ? "true" : "false", d->ignore_bom ? "true" : "false");
|
|
356
|
+
return js_new_string_cstr(ctx, s);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* ---- Encoding ------------------------------------------------------------------------------ */
|
|
360
|
+
|
|
361
|
+
/* new TextEncoder() */
|
|
362
|
+
BUILTIN(text_encoder_ctor) {
|
|
363
|
+
(void)callee, (void)this_val, (void)argc, (void)argv;
|
|
364
|
+
if (js_is_undefined(new_target)) return js_throw_class_without_new(ctx, "TextEncoder");
|
|
365
|
+
JSValue proto = js_get_prototype_from_constructor(ctx, new_target, JS_INTRINSIC_TEXT_ENCODER_PROTOTYPE);
|
|
366
|
+
if (js_is_exception(proto)) return proto;
|
|
367
|
+
return js_object_value(js_alloc_object(ctx, JS_CELL_OBJECT, js_shape_root(ctx, &text_encoder_class, proto, 0)));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
BUILTIN(text_encoder_encoding) {
|
|
371
|
+
UNUSED_ARGS;
|
|
372
|
+
THIS_ENCODER();
|
|
373
|
+
return js_new_string_cstr(ctx, "utf-8");
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/* encode(input = "") */
|
|
377
|
+
BUILTIN(text_encoder_encode) {
|
|
378
|
+
UNUSED_ARGS;
|
|
379
|
+
THIS_ENCODER();
|
|
380
|
+
JSValue s = js_is_undefined(ARG(0)) ? js_empty_string() : js_to_string(ctx, ARG(0));
|
|
381
|
+
if (js_is_exception(s)) return s;
|
|
382
|
+
size_t n = js_view_to_utf8(js_string_view(ctx, s), NULL, 0);
|
|
383
|
+
JSValue a = js_new_uint8_array(ctx, n);
|
|
384
|
+
if (js_is_exception(a)) return a;
|
|
385
|
+
uint8_t *bytes;
|
|
386
|
+
size_t len;
|
|
387
|
+
js_buffer_source_bytes(a, &bytes, &len);
|
|
388
|
+
js_view_to_utf8(js_string_view(ctx, s), (char *)bytes, len);
|
|
389
|
+
return a;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* encodeInto(src, dest): { read, written }, without splitting a code point */
|
|
393
|
+
BUILTIN(text_encoder_encode_into) {
|
|
394
|
+
UNUSED_ARGS;
|
|
395
|
+
THIS_ENCODER();
|
|
396
|
+
if (!js_is_string(ARG(0))) return js_throw_invalid_arg_type(ctx, "src", "of type string", ARG(0));
|
|
397
|
+
if (!js_is_uint8_array(ARG(1))) return js_throw_invalid_arg_type(ctx, "dest", "an instance of Uint8Array", ARG(1));
|
|
398
|
+
uint8_t *out;
|
|
399
|
+
size_t cap;
|
|
400
|
+
js_buffer_source_bytes(ARG(1), &out, &cap);
|
|
401
|
+
JSStrView v = js_string_view(ctx, ARG(0));
|
|
402
|
+
size_t read = 0, written = 0;
|
|
403
|
+
while (read < v.length) {
|
|
404
|
+
uint32_t c = js_view_at(v, (uint32_t)read), units = 1;
|
|
405
|
+
if (c >= 0xD800 && c <= 0xDBFF && read + 1 < v.length) {
|
|
406
|
+
uint32_t t = js_view_at(v, (uint32_t)read + 1);
|
|
407
|
+
if (t >= 0xDC00 && t <= 0xDFFF) {
|
|
408
|
+
c = 0x10000 + ((c - 0xD800) << 10) + (t - 0xDC00);
|
|
409
|
+
units = 2;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (c >= 0xD800 && c <= 0xDFFF) c = 0xFFFD;
|
|
413
|
+
size_t k = c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
|
|
414
|
+
if (written + k > cap) break;
|
|
415
|
+
if (k == 1) {
|
|
416
|
+
out[written] = (uint8_t)c;
|
|
417
|
+
} else if (k == 2) {
|
|
418
|
+
out[written] = (uint8_t)(0xC0 | (c >> 6));
|
|
419
|
+
out[written + 1] = (uint8_t)(0x80 | (c & 0x3F));
|
|
420
|
+
} else if (k == 3) {
|
|
421
|
+
out[written] = (uint8_t)(0xE0 | (c >> 12));
|
|
422
|
+
out[written + 1] = (uint8_t)(0x80 | ((c >> 6) & 0x3F));
|
|
423
|
+
out[written + 2] = (uint8_t)(0x80 | (c & 0x3F));
|
|
424
|
+
} else {
|
|
425
|
+
out[written] = (uint8_t)(0xF0 | (c >> 18));
|
|
426
|
+
out[written + 1] = (uint8_t)(0x80 | ((c >> 12) & 0x3F));
|
|
427
|
+
out[written + 2] = (uint8_t)(0x80 | ((c >> 6) & 0x3F));
|
|
428
|
+
out[written + 3] = (uint8_t)(0x80 | (c & 0x3F));
|
|
429
|
+
}
|
|
430
|
+
written += k;
|
|
431
|
+
read += units;
|
|
432
|
+
}
|
|
433
|
+
JSValue r = js_new_object(ctx);
|
|
434
|
+
js_define_data(ctx, js_as_object(r), js_atom_from_cstr(ctx, "read"), js_number((double)read), JS_PROP_DEFAULT);
|
|
435
|
+
js_define_data(ctx, js_as_object(r), js_atom_from_cstr(ctx, "written"), js_number((double)written), JS_PROP_DEFAULT);
|
|
436
|
+
return r;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Node's inspection: `{ encoding: 'utf-8' }`. */
|
|
440
|
+
BUILTIN(text_encoder_inspect) {
|
|
441
|
+
UNUSED_ARGS;
|
|
442
|
+
THIS_ENCODER();
|
|
443
|
+
if (js_is_number(ARG(0)) && js_as_number(ARG(0)) < 0) return this_val;
|
|
444
|
+
return js_new_string_cstr(ctx, "{ encoding: 'utf-8' }");
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* ---- Realm --------------------------------------------------------------------------------- */
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
static const JSBuiltin text_decoder_proto[] = {
|
|
451
|
+
WEBIDL_OPERATION("decode", text_decoder_decode, 0),
|
|
452
|
+
WEBIDL_ATTRIBUTE("encoding", text_decoder_encoding, NULL),
|
|
453
|
+
WEBIDL_ATTRIBUTE("fatal", text_decoder_fatal, NULL),
|
|
454
|
+
WEBIDL_ATTRIBUTE("ignoreBOM", text_decoder_ignore_bom, NULL),
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
static const JSBuiltin text_encoder_proto[] = {
|
|
458
|
+
WEBIDL_ATTRIBUTE("encoding", text_encoder_encoding, NULL),
|
|
459
|
+
WEBIDL_OPERATION("encode", text_encoder_encode, 0),
|
|
460
|
+
WEBIDL_OPERATION("encodeInto", text_encoder_encode_into, 2),
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
static void define_class(JSContext *ctx, JSObject *global, const char *name, JSNativeFn ctor, JSIntrinsic slot,
|
|
464
|
+
const JSBuiltin *methods, size_t n, JSNativeFn inspect, const char *tag) {
|
|
465
|
+
JSValue proto = js_new_object_proto(ctx, ctx->intrinsics[JS_INTRINSIC_OBJECT_PROTOTYPE], 8);
|
|
466
|
+
ctx->intrinsics[slot] = proto;
|
|
467
|
+
JSValue key = js_atom_from_cstr(ctx, name);
|
|
468
|
+
JSValue c = js_new_native(ctx, ctor, key, 0, JS_FN_STRICT | JS_FN_CONSTRUCTOR);
|
|
469
|
+
js_define_data(ctx, js_as_object(c), JS_ATOM(prototype), proto, 0);
|
|
470
|
+
js_define_data(ctx, js_as_object(proto), JS_ATOM(constructor), c, JS_BUILTIN_METHOD_ATTRS);
|
|
471
|
+
js_define_builtins(ctx, js_as_object(proto), methods, n);
|
|
472
|
+
JSValue f = js_new_native(ctx, inspect, js_new_string_cstr(ctx, "[nodejs.util.inspect.custom]"), 2, JS_FN_STRICT);
|
|
473
|
+
js_define_data(ctx, js_as_object(proto), inspect_custom_key(ctx), f, JS_BUILTIN_METHOD_ATTRS);
|
|
474
|
+
js_define_data(ctx, js_as_object(proto), JS_SYMBOL(toStringTag), js_new_string_cstr(ctx, tag), JS_PROP_CONFIGURABLE);
|
|
475
|
+
js_define_data(ctx, global, key, c, JS_BUILTIN_METHOD_ATTRS);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
static void install_encoding(JSContext *ctx, JSObject *global) {
|
|
479
|
+
define_class(ctx, global, "TextEncoder", text_encoder_ctor, JS_INTRINSIC_TEXT_ENCODER_PROTOTYPE, text_encoder_proto,
|
|
480
|
+
JS_COUNTOF(text_encoder_proto), text_encoder_inspect, "TextEncoder");
|
|
481
|
+
define_class(ctx, global, "TextDecoder", text_decoder_ctor, JS_INTRINSIC_TEXT_DECODER_PROTOTYPE, text_decoder_proto,
|
|
482
|
+
JS_COUNTOF(text_decoder_proto), text_decoder_inspect, "TextDecoder");
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const JSComponent js_component_encoding = { "encoding", install_encoding };
|