UNPKG

@vscode/js-debug-browsers

Version:

Browser launch and discovery logic used in VS Code's JavaScript Debugger

50 lines 1.89 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.WindowsChromeBrowserFinder = void 0; const path_1 = require("path"); const util_1 = require("./util"); const fs_1 = require("fs"); /** * Finds the Chrome browser on Windows. */ class WindowsChromeBrowserFinder { constructor(env = process.env, fs = fs_1.promises) { this.env = env; this.fs = fs; } async findWhere(predicate) { return (await this.findAll()).find(predicate); } async findAll() { const sep = path_1.win32.sep; const suffixes = [ { name: `${sep}Google${sep}Chrome Dev${sep}Application${sep}chrome.exe`, type: "dev" /* Dev */, }, { name: `${sep}Google${sep}Chrome SxS${sep}Application${sep}chrome.exe`, type: "canary" /* Canary */, }, { name: `${sep}Google${sep}Chrome Beta${sep}Application${sep}chrome.exe`, type: "beta" /* Beta */, }, { name: `${sep}Google${sep}Chrome${sep}Application${sep}chrome.exe`, type: "stable" /* Stable */, }, ]; const installations = await (0, util_1.findWindowsCandidates)(this.env, this.fs, suffixes); const customChromePath = await (0, util_1.preferredChromePath)(this.fs, this.env); if (customChromePath) { installations.unshift({ path: customChromePath, quality: "custom" /* Custom */ }); } return installations; } } exports.WindowsChromeBrowserFinder = WindowsChromeBrowserFinder; //# sourceMappingURL=windowsChrome.js.map