From 7989427ea65006bfa2a2e2323ec936bfb7e2dff7 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Mon, 18 Apr 2022 19:20:49 -0800 Subject: [PATCH] chore: bundle core deps (#13621) --- package-lock.json | 134 ++----------- package.json | 5 +- .../playwright-core/ThirdPartyNotices.txt | 189 +++++++++++++++--- .../bundles/utils/package-lock.json | 157 ++++++++++++++- .../bundles/utils/package.json | 13 +- .../bundles/utils/src/utilsBundleImpl.ts | 15 ++ packages/playwright-core/package.json | 7 - .../playwright-core/src/browserServerImpl.ts | 5 +- .../src/client/elementHandle.ts | 2 +- .../playwright-core/src/client/network.ts | 2 +- .../playwright-core/src/grid/gridAgent.ts | 2 +- .../src/grid/gridBrowserWorker.ts | 2 +- .../playwright-core/src/grid/gridServer.ts | 5 +- .../src/remote/playwrightConnection.ts | 2 +- .../src/remote/playwrightServer.ts | 8 +- .../src/server/android/android.ts | 2 +- packages/playwright-core/src/server/dom.ts | 2 +- .../playwright-core/src/server/formData.ts | 2 +- .../src/server/har/harTracer.ts | 2 +- .../src/server/recorder/DEPS.list | 1 + .../src/server/recorder/recorderApp.ts | 2 +- .../src/server/registry/download.ts | 2 +- .../src/server/trace/recorder/DEPS.list | 1 + .../src/server/trace/recorder/snapshotter.ts | 2 +- .../playwright-core/src/server/transport.ts | 7 +- .../src/server/webkit/wkPage.ts | 5 +- .../playwright-core/src/utils/comparators.ts | 9 +- .../playwright-core/src/utils/httpServer.ts | 6 +- packages/playwright-core/src/utilsBundle.ts | 7 + packages/playwright-test/package.json | 1 - .../src/matchers/toMatchSnapshot.ts | 2 +- packages/playwright-test/src/util.ts | 2 +- tests/android/device.spec.ts | 2 +- tests/library/headful.spec.ts | 2 +- tests/library/screenshot.spec.ts | 2 +- tests/library/tracing.spec.ts | 6 +- tests/library/video.spec.ts | 2 +- .../playwright-test-fixtures.ts | 3 +- .../to-have-screenshot.spec.ts | 2 +- utils/check_deps.js | 2 +- 40 files changed, 416 insertions(+), 208 deletions(-) diff --git a/package-lock.json b/package-lock.json index 082f236122..3786a9e49f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,18 +22,14 @@ "@babel/plugin-transform-typescript": "^7.16.8", "@babel/preset-react": "^7.16.7", "@types/formidable": "^2.0.4", - "@types/mime": "^2.0.3", "@types/minimatch": "^3.0.5", "@types/ms": "^0.7.31", "@types/node": "=14.17.15", - "@types/pngjs": "^6.0.1", - "@types/progress": "^2.0.5", "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", "@types/resize-observer-browser": "^0.1.6", "@types/source-map-support": "^0.5.4", "@types/stack-utils": "^2.0.1", - "@types/ws": "8.2.2", "@types/xml2js": "^0.4.9", "@typescript-eslint/eslint-plugin": "^5.10.2", "@typescript-eslint/parser": "^5.10.2", @@ -63,6 +59,7 @@ "socksv5": "0.0.6", "typescript": "^4.5.5", "vite": "^2.8.0", + "ws": "^8.5.0", "xml2js": "^0.4.23", "yaml": "^1.10.2" }, @@ -988,12 +985,6 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, - "node_modules/@types/mime": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", - "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", - "dev": true - }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -1018,24 +1009,6 @@ "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, - "node_modules/@types/pngjs": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz", - "integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/progress": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/progress/-/progress-2.0.5.tgz", - "integrity": "sha512-ZYYVc/kSMkhH9W/4dNK/sLNra3cnkfT2nJyOAIDY+C2u6w72wa0s1aXAezVtbTsnN8HID1uhXCrLwDE2ZXpplg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/prop-types": { "version": "15.7.3", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", @@ -1098,15 +1071,6 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, - "node_modules/@types/ws": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", - "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/xml2js": { "version": "0.4.9", "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.9.tgz", @@ -3655,11 +3619,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "node_modules/jpeg-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", - "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3948,6 +3907,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dev": true, "bin": { "mime": "cli.js" }, @@ -4387,14 +4347,6 @@ "resolved": "packages/playwright-webkit", "link": true }, - "node_modules/pngjs": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", - "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", - "engines": { - "node": ">=12.13.0" - } - }, "node_modules/postcss": { "version": "8.4.12", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz", @@ -4447,6 +4399,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -5477,9 +5430,10 @@ "dev": true }, "node_modules/ws": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz", - "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, "engines": { "node": ">=10.0.0" }, @@ -5669,13 +5623,6 @@ "packages/playwright-core": { "version": "1.22.0-next", "license": "Apache-2.0", - "dependencies": { - "jpeg-js": "0.4.3", - "mime": "3.0.0", - "pngjs": "6.0.0", - "progress": "2.0.3", - "ws": "8.4.2" - }, "bin": { "playwright": "cli.js" }, @@ -5736,7 +5683,6 @@ "license": "Apache-2.0", "dependencies": { "json5": "2.2.1", - "mime": "3.0.0", "minimatch": "3.0.4", "ms": "2.1.3", "open": "8.4.0", @@ -6431,7 +6377,6 @@ "version": "file:packages/playwright-test", "requires": { "json5": "2.2.1", - "mime": "3.0.0", "minimatch": "3.0.4", "ms": "2.1.3", "open": "8.4.0", @@ -6500,12 +6445,6 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, - "@types/mime": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", - "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", - "dev": true - }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -6530,24 +6469,6 @@ "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, - "@types/pngjs": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz", - "integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/progress": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/progress/-/progress-2.0.5.tgz", - "integrity": "sha512-ZYYVc/kSMkhH9W/4dNK/sLNra3cnkfT2nJyOAIDY+C2u6w72wa0s1aXAezVtbTsnN8HID1uhXCrLwDE2ZXpplg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/prop-types": { "version": "15.7.3", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", @@ -6609,15 +6530,6 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, - "@types/ws": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", - "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/xml2js": { "version": "0.4.9", "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.9.tgz", @@ -8425,11 +8337,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "jpeg-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", - "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8666,7 +8573,8 @@ "mime": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==" + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dev": true }, "mimic-response": { "version": "1.0.1", @@ -8990,14 +8898,7 @@ } }, "playwright-core": { - "version": "file:packages/playwright-core", - "requires": { - "jpeg-js": "0.4.3", - "mime": "3.0.0", - "pngjs": "6.0.0", - "progress": "2.0.3", - "ws": "8.4.2" - } + "version": "file:packages/playwright-core" }, "playwright-firefox": { "version": "file:packages/playwright-firefox", @@ -9011,11 +8912,6 @@ "playwright-core": "1.22.0-next" } }, - "pngjs": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", - "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==" - }, "postcss": { "version": "8.4.12", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz", @@ -9048,7 +8944,8 @@ "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true }, "proto-list": { "version": "1.2.4", @@ -9818,9 +9715,10 @@ "dev": true }, "ws": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz", - "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, "requires": {} }, "xml2js": { diff --git a/package.json b/package.json index cb76b06b00..76490a22db 100644 --- a/package.json +++ b/package.json @@ -54,18 +54,14 @@ "@babel/plugin-transform-typescript": "^7.16.8", "@babel/preset-react": "^7.16.7", "@types/formidable": "^2.0.4", - "@types/mime": "^2.0.3", "@types/minimatch": "^3.0.5", "@types/ms": "^0.7.31", "@types/node": "=14.17.15", - "@types/pngjs": "^6.0.1", - "@types/progress": "^2.0.5", "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", "@types/resize-observer-browser": "^0.1.6", "@types/source-map-support": "^0.5.4", "@types/stack-utils": "^2.0.1", - "@types/ws": "8.2.2", "@types/xml2js": "^0.4.9", "@typescript-eslint/eslint-plugin": "^5.10.2", "@typescript-eslint/parser": "^5.10.2", @@ -95,6 +91,7 @@ "socksv5": "0.0.6", "typescript": "^4.5.5", "vite": "^2.8.0", + "ws": "^8.5.0", "xml2js": "^0.4.23", "yaml": "^1.10.2" } diff --git a/packages/playwright-core/ThirdPartyNotices.txt b/packages/playwright-core/ThirdPartyNotices.txt index 59b01ec900..be2374b012 100644 --- a/packages/playwright-core/ThirdPartyNotices.txt +++ b/packages/playwright-core/ThirdPartyNotices.txt @@ -19,32 +19,37 @@ This project incorporates components from the projects listed below. The origina 13. inflight@1.0.6 (https://github.com/npm/inflight) 14. inherits@2.0.4 (https://github.com/isaacs/inherits) 15. ip@1.1.5 (https://github.com/indutny/node-ip) -16. minimatch@3.1.2 (https://github.com/isaacs/minimatch) -17. ms@2.1.2 (https://github.com/zeit/ms) -18. once@1.4.0 (https://github.com/isaacs/once) -19. path-is-absolute@1.0.1 (https://github.com/sindresorhus/path-is-absolute) -20. proper-lockfile@4.1.2 (https://github.com/moxystudio/node-proper-lockfile) -21. proxy-from-env@1.1.0 (https://github.com/Rob--W/proxy-from-env) -22. retry@0.12.0 (https://github.com/tim-kos/node-retry) -23. rimraf@3.0.2 (https://github.com/isaacs/rimraf) -24. signal-exit@3.0.7 (https://github.com/tapjs/signal-exit) -25. smart-buffer@4.2.0 (https://github.com/JoshGlazebrook/smart-buffer) -26. socks-proxy-agent@6.1.1 (https://github.com/TooTallNate/node-socks-proxy-agent) -27. socks@2.6.2 (https://github.com/JoshGlazebrook/socks) -28. stack-utils@2.0.5 (https://github.com/tapjs/stack-utils) -29. wrappy@1.0.2 (https://github.com/npm/wrappy) -30. @types/node@17.0.24 (https://github.com/DefinitelyTyped/DefinitelyTyped) -31. @types/yauzl@2.10.0 (https://github.com/DefinitelyTyped/DefinitelyTyped) -32. buffer-crc32@0.2.13 (https://github.com/brianloveswords/buffer-crc32) -33. debug@4.3.4 (https://github.com/debug-js/debug) -34. end-of-stream@1.4.4 (https://github.com/mafintosh/end-of-stream) -35. extract-zip@2.0.1 (https://github.com/maxogden/extract-zip) -36. fd-slicer@1.1.0 (https://github.com/andrewrk/node-fd-slicer) -37. get-stream@5.2.0 (https://github.com/sindresorhus/get-stream) -38. pend@1.2.0 (https://github.com/andrewrk/node-pend) -39. pump@3.0.0 (https://github.com/mafintosh/pump) -40. yauzl@2.10.0 (https://github.com/thejoshwolfe/yauzl) -41. yazl@2.5.1 (https://github.com/thejoshwolfe/yazl) +16. jpeg-js@0.4.3 (https://github.com/eugeneware/jpeg-js) +17. mime@3.0.0 (https://github.com/broofa/mime) +18. minimatch@3.1.2 (https://github.com/isaacs/minimatch) +19. ms@2.1.2 (https://github.com/zeit/ms) +20. once@1.4.0 (https://github.com/isaacs/once) +21. path-is-absolute@1.0.1 (https://github.com/sindresorhus/path-is-absolute) +22. pngjs@6.0.0 (https://github.com/lukeapage/pngjs) +23. progress@2.0.3 (https://github.com/visionmedia/node-progress) +24. proper-lockfile@4.1.2 (https://github.com/moxystudio/node-proper-lockfile) +25. proxy-from-env@1.1.0 (https://github.com/Rob--W/proxy-from-env) +26. retry@0.12.0 (https://github.com/tim-kos/node-retry) +27. rimraf@3.0.2 (https://github.com/isaacs/rimraf) +28. signal-exit@3.0.7 (https://github.com/tapjs/signal-exit) +29. smart-buffer@4.2.0 (https://github.com/JoshGlazebrook/smart-buffer) +30. socks-proxy-agent@6.1.1 (https://github.com/TooTallNate/node-socks-proxy-agent) +31. socks@2.6.2 (https://github.com/JoshGlazebrook/socks) +32. stack-utils@2.0.5 (https://github.com/tapjs/stack-utils) +33. wrappy@1.0.2 (https://github.com/npm/wrappy) +34. ws@8.4.2 (https://github.com/websockets/ws) +35. @types/node@17.0.24 (https://github.com/DefinitelyTyped/DefinitelyTyped) +36. @types/yauzl@2.10.0 (https://github.com/DefinitelyTyped/DefinitelyTyped) +37. buffer-crc32@0.2.13 (https://github.com/brianloveswords/buffer-crc32) +38. debug@4.3.4 (https://github.com/debug-js/debug) +39. end-of-stream@1.4.4 (https://github.com/mafintosh/end-of-stream) +40. extract-zip@2.0.1 (https://github.com/maxogden/extract-zip) +41. fd-slicer@1.1.0 (https://github.com/andrewrk/node-fd-slicer) +42. get-stream@5.2.0 (https://github.com/sindresorhus/get-stream) +43. pend@1.2.0 (https://github.com/andrewrk/node-pend) +44. pump@3.0.0 (https://github.com/mafintosh/pump) +45. yauzl@2.10.0 (https://github.com/thejoshwolfe/yauzl) +46. yazl@2.5.1 (https://github.com/thejoshwolfe/yazl) %% agent-base@6.0.2 NOTICES AND INFORMATION BEGIN HERE ========================================= @@ -737,6 +742,62 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================= END OF ip@1.1.5 AND INFORMATION +%% jpeg-js@0.4.3 NOTICES AND INFORMATION BEGIN HERE +========================================= +Copyright (c) 2014, Eugene Ware +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of Eugene Ware nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY EUGENE WARE ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL EUGENE WARE BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +========================================= +END OF jpeg-js@0.4.3 AND INFORMATION + +%% mime@3.0.0 NOTICES AND INFORMATION BEGIN HERE +========================================= +The MIT License (MIT) + +Copyright (c) 2010 Benjamin Thomas, Robert Kieffer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +========================================= +END OF mime@3.0.0 AND INFORMATION + %% minimatch@3.1.2 NOTICES AND INFORMATION BEGIN HERE ========================================= The ISC License @@ -829,6 +890,58 @@ THE SOFTWARE. ========================================= END OF path-is-absolute@1.0.1 AND INFORMATION +%% pngjs@6.0.0 NOTICES AND INFORMATION BEGIN HERE +========================================= +pngjs2 original work Copyright (c) 2015 Luke Page & Original Contributors +pngjs derived work Copyright (c) 2012 Kuba Niegowski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +========================================= +END OF pngjs@6.0.0 AND INFORMATION + +%% progress@2.0.3 NOTICES AND INFORMATION BEGIN HERE +========================================= +(The MIT License) + +Copyright (c) 2017 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +========================================= +END OF progress@2.0.3 AND INFORMATION + %% proper-lockfile@4.1.2 NOTICES AND INFORMATION BEGIN HERE ========================================= The MIT License (MIT) @@ -1200,6 +1313,30 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ========================================= END OF wrappy@1.0.2 AND INFORMATION +%% ws@8.4.2 NOTICES AND INFORMATION BEGIN HERE +========================================= +Copyright (c) 2011 Einar Otto Stangvik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +========================================= +END OF ws@8.4.2 AND INFORMATION + %% @types/node@17.0.24 NOTICES AND INFORMATION BEGIN HERE ========================================= MIT License diff --git a/packages/playwright-core/bundles/utils/package-lock.json b/packages/playwright-core/bundles/utils/package-lock.json index 08017afacc..768936a9ca 100644 --- a/packages/playwright-core/bundles/utils/package-lock.json +++ b/packages/playwright-core/bundles/utils/package-lock.json @@ -12,18 +12,27 @@ "commander": "8.3.0", "debug": "4.3.3", "https-proxy-agent": "5.0.0", + "jpeg-js": "0.4.3", + "mime": "^3.0.0", + "pngjs": "6.0.0", + "progress": "2.0.3", "proper-lockfile": "4.1.2", "proxy-from-env": "1.1.0", "rimraf": "3.0.2", "socks-proxy-agent": "6.1.1", - "stack-utils": "2.0.5" + "stack-utils": "2.0.5", + "ws": "8.4.2" }, "devDependencies": { "@types/debug": "^4.1.7", + "@types/mime": "^2.0.3", + "@types/pngjs": "^6.0.1", + "@types/progress": "^2.0.5", "@types/proper-lockfile": "^4.1.2", "@types/proxy-from-env": "^1.0.1", "@types/rimraf": "^3.0.2", - "@types/stack-utils": "^2.0.1" + "@types/stack-utils": "^2.0.1", + "@types/ws": "8.2.2" } }, "node_modules/@types/debug": { @@ -45,6 +54,12 @@ "@types/node": "*" } }, + "node_modules/@types/mime": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", + "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", + "dev": true + }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -63,6 +78,24 @@ "integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==", "dev": true }, + "node_modules/@types/pngjs": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz", + "integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/progress": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/progress/-/progress-2.0.5.tgz", + "integrity": "sha512-ZYYVc/kSMkhH9W/4dNK/sLNra3cnkfT2nJyOAIDY+C2u6w72wa0s1aXAezVtbTsnN8HID1uhXCrLwDE2ZXpplg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/@types/proper-lockfile/-/proper-lockfile-4.1.2.tgz", @@ -103,6 +136,15 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, + "node_modules/@types/ws": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", + "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -233,6 +275,22 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" }, + "node_modules/jpeg-js": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", + "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==" + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -265,6 +323,22 @@ "node": ">=0.10.0" } }, + "node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", @@ -357,6 +431,26 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/ws": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz", + "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } } }, "dependencies": { @@ -379,6 +473,12 @@ "@types/node": "*" } }, + "@types/mime": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", + "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", + "dev": true + }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -397,6 +497,24 @@ "integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==", "dev": true }, + "@types/pngjs": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz", + "integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/progress": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/progress/-/progress-2.0.5.tgz", + "integrity": "sha512-ZYYVc/kSMkhH9W/4dNK/sLNra3cnkfT2nJyOAIDY+C2u6w72wa0s1aXAezVtbTsnN8HID1uhXCrLwDE2ZXpplg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/@types/proper-lockfile/-/proper-lockfile-4.1.2.tgz", @@ -437,6 +555,15 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, + "@types/ws": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", + "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -538,6 +665,16 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" }, + "jpeg-js": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", + "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==" + }, + "mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==" + }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -564,6 +701,16 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, "proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", @@ -633,6 +780,12 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz", + "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==", + "requires": {} } } } diff --git a/packages/playwright-core/bundles/utils/package.json b/packages/playwright-core/bundles/utils/package.json index 5768a0a748..f117fffca5 100644 --- a/packages/playwright-core/bundles/utils/package.json +++ b/packages/playwright-core/bundles/utils/package.json @@ -13,17 +13,26 @@ "commander": "8.3.0", "debug": "4.3.3", "https-proxy-agent": "5.0.0", + "jpeg-js": "0.4.3", + "mime": "^3.0.0", + "pngjs": "6.0.0", + "progress": "2.0.3", "proper-lockfile": "4.1.2", "proxy-from-env": "1.1.0", "socks-proxy-agent": "6.1.1", "stack-utils": "2.0.5", - "rimraf": "3.0.2" + "rimraf": "3.0.2", + "ws": "8.4.2" }, "devDependencies": { "@types/debug": "^4.1.7", + "@types/mime": "^2.0.3", + "@types/pngjs": "^6.0.1", + "@types/progress": "^2.0.5", "@types/proper-lockfile": "^4.1.2", "@types/proxy-from-env": "^1.0.1", "@types/rimraf": "^3.0.2", - "@types/stack-utils": "^2.0.1" + "@types/stack-utils": "^2.0.1", + "@types/ws": "8.2.2" } } diff --git a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts index 9c5080e7ac..e0c8d4f519 100644 --- a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts +++ b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts @@ -24,11 +24,22 @@ export { getProxyForUrl } from 'proxy-from-env'; export { HttpsProxyAgent } from 'https-proxy-agent'; +import jpegLibrary from 'jpeg-js'; +export const jpegjs = jpegLibrary; + import lockfileLibrary from 'proper-lockfile'; export const lockfile = lockfileLibrary; +import mimeLibrary from 'mime'; +export const mime = mimeLibrary; + +export { PNG } from 'pngjs'; + export { program } from 'commander'; +import progressLibrary from 'progress'; +export const progress = progressLibrary; + import rimrafLibrary from 'rimraf'; export const rimraf = rimrafLibrary; @@ -36,3 +47,7 @@ export { SocksProxyAgent } from 'socks-proxy-agent'; import StackUtilsLibrary from 'stack-utils'; export const StackUtils = StackUtilsLibrary; + +import wsLibrary, { WebSocketServer } from 'ws'; +export const ws = wsLibrary; +export const wsServer = WebSocketServer; diff --git a/packages/playwright-core/package.json b/packages/playwright-core/package.json index 6b4f3e7a7a..da20f75e18 100644 --- a/packages/playwright-core/package.json +++ b/packages/playwright-core/package.json @@ -42,12 +42,5 @@ "types": "types/types.d.ts", "bin": { "playwright": "./cli.js" - }, - "dependencies": { - "jpeg-js": "0.4.3", - "mime": "3.0.0", - "pngjs": "6.0.0", - "progress": "2.0.3", - "ws": "8.4.2" } } diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts index 44d8fe267b..39dc9a877f 100644 --- a/packages/playwright-core/src/browserServerImpl.ts +++ b/packages/playwright-core/src/browserServerImpl.ts @@ -15,7 +15,8 @@ */ import type { LaunchServerOptions, Logger } from './client/types'; -import { EventEmitter } from 'ws'; +import { ws } from './utilsBundle'; +import type { WebSocketEventEmitter } from './utilsBundle'; import type { BrowserServerLauncher, BrowserServer } from './client/browserType'; import { envObjectToArray } from './client/clientHelper'; import { createGuid } from './utils'; @@ -57,7 +58,7 @@ export class BrowserServerLauncherImpl implements BrowserServerLauncher { const wsEndpoint = await server.listen(options.port); // 3. Return the BrowserServer interface - const browserServer = new EventEmitter() as (BrowserServer & EventEmitter); + const browserServer = new ws.EventEmitter() as (BrowserServer & WebSocketEventEmitter); browserServer.process = () => browser.options.browserProcess.process!; browserServer.wsEndpoint = () => wsEndpoint; browserServer.close = () => browser.options.browserProcess.close(); diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts index 357192c2bf..d95c54461a 100644 --- a/packages/playwright-core/src/client/elementHandle.ts +++ b/packages/playwright-core/src/client/elementHandle.ts @@ -21,7 +21,7 @@ import { JSHandle, serializeArgument, parseResult } from './jsHandle'; import type { ChannelOwner } from './channelOwner'; import type { SelectOption, FilePayload, Rect, SelectOptionOptions } from './types'; import fs from 'fs'; -import * as mime from 'mime'; +import { mime } from '../utilsBundle'; import path from 'path'; import { assert, isString } from '../utils'; import { mkdirIfNeeded } from '../utils/fileUtils'; diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts index 85dbe5ae13..b9593a0a78 100644 --- a/packages/playwright-core/src/client/network.ts +++ b/packages/playwright-core/src/client/network.ts @@ -20,7 +20,7 @@ import { ChannelOwner } from './channelOwner'; import { Frame } from './frame'; import type { Headers, RemoteAddr, SecurityDetails, WaitForEventOptions } from './types'; import fs from 'fs'; -import * as mime from 'mime'; +import { mime } from '../utilsBundle'; import { isString, headersObjectToArray } from '../utils'; import { ManualPromise } from '../utils/manualPromise'; import { Events } from './events'; diff --git a/packages/playwright-core/src/grid/gridAgent.ts b/packages/playwright-core/src/grid/gridAgent.ts index 729c06eaf6..b40cdf4198 100644 --- a/packages/playwright-core/src/grid/gridAgent.ts +++ b/packages/playwright-core/src/grid/gridAgent.ts @@ -15,7 +15,7 @@ */ import { debug } from '../utilsBundle'; -import WebSocket from 'ws'; +import { ws as WebSocket } from '../utilsBundle'; import { fork } from 'child_process'; import { getPlaywrightVersion } from '../common/userAgent'; diff --git a/packages/playwright-core/src/grid/gridBrowserWorker.ts b/packages/playwright-core/src/grid/gridBrowserWorker.ts index 56187602b0..29ddabd453 100644 --- a/packages/playwright-core/src/grid/gridBrowserWorker.ts +++ b/packages/playwright-core/src/grid/gridBrowserWorker.ts @@ -15,7 +15,7 @@ */ import { debug } from '../utilsBundle'; -import WebSocket from 'ws'; +import { ws as WebSocket } from '../utilsBundle'; import { PlaywrightConnection } from '../remote/playwrightConnection'; import { gracefullyCloseAll } from '../utils/processLauncher'; diff --git a/packages/playwright-core/src/grid/gridServer.ts b/packages/playwright-core/src/grid/gridServer.ts index a0c9943866..f6ffd7f34e 100644 --- a/packages/playwright-core/src/grid/gridServer.ts +++ b/packages/playwright-core/src/grid/gridServer.ts @@ -17,8 +17,7 @@ import { debug } from '../utilsBundle'; import { EventEmitter } from 'events'; import { URL } from 'url'; -import type { Server as WebSocketServer } from 'ws'; -import type WebSocket from 'ws'; +import type { WebSocketServer, WebSocket, WebSocketRawData } from '../utilsBundle'; import { HttpServer } from '../utils/httpServer'; import { assert, createGuid } from '../utils'; import { getPlaywrightVersion } from '../common/userAgent'; @@ -75,7 +74,7 @@ class GridWorker extends EventEmitter { private _workerSocket: WebSocket | undefined; private _clientSocket: WebSocket; private _log: debug.Debugger; - private _bufferedMessages: WebSocket.RawData[] = []; + private _bufferedMessages: WebSocketRawData[] = []; constructor(clientSocket: WebSocket, params: GridWorkerParams) { super(); diff --git a/packages/playwright-core/src/remote/playwrightConnection.ts b/packages/playwright-core/src/remote/playwrightConnection.ts index 6d10db7237..092af9402b 100644 --- a/packages/playwright-core/src/remote/playwrightConnection.ts +++ b/packages/playwright-core/src/remote/playwrightConnection.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type WebSocket from 'ws'; +import type { WebSocket } from '../utilsBundle'; import type { Playwright, DispatcherScope } from '../server'; import { createPlaywright, DispatcherConnection, Root, PlaywrightDispatcher } from '../server'; import { Browser } from '../server/browser'; diff --git a/packages/playwright-core/src/remote/playwrightServer.ts b/packages/playwright-core/src/remote/playwrightServer.ts index 3f3462bf39..39ea745bb0 100644 --- a/packages/playwright-core/src/remote/playwrightServer.ts +++ b/packages/playwright-core/src/remote/playwrightServer.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { debug } from '../utilsBundle'; +import { debug, wsServer } from '../utilsBundle'; +import type { WebSocketServer } from '../utilsBundle'; import * as http from 'http'; -import WebSocket from 'ws'; import type { Browser } from '../server/browser'; import { PlaywrightConnection } from './playwrightConnection'; @@ -35,7 +35,7 @@ export class PlaywrightServer { private _maxClients: number; private _enableSocksProxy: boolean; private _browser: Browser | undefined; - private _wsServer: WebSocket.Server | undefined; + private _wsServer: WebSocketServer | undefined; private _clientsCount = 0; static async startDefault(options: { path?: string, maxClients?: number, enableSocksProxy?: boolean } = {}): Promise { @@ -70,7 +70,7 @@ export class PlaywrightServer { debugLog('Listening at ' + wsEndpoint); - this._wsServer = new WebSocket.Server({ server, path: this._path }); + this._wsServer = new wsServer({ server, path: this._path }); const originalShouldHandle = this._wsServer.shouldHandle.bind(this._wsServer); this._wsServer.shouldHandle = request => originalShouldHandle(request) && this._clientsCount < this._maxClients; this._wsServer.on('connection', async (ws, request) => { diff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.ts index ee2d78cf17..6216c06dd9 100644 --- a/packages/playwright-core/src/server/android/android.ts +++ b/packages/playwright-core/src/server/android/android.ts @@ -21,7 +21,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; import type * as stream from 'stream'; -import * as ws from 'ws'; +import { ws } from '../../utilsBundle'; import { createGuid, makeWaitForNextTask, isUnderTest } from '../../utils'; import { removeFolders } from '../../utils/fileUtils'; import type { BrowserOptions, BrowserProcess, PlaywrightOptions } from '../browser'; diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.ts index 2e46e3cea8..19d1021770 100644 --- a/packages/playwright-core/src/server/dom.ts +++ b/packages/playwright-core/src/server/dom.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as mime from 'mime'; +import { mime } from '../utilsBundle'; import * as injectedScriptSource from '../generated/injectedScriptSource'; import type * as channels from '../protocol/channels'; import { isSessionClosedError } from './protocolError'; diff --git a/packages/playwright-core/src/server/formData.ts b/packages/playwright-core/src/server/formData.ts index dadb92320f..280e261f06 100644 --- a/packages/playwright-core/src/server/formData.ts +++ b/packages/playwright-core/src/server/formData.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import mime from 'mime'; +import { mime } from '../utilsBundle'; import type * as channels from '../protocol/channels'; export class MultipartFormData { diff --git a/packages/playwright-core/src/server/har/harTracer.ts b/packages/playwright-core/src/server/har/harTracer.ts index 5a0622f5c9..bd906299a4 100644 --- a/packages/playwright-core/src/server/har/harTracer.ts +++ b/packages/playwright-core/src/server/har/harTracer.ts @@ -24,7 +24,7 @@ import type * as har from './har'; import { calculateSha1, monotonicTime } from '../../utils'; import type { RegisteredListener } from '../../utils/eventsHelper'; import { eventsHelper } from '../../utils/eventsHelper'; -import * as mime from 'mime'; +import { mime } from '../../utilsBundle'; import { ManualPromise } from '../../utils/manualPromise'; import { getPlaywrightVersion } from '../../common/userAgent'; diff --git a/packages/playwright-core/src/server/recorder/DEPS.list b/packages/playwright-core/src/server/recorder/DEPS.list index e94a071ef4..bb668d0e80 100644 --- a/packages/playwright-core/src/server/recorder/DEPS.list +++ b/packages/playwright-core/src/server/recorder/DEPS.list @@ -4,6 +4,7 @@ ../../common/ ../../protocol/ ../../utils/** +../../utilsBundle.ts ../../zipBundle.ts [recorderApp.ts] diff --git a/packages/playwright-core/src/server/recorder/recorderApp.ts b/packages/playwright-core/src/server/recorder/recorderApp.ts index ac35edfab3..4f8fa39ba8 100644 --- a/packages/playwright-core/src/server/recorder/recorderApp.ts +++ b/packages/playwright-core/src/server/recorder/recorderApp.ts @@ -22,7 +22,7 @@ import { EventEmitter } from 'events'; import { serverSideCallMetadata } from '../instrumentation'; import type { CallLog, EventData, Mode, Source } from './recorderTypes'; import { isUnderTest } from '../../utils'; -import * as mime from 'mime'; +import { mime } from '../../utilsBundle'; import { installAppIcon } from '../chromium/crApp'; import { findChromiumChannel } from '../registry'; diff --git a/packages/playwright-core/src/server/registry/download.ts b/packages/playwright-core/src/server/registry/download.ts index e474054b15..2584219b05 100644 --- a/packages/playwright-core/src/server/registry/download.ts +++ b/packages/playwright-core/src/server/registry/download.ts @@ -15,7 +15,7 @@ */ import fs from 'fs'; -import ProgressBar from 'progress'; +import { progress as ProgressBar } from '../../utilsBundle'; import { httpRequest } from '../../common/netUtils'; type OnProgressCallback = (downloadedBytes: number, totalBytes: number) => void; diff --git a/packages/playwright-core/src/server/trace/recorder/DEPS.list b/packages/playwright-core/src/server/trace/recorder/DEPS.list index ac1d81edd8..8f5e716a87 100644 --- a/packages/playwright-core/src/server/trace/recorder/DEPS.list +++ b/packages/playwright-core/src/server/trace/recorder/DEPS.list @@ -4,5 +4,6 @@ ../../../common/ ../../../protocol/ ../../../utils/ +../../../utilsBundle.ts ../../../zipBundle.ts ../common/ diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts index b3f884c4b0..8d874b451c 100644 --- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts +++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts @@ -25,7 +25,7 @@ import { frameSnapshotStreamer } from './snapshotterInjected'; import { calculateSha1, createGuid, monotonicTime } from '../../../utils'; import type { FrameSnapshot } from '../common/snapshotTypes'; import type { ElementHandle } from '../../dom'; -import * as mime from 'mime'; +import { mime } from '../../../utilsBundle'; export type SnapshotterBlob = { buffer: Buffer, diff --git a/packages/playwright-core/src/server/transport.ts b/packages/playwright-core/src/server/transport.ts index a57f3bb39c..b59de1c3c9 100644 --- a/packages/playwright-core/src/server/transport.ts +++ b/packages/playwright-core/src/server/transport.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import WebSocket from 'ws'; +import { ws } from '../utilsBundle'; +import type { WebSocket } from '../utilsBundle'; import type { Progress } from './progress'; import { makeWaitForNextTask } from '../utils'; @@ -77,7 +78,7 @@ export class WebSocketTransport implements ConnectionTransport { constructor(progress: Progress, url: string, headers?: { [key: string]: string; }, followRedirects?: boolean) { this.wsEndpoint = url; - this._ws = new WebSocket(url, [], { + this._ws = new ws(url, [], { perMessageDeflate: false, maxPayload: 256 * 1024 * 1024, // 256Mb, // Prevent internal http client error when passing negative timeout. @@ -122,7 +123,7 @@ export class WebSocketTransport implements ConnectionTransport { } async closeAndWait() { - if (this._ws.readyState === WebSocket.CLOSED) + if (this._ws.readyState === ws.CLOSED) return; const promise = new Promise(f => this._ws.once('close', f)); this.close(); diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.ts index 624ff70c21..6077850c35 100644 --- a/packages/playwright-core/src/server/webkit/wkPage.ts +++ b/packages/playwright-core/src/server/webkit/wkPage.ts @@ -15,9 +15,8 @@ * limitations under the License. */ -import * as jpeg from 'jpeg-js'; import path from 'path'; -import * as png from 'pngjs'; +import { PNG, jpegjs } from '../../utilsBundle'; import { splitErrorMessage } from '../../utils/stackTrace'; import { assert, createGuid, debugAssert, headersArrayToObject, headersObjectToArray } from '../../utils'; import { hostPlatform } from '../../utils/hostPlatform'; @@ -838,7 +837,7 @@ export class WKPage implements PageDelegate { const prefix = 'data:image/png;base64,'; let buffer = Buffer.from(result.dataURL.substr(prefix.length), 'base64'); if (format === 'jpeg') - buffer = jpeg.encode(png.PNG.sync.read(buffer), quality).data; + buffer = jpegjs.encode(PNG.sync.read(buffer), quality).data; return buffer; } diff --git a/packages/playwright-core/src/utils/comparators.ts b/packages/playwright-core/src/utils/comparators.ts index af4e0d21f6..1675004513 100644 --- a/packages/playwright-core/src/utils/comparators.ts +++ b/packages/playwright-core/src/utils/comparators.ts @@ -15,11 +15,10 @@ * limitations under the License. */ -import { colors } from '../utilsBundle'; -import jpeg from 'jpeg-js'; +import { colors, jpegjs } from '../utilsBundle'; import pixelmatch from '../third_party/pixelmatch'; import { diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL } from '../third_party/diff_match_patch'; -import { PNG } from 'pngjs'; +import { PNG } from '../utilsBundle'; export type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number }; export type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null; @@ -49,8 +48,8 @@ function compareImages(mimeType: string, actualBuffer: Buffer | string, expected if (!actualBuffer || !(actualBuffer instanceof Buffer)) return { errorMessage: 'Actual result should be a Buffer.' }; - const actual = mimeType === 'image/png' ? PNG.sync.read(actualBuffer) : jpeg.decode(actualBuffer); - const expected = mimeType === 'image/png' ? PNG.sync.read(expectedBuffer) : jpeg.decode(expectedBuffer); + const actual = mimeType === 'image/png' ? PNG.sync.read(actualBuffer) : jpegjs.decode(actualBuffer); + const expected = mimeType === 'image/png' ? PNG.sync.read(expectedBuffer) : jpegjs.decode(expectedBuffer); if (expected.width !== actual.width || expected.height !== actual.height) { return { errorMessage: `Expected an image ${expected.width}px by ${expected.height}px, received ${actual.width}px by ${actual.height}px. ` diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/utils/httpServer.ts index a4e4dc17b3..a1918e95e8 100644 --- a/packages/playwright-core/src/utils/httpServer.ts +++ b/packages/playwright-core/src/utils/httpServer.ts @@ -17,8 +17,8 @@ import * as http from 'http'; import fs from 'fs'; import path from 'path'; -import { Server as WebSocketServer } from 'ws'; -import * as mime from 'mime'; +import { mime, wsServer } from '../utilsBundle'; +import type { WebSocketServer } from '../utilsBundle'; import { assert } from './'; export type ServerRouteHandler = (request: http.IncomingMessage, response: http.ServerResponse) => boolean; @@ -36,7 +36,7 @@ export class HttpServer { } createWebSocketServer(): WebSocketServer { - return new WebSocketServer({ server: this._server }); + return new wsServer({ server: this._server }); } routePrefix(prefix: string, handler: ServerRouteHandler) { diff --git a/packages/playwright-core/src/utilsBundle.ts b/packages/playwright-core/src/utilsBundle.ts index fa7f789a6d..b5d8b892bc 100644 --- a/packages/playwright-core/src/utilsBundle.ts +++ b/packages/playwright-core/src/utilsBundle.ts @@ -18,9 +18,16 @@ export const colors: typeof import('../bundles/utils/node_modules/colors/safe') export const debug: typeof import('../bundles/utils/node_modules/@types/debug') = require('./utilsBundleImpl').debug; export const getProxyForUrl: typeof import('../bundles/utils/node_modules/@types/proxy-from-env').getProxyForUrl = require('./utilsBundleImpl').getProxyForUrl; export const HttpsProxyAgent: typeof import('../bundles/utils/node_modules/https-proxy-agent').HttpsProxyAgent = require('./utilsBundleImpl').HttpsProxyAgent; +export const jpegjs: typeof import('../bundles/utils/node_modules/jpeg-js') = require('./utilsBundleImpl').jpegjs; export const lockfile: typeof import('../bundles/utils/node_modules/@types/proper-lockfile') = require('./utilsBundleImpl').lockfile; +export const mime: typeof import('../bundles/utils/node_modules/@types/mime') = require('./utilsBundleImpl').mime; +export const PNG: typeof import('../bundles/utils/node_modules/@types/pngjs').PNG = require('./utilsBundleImpl').PNG; export const program: typeof import('../bundles/utils/node_modules/commander').program = require('./utilsBundleImpl').program; +export const progress: typeof import('../bundles/utils/node_modules/@types/progress') = require('./utilsBundleImpl').progress; export const rimraf: typeof import('../bundles/utils/node_modules/@types/rimraf') = require('./utilsBundleImpl').rimraf; export const SocksProxyAgent: typeof import('../bundles/utils/node_modules/socks-proxy-agent').SocksProxyAgent = require('./utilsBundleImpl').SocksProxyAgent; export const StackUtils: typeof import('../bundles/utils/node_modules/@types/stack-utils') = require('./utilsBundleImpl').StackUtils; +export const ws: typeof import('../bundles/utils/node_modules/@types/ws') = require('./utilsBundleImpl').ws; +export const wsServer: typeof import('../bundles/utils/node_modules/@types/ws').WebSocketServer = require('./utilsBundleImpl').wsServer; export type { Command } from '../bundles/utils/node_modules/commander'; +export type { WebSocket, WebSocketServer, RawData as WebSocketRawData, EventEmitter as WebSocketEventEmitter } from '../bundles/utils/node_modules/@types/ws'; diff --git a/packages/playwright-test/package.json b/packages/playwright-test/package.json index af3d856ff0..5d3dc237e4 100644 --- a/packages/playwright-test/package.json +++ b/packages/playwright-test/package.json @@ -30,7 +30,6 @@ "license": "Apache-2.0", "dependencies": { "json5": "2.2.1", - "mime": "3.0.0", "minimatch": "3.0.4", "ms": "2.1.3", "open": "8.4.0", diff --git a/packages/playwright-test/src/matchers/toMatchSnapshot.ts b/packages/playwright-test/src/matchers/toMatchSnapshot.ts index 1e7fe9da50..6aec9147d6 100644 --- a/packages/playwright-test/src/matchers/toMatchSnapshot.ts +++ b/packages/playwright-test/src/matchers/toMatchSnapshot.ts @@ -29,7 +29,7 @@ import { import { colors } from 'playwright-core/lib/utilsBundle'; import fs from 'fs'; import path from 'path'; -import * as mime from 'mime'; +import { mime } from 'playwright-core/lib/utilsBundle'; import type { TestInfoImpl } from '../testInfo'; import type { SyncExpectationResult } from '../expect'; diff --git a/packages/playwright-test/src/util.ts b/packages/playwright-test/src/util.ts index aaacea2313..21360e3a8f 100644 --- a/packages/playwright-test/src/util.ts +++ b/packages/playwright-test/src/util.ts @@ -15,7 +15,7 @@ */ import fs from 'fs'; -import * as mime from 'mime'; +import { mime } from 'playwright-core/lib/utilsBundle'; import util from 'util'; import path from 'path'; import url from 'url'; diff --git a/tests/android/device.spec.ts b/tests/android/device.spec.ts index 6a2da61cf9..c8011b4aea 100644 --- a/tests/android/device.spec.ts +++ b/tests/android/device.spec.ts @@ -16,7 +16,7 @@ import fs from 'fs'; import { join } from 'path'; -import { PNG } from 'pngjs'; +import { PNG } from 'playwright-core/lib/utilsBundle'; import { androidTest as test, expect } from './androidTest'; test('androidDevice.shell', async function({ androidDevice }) { diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.ts index b5fcf0ab88..a1e669466c 100644 --- a/tests/library/headful.spec.ts +++ b/tests/library/headful.spec.ts @@ -15,7 +15,7 @@ */ import pixelmatch from '../../packages/playwright-core/src/third_party/pixelmatch'; -import { PNG } from 'pngjs'; +import { PNG } from 'playwright-core/lib/utilsBundle'; import { expect, playwrightTest as it } from '../config/browserTest'; it('should have default url when launching browser @smoke', async ({ browserType, createUserDataDir }) => { diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.ts index 31f0f9e395..fb70b50ae3 100644 --- a/tests/library/screenshot.spec.ts +++ b/tests/library/screenshot.spec.ts @@ -16,7 +16,7 @@ */ import { expect, browserTest } from '../config/browserTest'; -import { PNG } from 'pngjs'; +import { PNG } from 'playwright-core/lib/utilsBundle'; import { verifyViewport } from '../config/utils'; browserTest.describe('page screenshot', () => { diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.ts index ff7a47bc59..b5ac67cb4d 100644 --- a/tests/library/tracing.spec.ts +++ b/tests/library/tracing.spec.ts @@ -15,7 +15,7 @@ */ import fs from 'fs'; -import jpeg from 'jpeg-js'; +import { jpegjs } from 'playwright-core/lib/utilsBundle'; import path from 'path'; import { browserTest, contextTest as test, expect } from '../config/browserTest'; import { parseTrace } from '../config/utils'; @@ -276,14 +276,14 @@ for (const params of [ expect(frame.width).toBe(params.width); expect(frame.height).toBe(params.height); const buffer = resources.get('resources/' + frame.sha1); - const image = jpeg.decode(buffer); + const image = jpegjs.decode(buffer); expect(image.width).toBe(previewWidth); expect(image.height).toBe(previewHeight); } const frame = frames[frames.length - 1]; // pick last frame. const buffer = resources.get('resources/' + frame.sha1); - const image = jpeg.decode(buffer); + const image = jpegjs.decode(buffer); expect(image.data.byteLength).toBe(previewWidth * previewHeight * 4); expectRed(image.data, previewWidth * previewHeight * 4 / 2 + previewWidth * 4 / 2); // center is red expectBlue(image.data, previewWidth * 5 * 4 + previewWidth * 4 / 2); // top diff --git a/tests/library/video.spec.ts b/tests/library/video.spec.ts index a5548fc193..057d36c9a7 100644 --- a/tests/library/video.spec.ts +++ b/tests/library/video.spec.ts @@ -18,7 +18,7 @@ import { browserTest as it, expect } from '../config/browserTest'; import fs from 'fs'; import path from 'path'; import { spawnSync } from 'child_process'; -import { PNG } from 'pngjs'; +import { PNG } from 'playwright-core/lib/utilsBundle'; import { registry } from '../../packages/playwright-core/lib/server'; const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath('javascript'); diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts index cc7bdb1f3c..0277e9845e 100644 --- a/tests/playwright-test/playwright-test-fixtures.ts +++ b/tests/playwright-test/playwright-test-fixtures.ts @@ -18,8 +18,7 @@ import type { JSONReport, JSONReportSuite } from '@playwright/test/reporter'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { rimraf } from 'playwright-core/lib/utilsBundle'; -import { PNG } from 'pngjs'; +import { rimraf, PNG } from 'playwright-core/lib/utilsBundle'; import { promisify } from 'util'; import type { CommonFixtures } from '../config/commonFixtures'; import { commonFixtures } from '../config/commonFixtures'; diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.ts index fd7bd8ca71..317601ff6e 100644 --- a/tests/playwright-test/to-have-screenshot.spec.ts +++ b/tests/playwright-test/to-have-screenshot.spec.ts @@ -16,7 +16,7 @@ import { getComparator } from 'playwright-core/lib/utils/comparators'; import * as fs from 'fs'; -import { PNG } from 'pngjs'; +import { PNG } from 'playwright-core/lib/utilsBundle'; import * as path from 'path'; import { pathToFileURL } from 'url'; import { test, expect, stripAnsi, createImage, paintBlackPixels } from './playwright-test-fixtures'; diff --git a/utils/check_deps.js b/utils/check_deps.js index fc98b50e2b..d91f1bbb4c 100644 --- a/utils/check_deps.js +++ b/utils/check_deps.js @@ -36,7 +36,7 @@ async function checkDeps() { const testPackageJson = await innerCheckDeps(path.join(packagesDir, 'playwright-test'), true, true); let hasVersionMismatch = false; - for (const [key, value] of Object.entries(corePackageJson.dependencies)) { + for (const [key, value] of Object.entries(corePackageJson.dependencies || {})) { const value2 = testPackageJson.dependencies[key]; if (value2 && value2 !== value) { hasVersionMismatch = true;