From e3985130ef90e7b299cdf75c1ac2961c68e2805a Mon Sep 17 00:00:00 2001 From: v1rtl Date: Fri, 20 Sep 2024 16:40:17 +0300 Subject: [PATCH 01/14] replace glob with tinyglobby --- packages/hardhat-core/package.json | 3 +- .../hardhat-core/src/internal/util/glob.ts | 9 ++--- pnpm-lock.yaml | 36 +++++++++++++++---- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index b12a62a377..d7dcb83a93 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -68,7 +68,6 @@ "@types/debug": "^4.1.4", "@types/find-up": "^2.1.1", "@types/fs-extra": "^5.1.0", - "@types/glob": "^7.1.1", "@types/keccak": "^3.0.1", "@types/lodash": "^4.14.123", "@types/mocha": ">=9.1.0", @@ -125,7 +124,6 @@ "find-up": "^2.1.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", - "glob": "7.2.0", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "json-stream-stringify": "^3.1.4", @@ -140,6 +138,7 @@ "solc": "0.8.26", "source-map-support": "^0.5.13", "stacktrace-parser": "^0.1.10", + "tinyglobby": "^0.2.6", "tsort": "0.0.1", "undici": "^5.14.0", "uuid": "^8.3.2", diff --git a/packages/hardhat-core/src/internal/util/glob.ts b/packages/hardhat-core/src/internal/util/glob.ts index 41ad6aea5a..5e1fd47dee 100644 --- a/packages/hardhat-core/src/internal/util/glob.ts +++ b/packages/hardhat-core/src/internal/util/glob.ts @@ -1,7 +1,5 @@ -import type { IOptions as GlobOptions } from "glob"; - +import type { GlobOptions } from "tinyglobby"; import * as path from "path"; -import util from "util"; /** * DO NOT USE THIS FUNCTION. It's SLOW and its semantics are optimized for @@ -16,8 +14,7 @@ export async function glob( pattern: string, options: GlobOptions = {} ): Promise { - const { default: globModule } = await import("glob"); - const files = await util.promisify(globModule)(pattern, options); + const files = await (await import('tinyglobby')).glob([pattern], options); return files.map(path.normalize); } @@ -26,6 +23,6 @@ export async function glob( * @see glob */ export function globSync(pattern: string, options: GlobOptions = {}): string[] { - const files = require("glob").sync(pattern, options); + const files = (require('tinyglobby') as typeof import('tinyglobby')).globSync([pattern], options); return files.map(path.normalize); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ecf43008b..6137310b61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -269,9 +269,6 @@ importers: fs-extra: specifier: ^7.0.1 version: 7.0.1 - glob: - specifier: 7.2.0 - version: 7.2.0 immutable: specifier: ^4.0.0-rc.12 version: 4.3.7 @@ -314,6 +311,9 @@ importers: stacktrace-parser: specifier: ^0.1.10 version: 0.1.10 + tinyglobby: + specifier: ^0.2.6 + version: 0.2.6 tsort: specifier: 0.0.1 version: 0.0.1 @@ -357,9 +357,6 @@ importers: '@types/fs-extra': specifier: ^5.1.0 version: 5.1.0 - '@types/glob': - specifier: ^7.1.1 - version: 7.2.0 '@types/keccak': specifier: ^3.0.1 version: 3.0.5 @@ -4211,6 +4208,14 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + fdir@6.3.0: + resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -5673,6 +5678,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + pify@2.3.0: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} @@ -6396,6 +6405,10 @@ packages: resolution: {integrity: sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==} engines: {node: '>=0.10.0'} + tinyglobby@0.2.6: + resolution: {integrity: sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==} + engines: {node: '>=12.0.0'} + title-case@2.1.1: resolution: {integrity: sha512-EkJoZ2O3zdCz3zJsYCsxyq2OC5hrxR9mfdd5I+w8h/tmFfeOxJ+vvkxsKxdmN0WtS9zLdHEgfgVOiMVgv+Po4Q==} @@ -10400,6 +10413,10 @@ snapshots: dependencies: reusify: 1.0.4 + fdir@6.3.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-entry-cache@6.0.1: dependencies: flat-cache: 3.2.0 @@ -11913,6 +11930,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + pify@2.3.0: {} pify@4.0.1: {} @@ -12810,6 +12829,11 @@ snapshots: timed-out@4.0.1: {} + tinyglobby@0.2.6: + dependencies: + fdir: 6.3.0(picomatch@4.0.2) + picomatch: 4.0.2 + title-case@2.1.1: dependencies: no-case: 2.3.2 From 34d037bcc4c1ef6619af2db3e531b5574facfdb8 Mon Sep 17 00:00:00 2001 From: v1rtl Date: Sat, 21 Sep 2024 14:46:45 +0300 Subject: [PATCH 02/14] replace chalk with picocolors --- packages/hardhat-core/package.json | 2 +- .../hardhat-core/src/builtin-tasks/compile.ts | 6 ++-- .../hardhat-core/src/builtin-tasks/flatten.ts | 2 +- .../hardhat-core/src/builtin-tasks/node.ts | 2 +- .../hardhat-core/src/builtin-tasks/test.ts | 2 +- .../src/builtin-tasks/utils/watch.ts | 2 +- .../src/internal/cli/bootstrap.ts | 2 +- packages/hardhat-core/src/internal/cli/cli.ts | 2 +- .../src/internal/cli/project-creation.ts | 2 +- .../hardhat-core/src/internal/cli/vars.ts | 2 +- .../src/internal/cli/version-notifier.ts | 2 +- .../internal/core/config/config-loading.ts | 2 +- .../hardhat-network/provider/provider.ts | 2 +- .../utils/fork-recomendations-banner.ts | 2 +- .../provider/utils/makeForkClient.ts | 2 +- .../stack-traces/vm-trace-decoder.ts | 2 +- .../test/builtin-tasks/flatten.ts | 2 +- .../test/internal/cli/vars/vars.ts | 2 +- packages/hardhat-core/test/setup.ts | 2 +- packages/hardhat-ethers/package.json | 4 +-- packages/hardhat-ethers/test/environment.ts | 2 +- packages/hardhat-foundry/package.json | 6 ++-- packages/hardhat-foundry/src/foundry.ts | 2 +- packages/hardhat-foundry/src/index.ts | 2 +- packages/hardhat-verify/package.json | 2 +- packages/hardhat-verify/src/index.ts | 2 +- .../hardhat-verify/src/internal/config.ts | 2 +- .../src/internal/tasks/sourcify.ts | 2 +- .../hardhat-verify/src/internal/utilities.ts | 2 +- .../hardhat-verify/test/unit/utilities.ts | 2 +- pnpm-lock.yaml | 29 +++++++++++-------- 31 files changed, 52 insertions(+), 47 deletions(-) diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index d7dcb83a93..7dec020837 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -113,7 +113,6 @@ "aggregate-error": "^3.0.0", "ansi-escapes": "^4.3.0", "boxen": "^5.1.2", - "chalk": "^2.4.2", "chokidar": "^4.0.0", "ci-info": "^2.0.0", "debug": "^4.1.1", @@ -132,6 +131,7 @@ "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", + "picocolors": "^1.1.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", diff --git a/packages/hardhat-core/src/builtin-tasks/compile.ts b/packages/hardhat-core/src/builtin-tasks/compile.ts index 88454dbdc4..59db023ba6 100644 --- a/packages/hardhat-core/src/builtin-tasks/compile.ts +++ b/packages/hardhat-core/src/builtin-tasks/compile.ts @@ -1,5 +1,5 @@ import os from "os"; -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; import semver from "semver"; @@ -800,11 +800,11 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS) getFormattedInternalCompilerErrorMessage(error) ?? error.formattedMessage; - console.error(errorMessage.replace(/^\w+:/, (t) => chalk.red.bold(t))); + console.error(errorMessage.replace(/^\w+:/, (t) => chalk.bold(chalk.red(t)))); } else { console.warn( (error.formattedMessage as string).replace(/^\w+:/, (t) => - chalk.yellow.bold(t) + chalk.bold(chalk.yellow(t)) ) ); } diff --git a/packages/hardhat-core/src/builtin-tasks/flatten.ts b/packages/hardhat-core/src/builtin-tasks/flatten.ts index c37b1a5af6..ac0ab67a0d 100644 --- a/packages/hardhat-core/src/builtin-tasks/flatten.ts +++ b/packages/hardhat-core/src/builtin-tasks/flatten.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import { subtask, task, types } from "../internal/core/config/config-env"; import { HardhatError } from "../internal/core/errors"; import { ERRORS } from "../internal/core/errors-list"; diff --git a/packages/hardhat-core/src/builtin-tasks/node.ts b/packages/hardhat-core/src/builtin-tasks/node.ts index c44bee6eea..879667a51f 100644 --- a/packages/hardhat-core/src/builtin-tasks/node.ts +++ b/packages/hardhat-core/src/builtin-tasks/node.ts @@ -1,6 +1,6 @@ import type EthereumjsUtilT from "@nomicfoundation/ethereumjs-util"; -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; diff --git a/packages/hardhat-core/src/builtin-tasks/test.ts b/packages/hardhat-core/src/builtin-tasks/test.ts index d6a5577571..451d31220c 100644 --- a/packages/hardhat-core/src/builtin-tasks/test.ts +++ b/packages/hardhat-core/src/builtin-tasks/test.ts @@ -1,6 +1,6 @@ import type { MochaOptions } from "mocha"; -import chalk from "chalk"; +import chalk from "picocolors"; import path from "path"; import { HARDHAT_NETWORK_NAME } from "../internal/constants"; diff --git a/packages/hardhat-core/src/builtin-tasks/utils/watch.ts b/packages/hardhat-core/src/builtin-tasks/utils/watch.ts index 37817a88d7..376c35da07 100644 --- a/packages/hardhat-core/src/builtin-tasks/utils/watch.ts +++ b/packages/hardhat-core/src/builtin-tasks/utils/watch.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import { FSWatcher } from "chokidar"; import debug from "debug"; import fsExtra from "fs-extra"; diff --git a/packages/hardhat-core/src/internal/cli/bootstrap.ts b/packages/hardhat-core/src/internal/cli/bootstrap.ts index 7668019292..98f51106d5 100644 --- a/packages/hardhat-core/src/internal/cli/bootstrap.ts +++ b/packages/hardhat-core/src/internal/cli/bootstrap.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -import chalk from "chalk"; +import chalk from "picocolors"; import { isNodeVersionToWarnOn } from "./is-node-version-to-warn-on"; diff --git a/packages/hardhat-core/src/internal/cli/cli.ts b/packages/hardhat-core/src/internal/cli/cli.ts index f31f1c8aec..1b55a250f2 100755 --- a/packages/hardhat-core/src/internal/cli/cli.ts +++ b/packages/hardhat-core/src/internal/cli/cli.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import "source-map-support/register"; diff --git a/packages/hardhat-core/src/internal/cli/project-creation.ts b/packages/hardhat-core/src/internal/cli/project-creation.ts index 43ac320bf6..0c027ad032 100644 --- a/packages/hardhat-core/src/internal/cli/project-creation.ts +++ b/packages/hardhat-core/src/internal/cli/project-creation.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import fsExtra from "fs-extra"; import path from "path"; diff --git a/packages/hardhat-core/src/internal/cli/vars.ts b/packages/hardhat-core/src/internal/cli/vars.ts index 7a36f80920..ae7b0613fd 100644 --- a/packages/hardhat-core/src/internal/cli/vars.ts +++ b/packages/hardhat-core/src/internal/cli/vars.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import { HardhatError, assertHardhatInvariant } from "../core/errors"; import { ERRORS } from "../core/errors-list"; diff --git a/packages/hardhat-core/src/internal/cli/version-notifier.ts b/packages/hardhat-core/src/internal/cli/version-notifier.ts index 1ac7ececee..8785639b16 100644 --- a/packages/hardhat-core/src/internal/cli/version-notifier.ts +++ b/packages/hardhat-core/src/internal/cli/version-notifier.ts @@ -1,5 +1,5 @@ import boxen from "boxen"; -import chalk from "chalk"; +import chalk from "picocolors"; import fsExtra from "fs-extra"; import { join } from "node:path"; import { mkdir, readFile, writeFile } from "node:fs/promises"; diff --git a/packages/hardhat-core/src/internal/core/config/config-loading.ts b/packages/hardhat-core/src/internal/core/config/config-loading.ts index 751151c07e..fc1ccf2adb 100644 --- a/packages/hardhat-core/src/internal/core/config/config-loading.ts +++ b/packages/hardhat-core/src/internal/core/config/config-loading.ts @@ -1,6 +1,6 @@ import type StackTraceParserT from "stacktrace-parser"; -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; import path from "path"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts index 359f982be2..71fdfb3c82 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts @@ -19,7 +19,7 @@ import type { HttpHeader, } from "@nomicfoundation/edr"; import { Common } from "@nomicfoundation/ethereumjs-common"; -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import { EventEmitter } from "events"; import fsExtra from "fs-extra"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts index a8782aa94f..4f5597b5f2 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import fsExtra from "fs-extra"; import path from "path"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts index cc006ec9ab..bb50d0527c 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import { HARDHAT_NETWORK_NAME } from "../../../constants"; import { assertHardhatInvariant } from "../../../core/errors"; diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts index a0bf98769b..e845dc0865 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts @@ -1,5 +1,5 @@ import type { VmTraceDecoder as VmTraceDecoderT } from "@nomicfoundation/edr"; -import chalk from "chalk"; +import chalk from "picocolors"; import debug from "debug"; import { Reporter } from "../../sentry/reporter"; import { TracingConfig } from "../provider/node-types"; diff --git a/packages/hardhat-core/test/builtin-tasks/flatten.ts b/packages/hardhat-core/test/builtin-tasks/flatten.ts index 75cd7dbbc3..268a4b98f0 100644 --- a/packages/hardhat-core/test/builtin-tasks/flatten.ts +++ b/packages/hardhat-core/test/builtin-tasks/flatten.ts @@ -2,7 +2,7 @@ import { assert } from "chai"; import fs from "fs"; import sinon, { SinonSpy } from "sinon"; -import chalk from "chalk"; +import chalk from "picocolors"; import { TASK_FLATTEN, TASK_FLATTEN_GET_FLATTENED_SOURCE, diff --git a/packages/hardhat-core/test/internal/cli/vars/vars.ts b/packages/hardhat-core/test/internal/cli/vars/vars.ts index ba83c1d1bc..99d5a7cf5a 100644 --- a/packages/hardhat-core/test/internal/cli/vars/vars.ts +++ b/packages/hardhat-core/test/internal/cli/vars/vars.ts @@ -5,7 +5,7 @@ import fs from "fs-extra"; import * as os from "os"; import sinon, { SinonSandbox } from "sinon"; import { assert, expect } from "chai"; -import chalk from "chalk"; +import chalk from "picocolors"; import enquirer from "enquirer"; import { HardhatContext } from "../../../../src/internal/context"; import { handleVars } from "../../../../src/internal/cli/vars"; diff --git a/packages/hardhat-core/test/setup.ts b/packages/hardhat-core/test/setup.ts index b07c382945..2550630672 100644 --- a/packages/hardhat-core/test/setup.ts +++ b/packages/hardhat-core/test/setup.ts @@ -1,6 +1,6 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import chalk from "chalk"; +import chalk from "picocolors"; chai.use(chaiAsPromised); diff --git a/packages/hardhat-ethers/package.json b/packages/hardhat-ethers/package.json index 9118691669..216fef6d1d 100644 --- a/packages/hardhat-ethers/package.json +++ b/packages/hardhat-ethers/package.json @@ -40,7 +40,8 @@ ], "dependencies": { "debug": "^4.1.1", - "lodash.isequal": "^4.5.0" + "lodash.isequal": "^4.5.0", + "picocolors": "^1.1.0" }, "devDependencies": { "@nomicfoundation/eslint-plugin-hardhat-internal-rules": "workspace:^", @@ -56,7 +57,6 @@ "@typescript-eslint/parser": "5.61.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "chalk": "^2.4.2", "eslint": "^8.44.0", "eslint-config-prettier": "8.3.0", "eslint-plugin-import": "2.27.5", diff --git a/packages/hardhat-ethers/test/environment.ts b/packages/hardhat-ethers/test/environment.ts index 7e5c760d56..c018cf895b 100644 --- a/packages/hardhat-ethers/test/environment.ts +++ b/packages/hardhat-ethers/test/environment.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import fs from "fs"; import { HardhatRuntimeEnvironment, HardhatUserConfig } from "hardhat/types"; import { resetHardhatContext } from "hardhat/plugins-testing"; diff --git a/packages/hardhat-foundry/package.json b/packages/hardhat-foundry/package.json index ce87dd83c7..72c7340be1 100644 --- a/packages/hardhat-foundry/package.json +++ b/packages/hardhat-foundry/package.json @@ -32,9 +32,6 @@ "LICENSE", "README.md" ], - "dependencies": { - "chalk": "^2.4.2" - }, "devDependencies": { "@nomicfoundation/eslint-plugin-hardhat-internal-rules": "workspace:^", "@nomicfoundation/eslint-plugin-slow-imports": "workspace:^", @@ -58,5 +55,8 @@ }, "peerDependencies": { "hardhat": "workspace:^2.17.2" + }, + "dependencies": { + "picocolors": "^1.1.0" } } diff --git a/packages/hardhat-foundry/src/foundry.ts b/packages/hardhat-foundry/src/foundry.ts index c3fbf10350..47d57ce7b8 100644 --- a/packages/hardhat-foundry/src/foundry.ts +++ b/packages/hardhat-foundry/src/foundry.ts @@ -1,4 +1,4 @@ -import chalk from "chalk"; +import chalk from "picocolors"; import { exec as execCallback, execSync } from "child_process"; import { NomicLabsHardhatPluginError } from "hardhat/internal/core/errors"; import { promisify } from "util"; diff --git a/packages/hardhat-foundry/src/index.ts b/packages/hardhat-foundry/src/index.ts index 8098279e35..b9a856fa18 100644 --- a/packages/hardhat-foundry/src/index.ts +++ b/packages/hardhat-foundry/src/index.ts @@ -7,7 +7,7 @@ import { import { HardhatRuntimeEnvironment } from "hardhat/types"; import { existsSync, writeFileSync } from "fs"; import path from "path"; -import chalk from "chalk"; +import chalk from "picocolors"; import { getForgeConfig, getRemappings, diff --git a/packages/hardhat-verify/package.json b/packages/hardhat-verify/package.json index 409f97e97f..7eb30e89c7 100644 --- a/packages/hardhat-verify/package.json +++ b/packages/hardhat-verify/package.json @@ -42,9 +42,9 @@ "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", "cbor": "^8.1.0", - "chalk": "^2.4.2", "debug": "^4.1.1", "lodash.clonedeep": "^4.5.0", + "picocolors": "^1.1.0", "semver": "^6.3.0", "table": "^6.8.0", "undici": "^5.14.0" diff --git a/packages/hardhat-verify/src/index.ts b/packages/hardhat-verify/src/index.ts index 175ba72cb9..0cbfc3a864 100644 --- a/packages/hardhat-verify/src/index.ts +++ b/packages/hardhat-verify/src/index.ts @@ -5,7 +5,7 @@ import type { } from "./internal/solc/artifacts"; import type { Bytecode } from "./internal/solc/bytecode"; -import chalk from "chalk"; +import chalk from "picocolors"; import { extendConfig, subtask, task, types } from "hardhat/config"; import { diff --git a/packages/hardhat-verify/src/internal/config.ts b/packages/hardhat-verify/src/internal/config.ts index 58354c51be..ed80d56ae8 100644 --- a/packages/hardhat-verify/src/internal/config.ts +++ b/packages/hardhat-verify/src/internal/config.ts @@ -6,7 +6,7 @@ import type { BlockscoutConfig, } from "../types"; -import chalk from "chalk"; +import chalk from "picocolors"; export function etherscanConfigExtender( config: HardhatConfig, diff --git a/packages/hardhat-verify/src/internal/tasks/sourcify.ts b/packages/hardhat-verify/src/internal/tasks/sourcify.ts index 02accba930..4ce00cf4fd 100644 --- a/packages/hardhat-verify/src/internal/tasks/sourcify.ts +++ b/packages/hardhat-verify/src/internal/tasks/sourcify.ts @@ -4,7 +4,7 @@ import type { LibraryToAddress, } from "../solc/artifacts"; -import chalk from "chalk"; +import chalk from "picocolors"; import { subtask, types } from "hardhat/config"; import { isFullyQualifiedName } from "hardhat/utils/contract-names"; import { HARDHAT_NETWORK_NAME } from "hardhat/plugins"; diff --git a/packages/hardhat-verify/src/internal/utilities.ts b/packages/hardhat-verify/src/internal/utilities.ts index 9785344b00..3ef70d9146 100644 --- a/packages/hardhat-verify/src/internal/utilities.ts +++ b/packages/hardhat-verify/src/internal/utilities.ts @@ -2,7 +2,7 @@ import type { JsonFragment } from "@ethersproject/abi"; import type { SolidityConfig } from "hardhat/types"; import type { ChainConfig } from "../types"; -import chalk from "chalk"; +import chalk from "picocolors"; import path from "path"; import { builtinChains } from "./chain-config"; import { diff --git a/packages/hardhat-verify/test/unit/utilities.ts b/packages/hardhat-verify/test/unit/utilities.ts index 8141002302..11684785aa 100644 --- a/packages/hardhat-verify/test/unit/utilities.ts +++ b/packages/hardhat-verify/test/unit/utilities.ts @@ -5,7 +5,7 @@ import type { ChainConfig } from "../../src/types"; import path from "path"; import { assert, expect } from "chai"; import sinon from "sinon"; -import chalk from "chalk"; +import chalk from "picocolors"; import { encodeArguments, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6137310b61..5e23dba029 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,9 +236,6 @@ importers: boxen: specifier: ^5.1.2 version: 5.1.2 - chalk: - specifier: ^2.4.2 - version: 2.4.2 chokidar: specifier: ^4.0.0 version: 4.0.1 @@ -293,6 +290,9 @@ importers: p-map: specifier: ^4.0.0 version: 4.0.0 + picocolors: + specifier: ^1.1.0 + version: 1.1.0 raw-body: specifier: ^2.4.1 version: 2.5.2 @@ -450,6 +450,9 @@ importers: lodash.isequal: specifier: ^4.5.0 version: 4.5.0 + picocolors: + specifier: ^1.1.0 + version: 1.1.0 devDependencies: '@nomicfoundation/eslint-plugin-hardhat-internal-rules': specifier: workspace:^ @@ -490,9 +493,6 @@ importers: chai-as-promised: specifier: ^7.1.1 version: 7.1.2(chai@4.5.0) - chalk: - specifier: ^2.4.2 - version: 2.4.2 eslint: specifier: ^8.44.0 version: 8.57.1 @@ -535,9 +535,9 @@ importers: packages/hardhat-foundry: dependencies: - chalk: - specifier: ^2.4.2 - version: 2.4.2 + picocolors: + specifier: ^1.1.0 + version: 1.1.0 devDependencies: '@nomicfoundation/eslint-plugin-hardhat-internal-rules': specifier: workspace:^ @@ -1366,15 +1366,15 @@ importers: cbor: specifier: ^8.1.0 version: 8.1.0 - chalk: - specifier: ^2.4.2 - version: 2.4.2 debug: specifier: ^4.1.1 version: 4.3.7(supports-color@8.1.1) lodash.clonedeep: specifier: ^4.5.0 version: 4.5.0 + picocolors: + specifier: ^1.1.0 + version: 1.1.0 semver: specifier: ^6.3.0 version: 6.3.1 @@ -5671,6 +5671,9 @@ packages: performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -11926,6 +11929,8 @@ snapshots: performance-now@2.1.0: {} + picocolors@1.1.0: {} + picocolors@1.1.1: {} picomatch@2.3.1: {} From a0a9d3da75fbcb21626babd2fb26dcc4cc70da7e Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:21:30 +0000 Subject: [PATCH 03/14] Fix picocolors bugs --- .../hardhat-core/src/internal/cli/bootstrap.ts | 2 +- packages/hardhat-core/src/internal/cli/cli.ts | 16 +++++++++------- packages/hardhat-ethers/test/environment.ts | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/hardhat-core/src/internal/cli/bootstrap.ts b/packages/hardhat-core/src/internal/cli/bootstrap.ts index 98f51106d5..4535af930c 100644 --- a/packages/hardhat-core/src/internal/cli/bootstrap.ts +++ b/packages/hardhat-core/src/internal/cli/bootstrap.ts @@ -6,7 +6,7 @@ import { isNodeVersionToWarnOn } from "./is-node-version-to-warn-on"; if (isNodeVersionToWarnOn(process.version)) { console.warn( - chalk.yellow.bold(`WARNING:`), + chalk.yellow(chalk.bold(`WARNING:`)), `You are currently using Node.js ${process.version}, which is not supported by Hardhat. This can lead to unexpected behavior. See https://hardhat.org/nodejs-versions` ); console.log(); diff --git a/packages/hardhat-core/src/internal/cli/cli.ts b/packages/hardhat-core/src/internal/cli/cli.ts index 1b55a250f2..0b8511358b 100755 --- a/packages/hardhat-core/src/internal/cli/cli.ts +++ b/packages/hardhat-core/src/internal/cli/cli.ts @@ -170,14 +170,16 @@ async function main() { // Warning for Hardhat V3 deprecation console.warn( - chalk.yellow.bold("\n\nDEPRECATION WARNING\n\n"), + chalk.yellow(chalk.bold("\n\nDEPRECATION WARNING\n\n")), chalk.yellow( - `Initializing a project with ${chalk.white.italic( - "npx hardhat" + `Initializing a project with ${chalk.white( + chalk.italic("npx hardhat") )} is deprecated and will be removed in the future.\n` ), chalk.yellow( - `Please use ${chalk.white.italic("npx hardhat init")} instead.\n\n` + `Please use ${chalk.white( + chalk.italic("npx hardhat init") + )} instead.\n\n` ) ); @@ -387,13 +389,13 @@ async function main() { if (HardhatError.isHardhatError(error)) { isHardhatError = true; console.error( - chalk.red.bold("Error"), - error.message.replace(/^\w+:/, (t) => chalk.red.bold(t)) + chalk.red(chalk.bold("Error")), + error.message.replace(/^\w+:/, (t) => chalk.red(chalk.bold(t))) ); } else if (HardhatPluginError.isHardhatPluginError(error)) { isHardhatError = true; console.error( - chalk.red.bold(`Error in plugin ${error.pluginName}:`), + chalk.red(chalk.bold(`Error in plugin ${error.pluginName}:`)), error.message ); } else if (error instanceof Error) { diff --git a/packages/hardhat-ethers/test/environment.ts b/packages/hardhat-ethers/test/environment.ts index c018cf895b..f2dce6cd8c 100644 --- a/packages/hardhat-ethers/test/environment.ts +++ b/packages/hardhat-ethers/test/environment.ts @@ -39,7 +39,10 @@ export function useEnvironment( afterEach(function () { if (this.currentTest?.state === "failed") { - console.log(chalk.red("Failed in fixture project", fixtureProjectPath)); + console.log( + chalk.red("Failed in fixture project"), + chalk.red(fixtureProjectPath) + ); } }); } @@ -70,7 +73,10 @@ export function usePersistentEnvironment( afterEach(function () { if (this.currentTest?.state === "failed") { - console.log(chalk.red("Failed in fixture project", fixtureProjectPath)); + console.log( + chalk.red("Failed in fixture project"), + chalk.red(fixtureProjectPath) + ); } }); } @@ -159,7 +165,10 @@ contract Example { afterEach(function () { if (this.currentTest?.state === "failed") { - console.log(chalk.red("Failed in fixture project", fixtureProjectPath)); + console.log( + chalk.red("Failed in fixture project"), + chalk.red(fixtureProjectPath) + ); } }); } From f1f10f2c6965210e60d582f5f0c52f7afb2ee486 Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:23:37 +0000 Subject: [PATCH 04/14] Fix linter errors --- config/eslint/constants.js | 2 +- packages/hardhat-core/src/builtin-tasks/compile.ts | 4 +++- packages/hardhat-core/src/internal/util/glob.ts | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/eslint/constants.js b/config/eslint/constants.js index ae18c712a2..9b37675e7c 100644 --- a/config/eslint/constants.js +++ b/config/eslint/constants.js @@ -1,5 +1,5 @@ module.exports.slowImportsCommonIgnoredModules = [ - "chalk", + "picocolors", "debug", "find-up", "fs-extra", diff --git a/packages/hardhat-core/src/builtin-tasks/compile.ts b/packages/hardhat-core/src/builtin-tasks/compile.ts index 59db023ba6..8aaa922b26 100644 --- a/packages/hardhat-core/src/builtin-tasks/compile.ts +++ b/packages/hardhat-core/src/builtin-tasks/compile.ts @@ -800,7 +800,9 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS) getFormattedInternalCompilerErrorMessage(error) ?? error.formattedMessage; - console.error(errorMessage.replace(/^\w+:/, (t) => chalk.bold(chalk.red(t)))); + console.error( + errorMessage.replace(/^\w+:/, (t) => chalk.bold(chalk.red(t))) + ); } else { console.warn( (error.formattedMessage as string).replace(/^\w+:/, (t) => diff --git a/packages/hardhat-core/src/internal/util/glob.ts b/packages/hardhat-core/src/internal/util/glob.ts index 5e1fd47dee..afe82744dd 100644 --- a/packages/hardhat-core/src/internal/util/glob.ts +++ b/packages/hardhat-core/src/internal/util/glob.ts @@ -14,7 +14,7 @@ export async function glob( pattern: string, options: GlobOptions = {} ): Promise { - const files = await (await import('tinyglobby')).glob([pattern], options); + const files = await (await import("tinyglobby")).glob([pattern], options); return files.map(path.normalize); } @@ -23,6 +23,9 @@ export async function glob( * @see glob */ export function globSync(pattern: string, options: GlobOptions = {}): string[] { - const files = (require('tinyglobby') as typeof import('tinyglobby')).globSync([pattern], options); + const files = (require("tinyglobby") as typeof import("tinyglobby")).globSync( + [pattern], + options + ); return files.map(path.normalize); } From 40c19b54664d95d472796405ed22cb5ad859624e Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:49:27 +0000 Subject: [PATCH 05/14] Upgrade find-up (Thanks @kiriyaga-txfusion!) --- packages/hardhat-core/package.json | 3 +- .../src/internal/cli/autocomplete.ts | 2 +- .../internal/core/config/config-loading.ts | 2 +- .../src/internal/core/project-structure.ts | 16 +++--- .../src/internal/sentry/anonymizer.ts | 4 +- .../src/internal/util/caller-package.ts | 4 +- .../src/internal/util/packageInfo.ts | 8 +-- .../test/internal/sentry/anonymizer.ts | 4 +- pnpm-lock.yaml | 57 +------------------ 9 files changed, 23 insertions(+), 77 deletions(-) diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index 7dec020837..e7b0da707c 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -66,7 +66,6 @@ "@types/chai-as-promised": "^7.1.3", "@types/ci-info": "^2.0.0", "@types/debug": "^4.1.4", - "@types/find-up": "^2.1.1", "@types/fs-extra": "^5.1.0", "@types/keccak": "^3.0.1", "@types/lodash": "^4.14.123", @@ -120,7 +119,7 @@ "env-paths": "^2.2.0", "ethereum-cryptography": "^1.0.3", "ethereumjs-abi": "^0.6.8", - "find-up": "^2.1.0", + "find-up": "^5.0.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", "immutable": "^4.0.0-rc.12", diff --git a/packages/hardhat-core/src/internal/cli/autocomplete.ts b/packages/hardhat-core/src/internal/cli/autocomplete.ts index 10ebe09b38..82eb3773ff 100644 --- a/packages/hardhat-core/src/internal/cli/autocomplete.ts +++ b/packages/hardhat-core/src/internal/cli/autocomplete.ts @@ -307,7 +307,7 @@ function getTaskFromTaskDefinition(taskDef: TaskDefinition): Task { function getProjectId(): string | undefined { const packageJsonPath = findup.sync("package.json"); - if (packageJsonPath === null) { + if (packageJsonPath === undefined) { return undefined; } diff --git a/packages/hardhat-core/src/internal/core/config/config-loading.ts b/packages/hardhat-core/src/internal/core/config/config-loading.ts index fc1ccf2adb..5717301b27 100644 --- a/packages/hardhat-core/src/internal/core/config/config-loading.ts +++ b/packages/hardhat-core/src/internal/core/config/config-loading.ts @@ -198,7 +198,7 @@ export function analyzeModuleNotFoundError(error: any, configPath: string) { const packageJsonPath = findClosestPackageJson(throwingFile); - if (packageJsonPath === null) { + if (packageJsonPath === undefined) { return; } diff --git a/packages/hardhat-core/src/internal/core/project-structure.ts b/packages/hardhat-core/src/internal/core/project-structure.ts index 1ccf6ecfec..26f67b8a09 100644 --- a/packages/hardhat-core/src/internal/core/project-structure.ts +++ b/packages/hardhat-core/src/internal/core/project-structure.ts @@ -14,31 +14,31 @@ const CTS_CONFIG_FILENAME = "hardhat.config.cts"; export function isCwdInsideProject() { return ( - findUp.sync(TS_CONFIG_FILENAME) !== null || - findUp.sync(CTS_CONFIG_FILENAME) !== null || - findUp.sync(CJS_CONFIG_FILENAME) !== null || - findUp.sync(JS_CONFIG_FILENAME) !== null + findUp.sync(TS_CONFIG_FILENAME) !== undefined || + findUp.sync(CTS_CONFIG_FILENAME) !== undefined || + findUp.sync(CJS_CONFIG_FILENAME) !== undefined || + findUp.sync(JS_CONFIG_FILENAME) !== undefined ); } export function getUserConfigPath() { const tsConfigPath = findUp.sync(TS_CONFIG_FILENAME); - if (tsConfigPath !== null) { + if (tsConfigPath !== undefined) { return tsConfigPath; } const ctsConfigPath = findUp.sync(CTS_CONFIG_FILENAME); - if (ctsConfigPath !== null) { + if (ctsConfigPath !== undefined) { return ctsConfigPath; } const cjsConfigPath = findUp.sync(CJS_CONFIG_FILENAME); - if (cjsConfigPath !== null) { + if (cjsConfigPath !== undefined) { return cjsConfigPath; } const pathToConfigFile = findUp.sync(JS_CONFIG_FILENAME); - if (pathToConfigFile === null) { + if (pathToConfigFile === undefined) { throw new HardhatError(ERRORS.GENERAL.NOT_INSIDE_PROJECT); } diff --git a/packages/hardhat-core/src/internal/sentry/anonymizer.ts b/packages/hardhat-core/src/internal/sentry/anonymizer.ts index 1a5a52b0f3..bbf694b303 100644 --- a/packages/hardhat-core/src/internal/sentry/anonymizer.ts +++ b/packages/hardhat-core/src/internal/sentry/anonymizer.ts @@ -59,7 +59,7 @@ export class Anonymizer { if (filename === this._configPath) { const packageJsonPath = this._getFilePackageJsonPath(filename); - if (packageJsonPath === null) { + if (packageJsonPath === undefined) { // if we can't find a package.json, we just return the basename return { anonymizedFilename: path.basename(filename), @@ -163,7 +163,7 @@ export class Anonymizer { return false; } - protected _getFilePackageJsonPath(filename: string): string | null { + protected _getFilePackageJsonPath(filename: string): string | undefined { return findup.sync("package.json", { cwd: path.dirname(filename), }); diff --git a/packages/hardhat-core/src/internal/util/caller-package.ts b/packages/hardhat-core/src/internal/util/caller-package.ts index 7c31a91005..e90916b837 100644 --- a/packages/hardhat-core/src/internal/util/caller-package.ts +++ b/packages/hardhat-core/src/internal/util/caller-package.ts @@ -1,7 +1,7 @@ import findup from "find-up"; import path from "path"; -function findClosestPackageJson(file: string): string | null { +function findClosestPackageJson(file: string): string | undefined { return findup.sync("package.json", { cwd: path.dirname(file) }); } @@ -35,7 +35,7 @@ export function getClosestCallerPackage(): string | undefined { continue; } - if (callerPackage === null) { + if (callerPackage === undefined) { return undefined; } diff --git a/packages/hardhat-core/src/internal/util/packageInfo.ts b/packages/hardhat-core/src/internal/util/packageInfo.ts index b2f678a8a4..50dc5409e2 100644 --- a/packages/hardhat-core/src/internal/util/packageInfo.ts +++ b/packages/hardhat-core/src/internal/util/packageInfo.ts @@ -23,13 +23,13 @@ export interface PackageJson { }; } -export function findClosestPackageJson(file: string): string | null { +export function findClosestPackageJson(file: string): string | undefined { return findup.sync("package.json", { cwd: path.dirname(file) }); } export async function getPackageName(file: string): Promise { const packageJsonPath = findClosestPackageJson(file); - if (packageJsonPath !== null && packageJsonPath !== "") { + if (packageJsonPath !== undefined && packageJsonPath !== "") { const packageJson: PackageJson = await fsExtra.readJSON(packageJsonPath); return packageJson.name; } @@ -45,7 +45,7 @@ export function getHardhatVersion(): string { const packageJsonPath = findClosestPackageJson(__filename); assertHardhatInvariant( - packageJsonPath !== null, + packageJsonPath !== undefined, "There should be a package.json in hardhat-core's root directory" ); @@ -60,7 +60,7 @@ export function getProjectPackageJson(): Promise { const packageJsonPath = findup.sync("package.json"); assertHardhatInvariant( - packageJsonPath !== null, + packageJsonPath !== undefined, "Expected a package.json file in the current directory or in an ancestor directory" ); diff --git a/packages/hardhat-core/test/internal/sentry/anonymizer.ts b/packages/hardhat-core/test/internal/sentry/anonymizer.ts index 5f46a79ad9..cfad9f67e2 100644 --- a/packages/hardhat-core/test/internal/sentry/anonymizer.ts +++ b/packages/hardhat-core/test/internal/sentry/anonymizer.ts @@ -6,9 +6,9 @@ import { Anonymizer } from "../../../src/internal/sentry/anonymizer"; const PROJECT_ROOT = "/path/to/project"; class MockedAnonymizer extends Anonymizer { - public getFilePackageJsonPathResult: string | null = null; + public getFilePackageJsonPathResult: string | undefined = undefined; - protected _getFilePackageJsonPath(_: string): string | null { + protected _getFilePackageJsonPath(_: string): string | undefined { return this.getFilePackageJsonPathResult; } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e23dba029..7c9123e5d1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -258,8 +258,8 @@ importers: specifier: ^0.6.8 version: 0.6.8 find-up: - specifier: ^2.1.0 - version: 2.1.0 + specifier: ^5.0.0 + version: 5.0.0 fp-ts: specifier: 1.19.3 version: 1.19.3 @@ -351,9 +351,6 @@ importers: '@types/debug': specifier: ^4.1.4 version: 4.1.12 - '@types/find-up': - specifier: ^2.1.1 - version: 2.1.1 '@types/fs-extra': specifier: ^5.1.0 version: 5.1.0 @@ -2672,9 +2669,6 @@ packages: '@types/events@3.0.3': resolution: {integrity: sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==} - '@types/find-up@2.1.1': - resolution: {integrity: sha512-60LC501bQRN9/3yfVaEEMd7IndaufffL56PBRAejPpUrY304Ps1jfnjNqPw5jmM5R8JHWiKBAe5IHzNcPV41AA==} - '@types/form-data@0.0.33': resolution: {integrity: sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==} @@ -4243,10 +4237,6 @@ packages: resolution: {integrity: sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==} engines: {node: '>=0.10.0'} - find-up@2.1.0: - resolution: {integrity: sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==} - engines: {node: '>=4'} - find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -5059,10 +5049,6 @@ packages: resolution: {integrity: sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==} engines: {node: '>=0.10.0'} - locate-path@2.0.0: - resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} - engines: {node: '>=4'} - locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -5522,10 +5508,6 @@ packages: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} - p-limit@1.3.0: - resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==} - engines: {node: '>=4'} - p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} @@ -5534,10 +5516,6 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} - p-locate@2.0.0: - resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} - engines: {node: '>=4'} - p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -5558,10 +5536,6 @@ packages: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} engines: {node: '>=10'} - p-try@1.0.0: - resolution: {integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==} - engines: {node: '>=4'} - p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} @@ -5628,10 +5602,6 @@ packages: resolution: {integrity: sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==} engines: {node: '>=0.10.0'} - path-exists@3.0.0: - resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} - engines: {node: '>=4'} - path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -8523,8 +8493,6 @@ snapshots: '@types/events@3.0.3': {} - '@types/find-up@2.1.1': {} - '@types/form-data@0.0.33': dependencies: '@types/node': 18.19.59 @@ -10457,10 +10425,6 @@ snapshots: path-exists: 2.1.0 pinkie-promise: 2.0.1 - find-up@2.1.0: - dependencies: - locate-path: 2.0.0 - find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -11317,11 +11281,6 @@ snapshots: pinkie-promise: 2.0.1 strip-bom: 2.0.0 - locate-path@2.0.0: - dependencies: - p-locate: 2.0.0 - path-exists: 3.0.0 - locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -11784,10 +11743,6 @@ snapshots: dependencies: p-map: 2.1.0 - p-limit@1.3.0: - dependencies: - p-try: 1.0.0 - p-limit@2.3.0: dependencies: p-try: 2.2.0 @@ -11796,10 +11751,6 @@ snapshots: dependencies: yocto-queue: 0.1.0 - p-locate@2.0.0: - dependencies: - p-limit: 1.3.0 - p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -11818,8 +11769,6 @@ snapshots: dependencies: aggregate-error: 3.1.0 - p-try@1.0.0: {} - p-try@2.2.0: {} package-hash@4.0.0: @@ -11893,8 +11842,6 @@ snapshots: dependencies: pinkie-promise: 2.0.1 - path-exists@3.0.0: {} - path-exists@4.0.0: {} path-is-absolute@1.0.1: {} From ce23e3e968b5171ef3e9f6814c091ac37abc702a Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:50:15 +0000 Subject: [PATCH 06/14] Remove unnecessary peer dependency in hardhat-viem --- packages/hardhat-viem/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/hardhat-viem/package.json b/packages/hardhat-viem/package.json index a45bda1a2d..08dea7faf0 100644 --- a/packages/hardhat-viem/package.json +++ b/packages/hardhat-viem/package.json @@ -70,7 +70,6 @@ }, "peerDependencies": { "hardhat": "workspace:^2.17.0", - "typescript": "~5.0.0", "viem": "^2.7.6" }, "dependencies": { From 90bcfda320ad29c1e5f05fe1f6ae4011cdc27c8c Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:57:37 +0000 Subject: [PATCH 07/14] Add hardhat-viem changeset --- .changeset/purple-starfishes-drive.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/purple-starfishes-drive.md diff --git a/.changeset/purple-starfishes-drive.md b/.changeset/purple-starfishes-drive.md new file mode 100644 index 0000000000..e5187f8716 --- /dev/null +++ b/.changeset/purple-starfishes-drive.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/hardhat-viem": patch +--- + +Remove unnecessary peerDependency From c7262c5eb9592157f6a29098551c6947ad62426d Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:58:02 +0000 Subject: [PATCH 08/14] Rename chalk to picocolors --- packages/hardhat-verify/src/index.ts | 4 ++-- packages/hardhat-verify/src/internal/config.ts | 4 ++-- packages/hardhat-verify/src/internal/tasks/sourcify.ts | 4 ++-- packages/hardhat-verify/src/internal/utilities.ts | 10 +++++----- packages/hardhat-verify/test/unit/utilities.ts | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/hardhat-verify/src/index.ts b/packages/hardhat-verify/src/index.ts index 0cbfc3a864..30cdae4e6f 100644 --- a/packages/hardhat-verify/src/index.ts +++ b/packages/hardhat-verify/src/index.ts @@ -5,7 +5,7 @@ import type { } from "./internal/solc/artifacts"; import type { Bytecode } from "./internal/solc/bytecode"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import { extendConfig, subtask, task, types } from "hardhat/config"; import { @@ -197,7 +197,7 @@ subtask( !config.blockscout.enabled ) { console.warn( - chalk.yellow( + picocolors.yellow( `[WARNING] No verification services are enabled. Please enable at least one verification service in your configuration.` ) ); diff --git a/packages/hardhat-verify/src/internal/config.ts b/packages/hardhat-verify/src/internal/config.ts index ed80d56ae8..21f0b7cd93 100644 --- a/packages/hardhat-verify/src/internal/config.ts +++ b/packages/hardhat-verify/src/internal/config.ts @@ -6,7 +6,7 @@ import type { BlockscoutConfig, } from "../types"; -import chalk from "picocolors"; +import picocolors from "picocolors"; export function etherscanConfigExtender( config: HardhatConfig, @@ -28,7 +28,7 @@ export function etherscanConfigExtender( config.networks?.etherscan !== undefined ) { console.warn( - chalk.yellow( + picocolors.yellow( "WARNING: you have an 'etherscan' entry in your networks configuration. This is likely a mistake. The etherscan configuration should be at the root of the configuration, not within the networks object." ) ); diff --git a/packages/hardhat-verify/src/internal/tasks/sourcify.ts b/packages/hardhat-verify/src/internal/tasks/sourcify.ts index 4ce00cf4fd..03facb6061 100644 --- a/packages/hardhat-verify/src/internal/tasks/sourcify.ts +++ b/packages/hardhat-verify/src/internal/tasks/sourcify.ts @@ -4,7 +4,7 @@ import type { LibraryToAddress, } from "../solc/artifacts"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import { subtask, types } from "hardhat/config"; import { isFullyQualifiedName } from "hardhat/utils/contract-names"; import { HARDHAT_NETWORK_NAME } from "hardhat/plugins"; @@ -224,7 +224,7 @@ ${contractURL} subtask(TASK_VERIFY_SOURCIFY_DISABLED_WARNING, async () => { console.info( - chalk.cyan( + picocolors.cyan( `[INFO] Sourcify Verification Skipped: Sourcify verification is currently disabled. To enable it, add the following entry to your Hardhat configuration: sourcify: { diff --git a/packages/hardhat-verify/src/internal/utilities.ts b/packages/hardhat-verify/src/internal/utilities.ts index 3ef70d9146..ea88f2863f 100644 --- a/packages/hardhat-verify/src/internal/utilities.ts +++ b/packages/hardhat-verify/src/internal/utilities.ts @@ -2,7 +2,7 @@ import type { JsonFragment } from "@ethersproject/abi"; import type { SolidityConfig } from "hardhat/types"; import type { ChainConfig } from "../types"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import path from "path"; import { builtinChains } from "./chain-config"; import { @@ -45,7 +45,7 @@ export async function printSupportedNetworks( ]); const supportedNetworksTable = table([ - [chalk.bold("network"), chalk.bold("chain id")], + [picocolors.bold("network"), picocolors.bold("chain id")], ...supportedNetworks, ]); @@ -58,7 +58,7 @@ export async function printSupportedNetworks( const customNetworksTable = customNetworks.length > 0 ? table([ - [chalk.bold("network"), chalk.bold("chain id")], + [picocolors.bold("network"), picocolors.bold("chain id")], ...customNetworks, ]) : table([["No custom networks were added"]]); @@ -85,7 +85,7 @@ To learn how to add custom networks, follow these instructions: https://hardhat. * are the names of verification subtasks and the values are HardhatVerifyError * objects describing the specific errors. * @remarks This function formats and logs the verification errors to the - * console with a red color using chalk. Each error is displayed along with the + * console with a red color using picocolors. Each error is displayed along with the * name of the verification provider it belongs to. * @example * const errors: Record = { @@ -119,7 +119,7 @@ export function printVerificationErrors( errorMessage += `${subtaskLabel}:\n${error.message}\n\n`; } - console.error(chalk.red(errorMessage)); + console.error(picocolors.red(errorMessage)); } /** diff --git a/packages/hardhat-verify/test/unit/utilities.ts b/packages/hardhat-verify/test/unit/utilities.ts index 11684785aa..d82f0fb79d 100644 --- a/packages/hardhat-verify/test/unit/utilities.ts +++ b/packages/hardhat-verify/test/unit/utilities.ts @@ -5,7 +5,7 @@ import type { ChainConfig } from "../../src/types"; import path from "path"; import { assert, expect } from "chai"; import sinon from "sinon"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import { encodeArguments, @@ -65,7 +65,7 @@ describe("Utilities", () => { const errorMessage = errorStub.getCall(0).args[0]; assert.equal( errorMessage, - chalk.red( + picocolors.red( `hardhat-verify found one or more errors during the verification process: Etherscan: From f57167069a482a0768922066d0d53b534e3585b8 Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 22:58:34 +0000 Subject: [PATCH 09/14] Add hardhat-verify changeset --- .changeset/unlucky-humans-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/unlucky-humans-dream.md diff --git a/.changeset/unlucky-humans-dream.md b/.changeset/unlucky-humans-dream.md new file mode 100644 index 0000000000..9b56ca6584 --- /dev/null +++ b/.changeset/unlucky-humans-dream.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/hardhat-verify": patch +--- + +Replace chalk with picocolors From 53c1ef8de12e50a83c410b37246547e51bbd18a0 Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 23:01:41 +0000 Subject: [PATCH 10/14] Rename chalk to picocolors --- packages/hardhat-foundry/src/foundry.ts | 4 ++-- packages/hardhat-foundry/src/index.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/hardhat-foundry/src/foundry.ts b/packages/hardhat-foundry/src/foundry.ts index 47d57ce7b8..77de6c275a 100644 --- a/packages/hardhat-foundry/src/foundry.ts +++ b/packages/hardhat-foundry/src/foundry.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import { exec as execCallback, execSync } from "child_process"; import { NomicLabsHardhatPluginError } from "hardhat/internal/core/errors"; import { promisify } from "util"; @@ -75,7 +75,7 @@ export async function getRemappings() { export async function installDependency(dependency: string) { const cmd = `forge install --no-commit ${dependency}`; - console.log(`Running '${chalk.blue(cmd)}'`); + console.log(`Running '${picocolors.blue(cmd)}'`); try { await exec(cmd); diff --git a/packages/hardhat-foundry/src/index.ts b/packages/hardhat-foundry/src/index.ts index b9a856fa18..68d1b061ae 100644 --- a/packages/hardhat-foundry/src/index.ts +++ b/packages/hardhat-foundry/src/index.ts @@ -7,7 +7,7 @@ import { import { HardhatRuntimeEnvironment } from "hardhat/types"; import { existsSync, writeFileSync } from "fs"; import path from "path"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import { getForgeConfig, getRemappings, @@ -24,7 +24,7 @@ extendConfig((config, userConfig) => { if (!existsSync(path.join(config.paths.root, "foundry.toml"))) { if (!process.argv.includes(TASK_INIT_FOUNDRY)) { console.log( - chalk.yellow( + picocolors.yellow( `Warning: You are using the hardhat-foundry plugin but there isn't a foundry.toml file in your project. Run 'npx hardhat ${TASK_INIT_FOUNDRY}' to create one.` ) ); @@ -112,7 +112,9 @@ task( ); if (existsSync(foundryConfigPath)) { - console.warn(chalk.yellow(`File foundry.toml already exists. Aborting.`)); + console.warn( + picocolors.yellow(`File foundry.toml already exists. Aborting.`) + ); process.exit(1); } From 7a383c91233c04b0427cfd6e988887cb66237f70 Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 23:04:01 +0000 Subject: [PATCH 11/14] Add hardhat-foundry changeset --- .changeset/light-beds-tap.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/light-beds-tap.md diff --git a/.changeset/light-beds-tap.md b/.changeset/light-beds-tap.md new file mode 100644 index 0000000000..8f039eed03 --- /dev/null +++ b/.changeset/light-beds-tap.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/hardhat-foundry": patch +--- + +Replace chalk with picocolor From c75614a382963958958da368dead2f02b4fc519e Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 23:04:15 +0000 Subject: [PATCH 12/14] Correct the hardhat-ethers chalk migration --- packages/hardhat-ethers/package.json | 4 ++-- packages/hardhat-ethers/test/environment.ts | 14 +++++++------- pnpm-lock.yaml | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/hardhat-ethers/package.json b/packages/hardhat-ethers/package.json index 216fef6d1d..62a0ea4b72 100644 --- a/packages/hardhat-ethers/package.json +++ b/packages/hardhat-ethers/package.json @@ -40,8 +40,7 @@ ], "dependencies": { "debug": "^4.1.1", - "lodash.isequal": "^4.5.0", - "picocolors": "^1.1.0" + "lodash.isequal": "^4.5.0" }, "devDependencies": { "@nomicfoundation/eslint-plugin-hardhat-internal-rules": "workspace:^", @@ -65,6 +64,7 @@ "ethers": "^6.1.0", "hardhat": "workspace:^2.0.0", "mocha": "^10.0.0", + "picocolors": "^1.1.0", "prettier": "2.4.1", "rimraf": "^3.0.2", "sinon": "^9.0.0", diff --git a/packages/hardhat-ethers/test/environment.ts b/packages/hardhat-ethers/test/environment.ts index f2dce6cd8c..f3e90df9a5 100644 --- a/packages/hardhat-ethers/test/environment.ts +++ b/packages/hardhat-ethers/test/environment.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import fs from "fs"; import { HardhatRuntimeEnvironment, HardhatUserConfig } from "hardhat/types"; import { resetHardhatContext } from "hardhat/plugins-testing"; @@ -40,8 +40,8 @@ export function useEnvironment( afterEach(function () { if (this.currentTest?.state === "failed") { console.log( - chalk.red("Failed in fixture project"), - chalk.red(fixtureProjectPath) + picocolors.red("Failed in fixture project"), + picocolors.red(fixtureProjectPath) ); } }); @@ -74,8 +74,8 @@ export function usePersistentEnvironment( afterEach(function () { if (this.currentTest?.state === "failed") { console.log( - chalk.red("Failed in fixture project"), - chalk.red(fixtureProjectPath) + picocolors.red("Failed in fixture project"), + picocolors.red(fixtureProjectPath) ); } }); @@ -166,8 +166,8 @@ contract Example { afterEach(function () { if (this.currentTest?.state === "failed") { console.log( - chalk.red("Failed in fixture project"), - chalk.red(fixtureProjectPath) + picocolors.red("Failed in fixture project"), + picocolors.red(fixtureProjectPath) ); } }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c9123e5d1..8ff1e2faaa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -447,9 +447,6 @@ importers: lodash.isequal: specifier: ^4.5.0 version: 4.5.0 - picocolors: - specifier: ^1.1.0 - version: 1.1.0 devDependencies: '@nomicfoundation/eslint-plugin-hardhat-internal-rules': specifier: workspace:^ @@ -514,6 +511,9 @@ importers: mocha: specifier: ^10.0.0 version: 10.7.3 + picocolors: + specifier: ^1.1.0 + version: 1.1.0 prettier: specifier: 2.4.1 version: 2.4.1 From 58cc0a3d163e27e0264cfeb9a1308f1b85971600 Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 23:05:28 +0000 Subject: [PATCH 13/14] Rename chalk to picocolors --- .../hardhat-core/src/builtin-tasks/compile.ts | 10 +++-- .../hardhat-core/src/builtin-tasks/flatten.ts | 8 ++-- .../hardhat-core/src/builtin-tasks/node.ts | 10 ++--- .../hardhat-core/src/builtin-tasks/test.ts | 4 +- .../src/builtin-tasks/utils/watch.ts | 4 +- .../src/internal/cli/bootstrap.ts | 4 +- packages/hardhat-core/src/internal/cli/cli.ts | 30 +++++++------ .../src/internal/cli/project-creation.ts | 44 ++++++++++++------- .../hardhat-core/src/internal/cli/vars.ts | 20 ++++----- .../src/internal/cli/version-notifier.ts | 6 +-- .../internal/core/config/config-loading.ts | 10 ++--- .../hardhat-network/provider/provider.ts | 6 +-- .../utils/fork-recomendations-banner.ts | 4 +- .../provider/utils/makeForkClient.ts | 4 +- .../stack-traces/vm-trace-decoder.ts | 4 +- .../test/builtin-tasks/flatten.ts | 8 ++-- .../test/internal/cli/vars/vars.ts | 10 ++--- packages/hardhat-core/test/setup.ts | 4 +- 18 files changed, 102 insertions(+), 88 deletions(-) diff --git a/packages/hardhat-core/src/builtin-tasks/compile.ts b/packages/hardhat-core/src/builtin-tasks/compile.ts index 8aaa922b26..14a1a92b5e 100644 --- a/packages/hardhat-core/src/builtin-tasks/compile.ts +++ b/packages/hardhat-core/src/builtin-tasks/compile.ts @@ -1,5 +1,5 @@ import os from "os"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; import semver from "semver"; @@ -801,12 +801,14 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS) error.formattedMessage; console.error( - errorMessage.replace(/^\w+:/, (t) => chalk.bold(chalk.red(t))) + errorMessage.replace(/^\w+:/, (t) => + picocolors.bold(picocolors.red(t)) + ) ); } else { console.warn( (error.formattedMessage as string).replace(/^\w+:/, (t) => - chalk.bold(chalk.yellow(t)) + picocolors.bold(picocolors.yellow(t)) ) ); } @@ -815,7 +817,7 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS) const hasConsoleErrors: boolean = output.errors.some(isConsoleLogError); if (hasConsoleErrors) { console.error( - chalk.red( + picocolors.red( `The console.log call you made isn’t supported. See https://hardhat.org/console-log for the list of supported methods.` ) ); diff --git a/packages/hardhat-core/src/builtin-tasks/flatten.ts b/packages/hardhat-core/src/builtin-tasks/flatten.ts index ac0ab67a0d..28e6a65c88 100644 --- a/packages/hardhat-core/src/builtin-tasks/flatten.ts +++ b/packages/hardhat-core/src/builtin-tasks/flatten.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import { subtask, task, types } from "../internal/core/config/config-env"; import { HardhatError } from "../internal/core/errors"; import { ERRORS } from "../internal/core/errors-list"; @@ -313,7 +313,7 @@ task( if (metadata.filesWithoutLicenses.length > 0) { console.warn( - chalk.yellow( + picocolors.yellow( `\nThe following file(s) do NOT specify SPDX licenses: ${metadata.filesWithoutLicenses.join( ", " )}` @@ -326,7 +326,7 @@ task( metadata.filesWithoutPragmaDirectives.length > 0 ) { console.warn( - chalk.yellow( + picocolors.yellow( `\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${metadata.filesWithoutPragmaDirectives.join( ", " )}` @@ -336,7 +336,7 @@ task( if (metadata.filesWithDifferentPragmaDirectives.length > 0) { console.warn( - chalk.yellow( + picocolors.yellow( `\nThe flattened file is using the pragma abicoder directive '${ metadata.pragmaDirective }' but these files have a different pragma abicoder directive: ${metadata.filesWithDifferentPragmaDirectives.join( diff --git a/packages/hardhat-core/src/builtin-tasks/node.ts b/packages/hardhat-core/src/builtin-tasks/node.ts index 879667a51f..ee4ff36360 100644 --- a/packages/hardhat-core/src/builtin-tasks/node.ts +++ b/packages/hardhat-core/src/builtin-tasks/node.ts @@ -1,6 +1,6 @@ import type EthereumjsUtilT from "@nomicfoundation/ethereumjs-util"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; @@ -35,12 +35,12 @@ const log = debug("hardhat:core:tasks:node"); function printDefaultConfigWarning() { console.log( - chalk.bold( + picocolors.bold( "WARNING: These accounts, and their private keys, are publicly known." ) ); console.log( - chalk.bold( + picocolors.bold( "Any funds sent to them on Mainnet or any other live network WILL BE LOST." ) ); @@ -237,7 +237,7 @@ subtask(TASK_NODE_SERVER_READY) { config } ) => { console.log( - chalk.green( + picocolors.green( `Started HTTP and WebSocket JSON-RPC server at http://${address}:${port}/` ) ); @@ -339,7 +339,7 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network") watcher = await watchCompilerOutput(provider, config.paths); } catch (error) { console.warn( - chalk.yellow( + picocolors.yellow( "There was a problem watching the compiler output, changes in the contracts won't be reflected in the Hardhat Network. Run Hardhat with --verbose to learn more." ) ); diff --git a/packages/hardhat-core/src/builtin-tasks/test.ts b/packages/hardhat-core/src/builtin-tasks/test.ts index 451d31220c..b6785d830b 100644 --- a/packages/hardhat-core/src/builtin-tasks/test.ts +++ b/packages/hardhat-core/src/builtin-tasks/test.ts @@ -1,6 +1,6 @@ import type { MochaOptions } from "mocha"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import path from "path"; import { HARDHAT_NETWORK_NAME } from "../internal/constants"; @@ -207,7 +207,7 @@ task(TASK_TEST, "Runs mocha tests") if (stackTracesFailures !== 0) { console.warn( - chalk.yellow( + picocolors.yellow( `Failed to generate ${stackTracesFailures} ${pluralize( stackTracesFailures, "stack trace" diff --git a/packages/hardhat-core/src/builtin-tasks/utils/watch.ts b/packages/hardhat-core/src/builtin-tasks/utils/watch.ts index 376c35da07..b79cf20fa1 100644 --- a/packages/hardhat-core/src/builtin-tasks/utils/watch.ts +++ b/packages/hardhat-core/src/builtin-tasks/utils/watch.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import { FSWatcher } from "chokidar"; import debug from "debug"; import fsExtra from "fs-extra"; @@ -34,7 +34,7 @@ export async function watchCompilerOutput( }); } catch (error) { console.warn( - chalk.yellow( + picocolors.yellow( "There was a problem adding the new compiler result. Run Hardhat with --verbose to learn more." ) ); diff --git a/packages/hardhat-core/src/internal/cli/bootstrap.ts b/packages/hardhat-core/src/internal/cli/bootstrap.ts index 4535af930c..2b05f8e003 100644 --- a/packages/hardhat-core/src/internal/cli/bootstrap.ts +++ b/packages/hardhat-core/src/internal/cli/bootstrap.ts @@ -1,12 +1,12 @@ #!/usr/bin/env node -import chalk from "picocolors"; +import picocolors from "picocolors"; import { isNodeVersionToWarnOn } from "./is-node-version-to-warn-on"; if (isNodeVersionToWarnOn(process.version)) { console.warn( - chalk.yellow(chalk.bold(`WARNING:`)), + picocolors.yellow(picocolors.bold(`WARNING:`)), `You are currently using Node.js ${process.version}, which is not supported by Hardhat. This can lead to unexpected behavior. See https://hardhat.org/nodejs-versions` ); console.log(); diff --git a/packages/hardhat-core/src/internal/cli/cli.ts b/packages/hardhat-core/src/internal/cli/cli.ts index 0b8511358b..c00c3a0137 100755 --- a/packages/hardhat-core/src/internal/cli/cli.ts +++ b/packages/hardhat-core/src/internal/cli/cli.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import "source-map-support/register"; @@ -102,7 +102,7 @@ function showViaIRWarning(resolvedConfig: HardhatConfig) { if (viaIREnabled) { console.warn(); console.warn( - chalk.yellow( + picocolors.yellow( `Your solidity settings have viaIR enabled, which is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly. Learn more at https://hardhat.org/solc-viair` @@ -170,15 +170,15 @@ async function main() { // Warning for Hardhat V3 deprecation console.warn( - chalk.yellow(chalk.bold("\n\nDEPRECATION WARNING\n\n")), - chalk.yellow( - `Initializing a project with ${chalk.white( - chalk.italic("npx hardhat") + picocolors.yellow(picocolors.bold("\n\nDEPRECATION WARNING\n\n")), + picocolors.yellow( + `Initializing a project with ${picocolors.white( + picocolors.italic("npx hardhat") )} is deprecated and will be removed in the future.\n` ), - chalk.yellow( - `Please use ${chalk.white( - chalk.italic("npx hardhat init") + picocolors.yellow( + `Please use ${picocolors.white( + picocolors.italic("npx hardhat init") )} instead.\n\n` ) ); @@ -389,20 +389,22 @@ async function main() { if (HardhatError.isHardhatError(error)) { isHardhatError = true; console.error( - chalk.red(chalk.bold("Error")), - error.message.replace(/^\w+:/, (t) => chalk.red(chalk.bold(t))) + picocolors.red(picocolors.bold("Error")), + error.message.replace(/^\w+:/, (t) => + picocolors.red(picocolors.bold(t)) + ) ); } else if (HardhatPluginError.isHardhatPluginError(error)) { isHardhatError = true; console.error( - chalk.red(chalk.bold(`Error in plugin ${error.pluginName}:`)), + picocolors.red(picocolors.bold(`Error in plugin ${error.pluginName}:`)), error.message ); } else if (error instanceof Error) { - console.error(chalk.red("An unexpected error occurred:")); + console.error(picocolors.red("An unexpected error occurred:")); showStackTraces = true; } else { - console.error(chalk.red("An unexpected error occurred.")); + console.error(picocolors.red("An unexpected error occurred.")); showStackTraces = true; } diff --git a/packages/hardhat-core/src/internal/cli/project-creation.ts b/packages/hardhat-core/src/internal/cli/project-creation.ts index 0c027ad032..1d3a10c841 100644 --- a/packages/hardhat-core/src/internal/cli/project-creation.ts +++ b/packages/hardhat-core/src/internal/cli/project-creation.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import fsExtra from "fs-extra"; import path from "path"; @@ -97,28 +97,34 @@ const TYPESCRIPT_VIEM_PEER_DEPENDENCIES: Dependencies = { // generated with the "colossal" font function printAsciiLogo() { console.log( - chalk.blue("888 888 888 888 888") + picocolors.blue("888 888 888 888 888") ); console.log( - chalk.blue("888 888 888 888 888") + picocolors.blue("888 888 888 888 888") ); console.log( - chalk.blue("888 888 888 888 888") + picocolors.blue("888 888 888 888 888") ); console.log( - chalk.blue("8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888") + picocolors.blue( + "8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888" + ) ); console.log( - chalk.blue('888 888 "88b 888P" d88" 888 888 "88b "88b 888') + picocolors.blue('888 888 "88b 888P" d88" 888 888 "88b "88b 888') ); console.log( - chalk.blue("888 888 .d888888 888 888 888 888 888 .d888888 888") + picocolors.blue("888 888 .d888888 888 888 888 888 888 .d888888 888") ); console.log( - chalk.blue("888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.") + picocolors.blue( + "888 888 888 888 888 Y88b 888 888 888 888 888 Y88b." + ) ); console.log( - chalk.blue('888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888') + picocolors.blue( + '888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888' + ) ); console.log(""); } @@ -127,7 +133,7 @@ async function printWelcomeMessage() { const packageJson = await getPackageJson(); console.log( - chalk.cyan( + picocolors.cyan( `${emoji("πŸ‘· ")}Welcome to ${HARDHAT_NAME} v${packageJson.version}${emoji( " πŸ‘·β€" )}\n` @@ -200,7 +206,7 @@ Please delete or rename ${pluralize( "it", "them" )} and try again.`; - console.log(chalk.red(errorMsg)); + console.log(picocolors.red(errorMsg)); process.exit(1); } @@ -356,11 +362,13 @@ async function createPackageJson() { function showStarOnGitHubMessage() { console.log( - chalk.cyan("Give Hardhat a star on Github if you're enjoying it!") + + picocolors.cyan("Give Hardhat a star on Github if you're enjoying it!") + emoji(" ⭐️✨") ); console.log(); - console.log(chalk.cyan(" https://github.com/NomicFoundation/hardhat")); + console.log( + picocolors.cyan(" https://github.com/NomicFoundation/hardhat") + ); } export function showSoliditySurveyMessage() { @@ -371,7 +379,7 @@ export function showSoliditySurveyMessage() { console.log(); console.log( - chalk.cyan( + picocolors.cyan( "Please take a moment to complete the 2023 Solidity Survey: https://hardhat.org/solidity-survey-2023" ) ); @@ -405,7 +413,7 @@ export async function createProject() { if (action === Action.CREATE_EMPTY_HARDHAT_CONFIG_ACTION) { await writeEmptyHardhatConfig(isEsm); console.log( - `${emoji("✨ ")}${chalk.cyan(`Config file created`)}${emoji(" ✨")}` + `${emoji("✨ ")}${picocolors.cyan(`Config file created`)}${emoji(" ✨")}` ); if (!isInstalled(HARDHAT_PACKAGE_NAME)) { @@ -504,7 +512,9 @@ export async function createProject() { if (!installed) { console.warn( - chalk.red("Failed to install the sample project's dependencies") + picocolors.red( + "Failed to install the sample project's dependencies" + ) ); } @@ -519,7 +529,7 @@ export async function createProject() { } console.log( - `\n${emoji("✨ ")}${chalk.cyan("Project created")}${emoji(" ✨")}` + `\n${emoji("✨ ")}${picocolors.cyan("Project created")}${emoji(" ✨")}` ); console.log(); console.log("See the README.md file for some example tasks you can run"); diff --git a/packages/hardhat-core/src/internal/cli/vars.ts b/packages/hardhat-core/src/internal/cli/vars.ts index ae7b0613fd..385077b484 100644 --- a/packages/hardhat-core/src/internal/cli/vars.ts +++ b/packages/hardhat-core/src/internal/cli/vars.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import { HardhatError, assertHardhatInvariant } from "../core/errors"; import { ERRORS } from "../core/errors-list"; @@ -35,7 +35,7 @@ export async function handleVars( case "setup": return setup(configPath); default: - console.error(chalk.red(`Invalid task '${taskDefinition.name}'`)); + console.error(picocolors.red(`Invalid task '${taskDefinition.name}'`)); return 1; // Error code } } @@ -65,7 +65,7 @@ function get(key: string): number { } console.warn( - chalk.yellow( + picocolors.yellow( `The configuration variable '${key}' is not set in ${HardhatContext.getHardhatContext().varsManager.getStoragePath()}` ) ); @@ -88,7 +88,7 @@ function list(): number { } else { if (process.stdout.isTTY) { console.warn( - chalk.yellow( + picocolors.yellow( `There are no configuration variables stored in ${varsStoragePath}` ) ); @@ -112,7 +112,7 @@ function del(key: string): number { } console.warn( - chalk.yellow( + picocolors.yellow( `There is no configuration variable '${key}' to delete from ${varsStoragePath}` ) ); @@ -137,7 +137,7 @@ function setup(configPath: string | undefined) { loadConfigFile(configPath); } catch (err: any) { console.error( - chalk.red( + picocolors.red( "There is an error in your Hardhat configuration file. Please double check it.\n" ) ); @@ -187,7 +187,7 @@ function listVarsToSetup(varsManagerSetup: VarsManagerSetup) { if (requiredKeysToSet.length === 0 && optionalKeysToSet.length === 0) { console.log( - chalk.green( + picocolors.green( "There are no configuration variables that need to be set for this project" ) ); @@ -198,7 +198,7 @@ function listVarsToSetup(varsManagerSetup: VarsManagerSetup) { if (requiredKeysToSet.length > 0) { console.log( - chalk.bold( + picocolors.bold( `${emoji("❗ ")}The following configuration variables need to be set:\n` ) ); @@ -210,7 +210,7 @@ function listVarsToSetup(varsManagerSetup: VarsManagerSetup) { if (optionalKeysToSet.length > 0) { console.log( - chalk.bold( + picocolors.bold( `${emoji("πŸ’‘ ")}The following configuration variables are optional:\n` ) ); @@ -237,7 +237,7 @@ function printAlreadySetKeys(varsManagerSetup: VarsManagerSetup) { } console.log( - `${chalk.bold(`${emoji("βœ”οΈ ")}Configuration variables already set:`)}` + `${picocolors.bold(`${emoji("βœ”οΈ ")}Configuration variables already set:`)}` ); console.log(); diff --git a/packages/hardhat-core/src/internal/cli/version-notifier.ts b/packages/hardhat-core/src/internal/cli/version-notifier.ts index 8785639b16..c18a6d6052 100644 --- a/packages/hardhat-core/src/internal/cli/version-notifier.ts +++ b/packages/hardhat-core/src/internal/cli/version-notifier.ts @@ -1,5 +1,5 @@ import boxen from "boxen"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import fsExtra from "fs-extra"; import { join } from "node:path"; import { mkdir, readFile, writeFile } from "node:fs/promises"; @@ -111,9 +111,9 @@ export async function showNewVersionNotification() { console.log( boxen( - `New Hardhat release available! ${chalk.red( + `New Hardhat release available! ${picocolors.red( hardhatVersion - )} -> ${chalk.green(latestV2Version)}. + )} -> ${picocolors.green(latestV2Version)}. Changelog: https://hardhat.org/release/${latestV2Version} diff --git a/packages/hardhat-core/src/internal/core/config/config-loading.ts b/packages/hardhat-core/src/internal/core/config/config-loading.ts index 5717301b27..e17967faa4 100644 --- a/packages/hardhat-core/src/internal/core/config/config-loading.ts +++ b/packages/hardhat-core/src/internal/core/config/config-loading.ts @@ -1,6 +1,6 @@ import type StackTraceParserT from "stacktrace-parser"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import fsExtra from "fs-extra"; import path from "path"; @@ -281,14 +281,14 @@ function checkEmptyConfig( warning += `\nLearn more about configuring Hardhat at https://hardhat.org/config\n`; } - console.warn(chalk.yellow(warning)); + console.warn(picocolors.yellow(warning)); } } function checkMissingSolidityConfig(userConfig: any) { if (userConfig.solidity === undefined) { console.warn( - chalk.yellow( + picocolors.yellow( `Solidity compiler is not configured. Version ${DEFAULT_SOLC_VERSION} will be used by default. Add a 'solidity' entry to your configuration to suppress this warning. Learn more about compiler configuration at https://hardhat.org/config @@ -314,7 +314,7 @@ function checkUnsupportedSolidityConfig(resolvedConfig: HardhatConfig) { if (unsupportedVersions.length > 0) { console.warn( - chalk.yellow( + picocolors.yellow( `Solidity ${unsupportedVersions.join(", ")} ${ unsupportedVersions.length === 1 ? "is" : "are" } not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly. @@ -337,7 +337,7 @@ function checkUnsupportedRemappings({ solidity }: HardhatConfig) { if (remappings.length > 0) { console.warn( - chalk.yellow( + picocolors.yellow( `Solidity remappings are not currently supported; you may experience unexpected compilation results. Remove any 'remappings' fields from your configuration to suppress this warning. Learn more about compiler configuration at https://hardhat.org/config diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts index 71fdfb3c82..b43e2565d8 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts @@ -19,7 +19,7 @@ import type { HttpHeader, } from "@nomicfoundation/edr"; import { Common } from "@nomicfoundation/ethereumjs-common"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import { EventEmitter } from "events"; import fsExtra from "fs-extra"; @@ -559,7 +559,7 @@ export class EdrProviderWrapper ); } catch (error) { console.warn( - chalk.yellow( + picocolors.yellow( "The Hardhat Network tracing engine could not be updated. Run Hardhat with --verbose to learn more." ) ); @@ -662,7 +662,7 @@ async function makeTracingConfig( }; } catch (error) { console.warn( - chalk.yellow( + picocolors.yellow( "Stack traces engine could not be initialized. Run Hardhat with --verbose to learn more." ) ); diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts index 4f5597b5f2..9436748194 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/fork-recomendations-banner.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import fsExtra from "fs-extra"; import path from "path"; @@ -10,7 +10,7 @@ function getAlreadyShownFilePath(forkCachePath: string) { function displayBanner() { console.warn( - chalk.yellow( + picocolors.yellow( `You're running a network fork starting from the latest block. Performance may degrade due to fetching data from the network with each run. If connecting to an archival node (e.g. Alchemy), we strongly recommend setting diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts index bb50d0527c..49347d1b96 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/utils/makeForkClient.ts @@ -1,4 +1,4 @@ -import chalk from "picocolors"; +import picocolors from "picocolors"; import { HARDHAT_NETWORK_NAME } from "../../../constants"; import { assertHardhatInvariant } from "../../../core/errors"; @@ -61,7 +61,7 @@ export async function makeForkProvider(forkConfig: ForkConfig): Promise<{ latestBlockNumber - BigInt(forkConfig.blockNumber) + 1n; const requiredConfirmations = maxReorg + 1n; console.warn( - chalk.yellow( + picocolors.yellow( `You are forking from block ${ forkConfig.blockNumber }, which has less than ${requiredConfirmations} confirmations, and will affect Hardhat Network's performance. diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts index e845dc0865..b3b190df3a 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts @@ -1,5 +1,5 @@ import type { VmTraceDecoder as VmTraceDecoderT } from "@nomicfoundation/edr"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import debug from "debug"; import { Reporter } from "../../sentry/reporter"; import { TracingConfig } from "../provider/node-types"; @@ -19,7 +19,7 @@ function initializeVmTraceDecoderWrapper( initializeVmTraceDecoder(vmTraceDecoder, tracingConfig); } catch (error) { console.warn( - chalk.yellow( + picocolors.yellow( "The Hardhat Network tracing engine could not be initialized. Run Hardhat with --verbose to learn more." ) ); diff --git a/packages/hardhat-core/test/builtin-tasks/flatten.ts b/packages/hardhat-core/test/builtin-tasks/flatten.ts index 268a4b98f0..64844b5645 100644 --- a/packages/hardhat-core/test/builtin-tasks/flatten.ts +++ b/packages/hardhat-core/test/builtin-tasks/flatten.ts @@ -2,7 +2,7 @@ import { assert } from "chai"; import fs from "fs"; import sinon, { SinonSpy } from "sinon"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import { TASK_FLATTEN, TASK_FLATTEN_GET_FLATTENED_SOURCE, @@ -381,7 +381,7 @@ describe("Flatten task", () => { assert( spyFunctionConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `\nThe following file(s) do NOT specify SPDX licenses: contracts/A.sol, contracts/B.sol, contracts/C.sol` ) ) @@ -389,7 +389,7 @@ describe("Flatten task", () => { assert( spyFunctionConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: contracts/A.sol, contracts/B.sol` ) ) @@ -397,7 +397,7 @@ describe("Flatten task", () => { assert( spyFunctionConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `\nThe flattened file is using the pragma abicoder directive 'pragma abicoder v2' but these files have a different pragma abicoder directive: contracts/C.sol` ) ) diff --git a/packages/hardhat-core/test/internal/cli/vars/vars.ts b/packages/hardhat-core/test/internal/cli/vars/vars.ts index 99d5a7cf5a..3ef44c4b4e 100644 --- a/packages/hardhat-core/test/internal/cli/vars/vars.ts +++ b/packages/hardhat-core/test/internal/cli/vars/vars.ts @@ -5,7 +5,7 @@ import fs from "fs-extra"; import * as os from "os"; import sinon, { SinonSandbox } from "sinon"; import { assert, expect } from "chai"; -import chalk from "picocolors"; +import picocolors from "picocolors"; import enquirer from "enquirer"; import { HardhatContext } from "../../../../src/internal/context"; import { handleVars } from "../../../../src/internal/cli/vars"; @@ -149,7 +149,7 @@ describe("vars", () => { assert( spyConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `The configuration variable 'nonExistingKey' is not set in ${TMP_FILE_PATH}` ) ) @@ -194,7 +194,7 @@ describe("vars", () => { if (process.stdout.isTTY) { assert( spyConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `There are no configuration variables stored in ${TMP_FILE_PATH}` ) ) @@ -227,7 +227,7 @@ describe("vars", () => { ); assert( spyConsoleWarn.calledWith( - chalk.yellow( + picocolors.yellow( `There is no configuration variable 'nonExistingKey' to delete from ${TMP_FILE_PATH}` ) ) @@ -373,7 +373,7 @@ describe("vars", () => { assert( spyConsoleError.calledWith( - chalk.red( + picocolors.red( "There is an error in your Hardhat configuration file. Please double check it.\n" ) ) diff --git a/packages/hardhat-core/test/setup.ts b/packages/hardhat-core/test/setup.ts index 2550630672..81acbf397f 100644 --- a/packages/hardhat-core/test/setup.ts +++ b/packages/hardhat-core/test/setup.ts @@ -1,6 +1,6 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; -import chalk from "picocolors"; +import picocolors from "picocolors"; chai.use(chaiAsPromised); @@ -20,7 +20,7 @@ export const ALCHEMY_URL = getEnv("ALCHEMY_URL"); function printForkingLogicNotBeingTestedWarning(varName: string) { console.warn( - chalk.yellow( + picocolors.yellow( `TEST RUN INCOMPLETE: You need to define the env variable ${varName}` ) ); From fcece6555a5c6dd25ba3edb0b3a58047dce1b5de Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Sat, 26 Oct 2024 23:11:34 +0000 Subject: [PATCH 14/14] Add hardhat-core changeset --- .changeset/smart-rocks-develop.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smart-rocks-develop.md diff --git a/.changeset/smart-rocks-develop.md b/.changeset/smart-rocks-develop.md new file mode 100644 index 0000000000..fd675ffb7e --- /dev/null +++ b/.changeset/smart-rocks-develop.md @@ -0,0 +1,5 @@ +--- +"hardhat": patch +--- + +Replaced `chalk` with `picocolors`, `glob` with `tinyglob`, and upgraded `find-up`