From b63114df4bd431aebce86e5a124a3f727d5ab0f4 Mon Sep 17 00:00:00 2001 From: Kyle McNally Date: Wed, 17 Jul 2024 09:49:05 -0400 Subject: [PATCH] remove opinionated viewport --- README.md | 9 ++++++++- source/index.ts | 48 +----------------------------------------------- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index f02483e..2952b58 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,14 @@ test("Check the page title of example.com", async (t) => { args: chromium.args, headless: "shell", }), - defaultViewport: chromium.defaultViewport, + defaultViewport: { + deviceScaleFactor: 1, + hasTouch: false, + height: 1080, + isLandscape: true, + isMobile: false, + width: 1920, + }, executablePath: await chromium.executablePath(), headless: "shell", }); diff --git a/source/index.ts b/source/index.ts index 979f3bc..3ef1dfe 100644 --- a/source/index.ts +++ b/source/index.ts @@ -17,39 +17,7 @@ import { } from "./helper"; import { inflate } from "./lambdafs"; -/** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */ -interface Viewport { - /** - * Specify device scale factor. - * See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio} for more info. - * @default 1 - */ - deviceScaleFactor?: number; - /** - * Specify if the viewport supports touch events. - * @default false - */ - hasTouch?: boolean; - /** - * The page height in pixels. - */ - height: number; - /** - * Specifies if the viewport is in landscape mode. - * @default false - */ - isLandscape?: boolean; - /** - * Whether the `meta viewport` tag is taken into account. - * @default false - */ - isMobile?: boolean; - /** - * The page width in pixels. - */ - width: number; -} - +// Set up the environmental variables if (isRunningInAwsLambda()) { if (process.env["FONTCONFIG_PATH"] === undefined) { process.env["FONTCONFIG_PATH"] = "/tmp/fonts"; @@ -156,20 +124,6 @@ class Chromium { ]; } - /** - * Returns sensible default viewport settings for serverless environments. - */ - static get defaultViewport(): Required { - return { - deviceScaleFactor: 1, - hasTouch: false, - height: 1080, - isLandscape: true, - isMobile: false, - width: 1920, - }; - } - /** * Inflates the included version of Chromium * @param input The location of the `bin` folder