hardhat 3.4.2 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CHANGELOG.md +29 -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.js +7 -7
  5. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +1 -1
  7. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -1
  8. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +2 -2
  9. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  10. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  11. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
  12. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  13. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
  14. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
  15. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  16. package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
  17. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  18. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
  19. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
  20. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
  21. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
  22. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
  23. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  24. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +1 -1
  25. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
  26. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +2 -2
  27. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  29. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +9 -9
  30. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  31. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  32. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
  33. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  34. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -2
  35. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  36. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +2 -2
  37. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
  38. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
  39. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
  40. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
  43. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
  44. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
  45. package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
  46. package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
  47. package/dist/src/internal/builtin-plugins/node/helpers.js +3 -3
  48. package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
  49. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
  50. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
  51. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  52. package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
  53. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  54. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  55. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +18 -9
  56. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  57. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts +8 -0
  58. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
  59. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
  60. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
  61. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
  62. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
  63. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  64. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  65. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
  66. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +2 -1
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  84. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  85. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  86. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
  87. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  88. package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
  89. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  91. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  92. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  93. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
  94. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  95. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
  96. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  97. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
  98. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
  100. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  102. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -2
  103. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  104. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  105. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  106. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  107. package/dist/src/internal/builtin-plugins/test/task-action.js +8 -6
  108. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  109. package/dist/src/internal/cli/banner-manager.js +2 -2
  110. package/dist/src/internal/cli/banner-manager.js.map +1 -1
  111. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  112. package/dist/src/internal/cli/error-handler.js +6 -6
  113. package/dist/src/internal/cli/error-handler.js.map +1 -1
  114. package/dist/src/internal/cli/help/get-help-string.js +2 -2
  115. package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
  116. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  117. package/dist/src/internal/cli/init/init.js +40 -28
  118. package/dist/src/internal/cli/init/init.js.map +1 -1
  119. package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
  120. package/dist/src/internal/cli/init/package-manager.js +5 -5
  121. package/dist/src/internal/cli/init/package-manager.js.map +1 -1
  122. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  123. package/dist/src/internal/cli/init/prompt.js +3 -3
  124. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  125. package/dist/src/internal/cli/main.d.ts.map +1 -1
  126. package/dist/src/internal/cli/main.js +2 -2
  127. package/dist/src/internal/cli/main.js.map +1 -1
  128. package/dist/src/internal/cli/node-version.js +1 -1
  129. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  130. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  131. package/dist/src/internal/cli/telemetry/analytics/utils.js +2 -2
  132. package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
  133. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
  134. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
  135. package/dist/src/internal/cli/telemetry/sentry/reporter.js +2 -2
  136. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  137. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +2 -2
  138. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  139. package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
  140. package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
  141. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
  142. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  143. package/dist/src/internal/config-loading.js +2 -2
  144. package/dist/src/internal/config-loading.js.map +1 -1
  145. package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
  146. package/dist/src/internal/core/hook-manager.js +10 -3
  147. package/dist/src/internal/core/hook-manager.js.map +1 -1
  148. package/dist/src/internal/core/user-interruptions.js +4 -4
  149. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  150. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
  151. package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
  152. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
  153. package/package.json +6 -9
  154. package/src/internal/builtin-plugins/console/task-action.ts +4 -4
  155. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +7 -7
  156. package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +1 -1
  157. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +2 -2
  158. package/src/internal/builtin-plugins/coverage/instrumentation.ts +21 -2
  159. package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
  160. package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
  161. package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
  162. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
  163. package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +1 -1
  164. package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
  165. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +10 -9
  166. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
  167. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -2
  168. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
  169. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
  170. package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
  171. package/src/internal/builtin-plugins/node/helpers.ts +7 -4
  172. package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
  173. package/src/internal/builtin-plugins/node/task-action.ts +5 -4
  174. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +23 -9
  175. package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
  176. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
  177. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
  178. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
  179. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
  180. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
  181. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
  182. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
  183. package/src/internal/builtin-plugins/solidity/config.ts +5 -2
  184. package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
  185. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  186. package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
  187. package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
  188. package/src/internal/builtin-plugins/solidity-test/task-action.ts +5 -2
  189. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  190. package/src/internal/builtin-plugins/test/task-action.ts +12 -6
  191. package/src/internal/cli/banner-manager.ts +2 -2
  192. package/src/internal/cli/error-handler.ts +10 -6
  193. package/src/internal/cli/help/get-help-string.ts +2 -2
  194. package/src/internal/cli/init/init.ts +53 -28
  195. package/src/internal/cli/init/package-manager.ts +8 -6
  196. package/src/internal/cli/init/prompt.ts +4 -3
  197. package/src/internal/cli/main.ts +4 -3
  198. package/src/internal/cli/node-version.ts +1 -1
  199. package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
  200. package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
  201. package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
  202. package/src/internal/cli/telemetry/sentry/reporter.ts +2 -2
  203. package/src/internal/cli/telemetry/sentry/subprocess.ts +2 -2
  204. package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
  205. package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
  206. package/src/internal/config-loading.ts +2 -2
  207. package/src/internal/core/hook-manager.ts +21 -3
  208. package/src/internal/core/user-interruptions.ts +4 -4
  209. package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
  210. package/templates/hardhat-3/01-node-test-runner-viem/package.json +6 -6
  211. package/templates/hardhat-3/02-mocha-ethers/package.json +12 -12
  212. package/templates/hardhat-3/03-minimal/package.json +1 -1
  213. package/dist/src/internal/utils/colorizer.d.ts +0 -10
  214. package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
  215. package/dist/src/internal/utils/colorizer.js +0 -2
  216. package/dist/src/internal/utils/colorizer.js.map +0 -1
  217. package/src/internal/utils/colorizer.ts +0 -9
