From f7cf05ce4a6795ba9e0d1edf95e75aa74639d0ea Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Wed, 8 Nov 2023 19:36:56 +0100 Subject: [PATCH] docs: move ProductLauncher to abstract class (#11324) --- .../puppeteer.productlauncher.defaultargs.md | 2 +- ...uppeteer.productlauncher.executablepath.md | 2 +- docs/api/puppeteer.productlauncher.md | 2 +- .../src/node/ProductLauncher.ts | 22 +++++-------------- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/docs/api/puppeteer.productlauncher.defaultargs.md b/docs/api/puppeteer.productlauncher.defaultargs.md index 0c5499177e3..d1a20c47bd6 100644 --- a/docs/api/puppeteer.productlauncher.defaultargs.md +++ b/docs/api/puppeteer.productlauncher.defaultargs.md @@ -8,7 +8,7 @@ sidebar_label: ProductLauncher.defaultArgs ```typescript class ProductLauncher { - defaultArgs(object: BrowserLaunchArgumentOptions): string[]; + abstract defaultArgs(object: BrowserLaunchArgumentOptions): string[]; } ``` diff --git a/docs/api/puppeteer.productlauncher.executablepath.md b/docs/api/puppeteer.productlauncher.executablepath.md index 2b36d0d3cda..8d62389eda5 100644 --- a/docs/api/puppeteer.productlauncher.executablepath.md +++ b/docs/api/puppeteer.productlauncher.executablepath.md @@ -8,7 +8,7 @@ sidebar_label: ProductLauncher.executablePath ```typescript class ProductLauncher { - executablePath(channel?: ChromeReleaseChannel): string; + abstract executablePath(channel?: ChromeReleaseChannel): string; } ``` diff --git a/docs/api/puppeteer.productlauncher.md b/docs/api/puppeteer.productlauncher.md index f4eed461aec..dab0bbe489d 100644 --- a/docs/api/puppeteer.productlauncher.md +++ b/docs/api/puppeteer.productlauncher.md @@ -9,7 +9,7 @@ Describes a launcher - a class that is able to create and launch a browser insta #### Signature: ```typescript -export declare class ProductLauncher +export declare abstract class ProductLauncher ``` ## Remarks diff --git a/packages/puppeteer-core/src/node/ProductLauncher.ts b/packages/puppeteer-core/src/node/ProductLauncher.ts index 329b3ce489b..ef39c749eea 100644 --- a/packages/puppeteer-core/src/node/ProductLauncher.ts +++ b/packages/puppeteer-core/src/node/ProductLauncher.ts @@ -58,7 +58,7 @@ export interface ResolvedLaunchArgs { * * @public */ -export class ProductLauncher { +export abstract class ProductLauncher { #product: Product; /** @@ -201,15 +201,9 @@ export class ProductLauncher { return browser; } - executablePath(channel?: ChromeReleaseChannel): string; - executablePath(): string { - throw new Error('Not implemented'); - } + abstract executablePath(channel?: ChromeReleaseChannel): string; - defaultArgs(object: BrowserLaunchArgumentOptions): string[]; - defaultArgs(): string[] { - throw new Error('Not implemented'); - } + abstract defaultArgs(object: BrowserLaunchArgumentOptions): string[]; /** * Set only for Firefox, after the launcher resolves the `latest` revision to @@ -223,23 +217,17 @@ export class ProductLauncher { /** * @internal */ - protected async computeLaunchArguments( + protected abstract computeLaunchArguments( options: PuppeteerNodeLaunchOptions ): Promise; - protected async computeLaunchArguments(): Promise { - throw new Error('Not implemented'); - } /** * @internal */ - protected async cleanUserDataDir( + protected abstract cleanUserDataDir( path: string, opts: {isTemp: boolean} ): Promise; - protected async cleanUserDataDir(): Promise { - throw new Error('Not implemented'); - } /** * @internal