Skip to content

Commit ae69f10

Browse files
authored
Merge pull request #5767 from talentlessguy/general-cleanup
General dependency cleanup
2 parents b41c9c7 + fcece65 commit ae69f10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+242
-220
lines changed

.changeset/light-beds-tap.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-foundry": patch
3+
---
4+
5+
Replace chalk with picocolor

.changeset/purple-starfishes-drive.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-viem": patch
3+
---
4+
5+
Remove unnecessary peerDependency

.changeset/smart-rocks-develop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Replaced `chalk` with `picocolors`, `glob` with `tinyglob`, and upgraded `find-up`

.changeset/unlucky-humans-dream.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-verify": patch
3+
---
4+
5+
Replace chalk with picocolors

config/eslint/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports.slowImportsCommonIgnoredModules = [
2-
"chalk",
2+
"picocolors",
33
"debug",
44
"find-up",
55
"fs-extra",

packages/hardhat-core/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@
6666
"@types/chai-as-promised": "^7.1.3",
6767
"@types/ci-info": "^2.0.0",
6868
"@types/debug": "^4.1.4",
69-
"@types/find-up": "^2.1.1",
7069
"@types/fs-extra": "^5.1.0",
71-
"@types/glob": "^7.1.1",
7270
"@types/keccak": "^3.0.1",
7371
"@types/lodash": "^4.14.123",
7472
"@types/mocha": ">=9.1.0",
@@ -114,18 +112,16 @@
114112
"aggregate-error": "^3.0.0",
115113
"ansi-escapes": "^4.3.0",
116114
"boxen": "^5.1.2",
117-
"chalk": "^2.4.2",
118115
"chokidar": "^4.0.0",
119116
"ci-info": "^2.0.0",
120117
"debug": "^4.1.1",
121118
"enquirer": "^2.3.0",
122119
"env-paths": "^2.2.0",
123120
"ethereum-cryptography": "^1.0.3",
124121
"ethereumjs-abi": "^0.6.8",
125-
"find-up": "^2.1.0",
122+
"find-up": "^5.0.0",
126123
"fp-ts": "1.19.3",
127124
"fs-extra": "^7.0.1",
128-
"glob": "7.2.0",
129125
"immutable": "^4.0.0-rc.12",
130126
"io-ts": "1.10.4",
131127
"json-stream-stringify": "^3.1.4",
@@ -134,12 +130,14 @@
134130
"mnemonist": "^0.38.0",
135131
"mocha": "^10.0.0",
136132
"p-map": "^4.0.0",
133+
"picocolors": "^1.1.0",
137134
"raw-body": "^2.4.1",
138135
"resolve": "1.17.0",
139136
"semver": "^6.3.0",
140137
"solc": "0.8.26",
141138
"source-map-support": "^0.5.13",
142139
"stacktrace-parser": "^0.1.10",
140+
"tinyglobby": "^0.2.6",
143141
"tsort": "0.0.1",
144142
"undici": "^5.14.0",
145143
"uuid": "^8.3.2",

packages/hardhat-core/src/builtin-tasks/compile.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os from "os";
2-
import chalk from "chalk";
2+
import picocolors from "picocolors";
33
import debug from "debug";
44
import fsExtra from "fs-extra";
55
import semver from "semver";
@@ -800,11 +800,15 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS)
800800
getFormattedInternalCompilerErrorMessage(error) ??
801801
error.formattedMessage;
802802

