Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const Filter = require('broccoli-persistent-filter');
const gql = require('graphql-tag');
gql.disableFragmentWarnings();
module.exports = class GraphQLFilter extends Filter {
constructor(inputNode, options) {
super(inputNode, options);
this.extensions = ['graphql'];
this.targetExtension = 'js';
}
processString(source) {
let output = [
`const doc = ${JSON.stringify(gql([source]), null, 2)};`,
`export default doc;`
];
source.split('\n').forEach((line, i) => {
let match = /^#import\s+(.*)/.exec(line);