perf(nuxt): early return from annotation for non-object syntax plugins (#30683)

This commit is contained in:
Daniel Roe 2025-01-22 09:22:44 +00:00 committed by GitHub
parent a8a43a9203
commit 2a29482f61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,9 @@ export async function extractMetadata (code: string, loader = 'ts' as 'ts' | 'ts
if (metaCache[code]) {
return metaCache[code]
}
if (code.match(/defineNuxtPlugin\s*\([\w(]/)) {
return {}
}
const js = await transform(code, { loader })
parseAndWalk(js.code, `file.${loader}`, (node) => {
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }