mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 19:32:40 +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 { getQuery as getURLQuery, joinURL, withoutTrailingSlash } from 'ufo'
|
||||||
import { renderToString as _renderToString } from 'vue/server-renderer'
|
import { renderToString as _renderToString } from 'vue/server-renderer'
|
||||||
import { createHead as createServerHead, propsToString, renderSSRHead } from '@unhead/vue/server'
|
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 { resolveUnrefHeadInput } from '@unhead/vue'
|
||||||
|
|
||||||
import { defineRenderHandler, getRouteRules, useNitroApp, useRuntimeConfig, useStorage } from 'nitro/runtime'
|
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 s = new MagicString(code)
|
||||||
const importsToAdd: ImportSpecifier[] = []
|
const importsToAdd: ImportSpecifier[] = []
|
||||||
// Without setup function, vue compiler does not generate __name
|
|
||||||
parseAndWalk(code, id, function (node) {
|
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))) {
|
if (node.type === 'ImportDeclaration' && [UnheadVue, '#app/composables/head'].includes(String(node.source.value))) {
|
||||||
importsToAdd.push(...node.specifiers as ImportSpecifier[])
|
importsToAdd.push(...node.specifiers as ImportSpecifier[])
|
||||||
const { start, end } = withLocations(node)
|
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`)
|
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) {
|
if (importsFromHead.length) {
|
||||||
s.prepend(`import { ${toImports(importsFromHead).join(', ')} } from ${JSON.stringify(UnheadVue)}'\n`)
|
s.prepend(`import { ${toImports(importsFromHead).join(', ')} } from ${JSON.stringify(UnheadVue)}'\n`)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user