hardhat 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/src/cli.js +5 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +11 -4
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js +10 -10
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +24 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js +27 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +18 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -3
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +10 -4
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +18 -14
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +2 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +14 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +40 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +1 -12
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +3 -42
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +2 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +4 -4
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +7 -7
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +2 -2
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +61 -28
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +10 -10
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +16 -11
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +18 -9
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +5 -14
- package/dist/src/internal/cli/init/template.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +4 -2
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/node-version.d.ts +1 -1
- package/dist/src/internal/cli/node-version.d.ts.map +1 -1
- package/dist/src/internal/cli/node-version.js +18 -8
- package/dist/src/internal/cli/node-version.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts +6 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +47 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts +27 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js +40 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js.map +1 -0
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts +0 -8
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.js +1 -37
- package/dist/src/internal/cli/telemetry/sentry/init.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts +8 -2
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +18 -12
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
- package/dist/src/internal/config-loading.js +3 -3
- package/dist/src/internal/config-loading.js.map +1 -1
- package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
- package/dist/src/internal/core/configuration-variables.js +1 -1
- package/dist/src/internal/core/configuration-variables.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +196 -59
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +5 -5
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.d.ts +11 -0
- package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -0
- package/dist/src/internal/core/lazy-user-interruptions.js +39 -0
- package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -0
- package/dist/src/internal/core/plugins/resolve-plugin-list.js +1 -1
- package/dist/src/internal/core/plugins/resolve-plugin-list.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +4 -4
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +9 -9
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/hre-initialization.js +1 -1
- package/dist/src/internal/hre-initialization.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +13 -6
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +16 -10
- package/src/internal/builtin-plugins/clean/index.ts +1 -1
- package/src/internal/builtin-plugins/console/index.ts +1 -1
- package/src/internal/builtin-plugins/coverage/exports.ts +1 -1
- package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +44 -0
- package/src/internal/builtin-plugins/coverage/helpers/compat.ts +37 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/clean.ts +1 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +26 -16
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -3
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/flatten/index.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/index.ts +4 -2
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +2 -6
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +61 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +3 -62
- package/src/internal/builtin-plugins/network-manager/edr/genesis-state.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +3 -9
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +4 -4
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +6 -2
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +11 -7
- package/src/internal/builtin-plugins/node/helpers.ts +2 -2
- package/src/internal/builtin-plugins/node/index.ts +1 -1
- package/src/internal/builtin-plugins/run/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +84 -49
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -4
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/read-source-file.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +11 -11
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +27 -14
- package/src/internal/builtin-plugins/solidity/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/solidity-hooks.ts +1 -1
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +4 -4
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +1 -1
- package/src/internal/builtin-plugins/telemetry/index.ts +1 -1
- package/src/internal/builtin-plugins/test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/test/index.ts +1 -1
- package/src/internal/builtin-plugins/test/task-action.ts +1 -1
- package/src/internal/cli/init/init.ts +32 -14
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/main.ts +5 -3
- package/src/internal/cli/node-version.ts +21 -10
- package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +64 -0
- package/src/internal/cli/telemetry/error-reporter/reporter.ts +49 -0
- package/src/internal/cli/telemetry/sentry/anonymizer.ts +1 -1
- package/src/internal/cli/telemetry/sentry/init.ts +2 -62
- package/src/internal/cli/telemetry/sentry/reporter.ts +27 -15
- package/src/internal/cli/telemetry/sentry/transport.ts +1 -1
- package/src/internal/cli/telemetry/telemetry-permissions.ts +1 -1
- package/src/internal/config-loading.ts +3 -3
- package/src/internal/core/configuration-variables.ts +19 -18
- package/src/internal/core/hook-manager.ts +267 -103
- package/src/internal/core/hre.ts +7 -5
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/src/internal/core/plugins/resolve-plugin-list.ts +1 -1
- package/src/internal/core/tasks/resolved-task.ts +4 -4
- package/src/internal/core/user-interruptions.ts +9 -9
- package/src/internal/hre-initialization.ts +1 -1
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +10 -10
- package/templates/hardhat-3/02-mocha-ethers/package.json +13 -13
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +0 -15
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +0 -35
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
|
@@ -195,7 +195,7 @@ export class CompilerDownloaderImplementation implements CompilerDownloader {
|
|
|
195
195
|
|
|
196
196
|
const downloadPath = this.#getCompilerBinaryPathFromBuild(build);
|
|
197
197
|
|
|
198
|
-
return exists(downloadPath);
|
|
198
|
+
return await exists(downloadPath);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
public async downloadCompiler(version: string): Promise<boolean> {
|
|
@@ -208,7 +208,7 @@ export class CompilerDownloaderImplementation implements CompilerDownloader {
|
|
|
208
208
|
path.join(this.#compilersDir, `compiler-download-${version}`),
|
|
209
209
|
);
|
|
210
210
|
|
|
211
|
-
return mutex.use(async () => {
|
|
211
|
+
return await mutex.use(async () => {
|
|
212
212
|
const isCompilerDownloaded = await this.isCompilerDownloaded(version);
|
|
213
213
|
|
|
214
214
|
if (isCompilerDownloaded === true) {
|
|
@@ -240,7 +240,7 @@ export class CompilerDownloaderImplementation implements CompilerDownloader {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
return this.#postProcessCompilerDownload(build, downloadPath);
|
|
243
|
+
return await this.#postProcessCompilerDownload(build, downloadPath);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -295,7 +295,7 @@ export class CompilerDownloaderImplementation implements CompilerDownloader {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
async #readCompilerList(listPath: string): Promise<CompilerList> {
|
|
298
|
-
return readJsonFile(listPath);
|
|
298
|
+
return await readJsonFile(listPath);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
#getCompilerDownloadPathFromBuild(build: CompilerBuild): string {
|
|
@@ -124,10 +124,10 @@ export async function getCompiler(
|
|
|
124
124
|
): Promise<Compiler> {
|
|
125
125
|
if (compilerPath !== undefined) {
|
|
126
126
|
// If a compiler path is provided, it means the user is using a custom compiler
|
|
127
|
-
return getCompilerFromPath(version, compilerPath);
|
|
127
|
+
return await getCompilerFromPath(version, compilerPath);
|
|
128
128
|
} else {
|
|
129
129
|
// Otherwise we get or download the compiler for the specific version
|
|
130
|
-
return getCompilerFromVersion(version, { preferWasm });
|
|
130
|
+
return await getCompilerFromVersion(version, { preferWasm });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -6,7 +6,7 @@ async function readStream(
|
|
|
6
6
|
): Promise<string> {
|
|
7
7
|
stream.setEncoding(encoding);
|
|
8
8
|
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
9
|
+
return await new Promise((resolve, reject) => {
|
|
10
10
|
let data = "";
|
|
11
11
|
|
|
12
12
|
stream.on("data", (chunk) => (data += chunk.toString(encoding)));
|
|
@@ -33,7 +33,7 @@ export async function buildDependencyGraph(
|
|
|
33
33
|
"readNpmPackageRemappings",
|
|
34
34
|
[packageName, packageVersion, packagePath],
|
|
35
35
|
async (_context, name, version, path) =>
|
|
36
|
-
defaultBehavior(name, version, path),
|
|
36
|
+
await defaultBehavior(name, version, path),
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
const resolver = await ResolverImplementation.create(
|
|
@@ -6,11 +6,11 @@ export function readSourceFileFactory(
|
|
|
6
6
|
hooks: HookManager,
|
|
7
7
|
): (absPath: string) => Promise<string> {
|
|
8
8
|
return async (factoryAbsPath: string) => {
|
|
9
|
-
return hooks.runHandlerChain(
|
|
9
|
+
return await hooks.runHandlerChain(
|
|
10
10
|
"solidity",
|
|
11
11
|
"readSourceFile",
|
|
12
12
|
[factoryAbsPath],
|
|
13
|
-
async (_context, absPath) => readUtf8File(absPath),
|
|
13
|
+
async (_context, absPath) => await readUtf8File(absPath),
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -133,8 +133,8 @@ export class ResolverImplementation implements Resolver {
|
|
|
133
133
|
public async resolveProjectFile(
|
|
134
134
|
absoluteFilePath: string,
|
|
135
135
|
): Promise<Result<ProjectResolvedFile, ProjectRootResolutionError>> {
|
|
136
|
-
return this.#mutex.exclusiveRun(async () => {
|
|
137
|
-
return this.#resolveProjectFile(absoluteFilePath);
|
|
136
|
+
return await this.#mutex.exclusiveRun(async () => {
|
|
137
|
+
return await this.#resolveProjectFile(absoluteFilePath);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -146,8 +146,8 @@ export class ResolverImplementation implements Resolver {
|
|
|
146
146
|
NpmRootResolutionError
|
|
147
147
|
>
|
|
148
148
|
> {
|
|
149
|
-
return this.#mutex.exclusiveRun(async () => {
|
|
150
|
-
return this.#resolveNpmDependencyFileAsRoot(npmModule);
|
|
149
|
+
return await this.#mutex.exclusiveRun(async () => {
|
|
150
|
+
return await this.#resolveNpmDependencyFileAsRoot(npmModule);
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -160,8 +160,8 @@ export class ResolverImplementation implements Resolver {
|
|
|
160
160
|
ImportResolutionError
|
|
161
161
|
>
|
|
162
162
|
> {
|
|
163
|
-
return this.#mutex.exclusiveRun(
|
|
164
|
-
this.#resolveImport(from, importPath),
|
|
163
|
+
return await this.#mutex.exclusiveRun(
|
|
164
|
+
async () => await this.#resolveImport(from, importPath),
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -495,7 +495,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
return this.#resolveRelativeImport({
|
|
498
|
+
return await this.#resolveRelativeImport({
|
|
499
499
|
from,
|
|
500
500
|
importPath,
|
|
501
501
|
directImport,
|
|
@@ -504,7 +504,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
504
504
|
if (bestUserRemapping !== undefined) {
|
|
505
505
|
// If the import isn't relative, and there's a user remapping, we
|
|
506
506
|
// prioritize that.
|
|
507
|
-
return this.#resolveUserRemappedImport({
|
|
507
|
+
return await this.#resolveUserRemappedImport({
|
|
508
508
|
from,
|
|
509
509
|
importPath,
|
|
510
510
|
directImport,
|
|
@@ -576,7 +576,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
576
576
|
|
|
577
577
|
const relativeFsPath = sourceNamePathToFsPath(relativeSourceNamePath);
|
|
578
578
|
|
|
579
|
-
return this.#commonImportResolution({
|
|
579
|
+
return await this.#commonImportResolution({
|
|
580
580
|
from,
|
|
581
581
|
importPath,
|
|
582
582
|
npmPackage: from.package,
|
|
@@ -639,7 +639,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
639
639
|
|
|
640
640
|
const relativeFsPath = sourceNamePathToFsPath(relativeSourceNamePath);
|
|
641
641
|
|
|
642
|
-
return this.#commonImportResolution({
|
|
642
|
+
return await this.#commonImportResolution({
|
|
643
643
|
from,
|
|
644
644
|
importPath,
|
|
645
645
|
npmPackage: targetNpmPackage,
|
|
@@ -796,7 +796,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
796
796
|
const relativePath = resolvedSubpath ?? subpath;
|
|
797
797
|
const relativeFsPathWithinPackage = sourceNamePathToFsPath(relativePath);
|
|
798
798
|
|
|
799
|
-
return this.#commonImportResolution({
|
|
799
|
+
return await this.#commonImportResolution({
|
|
800
800
|
from,
|
|
801
801
|
importPath,
|
|
802
802
|
npmPackage: dependency,
|
package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts
CHANGED
|
@@ -457,7 +457,7 @@ export class RemappedNpmPackagesGraphImplementation
|
|
|
457
457
|
npmPackage.version,
|
|
458
458
|
npmPackage.rootFsPath,
|
|
459
459
|
async (_packageName, _packageVersion, packagePath) =>
|
|
460
|
-
this.#defaultReadPackageRemappings(packagePath),
|
|
460
|
+
await this.#defaultReadPackageRemappings(packagePath),
|
|
461
461
|
);
|
|
462
462
|
|
|
463
463
|
return this.#parseAndDeduplicateRemappings(npmPackage, allRemappings);
|
|
@@ -20,7 +20,7 @@ export default async (): Promise<Partial<ConfigHooks>> => {
|
|
|
20
20
|
resolveConfigurationVariable,
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
return resolveSolidityUserConfig(userConfig, resolvedConfig);
|
|
23
|
+
return await resolveSolidityUserConfig(userConfig, resolvedConfig);
|
|
24
24
|
},
|
|
25
25
|
validateResolvedConfig: async (resolvedConfig) =>
|
|
26
26
|
validateSolidityConfig(resolvedConfig),
|
|
@@ -21,7 +21,14 @@ import type {
|
|
|
21
21
|
CompilerOutputError,
|
|
22
22
|
} from "../../../../types/solidity/compiler-io.js";
|
|
23
23
|
import type { SolidityBuildInfo } from "../../../../types/solidity.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
SolidityBuildSystemOptions,
|
|
26
|
+
SolidityBuildSystemImplementation as SolidityBuildSystemImplementationT,
|
|
27
|
+
} from "../build-system/build-system.js";
|
|
28
|
+
|
|
29
|
+
let SolidityBuildSystemImplementation:
|
|
30
|
+
| typeof SolidityBuildSystemImplementationT
|
|
31
|
+
| undefined;
|
|
25
32
|
|
|
26
33
|
class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
27
34
|
readonly #hooks: HookManager;
|
|
@@ -38,12 +45,12 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
38
45
|
options: { scope?: BuildScope } = {},
|
|
39
46
|
): Promise<string[]> {
|
|
40
47
|
const buildSystem = await this.#getBuildSystem();
|
|
41
|
-
return buildSystem.getRootFilePaths(options);
|
|
48
|
+
return await buildSystem.getRootFilePaths(options);
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
public async getScope(fsPath: string): Promise<BuildScope> {
|
|
45
52
|
const buildSystem = await this.#getBuildSystem();
|
|
46
|
-
return buildSystem.getScope(fsPath);
|
|
53
|
+
return await buildSystem.getScope(fsPath);
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
public isSuccessfulBuildResult(
|
|
@@ -59,7 +66,7 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
59
66
|
options?: BuildOptions,
|
|
60
67
|
): Promise<CompilationJobCreationError | Map<string, FileBuildResult>> {
|
|
61
68
|
const buildSystem = await this.#getBuildSystem();
|
|
62
|
-
return buildSystem.build(rootFiles, options);
|
|
69
|
+
return await buildSystem.build(rootFiles, options);
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
public async getCompilationJobs(
|
|
@@ -67,7 +74,7 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
67
74
|
options?: GetCompilationJobsOptions,
|
|
68
75
|
): Promise<CompilationJobCreationError | GetCompilationJobsResult> {
|
|
69
76
|
const buildSystem = await this.#getBuildSystem();
|
|
70
|
-
return buildSystem.getCompilationJobs(rootFiles, options);
|
|
77
|
+
return await buildSystem.getCompilationJobs(rootFiles, options);
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
public async runCompilationJob(
|
|
@@ -75,7 +82,7 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
75
82
|
options?: RunCompilationJobOptions,
|
|
76
83
|
): Promise<RunCompilationJobResult> {
|
|
77
84
|
const buildSystem = await this.#getBuildSystem();
|
|
78
|
-
return buildSystem.runCompilationJob(compilationJob, options);
|
|
85
|
+
return await buildSystem.runCompilationJob(compilationJob, options);
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
public async remapCompilerError(
|
|
@@ -84,7 +91,7 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
84
91
|
shouldShortenPaths?: boolean,
|
|
85
92
|
): Promise<CompilerOutputError> {
|
|
86
93
|
const buildSystem = await this.#getBuildSystem();
|
|
87
|
-
return buildSystem.remapCompilerError(
|
|
94
|
+
return await buildSystem.remapCompilerError(
|
|
88
95
|
compilationJob,
|
|
89
96
|
error,
|
|
90
97
|
shouldShortenPaths,
|
|
@@ -97,7 +104,11 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
97
104
|
options: { scope?: BuildScope } = {},
|
|
98
105
|
): Promise<EmitArtifactsResult> {
|
|
99
106
|
const buildSystem = await this.#getBuildSystem();
|
|
100
|
-
return buildSystem.emitArtifacts(
|
|
107
|
+
return await buildSystem.emitArtifacts(
|
|
108
|
+
compilationJob,
|
|
109
|
+
compilerOutput,
|
|
110
|
+
options,
|
|
111
|
+
);
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
public async cleanupArtifacts(
|
|
@@ -105,7 +116,7 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
105
116
|
options: { scope?: BuildScope } = {},
|
|
106
117
|
): Promise<void> {
|
|
107
118
|
const buildSystem = await this.#getBuildSystem();
|
|
108
|
-
return buildSystem.cleanupArtifacts(rootFilePaths, options);
|
|
119
|
+
return await buildSystem.cleanupArtifacts(rootFilePaths, options);
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
public async compileBuildInfo(
|
|
@@ -113,18 +124,20 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
113
124
|
options?: CompileBuildInfoOptions,
|
|
114
125
|
): Promise<CompilerOutput> {
|
|
115
126
|
const buildSystem = await this.#getBuildSystem();
|
|
116
|
-
return buildSystem.compileBuildInfo(buildInfo, options);
|
|
127
|
+
return await buildSystem.compileBuildInfo(buildInfo, options);
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
public async getArtifactsDirectory(scope: BuildScope): Promise<string> {
|
|
120
131
|
const buildSystem = await this.#getBuildSystem();
|
|
121
|
-
return buildSystem.getArtifactsDirectory(scope);
|
|
132
|
+
return await buildSystem.getArtifactsDirectory(scope);
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
async #getBuildSystem(): Promise<SolidityBuildSystem> {
|
|
125
|
-
|
|
126
|
-
"../build-system/build-system.js"
|
|
127
|
-
|
|
136
|
+
if (SolidityBuildSystemImplementation === undefined) {
|
|
137
|
+
const buildSystemModule = await import("../build-system/build-system.js");
|
|
138
|
+
SolidityBuildSystemImplementation =
|
|
139
|
+
buildSystemModule.SolidityBuildSystemImplementation;
|
|
140
|
+
}
|
|
128
141
|
|
|
129
142
|
if (this.#buildSystem === undefined) {
|
|
130
143
|
this.#buildSystem = new SolidityBuildSystemImplementation(
|
|
@@ -32,7 +32,7 @@ const buildTask = task("build", "Build project")
|
|
|
32
32
|
name: "noContracts",
|
|
33
33
|
description: "Skip solidity contracts compilation",
|
|
34
34
|
})
|
|
35
|
-
.setAction(async () => import("./tasks/build.js"))
|
|
35
|
+
.setAction(async () => await import("./tasks/build.js"))
|
|
36
36
|
.build();
|
|
37
37
|
|
|
38
38
|
const hardhatPlugin: HardhatPlugin = {
|
|
@@ -46,7 +46,7 @@ export async function getSolcCompilerForConfig(
|
|
|
46
46
|
compilerConfig: SolidityCompilerConfig,
|
|
47
47
|
buildProfilePreferWasm: boolean,
|
|
48
48
|
): Promise<Compiler> {
|
|
49
|
-
return getCompiler(compilerConfig.version, {
|
|
49
|
+
return await getCompiler(compilerConfig.version, {
|
|
50
50
|
preferWasm: resolvePreferWasm(compilerConfig, buildProfilePreferWasm),
|
|
51
51
|
compilerPath: compilerConfig.path,
|
|
52
52
|
});
|
|
@@ -119,7 +119,7 @@ const buildAction: NewTaskActionFunction<BuildActionArguments> = async (
|
|
|
119
119
|
return { contractRootPaths, testRootPaths };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
return runSolidityBuild({
|
|
122
|
+
return await runSolidityBuild({
|
|
123
123
|
buildProfile,
|
|
124
124
|
files,
|
|
125
125
|
force: args.force,
|
|
@@ -208,7 +208,7 @@ async function runSolidityBuild({
|
|
|
208
208
|
return { contractRootPaths, testRootPaths };
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
return partitionRootPathsByScope(solidity, builtRootPaths);
|
|
211
|
+
return await partitionRootPathsByScope(solidity, builtRootPaths);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
@@ -237,7 +237,7 @@ async function getRootsToBuild({
|
|
|
237
237
|
isFullBuild: boolean;
|
|
238
238
|
}> {
|
|
239
239
|
if (isUnifiedModeOrScope === true) {
|
|
240
|
-
return getRootsToBuildInUnifiedMode({
|
|
240
|
+
return await getRootsToBuildInUnifiedMode({
|
|
241
241
|
files,
|
|
242
242
|
noContracts,
|
|
243
243
|
noTests,
|
|
@@ -245,7 +245,7 @@ async function getRootsToBuild({
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
return getRootsToBuildForScope({
|
|
248
|
+
return await getRootsToBuildForScope({
|
|
249
249
|
files,
|
|
250
250
|
scope: isUnifiedModeOrScope,
|
|
251
251
|
solidity,
|
|
@@ -31,7 +31,7 @@ export async function getBuildInfosAndOutputs(
|
|
|
31
31
|
): Promise<BuildInfoAndOutput[]> {
|
|
32
32
|
const buildInfoIds = await artifactManager.getAllBuildInfoIds();
|
|
33
33
|
|
|
34
|
-
return Promise.all(
|
|
34
|
+
return await Promise.all(
|
|
35
35
|
Array.from(buildInfoIds).map(async (buildInfoId) => {
|
|
36
36
|
const buildInfoPath = await artifactManager.getBuildInfoPath(buildInfoId);
|
|
37
37
|
const buildInfoOutputPath =
|
|
@@ -76,7 +76,7 @@ export async function buildEdrArtifactsWithMetadata(
|
|
|
76
76
|
|
|
77
77
|
const artifacts = await Promise.all(
|
|
78
78
|
Array.from(fullyQualifiedNames).map(async (fullyQualifiedName) => {
|
|
79
|
-
return artifactManager.readArtifact(fullyQualifiedName);
|
|
79
|
+
return await artifactManager.readArtifact(fullyQualifiedName);
|
|
80
80
|
}),
|
|
81
81
|
);
|
|
82
82
|
|
|
@@ -9,7 +9,7 @@ import type { TestResult } from "@nomicfoundation/edr";
|
|
|
9
9
|
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
|
|
12
|
-
import { sendErrorTelemetry } from "../../cli/telemetry/
|
|
12
|
+
import { sendErrorTelemetry } from "../../cli/telemetry/error-reporter/reporter.js";
|
|
13
13
|
import { SolidityTestStackTraceGenerationError } from "../network-manager/edr/stack-traces/stack-trace-generation-errors.js";
|
|
14
14
|
import { encodeStackTraceEntry } from "../network-manager/edr/stack-traces/stack-trace-solidity-errors.js";
|
|
15
15
|
import { formatTraces } from "../network-manager/edr/utils/trace-formatters.js";
|
|
@@ -27,7 +27,7 @@ import { getFullyQualifiedName } from "../../../utils/contract-names.js";
|
|
|
27
27
|
import { errorResult, successfulResult } from "../../../utils/result.js";
|
|
28
28
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
29
29
|
import { ArtifactManagerImplementation } from "../artifacts/artifact-manager.js";
|
|
30
|
-
import { getCoverageManager } from "../coverage/helpers.js";
|
|
30
|
+
import { getCoverageManager } from "../coverage/helpers/accessors.js";
|
|
31
31
|
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
32
32
|
import { edrGasReportToHardhatGasMeasurements } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
33
33
|
|
|
@@ -14,7 +14,7 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
14
14
|
name: "disable",
|
|
15
15
|
description: "Disable telemetry",
|
|
16
16
|
})
|
|
17
|
-
.setAction(async () => import("./task-action.js"))
|
|
17
|
+
.setAction(async () => await import("./task-action.js"))
|
|
18
18
|
.build(),
|
|
19
19
|
],
|
|
20
20
|
npmPackage: "hardhat",
|
|
@@ -32,7 +32,7 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
32
32
|
name: "noCompile",
|
|
33
33
|
description: "Do not compile the project before running the tests",
|
|
34
34
|
})
|
|
35
|
-
.setAction(async () => import("./task-action.js"))
|
|
35
|
+
.setAction(async () => await import("./task-action.js"))
|
|
36
36
|
.build(),
|
|
37
37
|
],
|
|
38
38
|
dependencies: () => [import("../solidity/index.js")],
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isResult,
|
|
17
17
|
successfulResult,
|
|
18
18
|
} from "../../../utils/result.js";
|
|
19
|
-
import { getCoverageManager } from "../coverage/helpers.js";
|
|
19
|
+
import { getCoverageManager } from "../coverage/helpers/accessors.js";
|
|
20
20
|
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
21
21
|
|
|
22
22
|
interface TestActionArguments {
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
copy,
|
|
13
13
|
ensureDir,
|
|
14
14
|
exists,
|
|
15
|
-
getAllFilesMatching,
|
|
16
15
|
isDirectory,
|
|
17
16
|
mkdir,
|
|
18
17
|
readJsonFile,
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
} from "../../utils/package.js";
|
|
32
31
|
import { BannerManager } from "../banner-manager.js";
|
|
33
32
|
import { sendProjectTypeAnalytics } from "../telemetry/analytics/analytics.js";
|
|
34
|
-
import { sendErrorTelemetry } from "../telemetry/
|
|
33
|
+
import { sendErrorTelemetry } from "../telemetry/error-reporter/reporter.js";
|
|
35
34
|
|
|
36
35
|
import {
|
|
37
36
|
getDevDependenciesInstallationCommand,
|
|
@@ -435,17 +434,36 @@ export async function copyProjectFiles(
|
|
|
435
434
|
template: Template,
|
|
436
435
|
force?: boolean,
|
|
437
436
|
): Promise<void> {
|
|
438
|
-
// Find all the
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
437
|
+
// Find all the paths in the template that clash with an existing one in the
|
|
438
|
+
// workspace
|
|
439
|
+
const matchingRelativeWorkspacePaths = (
|
|
440
|
+
await Promise.all(
|
|
441
|
+
template.files.map(async (relativeTemplatePath) => {
|
|
442
|
+
const relativeWorkspacePath =
|
|
443
|
+
relativeTemplateToWorkspacePath(relativeTemplatePath);
|
|
444
|
+
|
|
445
|
+
const absoluteWorkspacePath = path.join(
|
|
446
|
+
workspace,
|
|
447
|
+
relativeWorkspacePath,
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
if (!(await exists(absoluteWorkspacePath))) {
|
|
451
|
+
return undefined;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// We ignore directories in this clash detection
|
|
455
|
+
if (await isDirectory(absoluteWorkspacePath)) {
|
|
456
|
+
return undefined;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
return relativeWorkspacePath;
|
|
460
|
+
}),
|
|
461
|
+
)
|
|
462
|
+
).filter((relativeWorkspacePath) => relativeWorkspacePath !== undefined);
|
|
463
|
+
|
|
464
|
+
const matchingRelativeWorkspacePathsSet = new Set(
|
|
465
|
+
matchingRelativeWorkspacePaths,
|
|
466
|
+
);
|
|
449
467
|
|
|
450
468
|
// Ask the user for permission to overwrite existing files if needed
|
|
451
469
|
if (matchingRelativeWorkspacePaths.length !== 0) {
|
|
@@ -461,7 +479,7 @@ export async function copyProjectFiles(
|
|
|
461
479
|
|
|
462
480
|
if (
|
|
463
481
|
force === false &&
|
|
464
|
-
|
|
482
|
+
matchingRelativeWorkspacePathsSet.has(relativeWorkspacePath)
|
|
465
483
|
) {
|
|
466
484
|
continue;
|
|
467
485
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
exists,
|
|
6
6
|
getAllFilesMatching,
|
|
7
7
|
isDirectory,
|
|
8
|
-
|
|
8
|
+
readdirOrEmpty,
|
|
9
9
|
readJsonFile,
|
|
10
10
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
11
11
|
import {
|
|
@@ -40,11 +40,7 @@ export async function getTemplates(
|
|
|
40
40
|
const packageRoot = await findClosestPackageRoot(import.meta.url);
|
|
41
41
|
const pathToTemplates = path.join(packageRoot, "templates", templatesDir);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const pathsToTemplates = await readdir(pathToTemplates);
|
|
43
|
+
const pathsToTemplates = await readdirOrEmpty(pathToTemplates);
|
|
48
44
|
pathsToTemplates.sort();
|
|
49
45
|
|
|
50
46
|
const templates = await Promise.all(
|
|
@@ -65,27 +61,26 @@ export async function getTemplates(
|
|
|
65
61
|
|
|
66
62
|
const packageJson: PackageJson =
|
|
67
63
|
await readJsonFile<PackageJson>(pathToPackageJson);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}).then((fs) => fs.map((f) => path.relative(pathToTemplate, f)));
|
|
64
|
+
|
|
65
|
+
const matchingFiles = await getAllFilesMatching(
|
|
66
|
+
pathToTemplate,
|
|
67
|
+
(f) => {
|
|
68
|
+
// Ignore the package.json file because it is handled separately
|
|
69
|
+
if (f === pathToPackageJson) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// .gitignore files are expected to be called gitignore in the templates
|
|
74
|
+
// because npm ignores .gitignore files during npm pack (see https://github.com/npm/npm/issues/3763)
|
|
75
|
+
if (path.basename(f) === ".gitignore") {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
},
|
|
80
|
+
(dir) => path.basename(dir) !== "node_modules",
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const files = matchingFiles.map((f) => path.relative(pathToTemplate, f));
|
|
89
84
|
|
|
90
85
|
return {
|
|
91
86
|
name,
|
package/src/internal/cli/main.ts
CHANGED
|
@@ -46,11 +46,11 @@ import { printErrorMessages } from "./error-handler.js";
|
|
|
46
46
|
import { getGlobalHelpString } from "./help/get-global-help-string.js";
|
|
47
47
|
import { getHelpString } from "./help/get-help-string.js";
|
|
48
48
|
import { sendTaskAnalytics } from "./telemetry/analytics/analytics.js";
|
|
49
|
+
import { setupGlobalUnhandledErrorHandlers } from "./telemetry/error-reporter/global-error-handlers.js";
|
|
49
50
|
import {
|
|
50
51
|
sendErrorTelemetry,
|
|
51
52
|
setCliHardhatConfigPath,
|
|
52
|
-
|
|
53
|
-
} from "./telemetry/sentry/reporter.js";
|
|
53
|
+
} from "./telemetry/error-reporter/reporter.js";
|
|
54
54
|
import { printVersionMessage } from "./version.js";
|
|
55
55
|
|
|
56
56
|
export interface MainOptions {
|
|
@@ -64,7 +64,9 @@ export async function main(
|
|
|
64
64
|
rawArguments: string[],
|
|
65
65
|
options: MainOptions = {},
|
|
66
66
|
): Promise<void> {
|
|
67
|
-
|
|
67
|
+
// We set up the global unhandled errors before running any functionality
|
|
68
|
+
setupGlobalUnhandledErrorHandlers();
|
|
69
|
+
|
|
68
70
|
const print = options.print ?? console.log;
|
|
69
71
|
|
|
70
72
|
const log = debug("hardhat:core:cli:main");
|