diff --git a/.puppeteerrc b/.puppeteerrc new file mode 100644 index 00000000000000..21934c4d175e8f --- /dev/null +++ b/.puppeteerrc @@ -0,0 +1,9 @@ +{ + "chrome": { + "skipDownload": false + }, + "firefox": { + "skipDownload": false, + "version": "latest" + } +} diff --git a/package-lock.json b/package-lock.json index 94341245493776..a11f8489fc0305 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "packages": { "": { "name": "pdf.js", - "hasInstallScript": true, "license": "Apache-2.0", "devDependencies": { "@babel/core": "^7.25.2", @@ -21,7 +20,6 @@ "caniuse-lite": "^1.0.30001647", "canvas": "^2.11.2", "core-js": "^3.37.1", - "cross-env": "^7.0.3", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-fetch-options": "^0.0.5", @@ -54,7 +52,7 @@ "postcss-discard-comments": "^7.0.1", "postcss-nesting": "^13.0.0", "prettier": "^3.3.3", - "puppeteer": "^22.15.0", + "puppeteer": "^23.0.2", "stylelint": "^16.8.1", "stylelint-prettier": "^5.0.2", "terser-webpack-plugin": "^5.3.10", @@ -3991,9 +3989,9 @@ } }, "node_modules/chromium-bidi": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.3.tgz", - "integrity": "sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.4.tgz", + "integrity": "sha512-8zoq6ogmhQQkAKZVKO2ObFTl4uOkqoX1PlKQX3hZQ5E9cbUotcAb7h4pTNVAGGv8Z36PF3CtdOriEp/Rz82JqQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -4440,24 +4438,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "bin": { - "cross-env": "src/bin/cross-env.js", - "cross-env-shell": "src/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=10.14", - "npm": ">=6", - "yarn": ">=1" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -10931,34 +10911,35 @@ } }, "node_modules/puppeteer": { - "version": "22.15.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.15.0.tgz", - "integrity": "sha512-XjCY1SiSEi1T7iSYuxS82ft85kwDJUS7wj1Z0eGVXKdtr5g4xnVcbjwxhq5xBnpK/E7x1VZZoJDxpjAOasHT4Q==", + "version": "23.0.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.0.2.tgz", + "integrity": "sha512-I/l1P8s8brcLG+oW9AwF8hUaOSGGJcGKMflXRgULUH0S3ABptlLI9ZKjqWDo8ipY6v789ZKd+bNKtcCwpTh5Ww==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "2.3.0", + "chromium-bidi": "0.6.4", "cosmiconfig": "^9.0.0", "devtools-protocol": "0.0.1312386", - "puppeteer-core": "22.15.0" + "puppeteer-core": "23.0.2" }, "bin": { - "puppeteer": "lib/esm/puppeteer/node/cli.js" + "puppeteer": "lib/cjs/puppeteer/node/cli.js" }, "engines": { "node": ">=18" } }, "node_modules/puppeteer-core": { - "version": "22.15.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", - "integrity": "sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==", + "version": "23.0.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.0.2.tgz", + "integrity": "sha512-MvOHn+g1TYkAR2oVd/bf/YWXKqFTJmkhyyurYgxkrjh8rBOL1ZH5VyOsLJi0bLO7/yoipAmk1gFZEx9HUJnaoA==", "dev": true, "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "2.3.0", - "chromium-bidi": "0.6.3", + "chromium-bidi": "0.6.4", "debug": "^4.3.6", "devtools-protocol": "0.0.1312386", "ws": "^8.18.0" diff --git a/package.json b/package.json index b9735cee1c5d3e..3fa3c42d0a7d6f 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "caniuse-lite": "^1.0.30001647", "canvas": "^2.11.2", "core-js": "^3.37.1", - "cross-env": "^7.0.3", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-fetch-options": "^0.0.5", @@ -48,7 +47,7 @@ "postcss-discard-comments": "^7.0.1", "postcss-nesting": "^13.0.0", "prettier": "^3.3.3", - "puppeteer": "^22.15.0", + "puppeteer": "^23.0.2", "stylelint": "^16.8.1", "stylelint-prettier": "^5.0.2", "terser-webpack-plugin": "^5.3.10", @@ -60,9 +59,6 @@ "webpack-stream": "^7.0.0", "yargs": "^17.7.2" }, - "scripts": { - "postinstall": "cross-env PUPPETEER_PRODUCT=firefox node node_modules/puppeteer/install.mjs" - }, "repository": { "type": "git", "url": "git://github.com/mozilla/pdf.js.git" diff --git a/test/integration/freetext_editor_spec.mjs b/test/integration/freetext_editor_spec.mjs index d03df9fa69feb4..2135687955fa7b 100644 --- a/test/integration/freetext_editor_spec.mjs +++ b/test/integration/freetext_editor_spec.mjs @@ -1675,7 +1675,7 @@ describe("FreeText Editor", () => { clip: rect, type: "png", }); - const editorImage = PNG.sync.read(editorPng); + const editorImage = PNG.sync.read(Buffer.from(editorPng)); const editorFirstPix = getFirstPixel( editorImage.data, editorImage.width, @@ -1703,7 +1703,7 @@ describe("FreeText Editor", () => { clip: rect, type: "png", }); - const editorImage = PNG.sync.read(editorPng); + const editorImage = PNG.sync.read(Buffer.from(editorPng)); const editorFirstPix = getFirstPixel( editorImage.data, editorImage.width, @@ -1836,7 +1836,7 @@ describe("FreeText Editor", () => { clip: rect, type: "png", }); - const editorImage = PNG.sync.read(editorPng); + const editorImage = PNG.sync.read(Buffer.from(editorPng)); const editorFirstPix = getFirstPixel( editorImage.data, editorImage.width, @@ -1870,7 +1870,7 @@ describe("FreeText Editor", () => { clip: rect, type: "png", }); - const editorImage = PNG.sync.read(editorPng); + const editorImage = PNG.sync.read(Buffer.from(editorPng)); const editorFirstPix = getFirstPixel( editorImage.data, editorImage.width, @@ -3603,7 +3603,7 @@ describe("FreeText Editor", () => { "[data-annotation-id='998R']", el => (el.hidden = false) ); - let editorImage = PNG.sync.read(editorPng); + let editorImage = PNG.sync.read(Buffer.from(editorPng)); expect(editorImage.data.every(x => x === 0xff)) .withContext(`In ${browserName}`) .toBeTrue(); @@ -3650,7 +3650,7 @@ describe("FreeText Editor", () => { clip: editorRect, type: "png", }); - editorImage = PNG.sync.read(editorPng); + editorImage = PNG.sync.read(Buffer.from(editorPng)); expect(editorImage.data.every(x => x === 0xff)) .withContext(`In ${browserName}`) .toBeFalse(); diff --git a/test/test.mjs b/test/test.mjs index 0d23a76f0e7e29..7b77342d9c4a52 100644 --- a/test/test.mjs +++ b/test/test.mjs @@ -882,7 +882,7 @@ async function startBrowser({ extraPrefsFirefox = {}, }) { const options = { - product: browserName, + browser: browserName, protocol: "webDriverBiDi", headless, dumpio: true,