UNPKG

@vscode/js-debug-browsers

Version:

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

49 lines 1.95 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.WindowsEdgeBrowserFinder = void 0; const path_1 = require("path"); const fs_1 = require("fs"); const util_1 = require("./util"); /** * Finds the Chrome browser on Windows. */ class WindowsEdgeBrowserFinder { 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 suffixes = [ { name: `${path_1.sep}Microsoft${path_1.sep}Edge SxS${path_1.sep}Application${path_1.sep}msedge.exe`, type: "canary" /* Canary */, }, { name: `${path_1.sep}Microsoft${path_1.sep}Edge Dev${path_1.sep}Application${path_1.sep}msedge.exe`, type: "dev" /* Dev */, }, { name: `${path_1.sep}Microsoft${path_1.sep}Edge Beta${path_1.sep}Application${path_1.sep}msedge.exe`, type: "beta" /* Beta */, }, { name: `${path_1.sep}Microsoft${path_1.sep}Edge${path_1.sep}Application${path_1.sep}msedge.exe`, type: "stable" /* Stable */, }, ]; const installations = await (0, util_1.findWindowsCandidates)(this.env, this.fs, suffixes); const customEdgePath = await (0, util_1.preferredEdgePath)(this.fs, this.env); if (customEdgePath) { installations.unshift({ path: customEdgePath, quality: "custom" /* Custom */ }); } return installations; } } exports.WindowsEdgeBrowserFinder = WindowsEdgeBrowserFinder; //# sourceMappingURL=windowsEdge.js.map