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.
Files changed (298) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/src/config.d.ts +20 -0
  3. package/dist/src/config.d.ts.map +1 -1
  4. package/dist/src/config.js +31 -0
  5. package/dist/src/config.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts +2 -2
  7. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
  8. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
  9. package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
  10. package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
  11. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  12. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +33 -21
  13. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  14. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +3 -5
  15. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
  16. package/dist/src/internal/builtin-plugins/coverage/helpers.js +7 -19
  17. package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +1 -1
  18. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts +7 -0
  19. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -0
  20. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +42 -0
  21. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -0
  22. package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
  23. package/dist/src/internal/builtin-plugins/coverage/index.js +1 -0
  24. package/dist/src/internal/builtin-plugins/coverage/index.js.map +1 -1
  25. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  26. package/dist/src/internal/builtin-plugins/flatten/task-action.js +1 -1
  27. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +2 -2
  29. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  30. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +3 -5
  31. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
  32. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +7 -19
  33. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -1
  34. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts +7 -0
  35. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -0
  36. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +42 -0
  37. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -0
  38. package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
  39. package/dist/src/internal/builtin-plugins/gas-analytics/index.js +1 -0
  40. package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +17 -20
  43. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  44. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts +1 -1
  45. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts.map +1 -1
  46. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js +2 -2
  47. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js.map +1 -1
  48. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts +0 -2
  49. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts.map +1 -1
  50. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js +0 -6
  51. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js.map +1 -1
  52. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +1 -3
  53. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
  54. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +0 -49
  55. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
  56. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.d.ts.map +1 -1
  57. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js +58 -20
  58. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js.map +1 -1
  59. package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
  60. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +8 -0
  61. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
  62. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  63. package/dist/src/internal/builtin-plugins/node/task-action.js +1 -2
  64. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  65. package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts +2 -2
  66. package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-results.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-results.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +1 -0
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +14 -6
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +1 -1
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts +0 -3
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +3 -5
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts +2 -1
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +4 -2
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.d.ts +1 -1
  84. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.js +1 -1
  85. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts +5 -2
  86. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  87. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +8 -2
  88. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  89. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.d.ts.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js +19 -5
  91. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js.map +1 -1
  92. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts +21 -2
  93. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
  94. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +84 -25
  95. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
  96. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts +3 -12
  97. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts.map +1 -1
  98. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.js.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +1 -1
  100. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts +8 -6
  102. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts.map +1 -1
  103. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js +103 -27
  104. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js.map +1 -1
  105. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  106. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  107. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
  108. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +5 -0
  109. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
  110. package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +1 -1
  111. package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
  112. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +22 -0
  113. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
  114. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  115. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  116. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  117. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts +1 -1
  118. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts.map +1 -1
  119. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +1 -1
  120. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
  121. package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts +1 -1
  122. package/dist/src/internal/builtin-plugins/solidity-test/runner.js +1 -1
  123. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  124. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +16 -27
  125. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  126. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  127. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  128. package/dist/src/internal/builtin-plugins/telemetry/task-action.d.ts.map +1 -1
  129. package/dist/src/internal/builtin-plugins/telemetry/task-action.js +3 -2
  130. package/dist/src/internal/builtin-plugins/telemetry/task-action.js.map +1 -1
  131. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  132. package/dist/src/internal/builtin-plugins/test/task-action.js +40 -13
  133. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  134. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +27 -0
  135. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
  136. package/dist/src/internal/cli/banner-manager.d.ts +26 -0
  137. package/dist/src/internal/cli/banner-manager.d.ts.map +1 -0
  138. package/dist/src/internal/cli/banner-manager.js +146 -0
  139. package/dist/src/internal/cli/banner-manager.js.map +1 -0
  140. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  141. package/dist/src/internal/cli/error-handler.js +15 -0
  142. package/dist/src/internal/cli/error-handler.js.map +1 -1
  143. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  144. package/dist/src/internal/cli/init/init.js +8 -0
  145. package/dist/src/internal/cli/init/init.js.map +1 -1
  146. package/dist/src/internal/cli/main.d.ts.map +1 -1
  147. package/dist/src/internal/cli/main.js +18 -1
  148. package/dist/src/internal/cli/main.js.map +1 -1
  149. package/dist/src/internal/cli/telemetry/analytics/subprocess.js +2 -0
  150. package/dist/src/internal/cli/telemetry/analytics/subprocess.js.map +1 -1
  151. package/dist/src/internal/cli/telemetry/sentry/anonymize-paths.js +1 -1
  152. package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
  153. package/dist/src/internal/cli/telemetry/sentry/reporter.js +4 -0
  154. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  155. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts +1 -1
  156. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts.map +1 -1
  157. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js +47 -38
  158. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js.map +1 -1
  159. package/dist/src/internal/core/config-validation.d.ts +3 -3
  160. package/dist/src/internal/core/config-validation.d.ts.map +1 -1
  161. package/dist/src/internal/core/config-validation.js +48 -18
  162. package/dist/src/internal/core/config-validation.js.map +1 -1
  163. package/dist/src/internal/core/tasks/builders.d.ts +26 -16
  164. package/dist/src/internal/core/tasks/builders.d.ts.map +1 -1
  165. package/dist/src/internal/core/tasks/builders.js +65 -6
  166. package/dist/src/internal/core/tasks/builders.js.map +1 -1
  167. package/dist/src/internal/core/tasks/resolved-task.d.ts +2 -2
  168. package/dist/src/internal/core/tasks/resolved-task.d.ts.map +1 -1
  169. package/dist/src/internal/core/tasks/resolved-task.js +23 -9
  170. package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
  171. package/dist/src/internal/core/tasks/task-manager.d.ts.map +1 -1
  172. package/dist/src/internal/core/tasks/task-manager.js +14 -6
  173. package/dist/src/internal/core/tasks/task-manager.js.map +1 -1
  174. package/dist/src/internal/core/tasks/validations.d.ts +2 -0
  175. package/dist/src/internal/core/tasks/validations.d.ts.map +1 -1
  176. package/dist/src/internal/core/tasks/validations.js +11 -0
  177. package/dist/src/internal/core/tasks/validations.js.map +1 -1
  178. package/dist/src/internal/core/user-interruptions.js +1 -1
  179. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts +2 -0
  180. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts.map +1 -0
  181. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js +12 -0
  182. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js.map +1 -0
  183. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts +35 -0
  184. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -0
  185. package/dist/src/internal/using-hardhat2-plugin-errors.js +98 -0
  186. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -0
  187. package/dist/src/plugins.d.ts +8 -0
  188. package/dist/src/plugins.d.ts.map +1 -1
  189. package/dist/src/plugins.js +13 -0
  190. package/dist/src/plugins.js.map +1 -1
  191. package/dist/src/types/artifacts.d.ts +32 -3
  192. package/dist/src/types/artifacts.d.ts.map +1 -1
  193. package/dist/src/types/index.d.ts +15 -0
  194. package/dist/src/types/index.d.ts.map +1 -0
  195. package/dist/src/types/index.js +15 -0
  196. package/dist/src/types/index.js.map +1 -0
  197. package/dist/src/types/network.d.ts +1 -1
  198. package/dist/src/types/plugins.d.ts +2 -2
  199. package/dist/src/types/solidity/build-system.d.ts +56 -10
  200. package/dist/src/types/solidity/build-system.d.ts.map +1 -1
  201. package/dist/src/types/solidity/build-system.js +26 -2
  202. package/dist/src/types/solidity/build-system.js.map +1 -1
  203. package/dist/src/types/solidity/errors.d.ts +18 -0
  204. package/dist/src/types/solidity/errors.d.ts.map +1 -1
  205. package/dist/src/types/solidity/errors.js.map +1 -1
  206. package/dist/src/types/solidity/resolved-file.d.ts +2 -2
  207. package/dist/src/types/tasks.d.ts +103 -34
  208. package/dist/src/types/tasks.d.ts.map +1 -1
  209. package/dist/src/types/tasks.js.map +1 -1
  210. package/dist/src/types/test.d.ts +11 -0
  211. package/dist/src/types/test.d.ts.map +1 -1
  212. package/dist/src/types/utils.d.ts +16 -0
  213. package/dist/src/types/utils.d.ts.map +1 -1
  214. package/dist/src/utils/result.d.ts +33 -0
  215. package/dist/src/utils/result.d.ts.map +1 -0
  216. package/dist/src/utils/result.js +43 -0
  217. package/dist/src/utils/result.js.map +1 -0
  218. package/package.json +12 -7
  219. package/src/config.ts +37 -0
  220. package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +4 -1
  221. package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +4 -1
  222. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +57 -50
  223. package/src/internal/builtin-plugins/coverage/helpers.ts +11 -29
  224. package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +68 -0
  225. package/src/internal/builtin-plugins/coverage/index.ts +1 -0
  226. package/src/internal/builtin-plugins/flatten/task-action.ts +1 -0
  227. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +4 -4
  228. package/src/internal/builtin-plugins/gas-analytics/helpers.ts +11 -29
  229. package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +68 -0
  230. package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -0
  231. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +21 -28
  232. package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.ts +5 -2
  233. package/src/internal/builtin-plugins/network-manager/edr/type-validation.ts +0 -13
  234. package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +0 -64
  235. package/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts +65 -21
  236. package/src/internal/builtin-plugins/network-manager/type-validation.ts +9 -0
  237. package/src/internal/builtin-plugins/node/task-action.ts +2 -2
  238. package/src/internal/builtin-plugins/solidity/build-results.ts +3 -1
  239. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +16 -5
  240. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
  241. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +7 -6
  242. package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +23 -1
  243. package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +1 -1
  244. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +17 -3
  245. package/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.ts +19 -5
  246. package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +139 -35
  247. package/src/internal/builtin-plugins/solidity/build-system/resolver/types.ts +3 -9
  248. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +1 -1
  249. package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +125 -28
  250. package/src/internal/builtin-plugins/solidity/config.ts +2 -2
  251. package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +8 -0
  252. package/src/internal/builtin-plugins/solidity/tasks/build.ts +1 -1
  253. package/src/internal/builtin-plugins/solidity/type-extensions.ts +28 -0
  254. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  255. package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
  256. package/src/internal/builtin-plugins/solidity-test/runner.ts +1 -1
  257. package/src/internal/builtin-plugins/solidity-test/task-action.ts +36 -38
  258. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  259. package/src/internal/builtin-plugins/telemetry/task-action.ts +4 -2
  260. package/src/internal/builtin-plugins/test/task-action.ts +71 -25
  261. package/src/internal/builtin-plugins/test/type-extensions.ts +42 -0
  262. package/src/internal/cli/banner-manager.ts +234 -0
  263. package/src/internal/cli/error-handler.ts +18 -0
  264. package/src/internal/cli/init/init.ts +8 -0
  265. package/src/internal/cli/main.ts +19 -1
  266. package/src/internal/cli/telemetry/analytics/subprocess.ts +2 -0
  267. package/src/internal/cli/telemetry/sentry/anonymize-paths.ts +1 -1
  268. package/src/internal/cli/telemetry/sentry/reporter.ts +5 -0
  269. package/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.ts +98 -50
  270. package/src/internal/core/config-validation.ts +67 -18
  271. package/src/internal/core/tasks/builders.ts +174 -30
  272. package/src/internal/core/tasks/resolved-task.ts +31 -13
  273. package/src/internal/core/tasks/task-manager.ts +23 -5
  274. package/src/internal/core/tasks/validations.ts +40 -0
  275. package/src/internal/core/user-interruptions.ts +1 -1
  276. package/src/internal/deprecated-module-imported-from-hardhat2-plugin.ts +12 -0
  277. package/src/internal/using-hardhat2-plugin-errors.ts +108 -0
  278. package/src/plugins.ts +16 -0
  279. package/src/types/artifacts.ts +40 -3
  280. package/src/types/hre.ts +1 -1
  281. package/src/types/index.ts +14 -0
  282. package/src/types/network.ts +1 -1
  283. package/src/types/plugins.ts +2 -2
  284. package/src/types/solidity/build-system.ts +75 -14
  285. package/src/types/solidity/errors.ts +22 -0
  286. package/src/types/solidity/resolved-file.ts +2 -2
  287. package/src/types/tasks.ts +143 -36
  288. package/src/types/test.ts +12 -0
  289. package/src/types/utils.ts +14 -0
  290. package/src/utils/result.ts +57 -0
  291. package/templates/hardhat-3/01-node-test-runner-viem/package.json +11 -11
  292. package/templates/hardhat-3/02-mocha-ethers/package.json +16 -16
  293. package/templates/hardhat-3/03-minimal/package.json +1 -1
  294. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts +0 -19
  295. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts.map +0 -1
  296. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js +0 -2
  297. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js.map +0 -1
  298. package/src/internal/builtin-plugins/network-manager/edr/types/output.ts +0 -19
