graphql-language-service
Advanced tools
Comparing version
@@ -9,7 +9,7 @@ import { GraphQLSchema, GraphQLType } from 'graphql'; | ||
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken, config?: HoverConfig): Hover['contents']; | ||
export declare function renderField(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderDirective(into: string[], typeInfo: AllTypeInfo, _options: any): void; | ||
export declare function renderArg(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderEnumValue(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderType(into: string[], typeInfo: AllTypeInfo, options: any, t: GraphQLType): void; | ||
export declare function renderField(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderDirective(into: string[], typeInfo: AllTypeInfo, _options: HoverConfig): void; | ||
export declare function renderArg(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderEnumValue(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderType(into: string[], typeInfo: AllTypeInfo, options: HoverConfig, t: GraphQLType): void; | ||
//# sourceMappingURL=getHoverInformation.d.ts.map |
@@ -167,3 +167,3 @@ "use strict"; | ||
} | ||
const reason = def.deprecationReason || null; | ||
const reason = def.deprecationReason; | ||
if (!reason) { | ||
@@ -170,0 +170,0 @@ return; |
import { Outline } from '../types'; | ||
declare const OUTLINEABLE_KINDS: { | ||
Field: boolean; | ||
OperationDefinition: boolean; | ||
Document: boolean; | ||
SelectionSet: boolean; | ||
Name: boolean; | ||
FragmentDefinition: boolean; | ||
FragmentSpread: boolean; | ||
InlineFragment: boolean; | ||
ObjectTypeDefinition: boolean; | ||
InputObjectTypeDefinition: boolean; | ||
InterfaceTypeDefinition: boolean; | ||
EnumTypeDefinition: boolean; | ||
EnumValueDefinition: boolean; | ||
InputValueDefinition: boolean; | ||
FieldDefinition: boolean; | ||
}; | ||
export declare type OutlineableKinds = keyof typeof OUTLINEABLE_KINDS; | ||
export declare type OutlineableKinds = 'Field' | 'OperationDefinition' | 'Document' | 'SelectionSet' | 'Name' | 'FragmentDefinition' | 'FragmentSpread' | 'InlineFragment' | 'ObjectTypeDefinition' | 'InputObjectTypeDefinition' | 'InterfaceTypeDefinition' | 'EnumTypeDefinition' | 'EnumValueDefinition' | 'InputValueDefinition' | 'FieldDefinition'; | ||
export declare function getOutline(documentText: string): Outline | null; | ||
export {}; | ||
//# sourceMappingURL=getOutline.d.ts.map |
@@ -6,20 +6,2 @@ "use strict"; | ||
const utils_1 = require("../utils"); | ||
const { INLINE_FRAGMENT } = graphql_1.Kind; | ||
const OUTLINEABLE_KINDS = { | ||
Field: true, | ||
OperationDefinition: true, | ||
Document: true, | ||
SelectionSet: true, | ||
Name: true, | ||
FragmentDefinition: true, | ||
FragmentSpread: true, | ||
InlineFragment: true, | ||
ObjectTypeDefinition: true, | ||
InputObjectTypeDefinition: true, | ||
InterfaceTypeDefinition: true, | ||
EnumTypeDefinition: true, | ||
EnumValueDefinition: true, | ||
InputValueDefinition: true, | ||
FieldDefinition: true, | ||
}; | ||
function getOutline(documentText) { | ||
@@ -70,3 +52,3 @@ let ast; | ||
SelectionSet: (node) => concatMap(node.selections, (child) => { | ||
return child.kind === INLINE_FRAGMENT ? child.selectionSet : child; | ||
return child.kind === graphql_1.Kind.INLINE_FRAGMENT ? child.selectionSet : child; | ||
}), | ||
@@ -73,0 +55,0 @@ Name: (node) => node.value, |
@@ -191,2 +191,3 @@ "use strict"; | ||
required: [], | ||
additionalProperties: false, | ||
}; | ||
@@ -193,0 +194,0 @@ const runtimeOptions = Object.assign(Object.assign({}, options), { definitionMarker: new Marker(), scalarSchemas: Object.assign(Object.assign({}, defaultScalarTypesMap), options === null || options === void 0 ? void 0 : options.scalarSchemas) }); |
@@ -9,7 +9,7 @@ import { GraphQLSchema, GraphQLType } from 'graphql'; | ||
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken, config?: HoverConfig): Hover['contents']; | ||
export declare function renderField(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderDirective(into: string[], typeInfo: AllTypeInfo, _options: any): void; | ||
export declare function renderArg(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderEnumValue(into: string[], typeInfo: AllTypeInfo, options: any): void; | ||
export declare function renderType(into: string[], typeInfo: AllTypeInfo, options: any, t: GraphQLType): void; | ||
export declare function renderField(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderDirective(into: string[], typeInfo: AllTypeInfo, _options: HoverConfig): void; | ||
export declare function renderArg(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderEnumValue(into: string[], typeInfo: AllTypeInfo, options: HoverConfig): void; | ||
export declare function renderType(into: string[], typeInfo: AllTypeInfo, options: HoverConfig, t: GraphQLType): void; | ||
//# sourceMappingURL=getHoverInformation.d.ts.map |
@@ -158,3 +158,3 @@ import { GraphQLNonNull, GraphQLList, } from 'graphql'; | ||
} | ||
const reason = def.deprecationReason || null; | ||
const reason = def.deprecationReason; | ||
if (!reason) { | ||
@@ -161,0 +161,0 @@ return; |
import { Outline } from '../types'; | ||
declare const OUTLINEABLE_KINDS: { | ||
Field: boolean; | ||
OperationDefinition: boolean; | ||
Document: boolean; | ||
SelectionSet: boolean; | ||
Name: boolean; | ||
FragmentDefinition: boolean; | ||
FragmentSpread: boolean; | ||
InlineFragment: boolean; | ||
ObjectTypeDefinition: boolean; | ||
InputObjectTypeDefinition: boolean; | ||
InterfaceTypeDefinition: boolean; | ||
EnumTypeDefinition: boolean; | ||
EnumValueDefinition: boolean; | ||
InputValueDefinition: boolean; | ||
FieldDefinition: boolean; | ||
}; | ||
export declare type OutlineableKinds = keyof typeof OUTLINEABLE_KINDS; | ||
export declare type OutlineableKinds = 'Field' | 'OperationDefinition' | 'Document' | 'SelectionSet' | 'Name' | 'FragmentDefinition' | 'FragmentSpread' | 'InlineFragment' | 'ObjectTypeDefinition' | 'InputObjectTypeDefinition' | 'InterfaceTypeDefinition' | 'EnumTypeDefinition' | 'EnumValueDefinition' | 'InputValueDefinition' | 'FieldDefinition'; | ||
export declare function getOutline(documentText: string): Outline | null; | ||
export {}; | ||
//# sourceMappingURL=getOutline.d.ts.map |
import { Kind, parse, visit, } from 'graphql'; | ||
import { offsetToPosition } from '../utils'; | ||
const { INLINE_FRAGMENT } = Kind; | ||
const OUTLINEABLE_KINDS = { | ||
Field: true, | ||
OperationDefinition: true, | ||
Document: true, | ||
SelectionSet: true, | ||
Name: true, | ||
FragmentDefinition: true, | ||
FragmentSpread: true, | ||
InlineFragment: true, | ||
ObjectTypeDefinition: true, | ||
InputObjectTypeDefinition: true, | ||
InterfaceTypeDefinition: true, | ||
EnumTypeDefinition: true, | ||
EnumValueDefinition: true, | ||
InputValueDefinition: true, | ||
FieldDefinition: true, | ||
}; | ||
export function getOutline(documentText) { | ||
@@ -65,3 +47,3 @@ let ast; | ||
SelectionSet: (node) => concatMap(node.selections, (child) => { | ||
return child.kind === INLINE_FRAGMENT ? child.selectionSet : child; | ||
return child.kind === Kind.INLINE_FRAGMENT ? child.selectionSet : child; | ||
}), | ||
@@ -68,0 +50,0 @@ Name: (node) => node.value, |
@@ -188,2 +188,3 @@ import { isEnumType, isInputObjectType, isListType, isNonNullType, isScalarType, } from 'graphql'; | ||
required: [], | ||
additionalProperties: false, | ||
}; | ||
@@ -190,0 +191,0 @@ const runtimeOptions = Object.assign(Object.assign({}, options), { definitionMarker: new Marker(), scalarSchemas: Object.assign(Object.assign({}, defaultScalarTypesMap), options === null || options === void 0 ? void 0 : options.scalarSchemas) }); |
{ | ||
"name": "graphql-language-service", | ||
"version": "5.4.0-canary-e8982f7d.0", | ||
"version": "5.4.0", | ||
"description": "The official, runtime independent Language Service for GraphQL", | ||
@@ -10,3 +10,3 @@ "contributors": [ | ||
"type": "git", | ||
"url": "http://github.com/graphql/graphiql", | ||
"url": "https://github.com/graphql/graphiql", | ||
"directory": "packages/graphql-language-service" | ||
@@ -36,3 +36,3 @@ }, | ||
"peerDependencies": { | ||
"graphql": "^16.0.0" | ||
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0" | ||
}, | ||
@@ -58,4 +58,6 @@ "dependencies": { | ||
"scripts": { | ||
"benchmark": "ts-node benchmark/index.ts" | ||
"types:check": "tsc --noEmit", | ||
"benchmark": "ts-node benchmark/index.ts", | ||
"test": "vitest" | ||
} | ||
} |
@@ -35,3 +35,3 @@ # `graphql-language-service` | ||
A standalone online, immutable, dependency-free parser for | ||
[GraphQL](http://graphql.org/), used by the LSP interface methods | ||
[GraphQL](https://graphql.org), used by the LSP interface methods | ||
@@ -38,0 +38,0 @@ ## Utils |
@@ -196,7 +196,5 @@ /** | ||
const line = location.line - 1; | ||
// @ts-ignore | ||
// https://github.com/microsoft/TypeScript/pull/32695 | ||
// @ts-expect-error -- https://github.com/microsoft/TypeScript/pull/32695 | ||
const start = stream.getStartOfToken(); | ||
// @ts-ignore | ||
// https://github.com/microsoft/TypeScript/pull/32695 | ||
// @ts-expect-error -- https://github.com/microsoft/TypeScript/pull/32695 | ||
const end = stream.getCurrentPosition(); | ||
@@ -203,0 +201,0 @@ return new Range(new Position(line, start), new Position(line, end)); |
@@ -108,3 +108,3 @@ /** | ||
function renderMdCodeStart(into: string[], options: any) { | ||
function renderMdCodeStart(into: string[], options: HoverConfig) { | ||
if (options.useMarkdown) { | ||
@@ -123,3 +123,3 @@ text(into, '```graphql\n'); | ||
typeInfo: AllTypeInfo, | ||
options: any, | ||
options: HoverConfig, | ||
) { | ||
@@ -133,3 +133,3 @@ renderQualifiedField(into, typeInfo, options); | ||
typeInfo: AllTypeInfo, | ||
options: any, | ||
options: HoverConfig, | ||
) { | ||
@@ -150,3 +150,3 @@ if (!typeInfo.fieldDef) { | ||
typeInfo: AllTypeInfo, | ||
_options: any, | ||
_options: HoverConfig, | ||
) { | ||
@@ -160,3 +160,7 @@ if (!typeInfo.directiveDef) { | ||
export function renderArg(into: string[], typeInfo: AllTypeInfo, options: any) { | ||
export function renderArg( | ||
into: string[], | ||
typeInfo: AllTypeInfo, | ||
options: HoverConfig, | ||
) { | ||
if (typeInfo.directiveDef) { | ||
@@ -182,3 +186,3 @@ renderDirective(into, typeInfo, options); | ||
typeInfo: AllTypeInfo, | ||
options: any, | ||
options: HoverConfig, | ||
t: GraphQLType, | ||
@@ -193,3 +197,3 @@ ) { | ||
typeInfo: AllTypeInfo, | ||
options: any, | ||
options: HoverConfig, | ||
) { | ||
@@ -208,3 +212,3 @@ if (!typeInfo.enumValue) { | ||
typeInfo: AllTypeInfo, | ||
options: any, | ||
options: HoverConfig, | ||
t: GraphQLType, | ||
@@ -230,3 +234,3 @@ ) { | ||
into: string[], | ||
options: any, | ||
options: HoverConfig, | ||
// TODO: Figure out the right type for this one | ||
@@ -249,4 +253,4 @@ def: any, | ||
into: string[], | ||
_options: any, | ||
def: GraphQLField<any, any> | GraphQLFieldConfig<any, any>, | ||
_options: HoverConfig, | ||
def: GraphQLField<unknown, unknown> | GraphQLFieldConfig<unknown, unknown>, | ||
) { | ||
@@ -257,3 +261,3 @@ if (!def) { | ||
const reason = def.deprecationReason || null; | ||
const reason = def.deprecationReason; | ||
if (!reason) { | ||
@@ -260,0 +264,0 @@ return; |
@@ -42,26 +42,19 @@ /** | ||
const { INLINE_FRAGMENT } = Kind; | ||
export type OutlineableKinds = | ||
| 'Field' | ||
| 'OperationDefinition' | ||
| 'Document' | ||
| 'SelectionSet' | ||
| 'Name' | ||
| 'FragmentDefinition' | ||
| 'FragmentSpread' | ||
| 'InlineFragment' | ||
| 'ObjectTypeDefinition' | ||
| 'InputObjectTypeDefinition' | ||
| 'InterfaceTypeDefinition' | ||
| 'EnumTypeDefinition' | ||
| 'EnumValueDefinition' | ||
| 'InputValueDefinition' | ||
| 'FieldDefinition'; | ||
const OUTLINEABLE_KINDS = { | ||
Field: true, | ||
OperationDefinition: true, | ||
Document: true, | ||
SelectionSet: true, | ||
Name: true, | ||
FragmentDefinition: true, | ||
FragmentSpread: true, | ||
InlineFragment: true, | ||
ObjectTypeDefinition: true, | ||
InputObjectTypeDefinition: true, | ||
InterfaceTypeDefinition: true, | ||
EnumTypeDefinition: true, | ||
EnumValueDefinition: true, | ||
InputValueDefinition: true, | ||
FieldDefinition: true, | ||
}; | ||
export type OutlineableKinds = keyof typeof OUTLINEABLE_KINDS; | ||
// type OutlineableNodes = FieldNode | OperationDefinitionNode | DocumentNode | SelectionSetNode | NameNode | FragmentDefinitionNode | FragmentSpreadNode |InlineFragmentNode | ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | ||
type OutlineTreeResult = | ||
@@ -141,3 +134,3 @@ | { | ||
concatMap<SelectionNode>(node.selections, (child: SelectionNode) => { | ||
return child.kind === INLINE_FRAGMENT ? child.selectionSet : child; | ||
return child.kind === Kind.INLINE_FRAGMENT ? child.selectionSet : child; | ||
}), | ||
@@ -144,0 +137,0 @@ Name: (node: NameNode) => node.value, |
@@ -214,3 +214,3 @@ /** | ||
// Utility function to assign from object to another object. | ||
function assign(to: Object, from: Object): Object { | ||
function assign(to: object, from: object): object { | ||
const keys = Object.keys(from); | ||
@@ -217,0 +217,0 @@ for (let i = 0; i < keys.length; i++) { |
@@ -94,3 +94,3 @@ /** | ||
useMarkdown?: boolean, | ||
description?: string | undefined | null, | ||
description?: string | null, | ||
) { | ||
@@ -363,2 +363,3 @@ const into: string[] = []; | ||
required: [], | ||
additionalProperties: false, | ||
}; | ||
@@ -365,0 +366,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
-100%825612
-0.24%15641
-0.45%