@tramvai/module-deps-graph 5.10.0 → 5.14.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,11 +6,9 @@ const depsGraph = ({ di }) => {
|
|
|
6
6
|
method: 'get',
|
|
7
7
|
path: '/deps-graph',
|
|
8
8
|
async handler({ parsedUrl: { query }, responseManager }) {
|
|
9
|
-
|
|
10
|
-
const graphs = getGraph({ di, searchValue: (_a = query.search) !== null && _a !== void 0 ? _a : '' });
|
|
9
|
+
const graphs = getGraph({ di, searchValue: query.search ?? '' });
|
|
11
10
|
function isLineVisible(line, graph) {
|
|
12
|
-
|
|
13
|
-
return (!query.lines && graph) || ((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(line) !== -1;
|
|
11
|
+
return (!query.lines && graph) || (query.lines ?? '').search(line) !== -1;
|
|
14
12
|
}
|
|
15
13
|
responseManager.setHeader('content-type', 'text/html');
|
|
16
14
|
responseManager.setBody(`
|
|
@@ -27,12 +25,9 @@ const depsGraph = ({ di }) => {
|
|
|
27
25
|
|
|
28
26
|
<h3>Command Lines:</h3>
|
|
29
27
|
${graphs
|
|
30
|
-
.map(([token, graph]) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<input id="${token}" type="checkbox" ${((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(token) !== -1 ? 'checked' : ''} onchange="toggleLine('${token}')"/><label ${!graph ? 'style="color: gray"' : ''} for="${token}">${token}</label>
|
|
34
|
-
`;
|
|
35
|
-
})
|
|
28
|
+
.map(([token, graph]) => `
|
|
29
|
+
<input id="${token}" type="checkbox" ${(query.lines ?? '').search(token) !== -1 ? 'checked' : ''} onchange="toggleLine('${token}')"/><label ${!graph ? 'style="color: gray"' : ''} for="${token}">${token}</label>
|
|
30
|
+
`)
|
|
36
31
|
.join('<br/>')}
|
|
37
32
|
|
|
38
33
|
|
package/lib/papi/deps-graph.js
CHANGED
|
@@ -10,11 +10,9 @@ const depsGraph = ({ di }) => {
|
|
|
10
10
|
method: 'get',
|
|
11
11
|
path: '/deps-graph',
|
|
12
12
|
async handler({ parsedUrl: { query }, responseManager }) {
|
|
13
|
-
|
|
14
|
-
const graphs = getGraph.getGraph({ di, searchValue: (_a = query.search) !== null && _a !== void 0 ? _a : '' });
|
|
13
|
+
const graphs = getGraph.getGraph({ di, searchValue: query.search ?? '' });
|
|
15
14
|
function isLineVisible(line, graph) {
|
|
16
|
-
|
|
17
|
-
return (!query.lines && graph) || ((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(line) !== -1;
|
|
15
|
+
return (!query.lines && graph) || (query.lines ?? '').search(line) !== -1;
|
|
18
16
|
}
|
|
19
17
|
responseManager.setHeader('content-type', 'text/html');
|
|
20
18
|
responseManager.setBody(`
|
|
@@ -31,12 +29,9 @@ const depsGraph = ({ di }) => {
|
|
|
31
29
|
|
|
32
30
|
<h3>Command Lines:</h3>
|
|
33
31
|
${graphs
|
|
34
|
-
.map(([token, graph]) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<input id="${token}" type="checkbox" ${((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(token) !== -1 ? 'checked' : ''} onchange="toggleLine('${token}')"/><label ${!graph ? 'style="color: gray"' : ''} for="${token}">${token}</label>
|
|
38
|
-
`;
|
|
39
|
-
})
|
|
32
|
+
.map(([token, graph]) => `
|
|
33
|
+
<input id="${token}" type="checkbox" ${(query.lines ?? '').search(token) !== -1 ? 'checked' : ''} onchange="toggleLine('${token}')"/><label ${!graph ? 'style="color: gray"' : ''} for="${token}">${token}</label>
|
|
34
|
+
`)
|
|
40
35
|
.join('<br/>')}
|
|
41
36
|
|
|
42
37
|
|
|
@@ -20,13 +20,12 @@ const getGraph = ({ di, searchValue }) => {
|
|
|
20
20
|
return deps;
|
|
21
21
|
}
|
|
22
22
|
function buildDepsGraph(container, parentNode, rank, token, recordOfMulti) {
|
|
23
|
-
var _a, _b;
|
|
24
23
|
const record = recordOfMulti || container.getRecord(Symbol.for(token));
|
|
25
24
|
if (!record) {
|
|
26
25
|
return null;
|
|
27
26
|
}
|
|
28
27
|
const moduleName = record.stack
|
|
29
|
-
?
|
|
28
|
+
? /\/(module(?:-|s\/)[\w-]*?)\//.exec(record.stack)?.[1].replace('modules/', '')
|
|
30
29
|
: undefined;
|
|
31
30
|
const searchMatch = searchValue &&
|
|
32
31
|
((token && token.indexOf(searchValue) !== -1) ||
|
|
@@ -49,10 +48,10 @@ const getGraph = ({ di, searchValue }) => {
|
|
|
49
48
|
multi: !!record.multi,
|
|
50
49
|
multiInstance: !!record.multi || !!recordOfMulti,
|
|
51
50
|
};
|
|
52
|
-
if (
|
|
51
|
+
if (record.multi?.length) {
|
|
53
52
|
node.deps = record.multi.reduce((acc, r) => acc.concat(buildDepsGraph(container, node, rank + 1, token, r)), []);
|
|
54
53
|
}
|
|
55
|
-
else if (record
|
|
54
|
+
else if (record?.resolvedDeps) {
|
|
56
55
|
node.deps = getDepsFromRecord(container, node, rank + 1, record);
|
|
57
56
|
}
|
|
58
57
|
return node;
|
package/lib/utils/get-graph.js
CHANGED
|
@@ -24,13 +24,12 @@ const getGraph = ({ di, searchValue }) => {
|
|
|
24
24
|
return deps;
|
|
25
25
|
}
|
|
26
26
|
function buildDepsGraph(container, parentNode, rank, token, recordOfMulti) {
|
|
27
|
-
var _a, _b;
|
|
28
27
|
const record = recordOfMulti || container.getRecord(Symbol.for(token));
|
|
29
28
|
if (!record) {
|
|
30
29
|
return null;
|
|
31
30
|
}
|
|
32
31
|
const moduleName = record.stack
|
|
33
|
-
?
|
|
32
|
+
? /\/(module(?:-|s\/)[\w-]*?)\//.exec(record.stack)?.[1].replace('modules/', '')
|
|
34
33
|
: undefined;
|
|
35
34
|
const searchMatch = searchValue &&
|
|
36
35
|
((token && token.indexOf(searchValue) !== -1) ||
|
|
@@ -53,10 +52,10 @@ const getGraph = ({ di, searchValue }) => {
|
|
|
53
52
|
multi: !!record.multi,
|
|
54
53
|
multiInstance: !!record.multi || !!recordOfMulti,
|
|
55
54
|
};
|
|
56
|
-
if (
|
|
55
|
+
if (record.multi?.length) {
|
|
57
56
|
node.deps = record.multi.reduce((acc, r) => acc.concat(buildDepsGraph(container, node, rank + 1, token, r)), []);
|
|
58
57
|
}
|
|
59
|
-
else if (record
|
|
58
|
+
else if (record?.resolvedDeps) {
|
|
60
59
|
node.deps = getDepsFromRecord(container, node, rank + 1, record);
|
|
61
60
|
}
|
|
62
61
|
return node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-deps-graph",
|
|
3
|
-
"version": "5.10
|
|
3
|
+
"version": "5.14.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"watch": "tsc -w"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@tramvai/core": "5.10
|
|
22
|
-
"@tramvai/tokens-common": "5.10
|
|
23
|
-
"@tramvai/tokens-server": "5.10
|
|
24
|
-
"@tramvai/papi": "5.10
|
|
21
|
+
"@tramvai/core": "5.14.10",
|
|
22
|
+
"@tramvai/tokens-common": "5.14.10",
|
|
23
|
+
"@tramvai/tokens-server": "5.14.10",
|
|
24
|
+
"@tramvai/papi": "5.14.10",
|
|
25
25
|
"@tinkoff/dippy": "0.11.3",
|
|
26
26
|
"tslib": "^2.4.0"
|
|
27
27
|
},
|