@@ -0,0 +1,108 @@
1
+ import { fileURLToPath } from "node:url";
2
+
3
+ import { CustomError } from "@nomicfoundation/hardhat-utils/error";
4
+ import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
5
+ import chalk from "chalk";
6
+
7
+ export class UsingHardhat2PluginError extends CustomError {
8
+ public readonly callerRelativePath: string | undefined;
9
+ constructor() {
10
+ const callerPath = getCallerRelativePath();
11
+
12
+ let message: string;
13
+ if (callerPath !== undefined) {
14
+ message = `You are trying to use a Hardhat 2 plugin in a Hardhat 3 project.
15
+
16
+ This file is part of a Hardhat 2 plugin calling an API that was removed in Hardhat 3: ${chalk.bold(callerPath)}
17
+
18
+ Please read https://hardhat.org/migrate-from-hardhat2 to learn how to migrate your project to Hardhat 3.
19
+ `;
20
+ } else {
21
+ message = `You are trying to use a Hardhat 2 plugin in a Hardhat 3 project.
22
+
23
+ Check the stack trace below to identify which plugin is causing this.
24
+
25
+ Please read https://hardhat.org/migrate-from-hardhat2 to learn how to migrate your project to Hardhat 3.
26
+ `;
27
+ }
28
+
29
+ super(message);
30
+ this.callerRelativePath = callerPath;
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Returns the relative path of the file that called a deprecated Hardhat
36
+ * plugin API, based on the stack trace. This helps identify which plugin
37
+ * file is triggering usage of Hardhat 2 APIs in a Hardhat 3 project.
38
+ *
39
+ * @param {number} [depth=5] The stack trace depth to locate the caller's
40
+ * source file. By default, depth 5 is used because:
41
+ * 0 = message
42
+ * 1 = getCallerRelativePath
43
+ * 2 = UsingHardhat2PluginError constructor
44
+ * 3 = throwUsingHardhat2PluginError
45
+ * 4 = deprecated function
46
+ * 5 = actual caller (the plugin file)
47
+ *
48
+ * @returns {string|undefined} The shortened relative path of the caller file,
49
+ * or undefined if not found.
50
+ *
51
+ * @example
52
+ * If the stack trace is:
53
+ * // Error
54
+ * // at getCallerRelativePath (src/internal/using-hardhat2-plugin-errors.ts:34:15)
55
+ * // at UsingHardhat2PluginError.constructor (src/internal/using-hardhat2-plugin-errors.ts:7:3)
56
+ * // at throwUsingHardhat2PluginError (src/internal/using-hardhat2-plugin-errors.ts:90:3)
57
+ * // at deprecatedFunction (plugins/example-plugin/deprecated.js:50:10)
58
+ * // at main (plugins/example-plugin/index.js:100:5)
59
+ * Calling getCallerRelativePath() returns 'plugins/example-plugin/index.js'
60
+ */
61
+ export function getCallerRelativePath(depth: number = 5): string | undefined {
62
+ try {
63
+ const stack = new Error().stack;
64
+ if (stack === undefined) {
65
+ return undefined;
66
+ }
67
+
68
+ const lines = stack.split("\n");
69
+ const callerLine = lines[depth];
70
+ if (callerLine === undefined) {
71
+ return undefined;
72
+ }
73
+
74
+ /**
75
+ * Matches a single stack trace line:
76
+ *
77
+ * at FunctionName (path/to/file.ts:10:5)
78
+ * at path/to/file.ts:10:5
79
+ *
80
+ * Captures:
81
+ * - group 1: file location (without line/column)
82
+ */
83
+ const STACK_TRACE_LINE_REGEX =
84
+ /^at (?:.+? \()?([^\(].*?)(?::\d+)?(?::\d+)?\)?$/;
85
+
86
+ const match = callerLine.trim().match(STACK_TRACE_LINE_REGEX);
87
+ if (match === null || match[1] === undefined) {
88
+ return undefined;
89
+ }
90
+
91
+ let filePath = match[1];
92
+
93
+ // Handle file:// URLs from ESM stack traces
94
+ if (filePath.startsWith("file://")) {
95
+ filePath = fileURLToPath(filePath);
96
+ }
97
+
98
+ return shortenPath(filePath);
99
+ } catch {
100
+ return undefined;
101
+ }
102
+ }
103
+
104
+ export function throwUsingHardhat2PluginError(): never {
105
+ /* eslint-disable-next-line no-restricted-syntax -- Intentionally throwing a
106
+ custom error here so that we always print the stack trace */
107
+ throw new UsingHardhat2PluginError();
108
+ }
package/src/plugins.ts CHANGED
@@ -1 +1,17 @@
1
1
  export { HardhatPluginError } from "@nomicfoundation/hardhat-errors";
2
+
3
+ import { throwUsingHardhat2PluginError } from "./internal/using-hardhat2-plugin-errors.js";
4
+
5
+ /**
6
+ * @deprecated This function is part of the Hardhat 2 plugin API.
7
+ */
8
+ export function lazyFunction(..._args: any): any {
9
+ throwUsingHardhat2PluginError();
10
+ }
11
+
12
+ /**
13
+ * @deprecated This function is part of the Hardhat 2 plugin API.
14
+ */
15
+ export function lazyObject(..._args: any): any {
16
+ throwUsingHardhat2PluginError();
17
+ }
@@ -1,4 +1,5 @@
1
1
  import type { SolidityBuildInfo } from "./solidity/solidity-artifacts.js";
2
+ import type { NonNeverKeys } from "./utils.js";
2
3
 
3
4
  /**
4
5
  * A map of bare contract names and fully qualified contract names to their
@@ -17,6 +18,37 @@ export type GetArtifactByName<ContractNameT extends string> =
17
18
  ? ArtifactMap[ContractNameT]
18
19
  : Artifact;
19
20
 
21
+ /**
22
+ * A type that represents the contract names (bare and fully qualified) of all
23
+ * the artifacts that have been built in a project. This enables the
24
+ * autocomplete of the TS Language Server to list the actual contracts, without
25
+ * leading to a compilation error for general strings, so it doesn't fail
26
+ * before `hardhat build` is run.
27
+ *
28
+ * This is meant to be used in functions like this:
29
+ * @example
30
+ * ```
31
+ * function doSomething<ContractNameT extends ArtifactContractNames>(
32
+ * contractName: ContractNameT,
33
+ * ...
34
+ * ): DoSomethingReturnType<ContractNameT> {
35
+ * }
36
+ */
37
+ export type ArtifactContractNames = keyof ArtifactMap extends never
38
+ ? string
39
+ : NonNeverKeys<ArtifactMap>;
40
+
41
+ /**
42
+ * A type that represents a string that should match an artifact contract name,
43
+ * but it doesn't fail if the string is not a contract name. It's mostly used
44
+ * to offer autocompletion.
45
+ *
46
+ * @see {@link ArtifactContractNames}
47
+ */
48
+ export type StringWithArtifactContractNamesAutocompletion =
49
+ | ArtifactContractNames
50
+ | (string & {});
51
+
20
52
  /**
21
53
  * The ArtifactManager is responsible for reading and writing artifacts from
22
54
  * the Hardhat build system.
@@ -28,13 +60,18 @@ export interface ArtifactManager {
28
60
  * @param contractNameOrFullyQualifiedName The name of the contract.
29
61
  * It can be a contract bare contract name (e.g. "Token") if it's
30
62
  * unique in your project, or a fully qualified contract name
31
- * (e.g. "contract/token.sol:Token") otherwise.
63
+ * (e.g. "contract/token.sol:Token") otherwise. TypeScript's language server
64
+ * autocompletes the names of the contracts that have already been built. If
65
+ * your contract name isn't in the list, you can still use it, and/or run
66
+ * `hardhat build` to get it in the list.
32
67
  *
33
68
  * @throws Throws an error if a non-unique contract name is used,
34
69
  * indicating which fully qualified names can be used instead.
35
70
  * @throws Throws an error if the artifact doesn't exist.
36
71
  */
37
- readArtifact<ContractNameT extends string>(
72
+ readArtifact<
73
+ ContractNameT extends StringWithArtifactContractNamesAutocompletion,
74
+ >(
38
75
  contractNameOrFullyQualifiedName: ContractNameT,
39
76
  ): Promise<GetArtifactByName<ContractNameT>>;
40
77
 
@@ -239,7 +276,7 @@ export interface LinkReferences {
239
276
  * is the id of the AST node that represents the variable.
240
277
  */
241
278
  export interface ImmutableReferences {
242
- [immuatableId: string]: Array<{ start: number; length: number }>;
279
+ [immutableId: string]: Array<{ start: number; length: number }>;
243
280
  }
244
281
 
245
282
  /**
package/src/types/hre.ts CHANGED
@@ -15,7 +15,7 @@ export interface HardhatRuntimeEnvironment {
15
15
  readonly hardhat: string;
16
16
  readonly edr: string;
17
17
  };
18
- // These fields are defined using module agumentation despite being part of
18
+ // These fields are defined using module augmentation despite being part of
19
19
  // Hardhat's core:
20
20
  // readonly hooks: HookManager;
21
21
  // readonly tasks: TaskManager;
@@ -0,0 +1,14 @@
1
+ export * from "./arguments.js";
2
+ export * from "./artifacts.js";
3
+ export * from "./config.js";
4
+ export * from "./global-options.js";
5
+ export * from "./hooks.js";
6
+ export * from "./hre.js";
7
+ export * from "./network.js";
8
+ export * from "./plugins.js";
9
+ export * from "./providers.js";
10
+ export * from "./solidity.js";
11
+ export * from "./tasks.js";
12
+ export * from "./test.js";
13
+ export * from "./user-interruptions.js";
14
+ export * from "./utils.js";
@@ -10,7 +10,7 @@ import type { EthereumProvider } from "./providers.js";
10
10
  export type ChainType = GenericChainType | "l1" | "op";
11
11
 
12
12
  /**
13
- * The most generic chanin type.
13
+ * The most generic chain type.
14
14
  */
15
15
  export type GenericChainType = "generic";
16
16
 
@@ -65,8 +65,8 @@ export interface HardhatPlugin {
65
65
  * returning an object with a handler for the `extendUserConfig` hook.
66
66
  *
67
67
  * You can define each factory in two ways:
68
- * - As an inline function.
69
- * - As a string with the path to a file that exports the factory as `default`.
68
+ * - As an inline function.
69
+ * - As a string with the path to a file that exports the factory as `default`.
70
70
  *
71
71
  * The first option should only be used for development. You MUST use the second
72
72
  * option for production.
@@ -72,7 +72,7 @@ export type RunCompilationJobOptions = Pick<
72
72
  */
73
73
  export interface CompileBuildInfoOptions {
74
74
  /**
75
- * If `true`, this option foces the build system to recompile the build info,
75
+ * If `true`, this option forces the build system to recompile the build info,
76
76
  * even if its output is cached.
77
77
  */
78
78
  force?: boolean;
@@ -84,26 +84,70 @@ export interface CompileBuildInfoOptions {
84
84
  }
85
85
 
86
86
  export enum CompilationJobCreationErrorReason {
87
- NO_COMPATIBLE_SOLC_VERSION_FOUND = "NO_COMPATIBLE_SOLC_VERSION_FOUND",
87
+ /**
88
+ * The root file's own pragmas are incompatible with all configured compilers.
89
+ */
88
90
  NO_COMPATIBLE_SOLC_VERSION_WITH_ROOT = "NO_COMPATIBLE_SOLC_VERSION_WITH_ROOT",
89
- INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION = "INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION",
91
+
92
+ /**
93
+ * A dependency's own pragmas are incompatible with all configured compilers.
94
+ */
95
+ NO_COMPATIBLE_SOLC_VERSION_WITH_DEPENDENCY = "NO_COMPATIBLE_SOLC_VERSION_WITH_DEPENDENCY",
96
+
97
+ /**
98
+ * Root and a transitive import path have contradictory pragmas (invalid range / empty intersection).
99
+ */
90
100
  IMPORT_OF_INCOMPATIBLE_FILE = "IMPORT_OF_INCOMPATIBLE_FILE",
101
+
102
+ /**
103
+ * Root and a transitive import path have a valid range but no configured compiler satisfies it.
104
+ */
105
+ NO_COMPATIBLE_SOLC_VERSION_FOR_TRANSITIVE_IMPORT_PATH = "NO_COMPATIBLE_SOLC_VERSION_FOR_TRANSITIVE_IMPORT_PATH",
106
+
107
+ /**
108
+ * The override version doesn't satisfy the root file's own pragmas.
109
+ */
110
+ INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION = "INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION",
111
+
112
+ /**
113
+ * A dependency's pragmas are incompatible with the override version.
114
+ */
115
+ OVERRIDDEN_SOLC_VERSION_INCOMPATIBLE_WITH_DEPENDENCY = "OVERRIDDEN_SOLC_VERSION_INCOMPATIBLE_WITH_DEPENDENCY",
116
+
117
+ /**
118
+ * Generic fallback — no single compiler works for root + all dependencies.
119
+ */
120
+ NO_COMPATIBLE_SOLC_VERSION_FOUND = "NO_COMPATIBLE_SOLC_VERSION_FOUND",
91
121
  }
92
122
 
93
123
  export interface BaseCompilationJobCreationError {
124
+ success: false;
94
125
  buildProfile: string;
95
126
  rootFilePath: string;
96
127
  formattedReason: string;
97
128
  }
98
129
 
99
- export interface CompilationJobCreationErrorNoCompatibleSolcVersionFound
130
+ export interface CompilationJobCreationErrorNoCompatibleSolcVersionWithRoot
100
131
  extends BaseCompilationJobCreationError {
101
132
  reason: CompilationJobCreationErrorReason.NO_COMPATIBLE_SOLC_VERSION_WITH_ROOT;
102
133
  }
103
134
 
104
- export interface CompilationJobCreationErrorIncompatibleOverriddenSolcVersion
135
+ export interface CompilationJobCreationErrorNoCompatibleSolcVersionWithDependency
105
136
  extends BaseCompilationJobCreationError {
106
- reason: CompilationJobCreationErrorReason.INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION;
137
+ reason: CompilationJobCreationErrorReason.NO_COMPATIBLE_SOLC_VERSION_WITH_DEPENDENCY;
138
+ incompatibleImportPath: string[];
139
+ }
140
+
141
+ export interface CompilationJobCreationErrorImportOfIncompatibleFile
142
+ extends BaseCompilationJobCreationError {
143
+ reason: CompilationJobCreationErrorReason.IMPORT_OF_INCOMPATIBLE_FILE;
144
+ incompatibleImportPath: string[];
145
+ }
146
+
147
+ export interface CompilationJobCreationErrorNoCompatibleSolcVersionForTransitiveImportPath
148
+ extends BaseCompilationJobCreationError {
149
+ reason: CompilationJobCreationErrorReason.NO_COMPATIBLE_SOLC_VERSION_FOR_TRANSITIVE_IMPORT_PATH;
150
+ incompatibleImportPath: string[];
107
151
  }
108
152
 
109
153
  export interface CompilationJobCreationErrorIncompatibleOverriddenSolcVersion
@@ -111,24 +155,25 @@ export interface CompilationJobCreationErrorIncompatibleOverriddenSolcVersion
111
155
  reason: CompilationJobCreationErrorReason.INCOMPATIBLE_OVERRIDDEN_SOLC_VERSION;
112
156
  }
113
157
 
114
- export interface CompilationJobCreationErrorIportOfIncompatibleFile
158
+ export interface CompilationJobCreationErrorOverriddenSolcVersionIncompatibleWithDependency
115
159
  extends BaseCompilationJobCreationError {
116
- reason: CompilationJobCreationErrorReason.IMPORT_OF_INCOMPATIBLE_FILE;
117
- // The path of absolute files imported, starting from the root, that take you
118
- // to the first file with an incompatible version pragma.
160
+ reason: CompilationJobCreationErrorReason.OVERRIDDEN_SOLC_VERSION_INCOMPATIBLE_WITH_DEPENDENCY;
119
161
  incompatibleImportPath: string[];
120
162
  }
121
163
 
122
- export interface NoCompatibleSolcVersionFound
164
+ export interface CompilationJobCreationErrorNoCompatibleSolcVersionFound
123
165
  extends BaseCompilationJobCreationError {
124
166
  reason: CompilationJobCreationErrorReason.NO_COMPATIBLE_SOLC_VERSION_FOUND;
125
167
  }
126
168
 
127
169
  export type CompilationJobCreationError =
128
- | CompilationJobCreationErrorNoCompatibleSolcVersionFound
129
- | CompilationJobCreationErrorIportOfIncompatibleFile
170
+ | CompilationJobCreationErrorNoCompatibleSolcVersionWithRoot
171
+ | CompilationJobCreationErrorNoCompatibleSolcVersionWithDependency
172
+ | CompilationJobCreationErrorImportOfIncompatibleFile
173
+ | CompilationJobCreationErrorNoCompatibleSolcVersionForTransitiveImportPath
130
174
  | CompilationJobCreationErrorIncompatibleOverriddenSolcVersion
131
- | NoCompatibleSolcVersionFound;
175
+ | CompilationJobCreationErrorOverriddenSolcVersionIncompatibleWithDependency
176
+ | CompilationJobCreationErrorNoCompatibleSolcVersionFound;
132
177
 
133
178
  /**
134
179
  * The restult of building a file.
@@ -174,6 +219,11 @@ export interface CacheHitInfo {
174
219
  * The keys in the maps of this interface are Root File Paths, which means either absolute paths or `npm:<package>/<file>` URIs.
175
220
  */
176
221
  export interface GetCompilationJobsResult {
222
+ /**
223
+ * A flag to distinguish between a successful and a failed result.
224
+ */
225
+ success: true;
226
+
177
227
  /**
178
228
  * Map from root file path to compilation job for files that need compilation.
179
229
  */
@@ -239,12 +289,23 @@ export interface SolidityBuildSystem {
239
289
  * @param options The options to use when building the files.
240
290
  * @returns An `Map` of the files to their build results, or an error if
241
291
  * there was a problem when trying to create the necessary compilation jobs.
292
+ * @see `isSuccessfulBuildResult` to check if the build result is successful.
242
293
  */
243
294
  build(
244
295
  rootFilePaths: string[],
245
296
  options?: BuildOptions,
246
297
  ): Promise<CompilationJobCreationError | Map<string, FileBuildResult>>;
247
298
 
299
+ /**
300
+ * Returns true if the given build result is successful.
301
+ *
302
+ * @param buildResult Result of the `build` method.
303
+ * @returns True if the build result is successful.
304
+ */
305
+ isSuccessfulBuildResult(
306
+ buildResult: CompilationJobCreationError | Map<string, FileBuildResult>,
307
+ ): buildResult is Map<string, FileBuildResult>;
308
+
248
309
  /**
249
310
  * Returns the CompilationJobs that would be used to build the provided files.
250
311
  *
@@ -91,6 +91,11 @@ export interface NpmRootFileOfUninstalledPackageError {
91
91
  type: RootResolutionErrorType.NPM_ROOT_FILE_OF_UNINSTALLED_PACKAGE;
92
92
  npmModule: string;
93
93
  installationName: string;
94
+ /**
95
+ * A boolean indicating if the Hardhat project has a foundry.toml file in its
96
+ * root.
97
+ */
98
+ projectHasFoundryToml?: boolean;
94
99
  }
95
100
 
96
101
  export interface NpmRootResolutionWithRemappingErrors {
@@ -109,6 +114,10 @@ export interface NpmRootFileWithIncorrectCasingError
109
114
  extends ResolvedFileReference {
110
115
  type: RootResolutionErrorType.NPM_ROOT_FILE_WITH_INCORRECT_CASING;
111
116
  npmModule: string;
117
+ /**
118
+ * The correct casing of the file, expressed as the relative fs path from the
119
+ * package's root, using forward slashes, and without a leading "./".
120
+ */
112
121
  correctCasing: string;
113
122
  }
114
123
 
@@ -216,6 +225,10 @@ export interface ImportInvalidCasingError extends ResolvedFileReference {
216
225
  type: ImportResolutionErrorType.IMPORT_INVALID_CASING;
217
226
  fromFsPath: string;
218
227
  importPath: string;
228
+ /**
229
+ * The correct casing of the file, expressed as the relative fs path from the
230
+ * package's root, using forward slashes, and without a leading "./".
231
+ */
219
232
  correctCasing: string;
220
233
  }
221
234
 
@@ -230,6 +243,11 @@ export interface ImportOfUninstalledPackageError {
230
243
  fromFsPath: string;
231
244
  importPath: string;
232
245
  installationName: string;
246
+ /**
247
+ * A boolean indicating weather the import is from a source file whose package
248
+ * has a foundry.toml file in its root.
249
+ */
250
+ importerPackageHasFoundryToml?: boolean;
233
251
  }
234
252
 
235
253
  export interface ImportWithRemappingErrorsError {
@@ -348,10 +366,14 @@ export interface ResolvedFileReference {
348
366
  // package's input source name root, after applying the user remapping.
349
367
  // - For an npm import, it's the npm-subpath. i.e. the module identifier
350
368
  // without the package name.
369
+ //
370
+ // This never includes a leading "./".
351
371
  subpath: string;
352
372
 
353
373
  // The subpath after resolving package.exports
354
374
  //
355
375
  // Only present when actually using package.exports.
376
+ //
377
+ // This never includes a leading "./".
356
378
  packageExportsResolvedSubpath?: string;
357
379
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export interface ResolvedNpmPackage {
5
5
  /**
6
- * The name of the package, potentially scopde.
6
+ * The name of the package, potentially scoped.
7
7
  */
8
8
  name: string;
9
9
 
@@ -103,7 +103,7 @@ export interface NpmPackageResolvedFile {
103
103
  }
104
104
 
105
105
  /**
106
- * The resolult of resolving a file or import using a Resolver.
106
+ * The result of resolving a file or import using a Resolver.
107
107
  */
108
108
  export type ResolvedFile = ProjectResolvedFile | NpmPackageResolvedFile;
109
109