2017-05-11 07:06:41 +00:00
|
|
|
/node_modules/
|
fix: wider compat TS types and CI checks to ensure correct type defs (#6855)
* fix: wider compat TS types and CI checks to ensure correct type defs
This PR improves our TS types further to make sure they are usable in a
TS environment where ES Modules are the target output. Our use of
`export =` is problematic this environment as TypeScript does not allow
`export =` to be used and it errors.
The fix for the type issues to avoid `export =` is to instead define the
functions that you gain access to when you import Puppeteer as top level
functions in our `types.d.ts` file. We can do this by declaring them
explicitly in `src/node.ts`. These are then rolled into `lib/types.d.ts`
at build time. The downside to this is that we have to keep those
declarations in sync with the Puppeteer API; should we add a new method
to the `Puppeteer` class, we must add it to the `nodes.ts` declarations.
However, this could easily be automated by a small script that walks the
AST and generates these. I will do that in a follow-up PR, but I
consider this low risk given how rarely the very top level API of
Puppeteer changes. The nice thing about this approach is we no longer
need our script that hacks on changes to `lib/types.d.ts`.
To avoid yet more releases to fix issues in one particular TS
environment, this PR also includes a suite of example setups that we
test on each CI run. Each sample folder contains `good.ts`, which should
have no TS errors, and `bad.ts`, which should have some errors. The test
first packs Puppeteer into a tar, and then installs it from that tar
into each project. This should replicate how the published package
behaves when it is installed. We then check that we get no errors on
`good.ts`, and the expected errors on `bad.ts`.
We have a variety of test projects that cover both TS and JS source
code, and CJS and ESM imports and outputs.
2021-02-10 12:04:36 +00:00
|
|
|
test-ts-types/**/node_modules
|
|
|
|
test-ts-types/**/dist/
|
2019-02-02 01:55:12 +00:00
|
|
|
/test/output-chromium
|
|
|
|
/test/output-firefox
|
2017-10-11 19:14:13 +00:00
|
|
|
/test/test-user-data-dir*
|
2017-05-11 07:06:41 +00:00
|
|
|
/.local-chromium/
|
2020-03-10 20:59:03 +00:00
|
|
|
/.local-firefox/
|
2017-05-11 07:06:41 +00:00
|
|
|
/.dev_profile*
|
|
|
|
.DS_Store
|
|
|
|
*.swp
|
|
|
|
*.pyc
|
2017-07-18 01:49:52 +00:00
|
|
|
.vscode
|
2017-08-02 21:18:14 +00:00
|
|
|
package-lock.json
|
2018-01-23 01:11:10 +00:00
|
|
|
yarn.lock
|
2017-08-24 19:20:05 +00:00
|
|
|
/node6
|
2020-04-02 14:25:19 +00:00
|
|
|
/lib
|
2020-04-30 12:00:41 +00:00
|
|
|
test/coverage.json
|
2020-06-04 10:47:13 +00:00
|
|
|
temp/
|
2020-10-14 10:44:40 +00:00
|
|
|
new-docs/
|
2022-05-06 11:50:31 +00:00
|
|
|
puppeteer*.tgz
|
2021-06-10 08:30:40 +00:00
|
|
|
docs-api-json/
|
2021-07-21 13:59:12 +00:00
|
|
|
docs-dist/
|
2021-08-04 09:00:48 +00:00
|
|
|
website/docs
|
2022-02-28 09:43:59 +00:00
|
|
|
docs/api.html
|