aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 22:10:12 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-15 22:10:12 -0700
commite6fbbd48db4077ab3d35fef322d2612cb6141a12 (patch)
tree7f8c43e4f7f4a051ab1b35e93aab2baab550e6e6
parent56e88fb4dd06e07569ddc3861e2e8e21f71e45b8 (diff)
downloadbun-e6fbbd48db4077ab3d35fef322d2612cb6141a12.tar.gz
bun-e6fbbd48db4077ab3d35fef322d2612cb6141a12.tar.zst
bun-e6fbbd48db4077ab3d35fef322d2612cb6141a12.zip
Fix lazy loading internal streams
-rw-r--r--src/javascript/jsc/bindings/BunBuiltinNames.h3
-rw-r--r--src/javascript/jsc/bindings/ReadableByteStreamInternalsBuiltins.cpp47
-rw-r--r--src/javascript/jsc/bindings/ReadableStreamBuiltins.cpp41
-rw-r--r--src/javascript/jsc/bindings/ReadableStreamInternalsBuiltins.cpp46
-rw-r--r--src/javascript/jsc/bindings/ZigGlobalObject.cpp33
-rw-r--r--src/javascript/jsc/bindings/ZigGlobalObject.h2
-rw-r--r--src/javascript/jsc/bindings/builtins/js/ReadableByteStreamInternals.js41
-rw-r--r--src/javascript/jsc/bindings/builtins/js/ReadableStream.js33
-rw-r--r--src/javascript/jsc/bindings/builtins/js/ReadableStreamInternals.js36
-rw-r--r--src/javascript/jsc/bindings/headers-cpp.h2
-rw-r--r--src/javascript/jsc/bindings/headers.h496
-rw-r--r--src/javascript/jsc/bindings/headers.zig2
-rw-r--r--src/javascript/jsc/webcore/streams.zig2
13 files changed, 424 insertions, 360 deletions
diff --git a/src/javascript/jsc/bindings/BunBuiltinNames.h b/src/javascript/jsc/bindings/BunBuiltinNames.h
index 917f0bf09..1b49338c0 100644
--- a/src/javascript/jsc/bindings/BunBuiltinNames.h
+++ b/src/javascript/jsc/bindings/BunBuiltinNames.h
@@ -125,12 +125,13 @@ using namespace JSC;
macro(join) \
macro(kind) \
macro(lazy) \
+ macro(lazyStreamPrototypeMap) \
+ macro(lazyLoad) \
macro(localStreams) \
macro(makeDOMException) \
macro(makeGetterTypeError) \
macro(makeThisTypeError) \
macro(map) \
- macro(nativeReadableStreamPrototype) \
macro(nextTick) \
macro(normalize) \
macro(on) \
diff --git a/src/javascript/jsc/bindings/ReadableByteStreamInternalsBuiltins.cpp b/src/javascript/jsc/bindings/ReadableByteStreamInternalsBuiltins.cpp
index 97bcc0e25..5f2f77b6a 100644
--- a/src/javascript/jsc/bindings/ReadableByteStreamInternalsBuiltins.cpp
+++ b/src/javascript/jsc/bindings/ReadableByteStreamInternalsBuiltins.cpp
@@ -49,7 +49,7 @@ namespace WebCore {
const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 2089;
+const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 2365;
static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode =
"(function (stream, underlyingByteSource, highWaterMark)\n" \
@@ -69,7 +69,7 @@ const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStre
" @putByIdDirectPrivate(this, \"pulling\", false);\n" \
" @readableByteStreamControllerClearPendingPullIntos(this);\n" \
" @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \
- " @putByIdDirectPrivate(this, \"started\", -1);\n" \
+ " @putByIdDirectPrivate(this, \"started\", 0);\n" \
" @putByIdDirectPrivate(this, \"closeRequested\", false);\n" \
"\n" \
" let hwm = @toNumber(highWaterMark);\n" \
@@ -86,44 +86,34 @@ const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStre
" @putByIdDirectPrivate(this, \"autoAllocateChunkSize\", autoAllocateChunkSize);\n" \
" @putByIdDirectPrivate(this, \"pendingPullIntos\", @createFIFO());\n" \
"\n" \
- " @putByIdDirectPrivate(this, \"cancel\", @readableByteStreamControllerCancel);\n" \
- " @putByIdDirectPrivate(this, \"pull\", @readableByteStreamControllerPull);\n" \
"\n" \
- " if (@getByIdDirectPrivate(underlyingByteSource, \"lazy\") === true) {\n" \
- " @putByIdDirectPrivate(this, \"start\", () => @readableStreamByteStreamControllerStart(this));\n" \
- " } else {\n" \
- " @putByIdDirectPrivate(this, \"start\", @undefined); \n" \
- " @readableStreamByteStreamControllerStart(this);\n" \
- " }\n" \
+ " const controller = this;\n" \
+ " @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"start\", [controller]).@then(() => {\n" \
+ " @putByIdDirectPrivate(controller, \"started\", 1);\n" \
+ " @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \
+ " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \
+ " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \
+ " }, (error) => {\n" \
+ " if (@getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \
+ " @readableByteStreamControllerError(controller, error);\n" \
+ " });\n" \
"\n" \
+ " @putByIdDirectPrivate(this, \"cancel\", @readableByteStreamControllerCancel);\n" \
+ " @putByIdDirectPrivate(this, \"pull\", @readableByteStreamControllerPull);\n" \
+ " \n" \
" return this;\n" \
"})\n" \
;
const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength = 972;
+const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength = 107;
static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode =
"(function (controller) {\n" \
" \"use strict\";\n" \
" @putByIdDirectPrivate(controller, \"start\", @undefined);\n" \
- " \n" \
- " if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n" \
- " return;\n" \
"\n" \
- " @putByIdDirectPrivate(controller, \"started\", 0);\n" \
- " var stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \
- " return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"start\", [controller]).@then(() => {\n" \
- " @putByIdDirectPrivate(controller, \"started\", 1);\n" \
- " @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \
- " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \
- " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \
- " }, (error) => {\n" \
- " var stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \
- " if (stream && @getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \
- " @readableByteStreamControllerError(controller, error);\n" \
- " });\n" \
"})\n" \
;
@@ -339,7 +329,7 @@ const char* const s_readableByteStreamInternalsReadableByteStreamControllerHandl
const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength = 1598;
+const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength = 1610;
static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerPullCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullCode =
"(function (controller)\n" \
@@ -348,8 +338,7 @@ const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullC
"\n" \
" const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \
" @assert(@readableStreamHasDefaultReader(stream));\n" \
- "\n" \
- " if (@getByIdDirectPrivate(controller, \"queue\").size > 0) {\n" \
+ " if (@getByIdDirectPrivate(controller, \"queue\").content?.isNotEmpty()) {\n" \
" const entry = @getByIdDirectPrivate(controller, \"queue\").content.shift();\n" \
" @getByIdDirectPrivate(controller, \"queue\").size -= entry.byteLength;\n" \
" @readableByteStreamControllerHandleQueueDrain(controller);\n" \
diff --git a/src/javascript/jsc/bindings/ReadableStreamBuiltins.cpp b/src/javascript/jsc/bindings/ReadableStreamBuiltins.cpp
index b7692a601..7ce97e7bb 100644
--- a/src/javascript/jsc/bindings/ReadableStreamBuiltins.cpp
+++ b/src/javascript/jsc/bindings/ReadableStreamBuiltins.cpp
@@ -49,7 +49,7 @@ namespace WebCore {
const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInitializeReadableStreamCodeLength = 2262;
+const int s_readableStreamInitializeReadableStreamCodeLength = 2501;
static const JSC::Intrinsic s_readableStreamInitializeReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInitializeReadableStreamCode =
"(function (underlyingSource, strategy)\n" \
@@ -57,7 +57,7 @@ const char* const s_readableStreamInitializeReadableStreamCode =
" \"use strict\";\n" \
"\n" \
" if (underlyingSource === @undefined)\n" \
- " underlyingSource = { };\n" \
+ " underlyingSource = { @bunNativeType: 0, @bunNativePtr: 0, @lazy: false };\n" \
" if (strategy === @undefined)\n" \
" strategy = { };\n" \
"\n" \
@@ -77,6 +77,8 @@ const char* const s_readableStreamInitializeReadableStreamCode =
" \n" \
" //\n" \
" @putByIdDirectPrivate(this, \"readableStreamController\", null);\n" \
+ " @putByIdDirectPrivate(this, \"bunNativeType\", @getByIdDirectPrivate(underlyingSource, \"bunNativeType\") ?? 0);\n" \
+ " @putByIdDirectPrivate(this, \"bunNativePtr\", @getByIdDirectPrivate(underlyingSource, \"bunNativePtr\") ?? 0);\n" \
"\n" \
" const isDirect = underlyingSource.type === \"direct\";\n" \
" //\n" \
@@ -93,16 +95,20 @@ const char* const s_readableStreamInitializeReadableStreamCode =
" return this;\n" \
" }\n" \
" if (isDirect) {\n" \
- " if (\"start\" in underlyingSource && typeof underlyingSource.start === \"function\")\n" \
- " @throwTypeError(\"\\\"start\\\" for direct streams are not implemented yet\");\n" \
- " \n" \
- " @putByIdDirectPrivate(this, \"start\", () => @createReadableStreamController.@call(this, underlyingSource, strategy, true));\n" \
+ " @putByIdDirectPrivate(this, \"start\", () => @createReadableStreamController(this, underlyingSource, strategy));\n" \
" } else if (isLazy) {\n" \
" const autoAllocateChunkSize = underlyingSource.autoAllocateChunkSize;\n" \
- " @putByIdDirectPrivate(this, \"start\", () => @lazyLoadStream(this, autoAllocateChunkSize));\n" \
+ "\n" \
+ " \n" \
+ " @putByIdDirectPrivate(this, \"start\", () => {\n" \
+ " const instance = @lazyLoadStream(this, autoAllocateChunkSize);\n" \
+ " if (instance) {\n" \
+ " @createReadableStreamController(this, instance, strategy);\n" \
+ " }\n" \
+ " });\n" \
" } else {\n" \
" @putByIdDirectPrivate(this, \"start\", @undefined);\n" \
- " @createReadableStreamController.@call(this, underlyingSource, strategy, false);\n" \
+ " @createReadableStreamController(this, underlyingSource, strategy);\n" \
" }\n" \
" \n" \
"\n" \
@@ -383,10 +389,12 @@ const char* const s_readableStreamConsumeReadableStreamCode =
const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamCreateEmptyReadableStreamCodeLength = 137;
+const int s_readableStreamCreateEmptyReadableStreamCodeLength = 156;
static const JSC::Intrinsic s_readableStreamCreateEmptyReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamCreateEmptyReadableStreamCode =
"(function () {\n" \
+ " \"use strict\";\n" \
+ "\n" \
" var stream = new @ReadableStream({\n" \
" pull() {},\n" \
" });\n" \
@@ -397,18 +405,17 @@ const char* const s_readableStreamCreateEmptyReadableStreamCode =
const JSC::ConstructAbility s_readableStreamCreateNativeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamCreateNativeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamCreateNativeReadableStreamCodeLength = 343;
+const int s_readableStreamCreateNativeReadableStreamCodeLength = 266;
static const JSC::Intrinsic s_readableStreamCreateNativeReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamCreateNativeReadableStreamCode =
"(function (nativePtr, nativeType, autoAllocateChunkSize) {\n" \
" \"use strict\";\n" \
- " stream = new @ReadableStream({\n" \
+ " return new @ReadableStream({\n" \
" @lazy: true,\n" \
+ " @bunNativeType: nativeType,\n" \
+ " @bunNativePtr: nativePtr,\n" \
" autoAllocateChunkSize: autoAllocateChunkSize,\n" \
" });\n" \
- " @putByIdDirectPrivate(stream, \"bunNativeType\", nativeType);\n" \
- " @putByIdDirectPrivate(stream, \"bunNativePtr\", nativePtr);\n" \
- " return stream;\n" \
"})\n" \
;
@@ -433,7 +440,7 @@ const char* const s_readableStreamCancelCode =
const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamGetReaderCodeLength = 619;
+const int s_readableStreamGetReaderCodeLength = 680;
static const JSC::Intrinsic s_readableStreamGetReaderCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamGetReaderCode =
"(function (options)\n" \
@@ -447,8 +454,10 @@ const char* const s_readableStreamGetReaderCode =
" if (mode === @undefined) {\n" \
" var start_ = @getByIdDirectPrivate(this, \"start\");\n" \
" if (start_) {\n" \
- " start_.@call(this);\n" \
+ " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \
+ " start_();\n" \
" }\n" \
+ " \n" \
" return new @ReadableStreamDefaultReader(this);\n" \
" }\n" \
" //\n" \
diff --git a/src/javascript/jsc/bindings/ReadableStreamInternalsBuiltins.cpp b/src/javascript/jsc/bindings/ReadableStreamInternalsBuiltins.cpp
index 6bc61fd96..09e96a121 100644
--- a/src/javascript/jsc/bindings/ReadableStreamInternalsBuiltins.cpp
+++ b/src/javascript/jsc/bindings/ReadableStreamInternalsBuiltins.cpp
@@ -197,13 +197,11 @@ const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerC
const JSC::ConstructAbility s_readableStreamInternalsCreateReadableStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInternalsCreateReadableStreamControllerCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength = 1256;
+const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength = 1196;
static const JSC::Intrinsic s_readableStreamInternalsCreateReadableStreamControllerCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInternalsCreateReadableStreamControllerCode =
- "(function (underlyingSource, strategy, fromLazy) {\n" \
- " if (fromLazy) {\n" \
- " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \
- " }\n" \
+ "(function (stream, underlyingSource, strategy) {\n" \
+ " \"use strict\";\n" \
"\n" \
" const type = underlyingSource.type;\n" \
" const typeString = @toString(type);\n" \
@@ -217,15 +215,15 @@ const char* const s_readableStreamInternalsCreateReadableStreamControllerCode =
" if (strategy.size !== @undefined)\n" \
" @throwRangeError(\"Strategy for a ReadableByteStreamController cannot have a size\");\n" \
"\n" \
- " @putByIdDirectPrivate(this, \"readableStreamController\", new @ReadableByteStreamController(this, underlyingSource, strategy.highWaterMark, @isReadableStream));\n" \
+ " @putByIdDirectPrivate(stream, \"readableStreamController\", new @ReadableByteStreamController(stream, underlyingSource, strategy.highWaterMark, @isReadableStream));\n" \
" } else if (typeString === \"direct\") {\n" \
" var highWaterMark = strategy?.highWaterMark;\n" \
- " @initializeArrayBufferStream.@call(this, underlyingSource, highWaterMark); \n" \
+ " @initializeArrayBufferStream.@call(stream, underlyingSource, highWaterMark); \n" \
" } else if (type === @undefined) {\n" \
" if (strategy.highWaterMark === @undefined)\n" \
" strategy.highWaterMark = 1;\n" \
" \n" \
- " @setupReadableStreamDefaultController(this, underlyingSource, strategy.size, strategy.highWaterMark, underlyingSource.start, underlyingSource.pull, underlyingSource.cancel);\n" \
+ " @setupReadableStreamDefaultController(stream, underlyingSource, strategy.size, strategy.highWaterMark, underlyingSource.start, underlyingSource.pull, underlyingSource.cancel);\n" \
" } else\n" \
" @throwRangeError(\"Invalid type for underlying source\");\n" \
"\n" \
@@ -392,11 +390,13 @@ const char* const s_readableStreamInternalsPipeToDoReadWriteCode =
const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 676;
+const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 695;
static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode =
"(function (pipeState)\n" \
"{\n" \
+ " \"use strict\";\n" \
+ "\n" \
" const action = () => {\n" \
" pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);\n" \
" const error = @getByIdDirectPrivate(pipeState.source, \"storedError\");\n" \
@@ -442,11 +442,12 @@ const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardC
const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 680;
+const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 698;
static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode =
"(function (pipeState)\n" \
"{\n" \
+ " \"use strict\";\n" \
" const action = () => {\n" \
" pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);\n" \
" const error = @getByIdDirectPrivate(pipeState.source, \"storedError\");\n" \
@@ -466,11 +467,12 @@ const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardC
const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength = 464;
+const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength = 482;
static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode =
"(function (pipeState)\n" \
"{\n" \
+ " \"use strict\";\n" \
" if (!@writableStreamCloseQueuedOrInFlight(pipeState.destination) && @getByIdDirectPrivate(pipeState.destination, \"state\") !== \"closed\")\n" \
" return;\n" \
"\n" \
@@ -1486,20 +1488,18 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanClo
const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind = JSC::ConstructorKind::None;
-const int s_readableStreamInternalsLazyLoadStreamCodeLength = 3053;
+const int s_readableStreamInternalsLazyLoadStreamCodeLength = 2853;
static const JSC::Intrinsic s_readableStreamInternalsLazyLoadStreamCodeIntrinsic = JSC::NoIntrinsic;
const char* const s_readableStreamInternalsLazyLoadStreamCode =
"(function (stream, autoAllocateChunkSize) {\n" \
" \"use strict\";\n" \
"\n" \
- " @putByIdDirectPrivate(stream, \"start\", @undefined);\n" \
- " var bunNativeType = @getByIdDirectPrivate(stream, \"bunNativeType\");\n" \
- " var bunNativePtr = @getByIdDirectPrivate(stream, \"bunNativePtr\");\n" \
- "\n" \
- " var cached = globalThis[globalThis.Symbol.for(\"Bun.nativeReadableStreamPrototype\")] ||= new @Map;\n" \
+ " var nativeType = @getByIdDirectPrivate(stream, \"bunNativeType\");\n" \
+ " var nativePtr = @getByIdDirectPrivate(stream, \"bunNativePtr\");\n" \
+ " var cached = @lazyStreamPrototypeMap;\n" \
" var Prototype = cached.@get(nativeType);\n" \
" if (Prototype === @undefined) {\n" \
- " var [pull, start, cancel, setClose, deinit] = globalThis[globalThis.Symbol.for(\"Bun.lazy\")](nativeType);\n" \
+ " var [pull, start, cancel, setClose, deinit] = @lazyLoad(nativeType);\n" \
" var closer = [false];\n" \
" var handleResult;\n" \
" function handleNativeReadableStreamPromiseResult(val) {\n" \
@@ -1561,26 +1561,22 @@ const char* const s_readableStreamInternalsLazyLoadStreamCode =
" cancel_(reason) {\n" \
" cancel(this, reason);\n" \
" }\n" \
- "\n" \
+ " static deinit = deinit;\n" \
" static registry = new FinalizationRegistry(deinit);\n" \
" }\n" \
" cached.@set(nativeType, Prototype);\n" \
" }\n" \
"\n" \
- " //\n" \
- " //\n" \
- " //\n" \
" const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize);\n" \
"\n" \
" //\n" \
" if (chunkSize === 0) {\n" \
" @readableStreamClose(stream);\n" \
- " return;\n" \
+ " return null;\n" \
" }\n" \
- "\n" \
" var instance = new Prototype(nativePtr, chunkSize);\n" \
" Prototype.registry.register(instance, nativePtr);\n" \
- " @createReadableStreamController.@call(stream, instance, @undefined, true);\n" \
+ " return instance;\n" \
"})\n" \
;
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.cpp b/src/javascript/jsc/bindings/ZigGlobalObject.cpp
index 43e2de52e..45a3aa729 100644
--- a/src/javascript/jsc/bindings/ZigGlobalObject.cpp
+++ b/src/javascript/jsc/bindings/ZigGlobalObject.cpp
@@ -375,6 +375,17 @@ void GlobalObject::setConsole(void* console)
#pragma mark - Globals
+JSC_DECLARE_CUSTOM_GETTER(functionLazyLoadStreamProtoypeMap_getter);
+
+JSC_DEFINE_CUSTOM_GETTER(functionLazyLoadStreamProtoypeMap_getter,
+ (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
+ JSC::PropertyName))
+{
+ Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
+ return JSC::JSValue::encode(
+ thisObject->readableStreamNativeMap());
+}
+
JSC_DECLARE_CUSTOM_GETTER(JSBuffer_getter);
JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter,
@@ -1667,6 +1678,12 @@ void GlobalObject::finishCreation(VM& vm)
init.set(prototype);
});
+ m_lazyReadableStreamPrototypeMap.initLater(
+ [](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSMap>::Initializer& init) {
+ auto* map = JSC::JSMap::create(init.owner, init.vm, init.owner->mapStructure());
+ init.set(map);
+ });
+
m_JSArrayBufferSinkClassStructure.initLater(
[](LazyClassStructure::Initializer& init) {
auto* prototype = createJSSinkPrototype(init.vm, init.global, WebCore::SinkID::ArrayBufferSink);
@@ -1697,7 +1714,7 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
auto& builtinNames = WebCore::builtinNames(vm);
WTF::Vector<GlobalPropertyInfo> extraStaticGlobals;
- extraStaticGlobals.reserveCapacity(28);
+ extraStaticGlobals.reserveCapacity(29);
JSC::Identifier queueMicrotaskIdentifier = JSC::Identifier::fromString(vm, "queueMicrotask"_s);
extraStaticGlobals.uncheckedAppend(
@@ -1762,10 +1779,16 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
static NeverDestroyed<const String> BunLazyString(MAKE_STATIC_STRING_IMPL("Bun.lazy"));
JSC::Identifier BunLazyIdentifier = JSC::Identifier::fromUid(vm.symbolRegistry().symbolForKey(BunLazyString));
+ JSC::JSFunction* lazyLoadFunction = JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
+ BunLazyString, functionLazyLoad);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { BunLazyIdentifier,
- JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
- BunLazyString, functionLazyLoad),
+ lazyLoadFunction,
+ JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::Function | 0 });
+
+ extraStaticGlobals.uncheckedAppend(
+ GlobalPropertyInfo { builtinNames.lazyLoadPrivateName(),
+ lazyLoadFunction,
JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::Function | 0 });
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.makeThisTypeErrorPrivateName(), JSFunction::create(vm, this, 2, String(), makeThisTypeErrorForBuiltins), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
@@ -1804,6 +1827,9 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "URL"_s), JSC::CustomGetterSetter::create(vm, JSDOMURL_getter, nullptr),
JSC::PropertyAttribute::DontDelete | 0);
+ putDirectCustomAccessor(vm, builtinNames.lazyStreamPrototypeMapPrivateName(), JSC::CustomGetterSetter::create(vm, functionLazyLoadStreamProtoypeMap_getter, nullptr),
+ JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0);
+
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "URLSearchParams"_s), JSC::CustomGetterSetter::create(vm, JSURLSearchParams_getter, nullptr),
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
@@ -2022,6 +2048,7 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
thisObject->m_JSFFIFunctionStructure.visit(visitor);
thisObject->m_JSArrayBufferSinkClassStructure.visit(visitor);
thisObject->m_JSArrayBufferControllerPrototype.visit(visitor);
+ thisObject->m_lazyReadableStreamPrototypeMap.visit(visitor);
visitor.append(thisObject->m_readableStreamToArrayBufferResolve);
visitor.append(thisObject->m_readableStreamToText);
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.h b/src/javascript/jsc/bindings/ZigGlobalObject.h
index 95fba762d..4f8a7871e 100644
--- a/src/javascript/jsc/bindings/ZigGlobalObject.h
+++ b/src/javascript/jsc/bindings/ZigGlobalObject.h
@@ -152,6 +152,7 @@ public:
JSC::JSObject* ArrayBufferSink() { return m_JSArrayBufferSinkClassStructure.constructorInitializedOnMainThread(this); }
JSC::JSValue ArrayBufferSinkPrototype() { return m_JSArrayBufferSinkClassStructure.prototypeInitializedOnMainThread(this); }
JSC::JSValue JSReadableArrayBufferSinkControllerPrototype() { return m_JSArrayBufferControllerPrototype.getInitializedOnMainThread(this); }
+ JSC::JSMap* readableStreamNativeMap() { return m_lazyReadableStreamPrototypeMap.getInitializedOnMainThread(this); }
void* bunVM() { return m_bunVM; }
bool isThreadLocalDefaultGlobalObject = false;
@@ -177,6 +178,7 @@ private:
LazyClassStructure m_NapiClassStructure;
LazyClassStructure m_JSArrayBufferSinkClassStructure;
LazyProperty<JSGlobalObject, JSObject> m_JSArrayBufferControllerPrototype;
+ LazyProperty<JSGlobalObject, JSMap> m_lazyReadableStreamPrototypeMap;
DOMGuardedObjectSet m_guardedObjects WTF_GUARDED_BY_LOCK(m_gcLock);
void* m_bunVM;
diff --git a/src/javascript/jsc/bindings/builtins/js/ReadableByteStreamInternals.js b/src/javascript/jsc/bindings/builtins/js/ReadableByteStreamInternals.js
index f59a7bdbc..01da62e1a 100644
--- a/src/javascript/jsc/bindings/builtins/js/ReadableByteStreamInternals.js
+++ b/src/javascript/jsc/bindings/builtins/js/ReadableByteStreamInternals.js
@@ -41,7 +41,7 @@ function privateInitializeReadableByteStreamController(stream, underlyingByteSou
@putByIdDirectPrivate(this, "pulling", false);
@readableByteStreamControllerClearPendingPullIntos(this);
@putByIdDirectPrivate(this, "queue", @newQueue());
- @putByIdDirectPrivate(this, "started", -1);
+ @putByIdDirectPrivate(this, "started", 0);
@putByIdDirectPrivate(this, "closeRequested", false);
let hwm = @toNumber(highWaterMark);
@@ -58,38 +58,28 @@ function privateInitializeReadableByteStreamController(stream, underlyingByteSou
@putByIdDirectPrivate(this, "autoAllocateChunkSize", autoAllocateChunkSize);
@putByIdDirectPrivate(this, "pendingPullIntos", @createFIFO());
- @putByIdDirectPrivate(this, "cancel", @readableByteStreamControllerCancel);
- @putByIdDirectPrivate(this, "pull", @readableByteStreamControllerPull);
- if (@getByIdDirectPrivate(underlyingByteSource, "lazy") === true) {
- @putByIdDirectPrivate(this, "start", () => @readableStreamByteStreamControllerStart(this));
- } else {
- @putByIdDirectPrivate(this, "start", @undefined);
- @readableStreamByteStreamControllerStart(this);
- }
+ const controller = this;
+ @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, "underlyingByteSource"), "start", [controller]).@then(() => {
+ @putByIdDirectPrivate(controller, "started", 1);
+ @assert(!@getByIdDirectPrivate(controller, "pulling"));
+ @assert(!@getByIdDirectPrivate(controller, "pullAgain"));
+ @readableByteStreamControllerCallPullIfNeeded(controller);
+ }, (error) => {
+ if (@getByIdDirectPrivate(stream, "state") === @streamReadable)
+ @readableByteStreamControllerError(controller, error);
+ });
+ @putByIdDirectPrivate(this, "cancel", @readableByteStreamControllerCancel);
+ @putByIdDirectPrivate(this, "pull", @readableByteStreamControllerPull);
+
return this;
}
function readableStreamByteStreamControllerStart(controller) {
"use strict";
@putByIdDirectPrivate(controller, "start", @undefined);
-
- if (@getByIdDirectPrivate(controller, "started") !== -1)
- return;
- @putByIdDirectPrivate(controller, "started", 0);
- var stream = @getByIdDirectPrivate(controller, "controlledReadableStream");
- return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, "underlyingByteSource"), "start", [controller]).@then(() => {
- @putByIdDirectPrivate(controller, "started", 1);
- @assert(!@getByIdDirectPrivate(controller, "pulling"));
- @assert(!@getByIdDirectPrivate(controller, "pullAgain"));
- @readableByteStreamControllerCallPullIfNeeded(controller);
- }, (error) => {
- var stream = @getByIdDirectPrivate(controller, "controlledReadableStream");
- if (stream && @getByIdDirectPrivate(stream, "state") === @streamReadable)
- @readableByteStreamControllerError(controller, error);
- });
}
@@ -237,8 +227,7 @@ function readableByteStreamControllerPull(controller)
const stream = @getByIdDirectPrivate(controller, "controlledReadableStream");
@assert(@readableStreamHasDefaultReader(stream));
-
- if (@getByIdDirectPrivate(controller, "queue").size > 0) {
+ if (@getByIdDirectPrivate(controller, "queue").content?.isNotEmpty()) {
const entry = @getByIdDirectPrivate(controller, "queue").content.shift();
@getByIdDirectPrivate(controller, "queue").size -= entry.byteLength;
@readableByteStreamControllerHandleQueueDrain(controller);
diff --git a/src/javascript/jsc/bindings/builtins/js/ReadableStream.js b/src/javascript/jsc/bindings/builtins/js/ReadableStream.js
index cfe68d13c..db7cf85a8 100644
--- a/src/javascript/jsc/bindings/builtins/js/ReadableStream.js
+++ b/src/javascript/jsc/bindings/builtins/js/ReadableStream.js
@@ -29,7 +29,7 @@ function initializeReadableStream(underlyingSource, strategy)
"use strict";
if (underlyingSource === @undefined)
- underlyingSource = { };
+ underlyingSource = { @bunNativeType: 0, @bunNativePtr: 0, @lazy: false };
if (strategy === @undefined)
strategy = { };
@@ -49,6 +49,8 @@ function initializeReadableStream(underlyingSource, strategy)
// Initialized with null value to enable distinction with undefined case.
@putByIdDirectPrivate(this, "readableStreamController", null);
+ @putByIdDirectPrivate(this, "bunNativeType", @getByIdDirectPrivate(underlyingSource, "bunNativeType") ?? 0);
+ @putByIdDirectPrivate(this, "bunNativePtr", @getByIdDirectPrivate(underlyingSource, "bunNativePtr") ?? 0);
const isDirect = underlyingSource.type === "direct";
// direct streams are always lazy
@@ -65,16 +67,20 @@ function initializeReadableStream(underlyingSource, strategy)
return this;
}
if (isDirect) {
- if ("start" in underlyingSource && typeof underlyingSource.start === "function")
- @throwTypeError("\"start\" for direct streams are not implemented yet");
-
- @putByIdDirectPrivate(this, "start", () => @createReadableStreamController.@call(this, underlyingSource, strategy, true));
+ @putByIdDirectPrivate(this, "start", () => @createReadableStreamController(this, underlyingSource, strategy));
} else if (isLazy) {
const autoAllocateChunkSize = underlyingSource.autoAllocateChunkSize;
- @putByIdDirectPrivate(this, "start", () => @lazyLoadStream(this, autoAllocateChunkSize));
+
+
+ @putByIdDirectPrivate(this, "start", () => {
+ const instance = @lazyLoadStream(this, autoAllocateChunkSize);
+ if (instance) {
+ @createReadableStreamController(this, instance, strategy);
+ }
+ });
} else {
@putByIdDirectPrivate(this, "start", @undefined);
- @createReadableStreamController.@call(this, underlyingSource, strategy, false);
+ @createReadableStreamController(this, underlyingSource, strategy);
}
@@ -327,6 +333,8 @@ function consumeReadableStream(nativePtr, nativeType, inputStream) {
@globalPrivate
function createEmptyReadableStream() {
+ "use strict";
+
var stream = new @ReadableStream({
pull() {},
});
@@ -337,13 +345,12 @@ function createEmptyReadableStream() {
@globalPrivate
function createNativeReadableStream(nativePtr, nativeType, autoAllocateChunkSize) {
"use strict";
- stream = new @ReadableStream({
+ return new @ReadableStream({
@lazy: true,
+ @bunNativeType: nativeType,
+ @bunNativePtr: nativePtr,
autoAllocateChunkSize: autoAllocateChunkSize,
});
- @putByIdDirectPrivate(stream, "bunNativeType", nativeType);
- @putByIdDirectPrivate(stream, "bunNativePtr", nativePtr);
- return stream;
}
function cancel(reason)
@@ -370,8 +377,10 @@ function getReader(options)
if (mode === @undefined) {
var start_ = @getByIdDirectPrivate(this, "start");
if (start_) {
- start_.@call(this);
+ @putByIdDirectPrivate(this, "start", @undefined);
+ start_();
}
+
return new @ReadableStreamDefaultReader(this);
}
// String conversion is required by spec, hence double equals.
diff --git a/src/javascript/jsc/bindings/builtins/js/ReadableStreamInternals.js b/src/javascript/jsc/bindings/builtins/js/ReadableStreamInternals.js
index d2dfd5137..3e6590f31 100644
--- a/src/javascript/jsc/bindings/builtins/js/ReadableStreamInternals.js
+++ b/src/javascript/jsc/bindings/builtins/js/ReadableStreamInternals.js
@@ -143,10 +143,8 @@ function setupReadableStreamDefaultController(stream, underlyingSource, size, hi
}
-function createReadableStreamController(underlyingSource, strategy, fromLazy) {
- if (fromLazy) {
- @putByIdDirectPrivate(this, "start", @undefined);
- }
+function createReadableStreamController(stream, underlyingSource, strategy) {
+ "use strict";
const type = underlyingSource.type;
const typeString = @toString(type);
@@ -160,15 +158,15 @@ function createReadableStreamController(underlyingSource, strategy, fromLazy) {
if (strategy.size !== @undefined)
@throwRangeError("Strategy for a ReadableByteStreamController cannot have a size");
- @putByIdDirectPrivate(this, "readableStreamController", new @ReadableByteStreamController(this, underlyingSource, strategy.highWaterMark, @isReadableStream));
+ @putByIdDirectPrivate(stream, "readableStreamController", new @ReadableByteStreamController(stream, underlyingSource, strategy.highWaterMark, @isReadableStream));
} else if (typeString === "direct") {
var highWaterMark = strategy?.highWaterMark;
- @initializeArrayBufferStream.@call(this, underlyingSource, highWaterMark);
+ @initializeArrayBufferStream.@call(stream, underlyingSource, highWaterMark);
} else if (type === @undefined) {
if (strategy.highWaterMark === @undefined)
strategy.highWaterMark = 1;
- @setupReadableStreamDefaultController(this, underlyingSource, strategy.size, strategy.highWaterMark, underlyingSource.start, underlyingSource.pull, underlyingSource.cancel);
+ @setupReadableStreamDefaultController(stream, underlyingSource, strategy.size, strategy.highWaterMark, underlyingSource.start, underlyingSource.pull, underlyingSource.cancel);
} else
@throwRangeError("Invalid type for underlying source");
@@ -313,6 +311,8 @@ function pipeToDoReadWrite(pipeState)
function pipeToErrorsMustBePropagatedForward(pipeState)
{
+ "use strict";
+
const action = () => {
pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);
const error = @getByIdDirectPrivate(pipeState.source, "storedError");
@@ -351,6 +351,7 @@ function pipeToErrorsMustBePropagatedBackward(pipeState)
function pipeToClosingMustBePropagatedForward(pipeState)
{
+ "use strict";
const action = () => {
pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);
const error = @getByIdDirectPrivate(pipeState.source, "storedError");
@@ -369,6 +370,7 @@ function pipeToClosingMustBePropagatedForward(pipeState)
function pipeToClosingMustBePropagatedBackward(pipeState)
{
+ "use strict";
if (!@writableStreamCloseQueuedOrInFlight(pipeState.destination) && @getByIdDirectPrivate(pipeState.destination, "state") !== "closed")
return;
@@ -1167,14 +1169,12 @@ function readableStreamDefaultControllerCanCloseOrEnqueue(controller)
function lazyLoadStream(stream, autoAllocateChunkSize) {
"use strict";
- @putByIdDirectPrivate(stream, "start", @undefined);
- var bunNativeType = @getByIdDirectPrivate(stream, "bunNativeType");
- var bunNativePtr = @getByIdDirectPrivate(stream, "bunNativePtr");
-
- var cached = globalThis[globalThis.Symbol.for("Bun.nativeReadableStreamPrototype")] ||= new @Map;
+ var nativeType = @getByIdDirectPrivate(stream, "bunNativeType");
+ var nativePtr = @getByIdDirectPrivate(stream, "bunNativePtr");
+ var cached = @lazyStreamPrototypeMap;
var Prototype = cached.@get(nativeType);
if (Prototype === @undefined) {
- var [pull, start, cancel, setClose, deinit] = globalThis[globalThis.Symbol.for("Bun.lazy")](nativeType);
+ var [pull, start, cancel, setClose, deinit] = @lazyLoad(nativeType);
var closer = [false];
var handleResult;
function handleNativeReadableStreamPromiseResult(val) {
@@ -1236,24 +1236,20 @@ function lazyLoadStream(stream, autoAllocateChunkSize) {
cancel_(reason) {
cancel(this, reason);
}
-
+ static deinit = deinit;
static registry = new FinalizationRegistry(deinit);
}
cached.@set(nativeType, Prototype);
}
- // either returns the chunk size
- // or throws an error
- // should never return a Promise
const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize);
// empty file, no need for native back-and-forth on this
if (chunkSize === 0) {
@readableStreamClose(stream);
- return;
+ return null;
}
-
var instance = new Prototype(nativePtr, chunkSize);
Prototype.registry.register(instance, nativePtr);
- @createReadableStreamController.@call(stream, instance, @undefined, true);
+ return instance;
} \ No newline at end of file
diff --git a/src/javascript/jsc/bindings/headers-cpp.h b/src/javascript/jsc/bindings/headers-cpp.h
index 7a5ec325a..09731ce13 100644
--- a/src/javascript/jsc/bindings/headers-cpp.h
+++ b/src/javascript/jsc/bindings/headers-cpp.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1655288763
+//-- AUTOGENERATED FILE -- 1655351052
// clang-format off
#pragma once
diff --git a/src/javascript/jsc/bindings/headers.h b/src/javascript/jsc/bindings/headers.h
index 4bb9c65cb..0257c39ed 100644
--- a/src/javascript/jsc/bindings/headers.h
+++ b/src/javascript/jsc/bindings/headers.h
@@ -1,5 +1,5 @@
// clang-format: off
-//-- AUTOGENERATED FILE -- 1655288763
+//-- AUTOGENERATED FILE -- 1655351052
#pragma once
#include <stddef.h>
@@ -7,11 +7,11 @@
#include <stdbool.h>
#ifdef __cplusplus
- #define AUTO_EXTERN_C extern "C"
- #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak))
+#define AUTO_EXTERN_C extern "C"
+#define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak))
#else
- #define AUTO_EXTERN_C
- #define AUTO_EXTERN_C_ZIG __attribute__((weak))
+#define AUTO_EXTERN_C
+#define AUTO_EXTERN_C_ZIG __attribute__((weak))
#endif
#define ZIG_DECL AUTO_EXTERN_C_ZIG
#define CPP_DECL AUTO_EXTERN_C
@@ -26,238 +26,283 @@ typedef void* JSClassRef;
#include "JavaScriptCore/JSClassRef.h"
#endif
#include "headers-handwritten.h"
- typedef struct bJSC__SourceCode { unsigned char bytes[24]; } bJSC__SourceCode;
- typedef char* bJSC__SourceCode_buf;
- typedef struct bWTF__URL { unsigned char bytes[40]; } bWTF__URL;
- typedef char* bWTF__URL_buf;
- typedef struct bJSC__JSModuleRecord { unsigned char bytes[216]; } bJSC__JSModuleRecord;
- typedef char* bJSC__JSModuleRecord_buf;
- typedef struct bJSC__ThrowScope { unsigned char bytes[8]; } bJSC__ThrowScope;
- typedef char* bJSC__ThrowScope_buf;
- typedef struct bJSC__PropertyName { unsigned char bytes[8]; } bJSC__PropertyName;
- typedef char* bJSC__PropertyName_buf;
- typedef struct bJSC__JSFunction { unsigned char bytes[32]; } bJSC__JSFunction;
- typedef char* bJSC__JSFunction_buf;
- typedef struct bJSC__JSGlobalObject { unsigned char bytes[2312]; } bJSC__JSGlobalObject;
- typedef char* bJSC__JSGlobalObject_buf;
- typedef struct bJSC__JSCell { unsigned char bytes[8]; } bJSC__JSCell;
- typedef char* bJSC__JSCell_buf;
- typedef struct bJSC__CatchScope { unsigned char bytes[8]; } bJSC__CatchScope;
- typedef char* bJSC__CatchScope_buf;
- typedef struct bWTF__String { unsigned char bytes[8]; } bWTF__String;
- typedef char* bWTF__String_buf;
- typedef struct bWTF__StringView { unsigned char bytes[16]; } bWTF__StringView;
- typedef char* bWTF__StringView_buf;
- typedef struct bJSC__JSModuleLoader { unsigned char bytes[16]; } bJSC__JSModuleLoader;
- typedef char* bJSC__JSModuleLoader_buf;
- typedef struct bInspector__ScriptArguments { unsigned char bytes[32]; } bInspector__ScriptArguments;
- typedef char* bInspector__ScriptArguments_buf;
- typedef struct bJSC__Exception { unsigned char bytes[40]; } bJSC__Exception;
- typedef char* bJSC__Exception_buf;
- typedef struct bJSC__VM { unsigned char bytes[52168]; } bJSC__VM;
- typedef char* bJSC__VM_buf;
- typedef struct bJSC__JSString { unsigned char bytes[16]; } bJSC__JSString;
- typedef char* bJSC__JSString_buf;
- typedef struct bJSC__SourceOrigin { unsigned char bytes[48]; } bJSC__SourceOrigin;
- typedef char* bJSC__SourceOrigin_buf;
- typedef struct bWTF__ExternalStringImpl { unsigned char bytes[40]; } bWTF__ExternalStringImpl;
- typedef char* bWTF__ExternalStringImpl_buf;
- typedef struct bJSC__JSInternalPromise { unsigned char bytes[32]; } bJSC__JSInternalPromise;
- typedef char* bJSC__JSInternalPromise_buf;
- typedef struct bWTF__StringImpl { unsigned char bytes[24]; } bWTF__StringImpl;
- typedef char* bWTF__StringImpl_buf;
- typedef struct bJSC__JSPromise { unsigned char bytes[32]; } bJSC__JSPromise;
- typedef char* bJSC__JSPromise_buf;
- typedef struct bJSC__JSObject { unsigned char bytes[16]; } bJSC__JSObject;
- typedef char* bJSC__JSObject_buf;
- typedef struct bJSC__Identifier { unsigned char bytes[8]; } bJSC__Identifier;
- typedef char* bJSC__Identifier_buf;
+typedef struct bJSC__SourceCode {
+ unsigned char bytes[24];
+} bJSC__SourceCode;
+typedef char* bJSC__SourceCode_buf;
+typedef struct bWTF__URL {
+ unsigned char bytes[40];
+} bWTF__URL;
+typedef char* bWTF__URL_buf;
+typedef struct bJSC__JSModuleRecord {
+ unsigned char bytes[216];
+} bJSC__JSModuleRecord;
+typedef char* bJSC__JSModuleRecord_buf;
+typedef struct bJSC__ThrowScope {
+ unsigned char bytes[8];
+} bJSC__ThrowScope;
+typedef char* bJSC__ThrowScope_buf;
+typedef struct bJSC__PropertyName {
+ unsigned char bytes[8];
+} bJSC__PropertyName;
+typedef char* bJSC__PropertyName_buf;
+typedef struct bJSC__JSFunction {
+ unsigned char bytes[32];
+} bJSC__JSFunction;
+typedef char* bJSC__JSFunction_buf;
+typedef struct bJSC__JSGlobalObject {
+ unsigned char bytes[2312];
+} bJSC__JSGlobalObject;
+typedef char* bJSC__JSGlobalObject_buf;
+typedef struct bJSC__JSCell {
+ unsigned char bytes[8];
+} bJSC__JSCell;
+typedef char* bJSC__JSCell_buf;
+typedef struct bJSC__CatchScope {
+ unsigned char bytes[8];
+} bJSC__CatchScope;
+typedef char* bJSC__CatchScope_buf;
+typedef struct bWTF__String {
+ unsigned char bytes[8];
+} bWTF__String;
+typedef char* bWTF__String_buf;
+typedef struct bWTF__StringView {
+ unsigned char bytes[16];
+} bWTF__StringView;
+typedef char* bWTF__StringView_buf;
+typedef struct bJSC__JSModuleLoader {
+ unsigned char bytes[16];
+} bJSC__JSModuleLoader;
+typedef char* bJSC__JSModuleLoader_buf;
+typedef struct bInspector__ScriptArguments {
+ unsigned char bytes[32];
+} bInspector__ScriptArguments;
+typedef char* bInspector__ScriptArguments_buf;
+typedef struct bJSC__Exception {
+ unsigned char bytes[40];
+} bJSC__Exception;
+typedef char* bJSC__Exception_buf;
+typedef struct bJSC__VM {
+ unsigned char bytes[52168];
+} bJSC__VM;
+typedef char* bJSC__VM_buf;
+typedef struct bJSC__JSString {
+ unsigned char bytes[16];
+} bJSC__JSString;
+typedef char* bJSC__JSString_buf;
+typedef struct bJSC__SourceOrigin {
+ unsigned char bytes[48];
+} bJSC__SourceOrigin;
+typedef char* bJSC__SourceOrigin_buf;
+typedef struct bWTF__ExternalStringImpl {
+ unsigned char bytes[40];
+} bWTF__ExternalStringImpl;
+typedef char* bWTF__ExternalStringImpl_buf;
+typedef struct bJSC__JSInternalPromise {
+ unsigned char bytes[32];
+} bJSC__JSInternalPromise;
+typedef char* bJSC__JSInternalPromise_buf;
+typedef struct bWTF__StringImpl {
+ unsigned char bytes[24];
+} bWTF__StringImpl;
+typedef char* bWTF__StringImpl_buf;
+typedef struct bJSC__JSPromise {
+ unsigned char bytes[32];
+} bJSC__JSPromise;
+typedef char* bJSC__JSPromise_buf;
+typedef struct bJSC__JSObject {
+ unsigned char bytes[16];
+} bJSC__JSObject;
+typedef char* bJSC__JSObject_buf;
+typedef struct bJSC__Identifier {
+ unsigned char bytes[8];
+} bJSC__Identifier;
+typedef char* bJSC__Identifier_buf;
#ifndef __cplusplus
- typedef bJSC__CatchScope JSC__CatchScope; // JSC::CatchScope
- typedef struct JSC__GeneratorPrototype JSC__GeneratorPrototype; // JSC::GeneratorPrototype
- typedef struct JSC__ArrayIteratorPrototype JSC__ArrayIteratorPrototype; // JSC::ArrayIteratorPrototype
- typedef ErrorableResolvedSource ErrorableResolvedSource;
- typedef struct JSC__JSPromisePrototype JSC__JSPromisePrototype; // JSC::JSPromisePrototype
- typedef ErrorableZigString ErrorableZigString;
- typedef bJSC__PropertyName JSC__PropertyName; // JSC::PropertyName
- typedef bJSC__JSObject JSC__JSObject; // JSC::JSObject
- typedef bWTF__ExternalStringImpl WTF__ExternalStringImpl; // WTF::ExternalStringImpl
- typedef struct JSC__AsyncIteratorPrototype JSC__AsyncIteratorPrototype; // JSC::AsyncIteratorPrototype
- typedef bJSC__JSModuleLoader JSC__JSModuleLoader; // JSC::JSModuleLoader
- typedef struct JSC__AsyncGeneratorPrototype JSC__AsyncGeneratorPrototype; // JSC::AsyncGeneratorPrototype
- typedef struct JSC__AsyncGeneratorFunctionPrototype JSC__AsyncGeneratorFunctionPrototype; // JSC::AsyncGeneratorFunctionPrototype
- typedef bJSC__Identifier JSC__Identifier; // JSC::Identifier
- typedef struct JSC__ArrayPrototype JSC__ArrayPrototype; // JSC::ArrayPrototype
- typedef struct Zig__JSMicrotaskCallback Zig__JSMicrotaskCallback; // Zig::JSMicrotaskCallback
- typedef bJSC__JSPromise JSC__JSPromise; // JSC::JSPromise
- typedef struct JSC__SetIteratorPrototype JSC__SetIteratorPrototype; // JSC::SetIteratorPrototype
- typedef SystemError SystemError;
- typedef bJSC__JSCell JSC__JSCell; // JSC::JSCell
- typedef bJSC__SourceOrigin JSC__SourceOrigin; // JSC::SourceOrigin
- typedef Bun__Writable Bun__Writable;
- typedef bJSC__JSModuleRecord JSC__JSModuleRecord; // JSC::JSModuleRecord
- typedef bWTF__String WTF__String; // WTF::String
- typedef bWTF__URL WTF__URL; // WTF::URL
- typedef struct JSC__IteratorPrototype JSC__IteratorPrototype; // JSC::IteratorPrototype
- typedef bJSC__JSInternalPromise JSC__JSInternalPromise; // JSC::JSInternalPromise
- typedef Bun__Readable Bun__Readable;
- typedef struct JSC__RegExpPrototype JSC__RegExpPrototype; // JSC::RegExpPrototype
- typedef struct JSC__MapIteratorPrototype JSC__MapIteratorPrototype; // JSC::MapIteratorPrototype
- typedef struct WebCore__FetchHeaders WebCore__FetchHeaders; // WebCore::FetchHeaders
- typedef struct JSC__CallFrame JSC__CallFrame; // JSC::CallFrame
- typedef bWTF__StringView WTF__StringView; // WTF::StringView
- typedef bJSC__ThrowScope JSC__ThrowScope; // JSC::ThrowScope
- typedef bWTF__StringImpl WTF__StringImpl; // WTF::StringImpl
- typedef bJSC__VM JSC__VM; // JSC::VM
- typedef JSClassRef JSClassRef;
- typedef Bun__ArrayBuffer Bun__ArrayBuffer;
- typedef bJSC__JSGlobalObject JSC__JSGlobalObject; // JSC::JSGlobalObject
- typedef bJSC__JSFunction JSC__JSFunction; // JSC::JSFunction
- typedef struct JSC__AsyncFunctionPrototype JSC__AsyncFunctionPrototype; // JSC::AsyncFunctionPrototype
- typedef ZigException ZigException;
- typedef bJSC__SourceCode JSC__SourceCode; // JSC::SourceCode
- typedef struct JSC__BigIntPrototype JSC__BigIntPrototype; // JSC::BigIntPrototype
- typedef struct JSC__GeneratorFunctionPrototype JSC__GeneratorFunctionPrototype; // JSC::GeneratorFunctionPrototype
- typedef ZigString ZigString;
- typedef struct WebCore__DOMURL WebCore__DOMURL; // WebCore::DOMURL
- typedef int64_t JSC__JSValue;
- typedef struct JSC__FunctionPrototype JSC__FunctionPrototype; // JSC::FunctionPrototype
- typedef bInspector__ScriptArguments Inspector__ScriptArguments; // Inspector::ScriptArguments
- typedef bJSC__Exception JSC__Exception; // JSC::Exception
- typedef bJSC__JSString JSC__JSString; // JSC::JSString
- typedef struct JSC__ObjectPrototype JSC__ObjectPrototype; // JSC::ObjectPrototype
- typedef struct JSC__StringPrototype JSC__StringPrototype; // JSC::StringPrototype
+typedef bJSC__CatchScope JSC__CatchScope; // JSC::CatchScope
+typedef struct JSC__GeneratorPrototype JSC__GeneratorPrototype; // JSC::GeneratorPrototype
+typedef struct JSC__ArrayIteratorPrototype JSC__ArrayIteratorPrototype; // JSC::ArrayIteratorPrototype
+typedef ErrorableResolvedSource ErrorableResolvedSource;
+typedef struct JSC__JSPromisePrototype JSC__JSPromisePrototype; // JSC::JSPromisePrototype
+typedef ErrorableZigString ErrorableZigString;
+typedef bJSC__PropertyName JSC__PropertyName; // JSC::PropertyName
+typedef bJSC__JSObject JSC__JSObject; // JSC::JSObject
+typedef bWTF__ExternalStringImpl WTF__ExternalStringImpl; // WTF::ExternalStringImpl
+typedef struct JSC__AsyncIteratorPrototype JSC__AsyncIteratorPrototype; // JSC::AsyncIteratorPrototype
+typedef bJSC__JSModuleLoader JSC__JSModuleLoader; // JSC::JSModuleLoader
+typedef struct JSC__AsyncGeneratorPrototype JSC__AsyncGeneratorPrototype; // JSC::AsyncGeneratorPrototype
+typedef struct JSC__AsyncGeneratorFunctionPrototype JSC__AsyncGeneratorFunctionPrototype; // JSC::AsyncGeneratorFunctionPrototype
+typedef bJSC__Identifier JSC__Identifier; // JSC::Identifier
+typedef struct JSC__ArrayPrototype JSC__ArrayPrototype; // JSC::ArrayPrototype
+typedef struct Zig__JSMicrotaskCallback Zig__JSMicrotaskCallback; // Zig::JSMicrotaskCallback
+typedef bJSC__JSPromise JSC__JSPromise; // JSC::JSPromise
+typedef struct JSC__SetIteratorPrototype JSC__SetIteratorPrototype; // JSC::SetIteratorPrototype
+typedef SystemError SystemError;
+typedef bJSC__JSCell JSC__JSCell; // JSC::JSCell
+typedef bJSC__SourceOrigin JSC__SourceOrigin; // JSC::SourceOrigin
+typedef Bun__Writable Bun__Writable;
+typedef bJSC__JSModuleRecord JSC__JSModuleRecord; // JSC::JSModuleRecord
+typedef bWTF__String WTF__String; // WTF::String
+typedef bWTF__URL WTF__URL; // WTF::URL
+typedef struct JSC__IteratorPrototype JSC__IteratorPrototype; // JSC::IteratorPrototype
+typedef bJSC__JSInternalPromise JSC__JSInternalPromise; // JSC::JSInternalPromise
+typedef Bun__Readable Bun__Readable;
+typedef struct JSC__RegExpPrototype JSC__RegExpPrototype; // JSC::RegExpPrototype
+typedef struct JSC__MapIteratorPrototype JSC__MapIteratorPrototype; // JSC::MapIteratorPrototype
+typedef struct WebCore__FetchHeaders WebCore__FetchHeaders; // WebCore::FetchHeaders
+typedef struct JSC__CallFrame JSC__CallFrame; // JSC::CallFrame
+typedef bWTF__StringView WTF__StringView; // WTF::StringView
+typedef bJSC__ThrowScope JSC__ThrowScope; // JSC::ThrowScope
+typedef bWTF__StringImpl WTF__StringImpl; // WTF::StringImpl
+typedef bJSC__VM JSC__VM; // JSC::VM
+typedef JSClassRef JSClassRef;
+typedef Bun__ArrayBuffer Bun__ArrayBuffer;
+typedef bJSC__JSGlobalObject JSC__JSGlobalObject; // JSC::JSGlobalObject
+typedef bJSC__JSFunction JSC__JSFunction; // JSC::JSFunction
+typedef struct JSC__AsyncFunctionPrototype JSC__AsyncFunctionPrototype; // JSC::AsyncFunctionPrototype
+typedef ZigException ZigException;
+typedef bJSC__SourceCode JSC__SourceCode; // JSC::SourceCode
+typedef struct JSC__BigIntPrototype JSC__BigIntPrototype; // JSC::BigIntPrototype
+typedef struct JSC__GeneratorFunctionPrototype JSC__GeneratorFunctionPrototype; // JSC::GeneratorFunctionPrototype
+typedef ZigString ZigString;
+typedef struct WebCore__DOMURL WebCore__DOMURL; // WebCore::DOMURL
+typedef int64_t JSC__JSValue;
+typedef struct JSC__FunctionPrototype JSC__FunctionPrototype; // JSC::FunctionPrototype
+typedef bInspector__ScriptArguments Inspector__ScriptArguments; // Inspector::ScriptArguments
+typedef bJSC__Exception JSC__Exception; // JSC::Exception
+typedef bJSC__JSString JSC__JSString; // JSC::JSString
+typedef struct JSC__ObjectPrototype JSC__ObjectPrototype; // JSC::ObjectPrototype
+typedef struct JSC__StringPrototype JSC__StringPrototype; // JSC::StringPrototype
#endif
#ifdef __cplusplus
- namespace JSC {
- class JSCell;
- class Exception;
- class JSPromisePrototype;
- class StringPrototype;
- class GeneratorFunctionPrototype;
- class ArrayPrototype;
- class JSString;
- class JSObject;
- class AsyncIteratorPrototype;
- class AsyncGeneratorFunctionPrototype;
- class Identifier;
- class JSPromise;
- class RegExpPrototype;
- class AsyncFunctionPrototype;
- class CatchScope;
- class VM;
- class BigIntPrototype;
- class SourceOrigin;
- class ThrowScope;
- class SetIteratorPrototype;
- class AsyncGeneratorPrototype;
- class PropertyName;
- class MapIteratorPrototype;
- class JSModuleRecord;
- class JSInternalPromise;
- class ArrayIteratorPrototype;
- class JSFunction;
- class JSModuleLoader;
- class GeneratorPrototype;
- class JSGlobalObject;
- class SourceCode;
- class FunctionPrototype;
- class IteratorPrototype;
- class CallFrame;
- class ObjectPrototype;
- }
- namespace WTF {
- class URL;
- class StringImpl;
- class String;
- class StringView;
- class ExternalStringImpl;
- }
- namespace Zig {
- class JSMicrotaskCallback;
- }
- namespace WebCore {
- class DOMURL;
- class FetchHeaders;
- }
- namespace Inspector {
- class ScriptArguments;
- }
-
- typedef ErrorableResolvedSource ErrorableResolvedSource;
- typedef ErrorableZigString ErrorableZigString;
- typedef SystemError SystemError;
- typedef Bun__Writable Bun__Writable;
- typedef Bun__Readable Bun__Readable;
- typedef JSClassRef JSClassRef;
- typedef Bun__ArrayBuffer Bun__ArrayBuffer;
- typedef ZigException ZigException;
- typedef ZigString ZigString;
- typedef int64_t JSC__JSValue;
- using JSC__JSCell = JSC::JSCell;
- using JSC__Exception = JSC::Exception;
- using JSC__JSPromisePrototype = JSC::JSPromisePrototype;
- using JSC__StringPrototype = JSC::StringPrototype;
- using JSC__GeneratorFunctionPrototype = JSC::GeneratorFunctionPrototype;
- using JSC__ArrayPrototype = JSC::ArrayPrototype;
- using JSC__JSString = JSC::JSString;
- using JSC__JSObject = JSC::JSObject;
- using JSC__AsyncIteratorPrototype = JSC::AsyncIteratorPrototype;
- using JSC__AsyncGeneratorFunctionPrototype = JSC::AsyncGeneratorFunctionPrototype;
- using JSC__Identifier = JSC::Identifier;
- using JSC__JSPromise = JSC::JSPromise;
- using JSC__RegExpPrototype = JSC::RegExpPrototype;
- using JSC__AsyncFunctionPrototype = JSC::AsyncFunctionPrototype;
- using JSC__CatchScope = JSC::CatchScope;
- using JSC__VM = JSC::VM;
- using JSC__BigIntPrototype = JSC::BigIntPrototype;
- using JSC__SourceOrigin = JSC::SourceOrigin;
- using JSC__ThrowScope = JSC::ThrowScope;
- using JSC__SetIteratorPrototype = JSC::SetIteratorPrototype;
- using JSC__AsyncGeneratorPrototype = JSC::AsyncGeneratorPrototype;
- using JSC__PropertyName = JSC::PropertyName;
- using JSC__MapIteratorPrototype = JSC::MapIteratorPrototype;
- using JSC__JSModuleRecord = JSC::JSModuleRecord;
- using JSC__JSInternalPromise = JSC::JSInternalPromise;
- using JSC__ArrayIteratorPrototype = JSC::ArrayIteratorPrototype;
- using JSC__JSFunction = JSC::JSFunction;
- using JSC__JSModuleLoader = JSC::JSModuleLoader;
- using JSC__GeneratorPrototype = JSC::GeneratorPrototype;
- using JSC__JSGlobalObject = JSC::JSGlobalObject;
- using JSC__SourceCode = JSC::SourceCode;
- using JSC__FunctionPrototype = JSC::FunctionPrototype;
- using JSC__IteratorPrototype = JSC::IteratorPrototype;
- using JSC__CallFrame = JSC::CallFrame;
- using JSC__ObjectPrototype = JSC::ObjectPrototype;
- using WTF__URL = WTF::URL;
- using WTF__StringImpl = WTF::StringImpl;
- using WTF__String = WTF::String;
- using WTF__StringView = WTF::StringView;
- using WTF__ExternalStringImpl = WTF::ExternalStringImpl;
- using Zig__JSMicrotaskCallback = Zig::JSMicrotaskCallback;
- using WebCore__DOMURL = WebCore::DOMURL;
- using WebCore__FetchHeaders = WebCore::FetchHeaders;
- using Inspector__ScriptArguments = Inspector::ScriptArguments;
+namespace JSC {
+class JSCell;
+class Exception;
+class JSPromisePrototype;
+class StringPrototype;
+class GeneratorFunctionPrototype;
+class ArrayPrototype;
+class JSString;
+class JSObject;
+class AsyncIteratorPrototype;
+class AsyncGeneratorFunctionPrototype;
+class Identifier;
+class JSPromise;
+class RegExpPrototype;
+class AsyncFunctionPrototype;
+class CatchScope;
+class VM;
+class BigIntPrototype;
+class SourceOrigin;
+class ThrowScope;
+class SetIteratorPrototype;
+class AsyncGeneratorPrototype;
+class PropertyName;
+class MapIteratorPrototype;
+class JSModuleRecord;
+class JSInternalPromise;
+class ArrayIteratorPrototype;
+class JSFunction;
+class JSModuleLoader;
+class GeneratorPrototype;
+class JSGlobalObject;
+class SourceCode;
+class FunctionPrototype;
+class IteratorPrototype;
+class CallFrame;
+class ObjectPrototype;
+}
+namespace WTF {
+class URL;
+class StringImpl;
+class String;
+class StringView;
+class ExternalStringImpl;
+}
+namespace Zig {
+class JSMicrotaskCallback;
+}
+namespace WebCore {
+class DOMURL;
+class FetchHeaders;
+}
+namespace Inspector {
+class ScriptArguments;
+}
+
+typedef ErrorableResolvedSource ErrorableResolvedSource;
+typedef ErrorableZigString ErrorableZigString;
+typedef SystemError SystemError;
+typedef Bun__Writable Bun__Writable;
+typedef Bun__Readable Bun__Readable;
+typedef JSClassRef JSClassRef;
+typedef Bun__ArrayBuffer Bun__ArrayBuffer;
+typedef ZigException ZigException;
+typedef ZigString ZigString;
+typedef int64_t JSC__JSValue;
+using JSC__JSCell = JSC::JSCell;
+using JSC__Exception = JSC::Exception;
+using JSC__JSPromisePrototype = JSC::JSPromisePrototype;
+using JSC__StringPrototype = JSC::StringPrototype;
+using JSC__GeneratorFunctionPrototype = JSC::GeneratorFunctionPrototype;
+using JSC__ArrayPrototype = JSC::ArrayPrototype;
+using JSC__JSString = JSC::JSString;
+using JSC__JSObject = JSC::JSObject;
+using JSC__AsyncIteratorPrototype = JSC::AsyncIteratorPrototype;
+using JSC__AsyncGeneratorFunctionPrototype = JSC::AsyncGeneratorFunctionPrototype;
+using JSC__Identifier = JSC::Identifier;
+using JSC__JSPromise = JSC::JSPromise;
+using JSC__RegExpPrototype = JSC::RegExpPrototype;
+using JSC__AsyncFunctionPrototype = JSC::AsyncFunctionPrototype;
+using JSC__CatchScope = JSC::CatchScope;
+using JSC__VM = JSC::VM;
+using JSC__BigIntPrototype = JSC::BigIntPrototype;
+using JSC__SourceOrigin = JSC::SourceOrigin;
+using JSC__ThrowScope = JSC::ThrowScope;
+using JSC__SetIteratorPrototype = JSC::SetIteratorPrototype;
+using JSC__AsyncGeneratorPrototype = JSC::AsyncGeneratorPrototype;
+using JSC__PropertyName = JSC::PropertyName;
+using JSC__MapIteratorPrototype = JSC::MapIteratorPrototype;
+using JSC__JSModuleRecord = JSC::JSModuleRecord;
+using JSC__JSInternalPromise = JSC::JSInternalPromise;
+using JSC__ArrayIteratorPrototype = JSC::ArrayIteratorPrototype;
+using JSC__JSFunction = JSC::JSFunction;
+using JSC__JSModuleLoader = JSC::JSModuleLoader;
+using JSC__GeneratorPrototype = JSC::GeneratorPrototype;
+using JSC__JSGlobalObject = JSC::JSGlobalObject;
+using JSC__SourceCode = JSC::SourceCode;
+using JSC__FunctionPrototype = JSC::FunctionPrototype;
+using JSC__IteratorPrototype = JSC::IteratorPrototype;
+using JSC__CallFrame = JSC::CallFrame;
+using JSC__ObjectPrototype = JSC::ObjectPrototype;
+using WTF__URL = WTF::URL;
+using WTF__StringImpl = WTF::StringImpl;
+using WTF__String = WTF::String;
+using WTF__StringView = WTF::StringView;
+using WTF__ExternalStringImpl = WTF::ExternalStringImpl;
+using Zig__JSMicrotaskCallback = Zig::JSMicrotaskCallback;
+using WebCore__DOMURL = WebCore::DOMURL;
+using WebCore__FetchHeaders = WebCore::FetchHeaders;
+using Inspector__ScriptArguments = Inspector::ScriptArguments;
#endif
-
#pragma mark - JSC::JSObject
-CPP_DECL JSC__JSValue JSC__JSObject__create(JSC__JSGlobalObject* arg0, size_t arg1, void* arg2, void (* ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2));
+CPP_DECL JSC__JSValue JSC__JSObject__create(JSC__JSGlobalObject* arg0, size_t arg1, void* arg2, void (*ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2));
CPP_DECL size_t JSC__JSObject__getArrayLength(JSC__JSObject* arg0);
CPP_DECL JSC__JSValue JSC__JSObject__getDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, const ZigString* arg2);
CPP_DECL JSC__JSValue JSC__JSObject__getIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2);
CPP_DECL void JSC__JSObject__putRecord(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4);
-CPP_DECL JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void (* ArgFn3)(void* arg0, void* arg1, size_t arg2));
+CPP_DECL JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(void* arg0, void* arg1, size_t arg2));
CPP_DECL JSC__JSValue ZigString__to16BitValue(const ZigString* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL JSC__JSValue ZigString__toErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL JSC__JSValue ZigString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC__JSGlobalObject* arg2);
CPP_DECL JSC__JSValue ZigString__toExternalValue(const ZigString* arg0, JSC__JSGlobalObject* arg1);
-CPP_DECL JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void (* ArgFn2)(void* arg0, void* arg1, size_t arg2));
+CPP_DECL JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void (*ArgFn2)(void* arg0, void* arg1, size_t arg2));
CPP_DECL JSC__JSValue ZigString__toValue(const ZigString* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL JSC__JSValue ZigString__toValueGC(const ZigString* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL WebCore__DOMURL* WebCore__DOMURL__cast_(JSC__JSValue JSValue0, JSC__VM* arg1);
@@ -399,6 +444,7 @@ CPP_DECL JSC__JSPromisePrototype* JSC__JSGlobalObject__promisePrototype(JSC__JSG
CPP_DECL JSC__JSValue JSC__JSGlobalObject__putCachedObject(JSC__JSGlobalObject* arg0, const ZigString* arg1, JSC__JSValue JSValue2);
CPP_DECL JSC__RegExpPrototype* JSC__JSGlobalObject__regExpPrototype(JSC__JSGlobalObject* arg0);
CPP_DECL JSC__SetIteratorPrototype* JSC__JSGlobalObject__setIteratorPrototype(JSC__JSGlobalObject* arg0);
+CPP_DECL bool JSC__JSGlobalObject__startRemoteInspector(JSC__JSGlobalObject* arg0, unsigned char* arg1, uint16_t arg2);
CPP_DECL JSC__StringPrototype* JSC__JSGlobalObject__stringPrototype(JSC__JSGlobalObject* arg0);
CPP_DECL JSC__JSObject* JSC__JSGlobalObject__symbolPrototype(JSC__JSGlobalObject* arg0);
CPP_DECL JSC__VM* JSC__JSGlobalObject__vm(JSC__JSGlobalObject* arg0);
@@ -453,7 +499,7 @@ CPP_DECL size_t WTF__String__length(WTF__String* arg0);
#pragma mark - JSC::JSValue
-CPP_DECL void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void (* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, void** arg2, size_t arg3), void (* ArgFn4)(JSC__JSGlobalObject* arg0, void* arg1, void** arg2, size_t arg3));
+CPP_DECL void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, void** arg2, size_t arg3), void (*ArgFn4)(JSC__JSGlobalObject* arg0, void* arg1, void** arg2, size_t arg3));
CPP_DECL bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, Bun__ArrayBuffer* arg2);
CPP_DECL JSC__JSCell* JSC__JSValue__asCell(JSC__JSValue JSValue0);
CPP_DECL JSC__JSInternalPromise* JSC__JSValue__asInternalPromise(JSC__JSValue JSValue0);
@@ -471,7 +517,7 @@ CPP_DECL JSC__JSValue JSC__JSValue__createTypeError(const ZigString* arg0, const
CPP_DECL JSC__JSValue JSC__JSValue__createUninitializedUint8Array(JSC__JSGlobalObject* arg0, size_t arg1);
CPP_DECL bool JSC__JSValue__eqlCell(JSC__JSValue JSValue0, JSC__JSCell* arg1);
CPP_DECL bool JSC__JSValue__eqlValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1);
-CPP_DECL void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void (* ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3));
+CPP_DECL void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3));
CPP_DECL JSC__JSValue JSC__JSValue__fromEntries(JSC__JSGlobalObject* arg0, ZigString* arg1, ZigString* arg2, size_t arg3, bool arg4);
CPP_DECL JSC__JSValue JSC__JSValue__fromInt64NoTruncate(JSC__JSGlobalObject* arg0, int64_t arg1);
CPP_DECL JSC__JSValue JSC__JSValue__fromUInt64NoTruncate(JSC__JSGlobalObject* arg0, uint64_t arg1);
@@ -557,13 +603,13 @@ CPP_DECL JSC__JSValue JSC__Exception__value(JSC__Exception* arg0);
CPP_DECL void JSC__VM__clearExecutionTimeLimit(JSC__VM* arg0);
CPP_DECL JSC__VM* JSC__VM__create(unsigned char HeapType0);
-CPP_DECL void JSC__VM__deferGC(JSC__VM* arg0, void* arg1, void (* ArgFn2)(void* arg0));
+CPP_DECL void JSC__VM__deferGC(JSC__VM* arg0, void* arg1, void (*ArgFn2)(void* arg0));
CPP_DECL void JSC__VM__deinit(JSC__VM* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL void JSC__VM__deleteAllCode(JSC__VM* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL void JSC__VM__doWork(JSC__VM* arg0);
CPP_DECL void JSC__VM__drainMicrotasks(JSC__VM* arg0);
CPP_DECL bool JSC__VM__executionForbidden(JSC__VM* arg0);
-CPP_DECL void JSC__VM__holdAPILock(JSC__VM* arg0, void* arg1, void (* ArgFn2)(void* arg0));
+CPP_DECL void JSC__VM__holdAPILock(JSC__VM* arg0, void* arg1, void (*ArgFn2)(void* arg0));
CPP_DECL bool JSC__VM__isEntered(JSC__VM* arg0);
CPP_DECL bool JSC__VM__isJITEnabled();
CPP_DECL void JSC__VM__releaseWeakRefs(JSC__VM* arg0);
@@ -573,7 +619,7 @@ CPP_DECL void JSC__VM__setExecutionTimeLimit(JSC__VM* arg0, double arg1);
CPP_DECL void JSC__VM__shrinkFootprint(JSC__VM* arg0);
CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2);
CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2);
-CPP_DECL void JSC__VM__whenIdle(JSC__VM* arg0, void (* ArgFn1)());
+CPP_DECL void JSC__VM__whenIdle(JSC__VM* arg0, void (*ArgFn1)());
#pragma mark - JSC::ThrowScope
@@ -620,7 +666,7 @@ CPP_DECL size_t WTF__StringImpl__length(const WTF__StringImpl* arg0);
CPP_DECL const uint16_t* WTF__ExternalStringImpl__characters16(const WTF__ExternalStringImpl* arg0);
CPP_DECL const unsigned char* WTF__ExternalStringImpl__characters8(const WTF__ExternalStringImpl* arg0);
-CPP_DECL bWTF__ExternalStringImpl WTF__ExternalStringImpl__create(const unsigned char* arg0, size_t arg1, void (* ArgFn2)(void* arg0, unsigned char* arg1, size_t arg2));
+CPP_DECL bWTF__ExternalStringImpl WTF__ExternalStringImpl__create(const unsigned char* arg0, size_t arg1, void (*ArgFn2)(void* arg0, unsigned char* arg1, size_t arg2));
CPP_DECL bool WTF__ExternalStringImpl__is16Bit(const WTF__ExternalStringImpl* arg0);
CPP_DECL bool WTF__ExternalStringImpl__is8Bit(const WTF__ExternalStringImpl* arg0);
CPP_DECL bool WTF__ExternalStringImpl__isEmpty(const WTF__ExternalStringImpl* arg0);
@@ -758,7 +804,6 @@ CPP_DECL ZigException ZigException__fromException(JSC__Exception* arg0);
#pragma mark - Zig::ConsoleClient
-
#ifdef __cplusplus
ZIG_DECL void Zig__ConsoleClient__count(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3);
@@ -779,7 +824,6 @@ ZIG_DECL void Zig__ConsoleClient__timeStamp(void* arg0, JSC__JSGlobalObject* arg
#pragma mark - Bun__Timer
-
#ifdef __cplusplus
ZIG_DECL JSC__JSValue Bun__Timer__clearInterval(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
diff --git a/src/javascript/jsc/bindings/headers.zig b/src/javascript/jsc/bindings/headers.zig
index d8915b9d3..ee59be0a4 100644
--- a/src/javascript/jsc/bindings/headers.zig
+++ b/src/javascript/jsc/bindings/headers.zig
@@ -260,6 +260,8 @@ pub extern fn JSC__JSGlobalObject__promisePrototype(arg0: [*c]JSC__JSGlobalObjec
pub extern fn JSC__JSGlobalObject__putCachedObject(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]const ZigString, JSValue2: JSC__JSValue) JSC__JSValue;
pub extern fn JSC__JSGlobalObject__regExpPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__RegExpPrototype;
pub extern fn JSC__JSGlobalObject__setIteratorPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__SetIteratorPrototype;
+pub extern fn JSC__JSGlobalObject__startRemoteInspector(arg0: [*c]JSC__JSGlobalObject, arg1: [*c]u8, arg2: u16) bool;
+pub extern fn JSC__JSGlobalObject__stopRemoteInspector(arg0: [*c]JSC__JSGlobalObject) void;
pub extern fn JSC__JSGlobalObject__stringPrototype(arg0: [*c]JSC__JSGlobalObject) ?*JSC__StringPrototype;
pub extern fn JSC__JSGlobalObject__symbolPrototype(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__JSObject;
pub extern fn JSC__JSGlobalObject__vm(arg0: [*c]JSC__JSGlobalObject) [*c]JSC__VM;
diff --git a/src/javascript/jsc/webcore/streams.zig b/src/javascript/jsc/webcore/streams.zig
index e61e599ca..df5de24fa 100644
--- a/src/javascript/jsc/webcore/streams.zig
+++ b/src/javascript/jsc/webcore/streams.zig
@@ -279,7 +279,7 @@ pub const StreamStart = union(Tag) {
empty = false;
}
- if (value.get(globalThis, "highwaterMark")) |chunkSize| {
+ if (value.get(globalThis, "highWaterMark")) |chunkSize| {
empty = false;
chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @maximum(0, @truncate(i51, chunkSize.toInt64())));
}