Skip to content

Merge train: #9624 #9625 (Bun Transpiler/build, serve) + 3 gate fixes - #9636

Merged
proggeramlug merged 5 commits into
mainfrom
land-train93
Sep 3, 2026
Merged

Merge train: #9624 #9625 (Bun Transpiler/build, serve) + 3 gate fixes#9636
proggeramlug merged 5 commits into
mainfrom
land-train93

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Lands #9624 (Bun runtime Transpiler + build subset) and #9625 (Bun serve over native HTTP).

Nine conflicts against the just-landed #9621/#9622 tables, resolved as unions with each authors entries preserved: the expr_new/member.rs guard admits Transpiler alongside Glob/Terminal; the arity match arms were hand-merged; serves NativeModSig signature was taken from #9625s own file and confirmed to match the shared trailing args/ret before merging (a blind union would have given it Transpilers). All 9 methods across the three Bun PRs are present in the native table.

Three gate findings fixed, all real:

  • fix(runtime): #9192 — an array with a non-array [[Prototype]] inherited nothing (47 divergences from node → 19) #9219 shape: raw_heap_address in perry-ext-typescript used a bare >= 0x10000 floor, which admits the fetch/zlib/proxy handle bands — real addresses on Linux, hidden on macOS. Raised to the band top; the crate links only perry-ffi, so the constant is a documented mirror with a justified addr_class_allowlist.txt entry.
  • array_from_values held its pending values as raw addresses across js_array_push calls that can collect — array and values now rooted through TransientRootScope. (The gate refused a new baseline entry as firmly as a ceiling raise, so there was no bookkeeping escape.)
  • perry-hir/src/lower/tests.rs crossed the 2000-line cap; last test split out.

Validation: run_lint_gates.sh all 62 gates pass; release build green; RUST_TEST_THREADS=1 perry-runtime 3048/0; perry-hir 378/0; issue_9599_bun_platform 2/2; native_module 27/27 including arity_table_is_sorted.

Rebase-merge preserving authorship.

Summary by CodeRabbit

  • New Features
    • Added Bun-compatible Transpiler support for TypeScript/JSX transformation and import scanning.
    • Added in-memory Bun.build support, including external modules and onResolve/onLoad plugins.
    • Added Bun.serve and import { serve } from "bun" support with Fetch handlers, request metadata, lifecycle methods, and server properties.
    • Build failures now report filenames and source positions without terminating the process.
  • Documentation
    • Updated API declarations and reference documentation for the new Bun APIs.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: b5823709-7ac7-46ca-9313-65ba70aea3d5

📥 Commits

Reviewing files that changed from the base of the PR and between 51a70f3 and 4d91080.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (36)
  • Cargo.toml
  • changelog.d/9602-bun-runtime-compiler.md
  • changelog.d/9625-bun-serve.md
  • crates/perry-api-manifest/src/entries/part_4.rs
  • crates/perry-codegen/src/ext_registry.rs
  • crates/perry-codegen/src/lower_call/builtin.rs
  • crates/perry-codegen/src/lower_call/native_table/bun.rs
  • crates/perry-ext-http/src/server/bun_server.rs
  • crates/perry-ext-http/src/server/dispatch_ext.rs
  • crates/perry-ext-http/src/server/handle_dispatch.rs
  • crates/perry-ext-http/src/server/mod.rs
  • crates/perry-ext-http/src/server/server.rs
  • crates/perry-ext-typescript/Cargo.toml
  • crates/perry-ext-typescript/src/bun.rs
  • crates/perry-ext-typescript/src/lib.rs
  • crates/perry-hir/src/js_transform/local_natives.rs
  • crates/perry-hir/src/lower/expr_call/module_static.rs
  • crates/perry-hir/src/lower/expr_new/member.rs
  • crates/perry-hir/src/lower/tests.rs
  • crates/perry-hir/src/lower/tests/nullish_over_optional_chain.rs
  • crates/perry-runtime/src/object/native_module/callable_export_arity_table.rs
  • crates/perry-runtime/src/object/native_module/callable_export_check.rs
  • crates/perry-runtime/src/object/native_module/callable_export_table.rs
  • crates/perry-runtime/src/object/native_module/constructor_exports.rs
  • crates/perry-runtime/src/object/native_module/module_keys.rs
  • crates/perry-runtime/src/object/native_module_dispatch/dispatch_a_c.rs
  • crates/perry-stdlib/src/common/dispatch/init.rs
  • crates/perry-stdlib/src/fetch/bun_server_bridge.rs
  • crates/perry-stdlib/src/fetch/mod.rs
  • crates/perry/tests/issue_6560_bun_globals.rs
  • crates/perry/tests/issue_9599_bun_platform.rs
  • crates/perry/tests/issue_9602_bun_runtime_compiler.rs
  • crates/perry/tests/issue_9603_bun_serve.rs
  • docs/api/perry.d.ts
  • docs/src/api/reference.md
  • scripts/addr_class_allowlist.txt

