Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(agnostification): split up root Puppeteer class #6504

Merged
merged 1 commit into from Oct 13, 2020

Conversation

jackfranklin
Copy link
Collaborator

The Puppeteer class had two concerns:

  • connect to an existing browser
  • launch a new browser

The first of those concerns is needed in all environments, but the
second is only needed in Node.
#6484 landing enabled us to
pull the Puppeteer class apart into two:

  1. Puppeteer which hosts the behaviour for connecting to existing
    browsers.
  2. PuppeteerNode, which extends Puppeteer and also adds the ability
    to launch a new browser.

This is a non-breaking change, because Node users will still get an
instance of a class with all the methods they expect, but it'll be a
PuppeteerNode rather than Puppeteer. I don't expect this to cause
people any issues.

We also now have new files that are effectively the entry points for
Puppeteer:

  • node.ts: the main entry point for Puppeteer on Node.
  • web.ts: the main entry point for Puppeteer on the web.
  • node-puppeteer-core.ts: for those using puppeteer-core (which only
    exists in Node, not on the web).

@jackfranklin
Copy link
Collaborator Author

jackfranklin commented Oct 12, 2020

Puppeteer Node vs Browser entry points (1)

I drew this diagram as it might help visualise the entry points for each environment.

Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loved the diagram!

@jackfranklin jackfranklin force-pushed the split-up-pptr-class branch 4 times, most recently from dae61eb to 3b515e4 Compare October 13, 2020 14:36
The `Puppeteer` class had two concerns:

* connect to an existing browser
* launch a new browser

The first of those concerns is needed in all environments, but the
second is only needed in Node.
#6484 landing enabled us to
pull the `Puppeteer` class apart into two:

1. `Puppeteer` which hosts the behaviour for connecting to existing
   browsers.
2. `PuppeteerNode`, which extends `Puppeteer` and also adds the ability
   to launch a new browser.

This is a non-breaking change, because Node users will still get an
instance of a class with all the methods they expect, but it'll be a
`PuppeteerNode` rather than `Puppeteer`. I don't expect this to cause
people any issues.

We also now have new files that are effectively the entry points for
Puppeteer:

* `node.ts`: the main entry point for Puppeteer on Node.
* `web.ts`: the main entry point for Puppeteer on the web.
* `node-puppeteer-core.ts`: for those using puppeteer-core (which only
  exists in Node, not on the web).
@jackfranklin jackfranklin merged commit e655bb6 into main Oct 13, 2020
@jackfranklin jackfranklin deleted the split-up-pptr-class branch October 13, 2020 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants