From 1629a5cea57a01af762d10d17ad900f3ba8f2280 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 5 Oct 2022 15:10:40 +1100 Subject: [PATCH 01/28] feat(head): migrate to latest `@vueuse/head` --- packages/nuxt/package.json | 4 +- packages/nuxt/src/head/runtime/components.ts | 10 +- packages/nuxt/src/head/runtime/composables.ts | 18 ++- .../head/runtime/lib/vueuse-head.plugin.ts | 37 ++++-- packages/schema/package.json | 1 + packages/schema/src/config/_app.ts | 6 +- packages/schema/src/types/config.ts | 4 +- packages/schema/src/types/meta.ts | 111 +++++++++++++++--- test/basic.test.ts | 3 +- yarn.lock | 72 +++++++++--- 10 files changed, 204 insertions(+), 62 deletions(-) diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 2fb8eb6579f..944a5903233 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -42,9 +42,9 @@ "@nuxt/telemetry": "^2.1.5", "@nuxt/ui-templates": "^0.4.0", "@nuxt/vite-builder": "3.0.0-rc.11", - "@vue/reactivity": "^3.2.39", + "@vue/reactivity": "^3.2.40", "@vue/shared": "^3.2.39", - "@vueuse/head": "^0.7.12", + "@vueuse/head": "^0.9.6", "chokidar": "^3.5.3", "cookie-es": "^0.5.0", "defu": "^6.1.0", diff --git a/packages/nuxt/src/head/runtime/components.ts b/packages/nuxt/src/head/runtime/components.ts index db72e444ce8..ade52903efa 100644 --- a/packages/nuxt/src/head/runtime/components.ts +++ b/packages/nuxt/src/head/runtime/components.ts @@ -1,6 +1,6 @@ import { defineComponent, PropType } from 'vue' import type { SetupContext } from 'vue' -import { useHead } from './composables' +import { useHeadRaw } from './composables' import type { Props, FetchPriority, @@ -15,7 +15,7 @@ const removeUndefinedProps = (props: Props) => Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined)) const setupForUseMeta = (metaFactory: (props: Props, ctx: SetupContext) => Record, renderChild?: boolean) => (props: Props, ctx: SetupContext) => { - useHead(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx)) + useHeadRaw(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx)) return () => renderChild ? ctx.slots.default?.() : null } @@ -97,7 +97,7 @@ export const Script = defineComponent({ .map(({ children }) => children) .join('') if (textContent) { - script.children = textContent + script.innerHTML = textContent } return { script: [script] @@ -120,7 +120,7 @@ export const NoScript = defineComponent({ .map(({ children }) => children) .join('') if (textContent) { - noscript.children = textContent + noscript.innerHtml = textContent } return { noscript: [noscript] @@ -244,7 +244,7 @@ export const Style = defineComponent({ if (process.dev && typeof textContent !== 'string') { console.error('