@graphql-tools/webpack-loader
Advanced tools
Comparing version 6.0.12-alpha-3ae4174.0 to 6.0.12-alpha-48f2add.0
@@ -8,30 +8,2 @@ 'use strict'; | ||
function isSDL(doc) { | ||
return !doc.definitions.some(def => graphql.isExecutableDefinitionNode(def)); | ||
} | ||
function removeDescriptions(doc) { | ||
function transformNode(node) { | ||
if (node.description) { | ||
return { | ||
...node, | ||
description: undefined, | ||
}; | ||
} | ||
return node; | ||
} | ||
if (isSDL(doc)) { | ||
return graphql.visit(doc, { | ||
ScalarTypeDefinition: transformNode, | ||
ObjectTypeDefinition: transformNode, | ||
InterfaceTypeDefinition: transformNode, | ||
UnionTypeDefinition: transformNode, | ||
EnumTypeDefinition: transformNode, | ||
EnumValueDefinition: transformNode, | ||
InputObjectTypeDefinition: transformNode, | ||
InputValueDefinition: transformNode, | ||
FieldDefinition: transformNode, | ||
}); | ||
} | ||
return doc; | ||
} | ||
function index (path) { | ||
@@ -48,9 +20,3 @@ const callback = this.async(); | ||
const mergedDoc = graphql.concatAST(documents); | ||
const transformations = []; | ||
if (options.removeDescriptions) { | ||
transformations.push(removeDescriptions); | ||
} | ||
const transformedDoc = transformations.reduce((doc, transform) => transform(doc), mergedDoc); | ||
const exportStatement = options.commonjs === false ? `export default ` : `module.exports = `; | ||
return callback(null, `${exportStatement} ${JSON.stringify(transformedDoc)}`); | ||
return callback(null, `export default ${JSON.stringify(mergedDoc)}`); | ||
}); | ||
@@ -57,0 +23,0 @@ } |
import { loadTypedefs } from '@graphql-tools/load'; | ||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'; | ||
import { concatAST, isExecutableDefinitionNode, visit } from 'graphql'; | ||
import { concatAST } from 'graphql'; | ||
import { getOptions } from 'loader-utils'; | ||
function isSDL(doc) { | ||
return !doc.definitions.some(def => isExecutableDefinitionNode(def)); | ||
} | ||
function removeDescriptions(doc) { | ||
function transformNode(node) { | ||
if (node.description) { | ||
return { | ||
...node, | ||
description: undefined, | ||
}; | ||
} | ||
return node; | ||
} | ||
if (isSDL(doc)) { | ||
return visit(doc, { | ||
ScalarTypeDefinition: transformNode, | ||
ObjectTypeDefinition: transformNode, | ||
InterfaceTypeDefinition: transformNode, | ||
UnionTypeDefinition: transformNode, | ||
EnumTypeDefinition: transformNode, | ||
EnumValueDefinition: transformNode, | ||
InputObjectTypeDefinition: transformNode, | ||
InputValueDefinition: transformNode, | ||
FieldDefinition: transformNode, | ||
}); | ||
} | ||
return doc; | ||
} | ||
function index (path) { | ||
@@ -45,9 +17,3 @@ const callback = this.async(); | ||
const mergedDoc = concatAST(documents); | ||
const transformations = []; | ||
if (options.removeDescriptions) { | ||
transformations.push(removeDescriptions); | ||
} | ||
const transformedDoc = transformations.reduce((doc, transform) => transform(doc), mergedDoc); | ||
const exportStatement = options.commonjs === false ? `export default ` : `module.exports = `; | ||
return callback(null, `${exportStatement} ${JSON.stringify(transformedDoc)}`); | ||
return callback(null, `export default ${JSON.stringify(mergedDoc)}`); | ||
}); | ||
@@ -54,0 +20,0 @@ } |
{ | ||
"name": "@graphql-tools/webpack-loader", | ||
"version": "6.0.12-alpha-3ae4174.0", | ||
"version": "6.0.12-alpha-48f2add.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,4 +10,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/load": "6.0.12-alpha-3ae4174.0", | ||
"@graphql-tools/graphql-file-loader": "6.0.12-alpha-3ae4174.0", | ||
"@graphql-tools/load": "6.0.12-alpha-48f2add.0", | ||
"@graphql-tools/graphql-file-loader": "6.0.12-alpha-48f2add.0", | ||
"loader-utils": "2.0.0", | ||
@@ -14,0 +14,0 @@ "tslib": "~2.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5326
42
+ Added@graphql-tools/graphql-file-loader@6.0.12-alpha-48f2add.0(transitive)
+ Added@graphql-tools/import@6.0.12-alpha-48f2add.0(transitive)
+ Added@graphql-tools/load@6.0.12-alpha-48f2add.0(transitive)
+ Added@graphql-tools/merge@6.0.12-alpha-48f2add.0(transitive)
+ Added@graphql-tools/schema@6.0.12-alpha-48f2add.0(transitive)
+ Added@graphql-tools/utils@6.0.12-alpha-48f2add.0(transitive)
- Removed@graphql-tools/graphql-file-loader@6.0.12-alpha-3ae4174.0(transitive)
- Removed@graphql-tools/import@6.0.12-alpha-3ae4174.0(transitive)
- Removed@graphql-tools/load@6.0.12-alpha-3ae4174.0(transitive)
- Removed@graphql-tools/merge@6.0.12-alpha-3ae4174.0(transitive)
- Removed@graphql-tools/schema@6.0.12-alpha-3ae4174.0(transitive)
- Removed@graphql-tools/utils@6.0.12-alpha-3ae4174.0(transitive)
Updated@graphql-tools/graphql-file-loader@6.0.12-alpha-48f2add.0