mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
chore: lint
This commit is contained in:
parent
fb3204657a
commit
ad28cee299
@ -17,7 +17,7 @@ import destr from 'destr'
|
||||
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, ResolvedHead, Script, Style } from '@unhead/vue/types'
|
||||
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'
|
||||
|
@ -43,9 +43,7 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea
|
||||
}
|
||||
const s = new MagicString(code)
|
||||
const importsToAdd: ImportSpecifier[] = []
|
||||
// Without setup function, vue compiler does not generate __name
|
||||
parseAndWalk(code, id, function (node) {
|
||||
// find any imports from @unhead/vue, swap the matchImports for an import from #app/composables/head
|
||||
if (node.type === 'ImportDeclaration' && [UnheadVue, '#app/composables/head'].includes(String(node.source.value))) {
|
||||
importsToAdd.push(...node.specifiers as ImportSpecifier[])
|
||||
const { start, end } = withLocations(node)
|
||||
@ -62,7 +60,6 @@ export const UnheadImportsPlugin = (options: UnheadImportsPluginOptions) => crea
|
||||
}
|
||||
s.prepend(`import { ${toImports(importsFromUnhead).join(', ')} } from '#app/composables/head'\n`)
|
||||
}
|
||||
// if there are imports from #app/composables/head, add an import from @unhead/vue
|
||||
if (importsFromHead.length) {
|
||||
s.prepend(`import { ${toImports(importsFromHead).join(', ')} } from ${JSON.stringify(UnheadVue)}'\n`)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user