@@ -28,13 +28,25 @@ export function substituteDirective(
28
28
validateObject ( value , [ ...ctx , key ] ) ;
29
29
if ( Array . isArray ( value ) ) throw new AppConfigError ( '$substitute was given an array' ) ;
30
30
31
+ if ( value . $name ) {
32
+ logger . warn (
33
+ `Detected deprecated use of $name in a $substitute directive. Use 'name' instead.` ,
34
+ ) ;
35
+ }
36
+
31
37
const name = ( await parse ( selectDefined ( value . name , value . $name ) ) ) . toJSON ( ) ;
32
38
33
39
validateString ( name , [ ...ctx , key , [ InObject , 'name' ] ] ) ;
34
40
35
41
const parseValue = async ( strValue : string | null ) => {
36
42
const parseBool = ( await parse ( selectDefined ( value . parseBool , value . $parseBool ) ) ) . toJSON ( ) ;
37
43
44
+ if ( value . $parseBool ) {
45
+ logger . warn (
46
+ `Detected deprecated use of $parseBool in a $substitute directive. Use 'parseBool' instead.` ,
47
+ ) ;
48
+ }
49
+
38
50
if ( parseBool ) {
39
51
const parsed =
40
52
strValue !== null && ( strValue . toLowerCase ( ) === 'true' || strValue === '1' ) ;
@@ -48,6 +60,12 @@ export function substituteDirective(
48
60
49
61
const parseInt = ( await parse ( selectDefined ( value . parseInt , value . $parseInt ) ) ) . toJSON ( ) ;
50
62
63
+ if ( value . $parseInt ) {
64
+ logger . warn (
65
+ `Detected deprecated use of $parseInt in a $substitute directive. Use 'parseInt' instead.` ,
66
+ ) ;
67
+ }
68
+
51
69
if ( parseInt ) {
52
70
const parsed = Number . parseInt ( strValue , 10 ) ;
53
71
@@ -58,6 +76,12 @@ export function substituteDirective(
58
76
return parse ( parsed , { shouldFlatten : true } ) ;
59
77
}
60
78
79
+ if ( value . $parseFloat ) {
80
+ logger . warn (
81
+ `Detected deprecated use of $parseFloat in a $substitute directive. Use 'parseFloat' instead.` ,
82
+ ) ;
83
+ }
84
+
61
85
const parseFloat = (
62
86
await parse ( selectDefined ( value . parseFloat , value . $parseFloat ) )
63
87
) . toJSON ( ) ;
@@ -89,6 +113,18 @@ export function substituteDirective(
89
113
const fallback = ( await parse ( selectDefined ( value . fallback , value . $fallback ) ) ) . toJSON ( ) ;
90
114
const allowNull = ( await parse ( selectDefined ( value . allowNull , value . $allowNull ) ) ) . toJSON ( ) ;
91
115
116
+ if ( value . $fallback ) {
117
+ logger . warn (
118
+ `Detected deprecated use of $fallback in a $substitute directive. Use 'fallback' instead.` ,
119
+ ) ;
120
+ }
121
+
122
+ if ( value . $allowNull ) {
123
+ logger . warn (
124
+ `Detected deprecated use of $allowNull in a $substitute directive. Use 'allowNull' instead.` ,
125
+ ) ;
126
+ }
127
+
92
128
if ( allowNull ) {
93
129
validateStringOrNull ( fallback , [ ...ctx , key , [ InObject , 'fallback' ] ] ) ;
94
130
} else {
0 commit comments