Skip to content

Commit bba0ed4

Browse files
committed
feat: enable parse cache
1 parent cbedcc0 commit bba0ed4

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.changeset/strange-keys-brush.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@vue-macros/common": patch
3+
"@vue-macros/api": patch
4+
---
5+
6+
Enable parse cache
7+

packages/api/src/ts/scope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function getTSFile(filePath: string): Promise<TSFile> {
3939
filePath,
4040
content,
4141
ast: REGEX_SUPPORTED_EXT.test(filePath)
42-
? babelParse(code, lang).body
42+
? babelParse(code, lang, { cache: true }).body
4343
: undefined,
4444
})
4545
}

packages/common/src/vue.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ export function parseSFC(code: string, id: string): SFC {
5454
if (!descriptor.scriptSetup) return
5555
return babelParse(descriptor.scriptSetup.content, lang, {
5656
plugins: [['importAttributes', { deprecatedAssertSyntax: true }]],
57+
cache: true,
5758
})
5859
},
5960
getScriptAst() {
6061
if (!descriptor.script) return
6162
return babelParse(descriptor.script.content, lang, {
6263
plugins: [['importAttributes', { deprecatedAssertSyntax: true }]],
64+
cache: true,
6365
})
6466
},
6567
} satisfies Partial<SFC>)

0 commit comments

Comments
 (0)