diff --git a/.appveyor.yml b/.appveyor.yml index 1ec90faa2b4da..5ca203000e12a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: - - nodejs_version: "8.16.0" - FLAKINESS_DASHBOARD_NAME: Appveyor Chromium (Win + node8) + - nodejs_version: "10.18.1" + FLAKINESS_DASHBOARD_NAME: Appveyor Chromium (Win + node10) FLAKINESS_DASHBOARD_PASSWORD: secure: g66jP+j6C+hkXLutBV9fdxB5fRJgcQQzy93SgQzXUmcCl/RjkJwnzyHvX0xfCVnv @@ -11,7 +11,7 @@ install: - ps: $env:FLAKINESS_DASHBOARD_BUILD_URL="https://ci.appveyor.com/project/aslushnikov/puppeteer/builds/$env:APPVEYOR_BUILD_ID/job/$env:APPVEYOR_JOB_ID" - ps: Install-Product node $env:nodejs_version - npm install - - if "%nodejs_version%" == "8.16.0" ( + - if "%nodejs_version%" == "10.18.1" ( npm run lint && npm run coverage && npm run test-doclint && diff --git a/.cirrus.yml b/.cirrus.yml index 6602841149337..ba7737ff5b431 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,9 +6,6 @@ env: task: matrix: - - name: Chromium (node8 + linux) - container: - dockerfile: .ci/node8/Dockerfile.linux - name: Chromium (node10 + linux) container: dockerfile: .ci/node10/Dockerfile.linux @@ -25,12 +22,12 @@ task: task: osx_instance: image: high-sierra-base - name: Chromium (node8 + macOS) + name: Chromium (node10 + macOS) env: HOMEBREW_NO_AUTO_UPDATE: 1 node_install_script: - - brew install node@8 - - brew link --force node@8 + - brew install node@10 + - brew link --force node@10 install_script: npm install --unsafe-perm lint_script: npm run lint coverage_script: npm run coverage diff --git a/.travis.yml b/.travis.yml index 6658abf275079..8b2e22eb1d923 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,24 +19,24 @@ before_install: - 'if [ "$FIREFOX" = "true" ]; then rm -rf $FIREFOX_HOME; mozdownload -t daily -d $FIREFOX_HOME/latest.tar.bz --log-level DEBUG; fi' - 'if [ "$FIREFOX" = "true" ]; then cd $FIREFOX_HOME; tar -xvf latest.tar.bz; cd -; ls $FIREFOX_HOME/firefox/firefox; fi' script: - - 'if [ "$NODE8" = "true" ]; then npm run lint; fi' - - 'if [ "$NODE8" = "true" ]; then npm run coverage; fi' + - 'if [ "$NODE10" = "true" ]; then npm run lint; fi' + - 'if [ "$NODE10" = "true" ]; then npm run coverage; fi' - 'if [ "$FIREFOX" = "true" ]; then BINARY=$FIREFOX_HOME/firefox/firefox npm run funit; fi' - - 'if [ "$NODE8" = "true" ]; then npm run test-doclint; fi' - - 'if [ "$NODE8" = "true" ]; then npm run test-types; fi' - - 'if [ "$NODE8" = "true" ]; then npm run bundle; fi' - - 'if [ "$NODE8" = "true" ]; then npm run unit-bundle; fi' + - 'if [ "$NODE10" = "true" ]; then npm run test-doclint; fi' + - 'if [ "$NODE10" = "true" ]; then npm run test-types; fi' + - 'if [ "$NODE10" = "true" ]; then npm run bundle; fi' + - 'if [ "$NODE10" = "true" ]; then npm run unit-bundle; fi' jobs: include: - - node_js: "8.16.0" + - node_js: "10.18.1" env: - - NODE8=true - - FLAKINESS_DASHBOARD_NAME="Travis Chromium (node8 + linux)" + - NODE10=true + - FLAKINESS_DASHBOARD_NAME="Travis Chromium (node10 + linux)" - FLAKINESS_DASHBOARD_BUILD_URL="${TRAVIS_JOB_WEB_URL}" - - node_js: "8.16.0" + - node_js: "10.18.1" env: - FIREFOX=true - - FLAKINESS_DASHBOARD_NAME="Travis Firefox Nightly (node8 + linux)" + - FLAKINESS_DASHBOARD_NAME="Travis Firefox Nightly (node10 + linux)" - FLAKINESS_DASHBOARD_BUILD_URL="${TRAVIS_JOB_WEB_URL}" - FIREFOX_HOME=$TRAVIS_HOME/firefox-latest before_deploy: "npm run apply-next-version" @@ -47,6 +47,6 @@ deploy: secure: Ng8o2KwJf90XCBNgUKK3jRZnwtdBSJatjYNmZBERJEqBWFTadFAp1NdhxZaqjnuG8aFYaH5bRJdL+EQBYUksVCbrv/gcaXeEFkwsfPfVX1QXGqu7NnZmtme2hbxppLQ7dEJ8hz2Z9K4vehqVOxmLabxvoupOumxEQMLCphVHh2FOmsm/S5JrRZqZ4V9k76eIc0/PiyfXNMdx5WTZjHbIRDIHRy9nqOXjFp2Rx3PMa3uU2fS8mTshYEYs151TA6e6VdHjqmBwEQC/M5tXbDlLCMNUr4JBtLTcL4OipNYjzkwD1N2xYlbSRqtvqqF4ifdvFhoI65a31GinlMC7Z/SH1Zy+d+/z3Mo7D63eYcsJVnsg9OYxTFy2piUntr0JqTBHtQoe/CvGxJmkcVt+H6YSkcBibSG9s9tG3qpAD5wBCFqqOYnfClX+YZziEd+Hngd9inxAf87qdvgVIZ5tPD2dygtE+te2/qoEHtvccv/HuS8MxNj5iKwlP7JaBPM6uAkazYqZP2R99I2ph9gNOEVuQLtk+3+OIdb8HWrEKUrJBgKhdKY1dvcKYElI+D8NRlyzrr6BnZfudACuAt2EtfKpfJ3mL+iRMFdBJ3ntLt93xBrB+j4z3pD0iWZcg1g3I742PFzQEHzyd/DDTP1yRTUoJeQWwoQRJyNO1m6Qk4wx77c= on: branch: master - condition: "$NODE8 = true" + condition: "$NODE10 = true" skip_cleanup: true tag: next diff --git a/README.md b/README.md index eb95fb523e451..f4f3196c7ab84 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ See [puppeteer vs puppeteer-core](https://github.com/puppeteer/puppeteer/blob/ma Puppeteer follows the latest [maintenance LTS](https://github.com/nodejs/Release#release-schedule) version of Node. -Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. All subsequent versions rely on -Node 8.9.0+. All examples below use async/await which is only supported in Node v7.6.0 or greater. +Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. Versions from v1.18.1 to v2.1.0 rely on +Node 8.9.0+. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. All examples below use async/await which is only supported in Node v7.6.0 or greater. Puppeteer will be familiar to people using other browser testing frameworks. You create an instance of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v2.1.1/docs/api.md#). diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index bebf9e98a3ee7..be5d45dbbdc62 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -249,7 +249,7 @@ Running Puppeteer smoothly on CircleCI requires the following steps: ## Running Puppeteer in Docker -> 👋 We use [Cirrus Ci](https://cirrus-ci.org/) to run our tests for Puppeteer in a Docker container - see our [`Dockerfile.linux`](https://github.com/puppeteer/puppeteer/blob/master/.ci/node8/Dockerfile.linux) for reference. +> 👋 We use [Cirrus Ci](https://cirrus-ci.org/) to run our tests for Puppeteer in a Docker container - see our [`Dockerfile.linux`](https://github.com/puppeteer/puppeteer/blob/master/.ci/node10/Dockerfile.linux) for reference. Getting headless Chrome up and running in Docker can be tricky. The bundled Chromium that Puppeteer installs is missing the necessary @@ -398,9 +398,9 @@ To use `puppeteer`, simply list the module as a dependency in your `package.json ### Running Puppeteer on Google Cloud Functions -The Node.js 8 runtime of [Google Cloud Functions](https://cloud.google.com/functions/docs/) comes with all system packages needed to run Headless Chrome. +The Node.js 10 runtime of [Google Cloud Functions](https://cloud.google.com/functions/docs/) comes with all system packages needed to run Headless Chrome. -To use `puppeteer`, simply list the module as a dependency in your `package.json` and deploy your function to Google Cloud Functions using the `nodejs8` runtime. +To use `puppeteer`, simply list the module as a dependency in your `package.json` and deploy your function to Google Cloud Functions using the `nodejs10` runtime. ### Running Puppeteer on Heroku diff --git a/.ci/node8/Dockerfile.linux b/experimental/puppeteer-firefox/.ci/node10/Dockerfile.linux similarity index 96% rename from .ci/node8/Dockerfile.linux rename to experimental/puppeteer-firefox/.ci/node10/Dockerfile.linux index 26f1197984585..7c3d3ce0fedcb 100644 --- a/.ci/node8/Dockerfile.linux +++ b/experimental/puppeteer-firefox/.ci/node10/Dockerfile.linux @@ -1,4 +1,4 @@ -FROM node:8.11.3 +FROM node:10.18.1-stretch RUN apt-get update && \ apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ diff --git a/experimental/puppeteer-firefox/.ci/node8/Dockerfile.windows b/experimental/puppeteer-firefox/.ci/node10/Dockerfile.windows similarity index 94% rename from experimental/puppeteer-firefox/.ci/node8/Dockerfile.windows rename to experimental/puppeteer-firefox/.ci/node10/Dockerfile.windows index d931548d28843..8494e332e7da3 100644 --- a/experimental/puppeteer-firefox/.ci/node8/Dockerfile.windows +++ b/experimental/puppeteer-firefox/.ci/node10/Dockerfile.windows @@ -1,6 +1,6 @@ FROM microsoft/windowsservercore:latest -ENV NODE_VERSION 8.11.3 +ENV NODE_VERSION 10.18.1 RUN setx /m PATH "%PATH%;C:\nodejs" diff --git a/experimental/puppeteer-firefox/.ci/node6/Dockerfile.linux b/experimental/puppeteer-firefox/.ci/node6/Dockerfile.linux deleted file mode 100644 index 77b416735d9db..0000000000000 --- a/experimental/puppeteer-firefox/.ci/node6/Dockerfile.linux +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:6.12.3 - -RUN apt-get update && \ - apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ - libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \ - libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \ - libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ - libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \ - rm -rf /var/lib/apt/lists/* - -# Add user so we don't need --no-sandbox. -RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ - && mkdir -p /home/pptruser/Downloads \ - && chown -R pptruser:pptruser /home/pptruser - -# Run everything after as non-privileged user. -USER pptruser diff --git a/experimental/puppeteer-firefox/.ci/node8/Dockerfile.linux b/experimental/puppeteer-firefox/.ci/node8/Dockerfile.linux deleted file mode 100644 index bb4da3af0a4fd..0000000000000 --- a/experimental/puppeteer-firefox/.ci/node8/Dockerfile.linux +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:8.11.3-stretch - -RUN apt-get update && \ - apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ - libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \ - libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \ - libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ - libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \ - rm -rf /var/lib/apt/lists/* - -# Add user so we don't need --no-sandbox. -RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ - && mkdir -p /home/pptruser/Downloads \ - && chown -R pptruser:pptruser /home/pptruser - -# Run everything after as non-privileged user. -USER pptruser diff --git a/experimental/puppeteer-firefox/.cirrus.yml b/experimental/puppeteer-firefox/.cirrus.yml index dc0ec87a9c42c..ce31e5c4065a9 100644 --- a/experimental/puppeteer-firefox/.cirrus.yml +++ b/experimental/puppeteer-firefox/.cirrus.yml @@ -2,30 +2,30 @@ env: DISPLAY: :99.0 task: - name: node8 (linux) + name: node10 (linux) container: - dockerfile: .ci/node8/Dockerfile.linux + dockerfile: .ci/node10/Dockerfile.linux xvfb_start_background_script: Xvfb :99 -ac -screen 0 1024x768x24 install_script: npm install test_script: npm run fjunit task: - name: node8 (macOS) + name: node10 (macOS) osx_instance: image: high-sierra-base env: HOMEBREW_NO_AUTO_UPDATE: 1 node_install_script: - - brew install node@8 - - brew link --force node@8 + - brew install node@10 + - brew link --force node@10 install_script: npm install test_script: npm run fjunit # task: # allow_failures: true # windows_container: -# dockerfile: .ci/node8/Dockerfile.windows +# dockerfile: .ci/node10/Dockerfile.windows # os_version: 2016 -# name: node8 (windows) +# name: node10 (windows) # install_script: npm install --unsafe-perm # test_script: npm run fjunit diff --git a/experimental/puppeteer-firefox/package.json b/experimental/puppeteer-firefox/package.json index eb511fdcd01fb..ef5947a45b6ce 100644 --- a/experimental/puppeteer-firefox/package.json +++ b/experimental/puppeteer-firefox/package.json @@ -6,7 +6,7 @@ "repository": "github:puppeteer/puppeteer", "homepage": "https://github.com/puppeteer/puppeteer/tree/master/experimental/puppeteer-firefox", "engines": { - "node": ">=8.9.4" + "node": ">=10.18.1" }, "puppeteer": { "firefox_revision": "v0.0.1" diff --git a/lib/Launcher.js b/lib/Launcher.js index df89588e34f52..2c4f238f1d882 100644 --- a/lib/Launcher.js +++ b/lib/Launcher.js @@ -168,7 +168,9 @@ class BrowserRunner { const transport = await WebSocketTransport.create(browserWSEndpoint); this.connection = new Connection(browserWSEndpoint, transport, slowMo); } else { - const transport = new PipeTransport(/** @type {!NodeJS.WritableStream} */(this.proc.stdio[3]), /** @type {!NodeJS.ReadableStream} */ (this.proc.stdio[4])); + // stdio was assigned during start(), and the 'pipe' option there adds the 4th and 5th items to stdio array + const { 3: pipeWrite, 4: pipeRead } = /** @type {!Array} */ (this.proc.stdio); + const transport = new PipeTransport(/** @type {!NodeJS.WritableStream} */ pipeWrite, /** @type {!NodeJS.ReadableStream} */ pipeRead); this.connection = new Connection('', transport, slowMo); } return this.connection; diff --git a/package.json b/package.json index 72a24b3dd0047..3f44c6e2b79b9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "repository": "github:puppeteer/puppeteer", "engines": { - "node": ">=8.16.0" + "node": ">=10.18.1" }, "puppeteer": { "chromium_revision": "722234" @@ -23,7 +23,7 @@ "tsc": "tsc -p .", "apply-next-version": "node utils/apply_next_version.js", "bundle": "npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js", - "test-types": "node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/", + "test-types": "node utils/doclint/generate_types && npx -p typescript@3.2 tsc -p utils/doclint/generate_types/test/", "unit-bundle": "node utils/browser/test.js" }, "author": "The Chromium Authors", @@ -44,7 +44,7 @@ "@types/debug": "0.0.31", "@types/extract-zip": "^1.6.2", "@types/mime": "^2.0.0", - "@types/node": "^8.10.34", + "@types/node": "^10.17.14", "@types/rimraf": "^2.0.2", "@types/ws": "^6.0.1", "commonmark": "^0.28.1",