devlensio 1.2.0 → 1.4.0
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/dist/graph/edges/callEdges.js +77 -3
- package/dist/graph/edges/callEdges.test.js +1 -1
- package/dist/graph/edges/callOrder.test.d.ts +1 -0
- package/dist/graph/edges/callOrder.test.js +227 -0
- package/dist/graph/edges/propEdges.js +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/parser/callFlow.d.ts +15 -0
- package/dist/parser/callFlow.js +302 -0
- package/dist/parser/callOrder.test.d.ts +1 -0
- package/dist/parser/callOrder.test.js +407 -0
- package/dist/parser/extractors/components.js +18 -28
- package/dist/parser/extractors/functions.d.ts +12 -3
- package/dist/parser/extractors/functions.js +58 -36
- package/dist/parser/extractors/moduleScope.js +1 -1
- package/dist/parser/moduleScope.test.js +5 -3
- package/dist/summarizer/index.js +53 -4
- package/dist/summarizer/prompts.js +111 -50
- package/dist/summarizer/prompts.test.d.ts +1 -0
- package/dist/summarizer/prompts.test.js +112 -0
- package/dist/types.d.ts +63 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/extractors/go/bin/darwin-amd64/devlens_go_extractor +0 -0
- package/extractors/go/bin/darwin-arm64/devlens_go_extractor +0 -0
- package/extractors/go/bin/linux-amd64/devlens_go_extractor +0 -0
- package/extractors/go/bin/linux-arm64/devlens_go_extractor +0 -0
- package/extractors/go/bin/windows-amd64/devlens_go_extractor.exe +0 -0
- package/extractors/go/calls.go +89 -10
- package/extractors/go/nodes.go +29 -11
- package/extractors/go/parser.go +311 -21
- package/extractors/java/devlens_java_extractor.jar +0 -0
- package/extractors/java/src/devlens/extractor/Extractor.java +36 -10
- package/extractors/java/src/devlens/extractor/Parser.java +387 -0
- package/extractors/java/src/devlens/extractor/edges/Calls.java +66 -10
- package/extractors/python/devlens_extractors_python/edges/calls.py +26 -3
- package/extractors/python/devlens_extractors_python/parser/__init__.py +4 -3
- package/extractors/python/devlens_extractors_python/parser/functions.py +199 -42
- package/extractors/rust/bin/darwin-amd64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/darwin-arm64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/linux-amd64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/linux-arm64/devlens_rust_extractor +0 -0
- package/extractors/rust/bin/windows-amd64/devlens_rust_extractor.exe +0 -0
- package/extractors/rust/src/calls.rs +82 -8
- package/extractors/rust/src/nodes.rs +29 -0
- package/extractors/rust/src/parser.rs +362 -27
- package/package.json +77 -73
|
@@ -87,6 +87,11 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
87
87
|
const createdLocalEdges = new Set();
|
|
88
88
|
// Accumulate resolved calls per node — written back to metadata after edge loop
|
|
89
89
|
const resolvedCallsMap = new Map();
|
|
90
|
+
// Every ordinal that resolved to one (caller, target, type) key. The edge
|
|
91
|
+
// mirror is optional export data; consumers read resolvedCalls instead.
|
|
92
|
+
// Every ordinal that resolved to one (caller, target), so the NODE can carry
|
|
93
|
+
// the repeat positions itself (resolvedCalls[].orders).
|
|
94
|
+
const resolvedOrders = new Map();
|
|
90
95
|
// Lazily-created method nodes for default/namespace import member-access calls
|
|
91
96
|
const createdMethodNodes = new Map();
|
|
92
97
|
// id → node, for turning resolved export bindings back into candidates
|
|
@@ -134,6 +139,9 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
134
139
|
? callSites
|
|
135
140
|
: (primaryNames ?? []).map((name) => ({ name, argCount: -1 }));
|
|
136
141
|
for (const callSite of primaryCallSites) {
|
|
142
|
+
// Hooks are ordered too, but hookEdges.ts owns their edges.
|
|
143
|
+
if (callSite.kind === "hook")
|
|
144
|
+
continue;
|
|
137
145
|
const calledName = callSite.name;
|
|
138
146
|
// ── Third-party guard ─────────────────────────────────────────
|
|
139
147
|
// The alias map is keyed by node.filePath (relative) and populated
|
|
@@ -178,6 +186,35 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
178
186
|
tpNodeId = methodNodeId;
|
|
179
187
|
}
|
|
180
188
|
const edgeKey = `${node.id}→${tpNodeId}:CALLS`;
|
|
189
|
+
if (callSite.order !== undefined) {
|
|
190
|
+
// Third-party targets are nodes too, so their ordinal lives in
|
|
191
|
+
// resolvedCalls like any other callee (no edge mirror).
|
|
192
|
+
let perTarget = resolvedOrders.get(node.id);
|
|
193
|
+
if (!perTarget) {
|
|
194
|
+
perTarget = new Map();
|
|
195
|
+
resolvedOrders.set(node.id, perTarget);
|
|
196
|
+
}
|
|
197
|
+
const list = perTarget.get(tpNodeId);
|
|
198
|
+
if (list)
|
|
199
|
+
list.push(callSite.order);
|
|
200
|
+
else
|
|
201
|
+
perTarget.set(tpNodeId, [callSite.order]);
|
|
202
|
+
let entries = resolvedCallsMap.get(node.id);
|
|
203
|
+
if (!entries) {
|
|
204
|
+
entries = [];
|
|
205
|
+
resolvedCallsMap.set(node.id, entries);
|
|
206
|
+
}
|
|
207
|
+
if (!entries.some((e) => e.nodeId === tpNodeId)) {
|
|
208
|
+
entries.push({
|
|
209
|
+
name: createdMethodNodes.get(tpNodeId)?.name
|
|
210
|
+
?? nodesById.get(tpNodeId)?.name
|
|
211
|
+
?? calledName,
|
|
212
|
+
nodeId: tpNodeId,
|
|
213
|
+
firstOrder: callSite.order,
|
|
214
|
+
line: callSite.line,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
181
218
|
if (!createdThirdPartyEdges.has(edgeKey)) {
|
|
182
219
|
createdThirdPartyEdges.add(edgeKey);
|
|
183
220
|
edges.push({
|
|
@@ -289,6 +326,18 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
289
326
|
}
|
|
290
327
|
}
|
|
291
328
|
const localEdgeKey = `${node.id}→${target.id}:${edgeType}`;
|
|
329
|
+
if (callSite.order !== undefined) {
|
|
330
|
+
let perTarget = resolvedOrders.get(node.id);
|
|
331
|
+
if (!perTarget) {
|
|
332
|
+
perTarget = new Map();
|
|
333
|
+
resolvedOrders.set(node.id, perTarget);
|
|
334
|
+
}
|
|
335
|
+
const list = perTarget.get(target.id);
|
|
336
|
+
if (list)
|
|
337
|
+
list.push(callSite.order);
|
|
338
|
+
else
|
|
339
|
+
perTarget.set(target.id, [callSite.order]);
|
|
340
|
+
}
|
|
292
341
|
if (createdLocalEdges.has(localEdgeKey))
|
|
293
342
|
continue;
|
|
294
343
|
createdLocalEdges.add(localEdgeKey);
|
|
@@ -313,7 +362,18 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
313
362
|
resolvedCallsMap.set(node.id, []);
|
|
314
363
|
const existing = resolvedCallsMap.get(node.id);
|
|
315
364
|
if (!existing.some(r => r.nodeId === target.id)) {
|
|
316
|
-
existing.push({
|
|
365
|
+
existing.push({
|
|
366
|
+
name: resolvedName,
|
|
367
|
+
nodeId: target.id,
|
|
368
|
+
...(callSite.order !== undefined && { firstOrder: callSite.order }),
|
|
369
|
+
...(callSite.line !== undefined && { line: callSite.line }),
|
|
370
|
+
...(callSite.defer && { defer: callSite.defer }),
|
|
371
|
+
...(callSite.deferDetail && { deferDetail: callSite.deferDetail }),
|
|
372
|
+
...(callSite.awaited && { awaited: true }),
|
|
373
|
+
...(callSite.conc && { conc: true }),
|
|
374
|
+
...(callSite.repeat && { repeat: true }),
|
|
375
|
+
...(callSite.maybe && { maybe: true }),
|
|
376
|
+
});
|
|
317
377
|
}
|
|
318
378
|
}
|
|
319
379
|
// ── Hook / dependency names: third-party edges only ──────────────
|
|
@@ -339,9 +399,23 @@ export function detectCallEdges(nodes, lookupMp) {
|
|
|
339
399
|
}
|
|
340
400
|
}
|
|
341
401
|
}
|
|
342
|
-
// Write resolved calls back onto nodes
|
|
402
|
+
// Write resolved calls back onto nodes. `orders` carries every position that
|
|
403
|
+
// reached a target (only when more than one). Ordering is node metadata only:
|
|
404
|
+
// edges describe structure, never sequence (docs/CALL_ORDER.md §3.2).
|
|
343
405
|
for (const node of nodes) {
|
|
344
|
-
|
|
406
|
+
const entries = resolvedCallsMap.get(node.id) ?? [];
|
|
407
|
+
const perTarget = resolvedOrders.get(node.id);
|
|
408
|
+
if (perTarget) {
|
|
409
|
+
for (const entry of entries) {
|
|
410
|
+
const list = perTarget.get(entry.nodeId);
|
|
411
|
+
if (!list)
|
|
412
|
+
continue;
|
|
413
|
+
const unique = [...new Set(list)].sort((a, b) => a - b);
|
|
414
|
+
if (unique.length > 1)
|
|
415
|
+
entry.orders = unique;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
node.metadata.resolvedCalls = entries;
|
|
345
419
|
}
|
|
346
420
|
return { edges, newThirdPartyNodes: [...createdMethodNodes.values()] };
|
|
347
421
|
}
|
|
@@ -376,7 +376,7 @@ describe("detectCallEdges with module-scope callers", () => {
|
|
|
376
376
|
}));
|
|
377
377
|
const file = all.find((n) => n.id === "file::main.ts");
|
|
378
378
|
expect(file.metadata.resolvedCalls).toEqual([
|
|
379
|
-
{ name: "startAll", nodeId: "lib/startAll.ts::startAll" },
|
|
379
|
+
expect.objectContaining({ name: "startAll", nodeId: "lib/startAll.ts::startAll", firstOrder: 1 }),
|
|
380
380
|
]);
|
|
381
381
|
deleteFakeRepo(repo);
|
|
382
382
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
import { parseRepo } from "../../parser/index.js";
|
|
5
|
+
import { buildLookupMaps } from "../buildLookup.js";
|
|
6
|
+
import { detectImportEdges } from "./importEdges.js";
|
|
7
|
+
import { detectCallEdges } from "./callEdges.js";
|
|
8
|
+
import { detectPropEdges } from "./propEdges.js";
|
|
9
|
+
import { detectHookEdges } from "./hookEdges.js";
|
|
10
|
+
import { buildThirdPartyNodes } from "../thirdPartyLibs.js";
|
|
11
|
+
// callOrder/v1 edge projection. docs/CALL_ORDER.md §3.2.
|
|
12
|
+
function createFakeRepo(files) {
|
|
13
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "devlens-callorder-edge-"));
|
|
14
|
+
for (const [filePath, content] of Object.entries(files)) {
|
|
15
|
+
const fullPath = path.join(tmpDir, filePath);
|
|
16
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
17
|
+
fs.writeFileSync(fullPath, content);
|
|
18
|
+
}
|
|
19
|
+
return tmpDir;
|
|
20
|
+
}
|
|
21
|
+
function deleteFakeRepo(repoPath) {
|
|
22
|
+
fs.rmSync(repoPath, { recursive: true, force: true });
|
|
23
|
+
}
|
|
24
|
+
function detectCalls(repoPath, extraNodes = []) {
|
|
25
|
+
const { nodes } = parseRepo(repoPath);
|
|
26
|
+
const all = [...nodes, ...extraNodes];
|
|
27
|
+
const lookup = buildLookupMaps(all);
|
|
28
|
+
detectImportEdges(lookup, repoPath);
|
|
29
|
+
const result = detectCallEdges(all, lookup);
|
|
30
|
+
return { nodes, edges: result.edges };
|
|
31
|
+
}
|
|
32
|
+
function edgeOf(edges, from, to, type = "CALLS") {
|
|
33
|
+
const found = edges.find((e) => e.from === from && e.to === to && e.type === type);
|
|
34
|
+
if (!found)
|
|
35
|
+
throw new Error(`edge not found: ${from} -> ${to} (${type})`);
|
|
36
|
+
return found;
|
|
37
|
+
}
|
|
38
|
+
function nodeOf(nodes, name) {
|
|
39
|
+
const found = nodes.find((n) => n.name === name);
|
|
40
|
+
if (!found)
|
|
41
|
+
throw new Error(`node not found: ${name}`);
|
|
42
|
+
return found;
|
|
43
|
+
}
|
|
44
|
+
describe("callOrder edges — CALLS", () => {
|
|
45
|
+
it("keeps the first position and every repeated position on the node, not the edge", () => {
|
|
46
|
+
const repo = createFakeRepo({
|
|
47
|
+
"main.ts": `
|
|
48
|
+
function a() {}
|
|
49
|
+
function b() {}
|
|
50
|
+
function run() { a(); b(); a(); }
|
|
51
|
+
`,
|
|
52
|
+
});
|
|
53
|
+
const { nodes, edges } = detectCalls(repo);
|
|
54
|
+
const run = nodeOf(nodes, "run");
|
|
55
|
+
const a = nodeOf(nodes, "a");
|
|
56
|
+
const b = nodeOf(nodes, "b");
|
|
57
|
+
const rc = (run.metadata.resolvedCalls ?? []);
|
|
58
|
+
expect(rc.find((r) => r.nodeId === a.id)).toMatchObject({ firstOrder: 1, orders: [1, 3] });
|
|
59
|
+
expect(rc.find((r) => r.nodeId === b.id)).toMatchObject({ firstOrder: 2 });
|
|
60
|
+
expect(rc.find((r) => r.nodeId === b.id)?.orders).toBeUndefined();
|
|
61
|
+
// The edge is structure only.
|
|
62
|
+
expect(edgeOf(edges, run.id, a.id).metadata).not.toHaveProperty("firstCallOrder");
|
|
63
|
+
deleteFakeRepo(repo);
|
|
64
|
+
});
|
|
65
|
+
it("still emits exactly one edge per target", () => {
|
|
66
|
+
const repo = createFakeRepo({
|
|
67
|
+
"main.ts": `
|
|
68
|
+
function a() {}
|
|
69
|
+
function run() { a(); a(); a(); }
|
|
70
|
+
`,
|
|
71
|
+
});
|
|
72
|
+
const { edges } = detectCalls(repo);
|
|
73
|
+
expect(edges.filter((e) => e.type === "CALLS")).toHaveLength(1);
|
|
74
|
+
deleteFakeRepo(repo);
|
|
75
|
+
});
|
|
76
|
+
it("mirrors the position into resolvedCalls with the call-site line", () => {
|
|
77
|
+
const repo = createFakeRepo({
|
|
78
|
+
"main.ts": `
|
|
79
|
+
function a() {}
|
|
80
|
+
function run() {
|
|
81
|
+
a();
|
|
82
|
+
}
|
|
83
|
+
`,
|
|
84
|
+
});
|
|
85
|
+
const { nodes } = detectCalls(repo);
|
|
86
|
+
const run = nodeOf(nodes, "run");
|
|
87
|
+
expect(run.metadata.resolvedCalls).toEqual([
|
|
88
|
+
expect.objectContaining({ name: "a", firstOrder: 1, line: 4 }),
|
|
89
|
+
]);
|
|
90
|
+
deleteFakeRepo(repo);
|
|
91
|
+
});
|
|
92
|
+
it("numbers third-party calls in the same sequence", () => {
|
|
93
|
+
const repo = createFakeRepo({
|
|
94
|
+
"main.ts": `
|
|
95
|
+
import axios from "axios";
|
|
96
|
+
declare function local(): void;
|
|
97
|
+
function run() { local(); axios.get("/x"); }
|
|
98
|
+
`,
|
|
99
|
+
});
|
|
100
|
+
const extra = buildThirdPartyNodes(repo, ["axios"]);
|
|
101
|
+
const { nodes, edges } = detectCalls(repo, extra);
|
|
102
|
+
const run = nodeOf(nodes, "run");
|
|
103
|
+
const thirdParty = edges.find((e) => e.from === run.id && e.to.endsWith("axios::get"));
|
|
104
|
+
expect(thirdParty).toBeDefined();
|
|
105
|
+
expect(thirdParty?.metadata).not.toHaveProperty("firstCallOrder");
|
|
106
|
+
const rc = (run.metadata.resolvedCalls ?? []);
|
|
107
|
+
expect(rc.find((r) => r.nodeId === thirdParty.to)?.firstOrder).toBe(2);
|
|
108
|
+
deleteFakeRepo(repo);
|
|
109
|
+
});
|
|
110
|
+
it("leaves structure-only callers without an order", () => {
|
|
111
|
+
const nodes = [
|
|
112
|
+
{
|
|
113
|
+
id: "f.ts::a",
|
|
114
|
+
name: "a",
|
|
115
|
+
type: "FUNCTION",
|
|
116
|
+
filePath: "f.ts",
|
|
117
|
+
startLine: 1,
|
|
118
|
+
endLine: 1,
|
|
119
|
+
metadata: {},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "f.ts::run",
|
|
123
|
+
name: "run",
|
|
124
|
+
type: "FUNCTION",
|
|
125
|
+
filePath: "f.ts",
|
|
126
|
+
startLine: 2,
|
|
127
|
+
endLine: 2,
|
|
128
|
+
metadata: { calls: ["a"] },
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
const lookup = buildLookupMaps(nodes);
|
|
132
|
+
const { edges } = detectCallEdges(nodes, lookup);
|
|
133
|
+
expect(edges).toHaveLength(1);
|
|
134
|
+
expect(edges[0].metadata?.firstCallOrder).toBeUndefined();
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe("callOrder edges — hooks and components", () => {
|
|
138
|
+
it("numbers hook CALLS edges", () => {
|
|
139
|
+
const repo = createFakeRepo({
|
|
140
|
+
"main.tsx": `
|
|
141
|
+
import { useState } from "react";
|
|
142
|
+
function useTheme() { return "dark"; }
|
|
143
|
+
function Panel() {
|
|
144
|
+
const [v] = useState(0);
|
|
145
|
+
const t = useTheme();
|
|
146
|
+
return <div>{v}{t}</div>;
|
|
147
|
+
}
|
|
148
|
+
`,
|
|
149
|
+
});
|
|
150
|
+
const { nodes } = parseRepo(repo);
|
|
151
|
+
const edges = detectHookEdges(nodes, buildLookupMaps(nodes));
|
|
152
|
+
const panel = nodeOf(nodes, "Panel");
|
|
153
|
+
const theme = nodeOf(nodes, "useTheme");
|
|
154
|
+
const hookEdge = edgeOf(edges, panel.id, theme.id);
|
|
155
|
+
expect(hookEdge.metadata).toMatchObject({ isHookCall: true });
|
|
156
|
+
// The ordinal lives on the caller's callSites, never on the edge.
|
|
157
|
+
expect(hookEdge.metadata).not.toHaveProperty("firstCallOrder");
|
|
158
|
+
const site = panel.metadata.callSites.find((c) => c.name === "useTheme");
|
|
159
|
+
expect(site.order).toBe(2);
|
|
160
|
+
deleteFakeRepo(repo);
|
|
161
|
+
});
|
|
162
|
+
it("numbers USES edges from components", () => {
|
|
163
|
+
const repo = createFakeRepo({
|
|
164
|
+
"main.tsx": `
|
|
165
|
+
declare function formatName(v: string): string;
|
|
166
|
+
function Card({ name }: { name: string }) {
|
|
167
|
+
return <span>{formatName(name)}</span>;
|
|
168
|
+
}
|
|
169
|
+
`,
|
|
170
|
+
});
|
|
171
|
+
const { nodes, edges } = detectCalls(repo);
|
|
172
|
+
const card = nodeOf(nodes, "Card");
|
|
173
|
+
const formatName = nodes.find((n) => n.name === "formatName");
|
|
174
|
+
if (formatName) {
|
|
175
|
+
const uses = edgeOf(edges, card.id, formatName.id, "USES");
|
|
176
|
+
expect(uses.metadata).not.toHaveProperty("firstCallOrder");
|
|
177
|
+
expect(uses.metadata).not.toHaveProperty("callOrder");
|
|
178
|
+
const rc = (card.metadata.resolvedCalls ?? []);
|
|
179
|
+
expect(rc.find((r) => r.nodeId === formatName.id)?.firstOrder).toBe(1);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
expect(card.metadata.uses).toEqual(["formatName"]);
|
|
183
|
+
}
|
|
184
|
+
deleteFakeRepo(repo);
|
|
185
|
+
});
|
|
186
|
+
it("numbers PROP_PASS render order, including repeats", () => {
|
|
187
|
+
const repo = createFakeRepo({
|
|
188
|
+
"main.tsx": `
|
|
189
|
+
function Item({ v }: { v: number }) { return <li>{v}</li>; }
|
|
190
|
+
function List() { return <ul><Item v={1} /><Item v={2} /></ul>; }
|
|
191
|
+
`,
|
|
192
|
+
});
|
|
193
|
+
const { nodes } = parseRepo(repo);
|
|
194
|
+
const edges = detectPropEdges(nodes, buildLookupMaps(nodes), repo);
|
|
195
|
+
const list = nodeOf(nodes, "List");
|
|
196
|
+
const item = nodeOf(nodes, "Item");
|
|
197
|
+
const edge = edgeOf(edges, list.id, item.id, "PROP_PASS");
|
|
198
|
+
expect(edge.metadata).toMatchObject({ renderCount: 2 });
|
|
199
|
+
deleteFakeRepo(repo);
|
|
200
|
+
});
|
|
201
|
+
// Guard: ordering is node metadata only. If this fails, someone re-added the
|
|
202
|
+
// denormalised edge mirror that the cloud had to strip at ingest.
|
|
203
|
+
it("writes no ordering keys into any edge metadata", () => {
|
|
204
|
+
const repo = createFakeRepo({
|
|
205
|
+
"main.tsx": `
|
|
206
|
+
function Item({ v }: { v: number }) { return <li>{v}</li>; }
|
|
207
|
+
function List() { return <ul><Item v={1} /><Item v={2} /></ul>; }
|
|
208
|
+
declare function formatName(v: string): string;
|
|
209
|
+
function Page({ name }: { name: string }) {
|
|
210
|
+
return <span>{formatName(name)}<List /></span>;
|
|
211
|
+
}
|
|
212
|
+
`,
|
|
213
|
+
});
|
|
214
|
+
const { nodes, edges } = detectCalls(repo);
|
|
215
|
+
const FORBIDDEN = ["firstCallOrder", "callOrder", "firstRenderOrder", "renderOrders"];
|
|
216
|
+
for (const edge of edges) {
|
|
217
|
+
for (const key of FORBIDDEN) {
|
|
218
|
+
expect(edge.metadata ?? {}).not.toHaveProperty(key);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// ...while the ordinal is still available on the caller.
|
|
222
|
+
const page = nodeOf(nodes, "Page");
|
|
223
|
+
const rc = (page.metadata.resolvedCalls ?? []);
|
|
224
|
+
expect(rc.find((r) => r.name === "formatName")?.firstOrder).toBe(1);
|
|
225
|
+
deleteFakeRepo(repo);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
@@ -60,12 +60,17 @@ export function detectPropEdges(nodes, lookupMp, repoPath) {
|
|
|
60
60
|
const jsxOpeningElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement);
|
|
61
61
|
const jsxSelfClosingElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);
|
|
62
62
|
// Filter to only JSX within this component's line range (meaning which lies between this component's startLine and endLine)
|
|
63
|
+
// Sorted by source position: JSX document order is render order for the
|
|
64
|
+
// element tree the component returns.
|
|
63
65
|
const allJsxElements = [...jsxOpeningElements, ...jsxSelfClosingElements]
|
|
64
66
|
.filter(el => {
|
|
65
67
|
const line = el.getStartLineNumber();
|
|
66
68
|
return line >= component.startLine && line <= component.endLine;
|
|
67
|
-
})
|
|
69
|
+
})
|
|
70
|
+
.sort((a, b) => a.getStart() - b.getStart());
|
|
71
|
+
let renderOrder = 0;
|
|
68
72
|
for (const jsxElement of allJsxElements) {
|
|
73
|
+
renderOrder++;
|
|
69
74
|
const tagName = jsxElement.getTagNameNode().getText();
|
|
70
75
|
// Skip HTML native elements — they start with lowercase
|
|
71
76
|
if (/^[a-z]/.test(tagName))
|
package/dist/index.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export { loadCatalog, findProvider, saveProvider, removeProvider, resetUserCatal
|
|
|
23
23
|
export type { CatalogProvider, CatalogProviderInput } from "./config/providers/catalog.js";
|
|
24
24
|
export { listModels } from "./summarizer/providers/models.js";
|
|
25
25
|
export type { ListModelsOpts } from "./summarizer/providers/models.js";
|
|
26
|
+
export { engineVersion } from "./version.js";
|
package/dist/index.js
CHANGED
|
@@ -25,3 +25,4 @@ export { buildGraphIndex, getBlastRadius, getKHop, getSubgraph, findCycles, } fr
|
|
|
25
25
|
export { loadCatalog, findProvider, saveProvider, removeProvider, resetUserCatalog, listUserProviders, } from "./config/providers/catalog.js";
|
|
26
26
|
// Dynamic model discovery (consumed by DevLens OSS CLI)
|
|
27
27
|
export { listModels } from "./summarizer/providers/models.js";
|
|
28
|
+
export { engineVersion } from "./version.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Node } from "ts-morph";
|
|
2
|
+
import type { CallScope, DeferKind } from "../types.js";
|
|
3
|
+
export interface CallAnnotations {
|
|
4
|
+
col: number;
|
|
5
|
+
scope: CallScope;
|
|
6
|
+
nested?: number;
|
|
7
|
+
awaited?: boolean;
|
|
8
|
+
defer?: DeferKind;
|
|
9
|
+
deferDetail?: string;
|
|
10
|
+
conc?: boolean;
|
|
11
|
+
repeat?: boolean;
|
|
12
|
+
maybe?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function isIifeCallee(callee: Node): boolean;
|
|
15
|
+
export declare function annotateCall(call: Node, owner: Node, isFileOwner: boolean, ordinals: Map<Node, number>): CallAnnotations;
|