1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.BuildGraph = void 0;
|
4 | const nodes_1 = require("../ng-package/nodes");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | class BuildGraph {
|
10 | constructor() {
|
11 | this.store = new Map();
|
12 | }
|
13 | put(value) {
|
14 | if (value instanceof Array) {
|
15 | value.forEach(node => this.insert(node));
|
16 | }
|
17 | else {
|
18 | this.insert(value);
|
19 | }
|
20 | return this;
|
21 | }
|
22 | insert(node) {
|
23 | if (this.store.has(node.url)) {
|
24 |
|
25 | const oldNode = this.store.get(node.url);
|
26 | oldNode['_dependees'].delete(oldNode);
|
27 | }
|
28 | if (this.watcher && node.url.startsWith(nodes_1.URL_PROTOCOL_FILE)) {
|
29 | this.watcher.add(node.url.slice(nodes_1.URL_PROTOCOL_FILE.length));
|
30 | }
|
31 | this.store.set(node.url, node);
|
32 | }
|
33 | get(url) {
|
34 | return this.store.get(url);
|
35 | }
|
36 | has(url) {
|
37 | return this.store.has(url);
|
38 | }
|
39 | entries() {
|
40 | const values = this.store.values();
|
41 | return Array.from(values);
|
42 | }
|
43 | some(by) {
|
44 | return this.entries().some(by);
|
45 | }
|
46 | filter(by) {
|
47 | return this.entries().filter(by);
|
48 | }
|
49 | find(by) {
|
50 | return this.entries().find(by);
|
51 | }
|
52 | get size() {
|
53 | return this.store.size;
|
54 | }
|
55 | }
|
56 | exports.BuildGraph = BuildGraph;
|
57 |
|
\ | No newline at end of file |