@graphql-codegen/cli 2.6.0-alpha-967b742ba.0 → 2.7.0-alpha-d6c7238c0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin.js CHANGED
@@ -799,13 +799,14 @@ function hashContent(content) {
799
799
  return crypto.createHash('sha256').update(content).digest('hex');
800
800
  }
801
801
  function hashSchema(schema) {
802
- return hashContent(utils.printSchemaWithDirectives(schema, {
803
- assumeValid: true,
804
- }));
802
+ return hashContent(graphql.print(pluginHelpers.getCachedDocumentNodeFromSchema(schema)));
805
803
  }
806
804
  function addHashToSchema(schemaPromise) {
807
805
  return schemaPromise.then(schema => {
808
806
  // It's consumed later on. The general purpose is to use it for caching.
807
+ if (!schema.extensions) {
808
+ schema.extensions = {};
809
+ }
809
810
  schema.extensions['hash'] = hashSchema(schema);
810
811
  return schema;
811
812
  });
package/index.js CHANGED
@@ -717,13 +717,14 @@ function hashContent(content) {
717
717
  return crypto.createHash('sha256').update(content).digest('hex');
718
718
  }
719
719
  function hashSchema(schema) {
720
- return hashContent(utils.printSchemaWithDirectives(schema, {
721
- assumeValid: true,
722
- }));
720
+ return hashContent(graphql.print(pluginHelpers.getCachedDocumentNodeFromSchema(schema)));
723
721
  }
724
722
  function addHashToSchema(schemaPromise) {
725
723
  return schemaPromise.then(schema => {
726
724
  // It's consumed later on. The general purpose is to use it for caching.
725
+ if (!schema.extensions) {
726
+ schema.extensions = {};
727
+ }
727
728
  schema.extensions['hash'] = hashSchema(schema);
728
729
  return schema;
729
730
  });
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { isDetailedError, DetailedError, createNoopProfiler, createProfiler, normalizeInstanceOrArray, normalizeConfig, normalizeOutputParam, getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';
1
+ import { isDetailedError, DetailedError, createNoopProfiler, createProfiler, getCachedDocumentNodeFromSchema, normalizeInstanceOrArray, normalizeConfig, normalizeOutputParam } from '@graphql-codegen/plugin-helpers';
2
2
  import { codegen } from '@graphql-codegen/core';
3
- import { printSchemaWithDirectives, AggregateError, isValidPath } from '@graphql-tools/utils';
3
+ import { AggregateError, isValidPath } from '@graphql-tools/utils';
4
4
  import chalk from 'chalk';
5
5
  import logSymbols from 'log-symbols';
6
6
  import ansiEscapes from 'ansi-escapes';
@@ -690,13 +690,14 @@ function hashContent(content) {
690
690
  return createHash('sha256').update(content).digest('hex');
691
691
  }
692
692
  function hashSchema(schema) {
693
- return hashContent(printSchemaWithDirectives(schema, {
694
- assumeValid: true,
695
- }));
693
+ return hashContent(print(getCachedDocumentNodeFromSchema(schema)));
696
694
  }
697
695
  function addHashToSchema(schemaPromise) {
698
696
  return schemaPromise.then(schema => {
699
697
  // It's consumed later on. The general purpose is to use it for caching.
698
+ if (!schema.extensions) {
699
+ schema.extensions = {};
700
+ }
700
701
  schema.extensions['hash'] = hashSchema(schema);
701
702
  return schema;
702
703
  });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "2.6.0-alpha-967b742ba.0",
3
+ "version": "2.7.0-alpha-d6c7238c0.0",
4
4
  "peerDependencies": {
5
5
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
6
6
  },
7
7
  "dependencies": {
8
- "@graphql-codegen/core": "2.6.0-alpha-967b742ba.0",
9
- "@graphql-codegen/plugin-helpers": "2.5.0-alpha-967b742ba.0",
8
+ "@graphql-codegen/core": "2.6.0-alpha-d6c7238c0.0",
9
+ "@graphql-codegen/plugin-helpers": "2.5.0-alpha-d6c7238c0.0",
10
10
  "@graphql-tools/apollo-engine-loader": "^7.0.5",
11
11
  "@graphql-tools/code-file-loader": "^7.0.6",
12
12
  "@graphql-tools/git-loader": "^7.0.5",