@@ -151,15 +151,15 @@ export class GraphQLCache implements GraphQLCacheInterface {
151
151
} ) ;
152
152
153
153
const asts = new Set < FragmentInfo > ( ) ;
154
- referencedFragNames . forEach ( name => {
154
+ for ( const name of referencedFragNames ) {
155
155
if ( ! existingFrags . has ( name ) && fragmentDefinitions . has ( name ) ) {
156
156
asts . add ( nullthrows ( fragmentDefinitions . get ( name ) ) ) ;
157
157
}
158
- } ) ;
158
+ }
159
159
160
160
const referencedFragments : FragmentInfo [ ] = [ ] ;
161
161
162
- asts . forEach ( ast => {
162
+ for ( const ast of asts ) {
163
163
visit ( ast . definition , {
164
164
FragmentSpread ( node ) {
165
165
if (
@@ -174,7 +174,7 @@ export class GraphQLCache implements GraphQLCacheInterface {
174
174
if ( ! existingFrags . has ( ast . definition . name . value ) ) {
175
175
referencedFragments . push ( ast ) ;
176
176
}
177
- } ) ;
177
+ }
178
178
179
179
return referencedFragments ;
180
180
} ;
@@ -252,15 +252,15 @@ export class GraphQLCache implements GraphQLCacheInterface {
252
252
} ) ;
253
253
254
254
const asts = new Set < ObjectTypeInfo > ( ) ;
255
- referencedObjectTypes . forEach ( name => {
255
+ for ( const name of referencedObjectTypes ) {
256
256
if ( ! existingObjectTypes . has ( name ) && objectTypeDefinitions . has ( name ) ) {
257
257
asts . add ( nullthrows ( objectTypeDefinitions . get ( name ) ) ) ;
258
258
}
259
- } ) ;
259
+ }
260
260
261
261
const referencedObjects : ObjectTypeInfo [ ] = [ ] ;
262
262
263
- asts . forEach ( ast => {
263
+ for ( const ast of asts ) {
264
264
visit ( ast . definition , {
265
265
NamedType ( node ) {
266
266
if (
@@ -275,7 +275,7 @@ export class GraphQLCache implements GraphQLCacheInterface {
275
275
if ( ! existingObjectTypes . has ( ast . definition . name . value ) ) {
276
276
referencedObjects . push ( ast ) ;
277
277
}
278
- } ) ;
278
+ }
279
279
280
280
return referencedObjects ;
281
281
} ;
@@ -412,25 +412,25 @@ export class GraphQLCache implements GraphQLCacheInterface {
412
412
} ) ;
413
413
if ( cache ) {
414
414
// first go through the fragment list to delete the ones from this file
415
- cache . forEach ( ( value , key ) => {
415
+ for ( const [ key , value ] of cache . entries ( ) ) {
416
416
if ( value . filePath === filePath ) {
417
417
cache . delete ( key ) ;
418
418
}
419
- } ) ;
420
- asts . forEach ( ( { ast, query } ) => {
419
+ }
420
+ for ( const { ast, query } of asts ) {
421
421
if ( ! ast ) {
422
- return ;
422
+ continue ;
423
423
}
424
- ast . definitions . forEach ( definition => {
424
+ for ( const definition of ast . definitions ) {
425
425
if ( definition . kind === Kind . FRAGMENT_DEFINITION ) {
426
426
cache . set ( definition . name . value , {
427
427
filePath,
428
428
content : query ,
429
429
definition,
430
430
} ) ;
431
431
}
432
- } ) ;
433
- } ) ;
432
+ }
433
+ }
434
434
}
435
435
}
436
436
@@ -474,16 +474,16 @@ export class GraphQLCache implements GraphQLCacheInterface {
474
474
} ) ;
475
475
if ( cache ) {
476
476
// first go through the types list to delete the ones from this file
477
- cache . forEach ( ( value , key ) => {
477
+ for ( const [ key , value ] of cache . entries ( ) ) {
478
478
if ( value . filePath === filePath ) {
479
479
cache . delete ( key ) ;
480
480
}
481
- } ) ;
482
- asts . forEach ( ( { ast, query } ) => {
481
+ }
482
+ for ( const { ast, query } of asts ) {
483
483
if ( ! ast ) {
484
- return ;
484
+ continue ;
485
485
}
486
- ast . definitions . forEach ( definition => {
486
+ for ( const definition of ast . definitions ) {
487
487
if (
488
488
definition . kind === Kind . OBJECT_TYPE_DEFINITION ||
489
489
definition . kind === Kind . INPUT_OBJECT_TYPE_DEFINITION ||
@@ -495,8 +495,8 @@ export class GraphQLCache implements GraphQLCacheInterface {
495
495
definition,
496
496
} ) ;
497
497
}
498
- } ) ;
499
- } ) ;
498
+ }
499
+ }
500
500
}
501
501
}
502
502
@@ -537,12 +537,12 @@ export class GraphQLCache implements GraphQLCacheInterface {
537
537
if ( ! graphQLFileMap ) {
538
538
return schema ;
539
539
}
540
- graphQLFileMap . forEach ( ( { filePath, asts } ) => {
541
- asts . forEach ( ast => {
540
+ for ( const { filePath, asts } of graphQLFileMap . values ( ) ) {
541
+ for ( const ast of asts ) {
542
542
if ( filePath === schemaPath ) {
543
- return ;
543
+ continue ;
544
544
}
545
- ast . definitions . forEach ( definition => {
545
+ for ( const definition of ast . definitions ) {
546
546
switch ( definition . kind ) {
547
547
case Kind . OBJECT_TYPE_DEFINITION :
548
548
case Kind . INTERFACE_TYPE_DEFINITION :
@@ -560,9 +560,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
560
560
typeExtensions . push ( definition ) ;
561
561
break ;
562
562
}
563
- } ) ;
564
- } ) ;
565
- } ) ;
563
+ }
564
+ }
565
+ }
566
566
567
567
if ( schemaCacheKey ) {
568
568
const sorted = typeExtensions . sort ( ( a : any , b : any ) => {
@@ -723,12 +723,12 @@ export class GraphQLCache implements GraphQLCacheInterface {
723
723
const fragmentDefinitions = new Map ( ) ;
724
724
const graphQLFileMap = new Map ( ) ;
725
725
726
- responses . forEach ( response => {
726
+ for ( const response of responses ) {
727
727
const { filePath, content, asts, mtime, size } = response ;
728
728
729
729
if ( asts ) {
730
- asts . forEach ( ast => {
731
- ast . definitions . forEach ( definition => {
730
+ for ( const ast of asts ) {
731
+ for ( const definition of ast . definitions ) {
732
732
if ( definition . kind === Kind . FRAGMENT_DEFINITION ) {
733
733
fragmentDefinitions . set ( definition . name . value , {
734
734
filePath,
@@ -747,8 +747,8 @@ export class GraphQLCache implements GraphQLCacheInterface {
747
747
definition,
748
748
} ) ;
749
749
}
750
- } ) ;
751
- } ) ;
750
+ }
751
+ }
752
752
}
753
753
754
754
// Relay the previous object whether or not ast exists.
@@ -759,7 +759,7 @@ export class GraphQLCache implements GraphQLCacheInterface {
759
759
mtime,
760
760
size,
761
761
} ) ;
762
- } ) ;
762
+ }
763
763
764
764
return {
765
765
objectTypeDefinitions,
@@ -794,7 +794,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
794
794
} ;
795
795
}
796
796
797
- queries . forEach ( ( { query } ) => asts . push ( parse ( query ) ) ) ;
797
+ for ( const { query } of queries ) {
798
+ asts . push ( parse ( query ) ) ;
799
+ }
798
800
return {
799
801
filePath,
800
802
content,
0 commit comments