Commit Graph

11 Commits

Author SHA1 Message Date
jrandolf
465a7c405f
feat: export puppeteer methods (#8493) 2022-06-09 19:00:50 +02:00
jrandolf
6841bd68d8
feat: support ES modules (#8306) 2022-05-09 11:17:24 +00:00
Alex Rudenko
179ededa14
revert: esm modules (#7996)
* Revert "fix(puppeteer): export internals (#7991)"

This reverts commit 448118cbdb.

* Revert "feat(puppeteer): export esm modules in package.json (#7964)"

This reverts commit 523b487e88.
2022-02-10 13:34:36 +00:00
jrandolf
448118cbdb
fix(puppeteer): export internals (#7991)
Signed-off-by: Randolf Jung <jrandolf@chromium.org>

Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-10 10:59:24 +00:00
jrandolf
523b487e88
feat(puppeteer): export esm modules in package.json (#7964)
* feat(puppeteer): export esm modules in package.json

Signed-off-by: Randolf Jung <jrandolf@chromium.org>

Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-09 07:47:27 +00:00
Maja Frydrychowicz
996e82c7aa
test(install): check for Firefox binary, clean up messages (#6316) 2020-08-10 10:22:31 +02:00
Jack Franklin
9d79cc89cb
chore: fix Firefox install checker (#6129)
I think when the FF version changes this check breaks - let's just make
it check that a version installed rather than the specific version else
this will happen on a continuing basis.
2020-06-30 15:52:53 +01:00
Jack Franklin
1f5e333f00
chore: Don't store revisions in package.json (#6109)
* chore: Don't store revisions in `package.json`

It's quite messy to have to require the `package.json` file in multiple
places purely to find out what revision of a given browser we want to
use. We can also achieve better type safety by placing it in an actual
source file.

This commit makes that change and also tidies up our reliance on
`package.json` within the source code generally; we now only use it to
find the location of the Puppeteer root such that we know where to
install downloaded browsers to.

To avoid using `package.json` to parse the name of the module, we also
now explicitly have an entry point for the Puppeteer module and the
Puppeter Core module. This will make it easier in the future to ship
less code as part of core (e.g. core never needs to download a browser,
so why ship that code?). Core can also then not have any revisions based
info contained in it.

The test install script has also been updated to ensure that
puppeteer-core can be installed correctly too.

Finally, the `install` script has been moved to TypeScript for nicer
typechecking and safety. The functionality of it has not changed.
2020-06-29 16:13:24 +01:00
Jack Franklin
1c0009d2c0
chore(agnostic): ship CJS and ESM builds (#6095)
* chore(agnostic): ship CJS and ESM builds

For our work to enable Puppeteer in other environments (e.g. a browser)
we need to ship an ESM build. This commit changes our config to ship to
`lib/cjs` and `lib/esm` accordingly. The majority of our code stays the
same, with one small fix for the CJS build to ensure that we ship a
version that lets you `require('puppeteer')` rather than have to
`require('puppeteer').default`. We do this with the `cjs-entry.js` which
is what the `main` field in our `package.json` points to.

We also swap to `read-pkg-up` to find the `package.json` file. This is
because the folder structure of `lib/` does not match `src/` now we ship
to `cjs` and `esm`, so you cannot rely on exact paths. This module works
up from the file to find the nearest `package.json` so it will always
find Puppeteer's `package.json`.

Note that we *do not* point any users to the ESM build. We happen to
ship those files so people who know about them can get at them but it's
not expected (nor will we actively support) that people will rely on
them. The CommonJS build is considered our main build.

We may make breaking changes to the structure of the ESM build which we
will do without requiring new major versions. For example the ESM build
currently ships all files that the CJS build does, but given we are
working on the ESM build being able to run in the browser this may
change over time.

Long term once the Node versions catch up we can ditch CJS and ship
exclusively ESM but we are not there yet.
2020-06-25 14:24:46 +01:00
Maja Frydrychowicz
ef63c64178
test: check installation with Firefox (#5965) 2020-06-03 16:00:08 +02:00
Jack Franklin
feec588f95
chore: add test for npm package installing correctly (#5714)
* chore: add test for npm package installing correctly

This command packs up the module and installs it again to check we're
correctly bundling everything we need to allow users to do a fresh
install.

* install realpath
2020-04-22 15:33:36 +01:00