From 0f1f90ce8f4a25ddebdaf7a9ddbe136214aa64a3 Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Mon, 6 Dec 2021 15:52:42 +0100 Subject: [PATCH] fix: export types & modules from `graphql-language-service` explicitly (#2086) --- .changeset/lazy-plums-speak.md | 5 + .../graphql-language-service/src/index.ts | 137 +++++++++++++++++- .../src/types/index.ts | 2 - 3 files changed, 135 insertions(+), 9 deletions(-) create mode 100644 .changeset/lazy-plums-speak.md delete mode 100644 packages/graphql-language-service/src/types/index.ts diff --git a/.changeset/lazy-plums-speak.md b/.changeset/lazy-plums-speak.md new file mode 100644 index 00000000000..b75dcb45744 --- /dev/null +++ b/.changeset/lazy-plums-speak.md @@ -0,0 +1,5 @@ +--- +'graphql-language-service': minor +--- + +Export all modules & types explicitly from `graphql-language-service` diff --git a/packages/graphql-language-service/src/index.ts b/packages/graphql-language-service/src/index.ts index 00f4d147326..665598c0dbc 100644 --- a/packages/graphql-language-service/src/index.ts +++ b/packages/graphql-language-service/src/index.ts @@ -6,10 +6,133 @@ * LICENSE file in the root directory of this source tree. * */ -export * from './types'; -export * from './schemaLoader'; -export * from './LanguageService'; -export * from 'graphql-language-service-interface'; -export * from 'graphql-language-service-parser'; -export * from 'graphql-language-service-types'; -export * from 'graphql-language-service-utils'; + +/** + * A simple LanguageService used by `monaco-graphql`'s webworker lives here. + * + * TODO: retire `graphql-language-service-{parser,interface,types,utils}` and merge with this workspace + */ +export type { + SchemaConfig, + BaseSchemaConfig, + SchemaLoader, +} from './schemaLoader'; +export { defaultSchemaLoader } from './schemaLoader'; + +export type { GraphQLLanguageConfig } from './LanguageService'; +export { LanguageService } from './LanguageService'; + +/** + * A whole bunch of the key language services + */ +export { + getAutocompleteSuggestions, + getDefinitionQueryResultForDefinitionNode, + getDefinitionQueryResultForFragmentSpread, + getDefinitionQueryResultForNamedType, + getDefinitionState, + getDiagnostics, + getFieldDef, + getFragmentDefinitions, + getHoverInformation, + getOutline, + getRange, + getTokenAtPosition, + getTypeInfo, + getVariableCompletions, + GraphQLLanguageService, + SEVERITY, + Severity, + SeverityEnum, + DIAGNOSTIC_SEVERITY, + DefinitionQueryResult, + canUseDirective, + SuggestionCommand, + AutocompleteSuggestionOptions, +} from 'graphql-language-service-interface'; + +/** + * The dependency-less streaming token parser used for getAutocompleteSuggestions, getHover and more + */ +export { + onlineParser, + ParseRules, + CharacterStream, + RuleKinds, + LexRules, + isIgnored, + p, + list, + t, + opt, +} from 'graphql-language-service-parser'; + +export type { + RuleOrString, + ParserOptions, + ParseRule, + TokenPattern, + State, + CharacterStreamInterface, + RuleKindEnum, + Token, + ContextToken, + ContextTokenForCodeMirror, + ContextTokenUnion, + RuleKind, +} from 'graphql-language-service-parser'; + +/** + * Types and enums to use across projects + */ +export type { + CompletionItem, + GraphQLProjectConfig, + Maybe, + IPosition, + Diagnostic, + IRange, + Definition, + CachedContent, + GraphQLConfig, + GraphQLFileMetadata, + Uri, + ObjectTypeInfo, + Outline, + OutlineTree, + FragmentInfo, + GraphQLFileInfo, + FileChangeType, + GraphQLCache, + GraphQLExtensionDeclaration, +} from 'graphql-language-service-types'; + +export { + CompletionItemKind, + FileChangeTypeKind, +} from 'graphql-language-service-types'; + +/** + * Utilities useful for language services across runtimes + */ +export { + JSONSchema6, + JSONSchema6TypeName, + JSONSchemaOptions, + getASTNodeAtPosition, + getFragmentDependencies, + getFragmentDependenciesForAST, + getOperationASTFacts, + getOperationFacts, + getQueryFacts, + getVariablesJSONSchema, + offsetToPosition, + OperationFacts, + pointToOffset, + Position, + collectVariables, + validateWithCustomRules, + VariableToType, + QueryFacts, + Range, +} from 'graphql-language-service-utils'; diff --git a/packages/graphql-language-service/src/types/index.ts b/packages/graphql-language-service/src/types/index.ts deleted file mode 100644 index 81dc64f4cba..00000000000 --- a/packages/graphql-language-service/src/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { IntrospectionQuery } from 'graphql'; -export type RawSchema = string | IntrospectionQuery;