You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
733 B
21 lines
733 B
4 months ago
|
import { print as origPrint } from "graphql";
|
||
|
import { AutoCleanedWeakCache, cacheSizes, } from "../caching/index.js";
|
||
|
import { registerGlobalCache } from "../caching/getMemoryInternals.js";
|
||
|
var printCache;
|
||
|
export var print = Object.assign(function (ast) {
|
||
|
var result = printCache.get(ast);
|
||
|
if (!result) {
|
||
|
result = origPrint(ast);
|
||
|
printCache.set(ast, result);
|
||
|
}
|
||
|
return result;
|
||
|
}, {
|
||
|
reset: function () {
|
||
|
printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 /* defaultCacheSizes.print */);
|
||
|
},
|
||
|
});
|
||
|
print.reset();
|
||
|
if (globalThis.__DEV__ !== false) {
|
||
|
registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); });
|
||
|
}
|
||
|
//# sourceMappingURL=print.js.map
|