Skip to content

Commit

Permalink
fix: nitro runtime issue
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Mar 16, 2023
1 parent 7ff7763 commit c0b6119
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { screenshot } from './runtime/browserUtil'
import type { OgImageOptions, ScreenshotOptions } from './types'
import { setupPlaygroundRPC } from './rpc'
import { exposeModuleConfig } from './nuxt-utils'
import { extractOgImageOptions, stripOgImageOptions } from './utils'
import { extractOgImageOptions, stripOgImageOptions } from './runtime/nitro/utils-pure'

export interface ModuleOptions {
/**
Expand Down Expand Up @@ -132,7 +132,8 @@ export {}
})
})

// @ts-expect-error runtime type
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore runtime type
nuxt.hook('devtools:customTabs', (iframeTabs) => {
iframeTabs.push({
name: 'ogimage',
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/nitro/routes/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createError, defineEventHandler, getHeaders, getQuery } from 'h3'
import type { OgImageOptions } from '../../../types'
import { useHostname } from '../utils'
import { extractOgImageOptions } from '../../../utils'
import { extractOgImageOptions, useHostname } from '../utils'
import { getRouteRules } from '#internal/nitro'
import { defaults } from '#nuxt-og-image/config'

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts → src/runtime/nitro/utils-pure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { OgImageOptions } from './types'
import type { OgImageOptions } from '../../types'

function decodeHtmlEntities(obj: Record<string, string | any>) {
Object.entries(obj).forEach(([key, value]) => {
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/nitro/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ export async function readPublicAssetBase64(file: string) {
}
// fine if it fails, we fallback elsewhere
}

export * from './utils-pure'

0 comments on commit c0b6119

Please sign in to comment.