hardhat 3.12.0 → 3.14.0
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 +34 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts +3 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +16 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +10 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.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 +12 -0
- 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 +5 -4
- 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 +56 -14
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +18 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js +0 -17
- package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +3 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +10 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +5 -3
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/cli/error-handling/error-handler.d.ts.map +1 -0
- package/dist/src/internal/cli/{error-handler.js → error-handling/error-handler.js} +13 -2
- package/dist/src/internal/cli/error-handling/error-handler.js.map +1 -0
- package/dist/src/internal/cli/error-handling/native-binding-error.d.ts +18 -0
- package/dist/src/internal/cli/error-handling/native-binding-error.d.ts.map +1 -0
- package/dist/src/internal/cli/error-handling/native-binding-error.js +57 -0
- package/dist/src/internal/cli/error-handling/native-binding-error.js.map +1 -0
- package/dist/src/internal/cli/hhu.js +1 -1
- package/dist/src/internal/cli/hhu.js.map +1 -1
- package/dist/src/internal/cli/main.js +1 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/constants.d.ts +10 -0
- package/dist/src/internal/constants.d.ts.map +1 -1
- package/dist/src/internal/constants.js +10 -0
- package/dist/src/internal/constants.js.map +1 -1
- package/dist/src/internal/core/config.d.ts +14 -1
- package/dist/src/internal/core/config.d.ts.map +1 -1
- package/dist/src/internal/core/config.js +13 -5
- package/dist/src/internal/core/config.js.map +1 -1
- package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
- package/dist/src/internal/core/configuration-variables.js +3 -1
- package/dist/src/internal/core/configuration-variables.js.map +1 -1
- package/dist/src/types/config.d.ts +11 -0
- package/dist/src/types/config.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +26 -4
- package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +15 -0
- package/src/internal/builtin-plugins/gas-analytics/index.ts +13 -0
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +90 -13
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +29 -6
- package/src/internal/builtin-plugins/network-manager/chain-descriptors.ts +0 -17
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +5 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +25 -5
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +6 -2
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +6 -7
- package/src/internal/cli/{error-handler.ts → error-handling/error-handler.ts} +20 -3
- package/src/internal/cli/error-handling/native-binding-error.ts +78 -0
- package/src/internal/cli/hhu.ts +1 -1
- package/src/internal/cli/main.ts +1 -1
- package/src/internal/constants.ts +11 -0
- package/src/internal/core/config.ts +35 -2
- package/src/internal/core/configuration-variables.ts +3 -1
- package/src/types/config.ts +12 -0
- package/templates/01-node-test-runner-viem/package.json +1 -1
- package/templates/02-mocha-ethers/package.json +1 -1
- package/templates/03-minimal/package.json +1 -1
- package/dist/src/internal/cli/error-handler.d.ts.map +0 -1
- package/dist/src/internal/cli/error-handler.js.map +0 -1
- /package/dist/src/internal/cli/{error-handler.d.ts → error-handling/error-handler.d.ts} +0 -0
|
@@ -23,11 +23,33 @@ import {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Creates a configuration variable, which will be fetched at runtime.
|
|
26
|
+
*
|
|
27
|
+
* The second argument is an options object with an optional `format` (a
|
|
28
|
+
* template that must include the `{variable}` marker) and an optional
|
|
29
|
+
* `default` value. The default is used as a fallback when the variable can't
|
|
30
|
+
* be resolved from any other source (see {@link ConfigurationVariable.default}).
|
|
26
31
|
*/
|
|
27
32
|
export function configVariable(
|
|
28
33
|
name: string,
|
|
29
|
-
format
|
|
34
|
+
options?: { format?: string; default?: string },
|
|
35
|
+
): ConfigurationVariable;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Passing the `format` as a string is deprecated. Pass an options
|
|
38
|
+
* object instead: `configVariable(name, { format })`.
|
|
39
|
+
*/
|
|
40
|
+
export function configVariable(
|
|
41
|
+
name: string,
|
|
42
|
+
format: string,
|
|
43
|
+
): ConfigurationVariable;
|
|
44
|
+
export function configVariable(
|
|
45
|
+
name: string,
|
|
46
|
+
formatOrOptions: string | { format?: string; default?: string } = {},
|
|
30
47
|
): ConfigurationVariable {
|
|
48
|
+
const { format = CONFIGURATION_VARIABLE_MARKER, default: defaultValue } =
|
|
49
|
+
typeof formatOrOptions === "string"
|
|
50
|
+
? { format: formatOrOptions }
|
|
51
|
+
: formatOrOptions;
|
|
52
|
+
|
|
31
53
|
if (!format.includes(CONFIGURATION_VARIABLE_MARKER)) {
|
|
32
54
|
throw new HardhatError(
|
|
33
55
|
HardhatError.ERRORS.CORE.GENERAL
|
|
@@ -35,7 +57,18 @@ export function configVariable(
|
|
|
35
57
|
{ format, marker: CONFIGURATION_VARIABLE_MARKER },
|
|
36
58
|
);
|
|
37
59
|
}
|
|
38
|
-
|
|
60
|
+
|
|
61
|
+
const configurationVariable: ConfigurationVariable = {
|
|
62
|
+
_type: "ConfigurationVariable",
|
|
63
|
+
name,
|
|
64
|
+
format,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (defaultValue !== undefined) {
|
|
68
|
+
configurationVariable.default = defaultValue;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return configurationVariable;
|
|
39
72
|
}
|
|
40
73
|
|
|
41
74
|
/**
|
|
@@ -131,7 +131,9 @@ export class LazyResolvedConfigurationVariable extends BaseResolvedConfiguration
|
|
|
131
131
|
"fetchValue",
|
|
132
132
|
[this.#variable],
|
|
133
133
|
async (_context, v) => {
|
|
134
|
-
|
|
134
|
+
// Fall back to the default only when the env var is unset. An empty
|
|
135
|
+
// string still takes precedence
|
|
136
|
+
const value = process.env[v.name] ?? v.default;
|
|
135
137
|
|
|
136
138
|
if (typeof value !== "string") {
|
|
137
139
|
throw new HardhatError(
|
package/src/types/config.ts
CHANGED
|
@@ -8,6 +8,18 @@ export interface ConfigurationVariable {
|
|
|
8
8
|
_type: "ConfigurationVariable";
|
|
9
9
|
name: string;
|
|
10
10
|
format?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An optional fallback value, used only when the variable can't be resolved
|
|
14
|
+
* from any other source (e.g. an environment variable or the keystore).
|
|
15
|
+
*
|
|
16
|
+
* By default, the value is resolved from the environment variable first, then
|
|
17
|
+
* any plugin source (like hardhat-keystore), and finally this default. Plugins
|
|
18
|
+
* can customize this, but the built-in resolver and bundled plugins follow this
|
|
19
|
+
* order. If none of them provide a value and no default is set, resolving the
|
|
20
|
+
* variable throws.
|
|
21
|
+
*/
|
|
22
|
+
default?: string;
|
|
11
23
|
}
|
|
12
24
|
|
|
13
25
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "A TypeScript Hardhat project using Node Test Runner and Viem",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"hardhat": "workspace:^3.
|
|
8
|
+
"hardhat": "workspace:^3.14.0",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-viem": "workspace:^5.0.7",
|
|
10
10
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.1.8",
|
|
11
11
|
"@types/node": "^22.8.5",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "A TypeScript Hardhat project using Mocha and Ethers.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"hardhat": "workspace:^3.
|
|
8
|
+
"hardhat": "workspace:^3.14.0",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.7",
|
|
10
10
|
"@nomicfoundation/hardhat-ethers": "workspace:^4.0.15",
|
|
11
11
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.1.8",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../../src/internal/cli/error-handler.ts"],"names":[],"mappings":"AAyDA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,KAAK,EACZ,qBAAqB,GAAE,OAAe,EACtC,KAAK,GAAE,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,KAAK,IAAoB,GACvD,OAAO,CAAC,IAAI,CAAC,CA8Df"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../../src/internal/cli/error-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,8EAA8E;AAC9E,qBAAqB;AACrB,IAAI,gBAAgD,CAAC;AAErD;;;;;;GAMG;AACH,IAAK,aAOJ;AAPD,WAAK,aAAa;IAChB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,sDAAqC,CAAA;IACrC,8DAA6C,CAAA;IAC7C,8DAA6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