Skip to content

Commit

Permalink
Merge pull request #138 from rtritto/fix-xvfb-dep
Browse files Browse the repository at this point in the history
Change xvfb as optional peer dependency
  • Loading branch information
mdervisaygan authored Dec 27, 2024
2 parents 5eb38b3 + ef8e317 commit c7920f3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
9 changes: 7 additions & 2 deletions lib/cjs/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
var puppeteer = require("rebrowser-puppeteer-core");
const puppeteer = require("rebrowser-puppeteer-core");
const { pageController } = require("./module/pageController.js");
const Xvfb = require("xvfb");
let Xvfb
try {
Xvfb = require("xvfb");
} catch {
// ignore
}

async function connect({
args = [],
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/index.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { launch, Launcher } from "chrome-launcher";
import puppeteer from "rebrowser-puppeteer-core";
import { pageController } from "./module/pageController.mjs";
import Xvfb from "xvfb";

// process.env.REBROWSER_PATCHES_DEBUG=1
export async function connect({
Expand All @@ -20,6 +19,7 @@ export async function connect({

if (process.platform === "linux" && disableXvfb === false) {
try {
const { default: Xvfb } = await import("xvfb");
xvfbsession = new Xvfb({
silent: true,
xvfb_args: ["-screen", "0", "1920x1080x24", "-ac"],
Expand Down
19 changes: 16 additions & 3 deletions package-lock.json

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

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,19 @@
"ghost-cursor": "^1.3.0",
"puppeteer-extra": "^3.3.6",
"rebrowser-puppeteer-core": "^23.3.1",
"tree-kill": "^1.2.2",
"tree-kill": "^1.2.2"
},
"devDependencies": {
"xvfb": "^0.4.0"
},
"peerDependencies": {
"xvfb": "*"
},
"peerDependenciesMeta": {
"xvfb": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "https://github.com/zfcsoftware/puppeteer-real-browser"
Expand Down

0 comments on commit c7920f3

Please sign in to comment.