mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-02 08:40:31 +00:00
perf(nuxt): early return from annotation for non-object syntax plugins (#30683)
This commit is contained in:
parent
a8a43a9203
commit
2a29482f61
@ -44,6 +44,9 @@ export async function extractMetadata (code: string, loader = 'ts' as 'ts' | 'ts
|
|||||||
if (metaCache[code]) {
|
if (metaCache[code]) {
|
||||||
return metaCache[code]
|
return metaCache[code]
|
||||||
}
|
}
|
||||||
|
if (code.match(/defineNuxtPlugin\s*\([\w(]/)) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
const js = await transform(code, { loader })
|
const js = await transform(code, { loader })
|
||||||
parseAndWalk(js.code, `file.${loader}`, (node) => {
|
parseAndWalk(js.code, `file.${loader}`, (node) => {
|
||||||
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }
|
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }
|
||||||
|
Loading…
Reference in New Issue
Block a user