UNPKG

1.2 kBJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 * @format
9 */
10'use strict';
11
12var formatGeneratedModule = function formatGeneratedModule(_ref) {
13 var moduleName = _ref.moduleName,
14 documentType = _ref.documentType,
15 docText = _ref.docText,
16 concreteText = _ref.concreteText,
17 typeText = _ref.typeText,
18 hash = _ref.hash,
19 sourceHash = _ref.sourceHash;
20 var documentTypeImport = documentType ? "import type { ".concat(documentType, " } from 'relay-runtime';") : '';
21 var docTextComment = docText ? '\n/*\n' + docText.trim() + '\n*/\n' : '';
22 var hashText = hash ? "\n * ".concat(hash) : '';
23 return "/**\n * ".concat('@', "flow", hashText, "\n */\n\n/* eslint-disable */\n\n'use strict';\n\n/*::\n").concat(documentTypeImport, "\n").concat(typeText || '', "\n*/\n\n").concat(docTextComment, "\nconst node/*: ").concat(documentType || 'empty', "*/ = ").concat(concreteText, ";\n// prettier-ignore\n(node/*: any*/).hash = '").concat(sourceHash, "';\nmodule.exports = node;\n");
24};
25
26module.exports = formatGeneratedModule;
\No newline at end of file