scip-query 0.4.2 → 0.4.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.
Files changed (137) hide show
  1. package/dist/{chunk-JHVQB4Y5.js → chunk-334PCFO3.js} +12 -12
  2. package/dist/{chunk-OXX3QF24.js → chunk-46ZTW4AI.js} +2 -2
  3. package/dist/{chunk-24LF6IZB.js → chunk-4YN3PE57.js} +3 -3
  4. package/dist/{chunk-3NJSJ7TE.js → chunk-5YB6UXQ3.js} +4 -15
  5. package/dist/{chunk-Z5VSUOEE.js → chunk-6PVHJ332.js} +2 -2
  6. package/dist/{chunk-EAGKJFDX.js → chunk-7KGTWDAX.js} +3 -3
  7. package/dist/{chunk-PU2254N2.js → chunk-7OGXSMLY.js} +5 -15
  8. package/dist/{chunk-R7HPHMRZ.js → chunk-AEBM56CO.js} +3 -3
  9. package/dist/{chunk-SYQR4QGK.js → chunk-B747RITP.js} +3 -3
  10. package/dist/{chunk-A6XLXV6W.js → chunk-B7LDMCUS.js} +3 -3
  11. package/dist/{chunk-KLNKDX6A.js → chunk-C2VSV54P.js} +4 -4
  12. package/dist/{chunk-VKBOLNYN.js → chunk-DIYEUFVP.js} +10 -8
  13. package/dist/{chunk-RE7POFGI.js → chunk-E74RY6AQ.js} +2 -2
  14. package/dist/{chunk-RL74LF47.js → chunk-FIMTTUGE.js} +2 -2
  15. package/dist/{chunk-ALUFWH3U.js → chunk-FMAYH7GS.js} +116 -269
  16. package/dist/{chunk-MGNMHKX3.js → chunk-FO2CBB7U.js} +10 -2
  17. package/dist/{chunk-7BS4CPJX.js → chunk-HESWGDIV.js} +3 -3
  18. package/dist/{chunk-FVJE4MQL.js → chunk-HL2LXSBW.js} +5 -8
  19. package/dist/{chunk-KG4OFQEN.js → chunk-HW76DVE4.js} +3 -3
  20. package/dist/{chunk-RJ5GULL6.js → chunk-IC5NTO47.js} +2 -2
  21. package/dist/{chunk-VY2L4TP6.js → chunk-J34HAAEQ.js} +3 -3
  22. package/dist/{chunk-PCU455MX.js → chunk-JSXGC2EH.js} +2 -2
  23. package/dist/{chunk-NXUIWD6K.js → chunk-LQXBFCP2.js} +3 -3
  24. package/dist/{chunk-GNAMV3JC.js → chunk-NML6M5AS.js} +3 -3
  25. package/dist/{chunk-UJWI5CBB.js → chunk-NNFP4ZRF.js} +4 -7
  26. package/dist/{chunk-6ECR2FLR.js → chunk-NWXTQGUE.js} +4 -15
  27. package/dist/{chunk-ZVZAIIB5.js → chunk-NYZ6INK3.js} +3 -3
  28. package/dist/{chunk-JKXHHV4B.js → chunk-OMVF3BHY.js} +2 -2
  29. package/dist/{chunk-CBIWNZZZ.js → chunk-PGQXIAJF.js} +3 -3
  30. package/dist/{chunk-J47VSL6I.js → chunk-PKDFXASW.js} +3 -3
  31. package/dist/{chunk-POLELLNM.js → chunk-PSK5BPFE.js} +3 -3
  32. package/dist/{chunk-6CH23IAS.js → chunk-QZ4FRB65.js} +9 -7
  33. package/dist/{chunk-TWVXFKJA.js → chunk-R2QBMQQN.js} +4 -4
  34. package/dist/{chunk-5GCORUNV.js → chunk-T3ALCNCP.js} +30 -17
  35. package/dist/{chunk-QMXSLHZP.js → chunk-T6UVM534.js} +2 -2
  36. package/dist/{chunk-6UZU7DFL.js → chunk-U74VYTLX.js} +3 -3
  37. package/dist/{chunk-XUVPQDXW.js → chunk-UIRCHPOU.js} +4 -4
  38. package/dist/{chunk-43A4UCS7.js → chunk-UNS6ZQVX.js} +3 -3
  39. package/dist/{chunk-J6QXMYAQ.js → chunk-VJMTX3OR.js} +3 -3
  40. package/dist/{chunk-SVLUJSY7.js → chunk-XJSPWHNT.js} +4 -15
  41. package/dist/{chunk-W46L2BXT.js → chunk-XMZAC2VU.js} +2 -2
  42. package/dist/{chunk-ELFGD5EW.js → chunk-Y7FKURZG.js} +3 -3
  43. package/dist/{chunk-TO3L4YNK.js → chunk-YMSJCSRG.js} +5 -1
  44. package/dist/{chunk-DUJNJQPO.js → chunk-YQIWS5V6.js} +3 -3
  45. package/dist/{chunk-KYPXKV64.js → chunk-ZPEI7DRJ.js} +30 -15
  46. package/dist/cli.js +200 -373
  47. package/dist/{db-C4rPbKkI.d.ts → db-6F9R9e_t.d.ts} +0 -4
  48. package/dist/index.d.ts +2 -4
  49. package/dist/index.js +45 -57
  50. package/dist/queries/affected.d.ts +1 -1
  51. package/dist/queries/affected.js +3 -3
  52. package/dist/queries/bottlenecks.d.ts +1 -1
  53. package/dist/queries/bottlenecks.js +3 -3
  54. package/dist/queries/by-kind.d.ts +1 -1
  55. package/dist/queries/by-kind.js +3 -3
  56. package/dist/queries/call-graph.d.ts +1 -1
  57. package/dist/queries/call-graph.js +3 -3
  58. package/dist/queries/change-surface.d.ts +1 -1
  59. package/dist/queries/change-surface.js +3 -3
  60. package/dist/queries/code.d.ts +1 -1
  61. package/dist/queries/code.js +3 -3
  62. package/dist/queries/complexity-hotspots.d.ts +1 -1
  63. package/dist/queries/complexity-hotspots.js +3 -3
  64. package/dist/queries/complexity.d.ts +1 -1
  65. package/dist/queries/complexity.js +3 -3
  66. package/dist/queries/convergence.d.ts +1 -1
  67. package/dist/queries/convergence.js +3 -3
  68. package/dist/queries/coupling.d.ts +1 -1
  69. package/dist/queries/coupling.js +3 -3
  70. package/dist/queries/cycles.d.ts +1 -1
  71. package/dist/queries/cycles.js +3 -3
  72. package/dist/queries/dataflow.d.ts +1 -1
  73. package/dist/queries/dataflow.js +3 -3
  74. package/dist/queries/dead.d.ts +1 -1
  75. package/dist/queries/dead.js +4 -4
  76. package/dist/queries/deep-chains.d.ts +1 -1
  77. package/dist/queries/deep-chains.js +3 -3
  78. package/dist/queries/deps.d.ts +1 -1
  79. package/dist/queries/deps.js +3 -3
  80. package/dist/queries/diff-impact.d.ts +1 -1
  81. package/dist/queries/diff-impact.js +2 -2
  82. package/dist/queries/drift.d.ts +1 -1
  83. package/dist/queries/drift.js +3 -3
  84. package/dist/queries/extract-candidates.d.ts +1 -1
  85. package/dist/queries/extract-candidates.js +3 -3
  86. package/dist/queries/fan.d.ts +1 -1
  87. package/dist/queries/fan.js +3 -3
  88. package/dist/queries/files.d.ts +1 -1
  89. package/dist/queries/files.js +1 -1
  90. package/dist/queries/health.d.ts +1 -1
  91. package/dist/queries/health.js +14 -14
  92. package/dist/queries/hierarchy.d.ts +1 -1
  93. package/dist/queries/hierarchy.js +3 -3
  94. package/dist/queries/hotspots.d.ts +1 -1
  95. package/dist/queries/hotspots.js +3 -3
  96. package/dist/queries/imports.d.ts +1 -1
  97. package/dist/queries/imports.js +3 -3
  98. package/dist/queries/index.d.ts +1 -1
  99. package/dist/queries/index.js +45 -45
  100. package/dist/queries/isolated.d.ts +1 -1
  101. package/dist/queries/isolated.js +4 -4
  102. package/dist/queries/members.d.ts +1 -1
  103. package/dist/queries/members.js +3 -3
  104. package/dist/queries/methods.d.ts +1 -1
  105. package/dist/queries/methods.js +3 -3
  106. package/dist/queries/outline.d.ts +1 -1
  107. package/dist/queries/outline.js +3 -3
  108. package/dist/queries/passthrough-candidates.d.ts +1 -1
  109. package/dist/queries/passthrough-candidates.js +3 -3
  110. package/dist/queries/redundant-reexports.d.ts +1 -1
  111. package/dist/queries/redundant-reexports.js +4 -4
  112. package/dist/queries/refs.d.ts +1 -1
  113. package/dist/queries/refs.js +3 -3
  114. package/dist/queries/similar-chains.d.ts +1 -1
  115. package/dist/queries/similar-chains.js +3 -3
  116. package/dist/queries/similar-files.d.ts +1 -1
  117. package/dist/queries/similar-files.js +3 -3
  118. package/dist/queries/similar-signatures.d.ts +1 -1
  119. package/dist/queries/similar-signatures.js +3 -3
  120. package/dist/queries/similar.d.ts +2 -1
  121. package/dist/queries/similar.js +3 -3
  122. package/dist/queries/slice.d.ts +4 -3
  123. package/dist/queries/slice.js +3 -3
  124. package/dist/queries/stale-abstractions.d.ts +1 -1
  125. package/dist/queries/stale-abstractions.js +3 -3
  126. package/dist/queries/stats.d.ts +1 -1
  127. package/dist/queries/surface.d.ts +1 -1
  128. package/dist/queries/surface.js +3 -3
  129. package/dist/queries/symbols.d.ts +1 -1
  130. package/dist/queries/symbols.js +3 -3
  131. package/dist/queries/system.d.ts +1 -1
  132. package/dist/queries/system.js +3 -3
  133. package/dist/queries/trace.d.ts +1 -1
  134. package/dist/queries/trace.js +3 -3
  135. package/dist/queries/wrapper-candidates.d.ts +1 -1
  136. package/dist/queries/wrapper-candidates.js +3 -3
  137. package/package.json +1 -1
