Tons of Solutions Engineering work done today for the rest of the CS team! Headway, Howard Hanna, Engels, Brighton, etc. Also completed Datasnippers auth flow and worked on Anthology's script. Cloned Anthology's courses (900..) and will clone Full Story on Monday.

This commit is contained in:
Norm Rasmussen
2024-01-05 17:07:59 -05:00
parent ce261975ca
commit a5fe4bd2c8
3157 changed files with 554269 additions and 16 deletions

118
Scripts/node_modules/puppeteer/src/getConfiguration.ts generated vendored Normal file
View File

@ -0,0 +1,118 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {homedir} from 'os';
import {join} from 'path';
import {cosmiconfigSync} from 'cosmiconfig';
import type {Configuration, Product} from 'puppeteer-core';
/**
* @internal
*/
function isSupportedProduct(product: unknown): product is Product {
switch (product) {
case 'chrome':
case 'firefox':
return true;
default:
return false;
}
}
/**
* @internal
*/
export const getConfiguration = (): Configuration => {
const result = cosmiconfigSync('puppeteer').search();
const configuration: Configuration = result ? result.config : {};
configuration.logLevel = (process.env['PUPPETEER_LOGLEVEL'] ??
process.env['npm_config_LOGLEVEL'] ??
process.env['npm_package_config_LOGLEVEL'] ??
configuration.logLevel ??
'warn') as 'silent' | 'error' | 'warn';
// Merging environment variables.
configuration.defaultProduct = (process.env['PUPPETEER_PRODUCT'] ??
process.env['npm_config_puppeteer_product'] ??
process.env['npm_package_config_puppeteer_product'] ??
configuration.defaultProduct ??
'chrome') as Product;
configuration.executablePath =
process.env['PUPPETEER_EXECUTABLE_PATH'] ??
process.env['npm_config_puppeteer_executable_path'] ??
process.env['npm_package_config_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 = Boolean(
process.env['PUPPETEER_SKIP_DOWNLOAD'] ??
process.env['npm_config_puppeteer_skip_download'] ??
process.env['npm_package_config_puppeteer_skip_download'] ??
configuration.skipDownload
);
// Prepare variables used in browser downloading
if (!configuration.skipDownload) {
configuration.browserRevision =
process.env['PUPPETEER_BROWSER_REVISION'] ??
process.env['npm_config_puppeteer_browser_revision'] ??
process.env['npm_package_config_puppeteer_browser_revision'] ??
configuration.browserRevision;
const downloadHost =
process.env['PUPPETEER_DOWNLOAD_HOST'] ??
process.env['npm_config_puppeteer_download_host'] ??
process.env['npm_package_config_puppeteer_download_host'];
if (downloadHost && configuration.logLevel === 'warn') {
console.warn(
`PUPPETEER_DOWNLOAD_HOST is deprecated. Use PUPPETEER_DOWNLOAD_BASE_URL instead.`
);
}
configuration.downloadBaseUrl =
process.env['PUPPETEER_DOWNLOAD_BASE_URL'] ??
process.env['npm_config_puppeteer_download_base_url'] ??
process.env['npm_package_config_puppeteer_download_base_url'] ??
configuration.downloadBaseUrl ??
downloadHost;
configuration.downloadPath =
process.env['PUPPETEER_DOWNLOAD_PATH'] ??
process.env['npm_config_puppeteer_download_path'] ??
process.env['npm_package_config_puppeteer_download_path'] ??
configuration.downloadPath;
}
configuration.cacheDirectory =
process.env['PUPPETEER_CACHE_DIR'] ??
process.env['npm_config_puppeteer_cache_dir'] ??
process.env['npm_package_config_puppeteer_cache_dir'] ??
configuration.cacheDirectory ??
join(homedir(), '.cache', 'puppeteer');
configuration.temporaryDirectory =
process.env['PUPPETEER_TMP_DIR'] ??
process.env['npm_config_puppeteer_tmp_dir'] ??
process.env['npm_package_config_puppeteer_tmp_dir'] ??
configuration.temporaryDirectory;
configuration.experiments ??= {};
// Validate configuration.
if (!isSupportedProduct(configuration.defaultProduct)) {
throw new Error(`Unsupported product ${configuration.defaultProduct}`);
}
return configuration;
};

