Skip to content

Commit

Permalink
chore: use Promise.all to load component data
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored and johnleider committed Apr 12, 2024
1 parent bd69e60 commit 237ba08
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/api-generator/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,17 @@ export async function generateDirectiveDataFromTypes (): Promise<DirectiveData[]
export async function generateComponentDataFromTypes (component: string): Promise<ComponentData> {
const sourceFile = project.addSourceFileAtPath(`./templates/tmp/${component}.d.ts`)

const props = await inspect(project, sourceFile.getTypeAlias('ComponentProps'))
const events = await inspect(project, sourceFile.getTypeAlias('ComponentEvents'))
const slots = await inspect(project, sourceFile.getTypeAlias('ComponentSlots'))
const exposed = await inspect(project, sourceFile.getTypeAlias('ComponentExposed'))
const [
props,
events,
slots,
exposed,
] = await Promise.all([
inspect(project, sourceFile.getTypeAlias('ComponentProps')),
inspect(project, sourceFile.getTypeAlias('ComponentEvents')),
inspect(project, sourceFile.getTypeAlias('ComponentSlots')),
inspect(project, sourceFile.getTypeAlias('ComponentExposed')),
])

const sections = [props, events, slots, exposed]

Expand Down

0 comments on commit 237ba08

Please sign in to comment.