mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 06:41:50 +00:00
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>
90 lines
1.9 KiB
TypeScript
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);
|