@@ -7,7 +7,9 @@ import type {
7
7
  import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
8
8
 
9
9
  import path from "node:path";
10
+ import { styleText } from "node:util";
10
11
 
12
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
11
13
  import { formatTable } from "@nomicfoundation/hardhat-utils/format";
12
14
  import {
13
15
  ensureDir,
@@ -18,13 +20,11 @@ import {
18
20
  writeJsonFile,
19
21
  writeUtf8File,
20
22
  } from "@nomicfoundation/hardhat-utils/fs";
21
- import chalk from "chalk";
22
- import debug from "debug";
23
23
 
24
24
  import { getProcessedCoverageInfo } from "./process-coverage.js";
25
25
  import { generateHtmlReport } from "./reports/html.js";
26
26
 
27
- const log = debug("hardhat:core:coverage:coverage-manager");
27
+ const log = createDebug("hardhat:core:coverage:coverage-manager");
28
28
 
29
29
  const MAX_COLUMN_WIDTH = 80;
30
30
 
@@ -435,18 +435,18 @@ export class CoverageManagerImplementation implements CoverageManager {
435
435
 
436
436
  rows.push({
437
437
  type: "title",
438
- text: chalk.bold("Coverage Report"),
438
+ text: styleText("bold", "Coverage Report"),
439
439
  });
440
440
 
441
441
  rows.push({
442
442
  type: "section-header",
443
- text: chalk.bold("File Coverage"),
443
+ text: styleText("bold", "File Coverage"),
444
444
  });
445
445
 
446
446
  rows.push({
447
447
  type: "header",
448
448
  cells: ["File Path", "Line %", "Statement %", "Uncovered Lines"].map(
449
- (s) => chalk.yellow(s),
449
+ (s) => styleText("yellow", s),
450
450
  ),
451
451
  });
452
452
 
@@ -500,7 +500,7 @@ export class CoverageManagerImplementation implements CoverageManager {
500
500
  rows.push({
501
501
  type: "header",
502
502
  cells: [
503
- chalk.yellow("Total"),
503
+ styleText("yellow", "Total"),
504
504
  this.formatCoverage(totalLineCoverage),
505
505
  this.formatCoverage(totalStatementCoverage),
506
506
  "",
@@ -2,7 +2,7 @@
2
2
  // handler and task-actions that may run on every `hardhat test` invocation
3
3
  // regardless of whether the feature is enabled. It must stay lightweight:
4
4
  // do not add top-level imports that pull in the coverage-manager module
5
- // graph (chalk, debug, node:crypto, file-system traversal, etc.), or the
5
+ // graph (debug, node:crypto, file-system traversal, etc.), or the
6
6
  // `--coverage` lazy-load is silently defeated for every caller.
7
7
  // If a new helper needs a heavy dependency, put it in a sibling file
8
8
  // (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
@@ -4,15 +4,15 @@ import type { CoverageMetadata } from "../types.js";
4
4
  import path from "node:path";
5
5
 
6
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
7
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
7
8
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
8
9
  import { readUtf8File } from "@nomicfoundation/hardhat-utils/fs";
9
10
  import { findClosestPackageRoot } from "@nomicfoundation/hardhat-utils/package";
10
- import debug from "debug";
11
11
 
12
12
  import { getCoverageManager } from "../helpers/accessors.js";
13
13
  import { instrumentSolidityFileForCompilationJob } from "../instrumentation.js";
14
14
 
15
- const log = debug("hardhat:core:coverage:hook-handlers:solidity");
15
+ const log = createDebug("hardhat:core:coverage:hook-handlers:solidity");
16
16
 
17
17
  const COVERAGE_LIBRARY_PATH =
18
18
  "__hardhat_coverage_library_a3e9cfe2-41b4-4a1f-ad9e-ac62dd82979e.sol";
@@ -4,7 +4,11 @@ import {
4
4
  addStatementCoverageInstrumentation,
5
5
  latestSupportedSolidityVersion,
6
6
  } from "@nomicfoundation/edr";
7
- import { satisfies } from "semver";
7
+ import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
8
+ import {
9
+ lowerThanOrEqual,
10
+ parseVersion,
11
+ } from "@nomicfoundation/hardhat-utils/fast-semver";
8
12
 
9
13
  /**
10
14
  * Instruments a solidity source file as part of a compilation job. i.e. the
@@ -37,8 +41,23 @@ export function instrumentSolidityFileForCompilationJob({
37
41
  instrumentationVersion: string;
38
42
  } {
39
43
  const latestSupportedVersion = latestSupportedSolidityVersion();
44
+ const parsedLatestSupportedVersion = parseVersion(latestSupportedVersion);
45
+ assertHardhatInvariant(
46
+ parsedLatestSupportedVersion !== undefined,
47
+ `Invalid latest supported solidity version: ${latestSupportedVersion}`,
48
+ );
40
49
  let instrumentationVersion = compilationJobSolcVersion;
41
- if (!satisfies(instrumentationVersion, `<=${latestSupportedVersion}`)) {
50
+ const parsedInstrumentationVersion = parseVersion(instrumentationVersion);
51
+ assertHardhatInvariant(
52
+ parsedInstrumentationVersion !== undefined,
53
+ `Invalid solc version: ${instrumentationVersion}`,
54
+ );
55
+ if (
56
+ !lowerThanOrEqual(
57
+ parsedInstrumentationVersion,
58
+ parsedLatestSupportedVersion,
59
+ )
60
+ ) {
42
61
  instrumentationVersion = latestSupportedVersion;
43
62
  }
44
63
  const { source, metadata } = addStatementCoverageInstrumentation(
@@ -4,7 +4,7 @@ import type {
4
4
  Statement,
5
5
  } from "./types.js";
6
6
 
7
- import chalk from "chalk";
7
+ import { styleText } from "node:util";
8
8
 
9
9
  // Use constants for the Uint8Array to improve memory usage (1 byte vs 8 bytes per item)
10
10
  const STATUS_NOT_EXECUTED = 0; // equivalent to false
@@ -399,7 +399,7 @@ function printStatementsForDebugging(
399
399
  console.debug(counter++ + " ---");
400
400
 
401
401
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
402
- process.stdout.write(chalk.gray(fileContent[i]));
402
+ process.stdout.write(styleText("gray", fileContent[i]));
403
403
  }
404
404
 
405
405
  console.debug();
@@ -413,7 +413,7 @@ function printStatementsForDebugging(
413
413
  console.debug(counter++ + " ---");
414
414
 
415
415
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
416
- process.stdout.write(chalk.gray(fileContent[i]));
416
+ process.stdout.write(styleText("gray", fileContent[i]));
417
417
  }
418
418
 
419
419
  console.debug();
@@ -432,11 +432,11 @@ function printCharacterCoverageForDebugging(
432
432
  ): void {
433
433
  for (let i = 0; i < characterCoverage.length; i++) {
434
434
  if (characterCoverage[i] === STATUS_IGNORED) {
435
- process.stdout.write(chalk.gray(fileContent[i]));
435
+ process.stdout.write(styleText("gray", fileContent[i]));
436
436
  } else if (characterCoverage[i] === STATUS_EXECUTED) {
437
- process.stdout.write(chalk.green(fileContent[i]));
437
+ process.stdout.write(styleText("green", fileContent[i]));
438
438
  } else {
439
- process.stdout.write(chalk.red(fileContent[i]));
439
+ process.stdout.write(styleText("red", fileContent[i]));
440
440
  }
441
441
  }
442
442
  }
@@ -1,7 +1,8 @@
1
1
  import type { NewTaskActionFunction } from "../../../types/tasks.js";
2
2
 
3
+ import { styleText } from "node:util";
4
+
3
5
  import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
4
- import chalk from "chalk";
5
6
 
6
7
  import {
7
8
  ResolvedFileType,
@@ -108,7 +109,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
108
109
 
109
110
  if (filesWithoutLicenses.length > 0) {
110
111
  warn(
111
- chalk.yellow(
112
+ styleText(
113
+ "yellow",
112
114
  `\nThe following file(s) do NOT specify SPDX licenses: ${filesWithoutLicenses.join(
113
115
  ", ",
114
116
  )}`,
@@ -118,7 +120,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
118
120
 
119
121
  if (pragmaDirective !== "" && filesWithoutPragmaDirectives.length > 0) {
120
122
  warn(
121
- chalk.yellow(
123
+ styleText(
124
+ "yellow",
122
125
  `\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${filesWithoutPragmaDirectives.join(
123
126
  ", ",
124
127
  )}`,
@@ -128,7 +131,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
128
131
 
129
132
  if (filesWithDifferentPragmaDirectives.length > 0) {
130
133
  warn(
131
- chalk.yellow(
134
+ styleText(
135
+ "yellow",
132
136
  `\nThe flattened file is using the pragma abicoder directive '${pragmaDirective}' but these files have a different pragma abicoder directive: ${filesWithDifferentPragmaDirectives.join(
133
137
  ", ",
134
138
  )}`,
@@ -1,6 +1,7 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
@@ -10,7 +11,6 @@ import {
10
11
  writeUtf8File,
11
12
  } from "@nomicfoundation/hardhat-utils/fs";
12
13
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
13
- import chalk from "chalk";
14
14
 
15
15
  import {
16
16
  getFullyQualifiedName,
@@ -388,7 +388,8 @@ export function logFunctionGasSnapshotsSection(
388
388
  if (isFirstTimeWrite) {
389
389
  logger();
390
390
  logger(
391
- chalk.green(
391
+ styleText(
392
+ "green",
392
393
  " No existing snapshots found. Function gas snapshots written successfully",
393
394
  ),
394
395
  );
@@ -408,7 +409,7 @@ export function logFunctionGasSnapshotsSection(
408
409
  "\n",
409
410
  );
410
411
  for (const line of addedLines) {
411
- logger(chalk.green(` + ${line}`));
412
+ logger(styleText("green", ` + ${line}`));
412
413
  }
413
414
  }
414
415
 
@@ -419,7 +420,7 @@ export function logFunctionGasSnapshotsSection(
419
420
  comparison.removed,
420
421
  ).split("\n");
421
422
  for (const line of removedLines) {
422
- logger(chalk.red(` - ${line}`));
423
+ logger(styleText("red", ` - ${line}`));
423
424
  }
424
425
  }
425
426
 
@@ -435,10 +436,10 @@ export function printFunctionGasSnapshotChanges(
435
436
  const isLast = i === changes.length - 1;
436
437
 
437
438
  logger(` ${change.contractNameOrFqn}#${change.functionSig}`);
438
- logger(chalk.grey(` (in ${change.source})`));
439
+ logger(styleText("grey", ` (in ${change.source})`));
439
440
 
440
441
  if (change.kind === "fuzz") {
441
- logger(chalk.grey(` Runs: ${change.runs}`));
442
+ logger(styleText("grey", ` Runs: ${change.runs}`));
442
443
  }
443
444
 
444
445
  const diff = change.actual - change.expected;
@@ -454,15 +455,15 @@ export function printFunctionGasSnapshotChanges(
454
455
 
455
456
  // Color: green for decrease (improvement), red for increase (regression)
456
457
  const formattedGasChange =
457
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
458
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
458
459
 
459
460
  const label = change.kind === "fuzz" ? "~" : "gas";
460
461
 
461
- logger(chalk.grey(` Expected (${label}): ${change.expected}`));
462
+ logger(styleText("grey", ` Expected (${label}): ${change.expected}`));
462
463
  logger(
463
- chalk.grey(` Actual (${label}): ${change.actual} (`) +
464
+ styleText("grey", ` Actual (${label}): ${change.actual} (`) +
464
465
  formattedGasChange +
465
- chalk.grey(")"),
466
+ styleText("grey", ")"),
466
467
  );
467
468
 
468
469
  if (!isLast) {
@@ -10,11 +10,13 @@ import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
10
10
 
11
11
  import crypto from "node:crypto";
12
12
  import path from "node:path";
13
+ import { styleText } from "node:util";
13
14
 
14
15
  import {
15
16
  HardhatError,
16
17
  assertHardhatInvariant,
17
18
  } from "@nomicfoundation/hardhat-errors";
19
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
18
20
  import { formatTable } from "@nomicfoundation/hardhat-utils/format";
19
21
  import {
20
22
  ensureDir,
@@ -26,8 +28,6 @@ import {
26
28
  writeJsonFile,
27
29
  } from "@nomicfoundation/hardhat-utils/fs";
28
30
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
29
- import chalk from "chalk";
30
- import debug from "debug";
31
31
 
32
32
  import { parseFullyQualifiedName } from "../../../utils/contract-names.js";
33
33
 
@@ -41,7 +41,7 @@ import {
41
41
  median,
42
42
  } from "./helpers/utils.js";
43
43
 
44
- const gasStatsLog = debug(
44
+ const gasStatsLog = createDebug(
45
45
  "hardhat:core:gas-analytics:gas-analytics-manager:gas-stats",
46
46
  );
47
47
 
@@ -311,7 +311,10 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
311
311
  const rows: TableItem[] = [];
312
312
 
313
313
  if (gasStatsByContract.size > 0) {
314
- rows.push({ type: "title", text: chalk.bold("Gas Usage Statistics") });
314
+ rows.push({
315
+ type: "title",
316
+ text: styleText("bold", "Gas Usage Statistics"),
317
+ });
315
318
  }
316
319
 
317
320
  const sortedContracts = getSortedContractEntries(gasStatsByContract);
@@ -322,8 +325,9 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
322
325
  } of sortedContracts) {
323
326
  rows.push({
324
327
  type: "section-header",
325
- text: chalk.cyan.bold(userFqn),
326
- subtitle: proxyLabel !== undefined ? chalk.cyan(proxyLabel) : undefined,
328
+ text: styleText(["cyan", "bold"], userFqn),
329
+ subtitle:
330
+ proxyLabel !== undefined ? styleText("cyan", proxyLabel) : undefined,
327
331
  });
328
332
 
329
333
  if (contractGasStats.functions.size > 0) {
@@ -336,7 +340,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
336
340
  "Median",
337
341
  "Max",
338
342
  "#calls",
339
- ].map((s) => chalk.yellow(s)),
343
+ ].map((s) => styleText("yellow", s)),
340
344
  });
341
345
  }
342
346
 
@@ -372,7 +376,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
372
376
  "Median",
373
377
  "Max",
374
378
  "#deployments",
375
- ].map((s) => chalk.yellow(s)),
379
+ ].map((s) => styleText("yellow", s)),
376
380
  });
377
381
  rows.push({
378
382
  type: "row",
@@ -388,7 +392,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
388
392
  rows.push({
389
393
  type: "header",
390
394
  cells: [
391
- chalk.yellow("Bytecode size"),
395
+ styleText("yellow", "Bytecode size"),
392
396
  `${contractGasStats.deployment.runtimeSize}`,
393
397
  ],
394
398
  });
@@ -2,7 +2,7 @@
2
2
  // handler and task-actions that may run on every `hardhat test` invocation
3
3
  // regardless of whether the feature is enabled. It must stay lightweight:
4
4
  // do not add top-level imports that pull in the gas-analytics-manager module
5
- // graph (chalk, debug, node:crypto, file-system traversal, etc.), or the
5
+ // graph (debug, node:crypto, file-system traversal, etc.), or the
6
6
  // `--gas-stats` lazy-load is silently defeated for every caller.
7
7
  // If a new helper needs a heavy dependency, put it in a sibling file
8
8
  // (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
1
+ import { styleText } from "node:util";
2
2
 
3
3
  /**
4
4
  * Converts an internal FQN (e.g. `"project/contracts/Foo.sol:Foo"` or
@@ -108,5 +108,5 @@ export function formatSectionHeader(
108
108
  parts.push(`${removedLength} removed`);
109
109
  }
110
110
 
111
- return `${sectionName}: ${chalk.gray(parts.join(", "))}`;
111
+ return `${sectionName}: ${styleText("gray", parts.join(", "))}`;
112
112
  }
@@ -1,6 +1,7 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
@@ -12,7 +13,6 @@ import {
12
13
  remove,
13
14
  writeJsonFile,
14
15
  } from "@nomicfoundation/hardhat-utils/fs";
15
- import chalk from "chalk";
16
16
 
17
17
  import {
18
18
  getFullyQualifiedName,
@@ -371,7 +371,8 @@ export function logSnapshotCheatcodesSection(
371
371
  if (isFirstTimeWrite) {
372
372
  logger();
373
373
  logger(
374
- chalk.green(
374
+ styleText(
375
+ "green",
375
376
  " No existing snapshots found. Snapshot cheatcodes written successfully",
376
377
  ),
377
378
  );
@@ -391,7 +392,7 @@ export function logSnapshotCheatcodesSection(
391
392
  "\n",
392
393
  );
393
394
  for (const line of addedLines) {
394
- logger(chalk.green(` + ${line}`));
395
+ logger(styleText("green", ` + ${line}`));
395
396
  }
396
397
  }
397
398
 
@@ -402,7 +403,7 @@ export function logSnapshotCheatcodesSection(
402
403
  "\n",
403
404
  );
404
405
  for (const line of removedLines) {
405
- logger(chalk.red(` - ${line}`));
406
+ logger(styleText("red", ` - ${line}`));
406
407
  }
407
408
  }
408
409
 
@@ -418,7 +419,7 @@ export function printSnapshotCheatcodeChanges(
418
419
  const isLast = i === changes.length - 1;
419
420
 
420
421
  logger(` ${change.group}#${change.name}`);
421
- logger(chalk.grey(` (in ${change.source})`));
422
+ logger(styleText("grey", ` (in ${change.source})`));
422
423
 
423
424
  const diff = change.actual - change.expected;
424
425
  const formattedDiff = diff > 0 ? `Δ+${diff}` : `Δ${diff}`;
@@ -433,13 +434,13 @@ export function printSnapshotCheatcodeChanges(
433
434
 
434
435
  // Color: green for decrease (improvement), red for increase (regression)
435
436
  const formattedGasChange =
436
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
437
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
437
438
 
438
- logger(chalk.grey(` Expected: ${change.expected}`));
439
+ logger(styleText("grey", ` Expected: ${change.expected}`));
439
440
  logger(
440
- chalk.grey(` Actual: ${change.actual} (`) +
441
+ styleText("grey", ` Actual: ${change.actual} (`) +
441
442
  formattedGasChange +
442
- chalk.grey(")"),
443
+ styleText("grey", ")"),
443
444
  );
444
445
 
445
446
  if (!isLast) {
@@ -5,8 +5,9 @@ import type { FunctionGasSnapshotCheckResult } from "../../function-gas-snapshot
5
5
  import type { SnapshotCheatcodesCheckResult } from "../../snapshot-cheatcodes.js";
6
6
  import type { SuiteResult } from "@nomicfoundation/edr";
7
7
 
8
+ import { styleText } from "node:util";
9
+
8
10
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
9
- import chalk from "chalk";
10
11
 
11
12
  import { errorResult } from "../../../../../utils/result.js";
12
13
  import {
@@ -103,7 +104,7 @@ export function logSnapshotResult(
103
104
  logger: typeof console.log = console.log,
104
105
  ): void {
105
106
  if (result.functionGasSnapshotsWritten) {
106
- logger(chalk.green("Function gas snapshots written successfully"));
107
+ logger(styleText("green", "Function gas snapshots written successfully"));
107
108
  logger();
108
109
  }
109
110
  }
@@ -133,8 +134,8 @@ export function logSnapshotCheckResult(
133
134
  ): void {
134
135
  logger(
135
136
  functionGasSnapshotsCheck.passed && snapshotCheatcodesCheck.passed
136
- ? chalk.green("Snapshot check passed")
137
- : chalk.red("Snapshot check failed"),
137
+ ? styleText("green", "Snapshot check passed")
138
+ : styleText("red", "Snapshot check failed"),
138
139
  );
139
140
 
140
141
  const functionGasHasOutput =
@@ -164,7 +165,12 @@ export function logSnapshotCheckResult(
164
165
  logSnapshotCheatcodesSection(snapshotCheatcodesCheck, logger);
165
166
 
166
167
  if (!functionGasSnapshotsCheck.passed || !snapshotCheatcodesCheck.passed) {
167
- logger(chalk.yellow("To update snapshots, run your tests with --snapshot"));
168
+ logger(
169
+ styleText(
170
+ "yellow",
171
+ "To update snapshots, run your tests with --snapshot",
172
+ ),
173
+ );
168
174
  logger();
169
175
  }
170
176
  }
@@ -29,9 +29,9 @@ import {
29
29
  HardhatError,
30
30
  } from "@nomicfoundation/hardhat-errors";
31
31
  import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
32
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
32
33
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
33
34
  import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
34
- import debug from "debug";
35
35
 
36
36
  import { sendErrorTelemetry } from "../../../cli/telemetry/error-reporter/reporter.js";
37
37
  import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT } from "../../../constants.js";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./utils/convert-to-edr.js";
60
60
  import { printLine, replaceLastLine } from "./utils/logger.js";
61
61
 
62
- const log = debug("hardhat:core:hardhat-network:provider");
62
+ const log = createDebug("hardhat:core:network-manager:edr:provider");
63
63
 
64
64
  interface EdrProviderConfig {
65
65
  chainDescriptors: ChainDescriptorsConfig;
@@ -1,10 +1,11 @@
1
- import type { Colorizer } from "../../../../utils/colorizer.js";
2
1
  import type {
3
2
  LogTrace,
4
3
  CallTrace,
5
4
  DecodedTraceParameters,
6
5
  } from "@nomicfoundation/edr";
7
6
 
7
+ import { styleText } from "node:util";
8
+
8
9
  import { LogKind, CallKind, IncludeTraces } from "@nomicfoundation/edr";
9
10
  import { bytesToHexString } from "@nomicfoundation/hardhat-utils/hex";
10
11
 
@@ -23,9 +24,10 @@ export function verbosityToIncludeTraces(verbosity: number): IncludeTraces {
23
24
  export function formatTraces(
24
25
  traces: CallTrace[],
25
26
  prefix: string,
26
- colorizer: Colorizer,
27
+ // Allow passing a custom colorize function for testing purposes
28
+ colorize: typeof styleText = styleText,
27
29
  ): string {
28
- const lines = traces.map((trace) => formatTrace(trace, colorizer));
30
+ const lines = traces.map((trace) => formatTrace(trace, colorize));
29
31
  const formattedTraces = formatNestedArray(lines, prefix);
30
32
  // Remove the trailing newline
31
33
  return formattedTraces.slice(0, -1);
@@ -52,9 +54,13 @@ function formatOutputs(outputs: string | Uint8Array): string | undefined {
52
54
  }
53
55
  }
54
56
 
55
- function formatLog(log: LogTrace, colorizer: Colorizer): string[] {
57
+ function formatLog(
58
+ log: LogTrace,
59
+ // Allow passing a custom colorize function for testing purposes
60
+ colorize: typeof styleText,
61
+ ): string[] {
56
62
  const { parameters } = log;
57
- const tag = colorizer.yellow("[event]");
63
+ const tag = colorize("yellow", "[event]");
58
64
  const lines = [];
59
65
 
60
66
  if (Array.isArray(parameters)) {
@@ -63,18 +69,18 @@ function formatLog(log: LogTrace, colorizer: Colorizer): string[] {
63
69
 
64
70
  for (let i = 0; i < topicCount; i++) {
65
71
  const prefix = i === 0 ? `${tag} topic 0` : ` topic ${i}`;
66
- lines.push(`${prefix}: ${colorizer.cyan(hexValues[i])}`);
72
+ lines.push(`${prefix}: ${colorize("cyan", hexValues[i])}`);
67
73
  }
68
74
 
69
75
  if (hexValues.length > 0) {
70
76
  const dataPrefix = topicCount > 0 ? " data" : `${tag} data`;
71
77
  lines.push(
72
- `${dataPrefix}: ${colorizer.cyan(hexValues[hexValues.length - 1])}`,
78
+ `${dataPrefix}: ${colorize("cyan", hexValues[hexValues.length - 1])}`,
73
79
  );
74
80
  }
75
81
  } else {
76
82
  lines.push(
77
- `${tag} ${parameters.name}(${colorizer.cyan(parameters.arguments.join(", "))})`,
83
+ `${tag} ${parameters.name}(${colorize("cyan", parameters.arguments.join(", "))})`,
78
84
  );
79
85
  }
80
86
  return lines;
@@ -82,7 +88,7 @@ function formatLog(log: LogTrace, colorizer: Colorizer): string[] {
82
88
 
83
89
  function formatTrace(
84
90
  trace: CallTrace,
85
- colorizer: Colorizer,
91
+ colorize: typeof styleText,
86
92
  ): NestedArray<string> {
87
93
  const {
88
94
  success,
@@ -95,14 +101,8 @@ function formatTrace(
95
101
  isCheatcode,
96
102
  outputs,
97
103
  } = trace;
98
- let color;
99
- if (isCheatcode) {
100
- color = colorizer.blue;
101
- } else if (success) {
102
- color = colorizer.green;
103
- } else {
104
- color = colorizer.red;
105
- }
104
+ const colorName = isCheatcode ? "blue" : success ? "green" : "red";
105
+ const color = (text: string) => colorize(colorName, text);
106
106
 
107
107
  const formattedInputs = formatInputs(inputs, color);
108
108
  const formattedOutputs = formatOutputs(outputs);
@@ -110,7 +110,7 @@ function formatTrace(
110
110
  let openingLine: string;
111
111
  let closingLine: string | undefined;
112
112
  if (kind === CallKind.Create) {
113
- openingLine = `[${gasUsed}] ${colorizer.yellow("→ new")} ${contract ?? "<unknown>"}@${address}`;
113
+ openingLine = `[${gasUsed}] ${colorize("yellow", "→ new")} ${contract ?? "<unknown>"}@${address}`;
114
114
  // TODO: Uncomment this when the formattedInputs starts containing
115
115
  // the address of where the contract was deployed instead of the code.
116
116
  // if (formattedInputs !== undefined) {
@@ -125,11 +125,11 @@ function formatTrace(
125
125
  openingLine = `${openingLine} {value: ${value}}`;
126
126
  }
127
127
  if (kind === CallKind.StaticCall) {
128
- openingLine = `${openingLine} ${colorizer.yellow("[staticcall]")}`;
128
+ openingLine = `${openingLine} ${colorize("yellow", "[staticcall]")}`;
129
129
  } else if (kind === CallKind.DelegateCall) {
130
- openingLine = `${openingLine} ${colorizer.yellow("[delegatecall]")}`;
130
+ openingLine = `${openingLine} ${colorize("yellow", "[delegatecall]")}`;
131
131
  } else if (kind === CallKind.CallCode) {
132
- openingLine = `${openingLine} ${colorizer.yellow("[callcode]")}`;
132
+ openingLine = `${openingLine} ${colorize("yellow", "[callcode]")}`;
133
133
  }
134
134
  }
135
135
  if (formattedOutputs !== undefined) {
@@ -147,9 +147,9 @@ function formatTrace(
147
147
  lines.push(openingLine);
148
148
  for (const child of trace.children) {
149
149
  if (child.kind === LogKind.Log) {
150
- lines.push(formatLog(child, colorizer));
150
+ lines.push(formatLog(child, colorize));
151
151
  } else {
152
- lines.push(formatTrace(child, colorizer));
152
+ lines.push(formatTrace(child, colorize));
153
153
  }
154
154
  }
155
155
  if (closingLine !== undefined) {