@@ -6,9 +6,12 @@ const axios = require('axios');
6
6
const { logger, setLoggingLevel, bsiExecutablePath, isPkg } = require ( '../../globals' ) ;
7
7
8
8
/**
9
- * Maps Puppeteer's platform values to the Chrome version history API platform values
10
- * @param {string } puppeteerPlatform - Platform value from detectBrowserPlatform()
11
- * @returns {string } - Platform value for Chrome version history API
9
+ * Maps Puppeteer's platform values to corresponding Chrome version history API platform values.
10
+ * Converts 'win' to 'win', 'mac' to 'mac', and 'linux' to 'linux'.
11
+ * If the platform cannot be mapped, it returns the original Puppeteer platform value.
12
+ *
13
+ * @param {string } puppeteerPlatform - Platform value from detectBrowserPlatform().
14
+ * @returns {string } - Platform value suitable for the Chrome version history API.
12
15
*/
13
16
function mapPlatformToChrome ( puppeteerPlatform ) {
14
17
// Chrome API expects: win, mac, linux
@@ -25,8 +28,20 @@ function mapPlatformToChrome(puppeteerPlatform) {
25
28
return puppeteerPlatform ;
26
29
}
27
30
28
- // Function to list all available browser versions
29
- // Returns an array of available browsers
31
+ /**
32
+ * List all available browser versions.
33
+ *
34
+ * @param {object } options - An options object.
35
+ * @param {string } options.browser - Browser to list available versions for. Can be one of "chrome" or "firefox".
36
+ * @param {string } options.channel - Which of the browser's release channel versions should be listed?
37
+ * This option is only used for Chrome. Can be one of "stable", "beta", "dev", or "canary".
38
+ * @param {string } options.loglevel - The log level. Can be one of "error", "warn", "info", "verbose", "debug", or "silly".
39
+ *
40
+ * @returns {Promise<Array<Object>> } - A promise that resolves to an array of available browsers.
41
+ * Each browser is represented by an object with the following properties:
42
+ * - version {string}: The browser version, e.g. "115.0.5790.90".
43
+ * - name {string}: The browser name, e.g. "chrome/platforms/win/channels/stable/versions/115.0.5790.90".
44
+ */
30
45
async function browserListAvailable ( options ) {
31
46
try {
32
47
// Set log level
@@ -212,8 +227,14 @@ async function browserListAvailable(options) {
212
227
throw err ;
213
228
}
214
229
}
215
- // Function to find most recent version of Chrome that Puppeteer can download and use
216
- // Returns the version number
230
+
231
+ /**
232
+ * Finds the most recent version of Chrome that Puppeteer can download and use.
233
+ *
234
+ * @param {string } channel - The Chrome release channel.
235
+ * Valid values are "stable", "beta", "dev", "canary".
236
+ * @returns {Promise<string> } - A promise that resolves to the most recent usable Chrome build ID.
237
+ */
217
238
async function getMostRecentUsableChromeBuildId ( channel ) {
218
239
try {
219
240
logger . verbose ( `Get most recent usable Chrome build ID: Channel "${ channel } "` ) ;
0 commit comments