📝 Walkthrough

Walkthrough

Changes

Bun runtime compiler

Layer / File(s) Summary
Compiler API surface and lowering
Cargo.toml, crates/perry-ext-typescript/..., crates/perry-codegen/..., crates/perry-hir/..., crates/perry-runtime/..., crates/perry-api-manifest/..., docs/..., scripts/...
Registers Bun.Transpiler and Bun.build across dependencies, lowering, native dispatch, exports, manifests, and documentation.
SWC transpiler and build implementation
crates/perry-ext-typescript/src/bun.rs, crates/perry/tests/issue_9602_bun_runtime_compiler.rs, changelog.d/9602-bun-runtime-compiler.md
Implements TypeScript/JSX lowering, import scanning, plugin hooks, bundling, diagnostics, promise results, and integration coverage.
Compiler lowering and regression validation
crates/perry-hir/src/lower/tests.rs, crates/perry-hir/src/lower/tests/nullish_over_optional_chain.rs
Tests native lowering for Bun compiler calls and isolates the optional-chain type regression test.

Bun.serve HTTP facade

Layer / File(s) Summary
Serve API surface and dispatch wiring
crates/perry-api-manifest/..., crates/perry-codegen/..., crates/perry-runtime/..., crates/perry-stdlib/..., crates/perry-ext-http/..., docs/..., changelog.d/9625-bun-serve.md
Registers Bun.serve, routes it to the HTTP extension, and exposes its callable export and documented API surface.
Serve request and promise lifecycle
crates/perry-ext-http/src/server/...
Adds server creation, Fetch handler invocation, promise settlement, response application, request IP tracking, lifecycle operations, and GC root handling.
Fetch bridge and server member behavior
crates/perry-stdlib/src/fetch/..., crates/perry-ext-http/src/server/dispatch_*.rs
Converts HTTP request and response snapshots through Fetch registries and exposes Bun server methods and properties.
Serve integration validation
crates/perry/tests/issue_6560_bun_globals.rs, crates/perry/tests/issue_9599_bun_platform.rs, crates/perry/tests/issue_9603_bun_serve.rs
Updates unsupported-call expectations and tests HTTP handling, asynchronous handlers, metadata, lifecycle methods, errors, and TLS rejection.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested reviewers: thehypnoo

Sequence Diagram(s)

sequenceDiagram
  participant BunCode
  participant PerryRuntime
  participant TypeScriptExtension
  participant SWCBundler
  BunCode->>PerryRuntime: Call Transpiler or build
  PerryRuntime->>TypeScriptExtension: Native FFI call
  TypeScriptExtension->>SWCBundler: Transform, resolve, and bundle
  SWCBundler-->>TypeScriptExtension: Output or diagnostics
  TypeScriptExtension-->>BunCode: String or promise result
Loading
sequenceDiagram
  participant Client
  participant HttpServer
  participant BunServe
  participant FetchRegistry
  Client->>HttpServer: HTTP request
  HttpServer->>BunServe: Process pending request
  BunServe->>FetchRegistry: Create Fetch Request
  BunServe-->>FetchRegistry: Snapshot Fetch Response
  HttpServer-->>Client: HTTP response
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch land-train93

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit ece26f9 into main Sep 3, 2026
18 of 22 checks passed
@proggeramlug
proggeramlug deleted the land-train93 branch September 3, 2026 15:24
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.

1 participant