hardhat 3.4.2 → 3.4.4

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 (253) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
  3. package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
  4. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts +1 -1
  5. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +16 -16
  7. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  8. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +1 -1
  9. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -1
  10. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +2 -2
  11. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  12. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  13. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
  14. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  15. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
  16. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
  17. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  18. package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
  19. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  20. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
  21. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
  22. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
  23. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
  24. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
  25. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  26. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +1 -1
  27. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +2 -2
  29. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -1
  30. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  31. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +9 -9
  32. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  33. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  34. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
  35. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  36. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -2
  37. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  38. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +2 -2
  39. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
  40. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
  43. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
  44. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
  45. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
  46. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
  47. package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
  48. package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
  49. package/dist/src/internal/builtin-plugins/node/helpers.js +3 -3
  50. package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
  51. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
  52. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
  53. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  54. package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
  55. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  56. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  57. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +18 -9
  58. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  59. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts +8 -0
  60. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
  61. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
  62. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
  63. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
  64. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
  65. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  66. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +2 -1
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
  84. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  85. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  86. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  87. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  88. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
  89. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
  91. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  92. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  93. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  94. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  95. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
  96. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  97. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
  98. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
  100. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
  102. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  103. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  104. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -2
  105. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  106. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  107. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  108. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  109. package/dist/src/internal/builtin-plugins/test/task-action.js +8 -6
  110. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  111. package/dist/src/internal/cli/banner-manager.js +2 -2
  112. package/dist/src/internal/cli/banner-manager.js.map +1 -1
  113. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  114. package/dist/src/internal/cli/error-handler.js +6 -6
  115. package/dist/src/internal/cli/error-handler.js.map +1 -1
  116. package/dist/src/internal/cli/help/get-help-string.js +2 -2
  117. package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
  118. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  119. package/dist/src/internal/cli/init/init.js +40 -28
  120. package/dist/src/internal/cli/init/init.js.map +1 -1
  121. package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
  122. package/dist/src/internal/cli/init/package-manager.js +5 -5
  123. package/dist/src/internal/cli/init/package-manager.js.map +1 -1
  124. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  125. package/dist/src/internal/cli/init/prompt.js +3 -3
  126. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  127. package/dist/src/internal/cli/main.d.ts.map +1 -1
  128. package/dist/src/internal/cli/main.js +2 -2
  129. package/dist/src/internal/cli/main.js.map +1 -1
  130. package/dist/src/internal/cli/node-version.js +1 -1
  131. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  132. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  133. package/dist/src/internal/cli/telemetry/analytics/utils.js +2 -2
  134. package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
  135. package/dist/src/internal/cli/telemetry/error-classification/classifier.d.ts +58 -0
  136. package/dist/src/internal/cli/telemetry/error-classification/classifier.d.ts.map +1 -0
  137. package/dist/src/internal/cli/telemetry/error-classification/classifier.js +402 -0
  138. package/dist/src/internal/cli/telemetry/error-classification/classifier.js.map +1 -0
  139. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.d.ts +67 -0
  140. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.d.ts.map +1 -0
  141. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.js +140 -0
  142. package/dist/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.js.map +1 -0
  143. package/dist/src/internal/cli/telemetry/error-classification/filter.d.ts +15 -0
  144. package/dist/src/internal/cli/telemetry/error-classification/filter.d.ts.map +1 -0
  145. package/dist/src/internal/cli/telemetry/error-classification/filter.js +114 -0
  146. package/dist/src/internal/cli/telemetry/error-classification/filter.js.map +1 -0
  147. package/dist/src/internal/cli/telemetry/error-classification/helpers.d.ts +52 -0
  148. package/dist/src/internal/cli/telemetry/error-classification/helpers.d.ts.map +1 -0
  149. package/dist/src/internal/cli/telemetry/error-classification/helpers.js +163 -0
  150. package/dist/src/internal/cli/telemetry/error-classification/helpers.js.map +1 -0
  151. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
  152. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
  153. package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts.map +1 -1
  154. package/dist/src/internal/cli/telemetry/error-reporter/reporter.js +14 -0
  155. package/dist/src/internal/cli/telemetry/error-reporter/reporter.js.map +1 -1
  156. package/dist/src/internal/cli/telemetry/sentry/anonymizer.d.ts +0 -2
  157. package/dist/src/internal/cli/telemetry/sentry/anonymizer.d.ts.map +1 -1
  158. package/dist/src/internal/cli/telemetry/sentry/anonymizer.js +0 -117
  159. package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
  160. package/dist/src/internal/cli/telemetry/sentry/init.d.ts.map +1 -1
  161. package/dist/src/internal/cli/telemetry/sentry/init.js +14 -9
  162. package/dist/src/internal/cli/telemetry/sentry/init.js.map +1 -1
  163. package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
  164. package/dist/src/internal/cli/telemetry/sentry/reporter.js +3 -29
  165. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  166. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +13 -19
  167. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  168. package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
  169. package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
  170. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
  171. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  172. package/dist/src/internal/config-loading.js +2 -2
  173. package/dist/src/internal/config-loading.js.map +1 -1
  174. package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
  175. package/dist/src/internal/core/hook-manager.js +10 -3
  176. package/dist/src/internal/core/hook-manager.js.map +1 -1
  177. package/dist/src/internal/core/user-interruptions.js +4 -4
  178. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  179. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
  180. package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
  181. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
  182. package/package.json +6 -9
  183. package/src/internal/builtin-plugins/console/task-action.ts +4 -4
  184. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +21 -17
  185. package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +1 -1
  186. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +2 -2
  187. package/src/internal/builtin-plugins/coverage/instrumentation.ts +21 -2
  188. package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
  189. package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
  190. package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
  191. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
  192. package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +1 -1
  193. package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
  194. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +10 -9
  195. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
  196. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -2
  197. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
  198. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
  199. package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
  200. package/src/internal/builtin-plugins/node/helpers.ts +7 -4
  201. package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
  202. package/src/internal/builtin-plugins/node/task-action.ts +5 -4
  203. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +23 -9
  204. package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
  205. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
  206. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
  207. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
  208. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
  209. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
  210. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
  211. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
  212. package/src/internal/builtin-plugins/solidity/config.ts +5 -2
  213. package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
  214. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  215. package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
  216. package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
  217. package/src/internal/builtin-plugins/solidity-test/task-action.ts +5 -2
  218. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  219. package/src/internal/builtin-plugins/test/task-action.ts +12 -6
  220. package/src/internal/cli/banner-manager.ts +2 -2
  221. package/src/internal/cli/error-handler.ts +10 -6
  222. package/src/internal/cli/help/get-help-string.ts +2 -2
  223. package/src/internal/cli/init/init.ts +53 -28
  224. package/src/internal/cli/init/package-manager.ts +8 -6
  225. package/src/internal/cli/init/prompt.ts +4 -3
  226. package/src/internal/cli/main.ts +4 -3
  227. package/src/internal/cli/node-version.ts +1 -1
  228. package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
  229. package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
  230. package/src/internal/cli/telemetry/error-classification/classifier.ts +636 -0
  231. package/src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.ts +200 -0
  232. package/src/internal/cli/telemetry/error-classification/filter.ts +140 -0
  233. package/src/internal/cli/telemetry/error-classification/helpers.ts +235 -0
  234. package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
  235. package/src/internal/cli/telemetry/error-reporter/reporter.ts +21 -0
  236. package/src/internal/cli/telemetry/sentry/anonymizer.ts +0 -168
  237. package/src/internal/cli/telemetry/sentry/init.ts +42 -33
  238. package/src/internal/cli/telemetry/sentry/reporter.ts +4 -47
  239. package/src/internal/cli/telemetry/sentry/subprocess.ts +13 -21
  240. package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
  241. package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
  242. package/src/internal/config-loading.ts +2 -2
  243. package/src/internal/core/hook-manager.ts +21 -3
  244. package/src/internal/core/user-interruptions.ts +4 -4
  245. package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
  246. package/templates/hardhat-3/01-node-test-runner-viem/package.json +7 -7
  247. package/templates/hardhat-3/02-mocha-ethers/package.json +12 -12
  248. package/templates/hardhat-3/03-minimal/package.json +1 -1
  249. package/dist/src/internal/utils/colorizer.d.ts +0 -10
  250. package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
  251. package/dist/src/internal/utils/colorizer.js +0 -2
  252. package/dist/src/internal/utils/colorizer.js.map +0 -1
  253. package/src/internal/utils/colorizer.ts +0 -9
