diff --git a/Makefile b/Makefile index 303db64..e75c6e7 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ test: npm install --fund=false --package-lock=false npm run build mkdir -p nodejs - npm install --prefix nodejs/ tar-fs@3.0.4 follow-redirects@1.15.5 --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false + npm install --prefix nodejs/ tar-fs@3.0.5 follow-redirects@1.15.5 --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false npm pack mkdir -p nodejs/node_modules/@sparticuz/chromium/ tar --directory nodejs/node_modules/@sparticuz/chromium/ --extract --file sparticuz-chromium-*.tgz --strip-components=1 diff --git a/README.md b/README.md index 37c9659..3c008ca 100644 --- a/README.md +++ b/README.md @@ -258,8 +258,8 @@ By default, this package uses `swiftshader`/`angle` to do CPU acceleration for W | `args` | `Array` | Provides a list of recommended additional [Chromium flags](https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md). | | `defaultViewport` | `Object` | Returns a sensible default viewport for serverless. | | `executablePath(location?: string)` | `Promise` | Returns the path the Chromium binary was extracted to. | -| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"new"` | -| `headless` | `true \| "new"` | Returns `true` or `"new"` depending on what version of chrome's headless you are running | +| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"chrome-headless-shell"` | +| `headless` | `true \| "chrome-headless-shell"` | Returns `true` or `"chrome-headless-shell"` depending on what version of chrome's headless you are running | | `setGraphicsMode` | `void` | Sets the graphics mode to either `true` or `false` | | `graphics` | `boolean` | Returns a boolean depending on whether webgl is enabled or disabled | diff --git a/_/amazon/handlers/index.js b/_/amazon/handlers/index.js index 46c065f..f6a5124 100644 --- a/_/amazon/handlers/index.js +++ b/_/amazon/handlers/index.js @@ -21,7 +21,7 @@ exports.handler = async (event, context) => { const contexts = [browser.defaultBrowserContext()]; while (contexts.length < event.length) { - contexts.push(await browser.createIncognitoBrowserContext()); + contexts.push(await browser.createBrowserContext()); } for (let context of contexts) { diff --git a/source/index.ts b/source/index.ts index ffd027b..569f030 100644 --- a/source/index.ts +++ b/source/index.ts @@ -93,7 +93,7 @@ class Chromium { * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless * @values true or "new" */ - private static headlessMode: true | "new" = "new"; + private static headlessMode: true | "chrome-headless-shell" = "chrome-headless-shell"; /** * If true, the graphics stack and webgl is enabled, @@ -254,7 +254,7 @@ class Chromium { ]; const headlessFlags = [ - this.headless === "new" ? "--headless='new'" : "--headless", + this.headless === "chrome-headless-shell" ? "--headless='chrome-headless-shell'" : "--headless", ]; return [ @@ -349,10 +349,10 @@ class Chromium { /** * Returns the headless mode. - * `true` means the 'old' (legacy, chromium < 112) headless mode. - * "new" means the 'new' headless mode. + * "chrome-headless-shell" means the 'old' (legacy, chromium < 112) headless mode. + * `true` means the 'new' headless mode. * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless - * @returns true | "new" + * @returns true | "chrome-headless-shell" */ public static get headless() { return this.headlessMode; @@ -360,18 +360,18 @@ class Chromium { /** * Sets the headless mode. - * `true` means the 'old' (legacy, chromium < 112) headless mode. - * "new" means the 'new' headless mode. + * "chrome-headless-shell" means the 'old' (legacy, chromium < 112) headless mode. + * `true` means the 'new' headless mode. * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless - * @default "new" + * @default "chrome-headless-shell" */ - public static set setHeadlessMode(value: true | "new") { + public static set setHeadlessMode(value: true | "chrome-headless-shell") { if ( - (typeof value === "string" && value !== "new") || + (typeof value === "string" && value !== "chrome-headless-shell") || (typeof value === "boolean" && value !== true) ) { throw new Error( - `Headless mode must be either \`true\` or 'new', you entered '${value}'` + `Headless mode must be either \`true\` or 'chrome-headless-shell', you entered '${value}'` ); } this.headlessMode = value;