hardhat 3.4.1 → 3.4.3
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 +50 -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 +10 -3
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
- package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +7 -7
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.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/coverage/instrumentation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
- package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
- package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.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/helpers/utils.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.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/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +11 -16
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.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 +2 -41
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.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 +1 -1
- 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/edr/utils/trace-formatters.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +4 -4
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
- package/dist/src/internal/builtin-plugins/node/task-action.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 +68 -29
- 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-cost.d.ts +8 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
- 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-wrapper.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
- 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/utils.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.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 +6 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +6 -3
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +9 -7
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/banner-manager.js +2 -2
- package/dist/src/internal/cli/banner-manager.js.map +1 -1
- package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
- package/dist/src/internal/cli/error-handler.js +6 -6
- package/dist/src/internal/cli/error-handler.js.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.js +2 -2
- package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +57 -36
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
- package/dist/src/internal/cli/init/package-manager.js +5 -5
- package/dist/src/internal/cli/init/package-manager.js.map +1 -1
- package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
- package/dist/src/internal/cli/init/prompt.js +3 -3
- package/dist/src/internal/cli/init/prompt.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 +2 -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 +17 -10
- 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/analytics/utils.js +2 -2
- package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/subprocess.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
- package/dist/src/internal/config-loading.js +2 -2
- package/dist/src/internal/config-loading.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +202 -58
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.js +2 -2
- 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/user-interruptions.js +4 -4
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
- package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
- package/package.json +6 -9
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +12 -5
- package/src/internal/builtin-plugins/console/task-action.ts +4 -4
- package/src/internal/builtin-plugins/coverage/coverage-manager.ts +7 -7
- 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/coverage/instrumentation.ts +21 -2
- package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
- package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +12 -15
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
- 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 +2 -61
- 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 +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
- package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
- package/src/internal/builtin-plugins/node/helpers.ts +8 -5
- package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
- package/src/internal/builtin-plugins/node/task-action.ts +5 -4
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +92 -52
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
- package/src/internal/builtin-plugins/solidity/config.ts +5 -2
- package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +13 -4
- package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +6 -3
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/test/task-action.ts +13 -7
- package/src/internal/cli/banner-manager.ts +2 -2
- package/src/internal/cli/error-handler.ts +10 -6
- package/src/internal/cli/help/get-help-string.ts +2 -2
- package/src/internal/cli/init/init.ts +86 -43
- package/src/internal/cli/init/package-manager.ts +8 -6
- package/src/internal/cli/init/prompt.ts +4 -3
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/main.ts +4 -3
- package/src/internal/cli/node-version.ts +20 -12
- package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
- package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
- package/src/internal/cli/telemetry/sentry/reporter.ts +2 -2
- package/src/internal/cli/telemetry/sentry/subprocess.ts +2 -2
- package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
- package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
- package/src/internal/config-loading.ts +2 -2
- package/src/internal/core/hook-manager.ts +283 -101
- package/src/internal/core/hre.ts +2 -2
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/src/internal/core/user-interruptions.ts +4 -4
- package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +7 -7
- 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/dist/src/internal/utils/colorizer.d.ts +0 -10
- package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
- package/dist/src/internal/utils/colorizer.js +0 -2
- package/dist/src/internal/utils/colorizer.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
- package/src/internal/utils/colorizer.ts +0 -9
|
@@ -6,9 +6,9 @@ import { validateUserConfig } from "./config-validation.js";
|
|
|
6
6
|
import { resolveConfigurationVariable } from "./configuration-variables.js";
|
|
7
7
|
import { buildGlobalOptionDefinitions, resolveGlobalOptions, } from "./global-options.js";
|
|
8
8
|
import { HookManagerImplementation } from "./hook-manager.js";
|
|
9
|
+
import { LazyUserInterruptionManager } from "./lazy-user-interruptions.js";
|
|
9
10
|
import { resolvePluginList } from "./plugins/resolve-plugin-list.js";
|
|
10
11
|
import { TaskManagerImplementation } from "./tasks/task-manager.js";
|
|
11
|
-
import { UserInterruptionManagerImplementation } from "./user-interruptions.js";
|
|
12
12
|
export class HardhatRuntimeEnvironmentImplementation {
|
|
13
13
|
userConfig;
|
|
14
14
|
config;
|
|
@@ -63,7 +63,7 @@ export class HardhatRuntimeEnvironmentImplementation {
|
|
|
63
63
|
const globalOptions = resolveGlobalOptions(userProvidedGlobalOptions, globalOptionDefinitions);
|
|
64
64
|
// Set the HookContext in the hook manager so that non-config hooks can
|
|
65
65
|
// use it
|
|
66
|
-
const interruptions = new
|
|
66
|
+
const interruptions = new LazyUserInterruptionManager(hooks);
|
|
67
67
|
const hre = new HardhatRuntimeEnvironmentImplementation(extendedUserConfig, config, hooks, interruptions, globalOptions, versions, globalOptionDefinitions);
|
|
68
68
|
// We create an object with the HRE as its prototype, and overwrite the
|
|
69
69
|
// tasks property with undefined, so that hooks don't have access to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../src/internal/core/hre.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../src/internal/core/hre.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5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IACX,CAAC,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,WAAmB,EACnB,UAA8B,EAC9B,KAAkB,EAClB,aAA8B,EAC9B,MAAyB;IAEzB;;;;+DAI2D;IAC3D,MAAM,qBAAqB,GAAG;QAC5B,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;QACzB,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC;KAC1C,CAAC;IAEnB,OAAO,MAAM,KAAK,CAAC,eAAe,CAChC,QAAQ,EACR,mBAAmB,EACnB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,4BAA4B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EACrE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE;QACd,OAAO,qBAAqB,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,WAAmB,EACnB,UAA8B,EAC9B,oBAA4C,EAAE;IAE9C,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EACJ,UAAU,KAAK,SAAS;YACtB,CAAC,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,CAAC;YAC1C,CAAC,CAAC,SAAS;QACf,KAAK,EAAE,eAAe,CAAC,WAAW,EAAE,iBAAiB,CAAC,KAAK,IAAI,OAAO,CAAC;QACvE,SAAS,EAAE,eAAe,CACxB,WAAW,EACX,iBAAiB,CAAC,SAAS,IAAI,WAAW,CAC3C;QACD;;;8BAGsB;QACtB,KAAK,EAAE,EAAqB;QAC5B;oCAC4B;QAC5B,OAAO,EAAE,EAAuB;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HookManager } from "../../types/hooks.js";
|
|
2
|
+
import type { UserInterruptionManager } from "../../types/user-interruptions.js";
|
|
3
|
+
export declare class LazyUserInterruptionManager implements UserInterruptionManager {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(hooks: HookManager);
|
|
6
|
+
displayMessage(interruptor: string, message: string): Promise<void>;
|
|
7
|
+
requestInput(interruptor: string, inputDescription: string): Promise<string>;
|
|
8
|
+
requestSecretInput(interruptor: string, inputDescription: string): Promise<string>;
|
|
9
|
+
uninterrupted<ReturnT>(f: () => ReturnT): Promise<Awaited<ReturnT>>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=lazy-user-interruptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-user-interruptions.d.ts","sourceRoot":"","sources":["../../../../src/internal/core/lazy-user-interruptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAMjF,qBAAa,2BAA4B,YAAW,uBAAuB;;gBAK7D,KAAK,EAAE,WAAW;IAIjB,cAAc,CACzB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAKH,YAAY,CACvB,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC;IAQL,kBAAkB,CAC7B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC;IAQL,aAAa,CAAC,OAAO,EAChC,CAAC,EAAE,MAAM,OAAO,GACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;CAyB7B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
let UserInterruptionManagerImplementation;
|
|
2
|
+
export class LazyUserInterruptionManager {
|
|
3
|
+
#hooks;
|
|
4
|
+
#userInterruptionManager;
|
|
5
|
+
constructor(hooks) {
|
|
6
|
+
this.#hooks = hooks;
|
|
7
|
+
}
|
|
8
|
+
async displayMessage(interruptor, message) {
|
|
9
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
10
|
+
return await userInterruptionManager.displayMessage(interruptor, message);
|
|
11
|
+
}
|
|
12
|
+
async requestInput(interruptor, inputDescription) {
|
|
13
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
14
|
+
return await userInterruptionManager.requestInput(interruptor, inputDescription);
|
|
15
|
+
}
|
|
16
|
+
async requestSecretInput(interruptor, inputDescription) {
|
|
17
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
18
|
+
return await userInterruptionManager.requestSecretInput(interruptor, inputDescription);
|
|
19
|
+
}
|
|
20
|
+
async uninterrupted(f) {
|
|
21
|
+
const userInterruptionManager = await this.#getUserInterruptionManager();
|
|
22
|
+
return await userInterruptionManager.uninterrupted(f);
|
|
23
|
+
}
|
|
24
|
+
async #getUserInterruptionManager() {
|
|
25
|
+
// Note: `await import` must run BEFORE the instance cache check so that
|
|
26
|
+
// concurrent callers share a single microtask-dedupe point — otherwise
|
|
27
|
+
// each suspended caller re-enters the branch and constructs its own
|
|
28
|
+
// impl, so callers end up holding different impl instances and state,
|
|
29
|
+
// which can cause concurrency issues.
|
|
30
|
+
if (UserInterruptionManagerImplementation === undefined) {
|
|
31
|
+
({ UserInterruptionManagerImplementation } = await import("./user-interruptions.js"));
|
|
32
|
+
}
|
|
33
|
+
if (this.#userInterruptionManager === undefined) {
|
|
34
|
+
this.#userInterruptionManager = new UserInterruptionManagerImplementation(this.#hooks);
|
|
35
|
+
}
|
|
36
|
+
return this.#userInterruptionManager;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=lazy-user-interruptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-user-interruptions.js","sourceRoot":"","sources":["../../../../src/internal/core/lazy-user-interruptions.ts"],"names":[],"mappings":"AAIA,IAAI,qCAES,CAAC;AAEd,MAAM,OAAO,2BA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BAAwB,GAAG,IAAI,qCAAqC,CACvE,IAAI,CAAC,MAAM,CACZ,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createInterface } from "node:readline";
|
|
2
|
+
import { styleText } from "node:util";
|
|
2
3
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
3
4
|
import { AsyncMutex } from "@nomicfoundation/hardhat-utils/synchronization";
|
|
4
|
-
import chalk from "chalk";
|
|
5
5
|
export class UserInterruptionManagerImplementation {
|
|
6
6
|
#hooks;
|
|
7
7
|
#mutex = new AsyncMutex();
|
|
@@ -28,7 +28,7 @@ export class UserInterruptionManagerImplementation {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
async function defaultDisplayMessage(_context, interruptor, message) {
|
|
31
|
-
console.log(
|
|
31
|
+
console.log(styleText("blue", `[${interruptor}]`) + ` ${message}`);
|
|
32
32
|
}
|
|
33
33
|
async function defaultRequestInput(_context, interruptor, inputDescription) {
|
|
34
34
|
const rl = createInterface({
|
|
@@ -36,7 +36,7 @@ async function defaultRequestInput(_context, interruptor, inputDescription) {
|
|
|
36
36
|
output: process.stdout,
|
|
37
37
|
});
|
|
38
38
|
return await new Promise((resolve) => {
|
|
39
|
-
rl.question(
|
|
39
|
+
rl.question(styleText("blue", `[${interruptor}]`) + ` ${inputDescription}: `, (answer) => {
|
|
40
40
|
resolve(answer);
|
|
41
41
|
rl.close();
|
|
42
42
|
});
|
|
@@ -73,7 +73,7 @@ async function defaultRequestSecretInput(_context, interruptor, inputDescription
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
return await new Promise((resolve) => {
|
|
76
|
-
rl.question(
|
|
76
|
+
rl.question(styleText("blue", `[${interruptor}]`) + ` ${inputDescription}: `, (answer) => {
|
|
77
77
|
resolve(answer);
|
|
78
78
|
rl.close();
|
|
79
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-interruptions.js","sourceRoot":"","sources":["../../../../src/internal/core/user-interruptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"user-interruptions.js","sourceRoot":"","sources":["../../../../src/internal/core/user-interruptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAE5E,MAAM,OAAO,qCAAqC;IAGvC,MAAM,CAAC;IACP,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAEnC,YAAY,KAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,cAAc,CACzB,WAAmB,EACnB,OAAe;QAEf,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;YAC/C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CACtC,mBAAmB,EACnB,gBAAgB,EAChB,CAAC,WAAW,EAAE,OAAO,CAAC,EACtB,qBAAqB,CACtB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,WAAmB,EACnB,gBAAwB;QAExB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;YAC/C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CACtC,mBAAmB,EACnB,cAAc,EACd,CAAC,WAAW,EAAE,gBAAgB,CAAC,EAC/B,mBAAmB,CACpB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,kBAAkB,C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ChB,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"using-hardhat2-plugin-errors.d.ts","sourceRoot":"","sources":["../../../src/internal/using-hardhat2-plugin-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"using-hardhat2-plugin-errors.d.ts","sourceRoot":"","sources":["../../../src/internal/using-hardhat2-plugin-errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGnE,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,SAAgB,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;;CAwBxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM,GAAG,SAAS,CAyC3E;AAED,wBAAgB,6BAA6B,IAAI,KAAK,CAIrD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { styleText } from "node:util";
|
|
2
3
|
import { CustomError } from "@nomicfoundation/hardhat-utils/error";
|
|
3
4
|
import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
|
|
4
|
-
import chalk from "chalk";
|
|
5
5
|
export class UsingHardhat2PluginError extends CustomError {
|
|
6
6
|
callerRelativePath;
|
|
7
7
|
constructor() {
|
|
@@ -10,7 +10,7 @@ export class UsingHardhat2PluginError extends CustomError {
|
|
|
10
10
|
if (callerPath !== undefined) {
|
|
11
11
|
message = `You are trying to use a Hardhat 2 plugin in a Hardhat 3 project.
|
|
12
12
|
|
|
13
|
-
This file is part of a Hardhat 2 plugin calling an API that was removed in Hardhat 3: ${
|
|
13
|
+
This file is part of a Hardhat 2 plugin calling an API that was removed in Hardhat 3: ${styleText("bold", callerPath)}
|
|
14
14
|
|
|
15
15
|
Please read https://hardhat.org/migrate-from-hardhat2 to learn how to migrate your project to Hardhat 3.
|
|
16
16
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"using-hardhat2-plugin-errors.js","sourceRoot":"","sources":["../../../src/internal/using-hardhat2-plugin-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"using-hardhat2-plugin-errors.js","sourceRoot":"","sources":["../../../src/internal/using-hardhat2-plugin-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvC,kBAAkB,CAAqB;IACvD;QACE,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;QAE3C,IAAI,OAAe,CAAC;QACpB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,GAAG;;wFAEwE,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;;;CAGpH,CAAC;QACE,CAAC;aAAM,CAAC;YACN,OAAO,GAAG;;;;;CAKf,CAAC;QACE,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC;IACvC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;QAChC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED;;;;;;;;WAQG;QACH,MAAM,sBAAsB,GAC1B,iDAAiD,CAAC;QAEpD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC9D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAC7C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAExB,4CAA4C;QAC5C,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B;IAC3C;kEAC8D;IAC9D,MAAM,IAAI,wBAAwB,EAAE,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"description": "Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.",
|
|
5
5
|
"homepage": "https://hardhat.org",
|
|
6
6
|
"repository": {
|
|
@@ -62,9 +62,8 @@
|
|
|
62
62
|
"README.md"
|
|
63
63
|
],
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@nomicfoundation/hardhat-node-test-reporter": "^3.0.
|
|
65
|
+
"@nomicfoundation/hardhat-node-test-reporter": "^3.0.6",
|
|
66
66
|
"@types/adm-zip": "^0.5.5",
|
|
67
|
-
"@types/debug": "^4.1.7",
|
|
68
67
|
"@types/node": "^22.0.0",
|
|
69
68
|
"@types/semver": "^7.5.8",
|
|
70
69
|
"@types/ws": "^8.5.13",
|
|
@@ -77,17 +76,15 @@
|
|
|
77
76
|
"@nomicfoundation/hardhat-test-utils": "^2.0.3"
|
|
78
77
|
},
|
|
79
78
|
"dependencies": {
|
|
80
|
-
"@nomicfoundation/edr": "0.12.0-next.
|
|
81
|
-
"@nomicfoundation/hardhat-errors": "^3.0.
|
|
82
|
-
"@nomicfoundation/hardhat-utils": "^4.0
|
|
83
|
-
"@nomicfoundation/hardhat-vendored": "^3.0.
|
|
79
|
+
"@nomicfoundation/edr": "0.12.0-next.31",
|
|
80
|
+
"@nomicfoundation/hardhat-errors": "^3.0.12",
|
|
81
|
+
"@nomicfoundation/hardhat-utils": "^4.1.0",
|
|
82
|
+
"@nomicfoundation/hardhat-vendored": "^3.0.3",
|
|
84
83
|
"@nomicfoundation/hardhat-zod-utils": "^3.0.4",
|
|
85
84
|
"@nomicfoundation/solidity-analyzer": "^0.1.1",
|
|
86
85
|
"@sentry/core": "^9.4.0",
|
|
87
86
|
"adm-zip": "^0.4.16",
|
|
88
|
-
"chalk": "^5.3.0",
|
|
89
87
|
"chokidar": "^4.0.3",
|
|
90
|
-
"debug": "^4.3.2",
|
|
91
88
|
"enquirer": "^2.3.0",
|
|
92
89
|
"ethereum-cryptography": "^2.2.1",
|
|
93
90
|
"micro-eth-signer": "^0.14.0",
|
package/src/cli.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { exitIfNodeVersionNotSupported } from "./internal/cli/node-version.js";
|
|
4
4
|
|
|
5
5
|
// We enable the sourcemaps before loading main, so that everything except this
|
|
6
6
|
// small file is loaded with sourcemaps enabled.
|
|
7
7
|
process.setSourceMapsEnabled(true);
|
|
8
8
|
|
|
9
|
-
// We
|
|
10
|
-
// unsupported js syntax or Node API elsewhere, we get to
|
|
11
|
-
// crashing.
|
|
12
|
-
|
|
9
|
+
// We check the Node.js version before loading main, so that if there is some
|
|
10
|
+
// unsupported js syntax or Node API elsewhere, we get to exit with a clear
|
|
11
|
+
// error before crashing.
|
|
12
|
+
exitIfNodeVersionNotSupported();
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line no-restricted-syntax -- Allow top-level await here
|
|
15
15
|
const { main } = await import("./internal/cli/main.js");
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
exists,
|
|
16
16
|
getAllFilesMatching,
|
|
17
|
+
readdirOrEmpty,
|
|
17
18
|
readJsonFile,
|
|
18
19
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
19
20
|
|
|
@@ -112,12 +113,18 @@ export class ArtifactManagerImplementation implements ArtifactManager {
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
public async getAllBuildInfoIds(): Promise<ReadonlySet<string>> {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const buildInfosDir = path.join(this.#artifactsPath, BUILD_INFO_DIR_NAME);
|
|
117
|
+
|
|
118
|
+
// The build-info directory is expected to be flat: every build-info file
|
|
119
|
+
// lives directly under it, so a non-recursive `readdir` is enough.
|
|
120
|
+
const buildInfoFiles = await readdirOrEmpty(buildInfosDir);
|
|
121
|
+
|
|
122
|
+
const jsonExtensionLength = ".json".length;
|
|
123
|
+
const buildInfoIds = buildInfoFiles
|
|
124
|
+
.filter((f) => f.endsWith(".json") && !f.endsWith(".output.json"))
|
|
125
|
+
.map((entry) => entry.slice(0, entry.length - jsonExtensionLength));
|
|
119
126
|
|
|
120
|
-
return new Set(
|
|
127
|
+
return new Set(buildInfoIds);
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
public async getBuildInfoPath(
|
|
@@ -3,12 +3,12 @@ import type { NewTaskActionFunction } from "../../../types/tasks.js";
|
|
|
3
3
|
import type { REPLServer } from "node:repl";
|
|
4
4
|
|
|
5
5
|
import repl from "node:repl";
|
|
6
|
+
import { styleText } from "node:util";
|
|
6
7
|
|
|
8
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
7
9
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
8
|
-
import chalk from "chalk";
|
|
9
|
-
import debug from "debug";
|
|
10
10
|
|
|
11
|
-
const log =
|
|
11
|
+
const log = createDebug("hardhat:core:tasks:console");
|
|
12
12
|
|
|
13
13
|
interface ConsoleActionArguments {
|
|
14
14
|
commands: string[];
|
|
@@ -25,7 +25,7 @@ const consoleAction: NewTaskActionFunction<ConsoleActionArguments> = async (
|
|
|
25
25
|
const handlers: Partial<HardhatHooks["userInterruptions"]> = {
|
|
26
26
|
requestSecretInput: async () => {
|
|
27
27
|
console.error(
|
|
28
|
-
|
|
28
|
+
styleText("red", "Secrets are not yet supported in the console task"),
|
|
29
29
|
);
|
|
30
30
|
process.exit(1);
|
|
31
31
|
},
|
|
@@ -7,7 +7,9 @@ import type {
|
|
|
7
7
|
import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
|
+
import { styleText } from "node:util";
|
|
10
11
|
|
|
12
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
11
13
|
import { formatTable } from "@nomicfoundation/hardhat-utils/format";
|
|
12
14
|
import {
|
|
13
15
|
ensureDir,
|
|
@@ -18,13 +20,11 @@ import {
|
|
|
18
20
|
writeJsonFile,
|
|
19
21
|
writeUtf8File,
|
|
20
22
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
21
|
-
import chalk from "chalk";
|
|
22
|
-
import debug from "debug";
|
|
23
23
|
|
|
24
24
|
import { getProcessedCoverageInfo } from "./process-coverage.js";
|
|
25
25
|
import { generateHtmlReport } from "./reports/html.js";
|
|
26
26
|
|
|
27
|
-
const log =
|
|
27
|
+
const log = createDebug("hardhat:core:coverage:coverage-manager");
|
|
28
28
|
|
|
29
29
|
const MAX_COLUMN_WIDTH = 80;
|
|
30
30
|
|
|
@@ -435,18 +435,18 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
435
435
|
|
|
436
436
|
rows.push({
|
|
437
437
|
type: "title",
|
|
438
|
-
text:
|
|
438
|
+
text: styleText("bold", "Coverage Report"),
|
|
439
439
|
});
|
|
440
440
|
|
|
441
441
|
rows.push({
|
|
442
442
|
type: "section-header",
|
|
443
|
-
text:
|
|
443
|
+
text: styleText("bold", "File Coverage"),
|
|
444
444
|
});
|
|
445
445
|
|
|
446
446
|
rows.push({
|
|
447
447
|
type: "header",
|
|
448
448
|
cells: ["File Path", "Line %", "Statement %", "Uncovered Lines"].map(
|
|
449
|
-
(s) =>
|
|
449
|
+
(s) => styleText("yellow", s),
|
|
450
450
|
),
|
|
451
451
|
});
|
|
452
452
|
|
|
@@ -500,7 +500,7 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
500
500
|
rows.push({
|
|
501
501
|
type: "header",
|
|
502
502
|
cells: [
|
|
503
|
-
|
|
503
|
+
styleText("yellow", "Total"),
|
|
504
504
|
this.formatCoverage(totalLineCoverage),
|
|
505
505
|
this.formatCoverage(totalStatementCoverage),
|
|
506
506
|
"",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// NOTE: This file is imported from hot paths — the plugin's `created` hook
|
|
2
|
+
// handler and task-actions that may run on every `hardhat test` invocation
|
|
3
|
+
// regardless of whether the feature is enabled. It must stay lightweight:
|
|
4
|
+
// do not add top-level imports that pull in the coverage-manager module
|
|
5
|
+
// graph (debug, node:crypto, file-system traversal, etc.), or the
|
|
6
|
+
// `--coverage` lazy-load is silently defeated for every caller.
|
|
7
|
+
// If a new helper needs a heavy dependency, put it in a sibling file
|
|
8
|
+
// (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
|
|
9
|
+
|
|
10
|
+
import type { HookContext } from "../../../../types/hooks.js";
|
|
11
|
+
import type { HardhatRuntimeEnvironment } from "../../../../types/hre.js";
|
|
12
|
+
import type { CoverageManager } from "../types.js";
|
|
13
|
+
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
|
|
16
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
17
|
+
|
|
18
|
+
import { HardhatRuntimeEnvironmentImplementation } from "../../../core/hre.js";
|
|
19
|
+
|
|
20
|
+
export function getCoveragePath(rootPath: string): string {
|
|
21
|
+
return path.join(rootPath, "coverage");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getCoverageManager(
|
|
25
|
+
hookContextOrHre: HookContext | HardhatRuntimeEnvironment,
|
|
26
|
+
): CoverageManager {
|
|
27
|
+
assertHardhatInvariant(
|
|
28
|
+
hookContextOrHre instanceof HardhatRuntimeEnvironmentImplementation &&
|
|
29
|
+
hookContextOrHre._coverage !== undefined,
|
|
30
|
+
"Expected _coverage to be installed on the HRE",
|
|
31
|
+
);
|
|
32
|
+
return hookContextOrHre._coverage;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function setCoverageManager(
|
|
36
|
+
hre: HardhatRuntimeEnvironment,
|
|
37
|
+
coverageManager: CoverageManager,
|
|
38
|
+
): void {
|
|
39
|
+
assertHardhatInvariant(
|
|
40
|
+
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
41
|
+
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
42
|
+
);
|
|
43
|
+
hre._coverage = coverageManager;
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HardhatRuntimeEnvironment } from "../../../../types/hre.js";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
testRunDone,
|
|
5
|
+
testRunStart,
|
|
6
|
+
testWorkerDone,
|
|
7
|
+
} from "../hook-handlers/test.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The following helpers are kept for backward compatibility with older versions
|
|
11
|
+
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
12
|
+
* from "hardhat/internal/coverage".
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
let cachedHre: HardhatRuntimeEnvironment | undefined;
|
|
16
|
+
async function getHre(): Promise<HardhatRuntimeEnvironment> {
|
|
17
|
+
if (cachedHre === undefined) {
|
|
18
|
+
const { default: hre } = await import("../../../../index.js");
|
|
19
|
+
cachedHre = hre;
|
|
20
|
+
}
|
|
21
|
+
return cachedHre;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function markTestRunStart(id: string): Promise<void> {
|
|
25
|
+
const hre = await getHre();
|
|
26
|
+
await testRunStart(hre, id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function markTestWorkerDone(id: string): Promise<void> {
|
|
30
|
+
const hre = await getHre();
|
|
31
|
+
await testWorkerDone(hre, id);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function markTestRunDone(id: string): Promise<void> {
|
|
35
|
+
const hre = await getHre();
|
|
36
|
+
await testRunDone(hre, id);
|
|
37
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { CleanHooks } from "../../../../types/hooks.js";
|
|
|
2
2
|
|
|
3
3
|
import { remove } from "@nomicfoundation/hardhat-utils/fs";
|
|
4
4
|
|
|
5
|
-
import { getCoveragePath } from "../helpers.js";
|
|
5
|
+
import { getCoveragePath } from "../helpers/accessors.js";
|
|
6
6
|
|
|
7
7
|
export default async (): Promise<Partial<CleanHooks>> => ({
|
|
8
8
|
onClean: async (context) => {
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import type { HardhatRuntimeEnvironmentHooks } from "../../../../types/hooks.js";
|
|
2
|
+
import type { CoverageManagerImplementation as CoverageManagerImplementationT } from "../coverage-manager.js";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
4
|
+
import { getCoveragePath, setCoverageManager } from "../helpers/accessors.js";
|
|
5
|
+
|
|
6
|
+
let CoverageManagerImplementation:
|
|
7
|
+
| typeof CoverageManagerImplementationT
|
|
8
|
+
| undefined;
|
|
5
9
|
|
|
6
10
|
export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
7
11
|
created: async (context, hre) => {
|
|
8
|
-
if (context.globalOptions.coverage) {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
if (!context.globalOptions.coverage) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
if (CoverageManagerImplementation === undefined) {
|
|
17
|
+
({ CoverageManagerImplementation } = await import(
|
|
18
|
+
"../coverage-manager.js"
|
|
19
|
+
));
|
|
20
|
+
}
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// is enabled or not.
|
|
17
|
-
hre.hooks.registerHandlers("network", {
|
|
18
|
-
onCoverageData: async (_context, coverageData) => {
|
|
19
|
-
await coverageManager.addData(coverageData);
|
|
22
|
+
const coveragePath = getCoveragePath(hre.config.paths.root);
|
|
23
|
+
const coverageManager = new CoverageManagerImplementation(coveragePath);
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
setCoverageManager(hre, coverageManager);
|
|
26
|
+
|
|
27
|
+
// NOTE: We register this hook dynamically because we use the information about
|
|
28
|
+
// the existence of onCoverageData hook handlers to determine whether coverage
|
|
29
|
+
// is enabled or not.
|
|
30
|
+
hre.hooks.registerHandlers("network", {
|
|
31
|
+
onCoverageData: async (_context, coverageData) => {
|
|
32
|
+
await coverageManager.addData(coverageData);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
25
35
|
},
|
|
26
36
|
});
|
|
@@ -4,15 +4,15 @@ import type { CoverageMetadata } from "../types.js";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
7
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
7
8
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
8
9
|
import { readUtf8File } from "@nomicfoundation/hardhat-utils/fs";
|
|
9
10
|
import { findClosestPackageRoot } from "@nomicfoundation/hardhat-utils/package";
|
|
10
|
-
import debug from "debug";
|
|
11
11
|
|
|
12
|
-
import { getCoverageManager } from "../helpers.js";
|
|
12
|
+
import { getCoverageManager } from "../helpers/accessors.js";
|
|
13
13
|
import { instrumentSolidityFileForCompilationJob } from "../instrumentation.js";
|
|
14
14
|
|
|
15
|
-
const log =
|
|
15
|
+
const log = createDebug("hardhat:core:coverage:hook-handlers:solidity");
|
|
16
16
|
|
|
17
17
|
const COVERAGE_LIBRARY_PATH =
|
|
18
18
|
"__hardhat_coverage_library_a3e9cfe2-41b4-4a1f-ad9e-ac62dd82979e.sol";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HookContext, TestHooks } from "../../../../types/hooks.js";
|
|
2
2
|
|
|
3
|
-
import { getCoverageManager } from "../helpers.js";
|
|
3
|
+
import { getCoverageManager } from "../helpers/accessors.js";
|
|
4
4
|
|
|
5
5
|
export default async (): Promise<Partial<TestHooks>> => ({
|
|
6
6
|
onTestRunStart: async (context, id, next) => {
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
addStatementCoverageInstrumentation,
|
|
5
5
|
latestSupportedSolidityVersion,
|
|
6
6
|
} from "@nomicfoundation/edr";
|
|
7
|
-
import {
|
|
7
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
8
|
+
import {
|
|
9
|
+
lowerThanOrEqual,
|
|
10
|
+
parseVersion,
|
|
11
|
+
} from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Instruments a solidity source file as part of a compilation job. i.e. the
|
|
@@ -37,8 +41,23 @@ export function instrumentSolidityFileForCompilationJob({
|
|
|
37
41
|
instrumentationVersion: string;
|
|
38
42
|
} {
|
|
39
43
|
const latestSupportedVersion = latestSupportedSolidityVersion();
|
|
44
|
+
const parsedLatestSupportedVersion = parseVersion(latestSupportedVersion);
|
|
45
|
+
assertHardhatInvariant(
|
|
46
|
+
parsedLatestSupportedVersion !== undefined,
|
|
47
|
+
`Invalid latest supported solidity version: ${latestSupportedVersion}`,
|
|
48
|
+
);
|
|
40
49
|
let instrumentationVersion = compilationJobSolcVersion;
|
|
41
|
-
|
|
50
|
+
const parsedInstrumentationVersion = parseVersion(instrumentationVersion);
|
|
51
|
+
assertHardhatInvariant(
|
|
52
|
+
parsedInstrumentationVersion !== undefined,
|
|
53
|
+
`Invalid solc version: ${instrumentationVersion}`,
|
|
54
|
+
);
|
|
55
|
+
if (
|
|
56
|
+
!lowerThanOrEqual(
|
|
57
|
+
parsedInstrumentationVersion,
|
|
58
|
+
parsedLatestSupportedVersion,
|
|
59
|
+
)
|
|
60
|
+
) {
|
|
42
61
|
instrumentationVersion = latestSupportedVersion;
|
|
43
62
|
}
|
|
44
63
|
const { source, metadata } = addStatementCoverageInstrumentation(
|