Skip to content

Conversation

@nektro
Copy link
Contributor

@nektro nektro commented Nov 16, 2025

Closes #1723
Closes #22214
Closes #24241

also supports the "brotli" and "zstd" formats

image

@robobun
Copy link
Collaborator

robobun commented Nov 16, 2025

Updated 3:49 PM PT - Nov 17th, 2025

@nektro, your commit 5d710b8 has 4 failures in Build #31905 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 24757

That installs a local version of the PR into your bun-24757 executable, so you can run:

bun-24757 --bun

@nektro nektro marked this pull request as ready for review November 16, 2025 11:38
@coderabbitai

This comment was marked as duplicate.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 87eca6b and 388798d.

📒 Files selected for processing (20)
  • bench/runner.mjs (1 hunks)
  • bench/snippets/compression-streams.mjs (1 hunks)
  • docs/runtime/nodejs-compat.mdx (2 hunks)
  • src/bun.js/bindings/JSCompressionStream.cpp (1 hunks)
  • src/bun.js/bindings/JSCompressionStream.h (1 hunks)
  • src/bun.js/bindings/JSDecompressionStream.cpp (1 hunks)
  • src/bun.js/bindings/JSDecompressionStream.h (1 hunks)
  • src/bun.js/bindings/ZigGlobalObject.cpp (2 hunks)
  • src/bun.js/bindings/ZigGlobalObject.lut.txt (2 hunks)
  • src/bun.js/bindings/js_classes.ts (1 hunks)
  • src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h (1 hunks)
  • src/bun.js/bindings/webcore/DOMConstructors.h (2 hunks)
  • src/bun.js/bindings/webcore/DOMIsoSubspaces.h (1 hunks)
  • src/codegen/bundle-modules.ts (1 hunks)
  • src/js/builtins/CompressionStream.ts (1 hunks)
  • src/js/builtins/DecompressionStream.ts (1 hunks)
  • src/js/node/stream.web.ts (1 hunks)
  • test/integration/bun-types/fixture/streams.ts (1 hunks)
  • test/js/node/test/parallel/test-global-webstreams.js (1 hunks)
  • test/js/node/test/parallel/test-whatwg-webstreams-compression.js (1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.

Applied to files:

  • src/bun.js/bindings/webcore/DOMIsoSubspaces.h
  • src/bun.js/bindings/js_classes.ts
  • src/bun.js/bindings/webcore/DOMConstructors.h
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/JSCompressionStream.h
  • src/codegen/bundle-modules.ts
  • src/bun.js/bindings/JSDecompressionStream.cpp
  • src/bun.js/bindings/JSDecompressionStream.h
  • src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h
  • src/bun.js/bindings/JSCompressionStream.cpp
  • src/bun.js/bindings/ZigGlobalObject.lut.txt
📚 Learning: 2025-10-26T01:32:04.844Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24082
File: test/cli/test/coverage.test.ts:60-112
Timestamp: 2025-10-26T01:32:04.844Z
Learning: In the Bun repository test files (test/cli/test/*.test.ts), when spawning Bun CLI commands with Bun.spawnSync for testing, prefer using stdio: ["inherit", "inherit", "inherit"] to inherit stdio streams rather than piping them.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
📚 Learning: 2025-11-14T16:07:01.064Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
📚 Learning: 2025-10-19T04:55:33.099Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: test/js/bun/http/node-telemetry.test.ts:27-203
Timestamp: 2025-10-19T04:55:33.099Z
Learning: In test/js/bun/http/node-telemetry.test.ts and the Bun.telemetry._node_binding API, after the architecture refactor, the _node_binding interface only contains two methods: handleIncomingRequest(req, res) and handleWriteHead(res, statusCode). The handleRequestFinish hook and other lifecycle hooks were removed during simplification. Both current methods are fully tested.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
📚 Learning: 2025-10-17T20:50:58.644Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/api/bun/socket/Handlers.zig:154-159
Timestamp: 2025-10-17T20:50:58.644Z
Learning: In Bun socket configuration error messages (src/bun.js/api/bun/socket/Handlers.zig), use the user-facing JavaScript names "data" and "drain" instead of internal field names "onData" and "onWritable", as these are the names users see in the API according to SocketConfig.bindv2.ts.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
  • src/bun.js/bindings/js_classes.ts
  • src/js/node/stream.web.ts
  • src/bun.js/bindings/ZigGlobalObject.lut.txt
📚 Learning: 2025-10-01T22:13:08.081Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/codegen/bindgenv2/internal/base.ts:120-125
Timestamp: 2025-10-01T22:13:08.081Z
Learning: Iterator.some() and other Iterator helper methods (map, filter, etc.) are supported in Bun and modern Node.js (22+) runtimes and can be safely used on string iterators and other iterator objects.

Applied to files:

  • test/integration/bun-types/fixture/streams.ts
📚 Learning: 2025-10-11T15:19:30.301Z
Learnt from: mastermakrela
Repo: oven-sh/bun PR: 19167
File: src/bun.js/api.zig:31-31
Timestamp: 2025-10-11T15:19:30.301Z
Learning: The learnings about `pub const js = JSC.Codegen.JS<ClassName>` and re-exporting toJS/fromJS/fromJSDirect apply to class-based Zig bindings with constructors and prototype methods (e.g., those with `new` constructors). They do NOT apply to simple namespace-style API objects like TOMLObject, YAMLObject, and CSVObject which expose static functions via a `create()` method that returns a plain JS object.

Applied to files:

  • src/bun.js/bindings/js_classes.ts
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/JSCompressionStream.cpp
  • src/bun.js/bindings/ZigGlobalObject.lut.txt
📚 Learning: 2025-09-24T05:48:59.872Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22806
File: scripts/runner.node.mjs:687-689
Timestamp: 2025-09-24T05:48:59.872Z
Learning: In the Bun codebase, the `startGroup` utility function in scripts/runner.node.mjs automatically closes any previously open group when called, so `startGroup("End")` correctly closes the final test group and keeps subsequent output ungrouped.

Applied to files:

  • bench/runner.mjs
📚 Learning: 2025-10-18T20:50:47.750Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: src/bun.js/telemetry.zig:366-373
Timestamp: 2025-10-18T20:50:47.750Z
Learning: In Bun's Zig codebase (src/bun.js/bindings/JSValue.zig), the JSValue enum uses `.null` (not `.js_null`) for JavaScript's null value. Only `js_undefined` has the `js_` prefix to avoid collision with Zig's built-in `undefined` keyword. The correct enum fields are: `js_undefined`, `null`, `true`, `false`, and `zero`.

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/ZigGlobalObject.lut.txt
📚 Learning: 2025-11-03T20:43:06.996Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24273
File: src/bun.js/test/snapshot.zig:19-19
Timestamp: 2025-11-03T20:43:06.996Z
Learning: In Bun's Zig codebase, when storing JSValue objects in collections like ArrayList, use `jsc.Strong.Optional` (not raw JSValue). When adding values, wrap them with `jsc.Strong.Optional.create(value, globalThis)`. In cleanup code, iterate the collection calling `.deinit()` on each Strong.Optional item before calling `.deinit()` on the ArrayList itself. This pattern automatically handles GC protection. See examples in src/bun.js/test/ScopeFunctions.zig and src/bun.js/node/node_cluster_binding.zig.

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
🧬 Code graph analysis (9)
src/js/builtins/CompressionStream.ts (2)
test/js/node/test/parallel/test-whatwg-webstreams-compression.js (1)
  • require (6-9)
src/js/builtins/DecompressionStream.ts (2)
  • readable (24-27)
  • writable (30-33)
src/js/builtins/DecompressionStream.ts (2)
test/js/node/test/parallel/test-whatwg-webstreams-compression.js (1)
  • require (6-9)
src/js/builtins/CompressionStream.ts (2)
  • readable (24-27)
  • writable (30-33)
src/bun.js/bindings/JSCompressionStream.h (6)
src/bun.js/bindings/webcore/DOMConstructors.h (1)
  • WebCore (7-890)
src/bun.js/bindings/JSDecompressionStream.h (4)
  • WebCore (5-40)
  • create (10-15)
  • Structure (23-26)
  • GCClient (28-33)
src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h (1)
  • WebCore (8-957)
src/bun.js/bindings/webcore/DOMIsoSubspaces.h (2)
  • WebCore (9-960)
  • WebCore (962-964)
src/bun.js/bindings/JSCompressionStream.cpp (19)
  • JSCompressionStream (99-102)
  • createPrototype (110-115)
  • createPrototype (110-110)
  • prototype (117-120)
  • prototype (117-117)
  • getConstructor (122-125)
  • getConstructor (122-122)
  • vm (19-24)
  • vm (19-19)
  • vm (33-36)
  • vm (33-33)
  • subspaceFor (28-32)
  • subspaceFor (28-28)
  • subspaceForImpl (89-97)
  • subspaceForImpl (89-89)
  • finishCreation (80-85)
  • finishCreation (80-80)
  • finishCreation (104-108)
  • finishCreation (104-104)
src/bun.js/bindings/JSDecompressionStream.cpp (18)
  • createPrototype (110-115)
  • createPrototype (110-110)
  • prototype (117-120)
  • prototype (117-117)
  • getConstructor (122-125)
  • getConstructor (122-122)
  • vm (19-24)
  • vm (19-19)
  • vm (33-36)
  • vm (33-33)
  • subspaceFor (28-32)
  • subspaceFor (28-28)
  • subspaceForImpl (89-97)
  • subspaceForImpl (89-89)
  • finishCreation (80-85)
  • finishCreation (80-80)
  • finishCreation (104-108)
  • finishCreation (104-104)
test/js/node/test/parallel/test-global-webstreams.js (1)
test/js/node/test/parallel/test-whatwg-webstreams-compression.js (2)
  • require (6-9)
  • assert (11-11)
src/bun.js/bindings/JSDecompressionStream.cpp (2)
src/bun.js/bindings/JSCompressionStream.cpp (22)
  • vm (19-24)
  • vm (19-19)
  • vm (33-36)
  • vm (33-33)
  • prototype (117-120)
  • prototype (117-117)
  • prototypeForStructure (52-56)
  • prototypeForStructure (52-52)
  • initializeProperties (58-65)
  • initializeProperties (58-58)
  • initializeExecutable (67-70)
  • initializeExecutable (67-67)
  • finishCreation (80-85)
  • finishCreation (80-80)
  • finishCreation (104-108)
  • finishCreation (104-104)
  • subspaceForImpl (89-97)
  • subspaceForImpl (89-89)
  • createPrototype (110-115)
  • createPrototype (110-110)
  • getConstructor (122-125)
  • getConstructor (122-122)
src/bun.js/bindings/JSDecompressionStream.h (2)
  • create (10-15)
  • JSDecompressionStream (7-38)
src/bun.js/bindings/JSDecompressionStream.h (4)
src/bun.js/bindings/JSCompressionStream.h (4)
  • WebCore (5-40)
  • create (10-15)
  • Structure (23-26)
  • GCClient (28-33)
src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h (1)
  • WebCore (8-957)
src/bun.js/bindings/webcore/DOMIsoSubspaces.h (2)
  • WebCore (9-960)
  • WebCore (962-964)
src/bun.js/bindings/JSDecompressionStream.cpp (19)
  • JSDecompressionStream (99-102)
  • createPrototype (110-115)
  • createPrototype (110-110)
  • prototype (117-120)
  • prototype (117-117)
  • getConstructor (122-125)
  • getConstructor (122-122)
  • vm (19-24)
  • vm (19-19)
  • vm (33-36)
  • vm (33-33)
  • subspaceFor (28-32)
  • subspaceFor (28-28)
  • subspaceForImpl (89-97)
  • subspaceForImpl (89-89)
  • finishCreation (80-85)
  • finishCreation (80-80)
  • finishCreation (104-108)
  • finishCreation (104-104)
src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h (2)
src/bun.js/bindings/JSCompressionStream.h (1)
  • GCClient (28-33)
src/bun.js/bindings/JSDecompressionStream.h (1)
  • GCClient (28-33)
bench/snippets/compression-streams.mjs (1)
bench/runner.mjs (4)
  • group (17-22)
  • bench (15-15)
  • bench (15-15)
  • run (7-13)
src/bun.js/bindings/JSCompressionStream.cpp (2)
src/bun.js/bindings/JSDecompressionStream.cpp (22)
  • vm (19-24)
  • vm (19-19)
  • vm (33-36)
  • vm (33-33)
  • prototype (117-120)
  • prototype (117-117)
  • prototypeForStructure (52-56)
  • prototypeForStructure (52-52)
  • initializeProperties (58-65)
  • initializeProperties (58-58)
  • initializeExecutable (67-70)
  • initializeExecutable (67-67)
  • finishCreation (80-85)
  • finishCreation (80-80)
  • finishCreation (104-108)
  • finishCreation (104-104)
  • subspaceForImpl (89-97)
  • subspaceForImpl (89-89)
  • createPrototype (110-115)
  • createPrototype (110-110)
  • getConstructor (122-125)
  • getConstructor (122-122)
src/bun.js/bindings/JSCompressionStream.h (2)
  • create (10-15)
  • JSCompressionStream (7-38)
🔇 Additional comments (25)
src/codegen/bundle-modules.ts (1)

535-535: LGTM: Type predicate improvement.

Changing from boolean to value is ${name} enables better type narrowing in consuming code. This is a useful enhancement with no runtime impact.

src/bun.js/bindings/webcore/DOMIsoSubspaces.h (1)

269-270: LGTM: IsoSubspace additions.

The new subspace members for CompressionStream and DecompressionStream are correctly positioned among other stream-related subspaces and follow the established naming convention.

src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h (1)

286-287: LGTM: Client subspace additions.

These client subspace members mirror the corresponding additions in DOMIsoSubspaces.h and maintain consistent positioning and naming.

src/js/builtins/DecompressionStream.ts (2)

24-27: LGTM: Proper type checking in getter.

The readable getter correctly validates the instance type before accessing private storage, preventing type confusion attacks.


5-11: No issues found — zstd decompression is fully supported and implemented.

The codebase includes comprehensive zstd support with zlib.createZstdDecompress available in the zlib module, including native Zstd streaming implementation for decompression. Node.js's zlib officially supports zstd decompression via createZstdDecompress, and Bun's implementation is fully functional with extensive test coverage validating round-trip compression and streaming decompression.

docs/runtime/nodejs-compat.mdx (1)

248-248: LGTM: Documentation updates.

The status updates correctly reflect the implementation of CompressionStream and DecompressionStream in this PR.

Also applies to: 276-276

test/integration/bun-types/fixture/streams.ts (1)

62-62: LGTM: Type-checking test added.

The test correctly validates that CompressionStream and DecompressionStream can be used in a streaming pipeline, following the same pattern as adjacent tests.

src/js/node/stream.web.ts (1)

18-19: LGTM: Module exports.

The exports correctly expose CompressionStream and DecompressionStream through the node:stream/web module, aligning with Node.js compatibility requirements.

src/bun.js/bindings/js_classes.ts (1)

11-12: Header files verified—code changes approved.

Both binding header files exist and are properly referenced by the mappings on lines 11-12.

bench/runner.mjs (1)

17-22: LGTM - Backward compatibility enhancement

The conditional handling for function-first-argument usage is straightforward and maintains backward compatibility while enabling explicit named groups.

src/bun.js/bindings/ZigGlobalObject.cpp (2)

81-82: LGTM - Proper header includes

The new includes for CompressionStream and DecompressionStream bindings are correctly placed and follow the existing include structure.


967-967: LGTM - Constructor registration follows existing patterns

The WEBCORE_GENERATED_CONSTRUCTOR_GETTER macros for CompressionStream and DecompressionStream are correctly placed and consistent with other stream constructor registrations in the codebase.

Also applies to: 971-971

src/bun.js/bindings/webcore/DOMConstructors.h (1)

201-202: LGTM - DOM constructor registration is correct

The new enum entries for CompressionStream and DecompressionStream are properly placed alongside other stream constructors, and the count is accurately updated (846 → 848).

Also applies to: 865-865

test/js/node/test/parallel/test-whatwg-webstreams-compression.js (3)

44-44: Verify support for non-standard compression formats

The test includes 'brotli' and 'zstd' formats, which are Bun extensions beyond the standard WHATWG CompressionStream API (which only mandates 'gzip', 'deflate', and 'deflate-raw'). Ensure these additional formats are intentionally supported and documented.


14-42: LGTM - Comprehensive compression roundtrip test

The test properly validates the complete compression/decompression flow including Symbol.toStringTag, stream piping, and data integrity verification.


46-70: LGTM - Good negative test coverage

The negative tests properly validate error handling for invalid format arguments and invalid receiver objects accessing the readable/writable getters.

test/js/node/test/parallel/test-global-webstreams.js (1)

1-24: LGTM - Validates global Web Streams constructor identity

The test correctly validates that all global Web Streams constructors, including the new CompressionStream and DecompressionStream, are identical to those exported by the stream/web module.

src/js/builtins/CompressionStream.ts (1)

24-33: LGTM - Proper getter validation

The readable and writable getters correctly validate the receiver type before accessing private storage, ensuring type safety.

src/bun.js/bindings/JSCompressionStream.h (1)

1-40: LGTM - Standard WebCore binding implementation

The JSCompressionStream binding follows the established WebCore/JSC patterns and is consistent with other stream bindings in the codebase (particularly JSDecompressionStream). The structure creation, subspace handling, and lifecycle methods are all correct.

bench/snippets/compression-streams.mjs (2)

18-69: LGTM - Clean compression utilities

The compress, decompress, and roundTrip helper functions properly handle stream lifecycle, chunk accumulation, and data reassembly.


75-146: LGTM - Well-structured benchmarks with proper error handling

The benchmark structure properly groups by data size, pre-computes compressed data for decompression tests, and uses try/catch to gracefully skip unsupported formats.

src/bun.js/bindings/JSDecompressionStream.h (1)

7-38: Header mirrors JSCompressionStream binding and looks structurally correct

The factory, structure creation, GC subspace hook, and lifecycle methods are consistent with the existing JSCompressionStream header pattern and WebCore JSDOM object conventions. I don’t see correctness or GC issues here.

src/bun.js/bindings/ZigGlobalObject.lut.txt (1)

46-85: New global constructor LUT entries are consistent with existing patterns

The added entries for CompressionStream, DecompressionStream, and the other DOM/Web Streams constructors use the expected *ConstructorCallback targets and PropertyCallback flags, matching surrounding entries. Names line up with the corresponding binding types and WHATWG globals.

src/bun.js/bindings/JSDecompressionStream.cpp (1)

16-125: DecompressionStream binding mirrors CompressionStream and appears correct

The prototype class, DOM constructor specialization, prototype property table (constructor, readable, writable), subspace wiring, and instance lifecycle (finishCreation, createPrototype, prototype, getConstructor) all match the existing JSCompressionStream pattern and WebCore builtin-constructor conventions. This should integrate cleanly with the DOM constructor ID and the new iso‑subspace fields.

src/bun.js/bindings/JSCompressionStream.cpp (1)

16-125: CompressionStream binding is consistent and symmetric with DecompressionStream

The prototype, DOM constructor specialization, prototype property table, GC subspace integration, and JSCompressionStream lifecycle methods line up with the DecompressionStream binding and standard JSDOMBuiltinConstructor usage. This should provide a solid surface for the JS builtins and global constructor exposure.

};

if (!(format in builders))
throw $ERR_INVALID_ARG_VALUE("format", format, "must be one of: " + Object.keys(builders).join(", "));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ngl i wonder the perf of this, but it is a really cold path so probably doesn't matter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that i could have used validateOneOf(format, "format", Object.keys(builders)); ?

@RiskyMH
Copy link
Member

RiskyMH commented Nov 16, 2025

Yeah this is a way better & simpler method than the one I did - especially as the perf was basically identical

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 388798d and 5d710b8.

📒 Files selected for processing (4)
  • bench/runner.mjs (1 hunks)
  • bench/snippets/compression-streams.mjs (1 hunks)
  • src/bun.js/bindings/JSCompressionStream.cpp (1 hunks)
  • src/bun.js/bindings/JSDecompressionStream.cpp (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-24T05:48:59.872Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22806
File: scripts/runner.node.mjs:687-689
Timestamp: 2025-09-24T05:48:59.872Z
Learning: In the Bun codebase, the `startGroup` utility function in scripts/runner.node.mjs automatically closes any previously open group when called, so `startGroup("End")` correctly closes the final test group and keeps subsequent output ungrouped.

Applied to files:

  • bench/runner.mjs
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.

Applied to files:

  • src/bun.js/bindings/JSDecompressionStream.cpp
  • src/bun.js/bindings/JSCompressionStream.cpp
📚 Learning: 2025-10-11T15:19:30.301Z
Learnt from: mastermakrela
Repo: oven-sh/bun PR: 19167
File: src/bun.js/api.zig:31-31
Timestamp: 2025-10-11T15:19:30.301Z
Learning: The learnings about `pub const js = JSC.Codegen.JS<ClassName>` and re-exporting toJS/fromJS/fromJSDirect apply to class-based Zig bindings with constructors and prototype methods (e.g., those with `new` constructors). They do NOT apply to simple namespace-style API objects like TOMLObject, YAMLObject, and CSVObject which expose static functions via a `create()` method that returns a plain JS object.

Applied to files:

  • src/bun.js/bindings/JSCompressionStream.cpp
🧬 Code graph analysis (3)
bench/snippets/compression-streams.mjs (1)
bench/runner.mjs (5)
  • group (16-16)
  • group (16-16)
  • bench (15-15)
  • bench (15-15)
  • run (7-13)
src/bun.js/bindings/JSDecompressionStream.cpp (3)
src/bun.js/bindings/JSCompressionStream.cpp (22)
  • vm (20-25)
  • vm (20-20)
  • vm (35-38)
  • vm (35-35)
  • prototype (119-122)
  • prototype (119-119)
  • prototypeForStructure (54-58)
  • prototypeForStructure (54-54)
  • initializeProperties (60-67)
  • initializeProperties (60-60)
  • initializeExecutable (69-72)
  • initializeExecutable (69-69)
  • finishCreation (82-87)
  • finishCreation (82-82)
  • finishCreation (106-110)
  • finishCreation (106-106)
  • subspaceForImpl (91-99)
  • subspaceForImpl (91-91)
  • createPrototype (112-117)
  • createPrototype (112-112)
  • getConstructor (124-127)
  • getConstructor (124-124)
src/bun.js/bindings/JSCompressionStream.h (1)
  • create (10-15)
src/bun.js/bindings/JSDecompressionStream.h (2)
  • create (10-15)
  • JSDecompressionStream (7-38)
src/bun.js/bindings/JSCompressionStream.cpp (2)
src/bun.js/bindings/JSDecompressionStream.cpp (22)
  • vm (20-25)
  • vm (20-20)
  • vm (35-38)
  • vm (35-35)
  • prototype (119-122)
  • prototype (119-119)
  • prototypeForStructure (54-58)
  • prototypeForStructure (54-54)
  • initializeProperties (60-67)
  • initializeProperties (60-60)
  • initializeExecutable (69-72)
  • initializeExecutable (69-69)
  • finishCreation (82-87)
  • finishCreation (82-82)
  • finishCreation (106-110)
  • finishCreation (106-106)
  • subspaceForImpl (91-99)
  • subspaceForImpl (91-91)
  • createPrototype (112-117)
  • createPrototype (112-112)
  • getConstructor (124-127)
  • getConstructor (124-124)
src/bun.js/bindings/JSCompressionStream.h (2)
  • create (10-15)
  • JSCompressionStream (7-38)
🔇 Additional comments (3)
src/bun.js/bindings/JSDecompressionStream.cpp (1)

17-87: Binding structure matches CompressionStream and uses safer global resolution

The JSDecompressionStream binding mirrors the JSCompressionStream pattern: prototype in plainObjectSpace, DOM constructor wired with "DecompressionStream" name, subspace management via subspaceForImpl, and getConstructor/prototype wiring all look consistent.

The custom getter jsDecompressionStreamConstructor now derives the realm from lexicalGlobalObject and only uses the prototype for a type check, which aligns with other DOM constructor getters and avoids relying on prototype-specific globalObject() access.

Also applies to: 89-137

src/bun.js/bindings/JSCompressionStream.cpp (1)

17-87: CompressionStream binding is consistent and aligned with DecompressionStream

This implementation follows the same pattern as JSDecompressionStream: prototype creation, ClassInfo, subspace wiring, DOM constructor setup, and getConstructor all look correct and consistent.

The jsCompressionStreamConstructor getter now uses lexicalGlobalObject as the source of the realm and only uses the prototype for a type check, which is safer and matches the updated DecompressionStream getter.

Also applies to: 89-137

bench/runner.mjs (1)

15-16: Direct alias to Mitata.group is compatible with all existing call sites

The change removes the wrapper function and exports group as a direct alias to Mitata.group. While this does change semantics (the single-function form is no longer supported), all 80+ benchmark call sites use the 2-argument form with either a string name or object config plus callback, which Mitata.group natively supports. The old wrapper's single-function handling path is unused in the codebase, making this a safe refactor with no practical impact on existing benchmarks.

@dylan-conway dylan-conway merged commit 5702b39 into main Nov 21, 2025
65 of 67 checks passed
@dylan-conway dylan-conway deleted the nektro-patch-49089 branch November 21, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CompressionStream

5 participants