Skip to content

Commit

Permalink
chore(deps): update deps
Browse files Browse the repository at this point in the history
Signed-off-by: Randolf Jung <jrandolf@chromium.org>

Co-authored-by: Randolf Jung <jrandolf@chromium.org>
  • Loading branch information
jrandolf-zz and jrandolf committed Feb 9, 2022
1 parent 523b487 commit 8ff9d59
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 65 deletions.
2 changes: 1 addition & 1 deletion cjs-entry-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
* This means that we can publish to CJS and ESM whilst maintaining the expected
* import behaviour for CJS and ESM users.
*/
const puppeteerExport = require('./lib/cjs/puppeteer/node-puppeteer-core');
const puppeteerExport = require('./lib/cjs/puppeteer/node-puppeteer-core.js');
module.exports = puppeteerExport.default;
2 changes: 1 addition & 1 deletion cjs-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
* This means that we can publish to CJS and ESM whilst maintaining the expected
* import behaviour for CJS and ESM users.
*/
const puppeteerExport = require('./lib/cjs/puppeteer/node');
const puppeteerExport = require('./lib/cjs/puppeteer/node.js');
module.exports = puppeteerExport.default;
16 changes: 16 additions & 0 deletions compat/cjs/compat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2022 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { dirname } from 'path';

export const puppeteerDirname = dirname(dirname(dirname(__dirname)));
16 changes: 16 additions & 0 deletions compat/esm/compat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2022 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { dirname } from 'path';
import { fileURLToPath } from 'url';

Expand Down
4 changes: 2 additions & 2 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
* necessary.
*/

const compileTypeScriptIfRequired = require('./typescript-if-required');
const compileTypeScriptIfRequired = require('./typescript-if-required.js');

async function download() {
await compileTypeScriptIfRequired();
// need to ensure TS is compiled before loading the installer
const {
downloadBrowser,
logPolitely,
} = require('./lib/cjs/puppeteer/node/install');
} = require('./lib/cjs/puppeteer/node/install.js');

