Skip to content

Commit e917fc3

Browse files
authored
chore: Update devDeps (#78)
1 parent 27651ef commit e917fc3

16 files changed

+5497
-7244
lines changed

package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"test": "jest",
1111
"build": "rimraf dist/* && tsc",
1212
"prepublishOnly": "npm run build",
13+
"typecheck": "tsc --noEmit",
1314
"format": "prettier --list-different --write ./src"
1415
},
1516
"files": [
@@ -27,16 +28,16 @@
2728
"p-queue": "^6.4.0"
2829
},
2930
"devDependencies": {
30-
"@types/fs-extra": "^9.0.1",
31-
"@types/jest": "^26.0.7",
32-
"@types/node": "^14.0.25",
33-
"gatsby": "~3.3.0",
34-
"graphql": "^15.4.0",
35-
"jest": "^26.1.0",
36-
"react-dom": "^16.13.1",
31+
"@types/fs-extra": "^9.0.13",
32+
"@types/jest": "^29.2.3",
33+
"@types/node": "^18.11.9",
34+
"gatsby": "^5.1.0",
35+
"graphql": "^16.6.0",
36+
"jest": "^29.3.1",
37+
"react-dom": "^18.2.0",
3738
"rimraf": "^3.0.2",
38-
"ts-jest": "^26.1.3",
39-
"typescript": "^3.9.7"
39+
"ts-jest": "^29.0.3",
40+
"typescript": "^4.9.3"
4041
},
4142
"peerDependencies": {
4243
"gatsby": "^3.0.0 || ^4.0.0 || ^5.0.0"

src/compile-node-queries/analyze/build-type-usages-map.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TypeInfo,
77
visit,
88
visitWithTypeInfo,
9+
Kind,
910
} from "graphql"
1011
import { IGatsbyNodeConfig, RemoteTypeName } from "../../types"
1112

