puppeteer/vendor
Ayman Azzam 41f23beb0d
docs: fix more tsdoc warnings
* docs: fix most tsdoc warning messages

* docs: i just added spaceline
2021-04-12 14:57:05 +01:00
..
mitt docs: fix more tsdoc warnings 2021-04-12 14:57:05 +01:00
README.md chore: upgrade Mitt to 2.1 (#6287) 2020-07-29 12:11:40 +01:00
tsconfig.cjs.json chore: vendor Mitt & update project structure (#6209) 2020-07-14 16:57:29 +01:00
tsconfig.esm.json chore: vendor Mitt & update project structure (#6209) 2020-07-14 16:57:29 +01:00

Vendoring third party dependencies

Because we are working towards an agnostic Puppeteer that can run in any environment (see #6125) we cannot import common dependencies in a way that relies on Node's resolution to find them. For example, import mitt from 'mitt' works fine in Node, but in an ESM build running in the browser, the browser has no idea where to find 'mitt'.

Therefore we put all common dependencies into this directory, vendor. This means there are extra criteria for these dependencies; ideally they will not depend on any other modules. If they do, we should consider an alternative way of managing our dependencies.

The process for updating a vendored dependency is:

  1. npm install {DEP NAME HERE}
  2. cp -r node_modules/DEP vendor
  3. Update eslintrc.js to forbid importing DEP directly (see the Mitt rule already defined in there).
  4. Use the new DEP, and run npm run tsc to check everything compiles successfully.
  5. If the dep ships as compiled JS, you may need to disable TypeScript checking the file. Add an entry to the excludes property of the TSConfig files in vendor. (again, see the entry that's already there for Mitt as an example). Don't forget to update both the ESM and CJS config files.