1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.setTSInstanceInCache = exports.getTSInstanceFromCache = void 0;
|
4 |
|
5 |
|
6 |
|
7 | const marker = {};
|
8 |
|
9 |
|
10 |
|
11 | const cache = new WeakMap();
|
12 | function getTSInstanceFromCache(key, name) {
|
13 | const compiler = key !== null && key !== void 0 ? key : marker;
|
14 | let instances = cache.get(compiler);
|
15 | if (!instances) {
|
16 | instances = new Map();
|
17 | cache.set(compiler, instances);
|
18 | }
|
19 | return instances.get(name);
|
20 | }
|
21 | exports.getTSInstanceFromCache = getTSInstanceFromCache;
|
22 | function setTSInstanceInCache(key, name, instance) {
|
23 | var _a;
|
24 | const compiler = key !== null && key !== void 0 ? key : marker;
|
25 | const instances = (_a = cache.get(compiler)) !== null && _a !== void 0 ? _a : new Map();
|
26 | instances.set(name, instance);
|
27 | cache.set(compiler, instances);
|
28 | }
|
29 | exports.setTSInstanceInCache = setTSInstanceInCache;
|
30 |
|
\ | No newline at end of file |