@graphql-codegen/typescript-operations 6.1.3 → 6.1.4

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/cjs/index.js CHANGED
@@ -85,8 +85,15 @@ const plugin = async (inputSchema, rawDocuments, config, { outputFile }) => {
85
85
  // #region generateSchemaTypes
86
86
  // When Input and Enum appear in Result selection sets, we need to
87
87
  // generate those types so they can be referred to correctly
88
- const schemaTypes = (0, plugin_helpers_1.oldVisit)((0, schema_ast_1.transformSchemaAST)(schema, config).ast, { leave: visitor });
89
- const schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
88
+ //
89
+ // Note: we don't run visitor on the schema when i.e. `!config.importSchemaTypesFrom`
90
+ // because the schema types are supposedly already generated elsewhere.
91
+ // In such cases, running the visitor on the schema will do unncessary work
92
+ let schemaTypesDefinitions = [];
93
+ if (!config.importSchemaTypesFrom) {
94
+ const schemaTypes = (0, plugin_helpers_1.oldVisit)((0, schema_ast_1.transformSchemaAST)(schema, config).ast, { leave: visitor });
95
+ schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
96
+ }
90
97
  // #endregion
91
98
  // #region generateIntrospectionTypesDefinitions
92
99
  // It is possible for queries to refer to enums in introspection:
package/esm/index.js CHANGED
@@ -48,8 +48,15 @@ export const plugin = async (inputSchema, rawDocuments, config, { outputFile })
48
48
  // #region generateSchemaTypes
49
49
  // When Input and Enum appear in Result selection sets, we need to
50
50
  // generate those types so they can be referred to correctly
51
- const schemaTypes = oldVisit(transformSchemaAST(schema, config).ast, { leave: visitor });
52
- const schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
51
+ //
52
+ // Note: we don't run visitor on the schema when i.e. `!config.importSchemaTypesFrom`
53
+ // because the schema types are supposedly already generated elsewhere.
54
+ // In such cases, running the visitor on the schema will do unncessary work
55
+ let schemaTypesDefinitions = [];
56
+ if (!config.importSchemaTypesFrom) {
57
+ const schemaTypes = oldVisit(transformSchemaAST(schema, config).ast, { leave: visitor });
58
+ schemaTypesDefinitions = findTransformedDefinitions(schemaTypes);
59
+ }
53
60
  // #endregion
54
61
  // #region generateIntrospectionTypesDefinitions
55
62
  // It is possible for queries to refer to enums in introspection:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-operations",
3
- "version": "6.1.3",
3
+ "version": "6.1.4",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments",
5
5
  "peerDependenciesMeta": {
6
6
  "graphql-sock": {