@tramvai/module-deps-graph 2.22.0 → 2.24.3
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.
- package/lib/server.es.js +7 -6
- package/lib/server.js +7 -6
- package/package.json +6 -6
package/lib/server.es.js
CHANGED
|
@@ -140,14 +140,15 @@ const depsGraph = ({ di }) => {
|
|
|
140
140
|
return createPapiMethod({
|
|
141
141
|
method: 'get',
|
|
142
142
|
path: '/deps-graph',
|
|
143
|
-
async handler(
|
|
143
|
+
async handler({ parsedUrl: { query }, responseManager }) {
|
|
144
144
|
var _a;
|
|
145
|
-
const graphs = getGraph({ di, searchValue: (_a =
|
|
145
|
+
const graphs = getGraph({ di, searchValue: (_a = query.search) !== null && _a !== void 0 ? _a : '' });
|
|
146
146
|
function isLineVisible(line, graph) {
|
|
147
147
|
var _a;
|
|
148
|
-
return (
|
|
148
|
+
return (!query.lines && graph) || ((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(line) !== -1;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
responseManager.setHeader('content-type', 'text/html');
|
|
151
|
+
responseManager.setBody(`
|
|
151
152
|
<script src="//d3js.org/d3.v6.min.js"></script>
|
|
152
153
|
<script src="https://unpkg.com/@hpcc-js/wasm@1.4.1/dist/index.min.js"></script>
|
|
153
154
|
<script src="https://unpkg.com/d3-graphviz@4.0.0/build/d3-graphviz.js"></script>
|
|
@@ -157,14 +158,14 @@ const depsGraph = ({ di }) => {
|
|
|
157
158
|
</div>
|
|
158
159
|
|
|
159
160
|
<h3>Search:</h3>
|
|
160
|
-
<input placeholder="Search module and token names..." value="${
|
|
161
|
+
<input placeholder="Search module and token names..." value="${query.search || ''}" style="padding: 10px 4px; width: 450px" onkeyup="event.keyCode === 13 && applySearch(this.value)" onblur="applySearch(this.value)"/><br/>
|
|
161
162
|
|
|
162
163
|
<h3>Command Lines:</h3>
|
|
163
164
|
${graphs
|
|
164
165
|
.map(([token, graph]) => {
|
|
165
166
|
var _a;
|
|
166
167
|
return `
|
|
167
|
-
<input id="${token}" type="checkbox" ${((_a =
|
|
168
|
+
<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>
|
|
168
169
|
`;
|
|
169
170
|
})
|
|
170
171
|
.join('<br/>')}
|
package/lib/server.js
CHANGED
|
@@ -144,14 +144,15 @@ const depsGraph = ({ di }) => {
|
|
|
144
144
|
return papi.createPapiMethod({
|
|
145
145
|
method: 'get',
|
|
146
146
|
path: '/deps-graph',
|
|
147
|
-
async handler(
|
|
147
|
+
async handler({ parsedUrl: { query }, responseManager }) {
|
|
148
148
|
var _a;
|
|
149
|
-
const graphs = getGraph({ di, searchValue: (_a =
|
|
149
|
+
const graphs = getGraph({ di, searchValue: (_a = query.search) !== null && _a !== void 0 ? _a : '' });
|
|
150
150
|
function isLineVisible(line, graph) {
|
|
151
151
|
var _a;
|
|
152
|
-
return (
|
|
152
|
+
return (!query.lines && graph) || ((_a = query.lines) !== null && _a !== void 0 ? _a : '').search(line) !== -1;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
responseManager.setHeader('content-type', 'text/html');
|
|
155
|
+
responseManager.setBody(`
|
|
155
156
|
<script src="//d3js.org/d3.v6.min.js"></script>
|
|
156
157
|
<script src="https://unpkg.com/@hpcc-js/wasm@1.4.1/dist/index.min.js"></script>
|
|
157
158
|
<script src="https://unpkg.com/d3-graphviz@4.0.0/build/d3-graphviz.js"></script>
|
|
@@ -161,14 +162,14 @@ const depsGraph = ({ di }) => {
|
|
|
161
162
|
</div>
|
|
162
163
|
|
|
163
164
|
<h3>Search:</h3>
|
|
164
|
-
<input placeholder="Search module and token names..." value="${
|
|
165
|
+
<input placeholder="Search module and token names..." value="${query.search || ''}" style="padding: 10px 4px; width: 450px" onkeyup="event.keyCode === 13 && applySearch(this.value)" onblur="applySearch(this.value)"/><br/>
|
|
165
166
|
|
|
166
167
|
<h3>Command Lines:</h3>
|
|
167
168
|
${graphs
|
|
168
169
|
.map(([token, graph]) => {
|
|
169
170
|
var _a;
|
|
170
171
|
return `
|
|
171
|
-
<input id="${token}" type="checkbox" ${((_a =
|
|
172
|
+
<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>
|
|
172
173
|
`;
|
|
173
174
|
})
|
|
174
175
|
.join('<br/>')}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-deps-graph",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"build-for-publish": "true"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@tramvai/core": "2.
|
|
23
|
-
"@tramvai/tokens-common": "2.
|
|
24
|
-
"@tramvai/tokens-server": "2.
|
|
25
|
-
"@tramvai/papi": "2.
|
|
26
|
-
"@tinkoff/dippy": "0.8.
|
|
22
|
+
"@tramvai/core": "2.24.3",
|
|
23
|
+
"@tramvai/tokens-common": "2.24.3",
|
|
24
|
+
"@tramvai/tokens-server": "2.24.3",
|
|
25
|
+
"@tramvai/papi": "2.24.3",
|
|
26
|
+
"@tinkoff/dippy": "0.8.3",
|
|
27
27
|
"tslib": "^2.0.3"
|
|
28
28
|
},
|
|
29
29
|
"module": "lib/server.es.js",
|