@lzehrung/codegraph 2.2.1 → 2.2.2

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 (47) hide show
  1. package/codegraph-skill/codegraph/SKILL.md +1 -1
  2. package/dist/bin/cli.js +265 -126
  3. package/dist/bin/queryIndexWorker.js +4 -0
  4. package/dist/indexer/build-cache/options.d.ts +15 -13
  5. package/dist/indexer/build-cache/options.d.ts.map +1 -1
  6. package/dist/indexer/build-cache/options.js +30 -38
  7. package/dist/indexer/build-cache/options.js.map +1 -1
  8. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  9. package/dist/indexer/build-cache/project-snapshot.js +103 -60
  10. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  11. package/dist/indexer/build-index.d.ts.map +1 -1
  12. package/dist/indexer/build-index.js +43 -20
  13. package/dist/indexer/build-index.js.map +1 -1
  14. package/dist/indexer/imports.d.ts +4 -0
  15. package/dist/indexer/imports.d.ts.map +1 -1
  16. package/dist/indexer/imports.js +6 -5
  17. package/dist/indexer/imports.js.map +1 -1
  18. package/dist/indexer/locals-and-exports.d.ts.map +1 -1
  19. package/dist/indexer/locals-and-exports.js +10 -5
  20. package/dist/indexer/locals-and-exports.js.map +1 -1
  21. package/dist/indexer/navigation-references.d.ts +14 -1
  22. package/dist/indexer/navigation-references.d.ts.map +1 -1
  23. package/dist/indexer/navigation-references.js +29 -7
  24. package/dist/indexer/navigation-references.js.map +1 -1
  25. package/dist/indexer/navigation.d.ts.map +1 -1
  26. package/dist/indexer/navigation.js +72 -10
  27. package/dist/indexer/navigation.js.map +1 -1
  28. package/dist/indexer/types.d.ts +1 -0
  29. package/dist/indexer/types.d.ts.map +1 -1
  30. package/dist/languages/definitions/javascript.d.ts.map +1 -1
  31. package/dist/languages/definitions/javascript.js +1 -0
  32. package/dist/languages/definitions/javascript.js.map +1 -1
  33. package/dist/languages/definitions/typescript.d.ts.map +1 -1
  34. package/dist/languages/definitions/typescript.js +2 -0
  35. package/dist/languages/definitions/typescript.js.map +1 -1
  36. package/dist/languages/types.d.ts +4 -0
  37. package/dist/languages/types.d.ts.map +1 -1
  38. package/dist/languages.d.ts +1 -0
  39. package/dist/languages.d.ts.map +1 -1
  40. package/dist/languages.js +1 -0
  41. package/dist/languages.js.map +1 -1
  42. package/dist/util/resolution.d.ts.map +1 -1
  43. package/dist/util/resolution.js +2 -3
  44. package/dist/util/resolution.js.map +1 -1
  45. package/dist/worker/nativeWorkerPool.js +1 -1
  46. package/dist/worker/nativeWorkerPool.js.map +1 -1
  47. package/package.json +3 -3
