mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-23 17:10:07 +00:00
chore: maybe fix failing tests
This commit is contained in:
parent
2e00c1fbe1
commit
a714a8611f
@ -46,7 +46,7 @@
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@nuxt/webpack-builder": "workspace:*",
|
||||
"@types/node": "22.13.2",
|
||||
"@unhead/vue": "2.0.0-alpha.13",
|
||||
"@unhead/vue": "2.0.0-alpha.14",
|
||||
"@vue/compiler-core": "3.5.13",
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
"@vue/shared": "3.5.13",
|
||||
@ -83,7 +83,7 @@
|
||||
"@types/babel__helper-plugin-utils": "7.10.3",
|
||||
"@types/node": "22.13.2",
|
||||
"@types/semver": "7.5.8",
|
||||
"@unhead/vue": "2.0.0-alpha.13",
|
||||
"@unhead/vue": "2.0.0-alpha.14",
|
||||
"@vitest/coverage-v8": "3.0.5",
|
||||
"@vue/test-utils": "2.4.6",
|
||||
"acorn": "8.14.0",
|
||||
|
@ -71,7 +71,7 @@
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@nuxt/telemetry": "^2.6.5",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@unhead/vue": "^2.0.0-alpha.13",
|
||||
"@unhead/vue": "^2.0.0-alpha.14",
|
||||
"@vue/shared": "^3.5.13",
|
||||
"acorn": "8.14.0",
|
||||
"c12": "^2.0.2",
|
||||
|
@ -17,6 +17,7 @@ import destr from 'destr'
|
||||
import { getQuery as getURLQuery, joinURL, withoutTrailingSlash } from 'ufo'
|
||||
import { renderToString as _renderToString } from 'vue/server-renderer'
|
||||
import { createHead, propsToString, renderSSRHead } from '@unhead/vue/server'
|
||||
import { resolveUnrefHeadInput } from '@unhead/vue/utils'
|
||||
import type { Head, HeadEntryOptions, Link, ResolvedHead, Script, Style } from '@unhead/vue/types'
|
||||
|
||||
import { defineRenderHandler, getRouteRules, useNitroApp, useRuntimeConfig, useStorage } from 'nitro/runtime'
|
||||
@ -467,21 +468,17 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
}, headEntryOptions)
|
||||
}
|
||||
|
||||
const tags = await head.resolveTags()
|
||||
|
||||
// Response for component islands
|
||||
if (isRenderingIsland && islandContext) {
|
||||
const islandHead: ResolvedHead = {}
|
||||
for (const tag of tags) {
|
||||
const currentValue = islandHead[tag.tag as keyof Head]
|
||||
if (['meta', 'link', 'style', 'script', 'noscript'].includes(tag.tag)) {
|
||||
const value = currentValue || []
|
||||
;(value as any[]).push(tag.props)
|
||||
// @ts-expect-error type juggling
|
||||
islandHead[tag.tag as keyof Head] = value
|
||||
} else {
|
||||
// @ts-expect-error type juggling
|
||||
islandHead[tag.tag as keyof Head] = { innerHTML: tag.innerHTML, textContent: tag.textContent, ...tag.props }
|
||||
// TODO migrate to using resolved tags to minify the payload
|
||||
for (const entry of head.entries.values()) {
|
||||
for (const [key, value] of Object.entries(resolveUnrefHeadInput(entry.input) as Head)) {
|
||||
const currentValue = islandHead[key as keyof ResolvedHead]
|
||||
if (Array.isArray(currentValue)) {
|
||||
currentValue.push(...value)
|
||||
}
|
||||
islandHead[key as keyof ResolvedHead] = value
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,11 +512,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
return response
|
||||
}
|
||||
|
||||
// remove certain tags for nuxt islands
|
||||
const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = await renderSSRHead(head, {
|
||||
...renderSSRHeadOptions,
|
||||
resolvedTags: tags,
|
||||
})
|
||||
const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = await renderSSRHead(head, renderSSRHeadOptions)
|
||||
|
||||
// Create render context
|
||||
const htmlContext: NuxtRenderHTMLContext = {
|
||||
|
@ -14,7 +14,7 @@ overrides:
|
||||
'@nuxt/vite-builder': workspace:*
|
||||
'@nuxt/webpack-builder': workspace:*
|
||||
'@types/node': 22.13.2
|
||||
'@unhead/vue': 2.0.0-alpha.13
|
||||
'@unhead/vue': 2.0.0-alpha.14
|
||||
'@vue/compiler-core': 3.5.13
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
@ -85,8 +85,8 @@ importers:
|
||||
specifier: 7.5.8
|
||||
version: 7.5.8
|
||||
'@unhead/vue':
|
||||
specifier: 2.0.0-alpha.13
|
||||
version: 2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3))
|
||||
specifier: 2.0.0-alpha.14
|
||||
version: 2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3))
|
||||
'@vitest/coverage-v8':
|
||||
specifier: 3.0.5
|
||||
version: 3.0.5(vitest@3.0.5(@types/debug@4.1.12)(@types/node@22.13.2)(happy-dom@17.1.0)(jiti@2.4.2)(terser@5.32.0)(tsx@4.19.2)(yaml@2.7.0))
|
||||
@ -338,8 +338,8 @@ importers:
|
||||
specifier: 22.13.2
|
||||
version: 22.13.2
|
||||
'@unhead/vue':
|
||||
specifier: 2.0.0-alpha.13
|
||||
version: 2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3))
|
||||
specifier: 2.0.0-alpha.14
|
||||
version: 2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3))
|
||||
'@vue/shared':
|
||||
specifier: 3.5.13
|
||||
version: 3.5.13
|
||||
@ -502,7 +502,7 @@ importers:
|
||||
devDependencies:
|
||||
'@nuxt/scripts':
|
||||
specifier: 0.10.1
|
||||
version: 0.10.1(@types/google.maps@3.58.1)(@types/vimeo__player@2.18.3)(@types/youtube@0.1.0)(@unhead/vue@2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)
|
||||
version: 0.10.1(@types/google.maps@3.58.1)(@types/vimeo__player@2.18.3)(@types/youtube@0.1.0)(@unhead/vue@2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)
|
||||
'@parcel/watcher':
|
||||
specifier: 2.5.1
|
||||
version: 2.5.1
|
||||
@ -2118,7 +2118,7 @@ packages:
|
||||
'@types/google.maps': ^3.58.1
|
||||
'@types/vimeo__player': ^2.18.3
|
||||
'@types/youtube': ^0.1.0
|
||||
'@unhead/vue': 2.0.0-alpha.13
|
||||
'@unhead/vue': 2.0.0-alpha.14
|
||||
peerDependenciesMeta:
|
||||
'@stripe/stripe-js':
|
||||
optional: true
|
||||
@ -2919,8 +2919,8 @@ packages:
|
||||
'@ungap/structured-clone@1.2.0':
|
||||
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
|
||||
|
||||
'@unhead/vue@2.0.0-alpha.13':
|
||||
resolution: {integrity: sha512-rp1eKnXeXdrmt39JQRlQXJTYKuJOiyJ+kqqp06PifhtNv3jk0/5eXMJBeG01Rj2mOHa7/ABforoIdIxQotIzDA==}
|
||||
'@unhead/vue@2.0.0-alpha.14':
|
||||
resolution: {integrity: sha512-XQteFcROXVbPjK3bEFX/0ffzB8XAOPibZo10djaPSzP9KHEuDF/GFwY2R8NBXboSGhlZ9SqUOCKSfuCgji2nuA==}
|
||||
peerDependencies:
|
||||
vue: 3.5.13
|
||||
|
||||
@ -7301,8 +7301,8 @@ packages:
|
||||
unenv@1.10.0:
|
||||
resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==}
|
||||
|
||||
unhead@2.0.0-alpha.13:
|
||||
resolution: {integrity: sha512-fekwwUZtWKNwGY+VXKtugsBAcQN5X4Rc/ctXjVu8OZ8w6KCu+ST7eOC7ac1HVK8vN7fb0SKaSqWCNlw3NZFzRA==}
|
||||
unhead@2.0.0-alpha.14:
|
||||
resolution: {integrity: sha512-mg8aYvi9kHBjj++LGRg/PPUPEU2wbaiV1O8IV90UaCSzWzVgy6i345uZU8++zLApbWqY4XSibYLGYrB4EHO7rQ==}
|
||||
|
||||
unicode-emoji-modifier-base@1.0.0:
|
||||
resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==}
|
||||
@ -8854,10 +8854,10 @@ snapshots:
|
||||
string-width: 4.2.3
|
||||
webpack: 5.98.0
|
||||
|
||||
'@nuxt/scripts@0.10.1(@types/google.maps@3.58.1)(@types/vimeo__player@2.18.3)(@types/youtube@0.1.0)(@unhead/vue@2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)':
|
||||
'@nuxt/scripts@0.10.1(@types/google.maps@3.58.1)(@types/vimeo__player@2.18.3)(@types/youtube@0.1.0)(@unhead/vue@2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@nuxt/kit': link:packages/kit
|
||||
'@unhead/vue': 2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3))
|
||||
'@unhead/vue': 2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3))
|
||||
'@vueuse/core': 12.5.0(typescript@5.7.3)
|
||||
consola: 3.4.0
|
||||
defu: 6.1.4
|
||||
@ -9839,10 +9839,10 @@ snapshots:
|
||||
|
||||
'@ungap/structured-clone@1.2.0': {}
|
||||
|
||||
'@unhead/vue@2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3))':
|
||||
'@unhead/vue@2.0.0-alpha.14(vue@3.5.13(typescript@5.7.3))':
|
||||
dependencies:
|
||||
hookable: 5.5.3
|
||||
unhead: 2.0.0-alpha.13
|
||||
unhead: 2.0.0-alpha.14
|
||||
vue: 3.5.13(typescript@5.7.3)
|
||||
|
||||
'@unocss/astro@65.4.3(rollup@4.34.6)(vite@6.1.0(@types/node@22.13.2)(jiti@2.4.2)(sass@1.78.0)(terser@5.32.0)(tsx@4.19.2)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))':
|
||||
@ -15098,7 +15098,7 @@ snapshots:
|
||||
node-fetch-native: 1.6.6
|
||||
pathe: 1.1.2
|
||||
|
||||
unhead@2.0.0-alpha.13:
|
||||
unhead@2.0.0-alpha.14:
|
||||
dependencies:
|
||||
hookable: 5.5.3
|
||||
|
||||
|
@ -1016,7 +1016,9 @@ describe('head tags', () => {
|
||||
expect(headHtml).toContain('<meta name="description" content="overriding with an inline useHead call">')
|
||||
expect(headHtml).toMatch(/<html[^>]*class="html-attrs-test"/)
|
||||
expect(headHtml).toMatch(/<body[^>]*class="body-attrs-test"/)
|
||||
expect(headHtml).toContain('<script src="https://a-body-appended-script.com"></script></body>')
|
||||
|
||||
const bodyHtml = headHtml.match(/<body[^>]*>(.*)<\/body>/s)![1]
|
||||
expect(bodyHtml).toContain('<script src="https://a-body-appended-script.com"></script>')
|
||||
|
||||
const indexHtml = await $fetch<string>('/')
|
||||
// should render charset by default
|
||||
|
@ -1,4 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { TemplateParamsPlugin } from '@unhead/vue/plugins'
|
||||
|
||||
// Unhead v2 requires an opt-in to template params
|
||||
const head = injectHead()
|
||||
head.use(TemplateParamsPlugin)
|
||||
|
||||
const description = ref('head script setup description for %site.name')
|
||||
const siteName = ref()
|
||||
// server meta
|
||||
|
Loading…
Reference in New Issue
Block a user