@vscode/js-debug-browsers
Version:
Browser launch and discovery logic used in VS Code's JavaScript Debugger
52 lines (51 loc) • 1.89 kB
TypeScript
/// <reference types="node" />
import { Quality, IExecutable, IBrowserFinder } from '.';
import _execa from 'execa';
import { promises as fsPromises } from 'fs';
import { IPriority } from './util';
/**
* Base class providing utilities for the Darwin browser finders.
*/
export declare abstract class DarwinFinderBase implements IBrowserFinder {
protected readonly env: NodeJS.ProcessEnv;
private readonly fs;
private readonly execa;
protected lsRegisterCommand: string;
/**
* Well-known paths to browsers on Chrome. This is used to make finding fast
* in the common case, avoiding sometimes-slow launch services.
* @see https://github.com/microsoft/vscode-js-debug/issues/570
*/
protected wellKnownPaths: ReadonlyArray<IExecutable>;
private foundAll;
constructor(env?: NodeJS.ProcessEnv, fs?: typeof fsPromises, execa?: typeof _execa);
/**
* @inheritdoc
*/
findWhere(predicate: (exe: IExecutable) => boolean): Promise<IExecutable | undefined>;
/**
* @inheritdoc
*/
findAll(): Promise<IExecutable[]>;
/**
* findAll implementation. Cached.
*/
protected abstract findAllInner(): Promise<IExecutable[]>;
/**
* Returns the environment-configured custom path, if any.
*/
protected abstract getPreferredPath(): string | undefined;
/**
* Finds apps matching the given pattern in the launch service register.
*/
protected findLaunchRegisteredApps(pattern: string, defaultPaths: ReadonlyArray<string>, suffixes: ReadonlyArray<string>): Promise<Set<string>>;
/**
* Creates priorities for the {@link sort} function that places browsers
* in proper order based on their installed location./
*/
protected createPriorities(priorities: {
name: string;
weight: number;
quality: Quality;
}[]): IPriority[];
}