Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 64 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions changelog.d/9622-bun-spawn-terminal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bun subprocess and terminal support

The `bun` compatibility layer now implements `Bun.spawn` in array and object
forms, including consumable output streams, process lifecycle controls, stdio
file descriptors and `Bun.file` sinks, and structured spawn errors. On POSIX
targets, `Bun.Terminal` attaches subprocesses to a native PTY with data, exit,
drain, write, resize, raw-mode, ref/unref, close, and async-disposal support.
14 changes: 14 additions & 0 deletions crates/perry-api-manifest/src/entries/part_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1102,8 +1102,18 @@ pub(crate) const API_MANIFEST_PART_4: &[ApiEntry] = &[
// Implementation: perry-runtime `bun_compat`.
method("bun", "stringWidth", false, None),
method("bun", "hash", false, None),
method("bun", "deepEquals", false, None),
method("bun", "stripANSI", false, None),
method("bun", "wrapAnsi", false, None),
method("bun", "which", false, None),
method("bun", "zstdDecompress", true, None),
method("bun", "zstdDecompressSync", false, None),
method("bun", "gc", false, None),
method("bun", "generateHeapSnapshot", false, None),
method("bun", "file", false, None),
method("bun", "write", false, None),
method("bun", "spawn", false, None),
method("bun", "Terminal", false, None),
method("bun", "pathToFileURL", false, None),
method("bun", "fileURLToPath", false, None),
// #8537 — OpenCode compatibility coverage added these dispatch rows
Expand All @@ -1116,6 +1126,10 @@ pub(crate) const API_MANIFEST_PART_4: &[ApiEntry] = &[
property("bun", "stderr"),
property("bun", "version"),
property("bun", "isStandaloneExecutable"),
property("bun", "YAML"),
property("bun", "TOML"),
property("bun", "semver"),
property("bun", "JSONL"),
// --- qs (issue #8751) ---
// Native nested query-string codec. This keeps Stripe's request encoder
// off qs' legacy get-intrinsic/ES-shims dependency chain.
Expand Down
90 changes: 90 additions & 0 deletions crates/perry-codegen/src/lower_call/native_table/bun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ use super::*;
/// `Bun.stdin` / `Bun.stdout` / `Bun.stderr` are property reads (handled by
/// `js_native_module_property_by_name`), not rows here.
pub(crate) const BUN_ROWS: &[NativeModSig] = &[
NativeModSig {
module: "bun",
has_receiver: false,
method: "spawn",
class_filter: None,
runtime: "js_bun_spawn",
args: &[NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "Terminal",
class_filter: None,
runtime: "js_bun_terminal_new",
args: &[NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
Expand All @@ -28,6 +46,78 @@ pub(crate) const BUN_ROWS: &[NativeModSig] = &[
args: &[NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "deepEquals",
class_filter: None,
runtime: "js_bun_deep_equals",
args: &[NA_F64, NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "stripANSI",
class_filter: None,
runtime: "js_bun_strip_ansi",
args: &[NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "wrapAnsi",
class_filter: None,
runtime: "js_bun_wrap_ansi",
args: &[NA_F64, NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "which",
class_filter: None,
runtime: "js_bun_which",
args: &[NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "zstdDecompress",
class_filter: None,
runtime: "js_bun_zstd_decompress",
args: &[NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "zstdDecompressSync",
class_filter: None,
runtime: "js_bun_zstd_decompress_sync",
args: &[NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "gc",
class_filter: None,
runtime: "js_bun_gc",
args: &[NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
method: "generateHeapSnapshot",
class_filter: None,
runtime: "js_bun_generate_heap_snapshot",
args: &[NA_F64, NA_F64],
ret: NR_F64,
},
NativeModSig {
module: "bun",
has_receiver: false,
Expand Down
Loading
Loading