puppeteer-core
Advanced tools
Comparing version 5.4.0 to 5.4.1
@@ -17,21 +17,2 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -198,3 +179,3 @@ exports.WaitTask = exports.DOMWorld = void 0; | ||
} | ||
const fs = await Promise.resolve().then(() => __importStar(require('fs'))); | ||
const fs = await helper_js_1.helper.importFSModule(); | ||
let contents = await fs.promises.readFile(path, 'utf8'); | ||
@@ -260,3 +241,3 @@ contents += '//# sourceURL=' + path.replace(/\n/g, ''); | ||
} | ||
const fs = await Promise.resolve().then(() => __importStar(require('fs'))); | ||
const fs = await helper_js_1.helper.importFSModule(); | ||
let contents = await fs.promises.readFile(path, 'utf8'); | ||
@@ -263,0 +244,0 @@ contents += '/*# sourceURL=' + path.replace(/\n/g, '') + '*/'; |
@@ -31,2 +31,15 @@ /// <reference types="node" /> | ||
declare function readProtocolStream(client: CDPSession, handle: string, path?: string): Promise<Buffer>; | ||
/** | ||
* Loads the Node fs promises API. Needed because on Node 10.17 and below, | ||
* fs.promises is experimental, and therefore not marked as enumerable. That | ||
* means when TypeScript compiles an `import('fs')`, its helper doesn't spot the | ||
* promises declaration and therefore on Node <10.17 you get an error as | ||
* fs.promises is undefined in compiled TypeScript land. | ||
* | ||
* See https://github.com/puppeteer/puppeteer/issues/6548 for more details. | ||
* | ||
* Once Node 10 is no longer supported (April 2021) we can remove this and use | ||
* `(await import('fs')).promises`. | ||
*/ | ||
declare function importFSModule(): Promise<typeof import('fs')>; | ||
export declare const helper: { | ||
@@ -44,2 +57,3 @@ evaluationString: typeof evaluationString; | ||
isNumber: typeof isNumber; | ||
importFSModule: typeof importFSModule; | ||
addEventListener: typeof addEventListener; | ||
@@ -46,0 +60,0 @@ removeEventListeners: typeof removeEventListeners; |
@@ -241,3 +241,3 @@ "use strict"; | ||
} | ||
const fs = environment_js_1.isNode ? await Promise.resolve().then(() => __importStar(require('fs'))) : null; | ||
const fs = environment_js_1.isNode ? await importFSModule() : null; | ||
let eof = false; | ||
@@ -269,2 +269,24 @@ let fileHandle; | ||
} | ||
/** | ||
* Loads the Node fs promises API. Needed because on Node 10.17 and below, | ||
* fs.promises is experimental, and therefore not marked as enumerable. That | ||
* means when TypeScript compiles an `import('fs')`, its helper doesn't spot the | ||
* promises declaration and therefore on Node <10.17 you get an error as | ||
* fs.promises is undefined in compiled TypeScript land. | ||
* | ||
* See https://github.com/puppeteer/puppeteer/issues/6548 for more details. | ||
* | ||
* Once Node 10 is no longer supported (April 2021) we can remove this and use | ||
* `(await import('fs')).promises`. | ||
*/ | ||
async function importFSModule() { | ||
if (!environment_js_1.isNode) { | ||
throw new Error('Cannot load the fs module API outside of Node.'); | ||
} | ||
const fs = await Promise.resolve().then(() => __importStar(require('fs'))); | ||
if (fs.promises) { | ||
return fs; | ||
} | ||
return fs.default; | ||
} | ||
exports.helper = { | ||
@@ -282,2 +304,3 @@ evaluationString, | ||
isNumber, | ||
importFSModule, | ||
addEventListener, | ||
@@ -284,0 +307,0 @@ removeEventListeners, |
@@ -447,4 +447,3 @@ "use strict"; | ||
const path = await Promise.resolve().then(() => __importStar(require('path'))); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const fs = await Promise.resolve().then(() => __importStar(require('fs'))); | ||
const fs = await helper_js_1.helper.importFSModule(); | ||
// Locate all files and confirm that they exist. | ||
@@ -451,0 +450,0 @@ const files = await Promise.all(filePaths.map(async (filePath) => { |
@@ -17,21 +17,2 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -1146,3 +1127,3 @@ exports.Page = void 0; | ||
} | ||
const fs = await Promise.resolve().then(() => __importStar(require('fs'))); | ||
const fs = await helper_js_1.helper.importFSModule(); | ||
if (options.path) | ||
@@ -1149,0 +1130,0 @@ await fs.promises.writeFile(options.path, buffer); |
@@ -175,3 +175,3 @@ /** | ||
} | ||
const fs = await import('fs'); | ||
const fs = await helper.importFSModule(); | ||
let contents = await fs.promises.readFile(path, 'utf8'); | ||
@@ -237,3 +237,3 @@ contents += '//# sourceURL=' + path.replace(/\n/g, ''); | ||
} | ||
const fs = await import('fs'); | ||
const fs = await helper.importFSModule(); | ||
let contents = await fs.promises.readFile(path, 'utf8'); | ||
@@ -240,0 +240,0 @@ contents += '/*# sourceURL=' + path.replace(/\n/g, '') + '*/'; |
@@ -31,2 +31,15 @@ /// <reference types="node" /> | ||
declare function readProtocolStream(client: CDPSession, handle: string, path?: string): Promise<Buffer>; | ||
/** | ||
* Loads the Node fs promises API. Needed because on Node 10.17 and below, | ||
* fs.promises is experimental, and therefore not marked as enumerable. That | ||
* means when TypeScript compiles an `import('fs')`, its helper doesn't spot the | ||
* promises declaration and therefore on Node <10.17 you get an error as | ||
* fs.promises is undefined in compiled TypeScript land. | ||
* | ||
* See https://github.com/puppeteer/puppeteer/issues/6548 for more details. | ||
* | ||
* Once Node 10 is no longer supported (April 2021) we can remove this and use | ||
* `(await import('fs')).promises`. | ||
*/ | ||
declare function importFSModule(): Promise<typeof import('fs')>; | ||
export declare const helper: { | ||
@@ -44,2 +57,3 @@ evaluationString: typeof evaluationString; | ||
isNumber: typeof isNumber; | ||
importFSModule: typeof importFSModule; | ||
addEventListener: typeof addEventListener; | ||
@@ -46,0 +60,0 @@ removeEventListeners: typeof removeEventListeners; |
@@ -219,3 +219,3 @@ /** | ||
} | ||
const fs = isNode ? await import('fs') : null; | ||
const fs = isNode ? await importFSModule() : null; | ||
let eof = false; | ||
@@ -247,2 +247,24 @@ let fileHandle; | ||
} | ||
/** | ||
* Loads the Node fs promises API. Needed because on Node 10.17 and below, | ||
* fs.promises is experimental, and therefore not marked as enumerable. That | ||
* means when TypeScript compiles an `import('fs')`, its helper doesn't spot the | ||
* promises declaration and therefore on Node <10.17 you get an error as | ||
* fs.promises is undefined in compiled TypeScript land. | ||
* | ||
* See https://github.com/puppeteer/puppeteer/issues/6548 for more details. | ||
* | ||
* Once Node 10 is no longer supported (April 2021) we can remove this and use | ||
* `(await import('fs')).promises`. | ||
*/ | ||
async function importFSModule() { | ||
if (!isNode) { | ||
throw new Error('Cannot load the fs module API outside of Node.'); | ||
} | ||
const fs = await import('fs'); | ||
if (fs.promises) { | ||
return fs; | ||
} | ||
return fs.default; | ||
} | ||
export const helper = { | ||
@@ -260,2 +282,3 @@ evaluationString, | ||
isNumber, | ||
importFSModule, | ||
addEventListener, | ||
@@ -262,0 +285,0 @@ removeEventListeners, |
@@ -423,4 +423,3 @@ /** | ||
const path = await import('path'); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const fs = await import('fs'); | ||
const fs = await helper.importFSModule(); | ||
// Locate all files and confirm that they exist. | ||
@@ -427,0 +426,0 @@ const files = await Promise.all(filePaths.map(async (filePath) => { |
@@ -1123,3 +1123,3 @@ /** | ||
} | ||
const fs = await import('fs'); | ||
const fs = await helper.importFSModule(); | ||
if (options.path) | ||
@@ -1126,0 +1126,0 @@ await fs.promises.writeFile(options.path, buffer); |
{ | ||
"name": "puppeteer-core", | ||
"version": "5.4.0", | ||
"version": "5.4.1", | ||
"description": "A high-level API to control headless Chrome over the DevTools Protocol", | ||
@@ -5,0 +5,0 @@ "main": "./cjs-entry-core.js", |
@@ -9,3 +9,3 @@ # Puppeteer | ||
###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) | ||
###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) | ||
@@ -41,3 +41,3 @@ > Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium. | ||
Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#environment-variables). | ||
Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#environment-variables). | ||
@@ -68,3 +68,3 @@ | ||
Puppeteer will be familiar to people using other browser testing frameworks. You create an instance | ||
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#). | ||
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#). | ||
@@ -94,3 +94,3 @@ **Example** - navigating to https://example.com and saving a screenshot as *example.png*: | ||
Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagesetviewportviewport). | ||
Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagesetviewportviewport). | ||
@@ -120,3 +120,3 @@ **Example** - create a PDF. | ||
See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagepdfoptions) for more information about creating pdfs. | ||
See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagepdfoptions) for more information about creating pdfs. | ||
@@ -156,3 +156,3 @@ **Example** - evaluate script in the context of the page | ||
See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. | ||
See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. | ||
@@ -166,3 +166,3 @@ <!-- [END getstarted] --> | ||
Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) when launching a browser: | ||
Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) when launching a browser: | ||
@@ -183,3 +183,3 @@ ```js | ||
You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) for more information. | ||
You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) for more information. | ||
@@ -196,3 +196,3 @@ See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. | ||
- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) | ||
- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md) | ||
- [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/) | ||
@@ -340,3 +340,3 @@ - [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer) | ||
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. | ||
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. | ||
@@ -437,3 +437,3 @@ We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari. | ||
* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) | ||
* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) | ||
* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming). | ||
@@ -440,0 +440,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1963729
36935
87
19