Files
bun.sh/src/bun.js/api/streams.classes.ts
Jarred Sumner b3cfaab07f Fix: after pausing stdin, a subprocess should be able to read from stdin (#23341)
Fixes #23333, Fixes #13978

### What does this PR do?

### How did you verify your code works?

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: pfg <pfg@pfg.pw>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2025-10-09 19:04:41 -07:00

90 lines
1.9 KiB
TypeScript

import { define } from "../../codegen/class-definitions";
function source(name) {
return define({
name: name + "InternalReadableStreamSource",
construct: false,
noConstructor: true,
finalize: true,
configurable: false,
memoryCost: true,
proto: {
drain: {
fn: "drainFromJS",
length: 1,
},
start: {
fn: "startFromJS",
length: 1,
},
updateRef: {
fn: "updateRefFromJS",
length: 1,
},
onClose: {
getter: "getOnCloseFromJS",
setter: "setOnCloseFromJS",
},
onDrain: {
getter: "getOnDrainFromJS",
setter: "setOnDrainFromJS",
},
cancel: {
fn: "cancelFromJS",
length: 1,
},
pull: {
fn: "pullFromJS",
length: 1,
},
isClosed: {
getter: "getIsClosedFromJS",
},
...(name !== "File"
? // Buffered versions
// not implemented in File, yet.
{
text: {
fn: "textFromJS",
length: 0,
},
json: {
fn: "jsonFromJS",
length: 0,
},
arrayBuffer: {
fn: "arrayBufferFromJS",
length: 0,
},
blob: {
fn: "blobFromJS",
length: 0,
},
bytes: {
fn: "bytesFromJS",
length: 0,
},
}
: {}),
...(name === "File"
? {
setRawMode: {
fn: "setRawModeFromJS",
length: 1,
},
setFlowing: {
fn: "setFlowingFromJS",
length: 1,
},
}
: {}),
},
klass: {},
values: ["pendingPromise", "onCloseCallback", "onDrainCallback"],
});
}
const sources = ["Blob", "File", "Bytes"];
export default sources.map(source);