@mishasinitcyn/betterrank 0.1.6 → 0.1.8
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/package.json +1 -1
- package/src/cache.js +85 -20
- package/src/cli.js +221 -8
- package/src/index.js +137 -14
- package/src/server.js +11 -0
- package/src/ui.html +652 -28
package/src/server.js
CHANGED
|
@@ -139,10 +139,12 @@ const routes = {
|
|
|
139
139
|
const p = params(req.url);
|
|
140
140
|
const focus = p.get('focus', '');
|
|
141
141
|
const focusFiles = focus ? focus.split(',') : [];
|
|
142
|
+
const format = p.get('format', 'text');
|
|
142
143
|
const result = await currentIndex.map({
|
|
143
144
|
focusFiles,
|
|
144
145
|
offset: p.getInt('offset', undefined),
|
|
145
146
|
limit: p.getInt('limit', 50),
|
|
147
|
+
structured: format === 'structured',
|
|
146
148
|
});
|
|
147
149
|
json(res, result);
|
|
148
150
|
},
|
|
@@ -246,6 +248,15 @@ const routes = {
|
|
|
246
248
|
json(res, result);
|
|
247
249
|
},
|
|
248
250
|
|
|
251
|
+
'GET /api/graph': async (req, res) => {
|
|
252
|
+
if (!requireIndex(res)) return;
|
|
253
|
+
const p = params(req.url);
|
|
254
|
+
const result = await currentIndex.graph({
|
|
255
|
+
limit: p.getInt('limit', 500),
|
|
256
|
+
});
|
|
257
|
+
json(res, result);
|
|
258
|
+
},
|
|
259
|
+
|
|
249
260
|
'GET /api/structure': async (req, res) => {
|
|
250
261
|
if (!requireIndex(res)) return;
|
|
251
262
|
const p = params(req.url);
|