hardhat 3.1.9 → 3.1.11
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 +33 -0
- package/dist/src/config.d.ts +20 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +31 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +33 -21
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +3 -5
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +7 -19
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +42 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/index.js +1 -0
- package/dist/src/internal/builtin-plugins/coverage/index.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 +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +3 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +7 -19
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +42 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- 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 +17 -20
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts +0 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js +0 -6
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +1 -3
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +0 -49
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js +58 -20
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +8 -0
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.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 +1 -2
- package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-results.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +1 -0
- 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 +14 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +1 -1
- 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 +0 -3
- 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 +3 -5
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +4 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts +5 -2
- 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 +8 -2
- 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/error-messages.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js +19 -5
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts +21 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +84 -25
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts +3 -12
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +1 -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/solc-config-selection.d.ts +8 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js +103 -27
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js.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/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +5 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +22 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.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/edr-artifacts.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +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 +16 -27
- 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/telemetry/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/task-action.js +3 -2
- package/dist/src/internal/builtin-plugins/telemetry/task-action.js.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 +40 -13
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +27 -0
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/cli/banner-manager.d.ts +26 -0
- package/dist/src/internal/cli/banner-manager.d.ts.map +1 -0
- package/dist/src/internal/cli/banner-manager.js +146 -0
- package/dist/src/internal/cli/banner-manager.js.map +1 -0
- package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
- package/dist/src/internal/cli/error-handler.js +15 -0
- package/dist/src/internal/cli/error-handler.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +8 -0
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +18 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/subprocess.js +2 -0
- package/dist/src/internal/cli/telemetry/analytics/subprocess.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymize-paths.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +4 -0
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js +47 -38
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js.map +1 -1
- package/dist/src/internal/core/config-validation.d.ts +3 -3
- package/dist/src/internal/core/config-validation.d.ts.map +1 -1
- package/dist/src/internal/core/config-validation.js +48 -18
- package/dist/src/internal/core/config-validation.js.map +1 -1
- package/dist/src/internal/core/tasks/builders.d.ts +26 -16
- package/dist/src/internal/core/tasks/builders.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/builders.js +65 -6
- package/dist/src/internal/core/tasks/builders.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.d.ts +2 -2
- package/dist/src/internal/core/tasks/resolved-task.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +23 -9
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.js +14 -6
- package/dist/src/internal/core/tasks/task-manager.js.map +1 -1
- package/dist/src/internal/core/tasks/validations.d.ts +2 -0
- package/dist/src/internal/core/tasks/validations.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/validations.js +11 -0
- package/dist/src/internal/core/tasks/validations.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +1 -1
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts +2 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts.map +1 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js +12 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js.map +1 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts +35 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.js +98 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -0
- package/dist/src/plugins.d.ts +8 -0
- package/dist/src/plugins.d.ts.map +1 -1
- package/dist/src/plugins.js +13 -0
- package/dist/src/plugins.js.map +1 -1
- package/dist/src/types/artifacts.d.ts +32 -3
- package/dist/src/types/artifacts.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +15 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +15 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/network.d.ts +1 -1
- package/dist/src/types/plugins.d.ts +2 -2
- package/dist/src/types/solidity/build-system.d.ts +56 -10
- package/dist/src/types/solidity/build-system.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.js +26 -2
- package/dist/src/types/solidity/build-system.js.map +1 -1
- package/dist/src/types/solidity/errors.d.ts +18 -0
- package/dist/src/types/solidity/errors.d.ts.map +1 -1
- package/dist/src/types/solidity/errors.js.map +1 -1
- package/dist/src/types/solidity/resolved-file.d.ts +2 -2
- package/dist/src/types/tasks.d.ts +103 -34
- package/dist/src/types/tasks.d.ts.map +1 -1
- package/dist/src/types/tasks.js.map +1 -1
- package/dist/src/types/test.d.ts +11 -0
- package/dist/src/types/test.d.ts.map +1 -1
- package/dist/src/types/utils.d.ts +16 -0
- package/dist/src/types/utils.d.ts.map +1 -1
- package/dist/src/utils/result.d.ts +33 -0
- package/dist/src/utils/result.d.ts.map +1 -0
- package/dist/src/utils/result.js +43 -0
- package/dist/src/utils/result.js.map +1 -0
- package/package.json +12 -7
- package/src/config.ts +37 -0
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +4 -1
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +4 -1
- package/src/internal/builtin-plugins/coverage/coverage-manager.ts +57 -50
- package/src/internal/builtin-plugins/coverage/helpers.ts +11 -29
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +68 -0
- package/src/internal/builtin-plugins/coverage/index.ts +1 -0
- package/src/internal/builtin-plugins/flatten/task-action.ts +1 -0
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +4 -4
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +11 -29
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +68 -0
- package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +21 -28
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.ts +5 -2
- package/src/internal/builtin-plugins/network-manager/edr/type-validation.ts +0 -13
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +0 -64
- package/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts +65 -21
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +9 -0
- package/src/internal/builtin-plugins/node/task-action.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-results.ts +3 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +16 -5
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +7 -6
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +23 -1
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +17 -3
- package/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.ts +19 -5
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +139 -35
- package/src/internal/builtin-plugins/solidity/build-system/resolver/types.ts +3 -9
- package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +125 -28
- package/src/internal/builtin-plugins/solidity/config.ts +2 -2
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +8 -0
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +1 -1
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +28 -0
- package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/runner.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +36 -38
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/telemetry/task-action.ts +4 -2
- package/src/internal/builtin-plugins/test/task-action.ts +71 -25
- package/src/internal/builtin-plugins/test/type-extensions.ts +42 -0
- package/src/internal/cli/banner-manager.ts +234 -0
- package/src/internal/cli/error-handler.ts +18 -0
- package/src/internal/cli/init/init.ts +8 -0
- package/src/internal/cli/main.ts +19 -1
- package/src/internal/cli/telemetry/analytics/subprocess.ts +2 -0
- package/src/internal/cli/telemetry/sentry/anonymize-paths.ts +1 -1
- package/src/internal/cli/telemetry/sentry/reporter.ts +5 -0
- package/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.ts +98 -50
- package/src/internal/core/config-validation.ts +67 -18
- package/src/internal/core/tasks/builders.ts +174 -30
- package/src/internal/core/tasks/resolved-task.ts +31 -13
- package/src/internal/core/tasks/task-manager.ts +23 -5
- package/src/internal/core/tasks/validations.ts +40 -0
- package/src/internal/core/user-interruptions.ts +1 -1
- package/src/internal/deprecated-module-imported-from-hardhat2-plugin.ts +12 -0
- package/src/internal/using-hardhat2-plugin-errors.ts +108 -0
- package/src/plugins.ts +16 -0
- package/src/types/artifacts.ts +40 -3
- package/src/types/hre.ts +1 -1
- package/src/types/index.ts +14 -0
- package/src/types/network.ts +1 -1
- package/src/types/plugins.ts +2 -2
- package/src/types/solidity/build-system.ts +75 -14
- package/src/types/solidity/errors.ts +22 -0
- package/src/types/solidity/resolved-file.ts +2 -2
- package/src/types/tasks.ts +143 -36
- package/src/types/test.ts +12 -0
- package/src/types/utils.ts +14 -0
- package/src/utils/result.ts +57 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +11 -11
- package/templates/hardhat-3/02-mocha-ethers/package.json +16 -16
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts +0 -19
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js +0 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js.map +0 -1
- package/src/internal/builtin-plugins/network-manager/edr/types/output.ts +0 -19
package/src/internal/cli/main.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
type OptionDefinition,
|
|
29
29
|
type PositionalArgumentDefinition,
|
|
30
30
|
} from "../../types/arguments.js";
|
|
31
|
+
import { isResult } from "../../utils/result.js";
|
|
31
32
|
import { BUILTIN_GLOBAL_OPTIONS_DEFINITIONS } from "../builtin-global-options.js";
|
|
32
33
|
import { builtinPlugins } from "../builtin-plugins/index.js";
|
|
33
34
|
import {
|
|
@@ -217,7 +218,24 @@ export async function main(
|
|
|
217
218
|
|
|
218
219
|
log(`Running task "${task.id.join(" ")}"`);
|
|
219
220
|
|
|
220
|
-
await Promise.all([
|
|
221
|
+
const [taskResult] = await Promise.all([
|
|
222
|
+
task.run(taskArguments),
|
|
223
|
+
sendTaskAnalytics(task.id),
|
|
224
|
+
]);
|
|
225
|
+
|
|
226
|
+
if (isResult(taskResult) && !taskResult.success) {
|
|
227
|
+
process.exitCode = 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!isCi() && process.stdout.isTTY === true) {
|
|
231
|
+
try {
|
|
232
|
+
const { BannerManager } = await import("./banner-manager.js");
|
|
233
|
+
const bannerManager = await BannerManager.getInstance();
|
|
234
|
+
await bannerManager.showBanner(200);
|
|
235
|
+
} catch (bannerError) {
|
|
236
|
+
log("Error showing banner", bannerError);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
221
239
|
} catch (error) {
|
|
222
240
|
ensureError(error);
|
|
223
241
|
printErrorMessages(error, builtinGlobalOptions?.showStackTraces);
|
|
@@ -5,7 +5,9 @@ import { postJsonRequest } from "@nomicfoundation/hardhat-utils/request";
|
|
|
5
5
|
|
|
6
6
|
// These keys are expected to be public
|
|
7
7
|
const ANALYTICS_URL = "https://www.google-analytics.com/mp/collect";
|
|
8
|
+
/* cspell:disable-next-line */
|
|
8
9
|
// const API_SECRET = "iXzTRik5RhahYpgiatSv1w"; // DEV
|
|
10
|
+
/* cspell:disable-next-line */
|
|
9
11
|
// const MEASUREMENT_ID = "G-ZFZWHGZ64H"; // DEV
|
|
10
12
|
const API_SECRET = "fQ5joCsDRTOp55wX8a2cVw"; // PROD
|
|
11
13
|
const MEASUREMENT_ID = "G-8LQ007N2QJ"; // PROD
|
|
@@ -107,7 +107,7 @@ function anonymizeSinglePath(path: string): string {
|
|
|
107
107
|
return normalizedPath;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// We first get the index of the first /node_modules to
|
|
110
|
+
// We first get the index of the first /node_modules to disambiguate some
|
|
111
111
|
// special cases below
|
|
112
112
|
const nodeModulesIndex = normalizedPath.indexOf("/node_modules");
|
|
113
113
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ProviderError,
|
|
9
9
|
UnknownError,
|
|
10
10
|
} from "../../../builtin-plugins/network-manager/provider-errors.js";
|
|
11
|
+
import { UsingHardhat2PluginError } from "../../../using-hardhat2-plugin-errors.js";
|
|
11
12
|
import { getHardhatVersion } from "../../../utils/package.js";
|
|
12
13
|
import { isTelemetryAllowed } from "../telemetry-permissions.js";
|
|
13
14
|
|
|
@@ -134,6 +135,10 @@ class Reporter {
|
|
|
134
135
|
return false;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
if (error instanceof UsingHardhat2PluginError) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
137
142
|
if (HardhatPluginError.isHardhatPluginError(error)) {
|
|
138
143
|
// Don't log errors from third-party plugins
|
|
139
144
|
return false;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable -- This file is vendored from https://github.com/getsentry/sentry-javascript/blob/9.4.0/packages/node/src/integrations/contextlines.ts */
|
|
2
2
|
|
|
3
|
-
import { createReadStream } from
|
|
4
|
-
import { createInterface } from
|
|
5
|
-
import type { Event, IntegrationFn, StackFrame } from
|
|
6
|
-
import { LRUMap, defineIntegration, logger, snipLine } from
|
|
7
|
-
import { DEBUG_BUILD } from
|
|
3
|
+
import { createReadStream } from "node:fs";
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
|
+
import type { Event, IntegrationFn, StackFrame } from "@sentry/core";
|
|
6
|
+
import { LRUMap, defineIntegration, logger, snipLine } from "@sentry/core";
|
|
7
|
+
import { DEBUG_BUILD } from "../debug-build.js";
|
|
8
8
|
|
|
9
9
|
const LRU_FILE_CONTENTS_CACHE = new LRUMap<string, Record<number, string>>(10);
|
|
10
10
|
const LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap<string, 1>(20);
|
|
11
11
|
const DEFAULT_LINES_OF_CONTEXT = 7;
|
|
12
|
-
const INTEGRATION_NAME =
|
|
12
|
+
const INTEGRATION_NAME = "ContextLines";
|
|
13
13
|
// Determines the upper bound of lineno/colno that we will attempt to read. Large colno values are likely to be
|
|
14
14
|
// minified code while large lineno values are likely to be bundled code.
|
|
15
15
|
// Exported for testing purposes.
|
|
@@ -36,7 +36,11 @@ export function resetFileContentCache(): void {
|
|
|
36
36
|
/**
|
|
37
37
|
* Get or init map value
|
|
38
38
|
*/
|
|
39
|
-
function emplace<T extends LRUMap<K, V>, K extends string, V>(
|
|
39
|
+
function emplace<T extends LRUMap<K, V>, K extends string, V>(
|
|
40
|
+
map: T,
|
|
41
|
+
key: K,
|
|
42
|
+
contents: V,
|
|
43
|
+
): V {
|
|
40
44
|
const value = map.get(key);
|
|
41
45
|
|
|
42
46
|
if (value === undefined) {
|
|
@@ -49,18 +53,18 @@ function emplace<T extends LRUMap<K, V>, K extends string, V>(map: T, key: K, co
|
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
55
|
* Determines if context lines should be skipped for a file.
|
|
52
|
-
* - .min.(mjs|cjs|js) files are and not useful since they
|
|
56
|
+
* - .min.(mjs|cjs|js) files are and not useful since they don't point to the original source
|
|
53
57
|
* - node: prefixed modules are part of the runtime and cannot be resolved to a file
|
|
54
58
|
* - data: skip json, wasm and inline js https://nodejs.org/api/esm.html#data-imports
|
|
55
59
|
*/
|
|
56
60
|
function shouldSkipContextLinesForFile(path: string): boolean {
|
|
57
61
|
// Test the most common prefix and extension first. These are the ones we
|
|
58
62
|
// are most likely to see in user applications and are the ones we can break out of first.
|
|
59
|
-
if (path.startsWith(
|
|
60
|
-
if (path.endsWith(
|
|
61
|
-
if (path.endsWith(
|
|
62
|
-
if (path.endsWith(
|
|
63
|
-
if (path.startsWith(
|
|
63
|
+
if (path.startsWith("node:")) return true;
|
|
64
|
+
if (path.endsWith(".min.js")) return true;
|
|
65
|
+
if (path.endsWith(".min.cjs")) return true;
|
|
66
|
+
if (path.endsWith(".min.mjs")) return true;
|
|
67
|
+
if (path.startsWith("data:")) return true;
|
|
64
68
|
return false;
|
|
65
69
|
}
|
|
66
70
|
|
|
@@ -68,14 +72,19 @@ function shouldSkipContextLinesForFile(path: string): boolean {
|
|
|
68
72
|
* Determines if we should skip contextlines based off the max lineno and colno values.
|
|
69
73
|
*/
|
|
70
74
|
function shouldSkipContextLinesForFrame(frame: StackFrame): boolean {
|
|
71
|
-
if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO)
|
|
72
|
-
|
|
75
|
+
if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO)
|
|
76
|
+
return true;
|
|
77
|
+
if (frame.colno !== undefined && frame.colno > MAX_CONTEXTLINES_COLNO)
|
|
78
|
+
return true;
|
|
73
79
|
return false;
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Checks if we have all the contents that we need in the cache.
|
|
77
83
|
*/
|
|
78
|
-
function rangeExistsInContentCache(
|
|
84
|
+
function rangeExistsInContentCache(
|
|
85
|
+
file: string,
|
|
86
|
+
range: ReadlineRange,
|
|
87
|
+
): boolean {
|
|
79
88
|
const contents = LRU_FILE_CONTENTS_CACHE.get(file);
|
|
80
89
|
if (contents === undefined) return false;
|
|
81
90
|
|
|
@@ -92,7 +101,10 @@ function rangeExistsInContentCache(file: string, range: ReadlineRange): boolean
|
|
|
92
101
|
* Creates contiguous ranges of lines to read from a file. In the case where context lines overlap,
|
|
93
102
|
* the ranges are merged to create a single range.
|
|
94
103
|
*/
|
|
95
|
-
function makeLineReaderRanges(
|
|
104
|
+
function makeLineReaderRanges(
|
|
105
|
+
lines: number[],
|
|
106
|
+
linecontext: number,
|
|
107
|
+
): ReadlineRange[] {
|
|
96
108
|
if (!lines.length) {
|
|
97
109
|
return [];
|
|
98
110
|
}
|
|
@@ -100,7 +112,7 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
|
|
|
100
112
|
let i = 0;
|
|
101
113
|
const line = lines[0];
|
|
102
114
|
|
|
103
|
-
if (typeof line !==
|
|
115
|
+
if (typeof line !== "number") {
|
|
104
116
|
return [];
|
|
105
117
|
}
|
|
106
118
|
|
|
@@ -115,7 +127,7 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
|
|
|
115
127
|
|
|
116
128
|
// If the next line falls into the current range, extend the current range to lineno + linecontext.
|
|
117
129
|
const next = lines[i + 1];
|
|
118
|
-
if (typeof next !==
|
|
130
|
+
if (typeof next !== "number") {
|
|
119
131
|
break;
|
|
120
132
|
}
|
|
121
133
|
if (next <= current[1]) {
|
|
@@ -134,13 +146,17 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
|
|
|
134
146
|
/**
|
|
135
147
|
* Extracts lines from a file and stores them in a cache.
|
|
136
148
|
*/
|
|
137
|
-
function getContextLinesFromFile(
|
|
149
|
+
function getContextLinesFromFile(
|
|
150
|
+
path: string,
|
|
151
|
+
ranges: ReadlineRange[],
|
|
152
|
+
output: Record<number, string>,
|
|
153
|
+
): Promise<void> {
|
|
138
154
|
return new Promise((resolve, _reject) => {
|
|
139
155
|
// It is important *not* to have any async code between createInterface and the 'line' event listener
|
|
140
156
|
// as it will cause the 'line' event to
|
|
141
157
|
// be emitted before the listener is attached.
|
|
142
158
|
const stream = createReadStream(path);
|
|
143
|
-
const
|
|
159
|
+
const lineRead = createInterface({
|
|
144
160
|
input: stream,
|
|
145
161
|
});
|
|
146
162
|
|
|
@@ -170,18 +186,18 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
170
186
|
// Mark file path as failed to read and prevent multiple read attempts.
|
|
171
187
|
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path, 1);
|
|
172
188
|
DEBUG_BUILD && logger.error(`Failed to read file: ${path}. Error: ${e}`);
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
lineRead.close();
|
|
190
|
+
lineRead.removeAllListeners();
|
|
175
191
|
destroyStreamAndResolve();
|
|
176
192
|
}
|
|
177
193
|
|
|
178
194
|
// We need to handle the error event to prevent the process from crashing in < Node 16
|
|
179
195
|
// https://github.com/nodejs/node/pull/31603
|
|
180
|
-
stream.on(
|
|
181
|
-
|
|
182
|
-
|
|
196
|
+
stream.on("error", onStreamError);
|
|
197
|
+
lineRead.on("error", onStreamError);
|
|
198
|
+
lineRead.on("close", destroyStreamAndResolve);
|
|
183
199
|
|
|
184
|
-
|
|
200
|
+
lineRead.on("line", (line) => {
|
|
185
201
|
lineNumber++;
|
|
186
202
|
if (lineNumber < rangeStart) return;
|
|
187
203
|
|
|
@@ -191,16 +207,16 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
191
207
|
if (lineNumber >= rangeEnd) {
|
|
192
208
|
if (currentRangeIndex === ranges.length - 1) {
|
|
193
209
|
// We need to close the file stream and remove listeners, else the reader will continue to run our listener;
|
|
194
|
-
|
|
195
|
-
|
|
210
|
+
lineRead.close();
|
|
211
|
+
lineRead.removeAllListeners();
|
|
196
212
|
return;
|
|
197
213
|
}
|
|
198
214
|
currentRangeIndex++;
|
|
199
215
|
const range = ranges[currentRangeIndex];
|
|
200
216
|
if (range === undefined) {
|
|
201
217
|
// This should never happen as it means we have a bug in the context.
|
|
202
|
-
|
|
203
|
-
|
|
218
|
+
lineRead.close();
|
|
219
|
+
lineRead.removeAllListeners();
|
|
204
220
|
return;
|
|
205
221
|
}
|
|
206
222
|
rangeStart = range[0];
|
|
@@ -217,7 +233,10 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
|
|
|
217
233
|
* failing reads from happening.
|
|
218
234
|
*/
|
|
219
235
|
|
|
220
|
-
async function addSourceContext(
|
|
236
|
+
async function addSourceContext(
|
|
237
|
+
event: Event,
|
|
238
|
+
contextLines: number,
|
|
239
|
+
): Promise<Event> {
|
|
221
240
|
// keep a lookup map of which files we've already enqueued to read,
|
|
222
241
|
// so we don't enqueue the same file multiple times which would cause multiple i/o reads
|
|
223
242
|
const filesToLines: Record<string, number[]> = {};
|
|
@@ -236,8 +255,8 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
|
|
|
236
255
|
|
|
237
256
|
if (
|
|
238
257
|
!frame ||
|
|
239
|
-
typeof filename !==
|
|
240
|
-
typeof frame.lineno !==
|
|
258
|
+
typeof filename !== "string" ||
|
|
259
|
+
typeof frame.lineno !== "number" ||
|
|
241
260
|
shouldSkipContextLinesForFile(filename) ||
|
|
242
261
|
shouldSkipContextLinesForFrame(frame)
|
|
243
262
|
) {
|
|
@@ -258,7 +277,7 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
|
|
|
258
277
|
|
|
259
278
|
const readlinePromises: Promise<void>[] = [];
|
|
260
279
|
for (const file of files) {
|
|
261
|
-
// If we failed to read this before,
|
|
280
|
+
// If we failed to read this before, don't try reading it again.
|
|
262
281
|
if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(file)) {
|
|
263
282
|
continue;
|
|
264
283
|
}
|
|
@@ -272,7 +291,7 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
|
|
|
272
291
|
filesToLineRanges.sort((a, b) => a - b);
|
|
273
292
|
// Check if the contents are already in the cache and if we can avoid reading the file again.
|
|
274
293
|
const ranges = makeLineReaderRanges(filesToLineRanges, contextLines);
|
|
275
|
-
if (ranges.every(r => rangeExistsInContentCache(file, r))) {
|
|
294
|
+
if (ranges.every((r) => rangeExistsInContentCache(file, r))) {
|
|
276
295
|
continue;
|
|
277
296
|
}
|
|
278
297
|
|
|
@@ -282,15 +301,25 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
|
|
|
282
301
|
|
|
283
302
|
// The promise rejections are caught in order to prevent them from short circuiting Promise.all
|
|
284
303
|
await Promise.all(readlinePromises).catch(() => {
|
|
285
|
-
DEBUG_BUILD &&
|
|
304
|
+
DEBUG_BUILD &&
|
|
305
|
+
logger.log(
|
|
306
|
+
"Failed to read one or more source files and resolve context lines",
|
|
307
|
+
);
|
|
286
308
|
});
|
|
287
309
|
|
|
288
310
|
// Perform the same loop as above, but this time we can assume all files are in the cache
|
|
289
311
|
// and attempt to add source context to frames.
|
|
290
312
|
if (contextLines > 0 && event.exception?.values) {
|
|
291
313
|
for (const exception of event.exception.values) {
|
|
292
|
-
if (
|
|
293
|
-
|
|
314
|
+
if (
|
|
315
|
+
exception.stacktrace?.frames &&
|
|
316
|
+
exception.stacktrace.frames.length > 0
|
|
317
|
+
) {
|
|
318
|
+
addSourceContextToFrames(
|
|
319
|
+
exception.stacktrace.frames,
|
|
320
|
+
contextLines,
|
|
321
|
+
LRU_FILE_CONTENTS_CACHE,
|
|
322
|
+
);
|
|
294
323
|
}
|
|
295
324
|
}
|
|
296
325
|
}
|
|
@@ -307,7 +336,11 @@ function addSourceContextToFrames(
|
|
|
307
336
|
): void {
|
|
308
337
|
for (const frame of frames) {
|
|
309
338
|
// Only add context if we have a filename and it hasn't already been added
|
|
310
|
-
if (
|
|
339
|
+
if (
|
|
340
|
+
frame.filename &&
|
|
341
|
+
frame.context_line === undefined &&
|
|
342
|
+
typeof frame.lineno === "number"
|
|
343
|
+
) {
|
|
311
344
|
const contents = cache.get(frame.filename);
|
|
312
345
|
if (contents === undefined) {
|
|
313
346
|
continue;
|
|
@@ -340,29 +373,34 @@ export function addContextToFrame(
|
|
|
340
373
|
// When there is no line number in the frame, attaching context is nonsensical and will even break grouping.
|
|
341
374
|
// We already check for lineno before calling this, but since StackFrame lineno ism optional, we check it again.
|
|
342
375
|
if (frame.lineno === undefined || contents === undefined) {
|
|
343
|
-
DEBUG_BUILD &&
|
|
376
|
+
DEBUG_BUILD &&
|
|
377
|
+
logger.error(
|
|
378
|
+
"Cannot resolve context for frame with no lineno or file contents",
|
|
379
|
+
);
|
|
344
380
|
return;
|
|
345
381
|
}
|
|
346
382
|
|
|
347
383
|
frame.pre_context = [];
|
|
348
384
|
for (let i = makeRangeStart(lineno, contextLines); i < lineno; i++) {
|
|
349
|
-
// We always expect the start context as line numbers cannot be negative. If we
|
|
385
|
+
// We always expect the start context as line numbers cannot be negative. If we don't find a line, then
|
|
350
386
|
// something went wrong somewhere. Clear the context and return without adding any linecontext.
|
|
351
387
|
const line = contents[i];
|
|
352
388
|
if (line === undefined) {
|
|
353
389
|
clearLineContext(frame);
|
|
354
|
-
DEBUG_BUILD &&
|
|
390
|
+
DEBUG_BUILD &&
|
|
391
|
+
logger.error(`Could not find line ${i} in file ${frame.filename}`);
|
|
355
392
|
return;
|
|
356
393
|
}
|
|
357
394
|
|
|
358
395
|
frame.pre_context.push(line);
|
|
359
396
|
}
|
|
360
397
|
|
|
361
|
-
// We should always have the context line. If we
|
|
398
|
+
// We should always have the context line. If we don't, something went wrong, so we clear the context and return
|
|
362
399
|
// without adding any linecontext.
|
|
363
400
|
if (contents[lineno] === undefined) {
|
|
364
401
|
clearLineContext(frame);
|
|
365
|
-
DEBUG_BUILD &&
|
|
402
|
+
DEBUG_BUILD &&
|
|
403
|
+
logger.error(`Could not find line ${lineno} in file ${frame.filename}`);
|
|
366
404
|
return;
|
|
367
405
|
}
|
|
368
406
|
|
|
@@ -371,7 +409,7 @@ export function addContextToFrame(
|
|
|
371
409
|
const end = makeRangeEnd(lineno, contextLines);
|
|
372
410
|
frame.post_context = [];
|
|
373
411
|
for (let i = lineno + 1; i <= end; i++) {
|
|
374
|
-
// Since we
|
|
412
|
+
// Since we don't track when the file ends, we cant clear the context if we don't find a line as it could
|
|
375
413
|
// just be that we reached the end of the file.
|
|
376
414
|
const line = contents[i];
|
|
377
415
|
if (line === undefined) {
|
|
@@ -393,13 +431,21 @@ function makeRangeEnd(line: number, linecontext: number): number {
|
|
|
393
431
|
return line + linecontext;
|
|
394
432
|
}
|
|
395
433
|
// Determine start and end indices for context range (inclusive);
|
|
396
|
-
function makeContextRange(
|
|
434
|
+
function makeContextRange(
|
|
435
|
+
line: number,
|
|
436
|
+
linecontext: number,
|
|
437
|
+
): [start: number, end: number] {
|
|
397
438
|
return [makeRangeStart(line, linecontext), makeRangeEnd(line, linecontext)];
|
|
398
439
|
}
|
|
399
440
|
|
|
400
441
|
/** Exported only for tests, as a type-safe variant. */
|
|
401
|
-
export const _contextLinesIntegration: any = ((
|
|
402
|
-
|
|
442
|
+
export const _contextLinesIntegration: any = ((
|
|
443
|
+
options: ContextLinesOptions = {},
|
|
444
|
+
) => {
|
|
445
|
+
const contextLines =
|
|
446
|
+
options.frameContextLines !== undefined
|
|
447
|
+
? options.frameContextLines
|
|
448
|
+
: DEFAULT_LINES_OF_CONTEXT;
|
|
403
449
|
|
|
404
450
|
return {
|
|
405
451
|
name: INTEGRATION_NAME,
|
|
@@ -412,4 +458,6 @@ export const _contextLinesIntegration: any = ((options: ContextLinesOptions = {}
|
|
|
412
458
|
/**
|
|
413
459
|
* Capture the lines before and after the frame's context.
|
|
414
460
|
*/
|
|
415
|
-
export const contextLinesIntegration: any = defineIntegration(
|
|
461
|
+
export const contextLinesIntegration: any = defineIntegration(
|
|
462
|
+
_contextLinesIntegration,
|
|
463
|
+
);
|
|
@@ -18,9 +18,9 @@ import {
|
|
|
18
18
|
} from "../../types/arguments.js";
|
|
19
19
|
import {
|
|
20
20
|
type EmptyTaskDefinition,
|
|
21
|
+
TaskDefinitionType,
|
|
21
22
|
type NewTaskDefinition,
|
|
22
23
|
type TaskDefinition,
|
|
23
|
-
TaskDefinitionType,
|
|
24
24
|
type TaskOverrideDefinition,
|
|
25
25
|
} from "../../types/tasks.js";
|
|
26
26
|
|
|
@@ -185,6 +185,7 @@ function validatePath(
|
|
|
185
185
|
export function validateTasksConfig(
|
|
186
186
|
tasks: TaskDefinition[],
|
|
187
187
|
path: Array<string | number> = [],
|
|
188
|
+
isPlugin: boolean = false,
|
|
188
189
|
): HardhatUserConfigValidationError[] {
|
|
189
190
|
const validationErrors: HardhatUserConfigValidationError[] = [];
|
|
190
191
|
|
|
@@ -207,13 +208,13 @@ export function validateTasksConfig(
|
|
|
207
208
|
}
|
|
208
209
|
case TaskDefinitionType.NEW_TASK: {
|
|
209
210
|
validationErrors.push(
|
|
210
|
-
...validateNewTask(task, [...path, "tasks", index]),
|
|
211
|
+
...validateNewTask(task, [...path, "tasks", index], isPlugin),
|
|
211
212
|
);
|
|
212
213
|
break;
|
|
213
214
|
}
|
|
214
215
|
case TaskDefinitionType.TASK_OVERRIDE: {
|
|
215
216
|
validationErrors.push(
|
|
216
|
-
...validateTaskOverride(task, [...path, "tasks", index]),
|
|
217
|
+
...validateTaskOverride(task, [...path, "tasks", index], isPlugin),
|
|
217
218
|
);
|
|
218
219
|
break;
|
|
219
220
|
}
|
|
@@ -252,6 +253,7 @@ export function validateEmptyTask(
|
|
|
252
253
|
export function validateNewTask(
|
|
253
254
|
task: NewTaskDefinition,
|
|
254
255
|
path: Array<string | number>,
|
|
256
|
+
isPlugin: boolean = false,
|
|
255
257
|
): HardhatUserConfigValidationError[] {
|
|
256
258
|
const validationErrors: HardhatUserConfigValidationError[] = [];
|
|
257
259
|
|
|
@@ -272,13 +274,7 @@ export function validateNewTask(
|
|
|
272
274
|
});
|
|
273
275
|
}
|
|
274
276
|
|
|
275
|
-
|
|
276
|
-
validationErrors.push({
|
|
277
|
-
path: [...path, "action"],
|
|
278
|
-
message:
|
|
279
|
-
"task action must be a lazy import function returning a module with a default export",
|
|
280
|
-
});
|
|
281
|
-
}
|
|
277
|
+
validationErrors.push(...validateActionFields(task, path, isPlugin));
|
|
282
278
|
|
|
283
279
|
if (isObject(task.options)) {
|
|
284
280
|
validationErrors.push(
|
|
@@ -308,6 +304,7 @@ export function validateNewTask(
|
|
|
308
304
|
export function validateTaskOverride(
|
|
309
305
|
task: TaskOverrideDefinition,
|
|
310
306
|
path: Array<string | number>,
|
|
307
|
+
isPlugin: boolean = false,
|
|
311
308
|
): HardhatUserConfigValidationError[] {
|
|
312
309
|
const validationErrors: HardhatUserConfigValidationError[] = [];
|
|
313
310
|
|
|
@@ -328,13 +325,7 @@ export function validateTaskOverride(
|
|
|
328
325
|
});
|
|
329
326
|
}
|
|
330
327
|
|
|
331
|
-
|
|
332
|
-
validationErrors.push({
|
|
333
|
-
path: [...path, "action"],
|
|
334
|
-
message:
|
|
335
|
-
"task action must be a lazy import function returning a module with a default export",
|
|
336
|
-
});
|
|
337
|
-
}
|
|
328
|
+
validationErrors.push(...validateActionFields(task, path, isPlugin));
|
|
338
329
|
|
|
339
330
|
if (isObject(task.options)) {
|
|
340
331
|
validationErrors.push(
|
|
@@ -350,6 +341,60 @@ export function validateTaskOverride(
|
|
|
350
341
|
return validationErrors;
|
|
351
342
|
}
|
|
352
343
|
|
|
344
|
+
function validateActionFields(
|
|
345
|
+
task: { action?: unknown; inlineAction?: unknown },
|
|
346
|
+
path: Array<string | number>,
|
|
347
|
+
isPlugin: boolean = false,
|
|
348
|
+
): HardhatUserConfigValidationError[] {
|
|
349
|
+
const validationErrors: HardhatUserConfigValidationError[] = [];
|
|
350
|
+
|
|
351
|
+
// Mutual exclusivity: cannot have both action and inlineAction
|
|
352
|
+
if (task.action !== undefined && task.inlineAction !== undefined) {
|
|
353
|
+
validationErrors.push({
|
|
354
|
+
path: [...path],
|
|
355
|
+
message: 'task cannot define both "action" and "inlineAction"',
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (isPlugin && task.inlineAction !== undefined) {
|
|
360
|
+
validationErrors.push({
|
|
361
|
+
path: [...path, "inlineAction"],
|
|
362
|
+
message:
|
|
363
|
+
"plugins cannot use inline actions. Use a lazy action import instead",
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// At least one action must be defined
|
|
368
|
+
if (task.action === undefined && task.inlineAction === undefined) {
|
|
369
|
+
validationErrors.push({
|
|
370
|
+
path: [...path, "action"],
|
|
371
|
+
message: 'task must define either "action" or "inlineAction"',
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (task.action !== undefined) {
|
|
376
|
+
if (typeof task.action !== "function") {
|
|
377
|
+
validationErrors.push({
|
|
378
|
+
path: [...path, "action"],
|
|
379
|
+
message:
|
|
380
|
+
"task action must be a lazy import function returning a module with a default export",
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (task.inlineAction !== undefined) {
|
|
386
|
+
if (typeof task.inlineAction !== "function") {
|
|
387
|
+
validationErrors.push({
|
|
388
|
+
path: [...path, "inlineAction"],
|
|
389
|
+
message:
|
|
390
|
+
"task inlineAction must be a function implementing the task's behavior",
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return validationErrors;
|
|
396
|
+
}
|
|
397
|
+
|
|
353
398
|
export function validateOptions(
|
|
354
399
|
options: Record<string, OptionDefinition>,
|
|
355
400
|
path: Array<string | number>,
|
|
@@ -665,7 +710,11 @@ export function validatePluginsConfig(
|
|
|
665
710
|
if (plugin.tasks !== undefined) {
|
|
666
711
|
if (Array.isArray(plugin.tasks)) {
|
|
667
712
|
validationErrors.push(
|
|
668
|
-
...validateTasksConfig(
|
|
713
|
+
...validateTasksConfig(
|
|
714
|
+
plugin.tasks,
|
|
715
|
+
[...path, "plugins", index],
|
|
716
|
+
true,
|
|
717
|
+
),
|
|
669
718
|
);
|
|
670
719
|
} else {
|
|
671
720
|
validationErrors.push({
|