mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(nuxt3): fix meta type generation (#628)
This commit is contained in:
parent
768488f07d
commit
48458e4544
@ -1,7 +1,7 @@
|
|||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { addPlugin, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
import { addPlugin, addTemplate, defineNuxtModule } from '@nuxt/kit'
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import type { MetaObject } from './types'
|
import type { MetaObject } from './runtime'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
name: 'meta',
|
name: 'meta',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { isFunction } from '@vue/shared'
|
import { isFunction } from '@vue/shared'
|
||||||
import { computed } from '@vue/reactivity'
|
import { computed } from '@vue/reactivity'
|
||||||
import type { ComputedGetter } from '@vue/reactivity'
|
import type { ComputedGetter } from '@vue/reactivity'
|
||||||
import type { MetaObject } from '../types'
|
import type { MetaObject } from './types'
|
||||||
import { useNuxtApp } from '#app'
|
import { useNuxtApp } from '#app'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export * from './composables'
|
export * from './composables'
|
||||||
|
export * from './types'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createMetaManager } from 'vue-meta'
|
import { createMetaManager } from 'vue-meta'
|
||||||
import type { MetaObject } from '../../types'
|
import type { MetaObject } from '../types'
|
||||||
import { defineNuxtPlugin } from '#app'
|
import { defineNuxtPlugin } from '#app'
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxt) => {
|
export default defineNuxtPlugin((nuxt) => {
|
||||||
|
21
packages/nuxt3/src/meta/runtime/types.ts
Normal file
21
packages/nuxt3/src/meta/runtime/types.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
export interface MetaObject extends Record<string, any> {
|
||||||
|
/**
|
||||||
|
* The character encoding in which the document is encoded => `<meta charset="<value>" />`
|
||||||
|
*
|
||||||
|
* @default `'utf-8'`
|
||||||
|
*/
|
||||||
|
charset?: string
|
||||||
|
/**
|
||||||
|
* Configuration of the viewport (the area of the window in which web content can be seen),
|
||||||
|
* mapped to => `<meta name="viewport" content="<value>" />`
|
||||||
|
*
|
||||||
|
* @default `'width=device-width, initial-scale=1'`
|
||||||
|
*/
|
||||||
|
viewport?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@nuxt/kit' {
|
||||||
|
interface NuxtConfig {
|
||||||
|
meta?: MetaObject,
|
||||||
|
}
|
||||||
|
}
|
23
packages/nuxt3/src/meta/types.d.ts
vendored
23
packages/nuxt3/src/meta/types.d.ts
vendored
@ -1,23 +0,0 @@
|
|||||||
export * from './runtime/composables'
|
|
||||||
|
|
||||||
export interface MetaObject extends Record<string, any> {
|
|
||||||
/**
|
|
||||||
* The character encoding in which the document is encoded => `<meta charset="<value>" />`
|
|
||||||
*
|
|
||||||
* @default `'utf-8'`
|
|
||||||
*/
|
|
||||||
charset?: string
|
|
||||||
/**
|
|
||||||
* Configuration of the viewport (the area of the window in which web content can be seen),
|
|
||||||
* mapped to => `<meta name="viewport" content="<value>" />`
|
|
||||||
*
|
|
||||||
* @default `'width=device-width, initial-scale=1'`
|
|
||||||
*/
|
|
||||||
viewport?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '@nuxt/kit' {
|
|
||||||
interface NuxtConfig {
|
|
||||||
meta?: MetaObject,
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user