chore: update prettier globs and format files (#7856)
* chore: update prettier globs and format files * fix: remove reference to Markdownlint
This commit is contained in:
parent
4ce72abcbd
commit
b2bf70fc3b
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
|
10
.github/workflows/scorecards-analysis.yml
vendored
10
.github/workflows/scorecards-analysis.yml
vendored
@ -5,7 +5,7 @@ on:
|
||||
schedule:
|
||||
- cron: '23 8 * * 6'
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [main]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
@ -21,12 +21,12 @@ jobs:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
- name: 'Run analysis'
|
||||
uses: ossf/scorecard-action@c8416b0b2bf627c349ca92fc8e3de51a64b005cf # v1.0.2
|
||||
with:
|
||||
results_file: results.sarif
|
||||
@ -37,7 +37,7 @@ jobs:
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional).
|
||||
- name: "Upload artifact"
|
||||
- name: 'Upload artifact'
|
||||
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
|
||||
with:
|
||||
name: SARIF file
|
||||
@ -45,7 +45,7 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub’s code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
- name: 'Upload to code-scanning'
|
||||
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
@ -6,5 +6,11 @@ vendor/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
package.json
|
||||
docs-api-json/
|
||||
docs-dist/
|
||||
website/
|
||||
experimental/
|
||||
CHANGELOG.md
|
||||
test/assets/
|
||||
/.local-chromium/
|
||||
/.local-firefox/
|
||||
|
@ -1,4 +1,5 @@
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- gen:toc -->
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
* [Contributor License Agreement](#contributor-license-agreement)
|
||||
@ -24,7 +25,9 @@
|
||||
- [Bisecting upstream changes](#bisecting-upstream-changes)
|
||||
* [Releasing to npm](#releasing-to-npm)
|
||||
<!-- gen:stop -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
# How to Contribute
|
||||
|
||||
First of all, thank you for your interest in Puppeteer!
|
||||
@ -128,7 +131,6 @@ We also maintain `test/tsconfig.test.json`. This is **only used to compile the u
|
||||
|
||||
The root `tsconfig.json` exists for the API Extractor; it has to find a `tsconfig.json` in the project's root directory. It is _not_ used for anything else.
|
||||
|
||||
|
||||
## API guidelines
|
||||
|
||||
When authoring new API methods, consider the following:
|
||||
@ -170,7 +172,7 @@ npm run doc
|
||||
To format the documentation markdown and its code snippets, use:
|
||||
|
||||
```bash
|
||||
npm run markdownlint-fix
|
||||
npm run prettier-fix
|
||||
```
|
||||
|
||||
## Writing TSDoc Comments
|
||||
@ -180,27 +182,26 @@ Each change to Puppeteer should be thoroughly documented using TSDoc comments. R
|
||||
- Every new method needs to have either `@public` or `@internal` added as a tag depending on if it is part of the public API.
|
||||
- Keep each line in a comment to no more than 90 characters (ESLint will warn you if you go over this). If you're a VSCode user the [Rewrap plugin](https://marketplace.visualstudio.com/items?itemName=stkb.rewrap) is highly recommended!
|
||||
|
||||
|
||||
## Running New Documentation website locally
|
||||
|
||||
- In the Puppeteer's folder, install all dependencies with `npm i`.
|
||||
- run `npm run generate-docs` which will generate all the `.md` files on `puppeteer/website/docs`.
|
||||
- run `npm run generate-docs` which will generate all the `.md` files on `puppeteer/website/docs`.
|
||||
- run `npm i` on `puppeteer/website`.
|
||||
- run `npm start` on `puppeteer/website`.
|
||||
|
||||
|
||||
## Adding New Dependencies
|
||||
|
||||
For all dependencies (both installation and development):
|
||||
|
||||
- **Do not add** a dependency if the desired functionality is easily implementable.
|
||||
- If adding a dependency, it should be well-maintained and trustworthy.
|
||||
|
||||
A barrier for introducing new installation dependencies is especially high:
|
||||
|
||||
- **Do not add** installation dependency unless it's critical to project success.
|
||||
|
||||
There are additional considerations for dependencies that are environment agonistic. See the [`vendor/README.md`](https://github.com/puppeteer/puppeteer/blob/main/vendor/README.md) for details.
|
||||
|
||||
|
||||
## Running & Writing Tests
|
||||
|
||||
- Every feature should be accompanied by a test.
|
||||
@ -228,7 +229,7 @@ npm run unit
|
||||
});
|
||||
```
|
||||
|
||||
- To disable a specific test, substitute the `it` with `xit` (mnemonic rule: '*cross it*'):
|
||||
- To disable a specific test, substitute the `it` with `xit` (mnemonic rule: '_cross it_'):
|
||||
|
||||
```js
|
||||
...
|
||||
@ -307,14 +308,14 @@ By default, it will use the Chromium revision in `src/revisions.ts` from the `ma
|
||||
Releasing to npm consists of the following phases:
|
||||
|
||||
1. Source Code: mark a release.
|
||||
1. Run `npm run release`. (This automatically bumps the version number in `package.json`, populates the changelog, updates the docs, and creates a Git commit for the next step.)
|
||||
1. Send a PR for the commit created in the previous step.
|
||||
1. Make sure the PR passes **all checks**.
|
||||
- **WHY**: there are linters in place that help to avoid unnecessary errors, e.g. [like this](https://github.com/puppeteer/puppeteer/pull/2446)
|
||||
1. Merge the PR.
|
||||
1. Once merged, publish the release notes from `CHANGELOG.md` using [GitHub’s “draft new release tag” option](https://github.com/puppeteer/puppeteer/releases/new).
|
||||
- **NOTE**: tag names are prefixed with `'v'`, e.g. for version `1.4.0` the tag is `v1.4.0`.
|
||||
1. As soon as the Git tag is created by completing the previous step, our CI automatically `npm publish`es the new releases for both the `puppeteer` and `puppeteer-core` packages.
|
||||
1. Run `npm run release`. (This automatically bumps the version number in `package.json`, populates the changelog, updates the docs, and creates a Git commit for the next step.)
|
||||
1. Send a PR for the commit created in the previous step.
|
||||
1. Make sure the PR passes **all checks**.
|
||||
- **WHY**: there are linters in place that help to avoid unnecessary errors, e.g. [like this](https://github.com/puppeteer/puppeteer/pull/2446)
|
||||
1. Merge the PR.
|
||||
1. Once merged, publish the release notes from `CHANGELOG.md` using [GitHub’s “draft new release tag” option](https://github.com/puppeteer/puppeteer/releases/new).
|
||||
- **NOTE**: tag names are prefixed with `'v'`, e.g. for version `1.4.0` the tag is `v1.4.0`.
|
||||
1. As soon as the Git tag is created by completing the previous step, our CI automatically `npm publish`es the new releases for both the `puppeteer` and `puppeteer-core` packages.
|
||||
1. Source Code: mark post-release.
|
||||
1. Bump `package.json` version to the `-post` version, run `npm run doc` to update the “released APIs” section at the top of `docs/api.md` accordingly, and send a PR titled `'chore: bump version to vXXX.YYY.ZZZ-post'` ([example](https://github.com/puppeteer/puppeteer/pull/6808))
|
||||
- **NOTE**: no other commits should be landed in-between release commit and bump commit.
|
||||
1. Bump `package.json` version to the `-post` version, run `npm run doc` to update the “released APIs” section at the top of `docs/api.md` accordingly, and send a PR titled `'chore: bump version to vXXX.YYY.ZZZ-post'` ([example](https://github.com/puppeteer/puppeteer/pull/6808))
|
||||
- **NOTE**: no other commits should be landed in-between release commit and bump commit.
|
||||
|
95
docs/api.md
95
docs/api.md
@ -902,6 +902,7 @@ Closes Chromium and all of its pages (if any were opened). The [Browser] object
|
||||
During the process of closing the browser, Puppeteer attempts to delete the temp folder created exclusively for this browser instance. If this fails (either because a file in the temp folder is locked by another process or because of insufficient permissions) an error is logged. This implies that: a) the folder and/or its content is not fully deleted; and b) the connection with the browser is not properly disposed (see [browser.disconnect()](#browserdisconnect)).
|
||||
|
||||
#### browser.createIncognitoBrowserContext([options])
|
||||
|
||||
- `options` <[Object]> Set of configurable options to set on the browserContext. Can have the following fields:
|
||||
- `proxyServer` <[string]> Optional proxy server with optional port to use for all requests. Username and password can be set in [page.authenticate(credentials)](#pageauthenticatecredentials).
|
||||
- `proxyBypassList` <[string]> Optional: Bypass the proxy for the given semi-colon-separated list of hosts.
|
||||
@ -2427,7 +2428,7 @@ page.on('request', (interceptedRequest) => {
|
||||
if (interceptedRequest.isInterceptResolutionHandled()) return;
|
||||
|
||||
// It is not strictly necessary to return a promise, but doing so will allow Puppeteer to await this handler.
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
// Continue after 500ms
|
||||
setTimeout(() => {
|
||||
// Inside, check synchronously to verify that the intercept wasn't handled already.
|
||||
@ -2439,13 +2440,13 @@ page.on('request', (interceptedRequest) => {
|
||||
interceptedRequest.continue();
|
||||
resolve();
|
||||
}, 500);
|
||||
})
|
||||
});
|
||||
});
|
||||
page.on('request', async (interceptedRequest) => {
|
||||
// The interception has not been handled yet. Control will pass through this guard.
|
||||
if (interceptedRequest.isInterceptResolutionHandled()) return;
|
||||
|
||||
await someLongAsyncOperation()
|
||||
await someLongAsyncOperation();
|
||||
// The interception *MIGHT* have been handled by the first handler, we can't be sure.
|
||||
// Therefore, we must check again before calling continue() or we risk Puppeteer raising an exception.
|
||||
if (interceptedRequest.isInterceptResolutionHandled()) return;
|
||||
@ -2467,7 +2468,7 @@ page.on('request', (interceptedRequest) => {
|
||||
if (action === InterceptResolutionAction.AlreadyHandled) return;
|
||||
|
||||
// It is not strictly necessary to return a promise, but doing so will allow Puppeteer to await this handler.
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
// Continue after 500ms
|
||||
setTimeout(() => {
|
||||
// Inside, check synchronously to verify that the intercept wasn't handled already.
|
||||
@ -2476,20 +2477,28 @@ page.on('request', (interceptedRequest) => {
|
||||
if (action === InterceptResolutionAction.AlreadyHandled) {
|
||||
resolve();
|
||||
return;
|
||||
};
|
||||
}
|
||||
interceptedRequest.continue();
|
||||
resolve();
|
||||
}, 500);
|
||||
})
|
||||
});
|
||||
});
|
||||
page.on('request', async (interceptedRequest) => {
|
||||
// The interception has not been handled yet. Control will pass through this guard.
|
||||
if (interceptedRequest.interceptResolutionState().action === InterceptResolutionAction.AlreadyHandled) return;
|
||||
if (
|
||||
interceptedRequest.interceptResolutionState().action ===
|
||||
InterceptResolutionAction.AlreadyHandled
|
||||
)
|
||||
return;
|
||||
|
||||
await someLongAsyncOperation()
|
||||
await someLongAsyncOperation();
|
||||
// The interception *MIGHT* have been handled by the first handler, we can't be sure.
|
||||
// Therefore, we must check again before calling continue() or we risk Puppeteer raising an exception.
|
||||
if (interceptedRequest.interceptResolutionState().action === InterceptResolutionAction.AlreadyHandled) return;
|
||||
if (
|
||||
interceptedRequest.interceptResolutionState().action ===
|
||||
InterceptResolutionAction.AlreadyHandled
|
||||
)
|
||||
return;
|
||||
interceptedRequest.continue();
|
||||
});
|
||||
```
|
||||
@ -2517,13 +2526,13 @@ In this example, Legacy Mode prevails and the request is aborted immediately bec
|
||||
// Final outcome: immediate abort()
|
||||
page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Legacy Mode: interception is aborted immediately.
|
||||
request.abort('failed');
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
// Control will never reach this point because the request was already aborted in Legacy Mode
|
||||
|
||||
// Cooperative Intercept Mode: votes for continue at priority 0.
|
||||
@ -2537,13 +2546,13 @@ In this example, Legacy Mode prevails and the request is continued because at le
|
||||
// Final outcome: immediate continue()
|
||||
page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to abort at priority 0.
|
||||
request.abort('failed', 0);
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Control reaches this point because the request was cooperatively aborted which postpones resolution.
|
||||
|
||||
@ -2557,7 +2566,6 @@ page.on('request', (request) => {
|
||||
// { action: InterceptResolutionAction.AlreadyHandled }, because continue in Legacy Mode was called
|
||||
console.log(request.interceptResolutionState());
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
In this example, Cooperative Intercept Mode is active because all handlers specify a `priority`. `continue()` wins because it has a higher priority than `abort()`.
|
||||
@ -2566,13 +2574,13 @@ In this example, Cooperative Intercept Mode is active because all handlers speci
|
||||
// Final outcome: cooperative continue() @ 5
|
||||
page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to abort at priority 10
|
||||
request.abort('failed', 0);
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to continue at priority 5
|
||||
request.continue(request.continueRequestOverrides(), 5);
|
||||
@ -2589,25 +2597,25 @@ In this example, Cooperative Intercept Mode is active because all handlers speci
|
||||
// Final outcome: cooperative respond() @ 15
|
||||
page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to abort at priority 10
|
||||
request.abort('failed', 10);
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to continue at priority 15
|
||||
request.continue(request.continueRequestOverrides(), 15);
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to respond at priority 15
|
||||
request.respond(request.responseForRequest(), 15);
|
||||
});
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Cooperative Intercept Mode: votes to respond at priority 12
|
||||
request.respond(request.responseForRequest(), 12);
|
||||
@ -2640,7 +2648,7 @@ If you are package maintainer and your package uses intercept handlers, you can
|
||||
|
||||
```ts
|
||||
page.on('request', (interceptedRequest) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
if (
|
||||
interceptedRequest.url().endsWith('.png') ||
|
||||
interceptedRequest.url().endsWith('.jpg')
|
||||
@ -2654,7 +2662,7 @@ To use Cooperative Intercept Mode, upgrade `continue()` and `abort()`:
|
||||
|
||||
```ts
|
||||
page.on('request', (interceptedRequest) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
if (
|
||||
interceptedRequest.url().endsWith('.png') ||
|
||||
interceptedRequest.url().endsWith('.jpg')
|
||||
@ -2690,7 +2698,7 @@ export const setInterceptResolutionConfig = (priority = 0) =>
|
||||
* the default priority when your handler has no opinion on the request and the intent is to continue() by default.
|
||||
*/
|
||||
page.on('request', (interceptedRequest) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
if (
|
||||
interceptedRequest.url().endsWith('.png') ||
|
||||
interceptedRequest.url().endsWith('.jpg')
|
||||
@ -2699,7 +2707,7 @@ page.on('request', (interceptedRequest) => {
|
||||
else
|
||||
interceptedRequest.continue(
|
||||
interceptedRequest.continueRequestOverrides(),
|
||||
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY // Unopinionated continuation
|
||||
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY // Unopinionated continuation
|
||||
);
|
||||
});
|
||||
```
|
||||
@ -2716,35 +2724,34 @@ interface InterceptResolutionConfig {
|
||||
// differences. You could, for example, create a config that
|
||||
// allowed separate priorities for PNG vs JPG.
|
||||
const DEFAULT_CONFIG: InterceptResolutionConfig = {
|
||||
abortPriority: undefined, // Default to Legacy Mode
|
||||
continuePriority: undefined, // Default to Legacy Mode
|
||||
abortPriority: undefined, // Default to Legacy Mode
|
||||
continuePriority: undefined, // Default to Legacy Mode
|
||||
};
|
||||
|
||||
// Defaults to undefined which preserves Legacy Mode behavior
|
||||
let _config: Partial<InterceptResolutionConfig> = {};
|
||||
|
||||
export const setInterceptResolutionConfig = (config: InterceptResolutionConfig) =>
|
||||
(_config = { ...DEFAULT_CONFIG, ...config });
|
||||
export const setInterceptResolutionConfig = (
|
||||
config: InterceptResolutionConfig
|
||||
) => (_config = { ...DEFAULT_CONFIG, ...config });
|
||||
|
||||
page.on('request', (interceptedRequest) => {
|
||||
if (request.isInterceptResolutionHandled()) return
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
if (
|
||||
interceptedRequest.url().endsWith('.png') ||
|
||||
interceptedRequest.url().endsWith('.jpg')
|
||||
) {
|
||||
interceptedRequest.abort('failed', _config.abortPriority);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here we use a custom-configured priority to allow for Opinionated
|
||||
// continuation.
|
||||
// We would only want to allow this if we had a very clear reason why
|
||||
// some use cases required Opinionated continuation.
|
||||
interceptedRequest.continue(
|
||||
interceptedRequest.continueRequestOverrides(),
|
||||
_config.continuePriority // Why would we ever want priority!==0 here?
|
||||
);
|
||||
}
|
||||
interceptedRequest.abort('failed', _config.abortPriority);
|
||||
} else {
|
||||
// Here we use a custom-configured priority to allow for Opinionated
|
||||
// continuation.
|
||||
// We would only want to allow this if we had a very clear reason why
|
||||
// some use cases required Opinionated continuation.
|
||||
interceptedRequest.continue(
|
||||
interceptedRequest.continueRequestOverrides(),
|
||||
_config.continuePriority // Why would we ever want priority!==0 here?
|
||||
);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
@ -3046,6 +3053,7 @@ const [response] = await Promise.all([
|
||||
Shortcut for [page.mainFrame().waitForNavigation(options)](#framewaitfornavigationoptions).
|
||||
|
||||
#### page.waitForNetworkIdle([options])
|
||||
|
||||
- `options` <[Object]> Optional waiting parameters
|
||||
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
|
||||
- `idleTime` <[number]> How long to wait for no network requests in milliseconds, defaults to 500 milliseconds.
|
||||
@ -4784,6 +4792,7 @@ This method scrolls element into view if needed, and then uses [page.mouse](#pag
|
||||
If the element is detached from DOM, the method throws an error.
|
||||
|
||||
#### elementHandle.isIntersectingViewport([options])
|
||||
|
||||
- `options` <[Object]>
|
||||
- `threshold` <[number]> threshold for the intersection between 0 (no intersection) and 1 (full intersection). Defaults to 1.
|
||||
- returns: <[Promise]<[boolean]>> Resolves to true if the element is visible in the current viewport.
|
||||
@ -4952,7 +4961,7 @@ await page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
if (request.isInterceptResolutionHandled()) return;
|
||||
|
||||
// Override headers
|
||||
// Override headers
|
||||
const headers = Object.assign({}, request.headers(), {
|
||||
foo: 'bar', // set "foo" header
|
||||
origin: undefined, // remove "origin" header
|
||||
|
@ -20,10 +20,10 @@ For issues, feature requests, or setup troubles with Puppeteer, file an issue ri
|
||||
|
||||
**Tell us about your environment:**
|
||||
|
||||
* Puppeteer version:
|
||||
* Platform / OS version:
|
||||
* URLs (if applicable):
|
||||
* Node.js version:
|
||||
- Puppeteer version:
|
||||
- Platform / OS version:
|
||||
- URLs (if applicable):
|
||||
- Node.js version:
|
||||
|
||||
**What steps will reproduce the problem?**
|
||||
|
||||
@ -35,6 +35,4 @@ _Please include code that reproduces the issue._
|
||||
|
||||
**What is the expected result?**
|
||||
|
||||
|
||||
**What happens instead?**
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
"eslint": "([ \"$CI\" = true ] && eslint --ext js --ext ts --quiet -f codeframe . || eslint --ext js --ext ts .)",
|
||||
"eslint-fix": "eslint --ext js --ext ts --fix .",
|
||||
"commitlint": "commitlint --from=HEAD~1",
|
||||
"markdownlint": "prettier --check **/README.md docs/troubleshooting.md",
|
||||
"markdownlint-fix": "prettier --write **/README.md docs/troubleshooting.md",
|
||||
"lint": "npm run eslint && npm run build && npm run doc && npm run markdownlint",
|
||||
"prettier": "prettier --check .",
|
||||
"prettier-fix": "prettier --write .",
|
||||
"lint": "npm run eslint && npm run build && npm run doc && npm run prettier",
|
||||
"doc": "node utils/doclint/cli.js",
|
||||
"clean-lib": "rimraf lib",
|
||||
"build": "npm run tsc && npm run generate-d-ts",
|
||||
|
@ -5,7 +5,5 @@
|
||||
"outDir": "../lib/cjs/puppeteer",
|
||||
"module": "CommonJS"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../vendor/tsconfig.cjs.json"}
|
||||
]
|
||||
"references": [{ "path": "../vendor/tsconfig.cjs.json" }]
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ async function run() {
|
||||
const browser2 = await puppeteer.launch();
|
||||
// 'foo' is invalid argument
|
||||
const page = await browser2.newPage('foo');
|
||||
const div = (await page.$('div')) as puppeteer.ElementHandle<
|
||||
HTMLAnchorElement
|
||||
>;
|
||||
const div = (await page.$(
|
||||
'div'
|
||||
)) as puppeteer.ElementHandle<HTMLAnchorElement>;
|
||||
console.log('got a div!', div);
|
||||
}
|
||||
run();
|
||||
|
@ -8,9 +8,9 @@ async function run() {
|
||||
page.on('request', (request) => {
|
||||
const resourceType = request.resourceType();
|
||||
});
|
||||
const div = (await page.$('div')) as puppeteer.ElementHandle<
|
||||
HTMLAnchorElement
|
||||
>;
|
||||
const div = (await page.$(
|
||||
'div'
|
||||
)) as puppeteer.ElementHandle<HTMLAnchorElement>;
|
||||
console.log('got a div!', div);
|
||||
}
|
||||
run();
|
||||
|
@ -10,9 +10,9 @@ async function run() {
|
||||
const browser2 = await puppeteer.launch();
|
||||
// 'foo' is invalid argument
|
||||
const page = await browser2.newPage('foo');
|
||||
const div = (await page.$('div')) as puppeteer.ElementHandle<
|
||||
HTMLAnchorElement
|
||||
>;
|
||||
const div = (await page.$(
|
||||
'div'
|
||||
)) as puppeteer.ElementHandle<HTMLAnchorElement>;
|
||||
console.log('got a div!', div);
|
||||
}
|
||||
run();
|
||||
|
@ -1,13 +1,13 @@
|
||||
body {
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
ins {
|
||||
background-color: #9cffa0;
|
||||
text-decoration: none;
|
||||
background-color: #9cffa0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
del {
|
||||
background-color: #ff9e9e;
|
||||
background-color: #ff9e9e;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user