From 77dd1c3acde29aeb828b6eb37b6fbdbb47a16c57 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Mon, 21 Oct 2024 13:10:49 +0300 Subject: [PATCH] fix(fetch): use `globalThis` instead of `window` for Deno compat --- .changeset/wicked-rules-nail.md | 7 ++++++ packages/fetch/dist/esm-ponyfill.js | 39 ++++++++++++++--------------- 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 .changeset/wicked-rules-nail.md diff --git a/.changeset/wicked-rules-nail.md b/.changeset/wicked-rules-nail.md new file mode 100644 index 00000000000..c473a6c5703 --- /dev/null +++ b/.changeset/wicked-rules-nail.md @@ -0,0 +1,7 @@ +--- +'@whatwg-node/fetch': patch +--- + +Use \`globalThis\` instead of \`window\` for the global object reference + +Fixes the issues with Deno \ No newline at end of file diff --git a/packages/fetch/dist/esm-ponyfill.js b/packages/fetch/dist/esm-ponyfill.js index 219be36d5c6..b267b70399e 100644 --- a/packages/fetch/dist/esm-ponyfill.js +++ b/packages/fetch/dist/esm-ponyfill.js @@ -1,23 +1,22 @@ -const fetch = window.fetch; -const Headers = window.Headers; -const Request = window.Request; -const Response = window.Response; -const FormData = window.FormData; -const ReadableStream = window.ReadableStream; -const WritableStream = window.WritableStream; -const TransformStream = window.TransformStream; -const CompressionStream = window.CompressionStream; -const DecompressionStream = window.DecompressionStream; -const Blob = window.Blob; -const File = window.File; -const crypto = window.crypto; -const btoa = window.btoa; -const TextEncoder = window.TextEncoder; -const TextDecoder = window.TextDecoder; -const URLPattern = window.URLPattern; -const URL = window.URL; -const URLSearchParams = window.URLSearchParams; - +const fetch = globalThis.fetch; +const Headers = globalThis.Headers; +const Request = globalThis.Request; +const Response = globalThis.Response; +const FormData = globalThis.FormData; +const ReadableStream = globalThis.ReadableStream; +const WritableStream = globalThis.WritableStream; +const TransformStream = globalThis.TransformStream; +const CompressionStream = globalThis.CompressionStream; +const DecompressionStream = globalThis.DecompressionStream; +const Blob = globalThis.Blob; +const File = globalThis.File; +const crypto = globalThis.crypto; +const btoa = globalThis.btoa; +const TextEncoder = globalThis.TextEncoder; +const TextDecoder = globalThis.TextDecoder; +const URLPattern = globalThis.URLPattern; +const URL = globalThis.URL; +const URLSearchParams = globalThis.URLSearchParams; export { fetch,