Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/webpack-loader

Package Overview
Dependencies
Maintainers
3
Versions
511
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/webpack-loader - npm Package Compare versions

Comparing version 6.0.12-alpha-3ae4174.0 to 6.0.12-alpha-48f2add.0

36

index.cjs.js

@@ -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 @@ }

6

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc