chore: import BiDi impl only if the user opts in (#9335)
This commit is contained in:
parent
c77b7299e2
commit
e8c1d56845
@ -20,7 +20,7 @@ import * as path from 'path';
|
||||
import * as readline from 'readline';
|
||||
import removeFolder from 'rimraf';
|
||||
import {promisify} from 'util';
|
||||
import {Connection as BiDiConnection} from '../common/bidi/Connection.js';
|
||||
import type {Connection as BiDiConnection} from '../common/bidi/bidi.js';
|
||||
import {Connection} from '../common/Connection.js';
|
||||
import {debug} from '../common/Debug.js';
|
||||
import {TimeoutError} from '../common/Errors.js';
|
||||
@ -262,7 +262,8 @@ export class BrowserRunner {
|
||||
);
|
||||
browserWSEndpoint += '/session';
|
||||
const transport = await WebSocketTransport.create(browserWSEndpoint);
|
||||
return new BiDiConnection(transport, slowMo);
|
||||
const BiDi = await import('../common/bidi/bidi.js');
|
||||
return new BiDi.Connection(transport, slowMo);
|
||||
}
|
||||
|
||||
async setupConnection(options: {
|
||||
|
@ -2,7 +2,6 @@ import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import {Browser} from '../api/Browser.js';
|
||||
import {Browser as BiDiBrowser} from '../common/bidi/Browser.js';
|
||||
import {CDPBrowser} from '../common/Browser.js';
|
||||
import {assert} from '../util/assert.js';
|
||||
import {BrowserFetcher} from './BrowserFetcher.js';
|
||||
@ -133,7 +132,8 @@ export class FirefoxLauncher extends ProductLauncher {
|
||||
slowMo,
|
||||
preferredRevision: this.puppeteer.browserRevision,
|
||||
});
|
||||
browser = await BiDiBrowser.create({
|
||||
const BiDi = await import('../common/bidi/bidi.js');
|
||||
browser = await BiDi.Browser.create({
|
||||
connection,
|
||||
closeCallback: runner.close.bind(runner),
|
||||
process: runner.proc,
|
||||
|
Loading…
Reference in New Issue
Block a user