From 10ba2f190212ff37456e0c964c4db8be393d4a89 Mon Sep 17 00:00:00 2001 From: harlan Date: Fri, 14 Feb 2025 18:04:03 +1100 Subject: [PATCH] chore: unhead 2.0.0-alpha.13 --- docs/1.getting-started/12.upgrade.md | 23 +++++- docs/1.getting-started/5.seo-meta.md | 2 +- docs/3.api/2.composables/use-head-safe.md | 17 ++--- docs/3.api/2.composables/use-head.md | 2 +- package.json | 8 +-- packages/nuxt/package.json | 2 +- .../nuxt/src/core/runtime/nitro/renderer.ts | 25 ++++--- packages/nuxt/src/head/module.ts | 6 +- .../nuxt/src/head/plugins/unhead-imports.ts | 3 +- .../nuxt/src/head/runtime/composables/v3.ts | 7 +- .../nuxt/src/head/runtime/composables/v4.ts | 7 +- packages/schema/build.config.ts | 2 +- packages/schema/package.json | 1 - packages/schema/src/config/app.ts | 8 +-- packages/schema/src/index.ts | 2 +- packages/schema/src/types/head.ts | 25 +------ pnpm-lock.yaml | 71 +++++-------------- test/bundle.test.ts | 20 ++---- 18 files changed, 91 insertions(+), 140 deletions(-) diff --git a/docs/1.getting-started/12.upgrade.md b/docs/1.getting-started/12.upgrade.md index b367ebe4e1..0810276d96 100644 --- a/docs/1.getting-started/12.upgrade.md +++ b/docs/1.getting-started/12.upgrade.md @@ -260,8 +260,11 @@ for lower-level APIs. ##### Migration Steps -The above changes should have minimal impact on your app, at a minimal you should verify you're not using -any of the removed props. +The above changes should have minimal impact on your app. + +If you have issues you should verify: + +- You're not using any of the removed props. ```diff useHead({ @@ -274,6 +277,20 @@ useHead({ }) ``` +- If you're using [Template Params](https://unhead.unjs.io/usage/guides/template-params) or [Alias Tag Sorting](https://unhead.unjs.io/usage/guides/sorting#sort-with-before-and-after), you will need to explicitly opt in to these features now. + +```ts +import { TemplateParamsPlugin, AliasSortingPlugin } from '@unhead/vue/plugins' + +export default defineNuxtPlugin({ + setup() { + const unhead = injectHead() + unhead.use(TemplateParamsPlugin) + unhead.use(AliasSortingPlugin) + } +}) +``` + While not required it's recommend to update any imports from `@unhead/vue` to `#imports` or `nuxt/app`. ```diff @@ -281,7 +298,7 @@ While not required it's recommend to update any imports from `@unhead/vue` to `# +import { useHead } from '#imports' ``` -If you do have issues you may revert the behavior by enabling the `head.legacy` config. +If you still have issues you may revert to the v1 behavior by enabling the `head.legacy` config. ```ts export default defineNuxtConfig({ diff --git a/docs/1.getting-started/5.seo-meta.md b/docs/1.getting-started/5.seo-meta.md index 46a3f2298d..9f124e5ee6 100644 --- a/docs/1.getting-started/5.seo-meta.md +++ b/docs/1.getting-started/5.seo-meta.md @@ -120,7 +120,7 @@ interface MetaObject { } ``` -See [@unhead/schema](https://github.com/unjs/unhead/blob/main/packages/schema/src/schema.ts) for more detailed types. +See [unhead/types](https://github.com/unjs/unhead/blob/main/packages/unhead/src/types/schema/head.ts) for more detailed types. ## Features diff --git a/docs/3.api/2.composables/use-head-safe.md b/docs/3.api/2.composables/use-head-safe.md index 956657a9de..5e9ddd7027 100644 --- a/docs/3.api/2.composables/use-head-safe.md +++ b/docs/3.api/2.composables/use-head-safe.md @@ -41,14 +41,15 @@ useHeadSafe(input: MaybeComputedRef): void The list of allowed values is: ```ts -export default { - htmlAttrs: ['id', 'class', 'lang', 'dir'], - bodyAttrs: ['id', 'class'], - meta: ['id', 'name', 'property', 'charset', 'content'], - noscript: ['id', 'textContent'], - script: ['id', 'type', 'textContent'], - link: ['id', 'color', 'crossorigin', 'fetchpriority', 'href', 'hreflang', 'imagesrcset', 'imagesizes', 'integrity', 'media', 'referrerpolicy', 'rel', 'sizes', 'type'], +const WhitelistAttributes = { + htmlAttrs: ['class', 'style', 'lang', 'dir'], + bodyAttrs: ['class', 'style'], + meta: ['name', 'property', 'charset', 'content', 'media'], + noscript: ['textContent'], + style: ['media', 'textContent', 'nonce', 'title', 'blocking'], + script: ['type', 'textContent', 'nonce', 'blocking'], + link: ['color', 'crossorigin', 'fetchpriority', 'href', 'hreflang', 'imagesrcset', 'imagesizes', 'integrity', 'media', 'referrerpolicy', 'rel', 'sizes', 'type'], } ``` -See [@unhead/schema](https://github.com/unjs/unhead/blob/main/packages/schema/src/safeSchema.ts) for more detailed types. +See [SafeInputPlugin](https://github.com/unjs/unhead/blob/main/packages/unhead/src/plugins/safe.ts) for more detailed types. diff --git a/docs/3.api/2.composables/use-head.md b/docs/3.api/2.composables/use-head.md index 18de37c85b..a80be734d1 100644 --- a/docs/3.api/2.composables/use-head.md +++ b/docs/3.api/2.composables/use-head.md @@ -35,7 +35,7 @@ interface MetaObject { } ``` -See [@unhead/schema](https://github.com/unjs/unhead/blob/main/packages/schema/src/schema.ts) for more detailed types. +See [unhead/types](https://github.com/unjs/unhead/blob/main/packages/unhead/src/types/schema/head.ts) for more detailed types. ::note The properties of `useHead` can be dynamic, accepting `ref`, `computed` and `reactive` properties. `meta` parameter can also accept a function returning an object to make the entire object reactive. diff --git a/package.json b/package.json index ba06282b5d..4062b71f58 100644 --- a/package.json +++ b/package.json @@ -46,9 +46,7 @@ "@nuxt/vite-builder": "workspace:*", "@nuxt/webpack-builder": "workspace:*", "@types/node": "22.13.1", - "@unhead/schema": "2.0.0-alpha.9", - "@unhead/shared": "2.0.0-alpha.9", - "@unhead/vue": "2.0.0-alpha.8", + "@unhead/vue": "2.0.0-alpha.13", "@vue/compiler-core": "3.5.13", "@vue/compiler-dom": "3.5.13", "@vue/shared": "3.5.13", @@ -65,7 +63,6 @@ "typescript": "5.7.3", "ufo": "1.5.4", "unbuild": "3.3.1", - "unhead": "2.0.0-alpha.9", "unimport": "4.1.1", "vite": "6.1.0", "vue": "3.5.13" @@ -86,8 +83,7 @@ "@types/babel__helper-plugin-utils": "7.10.3", "@types/node": "22.13.1", "@types/semver": "7.5.8", - "@unhead/schema": "2.0.0-alpha.9", - "@unhead/vue": "2.0.0-alpha.9", + "@unhead/vue": "2.0.0-alpha.13", "@vitest/coverage-v8": "3.0.5", "@vue/test-utils": "2.4.6", "acorn": "8.14.0", diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 562ad90f3e..28104e2c31 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -71,7 +71,7 @@ "@nuxt/schema": "workspace:*", "@nuxt/telemetry": "^2.6.5", "@nuxt/vite-builder": "workspace:*", - "@unhead/vue": "^2.0.0-alpha.9", + "@unhead/vue": "^2.0.0-alpha.13", "@vue/shared": "^3.5.13", "acorn": "8.14.0", "c12": "^2.0.2", diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index 95d547fdb3..dd896ea189 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -18,7 +18,6 @@ import { getQuery as getURLQuery, joinURL, withoutTrailingSlash } from 'ufo' import { renderToString as _renderToString } from 'vue/server-renderer' import { createHead as createServerHead, propsToString, renderSSRHead } from '@unhead/vue/server' import type { Head, HeadEntryOptions, Link, Script, Style } from '@unhead/vue/types' -import { resolveUnrefHeadInput } from '@unhead/vue' import { defineRenderHandler, getRouteRules, useNitroApp, useRuntimeConfig, useStorage } from 'nitro/runtime' import type { NuxtPayload, NuxtSSRContext } from 'nuxt/app' @@ -468,19 +467,19 @@ export default defineRenderHandler(async (event): Promise({ rootDir: nuxt.options.rootDir, })) - const unheadPlugins = await tryResolveModule('unhead/plugins', nuxt.options.modulesDir) || 'unhead/plugins' + const unheadPlugins = await tryResolveModule('@unhead/vue/plugins', nuxt.options.modulesDir) || '@unhead/vue/plugins' addTemplate({ filename: 'unhead-options.mjs', getContents () { @@ -54,10 +54,10 @@ export default defineNuxtModule({ } // v1 unhead legacy options const disableCapoSorting = !nuxt.options.experimental.headNext - return `import { DeprecationsPlugin, PromisesPlugin } from ${JSON.stringify(unheadPlugins)}; + return `import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin } from ${JSON.stringify(unheadPlugins)}; export default { disableCapoSorting: ${Boolean(disableCapoSorting)}, - plugins: [DeprecationsPlugin, PromisesPlugin], + plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin], }` }, }) diff --git a/packages/nuxt/src/head/plugins/unhead-imports.ts b/packages/nuxt/src/head/plugins/unhead-imports.ts index cc1e5cf3f0..adff43b45f 100644 --- a/packages/nuxt/src/head/plugins/unhead-imports.ts +++ b/packages/nuxt/src/head/plugins/unhead-imports.ts @@ -36,7 +36,7 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea name: 'nuxt:head:unhead-imports', enforce: 'post', transformInclude (id) { - return (isJS(id) || isVue(id, { type: ['script'] })) && !id.startsWith(distDir) && !UNHEAD_LIB_RE.test(id) + return (isJS(id) || isVue(id, { type: ['script'] })) && !id.startsWith('virtual:') && !id.startsWith(distDir) && !UNHEAD_LIB_RE.test(id) }, transform (code, id) { if (!code.includes(UnheadVue)) { @@ -66,6 +66,7 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea } if (s.hasChanged()) { + console.log('transformed', id) return { code: s.toString(), map: options.sourcemap diff --git a/packages/nuxt/src/head/runtime/composables/v3.ts b/packages/nuxt/src/head/runtime/composables/v3.ts index bbc7f0011f..efacaae2cf 100644 --- a/packages/nuxt/src/head/runtime/composables/v3.ts +++ b/packages/nuxt/src/head/runtime/composables/v3.ts @@ -1,5 +1,4 @@ -import type { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient } from '@unhead/vue' -import type { ActiveHeadEntry, MergeHead } from '@unhead/schema' +import type { ActiveHeadEntry, MergeHead, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient } from '@unhead/vue' import { hasInjectionContext, inject } from 'vue' import { useHead as headCore, @@ -8,8 +7,8 @@ import { useSeoMeta as seoMeta, useServerHead as serverHead, useServerHeadSafe as serverHeadSafe, useServerSeoMeta as serverSeoMeta, } from '@unhead/vue' -import { tryUseNuxtApp } from '#app' -import type { NuxtApp } from '#app' +import { tryUseNuxtApp } from '#app/nuxt' +import type { NuxtApp } from '#app/nuxt' /** * Injects the head client from the Nuxt context or Vue inject. diff --git a/packages/nuxt/src/head/runtime/composables/v4.ts b/packages/nuxt/src/head/runtime/composables/v4.ts index 358bab89b0..95ef8da4de 100644 --- a/packages/nuxt/src/head/runtime/composables/v4.ts +++ b/packages/nuxt/src/head/runtime/composables/v4.ts @@ -1,5 +1,4 @@ -import type { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient } from '@unhead/vue' -import type { ActiveHeadEntry, MergeHead } from '@unhead/schema' +import type { ActiveHeadEntry, MergeHead, UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient } from '@unhead/vue/types' import { hasInjectionContext, inject } from 'vue' import { useHead as headCore, @@ -8,8 +7,8 @@ import { useSeoMeta as seoMeta, useServerHead as serverHead, useServerHeadSafe as serverHeadSafe, useServerSeoMeta as serverSeoMeta, } from '@unhead/vue' -import { useNuxtApp } from '#app' -import type { NuxtApp } from '#app' +import { useNuxtApp } from '#app/nuxt' +import type { NuxtApp } from '#app/nuxt' /** * Injects the head client from the Nuxt context or Vue inject. diff --git a/packages/schema/build.config.ts b/packages/schema/build.config.ts index 7e920ba419..b16323d317 100644 --- a/packages/schema/build.config.ts +++ b/packages/schema/build.config.ts @@ -28,7 +28,7 @@ export default defineBuildConfig({ }, externals: [ // Type imports - '@unhead/schema', + '@unhead/vue', '@vitejs/plugin-vue', 'chokidar', '@vitejs/plugin-vue-jsx', diff --git a/packages/schema/package.json b/packages/schema/package.json index 917d61215a..7665540717 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -40,7 +40,6 @@ "@types/rollup-plugin-visualizer": "4.2.4", "@types/webpack-bundle-analyzer": "4.7.0", "@types/webpack-hot-middleware": "2.25.9", - "@unhead/schema": "2.0.0-alpha.9", "@vitejs/plugin-vue": "5.2.1", "@vitejs/plugin-vue-jsx": "4.1.1", "@vue/compiler-core": "3.5.13", diff --git a/packages/schema/src/config/app.ts b/packages/schema/src/config/app.ts index 2ee20136a0..4633f7714f 100644 --- a/packages/schema/src/config/app.ts +++ b/packages/schema/src/config/app.ts @@ -260,7 +260,7 @@ export default defineResolvers({ /** * Customize Nuxt root element id. - * @type {typeof import('@unhead/schema').HtmlAttributes} + * @type {typeof import('@unhead/vue/types').ResolvedHtmlAttributes} */ rootAttrs: { $resolve: async (val, get) => { @@ -290,7 +290,7 @@ export default defineResolvers({ /** * Customize Nuxt Teleport element attributes. - * @type {typeof import('@unhead/schema').HtmlAttributes} + * @type {typeof import('@unhead/vue/types').ResolvedHtmlAttributes} */ teleportAttrs: { $resolve: async (val, get) => { @@ -311,7 +311,7 @@ export default defineResolvers({ /** * Customize Nuxt Nuxt SpaLoader element attributes. - * @type {Partial} + * @type {Partial} */ spaLoaderAttrs: { id: '__nuxt-loader', @@ -486,7 +486,7 @@ export default defineResolvers({ * } * }) * ``` - * @type {typeof import('@unhead/schema').RenderSSRHeadOptions} + * @type {typeof import('@unhead/vue/types').RenderSSRHeadOptions} */ renderSSRHeadOptions: { $resolve: async (val, get) => { diff --git a/packages/schema/src/index.ts b/packages/schema/src/index.ts index 40294bcdce..8307d55320 100644 --- a/packages/schema/src/index.ts +++ b/packages/schema/src/index.ts @@ -4,7 +4,7 @@ export type { Component, ComponentMeta, ComponentsDir, ComponentsOptions, ScanDi export type { AppConfig, AppConfigInput, CustomAppConfig, NuxtAppConfig, NuxtBuilder, NuxtConfig, NuxtConfigLayer, NuxtOptions, PublicRuntimeConfig, RuntimeConfig, RuntimeValue, SchemaDefinition, UpperSnakeCase, ViteConfig } from './types/config' export type { GenerateAppOptions, HookResult, ImportPresetWithDeprecation, NuxtAnalyzeMeta, NuxtHookName, NuxtHooks, NuxtLayout, NuxtMiddleware, NuxtPage, TSReference, VueTSConfig, WatchEvent } from './types/hooks' export type { ImportsOptions } from './types/imports' -export type { AppHeadMetaObject, MetaObject, MetaObjectRaw, HeadAugmentations } from './types/head' +export type { AppHeadMetaObject, MetaObject, MetaObjectRaw } from './types/head' export type { ModuleDefinition, ModuleMeta, ModuleOptions, ModuleSetupInstallResult, ModuleSetupReturn, NuxtModule, ResolvedModuleOptions } from './types/module' export type { Nuxt, NuxtApp, NuxtPlugin, NuxtPluginTemplate, NuxtTemplate, NuxtTypeTemplate, NuxtServerTemplate, ResolvedNuxtTemplate } from './types/nuxt' export type { RouterConfig, RouterConfigSerializable, RouterOptions } from './types/router' diff --git a/packages/schema/src/types/head.ts b/packages/schema/src/types/head.ts index 937cf82c2c..9537865cb1 100644 --- a/packages/schema/src/types/head.ts +++ b/packages/schema/src/types/head.ts @@ -1,27 +1,6 @@ -import type { Head, MergeHead } from '@unhead/schema' +import type { Head, MergeHead } from '@unhead/vue/types' -/** @deprecated Extend types from `@unhead/schema` directly. This may be removed in a future minor version. */ -export interface HeadAugmentations extends MergeHead { - // runtime type modifications - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - base?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - link?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - meta?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - style?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - script?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - noscript?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - htmlAttrs?: {} - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - bodyAttrs?: {} -} - -export type MetaObjectRaw = Head +export type MetaObjectRaw = Head export type MetaObject = MetaObjectRaw export type AppHeadMetaObject = MetaObjectRaw & { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2373bf9f7d..576dad26c1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,7 @@ overrides: '@nuxt/vite-builder': workspace:* '@nuxt/webpack-builder': workspace:* '@types/node': 22.13.1 - '@unhead/schema': 2.0.0-alpha.9 - '@unhead/shared': 2.0.0-alpha.9 - '@unhead/vue': 2.0.0-alpha.8 + '@unhead/vue': 2.0.0-alpha.13 '@vue/compiler-core': 3.5.13 '@vue/compiler-dom': 3.5.13 '@vue/shared': 3.5.13 @@ -33,7 +31,6 @@ overrides: typescript: 5.7.3 ufo: 1.5.4 unbuild: 3.3.1 - unhead: 2.0.0-alpha.9 unimport: 4.1.1 vite: 6.1.0 vue: 3.5.13 @@ -87,12 +84,9 @@ importers: '@types/semver': specifier: 7.5.8 version: 7.5.8 - '@unhead/schema': - specifier: 2.0.0-alpha.9 - version: 2.0.0-alpha.9 '@unhead/vue': - specifier: 2.0.0-alpha.8 - version: 2.0.0-alpha.8(vue@3.5.13(typescript@5.7.3)) + specifier: 2.0.0-alpha.13 + version: 2.0.0-alpha.13(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.1)(happy-dom@17.0.4)(jiti@2.4.2)(terser@5.32.0)(tsx@4.19.2)(yaml@2.7.0)) @@ -344,8 +338,8 @@ importers: specifier: 22.13.1 version: 22.13.1 '@unhead/vue': - specifier: 2.0.0-alpha.8 - version: 2.0.0-alpha.8(vue@3.5.13(typescript@5.7.3)) + specifier: 2.0.0-alpha.13 + version: 2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3)) '@vue/shared': specifier: 3.5.13 version: 3.5.13 @@ -508,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.8(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.13(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3) '@parcel/watcher': specifier: 2.5.1 version: 2.5.1 @@ -700,9 +694,6 @@ importers: '@types/webpack-hot-middleware': specifier: 2.25.9 version: 2.25.9(esbuild@0.25.0) - '@unhead/schema': - specifier: 2.0.0-alpha.9 - version: 2.0.0-alpha.9 '@vitejs/plugin-vue': specifier: 5.2.1 version: 5.2.1(vite@6.1.0(@types/node@22.13.1)(jiti@2.4.2)(terser@5.32.0)(tsx@4.19.2)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) @@ -2127,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.8 + '@unhead/vue': 2.0.0-alpha.13 peerDependenciesMeta: '@stripe/stripe-js': optional: true @@ -2903,14 +2894,8 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - '@unhead/schema@2.0.0-alpha.9': - resolution: {integrity: sha512-KNMPY8tpeJ0FvHlA+81q2QeFZJ7vMMg9TBBdQBudLsza1whSSHvmpxVJY8rw8GNpnXrvnRYspLNHKpDn69RJrA==} - - '@unhead/shared@2.0.0-alpha.9': - resolution: {integrity: sha512-Ex/BsuAVix8X8pLEQ4gxrEmTzN10WoCh0hs6OHXQqjkvoDCzJo2OdIoQoR1B245PSzVagZhJ+PJCfXtkm8BEVQ==} - - '@unhead/vue@2.0.0-alpha.8': - resolution: {integrity: sha512-pBh1QgDMPyx5xwOykMFOCV4+S9X2hIRZbfk3K0shyb61vPuMJVcy4aEYbQyMCy/LAbH1PyAUug5dW97QF758tw==} + '@unhead/vue@2.0.0-alpha.13': + resolution: {integrity: sha512-rp1eKnXeXdrmt39JQRlQXJTYKuJOiyJ+kqqp06PifhtNv3jk0/5eXMJBeG01Rj2mOHa7/ABforoIdIxQotIzDA==} peerDependencies: vue: 3.5.13 @@ -5959,9 +5944,6 @@ packages: package-manager-detector@0.2.9: resolution: {integrity: sha512-+vYvA/Y31l8Zk8dwxHhL3JfTuHPm6tlxM2A3GeQyl7ovYnSp1+mzAxClxaOr0qO1TtPxbQxetI7v5XqKLJZk7Q==} - packrup@0.1.2: - resolution: {integrity: sha512-ZcKU7zrr5GlonoS9cxxrb5HVswGnyj6jQvwFBa6p5VFw7G71VAHcUKL5wyZSU/ECtPM/9gacWxy2KFQKt1gMNA==} - parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -7284,8 +7266,8 @@ packages: unenv@1.10.0: resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==} - unhead@2.0.0-alpha.9: - resolution: {integrity: sha512-Pvf5SZqAMOwumnCgOVOJtuJm4IM+QBOw1tCzvINFp31KNnBqQ6UCk3bYPWWdqjxavwFK3/lKs017qWS6PNKQqQ==} + unhead@2.0.0-alpha.13: + resolution: {integrity: sha512-fekwwUZtWKNwGY+VXKtugsBAcQN5X4Rc/ctXjVu8OZ8w6KCu+ST7eOC7ac1HVK8vN7fb0SKaSqWCNlw3NZFzRA==} unicode-emoji-modifier-base@1.0.0: resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} @@ -7918,9 +7900,6 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} - zhead@2.2.4: - resolution: {integrity: sha512-8F0OI5dpWIA5IGG5NHUg9staDwz/ZPxZtvGVf01j7vHqSyZ0raHY+78atOVxRqb73AotX22uV1pXt3gYSstGag==} - zip-stream@6.0.1: resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==} engines: {node: '>= 14'} @@ -8840,10 +8819,10 @@ snapshots: string-width: 4.2.3 webpack: 5.97.1 - '@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.8(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.13(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)': dependencies: '@nuxt/kit': link:packages/kit - '@unhead/vue': 2.0.0-alpha.8(vue@3.5.13(typescript@5.7.3)) + '@unhead/vue': 2.0.0-alpha.13(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 @@ -9788,22 +9767,10 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@unhead/schema@2.0.0-alpha.9': + '@unhead/vue@2.0.0-alpha.13(vue@3.5.13(typescript@5.7.3))': dependencies: hookable: 5.5.3 - zhead: 2.2.4 - - '@unhead/shared@2.0.0-alpha.9': - dependencies: - '@unhead/schema': 2.0.0-alpha.9 - packrup: 0.1.2 - - '@unhead/vue@2.0.0-alpha.8(vue@3.5.13(typescript@5.7.3))': - dependencies: - '@unhead/schema': 2.0.0-alpha.9 - '@unhead/shared': 2.0.0-alpha.9 - hookable: 5.5.3 - unhead: 2.0.0-alpha.9 + unhead: 2.0.0-alpha.13 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.1)(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))': @@ -13581,8 +13548,6 @@ snapshots: package-manager-detector@0.2.9: {} - packrup@0.1.2: {} - parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -15040,10 +15005,8 @@ snapshots: node-fetch-native: 1.6.6 pathe: 1.1.2 - unhead@2.0.0-alpha.9: + unhead@2.0.0-alpha.13: dependencies: - '@unhead/schema': 2.0.0-alpha.9 - '@unhead/shared': 2.0.0-alpha.9 hookable: 5.5.3 unicode-emoji-modifier-base@1.0.0: {} @@ -15800,8 +15763,6 @@ snapshots: yoctocolors@2.1.1: {} - zhead@2.2.4: {} - zip-stream@6.0.1: dependencies: archiver-utils: 5.0.2 diff --git a/test/bundle.test.ts b/test/bundle.test.ts index cd2cce0ab7..953d6be939 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -23,8 +23,8 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const [clientStats, clientStatsInlined] = await Promise.all((['.output', '.output-inline']) .map(outputDir => analyzeSizes(['**/*.js'], join(rootDir, outputDir, 'public')))) - expect.soft(roundToKilobytes(clientStats!.totalBytes)).toMatchInlineSnapshot(`"114k"`) - expect.soft(roundToKilobytes(clientStatsInlined!.totalBytes)).toMatchInlineSnapshot(`"114k"`) + expect.soft(roundToKilobytes(clientStats!.totalBytes)).toMatchInlineSnapshot(`"111k"`) + expect.soft(roundToKilobytes(clientStatsInlined!.totalBytes)).toMatchInlineSnapshot(`"111k"`) const files = new Set([...clientStats!.files, ...clientStatsInlined!.files].map(f => f.replace(/\..*\.js/, '.js'))) @@ -38,7 +38,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM it('default client bundle size (pages)', async () => { const clientStats = await analyzeSizes(['**/*.js'], join(pagesRootDir, '.output/public')) - expect.soft(roundToKilobytes(clientStats!.totalBytes)).toMatchInlineSnapshot(`"175k"`) + expect.soft(roundToKilobytes(clientStats!.totalBytes)).toMatchInlineSnapshot(`"172k"`) const files = clientStats!.files.map(f => f.replace(/\..*\.js/, '.js')) @@ -58,7 +58,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"208k"`) + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"0.0k"`) const modules = await analyzeSizes(['node_modules/**/*'], serverDir) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"1388k"`) @@ -70,7 +70,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM expect(packages).toMatchInlineSnapshot(` [ "@babel/parser", - "@unhead/shared", "@vue/compiler-core", "@vue/compiler-dom", "@vue/compiler-ssr", @@ -84,7 +83,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "entities", "estree-walker", "hookable", - "packrup", "source-map-js", "ufo", "unhead", @@ -98,10 +96,10 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output-inline/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"559k"`) + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"0.0k"`) const modules = await analyzeSizes(['node_modules/**/*'], serverDir) - expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"82.4k"`) + expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"82.0k"`) const packages = modules.files .filter(m => m.endsWith('package.json')) @@ -109,11 +107,9 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM .sort() expect(packages).toMatchInlineSnapshot(` [ - "@unhead/shared", "db0", "devalue", "hookable", - "packrup", "unhead", ] `) @@ -123,7 +119,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(pagesRootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"299k"`) + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot(`"0.0k"`) const modules = await analyzeSizes(['node_modules/**/*'], serverDir) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot(`"1388k"`) @@ -135,7 +131,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM expect(packages).toMatchInlineSnapshot(` [ "@babel/parser", - "@unhead/shared", "@vue/compiler-core", "@vue/compiler-dom", "@vue/compiler-ssr", @@ -149,7 +144,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "entities", "estree-walker", "hookable", - "packrup", "source-map-js", "ufo", "unhead",