@@ -57,7 +58,7 @@ export function buildTypeUsagesMap(
5758
args: IBuildTypeUsagesMapArgs
5859
): TypeUsagesMap {
5960
const fullDocument: DocumentNode = {
60-
kind: "Document",
61+
kind: Kind.DOCUMENT,
6162
definitions: args.fragments,
6263
}
6364

src/compile-node-queries/ast-transformers/add-node-fragment-spreads-and-typename.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import {
2-
ASTKindToNode,
32
FragmentDefinitionNode,
43
SelectionNode,
5-
Visitor,
4+
ASTVisitor,
65
} from "graphql"
76
import * as GraphQLAST from "../../utils/ast-nodes"
87
import { isFragmentSpread } from "../../utils/ast-predicates"
98

109
export function addNodeFragmentSpreadsAndTypename(
1110
nodeFragments: FragmentDefinitionNode[]
12-
): Visitor<ASTKindToNode> {
11+
): ASTVisitor {
1312
return {
1413
FragmentDefinition: () => false,
1514
SelectionSet: node => {

src/compile-node-queries/ast-transformers/add-remote-typename-field.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
TypeInfo,
3-
Visitor,
4-
ASTKindToNode,
3+
ASTVisitor,
54
SelectionSetNode,
65
isCompositeType,
76
getNamedType,
@@ -30,7 +29,7 @@ interface IAddTypeNameArgs {
3029
*/
3130
export function addRemoteTypeNameField({
3231
typeInfo,
33-
}: IAddTypeNameArgs): Visitor<ASTKindToNode> {
32+
}: IAddTypeNameArgs): ASTVisitor {
3433
return {
3534
SelectionSet: (node, _, parent) => {
3635
const type = typeInfo.getType()

src/compile-node-queries/ast-transformers/add-variable-definitions.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
2-
Visitor,
3-
ASTKindToNode,
2+
ASTVisitor,
43
OperationDefinitionNode,
54
VariableDefinitionNode,
65
TypeInfo,
76
GraphQLInputType,
87
DocumentNode,
98
parseType,
9+
Kind,
1010
} from "graphql"
1111
import * as GraphQLAST from "../../utils/ast-nodes"
1212

@@ -23,7 +23,7 @@ interface DefinitionInfo {
2323

2424
export function addVariableDefinitions({
2525
typeInfo,
26-
}: IAddVariableDefinitionsArgs): Visitor<ASTKindToNode> {
26+
}: IAddVariableDefinitionsArgs): ASTVisitor {
2727
const fragmentInfo = new Map<string, DefinitionInfo>()
2828
const operationInfo = new Map<string, DefinitionInfo>()
2929

@@ -91,9 +91,9 @@ function ensureVariableDefinitions(
9191
const variableDefinitions: VariableDefinitionNode[] = []
9292
for (const [name, inputType] of variables) {
9393
variableDefinitions.push({
94-
kind: "VariableDefinition",
94+
kind: Kind.VARIABLE_DEFINITION,
9595
variable: {
96-
kind: "Variable",
96+
kind: Kind.VARIABLE,
9797
name: GraphQLAST.name(name),
9898
},
9999
type: parseType(inputType.toString()),

src/compile-node-queries/ast-transformers/alias-gatsby-node-fields.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {
22
FieldNode,
3-
Visitor,
3+
ASTVisitor,
44
TypeInfo,
5-
ASTKindToNode,
65
GraphQLSchema,
76
GraphQLCompositeType,
87
isObjectType,
@@ -24,7 +23,7 @@ interface IAliasGatsbyNodeFieldsArgs {
2423

2524
export function aliasGatsbyNodeFields(
2625
args: IAliasGatsbyNodeFieldsArgs
27-
): Visitor<ASTKindToNode> {
26+
): ASTVisitor {
2827
return {
2928
Field: (node: FieldNode) => {
3029
if (isTypeName(node) || isNodeType(args.typeInfo.getParentType(), args)) {

src/compile-node-queries/ast-transformers/remove-unused-fragments.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ASTKindToNode, Visitor } from "graphql"
1+
import { ASTVisitor } from "graphql"
22
import * as GraphQLAST from "../../utils/ast-nodes"
33
import { isFragment, isOperation } from "../../utils/ast-predicates"
44

55
type FragmentName = string
66

7-
export function removeUnusedFragments(): Visitor<ASTKindToNode> {
7+
export function removeUnusedFragments(): ASTVisitor {
88
let currentSpreads: Array<FragmentName> = []
99
const definitionSpreads: Map<string, Array<FragmentName>> = new Map()
1010

src/compile-node-queries/ast-transformers/replace-node-selection-with-reference.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import {
22
TypeInfo,
33
isInterfaceType,
4-
Visitor,
5-
ASTKindToNode,
4+
ASTVisitor,
65
getNamedType,
76
GraphQLSchema,
87
GraphQLInterfaceType,
98
FieldNode,
109
SelectionNode,
1110
GraphQLObjectType,
1211
FragmentDefinitionNode,
12+
Kind,
1313
} from "graphql"
1414
import { FragmentMap } from "../../types"
1515
import * as GraphQLAST from "../../utils/ast-nodes"
@@ -42,7 +42,7 @@ interface ITransformArgs {
4242
*/
4343
export function replaceNodeSelectionWithReference(
4444
args: ITransformArgs
45-
): Visitor<ASTKindToNode> {
45+
): ASTVisitor {
4646
return {
4747
Field: node => {
4848
const type = args.typeInfo.getType()
@@ -96,7 +96,7 @@ function transformInterfaceField(
9696
return {
9797
...node,
9898
selectionSet: {
99-
kind: "SelectionSet",
99+
kind: Kind.SELECTION_SET,
100100
selections: [GraphQLAST.field(`__typename`), ...selections],
101101
},
102102
}

src/compile-node-queries/ast-transformers/strip-wrapping-fragments.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { SelectionSetNode, Visitor, ASTKindToNode } from "graphql"
1+
import { SelectionSetNode, ASTVisitor } from "graphql"
22

33
/**
44
* Strip unnecessary wrapping (just a prettify)
55
* i.e. { ...on InterfaceType { ...on ObjectType1 ...on ObjectType2 } }
66
* -> { ...on ObjectType1 ...on ObjectType2 }
77
*/
8-
export function stripWrappingFragments(): Visitor<ASTKindToNode> {
8+
export function stripWrappingFragments(): ASTVisitor {
99
return {
1010
SelectionSet: {
1111
leave: (node: SelectionSetNode) => {

src/compile-node-queries/generate-default-fragments.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import {
1717
ArgumentNode,
1818
astFromValue,
1919
isNonNullType,
20-
Visitor,
21-
ASTKindToNode,
20+
ASTVisitor,
2221
FragmentSpreadNode,
2322
TypeInfo,
2423
} from "graphql"
@@ -122,7 +121,7 @@ function generateDefaultFragment(
122121

123122
function inlineNamedFragments(
124123
args: IGenerateDefaultFragmentContext
125-
): Visitor<ASTKindToNode> {
124+
): ASTVisitor {
126125
const typeStack: string[] = []
127126
return {
128127
FragmentSpread: (node: FragmentSpreadNode, _, __) => {

src/config/load-schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function introspectSchema(
2222
throw new Error(`Schema introspection failed. First error: ${error}`)
2323
}
2424

25-
return introspectionResult.data as IntrospectionQuery
25+
return introspectionResult.data as unknown as IntrospectionQuery
2626
}
2727

2828
/**

src/create-schema-customization/analyze/build-sourcing-plan.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
visit,
66
visitWithTypeInfo,
77
visitInParallel,
8-
Visitor,
9-
ASTKindToNode,
8+
ASTVisitor,
109
getNamedType,
1110
isUnionType,
1211
isEnumType,
@@ -37,9 +36,9 @@ function buildFetchedTypeMap(args: IBuildSourcingPlanArgs) {
3736
const typeInfo = new TypeInfo(schema)
3837

3938
const Visitors: {
40-
collectTypeFields: Visitor<ASTKindToNode>
41-
addUnionTypes: Visitor<ASTKindToNode>
42-
addEnumTypes: Visitor<ASTKindToNode>
39+
collectTypeFields: ASTVisitor
40+
addUnionTypes: ASTVisitor
41+
addEnumTypes: ASTVisitor
4342
} = {
4443
collectTypeFields: {
4544
Field: (node: FieldNode) => {

src/create-schema-customization/build-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function interfaceType(
7575
if (remoteTypeName) {
7676
return typeNameTransform.toGatsbyTypeName(remoteTypeName)
7777
}
78-
return null
78+
return undefined
7979
},
8080
extensions: { infer: false },
8181
}

src/utils/ast-nodes.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import {
1414
SelectionSetNode,
1515
StringValueNode,
1616
ValueNode,
17+
Kind,
1718
} from "graphql"
1819

1920
export function document(definitions: DefinitionNode[]): DocumentNode {
2021
return {
21-
kind: "Document",
22+
kind: Kind.DOCUMENT,
2223
definitions,
2324
}
2425
}
@@ -29,7 +30,7 @@ export function fragmentDefinition(
2930
selections: SelectionNode[]
3031
): FragmentDefinitionNode {
3132
return {
32-
kind: "FragmentDefinition",
33+
kind: Kind.FRAGMENT_DEFINITION,
3334
name: name(fragmentName ?? typeName),
3435
typeCondition: namedType(typeName),
3536
selectionSet: selectionSet(selections),
@@ -41,7 +42,7 @@ export function inlineFragment(
4142
selections: readonly SelectionNode[]
4243
): InlineFragmentNode {
4344
return {
44-
kind: "InlineFragment",
45+
kind: Kind.INLINE_FRAGMENT,
4546
typeCondition: namedType(typeCondition),
4647
selectionSet: selectionSet(selections),
4748
}
@@ -51,7 +52,7 @@ export function selectionSet(
5152
selections: readonly SelectionNode[] = []
5253
): SelectionSetNode {
5354
return {
54-
kind: "SelectionSet",
55+
kind: Kind.SELECTION_SET,
5556
selections: selections,
5657
}
5758
}
@@ -64,7 +65,7 @@ export function field(
6465
directives?: DirectiveNode[]
6566
): FieldNode {
6667
return {
67-
kind: "Field",
68+
kind: Kind.FIELD,
6869
name: name(fieldName),
6970
alias: alias ? name(alias) : undefined,
7071
arguments: args,
@@ -75,29 +76,29 @@ export function field(
7576

7677
export function arg(argName: string, value: ValueNode): ArgumentNode {
7778
return {
78-
kind: "Argument",
79+
kind: Kind.ARGUMENT,
7980
name: name(argName),
8081
value,
8182
}
8283
}
8384

8485
export function name(value: string): NameNode {
8586
return {
86-
kind: "Name",
87+
kind: Kind.NAME,
8788
value: value,
8889
}
8990
}
9091

9192
export function namedType(typeName: string): NamedTypeNode {
9293
return {
93-
kind: "NamedType",
94+
kind: Kind.NAMED_TYPE,
9495
name: name(typeName),
9596
}
9697
}
9798

9899
export function fragmentSpread(fragmentName: string): FragmentSpreadNode {
99100
return {
100-
kind: "FragmentSpread",
101+
kind: Kind.FRAGMENT_SPREAD,
101102
name: name(fragmentName),
102103
}
103104
}
@@ -107,7 +108,7 @@ export function directive(
107108
args?: ArgumentNode[]
108109
): DirectiveNode {
109110
return {
110-
kind: "Directive",
111+
kind: Kind.DIRECTIVE,
111112
name: name(directiveName),
112113
arguments: args,
113114
}
@@ -119,14 +120,14 @@ export function skipDirective(condition: boolean = true) {
119120

120121
export function boolValue(value: boolean): BooleanValueNode {
121122
return {
122-
kind: "BooleanValue",
123+
kind: Kind.BOOLEAN,
123124
value,
124125
}
125126
}
126127

127128
export function stringValue(value: string): StringValueNode {
128129
return {
129-
kind: "StringValue",
130+
kind: Kind.STRING,
130131
value,
131132
}
132133
}

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"rootDir": "src",
1717
"outDir": "dist",
1818
"sourceMap": true,
19-
"esModuleInterop": true
19+
"esModuleInterop": true,
20+
"skipLibCheck": true,
2021
},
2122
"include": ["src"]
2223
}

0 commit comments

Comments
 (0)