hardhat 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/src/cli.js +5 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +11 -4
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js +10 -10
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +24 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js +27 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +18 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -3
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +10 -4
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +18 -14
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +2 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +14 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +40 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +1 -12
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +3 -42
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +2 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +4 -4
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +7 -7
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +2 -2
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +61 -28
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +10 -10
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +16 -11
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +18 -9
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +5 -14
- package/dist/src/internal/cli/init/template.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +4 -2
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/node-version.d.ts +1 -1
- package/dist/src/internal/cli/node-version.d.ts.map +1 -1
- package/dist/src/internal/cli/node-version.js +18 -8
- package/dist/src/internal/cli/node-version.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts +6 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +47 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts +27 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js +40 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js.map +1 -0
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts +0 -8
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.js +1 -37
- package/dist/src/internal/cli/telemetry/sentry/init.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts +8 -2
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +18 -12
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
- package/dist/src/internal/config-loading.js +3 -3
- package/dist/src/internal/config-loading.js.map +1 -1
- package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
- package/dist/src/internal/core/configuration-variables.js +1 -1
- package/dist/src/internal/core/configuration-variables.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +196 -59
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +5 -5
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.d.ts +11 -0
- package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -0
- package/dist/src/internal/core/lazy-user-interruptions.js +39 -0
- package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -0
- package/dist/src/internal/core/plugins/resolve-plugin-list.js +1 -1
- package/dist/src/internal/core/plugins/resolve-plugin-list.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +4 -4
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +9 -9
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/hre-initialization.js +1 -1
- package/dist/src/internal/hre-initialization.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +13 -6
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +16 -10
- package/src/internal/builtin-plugins/clean/index.ts +1 -1
- package/src/internal/builtin-plugins/console/index.ts +1 -1
- package/src/internal/builtin-plugins/coverage/exports.ts +1 -1
- package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +44 -0
- package/src/internal/builtin-plugins/coverage/helpers/compat.ts +37 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/clean.ts +1 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +26 -16
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -3
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/flatten/index.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/index.ts +4 -2
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +2 -6
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +61 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +3 -62
- package/src/internal/builtin-plugins/network-manager/edr/genesis-state.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +3 -9
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +4 -4
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +6 -2
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +11 -7
- package/src/internal/builtin-plugins/node/helpers.ts +2 -2
- package/src/internal/builtin-plugins/node/index.ts +1 -1
- package/src/internal/builtin-plugins/run/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +84 -49
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -4
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/read-source-file.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +11 -11
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +27 -14
- package/src/internal/builtin-plugins/solidity/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/solidity-hooks.ts +1 -1
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +4 -4
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +1 -1
- package/src/internal/builtin-plugins/telemetry/index.ts +1 -1
- package/src/internal/builtin-plugins/test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/test/index.ts +1 -1
- package/src/internal/builtin-plugins/test/task-action.ts +1 -1
- package/src/internal/cli/init/init.ts +32 -14
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/main.ts +5 -3
- package/src/internal/cli/node-version.ts +21 -10
- package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +64 -0
- package/src/internal/cli/telemetry/error-reporter/reporter.ts +49 -0
- package/src/internal/cli/telemetry/sentry/anonymizer.ts +1 -1
- package/src/internal/cli/telemetry/sentry/init.ts +2 -62
- package/src/internal/cli/telemetry/sentry/reporter.ts +27 -15
- package/src/internal/cli/telemetry/sentry/transport.ts +1 -1
- package/src/internal/cli/telemetry/telemetry-permissions.ts +1 -1
- package/src/internal/config-loading.ts +3 -3
- package/src/internal/core/configuration-variables.ts +19 -18
- package/src/internal/core/hook-manager.ts +267 -103
- package/src/internal/core/hre.ts +7 -5
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/src/internal/core/plugins/resolve-plugin-list.ts +1 -1
- package/src/internal/core/tasks/resolved-task.ts +4 -4
- package/src/internal/core/user-interruptions.ts +9 -9
- package/src/internal/hre-initialization.ts +1 -1
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +10 -10
- package/templates/hardhat-3/02-mocha-ethers/package.json +13 -13
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +0 -15
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +0 -35
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// NOTE: We don't use the `semver` package because it's slow to load, and this
|
|
2
2
|
// is always run during the initialization of the CLI.
|
|
3
|
+
//
|
|
4
|
+
// NOTE: This file shouldn't import any non-builtin dependency, as it's imported
|
|
5
|
+
// before enabling source maps support.
|
|
6
|
+
//
|
|
7
|
+
// EXCEPTION: we share `getRuntimeInfo` with the rest of the codebase instead
|
|
8
|
+
// of duplicating it. The helper has no transitive dependencies, so the risk of
|
|
9
|
+
// an unreadable stack trace from its import graph is negligible.
|
|
3
10
|
|
|
4
|
-
import
|
|
11
|
+
import { getRuntimeInfo } from "@nomicfoundation/hardhat-utils/runtime";
|
|
5
12
|
|
|
6
13
|
export const MIN_SUPPORTED_NODE_VERSION: number[] = [22, 10, 0];
|
|
7
14
|
|
|
@@ -12,10 +19,6 @@ export function isNodeVersionSupported(): boolean {
|
|
|
12
19
|
const minor = parseInt(minorStr, 10);
|
|
13
20
|
const patch = parseInt(patchStr, 10);
|
|
14
21
|
|
|
15
|
-
if (major % 2 === 1) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
22
|
if (major < MIN_SUPPORTED_NODE_VERSION[0]) {
|
|
20
23
|
return false;
|
|
21
24
|
} else if (major > MIN_SUPPORTED_NODE_VERSION[0]) {
|
|
@@ -39,12 +42,20 @@ export function isNodeVersionSupported(): boolean {
|
|
|
39
42
|
return true;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
export function
|
|
45
|
+
export function exitIfNodeVersionNotSupported(): void {
|
|
46
|
+
// Only enforce the Node.js version when we're actually running on Node.js.
|
|
47
|
+
// Bun and Deno emulate `process.versions.node`, so checking it there would
|
|
48
|
+
// incorrectly reject users on those runtimes.
|
|
49
|
+
if (getRuntimeInfo()?.runtime !== "node") {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
if (!isNodeVersionSupported()) {
|
|
44
|
-
console.
|
|
45
|
-
|
|
46
|
-
Please upgrade to ${MIN_SUPPORTED_NODE_VERSION.join(".")} or
|
|
54
|
+
console.error(
|
|
55
|
+
`\nERROR: You are using Node.js ${process.versions.node} which is not supported by Hardhat.\n` +
|
|
56
|
+
`Please upgrade to Node.js ${MIN_SUPPORTED_NODE_VERSION.join(".")} or later.\n`,
|
|
47
57
|
);
|
|
48
|
-
|
|
58
|
+
|
|
59
|
+
process.exit(1);
|
|
49
60
|
}
|
|
50
61
|
}
|
|
@@ -60,7 +60,7 @@ export async function sendTaskAnalytics(taskId: string[]): Promise<boolean> {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
return sendAnalytics(taskAnalyticsEvent);
|
|
63
|
+
return await sendAnalytics(taskAnalyticsEvent);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export async function sendProjectTypeAnalytics(
|
|
@@ -75,7 +75,7 @@ export async function sendProjectTypeAnalytics(
|
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
return sendAnalytics(initAnalyticsEvent);
|
|
78
|
+
return await sendAnalytics(initAnalyticsEvent);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Return a boolean for testing purposes to confirm whether analytics were sent based on the consent value and not in CI environments
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
2
|
+
import debug from "debug";
|
|
3
|
+
|
|
4
|
+
import { sendErrorTelemetry } from "./reporter.js";
|
|
5
|
+
|
|
6
|
+
const log = debug("hardhat:core:telemetry:global-error-handlers");
|
|
7
|
+
|
|
8
|
+
function createUnhandledErrorListener(isPromiseRejection: boolean) {
|
|
9
|
+
const description = isPromiseRejection
|
|
10
|
+
? "Unhandled promise rejection"
|
|
11
|
+
: "Uncaught exception";
|
|
12
|
+
|
|
13
|
+
const mechanismType = isPromiseRejection
|
|
14
|
+
? "onunhandledrejection"
|
|
15
|
+
: "onuncaughtexception";
|
|
16
|
+
|
|
17
|
+
async function listener(error: Error | unknown) {
|
|
18
|
+
log(description, error);
|
|
19
|
+
|
|
20
|
+
const telemetryError =
|
|
21
|
+
error instanceof Error
|
|
22
|
+
? error
|
|
23
|
+
: new Error(
|
|
24
|
+
isObject(error) &&
|
|
25
|
+
"message" in error &&
|
|
26
|
+
typeof error.message === "string"
|
|
27
|
+
? error.message
|
|
28
|
+
: "Unknown error",
|
|
29
|
+
{ cause: error },
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await sendErrorTelemetry(telemetryError, {
|
|
34
|
+
unhandled: true,
|
|
35
|
+
mechanismType,
|
|
36
|
+
});
|
|
37
|
+
} catch (telemetryErrorReportingError) {
|
|
38
|
+
log(
|
|
39
|
+
"Failed to send telemetry for unhandled error",
|
|
40
|
+
telemetryErrorReportingError,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.error();
|
|
45
|
+
console.error(`${description}:`);
|
|
46
|
+
console.error();
|
|
47
|
+
console.error(error);
|
|
48
|
+
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return listener;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Sets up global error handlers that report unhandled errors and promise
|
|
57
|
+
* rejections if authorized by the user.
|
|
58
|
+
*/
|
|
59
|
+
export function setupGlobalUnhandledErrorHandlers(): void {
|
|
60
|
+
log("Setting up global unhandled error handlers");
|
|
61
|
+
|
|
62
|
+
process.on("uncaughtException", createUnhandledErrorListener(false));
|
|
63
|
+
process.on("unhandledRejection", createUnhandledErrorListener(true));
|
|
64
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type * as SentryReporterT from "../sentry/reporter.js";
|
|
2
|
+
|
|
3
|
+
// Sentry's reporter loads a large number of modules, so we only load it if
|
|
4
|
+
// needed.
|
|
5
|
+
let sentryReporterModule: typeof SentryReporterT | undefined;
|
|
6
|
+
|
|
7
|
+
// We cache the `setCliHardhatConfigPath` to avoid loading the reporter just
|
|
8
|
+
// for this setting. We load it and set the config path if needed.
|
|
9
|
+
let cliHardhatConfigPath: string | undefined;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Reports an error if telemetry is authorized by the user.
|
|
13
|
+
*
|
|
14
|
+
* While this function is async, it's expected to always complete quickly,
|
|
15
|
+
* delegating the actual reporting to a subprocess.
|
|
16
|
+
*
|
|
17
|
+
* @param error - The error to report.
|
|
18
|
+
* @param hint - Optional metadata describing how the error was captured, used
|
|
19
|
+
* to tag the event in Sentry so unhandled crashes can be distinguished from
|
|
20
|
+
* errors caught and reported by the CLI.
|
|
21
|
+
* @param hint.unhandled - Whether the error reached a global handler without
|
|
22
|
+
* being caught (e.g. an uncaught exception or unhandled promise rejection).
|
|
23
|
+
* Defaults to `false` (i.e. the error was handled).
|
|
24
|
+
* @param hint.mechanismType - The Sentry mechanism type, used as a tag on the
|
|
25
|
+
* event. Common values are `"onuncaughtexception"`, `"onunhandledrejection"`,
|
|
26
|
+
* `"instrument"`, and `"generic"`. Defaults to `"generic"`.
|
|
27
|
+
*/
|
|
28
|
+
export async function sendErrorTelemetry(
|
|
29
|
+
error: Error,
|
|
30
|
+
hint?: { unhandled?: boolean; mechanismType?: string },
|
|
31
|
+
): Promise<void> {
|
|
32
|
+
if (sentryReporterModule === undefined) {
|
|
33
|
+
sentryReporterModule = await import("../sentry/reporter.js");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (cliHardhatConfigPath !== undefined) {
|
|
37
|
+
sentryReporterModule.setCliHardhatConfigPath(cliHardhatConfigPath);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await sentryReporterModule.sendErrorTelemetry(error, hint);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Sets the config path used in the Hardhat CLI. This is used for better
|
|
45
|
+
* anonymization of errors.
|
|
46
|
+
*/
|
|
47
|
+
export function setCliHardhatConfigPath(configPath: string): void {
|
|
48
|
+
cliHardhatConfigPath = configPath;
|
|
49
|
+
}
|
|
@@ -359,7 +359,7 @@ export class Anonymizer {
|
|
|
359
359
|
async #anonymizeFrames(frames: StackFrame[]): Promise<StackFrame[]> {
|
|
360
360
|
const anonymizedFrames = await Promise.all(
|
|
361
361
|
frames.map(async (frame) => {
|
|
362
|
-
return this.#anonymizeFrame(frame);
|
|
362
|
+
return await this.#anonymizeFrame(frame);
|
|
363
363
|
}),
|
|
364
364
|
);
|
|
365
365
|
return anonymizedFrames;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/* This file is inspired by https://github.com/getsentry/sentry-javascript/blob/9.4.0/packages/node/src/sdk/index.ts */
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
Client,
|
|
5
|
-
ServerRuntimeClientOptions,
|
|
6
|
-
Transport,
|
|
7
|
-
} from "@sentry/core";
|
|
3
|
+
import type { ServerRuntimeClientOptions, Transport } from "@sentry/core";
|
|
8
4
|
|
|
9
5
|
import os from "node:os";
|
|
10
6
|
import path from "node:path";
|
|
@@ -18,15 +14,12 @@ import {
|
|
|
18
14
|
ServerRuntimeClient,
|
|
19
15
|
stackParserFromStackParserOptions,
|
|
20
16
|
} from "@sentry/core";
|
|
21
|
-
import debug from "debug";
|
|
22
17
|
|
|
23
18
|
import { GENERIC_SERVER_NAME } from "./constants.js";
|
|
24
19
|
import { nodeContextIntegration } from "./vendor/integrations/context.js";
|
|
25
20
|
import { contextLinesIntegration } from "./vendor/integrations/contextlines.js";
|
|
26
21
|
import { createGetModuleFromFilename } from "./vendor/utils/module.js";
|
|
27
22
|
|
|
28
|
-
const log = debug("hardhat:core:sentry:init");
|
|
29
|
-
|
|
30
23
|
interface GlobalCustomSentryReporterOptions {
|
|
31
24
|
/**
|
|
32
25
|
* Sentry's DSN
|
|
@@ -49,12 +42,6 @@ interface GlobalCustomSentryReporterOptions {
|
|
|
49
42
|
* See the transport module for the different options.
|
|
50
43
|
*/
|
|
51
44
|
transport: Transport;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* If `true`, the global unhandled rejection and uncaught exception handlers
|
|
55
|
-
* will be installed.
|
|
56
|
-
*/
|
|
57
|
-
installGlobalHandlers?: boolean;
|
|
58
45
|
}
|
|
59
46
|
|
|
60
47
|
/**
|
|
@@ -72,12 +59,9 @@ interface GlobalCustomSentryReporterOptions {
|
|
|
72
59
|
* The reason that this uses the global instance of sentry (by calling
|
|
73
60
|
* initAndBind), is that using the client directly doesn't work with the linked
|
|
74
61
|
* errors integration.
|
|
75
|
-
*
|
|
76
|
-
* Calling `init` also has an option to set global unhandled rejection and
|
|
77
|
-
* uncaught exception handlers.
|
|
78
62
|
*/
|
|
79
63
|
export function init(options: GlobalCustomSentryReporterOptions): void {
|
|
80
|
-
|
|
64
|
+
initAndBind<ServerRuntimeClient, ServerRuntimeClientOptions>(
|
|
81
65
|
ServerRuntimeClient,
|
|
82
66
|
{
|
|
83
67
|
dsn: options.dsn,
|
|
@@ -113,48 +97,4 @@ export function init(options: GlobalCustomSentryReporterOptions): void {
|
|
|
113
97
|
),
|
|
114
98
|
},
|
|
115
99
|
);
|
|
116
|
-
|
|
117
|
-
setupGlobalUnhandledErrorHandlers(client);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function createUnhandledErrorListener(
|
|
121
|
-
client: Client,
|
|
122
|
-
isPromiseRejection: boolean,
|
|
123
|
-
) {
|
|
124
|
-
const description = isPromiseRejection
|
|
125
|
-
? "Unhandled promise rejection"
|
|
126
|
-
: "Uncaught exception";
|
|
127
|
-
|
|
128
|
-
async function listener(error: Error | unknown) {
|
|
129
|
-
log(description, error);
|
|
130
|
-
|
|
131
|
-
client.captureException(error, {
|
|
132
|
-
captureContext: {
|
|
133
|
-
level: "fatal",
|
|
134
|
-
},
|
|
135
|
-
mechanism: {
|
|
136
|
-
handled: false,
|
|
137
|
-
type: "onuncaughtexception",
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
await client.flush(100);
|
|
142
|
-
await client.close(100);
|
|
143
|
-
|
|
144
|
-
console.error();
|
|
145
|
-
console.error(`${description}:`);
|
|
146
|
-
console.error();
|
|
147
|
-
console.error(error);
|
|
148
|
-
|
|
149
|
-
process.exit(1);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return listener;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function setupGlobalUnhandledErrorHandlers(client: Client) {
|
|
156
|
-
log("Setting up global unhandled error handlers");
|
|
157
|
-
|
|
158
|
-
process.on("uncaughtException", createUnhandledErrorListener(client, false));
|
|
159
|
-
process.on("unhandledRejection", createUnhandledErrorListener(client, true));
|
|
160
100
|
}
|
|
@@ -19,15 +19,16 @@ const log = debug("hardhat:cli:telemetry:sentry:reporter");
|
|
|
19
19
|
export const SENTRY_DSN =
|
|
20
20
|
"https://572b03708e298427cc72fc26dac1e8b2@o385026.ingest.us.sentry.io/4508780138856448"; // PROD
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use packages/hardhat/src/internal/cli/telemetry/error-reporter/reporter.ts
|
|
24
|
+
* instead.
|
|
25
|
+
*/
|
|
26
|
+
export async function sendErrorTelemetry(
|
|
27
|
+
error: Error,
|
|
28
|
+
hint?: { unhandled?: boolean; mechanismType?: string },
|
|
29
|
+
): Promise<boolean> {
|
|
29
30
|
const instance = await Reporter.getInstance();
|
|
30
|
-
return instance.reportErrorViaSubprocess(error);
|
|
31
|
+
return await instance.reportErrorViaSubprocess(error, hint);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export function setCliHardhatConfigPath(configPath: string): void {
|
|
@@ -57,9 +58,7 @@ class Reporter {
|
|
|
57
58
|
this.#hardhatConfigPath = configPath;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
public static async getInstance(
|
|
61
|
-
shouldSetupErrorHandlers = false,
|
|
62
|
-
): Promise<Reporter> {
|
|
61
|
+
public static async getInstance(): Promise<Reporter> {
|
|
63
62
|
if (this.#instance !== undefined) {
|
|
64
63
|
return this.#instance;
|
|
65
64
|
}
|
|
@@ -94,7 +93,6 @@ class Reporter {
|
|
|
94
93
|
),
|
|
95
94
|
release,
|
|
96
95
|
environment,
|
|
97
|
-
installGlobalHandlers: shouldSetupErrorHandlers,
|
|
98
96
|
});
|
|
99
97
|
|
|
100
98
|
setExtra("nodeVersion", process.version);
|
|
@@ -108,17 +106,31 @@ class Reporter {
|
|
|
108
106
|
this.#instance = undefined;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
public async reportErrorViaSubprocess(
|
|
109
|
+
public async reportErrorViaSubprocess(
|
|
110
|
+
error: Error,
|
|
111
|
+
hint?: { unhandled?: boolean; mechanismType?: string },
|
|
112
|
+
): Promise<boolean> {
|
|
112
113
|
if (!(await this.#shouldBeReported(error))) {
|
|
113
114
|
log("Error not send: this type of error should not be reported");
|
|
114
115
|
return false;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
const { captureException } = await import("@sentry/core");
|
|
118
|
+
const { captureException, flush } = await import("@sentry/core");
|
|
118
119
|
|
|
119
120
|
log("Capturing exception");
|
|
120
121
|
|
|
121
|
-
captureException(
|
|
122
|
+
captureException(
|
|
123
|
+
error,
|
|
124
|
+
hint !== undefined
|
|
125
|
+
? {
|
|
126
|
+
mechanism: {
|
|
127
|
+
type: hint.mechanismType ?? "generic",
|
|
128
|
+
handled: hint.unhandled !== true,
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
: undefined,
|
|
132
|
+
);
|
|
133
|
+
await flush();
|
|
122
134
|
|
|
123
135
|
return true;
|
|
124
136
|
}
|
|
@@ -139,7 +139,7 @@ export async function sendEnvelopeToSentryBackend(
|
|
|
139
139
|
dsn: string,
|
|
140
140
|
envelope: Envelope,
|
|
141
141
|
): Promise<TransportMakeRequestResponse> {
|
|
142
|
-
return sendSerializedEnvelopeToSentryBackend(
|
|
142
|
+
return await sendSerializedEnvelopeToSentryBackend(
|
|
143
143
|
dsn,
|
|
144
144
|
serializeEnvelope(envelope),
|
|
145
145
|
);
|
|
@@ -35,7 +35,7 @@ export async function isTelemetryAllowed(
|
|
|
35
35
|
return process.env.HARDHAT_TEST_TELEMETRY_ENABLED === "true" ? true : false;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return isTelemetryEnabled(telemetryConfigFilePath);
|
|
38
|
+
return await isTelemetryEnabled(telemetryConfigFilePath);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -34,15 +34,15 @@ export async function resolveHardhatConfigPath(
|
|
|
34
34
|
userProvidedPath?: string,
|
|
35
35
|
): Promise<string> {
|
|
36
36
|
if (userProvidedPath !== undefined) {
|
|
37
|
-
return normalizeConfigPath(userProvidedPath);
|
|
37
|
+
return await normalizeConfigPath(userProvidedPath);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (process.env.HARDHAT_CONFIG !== undefined) {
|
|
41
41
|
log("Using config file path from the HARDHAT_CONFIG env var");
|
|
42
|
-
return normalizeConfigPath(process.env.HARDHAT_CONFIG);
|
|
42
|
+
return await normalizeConfigPath(process.env.HARDHAT_CONFIG);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return findClosestHardhatConfig();
|
|
45
|
+
return await findClosestHardhatConfig();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -118,24 +118,25 @@ export class LazyResolvedConfigurationVariable extends BaseResolvedConfiguration
|
|
|
118
118
|
const mutex = LazyResolvedConfigurationVariable.#mutexes.get(this.#hooks);
|
|
119
119
|
assertHardhatInvariant(mutex !== undefined, "Mutex must be defined");
|
|
120
120
|
|
|
121
|
-
return mutex.exclusiveRun(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
HardhatError
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
return await mutex.exclusiveRun(
|
|
122
|
+
async () =>
|
|
123
|
+
await this.#hooks.runHandlerChain(
|
|
124
|
+
"configurationVariables",
|
|
125
|
+
"fetchValue",
|
|
126
|
+
[this.#variable],
|
|
127
|
+
async (_context, v) => {
|
|
128
|
+
const value = process.env[v.name];
|
|
129
|
+
|
|
130
|
+
if (typeof value !== "string") {
|
|
131
|
+
throw new HardhatError(
|
|
132
|
+
HardhatError.ERRORS.CORE.GENERAL.ENV_VAR_NOT_FOUND,
|
|
133
|
+
{ name: v.name },
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return value;
|
|
138
|
+
},
|
|
139
|
+
),
|
|
139
140
|
);
|
|
140
141
|
}
|
|
141
142
|
}
|