1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var graphql_codegen_core_1 = require("graphql-codegen-core");
|
4 | function cleanTemplateComments(template, debugFilename) {
|
5 | if (debugFilename === void 0) { debugFilename = ''; }
|
6 | graphql_codegen_core_1.debugLog("[cleanTemplateComments] called, looking for magic comments in " + debugFilename + "...");
|
7 | if (template.match(/\/\*\s*gqlgen/gi)) {
|
8 | graphql_codegen_core_1.debugLog("[cleanTemplateComments] Found magic comment 'gqlgen' in template " + debugFilename + "...", template);
|
9 | var result = template
|
10 | .replace(/.*({{.*}})/gi, function (all, group) {
|
11 | if (all.toLowerCase().includes('gqlgen')) {
|
12 | return all;
|
13 | }
|
14 | return all.replace(/{{/g, '\\{{');
|
15 | })
|
16 | .replace(/\/\*\s*gqlgen\s*(.*?)\s*\*\//gi, function (all, group) { return (group ? group : all); });
|
17 | graphql_codegen_core_1.debugLog("[cleanTemplateComments] template " + debugFilename + " modified, result is: ", template);
|
18 | return result;
|
19 | }
|
20 | graphql_codegen_core_1.debugLog("[cleanTemplateComments] " + debugFilename + " does not contains any magic comments, skipping...");
|
21 | return template;
|
22 | }
|
23 | exports.cleanTemplateComments = cleanTemplateComments;
|
24 |
|
\ | No newline at end of file |