Commit Graph

9 Commits

Author SHA1 Message Date
Nikolay Vitkov
15cf3a5e6d
chore: add type test for CommonEventEmitter (#10500) 2023-07-03 14:38:33 +00:00
Alex Rudenko
df4d60c187
feat!: switch to Chrome for Testing instead of Chromium (#10054)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2023-05-02 08:53:40 +02:00
Nikolay Vitkov
e4b57c279a
chore: add EsLint rule for no-floating-promises (#10084) 2023-04-26 09:53:02 +00:00
Alex Rudenko
17f31a9ee4
fix(puppeteer-core): avoid type instantiation errors (#9370)
Using the accumulator allows enabling the tail-recursion optimization in
the TypeScript compiler.

Closes #9369
2022-12-06 19:21:08 +01:00
Joe Gomain Hoyes
bef1061c06
feat(puppeteer-core): Infer element type from complex selector (#9253)
**What kind of change does this PR introduce?**

Better type inference.

**Did you add tests for your changes?**

~Not yet.~ Yes.

**If relevant, did you update the documentation?**

Not yet.

**Summary**

<!-- Explain the **motivation** for making this change. What existing
problem does the pull request solve? -->
<!-- Try to link to an open issue for more information. -->
Currently methods that return an element handle, i.e. `.$`,
`.waitForSelector` attempt to infer the node element type from the
selector string. However, this only works when the selector is an exact
match of the element tag, i.e. a selector `"a"` would be inferred as
`HTMLAnchorElement` . And not when the selector is complex, i.e.
selectors `"a#some-id"`, `div > a`, `a:nth-child(2)` would all fallback
on `Element`.

This is due to simply looking up the the selector in
`HTMLElementTagNameMap` and `SVGElementTagNameMap` without any attempt
to parse the selector string.

This PR is an attempt to do so.

**Does this PR introduce a breaking change?**

<!-- If this PR introduces a breaking change, please describe the impact
and a migration path for existing applications. -->
This could break existing incorrect assertions using the `as` keyword.

**Other information**

~This PR introduces a dependency on the `type-fest` package.~

This PR is far from complete (no tests, no docs). Put out early for
feedback and discussion.

Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2022-11-23 10:59:23 +01:00
jrandolf
f42336cf83
feat: separate puppeteer and puppeteer-core (#9023)
This PR moves the puppeteer source code into separate mono-repo packages:

- `puppeteer` and `puppeteer-core` are now separated into their own
packages.
- `puppeteer-core` has a new exports called `puppeteer-core/internal`
for internal usage.

Tests and various tools have been updated to accommodate the migration.
2022-10-05 14:17:03 +02:00
Alex Rudenko
10a114d36f
fix: change injected.ts imports (#8987)
* fix: change injected.ts imports

Not sure why api-extractor generates broken .d.ts
files if the start import is used for Poller and TextContext.

* test: use generated types.d.ts in tsd
2022-09-20 10:28:31 +02:00
jrandolf
5ff205dc8b
fix: extends ElementHandle to Nodes (#8552)
* fix: extends `ElementHandle` to `Node`s (#8552)
2022-07-06 09:05:37 +02:00
jrandolf
e499515fd6
chore: add type tests (#8588) 2022-06-27 10:57:31 +02:00