Commit 6320940 1 parent bcbb459 commit 6320940 Copy full SHA for 6320940
File tree 2 files changed +3
-5
lines changed
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { launch } from "@astral/astral" ;
2
- import { DEFAULT_PORT , launchHttpServer } from "./utils/server.ts" ;
2
+ import { launchHttpServer } from "./utils/server.ts" ;
3
3
import type { MdToPdfOptions } from "./types.ts" ;
4
4
5
5
/**
@@ -20,7 +20,7 @@ export async function mdToPdf(
20
20
const server = launchHttpServer ( path , options ) ;
21
21
22
22
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 } ` ) ;
24
24
const pdf = await page . pdf ( ) ;
25
25
26
26
// 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";
5
5
import { parse } from "@std/yaml/parse" ;
6
6
import { join } from "@std/path" ;
7
7
8
- export const DEFAULT_PORT = 33433 ;
9
-
10
8
await initMd4w ( "small" ) ;
11
9
12
10
/**
@@ -71,7 +69,7 @@ export function launchHttpServer(
71
69
return notFound ( ) ;
72
70
} ;
73
71
74
- return Deno . serve ( { onListen : ( ) => "" , port : DEFAULT_PORT } , handler ) ;
72
+ return Deno . serve ( { onListen : ( ) => "" , port : 0 } , handler ) ;
75
73
}
76
74
77
75
/**
You can’t perform that action at this time.
0 commit comments