Skip to content

Commit

Permalink
feat: expose log
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Jun 28, 2022
1 parent 66277fa commit 78c919b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ export const open = async (options: Partial<Options>): Promise<ViteServer> => {

const server = await createViteServer(config)

server.log = log

// logs
!quiet && log('started - serving file:', chalk.yellow(file))
!quiet && server.vite.printUrls()
Expand Down
3 changes: 3 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface ViteServer {
networkAddr: string
/** The Vite dev server instance */
vite: ViteDevServer
/** Log function */
log: (...args: unknown[]) => void
}

/**
Expand Down Expand Up @@ -48,5 +50,6 @@ export const createViteServer = async (viteConfig: ViteConfig = {}): Promise<Vit
localAddr,
networkAddr,
vite: viteDevServer,
log: void 0 as never,
}
}

0 comments on commit 78c919b

Please sign in to comment.