Skip to content

🎥 Make videos programmatically with React

remove 'Product'

Jonny Burger2682352138ba
diff --git a/packages/renderer/src/browser/LaunchOptions.ts b/packages/renderer/src/browser/LaunchOptions.ts
index 1052de84ae..440ca71d09 100644
--- a/packages/renderer/src/browser/LaunchOptions.ts
+++ b/packages/renderer/src/browser/LaunchOptions.ts
@@ -16,7 +16,6 @@
import type {LogLevel} from '../log-level';
import type {BrowserConnectOptions} from './BrowserConnector';
-import type {Product} from './Product';
export interface BrowserLaunchArgumentOptions {
headless?: boolean | 'chrome';
@@ -32,7 +31,6 @@ export interface LaunchOptions {
dumpio?: boolean;
logLevel: LogLevel;
env?: Record<string, string | undefined>;
- product?: Product;
indent: boolean;
}
diff --git a/packages/renderer/src/browser/Launcher.ts b/packages/renderer/src/browser/Launcher.ts
index 4182226862..8ba9f4e95b 100644
--- a/packages/renderer/src/browser/Launcher.ts
+++ b/packages/renderer/src/browser/Launcher.ts
@@ -23,7 +23,6 @@ import {BrowserRunner} from './BrowserRunner';
import type {PuppeteerNodeLaunchOptions} from './LaunchOptions';
import {getRevisionInfo} from './BrowserFetcher';
-import type {Product} from './Product';
const tmpDir = () => {
return process.env.PUPPETEER_TMP_DIR || os.tmpdir();
@@ -32,7 +31,6 @@ const tmpDir = () => {
export interface ProductLauncher {
launch(object: PuppeteerNodeLaunchOptions): Promise<HeadlessBrowser>;
executablePath: (path?: any) => string;
- product: Product;
}
export class ChromeLauncher implements ProductLauncher {
@@ -67,7 +65,7 @@ export class ChromeLauncher implements ProductLauncher {
let chromeExecutable = executablePath;
if (!chromeExecutable) {
- const {missingText, executablePath: exPath} = resolveExecutablePath(this);
+ const {missingText, executablePath: exPath} = resolveExecutablePath();
if (missingText) {
throw new Error(missingText);
}
@@ -118,29 +116,19 @@ export class ChromeLauncher implements ProductLauncher {
}
executablePath(): string {
- const results = resolveExecutablePath(this);
+ const results = resolveExecutablePath();
return results.executablePath;
}
-
- get product(): Product {
- return 'chrome';
- }
}
-function resolveExecutablePath(launcher: ChromeLauncher): {
+function resolveExecutablePath(): {
executablePath: string;
missingText?: string;
} {
- const {product} = launcher;
-
const revisionInfo = getRevisionInfo();
- const firefoxHelp = `Run \`PUPPETEER_PRODUCT=firefox npm install\` to download a supported Firefox browser binary.`;
- const chromeHelp = `Run \`npm install\` to download the correct Chromium revision.`;
const missingText = revisionInfo.local
? undefined
- : `Could not find expected browser (${product}) locally. ${
- product === 'chrome' ? chromeHelp : firefoxHelp
- }`;
+ : `Could not find expected browser locally.`;
return {executablePath: revisionInfo.executablePath, missingText};
}
diff --git a/packages/renderer/src/browser/Product.ts b/packages/renderer/src/browser/Product.ts
deleted file mode 100644
index 7a7e0751a2..0000000000
--- a/packages/renderer/src/browser/Product.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2020 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type Product = 'chrome';
diff --git a/packages/renderer/src/browser/PuppeteerNode.ts b/packages/renderer/src/browser/PuppeteerNode.ts
index 65ef4e8f56..a3425f2582 100644
--- a/packages/renderer/src/browser/PuppeteerNode.ts
+++ b/packages/renderer/src/browser/PuppeteerNode.ts
@@ -22,13 +22,11 @@ import type {
BrowserLaunchArgumentOptions,
LaunchOptions,
} from './LaunchOptions';
-import type {Product} from './Product';
interface PuppeteerLaunchOptions
extends LaunchOptions,
BrowserLaunchArgumentOptions,
BrowserConnectOptions {
- product?: Product;
extraPrefsFirefox?: Record<string, unknown>;
}
@@ -55,8 +53,4 @@ export class PuppeteerNode {
return this.#lazyLauncher;
}
-
- get product(): string {
- return this._launcher.product;
- }
}
diff --git a/packages/renderer/src/open-browser.ts b/packages/renderer/src/open-browser.ts
index ebd1ca49e1..3a464d86e7 100644
--- a/packages/renderer/src/open-browser.ts
+++ b/packages/renderer/src/open-browser.ts
@@ -90,7 +90,6 @@ export const internalOpenBrowser = async ({
const browserInstance = await puppeteer.launch({
executablePath,
- product: browser,
dumpio: isEqualOrBelowLogLevel(logLevel, 'verbose'),
logLevel,
indent,