Skip to content

Commit

Permalink
fix: compat
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Mar 7, 2024
1 parent ab0297b commit b80a5a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sweet-books-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hono-og": patch
---

Fixed compat issues.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as Og from "@vercel/og";
import { type HonoElement, toReactNode } from "./utils.js";

const pkg = Og;

export type ImageResponseOptions = ConstructorParameters<
typeof Og.ImageResponse
>[1];
Expand All @@ -14,4 +16,7 @@ export class ImageResponse extends Og.ImageResponse {
export const unstable_createNodejsStream = (
element: HonoElement,
options?: Parameters<typeof Og.unstable_createNodejsStream>[1],
) => Og.unstable_createNodejsStream(toReactNode(element), options);
) =>
"unstable_createNodejsStream" in pkg
? pkg.unstable_createNodejsStream(toReactNode(element), options)
: undefined;

0 comments on commit b80a5a3

Please sign in to comment.