803-
console.error(errorMessage.replace(/^\w+:/, (t) => chalk.red.bold(t)));
803+
console.error(
804+
errorMessage.replace(/^\w+:/, (t) =>
805+
picocolors.bold(picocolors.red(t))
806+
)
807+
);
804808
} else {
805809
console.warn(
806810
(error.formattedMessage as string).replace(/^\w+:/, (t) =>
807-
chalk.yellow.bold(t)
811+
picocolors.bold(picocolors.yellow(t))
808812
)
809813
);
810814
}
@@ -813,7 +817,7 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_ERRORS)
813817
const hasConsoleErrors: boolean = output.errors.some(isConsoleLogError);
814818
if (hasConsoleErrors) {
815819
console.error(
816-
chalk.red(
820+
picocolors.red(
817821
`The console.log call you made isn’t supported. See https://hardhat.org/console-log for the list of supported methods.`
818822
)
819823
);

packages/hardhat-core/src/builtin-tasks/flatten.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from "chalk";
1+
import picocolors from "picocolors";
22
import { subtask, task, types } from "../internal/core/config/config-env";
33
import { HardhatError } from "../internal/core/errors";
44
import { ERRORS } from "../internal/core/errors-list";
@@ -313,7 +313,7 @@ task(
313313

314314
if (metadata.filesWithoutLicenses.length > 0) {
315315
console.warn(
316-
chalk.yellow(
316+
picocolors.yellow(
317317
`\nThe following file(s) do NOT specify SPDX licenses: ${metadata.filesWithoutLicenses.join(
318318
", "
319319
)}`
@@ -326,7 +326,7 @@ task(
326326
metadata.filesWithoutPragmaDirectives.length > 0
327327
) {
328328
console.warn(
329-
chalk.yellow(
329+
picocolors.yellow(
330330
`\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${metadata.filesWithoutPragmaDirectives.join(
331331
", "
332332
)}`
@@ -336,7 +336,7 @@ task(
336336

337337
if (metadata.filesWithDifferentPragmaDirectives.length > 0) {
338338
console.warn(
339-
chalk.yellow(
339+
picocolors.yellow(
340340
`\nThe flattened file is using the pragma abicoder directive '${
341341
metadata.pragmaDirective
342342
}' but these files have a different pragma abicoder directive: ${metadata.filesWithDifferentPragmaDirectives.join(

packages/hardhat-core/src/builtin-tasks/node.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type EthereumjsUtilT from "@nomicfoundation/ethereumjs-util";
22

3-
import chalk from "chalk";
3+
import picocolors from "picocolors";
44
import debug from "debug";
55
import fsExtra from "fs-extra";
66

@@ -35,12 +35,12 @@ const log = debug("hardhat:core:tasks:node");
3535

3636
function printDefaultConfigWarning() {
3737
console.log(
38-
chalk.bold(
38+
picocolors.bold(
3939
"WARNING: These accounts, and their private keys, are publicly known."
4040
)
4141
);
4242
console.log(
43-
chalk.bold(
43+
picocolors.bold(
4444
"Any funds sent to them on Mainnet or any other live network WILL BE LOST."
4545
)
4646
);
@@ -237,7 +237,7 @@ subtask(TASK_NODE_SERVER_READY)
237237
{ config }
238238
) => {
239239
console.log(
240-
chalk.green(
240+
picocolors.green(
241241
`Started HTTP and WebSocket JSON-RPC server at http://${address}:${port}/`
242242
)
243243
);
@@ -339,7 +339,7 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network")
339339
watcher = await watchCompilerOutput(provider, config.paths);
340340
} catch (error) {
341341
console.warn(
342-
chalk.yellow(
342+
picocolors.yellow(
343343
"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."
344344
)
345345
);

packages/hardhat-core/src/builtin-tasks/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { MochaOptions } from "mocha";
22

3-
import chalk from "chalk";
3+
import picocolors from "picocolors";
44
import path from "path";
55

66
import { HARDHAT_NETWORK_NAME } from "../internal/constants";
@@ -207,7 +207,7 @@ task(TASK_TEST, "Runs mocha tests")
207207

208208
if (stackTracesFailures !== 0) {
209209
console.warn(
210-
chalk.yellow(
210+
picocolors.yellow(
211211
`Failed to generate ${stackTracesFailures} ${pluralize(
212212
stackTracesFailures,
213213
"stack trace"

packages/hardhat-core/src/builtin-tasks/utils/watch.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from "chalk";
1+
import picocolors from "picocolors";
22
import { FSWatcher } from "chokidar";
33
import debug from "debug";
44
import fsExtra from "fs-extra";
@@ -34,7 +34,7 @@ export async function watchCompilerOutput(
3434
});
3535
} catch (error) {
3636
console.warn(
37-
chalk.yellow(
37+
picocolors.yellow(
3838
"There was a problem adding the new compiler result. Run Hardhat with --verbose to learn more."
3939
)
4040
);

packages/hardhat-core/src/internal/cli/autocomplete.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function getTaskFromTaskDefinition(taskDef: TaskDefinition): Task {
307307
function getProjectId(): string | undefined {
308308
const packageJsonPath = findup.sync("package.json");
309309

310-
if (packageJsonPath === null) {
310+
if (packageJsonPath === undefined) {
311311
return undefined;
312312
}
313313

packages/hardhat-core/src/internal/cli/bootstrap.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
22

3-
import chalk from "chalk";
3+
import picocolors from "picocolors";
44

55
import { isNodeVersionToWarnOn } from "./is-node-version-to-warn-on";
66

77
if (isNodeVersionToWarnOn(process.version)) {
88
console.warn(
9-
chalk.yellow.bold(`WARNING:`),
9+
picocolors.yellow(picocolors.bold(`WARNING:`)),
1010
`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`
1111
);
1212
console.log();

packages/hardhat-core/src/internal/cli/cli.ts

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from "chalk";
1+
import picocolors from "picocolors";
22
import debug from "debug";
33
import "source-map-support/register";
44

@@ -102,7 +102,7 @@ function showViaIRWarning(resolvedConfig: HardhatConfig) {
102102
if (viaIREnabled) {
103103
console.warn();
104104
console.warn(
105-
chalk.yellow(
105+
picocolors.yellow(
106106
`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.
107107
108108
Learn more at https://hardhat.org/solc-viair`
@@ -170,14 +170,16 @@ async function main() {
170170

171171
// Warning for Hardhat V3 deprecation
172172
console.warn(
173-
chalk.yellow.bold("\n\nDEPRECATION WARNING\n\n"),
174-
chalk.yellow(
175-
`Initializing a project with ${chalk.white.italic(
176-
"npx hardhat"
173+
picocolors.yellow(picocolors.bold("\n\nDEPRECATION WARNING\n\n")),
174+
picocolors.yellow(
175+
`Initializing a project with ${picocolors.white(
176+
picocolors.italic("npx hardhat")
177177
)} is deprecated and will be removed in the future.\n`
178178
),
179-
chalk.yellow(
180-
`Please use ${chalk.white.italic("npx hardhat init")} instead.\n\n`
179+
picocolors.yellow(
180+
`Please use ${picocolors.white(
181+
picocolors.italic("npx hardhat init")
182+
)} instead.\n\n`
181183
)
182184
);
183185

@@ -387,20 +389,22 @@ async function main() {
387389
if (HardhatError.isHardhatError(error)) {
388390
isHardhatError = true;
389391
console.error(
390-
chalk.red.bold("Error"),
391-
error.message.replace(/^\w+:/, (t) => chalk.red.bold(t))
392+
picocolors.red(picocolors.bold("Error")),
393+
error.message.replace(/^\w+:/, (t) =>
394+
picocolors.red(picocolors.bold(t))
395+
)
392396
);
393397
} else if (HardhatPluginError.isHardhatPluginError(error)) {
394398
isHardhatError = true;
395399
console.error(
396-
chalk.red.bold(`Error in plugin ${error.pluginName}:`),
400+
picocolors.red(picocolors.bold(`Error in plugin ${error.pluginName}:`)),
397401
error.message
398402
);
399403
} else if (error instanceof Error) {
400-
console.error(chalk.red("An unexpected error occurred:"));
404+
console.error(picocolors.red("An unexpected error occurred:"));
401405
showStackTraces = true;
402406
} else {
403-
console.error(chalk.red("An unexpected error occurred."));
407+
console.error(picocolors.red("An unexpected error occurred."));
404408
showStackTraces = true;
405409
}
406410

0 commit comments

Comments
 (0)