@@ -48,6 +48,7 @@ import { typstBinaryPath } from "../../core/typst.ts";
4848import { quartoCacheDir } from "../../core/appdirs.ts" ;
4949import { isWindows } from "../../deno_ral/platform.ts" ;
5050import { makeStringEnumTypeEnforcer } from "../../typing/dynamic.ts" ;
51+ import { findChrome } from "../../core/puppeteer.ts" ;
5152
5253export const kTargets = [
5354 "install" ,
@@ -212,11 +213,12 @@ async function checkInstall(services: RenderServices) {
212213 info ( "" ) ;
213214 const toolsMessage = "Checking tools...................." ;
214215 const toolsOutput : string [ ] = [ ] ;
216+ let tools : Awaited < ReturnType < typeof allTools > > ;
215217 await withSpinner ( {
216218 message : toolsMessage ,
217219 doneMessage : toolsMessage + "OK" ,
218220 } , async ( ) => {
219- const tools = await allTools ( ) ;
221+ tools = await allTools ( ) ;
220222
221223 for ( const tool of tools . installed ) {
222224 const version = await tool . installedVersion ( ) || "(external install)" ;
@@ -260,6 +262,38 @@ async function checkInstall(services: RenderServices) {
260262 latexOutput . forEach ( ( out ) => info ( out ) ) ;
261263 info ( "" ) ;
262264
265+ const chromeHeadlessMessage = "Checking Chrome Headless...................." ;
266+ const chromeHeadlessOutput : string [ ] = [ ] ;
267+ await withSpinner ( {
268+ message : chromeHeadlessMessage ,
269+ doneMessage : chromeHeadlessMessage + "OK" ,
270+ } , async ( ) => {
271+ const chromeSystemPath = await findChrome ( ) ;
272+ const chromiumQuartoPath = tools . installed . find ( ( tool ) =>
273+ tool . name === "chromium"
274+ ) ;
275+ if ( chromeSystemPath !== undefined ) {
276+ chromeHeadlessOutput . push ( `${ kIndent } Using: Chrome found on system` ) ;
277+ chromeHeadlessOutput . push ( `${ kIndent } Path: ${ dirname ( chromeSystemPath ) } ` ) ;
278+ } else if ( chromiumQuartoPath ) {
279+ chromeHeadlessOutput . push (
280+ `${ kIndent } Using: Chromium installed by Quarto` ,
281+ ) ;
282+ if ( chromiumQuartoPath ?. binDir ) {
283+ chromeHeadlessOutput . push (
284+ `${ kIndent } Path: ${ chromiumQuartoPath ?. binDir } ` ,
285+ ) ;
286+ }
287+ chromeHeadlessOutput . push (
288+ `${ kIndent } Version: ${ chromiumQuartoPath . installedVersion } ` ,
289+ ) ;
290+ } else {
291+ chromeHeadlessOutput . push ( `${ kIndent } Chrome: (not detected)` ) ;
292+ }
293+ } ) ;
294+ chromeHeadlessOutput . forEach ( ( out ) => info ( out ) ) ;
295+ info ( "" ) ;
296+
263297 const kMessage = "Checking basic markdown render...." ;
264298 await withSpinner ( {
265299 message : kMessage ,
0 commit comments