@graphql-cli/codegen@2.4.25
Patch Changes
@graphql-codegen/cli@2.16.5
Patch Changes
-
#8865
e4d073b16
Thanks @n1ru4l! - dependencies updates:- Updated dependency
@graphql-codegen/core@^2.6.8
↗︎ (from2.6.8
, independencies
) - Updated dependency
@graphql-tools/load@^7.8.0
↗︎ (from7.8.0
, independencies
) - Updated dependency
cosmiconfig-typescript-loader@^4.3.0
↗︎ (from4.3.0
, independencies
) - Updated dependency
graphql-config@^4.4.0
↗︎ (from4.4.0
, independencies
) - Added dependency
ts-node@^10.9.1
↗︎ (todependencies
) - Removed dependency
ts-node@>=10
↗︎ (frompeerDependencies
)
- Updated dependency
-
#8865
e4d073b16
Thanks @n1ru4l! - move ts-node from peer dependencies to dependencies
@graphql-codegen/visitor-plugin-common@2.13.8
Patch Changes
- #8816
a98198524
Thanks @charle692! - Fix issue where visitor-plugin-common emitted ESM imports for Operations when emitLegacyCommonJSImports is true
@graphql-codegen/typescript-document-nodes@2.3.13
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
@graphql-codegen/gql-tag-operations@1.6.2
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
@graphql-codegen/typescript-operations@2.5.13
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
- @graphql-codegen/typescript@2.8.8
@graphql-codegen/typescript-resolvers@2.7.13
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
- @graphql-codegen/typescript@2.8.8
@graphql-codegen/typed-document-node@2.3.13
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
@graphql-codegen/typescript@2.8.8
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
@graphql-codegen/client-preset@1.3.0
Minor Changes
-
#8757
4f290aa72
Thanks @n1ru4l! - Add support for persisted documents.You can now generate and embed a persisted documents hash for the executable documents.
/** codegen.ts */ import { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', documents: ['src/**/*.tsx'], ignoreNoDocuments: true, // for better experience with the watcher generates: { './src/gql/': { preset: 'client', plugins: [], presetConfig: { persistedDocuments: true, }, }, }, }; export default config;
This will generate
./src/gql/persisted-documents.json
(dictionary of hashes with their operation string).In addition to that each generated document node will have a
__meta__.hash
property.import { gql } from './gql.js'; const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` query allFilmsWithVariablesQuery($first: Int!) { allFilms(first: $first) { edges { node { ...FilmItem } } } } `); console.log((allFilmsWithVariablesQueryDocument as any)['__meta__']['hash']);
-
#8757
4f290aa72
Thanks @n1ru4l! - Add support for embedding metadata in the document AST.It is now possible to embed metadata (e.g. for your GraphQL client within the emitted code).
/** codegen.ts */ import { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', documents: ['src/**/*.tsx'], ignoreNoDocuments: true, // for better experience with the watcher generates: { './src/gql/': { preset: 'client', plugins: [], presetConfig: { onExecutableDocumentNode(documentNode) { return { operation: documentNode.definitions[0].operation, name: documentNode.definitions[0].name.value, }; }, }, }, }, }; export default config;
You can then access the metadata via the
__meta__
property on the document node.import { gql } from './gql.js'; const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` query allFilmsWithVariablesQuery($first: Int!) { allFilms(first: $first) { edges { node { ...FilmItem } } } } `); console.log((allFilmsWithVariablesQueryDocument as any)['__meta__']);
Patch Changes
- #8757
4f290aa72
Thanks @n1ru4l! - dependencies updates:- Added dependency
@graphql-tools/documents@^0.1.0
↗︎ (todependencies
)
- Added dependency
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8
- @graphql-codegen/gql-tag-operations@1.6.2
- @graphql-codegen/typescript-operations@2.5.13
- @graphql-codegen/typed-document-node@2.3.13
- @graphql-codegen/typescript@2.8.8
@graphql-codegen/graphql-modules-preset@2.5.12
Patch Changes
- Updated dependencies [
a98198524
]:- @graphql-codegen/visitor-plugin-common@2.13.8