@@ -0,0 +1,402 @@
1
+ import { HardhatError, assertHardhatInvariant, } from "@nomicfoundation/hardhat-errors";
2
+ import { DirectoryNotEmptyError, FileAlreadyExistsError, FileNotFoundError, FileSystemAccessError, InvalidFileFormatError, IsDirectoryError, NotADirectoryError, } from "@nomicfoundation/hardhat-utils/fs";
3
+ import { PackageJsonNotFoundError, PackageJsonReadError, } from "@nomicfoundation/hardhat-utils/package";
4
+ import { DispatcherError, RequestError, ResponseStatusCodeError, } from "@nomicfoundation/hardhat-utils/request";
5
+ import { SubprocessFileNotFoundError, SubprocessPathIsDirectoryError, } from "@nomicfoundation/hardhat-utils/subprocess";
6
+ import { EdrProviderStackTraceGenerationError, SolidityTestStackTraceGenerationError, } from "../../../builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js";
7
+ import { ProviderError, UnknownError, } from "../../../builtin-plugins/network-manager/provider-errors.js";
8
+ import { UsingHardhat2PluginError } from "../../../using-hardhat2-plugin-errors.js";
9
+ import { getHookExecutionFrame, getTaskExecutionFrame, isConfigLoadingBoundaryFrame, isConsoleEvaluationBoundaryFrame, isEdrFrame, isFirstPartyPluginFrame, isHookHandlerBoundaryFrame, isMochaTestExecutionBoundaryFrame, isNodeTestExecutionBoundaryFrame, isRunningInsideHardhatMonorepo, isScriptExecutionBoundaryFrame, isTaskActionBoundaryFrame, isThirdPartyFrame, } from "./codebase-dependent-helpers.js";
10
+ import { FrameOrigin, createErrorContext, getNodeErrorCode, hasErrorClassName, includesAny, } from "./helpers.js";
11
+ /**
12
+ * Classifies the error based on a set of heuristics.
13
+ *
14
+ * This classification is later used to select different criteria to decide if
15
+ * the error should be reported or not, and in some cases, how to display it in
16
+ * the CLI.
17
+ *
18
+ * @param error The error to classify.
19
+ * @param ignoreDevelopmentTimeFilter If true, the classifier will ignore the
20
+ * development-time filter, which is used to exclude errors that happen during
21
+ * development of Hardhat itself. This is only meant to be used for testing.
22
+ * @returns The error category.
23
+ */
24
+ export function classifyError(error, ignoreDevelopmentTimeFilter = false) {
25
+ const context = createErrorContext(error);
26
+ for (const matcher of ERROR_CATEGORY_MATCHERS) {
27
+ if (ignoreDevelopmentTimeFilter && matcher === isDevelopmentTimeError) {
28
+ continue;
29
+ }
30
+ const category = matcher(context);
31
+ if (category !== undefined) {
32
+ return category;
33
+ }
34
+ }
35
+ return ErrorCategory.UNEXPECTED_ERROR;
36
+ }
37
+ export var ErrorCategory;
38
+ (function (ErrorCategory) {
39
+ ErrorCategory["CJS_TO_ESM_MIGRATION_ERROR"] = "CJS_TO_ESM_MIGRATION_ERROR";
40
+ ErrorCategory["HH2_TO_HH3_MIGRATION_ERROR"] = "HH2_TO_HH3_MIGRATION_ERROR";
41
+ ErrorCategory["TYPESCRIPT_SUPPORT_ERROR"] = "TYPESCRIPT_SUPPORT_ERROR";
42
+ ErrorCategory["DEVELOPMENT_TIME_ERROR"] = "DEVELOPMENT_TIME_ERROR";
43
+ ErrorCategory["HARDHAT_ERROR"] = "HARDHAT_ERROR";
44
+ ErrorCategory["CONFIG_LOADING_ERROR"] = "CONFIG_LOADING_ERROR";
45
+ ErrorCategory["CONSOLE_EVALUATION_ERROR"] = "CONSOLE_EVALUATION_ERROR";
46
+ ErrorCategory["SCRIPT_EXECUTION_ERROR"] = "SCRIPT_EXECUTION_ERROR";
47
+ ErrorCategory["NODE_TEST_EXECUTION_ERROR"] = "NODE_TEST_EXECUTION_ERROR";
48
+ ErrorCategory["MOCHA_TEST_EXECUTION_ERROR"] = "MOCHA_TEST_EXECUTION_ERROR";
49
+ ErrorCategory["TASK_ACTION_ERROR"] = "TASK_ACTION_ERROR";
50
+ ErrorCategory["PLUGIN_TASK_ACTION_ERROR"] = "PLUGIN_TASK_ACTION_ERROR";
51
+ ErrorCategory["USER_TASK_ACTION_ERROR"] = "USER_TASK_ACTION_ERROR";
52
+ ErrorCategory["PLUGIN_HOOK_HANDLER_ERROR"] = "PLUGIN_HOOK_HANDLER_ERROR";
53
+ ErrorCategory["PROVIDER_INTERACTION_ERROR"] = "PROVIDER_INTERACTION_ERROR";
54
+ ErrorCategory["EDR_ERROR"] = "EDR_ERROR";
55
+ ErrorCategory["NETWORK_INTERACTION_ERROR"] = "NETWORK_INTERACTION_ERROR";
56
+ ErrorCategory["RUNTIME_ENVIRONMENT_ERROR"] = "RUNTIME_ENVIRONMENT_ERROR";
57
+ ErrorCategory["FILESYSTEM_INTERACTION_ERROR"] = "FILESYSTEM_INTERACTION_ERROR";
58
+ ErrorCategory["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR";
59
+ })(ErrorCategory || (ErrorCategory = {}));
60
+ export const USER_CODE_BOUNDARY_FRAME_MATCHERS = {
61
+ [ErrorCategory.CONFIG_LOADING_ERROR]: isConfigLoadingBoundaryFrame,
62
+ [ErrorCategory.CONSOLE_EVALUATION_ERROR]: isConsoleEvaluationBoundaryFrame,
63
+ [ErrorCategory.SCRIPT_EXECUTION_ERROR]: isScriptExecutionBoundaryFrame,
64
+ [ErrorCategory.NODE_TEST_EXECUTION_ERROR]: isNodeTestExecutionBoundaryFrame,
65
+ [ErrorCategory.MOCHA_TEST_EXECUTION_ERROR]: isMochaTestExecutionBoundaryFrame,
66
+ [ErrorCategory.PLUGIN_TASK_ACTION_ERROR]: isTaskActionBoundaryFrame,
67
+ [ErrorCategory.USER_TASK_ACTION_ERROR]: isTaskActionBoundaryFrame,
68
+ [ErrorCategory.PLUGIN_HOOK_HANDLER_ERROR]: isHookHandlerBoundaryFrame,
69
+ };
70
+ // These are categories that only need the boundary check for classification
71
+ const BOUNDARY_ONLY_ERROR_CATEGORIES = [
72
+ ErrorCategory.CONFIG_LOADING_ERROR,
73
+ ErrorCategory.SCRIPT_EXECUTION_ERROR,
74
+ ErrorCategory.NODE_TEST_EXECUTION_ERROR,
75
+ ErrorCategory.MOCHA_TEST_EXECUTION_ERROR,
76
+ ErrorCategory.CONSOLE_EVALUATION_ERROR,
77
+ ];
78
+ // IMPORTANT: The order here matters, as the first matcher that returns a
79
+ // category wins
80
+ const ERROR_CATEGORY_MATCHERS = [
81
+ isDevelopmentTimeError,
82
+ isESMMigrationError,
83
+ isHH3MigrationError,
84
+ isTypescriptSupportError,
85
+ isHardhatError,
86
+ isProviderInteractionError,
87
+ isEdrError,
88
+ isNetworkInteractionError,
89
+ isRuntimeEnvironmentError,
90
+ isFilesystemInteractionError,
91
+ isTaskActionError,
92
+ isBoundaryOnlyError,
93
+ isPluginTaskActionError,
94
+ isUserTaskActionError,
95
+ isPluginHookHandlerError,
96
+ ];
97
+ const ESM_MIGRATION_MARKERS = [
98
+ "is not defined in es module scope",
99
+ "cannot use import statement outside a module",
100
+ ];
101
+ /**
102
+ * Classifies common CommonJS/ESM migration failures by matching standard Node
103
+ * runtime markers.
104
+ */
105
+ function isESMMigrationError(context) {
106
+ for (const lowercaseMessage of context.lowercaseMessageByError.values()) {
107
+ if (includesAny(lowercaseMessage, ...ESM_MIGRATION_MARKERS) ||
108
+ /require\(\) of es module/.test(lowercaseMessage)) {
109
+ return ErrorCategory.CJS_TO_ESM_MIGRATION_ERROR;
110
+ }
111
+ }
112
+ }
113
+ const HH3_MIGRATION_MARKERS = [
114
+ "class extends value undefined is not a constructor or null",
115
+ "the requested module 'hardhat' does not provide an export named",
116
+ 'the requested module "hardhat" does not provide an export named',
117
+ "the requested module 'hardhat/config' does not provide an export named",
118
+ 'the requested module "hardhat/config" does not provide an export named',
119
+ "the requested module 'hardhat/plugins' does not provide an export named",
120
+ 'the requested module "hardhat/plugins" does not provide an export named',
121
+ "the requested module 'hardhat/builtin-tasks/task-names' does not provide an export named",
122
+ 'the requested module "hardhat/builtin-tasks/task-names" does not provide an export named',
123
+ "the requested module 'hardhat/types/runtime' does not provide an export named",
124
+ 'the requested module "hardhat/types/runtime" does not provide an export named',
125
+ ];
126
+ const HH2_PLUGIN_ERROR_MARKER = "you are trying to use a hardhat 2 plugin in a hardhat 3 project";
127
+ /**
128
+ * Classifies Hardhat 2 to Hardhat 3 migration failures by checking for known
129
+ * migration error types and message patterns anywhere in the cause chain.
130
+ *
131
+ * This is temporary, and will be removed once the HH2 to HH3 migration by the
132
+ * community is in a solid state. The matcher is broad, but right now mostly
133
+ * correct.
134
+ */
135
+ function isHH3MigrationError(context) {
136
+ if (context.errorChain.some((candidate) => hasErrorClassName(candidate, UsingHardhat2PluginError) ||
137
+ (context.lowercaseMessageByError.get(candidate) ?? "").includes(HH2_PLUGIN_ERROR_MARKER))) {
138
+ return ErrorCategory.HH2_TO_HH3_MIGRATION_ERROR;
139
+ }
140
+ for (const lowercaseMessage of context.lowercaseMessageByError.values()) {
141
+ if (includesAny(lowercaseMessage, ...HH3_MIGRATION_MARKERS)) {
142
+ return ErrorCategory.HH2_TO_HH3_MIGRATION_ERROR;
143
+ }
144
+ }
145
+ if (context.errorChain.some((candidate) => candidate.stack?.includes("@nomiclabs") === true)) {
146
+ return ErrorCategory.HH2_TO_HH3_MIGRATION_ERROR;
147
+ }
148
+ }
149
+ /**
150
+ * If Hardhat is being run from the monorepo, we don't report the error.
151
+ */
152
+ function isDevelopmentTimeError(_context) {
153
+ if (isRunningInsideHardhatMonorepo()) {
154
+ return ErrorCategory.DEVELOPMENT_TIME_ERROR;
155
+ }
156
+ return undefined;
157
+ }
158
+ const TYPESCRIPT_SUPPORT_ERROR_CODES = new Set([
159
+ "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX",
160
+ "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING",
161
+ "ERR_NO_TYPESCRIPT",
162
+ "ERR_UNKNOWN_FILE_EXTENSION",
163
+ ]);
164
+ /**
165
+ * Classifies Node.js TypeScript support failures by matching Node's stable
166
+ * error codes. ERR_UNKNOWN_FILE_EXTENSION also happens for non-TypeScript
167
+ * extensions, so require a TypeScript extension in that error's message.
168
+ */
169
+ function isTypescriptSupportError(context) {
170
+ if (context.errorChain.some((candidate) => {
171
+ const code = getTypescriptSupportErrorCode(candidate);
172
+ if (code === undefined) {
173
+ return false;
174
+ }
175
+ return (code !== "ERR_UNKNOWN_FILE_EXTENSION" ||
176
+ includesAny(context.lowercaseMessageByError.get(candidate), ".ts", ".mts", ".cts"));
177
+ })) {
178
+ return ErrorCategory.TYPESCRIPT_SUPPORT_ERROR;
179
+ }
180
+ }
181
+ /**
182
+ * Classifies top-level HardhatError instances that were not captured by a more
183
+ * specific matcher earlier in the chain.
184
+ */
185
+ function isHardhatError(context) {
186
+ if (HardhatError.isHardhatError(context.error)) {
187
+ return ErrorCategory.HARDHAT_ERROR;
188
+ }
189
+ }
190
+ function isBoundaryOnlyError(context) {
191
+ for (const category of BOUNDARY_ONLY_ERROR_CATEGORIES) {
192
+ const boundaryMatcher = USER_CODE_BOUNDARY_FRAME_MATCHERS[category];
193
+ if (context.allStackFrames.some(boundaryMatcher)) {
194
+ return category;
195
+ }
196
+ }
197
+ }
198
+ /**
199
+ * Classifies task-action failures routed through ResolvedTask when the nearest
200
+ * task-action frame belongs to first-party code.
201
+ */
202
+ function isTaskActionError(context) {
203
+ const taskActionFrame = getTaskExecutionFrame(context.allStackFrames);
204
+ if (taskActionFrame !== undefined &&
205
+ isFirstPartyPluginFrame(taskActionFrame.location)) {
206
+ return ErrorCategory.TASK_ACTION_ERROR;
207
+ }
208
+ }
209
+ /**
210
+ * Classifies task-action failures routed through ResolvedTask when the nearest
211
+ * task-action frame belongs to a third-party plugin.
212
+ */
213
+ function isPluginTaskActionError(context) {
214
+ const taskActionFrame = getTaskExecutionFrame(context.allStackFrames);
215
+ if (taskActionFrame !== undefined &&
216
+ isThirdPartyFrame(taskActionFrame.location)) {
217
+ return ErrorCategory.PLUGIN_TASK_ACTION_ERROR;
218
+ }
219
+ }
220
+ /**
221
+ * Classifies task-action failures routed through ResolvedTask when the nearest
222
+ * task-action frame belongs to user project code.
223
+ */
224
+ function isUserTaskActionError(context) {
225
+ const taskActionFrame = getTaskExecutionFrame(context.allStackFrames);
226
+ if (taskActionFrame !== undefined &&
227
+ taskActionFrame.origin === FrameOrigin.USER_PROJECT) {
228
+ return ErrorCategory.USER_TASK_ACTION_ERROR;
229
+ }
230
+ }
231
+ /**
232
+ * Classifies hook execution failures routed through HookManager when the
233
+ * nearest hook-handler frame belongs to a third-party plugin.
234
+ */
235
+ function isPluginHookHandlerError(context) {
236
+ const hookExecutionFrame = getHookExecutionFrame(context.allStackFrames);
237
+ if (hookExecutionFrame !== undefined &&
238
+ isThirdPartyFrame(hookExecutionFrame.location)) {
239
+ return ErrorCategory.PLUGIN_HOOK_HANDLER_ERROR;
240
+ }
241
+ }
242
+ const PROVIDER_INTERACTION_ERROR_WRAPPED_IN_UNKNOWN_EDR_ERROR_MARKERS = [
243
+ "unauthorized",
244
+ "rate limit",
245
+ "too many requests",
246
+ "historical state unavailable",
247
+ ];
248
+ /**
249
+ * Classifies provider-facing failures, including Solidity errors, expected
250
+ * provider errors, and selected UnknownError cases with provider-like causes.
251
+ */
252
+ function isProviderInteractionError(context) {
253
+ if (context.errorChain.some((candidate) => candidate.name === "SolidityError" ||
254
+ (ProviderError.isProviderError(candidate) &&
255
+ isUnknownEdrError(candidate, context) === false))) {
256
+ return ErrorCategory.PROVIDER_INTERACTION_ERROR;
257
+ }
258
+ if (isUnknownEdrError(context.errorChain[0], context) &&
259
+ context.errorChain[1] !== undefined &&
260
+ includesAny(context.lowercaseMessageByError.get(context.errorChain[1]), ...PROVIDER_INTERACTION_ERROR_WRAPPED_IN_UNKNOWN_EDR_ERROR_MARKERS)) {
261
+ return ErrorCategory.PROVIDER_INTERACTION_ERROR;
262
+ }
263
+ }
264
+ /**
265
+ * Classifies EDR-specific failures, including stack-trace generation errors
266
+ * and remaining UnknownError cases from the provider layer.
267
+ */
268
+ function isEdrError(context) {
269
+ if (context.errorChain.some((candidate) => hasErrorClassName(candidate, EdrProviderStackTraceGenerationError) ||
270
+ hasErrorClassName(candidate, SolidityTestStackTraceGenerationError) ||
271
+ isUnknownEdrError(candidate, context))) {
272
+ return ErrorCategory.EDR_ERROR;
273
+ }
274
+ }
275
+ /**
276
+ * Classifies network-related failures by collapsing request setup, request
277
+ * transport, response status, and telemetry transport errors into one bucket.
278
+ */
279
+ function isNetworkInteractionError(context) {
280
+ if (context.errorChain.some((candidate) => hasErrorClassName(candidate, ResponseStatusCodeError)) ||
281
+ context.errorChain.some((candidate) => hasErrorClassName(candidate, DispatcherError)) ||
282
+ context.errorChain.some((candidate) => hasErrorClassName(candidate, RequestError)) ||
283
+ (context.lowercaseMessageByError.get(context.error) ?? "").includes("fetch failed")) {
284
+ return ErrorCategory.NETWORK_INTERACTION_ERROR;
285
+ }
286
+ }
287
+ /**
288
+ * Classifies runtime-environment incompatibilities by matching a small set of
289
+ * capability-related error messages.
290
+ */
291
+ function isRuntimeEnvironmentError(context) {
292
+ if (Array.from(context.lowercaseMessageByError.values()).some((message) => includesAny(message, "toreversed is not a function", "flatmap is not a function", "crypto is not defined"))) {
293
+ return ErrorCategory.RUNTIME_ENVIRONMENT_ERROR;
294
+ }
295
+ }
296
+ /**
297
+ * Classifies project-data and filesystem-related failures by matching a known
298
+ * filesystem/project-data error type or a raw Node.js filesystem error code
299
+ * anywhere in the cause chain.
300
+ */
301
+ function isFilesystemInteractionError(context) {
302
+ if (context.errorChain.some((candidate) => isKnownFilesystemOrProjectDataError(candidate) ||
303
+ isNodeFilesystemError(candidate))) {
304
+ return ErrorCategory.FILESYSTEM_INTERACTION_ERROR;
305
+ }
306
+ }
307
+ function isUnknownEdrError(error, context) {
308
+ const errorIndex = context.errorChain.indexOf(error);
309
+ assertHardhatInvariant(errorIndex !== -1, "isUnknownEdrError must be called with an error from the error chain");
310
+ return (ProviderError.isProviderError(error) &&
311
+ (error.code === UnknownError.CODE || error.name === "UnknownError") &&
312
+ context.errorChain
313
+ .slice(errorIndex)
314
+ .some((candidate) => (context.stackFramesByError.get(candidate) ?? []).some(isEdrFrame)));
315
+ }
316
+ // This list should be kept up to date with hardhat-utils/fs errors
317
+ const HARDHAT_UTILS_FILESYSTEM_ERROR_CLASSES = [
318
+ PackageJsonReadError,
319
+ PackageJsonNotFoundError,
320
+ InvalidFileFormatError,
321
+ FileNotFoundError,
322
+ IsDirectoryError,
323
+ NotADirectoryError,
324
+ FileAlreadyExistsError,
325
+ DirectoryNotEmptyError,
326
+ ];
327
+ // This list should be kept up to date with hardhat-utils/subprocess errors
328
+ const HARDHAT_UTILS_SUBPROCESS_ERROR_CLASSES = [
329
+ SubprocessFileNotFoundError,
330
+ SubprocessPathIsDirectoryError,
331
+ ];
332
+ const NODE_FILESYSTEM_ERROR_CODES = new Set([
333
+ "EACCES",
334
+ "EAGAIN",
335
+ "EBADF",
336
+ "EBUSY",
337
+ "EEXIST",
338
+ "EFBIG",
339
+ "EINTR",
340
+ "EINVAL",
341
+ "EIO",
342
+ "EISDIR",
343
+ "ELOOP",
344
+ "EMFILE",
345
+ "ENAMETOOLONG",
346
+ "ENFILE",
347
+ "ENODEV",
348
+ "ENOENT",
349
+ "ENOSPC",
350
+ "ENOTDIR",
351
+ "ENOTEMPTY",
352
+ "ENOTSUP",
353
+ "ENXIO",
354
+ "EOPNOTSUPP",
355
+ "EOVERFLOW",
356
+ "EPERM",
357
+ "EROFS",
358
+ "ESPIPE",
359
+ "ETXTBSY",
360
+ "EXDEV",
361
+ ]);
362
+ /**
363
+ * Returns `true` for any of the filesystem/project-data error classes the
364
+ * classifier knows about. This is the gate for the FILESYSTEM_INTERACTION_ERROR
365
+ * category.
366
+ */
367
+ export function isKnownFilesystemOrProjectDataError(error) {
368
+ return (isHardhatUtilsFilesystemError(error) ||
369
+ isSubprocessFilesystemError(error) ||
370
+ hasErrorClassName(error, FileSystemAccessError));
371
+ }
372
+ /**
373
+ * Returns `true` for filesystem errors that callers commonly expect to surface
374
+ * during normal operation (e.g. missing files, format errors). Used by both
375
+ * the classifier (as part of the filesystem-interaction gate) and the filter
376
+ * (to drop these errors from reporting).
377
+ */
378
+ export function isHardhatUtilsFilesystemError(error) {
379
+ return HARDHAT_UTILS_FILESYSTEM_ERROR_CLASSES.some((cls) => hasErrorClassName(error, cls));
380
+ }
381
+ /**
382
+ * Returns `true` for filesystem errors raised by the subprocess-spawning
383
+ * helpers. These are unexpected enough to be worth reporting on their own.
384
+ */
385
+ export function isSubprocessFilesystemError(error) {
386
+ return HARDHAT_UTILS_SUBPROCESS_ERROR_CLASSES.some((cls) => hasErrorClassName(error, cls));
387
+ }
388
+ /**
389
+ * Returns `true` for the node errors with fs related codes.
390
+ */
391
+ function isNodeFilesystemError(error) {
392
+ const code = getNodeErrorCode(error);
393
+ return code !== undefined && NODE_FILESYSTEM_ERROR_CODES.has(code);
394
+ }
395
+ function getTypescriptSupportErrorCode(error) {
396
+ if ("code" in error &&
397
+ typeof error.code === "string" &&
398
+ TYPESCRIPT_SUPPORT_ERROR_CODES.has(error.code)) {
399
+ return error.code;
400
+ }
401
+ }
402
+ //# sourceMappingURL=classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../../../../../src/internal/cli/telemetry/error-classification/classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,4FAA4F,CAAC;AACpG,OAAO,EACL,aAAa,EACb,YAAY,GACb,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,gCAAgC,EAChC,UAAU,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,8BAA8B,EAC9B,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAGL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAY,EACZ,2BAA2B,GAAG,KAAK;IAEnC,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1C,KAAK,MAAM,OAAO,IA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C,IAAI,CAAC,EAC9C,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @file This file has a set of helpers that depend on the codebase. They
3
+ * inspect the stack frames to look for known folders, files, or function names.
4
+ *
5
+ * As such, they are somewhat fragile and need to be periodically reevaluated,
6
+ * especially after large refactors to Hardhat's core.
7
+ */
8
+ import { type StackFrame } from "./helpers.js";
9
+ /**
10
+ * Returns true when this package is being executed from the Hardhat monorepo
11
+ * source tree instead of from an installed `node_modules/hardhat` package.
12
+ */
13
+ export declare function isRunningInsideHardhatMonorepo(): boolean;
14
+ /**
15
+ * Matches the Hardhat frame that imports the user's config file.
16
+ */
17
+ export declare function isConfigLoadingBoundaryFrame(frame: StackFrame): boolean;
18
+ /**
19
+ * Matches the builtin console task frame that evaluates user input.
20
+ */
21
+ export declare function isConsoleEvaluationBoundaryFrame(frame: StackFrame): boolean;
22
+ /**
23
+ * Matches the builtin run task frame that executes a user script.
24
+ */
25
+ export declare function isScriptExecutionBoundaryFrame(frame: StackFrame): boolean;
26
+ /**
27
+ * Matches the node:test runner task frame that executes user tests.
28
+ */
29
+ export declare function isNodeTestExecutionBoundaryFrame(frame: StackFrame): boolean;
30
+ /**
31
+ * Matches the Mocha runner task frame that executes user tests.
32
+ */
33
+ export declare function isMochaTestExecutionBoundaryFrame(frame: StackFrame): boolean;
34
+ /**
35
+ * Matches the resolved-task frame that calls into a task action.
36
+ */
37
+ export declare function isTaskActionBoundaryFrame(frame: StackFrame): boolean;
38
+ /**
39
+ * Matches the hook-manager frame that calls into hook handlers.
40
+ */
41
+ export declare function isHookHandlerBoundaryFrame(frame: StackFrame): boolean;
42
+ /**
43
+ * Finds the task action frame immediately above the resolved-task boundary.
44
+ */
45
+ export declare function getTaskExecutionFrame(frames: StackFrame[]): StackFrame | undefined;
46
+ /**
47
+ * Finds the hook handler frame immediately above the hook-manager boundary.
48
+ */
49
+ export declare function getHookExecutionFrame(frames: StackFrame[]): StackFrame | undefined;
50
+ /**
51
+ * Returns true for stack locations owned by packages outside Hardhat.
52
+ */
53
+ export declare function isThirdPartyFrame(location: string): boolean;
54
+ /**
55
+ * Returns true for stack locations owned by Hardhat or first-party packages.
56
+ */
57
+ export declare function isFirstPartyPluginFrame(location: string): boolean;
58
+ /**
59
+ * Returns true when the error stack appears to come from workspace
60
+ * initialization.
61
+ */
62
+ export declare function isWorkspaceInitFilesystemFrame(error: Error): boolean;
63
+ /**
64
+ * Returns true for stack frames owned by EDR provider or stack-trace code.
65
+ */
66
+ export declare function isEdrFrame(frame: StackFrame): boolean;
67
+ //# sourceMappingURL=codebase-dependent-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-dependent-helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAYD;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAKvE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAK3E;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAKzE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAK3E;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAK5E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAKpE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAUrE;AASD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAAE,GACnB,UAAU,GAAG,SAAS,CAgBxB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAAE,GACnB,UAAU,GAAG,SAAS,CAexB;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK3D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMjE;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAMrD"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @file This file has a set of helpers that depend on the codebase. They
3
+ * inspect the stack frames to look for known folders, files, or function names.
4
+ *
5
+ * As such, they are somewhat fragile and need to be periodically reevaluated,
6
+ * especially after large refactors to Hardhat's core.
7
+ */
8
+ import { includesAny } from "./helpers.js";
9
+ /**
10
+ * Returns true when this package is being executed from the Hardhat monorepo
11
+ * source tree instead of from an installed `node_modules/hardhat` package.
12
+ */
13
+ export function isRunningInsideHardhatMonorepo() {
14
+ // If this file is in `/packages/hardhat/`, as opposed to
15
+ // `node_modules/hardhat/`, then we're running inside the monorepo.
16
+ return import.meta.url.includes("/packages/hardhat/");
17
+ }
18
+ // ---------------------------------------------------------------------------
19
+ // Boundary frame predicates
20
+ //
21
+ // These identify the first-party frames that mark the boundary between
22
+ // Hardhat-controlled code and the user/plugin code that ultimately ran. Both
23
+ // the classifier (to assign a category) and the filter (to find the frame
24
+ // above the boundary) need to agree on what those frames look like, so they
25
+ // share a single definition here.
26
+ // ---------------------------------------------------------------------------
27
+ /**
28
+ * Matches the Hardhat frame that imports the user's config file.
29
+ */
30
+ export function isConfigLoadingBoundaryFrame(frame) {
31
+ return (frame.location.includes("internal/config-loading.") &&
32
+ frame.functionName?.includes("importUserConfig") === true);
33
+ }
34
+ /**
35
+ * Matches the builtin console task frame that evaluates user input.
36
+ */
37
+ export function isConsoleEvaluationBoundaryFrame(frame) {
38
+ return (frame.location.includes("/internal/builtin-plugins/console/task-action.") &&
39
+ frame.functionName?.includes("consoleAction") === true);
40
+ }
41
+ /**
42
+ * Matches the builtin run task frame that executes a user script.
43
+ */
44
+ export function isScriptExecutionBoundaryFrame(frame) {
45
+ return (frame.location.includes("/internal/builtin-plugins/run/task-action.") &&
46
+ frame.functionName?.includes("runScriptWithHardhat") === true);
47
+ }
48
+ /**
49
+ * Matches the node:test runner task frame that executes user tests.
50
+ */
51
+ export function isNodeTestExecutionBoundaryFrame(frame) {
52
+ return (frame.location.includes("/hardhat-node-test-runner/src/task-action.") &&
53
+ frame.functionName?.includes("testWithHardhat") === true);
54
+ }
55
+ /**
56
+ * Matches the Mocha runner task frame that executes user tests.
57
+ */
58
+ export function isMochaTestExecutionBoundaryFrame(frame) {
59
+ return (frame.location.includes("/hardhat-mocha/src/task-action.") &&
60
+ frame.functionName?.includes("testWithHardhat") === true);
61
+ }
62
+ /**
63
+ * Matches the resolved-task frame that calls into a task action.
64
+ */
65
+ export function isTaskActionBoundaryFrame(frame) {
66
+ return (frame.location.includes("/internal/core/tasks/resolved-task.") &&
67
+ frame.functionName?.includes(".run") === true);
68
+ }
69
+ /**
70
+ * Matches the hook-manager frame that calls into hook handlers.
71
+ */
72
+ export function isHookHandlerBoundaryFrame(frame) {
73
+ return (frame.location.includes("/internal/core/hook-manager.") &&
74
+ includesAny(frame.functionName, ".runHandlerChain", ".runSequentialHandlers", ".runParallelHandlers"));
75
+ }
76
+ // ---------------------------------------------------------------------------
77
+ // Execution frame finders
78
+ //
79
+ // These locate the stack frame that identifies who the actual task action or
80
+ // hook handler is, relative to the boundary frame.
81
+ // ---------------------------------------------------------------------------
82
+ /**
83
+ * Finds the task action frame immediately above the resolved-task boundary.
84
+ */
85
+ export function getTaskExecutionFrame(frames) {
86
+ const resolvedTaskRunIndex = frames.findIndex(isTaskActionBoundaryFrame);
87
+ if (resolvedTaskRunIndex === -1) {
88
+ return;
89
+ }
90
+ // The frames between `task.run` calls may include other resolved-task.ts
91
+ // helpers; we want the last frame that does not belong to that file.
92
+ return frames
93
+ .slice(0, resolvedTaskRunIndex)
94
+ .findLast((frame) => frame.location.includes("/internal/core/tasks/resolved-task.") ===
95
+ false);
96
+ }
97
+ /**
98
+ * Finds the hook handler frame immediately above the hook-manager boundary.
99
+ */
100
+ export function getHookExecutionFrame(frames) {
101
+ const hookManagerIndex = frames.findIndex(isHookHandlerBoundaryFrame);
102
+ if (hookManagerIndex === -1) {
103
+ return;
104
+ }
105
+ // The frames between hook-manager calls may include other hook-manager
106
+ // helpers; we want the last frame that does not belong to that file.
107
+ return frames
108
+ .slice(0, hookManagerIndex)
109
+ .findLast((frame) => frame.location.includes("/internal/core/hook-manager.") === false);
110
+ }
111
+ // ---------------------------------------------------------------------------
112
+ // Frame origin / ownership helpers
113
+ // ---------------------------------------------------------------------------
114
+ /**
115
+ * Returns true for stack locations owned by packages outside Hardhat.
116
+ */
117
+ export function isThirdPartyFrame(location) {
118
+ return (location.includes("/node_modules/") &&
119
+ isFirstPartyPluginFrame(location) === false);
120
+ }
121
+ /**
122
+ * Returns true for stack locations owned by Hardhat or first-party packages.
123
+ */
124
+ export function isFirstPartyPluginFrame(location) {
125
+ return includesAny(location, "/node_modules/hardhat/", "/node_modules/@nomicfoundation/");
126
+ }
127
+ /**
128
+ * Returns true when the error stack appears to come from workspace
129
+ * initialization.
130
+ */
131
+ export function isWorkspaceInitFilesystemFrame(error) {
132
+ return error.stack?.includes("/internal/cli/init") ?? false;
133
+ }
134
+ /**
135
+ * Returns true for stack frames owned by EDR provider or stack-trace code.
136
+ */
137
+ export function isEdrFrame(frame) {
138
+ return includesAny(frame.location, "/builtin-plugins/network-manager/edr/", "/edr-provider.");
139
+ }
140
+ //# sourceMappingURL=codebase-dependent-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-dependent-helpers.js","sourceRoot":"","sources":["../../../../../../src/internal/cli/telemetry/error-classification/codebase-dependent-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,8BAA8B;IAC5C,yDAAyD;IACzD,mEAAmE;IACnE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AACxD,CAAC;AAED,8EAA8E;AAC9E,4BAA4B;AAC5B,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,kCAAkC;AAClC,8EAA8E;AAE9E;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAiB;IAC5D,OAAO,CACL,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACnD,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAC1D,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,KAAiB;IAChE,OAAO,CACL,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QACzE,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,IAAI,CACvD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAiB;IAC9D,OAAO,CACL,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,4CAA4C,CAAC;QACrE,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAC9D,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,KAAiB;IAChE,OAAO,CACL,KAAK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ry or not, based on the
4
+ * category returned by `classifyError(error)`.
5
+ *
6
+ * This first version intentionally uses a permissive policy: it drops clear
7
+ * noise, reports categories that are likely to be Hardhat bugs, and only uses a
8
+ * simple stack-shape heuristic for errors coming from user/plugin execution.
9
+ *
10
+ * @param error The error.
11
+ * @param category The result of calling `classifyError(error)`.
12
+ * @returns `true` if the error should be reported.
13
+ */
14
+ export declare function shouldBeReported(error: Error, category: ErrorCategory): boolean;
15
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/cli/telemetry/error-classification/filter.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,GACtB,OAAO,CA0BT"}