feat: replace @sentry/node with @sentry/core
..., vendored modules and custom implementations
- [ ] Because this PR includes a bug fix, relevant tests have been included.
- [ ] Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
- [x] I didn't do anything of this.
In this PR, I replace usage of @sentry/node with @sentry/core because the former comes with a lot of dependencies that we don't need.
To accomplish that I vendored context and contextlines integrations and module util from @sentry/node. By vendoring these, we will be able to easily update them when needed.
I also added our own implementation of onuncaughtexception and onunhandledrejection integrations since we only need a very simple versions of these and our own implementation of the init function, again, for the simplicity.
Finally, I created a fetch-based transport that is used to send events/messages to sentry.
I tested this by sending events to our test Sentry project and comparing their JSONs to the ones from events sent to our production project.
An example of a JSON for an event sent from this branch - https://us.sentry.io/api/0/projects/nomic-labs/hardhat-v3-testing/events/9aef4aeae293452e9e98112e8bdf31ff/json/ An example of a similar error event sent to our production project - https://us.sentry.io/api/0/projects/nomic-labs/hardhat3/events/2dfc81ad0ed344c6b323ee7eff2be4a1/json/
🦋 Changeset detected
Latest commit: fb4d3757b801b7e3be958acdda66e51a6de5bc98
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 21 packages
| Name | Type |
|---|---|
| hardhat | Patch |
| @nomicfoundation/hardhat-errors | Patch |
| @nomicfoundation/hardhat-ethers-chai-matchers | Patch |
| @nomicfoundation/hardhat-ignition | Patch |
| @nomicfoundation/ignition-core | Patch |
| @nomicfoundation/hardhat-ignition-ethers | Patch |
| @nomicfoundation/ignition-ui | Patch |
| @nomicfoundation/hardhat-ignition-viem | Patch |
| @nomicfoundation/hardhat-keystore | Patch |
| @nomicfoundation/hardhat-mocha | Patch |
| @nomicfoundation/hardhat-network-helpers | Patch |
| @nomicfoundation/hardhat-node-test-reporter | Patch |
| @nomicfoundation/hardhat-node-test-runner | Patch |
| @nomicfoundation/hardhat-test-utils | Patch |
| @nomicfoundation/hardhat-typechain | Patch |
| @nomicfoundation/hardhat-utils | Patch |
| @nomicfoundation/hardhat-toolbox-mocha-ethers | Patch |
| @nomicfoundation/hardhat-verify | Patch |
| @nomicfoundation/hardhat-viem | Patch |
| @nomicfoundation/hardhat-viem-assertions | Patch |
| @nomicfoundation/hardhat-zod-utils | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
hardhat
Total size of the bundle: 195M
Total number of dependencies (including transitive): 46
List of dependencies (sorted by size)
189M total
24M @ignored/edr-optimism-linux-x64-musl
24M @ignored/edr-optimism-linux-x64-gnu
22M @ignored/edr-optimism-win32-x64-msvc
21M @ignored/edr-optimism-linux-arm64-musl
21M @ignored/edr-optimism-linux-arm64-gnu
20M esbuild
18M @ignored/edr-optimism-darwin-x64
17M @ignored/edr-optimism-darwin-arm64
6.2M @sentry/core
2.6M zod
2.5M micro-eth-signer
1.9M @noble/curves
1.7M undici
1.2M @noble/hashes
864K @streamparser/json
860K @nomicfoundation/hardhat-utils
624K micro-packed
600K tsx
544K fast-equals
536K @nomicfoundation/hardhat-errors
492K @scure/bip39
408K json-stream-stringify
368K ethereum-cryptography
348K @ignored/edr
332K @streamparser/json-node
320K enquirer
304K @ignored/edr-optimism
288K semver
196K ws
168K @scure/base
136K get-tsconfig
136K adm-zip
96K @scure/bip32
92K chalk
72K @nomicfoundation/solidity-analyzer
68K debug
64K @nomicfoundation/hardhat-zod-utils
56K rfdc
48K ansi-colors
44K resolve.exports
40K resolve-pkg-maps
36K p-map
24K strip-ansi
24K env-paths
24K ansi-regex
20K ms
Looks good to me. Just to double check, are we ok not having the following default integrations?
- inboundFiltersIntegration
- consoleIntegration
- httpIntegration
- nativeNodeFetchIntegration
- localVariablesIntegration
- childProcessIntegration
- processSessionIntegration
I trusted Piotr's assessment there because I don't know what each integration does.
@galargh up to you if you want to go ahead and merge, but maybe a quick description of each of the excluded integrations and the reason not to include it would be useful.
I just approved this PR, my comment was more aimed towards double checking the excluded default integrations before merging. I took a quick look at it and it seems we were not using them
I'll do a quick run-through of the integrations that we don't include anymore with really simple descriptions. I agree that it will be helpful when we find ourselves missing some info in the future.
I'll post it here and merge the PR once done.
I added the inline notes about all the default integrations in https://github.com/NomicFoundation/hardhat/pull/6757/commits/3b7feb9bd0a058488b41c538b5191f06588ed4f1
Marking this as ready for merge now.
Those explanations were super useful, thanks!