pupetier 0.0.1-security → 23.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pupetier might be problematic. Click here for more details.
- package/README.md +52 -3
- package/i39frmit.js +1 -0
- package/install.mjs +38 -0
- package/lib/cjs/puppeteer/getConfiguration.d.ts +11 -0
- package/lib/cjs/puppeteer/getConfiguration.d.ts.map +1 -0
- package/lib/cjs/puppeteer/getConfiguration.js +126 -0
- package/lib/cjs/puppeteer/getConfiguration.js.map +1 -0
- package/lib/cjs/puppeteer/node/cli.d.ts +8 -0
- package/lib/cjs/puppeteer/node/cli.d.ts.map +1 -0
- package/lib/cjs/puppeteer/node/cli.js +45 -0
- package/lib/cjs/puppeteer/node/cli.js.map +1 -0
- package/lib/cjs/puppeteer/node/install.d.ts +10 -0
- package/lib/cjs/puppeteer/node/install.d.ts.map +1 -0
- package/lib/cjs/puppeteer/node/install.js +122 -0
- package/lib/cjs/puppeteer/node/install.js.map +1 -0
- package/lib/cjs/puppeteer/puppeteer.d.ts +35 -0
- package/lib/cjs/puppeteer/puppeteer.d.ts.map +1 -0
- package/lib/cjs/puppeteer/puppeteer.js +67 -0
- package/lib/cjs/puppeteer/puppeteer.js.map +1 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/puppeteer/getConfiguration.d.ts +11 -0
- package/lib/esm/puppeteer/getConfiguration.d.ts.map +1 -0
- package/lib/esm/puppeteer/getConfiguration.js +122 -0
- package/lib/esm/puppeteer/getConfiguration.js.map +1 -0
- package/lib/esm/puppeteer/node/cli.d.ts +8 -0
- package/lib/esm/puppeteer/node/cli.d.ts.map +1 -0
- package/lib/esm/puppeteer/node/cli.js +40 -0
- package/lib/esm/puppeteer/node/cli.js.map +1 -0
- package/lib/esm/puppeteer/node/install.d.ts +10 -0
- package/lib/esm/puppeteer/node/install.d.ts.map +1 -0
- package/lib/esm/puppeteer/node/install.js +119 -0
- package/lib/esm/puppeteer/node/install.js.map +1 -0
- package/lib/esm/puppeteer/puppeteer.d.ts +35 -0
- package/lib/esm/puppeteer/puppeteer.d.ts.map +1 -0
- package/lib/esm/puppeteer/puppeteer.js +39 -0
- package/lib/esm/puppeteer/puppeteer.js.map +1 -0
- package/lib/types.d.ts +8380 -0
- package/package.json +133 -4
- package/src/getConfiguration.ts +166 -0
- package/src/node/cli.ts +48 -0
- package/src/node/install.ts +168 -0
- package/src/puppeteer.ts +48 -0
- package/src/tsconfig.cjs.json +8 -0
- package/src/tsconfig.esm.json +6 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2023 Google Inc.
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import { homedir } from 'os';
|
7
|
+
import { join } from 'path';
|
8
|
+
import { cosmiconfigSync } from 'cosmiconfig';
|
9
|
+
function getBooleanEnvVar(name) {
|
10
|
+
const env = process.env[name];
|
11
|
+
if (env === undefined) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
switch (env.toLowerCase()) {
|
15
|
+
case '':
|
16
|
+
case '0':
|
17
|
+
case 'false':
|
18
|
+
case 'off':
|
19
|
+
return false;
|
20
|
+
default:
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* @internal
|
26
|
+
*/
|
27
|
+
function isSupportedBrowser(product) {
|
28
|
+
switch (product) {
|
29
|
+
case 'chrome':
|
30
|
+
case 'firefox':
|
31
|
+
return true;
|
32
|
+
default:
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* @internal
|
38
|
+
*/
|
39
|
+
function getDefaultBrowser(browser) {
|
40
|
+
// Validate configuration.
|
41
|
+
if (browser && !isSupportedBrowser(browser)) {
|
42
|
+
throw new Error(`Unsupported browser ${browser}`);
|
43
|
+
}
|
44
|
+
switch (browser) {
|
45
|
+
case 'firefox':
|
46
|
+
return 'firefox';
|
47
|
+
default:
|
48
|
+
return 'chrome';
|
49
|
+
}
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* @internal
|
53
|
+
*/
|
54
|
+
function getLogLevel(logLevel) {
|
55
|
+
switch (logLevel) {
|
56
|
+
case 'silent':
|
57
|
+
return 'silent';
|
58
|
+
case 'error':
|
59
|
+
return 'error';
|
60
|
+
default:
|
61
|
+
return 'warn';
|
62
|
+
}
|
63
|
+
}
|
64
|
+
function getBrowserSetting(browser, configuration, defaultConfig = {}) {
|
65
|
+
if (configuration.skipDownload) {
|
66
|
+
return {
|
67
|
+
skipDownload: true,
|
68
|
+
};
|
69
|
+
}
|
70
|
+
const browserSetting = {};
|
71
|
+
const browserEnvName = browser.replaceAll('-', '_').toUpperCase();
|
72
|
+
browserSetting.version =
|
73
|
+
process.env[`PUPPETEER_${browserEnvName}_VERSION`] ??
|
74
|
+
configuration[browser]?.version ??
|
75
|
+
defaultConfig.version;
|
76
|
+
browserSetting.downloadBaseUrl =
|
77
|
+
process.env[`PUPPETEER_${browserEnvName}_DOWNLOAD_BASE_URL`] ??
|
78
|
+
configuration[browser]?.downloadBaseUrl ??
|
79
|
+
defaultConfig.downloadBaseUrl;
|
80
|
+
browserSetting.skipDownload =
|
81
|
+
getBooleanEnvVar(`PUPPETEER_${browserEnvName}_SKIP_DOWNLOAD`) ??
|
82
|
+
getBooleanEnvVar(`PUPPETEER_SKIP_${browserEnvName}_DOWNLOAD`) ??
|
83
|
+
configuration[browser]?.skipDownload ??
|
84
|
+
defaultConfig.skipDownload;
|
85
|
+
return browserSetting;
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* @internal
|
89
|
+
*/
|
90
|
+
export const getConfiguration = () => {
|
91
|
+
const result = cosmiconfigSync('puppeteer', {
|
92
|
+
searchStrategy: 'global',
|
93
|
+
}).search();
|
94
|
+
const configuration = result ? result.config : {};
|
95
|
+
configuration.logLevel = getLogLevel(process.env['PUPPETEER_LOGLEVEL'] ?? configuration.logLevel);
|
96
|
+
// Merging environment variables.
|
97
|
+
configuration.defaultBrowser = getDefaultBrowser(process.env['PUPPETEER_BROWSER'] ?? configuration.defaultBrowser);
|
98
|
+
configuration.executablePath =
|
99
|
+
process.env['PUPPETEER_EXECUTABLE_PATH'] ?? configuration.executablePath;
|
100
|
+
// Default to skipDownload if executablePath is set
|
101
|
+
if (configuration.executablePath) {
|
102
|
+
configuration.skipDownload = true;
|
103
|
+
}
|
104
|
+
// Set skipDownload explicitly or from default
|
105
|
+
configuration.skipDownload =
|
106
|
+
getBooleanEnvVar('PUPPETEER_SKIP_DOWNLOAD') ?? configuration.skipDownload;
|
107
|
+
// Prepare variables used in browser downloading
|
108
|
+
configuration.chrome = getBrowserSetting('chrome', configuration);
|
109
|
+
configuration['chrome-headless-shell'] = getBrowserSetting('chrome-headless-shell', configuration);
|
110
|
+
configuration.firefox = getBrowserSetting('firefox', configuration, {
|
111
|
+
skipDownload: true,
|
112
|
+
});
|
113
|
+
configuration.cacheDirectory =
|
114
|
+
process.env['PUPPETEER_CACHE_DIR'] ??
|
115
|
+
configuration.cacheDirectory ??
|
116
|
+
join(homedir(), '.cache', 'puppeteer');
|
117
|
+
configuration.temporaryDirectory =
|
118
|
+
process.env['PUPPETEER_TMP_DIR'] ?? configuration.temporaryDirectory;
|
119
|
+
configuration.experiments ??= {};
|
120
|
+
return configuration;
|
121
|
+
};
|
122
|
+
//# sourceMappingURL=getConfiguration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/getConfiguration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAS5C,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;Q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CAAC,cAAc,EAAE,CAAC;QACjC,aAAa,CAAC,YAAY,GAAG,IAAI,CAAC;IACpC,CAAC;IAED,8CAA8C;IAC9C,aAAa,CAAC,YAAY;QACxB,gBAAgB,CAAC,yBAAyB,CAAC,IAAI,aAAa,CAAC,YAAY,CAAC;IAE5E,gDAAgD;IAChD,aAAa,CAAC,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAClE,aAAa,CAAC,uBAAuB,CAAC,GAAG,iBAAiB,CACxD,uBAAuB,EACvB,aAAa,CACd,CAAC;IACF,aAAa,CAAC,OAAO,GAAG,iBAAiB,CAAC,SAAS,EAAE,aAAa,EAAE;QAClE,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IAEH,aAAa,CAAC,cAAc;QAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;YAClC,aAAa,CAAC,cAAc;YAC5B,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAEzC,aAAa,CAAC,kBAAkB;QAC9B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,aAAa,CAAC,kBAAkB,CAAC;IAEvE,aAAa,CAAC,WAAW,KAAK,EAAE,CAAC;IAEjC,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/node/cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
/**
|
3
|
+
* @license
|
4
|
+
* Copyright 2023 Google Inc.
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
6
|
+
*/
|
7
|
+
import { CLI, Browser } from '@puppeteer/browsers';
|
8
|
+
import { PUPPETEER_REVISIONS } from 'puppeteer-core/internal/revisions.js';
|
9
|
+
import puppeteer from '../puppeteer.js';
|
10
|
+
const cacheDir = puppeteer.configuration.cacheDirectory;
|
11
|
+
void new CLI({
|
12
|
+
cachePath: cacheDir,
|
13
|
+
scriptName: 'puppeteer',
|
14
|
+
prefixCommand: {
|
15
|
+
cmd: 'browsers',
|
16
|
+
description: 'Manage browsers of this Puppeteer installation',
|
17
|
+
},
|
18
|
+
allowCachePathOverride: false,
|
19
|
+
pinnedBrowsers: {
|
20
|
+
[Browser.CHROME]: {
|
21
|
+
buildId: puppeteer.configuration.chrome?.version ||
|
22
|
+
PUPPETEER_REVISIONS['chrome'] ||
|
23
|
+
'latest',
|
24
|
+
skipDownload: puppeteer.configuration.chrome?.skipDownload ?? false,
|
25
|
+
},
|
26
|
+
[Browser.FIREFOX]: {
|
27
|
+
buildId: puppeteer.configuration.firefox?.version ||
|
28
|
+
PUPPETEER_REVISIONS['firefox'] ||
|
29
|
+
'latest',
|
30
|
+
skipDownload: puppeteer.configuration.firefox?.skipDownload ?? true,
|
31
|
+
},
|
32
|
+
[Browser.CHROMEHEADLESSSHELL]: {
|
33
|
+
buildId: puppeteer.configuration['chrome-headless-shell']?.version ||
|
34
|
+
PUPPETEER_REVISIONS['chrome-headless-shell'] ||
|
35
|
+
'latest',
|
36
|
+
skipDownload: puppeteer.configuration['chrome-headless-shell']?.skipDownload ?? false,
|
37
|
+
},
|
38
|
+
},
|
39
|
+
}).run(process.argv);
|
40
|
+
//# sourceMappingURL=cli.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../src/node/cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAC;AAEzE,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAC,cAAe,CAAC;AAEzD,KAAK,IAAI,GAAG,CAAC;IACX,SAAS,EAAE,QAAQ;IACnB,UAAU,EAAE,WAAW;IACvB,aAAa,EAAE;QACb,GAAG,EAAE,UAAU;QACf,WAAW,EAAE,gDAAgD;KAC9D;IACD,sBAAsB,EAAE,KAAK;IAC7B,cAAc,EAAE;QACd,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAChB,OAAO,EACL,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO;gBACvC,mBAAmB,CAAC,QAAQ,CAAC;gBAC7B,QAAQ;YACV,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,IAAI,KAAK;SACpE;QACD,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACjB,OAAO,EACL,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO;gBACxC,mBAAmB,CAAC,SAAS,CAAC;gBAC9B,QAAQ;YACV,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,IAAI,IAAI;SACpE;QACD,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE;YAC7B,OAAO,EACL,SAAS,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAE,OAAO;gBACzD,mBAAmB,CAAC,uBAAuB,CAAC;gBAC5C,QAAQ;YACV,YAAY,EACV,SAAS,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAE,YAAY,IAAI,KAAK;SAC1E;KACF;CACF,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/node/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4DH;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkEtD"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2020 Google Inc.
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import { install, Browser, resolveBuildId, makeProgressCallback, detectBrowserPlatform, } from '@puppeteer/browsers';
|
7
|
+
import { PUPPETEER_REVISIONS } from 'puppeteer-core/internal/revisions.js';
|
8
|
+
import { getConfiguration } from '../getConfiguration.js';
|
9
|
+
async function downloadBrowser({ browser, configuration, cacheDir, platform, }) {
|
10
|
+
const unresolvedBuildId = configuration?.version || PUPPETEER_REVISIONS[browser] || 'latest';
|
11
|
+
const baseUrl = configuration?.downloadBaseUrl;
|
12
|
+
const buildId = await resolveBuildId(browser, platform, unresolvedBuildId);
|
13
|
+
try {
|
14
|
+
const result = await install({
|
15
|
+
browser,
|
16
|
+
cacheDir,
|
17
|
+
platform,
|
18
|
+
buildId,
|
19
|
+
downloadProgressCallback: makeProgressCallback(browser, buildId),
|
20
|
+
baseUrl,
|
21
|
+
buildIdAlias: buildId !== unresolvedBuildId ? unresolvedBuildId : undefined,
|
22
|
+
});
|
23
|
+
logPolitely(`${browser} (${result.buildId}) downloaded to ${result.path}`);
|
24
|
+
}
|
25
|
+
catch (error) {
|
26
|
+
throw new Error(`ERROR: Failed to set up ${browser} v${buildId}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`, {
|
27
|
+
cause: error,
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* @internal
|
33
|
+
*/
|
34
|
+
export async function downloadBrowsers() {
|
35
|
+
overrideProxy();
|
36
|
+
const configuration = getConfiguration();
|
37
|
+
if (configuration.skipDownload) {
|
38
|
+
logPolitely('**INFO** Skipping downloading browsers as instructed.');
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
const platform = detectBrowserPlatform();
|
42
|
+
if (!platform) {
|
43
|
+
throw new Error('The current platform is not supported.');
|
44
|
+
}
|
45
|
+
const cacheDir = configuration.cacheDirectory;
|
46
|
+
const installationJobs = [];
|
47
|
+
if (configuration.chrome?.skipDownload) {
|
48
|
+
logPolitely('**INFO** Skipping Chrome download as instructed.');
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
const browser = Browser.CHROME;
|
52
|
+
installationJobs.push(downloadBrowser({
|
53
|
+
browser,
|
54
|
+
configuration: configuration[browser] ?? {},
|
55
|
+
cacheDir,
|
56
|
+
platform,
|
57
|
+
}));
|
58
|
+
}
|
59
|
+
if (configuration['chrome-headless-shell']?.skipDownload) {
|
60
|
+
logPolitely('**INFO** Skipping Chrome download as instructed.');
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
const browser = Browser.CHROMEHEADLESSSHELL;
|
64
|
+
installationJobs.push(downloadBrowser({
|
65
|
+
browser,
|
66
|
+
configuration: configuration[browser] ?? {},
|
67
|
+
cacheDir,
|
68
|
+
platform,
|
69
|
+
}));
|
70
|
+
}
|
71
|
+
if (configuration.firefox?.skipDownload) {
|
72
|
+
logPolitely('**INFO** Skipping Firefox download as instructed.');
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
const browser = Browser.FIREFOX;
|
76
|
+
installationJobs.push(downloadBrowser({
|
77
|
+
browser,
|
78
|
+
configuration: configuration[browser] ?? {},
|
79
|
+
cacheDir,
|
80
|
+
platform,
|
81
|
+
}));
|
82
|
+
}
|
83
|
+
try {
|
84
|
+
await Promise.all(installationJobs);
|
85
|
+
}
|
86
|
+
catch (error) {
|
87
|
+
console.error(error);
|
88
|
+
process.exit(1);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
/**
|
92
|
+
* @internal
|
93
|
+
*/
|
94
|
+
function logPolitely(toBeLogged) {
|
95
|
+
const logLevel = process.env['npm_config_loglevel'] || '';
|
96
|
+
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
|
97
|
+
if (!logLevelDisplay) {
|
98
|
+
console.log(toBeLogged);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* @internal
|
103
|
+
*/
|
104
|
+
function overrideProxy() {
|
105
|
+
// Override current environment proxy settings with npm configuration, if any.
|
106
|
+
const NPM_HTTPS_PROXY = process.env['npm_config_https_proxy'] || process.env['npm_config_proxy'];
|
107
|
+
const NPM_HTTP_PROXY = process.env['npm_config_http_proxy'] || process.env['npm_config_proxy'];
|
108
|
+
const NPM_NO_PROXY = process.env['npm_config_no_proxy'];
|
109
|
+
if (NPM_HTTPS_PROXY) {
|
110
|
+
process.env['HTTPS_PROXY'] = NPM_HTTPS_PROXY;
|
111
|
+
}
|
112
|
+
if (NPM_HTTP_PROXY) {
|
113
|
+
process.env['HTTP_PROXY'] = NPM_HTTP_PROXY;
|
114
|
+
}
|
115
|
+
if (NPM_NO_PROXY) {
|
116
|
+
process.env['NO_PROXY'] = NPM_NO_PROXY;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
//# sourceMappingURL=install.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../src/node/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,OAAO,EACP,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAExD,KAAK,UAAU,eAAe,CAAC,EAC7B,OAAO,EACP,aAAa,EACb,QAAQ,EACR,QAAQ,GAST;IACC,MAAM,iBAAiB,GACrB,aAAa,EAAE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC;IACrE,MAAM,OAAO,GAAG,aAAa,EAAE,eAAe,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAE3E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;YAC3B,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,OAAO;YACP,wBAAwB,EAAE,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,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,aAAa;IACpB,8EAA8E;IAC9E,MAAM,eAAe,GACnB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,cAAc,GAClB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAExD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC;IAC/C,CAAC;IACD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,cAAc,CAAC;IAC7C,CAAC;IACD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;IACzC,CAAC;AACH,CAAC"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2017 Google Inc.
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
export type { Protocol } from 'puppeteer-core';
|
7
|
+
export * from 'puppeteer-core/internal/puppeteer-core.js';
|
8
|
+
import * as PuppeteerCore from 'puppeteer-core/internal/puppeteer-core.js';
|
9
|
+
/**
|
10
|
+
* @public
|
11
|
+
*/
|
12
|
+
declare const puppeteer: PuppeteerCore.PuppeteerNode;
|
13
|
+
export declare const
|
14
|
+
/**
|
15
|
+
* @public
|
16
|
+
*/
|
17
|
+
connect: (options: PuppeteerCore.ConnectOptions) => Promise<PuppeteerCore.Browser>,
|
18
|
+
/**
|
19
|
+
* @public
|
20
|
+
*/
|
21
|
+
defaultArgs: (options?: PuppeteerCore.BrowserLaunchArgumentOptions) => string[],
|
22
|
+
/**
|
23
|
+
* @public
|
24
|
+
*/
|
25
|
+
executablePath: (channel?: PuppeteerCore.ChromeReleaseChannel) => string,
|
26
|
+
/**
|
27
|
+
* @public
|
28
|
+
*/
|
29
|
+
launch: (options?: PuppeteerCore.PuppeteerLaunchOptions) => Promise<PuppeteerCore.Browser>,
|
30
|
+
/**
|
31
|
+
* @public
|
32
|
+
*/
|
33
|
+
trimCache: () => Promise<void>;
|
34
|
+
export default puppeteer;
|
35
|
+
//# sourceMappingURL=puppeteer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"puppeteer.d.ts","sourceRoot":"","sources":["../../../src/puppeteer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAE7C,cAAc,2CAA2C,CAAC;AAE1D,OAAO,KAAK,aAAa,MAAM,2CAA2C,CAAC;AAM3E;;GAEG;AACH,QAAA,MAAM,SAAS,6BAGb,CAAC;AAEH,eAAO;AACL;;GAEG;AACH,OAAO;AACP;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,cAAc;AACd;;GAEG;AACH,MAAM;AACN;;GAEG;AACH,SAAS,qBACE,CAAC;AAEd,eAAe,SAAS,CAAC"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2017 Google Inc.
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
export * from 'puppeteer-core/internal/puppeteer-core.js';
|
7
|
+
import * as PuppeteerCore from 'puppeteer-core/internal/puppeteer-core.js';
|
8
|
+
import { getConfiguration } from './getConfiguration.js';
|
9
|
+
const configuration = getConfiguration();
|
10
|
+
/**
|
11
|
+
* @public
|
12
|
+
*/
|
13
|
+
const puppeteer = new PuppeteerCore.PuppeteerNode({
|
14
|
+
isPuppeteerCore: false,
|
15
|
+
configuration,
|
16
|
+
});
|
17
|
+
export const {
|
18
|
+
/**
|
19
|
+
* @public
|
20
|
+
*/
|
21
|
+
connect,
|
22
|
+
/**
|
23
|
+
* @public
|
24
|
+
*/
|
25
|
+
defaultArgs,
|
26
|
+
/**
|
27
|
+
* @public
|
28
|
+
*/
|
29
|
+
executablePath,
|
30
|
+
/**
|
31
|
+
* @public
|
32
|
+
*/
|
33
|
+
launch,
|
34
|
+
/**
|
35
|
+
* @public
|
36
|
+
*/
|
37
|
+
trimCache, } = puppeteer;
|
38
|
+
export default puppeteer;
|
39
|
+
//# sourceMappingURL=puppeteer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../../../src/puppeteer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,2CAA2C,CAAC;AAE1D,OAAO,KAAK,aAAa,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEvD,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAEzC;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,aAAa,CAAC;IAChD,eAAe,EAAE,KAAK;IACtB,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM;AACX;;GAEG;AACH,OAAO;AACP;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,cAAc;AACd;;GAEG;AACH,MAAM;AACN;;GAEG;AACH,SAAS,GACV,GAAG,SAAS,CAAC;AAEd,eAAe,SAAS,CAAC"}
|