Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj committed Sep 19, 2024
1 parent 61d6c0c commit ce5a58c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/definePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ function isStringLiteral(node: Node | null | undefined): node is StringLiteral {
return node?.type === 'StringLiteral'
}

function parseAst(code: string, id: string): { ast?: Program; offset: number } {
let ast: Program | undefined
function getAst(code: string, id: string): { ast?: Program; offset: number } {
let offset = 0
let lang = getLang(id.split(MACRO_DEFINE_PAGE_QUERY)[0]!)
let ast: Program | undefined
const lang = getLang(id.split(MACRO_DEFINE_PAGE_QUERY)[0]!)
if (lang === 'vue') {
const sfc = parseSFC(code, id)
if (sfc.scriptSetup) {
Expand Down Expand Up @@ -60,7 +60,7 @@ export function definePageTransform({
return isExtractingDefinePage ? 'export default {}' : undefined
}

const { ast, offset } = parseAst(code, id)
const { ast, offset } = getAst(code, id)
if (!ast) return

const definePageNodes = ((ast?.body || []) as Node[])
Expand Down Expand Up @@ -182,7 +182,7 @@ export function extractDefinePageNameAndPath(
): { name?: string; path?: string } | null | undefined {
if (!sfcCode.includes(MACRO_DEFINE_PAGE)) return

const { ast } = parseAst(sfcCode, id)
const { ast } = getAst(sfcCode, id)
if (!ast) return

const definePageNodes = ((ast.body ?? []) as Node[])
Expand Down

0 comments on commit ce5a58c

Please sign in to comment.