Skip to content

Commit eaaa824

Browse files
authored
Fix processor compatibility with other plugins
1 parent 08007cb commit eaaa824

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/plugin/src/processors/code-files.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { parseCode } from '@graphql-tools/graphql-tag-pluck';
2+
import { basename } from 'path';
23

34
const RELEVANT_KEYWORDS = ['gql', 'graphql', '/* GraphQL */'];
45

@@ -19,6 +20,8 @@ export function createGraphqlProcessor() {
1920
const blocks: Block[] = [];
2021
blocksMap.set(filename, blocks);
2122

23+
const originalFileBlock = { text, filename: `/../../${basename(filename)}` }
24+
2225
if (filename && text && RELEVANT_KEYWORDS.some(keyword => text.includes(keyword))) {
2326
const extractedDocuments = parseCode({
2427
code: text,
@@ -39,13 +42,13 @@ export function createGraphqlProcessor() {
3942
});
4043
}
4144

42-
blocks.push({ text, filename });
45+
blocks.push(originalFileBlock);
4346

4447
return blocks;
4548
}
4649
}
4750

48-
return [{ text, filename }];
51+
return [originalFileBlock];
4952
},
5053
postprocess: (messageLists: any[], filename: string): any[] => {
5154
const blocks = blocksMap.get(filename);

0 commit comments

Comments
 (0)