Skip to content

Commit 3f9af0b

Browse files
committed
fix: support relative paths
1 parent 9b15c20 commit 3f9af0b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ function getExtname(file: string): string {
357357
}
358358

359359
export function getParserSync(file: string, options?: ParserOptions): Parser {
360+
file = Path.resolve(file)
360361
const parentDir = Path.dirname(file)
361362
const extname = getExtname(file)
362363
const parser = dirParserCache.getSync(
@@ -418,6 +419,7 @@ export async function getParserAsync(
418419
file: string,
419420
options?: ParserOptions
420421
): Promise<Parser> {
422+
file = Path.resolve(file)
421423
const parentDir = Path.dirname(file)
422424
const extname = getExtname(file)
423425

0 commit comments

Comments
 (0)