File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 11import { launch } from "@astral/astral" ;
2- import { DEFAULT_PORT , launchHttpServer } from "./utils/server.ts" ;
2+ import { launchHttpServer } from "./utils/server.ts" ;
33import type { MdToPdfOptions } from "./types.ts" ;
44
55/**
@@ -20,7 +20,7 @@ export async function mdToPdf(
2020 const server = launchHttpServer ( path , options ) ;
2121
2222 const browser = await launch ( ) ;
23- const page = await browser . newPage ( `http://localhost:${ DEFAULT_PORT } ` ) ;
23+ const page = await browser . newPage ( `http://localhost:${ server . addr . port } ` ) ;
2424 const pdf = await page . pdf ( ) ;
2525
2626 // Close the browser and the server
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ import { extract } from "@std/front-matter/yaml";
55import { parse } from "@std/yaml/parse" ;
66import { join } from "@std/path" ;
77
8- export const DEFAULT_PORT = 33433 ;
9-
108await initMd4w ( "small" ) ;
119
1210/**
@@ -71,7 +69,7 @@ export function launchHttpServer(
7169 return notFound ( ) ;
7270 } ;
7371
74- return Deno . serve ( { onListen : ( ) => "" , port : DEFAULT_PORT } , handler ) ;
72+ return Deno . serve ( { onListen : ( ) => "" , port : 0 } , handler ) ;
7573}
7674
7775/**
You can’t perform that action at this time.
0 commit comments