github dotansimha/graphql-code-generator release-1675088794682
January 30, 2023

latest releases: release-1730117942954, @graphql-codegen/visitor-plugin-common@5.5.0, @graphql-codegen/typescript@4.1.1...
21 months ago

@graphql-cli/codegen@2.4.25

Patch Changes

@graphql-codegen/cli@2.16.5

Patch Changes

@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:
  • 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

Don't miss a new graphql-code-generator release

NewReleases is sending notifications on new releases.