aboutsummaryrefslogtreecommitdiff
path: root/src/js/out/InternalModuleRegistryConstants.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-08-06 20:39:40 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-06 20:39:40 -0700
commit0665733b0302ac7e743e4c131c7697741fa923a5 (patch)
tree2609e7055acbb308ddd52b45393a9b61fdc397bf /src/js/out/InternalModuleRegistryConstants.h
parent70c3371b14293e18a5e0470e8b8cd4c04259a606 (diff)
downloadbun-0665733b0302ac7e743e4c131c7697741fa923a5.tar.gz
bun-0665733b0302ac7e743e4c131c7697741fa923a5.tar.zst
bun-0665733b0302ac7e743e4c131c7697741fa923a5.zip
Fixes #4029 and fixes #4022 (#4032)
* Fixes #4029 and Fixes #4022 Fixes #4029 Fixes #4022 * Add test for all the fetches --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js/out/InternalModuleRegistryConstants.h')
-rw-r--r--src/js/out/InternalModuleRegistryConstants.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/js/out/InternalModuleRegistryConstants.h b/src/js/out/InternalModuleRegistryConstants.h
index 5cd010c12..0ad5c4c97 100644
--- a/src/js/out/InternalModuleRegistryConstants.h
+++ b/src/js/out/InternalModuleRegistryConstants.h
@@ -209,11 +209,11 @@ static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = "(function (){\"us
//
//
-static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";return globalThis.fetch})\n"_s;
+static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";const bunFetch=Bun.fetch,fetch=(...args)=>bunFetch(...args);return fetch.default=fetch,fetch.fetch=fetch,fetch})\n"_s;
//
//
-static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch})})\n"_s;
+static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch,default:fetch})})\n"_s;
//
//
@@ -434,11 +434,11 @@ static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = "(function (){\"us
//
//
-static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";return globalThis.fetch})\n"_s;
+static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";const bunFetch=Bun.fetch,fetch=(...args)=>bunFetch(...args);return fetch.default=fetch,fetch.fetch=fetch,fetch})\n"_s;
//
//
-static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch})})\n"_s;
+static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch,default:fetch})})\n"_s;
//
//
@@ -660,11 +660,11 @@ static constexpr ASCIILiteral ThirdpartyDetectLibcLinuxCode = "(function (){\"us
//
//
-static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";return globalThis.fetch})\n"_s;
+static constexpr ASCIILiteral ThirdpartyIsomorphicFetchCode = "(function (){\"use strict\";const bunFetch=Bun.fetch,fetch=(...args)=>bunFetch(...args);return fetch.default=fetch,fetch.fetch=fetch,fetch})\n"_s;
//
//
-static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch})})\n"_s;
+static constexpr ASCIILiteral ThirdpartyNodeFetchCode = "(function (){\"use strict\";const{Headers,Request,Response,Blob,File=Blob,FormData}=globalThis,realFetch=Bun.fetch;function fetch(...args){return realFetch(...args)}class AbortError extends DOMException{constructor(message){super(message,\"AbortError\")}}class FetchBaseError extends Error{constructor(message,type){super(message);this.type=type}}class FetchError extends FetchBaseError{constructor(message,type,systemError){super(message,type);this.code=systemError\?.code}}function blobFrom(path,options){return Promise.resolve(Bun.file(data))}function blobFromSync(path,options){return Bun.file(data)}var fileFrom=blobFrom,fileFromSync=blobFromSync;function isRedirect(code){return code===301||code===302||code===303||code===307||code===308}return Object.assign(fetch,{AbortError,Blob,FetchBaseError,FetchError,File,FormData,Headers,Request,Response,blobFrom,blobFromSync,fileFrom,fileFromSync,isRedirect,fetch,default:fetch})})\n"_s;
//
//