🎥 Make videos programmatically with React
Revert "condense"
Jonny Burgerc4c253185c64
diff --git a/packages/renderer/src/browser/BrowserRunner.ts b/packages/renderer/src/browser/BrowserRunner.tsindex 2068160c6a..e9c0c68e55 100644--- a/packages/renderer/src/browser/BrowserRunner.ts+++ b/packages/renderer/src/browser/BrowserRunner.ts@@ -76,7 +76,8 @@ export class BrowserRunner {}start(options: LaunchOptions): void {- const {handleSIGINT, handleSIGTERM, handleSIGHUP, dumpio, pipe} = options;+ const {handleSIGINT, handleSIGTERM, handleSIGHUP, dumpio, env, pipe} =+ options;let stdio: Array<'ignore' | 'pipe'>;if (pipe) {if (dumpio) {@@ -100,8 +101,8 @@ export class BrowserRunner {// process tree with `.kill(-pid)` command. @see// https://nodejs.org/api/child_process.html#child_process_options_detacheddetached: process.platform !== 'win32',+ env,stdio,- env: process.env,});if (dumpio) {diff --git a/packages/renderer/src/browser/LaunchOptions.ts b/packages/renderer/src/browser/LaunchOptions.tsindex e3f34ae861..e7048f9cb4 100644--- a/packages/renderer/src/browser/LaunchOptions.ts+++ b/packages/renderer/src/browser/LaunchOptions.ts@@ -19,8 +19,16 @@ import type {Product} from './Product';export interface BrowserLaunchArgumentOptions {headless?: boolean | 'chrome';+ userDataDir?: string;+ devtools?: boolean;+ debuggingPort?: number;args: string[];}+export type ChromeReleaseChannel =+ | 'chrome'+ | 'chrome-beta'+ | 'chrome-canary'+ | 'chrome-dev';export interface LaunchOptions {executablePath?: string;@@ -29,6 +37,7 @@ export interface LaunchOptions {handleSIGHUP?: boolean;timeout?: number;dumpio?: boolean;+ env?: Record<string, string | undefined>;pipe?: boolean;product?: Product;extraPrefsFirefox?: Record<string, unknown>;diff --git a/packages/renderer/src/browser/Launcher.ts b/packages/renderer/src/browser/Launcher.tsindex edccf124c9..5b609b58d0 100644--- a/packages/renderer/src/browser/Launcher.ts+++ b/packages/renderer/src/browser/Launcher.ts@@ -56,11 +56,13 @@ class ChromeLauncher implements ProductLauncher {dumpio = false,executablePath,pipe = false,+ env = process.env,handleSIGINT = true,handleSIGTERM = true,handleSIGHUP = true,defaultViewport,timeout = 30000,+ debuggingPort,} = options;const chromeArguments = args;@@ -71,7 +73,13 @@ class ChromeLauncher implements ProductLauncher {})) {if (pipe) {+ assert(+ !debuggingPort,+ 'Browser should be launched with either pipe or debugging port - not both.'+ );chromeArguments.push('--remote-debugging-pipe');+ } else {+ chromeArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);}}@@ -121,6 +129,7 @@ class ChromeLauncher implements ProductLauncher {handleSIGTERM,handleSIGINT,dumpio,+ env,pipe: false,});@@ -177,12 +186,14 @@ class FirefoxLauncher implements ProductLauncher {const {dumpio = false,executablePath = null,+ env = process.env,handleSIGINT = true,handleSIGTERM = true,handleSIGHUP = true,defaultViewport,timeout = 30000,extraPrefsFirefox = {},+ debuggingPort = null,} = options;const firefoxArguments = [];@@ -193,7 +204,7 @@ class FirefoxLauncher implements ProductLauncher {return argument.startsWith('--remote-debugging-');})) {- firefoxArguments.push(`--remote-debugging-port=0`);+ firefoxArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);}let userDataDir: string | undefined;@@ -249,6 +260,7 @@ class FirefoxLauncher implements ProductLauncher {handleSIGTERM,handleSIGINT,dumpio,+ env,});let browser;@@ -307,7 +319,12 @@ class FirefoxLauncher implements ProductLauncher {}defaultArgs(options: BrowserLaunchArgumentOptions): string[] {- const {headless = true, args = []} = options;+ const {+ devtools = false,+ headless = !devtools,+ args = [],+ userDataDir = null,+ } = options;const firefoxArguments = ['--no-remote'];@@ -317,10 +334,19 @@ class FirefoxLauncher implements ProductLauncher {firefoxArguments.push('--wait-for-browser');}+ if (userDataDir) {+ firefoxArguments.push('--profile');+ firefoxArguments.push(userDataDir);+ }+if (headless) {firefoxArguments.push('--headless');}+ if (devtools) {+ firefoxArguments.push('--devtools');+ }+if (args.every((arg) => {return arg.startsWith('-');