Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
perf(cli): use Promise.all (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumbiu committed Jan 18, 2024
1 parent 31241ba commit ddb944c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/shikiji-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ export async function run(
_: files = [],
} = options

for (const path of files) {
const codes = await Promise.all(files.map(async (path) => {
const content = await fs.readFile(path, 'utf-8')
const ext = lang || parse(path).ext.slice(1)
log(await codeToANSI(content, ext as BundledLanguage, theme))
}
return await codeToANSI(content, ext as BundledLanguage, theme)
}))

for (const code of codes)
log(code)
}

run()

0 comments on commit ddb944c

Please sign in to comment.