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

@graphql-codegen/jsdoc

Package Overview
Dependencies
Maintainers
5
Versions
693
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-codegen/jsdoc - npm Package Compare versions

Comparing version 1.15.1-alpha-4ca861a4.29 to 1.15.1-alpha-537dae1e.33

47

index.cjs.js

@@ -15,6 +15,20 @@ 'use strict';

const createDocBlock = (lines) => {
const typedef = ['/**', ...lines.map(line => ` * ${line}`), ' */'];
const typedef = [
'/**',
...lines
.filter(t => t && t !== '')
.reduce((prev, t) => [...prev, ...t.split('\n')], [])
.map(line => ` * ${line}`),
' */',
];
const block = typedef.join('\n');
return block;
};
const createDescriptionBlock = (nodeWithDesc) => {
var _a;
if ((_a = nodeWithDesc === null || nodeWithDesc === void 0 ? void 0 : nodeWithDesc.description) === null || _a === void 0 ? void 0 : _a.value) {
return `@description ${nodeWithDesc.description.value}`;
}
return '';
};
const plugin = (schema, documents) => {

@@ -33,3 +47,7 @@ const parsedSchema = graphql.parse(graphql.printSchema(schema));

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -40,3 +58,7 @@ },

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -47,3 +69,7 @@ },

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -54,5 +80,3 @@ },

if (node.types !== undefined) {
return `/**
* @typedef {(${node.types.join('|')})} ${node.name}
*/`;
return createDocBlock([`@typedef {(${node.types.join('|')})} ${node.name}`, createDescriptionBlock(node)]);
}

@@ -89,3 +113,3 @@ return node;

const fieldName = node.nonNullable ? node.name : `[${node.name}]`;
return `@property {${node.type}} ${fieldName}`;
return `@property {${node.type}} ${fieldName}${node.description && node.description.value ? ` - ${node.description.value}` : ''}`;
},

@@ -102,3 +126,3 @@ },

const fieldName = node.nonNullable ? node.name : `[${node.name}]`;
return `@property {${node.type}} ${fieldName}`;
return `@property {${node.type}} ${fieldName}${node.description && node.description.value ? ` - ${node.description.value}` : ''}`;
},

@@ -120,3 +144,3 @@ },

leave(node) {
return createDocBlock([`@typedef {*} ${node.name}`]);
return createDocBlock([`@typedef {*} ${node.name}`, createDescriptionBlock(node)]);
},

@@ -129,3 +153,4 @@ },

'@readonly',
...(node.values || []).map(v => `@property {String} ${v.name}`),
createDescriptionBlock(node),
...(node.values || []).map(v => `@property {String} ${v.name}${v.description && v.description.value ? ` - ${v.description.value}` : ''}`),
]);

@@ -132,0 +157,0 @@ },

@@ -11,6 +11,20 @@ import { parse, printSchema, concatAST, visit } from 'graphql';

const createDocBlock = (lines) => {
const typedef = ['/**', ...lines.map(line => ` * ${line}`), ' */'];
const typedef = [
'/**',
...lines
.filter(t => t && t !== '')
.reduce((prev, t) => [...prev, ...t.split('\n')], [])
.map(line => ` * ${line}`),
' */',
];
const block = typedef.join('\n');
return block;
};
const createDescriptionBlock = (nodeWithDesc) => {
var _a;
if ((_a = nodeWithDesc === null || nodeWithDesc === void 0 ? void 0 : nodeWithDesc.description) === null || _a === void 0 ? void 0 : _a.value) {
return `@description ${nodeWithDesc.description.value}`;
}
return '';
};
const plugin = (schema, documents) => {

@@ -29,3 +43,7 @@ const parsedSchema = parse(printSchema(schema));

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -36,3 +54,7 @@ },

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -43,3 +65,7 @@ },

const typedNode = node;
return createDocBlock([`@typedef {Object} ${typedNode.name}`, ...typedNode.fields]);
return createDocBlock([
`@typedef {Object} ${typedNode.name}`,
createDescriptionBlock(node),
...typedNode.fields,
]);
},

@@ -50,5 +76,3 @@ },

if (node.types !== undefined) {
return `/**
* @typedef {(${node.types.join('|')})} ${node.name}
*/`;
return createDocBlock([`@typedef {(${node.types.join('|')})} ${node.name}`, createDescriptionBlock(node)]);
}

@@ -85,3 +109,3 @@ return node;

const fieldName = node.nonNullable ? node.name : `[${node.name}]`;
return `@property {${node.type}} ${fieldName}`;
return `@property {${node.type}} ${fieldName}${node.description && node.description.value ? ` - ${node.description.value}` : ''}`;
},

@@ -98,3 +122,3 @@ },

const fieldName = node.nonNullable ? node.name : `[${node.name}]`;
return `@property {${node.type}} ${fieldName}`;
return `@property {${node.type}} ${fieldName}${node.description && node.description.value ? ` - ${node.description.value}` : ''}`;
},

@@ -116,3 +140,3 @@ },

leave(node) {
return createDocBlock([`@typedef {*} ${node.name}`]);
return createDocBlock([`@typedef {*} ${node.name}`, createDescriptionBlock(node)]);
},

@@ -125,3 +149,4 @@ },

'@readonly',
...(node.values || []).map(v => `@property {String} ${v.name}`),
createDescriptionBlock(node),
...(node.values || []).map(v => `@property {String} ${v.name}${v.description && v.description.value ? ` - ${v.description.value}` : ''}`),
]);

@@ -128,0 +153,0 @@ },

{
"name": "@graphql-codegen/jsdoc",
"version": "1.15.1-alpha-4ca861a4.29+4ca861a4",
"version": "1.15.1-alpha-537dae1e.33+537dae1e",
"description": "GraphQL Code Generator plugin for generating JSDoc based types for GraphQL queries, mutations, subscriptions and fragments",

@@ -9,4 +9,4 @@ "peerDependencies": {

"dependencies": {
"@graphql-codegen/plugin-helpers": "1.15.1-alpha-4ca861a4.29+4ca861a4",
"@graphql-codegen/visitor-plugin-common": "1.15.1-alpha-4ca861a4.29+4ca861a4",
"@graphql-codegen/plugin-helpers": "1.15.1-alpha-537dae1e.33+537dae1e",
"@graphql-codegen/visitor-plugin-common": "1.15.1-alpha-537dae1e.33+537dae1e",
"tslib": "~2.0.0"

@@ -13,0 +13,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