31
Scripts/node_modules/puppeteer/src/node/cli.ts generated vendored Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env node
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {CLI, Browser} from '@puppeteer/browsers';
import {PUPPETEER_REVISIONS} from 'puppeteer-core/internal/revisions.js';
import puppeteer from '../puppeteer.js';
// TODO: deprecate downloadPath in favour of cacheDirectory.
const cacheDir =
puppeteer.configuration.downloadPath ??
puppeteer.configuration.cacheDirectory!;
void new CLI({
cachePath: cacheDir,
scriptName: 'puppeteer',
prefixCommand: {
cmd: 'browsers',
description: 'Manage browsers of this Puppeteer installation',
},
allowCachePathOverride: false,
pinnedBrowsers: {
[Browser.CHROME]: PUPPETEER_REVISIONS.chrome,
[Browser.FIREFOX]: PUPPETEER_REVISIONS.firefox,
},
}).run(process.argv);

121
Scripts/node_modules/puppeteer/src/node/install.ts generated vendored Normal file
View File

@ -0,0 +1,121 @@
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import {
install,
Browser,
resolveBuildId,
makeProgressCallback,
detectBrowserPlatform,
} from '@puppeteer/browsers';
import type {Product} from 'puppeteer-core';
import {PUPPETEER_REVISIONS} from 'puppeteer-core/internal/revisions.js';
import {getConfiguration} from '../getConfiguration.js';
/**
* @internal
*/
const supportedProducts = {
chrome: 'Chrome',
firefox: 'Firefox Nightly',
} as const;
/**
* @internal
*/
export async function downloadBrowser(): Promise<void> {
overrideProxy();
const configuration = getConfiguration();
if (configuration.skipDownload) {
logPolitely('**INFO** Skipping browser download as instructed.');
return;
}
const downloadBaseUrl = configuration.downloadBaseUrl;
const platform = detectBrowserPlatform();
if (!platform) {
throw new Error('The current platform is not supported.');
}
const product = configuration.defaultProduct!;
const browser = productToBrowser(product);
const unresolvedBuildId =
configuration.browserRevision || PUPPETEER_REVISIONS[product] || 'latest';
const buildId = await resolveBuildId(browser, platform, unresolvedBuildId);
// TODO: deprecate downloadPath in favour of cacheDirectory.
const cacheDir = configuration.downloadPath ?? configuration.cacheDirectory!;
try {
const result = await install({
browser,
cacheDir,
platform,
buildId,
downloadProgressCallback: makeProgressCallback(browser, buildId),
baseUrl: downloadBaseUrl,
});
logPolitely(
`${supportedProducts[product]} (${result.buildId}) downloaded to ${result.path}`
);
} catch (error) {
console.error(
`ERROR: Failed to set up ${supportedProducts[product]} r${buildId}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`
);
console.error(error);
process.exit(1);
}
}
function productToBrowser(product?: Product) {
switch (product) {
case 'chrome':
return Browser.CHROME;
case 'firefox':
return Browser.FIREFOX;
}
return Browser.CHROME;
}
/**
* @internal
*/
function logPolitely(toBeLogged: unknown): void {
const logLevel = process.env['npm_config_loglevel'] || '';
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
// eslint-disable-next-line no-console
if (!logLevelDisplay) {
console.log(toBeLogged);
}
}
/**
* @internal
*/
function overrideProxy() {
// Override current environment proxy settings with npm configuration, if any.
const NPM_HTTPS_PROXY =
process.env['npm_config_https_proxy'] || process.env['npm_config_proxy'];
const NPM_HTTP_PROXY =
process.env['npm_config_http_proxy'] || process.env['npm_config_proxy'];
const NPM_NO_PROXY = process.env['npm_config_no_proxy'];
if (NPM_HTTPS_PROXY) {
process.env['HTTPS_PROXY'] = NPM_HTTPS_PROXY;
}
if (NPM_HTTP_PROXY) {
process.env['HTTP_PROXY'] = NPM_HTTP_PROXY;
}
if (NPM_NO_PROXY) {
process.env['NO_PROXY'] = NPM_NO_PROXY;
}
}

48
Scripts/node_modules/puppeteer/src/puppeteer.ts generated vendored Normal file
View File

@ -0,0 +1,48 @@
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
export type {Protocol} from 'puppeteer-core';
export * from 'puppeteer-core/internal/puppeteer-core.js';
import {PuppeteerNode} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import {getConfiguration} from './getConfiguration.js';
const configuration = getConfiguration();
/**
* @public
*/
const puppeteer = new PuppeteerNode({
isPuppeteerCore: false,
configuration,
});
export const {
/**
* @public
*/
connect,
/**
* @public
*/
defaultArgs,
/**
* @public
*/
executablePath,
/**
* @public
*/
launch,
/**
* @public
*/
trimCache,
} = puppeteer;
export default puppeteer;

8
Scripts/node_modules/puppeteer/src/tsconfig.cjs.json generated vendored Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "../lib/cjs/puppeteer"
}
}

6
Scripts/node_modules/puppeteer/src/tsconfig.esm.json generated vendored Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../lib/esm/puppeteer"
}
}