Skip to content

Commit

Permalink
fix: make chromium-bidi an opt peer dep (#9667)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Feb 14, 2023
1 parent eb13863 commit c6054ac
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
16 changes: 12 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/puppeteer-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
"author": "The Chromium Authors",
"license": "Apache-2.0",
"dependencies": {
"chromium-bidi": "0.4.3",
"cross-fetch": "3.1.5",
"debug": "4.3.4",
"devtools-protocol": "0.0.1094867",
Expand All @@ -144,11 +143,15 @@
"ws": "8.11.0"
},
"peerDependencies": {
"typescript": ">= 4.7.4"
"typescript": ">= 4.7.4",
"chromium-bidi": "0.4.3"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
},
"chromium-bidi": {
"optional": true
}
}
}
4 changes: 3 additions & 1 deletion packages/puppeteer-core/src/node/BrowserRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ export class BrowserRunner {
);
browserWSEndpoint += '/session';
const transport = await WebSocketTransport.create(browserWSEndpoint);
const BiDi = await import('../common/bidi/bidi.js');
const BiDi = await import(
/* webpackIgnore: true */ '../common/bidi/bidi.js'
);
return new BiDi.Connection(transport, slowMo);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/puppeteer-core/src/node/ChromeLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ export class ChromeLauncher extends ProductLauncher {

if (protocol === 'webDriverBiDi') {
try {
const BiDi = await import('../common/bidi/bidi.js');
const BiDi = await import(
/* webpackIgnore: true */ '../common/bidi/bidi.js'
);
const bidiConnection = await BiDi.connectBidiOverCDP(connection);
browser = await BiDi.Browser.create({
connection: bidiConnection,
Expand Down
4 changes: 3 additions & 1 deletion packages/puppeteer-core/src/node/FirefoxLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export class FirefoxLauncher extends ProductLauncher {
slowMo,
preferredRevision: this.puppeteer.browserRevision,
});
const BiDi = await import('../common/bidi/bidi.js');
const BiDi = await import(
/* webpackIgnore: true */ '../common/bidi/bidi.js'
);
browser = await BiDi.Browser.create({
connection,
closeCallback: runner.close.bind(runner),
Expand Down

0 comments on commit c6054ac

Please sign in to comment.