From 0c1cc3493571a0c8a8c160489ffd210096affe1c Mon Sep 17 00:00:00 2001 From: theMackabu Date: Thu, 26 Mar 2026 00:33:35 -0700 Subject: [PATCH] enable brotli --- examples/spec/buffer.js | 1 + include/streams/compression.h | 1 + meson/deps/meson.build | 3 ++- src/modules/buffer.c | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/spec/buffer.js b/examples/spec/buffer.js index 40a198d..f002973 100644 --- a/examples/spec/buffer.js +++ b/examples/spec/buffer.js @@ -12,6 +12,7 @@ const u8 = new Uint8Array(8); test('Uint8Array length', u8.length, 8); test('Uint8Array byteLength', u8.byteLength, 8); test('Uint8Array BYTES_PER_ELEMENT', u8.BYTES_PER_ELEMENT, 1); +test('Uint8Array constructor', u8.constructor, Uint8Array); test('Uint8Array with new', new Uint8Array(5).length, 5); test('Uint8Array via Reflect.construct', Reflect.construct(Uint8Array, [5]).length, 5); testThrows('Uint8Array without new throws', () => Uint8Array(5)); diff --git a/include/streams/compression.h b/include/streams/compression.h index 576817f..d7696a3 100644 --- a/include/streams/compression.h +++ b/include/streams/compression.h @@ -8,6 +8,7 @@ typedef enum { ZFMT_GZIP = 0, ZFMT_DEFLATE, ZFMT_DEFLATE_RAW, + ZFMT_BROTLI, } zformat_t; extern ant_value_t g_cs_proto; diff --git a/meson/deps/meson.build b/meson/deps/meson.build index ff77d41..708d09a 100644 --- a/meson/deps/meson.build +++ b/meson/deps/meson.build @@ -219,7 +219,8 @@ ant_deps = [ argtable3_dep, tlsuv_dep, libsodium_dep, yyjson_dep, minicoro_dep, uuidv7_dep, uriparser_dep, utf8proc_dep, openssl_dep, - zlib_dep, uthash_dep, lmdb_dep, + zlib_dep, brotli_common_dep, brotli_dec_dep, + brotli_enc_dep, uthash_dep, lmdb_dep, ] + mbedtls_dep + win_deps if get_option('jit') diff --git a/src/modules/buffer.c b/src/modules/buffer.c index c937be6..3c76dbb 100644 --- a/src/modules/buffer.c +++ b/src/modules/buffer.c @@ -2091,6 +2091,9 @@ void init_buffer_module() { ant_value_t name##_ctor_obj = js_mkobj(js); \ ant_value_t name##_proto = js_mkobj(js); \ js_set_proto_init(name##_proto, typedarray_proto); \ + js_setprop(js, name##_proto, ANT_STRING("constructor"), js_obj_to_func(name##_ctor_obj)); \ + js_set_descriptor(js, name##_proto, "constructor", 11, JS_DESC_W | JS_DESC_C); \ + js_set_sym(js, name##_proto, get_toStringTag_sym(), js_mkstr(js, #name, sizeof(#name) - 1)); \ js_set_slot(name##_ctor_obj, SLOT_CFUNC, js_mkfun(js_##name##_constructor)); \ js_setprop(js, name##_ctor_obj, js_mkstr(js, "prototype", 9), name##_proto); \ js_mkprop_fast(js, name##_ctor_obj, "name", 4, ANT_STRING(#name)); \ -- 2.51.2