npm / @graphql-codegen/visitor-plugin-common
@graphql-codegen/visitor-plugin-common
What changed in @graphql-codegen/visitor-plugin-common 2 to 8, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.
25 breaking15 new APIs and options2 behavior and defaults5 tooling69 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@graphql-codegen/visitor-plugin-common 811 changes
Breaking changes 7
The CLI flag was removed; use
--import-extensionto set the extension appended to relative imports.The deprecated config option was removed; use
importExtensionto set the extension appended to relative imports.GraphQL 14 and 15 are no longer supported; the peer dependency now requires GraphQL 16 or 17.
Version 9 extracts
#graphql-marked template literals by default, which can result in newly found documents; setpluckConfig.gqlHashCommentto an empty string to retain the previous behavior.Node.js versions below 22.18.0 are no longer supported.
@graphql-codegen/plugin-helpersno longer exports this function; useimportExtension ?? ''instead.Set
pluckConfig: { gqlHashComment: '' }to keep the previous behavior of not extracting#graphql-marked template literals by default.
New APIs and options 2
This parser option enables support for GraphQL v17 fragment arguments when set in the root config.
Use this option to set the extension appended to relative imports; when unset, no extension is appended.
Fixes and other changes 2
Uses the generated enum instead of null in ResolversTypes when enumValues maps an enum with an object.
Fixes typesPrefix being applied to enum keys when generating enums as const.
@graphql-codegen/visitor-plugin-common 793 changes
Breaking changes 14
Throws a descriptive error when an enum value is not defined on the schema's enum, and treats a non-enum schema type with the enum's name as having no schema enum.
_selectionSetToObject is optional because it is only set by setSelectionSetHandler; affected methods now throw descriptive errors when it is not set.
defaultMapperType throws a descriptive error when the defaultMapper config is not set.
FieldDefinition visitor parameters are typed, with key and parent required because the visitor always passes them.
InputValueDefinition visitor parameters are typed, with key and parent required because the visitor always passes them.
ListType visitor parameters are typed, with key and parent required because the visitor always passes them.
UnionTypeDefinition visitor parameters are typed, with key and parent required because the visitor always passes them.
Multiple-field @oneOf inputs are generated as a type alias even when declarationKind is interface; single-field inputs keep the configured declarationKind.input.
The exported helper is removed.
The default custom scalar type is now unknown instead of any.
The base-types-visitor no longer has this method.
Node 20 support is dropped; users are advised to upgrade to Node 22.
Nullable Result fields are no longer optional unless deferred with @defer or conditional with @skip or @include; avoidOptionals now only targets Variables input.
Operation plugin and Client Preset no longer generate optional __typename for result types unless it is requested or injected by a client.
New APIs and options 11
Adds the native-with-string-values enum type, allowing operation variables and input object fields to accept either an enum member or its string value.
Adds an option that, with documentMode: graphQLTag, includes spread fragments in each fragment document so it can be used on its own; defaults to false, and operation documents do not change.
Adds plainString mode, generating documents as plain template strings with embedded fragments instead of TypedDocumentString instances; each document is typed as string.
Returns the default reason for a @deprecated directive without arguments.
Adds a type representing every declaration kind set, used by declaration-kind normalization and parsed types configuration.
A new export provides the shared @oneOf input declaration-kind rule for typescript and typescript-operations.
Creates typedDocumentString to support TypedDocumentString usage, common in Client-side plugins when documentMode=string.
Added support for typescript-operations: Input and Result can be type or interface; Variables remain type, and extracted Results are forced to type.
Added an option that renders nested type names with field names only, without types.
Added to typescript-operations to allow omitting operation types such as Variables, selection sets, and Fragment types.
Added support for importSchemaTypesFrom.
Behavior and default changes 2
rawMappers defaults to {}.
A default is now set for namespacedImportName when importSchemaTypesFrom is set.
Tooling 5
Moved from base-visitor to types-visitor; it is now a types-visitor concern.
Moved from base-visitor to documents-visitor.
Moved from base-visitor to documents-visitor.
Moved from base-visitor to documents-visitor and types-visitor.
Moved from base-visitor to documents-visitor and types-visitor.
Fixes and other changes 61
SchemaDefinition() and SchemaExtension() are typed to return null instead of any.
May return null, matching its existing return behavior.
Its parameter is typed as string[] | null | undefined, matching its empty-string handling.
Accepts an undefined scalars mapping and uses only the defaults and the schema.
Accepts nullish identifier and source, and throws a descriptive error when either is missing.
Treats an enum node without values as empty instead of throwing.
When blockTransformer is undefined, the block is returned unchanged instead of throwing.
Fields are typed as string | null, with _name typed as string | NameNode | null.
Accepts null, which renders the same as no block.
Treats missing identifiers as empty.
The type parameter accepts null, which graphql 15's schema.getType() can return.
Returns false instead of undefined.
getName and transform may return null, matching their existing return behavior.
Emits an empty string instead of the text undefined or null when a variable has no name or type identifier.
Throws a descriptive error when a document file has no parsed document.
These fields accept null, matching values already emitted by parseEnumValues.
Returned nodes use description: undefined instead of any.
The returned typeInfo is typed as { name: string; type: string } | null.
Accepts undefined and null, which it handles by returning an empty string.
The default key uses String(item).
Input objects, objects, interfaces, unions and enums without fields, types, values or description are treated as empty instead of throwing.
The constructor accepts additionalConfig as Partial<TPluginConfig>, since the visitor fills in defaults for omitted keys.
FragmentDefinition may return null and reports a descriptive error when the fragment's type condition is absent from the schema.
OperationDefinition throws a descriptive error when _selectionSetToObject is not set.
The constructor accepts Partial<TPluginConfig> for additionalConfig because omitted keys receive defaults.
DirectiveDefinition may return null, matching behavior for skipped directives.
EnumTypeDefinition may return null for enums without mappers or enumValues.
getAbstractMembersType's isTypenameNonOptional parameter is optional, matching the optional configuration flags it reads.
ScalarTypeDefinition may return null, matching behavior for skipped federation scalars.
The typeCache key type is Location | undefined.
DirectiveDefinition may return null, matching its supported visitor result.
EnumTypeDefinition may return null, matching its supported visitor result.
NamedType visitor parameters are typed, with key and parent required because the visitor always passes them.
ObjectTypeDefinition may return null, matching its supported visitor result.
buildOperation may return null, matching the base implementation's existing behavior.
withComment accepts undefined, fixing strict TypeScript errors when the argument may be undefined.
Accepts any GraphQLType or undefined and returns a copy of possible types rather than the schema's readonly array.
namespace accepts null, fixing strict TypeScript errors for nullable values.
alias is optional, matching link fields built for fields without an alias.
transform accepts undefined and returns null, matching its existing behavior.
includeFragments is optional, matching the accepted call shape.
mapOrStr is optional, matching its existing default to an empty object.
transformSelectionSet declares its return type and throws a descriptive error when the instance has no selection set.
Selection set type cache keys now reference fragment spreads by name instead of using expanded field paths, keeping key growth linear and fixing out-of-memory errors.
The
valueparameter is typed asT | null | undefined, allowing the result to be non-nullable when given a non-nullable default.Fixes union and conditional directives resulting in no field types.
Reverts Partial handling when conditional fragments and fragment masking are used, preventing all masked fields from becoming optional due to function type override.
Fixes fragment masking generation when a conditional directive is used.
Prevents @skip and @include from incorrectly dropping fields in Result when used on an Inline Fragment or Fragment Spread.
Stops emitting an empty import statement when an import source has no identifiers and no namespace.
Fixes duplicate type generation when extractAllFieldsToTypes=true is used with @defer.
Handles conditional spreads of fragments whose top-level selections are fragment spreads or contain inline fragments.
_fragments is protected instead of private.
Fragments are now deduplicated when documentMode is set to graphQLTag.
Conditional selection separation is skipped when extractAllFieldsToTypesCompact is enabled.
Fixes incorrect application of typesPrefix to const enums.
Fixes incorrect application of typesSuffix to const enums.
Moved to base-visitor so all three visitor types correctly synchronize enum type names.
Input and Variables now use the same input scalar defaults, such as ID accepting string or number.
Fixed handling of types from remote schemas, which lack astNode and were incorrectly recognized as native types.
Fixed inconsistent application of namingConvention, including in imports, Variables, Input, and Result.
@graphql-codegen/visitor-plugin-common 68 changes
New APIs and options 2
Declares GraphQL documents that are read and available to plugins for type resolution but do not generate output files.
Adds the importExtension configuration option.
Fixes and other changes 6
Fixes an invalid extracted concrete type name on a shared interface.
Fixes fragment type generation names.
Use the parent type name for interface types without fragments.
Mappers configured for root types can now override rootValueType; previously, root types were checked before mappers.
Fixes nested fragments not receiving the correct meta field in Client Preset.
The visitor now handles schema extension nodes correctly when a schema has no operation type defined and extensions contain directives.
@graphql-codegen/visitor-plugin-common 31 changes
Breaking changes 1
Node.js 12 is no longer supported.
@graphql-codegen/visitor-plugin-common 23 changes
Breaking changes 3
Adds an option for deep inlining fragment types within operation types; it defaults to inline, replacing the previous combine behavior.
Node 10 is no longer supported by graphql-tools or Codegen packages.
The default for preResolveTypes is now true, producing more readable types.