@graphql-mesh/fusion-execution
Version:
Runtime for Fusion Supergraph
11 lines (10 loc) • 332 B
JavaScript
import { parse, print } from 'graphql';
const printCache = new WeakMap();
export function parseAndCache(source) {
const parsed = parse(source, { noLocation: true });
printCache.set(parsed, source);
return parsed;
}
export function printCached(document) {
return printCache.get(document) || print(document).trim();
}