diff options
author | 2021-11-23 16:35:45 -0800 | |
---|---|---|
committer | 2021-11-23 16:35:45 -0800 | |
commit | f82aa92c38e4042496379e57288e5e91a27d98de (patch) | |
tree | adda0cf3a972f3c5d5c658bd17dc0b8c1605dd9d /packages/bun-framework-next/server-polyfills.tsx | |
parent | 4e4f2058c2f086beefda1368c2db53f46fc4f6a0 (diff) | |
parent | 7660f727450908f322211e04a32dc69207d54044 (diff) | |
download | bun-f82aa92c38e4042496379e57288e5e91a27d98de.tar.gz bun-f82aa92c38e4042496379e57288e5e91a27d98de.tar.zst bun-f82aa92c38e4042496379e57288e5e91a27d98de.zip |
Merge pull request #65 from Jarred-Sumner/bun-framework-next-actions
Begin working on CI tasks for bun-framework-next
Diffstat (limited to 'packages/bun-framework-next/server-polyfills.tsx')
-rw-r--r-- | packages/bun-framework-next/server-polyfills.tsx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/packages/bun-framework-next/server-polyfills.tsx b/packages/bun-framework-next/server-polyfills.tsx index 474ee6ec9..f0a2b5c3a 100644 --- a/packages/bun-framework-next/server-polyfills.tsx +++ b/packages/bun-framework-next/server-polyfills.tsx @@ -1,28 +1,26 @@ globalThis.global = globalThis; import { Buffer } from "buffer"; - -globalThis.Buffer = Buffer; - +import { URL } from "url-polyfill"; +import { TextEncoder, TextDecoder } from "./text-encoder-polyfill"; import * as React from "react"; -class URL { - constructor(base, source) { - this.pathname = source; - this.href = base + source; - } -} -var onlyChildPolyfill = React.Children.only; +const onlyChildPolyfill = React.Children.only; + React.Children.only = function (children) { - if (children && typeof children === "object" && children.length == 1) { + if ( + children && + typeof children === "object" && + (children as any).length == 1 + ) { return onlyChildPolyfill(children[0]); } return onlyChildPolyfill(children); }; -globalThis.URL = URL; - -import { TextEncoder, TextDecoder } from "./text-encoder-polyfill"; +globalThis.Buffer = Buffer; +globalThis.URL = URL; +// @ts-expect-error encodeInto is missing in our polyfill globalThis.TextEncoder ||= TextEncoder; globalThis.TextDecoder ||= TextDecoder; |