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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
HardhatError,
|
|
3
5
|
HardhatPluginError,
|
|
4
6
|
} from "@nomicfoundation/hardhat-errors";
|
|
5
|
-
import chalk from "chalk";
|
|
6
7
|
|
|
7
8
|
import { HARDHAT_NAME, HARDHAT_WEBSITE_URL } from "../constants.js";
|
|
8
9
|
import { UsingHardhat2PluginError } from "../using-hardhat2-plugin-errors.js";
|
|
@@ -132,22 +133,25 @@ function getErrorMessages(error: Error): ErrorMessages {
|
|
|
132
133
|
switch (category) {
|
|
133
134
|
case ErrorCategory.HARDHAT:
|
|
134
135
|
return {
|
|
135
|
-
formattedErrorMessage: `${
|
|
136
|
+
formattedErrorMessage: `${styleText(["red", "bold"], `Error ${categorizedError.errorCode}:`)} ${categorizedError.formattedMessage}`,
|
|
136
137
|
showMoreInfoMessage: `For more info go to ${HARDHAT_WEBSITE_URL}${categorizedError.errorCode} or run ${HARDHAT_NAME} with --show-stack-traces`,
|
|
137
138
|
};
|
|
138
139
|
case ErrorCategory.PLUGIN:
|
|
139
140
|
return {
|
|
140
|
-
formattedErrorMessage: `${
|
|
141
|
+
formattedErrorMessage: `${styleText(["red", "bold"], `Error ${categorizedError.errorCode} in plugin ${categorizedError.pluginId}:`)} ${categorizedError.formattedMessage}`,
|
|
141
142
|
showMoreInfoMessage: `For more info go to ${HARDHAT_WEBSITE_URL}${categorizedError.errorCode} or run ${HARDHAT_NAME} with --show-stack-traces`,
|
|
142
143
|
};
|
|
143
144
|
case ErrorCategory.COMMUNITY_PLUGIN:
|
|
144
145
|
return {
|
|
145
|
-
formattedErrorMessage: `${
|
|
146
|
+
formattedErrorMessage: `${styleText(["red", "bold"], `Error in community plugin ${categorizedError.pluginId}:`)} ${categorizedError.message}`,
|
|
146
147
|
showMoreInfoMessage: `For more info run ${HARDHAT_NAME} with --show-stack-traces`,
|
|
147
148
|
};
|
|
148
149
|
case ErrorCategory.OTHER:
|
|
149
150
|
return {
|
|
150
|
-
formattedErrorMessage:
|
|
151
|
+
formattedErrorMessage: styleText(
|
|
152
|
+
["red", "bold"],
|
|
153
|
+
`An unexpected error occurred:`,
|
|
154
|
+
),
|
|
151
155
|
postErrorStackTraceMessage: `If you think this is a bug in Hardhat, please report it here: ${HARDHAT_WEBSITE_URL}report-bug`,
|
|
152
156
|
};
|
|
153
157
|
}
|
|
@@ -156,7 +160,7 @@ function printUsingHardhat2Error(
|
|
|
156
160
|
error: UsingHardhat2PluginError,
|
|
157
161
|
print: (message: string | Error) => void = console.error,
|
|
158
162
|
): void {
|
|
159
|
-
print(
|
|
163
|
+
print(styleText(["red", "bold"], `Hardhat 3 installation error:`));
|
|
160
164
|
print("");
|
|
161
165
|
if (error.callerRelativePath !== undefined) {
|
|
162
166
|
print(error.message);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GlobalOptionDefinitions } from "../../../types/global-options.js";
|
|
2
2
|
import type { Task } from "../../../types/tasks.js";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { styleText } from "node:util";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
GLOBAL_NAME_PADDING,
|
|
@@ -31,7 +31,7 @@ export async function getHelpString(
|
|
|
31
31
|
...globalOptions,
|
|
32
32
|
]) + GLOBAL_NAME_PADDING;
|
|
33
33
|
|
|
34
|
-
let output = `${
|
|
34
|
+
let output = `${styleText("bold", task.description)}`;
|
|
35
35
|
|
|
36
36
|
if (task.isEmpty) {
|
|
37
37
|
output += `\n\nUsage: hardhat [GLOBAL OPTIONS] ${task.id.join(" ")} <SUBTASK> [SUBTASK OPTIONS] [--] [SUBTASK POSITIONAL ARGUMENTS]\n`;
|
|
@@ -2,25 +2,24 @@ import type { Template } from "./template.js";
|
|
|
2
2
|
import type { PackageJson } from "@nomicfoundation/hardhat-utils/package";
|
|
3
3
|
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { styleText } from "node:util";
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
assertHardhatInvariant,
|
|
8
9
|
HardhatError,
|
|
9
10
|
} from "@nomicfoundation/hardhat-errors";
|
|
11
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
10
12
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
11
13
|
import {
|
|
12
14
|
copy,
|
|
13
15
|
ensureDir,
|
|
14
16
|
exists,
|
|
15
|
-
getAllFilesMatching,
|
|
16
17
|
isDirectory,
|
|
17
18
|
mkdir,
|
|
18
19
|
readJsonFile,
|
|
19
20
|
writeJsonFile,
|
|
20
21
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
21
22
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
22
|
-
import chalk from "chalk";
|
|
23
|
-
import debug from "debug";
|
|
24
23
|
import * as semver from "semver";
|
|
25
24
|
|
|
26
25
|
import { findClosestHardhatConfig } from "../../config-loading.js";
|
|
@@ -59,7 +58,7 @@ export interface InitHardhatOptions {
|
|
|
59
58
|
install?: boolean;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const log =
|
|
61
|
+
const log = createDebug("hardhat:core:cli:init");
|
|
63
62
|
|
|
64
63
|
/**
|
|
65
64
|
* initHardhat implements the project initialization wizard flow.
|
|
@@ -166,7 +165,7 @@ function printAsciiLogo() {
|
|
|
166
165
|
// logo doesn't fit
|
|
167
166
|
process.stdout.write("\x1b[?7l");
|
|
168
167
|
|
|
169
|
-
console.log(
|
|
168
|
+
console.log(styleText("blue", logoLines));
|
|
170
169
|
|
|
171
170
|
// Re-enable auto-wapping
|
|
172
171
|
process.stdout.write("\x1b[?7h");
|
|
@@ -177,7 +176,7 @@ export async function printWelcomeMessage(): Promise<void> {
|
|
|
177
176
|
const hardhatVersion = await getHardhatVersion();
|
|
178
177
|
|
|
179
178
|
console.log(
|
|
180
|
-
|
|
179
|
+
styleText("cyan", `👷 Welcome to ${HARDHAT_NAME} v${hardhatVersion} 👷\n`),
|
|
181
180
|
);
|
|
182
181
|
|
|
183
182
|
// Warn the user if they are using an outdated version of Hardhat
|
|
@@ -185,7 +184,8 @@ export async function printWelcomeMessage(): Promise<void> {
|
|
|
185
184
|
const latestHardhatVersion = await getLatestHardhatVersion();
|
|
186
185
|
if (hardhatVersion !== latestHardhatVersion) {
|
|
187
186
|
console.warn(
|
|
188
|
-
|
|
187
|
+
styleText(
|
|
188
|
+
["yellow", "bold"],
|
|
189
189
|
`⚠️ You are using an outdated version of Hardhat. The latest version is v${latestHardhatVersion}. Please consider upgrading to the latest version before continuing with the project initialization. ⚠️\n`,
|
|
190
190
|
),
|
|
191
191
|
);
|
|
@@ -198,7 +198,8 @@ export async function printWelcomeMessage(): Promise<void> {
|
|
|
198
198
|
log("Couldn't report error to sentry: %O", e);
|
|
199
199
|
}
|
|
200
200
|
console.warn(
|
|
201
|
-
|
|
201
|
+
styleText(
|
|
202
|
+
["yellow", "bold"],
|
|
202
203
|
`⚠️ We couldn't check if you are using the latest version of Hardhat. Please consider upgrading to the latest version if you are not using it yet. ⚠️\n`,
|
|
203
204
|
),
|
|
204
205
|
);
|
|
@@ -435,17 +436,36 @@ export async function copyProjectFiles(
|
|
|
435
436
|
template: Template,
|
|
436
437
|
force?: boolean,
|
|
437
438
|
): Promise<void> {
|
|
438
|
-
// Find all the
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
439
|
+
// Find all the paths in the template that clash with an existing one in the
|
|
440
|
+
// workspace
|
|
441
|
+
const matchingRelativeWorkspacePaths = (
|
|
442
|
+
await Promise.all(
|
|
443
|
+
template.files.map(async (relativeTemplatePath) => {
|
|
444
|
+
const relativeWorkspacePath =
|
|
445
|
+
relativeTemplateToWorkspacePath(relativeTemplatePath);
|
|
446
|
+
|
|
447
|
+
const absoluteWorkspacePath = path.join(
|
|
448
|
+
workspace,
|
|
449
|
+
relativeWorkspacePath,
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
if (!(await exists(absoluteWorkspacePath))) {
|
|
453
|
+
return undefined;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// We ignore directories in this clash detection
|
|
457
|
+
if (await isDirectory(absoluteWorkspacePath)) {
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return relativeWorkspacePath;
|
|
462
|
+
}),
|
|
463
|
+
)
|
|
464
|
+
).filter((relativeWorkspacePath) => relativeWorkspacePath !== undefined);
|
|
465
|
+
|
|
466
|
+
const matchingRelativeWorkspacePathsSet = new Set(
|
|
467
|
+
matchingRelativeWorkspacePaths,
|
|
468
|
+
);
|
|
449
469
|
|
|
450
470
|
// Ask the user for permission to overwrite existing files if needed
|
|
451
471
|
if (matchingRelativeWorkspacePaths.length !== 0) {
|
|
@@ -461,7 +481,7 @@ export async function copyProjectFiles(
|
|
|
461
481
|
|
|
462
482
|
if (
|
|
463
483
|
force === false &&
|
|
464
|
-
|
|
484
|
+
matchingRelativeWorkspacePathsSet.has(relativeWorkspacePath)
|
|
465
485
|
) {
|
|
466
486
|
continue;
|
|
467
487
|
}
|
|
@@ -473,7 +493,7 @@ export async function copyProjectFiles(
|
|
|
473
493
|
await copy(absoluteTemplatePath, absoluteWorkspacePath);
|
|
474
494
|
}
|
|
475
495
|
|
|
476
|
-
console.log(`✨ ${
|
|
496
|
+
console.log(`✨ ${styleText("cyan", `Template files copied`)} ✨`);
|
|
477
497
|
}
|
|
478
498
|
|
|
479
499
|
/**
|
|
@@ -549,16 +569,25 @@ export async function installProjectDependencies(
|
|
|
549
569
|
console.log();
|
|
550
570
|
console.log(commandString);
|
|
551
571
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
572
|
+
try {
|
|
573
|
+
await spawn(commandString, [], {
|
|
574
|
+
cwd: workspace,
|
|
575
|
+
// We need to run with `shell: true` for this to work on powershell, but
|
|
576
|
+
// we already enclosed every dependency identifier in quotes, so this
|
|
577
|
+
// is safe.
|
|
578
|
+
shell: true,
|
|
579
|
+
stdio: "inherit",
|
|
580
|
+
});
|
|
581
|
+
} catch (error) {
|
|
582
|
+
ensureError(error);
|
|
583
|
+
|
|
584
|
+
throw new HardhatError(
|
|
585
|
+
HardhatError.ERRORS.CORE.INIT.FAILED_TO_INSTALL_DEPENDENCIES,
|
|
586
|
+
error,
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
console.log(`✨ ${styleText("cyan", `Dependencies installed`)} ✨`);
|
|
562
591
|
}
|
|
563
592
|
}
|
|
564
593
|
|
|
@@ -593,26 +622,40 @@ export async function installProjectDependencies(
|
|
|
593
622
|
console.log();
|
|
594
623
|
console.log(commandString);
|
|
595
624
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
625
|
+
try {
|
|
626
|
+
await spawn(commandString, [], {
|
|
627
|
+
cwd: workspace,
|
|
628
|
+
// We need to run with `shell: true` for this to work on powershell, but
|
|
629
|
+
// we already enclosed every dependency identifier in quotes, so this
|
|
630
|
+
// is safe.
|
|
631
|
+
shell: true,
|
|
632
|
+
stdio: "inherit",
|
|
633
|
+
});
|
|
634
|
+
} catch (error) {
|
|
635
|
+
ensureError(error);
|
|
636
|
+
|
|
637
|
+
throw new HardhatError(
|
|
638
|
+
HardhatError.ERRORS.CORE.INIT.FAILED_TO_INSTALL_DEPENDENCIES,
|
|
639
|
+
error,
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
console.log(`✨ ${styleText("cyan", `Dependencies updated`)} ✨`);
|
|
606
644
|
}
|
|
607
645
|
}
|
|
608
646
|
}
|
|
609
647
|
|
|
610
648
|
function showStarOnGitHubMessage() {
|
|
611
649
|
console.log(
|
|
612
|
-
|
|
650
|
+
styleText(
|
|
651
|
+
"cyan",
|
|
652
|
+
"Give Hardhat a star on GitHub if you're enjoying it! ⭐️✨",
|
|
653
|
+
),
|
|
613
654
|
);
|
|
614
655
|
console.log();
|
|
615
|
-
console.log(
|
|
656
|
+
console.log(
|
|
657
|
+
styleText("cyan", " https://github.com/NomicFoundation/hardhat"),
|
|
658
|
+
);
|
|
616
659
|
}
|
|
617
660
|
|
|
618
661
|
// NOTE: This function is exported for testing purposes only.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
2
|
+
|
|
1
3
|
import { execSync } from "node:child_process";
|
|
2
4
|
|
|
3
|
-
import
|
|
5
|
+
import { parseVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
4
6
|
|
|
5
7
|
type PackageManager = "npm" | "yarn" | "pnpm" | "bun" | "deno";
|
|
6
8
|
|
|
@@ -156,7 +158,7 @@ export async function installsPeerDependenciesByDefault(
|
|
|
156
158
|
config,
|
|
157
159
|
);
|
|
158
160
|
// If we couldn't retrieve the npm version, we assume it is higher than 7
|
|
159
|
-
if (npmVersion === undefined || npmVersion
|
|
161
|
+
if (npmVersion === undefined || npmVersion[0] >= 7) {
|
|
160
162
|
// If legacy-peer-deps hasn't been explicitly set to true,
|
|
161
163
|
// peer dependencies are installed by default
|
|
162
164
|
if (legacyPeerDeps !== "true") {
|
|
@@ -177,7 +179,7 @@ export async function installsPeerDependenciesByDefault(
|
|
|
177
179
|
config,
|
|
178
180
|
);
|
|
179
181
|
// If we couldn't retrieve the pnpm version, we assume it is higher than 8
|
|
180
|
-
if (pnpmVersion === undefined || pnpmVersion
|
|
182
|
+
if (pnpmVersion === undefined || pnpmVersion[0] >= 8) {
|
|
181
183
|
// If auto-install-peers hasn't been explicitly set to false,
|
|
182
184
|
// peer dependencies are installed by default
|
|
183
185
|
if (autoInstallPeers !== "false") {
|
|
@@ -207,16 +209,16 @@ async function getVersion(
|
|
|
207
209
|
workspace: string,
|
|
208
210
|
packageManager: PackageManager,
|
|
209
211
|
version?: string,
|
|
210
|
-
): Promise<
|
|
212
|
+
): Promise<SemverVersion | undefined> {
|
|
211
213
|
if (version !== undefined) {
|
|
212
|
-
return
|
|
214
|
+
return parseVersion(version.trim());
|
|
213
215
|
}
|
|
214
216
|
try {
|
|
215
217
|
const versionString = execSync(`${packageManager} --version`, {
|
|
216
218
|
cwd: workspace,
|
|
217
219
|
encoding: "utf8",
|
|
218
220
|
});
|
|
219
|
-
return
|
|
221
|
+
return parseVersion(versionString.trim());
|
|
220
222
|
} catch (_error) {
|
|
221
223
|
return undefined;
|
|
222
224
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Template } from "./template.js";
|
|
2
2
|
|
|
3
|
+
import { styleText } from "node:util";
|
|
4
|
+
|
|
3
5
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
4
6
|
import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
|
|
5
|
-
import chalk from "chalk";
|
|
6
7
|
import enquirer from "enquirer";
|
|
7
8
|
|
|
8
9
|
export async function promptForHardhatVersion(): Promise<
|
|
@@ -116,7 +117,7 @@ export async function promptForInstall(
|
|
|
116
117
|
{
|
|
117
118
|
name: "install",
|
|
118
119
|
type: "confirm",
|
|
119
|
-
message: `You need to install the necessary dependencies using the following command:\n${
|
|
120
|
+
message: `You need to install the necessary dependencies using the following command:\n${styleText("italic", safelyFormattedCommand)}\n\nDo you want to run it now?`,
|
|
120
121
|
initial: true,
|
|
121
122
|
},
|
|
122
123
|
]);
|
|
@@ -133,7 +134,7 @@ export async function promptForUpdate(
|
|
|
133
134
|
{
|
|
134
135
|
name: "update",
|
|
135
136
|
type: "confirm",
|
|
136
|
-
message: `You need to update the following dependencies using the following command:\n${
|
|
137
|
+
message: `You need to update the following dependencies using the following command:\n${styleText("italic", safelyFormattedCommand)}\n\nDo you want to run it now?`,
|
|
137
138
|
initial: true,
|
|
138
139
|
},
|
|
139
140
|
]);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
exists,
|
|
6
6
|
getAllFilesMatching,
|
|
7
7
|
isDirectory,
|
|
8
|
-
|
|
8
|
+
readdirOrEmpty,
|
|
9
9
|
readJsonFile,
|
|
10
10
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
11
11
|
import {
|
|
@@ -40,11 +40,7 @@ export async function getTemplates(
|
|
|
40
40
|
const packageRoot = await findClosestPackageRoot(import.meta.url);
|
|
41
41
|
const pathToTemplates = path.join(packageRoot, "templates", templatesDir);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const pathsToTemplates = await readdir(pathToTemplates);
|
|
43
|
+
const pathsToTemplates = await readdirOrEmpty(pathToTemplates);
|
|
48
44
|
pathsToTemplates.sort();
|
|
49
45
|
|
|
50
46
|
const templates = await Promise.all(
|
|
@@ -65,27 +61,26 @@ export async function getTemplates(
|
|
|
65
61
|
|
|
66
62
|
const packageJson: PackageJson =
|
|
67
63
|
await readJsonFile<PackageJson>(pathToPackageJson);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}).then((fs) => fs.map((f) => path.relative(pathToTemplate, f)));
|
|
64
|
+
|
|
65
|
+
const matchingFiles = await getAllFilesMatching(
|
|
66
|
+
pathToTemplate,
|
|
67
|
+
(f) => {
|
|
68
|
+
// Ignore the package.json file because it is handled separately
|
|
69
|
+
if (f === pathToPackageJson) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// .gitignore files are expected to be called gitignore in the templates
|
|
74
|
+
// because npm ignores .gitignore files during npm pack (see https://github.com/npm/npm/issues/3763)
|
|
75
|
+
if (path.basename(f) === ".gitignore") {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
},
|
|
80
|
+
(dir) => path.basename(dir) !== "node_modules",
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const files = matchingFiles.map((f) => path.relative(pathToTemplate, f));
|
|
89
84
|
|
|
90
85
|
return {
|
|
91
86
|
name,
|
package/src/internal/cli/main.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
} from "../../types/global-options.js";
|
|
5
5
|
import type { HardhatRuntimeEnvironment } from "../../types/hre.js";
|
|
6
6
|
import type { Task, TaskArguments } from "../../types/tasks.js";
|
|
7
|
+
import type { DebugLogger } from "@nomicfoundation/hardhat-utils/debug";
|
|
7
8
|
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
9
10
|
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
assertHardhatInvariant,
|
|
13
14
|
} from "@nomicfoundation/hardhat-errors";
|
|
14
15
|
import { isCi } from "@nomicfoundation/hardhat-utils/ci";
|
|
16
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
15
17
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
16
18
|
import { getRealPath } from "@nomicfoundation/hardhat-utils/fs";
|
|
17
19
|
import {
|
|
@@ -20,7 +22,6 @@ import {
|
|
|
20
22
|
readClosestPackageJson,
|
|
21
23
|
} from "@nomicfoundation/hardhat-utils/package";
|
|
22
24
|
import { kebabToCamelCase } from "@nomicfoundation/hardhat-utils/string";
|
|
23
|
-
import debug from "debug";
|
|
24
25
|
import { register } from "tsx/esm/api";
|
|
25
26
|
|
|
26
27
|
import {
|
|
@@ -69,7 +70,7 @@ export async function main(
|
|
|
69
70
|
|
|
70
71
|
const print = options.print ?? console.log;
|
|
71
72
|
|
|
72
|
-
const log =
|
|
73
|
+
const log = createDebug("hardhat:core:cli:main");
|
|
73
74
|
|
|
74
75
|
let builtinGlobalOptions;
|
|
75
76
|
let configPath;
|
|
@@ -752,7 +753,7 @@ npm pkg set type="module"
|
|
|
752
753
|
*/
|
|
753
754
|
async function isHardhatInstalledLocallyOrLinked(
|
|
754
755
|
configPath: string,
|
|
755
|
-
log:
|
|
756
|
+
log: DebugLogger,
|
|
756
757
|
) {
|
|
757
758
|
try {
|
|
758
759
|
// Based on Node.js resolution algorithm find the real path
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
// is always run during the initialization of the CLI.
|
|
3
3
|
//
|
|
4
4
|
// NOTE: This file shouldn't import any non-builtin dependency, as it's imported
|
|
5
|
-
// before enabling source maps support.
|
|
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.
|
|
6
10
|
|
|
7
|
-
import
|
|
11
|
+
import { getRuntimeInfo } from "@nomicfoundation/hardhat-utils/runtime";
|
|
8
12
|
|
|
9
|
-
export const MIN_SUPPORTED_NODE_VERSION: number[] = [22,
|
|
13
|
+
export const MIN_SUPPORTED_NODE_VERSION: number[] = [22, 13, 0];
|
|
10
14
|
|
|
11
15
|
export function isNodeVersionSupported(): boolean {
|
|
12
16
|
try {
|
|
@@ -15,10 +19,6 @@ export function isNodeVersionSupported(): boolean {
|
|
|
15
19
|
const minor = parseInt(minorStr, 10);
|
|
16
20
|
const patch = parseInt(patchStr, 10);
|
|
17
21
|
|
|
18
|
-
if (major % 2 === 1) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
22
|
if (major < MIN_SUPPORTED_NODE_VERSION[0]) {
|
|
23
23
|
return false;
|
|
24
24
|
} else if (major > MIN_SUPPORTED_NODE_VERSION[0]) {
|
|
@@ -42,12 +42,20 @@ export function isNodeVersionSupported(): boolean {
|
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
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
|
+
|
|
46
53
|
if (!isNodeVersionSupported()) {
|
|
47
|
-
console.
|
|
48
|
-
|
|
49
|
-
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`,
|
|
50
57
|
);
|
|
51
|
-
|
|
58
|
+
|
|
59
|
+
process.exit(1);
|
|
52
60
|
}
|
|
53
61
|
}
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
|
|
9
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
9
10
|
import { spawnDetachedSubProcess } from "@nomicfoundation/hardhat-utils/subprocess";
|
|
10
|
-
import debug from "debug";
|
|
11
11
|
|
|
12
12
|
import { getHardhatVersion } from "../../../utils/package.js";
|
|
13
13
|
import {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
|
|
18
18
|
import { getAnalyticsClientId } from "./utils.js";
|
|
19
19
|
|
|
20
|
-
const log =
|
|
20
|
+
const log = createDebug("hardhat:core:cli:telemetry:analytics");
|
|
21
21
|
|
|
22
22
|
const SESSION_ID = Math.random().toString();
|
|
23
23
|
const ENGAGEMENT_TIME_MSEC = "10000";
|
|
@@ -2,15 +2,15 @@ import type { AnalyticsFile } from "./types.js";
|
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
5
6
|
import {
|
|
6
7
|
exists,
|
|
7
8
|
readJsonFile,
|
|
8
9
|
writeJsonFile,
|
|
9
10
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
10
11
|
import { getTelemetryDir } from "@nomicfoundation/hardhat-utils/global-dir";
|
|
11
|
-
import debug from "debug";
|
|
12
12
|
|
|
13
|
-
const log =
|
|
13
|
+
const log = createDebug("hardhat:core:cli:telemetry:analytics:utils");
|
|
14
14
|
|
|
15
15
|
const ANALYTICS_FILE_NAME = "analytics.json";
|
|
16
16
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
1
2
|
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
2
|
-
import debug from "debug";
|
|
3
3
|
|
|
4
4
|
import { sendErrorTelemetry } from "./reporter.js";
|
|
5
5
|
|
|
6
|
-
const log =
|
|
6
|
+
const log = createDebug("hardhat:core:cli:telemetry:global-error-handlers");
|
|
7
7
|
|
|
8
8
|
function createUnhandledErrorListener(isPromiseRejection: boolean) {
|
|
9
9
|
const description = isPromiseRejection
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
HardhatError,
|
|
3
3
|
HardhatPluginError,
|
|
4
4
|
} from "@nomicfoundation/hardhat-errors";
|
|
5
|
-
import
|
|
5
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
ProviderError,
|
|
@@ -12,7 +12,7 @@ import { UsingHardhat2PluginError } from "../../../using-hardhat2-plugin-errors.
|
|
|
12
12
|
import { getHardhatVersion } from "../../../utils/package.js";
|
|
13
13
|
import { isTelemetryAllowed } from "../telemetry-permissions.js";
|
|
14
14
|
|
|
15
|
-
const log =
|
|
15
|
+
const log = createDebug("hardhat:core:cli:telemetry:sentry:reporter");
|
|
16
16
|
|
|
17
17
|
// export const SENTRY_DSN =
|
|
18
18
|
// "https://d578a176729662a28e7a8da268d36912@o385026.ingest.us.sentry.io/4507685793103872"; // DEV
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax -- Allow top-level await */
|
|
2
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
2
3
|
import { captureMessage, close, captureException } from "@sentry/core";
|
|
3
|
-
import debug from "debug";
|
|
4
4
|
|
|
5
5
|
import { Anonymizer } from "./anonymizer.js";
|
|
6
6
|
import { init } from "./init.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
sendEnvelopeToSentryBackend,
|
|
10
10
|
} from "./transport.js";
|
|
11
11
|
|
|
12
|
-
const log =
|
|
12
|
+
const log = createDebug("hardhat:core:cli:telemetry:sentry:subprocess");
|
|
13
13
|
|
|
14
14
|
const serializedEnvelope = process.argv[2];
|
|
15
15
|
const configPath = process.argv[3] !== "" ? process.argv[3] : undefined;
|
|
@@ -7,10 +7,10 @@ import type {
|
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
|
|
10
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
10
11
|
import { createTransport, serializeEnvelope } from "@sentry/core";
|
|
11
|
-
import debug from "debug";
|
|
12
12
|
|
|
13
|
-
const log =
|
|
13
|
+
const log = createDebug("hardhat:core:cli:telemetry:sentry:transport");
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Creates a detached process transport.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
3
|
import { isCi } from "@nomicfoundation/hardhat-utils/ci";
|
|
4
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
4
5
|
import {
|
|
5
6
|
exists,
|
|
6
7
|
readJsonFile,
|
|
7
8
|
writeJsonFile,
|
|
8
9
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
9
10
|
import { getTelemetryDir } from "@nomicfoundation/hardhat-utils/global-dir";
|
|
10
|
-
import debug from "debug";
|
|
11
11
|
|
|
12
12
|
import { sendTelemetryConfigAnalytics } from "./analytics/analytics.js";
|
|
13
13
|
|
|
14
|
-
const log =
|
|
14
|
+
const log = createDebug("hardhat:core:cli:telemetry:permissions");
|
|
15
15
|
|
|
16
16
|
interface TelemetryConfig {
|
|
17
17
|
enabled: boolean;
|