if (process.env.PUPPETEER_SKIP_DOWNLOAD) {
logPolitely(
Expand Down
2 changes: 1 addition & 1 deletion mocha-config/coverage-tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const base = require('./base');
const base = require('./base.js');

module.exports = {
...base,
Expand Down
2 changes: 1 addition & 1 deletion mocha-config/doclint-tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const base = require('./base');
const base = require('./base.js');

module.exports = {
...base,
Expand Down
2 changes: 1 addition & 1 deletion mocha-config/puppeteer-unit-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

const base = require('./base');
const base = require('./base.js');

module.exports = {
...base,
Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,61 +67,61 @@
"author": "The Chromium Authors",
"license": "Apache-2.0",
"dependencies": {
"cross-fetch": "3.1.5",
"debug": "4.3.3",
"devtools-protocol": "0.0.960912",
"extract-zip": "2.0.1",
"https-proxy-agent": "5.0.0",
"node-fetch": "2.6.7",
"pkg-dir": "4.2.0",
"progress": "2.0.3",
"proxy-from-env": "1.1.0",
"rimraf": "3.0.2",
"tar-fs": "2.1.1",
"unbzip2-stream": "1.4.3",
"ws": "8.2.3"
"ws": "8.5.0"
},
"devDependencies": {
"@commitlint/cli": "13.2.0",
"@commitlint/cli": "16.1.0",
"@commitlint/config-conventional": "16.0.0",
"@microsoft/api-documenter": "7.13.65",
"@microsoft/api-extractor": "7.18.15",
"@microsoft/api-documenter": "7.15.1",
"@microsoft/api-extractor": "7.19.4",
"@types/debug": "4.1.7",
"@types/mime": "2.0.3",
"@types/mocha": "9.0.0",
"@types/node": "17.0.15",
"@types/mocha": "9.1.0",
"@types/node": "17.0.16",
"@types/progress": "2.0.5",
"@types/proxy-from-env": "1.0.1",
"@types/rimraf": "3.0.2",
"@types/sinon": "10.0.4",
"@types/sinon": "10.0.11",
"@types/tar-fs": "2.0.1",
"@types/ws": "8.2.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.33.0",
"@web/test-runner": "0.13.18",
"commonmark": "0.29.3",
"@types/ws": "8.2.2",
"@typescript-eslint/eslint-plugin": "5.11.0",
"@typescript-eslint/parser": "5.11.0",
"@web/test-runner": "0.13.27",
"commonmark": "0.30.0",
"cross-env": "7.0.3",
"eslint": "7.32.0",
"eslint": "8.8.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-mocha": "9.0.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-mocha": "10.0.3",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-unicorn": "37.0.1",
"eslint-plugin-unicorn": "40.1.0",
"esprima": "4.0.1",
"expect": "25.2.7",
"husky": "7.0.2",
"husky": "7.0.4",
"jpeg-js": "0.4.3",
"mime": "2.5.2",
"mime": "3.0.0",
"minimist": "1.2.5",
"mocha": "9.1.3",
"mocha": "9.2.0",
"ncp": "2.0.0",
"pixelmatch": "5.2.1",
"pngjs": "6.0.0",
"prettier": "2.3.0",
"sinon": "9.2.4",
"source-map-support": "0.5.19",
"prettier": "2.5.1",
"sinon": "13.0.1",
"source-map-support": "0.5.21",
"standard-version": "9.3.2",
"text-diff": "1.0.1",
"ts-node": "10.4.0",
"ts-node": "10.5.0",
"typescript": "4.4.4"
}
}
2 changes: 1 addition & 1 deletion src/common/BrowserConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { Browser, TargetFilterCallback } from './Browser.js';
import { assert } from './assert.js';
import { debugError } from '../common/helper.js';
import { Connection } from './Connection.js';
import { getFetch } from './fetch.js';
import { Viewport } from './PuppeteerViewport.js';
import { isNode } from '../environment.js';
import { getFetch } from './fetch.js';

/**
* Generic browser options that can be passed when launching any browser or when
Expand Down
7 changes: 1 addition & 6 deletions src/common/Coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,7 @@ export class JSCoverage {
assert(this._enabled, 'JSCoverage is not enabled');
this._enabled = false;

const result = await Promise.all<
Protocol.Profiler.TakePreciseCoverageResponse,
void,
void,
void
>([
const result = await Promise.all([
this._client.send('Profiler.takePreciseCoverage'),
this._client.send('Profiler.stopPreciseCoverage'),
this._client.send('Profiler.disable'),
Expand Down
2 changes: 1 addition & 1 deletion src/common/ExecutionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class ExecutionContext {
*
* @returns A promise that resolves to the return value of the given function.
*/
async evaluate<ReturnType extends any>(
async evaluate<ReturnType>(
pageFunction: Function | string,
...args: unknown[]
): Promise<ReturnType> {
Expand Down
2 changes: 1 addition & 1 deletion src/common/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ export class Page extends EventEmitter {
* more than 2 network connections for at least `500` ms.
*/
async reload(options?: WaitForOptions): Promise<HTTPResponse | null> {
const result = await Promise.all<HTTPResponse, void>([
const result = await Promise.all([
this.waitForNavigation(options),
this._client.send('Page.reload'),
]);
Expand Down
2 changes: 1 addition & 1 deletion src/common/WebWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class WebWorker extends EventEmitter {
* @param args - Arguments to pass to `pageFunction`.
* @returns Promise which resolves to the return value of `pageFunction`.
*/
async evaluate<ReturnType extends any>(
async evaluate<ReturnType>(
pageFunction: Function | string,
...args: any[]
): Promise<ReturnType> {
Expand Down
2 changes: 1 addition & 1 deletion src/common/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ import { isNode } from '../environment.js';

/* Use the global version if we're in the browser, else load the node-fetch module. */
export const getFetch = async (): Promise<typeof fetch> => {
return isNode ? await import('node-fetch') : globalThis.fetch;
return isNode ? (await import('cross-fetch')).fetch : globalThis.fetch;
};
4 changes: 2 additions & 2 deletions src/common/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function isNumber(obj: unknown): obj is number {
return typeof obj === 'number' || obj instanceof Number;
}

async function waitForEvent<T extends any>(
async function waitForEvent<T>(
emitter: CommonEventEmitter,
eventName: string | symbol,
predicate: (event: T) => Promise<boolean> | boolean,
Expand Down Expand Up @@ -295,7 +295,7 @@ function makePredicateString(
})() `;
}

async function waitWithTimeout<T extends any>(
async function waitWithTimeout<T>(
promise: Promise<T>,
taskName: string,
timeout: number
Expand Down
16 changes: 16 additions & 0 deletions src/compat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2022 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

declare const puppeteerDirname: string;

export { puppeteerDirname };
4 changes: 2 additions & 2 deletions src/initialize-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import { PuppeteerNode } from './node/Puppeteer.js';
import { PUPPETEER_REVISIONS } from './revisions.js';
import pkgDir from 'pkg-dir';
import { sync } from 'pkg-dir';
import { Product } from './common/Product.js';
import { puppeteerDirname } from './compat.js';

export const initializePuppeteerNode = (packageName: string): PuppeteerNode => {
const puppeteerRootDirectory = pkgDir.sync(puppeteerDirname);
const puppeteerRootDirectory = sync(puppeteerDirname);

let preferredRevision = PUPPETEER_REVISIONS.chromium;
const isPuppeteerCore = packageName === 'puppeteer-core';
Expand Down
2 changes: 1 addition & 1 deletion test/assert-coverage-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { describe, it } = require('mocha');
const { getCoverageResults } = require('./coverage-utils');
const { getCoverageResults } = require('./coverage-utils.js');
const expect = require('expect');

describe('API coverage test', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/run_static_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/
const path = require('path');
const { TestServer } = require('../utils/testserver/');
const { TestServer } = require('../utils/testserver/index.js');

const port = 8907;
const httpsPort = 8908;
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const fs = require('fs');
const path = require('path');
const expect = require('expect');
const GoldenUtils = require('./golden-utils');
const GoldenUtils = require('./golden-utils.js');
const PROJECT_ROOT = fs.existsSync(path.join(__dirname, '..', 'package.json'))
? path.join(__dirname, '..')
: path.join(__dirname, '..', '..');
Expand Down
2 changes: 1 addition & 1 deletion utils/check_availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function checkRollCandidate(channel) {
10
);
const currentRevision = parseInt(
require('../lib/cjs/puppeteer/revisions').PUPPETEER_REVISIONS.chromium,
require('../lib/cjs/puppeteer/revisions.js').PUPPETEER_REVISIONS.chromium,
10
);

Expand Down
2 changes: 1 addition & 1 deletion utils/doclint/check_public_api/JSBuilder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const ts = require('typescript');
const path = require('path');
const Documentation = require('./Documentation');
const Documentation = require('./Documentation.js');
module.exports = checkSources;

/**
Expand Down
8 changes: 4 additions & 4 deletions utils/doclint/check_public_api/MDBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

const Documentation = require('./Documentation');
const commonmark = require('commonmark');
const Documentation = require('./Documentation.js');
const { Parser, HtmlRenderer } = require('commonmark');

class MDOutline {
/**
Expand All @@ -25,9 +25,9 @@ class MDOutline {
*/
static async create(page, text) {
// Render markdown as HTML.
const reader = new commonmark.Parser();
const reader = new Parser();
const parsed = reader.parse(text);
const writer = new commonmark.HtmlRenderer();
const writer = new HtmlRenderer();
const html = writer.render(parsed);

page.on('console', (msg) => {
Expand Down
10 changes: 5 additions & 5 deletions utils/doclint/check_public_api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

const jsBuilder = require('./JSBuilder');
const mdBuilder = require('./MDBuilder');
const Documentation = require('./Documentation');
const Message = require('../Message');
const jsBuilder = require('./JSBuilder.js');
const mdBuilder = require('./MDBuilder.js');
const Documentation = require('./Documentation.js');
const Message = require('../Message.js');
const {
MODULES_TO_CHECK_FOR_COVERAGE,
} = require('../../../test/coverage-utils');
} = require('../../../test/coverage-utils.js');

const EXCLUDE_PROPERTIES = new Set([
'Browser.create',
Expand Down

0 comments on commit 8ff9d59

Please sign in to comment.