1
1
import type { ParameterTypeToValueType } from "../types/common.js" ;
2
2
import type {
3
- GlobalArguments ,
4
- GlobalParameter ,
5
- GlobalParametersMap ,
6
- } from "../types/global-parameters .js" ;
3
+ GlobalOptions ,
4
+ GlobalOption ,
5
+ GlobalOptionsMap ,
6
+ } from "../types/global-options .js" ;
7
7
import type { HardhatPlugin } from "../types/plugins.js" ;
8
8
9
9
import { HardhatError } from "@nomicfoundation/hardhat-errors" ;
@@ -17,50 +17,50 @@ import {
17
17
} from "./parameters.js" ;
18
18
19
19
/**
20
- * Builds a map of the global parameters , validating them.
20
+ * Builds a map of the global options , validating them.
21
21
*
22
22
* Note: this function can be used before initializing the HRE, so the plugins
23
23
* shouldn't be consider validated. Hence, we should validate the global
24
24
* parameters.
25
25
*/
26
- export function buildGlobalParametersMap (
26
+ export function buildGlobalOptionsMap (
27
27
resolvedPlugins : HardhatPlugin [ ] ,
28
- ) : GlobalParametersMap {
29
- const globalParametersMap : GlobalParametersMap = new Map ( ) ;
28
+ ) : GlobalOptionsMap {
29
+ const globalOptionsMap : GlobalOptionsMap = new Map ( ) ;
30
30
31
31
for ( const plugin of resolvedPlugins ) {
32
- if ( plugin . globalParameters === undefined ) {
32
+ if ( plugin . globalOptions === undefined ) {
33
33
continue ;
34
34
}
35
35
36
- for ( const param of plugin . globalParameters ) {
37
- const existingByName = globalParametersMap . get ( param . name ) ;
36
+ for ( const option of plugin . globalOptions ) {
37
+ const existingByName = globalOptionsMap . get ( option . name ) ;
38
38
if ( existingByName !== undefined ) {
39
39
throw new HardhatError (
40
- HardhatError . ERRORS . GENERAL . GLOBAL_PARAMETER_ALREADY_DEFINED ,
40
+ HardhatError . ERRORS . GENERAL . GLOBAL_OPTION_ALREADY_DEFINED ,
41
41
{
42
42
plugin : plugin . id ,
43
- globalParameter : param . name ,
43
+ globalOption : option . name ,
44
44
definedByPlugin : existingByName . pluginId ,
45
45
} ,
46
46
) ;
47
47
}
48
48
49
- const validatedGlobalParam = buildGlobalParameterDefinition ( param ) ;
49
+ const validatedGlobalOption = buildGlobalOptionDefinition ( option ) ;
50
50
51
51
const mapEntry = {
52
52
pluginId : plugin . id ,
53
- param : validatedGlobalParam ,
53
+ option : validatedGlobalOption ,
54
54
} ;
55
55
56
- globalParametersMap . set ( validatedGlobalParam . name , mapEntry ) ;
56
+ globalOptionsMap . set ( validatedGlobalOption . name , mapEntry ) ;
57
57
}
58
58
}
59
59
60
- return globalParametersMap ;
60
+ return globalOptionsMap ;
61
61
}
62
62
63
- export function buildGlobalParameterDefinition < T extends ParameterType > ( {
63
+ export function buildGlobalOptionDefinition < T extends ParameterType > ( {
64
64
name,
65
65
description,
66
66
parameterType,
@@ -70,7 +70,7 @@ export function buildGlobalParameterDefinition<T extends ParameterType>({
70
70
description : string ;
71
71
parameterType ?: T ;
72
72
defaultValue : ParameterTypeToValueType < T > ;
73
- } ) : GlobalParameter {
73
+ } ) : GlobalOption {
74
74
const type = parameterType ?? ParameterType . STRING ;
75
75
76
76
if ( ! isValidParamNameCasing ( name ) ) {
@@ -104,13 +104,13 @@ export function buildGlobalParameterDefinition<T extends ParameterType>({
104
104
} ;
105
105
}
106
106
107
- export function resolveGlobalArguments (
108
- userProvidedGlobalArguments : Partial < GlobalArguments > ,
109
- _globalParametersMap : GlobalParametersMap ,
110
- ) : GlobalArguments {
111
- // TODO: Validate the userProvidedGlobalArguments and get the remaining ones
107
+ export function resolveGlobalOptions (
108
+ userProvidedGlobalOptions : Partial < GlobalOptions > ,
109
+ _globalOptionsMap : GlobalOptionsMap ,
110
+ ) : GlobalOptions {
111
+ // TODO: Validate the userProvidedGlobalOptions and get the remaining ones
112
112
// from env variables
113
113
114
114
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- TODO
115
- return userProvidedGlobalArguments as GlobalArguments ;
115
+ return userProvidedGlobalOptions as GlobalOptions ;
116
116
}
0 commit comments