UNPKG

1.33 kBJavaScriptView Raw
1"use strict";
2var __assign = (this && this.__assign) || Object.assign || function(t) {
3 for (var s, i = 1, n = arguments.length; i < n; i++) {
4 s = arguments[i];
5 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6 t[p] = s[p];
7 }
8 return t;
9};
10Object.defineProperty(exports, "__esModule", { value: true });
11var prepare_documents_only_1 = require("./prepare-documents-only");
12var graphql_codegen_core_1 = require("graphql-codegen-core");
13var moment = require("moment");
14function generateSingleFile(compiledIndexTemplate, executionSettings, config, templateContext, documents) {
15 graphql_codegen_core_1.debugLog("[generateSingleFile] Compiling single file to: " + config.outFile);
16 return [
17 {
18 filename: config.outFile,
19 content: compiledIndexTemplate(__assign({ config: config.config, primitivesMap: config.primitives, currentTime: moment().format() }, (!executionSettings.generateSchema ? prepare_documents_only_1.prepareSchemaForDocumentsOnly(templateContext) : templateContext), { operations: documents.operations, fragments: documents.fragments, hasFragments: documents.hasFragments, hasOperations: documents.hasOperations }))
20 }
21 ];
22}
23exports.generateSingleFile = generateSingleFile;
24//# sourceMappingURL=generate-single-file.js.map
\No newline at end of file