mirror of
https://github.com/hanzoai/puppeteer.git
synced 2026-09-24 17:02:14 +00:00
feat!: move packages to ESM only (#14355)
This commit is contained in:
@@ -130,7 +130,7 @@ information on using pull requests.
|
|||||||
Our coding style is fully defined in
|
Our coding style is fully defined in
|
||||||
[`eslint.config`](https://github.com/puppeteer/puppeteer/blob/main/eslint.config.mjs)
|
[`eslint.config`](https://github.com/puppeteer/puppeteer/blob/main/eslint.config.mjs)
|
||||||
([ESLint](https://eslint.org/)) and
|
([ESLint](https://eslint.org/)) and
|
||||||
[`.prettierrc.cjs`](https://github.com/puppeteer/puppeteer/blob/main/.prettierrc.cjs)
|
[`prettier.config.js`](https://github.com/puppeteer/puppeteer/blob/main/prettier.config.js)
|
||||||
([Prettier](https://prettier.io)).
|
([Prettier](https://prettier.io)).
|
||||||
|
|
||||||
Code is checked for PRs automatically and you can check your code
|
Code is checked for PRs automatically and you can check your code
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ See https://github.com/puppeteer/puppeteer/tree/main/examples/puppeteer-in-exten
|
|||||||
|
|
||||||
To run Puppeteer in an extension, first you need to produce a browser-compatible build using a bundler such as rollup or webpack:
|
To run Puppeteer in an extension, first you need to produce a browser-compatible build using a bundler such as rollup or webpack:
|
||||||
|
|
||||||
1. When importing Puppeteer use the browser-specific entrypoint from puppeteer-core `puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js'`:
|
1. When importing Puppeteer use the browser-specific entrypoint from puppeteer-core `puppeteer-core/lib/puppeteer/puppeteer-core-browser.js'`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import {
|
import {
|
||||||
connect,
|
connect,
|
||||||
ExtensionTransport,
|
ExtensionTransport,
|
||||||
} from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js';
|
} from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';
|
||||||
|
|
||||||
// Create a tab or find a tab to attach to.
|
// Create a tab or find a tab to attach to.
|
||||||
const tab = await chrome.tabs.create({
|
const tab = await chrome.tabs.create({
|
||||||
@@ -59,8 +59,8 @@ export default {
|
|||||||
dir: 'out',
|
dir: 'out',
|
||||||
},
|
},
|
||||||
// If you do not need to use WebDriver BiDi protocol,
|
// If you do not need to use WebDriver BiDi protocol,
|
||||||
// exclude chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js to minimize the bundle size.
|
// exclude chromium-bidi/lib/bidiMapper/BidiMapper.js to minimize the bundle size.
|
||||||
external: ['chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js'],
|
external: ['chromium-bidi/lib/bidiMapper/BidiMapper.js'],
|
||||||
plugins: [
|
plugins: [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
// Indicate that we target a browser environment.
|
// Indicate that we target a browser environment.
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ See https://github.com/puppeteer/puppeteer/tree/main/examples/puppeteer-in-brows
|
|||||||
|
|
||||||
To run Puppeteer in the browser, first you need to produce a browser-compatible build using a bundler such as rollup or webpack:
|
To run Puppeteer in the browser, first you need to produce a browser-compatible build using a bundler such as rollup or webpack:
|
||||||
|
|
||||||
1. When importing Puppeteer use the browser-specific entrypoint from puppeteer-core `puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js'`:
|
1. When importing Puppeteer use the browser-specific entrypoint from puppeteer-core `puppeteer-core/lib/puppeteer/puppeteer-core-browser.js'`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import puppeteer from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js';
|
import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';
|
||||||
|
|
||||||
const browser = await puppeteer.connect({
|
const browser = await puppeteer.connect({
|
||||||
browserWSEndpoint: wsUrl,
|
browserWSEndpoint: wsUrl,
|
||||||
@@ -55,8 +55,8 @@ export default {
|
|||||||
dir: 'out',
|
dir: 'out',
|
||||||
},
|
},
|
||||||
// If you do not need to use WebDriver BiDi protocol,
|
// If you do not need to use WebDriver BiDi protocol,
|
||||||
// exclude chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js to minimize the bundle size.
|
// exclude chromium-bidi/lib/bidiMapper/BidiMapper.js to minimize the bundle size.
|
||||||
external: ['chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js'],
|
external: ['chromium-bidi/lib/bidiMapper/BidiMapper.js'],
|
||||||
plugins: [
|
plugins: [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
// Indicate that we target a browser environment.
|
// Indicate that we target a browser environment.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// TODO: can rollup find the browser entrypoint?
|
// TODO: can rollup find the browser entrypoint?
|
||||||
|
|
||||||
import puppeteer from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js';
|
import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';
|
||||||
|
|
||||||
async function onConnectClick() {
|
async function onConnectClick() {
|
||||||
const wsUrl = document.querySelector('#ws').value;
|
const wsUrl = document.querySelector('#ws').value;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export default {
|
|||||||
dir: 'out',
|
dir: 'out',
|
||||||
},
|
},
|
||||||
// If you do not need to use WebDriver BiDi protocol,
|
// If you do not need to use WebDriver BiDi protocol,
|
||||||
// exclude chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js to minimize the bundle size.
|
// exclude chromium-bidi/lib/bidiMapper/BidiMapper.js to minimize the bundle size.
|
||||||
external: ['chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js'],
|
external: ['chromium-bidi/lib/bidiMapper/BidiMapper.js'],
|
||||||
plugins: [
|
plugins: [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
browser: true,
|
browser: true,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import {
|
import {
|
||||||
connect,
|
connect,
|
||||||
ExtensionTransport,
|
ExtensionTransport,
|
||||||
} from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js';
|
} from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';
|
||||||
|
|
||||||
globalThis.testConnect = async url => {
|
globalThis.testConnect = async url => {
|
||||||
const tab = await chrome.tabs.create({
|
const tab = await chrome.tabs.create({
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export default {
|
|||||||
dir: 'out',
|
dir: 'out',
|
||||||
},
|
},
|
||||||
// If you do not need to use WebDriver BiDi protocol,
|
// If you do not need to use WebDriver BiDi protocol,
|
||||||
// exclude chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js to minimize the bundle size.
|
// exclude chromium-bidi/lib/bidiMapper/BidiMapper.js to minimize the bundle size.
|
||||||
external: ['chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js'],
|
external: ['chromium-bidi/lib/bidiMapper/BidiMapper.js'],
|
||||||
plugins: [
|
plugins: [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
browser: true,
|
browser: true,
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"doctest": {
|
"doctest": {
|
||||||
"command": "npx ./tools/doctest 'packages/puppeteer-core/lib/esm/**/*.js'",
|
"command": "npx ./tools/doctest 'packages/puppeteer-core/lib/**/*.js'",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"./packages/puppeteer-core:build",
|
"./packages/puppeteer-core:build",
|
||||||
"./tools/doctest:build"
|
"./tools/doctest:build"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/main.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/main.d.ts",
|
||||||
|
|
||||||
"extends": "./api-extractor.json",
|
"extends": "./api-extractor.json",
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/main.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/main.d.ts",
|
||||||
"bundledPackages": [],
|
"bundledPackages": [],
|
||||||
|
|
||||||
"apiReport": {
|
"apiReport": {
|
||||||
|
|||||||
@@ -9,53 +9,27 @@
|
|||||||
"clean": "../../tools/clean.mjs",
|
"clean": "../../tools/clean.mjs",
|
||||||
"test": "wireit"
|
"test": "wireit"
|
||||||
},
|
},
|
||||||
"type": "commonjs",
|
"type": "module",
|
||||||
"bin": "lib/cjs/main-cli.js",
|
"bin": "lib/main-cli.js",
|
||||||
"main": "./lib/cjs/main.js",
|
"main": "./lib/main.js",
|
||||||
"module": "./lib/esm/main.js",
|
"module": "./lib/main.js",
|
||||||
"exports": {
|
|
||||||
"import": "./lib/esm/main.js",
|
|
||||||
"require": "./lib/cjs/main.js"
|
|
||||||
},
|
|
||||||
"wireit": {
|
"wireit": {
|
||||||
"build": {
|
"build": {
|
||||||
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/cjs/main-cli.js lib/esm/main-cli.js",
|
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/main-cli.js",
|
||||||
"files": [
|
"files": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"clean": "if-file-deleted",
|
"clean": "if-file-deleted",
|
||||||
"output": [
|
"output": [
|
||||||
"lib/**",
|
"lib/**"
|
||||||
"!lib/esm/package.json"
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"generate:package-json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"generate:package-json": {
|
|
||||||
"command": "node --experimental-strip-types ../../tools/generate_module_package_json.ts lib/esm/package.json",
|
|
||||||
"files": [
|
|
||||||
"../../tools/generate_module_package_json.ts"
|
|
||||||
],
|
|
||||||
"output": [
|
|
||||||
"lib/esm/package.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"generate:package-json:test": {
|
|
||||||
"command": "node --experimental-strip-types ../../tools/generate_module_package_json.ts test/build/package.json",
|
|
||||||
"files": [
|
|
||||||
"../../tools/generate_module_package_json.ts"
|
|
||||||
],
|
|
||||||
"output": [
|
|
||||||
"test/build/package.json"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"build:docs": {
|
"build:docs": {
|
||||||
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
||||||
"files": [
|
"files": [
|
||||||
"api-extractor.docs.json",
|
"api-extractor.docs.json",
|
||||||
"lib/esm/main.d.ts",
|
"lib/main.d.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
@@ -74,7 +48,6 @@
|
|||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"build",
|
"build",
|
||||||
"generate:package-json:test",
|
|
||||||
"../testserver:build"
|
"../testserver:build"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "NodeNext",
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"outDir": "../lib/cjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../lib/esm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {CLI} from '../../lib/esm/CLI.js';
|
import {CLI} from '../../lib/CLI.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {Browser, Cache} from '../../lib/esm/main.js';
|
import {Browser, Cache} from '../../lib/main.js';
|
||||||
|
|
||||||
describe('Cache', () => {
|
describe('Cache', () => {
|
||||||
let tmpDir = '/tmp/puppeteer-browsers-test';
|
let tmpDir = '/tmp/puppeteer-browsers-test';
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {BrowserPlatform} from '../../../lib/esm/browser-data/browser-data.js';
|
import {BrowserPlatform} from '../../../lib/browser-data/browser-data.js';
|
||||||
import {
|
import {
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
resolveBuildId,
|
resolveBuildId,
|
||||||
} from '../../../lib/esm/browser-data/chrome-headless-shell.js';
|
} from '../../../lib/browser-data/chrome-headless-shell.js';
|
||||||
|
|
||||||
describe('chrome-headless-shell', () => {
|
describe('chrome-headless-shell', () => {
|
||||||
it('should resolve download URLs', () => {
|
it('should resolve download URLs', () => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {CLI} from '../../../lib/esm/CLI.js';
|
import {CLI} from '../../../lib/CLI.js';
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
setupTestServer,
|
setupTestServer,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
Cache,
|
Cache,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {getServerUrl, setupTestServer} from '../utils.js';
|
import {getServerUrl, setupTestServer} from '../utils.js';
|
||||||
import {testChromeDriverBuildId} from '../versions.js';
|
import {testChromeDriverBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import path from 'node:path';
|
|||||||
import {
|
import {
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
ChromeReleaseChannel,
|
ChromeReleaseChannel,
|
||||||
} from '../../../lib/esm/browser-data/browser-data.js';
|
} from '../../../lib/browser-data/browser-data.js';
|
||||||
import {
|
import {
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
resolveBuildId,
|
resolveBuildId,
|
||||||
compareVersions,
|
compareVersions,
|
||||||
resolveDefaultUserDataDir,
|
resolveDefaultUserDataDir,
|
||||||
} from '../../../lib/esm/browser-data/chrome.js';
|
} from '../../../lib/browser-data/chrome.js';
|
||||||
|
|
||||||
describe('Chrome', () => {
|
describe('Chrome', () => {
|
||||||
it('should resolve download URLs', () => {
|
it('should resolve download URLs', () => {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as chrome from '../../../lib/esm/browser-data/chrome.js';
|
import * as chrome from '../../../lib/browser-data/chrome.js';
|
||||||
import {CLI} from '../../../lib/esm/CLI.js';
|
import {CLI} from '../../../lib/CLI.js';
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
setupTestServer,
|
setupTestServer,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
Cache,
|
Cache,
|
||||||
computeExecutablePath,
|
computeExecutablePath,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {getServerUrl, setupTestServer} from '../utils.js';
|
import {getServerUrl, setupTestServer} from '../utils.js';
|
||||||
import {testChromeBuildId} from '../versions.js';
|
import {testChromeBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
install,
|
install,
|
||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {getServerUrl, setupTestServer, clearCache} from '../utils.js';
|
import {getServerUrl, setupTestServer, clearCache} from '../utils.js';
|
||||||
import {testChromeBuildId} from '../versions.js';
|
import {testChromeBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {BrowserPlatform} from '../../../lib/esm/browser-data/browser-data.js';
|
import {BrowserPlatform} from '../../../lib/browser-data/browser-data.js';
|
||||||
import {
|
import {
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
resolveBuildId,
|
resolveBuildId,
|
||||||
} from '../../../lib/esm/browser-data/chromedriver.js';
|
} from '../../../lib/browser-data/chromedriver.js';
|
||||||
|
|
||||||
describe('ChromeDriver', () => {
|
describe('ChromeDriver', () => {
|
||||||
it('should resolve download URLs', () => {
|
it('should resolve download URLs', () => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {CLI} from '../../../lib/esm/CLI.js';
|
import {CLI} from '../../../lib/CLI.js';
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
setupTestServer,
|
setupTestServer,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
Cache,
|
Cache,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {getServerUrl, setupTestServer} from '../utils.js';
|
import {getServerUrl, setupTestServer} from '../utils.js';
|
||||||
import {testChromeDriverBuildId} from '../versions.js';
|
import {testChromeDriverBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {BrowserPlatform} from '../../../lib/esm/browser-data/browser-data.js';
|
import {BrowserPlatform} from '../../../lib/browser-data/browser-data.js';
|
||||||
import {
|
import {
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
compareVersions,
|
compareVersions,
|
||||||
} from '../../../lib/esm/browser-data/chromium.js';
|
} from '../../../lib/browser-data/chromium.js';
|
||||||
|
|
||||||
describe('Chromium', () => {
|
describe('Chromium', () => {
|
||||||
it('should resolve download URLs', () => {
|
it('should resolve download URLs', () => {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
install,
|
install,
|
||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {getServerUrl, setupTestServer, clearCache} from '../utils.js';
|
import {getServerUrl, setupTestServer, clearCache} from '../utils.js';
|
||||||
import {testChromiumBuildId} from '../versions.js';
|
import {testChromiumBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import path from 'node:path';
|
|||||||
import {
|
import {
|
||||||
internalConstantsForTesting,
|
internalConstantsForTesting,
|
||||||
unpackArchive,
|
unpackArchive,
|
||||||
} from '../../lib/esm/fileUtil.js';
|
} from '../../lib/fileUtil.js';
|
||||||
|
|
||||||
describe('fileUtil', function () {
|
describe('fileUtil', function () {
|
||||||
let tmpDir = '/tmp/puppeteer-browsers-test';
|
let tmpDir = '/tmp/puppeteer-browsers-test';
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import path from 'node:path';
|
|||||||
|
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
||||||
import * as firefox from '../../../lib/esm/browser-data/firefox.js';
|
import * as firefox from '../../../lib/browser-data/firefox.js';
|
||||||
import {CLI} from '../../../lib/esm/CLI.js';
|
import {CLI} from '../../../lib/CLI.js';
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
getServerUrl,
|
getServerUrl,
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {BrowserPlatform} from '../../../lib/esm/browser-data/browser-data.js';
|
import {BrowserPlatform} from '../../../lib/browser-data/browser-data.js';
|
||||||
import {
|
import {
|
||||||
compareVersions,
|
compareVersions,
|
||||||
createProfile,
|
createProfile,
|
||||||
relativeExecutablePath,
|
relativeExecutablePath,
|
||||||
resolveDownloadUrl,
|
resolveDownloadUrl,
|
||||||
} from '../../../lib/esm/browser-data/firefox.js';
|
} from '../../../lib/browser-data/firefox.js';
|
||||||
|
|
||||||
describe('Firefox', () => {
|
describe('Firefox', () => {
|
||||||
it('should resolve download URLs for Nightly', () => {
|
it('should resolve download URLs for Nightly', () => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {install, Browser, BrowserPlatform} from '../../../lib/esm/main.js';
|
import {install, Browser, BrowserPlatform} from '../../../lib/main.js';
|
||||||
import {setupTestServer, getServerUrl, clearCache} from '../utils.js';
|
import {setupTestServer, getServerUrl, clearCache} from '../utils.js';
|
||||||
import {testFirefoxBuildId} from '../versions.js';
|
import {testFirefoxBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
createProfile,
|
createProfile,
|
||||||
} from '../../../lib/esm/main.js';
|
} from '../../../lib/main.js';
|
||||||
import {setupTestServer, getServerUrl, clearCache} from '../utils.js';
|
import {setupTestServer, getServerUrl, clearCache} from '../utils.js';
|
||||||
import {testFirefoxBuildId} from '../versions.js';
|
import {testFirefoxBuildId} from '../versions.js';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
install,
|
install,
|
||||||
type BrowserProvider,
|
type BrowserProvider,
|
||||||
type DownloadOptions,
|
type DownloadOptions,
|
||||||
} from '../../lib/esm/main.js';
|
} from '../../lib/main.js';
|
||||||
|
|
||||||
import {getServerUrl, setupTestServer} from './utils.js';
|
import {getServerUrl, setupTestServer} from './utils.js';
|
||||||
import {testChromeBuildId} from './versions.js';
|
import {testChromeBuildId} from './versions.js';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import {CLI} from '../../lib/esm/CLI.js';
|
import {CLI} from '../../lib/CLI.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createMockedReadlineInterface,
|
createMockedReadlineInterface,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
Browser,
|
Browser,
|
||||||
BrowserPlatform,
|
BrowserPlatform,
|
||||||
Cache,
|
Cache,
|
||||||
} from '../../lib/esm/main.js';
|
} from '../../lib/main.js';
|
||||||
|
|
||||||
import {getServerUrl, setupTestServer} from './utils.js';
|
import {getServerUrl, setupTestServer} from './utils.js';
|
||||||
import {testChromeBuildId} from './versions.js';
|
import {testChromeBuildId} from './versions.js';
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import {Writable, Readable} from 'node:stream';
|
|||||||
|
|
||||||
import {TestServer} from '@pptr/testserver';
|
import {TestServer} from '@pptr/testserver';
|
||||||
|
|
||||||
import {isErrorLike} from '../../lib/esm/launch.js';
|
import {isErrorLike} from '../../lib/launch.js';
|
||||||
import {Cache} from '../../lib/esm/main.js';
|
import {Cache} from '../../lib/main.js';
|
||||||
|
|
||||||
export function createMockedReadlineInterface(
|
export function createMockedReadlineInterface(
|
||||||
input: string,
|
input: string,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {normalize, join, dirname} from 'node:path';
|
|||||||
|
|
||||||
import {BrowserPlatform, install} from '@puppeteer/browsers';
|
import {BrowserPlatform, install} from '@puppeteer/browsers';
|
||||||
|
|
||||||
import {downloadPaths} from '../lib/esm/browser-data/browser-data.js';
|
import {downloadPaths} from '../lib/browser-data/browser-data.js';
|
||||||
import * as versions from '../test/build/versions.js';
|
import * as versions from '../test/build/versions.js';
|
||||||
|
|
||||||
function getBrowser(str) {
|
function getBrowser(str) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"files": [],
|
"compilerOptions": {
|
||||||
"references": [
|
"outDir": "lib",
|
||||||
{"path": "./src/tsconfig.esm.json"},
|
"rootDir": "src"
|
||||||
{"path": "./src/tsconfig.cjs.json"}
|
},
|
||||||
]
|
"include": ["src/**/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export function getCommandForRunner(runner: TestRunner): [string, ...string[]] {
|
|||||||
case TestRunner.Jest:
|
case TestRunner.Jest:
|
||||||
return [`jest`, '-c', 'e2e/jest.config.js'];
|
return [`jest`, '-c', 'e2e/jest.config.js'];
|
||||||
case TestRunner.Mocha:
|
case TestRunner.Mocha:
|
||||||
return [`mocha`, '--config=./e2e/.mocharc.js'];
|
return [`mocha`, '--config=./e2e/.mocharc.cjs'];
|
||||||
case TestRunner.Node:
|
case TestRunner.Node:
|
||||||
return [
|
return [
|
||||||
'node',
|
'node',
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
const {devDependencies} = getPackageJson(tree);
|
const {devDependencies} = getPackageJson(tree);
|
||||||
const {options} = getAngularJsonScripts(tree);
|
const {options} = getAngularJsonScripts(tree);
|
||||||
|
|
||||||
expect(tree.files).toContain('/e2e/.mocharc.js');
|
expect(tree.files).toContain('/e2e/.mocharc.cjs');
|
||||||
expect(devDependencies).toContain('mocha');
|
expect(devDependencies).toContain('mocha');
|
||||||
expect(devDependencies).toContain('@types/mocha');
|
expect(devDependencies).toContain('@types/mocha');
|
||||||
expect(options['testRunner']).toBe('mocha');
|
expect(options['testRunner']).toBe('mocha');
|
||||||
@@ -194,7 +194,7 @@ void describe('@puppeteer/ng-schematics: ng-add', () => {
|
|||||||
const {devDependencies} = getPackageJson(tree);
|
const {devDependencies} = getPackageJson(tree);
|
||||||
const {options} = getAngularJsonScripts(tree);
|
const {options} = getAngularJsonScripts(tree);
|
||||||
|
|
||||||
expect(tree.files).toContain(getMultiApplicationFile('e2e/.mocharc.js'));
|
expect(tree.files).toContain(getMultiApplicationFile('e2e/.mocharc.cjs'));
|
||||||
expect(devDependencies).toContain('mocha');
|
expect(devDependencies).toContain('mocha');
|
||||||
expect(devDependencies).toContain('@types/mocha');
|
expect(devDependencies).toContain('@types/mocha');
|
||||||
expect(options['testRunner']).toBe('mocha');
|
expect(options['testRunner']).toBe('mocha');
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class AngularProject {
|
|||||||
...packageJson['scripts'],
|
...packageJson['scripts'],
|
||||||
...AngularProject.#scripts(this.#runner),
|
...AngularProject.#scripts(this.#runner),
|
||||||
};
|
};
|
||||||
|
packageJson['devDependencies']['puppeteer'] = '../../../puppeteer';
|
||||||
await writeFile(packageJsonFile, JSON.stringify(packageJson, null, 2));
|
await writeFile(packageJsonFile, JSON.stringify(packageJson, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,21 +61,9 @@ export const generateInjectedTask = task({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const generatePackageJsonTask = task({
|
|
||||||
name: 'generate:package-json',
|
|
||||||
run: async () => {
|
|
||||||
await mkdir('lib/esm', {recursive: true});
|
|
||||||
await writeFile('lib/esm/package.json', JSON.stringify({type: 'module'}));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateTask = task({
|
export const generateTask = task({
|
||||||
name: 'generate',
|
name: 'generate',
|
||||||
dependencies: [
|
dependencies: [generateInjectedTask, updateVersionTask],
|
||||||
generateInjectedTask,
|
|
||||||
generatePackageJsonTask,
|
|
||||||
updateVersionTask,
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const buildTscTask = task({
|
export const buildTscTask = task({
|
||||||
@@ -90,7 +78,6 @@ export const buildTask = task({
|
|||||||
name: 'build',
|
name: 'build',
|
||||||
dependencies: [buildTscTask],
|
dependencies: [buildTscTask],
|
||||||
run: async () => {
|
run: async () => {
|
||||||
const formats = ['esm', 'cjs'];
|
|
||||||
const packages = (await readdir('third_party', {withFileTypes: true}))
|
const packages = (await readdir('third_party', {withFileTypes: true}))
|
||||||
.filter(dirent => {
|
.filter(dirent => {
|
||||||
return dirent.isDirectory();
|
return dirent.isDirectory();
|
||||||
@@ -99,75 +86,73 @@ export const buildTask = task({
|
|||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
const builders = [];
|
const builders = [];
|
||||||
for (const format of formats) {
|
const folder = posixPath.join('lib', 'third_party');
|
||||||
const folder = posixPath.join('lib', format, 'third_party');
|
for (const name of packages) {
|
||||||
for (const name of packages) {
|
const entrypoint = posixPath.join(folder, name, `${name}.js`);
|
||||||
const entrypoint = posixPath.join(folder, name, `${name}.js`);
|
builders.push(
|
||||||
builders.push(
|
await esbuild.build({
|
||||||
await esbuild.build({
|
entryPoints: [entrypoint],
|
||||||
entryPoints: [entrypoint],
|
outfile: entrypoint,
|
||||||
outfile: entrypoint,
|
bundle: true,
|
||||||
bundle: true,
|
allowOverwrite: true,
|
||||||
allowOverwrite: true,
|
format: 'esm',
|
||||||
format,
|
target: 'node20',
|
||||||
target: 'node18',
|
// Do not minify for readability and leave minification to
|
||||||
// Do not minify for readability and leave minification to
|
// consumers.
|
||||||
// consumers.
|
minify: false,
|
||||||
minify: false,
|
legalComments: 'inline',
|
||||||
legalComments: 'inline',
|
}),
|
||||||
}),
|
);
|
||||||
);
|
let license = '';
|
||||||
let license = '';
|
switch (name) {
|
||||||
switch (name) {
|
case 'rxjs':
|
||||||
case 'rxjs':
|
license = await readFile(
|
||||||
license = await readFile(
|
path.join(
|
||||||
path.join(
|
path.dirname(require.resolve('rxjs')),
|
||||||
path.dirname(require.resolve('rxjs')),
|
'..',
|
||||||
'..',
|
'..',
|
||||||
'..',
|
'LICENSE.txt',
|
||||||
'LICENSE.txt',
|
),
|
||||||
),
|
'utf-8',
|
||||||
'utf-8',
|
);
|
||||||
);
|
break;
|
||||||
break;
|
case 'mitt':
|
||||||
case 'mitt':
|
license = await readFile(
|
||||||
license = await readFile(
|
path.join(path.dirname(require.resolve('mitt')), '..', 'LICENSE'),
|
||||||
path.join(path.dirname(require.resolve('mitt')), '..', 'LICENSE'),
|
'utf-8',
|
||||||
'utf-8',
|
);
|
||||||
);
|
break;
|
||||||
break;
|
case 'parsel-js':
|
||||||
case 'parsel-js':
|
license = await readFile(
|
||||||
license = await readFile(
|
path.join(
|
||||||
path.join(
|
path.dirname(require.resolve('parsel-js')),
|
||||||
path.dirname(require.resolve('parsel-js')),
|
'..',
|
||||||
'..',
|
'LICENSE',
|
||||||
'LICENSE',
|
),
|
||||||
),
|
'utf-8',
|
||||||
'utf-8',
|
);
|
||||||
);
|
break;
|
||||||
break;
|
case 'urlpattern-polyfill':
|
||||||
case 'urlpattern-polyfill':
|
license = await readFile(
|
||||||
license = await readFile(
|
path.join(
|
||||||
path.join(
|
path.dirname(require.resolve('urlpattern-polyfill')),
|
||||||
path.dirname(require.resolve('urlpattern-polyfill')),
|
'LICENSE',
|
||||||
'LICENSE',
|
),
|
||||||
),
|
'utf-8',
|
||||||
'utf-8',
|
);
|
||||||
);
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
throw new Error(`Add license handling for ${path}`);
|
||||||
throw new Error(`Add license handling for ${path}`);
|
}
|
||||||
}
|
const content = await readFile(entrypoint, 'utf-8');
|
||||||
const content = await readFile(entrypoint, 'utf-8');
|
await writeFile(
|
||||||
await writeFile(
|
entrypoint,
|
||||||
entrypoint,
|
`/**
|
||||||
`/**
|
|
||||||
${license}
|
${license}
|
||||||
*/
|
*/
|
||||||
${content}`,
|
${content}`,
|
||||||
'utf-8',
|
'utf-8',
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await Promise.all(builders);
|
await Promise.all(builders);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer-core.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/puppeteer/puppeteer-core.d.ts",
|
||||||
|
|
||||||
"extends": "./api-extractor.json",
|
"extends": "./api-extractor.json",
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer-core.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/puppeteer/puppeteer-core.d.ts",
|
||||||
"bundledPackages": [],
|
"bundledPackages": [],
|
||||||
|
|
||||||
"apiReport": {
|
"apiReport": {
|
||||||
|
|||||||
@@ -8,20 +8,20 @@
|
|||||||
"headless",
|
"headless",
|
||||||
"automation"
|
"automation"
|
||||||
],
|
],
|
||||||
"type": "commonjs",
|
"type": "module",
|
||||||
"main": "./lib/cjs/puppeteer/puppeteer-core.js",
|
"main": "./lib/puppeteer/puppeteer-core.js",
|
||||||
"browser": "./lib/esm/puppeteer/puppeteer-core-browser.js",
|
"browser": "./lib/puppeteer/puppeteer-core-browser.js",
|
||||||
"module": "./lib/esm/puppeteer/puppeteer-core.js",
|
"module": "./lib/puppeteer/puppeteer-core.js",
|
||||||
"types": "./lib/types.d.ts",
|
"types": "./lib/types.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./lib/types.d.ts",
|
"types": "./lib/types.d.ts",
|
||||||
"import": "./lib/esm/puppeteer/puppeteer-core.js",
|
"import": "./lib/puppeteer/puppeteer-core.js",
|
||||||
"require": "./lib/cjs/puppeteer/puppeteer-core.js"
|
"require": "./lib/puppeteer/puppeteer-core.js"
|
||||||
},
|
},
|
||||||
"./internal/*": {
|
"./internal/*": {
|
||||||
"import": "./lib/esm/puppeteer/*",
|
"import": "./lib/puppeteer/*",
|
||||||
"require": "./lib/cjs/puppeteer/*"
|
"require": "./lib/puppeteer/*"
|
||||||
},
|
},
|
||||||
"./*": {
|
"./*": {
|
||||||
"import": "./*",
|
"import": "./*",
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
||||||
"files": [
|
"files": [
|
||||||
"api-extractor.docs.json",
|
"api-extractor.docs.json",
|
||||||
"lib/esm/puppeteer/puppeteer-core.d.ts",
|
"lib/puppeteer/puppeteer-core.d.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
"Herebyfile.mjs"
|
"Herebyfile.mjs"
|
||||||
],
|
],
|
||||||
"output": [
|
"output": [
|
||||||
"lib/{cjs,esm}/**"
|
"lib/**"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"build:es5": {
|
"build:es5": {
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
"command": "api-extractor run --local && eslint --fix lib/types.d.ts --no-ignore",
|
"command": "api-extractor run --local && eslint --fix lib/types.d.ts --no-ignore",
|
||||||
"files": [
|
"files": [
|
||||||
"api-extractor.json",
|
"api-extractor.json",
|
||||||
"lib/esm/puppeteer/types.d.ts",
|
"lib/puppeteer/types.d.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"output": [
|
"output": [
|
||||||
@@ -122,13 +122,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"unit": {
|
"unit": {
|
||||||
"command": "node --test --test-reporter=spec \"lib/cjs/**/*.test.js\"",
|
"command": "node --test --test-reporter=spec \"lib/**/*.test.js\"",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"build"
|
"build"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"unit:only": {
|
"unit:only": {
|
||||||
"command": "node --test --test-only --test-reporter=spec \"lib/cjs/**/*.test.js\"",
|
"command": "node --test --test-only --test-reporter=spec \"lib/**/*.test.js\"",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"build"
|
"build"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: 'lib/esm/puppeteer/puppeteer-core-browser.js',
|
input: 'lib/puppeteer/puppeteer-core-browser.js',
|
||||||
output: {
|
output: {
|
||||||
format: 'iife',
|
format: 'iife',
|
||||||
file: 'lib/es5-iife/puppeteer-core-browser.js',
|
file: 'lib/es5-iife/puppeteer-core-browser.js',
|
||||||
@@ -30,10 +30,10 @@ export default {
|
|||||||
if (id.includes('@puppeteer/browsers')) {
|
if (id.includes('@puppeteer/browsers')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (id.startsWith(path.join(cwd, `lib`, `esm`, `puppeteer`, `bidi`))) {
|
if (id.startsWith(path.join(cwd, `lib`, `puppeteer`, `bidi`))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (id.startsWith(path.join(cwd, `lib`, `esm`, `puppeteer`, `node`))) {
|
if (id.startsWith(path.join(cwd, `lib`, `puppeteer`, `node`))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ export interface WebMCPAnnotation {
|
|||||||
*/
|
*/
|
||||||
export type WebMCPInvocationStatus = 'Completed' | 'Canceled' | 'Error';
|
export type WebMCPInvocationStatus = 'Completed' | 'Canceled' | 'Error';
|
||||||
|
|
||||||
interface ProtocolWebMCPTool {
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ProtocolWebMCPTool {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
inputSchema?: object;
|
inputSchema?: object;
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "CommonJS",
|
|
||||||
"moduleResolution": "Node",
|
|
||||||
"outDir": "../lib/cjs/puppeteer"
|
|
||||||
},
|
|
||||||
"references": [{"path": "../third_party/tsconfig.cjs.json"}]
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../lib/esm/puppeteer"
|
|
||||||
},
|
|
||||||
"references": [{"path": "../third_party/tsconfig.json"}]
|
|
||||||
}
|
|
||||||
@@ -37,7 +37,7 @@ describe('Function', function () {
|
|||||||
describe('stringifyFunction', () => {
|
describe('stringifyFunction', () => {
|
||||||
it('should work', async () => {
|
it('should work', async () => {
|
||||||
// @ts-expect-error no types
|
// @ts-expect-error no types
|
||||||
const {variations} = await import('../../../../function-fixture.mjs');
|
const {variations} = await import('../../../function-fixture.mjs');
|
||||||
for (const v of variations) {
|
for (const v of variations) {
|
||||||
const fnStr = stringifyFunction(v);
|
const fnStr = stringifyFunction(v);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "NodeNext",
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"outDir": "../lib/cjs/third_party",
|
|
||||||
"declarationMap": false,
|
|
||||||
"sourceMap": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"extends": "../../../tsconfig.base.json",
|
"extends": "../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declarationMap": false,
|
"declarationMap": false,
|
||||||
"outDir": "../lib/esm/third_party",
|
"outDir": "../lib/third_party",
|
||||||
"sourceMap": false
|
"sourceMap": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
import {execSync} from 'child_process';
|
import {execSync} from 'child_process';
|
||||||
|
|
||||||
import packageJson from '../package.json' with {type: 'json'};
|
import packageJson from '../package.json' with {type: 'json'};
|
||||||
import {PUPPETEER_REVISIONS} from '../lib/esm/puppeteer/revisions.js';
|
import {PUPPETEER_REVISIONS} from '../lib/puppeteer/revisions.js';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const currentProtocolPackageInstalledVersion =
|
const currentProtocolPackageInstalledVersion =
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"files": [],
|
"compilerOptions": {
|
||||||
"references": [
|
"outDir": "./lib/puppeteer",
|
||||||
{"path": "./src/tsconfig.esm.json"},
|
"rootDir": "./src"
|
||||||
{"path": "./src/tsconfig.cjs.json"}
|
},
|
||||||
]
|
"include": ["src/**/*"],
|
||||||
|
"references": [{"path": "./third_party/tsconfig.json"}]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer.docs.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/puppeteer/puppeteer.docs.d.ts",
|
||||||
"bundledPackages": ["puppeteer-core"],
|
"bundledPackages": ["puppeteer-core"],
|
||||||
|
|
||||||
"extends": "./api-extractor.json",
|
"extends": "./api-extractor.json",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer.d.ts",
|
"mainEntryPointFilePath": "<projectFolder>/lib/puppeteer/puppeteer.d.ts",
|
||||||
"bundledPackages": [],
|
"bundledPackages": [],
|
||||||
|
|
||||||
"apiReport": {
|
"apiReport": {
|
||||||
|
|||||||
@@ -8,20 +8,20 @@
|
|||||||
"headless",
|
"headless",
|
||||||
"automation"
|
"automation"
|
||||||
],
|
],
|
||||||
"type": "commonjs",
|
"type": "module",
|
||||||
"bin": "./lib/cjs/puppeteer/node/cli.js",
|
"bin": "./lib/puppeteer/node/cli.js",
|
||||||
"main": "./lib/cjs/puppeteer/puppeteer.js",
|
"main": "./lib/puppeteer/puppeteer.js",
|
||||||
"module": "./lib/esm/puppeteer/puppeteer.js",
|
"module": "./lib/puppeteer/puppeteer.js",
|
||||||
"types": "./lib/types.d.ts",
|
"types": "./lib/types.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./lib/types.d.ts",
|
"types": "./lib/types.d.ts",
|
||||||
"import": "./lib/esm/puppeteer/puppeteer.js",
|
"import": "./lib/puppeteer/puppeteer.js",
|
||||||
"require": "./lib/cjs/puppeteer/puppeteer.js"
|
"require": "./lib/puppeteer/puppeteer.js"
|
||||||
},
|
},
|
||||||
"./internal/*": {
|
"./internal/*": {
|
||||||
"import": "./lib/esm/puppeteer/*",
|
"import": "./lib/puppeteer/*",
|
||||||
"require": "./lib/cjs/puppeteer/*"
|
"require": "./lib/puppeteer/*"
|
||||||
},
|
},
|
||||||
"./*": {
|
"./*": {
|
||||||
"import": "./*",
|
"import": "./*",
|
||||||
@@ -55,27 +55,14 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"build:tsc",
|
"build:tsc",
|
||||||
"build:types",
|
"build:types"
|
||||||
"generate:package-json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"generate:package-json": {
|
|
||||||
"command": "node --experimental-strip-types ../../tools/generate_module_package_json.ts lib/esm/package.json",
|
|
||||||
"files": [
|
|
||||||
"../../tools/generate_module_package_json.ts"
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"build:tsc"
|
|
||||||
],
|
|
||||||
"output": [
|
|
||||||
"lib/esm/package.json"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"build:docs": {
|
"build:docs": {
|
||||||
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
||||||
"files": [
|
"files": [
|
||||||
"api-extractor.docs.json",
|
"api-extractor.docs.json",
|
||||||
"lib/esm/puppeteer/puppeteer.docs.d.ts",
|
"lib/puppeteer/puppeteer.docs.d.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
@@ -83,7 +70,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"build:tsc": {
|
"build:tsc": {
|
||||||
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/cjs/puppeteer/node/cli.js lib/esm/puppeteer/node/cli.js",
|
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/puppeteer/node/cli.js",
|
||||||
"clean": "if-file-deleted",
|
"clean": "if-file-deleted",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"../puppeteer-core:build",
|
"../puppeteer-core:build",
|
||||||
@@ -93,15 +80,15 @@
|
|||||||
"src/**"
|
"src/**"
|
||||||
],
|
],
|
||||||
"output": [
|
"output": [
|
||||||
"lib/{cjs,esm}/**",
|
"lib/**",
|
||||||
"!lib/esm/package.json"
|
"!lib/package.json"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"build:types": {
|
"build:types": {
|
||||||
"command": "api-extractor run --local && eslint --fix lib/types.d.ts --no-ignore",
|
"command": "api-extractor run --local && eslint --fix lib/types.d.ts --no-ignore",
|
||||||
"files": [
|
"files": [
|
||||||
"api-extractor.json",
|
"api-extractor.json",
|
||||||
"lib/esm/puppeteer/types.d.ts",
|
"lib/puppeteer/types.d.ts",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"output": [
|
"output": [
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "NodeNext",
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"outDir": "../lib/cjs/puppeteer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../lib/esm/puppeteer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"files": [],
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"outDir": "./lib/puppeteer",
|
||||||
|
"rootDir": "./src",
|
||||||
|
|
||||||
// API extractor doesn't work well with NodeNext module resolution, so we
|
// API extractor doesn't work well with NodeNext module resolution, so we
|
||||||
// just stick with ol'fashion path resolution.
|
// just stick with ol'fashion path resolution.
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"puppeteer-core/internal/*": ["../puppeteer-core/lib/esm/puppeteer/*"]
|
"puppeteer-core/internal/*": ["../puppeteer-core/lib/puppeteer/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"references": [
|
"include": ["src/**/*"]
|
||||||
{"path": "./src/tsconfig.esm.json"},
|
|
||||||
{"path": "./src/tsconfig.cjs.json"}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/**
|
/**
|
||||||
* @type {import('prettier').Config}
|
* @type {import('prettier').Config}
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
export default {
|
||||||
bracketSpacing: false,
|
bracketSpacing: false,
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
trailingComma: 'all',
|
trailingComma: 'all',
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
/**
|
/**
|
||||||
* @type {import("puppeteer").Configuration}
|
* @type {import("puppeteer").Configuration}
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
export default {
|
||||||
chrome: {
|
chrome: {
|
||||||
skipDownload: false,
|
skipDownload: false,
|
||||||
},
|
},
|
||||||
@@ -6,5 +6,5 @@
|
|||||||
|
|
||||||
import 'puppeteer-core';
|
import 'puppeteer-core';
|
||||||
import 'puppeteer-core/internal/revisions.js';
|
import 'puppeteer-core/internal/revisions.js';
|
||||||
import 'puppeteer-core/lib/esm/puppeteer/revisions.js';
|
import 'puppeteer-core/lib/puppeteer/revisions.js';
|
||||||
import 'puppeteer-core/lib/esm/puppeteer/bidi/BidiOverCdp.js';
|
import 'puppeteer-core/lib/puppeteer/bidi/BidiOverCdp.js';
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
import 'puppeteer-core';
|
import 'puppeteer-core';
|
||||||
import 'puppeteer-core/internal/revisions.js';
|
import 'puppeteer-core/internal/revisions.js';
|
||||||
import 'puppeteer-core/lib/esm/puppeteer/revisions.js';
|
import 'puppeteer-core/lib/puppeteer/revisions.js';
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
|
|
||||||
require('puppeteer-core');
|
require('puppeteer-core');
|
||||||
require('puppeteer-core/internal/revisions.js');
|
require('puppeteer-core/internal/revisions.js');
|
||||||
require('puppeteer-core/lib/esm/puppeteer/revisions.js');
|
require('puppeteer-core/lib/puppeteer/revisions.js');
|
||||||
require('puppeteer-core/lib/esm/puppeteer/bidi/BidiOverCdp.js');
|
require('puppeteer-core/lib/puppeteer/bidi/BidiOverCdp.js');
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
require('puppeteer-core');
|
require('puppeteer-core');
|
||||||
require('puppeteer-core/internal/revisions.js');
|
require('puppeteer-core/internal/revisions.js');
|
||||||
require('puppeteer-core/lib/esm/puppeteer/revisions.js');
|
require('puppeteer-core/lib/puppeteer/revisions.js');
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2023 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
const puppeteer = require('puppeteer');
|
||||||
|
(async () => {
|
||||||
|
const browser = await puppeteer.launch();
|
||||||
|
const page = await browser.newPage();
|
||||||
|
await page.goto('http://example.com');
|
||||||
|
await page.$('aria/example');
|
||||||
|
await page.screenshot({path: 'example.png'});
|
||||||
|
await browser.close();
|
||||||
|
})();
|
||||||
@@ -17,7 +17,7 @@ import {execFile, readAsset} from './util.js';
|
|||||||
() => {
|
() => {
|
||||||
configureSandbox({
|
configureSandbox({
|
||||||
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
||||||
devDependencies: ['typescript@4.7.4', '@types/node@18.17.15'],
|
devDependencies: ['typescript@5.0.2', '@types/node@20.19.23'],
|
||||||
env: cwd => {
|
env: cwd => {
|
||||||
return {
|
return {
|
||||||
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
||||||
@@ -25,7 +25,27 @@ import {execFile, readAsset} from './util.js';
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work', async function () {
|
it('should work with ESM', async function () {
|
||||||
|
// Write a Webpack configuration.
|
||||||
|
await writeFile(
|
||||||
|
join(this.sandbox, 'tsconfig.json'),
|
||||||
|
await readAsset('puppeteer', 'tsconfig.json'),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Write the source code.
|
||||||
|
await writeFile(
|
||||||
|
join(this.sandbox, 'index.mts'),
|
||||||
|
await readAsset('puppeteer', 'basic.ts'),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Compile.
|
||||||
|
await execFile('npx', ['tsc'], {cwd: this.sandbox, shell: true});
|
||||||
|
|
||||||
|
const script = await readFile(join(this.sandbox, 'index.mjs'), 'utf-8');
|
||||||
|
|
||||||
|
await this.runScript(script, 'mjs');
|
||||||
|
});
|
||||||
|
it('should work with CJS', async function () {
|
||||||
// Write a Webpack configuration.
|
// Write a Webpack configuration.
|
||||||
await writeFile(
|
await writeFile(
|
||||||
join(this.sandbox, 'tsconfig.json'),
|
join(this.sandbox, 'tsconfig.json'),
|
||||||
@@ -35,7 +55,7 @@ import {execFile, readAsset} from './util.js';
|
|||||||
// Write the source code.
|
// Write the source code.
|
||||||
await writeFile(
|
await writeFile(
|
||||||
join(this.sandbox, 'index.ts'),
|
join(this.sandbox, 'index.ts'),
|
||||||
await readAsset('puppeteer', 'basic.ts'),
|
await readAsset('puppeteer', 'basic-cjs.ts'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Compile.
|
// Compile.
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ describe('acceptInsecureCerts', async () => {
|
|||||||
it('should work with mixed content', async () => {
|
it('should work with mixed content', async () => {
|
||||||
const {server, httpsServer, page} = state;
|
const {server, httpsServer, page} = state;
|
||||||
|
|
||||||
httpsServer.setRoute('/mixedcontent.html', (_req, res) => {
|
httpsServer.setRoute('/mixedcontent.html', (_req: any, res: any) => {
|
||||||
res.end(`<iframe src=${server.EMPTY_PAGE}></iframe>`);
|
res.end(`<iframe src=${server.EMPTY_PAGE}></iframe>`);
|
||||||
});
|
});
|
||||||
await page.goto(httpsServer.PREFIX + '/mixedcontent.html', {
|
await page.goto(httpsServer.PREFIX + '/mixedcontent.html', {
|
||||||
|
|||||||
@@ -415,7 +415,6 @@ export const mochaHooks: Mocha.RootHookObject = {
|
|||||||
'packages',
|
'packages',
|
||||||
'puppeteer',
|
'puppeteer',
|
||||||
'lib',
|
'lib',
|
||||||
'esm',
|
|
||||||
'puppeteer',
|
'puppeteer',
|
||||||
'puppeteer.js',
|
'puppeteer.js',
|
||||||
),
|
),
|
||||||
|
|||||||
+1
-11
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import prettier from '@prettier/sync';
|
|||||||
import {ESLintUtils} from '@typescript-eslint/utils';
|
import {ESLintUtils} from '@typescript-eslint/utils';
|
||||||
|
|
||||||
const prettierConfigFile = prettier.resolveConfigFile(
|
const prettierConfigFile = prettier.resolveConfigFile(
|
||||||
'../../../.prettierrc.cjs',
|
'../../../prettier.config.js',
|
||||||
);
|
);
|
||||||
const prettierConfig = prettier.resolveConfig(prettierConfigFile ?? '');
|
const prettierConfig = prettier.resolveConfig(prettierConfigFile ?? '');
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2022 Google Inc.
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {mkdirSync, writeFileSync} from 'node:fs';
|
|
||||||
import {dirname} from 'node:path';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Outputs the dummy package.json file to the path specified
|
|
||||||
* by the first argument.
|
|
||||||
*/
|
|
||||||
mkdirSync(dirname(process.argv[2]), {recursive: true});
|
|
||||||
writeFileSync(process.argv[2], `{"type": "module"}`);
|
|
||||||
@@ -231,6 +231,7 @@ async function main() {
|
|||||||
} else {
|
} else {
|
||||||
args.push(...specs);
|
args.push(...specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mochaCommand = [
|
const mochaCommand = [
|
||||||
...(useCoverage
|
...(useCoverage
|
||||||
? ['c8', '--check-coverage', '--lines', '90', 'npx']
|
? ['c8', '--check-coverage', '--lines', '90', 'npx']
|
||||||
@@ -239,6 +240,7 @@ async function main() {
|
|||||||
...mochaArgs.map(String),
|
...mochaArgs.map(String),
|
||||||
...args,
|
...args,
|
||||||
];
|
];
|
||||||
|
|
||||||
const handle = spawn('npx', mochaCommand, {
|
const handle = spawn('npx', mochaCommand, {
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function testIdMatchesExpectationPattern(title, pattern) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const prettierConfig = await import(
|
const prettierConfig = await import(
|
||||||
path.join(import.meta.dirname, '..', '.prettierrc.cjs')
|
path.join(import.meta.dirname, '..', 'prettier.config.js')
|
||||||
);
|
);
|
||||||
|
|
||||||
function getSpecificity(item) {
|
function getSpecificity(item) {
|
||||||
|
|||||||
+1
-11
@@ -1,15 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
"extends": ["../tsdoc.json"]
|
||||||
"tagDefinitions": [
|
|
||||||
{
|
|
||||||
"tagName": "@license",
|
|
||||||
"syntaxKind": "modifier",
|
|
||||||
"allowMultiple": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"supportForTags": {
|
|
||||||
"@license": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"tagDefinitions": [
|
"tagDefinitions": [
|
||||||
{
|
{
|
||||||
"tagName": "@license",
|
"tagName": "@license",
|
||||||
"syntaxKind": "modifier",
|
"syntaxKind": "block",
|
||||||
"allowMultiple": false
|
"allowMultiple": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user