@@ -5,34 +5,11 @@ import { detect } from './detect.js';
55import { runBrowser } from './run.js' ;
66import { createProfiles } from './create_profiles.js' ;
77import { BrowserInstance } from './instance.js' ;
8-
9- interface Config {
10- browsers : any [ ] ;
11- }
12-
13- interface LaunchOptions {
14- browser : string ;
15- version ?: string ;
16- proxy ?: string ;
17- options ?: string [ ] ;
18- skipDefaults ?: boolean ;
19- detached ?: boolean ;
20- noProxy ?: string | string [ ] ;
21- headless ?: boolean ;
22- prefs ?: { [ key : string ] : any } ;
23- profile ?: string | null ;
24- }
25-
26- interface Browser {
27- name : string ;
28- version : string ;
29- type : string ;
30- command : string ;
31- }
8+ import type { Config , LaunchOptions , Browser , BrowserInfo } from './core-types.js' ;
329
3310interface LaunchFunction {
3411 ( uri : string , options : string | LaunchOptions ) : Promise < BrowserInstance > ;
35- browsers : any [ ] ;
12+ browsers : Browser [ ] ;
3613}
3714
3815/**
@@ -85,19 +62,19 @@ async function getLauncher(configFile?: string): Promise<LaunchFunction> {
8562/**
8663 * Detect available browsers
8764 */
88- async function detectBrowsers ( ) : Promise < Browser [ ] > {
65+ async function detectBrowsers ( ) : Promise < BrowserInfo [ ] > {
8966 const browsers = await detect ( ) ;
9067 return browsers . map ( ( browser ) => {
9168 return pick ( browser , [ 'name' , 'version' , 'type' , 'command' ] ) ;
92- } ) as Browser [ ] ;
69+ } ) as BrowserInfo [ ] ;
9370}
9471
9572/**
9673 * Detect the available browsers and build appropriate profiles if necessary
9774 */
9875async function buildConfig ( configDir : string ) : Promise < Config > {
9976 const browsers = await detect ( ) ;
100- await createProfiles ( browsers as any , configDir ) ;
77+ await createProfiles ( browsers , configDir ) ;
10178 return { browsers } ;
10279}
10380
@@ -127,5 +104,6 @@ async function updateBrowsers(configFile?: string): Promise<Config> {
127104}
128105
129106export { getLauncher , detectBrowsers , updateBrowsers } ;
130- export type { Config , LaunchOptions , Browser , LaunchFunction } ;
107+ export type { Config , LaunchOptions , Browser , BrowserInfo } from './core-types.js' ;
108+ export type { LaunchFunction } ;
131109export { BrowserInstance } from './instance.js' ;
0 commit comments