Files
cypress/tooling/packherd/README.md
T
Ryan Manuel b0c0eaa508 feat: introduce v8 snapshots to improve startup performance (#24295)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Mark Noonan <mark@cypress.io>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Zachary Williams <zachjw34@gmail.com>
Co-authored-by: astone123 <adams@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Adam Stone <adams@cypress.io>
Co-authored-by: Blue F <blue@cypress.io>
Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com>
Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Sam Goodger <turbo@tailz.dev>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Stokes Player <stokes@cypress.io>
Co-authored-by: Vilhelm Melkstam <vilhelm.melkstam@gmail.com>
Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com>
2022-10-31 20:20:27 -05:00

37 lines
1.6 KiB
Markdown

## @tooling/packherd
Herds all dependencies reachable from an entry and packs them.
**Table of Contents**
- [Summary](#summary)
- [Creating a Bundle with Packherd](#creating-a-bundle-with-packherd)
## Summary
packherd has three main tasks:
1. bundling application files and providing related metadata
2. loading modules that have been bundled previously and are provided via fully instantiated
module exports or definition functions that return a module export when invoked
3. transpiling TypeScript modules on demand and maintaining a cache of them
`1.` is provided by this package. `2.` and `3.` are provided by `@packages/packherd-require`. While `1.` and `2.` are very related
and work hand in hand, `3.` is unrelated to them and was just added here since it is another feature that requires to intercept module loads.
## Creating a Bundle with Packherd
Calling the [packherd function][packherd fn] and providing the desired [packherd opts][packherd
opts] will return the `Buffer` of the bundle, a `meta` [esbuild metafile][esbuild metafile], a
`Buffer` containing the sourceMap if it was generated as well as any warnings that esbuild
emitted.
The caller can then store this data or use it for further operations, i.e. to generate a
snapshot as is the case for the [v8-snapshot][v8-snapshot] module.
[packherd fn]:https://github.com/cypress-io/cypress/blob/develop/packages/packherd/src/packherd.ts#L44
[packherd opts]:https://github.com/cypress-io/cypress/blob/develop/packages/packherd/src/packherd.ts#L14-L27
[esbuild metafile]:https://esbuild.github.io/api/#metafile
[v8-snapshot]:https://github.com/thlorenz/v8-snapshot