@@ -5,7 +5,7 @@ import {
5
5
  leafSuffix,
6
6
  parseSymbol,
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/source-analysis.ts
11
11
  import {
@@ -1054,44 +1054,55 @@ function getCachedMap(cache, db) {
1054
1054
  function normalizePath(path) {
1055
1055
  return path.replace(/\\/g, "/");
1056
1056
  }
1057
+ var LANGUAGE_EXTENSION_FAMILIES = [
1058
+ SOURCE_EXTENSIONS,
1059
+ PYTHON_SOURCE_EXTENSIONS,
1060
+ JVM_SOURCE_EXTENSIONS,
1061
+ RUST_SOURCE_EXTENSIONS,
1062
+ RUBY_SOURCE_EXTENSIONS,
1063
+ C_LIKE_SOURCE_EXTENSIONS,
1064
+ DOTNET_SOURCE_EXTENSIONS,
1065
+ DART_SOURCE_EXTENSIONS,
1066
+ PHP_SOURCE_EXTENSIONS
1067
+ ];
1068
+ function hasExtensionIn(relativePath, extensions) {
1069
+ return extensions.includes(extname(relativePath).toLowerCase());
1070
+ }
1057
1071
  function isJavaScriptSourcePath(relativePath) {
1058
- return SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1072
+ return hasExtensionIn(relativePath, SOURCE_EXTENSIONS);
1059
1073
  }
1060
1074
  function isPythonSourcePath(relativePath) {
1061
- return PYTHON_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1075
+ return hasExtensionIn(relativePath, PYTHON_SOURCE_EXTENSIONS);
1062
1076
  }
1063
1077
  function isJvmSourcePath(relativePath) {
1064
- return JVM_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1078
+ return hasExtensionIn(relativePath, JVM_SOURCE_EXTENSIONS);
1065
1079
  }
1066
1080
  function isRustSourcePath(relativePath) {
1067
- return RUST_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1081
+ return hasExtensionIn(relativePath, RUST_SOURCE_EXTENSIONS);
1068
1082
  }
1069
1083
  function isRubySourcePath(relativePath) {
1070
- return RUBY_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1084
+ return hasExtensionIn(relativePath, RUBY_SOURCE_EXTENSIONS);
1071
1085
  }
1072
1086
  function isCLikeSourcePath(relativePath) {
1073
- return C_LIKE_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1087
+ return hasExtensionIn(relativePath, C_LIKE_SOURCE_EXTENSIONS);
1074
1088
  }
1075
1089
  function isDotNetSourcePath(relativePath) {
1076
- return DOTNET_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1090
+ return hasExtensionIn(relativePath, DOTNET_SOURCE_EXTENSIONS);
1077
1091
  }
1078
1092
  function isVisualBasicSourcePath(relativePath) {
1079
1093
  return extname(relativePath).toLowerCase() === ".vb";
1080
1094
  }
1081
1095
  function isDartSourcePath(relativePath) {
1082
- return DART_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1096
+ return hasExtensionIn(relativePath, DART_SOURCE_EXTENSIONS);
1083
1097
  }
1084
1098
  function isPhpSourcePath(relativePath) {
1085
- return PHP_SOURCE_EXTENSIONS.includes(extname(relativePath).toLowerCase());
1099
+ return hasExtensionIn(relativePath, PHP_SOURCE_EXTENSIONS);
1086
1100
  }
1087
1101
  function extensionFamilyFor(relativePath) {
1088
- if (isJvmSourcePath(relativePath)) return JVM_SOURCE_EXTENSIONS;
1089
- if (isDotNetSourcePath(relativePath)) return DOTNET_SOURCE_EXTENSIONS;
1090
- if (isPhpSourcePath(relativePath)) return PHP_SOURCE_EXTENSIONS;
1091
- if (isDartSourcePath(relativePath)) return DART_SOURCE_EXTENSIONS;
1092
- if (isCLikeSourcePath(relativePath)) return C_LIKE_SOURCE_EXTENSIONS;
1093
- if (isRustSourcePath(relativePath)) return RUST_SOURCE_EXTENSIONS;
1094
- if (isRubySourcePath(relativePath)) return RUBY_SOURCE_EXTENSIONS;
1102
+ const ext = extname(relativePath).toLowerCase();
1103
+ for (const family of LANGUAGE_EXTENSION_FAMILIES) {
1104
+ if (family.includes(ext)) return family;
1105
+ }
1095
1106
  return SOURCE_EXTENSIONS;
1096
1107
  }
1097
1108
  function getSourceText(db, relativePath) {
@@ -1548,56 +1559,41 @@ function findEnclosingDefinition(definitions, line) {
1548
1559
  }
1549
1560
  return best;
1550
1561
  }
1551
- function getPythonSourceCalleeRows(db, symbol, limit) {
1552
- const match = getFullSymbolMatch(db, symbol);
1553
- if (!match || !isPythonDocument(db, match.relativePath)) {
1554
- return [];
1555
- }
1556
- const definitions = getDefinitionsForFile(db, match.relativePath);
1557
- const current = definitions.find((definition) => definition.symbolId === match.symbolId);
1558
- if (!current) {
1559
- return [];
1560
- }
1561
- const imports = getSourceImports(db, match.relativePath);
1562
- const bindings = new Map(
1563
- getSourceConstructorBindings(db, match.relativePath, {
1564
- startLine: match.startLine,
1565
- endLine: match.endLine
1566
- }).map((binding) => [binding.localName, binding.typeName])
1567
- );
1568
- const rows = [];
1569
- const seen = /* @__PURE__ */ new Set();
1570
- for (const call of getSourceCalls(db, match.relativePath, {
1571
- startLine: match.startLine,
1572
- endLine: match.endLine
1573
- })) {
1574
- const resolved = resolvePythonCallTarget(
1575
- db,
1576
- current,
1577
- definitions,
1578
- imports,
1579
- bindings,
1580
- call.receiverName,
1581
- call.calleeName
1582
- );
1583
- if (!resolved || resolved.symbolId === match.symbolId || db.isIgnored(resolved.relativePath)) continue;
1584
- const chunkId = 1e9 + call.line;
1585
- const key = `${resolved.symbol}|${resolved.relativePath}|${chunkId}`;
1586
- if (seen.has(key)) continue;
1587
- seen.add(key);
1588
- rows.push({
1589
- symbol: resolved.symbol,
1590
- file: resolved.relativePath,
1591
- chunkId
1592
- });
1593
- }
1594
- return applyLimit(rows, limit);
1595
- }
1596
- function getJavaScriptSourceCalleeRows(db, symbol, limit) {
1597
- const match = getFullSymbolMatch(db, symbol);
1598
- if (!match || !isJavaScriptDocument(db, match.relativePath)) {
1599
- return [];
1600
- }
1562
+ var LANGUAGE_CALLEE_CONFIGS = [
1563
+ // Python (index 0) — complex resolver
1564
+ { kind: "complex", languageIndex: 0, resolver: resolvePythonCallTarget },
1565
+ // JavaScript/TypeScript (index 1) — complex resolver
1566
+ { kind: "complex", languageIndex: 1, resolver: resolveJavaScriptCallTarget },
1567
+ // Java (index 2) — simple with field bindings
1568
+ { kind: "simple", languageIndex: 2, parseBindings: (_db, source) => parseJavaFieldBindings(source) },
1569
+ // Kotlin (index 3) — simple with field bindings
1570
+ { kind: "simple", languageIndex: 3, parseBindings: (_db, source) => parseKotlinFieldBindings(source) },
1571
+ // Scala (index 4) — simple, no bindings
1572
+ { kind: "simple", languageIndex: 4, parseBindings: null },
1573
+ // C# (index 5) — simple, no bindings
1574
+ { kind: "simple", languageIndex: 5, parseBindings: null },
1575
+ // Visual Basic (index 6) — simple, no bindings
1576
+ { kind: "simple", languageIndex: 6, parseBindings: null },
1577
+ // C++ (index 7) simple with receiver bindings
1578
+ { kind: "simple", languageIndex: 7, parseBindings: (_db, source) => parseCppReceiverBindings(source) },
1579
+ // Rust (index 8) — simple, no bindings
1580
+ { kind: "simple", languageIndex: 8, parseBindings: null },
1581
+ // Ruby (index 9) simple with dual-attempt logic
1582
+ {
1583
+ kind: "simple",
1584
+ languageIndex: 9,
1585
+ parseBindings: (db, source) => parseRubyReceiverBindings(db, source),
1586
+ dualAttempt: {
1587
+ baseOpts: { allowInstanceVariables: true },
1588
+ extendedOpts: { allowInstanceVariables: true, allowBareMemberCalls: true }
1589
+ }
1590
+ },
1591
+ // Dart (index 10) — simple, no bindings
1592
+ { kind: "simple", languageIndex: 10, parseBindings: null },
1593
+ // PHP (index 11) — simple, no bindings
1594
+ { kind: "simple", languageIndex: 11, parseBindings: null }
1595
+ ];
1596
+ function getComplexSourceCalleeRows(db, match, config, limit) {
1601
1597
  const definitions = getDefinitionsForFile(db, match.relativePath);
1602
1598
  const current = definitions.find((definition) => definition.symbolId === match.symbolId);
1603
1599
  if (!current) {
@@ -1616,7 +1612,7 @@ function getJavaScriptSourceCalleeRows(db, symbol, limit) {
1616
1612
  startLine: match.startLine,
1617
1613
  endLine: match.endLine
1618
1614
  })) {
1619
- const resolved = resolveJavaScriptCallTarget(
1615
+ const resolved = config.resolver(
1620
1616
  db,
1621
1617
  current,
1622
1618
  definitions,
@@ -1638,134 +1634,31 @@ function getJavaScriptSourceCalleeRows(db, symbol, limit) {
1638
1634
  }
1639
1635
  return applyLimit(rows, limit);
1640
1636
  }
1641
- function getJavaSourceCalleeRows(db, symbol, limit) {
1642
- const match = getFullSymbolMatch(db, symbol);
1643
- if (!match || !isJavaDocument(db, match.relativePath)) {
1644
- return [];
1645
- }
1646
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1647
- const bindings = parseJavaFieldBindings(getSourceText(db, match.relativePath));
1648
- return resolveSimpleSourceCallees(db, match, calls, bindings, limit);
1649
- }
1650
- function getKotlinSourceCalleeRows(db, symbol, limit) {
1651
- const match = getFullSymbolMatch(db, symbol);
1652
- if (!match || !isKotlinDocument(db, match.relativePath)) {
1653
- return [];
1654
- }
1655
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1656
- const bindings = parseKotlinFieldBindings(getSourceText(db, match.relativePath));
1657
- return resolveSimpleSourceCallees(db, match, calls, bindings, limit);
1658
- }
1659
- function getScalaSourceCalleeRows(db, symbol, limit) {
1660
- const match = getFullSymbolMatch(db, symbol);
1661
- if (!match || !isScalaDocument(db, match.relativePath)) {
1662
- return [];
1663
- }
1664
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1665
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1666
- }
1667
- function getCSharpSourceCalleeRows(db, symbol, limit) {
1668
- const match = getFullSymbolMatch(db, symbol);
1669
- if (!match || !isCSharpDocument(db, match.relativePath)) {
1670
- return [];
1671
- }
1672
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1673
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1674
- }
1675
- function getVisualBasicSourceCalleeRows(db, symbol, limit) {
1676
- const match = getFullSymbolMatch(db, symbol);
1677
- if (!match || !isVisualBasicDocument(db, match.relativePath)) {
1678
- return [];
1679
- }
1680
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1681
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1682
- }
1683
- function getCppSourceCalleeRows(db, symbol, limit) {
1684
- const match = getFullSymbolMatch(db, symbol);
1685
- if (!match || !isCppDocument(db, match.relativePath)) {
1686
- return [];
1637
+ function getSimpleLanguageCalleeRows(db, match, config, limit) {
1638
+ let calls;
1639
+ if (config.dualAttempt) {
1640
+ const baseCalls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine, config.dualAttempt.baseOpts);
1641
+ const extendedCalls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine, config.dualAttempt.extendedOpts);
1642
+ calls = extendedCalls.length > 0 ? extendedCalls : baseCalls;
1643
+ } else {
1644
+ calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine, config.sourceCallOpts);
1687
1645
  }
1688
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1689
- const bindings = parseCppReceiverBindings(getSourceText(db, match.relativePath));
1646
+ const bindings = config.parseBindings ? config.parseBindings(db, getSourceText(db, match.relativePath)) : /* @__PURE__ */ new Map();
1690
1647
  return resolveSimpleSourceCallees(db, match, calls, bindings, limit);
1691
1648
  }
1692
- function getRustSourceCalleeRows(db, symbol, limit) {
1693
- const match = getFullSymbolMatch(db, symbol);
1694
- if (!match || !isRustDocument(db, match.relativePath)) {
1695
- return [];
1696
- }
1697
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1698
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1699
- }
1700
- function getRubySourceCalleeRows(db, symbol, limit) {
1701
- const match = getFullSymbolMatch(db, symbol);
1702
- if (!match || !isRubyDocument(db, match.relativePath)) {
1703
- return [];
1704
- }
1705
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine, { allowInstanceVariables: true });
1706
- const rubyCalls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine, {
1707
- allowInstanceVariables: true,
1708
- allowBareMemberCalls: true
1709
- });
1710
- const bindings = parseRubyReceiverBindings(db, getSourceText(db, match.relativePath));
1711
- return resolveSimpleSourceCallees(db, match, rubyCalls.length > 0 ? rubyCalls : calls, bindings, limit);
1712
- }
1713
- function getDartSourceCalleeRows(db, symbol, limit) {
1714
- const match = getFullSymbolMatch(db, symbol);
1715
- if (!match || !isDartDocument(db, match.relativePath)) {
1716
- return [];
1717
- }
1718
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1719
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1720
- }
1721
- function getPhpSourceCalleeRows(db, symbol, limit) {
1722
- const match = getFullSymbolMatch(db, symbol);
1723
- if (!match || !isPhpDocument(db, match.relativePath)) {
1724
- return [];
1725
- }
1726
- const calls = getSimpleSourceCalls(db, match.relativePath, match.startLine, match.endLine);
1727
- return resolveSimpleSourceCallees(db, match, calls, /* @__PURE__ */ new Map(), limit);
1728
- }
1729
1649
  function getSourceBackedCalleeRows(db, symbol, limit) {
1730
1650
  const match = getFullSymbolMatch(db, symbol);
1731
1651
  if (!match) {
1732
1652
  return [];
1733
1653
  }
1734
- if (isPythonDocument(db, match.relativePath)) {
1735
- return getPythonSourceCalleeRows(db, match, limit);
1736
- }
1737
- if (isJavaScriptDocument(db, match.relativePath)) {
1738
- return getJavaScriptSourceCalleeRows(db, match, limit);
1739
- }
1740
- if (isJavaDocument(db, match.relativePath)) {
1741
- return getJavaSourceCalleeRows(db, match, limit);
1742
- }
1743
- if (isScalaDocument(db, match.relativePath)) {
1744
- return getScalaSourceCalleeRows(db, match, limit);
1745
- }
1746
- if (isKotlinDocument(db, match.relativePath)) {
1747
- return getKotlinSourceCalleeRows(db, match, limit);
1748
- }
1749
- if (isCSharpDocument(db, match.relativePath)) {
1750
- return getCSharpSourceCalleeRows(db, match, limit);
1751
- }
1752
- if (isVisualBasicDocument(db, match.relativePath)) {
1753
- return getVisualBasicSourceCalleeRows(db, match, limit);
1754
- }
1755
- if (isCppDocument(db, match.relativePath)) {
1756
- return getCppSourceCalleeRows(db, match, limit);
1757
- }
1758
- if (isRustDocument(db, match.relativePath)) {
1759
- return getRustSourceCalleeRows(db, match, limit);
1760
- }
1761
- if (isRubyDocument(db, match.relativePath)) {
1762
- return getRubySourceCalleeRows(db, match, limit);
1763
- }
1764
- if (isDartDocument(db, match.relativePath)) {
1765
- return getDartSourceCalleeRows(db, match, limit);
1766
- }
1767
- if (isPhpDocument(db, match.relativePath)) {
1768
- return getPhpSourceCalleeRows(db, match, limit);
1654
+ for (const config of LANGUAGE_CALLEE_CONFIGS) {
1655
+ if (!isDocumentLanguage(db, match.relativePath, DOCUMENT_LANGUAGE_TABLE[config.languageIndex])) {
1656
+ continue;
1657
+ }
1658
+ if (config.kind === "complex") {
1659
+ return getComplexSourceCalleeRows(db, match, config, limit);
1660
+ }
1661
+ return getSimpleLanguageCalleeRows(db, match, config, limit);
1769
1662
  }
1770
1663
  return [];
1771
1664
  }
@@ -1775,9 +1668,11 @@ function getPythonSourceCallerRows(db, target, limit) {
1775
1668
  }
1776
1669
  const rows = [];
1777
1670
  const seen = /* @__PURE__ */ new Set();
1671
+ const pythonConfig = LANGUAGE_CALLEE_CONFIGS[0];
1778
1672
  for (const candidate of getAllFunctionLikeDefinitions(db)) {
1779
1673
  if (candidate.symbolId === target.symbolId) continue;
1780
- const callees = getPythonSourceCalleeRows(db, candidate);
1674
+ if (!isDocumentLanguage(db, candidate.relativePath, DOCUMENT_LANGUAGE_TABLE[pythonConfig.languageIndex])) continue;
1675
+ const callees = getComplexSourceCalleeRows(db, candidate, pythonConfig);
1781
1676
  if (!callees.some((callee) => callee.symbol === target.symbol)) continue;
1782
1677
  const key = `${candidate.symbol}|${candidate.relativePath}`;
1783
1678
  if (seen.has(key) || db.isIgnored(candidate.relativePath)) continue;
@@ -2119,6 +2014,17 @@ function getAllDefinitions(db, opts = {}) {
2119
2014
  );
2120
2015
  return rows.filter((row) => !db.isIgnored(row.relative_path)).flatMap((row) => getDefinitionsForFile(db, row.relative_path));
2121
2016
  }
2017
+ function getScopedDefinitions(db, scope) {
2018
+ const scopeFilter = scope ? `AND relative_path LIKE '%${scope}%'` : "";
2019
+ return db.all(
2020
+ `SELECT relative_path
2021
+ FROM documents
2022
+ WHERE 1 = 1
2023
+ ${db.pathExclusionsFor("documents")}
2024
+ ${scopeFilter}
2025
+ ORDER BY relative_path`
2026
+ ).flatMap((row) => getDefinitionsForFile(db, row.relative_path)).filter((row) => !db.isIgnored(row.relativePath));
2027
+ }
2122
2028
  function getAllFunctionLikeDefinitions(db) {
2123
2029
  return getAllDefinitions(db).filter((definition) => definition.isFunctionLike);
2124
2030
  }
@@ -2536,89 +2442,29 @@ function parentTypeName(rawSymbol) {
2536
2442
  }
2537
2443
  return null;
2538
2444
  }
2539
- function isPythonDocument(db, relativePath) {
2540
- const row = db.get(
2541
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2542
- relativePath
2543
- );
2544
- return row?.language === "python" || relativePath.endsWith(".py") || relativePath.endsWith(".pyi");
2545
- }
2546
- function isJavaScriptDocument(db, relativePath) {
2547
- const row = db.get(
2548
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2549
- relativePath
2550
- );
2551
- return row?.language === "typescript" || row?.language === "javascript" || /\.(?:[cm]?[jt]sx?)$/.test(relativePath);
2552
- }
2553
- function isJavaDocument(db, relativePath) {
2554
- const row = db.get(
2555
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2556
- relativePath
2557
- );
2558
- return row?.language === "java" || relativePath.endsWith(".java");
2559
- }
2560
- function isKotlinDocument(db, relativePath) {
2561
- const row = db.get(
2562
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2563
- relativePath
2564
- );
2565
- return row?.language === "kotlin" || relativePath.endsWith(".kt") || relativePath.endsWith(".kts");
2566
- }
2567
- function isScalaDocument(db, relativePath) {
2568
- const row = db.get(
2569
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2570
- relativePath
2571
- );
2572
- return row?.language === "scala" || relativePath.endsWith(".scala");
2573
- }
2574
- function isCSharpDocument(db, relativePath) {
2575
- const row = db.get(
2576
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2577
- relativePath
2578
- );
2579
- return row?.language === "C#" || relativePath.endsWith(".cs");
2580
- }
2581
- function isVisualBasicDocument(db, relativePath) {
2582
- const row = db.get(
2583
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2584
- relativePath
2585
- );
2586
- return row?.language === "Visual Basic" || relativePath.endsWith(".vb");
2587
- }
2588
- function isCppDocument(db, relativePath) {
2589
- const row = db.get(
2590
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2591
- relativePath
2592
- );
2593
- return row?.language === "CPP" || /\.(?:cc|cpp|cxx|hpp|hh|hxx)$/.test(relativePath);
2594
- }
2595
- function isRustDocument(db, relativePath) {
2596
- const row = db.get(
2597
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2598
- relativePath
2599
- );
2600
- return row?.language === "Rust" || relativePath.endsWith(".rs");
2601
- }
2602
- function isRubyDocument(db, relativePath) {
2603
- const row = db.get(
2604
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2605
- relativePath
2606
- );
2607
- return row?.language === "ruby" || relativePath.endsWith(".rb");
2608
- }
2609
- function isDartDocument(db, relativePath) {
2445
+ var DOCUMENT_LANGUAGE_TABLE = [
2446
+ { languages: ["python"], extensionPattern: /\.(?:py|pyi)$/ },
2447
+ { languages: ["typescript", "javascript"], extensionPattern: /\.(?:[cm]?[jt]sx?)$/ },
2448
+ { languages: ["java"], extensionPattern: /\.java$/ },
2449
+ { languages: ["kotlin"], extensionPattern: /\.(?:kt|kts)$/ },
2450
+ { languages: ["scala"], extensionPattern: /\.scala$/ },
2451
+ { languages: ["C#"], extensionPattern: /\.cs$/ },
2452
+ { languages: ["Visual Basic"], extensionPattern: /\.vb$/ },
2453
+ { languages: ["CPP"], extensionPattern: /\.(?:cc|cpp|cxx|hpp|hh|hxx)$/ },
2454
+ { languages: ["Rust"], extensionPattern: /\.rs$/ },
2455
+ { languages: ["ruby"], extensionPattern: /\.rb$/ },
2456
+ { languages: ["Dart"], extensionPattern: /\.dart$/ },
2457
+ { languages: ["PHP"], extensionPattern: /\.php$/ }
2458
+ ];
2459
+ function isDocumentLanguage(db, relativePath, entry) {
2610
2460
  const row = db.get(
2611
2461
  `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2612
2462
  relativePath
2613
2463
  );
2614
- return row?.language === "Dart" || relativePath.endsWith(".dart");
2464
+ return entry.languages.includes(row?.language ?? "") || entry.extensionPattern.test(relativePath);
2615
2465
  }
2616
- function isPhpDocument(db, relativePath) {
2617
- const row = db.get(
2618
- `SELECT language FROM documents WHERE relative_path = ? LIMIT 1`,
2619
- relativePath
2620
- );
2621
- return row?.language === "PHP" || relativePath.endsWith(".php");
2466
+ function isPythonDocument(db, relativePath) {
2467
+ return isDocumentLanguage(db, relativePath, DOCUMENT_LANGUAGE_TABLE[0]);
2622
2468
  }
2623
2469
  function applyLimit(values, limit) {
2624
2470
  return typeof limit === "number" ? values.slice(0, limit) : values;
@@ -2690,6 +2536,7 @@ export {
2690
2536
  getCallerRowsForSymbol,
2691
2537
  getSourceReferenceSites,
2692
2538
  getDefinitionsForFile,
2693
- getAllDefinitions
2539
+ getAllDefinitions,
2540
+ getScopedDefinitions
2694
2541
  };
2695
- //# sourceMappingURL=chunk-ALUFWH3U.js.map
2542
+ //# sourceMappingURL=chunk-FMAYH7GS.js.map
@@ -1,10 +1,18 @@
1
1
  // src/queries/files.ts
2
+ function globToLike(pattern) {
3
+ const hasGlobChars = /[*?]/.test(pattern);
4
+ if (!hasGlobChars) {
5
+ return `%${pattern}%`;
6
+ }
7
+ return pattern.replace(/\*\*/g, "%").replace(/\*/g, "%").replace(/\?/g, "_");
8
+ }
2
9
  function files(db, pattern) {
10
+ const likePattern = globToLike(pattern);
3
11
  const rows = db.all(
4
12
  `SELECT relative_path FROM documents
5
13
  WHERE relative_path LIKE ?
6
14
  ORDER BY relative_path`,
7
- `%${pattern}%`
15
+ likePattern
8
16
  );
9
17
  return rows.filter((r) => !db.isIgnored(r.relative_path)).map((r) => ({ relativePath: r.relative_path }));
10
18
  }
@@ -12,4 +20,4 @@ function files(db, pattern) {
12
20
  export {
13
21
  files
14
22
  };
15
- //# sourceMappingURL=chunk-MGNMHKX3.js.map
23
+ //# sourceMappingURL=chunk-FO2CBB7U.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getAllDefinitions,
3
3
  getSourceText
4
- } from "./chunk-ALUFWH3U.js";
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
6
  shortenSymbol
7
- } from "./chunk-TO3L4YNK.js";
7
+ } from "./chunk-YMSJCSRG.js";
8
8
 
9
9
  // src/queries/similar-signatures.ts
10
10
  function similarSignatures(db, opts = {}) {
@@ -159,4 +159,4 @@ function escapeRegex(value) {
159
159
  export {
160
160
  similarSignatures
161
161
  };
162
- //# sourceMappingURL=chunk-7BS4CPJX.js.map
162
+ //# sourceMappingURL=chunk-HESWGDIV.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  findFirstSymbolMatch,
3
3
  getDefinitionsForFile
4
- } from "./chunk-ALUFWH3U.js";
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
- leafName,
7
- leafSuffix
8
- } from "./chunk-TO3L4YNK.js";
6
+ isCallableSymbol,
7
+ leafName
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/methods.ts
11
11
  import { basename } from "path";
@@ -24,9 +24,6 @@ function methods(db, className) {
24
24
  name: leafName(definition.symbol)
25
25
  }));
26
26
  }
27
- function isCallableSymbol(rawSymbol) {
28
- return rawSymbol.endsWith("().") || leafSuffix(rawSymbol) === "method";
29
- }
30
27
  function stripExtension(relativePath) {
31
28
  return relativePath.replace(/\.[^.]+$/, "");
32
29
  }
@@ -34,4 +31,4 @@ function stripExtension(relativePath) {
34
31
  export {
35
32
  methods
36
33
  };
37
- //# sourceMappingURL=chunk-FVJE4MQL.js.map
34
+ //# sourceMappingURL=chunk-HL2LXSBW.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getAllDefinitions
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
  import {
5
5
  leafSuffix,
6
6
  parseSymbol,
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/by-kind.ts
11
11
  var KIND_NAMES = {
@@ -213,4 +213,4 @@ export {
213
213
  byKind,
214
214
  kindCounts
215
215
  };
216
- //# sourceMappingURL=chunk-KG4OFQEN.js.map
216
+ //# sourceMappingURL=chunk-HW76DVE4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveIndexedFile
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
 
5
5
  // src/queries/deps.ts
6
6
  function deps(db, filePattern) {
@@ -50,4 +50,4 @@ export {
50
50
  deps,
51
51
  rdeps
52
52
  };
53
- //# sourceMappingURL=chunk-RJ5GULL6.js.map
53
+ //# sourceMappingURL=chunk-IC5NTO47.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getAllDefinitions,
3
3
  getCallerRowsForSymbol
4
- } from "./chunk-ALUFWH3U.js";
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
6
  shortenSymbol
7
- } from "./chunk-TO3L4YNK.js";
7
+ } from "./chunk-YMSJCSRG.js";
8
8
 
9
9
  // src/queries/hotspots.ts
10
10
  function hotspots(db, opts = {}) {
@@ -56,4 +56,4 @@ function hotspots(db, opts = {}) {
56
56
  export {
57
57
  hotspots
58
58
  };
59
- //# sourceMappingURL=chunk-VY2L4TP6.js.map
59
+ //# sourceMappingURL=chunk-J34HAAEQ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  shortenSymbol
3
- } from "./chunk-TO3L4YNK.js";
3
+ } from "./chunk-YMSJCSRG.js";
4
4
 
5
5
  // src/queries/diff-impact.ts
6
6
  import { execFileSync } from "child_process";
@@ -148,4 +148,4 @@ function getChangedFiles(projectRoot, base) {
148
148
  export {
149
149
  diffImpact
150
150
  };
151
- //# sourceMappingURL=chunk-PCU455MX.js.map
151
+ //# sourceMappingURL=chunk-JSXGC2EH.js.map
@@ -2,10 +2,10 @@ import {
2
2
  findExactSymbolMatch,
3
3
  findFirstSymbolMatch,
4
4
  getCallerRowsForSymbol
5
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
6
6
  import {
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/affected.ts
11
11
  function affected(db, symbolPattern, opts = {}) {
@@ -84,4 +84,4 @@ function getDirectAffectedRows(db, target, scope) {
84
84
  export {
85
85
  affected
86
86
  };
87
- //# sourceMappingURL=chunk-NXUIWD6K.js.map
87
+ //# sourceMappingURL=chunk-LQXBFCP2.js.map