package/dist/bin/cli.js CHANGED
@@ -2091,6 +2091,7 @@ var init_typescript = __esm({
2091
2091
  extensions: [".ts", ".mts", ".cts"],
2092
2092
  structure: BASE_STRUCTURE,
2093
2093
  graph: BASE_GRAPH,
2094
+ supportsExportFromReferences: true,
2094
2095
  ...BASE_HELPERS,
2095
2096
  isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
2096
2097
  native: {
@@ -2112,6 +2113,7 @@ var init_typescript = __esm({
2112
2113
  ]
2113
2114
  },
2114
2115
  graph: BASE_GRAPH,
2116
+ supportsExportFromReferences: true,
2115
2117
  ...BASE_HELPERS,
2116
2118
  isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
2117
2119
  native: {
@@ -2148,6 +2150,7 @@ var init_javascript = __esm({
2148
2150
  JAVASCRIPT_DEF = {
2149
2151
  id: "js",
2150
2152
  extensions: [".js", ".jsx", ".mjs", ".cjs"],
2153
+ supportsExportFromReferences: true,
2151
2154
  structure: {
2152
2155
  blocks: [...ECMASCRIPT_CORE_FUNCTION_BLOCKS, ...ECMASCRIPT_MODULE_VAR_BLOCKS],
2153
2156
  splitPoints: [...ECMASCRIPT_CONTROL_SPLIT_POINTS],
@@ -4489,6 +4492,7 @@ function adaptDefinition(def) {
4489
4492
  membersAreImplicitlyInScope: def.membersAreImplicitlyInScope ?? true,
4490
4493
  supportsCrossModuleSymbols: def.supportsCrossModuleSymbols || false,
4491
4494
  isTypeOnly: def.isTypeOnly || (() => false),
4495
+ supportsExportFromReferences: def.supportsExportFromReferences ?? false,
4492
4496
  usesQueryDrivenLocals: def.usesQueryDrivenLocals || false,
4493
4497
  normalizeIdentifier: def.normalizeIdentifier || ((name) => name),
4494
4498
  ...def.native ? { native: def.native } : {}
@@ -18361,8 +18365,7 @@ async function resolveSpecifier(fromFile, spec, projectRoot, matchPath, workspac
18361
18365
  }
18362
18366
  const fromExt = path20.extname(fromFile).toLowerCase();
18363
18367
  const prefersPathLikeFallback = [".go", ".java", ".cs", ".rb", ".rs", ".swift"].includes(fromExt);
18364
- const shouldTryPathLikeFallback = prefersPathLikeFallback || spec.includes("/") || spec.includes(".");
18365
- if (shouldTryPathLikeFallback) {
18368
+ if (prefersPathLikeFallback) {
18366
18369
  const pathLike = await resolvePathLikeModule(projectRoot, spec, opts?.resolutionExtensions);
18367
18370
  if (pathLike && isFilePathWithinRoot(projectRoot, pathLike)) {
18368
18371
  setResolveSpecifierCacheEntry(cacheKey3, pathLike);
@@ -26712,8 +26715,11 @@ async function collectImportsForFile(file2, projectRoot, opts) {
26712
26715
  });
26713
26716
  return imports;
26714
26717
  }
26715
- const tsCfg = resolvedSup.id === "ts" || resolvedSup.id === "tsx" ? await loadNearestTsconfigFor(file2, projectRoot, opts?.logLevel) : void 0;
26716
- const workspaceConfig = await loadWorkspaceConfig(projectRoot);
26718
+ let matchPath = opts?.matchPath;
26719
+ if ((resolvedSup.id === "ts" || resolvedSup.id === "tsx") && !matchPath) {
26720
+ ({ matchPath } = await loadNearestTsconfigFor(file2, projectRoot, opts?.logLevel));
26721
+ }
26722
+ const workspaceConfig = opts?.workspaceConfig ?? await loadWorkspaceConfig(projectRoot);
26717
26723
  const resolvedImportCache = /* @__PURE__ */ new Map();
26718
26724
  const resolveFrom = async (from, phpImportType) => {
26719
26725
  const cacheKey3 = `${from}\0${phpImportType ?? ""}`;
@@ -26723,7 +26729,7 @@ async function collectImportsForFile(file2, projectRoot, opts) {
26723
26729
  const resolutionHints = opts?.graphOptions?.resolutionHints;
26724
26730
  const resolved = (async () => {
26725
26731
  const result = await resolveImportSpecifier(projectRoot, file2, from, resolvedSup.id, {
26726
- ...tsCfg?.matchPath ? { matchPath: tsCfg.matchPath } : {},
26732
+ ...matchPath ? { matchPath } : {},
26727
26733
  ...workspaceConfig ? { workspaceConfig } : {},
26728
26734
  resolveNodeModules: !!opts?.graphOptions?.resolveNodeModules,
26729
26735
  ...resolutionHints ? { resolutionHints } : {},
@@ -27653,9 +27659,11 @@ function collectLocalsAndExportsFromSource(file2, source, support, imports = [],
27653
27659
  }
27654
27660
  }
27655
27661
  }
27656
- const methodSupplementTree = ensureTree();
27657
- if (methodSupplementTree) {
27658
- supplementMethodLocalsFromSyntaxTree(methodSupplementTree.rootNode);
27662
+ if (support.id === "ts" || support.id === "tsx" || support.id === "js") {
27663
+ const methodSupplementTree = ensureTree();
27664
+ if (methodSupplementTree) {
27665
+ supplementMethodLocalsFromSyntaxTree(methodSupplementTree.rootNode);
27666
+ }
27659
27667
  }
27660
27668
  function supplementMethodLocalsFromSyntaxTree(node) {
27661
27669
  if (METHOD_LIKE_BINDING_NODE_TYPES.has(node.type)) {
@@ -28036,7 +28044,8 @@ function collectLocalsAndExportsFromSource(file2, source, support, imports = [],
28036
28044
  throw error51;
28037
28045
  }
28038
28046
  }
28039
- if (support.id === "ts" || support.id === "tsx" || support.id === "js") {
28047
+ const isJsLike = support.id === "ts" || support.id === "tsx" || support.id === "js";
28048
+ if (isJsLike) {
28040
28049
  appendJsLikeRegexFallbackExports(file2, source, locals, exports);
28041
28050
  }
28042
28051
  if (support.id === "python") {
@@ -29915,19 +29924,9 @@ var init_location = __esm({
29915
29924
  // dist/indexer/build-cache/options.js
29916
29925
  import crypto5 from "node:crypto";
29917
29926
  import path36 from "node:path";
29918
- function functionSource(value) {
29919
- return typeof value === "function" ? Function.prototype.toString.call(value) : void 0;
29920
- }
29921
29927
  function languageDefinitionFingerprintDescriptor(definition) {
29922
29928
  const native = definition.native;
29923
- const nativeNormalizeQuery = functionSource(native?.normalizeQuery);
29924
- const classifyDefinition = functionSource(definition.classifyDefinition);
29925
- const isDeclarationName = functionSource(definition.isDeclarationName);
29926
- const scopeDeclarationNames = definition.scopeDeclarationNames === "all" ? "all" : functionSource(definition.scopeDeclarationNames);
29927
- const normalizeIdentifier = functionSource(definition.normalizeIdentifier);
29928
- const createsBlockScope = functionSource(definition.createsBlockScope);
29929
- const createsFunctionScope = functionSource(definition.createsFunctionScope);
29930
- const isTypeOnly = functionSource(definition.isTypeOnly);
29929
+ const scopeDeclarationNames = definition.scopeDeclarationNames === "all" ? "all" : void 0;
29931
29930
  return {
29932
29931
  id: definition.id,
29933
29932
  extensions: [...definition.extensions].sort(),
@@ -29938,38 +29937,38 @@ function languageDefinitionFingerprintDescriptor(definition) {
29938
29937
  ...native ? {
29939
29938
  native: {
29940
29939
  authoritativeKinds: [...native.authoritativeKinds ?? []].sort(),
29941
- notes: [...native.notes ?? []],
29942
- ...nativeNormalizeQuery ? { normalizeQuery: nativeNormalizeQuery } : {}
29940
+ notes: [...native.notes ?? []]
29943
29941
  }
29944
29942
  } : {},
29945
29943
  behavior: {
29946
- // Booleans serialize under the same defaults adaptDefinition applies, so the
29947
- // fingerprint tracks effective behavior rather than incidental optionality.
29944
+ // Function-valued behavior fields are covered by LANGUAGE_BEHAVIOR_EPOCH.
29945
+ // Bundlers rewrite their source text, so hashing it would make equivalent
29946
+ // CLI and library builds invalidate one another's caches.
29948
29947
  usesQueryDrivenLocals: definition.usesQueryDrivenLocals ?? false,
29949
29948
  membersAreImplicitlyInScope: definition.membersAreImplicitlyInScope ?? true,
29950
- ...classifyDefinition ? { classifyDefinition } : {},
29951
- ...isDeclarationName ? { isDeclarationName } : {},
29952
- ...scopeDeclarationNames ? { scopeDeclarationNames } : {},
29953
- ...normalizeIdentifier ? { normalizeIdentifier } : {},
29954
- ...createsBlockScope ? { createsBlockScope } : {},
29955
- ...createsFunctionScope ? { createsFunctionScope } : {},
29956
- ...isTypeOnly ? { isTypeOnly } : {}
29949
+ supportsExportFromReferences: definition.supportsExportFromReferences ?? false,
29950
+ ...scopeDeclarationNames ? { scopeDeclarationNames } : {}
29957
29951
  }
29958
29952
  };
29959
29953
  }
29960
- function getImplementationFingerprint() {
29961
- if (cachedImplementationFingerprint)
29962
- return cachedImplementationFingerprint;
29954
+ function getImplementationFingerprintForEpoch(languageBehaviorEpoch) {
29963
29955
  const definitions = getAllLanguages().map(languageDefinitionFingerprintDescriptor).sort((left, right) => left.id.localeCompare(right.id));
29964
29956
  const hash2 = crypto5.createHash("sha256");
29965
- hash2.update("codegraph-implementation-fingerprint-v2");
29957
+ hash2.update("codegraph-implementation-fingerprint-v3");
29966
29958
  hash2.update("\0");
29967
29959
  hash2.update(String(CORE_ALGORITHM_EPOCH));
29968
29960
  hash2.update("\0");
29961
+ hash2.update(String(languageBehaviorEpoch));
29962
+ hash2.update("\0");
29969
29963
  hash2.update(getCodegraphVersion());
29970
29964
  hash2.update("\0");
29971
29965
  hash2.update(JSON.stringify(definitions));
29972
- cachedImplementationFingerprint = hash2.digest("hex");
29966
+ return hash2.digest("hex");
29967
+ }
29968
+ function getImplementationFingerprint() {
29969
+ if (cachedImplementationFingerprint)
29970
+ return cachedImplementationFingerprint;
29971
+ cachedImplementationFingerprint = getImplementationFingerprintForEpoch(LANGUAGE_BEHAVIOR_EPOCH);
29973
29972
  return cachedImplementationFingerprint;
29974
29973
  }
29975
29974
  function normalizeManifestBuildOptions(opts) {
@@ -30139,7 +30138,7 @@ function graphOptionsEqual(a, b) {
30139
30138
  }
30140
30139
  return true;
30141
30140
  }
30142
- var CORE_ALGORITHM_EPOCH, cachedImplementationFingerprint;
30141
+ var CORE_ALGORITHM_EPOCH, LANGUAGE_BEHAVIOR_EPOCH, cachedImplementationFingerprint;
30143
30142
  var init_options2 = __esm({
30144
30143
  "dist/indexer/build-cache/options.js"() {
30145
30144
  "use strict";
@@ -30151,6 +30150,7 @@ var init_options2 = __esm({
30151
30150
  init_treeSitterNative();
30152
30151
  init_languages();
30153
30152
  CORE_ALGORITHM_EPOCH = 2;
30153
+ LANGUAGE_BEHAVIOR_EPOCH = 1;
30154
30154
  }
30155
30155
  });
30156
30156
 
@@ -49660,53 +49660,52 @@ function transformHandle(root, value, toRelative) {
49660
49660
  return `${transformPath(root, file2, toRelative)}${value.slice(separator)}`;
49661
49661
  }
49662
49662
  function transformModule(root, module2, toRelative) {
49663
- const copy = structuredClone(module2);
49664
49663
  const file2 = (value) => transformPath(root, value, toRelative);
49665
- copy.file = file2(copy.file);
49666
- for (const local of copy.locals)
49667
- local.file = file2(local.file);
49668
- for (const entry of copy.exports) {
49669
- if (entry.type === "local") {
49670
- entry.target.file = file2(entry.target.file);
49671
- } else {
49672
- transformPersistedExportFromModule(root, entry, toRelative);
49673
- }
49674
- }
49675
- for (const binding of copy.imports) {
49676
- if (typeof binding.resolved === "string")
49677
- binding.resolved = file2(binding.resolved);
49678
- }
49679
- return copy;
49664
+ return {
49665
+ ...module2,
49666
+ file: file2(module2.file),
49667
+ locals: module2.locals.map((local) => ({ ...local, file: file2(local.file) })),
49668
+ exports: module2.exports.map((entry) => {
49669
+ if (entry.type === "local") {
49670
+ return { ...entry, target: { ...entry.target, file: file2(entry.target.file) } };
49671
+ }
49672
+ const copy = { ...entry };
49673
+ transformPersistedExportFromModule(root, copy, toRelative);
49674
+ return copy;
49675
+ }),
49676
+ imports: module2.imports.map((binding) => ({
49677
+ ...binding,
49678
+ ...typeof binding.resolved === "string" ? { resolved: file2(binding.resolved) } : {}
49679
+ }))
49680
+ };
49680
49681
  }
49681
49682
  function transformSnapshotPaths(payload, root, toRelative) {
49682
- const copy = structuredClone(payload);
49683
- copy.graph.nodes = copy.graph.nodes.map((node) => transformPath(root, node, toRelative));
49684
- copy.graph.edges = copy.graph.edges.map((edge) => ({
49685
- ...edge,
49686
- from: transformPath(root, edge.from, toRelative),
49687
- to: edge.to.type === "file" ? { ...edge.to, path: transformPath(root, edge.to.path, toRelative) } : edge.to
49688
- }));
49689
- copy.modules = copy.modules.map((module2) => transformModule(root, module2, toRelative));
49690
- if (copy.projectFiles) {
49691
- copy.projectFiles = copy.projectFiles.map((file2) => ({
49692
- ...file2,
49693
- path: transformPath(root, file2.path, toRelative),
49694
- projectRoot: transformPath(root, file2.projectRoot, toRelative)
49695
- }));
49696
- }
49697
- if (copy.bloomFilters) {
49698
- const bloomFilters = {};
49699
- for (const [file2, filter] of Object.entries(copy.bloomFilters)) {
49700
- bloomFilters[transformPath(root, file2, toRelative)] = filter;
49701
- }
49702
- copy.bloomFilters = bloomFilters;
49703
- }
49704
- const fileSignatures = {};
49705
- for (const [file2, signature] of Object.entries(copy.fileSignatures ?? {})) {
49706
- fileSignatures[transformPath(root, file2, toRelative)] = signature;
49707
- }
49708
- copy.fileSignatures = fileSignatures;
49709
- return copy;
49683
+ const bloomFilters = payload.bloomFilters ? Object.fromEntries(Object.entries(payload.bloomFilters).map(([file2, filter]) => [transformPath(root, file2, toRelative), filter])) : void 0;
49684
+ const fileSignatures = Object.fromEntries(Object.entries(payload.fileSignatures ?? {}).map(([file2, signature]) => [
49685
+ transformPath(root, file2, toRelative),
49686
+ signature
49687
+ ]));
49688
+ return {
49689
+ ...payload,
49690
+ graph: {
49691
+ nodes: payload.graph.nodes.map((node) => transformPath(root, node, toRelative)),
49692
+ edges: payload.graph.edges.map((edge) => ({
49693
+ ...edge,
49694
+ from: transformPath(root, edge.from, toRelative),
49695
+ to: edge.to.type === "file" ? { ...edge.to, path: transformPath(root, edge.to.path, toRelative) } : edge.to
49696
+ }))
49697
+ },
49698
+ modules: payload.modules.map((module2) => transformModule(root, module2, toRelative)),
49699
+ ...payload.projectFiles ? {
49700
+ projectFiles: payload.projectFiles.map((file2) => ({
49701
+ ...file2,
49702
+ path: transformPath(root, file2.path, toRelative),
49703
+ projectRoot: transformPath(root, file2.projectRoot, toRelative)
49704
+ }))
49705
+ } : {},
49706
+ ...bloomFilters ? { bloomFilters } : {},
49707
+ fileSignatures
49708
+ };
49710
49709
  }
49711
49710
  function migrateProjectSnapshotPayload(value, currentRoot) {
49712
49711
  if (!value || typeof value !== "object" || Array.isArray(value))
@@ -49833,6 +49832,14 @@ function setBoundedSnapshotCache(cache, key, value) {
49833
49832
  cache.delete(oldestKey);
49834
49833
  }
49835
49834
  }
49835
+ function freezeSnapshotPayload(value) {
49836
+ if (!value || typeof value !== "object")
49837
+ return value;
49838
+ Object.freeze(value);
49839
+ for (const child of Object.values(value))
49840
+ freezeSnapshotPayload(child);
49841
+ return value;
49842
+ }
49836
49843
  function materializeDetailedSymbolGraph(payload) {
49837
49844
  const graph = structuredClone(payload);
49838
49845
  return {
@@ -49853,6 +49860,9 @@ function recordSnapshotCorruption(report, artifact, reason, logLevel) {
49853
49860
  }
49854
49861
  logWithLevel(logLevel, "warn", `Warning: Corrupt cache artifact ${artifact}: ${reason}`);
49855
49862
  }
49863
+ function recordSnapshotInvalidation(artifact, reason, logLevel) {
49864
+ logWithLevel(logLevel, "debug", `Cache artifact invalidated ${artifact}: ${reason}`);
49865
+ }
49856
49866
  function isMissingArtifactError(error51) {
49857
49867
  return !!error51 && typeof error51 === "object" && "code" in error51 && error51.code === "ENOENT";
49858
49868
  }
@@ -49878,18 +49888,23 @@ function transformCachedProjectSnapshot(snapshotPath, identity, rawPayload, proj
49878
49888
  const cached2 = transformedSnapshotCache.get(snapshotPath);
49879
49889
  if (cached2 && cached2.root === projectRoot && sameSnapshotFileIdentity(cached2.identity, identity)) {
49880
49890
  setBoundedSnapshotCache(transformedSnapshotCache, snapshotPath, cached2);
49881
- return structuredClone(cached2.payload);
49891
+ return cached2.payload;
49882
49892
  }
49883
49893
  const migratedPayload = migrateProjectSnapshotPayload(rawPayload, projectRoot);
49884
49894
  const payload = migratedPayload && typeof migratedPayload === "object" && !Array.isArray(migratedPayload) ? transformSnapshotPaths(migratedPayload, projectRoot, false) : migratedPayload;
49885
- setBoundedSnapshotCache(transformedSnapshotCache, snapshotPath, { identity, root: projectRoot, payload });
49886
- return structuredClone(payload);
49895
+ const immutablePayload = freezeSnapshotPayload(payload);
49896
+ setBoundedSnapshotCache(transformedSnapshotCache, snapshotPath, {
49897
+ identity,
49898
+ root: projectRoot,
49899
+ payload: immutablePayload
49900
+ });
49901
+ return immutablePayload;
49887
49902
  }
49888
49903
  function transformCachedProjectSnapshotModules(snapshotPath, identity, rawPayload, projectRoot) {
49889
49904
  const cached2 = transformedSnapshotModulesCache.get(snapshotPath);
49890
49905
  if (cached2 && cached2.root === projectRoot && sameSnapshotFileIdentity(cached2.identity, identity)) {
49891
49906
  setBoundedSnapshotCache(transformedSnapshotModulesCache, snapshotPath, cached2);
49892
- return structuredClone(cached2.payload);
49907
+ return cached2.payload;
49893
49908
  }
49894
49909
  const migratedPayload = migrateProjectSnapshotPayload(rawPayload, projectRoot);
49895
49910
  if (!migratedPayload || typeof migratedPayload !== "object" || Array.isArray(migratedPayload)) {
@@ -49899,7 +49914,7 @@ function transformCachedProjectSnapshotModules(snapshotPath, identity, rawPayloa
49899
49914
  if (!Array.isArray(payload.modules) || !payload.fileSignatures || typeof payload.fileSignatures !== "object") {
49900
49915
  return migratedPayload;
49901
49916
  }
49902
- const modules = structuredClone(payload.modules).map((module2) => transformModule(projectRoot, module2, false));
49917
+ const modules = payload.modules.map((module2) => transformModule(projectRoot, module2, false));
49903
49918
  const fileSignatures = {};
49904
49919
  for (const [file2, signature] of Object.entries(payload.fileSignatures)) {
49905
49920
  fileSignatures[transformPath(projectRoot, file2, false)] = signature;
@@ -49914,12 +49929,13 @@ function transformCachedProjectSnapshotModules(snapshotPath, identity, rawPayloa
49914
49929
  modules,
49915
49930
  fileSignatures
49916
49931
  };
49932
+ const immutablePayload = freezeSnapshotPayload(transformed);
49917
49933
  setBoundedSnapshotCache(transformedSnapshotModulesCache, snapshotPath, {
49918
49934
  identity,
49919
49935
  root: projectRoot,
49920
- payload: transformed
49936
+ payload: immutablePayload
49921
49937
  });
49922
- return structuredClone(transformed);
49938
+ return immutablePayload;
49923
49939
  }
49924
49940
  function projectIndexManifestEntries(entries) {
49925
49941
  return new Map(Array.from(entries, ([file2, entry]) => [
@@ -49939,7 +49955,12 @@ async function tryLoadProjectIndexSnapshot(projectRoot, opts, manifestEntries, r
49939
49955
  const payload = transformCachedProjectSnapshot(projectSnapshotPath(projectRoot, opts), parsedSnapshot.identity, parsedSnapshot.payload, projectRoot);
49940
49956
  const nativeRuntimeFingerprint = getNativeRuntimeFingerprint(opts?.native);
49941
49957
  const implementationFingerprint = getImplementationFingerprint();
49942
- if (!isProjectIndexSnapshotPayload(payload) || payload.filesSignature !== filesSignature || payload.nativeMode !== normalizedSnapshotNativeMode(opts?.native) || payload.nativeRuntimeFingerprint !== nativeRuntimeFingerprint || payload.implementationFingerprint !== implementationFingerprint) {
49958
+ if (!isProjectIndexSnapshotPayload(payload)) {
49959
+ recordSnapshotCorruption(report, projectSnapshotPath(projectRoot, opts), "invalid project snapshot payload", opts?.logLevel);
49960
+ return null;
49961
+ }
49962
+ if (payload.filesSignature !== filesSignature || payload.nativeMode !== normalizedSnapshotNativeMode(opts?.native) || payload.nativeRuntimeFingerprint !== nativeRuntimeFingerprint || payload.implementationFingerprint !== implementationFingerprint) {
49963
+ recordSnapshotInvalidation(projectSnapshotPath(projectRoot, opts), "project snapshot identity mismatch", opts?.logLevel);
49943
49964
  return null;
49944
49965
  }
49945
49966
  const graph = {
@@ -49987,7 +50008,12 @@ async function tryLoadProjectSnapshotModules(projectRoot, opts, fileSignatures,
49987
50008
  const payload = transformCachedProjectSnapshotModules(projectSnapshotPath(projectRoot, opts), parsedSnapshot.identity, parsedSnapshot.payload, projectRoot);
49988
50009
  const nativeRuntimeFingerprint = getNativeRuntimeFingerprint(opts?.native);
49989
50010
  const implementationFingerprint = getImplementationFingerprint();
49990
- if (!isProjectSnapshotModulesPayload(payload) || payload.nativeMode !== normalizedSnapshotNativeMode(opts?.native) || payload.nativeRuntimeFingerprint !== nativeRuntimeFingerprint || payload.implementationFingerprint !== implementationFingerprint) {
50011
+ if (!isProjectSnapshotModulesPayload(payload)) {
50012
+ recordSnapshotCorruption(report, projectSnapshotPath(projectRoot, opts), "invalid project snapshot payload", opts?.logLevel);
50013
+ return null;
50014
+ }
50015
+ if (payload.nativeMode !== normalizedSnapshotNativeMode(opts?.native) || payload.nativeRuntimeFingerprint !== nativeRuntimeFingerprint || payload.implementationFingerprint !== implementationFingerprint) {
50016
+ recordSnapshotInvalidation(projectSnapshotPath(projectRoot, opts), "project snapshot identity mismatch", opts?.logLevel);
49991
50017
  return null;
49992
50018
  }
49993
50019
  const normalizedFileSignatures = new Map(Object.entries(payload.fileSignatures).map(([file2, signature]) => [fileIdentityKey(file2), signature]));
@@ -50019,7 +50045,13 @@ async function tryLoadPersistedBloomFilters(projectRoot, opts, report) {
50019
50045
  if (sidecarBloom) {
50020
50046
  return createPersistedBloomFilters(sidecarBloom.bloomFilters, sidecarBloom.fileSignatures, projectRoot);
50021
50047
  }
50022
- recordSnapshotCorruption(report, sidecarPath, "invalid bloom filter payload", opts?.logLevel);
50048
+ const sidecar = sidecarParsed;
50049
+ const identityMismatch = isUnknownRecord(sidecarParsed) && (sidecar.version !== BLOOM_FILTER_SNAPSHOT_VERSION || sidecar.implementationFingerprint !== getImplementationFingerprint() || typeof sidecar.projectSnapshotIdentity !== "string");
50050
+ if (identityMismatch) {
50051
+ recordSnapshotInvalidation(sidecarPath, "bloom filter identity mismatch", opts?.logLevel);
50052
+ } else {
50053
+ recordSnapshotCorruption(report, sidecarPath, "invalid bloom filter payload", opts?.logLevel);
50054
+ }
50023
50055
  } catch (error51) {
50024
50056
  const isMissing = error51 && typeof error51 === "object" && "code" in error51 && error51.code === "ENOENT";
50025
50057
  if (!isMissing) {
@@ -50229,10 +50261,18 @@ async function tryLoadDetailedSymbolGraphSnapshot(projectRoot, opts, index, repo
50229
50261
  ...migratedPayload,
50230
50262
  graph: transformDetailedGraph(migratedPayload.graph, projectRoot, false)
50231
50263
  } : migratedPayload;
50232
- if (!isDetailedSymbolGraphSnapshotPayload(payload) || payload.implementationFingerprint !== getImplementationFingerprint() || payload.projectSnapshotIdentity !== index.projectSnapshotIdentity) {
50264
+ if (!isDetailedSymbolGraphSnapshotPayload(payload)) {
50233
50265
  recordSnapshotCorruption(report, snapshotPath, "invalid detailed symbol graph payload", opts?.logLevel);
50234
50266
  return null;
50235
50267
  }
50268
+ if (payload.implementationFingerprint !== getImplementationFingerprint()) {
50269
+ recordSnapshotInvalidation(snapshotPath, "implementation fingerprint mismatch", opts?.logLevel);
50270
+ return null;
50271
+ }
50272
+ if (payload.projectSnapshotIdentity !== index.projectSnapshotIdentity) {
50273
+ recordSnapshotInvalidation(snapshotPath, "project snapshot identity mismatch", opts?.logLevel);
50274
+ return null;
50275
+ }
50236
50276
  const graph = materializeDetailedSymbolGraph(payload.graph);
50237
50277
  if (!await isDetailedSymbolGraphCompatibleWithProject(projectRoot, index, graph)) {
50238
50278
  recordSnapshotCorruption(report, snapshotPath, "detailed symbol graph does not match project", opts?.logLevel);
@@ -52374,7 +52414,7 @@ function createNativeWorkerPool(opts) {
52374
52414
  const workerPath = resolveNativeWorkerPath();
52375
52415
  return new Piscina({
52376
52416
  filename: workerPath,
52377
- minThreads: threads,
52417
+ minThreads: 1,
52378
52418
  maxThreads: threads,
52379
52419
  maxQueue: opts?.maxQueue ?? threads * 4,
52380
52420
  idleTimeout: 3e4,
@@ -52803,16 +52843,13 @@ function isConfinedFileReadError(error51) {
52803
52843
  function createEmptyModuleIndex(file2) {
52804
52844
  return { file: file2, exports: [], imports: [], locals: [] };
52805
52845
  }
52806
- async function resolveCrossModuleSymbolExports(file2, mod2, support, projectRoot, graphOptions, workspaceConfig, logLevel) {
52807
- if (!support.supportsCrossModuleSymbols)
52846
+ async function resolveCrossModuleSymbolExports(file2, mod2, support, projectRoot, graphOptions, workspaceConfig, matchPath) {
52847
+ if (!support.supportsCrossModuleSymbols || !isJsTsLanguage(support.id))
52808
52848
  return;
52809
- if (!isJsTsLanguage(support.id))
52849
+ const reexports = mod2.exports.filter((entry) => entry.type === "reexport" || entry.type === "exportStar" || entry.type === "namespaceReexport");
52850
+ if (!reexports.length)
52810
52851
  return;
52811
- const { matchPath } = await Promise.resolve().then(() => (init_resolution(), resolution_exports)).then((mod3) => mod3.loadNearestTsconfigFor(file2, projectRoot, logLevel));
52812
- for (const entry of mod2.exports) {
52813
- if (entry.type !== "reexport" && entry.type !== "exportStar" && entry.type !== "namespaceReexport") {
52814
- continue;
52815
- }
52852
+ for (const entry of reexports) {
52816
52853
  if (entry.fromModule.startsWith(".")) {
52817
52854
  entry.moduleSpecifier ??= entry.fromModule;
52818
52855
  const resolved = await resolveSpecifier(file2, entry.fromModule, projectRoot, matchPath, workspaceConfig, {
@@ -52876,6 +52913,8 @@ async function buildIndexedModuleForFile(args) {
52876
52913
  }
52877
52914
  const sharedImportOptions = {
52878
52915
  graphOptions: args.graphOptions,
52916
+ ...args.workspaceConfig ? { workspaceConfig: args.workspaceConfig } : {},
52917
+ ...args.matchPath ? { matchPath: args.matchPath } : {},
52879
52918
  ...args.opts?.native ? { native: args.opts.native } : {},
52880
52919
  ...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {},
52881
52920
  ...args.opts?.languageExtensions ? { languageExtensions: args.opts.languageExtensions } : {},
@@ -52909,7 +52948,7 @@ async function buildIndexedModuleForFile(args) {
52909
52948
  });
52910
52949
  }
52911
52950
  mod2.imports = imports;
52912
- await resolveCrossModuleSymbolExports(args.file, mod2, sup, args.projectRoot, args.graphOptions, args.workspaceConfig, args.opts?.logLevel);
52951
+ await resolveCrossModuleSymbolExports(args.file, mod2, sup, args.projectRoot, args.graphOptions, args.workspaceConfig, args.matchPath);
52913
52952
  const sigInfo = args.fileSignatures.get(args.file);
52914
52953
  const cacheable = !prepared.nativeFallbackReason && !lacksParserContext;
52915
52954
  let cacheWrite;
@@ -53093,7 +53132,7 @@ async function prepareFileSignatures(args) {
53093
53132
  args.trustedSources?.set(file2, source);
53094
53133
  return [file2, fileSignatureFromSource(source, gitSig)];
53095
53134
  }
53096
- const sigInfo = await fileSignature(file2, args.needsContentHash ? args.opts?.cacheStrict : false, gitSig, {
53135
+ const sigInfo = await fileSignature(file2, args.signatureStrict, gitSig, {
53097
53136
  forceContentHash: args.cacheEnabled && !gitSig
53098
53137
  });
53099
53138
  return [file2, sigInfo];
@@ -53106,7 +53145,7 @@ async function buildProjectIndexFromExport(projectRoot, opts, helperOpts) {
53106
53145
  async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperOpts) {
53107
53146
  clearResolutionCaches();
53108
53147
  await initializeFileIdentityCaseSensitivity(projectRoot);
53109
- const { normalizedProjectRoot, report, timings, totalStart, cacheMode, cacheEnabled, graphOptions, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts);
53148
+ const { normalizedProjectRoot, report, timings, totalStart, cacheEnabled, graphOptions, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts);
53110
53149
  const manifestMode = helperOpts?.manifestMode ?? "off";
53111
53150
  const useManifest = manifestMode !== "off";
53112
53151
  const shouldWriteManifest = manifestMode === "read-write";
@@ -53165,11 +53204,13 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53165
53204
  const manifestEntriesForIndex = useManifest ? projectIndexManifestEntries2(cachedGraphEntries ?? []) : /* @__PURE__ */ new Map();
53166
53205
  const modules = /* @__PURE__ */ new Map();
53167
53206
  const gitAvailable = await isGitRepo(projectRoot);
53168
- const useGitSignatures = gitAvailable && (cacheMode !== "off" || opts?.cacheStrict);
53207
+ const needsPersistentSignatures = cacheEnabled || useManifest;
53208
+ const useGitSignatures = gitAvailable && needsPersistentSignatures;
53169
53209
  const gitSigMap = useGitSignatures ? await getGitBlobHashes(projectRoot, normalizedFiles, {
53170
53210
  gitAvailable,
53171
53211
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {}
53172
53212
  }) : /* @__PURE__ */ new Map();
53213
+ const signatureStrict = needsPersistentSignatures ? opts?.cacheStrict : false;
53173
53214
  const conc = edgeProbeConcurrency;
53174
53215
  const languageExtensions = normalizeLanguageExtensions(opts?.languageExtensions);
53175
53216
  const sqlFiles2 = normalizedFiles.filter((file2) => {
@@ -53180,10 +53221,9 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53180
53221
  const fileSignatures = await prepareFileSignatures({
53181
53222
  projectRoot,
53182
53223
  files: sqlFiles2,
53183
- opts,
53184
53224
  gitSigMap,
53185
53225
  cacheEnabled,
53186
- needsContentHash: true,
53226
+ signatureStrict,
53187
53227
  concurrency: conc,
53188
53228
  ...confinedRoot ? { confinedRoot, trustedSources } : {}
53189
53229
  });
@@ -53212,7 +53252,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53212
53252
  trustedSources?.set(file2, source);
53213
53253
  sigInfo = fileSignatureFromSource(source, gitSig);
53214
53254
  } else {
53215
- sigInfo = await fileSignature(file2, opts?.cacheStrict, gitSig, {
53255
+ sigInfo = await fileSignature(file2, signatureStrict, gitSig, {
53216
53256
  forceContentHash: cacheEnabled && !gitSig
53217
53257
  });
53218
53258
  }
@@ -53240,6 +53280,16 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53240
53280
  const persistedBloomFilters = bloomFilterCache ? await tryLoadPersistedBloomFilters(projectRoot, opts, report) : null;
53241
53281
  const parsedMap = /* @__PURE__ */ new Map();
53242
53282
  const workspaceConfig = await loadWorkspaceConfig(projectRoot);
53283
+ const tsconfigMatchPathByDirectory = /* @__PURE__ */ new Map();
53284
+ const loadMatchPathForFile = (file2) => {
53285
+ const directory = path47.dirname(file2);
53286
+ let matchPath = tsconfigMatchPathByDirectory.get(directory);
53287
+ if (!matchPath) {
53288
+ matchPath = loadNearestTsconfigFor(file2, projectRoot, opts?.logLevel).then((tsconfig) => tsconfig.matchPath);
53289
+ tsconfigMatchPathByDirectory.set(directory, matchPath);
53290
+ }
53291
+ return matchPath;
53292
+ };
53243
53293
  const parseStart = performance5.now();
53244
53294
  const graph = { nodes: new Set(normalizedFiles), edges: [] };
53245
53295
  const onFileEdges = manifestEntries ? (file2, entry) => {
@@ -53312,6 +53362,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53312
53362
  ensureBuildProgressStarted();
53313
53363
  let graphContext;
53314
53364
  let cacheWrite;
53365
+ const matchPath = support.id === "ts" || support.id === "tsx" ? await loadMatchPathForFile(file2) : void 0;
53315
53366
  if (!mod2) {
53316
53367
  const built = await buildIndexedModuleForFile({
53317
53368
  file: file2,
@@ -53320,7 +53371,8 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
53320
53371
  opts,
53321
53372
  report,
53322
53373
  graphOptions,
53323
- workspaceConfig,
53374
+ ...workspaceConfig ? { workspaceConfig } : {},
53375
+ ...matchPath ? { matchPath } : {},
53324
53376
  workerSetup,
53325
53377
  ...resolverEnvironmentFingerprint !== void 0 ? { resolverEnvironmentFingerprint } : {},
53326
53378
  parsedMap,
@@ -53852,6 +53904,16 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
53852
53904
  }
53853
53905
  }
53854
53906
  const workspaceConfig = await loadWorkspaceConfig(projectRoot);
53907
+ const tsconfigMatchPathByDirectory = /* @__PURE__ */ new Map();
53908
+ const loadMatchPathForFile = (file2) => {
53909
+ const directory = path47.dirname(file2);
53910
+ let matchPath = tsconfigMatchPathByDirectory.get(directory);
53911
+ if (!matchPath) {
53912
+ matchPath = loadNearestTsconfigFor(file2, projectRoot, opts?.logLevel).then((tsconfig) => tsconfig.matchPath);
53913
+ tsconfigMatchPathByDirectory.set(directory, matchPath);
53914
+ }
53915
+ return matchPath;
53916
+ };
53855
53917
  const conc = buildConcurrency(opts);
53856
53918
  let workerSetup = emptyWorkerPoolSetup();
53857
53919
  try {
@@ -53863,10 +53925,9 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
53863
53925
  const fileSignatures = await prepareFileSignatures({
53864
53926
  projectRoot,
53865
53927
  files: Array.from(allFiles),
53866
- opts,
53867
53928
  gitSigMap,
53868
53929
  cacheEnabled,
53869
- needsContentHash: cacheEnabled || manifestUsed || opts?.cacheStrict === true,
53930
+ signatureStrict: opts?.cacheStrict,
53870
53931
  concurrency: conc
53871
53932
  });
53872
53933
  const modules = /* @__PURE__ */ new Map();
@@ -53965,6 +54026,7 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
53965
54026
  const support = supportForFile(file2, opts?.languageExtensions);
53966
54027
  if (!support)
53967
54028
  return [file2, createEmptyModuleIndex(file2)];
54029
+ const matchPath = support.id === "ts" || support.id === "tsx" ? await loadMatchPathForFile(file2) : void 0;
53968
54030
  const built = await buildIndexedModuleForFile({
53969
54031
  file: file2,
53970
54032
  support,
@@ -53972,7 +54034,8 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
53972
54034
  opts,
53973
54035
  report,
53974
54036
  graphOptions,
53975
- workspaceConfig,
54037
+ ...workspaceConfig ? { workspaceConfig } : {},
54038
+ ...matchPath ? { matchPath } : {},
53976
54039
  workerSetup,
53977
54040
  parsedMap,
53978
54041
  parsedCacheMaxEntries: parsedCacheMaxEntries(opts),
@@ -62959,7 +63022,7 @@ var init_reference_context = __esm({
62959
63022
 
62960
63023
  // dist/indexer/navigation-references.js
62961
63024
  function exportFromIdentifier(index, fileId, range, parsed) {
62962
- if (!isJsTsLanguage(parsed.sup.id))
63025
+ if (!parsed.sup.supportsExportFromReferences)
62963
63026
  return null;
62964
63027
  const startIndex = range.start.index;
62965
63028
  if (typeof startIndex !== "number")
@@ -63083,8 +63146,16 @@ async function collectVerifiedNamedNodeReferences(index, fileId, symbolName, exp
63083
63146
  if (maxVerified !== void 0 && maxVerified > 0 && verified.length >= maxVerified) {
63084
63147
  break;
63085
63148
  }
63086
- if (exportFromIdentifier(index, fileId, range, parsed)?.isExportFrom)
63087
- continue;
63149
+ const exportFrom = exportFromIdentifier(index, fileId, range, parsed);
63150
+ if (exportFrom?.entry) {
63151
+ const reexported = resolveExport(index, exportFrom.entry.fromModule, exportFrom.entry.sourceSpecifier);
63152
+ if (reexported?.kind === "resolved") {
63153
+ if (sameDef(reexported.def, expectedDef, index.languageExtensions)) {
63154
+ verified.push({ range, via: { reexport: true } });
63155
+ }
63156
+ continue;
63157
+ }
63158
+ }
63088
63159
  const resolved = await resolveDefinition({
63089
63160
  file: fileId,
63090
63161
  line: range.start.line,
@@ -63093,7 +63164,11 @@ async function collectVerifiedNamedNodeReferences(index, fileId, symbolName, exp
63093
63164
  if (resolved.status !== "ok" || !resolved.definition)
63094
63165
  continue;
63095
63166
  if (sameDef(resolved.definition, expectedDef, index.languageExtensions)) {
63096
- verified.push({ range, ...resolved.provenance ? { provenance: resolved.provenance } : {} });
63167
+ verified.push({
63168
+ range,
63169
+ ...exportFrom?.isExportFrom ? { via: { reexport: true } } : {},
63170
+ ...resolved.provenance ? { provenance: resolved.provenance } : {}
63171
+ });
63097
63172
  }
63098
63173
  }
63099
63174
  return verified;
@@ -63188,6 +63263,9 @@ function filesExportingDefinition(index, def, exportedNames) {
63188
63263
  break;
63189
63264
  }
63190
63265
  }
63266
+ if (moduleIndex.exports.some((entry) => entry.type === "reexport" && exportedNames.includes(entry.sourceSpecifier) && resolveExport(index, entry.fromModule, entry.sourceSpecifier)?.kind !== "resolved")) {
63267
+ files.set(fileIdentityKey(fileId), fileId);
63268
+ }
63191
63269
  }
63192
63270
  return [...files.values()];
63193
63271
  }
@@ -63227,7 +63305,13 @@ function getCachedReferenceCandidateFiles(index, def, exportedNames, hasGlobalNa
63227
63305
  return cached2;
63228
63306
  const candidates = /* @__PURE__ */ new Map();
63229
63307
  const candidateFileEntries = getIndexedReferenceCandidateFiles(index, def, exportedNames) ?? Array.from(index.byFile.values(), (module2) => module2.file);
63230
- const exportingFiles = new Set(filesExportingDefinition(index, def, exportedNames).map((file2) => fileIdentityKey(file2)));
63308
+ const exportingFileIds = filesExportingDefinition(index, def, exportedNames);
63309
+ const exportingFiles = new Set(exportingFileIds.map((file2) => fileIdentityKey(file2)));
63310
+ for (const fileId of exportingFileIds) {
63311
+ if (fileIdentityKey(fileId) !== fileIdentityKey(def.file)) {
63312
+ candidates.set(fileIdentityKey(fileId), fileId);
63313
+ }
63314
+ }
63231
63315
  for (const fileId of candidateFileEntries) {
63232
63316
  if (fileIdentityKey(fileId) === fileIdentityKey(def.file))
63233
63317
  continue;
@@ -63251,7 +63335,6 @@ var init_navigation_references = __esm({
63251
63335
  "dist/indexer/navigation-references.js"() {
63252
63336
  "use strict";
63253
63337
  init_languages();
63254
- init_js_family();
63255
63338
  init_paths();
63256
63339
  init_ast();
63257
63340
  init_parse_context();
@@ -63713,6 +63796,30 @@ async function goToDefinition(index, req, parsedContext) {
63713
63796
  name = sliceText(declNameNode, source);
63714
63797
  }
63715
63798
  }
63799
+ if (node && sup.supportsExportFromReferences && index.projectRoot) {
63800
+ const exportFrom = exportFromIdentifier(index, file2, toRange(node), context);
63801
+ if (exportFrom?.entry) {
63802
+ let resolvedTarget;
63803
+ if (index.byFile.has(fileIdentityKey(exportFrom.entry.fromModule))) {
63804
+ resolvedTarget = exportFrom.entry.fromModule;
63805
+ } else {
63806
+ const { matchPath } = await loadNearestTsconfigFor(file2, index.projectRoot);
63807
+ resolvedTarget = await resolveImportSpecifier(index.projectRoot, file2, exportFrom.entry.moduleSpecifier ?? exportFrom.entry.fromModule, sup.id, {
63808
+ ...matchPath ? { matchPath } : {}
63809
+ });
63810
+ }
63811
+ if (typeof resolvedTarget === "string") {
63812
+ const hit = resolveExport(index, resolvedTarget, exportFrom.entry.sourceSpecifier);
63813
+ if (hit?.kind === "resolved") {
63814
+ return okGoToResult(index, hit.def, {
63815
+ via: { importedFrom: resolvedTarget, exportedName: exportFrom.entry.sourceSpecifier },
63816
+ resolution: "import",
63817
+ confidence: "high"
63818
+ });
63819
+ }
63820
+ }
63821
+ }
63822
+ }
63716
63823
  if (sup.supportsCrossModuleSymbols) {
63717
63824
  const scopeIndex = node.parent && isMemberAccessNode(sup, node.parent) ? getOrBuildScopeIndex(index, file2, source, sup, mod2, tree) : null;
63718
63825
  const memberAccessResult = await resolveMemberAccessDefinition({
@@ -63903,6 +64010,28 @@ async function findReferences(index, req, opts) {
63903
64010
  }
63904
64011
  return scopeIndex;
63905
64012
  };
64013
+ if (supportForFile(fileId, index.languageExtensions)?.supportsExportFromReferences) {
64014
+ for (const entry of module2.exports) {
64015
+ if (hasReachedMaxReferences())
64016
+ break;
64017
+ if (entry.type !== "reexport")
64018
+ continue;
64019
+ if (!exportedNameSet.has(entry.sourceSpecifier))
64020
+ continue;
64021
+ const resolved = resolveExport(index, entry.fromModule, entry.sourceSpecifier);
64022
+ if (resolved?.kind === "resolved" && !sameDef(resolved.def, def, index.languageExtensions))
64023
+ continue;
64024
+ const remainingReferences = maxReferences !== void 0 ? Math.max(0, maxReferences - refs.length) : void 0;
64025
+ const ranges = await collectVerifiedNamedNodeReferences(index, fileId, entry.sourceSpecifier, def, (params, parsed) => goToDefinition(index, params, parsed), remainingReferences);
64026
+ for (const { range, provenance: provenance3, via } of ranges) {
64027
+ if (hasReachedMaxReferences())
64028
+ break;
64029
+ if (!via?.reexport)
64030
+ continue;
64031
+ pushRef({ file: fileId, range, via, ...provenance3 ? { provenance: provenance3 } : {} });
64032
+ }
64033
+ }
64034
+ }
63906
64035
  for (const imp of module2.imports) {
63907
64036
  if (hasReachedMaxReferences())
63908
64037
  break;
@@ -63938,10 +64067,15 @@ async function findReferences(index, req, opts) {
63938
64067
  }
63939
64068
  const remainingReferences = maxReferences !== void 0 ? Math.max(0, maxReferences - refs.length) : void 0;
63940
64069
  const ranges = await collectVerifiedNamedNodeReferences(index, fileId, exportedName, def, (params, parsed) => goToDefinition(index, params, parsed), remainingReferences);
63941
- for (const { range, provenance: provenance3 } of ranges) {
64070
+ for (const { range, provenance: provenance3, via } of ranges) {
63942
64071
  if (hasReachedMaxReferences())
63943
64072
  break;
63944
- pushRef({ file: fileId, range, via: { import: imp }, ...provenance3 ? { provenance: provenance3 } : {} });
64073
+ pushRef({
64074
+ file: fileId,
64075
+ range,
64076
+ via: { import: imp, ...via ?? {} },
64077
+ ...provenance3 ? { provenance: provenance3 } : {}
64078
+ });
63945
64079
  }
63946
64080
  } else {
63947
64081
  let exported = exportedName;
@@ -63957,10 +64091,15 @@ async function findReferences(index, req, opts) {
63957
64091
  if (fileIdentityKey(targetFile) !== fileIdentityKey(definitionFile)) {
63958
64092
  const remainingReferences = maxReferences !== void 0 ? Math.max(0, maxReferences - refs.length) : void 0;
63959
64093
  const ranges = await collectVerifiedNamedNodeReferences(index, fileId, imp.local, def, (params, parsed2) => goToDefinition(index, params, parsed2), remainingReferences);
63960
- for (const { range, provenance: provenance3 } of ranges) {
64094
+ for (const { range, provenance: provenance3, via } of ranges) {
63961
64095
  if (hasReachedMaxReferences())
63962
64096
  break;
63963
- pushRef({ file: fileId, range, via: { import: imp }, ...provenance3 ? { provenance: provenance3 } : {} });
64097
+ pushRef({
64098
+ file: fileId,
64099
+ range,
64100
+ via: { import: imp, ...via ?? {} },
64101
+ ...provenance3 ? { provenance: provenance3 } : {}
64102
+ });
63964
64103
  }
63965
64104
  continue;
63966
64105
  }
@@ -63986,10 +64125,10 @@ async function findReferences(index, req, opts) {
63986
64125
  if (hasReachedMaxReferences())
63987
64126
  break;
63988
64127
  const ranges = await collectVerifiedNamedNodeReferences(index, fileId, candidateName, def, (params, parsed) => goToDefinition(index, params, parsed), remainingReferences);
63989
- for (const { range, provenance: provenance3 } of ranges) {
64128
+ for (const { range, provenance: provenance3, via } of ranges) {
63990
64129
  if (hasReachedMaxReferences())
63991
64130
  break;
63992
- pushRef({ file: fileId, range, ...provenance3 ? { provenance: provenance3 } : {} });
64131
+ pushRef({ file: fileId, range, ...via ? { via } : {}, ...provenance3 ? { provenance: provenance3 } : {} });
63993
64132
  }
63994
64133
  }
63995
64134
  }
@@ -64004,10 +64143,10 @@ async function findReferences(index, req, opts) {
64004
64143
  continue;
64005
64144
  const remainingReferences = maxReferences !== void 0 ? Math.max(0, maxReferences - refs.length) : void 0;
64006
64145
  const ranges = await collectVerifiedNamedNodeReferences(index, fileId, def.localName, def, (params, parsed) => goToDefinition(index, params, parsed), remainingReferences);
64007
- for (const { range, provenance: provenance3 } of ranges) {
64146
+ for (const { range, provenance: provenance3, via } of ranges) {
64008
64147
  if (hasReachedMaxReferences())
64009
64148
  break;
64010
- pushRef({ file: fileId, range, ...provenance3 ? { provenance: provenance3 } : {} });
64149
+ pushRef({ file: fileId, range, ...via ? { via } : {}, ...provenance3 ? { provenance: provenance3 } : {} });
64011
64150
  }
64012
64151
  }
64013
64152
  }