mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
chore: rollback some types
This commit is contained in:
parent
0ce81cba96
commit
daaf86c07a
@ -7,7 +7,7 @@ import { randomUUID } from 'uncrypto'
|
||||
import { joinURL, withQuery } from 'ufo'
|
||||
import type { FetchResponse } from 'ofetch'
|
||||
|
||||
import type { ActiveHeadEntry, ResolvedHead } from '@unhead/vue/types'
|
||||
import type { ActiveHeadEntry, Head } from '@unhead/vue/types'
|
||||
import type { NuxtIslandResponse } from '../types'
|
||||
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
|
||||
import { prerenderRoutes, useRequestEvent } from '../composables/ssr'
|
||||
@ -91,7 +91,7 @@ export default defineComponent({
|
||||
const instance = getCurrentInstance()!
|
||||
const event = useRequestEvent()
|
||||
|
||||
let activeHead: ActiveHeadEntry<ResolvedHead>
|
||||
let activeHead: ActiveHeadEntry<Head>
|
||||
|
||||
// TODO: remove use of `$fetch.raw` when nitro 503 issues on windows dev server are resolved
|
||||
const eventFetch = import.meta.server ? event!.fetch : import.meta.dev ? $fetch.raw : globalThis.fetch
|
||||
|
@ -77,7 +77,7 @@ export interface NuxtIslandContext {
|
||||
export interface NuxtIslandResponse {
|
||||
id?: string
|
||||
html: string
|
||||
head: Partial<ResolvedHead>
|
||||
head: Head
|
||||
props?: Record<string, Record<string, any>>
|
||||
components?: Record<string, NuxtIslandClientResponse>
|
||||
slots?: Record<string, NuxtIslandSlotResponse>
|
||||
@ -473,7 +473,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
|
||||
// Response for component islands
|
||||
if (isRenderingIsland && islandContext) {
|
||||
const islandHead: Partial<ResolvedHead> = {}
|
||||
const islandHead: Head = {}
|
||||
for (const entry of head.headEntries()) {
|
||||
for (const [key, value] of Object.entries(resolveUnrefHeadInput(entry.input) as Head)) {
|
||||
const currentValue = islandHead[key as keyof Head]
|
||||
|
@ -2,6 +2,7 @@ import { createUnplugin } from 'unplugin'
|
||||
import MagicString from 'magic-string'
|
||||
import type { ImportSpecifier } from 'estree'
|
||||
import { relative } from 'pathe'
|
||||
import { unheadVueComposablesImports } from '@unhead/vue'
|
||||
import { parseAndWalk, withLocations } from '../../core/utils/parse'
|
||||
import { isJS, isVue } from '../../core/utils'
|
||||
import { distDir } from '../../dirs'
|
||||
@ -21,15 +22,6 @@ function toImports (specifiers: ImportSpecifier[]) {
|
||||
})
|
||||
}
|
||||
|
||||
const UnheadNuxtContextComposables = [
|
||||
'useHead',
|
||||
'useHeadSafe',
|
||||
'useServerHeadSafe',
|
||||
'useSeoMeta',
|
||||
'useServerSeoMeta',
|
||||
'useServerHead',
|
||||
]
|
||||
|
||||
/**
|
||||
* To use composable in an async context we need to pass Nuxt context to the Unhead composables.
|
||||
*
|
||||
@ -58,8 +50,8 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea
|
||||
}
|
||||
})
|
||||
|
||||
const importsFromUnhead = importsToAdd.filter(specifier => UnheadNuxtContextComposables.includes(specifier.imported.name))
|
||||
const importsFromHead = importsToAdd.filter(specifier => !UnheadNuxtContextComposables.includes(specifier.imported.name))
|
||||
const importsFromUnhead = importsToAdd.filter(specifier => unheadVueComposablesImports['@unhead/vue'].includes(specifier.imported.name))
|
||||
const importsFromHead = importsToAdd.filter(specifier => !unheadVueComposablesImports['@unhead/vue'].includes(specifier.imported.name))
|
||||
if (importsFromUnhead.length) {
|
||||
// warn if user has imported from @unhead/vue themselves
|
||||
if (!id.includes('node_modules')) {
|
||||
|
Loading…
Reference in New Issue
Block a user