Commit Graph

195 Commits

Author SHA1 Message Date
jrandolf
6879f9cfe1
chore(release): mark v13.3.0 (#7979)
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
2022-02-09 17:01:45 +00:00
Alex Rudenko
b531f498e9
chore(release): mark v13.2.0 (#7970) 2022-02-07 15:35:33 +01:00
Alex Rudenko
7b76883802
chore(release): mark v13.1.3 (#7946) 2022-01-31 10:15:42 +01:00
Alex Rudenko
0a9eb3c9a5
chore(release): mark v13.1.2 (#7925) 2022-01-25 07:55:07 +00:00
Alex Rudenko
f108560be8
chore(release): mark v13.1.1 (#7912) 2022-01-18 08:55:34 +00:00
Alex Rudenko
80d6b84ded
chore(release): mark v13.1.0 (#7908) 2022-01-17 15:40:56 +01:00
Alex Rudenko
71cef32f6d
chore(release): mark v13.0.1 (#7865) 2021-12-22 09:06:12 +01:00
Alex Rudenko
d0cb9e2573
chore(release): mark v13.0.0 (#7832) 2021-12-10 09:02:39 +00:00
Alex Rudenko
913ff123ec
chore(release): mark v12.0.1 (#7810) 2021-11-29 20:06:56 +00:00
Alex Rudenko
641588a783
chore(release): mark v12.0.0 (#7800) 2021-11-26 08:58:29 +00:00
Jan Scheffler
e2e98376b9
chore(release): mark v11.0.0 (#7737) 2021-11-02 14:36:33 +00:00
Julien Déramond
7207746b4f
docs: fix typo for PUPPETEER_DOWNLOAD_PATH in README (#7715) 2021-10-25 09:31:27 +00:00
David Barton
9a6749f4b4
docs: remove try-puppeteer.appspot,com link (#7660) 2021-10-08 16:21:57 +00:00
David Barton
7cc22c7629
docs: add warning about version of try-puppeteer.appspot.com (#7639)
The URL https://try-puppeteer.appspot.com/ is mentioned around the top of `README.md` even if it is running a very outdated version (v1.4.0). This change adds a warning to inform users about this.
2021-10-07 09:27:56 +00:00
Jan Scheffler
5631d3aebc
chore(release): mark v10.4.0 (#7586) 2021-09-21 17:29:27 +02:00
Mathias Bynens
686030fe0d
chore: remove references to upstream master branches (#7412)
Chromium had its branch renamed to `main`, and for other projects we can just point to the `HEAD`.
2021-09-14 15:02:39 +00:00
Sarah Lewis
47624245e8
chore: fix link to demo 2021-08-10 09:18:53 +00:00
Maksim Sadym
c510df8d8e
chore(release): mark v10.2.0 (#7467) 2021-08-04 14:45:31 +02:00
Jan Scheffler
6b13a17ed9
chore(release): mark v10.1.0 (#7331) 2021-06-29 09:26:24 +02:00
Diego Fernandez
7e74a9d606
docs: add download location to the FAQ (#7339)
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2021-06-21 07:21:05 +02:00
Jan Scheffler
9df7b71e3b
chore(release): mark v10.0.0 (#7299) 2021-05-31 14:34:04 +02:00
Jan Scheffler
d615dd3d2c
chore(release): mark v9.1.1 (#7205) 2021-05-05 10:38:53 +02:00
Jan Scheffler
1d473bc79f
chore(release): mark v9.1.0 (#7201) 2021-05-03 14:08:44 +02:00
Maksim Sadym
5872e7178a
chore(release): mark v9.0.0 (#7111) 2021-04-21 11:18:09 +00:00
Nitin Kumar
56f17fe481
docs(readme): remove inactive slack link (#6986) 2021-03-15 07:48:06 +01:00
Alex Rudenko
0b5969dea9
chore(release): mark v8.0.0 (#6928) 2021-02-26 08:32:27 +00:00
信鑫-King
d66389ba7e
docs(readme): fix page.pdf code example (#6890)
Ref: `PaperFormat` type.
2021-02-18 09:05:43 +01:00
Jack Franklin
a681aac7e3
chore(release): mark v7.1.0 (#6879) 2021-02-12 10:51:43 +00:00
Jack Franklin
db2b4898e1
chore(release): mark v7.0.4 (#6850) 2021-02-09 13:24:44 +01:00
Jack Franklin
27eaf607ce
chore(release): mark v7.0.3 (#6845) 2021-02-09 09:49:44 +01:00
Jack Franklin
ff50c86332
chore(release): mark v7.0.2 (#6842) 2021-02-09 08:17:15 +00:00
Jack Franklin
f1b46ab5fa
fix: much better TypeScript definitions (#6837)
This PR aims to vastly improve our TS types and how we ship them.

Our previous attempt at shipping TypeScript was unfortunately flawed for
many reasons when compared to the @types/puppeteer package:

* It only worked if you needed the default export. If you wanted to
  import a type that Puppeteer uses, you'd have to do `import type X
  from 'puppeteer/lib/...'`. This is not something we want to encourage
  because that means our internal file structure becomes almost public
  API.
* It gave absolutely no help to CommonJS users in JS files because it
  would warn people they needed to do `const pptr =
  require('puppeteer').default, which is not correct.
* I found a bug in the `evaluate` types which mean't you couldn't
  override the types to provide more info, and TS would insist the types
  were all `unknown`.

The goal of this PR is to support:

1. In a `ts` file, `import puppeteer from 'puppeteer'`
1. In a `ts` file, `import type {ElementHandle} from 'puppeteer'`
1. In a `ts` file, referencing a type as `puppeteer.ElementHandle`
1. In a `ts` file, you can get good type inference when running
   `foo.evaluate(x => x.clientHeight)`.
1. In a `js` file using CJS, you can do `const puppeteer =
   require('puppeteer')` and get good type help from VSCode.

To test this I created a new empty repository with two test files in,
one `.ts` file with this in:
https://gist.github.com/jackfranklin/22ba2f390f97c7312cd70025a2096fc8,
and a `js` file with this in:
https://gist.github.com/jackfranklin/06bed136fdb22419cb7a8a9a4d4ef32f.

These files included enough code to check that the types were behaving
as I expected.

The fix for our types was to make use of API Extractor, which we already
use for our docs, to "rollup" all the disparate type files that TS
generates into one large `types.d.ts` which contains all the various
types that we define, such as:

```ts
export declare class ElementHandle {...}

export type EvaluateFn ...
```

If we then update our `package.json` `types` field to point to that file
in `lib/types.d.ts`, this then allows a developer to write:

```
import type {ElementHandle} from 'puppeteer'
```

And get the correct type definitions. However, what the `types.d.ts`
file doesn't do out of the box is declare the default export, so
importing Puppeteer's default export to call a method such as `launch`
on it will get you an error.

That's where the `script/add-default-export-to-types.ts` comes in. It
appends the following to the auto-generated `types.d.ts` file:

```ts
declare const puppeteer: PuppeteerNode;
export = puppeteer;
```

This tells TypeScript what the default export is, and by using the
`export =` syntax, we make sure TS understands both in a TS ESM
environment and in a JS CJS environment.

Now the `build` step, which is run by GitHub Actions when we release,
will generate the `.d.ts` file and then extend it with the default
export code.

To ensure that I was generating a valid package, I created a new
repository locally with the two code samples linked in Gists above. I
then ran:

```
npm init -y
npm install --save-dev typescript
npx tsc --init
```

Which gives me a base to test from. In Puppeteer, I ran `npm pack`,
which packs the module into a tar that's almost identical to what would
be published, so I can be confident that the .d.ts files in there are
what would be published.

I then installed it:

```
npm install --save-dev ../../puppeteer/puppeteer-7.0.1-post.tgz
```

And then reloaded VSCode in my dummy project. By deliberately making
typos and hovering over the code, I could confirm that all the goals
listed above were met, and this seems like a vast improvement on our
types.
2021-02-09 08:00:42 +00:00
Jack Franklin
eb0d604bf3
chore(release): mark v7.0.1 (#6812) 2021-02-04 10:07:37 +00:00
Jan Scheffler
edd8bcc619
chore(release): mark v7.0.0 (#6804) 2021-02-03 16:33:32 +01:00
Jan Scheffler
ef4767080a
chore(release): mark v6.0.0 (#6800) 2021-02-02 12:00:09 +01:00
Mathias Bynens
f7f122dc41
chore: drop Travis CI config (#6799)
Now that we’ve migrated to GitHub Actions and everything seems to work correctly, we can remove Travis CI without losing confidence.

Issue: #6726
2021-02-02 11:03:31 +01:00
Mathias Bynens
0a76cd0bd6 chore: drop README badge 2021-02-02 08:42:37 +01:00
Mathias Bynens
18143b3573
chore(release): mark v5.5.0 (#6604) 2020-11-16 14:38:50 +01:00
Jack Franklin
562c9c2723
chore: mark version 5.4.1 (#6552) 2020-10-27 15:05:43 +00:00
Johan Bay
729cdfe98a
chore: mark version v5.4.0 (#6542) 2020-10-23 16:28:38 +02:00
Maksim Sadym
c7d32cb92f
chore: mark version v5.3.1 (#6439) 2020-09-22 12:49:28 +02:00
Maksim Sadym
030fcaa075
chore: mark version v5.3.0 (#6412) 2020-09-11 10:43:09 +02:00
Johan Bay
4ee4649de6
chore: mark v5.2.1 (#6254) 2020-07-21 14:53:02 +02:00
Jack Franklin
028f144256
chore: mark v5.2.0 (#6238) 2020-07-17 13:44:29 +02:00
Changhao Han
8fa18aef99
chore: mark version v5.1.0 (#6206)
Co-authored-by: Changhao Han <changhaohan@chromium.org>
2020-07-13 10:25:14 +02:00
Jack Franklin
6d06adea10
chore: mark v5.0.0 (#6143) 2020-07-02 14:32:43 +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
46fc6ca41a
feat(types): improve typing of .evaluate() (#6096)
* feat(types): improve typing of `.evaluate()`

This is the start of the work to take the types from the
`@types/puppeteer` repository and port them into our repo so we can ship
our built-in types out the box.

This change types the `evaluate` function properly. It takes a generic
type which is the type of the function you're passing, and the arguments
and the return that you get back from the `evaluate` call are typed
correctly.
2020-06-25 13:38:01 +01:00
Mathias Bynens
f1ec6a3df0
chore: update references to branch names (#6022) 2020-06-15 17:34:16 +02:00
Jack Franklin
2ffe710177
chore: mark version 4.0.0 (#6018) 2020-06-15 14:48:37 +01:00