@lzehrung/codegraph 2.3.2 → 2.3.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 (69) hide show
  1. package/dist/agent/query-index/content.d.ts.map +1 -1
  2. package/dist/agent/query-index/content.js +4 -1
  3. package/dist/agent/query-index/content.js.map +1 -1
  4. package/dist/agent/query-index/update.js +2 -2
  5. package/dist/agent/query-index/update.js.map +1 -1
  6. package/dist/agent/query-index/workerPool.d.ts +22 -0
  7. package/dist/agent/query-index/workerPool.d.ts.map +1 -1
  8. package/dist/agent/query-index/workerPool.js +31 -1
  9. package/dist/agent/query-index/workerPool.js.map +1 -1
  10. package/dist/bin/cli.js +2082 -321
  11. package/dist/bin/queryIndexWorker.js +2 -2
  12. package/dist/duplicate-identifier-ranges.d.ts +5 -0
  13. package/dist/duplicate-identifier-ranges.d.ts.map +1 -0
  14. package/dist/duplicate-identifier-ranges.js +1500 -0
  15. package/dist/duplicate-identifier-ranges.js.map +1 -0
  16. package/dist/duplicate-token-normalization.d.ts.map +1 -1
  17. package/dist/duplicate-token-normalization.js +15 -1
  18. package/dist/duplicate-token-normalization.js.map +1 -1
  19. package/dist/duplicates/unitCache.d.ts +1 -1
  20. package/dist/duplicates/unitCache.d.ts.map +1 -1
  21. package/dist/duplicates/unitCache.js +5 -1
  22. package/dist/duplicates/unitCache.js.map +1 -1
  23. package/dist/indexer/build-cache/manifest.d.ts.map +1 -1
  24. package/dist/indexer/build-cache/manifest.js +25 -7
  25. package/dist/indexer/build-cache/manifest.js.map +1 -1
  26. package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
  27. package/dist/indexer/build-cache/module-cache.js +29 -14
  28. package/dist/indexer/build-cache/module-cache.js.map +1 -1
  29. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  30. package/dist/indexer/build-cache/project-snapshot.js +4 -1
  31. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  32. package/dist/indexer/build-index.d.ts.map +1 -1
  33. package/dist/indexer/build-index.js +25 -9
  34. package/dist/indexer/build-index.js.map +1 -1
  35. package/dist/indexer/build-workers.d.ts +5 -2
  36. package/dist/indexer/build-workers.d.ts.map +1 -1
  37. package/dist/indexer/build-workers.js +5 -3
  38. package/dist/indexer/build-workers.js.map +1 -1
  39. package/dist/indexer/finalize.d.ts +2 -1
  40. package/dist/indexer/finalize.d.ts.map +1 -1
  41. package/dist/indexer/finalize.js +3 -2
  42. package/dist/indexer/finalize.js.map +1 -1
  43. package/dist/indexer/types.d.ts +1 -1
  44. package/dist/indexer/types.d.ts.map +1 -1
  45. package/dist/util/bloomFilter.d.ts +1 -1
  46. package/dist/util/bloomFilter.d.ts.map +1 -1
  47. package/dist/util/bloomFilter.js +2 -1
  48. package/dist/util/bloomFilter.js.map +1 -1
  49. package/dist/util/git.d.ts +2 -18
  50. package/dist/util/git.d.ts.map +1 -1
  51. package/dist/util/git.js +23 -6
  52. package/dist/util/git.js.map +1 -1
  53. package/dist/util/identifiers.d.ts +0 -6
  54. package/dist/util/identifiers.d.ts.map +1 -1
  55. package/dist/util/identifiers.js +0 -6
  56. package/dist/util/identifiers.js.map +1 -1
  57. package/dist/util/projectFiles.d.ts +46 -5
  58. package/dist/util/projectFiles.d.ts.map +1 -1
  59. package/dist/util/projectFiles.js +227 -94
  60. package/dist/util/projectFiles.js.map +1 -1
  61. package/dist/worker/nativeExtractWorker.d.ts +8 -0
  62. package/dist/worker/nativeExtractWorker.d.ts.map +1 -1
  63. package/dist/worker/nativeExtractWorker.js +25 -2
  64. package/dist/worker/nativeExtractWorker.js.map +1 -1
  65. package/dist/worker/nativeWorkerPool.d.ts +2 -0
  66. package/dist/worker/nativeWorkerPool.d.ts.map +1 -1
  67. package/dist/worker/nativeWorkerPool.js +13 -1
  68. package/dist/worker/nativeWorkerPool.js.map +1 -1
  69. package/package.json +3 -3
package/dist/bin/cli.js CHANGED
@@ -2395,12 +2395,11 @@ function hasNonAsciiCodePoint(value, includeC0Controls = false) {
2395
2395
  }
2396
2396
  return false;
2397
2397
  }
2398
- var ECMASCRIPT_IDENTIFIER_SOURCE, DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE, BLOOM_FILTER_IDENTIFIER_SOURCE, XID_IDENTIFIER_SOURCE, PYTHON_IDENTIFIER_SOURCE, PHP_IDENTIFIER_SOURCE, JAVA_IDENTIFIER_IGNORABLE_SOURCE, CSHARP_IDENTIFIER_FORMAT_SOURCE, JAVA_IDENTIFIER_SOURCE, CSHARP_IDENTIFIER_SOURCE, GO_IDENTIFIER_SOURCE, KOTLIN_IDENTIFIER_SOURCE;
2398
+ var ECMASCRIPT_IDENTIFIER_SOURCE, BLOOM_FILTER_IDENTIFIER_SOURCE, XID_IDENTIFIER_SOURCE, PYTHON_IDENTIFIER_SOURCE, PHP_IDENTIFIER_SOURCE, JAVA_IDENTIFIER_IGNORABLE_SOURCE, CSHARP_IDENTIFIER_FORMAT_SOURCE, JAVA_IDENTIFIER_SOURCE, CSHARP_IDENTIFIER_SOURCE, GO_IDENTIFIER_SOURCE, KOTLIN_IDENTIFIER_SOURCE;
2399
2399
  var init_identifiers = __esm({
2400
2400
  "dist/util/identifiers.js"() {
2401
2401
  "use strict";
2402
2402
  ECMASCRIPT_IDENTIFIER_SOURCE = String.raw`[$_\p{ID_Start}](?:[$_\p{ID_Continue}]|\u200c|\u200d)*`;
2403
- DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE = String.raw`[$_\p{XID_Start}\u1885\u1886\u2118\u212E\u309B\u309C](?:[$_\p{XID_Continue}\u00B7\u0387\u1369-\u1371\u19DA\u200C\u200D\u1885\u1886\u2118\u212E\u309B\u309C])*`;
2404
2403
  BLOOM_FILTER_IDENTIFIER_SOURCE = String.raw`[A-Za-z0-9_$\u0000-\u0008\u000E-\u001B\u007F-\u009F\u200C\u200D\u0080-\u{10FFFF}]+`;
2405
2404
  XID_IDENTIFIER_SOURCE = String.raw`[_\p{XID_Start}][_\p{XID_Continue}]*`;
2406
2405
  PYTHON_IDENTIFIER_SOURCE = XID_IDENTIFIER_SOURCE;
@@ -4761,9 +4760,9 @@ var require_path = __commonJS({
4761
4760
  "use strict";
4762
4761
  Object.defineProperty(exports, "__esModule", { value: true });
4763
4762
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
4764
- var os12 = __require("os");
4763
+ var os13 = __require("os");
4765
4764
  var path99 = __require("path");
4766
- var IS_WINDOWS_PLATFORM = os12.platform() === "win32";
4765
+ var IS_WINDOWS_PLATFORM = os13.platform() === "win32";
4767
4766
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
4768
4767
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
4769
4768
  var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
@@ -10281,8 +10280,8 @@ var require_settings4 = __commonJS({
10281
10280
  Object.defineProperty(exports, "__esModule", { value: true });
10282
10281
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10283
10282
  var fs49 = __require("fs");
10284
- var os12 = __require("os");
10285
- var CPU_COUNT = Math.max(os12.cpus().length, 1);
10283
+ var os13 = __require("os");
10284
+ var CPU_COUNT = Math.max(os13.cpus().length, 1);
10286
10285
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10287
10286
  lstat: fs49.lstat,
10288
10287
  lstatSync: fs49.lstatSync,
@@ -13503,6 +13502,7 @@ __export(git_exports, {
13503
13502
  decodeGitPath: () => decodeGitPath,
13504
13503
  getGitBlobHashes: () => getGitBlobHashes,
13505
13504
  getGitHead: () => getGitHead,
13505
+ getGitRepositoryRoot: () => getGitRepositoryRoot,
13506
13506
  getUnifiedDiff: () => getUnifiedDiff,
13507
13507
  gitDiffArgs: () => gitDiffArgs,
13508
13508
  isGitIndexSentinel: () => isGitIndexSentinel,
@@ -13796,6 +13796,15 @@ async function isGitRepo(projectRoot) {
13796
13796
  gitRepositoryChecks.set(resolvedRoot, check2);
13797
13797
  return await check2;
13798
13798
  }
13799
+ async function getGitRepositoryRoot(projectRoot) {
13800
+ try {
13801
+ const { stdout } = await runGit(projectRoot, ["rev-parse", "--show-toplevel"]);
13802
+ const root = normalizePath(stdout.trim());
13803
+ return root || null;
13804
+ } catch {
13805
+ return null;
13806
+ }
13807
+ }
13799
13808
  async function isGitPathTracked(projectRoot, file2) {
13800
13809
  return await runGitPathPredicate(projectRoot, ["ls-files", "--error-unmatch", "--", normalizePath(file2)]);
13801
13810
  }
@@ -13917,6 +13926,9 @@ async function listChangedFiles(projectRoot, opts) {
13917
13926
  throw createGitError(projectRoot, args, error51);
13918
13927
  }
13919
13928
  }
13929
+ function resolveGitListedPath(projectRoot, listedPath) {
13930
+ return normalizePath(path8.isAbsolute(listedPath) ? listedPath : path8.resolve(projectRoot, listedPath));
13931
+ }
13920
13932
  async function listTrackedFiles(projectRoot, opts) {
13921
13933
  if (!(opts?.gitAvailable ?? true))
13922
13934
  return [];
@@ -13927,7 +13939,7 @@ async function listTrackedFiles(projectRoot, opts) {
13927
13939
  const { stdout } = await runGit(projectRoot, args, { maxBuffer: 64 * 1024 * 1024 });
13928
13940
  const out = [];
13929
13941
  for (const rel of stdout.split("\0").filter(Boolean)) {
13930
- const abs = normalizePath(path8.resolve(projectRoot, rel));
13942
+ const abs = resolveGitListedPath(projectRoot, rel);
13931
13943
  if (abs)
13932
13944
  out.push(abs);
13933
13945
  }
@@ -13987,7 +13999,7 @@ async function listGitExcludeFilesUncached(projectRoot) {
13987
13999
  const { stdout } = await runGit(projectRoot, ["rev-parse", "--git-path", "info/exclude"]);
13988
14000
  const resolved = stdout.trim();
13989
14001
  if (resolved)
13990
- candidates.push(normalizePath(path8.resolve(projectRoot, resolved)));
14002
+ candidates.push({ file: normalizePath(path8.resolve(projectRoot, resolved)), priority: 1 });
13991
14003
  } catch {
13992
14004
  }
13993
14005
  try {
@@ -13995,15 +14007,19 @@ async function listGitExcludeFilesUncached(projectRoot) {
13995
14007
  const configured = stdout.trim();
13996
14008
  if (configured) {
13997
14009
  const expanded = configured.startsWith("~") ? path8.join(os2.homedir(), configured.slice(1)) : path8.resolve(projectRoot, configured);
13998
- candidates.push(normalizePath(expanded));
14010
+ candidates.push({ file: normalizePath(expanded), priority: 0 });
13999
14011
  }
14000
14012
  } catch {
14001
14013
  }
14002
14014
  const sources = [];
14003
- for (const file2 of Array.from(new Set(candidates))) {
14015
+ const uniqueCandidates = /* @__PURE__ */ new Map();
14016
+ for (const candidate of candidates) {
14017
+ uniqueCandidates.set(candidate.file, Math.max(uniqueCandidates.get(candidate.file) ?? candidate.priority, candidate.priority));
14018
+ }
14019
+ for (const [file2, priority] of uniqueCandidates) {
14004
14020
  try {
14005
14021
  if ((await fsp4.stat(file2)).isFile())
14006
- sources.push({ file: file2, baseDir });
14022
+ sources.push({ file: file2, baseDir, priority });
14007
14023
  } catch {
14008
14024
  }
14009
14025
  }
@@ -14021,7 +14037,7 @@ async function listUntrackedFiles(projectRoot, opts) {
14021
14037
  const relFiles = stdout.toString().split("\0").filter(Boolean);
14022
14038
  const out = [];
14023
14039
  for (const rel of relFiles) {
14024
- const abs = normalizePath(path8.resolve(projectRoot, rel));
14040
+ const abs = resolveGitListedPath(projectRoot, rel);
14025
14041
  if (abs)
14026
14042
  out.push(abs);
14027
14043
  }
@@ -14098,9 +14114,11 @@ __export(projectFiles_exports, {
14098
14114
  DEFAULT_PROJECT_PATTERNS: () => DEFAULT_PROJECT_PATTERNS,
14099
14115
  createDiscoveredFileMatcher: () => createDiscoveredFileMatcher,
14100
14116
  discoverProjectFiles: () => discoverProjectFiles,
14117
+ discoverProjectFilesWithGitCandidates: () => discoverProjectFilesWithGitCandidates,
14101
14118
  filterRealPathsWithinRoot: () => filterRealPathsWithinRoot,
14102
14119
  isRelativePathInside: () => isRelativePathInside,
14103
14120
  listProjectFiles: () => listProjectFiles,
14121
+ listProjectFilesWithGitCandidates: () => listProjectFilesWithGitCandidates,
14104
14122
  matchesDiscoveryGlob: () => matchesDiscoveryGlob,
14105
14123
  translateGlobRootIgnoreGlobsForScanRoot: () => translateGlobRootIgnoreGlobsForScanRoot
14106
14124
  });
@@ -14187,20 +14205,34 @@ function parseGitignoreRule(baseDir, rawLine) {
14187
14205
  matches
14188
14206
  };
14189
14207
  }
14190
- async function buildGitignoreIndex(sources) {
14191
- const sorted = [...sources].map(({ file: file2, baseDir }) => ({ file: normalizePath(file2), baseDir: normalizePath(baseDir) })).sort((left, right) => {
14192
- const leftFile = left.file;
14193
- const rightFile = right.file;
14194
- const depthDelta = leftFile.split("/").length - rightFile.split("/").length;
14195
- if (depthDelta !== 0)
14196
- return depthDelta;
14197
- if (leftFile < rightFile)
14208
+ async function buildGitignoreIndex(sources, repositoryRoots = [], repositoryAliases = []) {
14209
+ const sorted = [...sources].map(({ file: file2, baseDir, repositoryRoot, priority }) => ({
14210
+ file: normalizePath(file2),
14211
+ baseDir: normalizePath(baseDir),
14212
+ priority: priority ?? 2,
14213
+ ...repositoryRoot === void 0 ? {} : { repositoryRoot: normalizePath(repositoryRoot) }
14214
+ })).sort((left, right) => {
14215
+ const baseDepthDelta = left.baseDir.split("/").length - right.baseDir.split("/").length;
14216
+ if (baseDepthDelta !== 0)
14217
+ return baseDepthDelta;
14218
+ const priorityDelta = left.priority - right.priority;
14219
+ if (priorityDelta !== 0)
14220
+ return priorityDelta;
14221
+ if (left.file < right.file)
14198
14222
  return -1;
14199
- return leftFile > rightFile ? 1 : 0;
14223
+ return left.file > right.file ? 1 : 0;
14200
14224
  });
14201
- const gitignoreIndex = { hasRules: false, byBaseDir: /* @__PURE__ */ new Map() };
14202
- for (const { file: file2, baseDir } of sorted) {
14203
- if (isIgnoredByGitignore(file2, gitignoreIndex)) {
14225
+ const gitignoreIndex = {
14226
+ hasRules: false,
14227
+ repositoryRoots: Array.from(new Set(repositoryRoots.map(normalizePath))).sort((left, right) => right.length - left.length),
14228
+ repositoryAliases: Array.from(new Map(repositoryAliases.map(({ path: aliasPath, repositoryRoot }) => [
14229
+ fileIdentityKey(aliasPath),
14230
+ { path: normalizePath(aliasPath), repositoryRoot: normalizePath(repositoryRoot) }
14231
+ ])).values()).sort((left, right) => right.path.length - left.path.length),
14232
+ byBaseDir: /* @__PURE__ */ new Map()
14233
+ };
14234
+ for (const { file: file2, baseDir, repositoryRoot } of sorted) {
14235
+ if (isIgnoredByGitignore(path9.dirname(file2), gitignoreIndex, true)) {
14204
14236
  continue;
14205
14237
  }
14206
14238
  let raw;
@@ -14218,7 +14250,7 @@ async function buildGitignoreIndex(sources) {
14218
14250
  if (existing)
14219
14251
  existing.rules.push(rule);
14220
14252
  else
14221
- gitignoreIndex.byBaseDir.set(baseKey, { baseDir, rules: [rule] });
14253
+ gitignoreIndex.byBaseDir.set(baseKey, { baseDir, repositoryRoot, rules: [rule] });
14222
14254
  gitignoreIndex.hasRules = true;
14223
14255
  }
14224
14256
  }
@@ -14247,9 +14279,10 @@ async function loadGitignoreIndexForRootAliases(projectRoot) {
14247
14279
  }
14248
14280
  return await buildGitignoreIndex(sources);
14249
14281
  }
14250
- function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14282
+ function isIgnoredByGitignore(absolutePath, gitignoreIndex, isDirectory2 = false) {
14251
14283
  if (!gitignoreIndex.hasRules)
14252
14284
  return false;
14285
+ const owningRepositoryRoot = gitignoreIndex.repositoryRoots.find((root) => isFilePathWithinRoot(root, absolutePath)) ?? gitignoreIndex.repositoryAliases.find(({ path: aliasPath }) => isFilePathWithinRoot(aliasPath, absolutePath))?.repositoryRoot;
14253
14286
  const chain = [];
14254
14287
  let current = normalizePath(path9.dirname(absolutePath));
14255
14288
  for (; ; ) {
@@ -14264,6 +14297,9 @@ function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14264
14297
  let ignored = false;
14265
14298
  for (let depth = chain.length - 1; depth >= 0; depth -= 1) {
14266
14299
  const group = chain[depth];
14300
+ if (group.repositoryRoot !== void 0 && owningRepositoryRoot !== void 0 && fileIdentityKey(group.repositoryRoot) !== fileIdentityKey(owningRepositoryRoot)) {
14301
+ continue;
14302
+ }
14267
14303
  const relativePath3 = path9.relative(group.baseDir, absolutePath);
14268
14304
  if (!isRelativePathInside(relativePath3)) {
14269
14305
  continue;
@@ -14271,10 +14307,11 @@ function isIgnoredByGitignore(absolutePath, gitignoreIndex) {
14271
14307
  const normalizedRelativePath2 = normalizePath(relativePath3);
14272
14308
  const hasSeparator = normalizedRelativePath2.includes("/");
14273
14309
  for (const rule of group.rules) {
14274
- if (rule.dirOnly && !hasSeparator) {
14310
+ if (rule.dirOnly && !hasSeparator && !isDirectory2) {
14275
14311
  continue;
14276
14312
  }
14277
- if (rule.matches(normalizedRelativePath2)) {
14313
+ const matchesDirectory = isDirectory2 && rule.dirOnly && rule.matches(`${normalizedRelativePath2}/.directory`);
14314
+ if (rule.matches(normalizedRelativePath2) || matchesDirectory) {
14278
14315
  ignored = !rule.negated;
14279
14316
  }
14280
14317
  }
@@ -14313,40 +14350,89 @@ function collectCandidateAncestorDirectories(root, files) {
14313
14350
  }
14314
14351
  return directories;
14315
14352
  }
14316
- async function findGitIgnoreSources(root, files) {
14317
- const directories = collectCandidateAncestorDirectories(root, files);
14318
- const present = await mapLimitSemaphore(directories, REALPATH_FILTER_CONCURRENCY, async (directory) => {
14319
- const candidate = normalizePath(path9.join(directory, ".gitignore"));
14320
- try {
14321
- return (await fsp5.stat(candidate)).isFile() ? { file: candidate, baseDir: directory } : null;
14322
- } catch {
14323
- return null;
14324
- }
14325
- });
14326
- const sources = present.filter((entry) => entry !== null);
14327
- sources.push(...await listGitExcludeFiles(root));
14353
+ async function findGitIgnoreSources(sourceRoots, files) {
14354
+ const roots = Array.from(new Map(sourceRoots.map(({ path: sourceRoot, repositoryRoot }) => [
14355
+ fileIdentityKey(sourceRoot),
14356
+ { path: normalizePath(sourceRoot), repositoryRoot: normalizePath(repositoryRoot) }
14357
+ ])).values());
14358
+ const sources = [];
14359
+ for (const { path: sourceRoot, repositoryRoot } of roots) {
14360
+ const directories = collectCandidateAncestorDirectories(sourceRoot, files.filter((file2) => isFilePathWithinRoot(sourceRoot, file2)));
14361
+ const present = await mapLimitSemaphore(directories, REALPATH_FILTER_CONCURRENCY, async (directory) => {
14362
+ const candidate = normalizePath(path9.join(directory, ".gitignore"));
14363
+ try {
14364
+ return (await fsp5.stat(candidate)).isFile() ? { file: candidate, baseDir: directory, repositoryRoot, priority: 2 } : null;
14365
+ } catch {
14366
+ return null;
14367
+ }
14368
+ });
14369
+ sources.push(...present.filter((entry) => entry !== null));
14370
+ sources.push(...(await listGitExcludeFiles(sourceRoot)).map((source) => ({
14371
+ ...source,
14372
+ repositoryRoot: source.baseDir
14373
+ })));
14374
+ }
14328
14375
  return sources;
14329
14376
  }
14330
14377
  async function listGitCandidateFiles(root, logLevel) {
14331
14378
  try {
14332
- if (!await isGitRepo(root))
14379
+ const realRoot = normalizePath(await fsp5.realpath(root));
14380
+ const gitRoot = await isGitRepo(root) ? root : realRoot;
14381
+ if (!await isGitRepo(gitRoot))
14382
+ return null;
14383
+ if (await isGitProjectRootIgnored(realRoot))
14333
14384
  return null;
14334
- if (await isGitProjectRootIgnored(root))
14385
+ const gitRepositoryRoot = await getGitRepositoryRoot(gitRoot);
14386
+ if (!gitRepositoryRoot)
14335
14387
  return null;
14336
14388
  const [tracked, untracked, submoduleDirectories] = await Promise.all([
14337
- listTrackedFiles(root, { recurseSubmodules: true, ...logLevel === void 0 ? {} : { logLevel } }),
14338
- listUntrackedFiles(root, { respectGitignore: true }),
14339
- listGitSubmoduleDirectories(root, { recurse: true })
14389
+ listTrackedFiles(gitRoot, { recurseSubmodules: true, ...logLevel === void 0 ? {} : { logLevel } }),
14390
+ listUntrackedFiles(gitRoot, { respectGitignore: true }),
14391
+ listGitSubmoduleDirectories(gitRoot, { recurse: true })
14340
14392
  ]);
14341
- const submoduleUntracked = await Promise.all(submoduleDirectories.map(async (directory) => await listUntrackedFiles(directory, { respectGitignore: true })));
14342
- const files = Array.from(/* @__PURE__ */ new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
14343
- return { files, gitignoreFiles: await findGitIgnoreSources(root, files) };
14393
+ const submoduleRoots = await Promise.all(submoduleDirectories.map(async (logicalPath) => ({
14394
+ logicalPath: normalizePath(logicalPath),
14395
+ physicalPath: normalizePath(await fsp5.realpath(logicalPath).catch(() => logicalPath))
14396
+ })));
14397
+ const submoduleUntracked = await Promise.all(submoduleRoots.map(async ({ physicalPath }) => await listUntrackedFiles(physicalPath, { respectGitignore: true })));
14398
+ const rawFiles = Array.from(/* @__PURE__ */ new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
14399
+ const needsLogicalRemap = normalizePath(gitRoot) !== normalizePath(root);
14400
+ const files = Array.from(new Set(rawFiles.map((file2) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file2) ? normalizePath(path9.resolve(root, path9.relative(realRoot, file2))) : normalizePath(file2)))).sort();
14401
+ const physicalFiles = normalizePath(root) === realRoot ? [] : (await mapLimitSemaphore(files, REALPATH_FILTER_CONCURRENCY, async (file2) => {
14402
+ try {
14403
+ return normalizePath(await fsp5.realpath(file2));
14404
+ } catch {
14405
+ return null;
14406
+ }
14407
+ })).filter((file2) => file2 !== null);
14408
+ const gitignoreRoots = [gitRepositoryRoot, ...submoduleRoots.map(({ physicalPath }) => physicalPath)].map(normalizePath);
14409
+ const sourceRoots = [
14410
+ { path: root, repositoryRoot: gitRepositoryRoot },
14411
+ { path: realRoot, repositoryRoot: gitRepositoryRoot },
14412
+ { path: gitRepositoryRoot, repositoryRoot: gitRepositoryRoot },
14413
+ ...submoduleRoots.flatMap(({ logicalPath, physicalPath }) => [
14414
+ { path: logicalPath, repositoryRoot: physicalPath },
14415
+ { path: physicalPath, repositoryRoot: physicalPath }
14416
+ ])
14417
+ ];
14418
+ return {
14419
+ files,
14420
+ gitignoreFiles: await findGitIgnoreSources(sourceRoots, [...rawFiles, ...files, ...physicalFiles]),
14421
+ gitignoreRoots,
14422
+ gitignoreAliases: sourceRoots
14423
+ };
14344
14424
  } catch (error51) {
14345
14425
  logWithLevel(logLevel, "debug", `Git discovery unavailable for ${root}: ${stringifyUnknown(error51)}`);
14346
14426
  return null;
14347
14427
  }
14348
14428
  }
14349
14429
  async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14430
+ return await listProjectFilesInternal(projectRoot, patterns, options);
14431
+ }
14432
+ async function listProjectFilesWithGitCandidates(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14433
+ return await listProjectFilesInternal(projectRoot, patterns, options);
14434
+ }
14435
+ async function listProjectFilesInternal(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
14350
14436
  const root = await ensureDirectoryReadable(projectRoot, "Project root");
14351
14437
  const globRoot = options?.globRoot ? await ensureDirectoryReadable(options.globRoot, "Glob root") : root;
14352
14438
  const includeGlobs = (options?.includeGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
@@ -14364,10 +14450,14 @@ async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS
14364
14450
  try {
14365
14451
  const useGitignore = options?.useGitignore ?? true;
14366
14452
  const realRoot = await fsp5.realpath(root);
14367
- const gitCandidates = useGitignore && options?.gitignoreRoot === void 0 && normalizePath(realRoot) === normalizePath(root) ? await listGitCandidateFiles(root, options?.logLevel) : null;
14453
+ const attemptedGitCandidates = useGitignore && options?.gitignoreRoot === void 0 && normalizePath(realRoot) === normalizePath(root);
14454
+ const gitCandidates = attemptedGitCandidates ? await listGitCandidateFiles(root, options?.logLevel) : null;
14455
+ if (attemptedGitCandidates) {
14456
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
14457
+ }
14368
14458
  let gitignoreIndex = EMPTY_GITIGNORE_INDEX;
14369
14459
  if (useGitignore && gitCandidates) {
14370
- gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles);
14460
+ gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases);
14371
14461
  } else if (useGitignore) {
14372
14462
  const gitignoreRoot = options?.gitignoreRoot ? await ensureDirectoryReadable(options.gitignoreRoot, "Gitignore root") : root;
14373
14463
  gitignoreIndex = await loadGitignoreIndexForRootAliases(gitignoreRoot);
@@ -14580,27 +14670,89 @@ async function buildProjectFileInfo(def, filePath) {
14580
14670
  };
14581
14671
  }
14582
14672
  async function discoverProjectFiles(projectRoot, options) {
14673
+ return await discoverProjectFilesInternal(projectRoot, options);
14674
+ }
14675
+ async function discoverProjectFilesWithGitCandidates(projectRoot, options) {
14676
+ return await discoverProjectFilesInternal(projectRoot, options);
14677
+ }
14678
+ async function discoverProjectFilesInternal(projectRoot, options) {
14583
14679
  const root = await ensureDirectoryReadable(projectRoot, "Project root");
14584
14680
  try {
14585
14681
  const realRoot = await fsp5.realpath(root);
14586
- const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((def) => def.patterns.map(toProjectGlob));
14587
- const matches = await (0, import_fast_glob2.default)(allPatterns, {
14588
- cwd: root,
14589
- absolute: true,
14590
- dot: true,
14591
- followSymbolicLinks: false,
14592
- ignore: DEFAULT_PROJECT_FILE_IGNORES,
14593
- markDirectories: true,
14594
- onlyFiles: false
14595
- });
14596
- const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14597
- markDirectories: true,
14598
- onlyFiles: false,
14599
- ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14600
- ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {}
14601
- });
14602
- const rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot);
14603
14682
  const projectFileDefinitionMatchers = PROJECT_FILE_DEFINITIONS.map((definition) => definition.patterns.map((pattern) => pattern.includes("*") || pattern.includes("?") ? new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$") : void 0));
14683
+ const matchesDefinition = (fileName, definitionIndex) => {
14684
+ const definition = PROJECT_FILE_DEFINITIONS[definitionIndex];
14685
+ return definition.patterns.some((pattern, patternIndex) => {
14686
+ const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
14687
+ return matcher ? matcher.test(fileName) : pattern === fileName;
14688
+ });
14689
+ };
14690
+ let gitCandidates;
14691
+ if (options?.knownGitCandidates !== void 0) {
14692
+ gitCandidates = options.knownGitCandidates;
14693
+ } else {
14694
+ gitCandidates = await listGitCandidateFiles(root, options?.logLevel);
14695
+ }
14696
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
14697
+ let rootSafeMatches;
14698
+ if (gitCandidates) {
14699
+ const gitignoreIndex = await buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases);
14700
+ const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => (0, import_picomatch.default)(globPattern, { dot: true }));
14701
+ const filterGitIgnoredEntries = (entries2, directoryKeys = /* @__PURE__ */ new Set()) => entries2.map(({ path: filePath, realPath }) => ({ filePath: normalizePath(filePath), realPath })).filter(({ filePath, realPath }) => {
14702
+ const isDirectory2 = directoryKeys.has(fileIdentityKey(filePath));
14703
+ const rootRelative = normalizePath(path9.relative(root, filePath));
14704
+ if (!isRelativePathInside(rootRelative))
14705
+ return false;
14706
+ if (defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
14707
+ return false;
14708
+ if (isIgnoredByGitignore(filePath, gitignoreIndex, isDirectory2))
14709
+ return false;
14710
+ return normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex, isDirectory2);
14711
+ }).map(({ filePath }) => filePath);
14712
+ const symlinkOptions = {
14713
+ candidatePaths: gitCandidates.files,
14714
+ ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14715
+ ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {}
14716
+ };
14717
+ const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, DEFAULT_PROJECT_FILE_IGNORES, symlinkOptions);
14718
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
14719
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14720
+ markDirectories: true,
14721
+ onlyFiles: false,
14722
+ resolvedSafeSymlinkDirectories: safeSymlinkDirectories
14723
+ });
14724
+ const rootSafeCandidateEntries = await filterRealPathsWithinRootEntries(gitCandidates.files, realRoot);
14725
+ const filteredFiles = filterGitIgnoredEntries(rootSafeCandidateEntries);
14726
+ const fileMatches = filteredFiles.filter((file2) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "file" && matchesDefinition(path9.basename(file2), definitionIndex)));
14727
+ const rawCandidateDirectories = collectCandidateAncestorDirectories(root, rootSafeCandidateEntries.map(({ path: filePath }) => filePath));
14728
+ const candidateDirectoryKeys = new Set(rawCandidateDirectories.map(fileIdentityKey));
14729
+ const safeSymlinkDirectoryKeys = new Set(safeSymlinkDirectories.map(fileIdentityKey));
14730
+ const directoryMatches = [
14731
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(rawCandidateDirectories, realRoot), candidateDirectoryKeys),
14732
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(safeSymlinkDirectories, realRoot), safeSymlinkDirectoryKeys)
14733
+ ].filter((directory) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "dir" && matchesDefinition(path9.basename(directory), definitionIndex)));
14734
+ const linkedDirectoryKeys = new Set(linkedMatches.filter((match) => match.endsWith("/")).map((match) => fileIdentityKey(match.slice(0, -1))));
14735
+ const rootSafeLinked = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(linkedMatches.map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot), linkedDirectoryKeys);
14736
+ rootSafeMatches = [...fileMatches, ...directoryMatches, ...rootSafeLinked];
14737
+ } else {
14738
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
14739
+ const matches = await (0, import_fast_glob2.default)(allPatterns, {
14740
+ cwd: root,
14741
+ absolute: true,
14742
+ dot: true,
14743
+ followSymbolicLinks: false,
14744
+ ignore: DEFAULT_PROJECT_FILE_IGNORES,
14745
+ markDirectories: true,
14746
+ onlyFiles: false
14747
+ });
14748
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
14749
+ markDirectories: true,
14750
+ onlyFiles: false,
14751
+ ...options?.knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: options.knownSymlinkDirectories } : {},
14752
+ ...options?.onSymlinkDirectoriesDiscovered ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered } : {}
14753
+ });
14754
+ rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => match.endsWith("/") ? match.slice(0, -1) : match), realRoot);
14755
+ }
14604
14756
  const entries = [];
14605
14757
  const matchTasks = rootSafeMatches.map(async (cleanMatch) => {
14606
14758
  const stats = await fsp5.stat(cleanMatch);
@@ -14612,10 +14764,7 @@ async function discoverProjectFiles(projectRoot, options) {
14612
14764
  continue;
14613
14765
  if (!isDir && def.kind !== "file")
14614
14766
  continue;
14615
- const matchesPattern = def.patterns.some((pattern, patternIndex) => {
14616
- const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
14617
- return matcher ? matcher.test(fileName) : pattern === fileName;
14618
- });
14767
+ const matchesPattern = matchesDefinition(fileName, definitionIndex);
14619
14768
  if (matchesPattern) {
14620
14769
  entries.push(await buildProjectFileInfo(def, cleanMatch));
14621
14770
  }
@@ -14742,7 +14891,12 @@ var init_projectFiles = __esm({
14742
14891
  ...DEFAULT_PROJECT_MANIFESTS.map((name) => `**/${name}`)
14743
14892
  ];
14744
14893
  REALPATH_FILTER_CONCURRENCY = 64;
14745
- EMPTY_GITIGNORE_INDEX = { hasRules: false, byBaseDir: /* @__PURE__ */ new Map() };
14894
+ EMPTY_GITIGNORE_INDEX = {
14895
+ hasRules: false,
14896
+ repositoryRoots: [],
14897
+ repositoryAliases: [],
14898
+ byBaseDir: /* @__PURE__ */ new Map()
14899
+ };
14746
14900
  }
14747
14901
  });
14748
14902
 
@@ -25606,12 +25760,210 @@ var init_adjacency = __esm({
25606
25760
  }
25607
25761
  });
25608
25762
 
25763
+ // dist/util/bloomFilter.js
25764
+ var bloomFilter_exports = {};
25765
+ __export(bloomFilter_exports, {
25766
+ BloomFilter: () => BloomFilter,
25767
+ BloomFilterCache: () => BloomFilterCache,
25768
+ buildBloomFilterFromSource: () => buildBloomFilterFromSource,
25769
+ calculateOptimalBloomParams: () => calculateOptimalBloomParams
25770
+ });
25771
+ import crypto3 from "node:crypto";
25772
+ function calculateOptimalBloomParams(expectedItems, falsePositiveRate = 0.01) {
25773
+ const n = Math.max(1, expectedItems);
25774
+ const p = Math.max(1e-4, Math.min(0.5, falsePositiveRate));
25775
+ const ln2 = Math.LN2;
25776
+ const ln2Squared = ln2 * ln2;
25777
+ const optimalSize = Math.ceil(-n * Math.log(p) / ln2Squared);
25778
+ const optimalHashCount = Math.max(1, Math.round(optimalSize / n * ln2));
25779
+ const size = Math.max(1e3, Math.min(1e6, optimalSize));
25780
+ const hashCount = Math.max(1, Math.min(10, optimalHashCount));
25781
+ return { size, hashCount };
25782
+ }
25783
+ function buildBloomFilterFromSource(source, support, falsePositiveRate = 0.01) {
25784
+ const identifierPattern = new RegExp(BLOOM_FILTER_IDENTIFIER_SOURCE, "gu");
25785
+ const matches = source.match(identifierPattern);
25786
+ const unique = /* @__PURE__ */ new Set();
25787
+ for (const identifier of matches ?? []) {
25788
+ unique.add(support.normalizeIdentifier(identifier));
25789
+ }
25790
+ const filter = BloomFilter.createOptimal(unique.size || 100, falsePositiveRate);
25791
+ for (const identifier of unique) {
25792
+ filter.add(identifier);
25793
+ }
25794
+ return filter;
25795
+ }
25796
+ var BloomFilter, BloomFilterCache;
25797
+ var init_bloomFilter = __esm({
25798
+ "dist/util/bloomFilter.js"() {
25799
+ "use strict";
25800
+ init_identifiers();
25801
+ init_paths();
25802
+ BloomFilter = class _BloomFilter {
25803
+ bits;
25804
+ size;
25805
+ hashCount;
25806
+ itemCount = 0;
25807
+ /**
25808
+ * Create a bloom filter
25809
+ * @param size - Number of bits in the filter (default: 10000)
25810
+ * @param hashCount - Number of hash functions to use (default: 3)
25811
+ */
25812
+ constructor(size = 1e4, hashCount = 3) {
25813
+ this.size = size;
25814
+ this.hashCount = hashCount;
25815
+ this.bits = new Uint8Array(Math.ceil(size / 8));
25816
+ }
25817
+ /**
25818
+ * Create an optimally-sized bloom filter for the expected number of items.
25819
+ * @param expectedItems - Expected number of items to be added
25820
+ * @param falsePositiveRate - Target false positive rate (default: 0.01 = 1%)
25821
+ */
25822
+ static createOptimal(expectedItems, falsePositiveRate = 0.01) {
25823
+ const { size, hashCount } = calculateOptimalBloomParams(expectedItems, falsePositiveRate);
25824
+ return new _BloomFilter(size, hashCount);
25825
+ }
25826
+ /**
25827
+ * Add an item to the bloom filter
25828
+ */
25829
+ add(item) {
25830
+ for (const hash2 of this.getHashes(item)) {
25831
+ const byteIndex = Math.floor(hash2 / 8);
25832
+ const bitIndex = hash2 % 8;
25833
+ if (byteIndex < 0 || byteIndex >= this.bits.length)
25834
+ return;
25835
+ const currentByte = this.bits[byteIndex];
25836
+ if (currentByte !== void 0) {
25837
+ this.bits[byteIndex] = currentByte | 1 << bitIndex;
25838
+ }
25839
+ }
25840
+ this.itemCount++;
25841
+ }
25842
+ /**
25843
+ * Get the number of items added to the filter
25844
+ */
25845
+ getItemCount() {
25846
+ return this.itemCount;
25847
+ }
25848
+ /**
25849
+ * Get the current estimated false positive rate based on items added
25850
+ */
25851
+ getCurrentFalsePositiveRate() {
25852
+ return this.getFalsePositiveRate(this.itemCount);
25853
+ }
25854
+ /**
25855
+ * Check if an item might be in the set
25856
+ * Returns false if definitely not present, true if might be present
25857
+ */
25858
+ mightContain(item) {
25859
+ for (const hash2 of this.getHashes(item)) {
25860
+ const byteIndex = Math.floor(hash2 / 8);
25861
+ const bitIndex = hash2 % 8;
25862
+ if (byteIndex < 0 || byteIndex >= this.bits.length)
25863
+ return false;
25864
+ const currentByte = this.bits[byteIndex];
25865
+ if (currentByte === void 0 || (currentByte & 1 << bitIndex) === 0) {
25866
+ return false;
25867
+ }
25868
+ }
25869
+ return true;
25870
+ }
25871
+ /**
25872
+ * Generate multiple hash values for an item
25873
+ */
25874
+ *getHashes(item) {
25875
+ const hash2 = crypto3.createHash("sha256").update(item).digest();
25876
+ for (let i = 0; i < this.hashCount; i++) {
25877
+ const offset = i * 4 % (hash2.length - 4);
25878
+ const value = hash2.readUInt32LE(offset);
25879
+ yield value % this.size;
25880
+ }
25881
+ }
25882
+ /**
25883
+ * Get the approximate false positive rate
25884
+ */
25885
+ getFalsePositiveRate(itemCount) {
25886
+ const exp = Math.exp(-this.hashCount * itemCount / this.size);
25887
+ return Math.pow(1 - exp, this.hashCount);
25888
+ }
25889
+ /**
25890
+ * Serialize to buffer for caching
25891
+ */
25892
+ toBuffer() {
25893
+ return Buffer.from(this.bits);
25894
+ }
25895
+ /**
25896
+ * Deserialize from buffer
25897
+ */
25898
+ static fromBuffer(buffer, size, hashCount, itemCount = 0) {
25899
+ const filter = new _BloomFilter(size, hashCount);
25900
+ filter.bits = new Uint8Array(buffer);
25901
+ filter.itemCount = itemCount;
25902
+ return filter;
25903
+ }
25904
+ /**
25905
+ * Get metadata for serialization
25906
+ */
25907
+ getMetadata() {
25908
+ return { size: this.size, hashCount: this.hashCount };
25909
+ }
25910
+ };
25911
+ BloomFilterCache = class {
25912
+ filters = /* @__PURE__ */ new Map();
25913
+ set(file2, filter) {
25914
+ this.filters.set(fileIdentityKey(file2), filter);
25915
+ }
25916
+ get(file2) {
25917
+ return this.filters.get(fileIdentityKey(file2));
25918
+ }
25919
+ has(file2) {
25920
+ return this.filters.has(fileIdentityKey(file2));
25921
+ }
25922
+ /**
25923
+ * Check if a symbol might be in any of the provided files
25924
+ * Returns only files that might contain the symbol
25925
+ */
25926
+ filterFiles(symbol2, files) {
25927
+ const candidates = [];
25928
+ for (const file2 of files) {
25929
+ const filter = this.filters.get(fileIdentityKey(file2));
25930
+ if (!filter) {
25931
+ candidates.push(file2);
25932
+ } else if (filter.mightContain(symbol2)) {
25933
+ candidates.push(file2);
25934
+ }
25935
+ }
25936
+ return candidates;
25937
+ }
25938
+ clear() {
25939
+ this.filters.clear();
25940
+ }
25941
+ size() {
25942
+ return this.filters.size;
25943
+ }
25944
+ };
25945
+ }
25946
+ });
25947
+
25609
25948
  // dist/worker/nativeExtractWorker.js
25610
25949
  import fsp17 from "node:fs/promises";
25611
25950
  import { createRequire as createRequire3 } from "node:module";
25612
25951
  import path32 from "node:path";
25613
25952
  import { fileURLToPath as fileURLToPath3 } from "node:url";
25614
25953
  import { isMainThread, workerData } from "node:worker_threads";
25954
+ function buildBloomFilterPayload(source, languageId) {
25955
+ const support = supportById(languageId);
25956
+ if (!support)
25957
+ return void 0;
25958
+ const filter = buildBloomFilterFromSource(source, support);
25959
+ const { size, hashCount } = filter.getMetadata();
25960
+ return {
25961
+ bits: filter.toBuffer(),
25962
+ size,
25963
+ hashCount,
25964
+ itemCount: filter.getItemCount()
25965
+ };
25966
+ }
25615
25967
  function readWorkerBindingHandoff(source = isMainThread ? void 0 : workerData) {
25616
25968
  if (!source || typeof source !== "object")
25617
25969
  return null;
@@ -25647,7 +25999,7 @@ function resolveSourceMaxBytes(task) {
25647
25999
  }
25648
26000
  return DEFAULT_NATIVE_SOURCE_MAX_BYTES;
25649
26001
  }
25650
- function resourceLimitFallback(task, source, error51) {
26002
+ function resourceLimitFallback(task, source, error51, bloomFilter) {
25651
26003
  const includeSource = task.includeSourceInResult ?? true;
25652
26004
  return {
25653
26005
  filePath: task.filePath,
@@ -25656,6 +26008,7 @@ function resourceLimitFallback(task, source, error51) {
25656
26008
  nativeResults: null,
25657
26009
  compactResults: null,
25658
26010
  syntaxTree: null,
26011
+ ...bloomFilter ? { bloomFilter } : {},
25659
26012
  fallbackReason: "queryFailure",
25660
26013
  error: error51
25661
26014
  };
@@ -25721,6 +26074,7 @@ function createNativeExtractor(deps) {
25721
26074
  }
25722
26075
  const includeSource = task.includeSourceInResult ?? true;
25723
26076
  const source = loaded.source;
26077
+ const bloomFilter = task.includeBloomFilter ? buildBloomFilterPayload(source, task.languageId) : void 0;
25724
26078
  if (!binding || !supportedIds) {
25725
26079
  return {
25726
26080
  filePath: task.filePath,
@@ -25729,6 +26083,7 @@ function createNativeExtractor(deps) {
25729
26083
  nativeResults: null,
25730
26084
  compactResults: null,
25731
26085
  syntaxTree: null,
26086
+ ...bloomFilter ? { bloomFilter } : {},
25732
26087
  fallbackReason: "unavailable",
25733
26088
  ...loadError ? { error: loadError } : {}
25734
26089
  };
@@ -25741,6 +26096,7 @@ function createNativeExtractor(deps) {
25741
26096
  nativeResults: null,
25742
26097
  compactResults: null,
25743
26098
  syntaxTree: null,
26099
+ ...bloomFilter ? { bloomFilter } : {},
25744
26100
  fallbackReason: "unsupportedLanguage"
25745
26101
  };
25746
26102
  }
@@ -25753,7 +26109,8 @@ function createNativeExtractor(deps) {
25753
26109
  ...includeSource ? { source } : {},
25754
26110
  nativeResults: null,
25755
26111
  compactResults,
25756
- syntaxTree: null
26112
+ syntaxTree: null,
26113
+ ...bloomFilter ? { bloomFilter } : {}
25757
26114
  };
25758
26115
  }
25759
26116
  const extraction = binding.extractLanguage(source, task.languageId, task.importsQuery, task.exportsQuery, task.localsQuery, task.importBindingsQuery);
@@ -25767,6 +26124,7 @@ function createNativeExtractor(deps) {
25767
26124
  nativeResults: extraction.results,
25768
26125
  compactResults: null,
25769
26126
  syntaxTree: null,
26127
+ ...bloomFilter ? { bloomFilter } : {},
25770
26128
  fallbackReason: "unavailable",
25771
26129
  error: loadError
25772
26130
  };
@@ -25777,12 +26135,13 @@ function createNativeExtractor(deps) {
25777
26135
  ...includeSource ? { source } : {},
25778
26136
  nativeResults: extraction.results,
25779
26137
  compactResults: null,
25780
- syntaxTree
26138
+ syntaxTree,
26139
+ ...bloomFilter ? { bloomFilter } : {}
25781
26140
  };
25782
26141
  } catch (err) {
25783
26142
  const message = err instanceof Error ? err.message : String(err);
25784
26143
  if (/max (node|depth) limit/i.test(message)) {
25785
- return resourceLimitFallback(task, source, message);
26144
+ return resourceLimitFallback(task, source, message, bloomFilter);
25786
26145
  }
25787
26146
  return {
25788
26147
  filePath: task.filePath,
@@ -25791,6 +26150,7 @@ function createNativeExtractor(deps) {
25791
26150
  nativeResults: null,
25792
26151
  compactResults: null,
25793
26152
  syntaxTree: null,
26153
+ ...bloomFilter ? { bloomFilter } : {},
25794
26154
  fallbackReason: "queryFailure",
25795
26155
  error: message
25796
26156
  };
@@ -25803,6 +26163,8 @@ var init_nativeExtractWorker = __esm({
25803
26163
  "use strict";
25804
26164
  init_bindingLoader();
25805
26165
  init_treeShape();
26166
+ init_languages();
26167
+ init_bloomFilter();
25806
26168
  init_treeShape();
25807
26169
  NATIVE_WORKER_BATCH_SIZE = 32;
25808
26170
  DEFAULT_NATIVE_SOURCE_MAX_BYTES = 8 * 1024 * 1024;
@@ -28504,190 +28866,6 @@ var init_locals_and_exports = __esm({
28504
28866
  }
28505
28867
  });
28506
28868
 
28507
- // dist/util/bloomFilter.js
28508
- var bloomFilter_exports = {};
28509
- __export(bloomFilter_exports, {
28510
- BloomFilter: () => BloomFilter,
28511
- BloomFilterCache: () => BloomFilterCache,
28512
- buildBloomFilterFromSource: () => buildBloomFilterFromSource,
28513
- calculateOptimalBloomParams: () => calculateOptimalBloomParams
28514
- });
28515
- import crypto3 from "node:crypto";
28516
- function calculateOptimalBloomParams(expectedItems, falsePositiveRate = 0.01) {
28517
- const n = Math.max(1, expectedItems);
28518
- const p = Math.max(1e-4, Math.min(0.5, falsePositiveRate));
28519
- const ln2 = Math.LN2;
28520
- const ln2Squared = ln2 * ln2;
28521
- const optimalSize = Math.ceil(-n * Math.log(p) / ln2Squared);
28522
- const optimalHashCount = Math.max(1, Math.round(optimalSize / n * ln2));
28523
- const size = Math.max(1e3, Math.min(1e6, optimalSize));
28524
- const hashCount = Math.max(1, Math.min(10, optimalHashCount));
28525
- return { size, hashCount };
28526
- }
28527
- function buildBloomFilterFromSource(source, support, falsePositiveRate = 0.01) {
28528
- const identifierPattern = new RegExp(BLOOM_FILTER_IDENTIFIER_SOURCE, "gu");
28529
- const matches = source.match(identifierPattern);
28530
- const unique = /* @__PURE__ */ new Set();
28531
- for (const identifier of matches ?? []) {
28532
- unique.add(support.normalizeIdentifier(identifier));
28533
- }
28534
- const filter = BloomFilter.createOptimal(unique.size || 100, falsePositiveRate);
28535
- for (const identifier of unique) {
28536
- filter.add(identifier);
28537
- }
28538
- return filter;
28539
- }
28540
- var BloomFilter, BloomFilterCache;
28541
- var init_bloomFilter = __esm({
28542
- "dist/util/bloomFilter.js"() {
28543
- "use strict";
28544
- init_identifiers();
28545
- init_paths();
28546
- BloomFilter = class _BloomFilter {
28547
- bits;
28548
- size;
28549
- hashCount;
28550
- itemCount = 0;
28551
- /**
28552
- * Create a bloom filter
28553
- * @param size - Number of bits in the filter (default: 10000)
28554
- * @param hashCount - Number of hash functions to use (default: 3)
28555
- */
28556
- constructor(size = 1e4, hashCount = 3) {
28557
- this.size = size;
28558
- this.hashCount = hashCount;
28559
- this.bits = new Uint8Array(Math.ceil(size / 8));
28560
- }
28561
- /**
28562
- * Create an optimally-sized bloom filter for the expected number of items.
28563
- * @param expectedItems - Expected number of items to be added
28564
- * @param falsePositiveRate - Target false positive rate (default: 0.01 = 1%)
28565
- */
28566
- static createOptimal(expectedItems, falsePositiveRate = 0.01) {
28567
- const { size, hashCount } = calculateOptimalBloomParams(expectedItems, falsePositiveRate);
28568
- return new _BloomFilter(size, hashCount);
28569
- }
28570
- /**
28571
- * Add an item to the bloom filter
28572
- */
28573
- add(item) {
28574
- for (const hash2 of this.getHashes(item)) {
28575
- const byteIndex = Math.floor(hash2 / 8);
28576
- const bitIndex = hash2 % 8;
28577
- if (byteIndex < 0 || byteIndex >= this.bits.length)
28578
- return;
28579
- const currentByte = this.bits[byteIndex];
28580
- if (currentByte !== void 0) {
28581
- this.bits[byteIndex] = currentByte | 1 << bitIndex;
28582
- }
28583
- }
28584
- this.itemCount++;
28585
- }
28586
- /**
28587
- * Get the number of items added to the filter
28588
- */
28589
- getItemCount() {
28590
- return this.itemCount;
28591
- }
28592
- /**
28593
- * Get the current estimated false positive rate based on items added
28594
- */
28595
- getCurrentFalsePositiveRate() {
28596
- return this.getFalsePositiveRate(this.itemCount);
28597
- }
28598
- /**
28599
- * Check if an item might be in the set
28600
- * Returns false if definitely not present, true if might be present
28601
- */
28602
- mightContain(item) {
28603
- for (const hash2 of this.getHashes(item)) {
28604
- const byteIndex = Math.floor(hash2 / 8);
28605
- const bitIndex = hash2 % 8;
28606
- if (byteIndex < 0 || byteIndex >= this.bits.length)
28607
- return false;
28608
- const currentByte = this.bits[byteIndex];
28609
- if (currentByte === void 0 || (currentByte & 1 << bitIndex) === 0) {
28610
- return false;
28611
- }
28612
- }
28613
- return true;
28614
- }
28615
- /**
28616
- * Generate multiple hash values for an item
28617
- */
28618
- *getHashes(item) {
28619
- const hash2 = crypto3.createHash("sha256").update(item).digest();
28620
- for (let i = 0; i < this.hashCount; i++) {
28621
- const offset = i * 4 % (hash2.length - 4);
28622
- const value = hash2.readUInt32LE(offset);
28623
- yield value % this.size;
28624
- }
28625
- }
28626
- /**
28627
- * Get the approximate false positive rate
28628
- */
28629
- getFalsePositiveRate(itemCount) {
28630
- const exp = Math.exp(-this.hashCount * itemCount / this.size);
28631
- return Math.pow(1 - exp, this.hashCount);
28632
- }
28633
- /**
28634
- * Serialize to buffer for caching
28635
- */
28636
- toBuffer() {
28637
- return Buffer.from(this.bits);
28638
- }
28639
- /**
28640
- * Deserialize from buffer
28641
- */
28642
- static fromBuffer(buffer, size, hashCount) {
28643
- const filter = new _BloomFilter(size, hashCount);
28644
- filter.bits = new Uint8Array(buffer);
28645
- return filter;
28646
- }
28647
- /**
28648
- * Get metadata for serialization
28649
- */
28650
- getMetadata() {
28651
- return { size: this.size, hashCount: this.hashCount };
28652
- }
28653
- };
28654
- BloomFilterCache = class {
28655
- filters = /* @__PURE__ */ new Map();
28656
- set(file2, filter) {
28657
- this.filters.set(fileIdentityKey(file2), filter);
28658
- }
28659
- get(file2) {
28660
- return this.filters.get(fileIdentityKey(file2));
28661
- }
28662
- has(file2) {
28663
- return this.filters.has(fileIdentityKey(file2));
28664
- }
28665
- /**
28666
- * Check if a symbol might be in any of the provided files
28667
- * Returns only files that might contain the symbol
28668
- */
28669
- filterFiles(symbol2, files) {
28670
- const candidates = [];
28671
- for (const file2 of files) {
28672
- const filter = this.filters.get(fileIdentityKey(file2));
28673
- if (!filter) {
28674
- candidates.push(file2);
28675
- } else if (filter.mightContain(symbol2)) {
28676
- candidates.push(file2);
28677
- }
28678
- }
28679
- return candidates;
28680
- }
28681
- clear() {
28682
- this.filters.clear();
28683
- }
28684
- size() {
28685
- return this.filters.size;
28686
- }
28687
- };
28688
- }
28689
- });
28690
-
28691
28869
  // dist/languages/queryGenerator.js
28692
28870
  function generateChunkingQuery(def) {
28693
28871
  const parts = [];
@@ -29686,7 +29864,1509 @@ var init_duplicate_keywords = __esm({
29686
29864
  }
29687
29865
  });
29688
29866
 
29867
+ // dist/duplicate-identifier-ranges.js
29868
+ var DUPLICATE_IDENTIFIER_START_RANGES, DUPLICATE_IDENTIFIER_CONTINUE_RANGES;
29869
+ var init_duplicate_identifier_ranges = __esm({
29870
+ "dist/duplicate-identifier-ranges.js"() {
29871
+ "use strict";
29872
+ DUPLICATE_IDENTIFIER_START_RANGES = [
29873
+ [36, 36],
29874
+ [65, 90],
29875
+ [95, 95],
29876
+ [97, 122],
29877
+ [170, 170],
29878
+ [181, 181],
29879
+ [186, 186],
29880
+ [192, 214],
29881
+ [216, 246],
29882
+ [248, 705],
29883
+ [710, 721],
29884
+ [736, 740],
29885
+ [748, 748],
29886
+ [750, 750],
29887
+ [880, 884],
29888
+ [886, 887],
29889
+ [891, 893],
29890
+ [895, 895],
29891
+ [902, 902],
29892
+ [904, 906],
29893
+ [908, 908],
29894
+ [910, 929],
29895
+ [931, 1013],
29896
+ [1015, 1153],
29897
+ [1162, 1327],
29898
+ [1329, 1366],
29899
+ [1369, 1369],
29900
+ [1376, 1416],
29901
+ [1488, 1514],
29902
+ [1519, 1522],
29903
+ [1568, 1610],
29904
+ [1646, 1647],
29905
+ [1649, 1747],
29906
+ [1749, 1749],
29907
+ [1765, 1766],
29908
+ [1774, 1775],
29909
+ [1786, 1788],
29910
+ [1791, 1791],
29911
+ [1808, 1808],
29912
+ [1810, 1839],
29913
+ [1869, 1957],
29914
+ [1969, 1969],
29915
+ [1994, 2026],
29916
+ [2036, 2037],
29917
+ [2042, 2042],
29918
+ [2048, 2069],
29919
+ [2074, 2074],
29920
+ [2084, 2084],
29921
+ [2088, 2088],
29922
+ [2112, 2136],
29923
+ [2144, 2154],
29924
+ [2160, 2183],
29925
+ [2185, 2190],
29926
+ [2208, 2249],
29927
+ [2308, 2361],
29928
+ [2365, 2365],
29929
+ [2384, 2384],
29930
+ [2392, 2401],
29931
+ [2417, 2432],
29932
+ [2437, 2444],
29933
+ [2447, 2448],
29934
+ [2451, 2472],
29935
+ [2474, 2480],
29936
+ [2482, 2482],
29937
+ [2486, 2489],
29938
+ [2493, 2493],
29939
+ [2510, 2510],
29940
+ [2524, 2525],
29941
+ [2527, 2529],
29942
+ [2544, 2545],
29943
+ [2556, 2556],
29944
+ [2565, 2570],
29945
+ [2575, 2576],
29946
+ [2579, 2600],
29947
+ [2602, 2608],
29948
+ [2610, 2611],
29949
+ [2613, 2614],
29950
+ [2616, 2617],
29951
+ [2649, 2652],
29952
+ [2654, 2654],
29953
+ [2674, 2676],
29954
+ [2693, 2701],
29955
+ [2703, 2705],
29956
+ [2707, 2728],
29957
+ [2730, 2736],
29958
+ [2738, 2739],
29959
+ [2741, 2745],
29960
+ [2749, 2749],
29961
+ [2768, 2768],
29962
+ [2784, 2785],
29963
+ [2809, 2809],
29964
+ [2821, 2828],
29965
+ [2831, 2832],
29966
+ [2835, 2856],
29967
+ [2858, 2864],
29968
+ [2866, 2867],
29969
+ [2869, 2873],
29970
+ [2877, 2877],
29971
+ [2908, 2909],
29972
+ [2911, 2913],
29973
+ [2929, 2929],
29974
+ [2947, 2947],
29975
+ [2949, 2954],
29976
+ [2958, 2960],
29977
+ [2962, 2965],
29978
+ [2969, 2970],
29979
+ [2972, 2972],
29980
+ [2974, 2975],
29981
+ [2979, 2980],
29982
+ [2984, 2986],
29983
+ [2990, 3001],
29984
+ [3024, 3024],
29985
+ [3077, 3084],
29986
+ [3086, 3088],
29987
+ [3090, 3112],
29988
+ [3114, 3129],
29989
+ [3133, 3133],
29990
+ [3160, 3162],
29991
+ [3165, 3165],
29992
+ [3168, 3169],
29993
+ [3200, 3200],
29994
+ [3205, 3212],
29995
+ [3214, 3216],
29996
+ [3218, 3240],
29997
+ [3242, 3251],
29998
+ [3253, 3257],
29999
+ [3261, 3261],
30000
+ [3293, 3294],
30001
+ [3296, 3297],
30002
+ [3313, 3314],
30003
+ [3332, 3340],
30004
+ [3342, 3344],
30005
+ [3346, 3386],
30006
+ [3389, 3389],
30007
+ [3406, 3406],
30008
+ [3412, 3414],
30009
+ [3423, 3425],
30010
+ [3450, 3455],
30011
+ [3461, 3478],
30012
+ [3482, 3505],
30013
+ [3507, 3515],
30014
+ [3517, 3517],
30015
+ [3520, 3526],
30016
+ [3585, 3632],
30017
+ [3634, 3634],
30018
+ [3648, 3654],
30019
+ [3713, 3714],
30020
+ [3716, 3716],
30021
+ [3718, 3722],
30022
+ [3724, 3747],
30023
+ [3749, 3749],
30024
+ [3751, 3760],
30025
+ [3762, 3762],
30026
+ [3773, 3773],
30027
+ [3776, 3780],
30028
+ [3782, 3782],
30029
+ [3804, 3807],
30030
+ [3840, 3840],
30031
+ [3904, 3911],
30032
+ [3913, 3948],
30033
+ [3976, 3980],
30034
+ [4096, 4138],
30035
+ [4159, 4159],
30036
+ [4176, 4181],
30037
+ [4186, 4189],
30038
+ [4193, 4193],
30039
+ [4197, 4198],
30040
+ [4206, 4208],
30041
+ [4213, 4225],
30042
+ [4238, 4238],
30043
+ [4256, 4293],
30044
+ [4295, 4295],
30045
+ [4301, 4301],
30046
+ [4304, 4346],
30047
+ [4348, 4680],
30048
+ [4682, 4685],
30049
+ [4688, 4694],
30050
+ [4696, 4696],
30051
+ [4698, 4701],
30052
+ [4704, 4744],
30053
+ [4746, 4749],
30054
+ [4752, 4784],
30055
+ [4786, 4789],
30056
+ [4792, 4798],
30057
+ [4800, 4800],
30058
+ [4802, 4805],
30059
+ [4808, 4822],
30060
+ [4824, 4880],
30061
+ [4882, 4885],
30062
+ [4888, 4954],
30063
+ [4992, 5007],
30064
+ [5024, 5109],
30065
+ [5112, 5117],
30066
+ [5121, 5740],
30067
+ [5743, 5759],
30068
+ [5761, 5786],
30069
+ [5792, 5866],
30070
+ [5870, 5880],
30071
+ [5888, 5905],
30072
+ [5919, 5937],
30073
+ [5952, 5969],
30074
+ [5984, 5996],
30075
+ [5998, 6e3],
30076
+ [6016, 6067],
30077
+ [6103, 6103],
30078
+ [6108, 6108],
30079
+ [6176, 6264],
30080
+ [6272, 6312],
30081
+ [6314, 6314],
30082
+ [6320, 6389],
30083
+ [6400, 6430],
30084
+ [6480, 6509],
30085
+ [6512, 6516],
30086
+ [6528, 6571],
30087
+ [6576, 6601],
30088
+ [6656, 6678],
30089
+ [6688, 6740],
30090
+ [6823, 6823],
30091
+ [6917, 6963],
30092
+ [6981, 6988],
30093
+ [7043, 7072],
30094
+ [7086, 7087],
30095
+ [7098, 7141],
30096
+ [7168, 7203],
30097
+ [7245, 7247],
30098
+ [7258, 7293],
30099
+ [7296, 7306],
30100
+ [7312, 7354],
30101
+ [7357, 7359],
30102
+ [7401, 7404],
30103
+ [7406, 7411],
30104
+ [7413, 7414],
30105
+ [7418, 7418],
30106
+ [7424, 7615],
30107
+ [7680, 7957],
30108
+ [7960, 7965],
30109
+ [7968, 8005],
30110
+ [8008, 8013],
30111
+ [8016, 8023],
30112
+ [8025, 8025],
30113
+ [8027, 8027],
30114
+ [8029, 8029],
30115
+ [8031, 8061],
30116
+ [8064, 8116],
30117
+ [8118, 8124],
30118
+ [8126, 8126],
30119
+ [8130, 8132],
30120
+ [8134, 8140],
30121
+ [8144, 8147],
30122
+ [8150, 8155],
30123
+ [8160, 8172],
30124
+ [8178, 8180],
30125
+ [8182, 8188],
30126
+ [8305, 8305],
30127
+ [8319, 8319],
30128
+ [8336, 8348],
30129
+ [8450, 8450],
30130
+ [8455, 8455],
30131
+ [8458, 8467],
30132
+ [8469, 8469],
30133
+ [8472, 8477],
30134
+ [8484, 8484],
30135
+ [8486, 8486],
30136
+ [8488, 8488],
30137
+ [8490, 8505],
30138
+ [8508, 8511],
30139
+ [8517, 8521],
30140
+ [8526, 8526],
30141
+ [8544, 8584],
30142
+ [11264, 11492],
30143
+ [11499, 11502],
30144
+ [11506, 11507],
30145
+ [11520, 11557],
30146
+ [11559, 11559],
30147
+ [11565, 11565],
30148
+ [11568, 11623],
30149
+ [11631, 11631],
30150
+ [11648, 11670],
30151
+ [11680, 11686],
30152
+ [11688, 11694],
30153
+ [11696, 11702],
30154
+ [11704, 11710],
30155
+ [11712, 11718],
30156
+ [11720, 11726],
30157
+ [11728, 11734],
30158
+ [11736, 11742],
30159
+ [12293, 12295],
30160
+ [12321, 12329],
30161
+ [12337, 12341],
30162
+ [12344, 12348],
30163
+ [12353, 12438],
30164
+ [12443, 12447],
30165
+ [12449, 12538],
30166
+ [12540, 12543],
30167
+ [12549, 12591],
30168
+ [12593, 12686],
30169
+ [12704, 12735],
30170
+ [12784, 12799],
30171
+ [13312, 19903],
30172
+ [19968, 42124],
30173
+ [42192, 42237],
30174
+ [42240, 42508],
30175
+ [42512, 42527],
30176
+ [42538, 42539],
30177
+ [42560, 42606],
30178
+ [42623, 42653],
30179
+ [42656, 42735],
30180
+ [42775, 42783],
30181
+ [42786, 42888],
30182
+ [42891, 42957],
30183
+ [42960, 42961],
30184
+ [42963, 42963],
30185
+ [42965, 42972],
30186
+ [42994, 43009],
30187
+ [43011, 43013],
30188
+ [43015, 43018],
30189
+ [43020, 43042],
30190
+ [43072, 43123],
30191
+ [43138, 43187],
30192
+ [43250, 43255],
30193
+ [43259, 43259],
30194
+ [43261, 43262],
30195
+ [43274, 43301],
30196
+ [43312, 43334],
30197
+ [43360, 43388],
30198
+ [43396, 43442],
30199
+ [43471, 43471],
30200
+ [43488, 43492],
30201
+ [43494, 43503],
30202
+ [43514, 43518],
30203
+ [43520, 43560],
30204
+ [43584, 43586],
30205
+ [43588, 43595],
30206
+ [43616, 43638],
30207
+ [43642, 43642],
30208
+ [43646, 43695],
30209
+ [43697, 43697],
30210
+ [43701, 43702],
30211
+ [43705, 43709],
30212
+ [43712, 43712],
30213
+ [43714, 43714],
30214
+ [43739, 43741],
30215
+ [43744, 43754],
30216
+ [43762, 43764],
30217
+ [43777, 43782],
30218
+ [43785, 43790],
30219
+ [43793, 43798],
30220
+ [43808, 43814],
30221
+ [43816, 43822],
30222
+ [43824, 43866],
30223
+ [43868, 43881],
30224
+ [43888, 44002],
30225
+ [44032, 55203],
30226
+ [55216, 55238],
30227
+ [55243, 55291],
30228
+ [63744, 64109],
30229
+ [64112, 64217],
30230
+ [64256, 64262],
30231
+ [64275, 64279],
30232
+ [64285, 64285],
30233
+ [64287, 64296],
30234
+ [64298, 64310],
30235
+ [64312, 64316],
30236
+ [64318, 64318],
30237
+ [64320, 64321],
30238
+ [64323, 64324],
30239
+ [64326, 64433],
30240
+ [64467, 64605],
30241
+ [64612, 64829],
30242
+ [64848, 64911],
30243
+ [64914, 64967],
30244
+ [65008, 65017],
30245
+ [65137, 65137],
30246
+ [65139, 65139],
30247
+ [65143, 65143],
30248
+ [65145, 65145],
30249
+ [65147, 65147],
30250
+ [65149, 65149],
30251
+ [65151, 65276],
30252
+ [65313, 65338],
30253
+ [65345, 65370],
30254
+ [65382, 65437],
30255
+ [65440, 65470],
30256
+ [65474, 65479],
30257
+ [65482, 65487],
30258
+ [65490, 65495],
30259
+ [65498, 65500],
30260
+ [65536, 65547],
30261
+ [65549, 65574],
30262
+ [65576, 65594],
30263
+ [65596, 65597],
30264
+ [65599, 65613],
30265
+ [65616, 65629],
30266
+ [65664, 65786],
30267
+ [65856, 65908],
30268
+ [66176, 66204],
30269
+ [66208, 66256],
30270
+ [66304, 66335],
30271
+ [66349, 66378],
30272
+ [66384, 66421],
30273
+ [66432, 66461],
30274
+ [66464, 66499],
30275
+ [66504, 66511],
30276
+ [66513, 66517],
30277
+ [66560, 66717],
30278
+ [66736, 66771],
30279
+ [66776, 66811],
30280
+ [66816, 66855],
30281
+ [66864, 66915],
30282
+ [66928, 66938],
30283
+ [66940, 66954],
30284
+ [66956, 66962],
30285
+ [66964, 66965],
30286
+ [66967, 66977],
30287
+ [66979, 66993],
30288
+ [66995, 67001],
30289
+ [67003, 67004],
30290
+ [67008, 67059],
30291
+ [67072, 67382],
30292
+ [67392, 67413],
30293
+ [67424, 67431],
30294
+ [67456, 67461],
30295
+ [67463, 67504],
30296
+ [67506, 67514],
30297
+ [67584, 67589],
30298
+ [67592, 67592],
30299
+ [67594, 67637],
30300
+ [67639, 67640],
30301
+ [67644, 67644],
30302
+ [67647, 67669],
30303
+ [67680, 67702],
30304
+ [67712, 67742],
30305
+ [67808, 67826],
30306
+ [67828, 67829],
30307
+ [67840, 67861],
30308
+ [67872, 67897],
30309
+ [67968, 68023],
30310
+ [68030, 68031],
30311
+ [68096, 68096],
30312
+ [68112, 68115],
30313
+ [68117, 68119],
30314
+ [68121, 68149],
30315
+ [68192, 68220],
30316
+ [68224, 68252],
30317
+ [68288, 68295],
30318
+ [68297, 68324],
30319
+ [68352, 68405],
30320
+ [68416, 68437],
30321
+ [68448, 68466],
30322
+ [68480, 68497],
30323
+ [68608, 68680],
30324
+ [68736, 68786],
30325
+ [68800, 68850],
30326
+ [68864, 68899],
30327
+ [68938, 68965],
30328
+ [68975, 68997],
30329
+ [69248, 69289],
30330
+ [69296, 69297],
30331
+ [69314, 69316],
30332
+ [69376, 69404],
30333
+ [69415, 69415],
30334
+ [69424, 69445],
30335
+ [69488, 69505],
30336
+ [69552, 69572],
30337
+ [69600, 69622],
30338
+ [69635, 69687],
30339
+ [69745, 69746],
30340
+ [69749, 69749],
30341
+ [69763, 69807],
30342
+ [69840, 69864],
30343
+ [69891, 69926],
30344
+ [69956, 69956],
30345
+ [69959, 69959],
30346
+ [69968, 70002],
30347
+ [70006, 70006],
30348
+ [70019, 70066],
30349
+ [70081, 70084],
30350
+ [70106, 70106],
30351
+ [70108, 70108],
30352
+ [70144, 70161],
30353
+ [70163, 70187],
30354
+ [70207, 70208],
30355
+ [70272, 70278],
30356
+ [70280, 70280],
30357
+ [70282, 70285],
30358
+ [70287, 70301],
30359
+ [70303, 70312],
30360
+ [70320, 70366],
30361
+ [70405, 70412],
30362
+ [70415, 70416],
30363
+ [70419, 70440],
30364
+ [70442, 70448],
30365
+ [70450, 70451],
30366
+ [70453, 70457],
30367
+ [70461, 70461],
30368
+ [70480, 70480],
30369
+ [70493, 70497],
30370
+ [70528, 70537],
30371
+ [70539, 70539],
30372
+ [70542, 70542],
30373
+ [70544, 70581],
30374
+ [70583, 70583],
30375
+ [70609, 70609],
30376
+ [70611, 70611],
30377
+ [70656, 70708],
30378
+ [70727, 70730],
30379
+ [70751, 70753],
30380
+ [70784, 70831],
30381
+ [70852, 70853],
30382
+ [70855, 70855],
30383
+ [71040, 71086],
30384
+ [71128, 71131],
30385
+ [71168, 71215],
30386
+ [71236, 71236],
30387
+ [71296, 71338],
30388
+ [71352, 71352],
30389
+ [71424, 71450],
30390
+ [71488, 71494],
30391
+ [71680, 71723],
30392
+ [71840, 71903],
30393
+ [71935, 71942],
30394
+ [71945, 71945],
30395
+ [71948, 71955],
30396
+ [71957, 71958],
30397
+ [71960, 71983],
30398
+ [71999, 71999],
30399
+ [72001, 72001],
30400
+ [72096, 72103],
30401
+ [72106, 72144],
30402
+ [72161, 72161],
30403
+ [72163, 72163],
30404
+ [72192, 72192],
30405
+ [72203, 72242],
30406
+ [72250, 72250],
30407
+ [72272, 72272],
30408
+ [72284, 72329],
30409
+ [72349, 72349],
30410
+ [72368, 72440],
30411
+ [72640, 72672],
30412
+ [72704, 72712],
30413
+ [72714, 72750],
30414
+ [72768, 72768],
30415
+ [72818, 72847],
30416
+ [72960, 72966],
30417
+ [72968, 72969],
30418
+ [72971, 73008],
30419
+ [73030, 73030],
30420
+ [73056, 73061],
30421
+ [73063, 73064],
30422
+ [73066, 73097],
30423
+ [73112, 73112],
30424
+ [73440, 73458],
30425
+ [73474, 73474],
30426
+ [73476, 73488],
30427
+ [73490, 73523],
30428
+ [73648, 73648],
30429
+ [73728, 74649],
30430
+ [74752, 74862],
30431
+ [74880, 75075],
30432
+ [77712, 77808],
30433
+ [77824, 78895],
30434
+ [78913, 78918],
30435
+ [78944, 82938],
30436
+ [82944, 83526],
30437
+ [90368, 90397],
30438
+ [92160, 92728],
30439
+ [92736, 92766],
30440
+ [92784, 92862],
30441
+ [92880, 92909],
30442
+ [92928, 92975],
30443
+ [92992, 92995],
30444
+ [93027, 93047],
30445
+ [93053, 93071],
30446
+ [93504, 93548],
30447
+ [93760, 93823],
30448
+ [93952, 94026],
30449
+ [94032, 94032],
30450
+ [94099, 94111],
30451
+ [94176, 94177],
30452
+ [94179, 94179],
30453
+ [94208, 100343],
30454
+ [100352, 101589],
30455
+ [101631, 101640],
30456
+ [110576, 110579],
30457
+ [110581, 110587],
30458
+ [110589, 110590],
30459
+ [110592, 110882],
30460
+ [110898, 110898],
30461
+ [110928, 110930],
30462
+ [110933, 110933],
30463
+ [110948, 110951],
30464
+ [110960, 111355],
30465
+ [113664, 113770],
30466
+ [113776, 113788],
30467
+ [113792, 113800],
30468
+ [113808, 113817],
30469
+ [119808, 119892],
30470
+ [119894, 119964],
30471
+ [119966, 119967],
30472
+ [119970, 119970],
30473
+ [119973, 119974],
30474
+ [119977, 119980],
30475
+ [119982, 119993],
30476
+ [119995, 119995],
30477
+ [119997, 120003],
30478
+ [120005, 120069],
30479
+ [120071, 120074],
30480
+ [120077, 120084],
30481
+ [120086, 120092],
30482
+ [120094, 120121],
30483
+ [120123, 120126],
30484
+ [120128, 120132],
30485
+ [120134, 120134],
30486
+ [120138, 120144],
30487
+ [120146, 120485],
30488
+ [120488, 120512],
30489
+ [120514, 120538],
30490
+ [120540, 120570],
30491
+ [120572, 120596],
30492
+ [120598, 120628],
30493
+ [120630, 120654],
30494
+ [120656, 120686],
30495
+ [120688, 120712],
30496
+ [120714, 120744],
30497
+ [120746, 120770],
30498
+ [120772, 120779],
30499
+ [122624, 122654],
30500
+ [122661, 122666],
30501
+ [122928, 122989],
30502
+ [123136, 123180],
30503
+ [123191, 123197],
30504
+ [123214, 123214],
30505
+ [123536, 123565],
30506
+ [123584, 123627],
30507
+ [124112, 124139],
30508
+ [124368, 124397],
30509
+ [124400, 124400],
30510
+ [124896, 124902],
30511
+ [124904, 124907],
30512
+ [124909, 124910],
30513
+ [124912, 124926],
30514
+ [124928, 125124],
30515
+ [125184, 125251],
30516
+ [125259, 125259],
30517
+ [126464, 126467],
30518
+ [126469, 126495],
30519
+ [126497, 126498],
30520
+ [126500, 126500],
30521
+ [126503, 126503],
30522
+ [126505, 126514],
30523
+ [126516, 126519],
30524
+ [126521, 126521],
30525
+ [126523, 126523],
30526
+ [126530, 126530],
30527
+ [126535, 126535],
30528
+ [126537, 126537],
30529
+ [126539, 126539],
30530
+ [126541, 126543],
30531
+ [126545, 126546],
30532
+ [126548, 126548],
30533
+ [126551, 126551],
30534
+ [126553, 126553],
30535
+ [126555, 126555],
30536
+ [126557, 126557],
30537
+ [126559, 126559],
30538
+ [126561, 126562],
30539
+ [126564, 126564],
30540
+ [126567, 126570],
30541
+ [126572, 126578],
30542
+ [126580, 126583],
30543
+ [126585, 126588],
30544
+ [126590, 126590],
30545
+ [126592, 126601],
30546
+ [126603, 126619],
30547
+ [126625, 126627],
30548
+ [126629, 126633],
30549
+ [126635, 126651],
30550
+ [131072, 173791],
30551
+ [173824, 177977],
30552
+ [177984, 178205],
30553
+ [178208, 183969],
30554
+ [183984, 191456],
30555
+ [191472, 192093],
30556
+ [194560, 195101],
30557
+ [196608, 201546],
30558
+ [201552, 205743]
30559
+ ];
30560
+ DUPLICATE_IDENTIFIER_CONTINUE_RANGES = [
30561
+ [36, 36],
30562
+ [48, 57],
30563
+ [65, 90],
30564
+ [95, 95],
30565
+ [97, 122],
30566
+ [170, 170],
30567
+ [181, 181],
30568
+ [183, 183],
30569
+ [186, 186],
30570
+ [192, 214],
30571
+ [216, 246],
30572
+ [248, 705],
30573
+ [710, 721],
30574
+ [736, 740],
30575
+ [748, 748],
30576
+ [750, 750],
30577
+ [768, 884],
30578
+ [886, 887],
30579
+ [891, 893],
30580
+ [895, 895],
30581
+ [902, 906],
30582
+ [908, 908],
30583
+ [910, 929],
30584
+ [931, 1013],
30585
+ [1015, 1153],
30586
+ [1155, 1159],
30587
+ [1162, 1327],
30588
+ [1329, 1366],
30589
+ [1369, 1369],
30590
+ [1376, 1416],
30591
+ [1425, 1469],
30592
+ [1471, 1471],
30593
+ [1473, 1474],
30594
+ [1476, 1477],
30595
+ [1479, 1479],
30596
+ [1488, 1514],
30597
+ [1519, 1522],
30598
+ [1552, 1562],
30599
+ [1568, 1641],
30600
+ [1646, 1747],
30601
+ [1749, 1756],
30602
+ [1759, 1768],
30603
+ [1770, 1788],
30604
+ [1791, 1791],
30605
+ [1808, 1866],
30606
+ [1869, 1969],
30607
+ [1984, 2037],
30608
+ [2042, 2042],
30609
+ [2045, 2045],
30610
+ [2048, 2093],
30611
+ [2112, 2139],
30612
+ [2144, 2154],
30613
+ [2160, 2183],
30614
+ [2185, 2190],
30615
+ [2199, 2273],
30616
+ [2275, 2403],
30617
+ [2406, 2415],
30618
+ [2417, 2435],
30619
+ [2437, 2444],
30620
+ [2447, 2448],
30621
+ [2451, 2472],
30622
+ [2474, 2480],
30623
+ [2482, 2482],
30624
+ [2486, 2489],
30625
+ [2492, 2500],
30626
+ [2503, 2504],
30627
+ [2507, 2510],
30628
+ [2519, 2519],
30629
+ [2524, 2525],
30630
+ [2527, 2531],
30631
+ [2534, 2545],
30632
+ [2556, 2556],
30633
+ [2558, 2558],
30634
+ [2561, 2563],
30635
+ [2565, 2570],
30636
+ [2575, 2576],
30637
+ [2579, 2600],
30638
+ [2602, 2608],
30639
+ [2610, 2611],
30640
+ [2613, 2614],
30641
+ [2616, 2617],
30642
+ [2620, 2620],
30643
+ [2622, 2626],
30644
+ [2631, 2632],
30645
+ [2635, 2637],
30646
+ [2641, 2641],
30647
+ [2649, 2652],
30648
+ [2654, 2654],
30649
+ [2662, 2677],
30650
+ [2689, 2691],
30651
+ [2693, 2701],
30652
+ [2703, 2705],
30653
+ [2707, 2728],
30654
+ [2730, 2736],
30655
+ [2738, 2739],
30656
+ [2741, 2745],
30657
+ [2748, 2757],
30658
+ [2759, 2761],
30659
+ [2763, 2765],
30660
+ [2768, 2768],
30661
+ [2784, 2787],
30662
+ [2790, 2799],
30663
+ [2809, 2815],
30664
+ [2817, 2819],
30665
+ [2821, 2828],
30666
+ [2831, 2832],
30667
+ [2835, 2856],
30668
+ [2858, 2864],
30669
+ [2866, 2867],
30670
+ [2869, 2873],
30671
+ [2876, 2884],
30672
+ [2887, 2888],
30673
+ [2891, 2893],
30674
+ [2901, 2903],
30675
+ [2908, 2909],
30676
+ [2911, 2915],
30677
+ [2918, 2927],
30678
+ [2929, 2929],
30679
+ [2946, 2947],
30680
+ [2949, 2954],
30681
+ [2958, 2960],
30682
+ [2962, 2965],
30683
+ [2969, 2970],
30684
+ [2972, 2972],
30685
+ [2974, 2975],
30686
+ [2979, 2980],
30687
+ [2984, 2986],
30688
+ [2990, 3001],
30689
+ [3006, 3010],
30690
+ [3014, 3016],
30691
+ [3018, 3021],
30692
+ [3024, 3024],
30693
+ [3031, 3031],
30694
+ [3046, 3055],
30695
+ [3072, 3084],
30696
+ [3086, 3088],
30697
+ [3090, 3112],
30698
+ [3114, 3129],
30699
+ [3132, 3140],
30700
+ [3142, 3144],
30701
+ [3146, 3149],
30702
+ [3157, 3158],
30703
+ [3160, 3162],
30704
+ [3165, 3165],
30705
+ [3168, 3171],
30706
+ [3174, 3183],
30707
+ [3200, 3203],
30708
+ [3205, 3212],
30709
+ [3214, 3216],
30710
+ [3218, 3240],
30711
+ [3242, 3251],
30712
+ [3253, 3257],
30713
+ [3260, 3268],
30714
+ [3270, 3272],
30715
+ [3274, 3277],
30716
+ [3285, 3286],
30717
+ [3293, 3294],
30718
+ [3296, 3299],
30719
+ [3302, 3311],
30720
+ [3313, 3315],
30721
+ [3328, 3340],
30722
+ [3342, 3344],
30723
+ [3346, 3396],
30724
+ [3398, 3400],
30725
+ [3402, 3406],
30726
+ [3412, 3415],
30727
+ [3423, 3427],
30728
+ [3430, 3439],
30729
+ [3450, 3455],
30730
+ [3457, 3459],
30731
+ [3461, 3478],
30732
+ [3482, 3505],
30733
+ [3507, 3515],
30734
+ [3517, 3517],
30735
+ [3520, 3526],
30736
+ [3530, 3530],
30737
+ [3535, 3540],
30738
+ [3542, 3542],
30739
+ [3544, 3551],
30740
+ [3558, 3567],
30741
+ [3570, 3571],
30742
+ [3585, 3642],
30743
+ [3648, 3662],
30744
+ [3664, 3673],
30745
+ [3713, 3714],
30746
+ [3716, 3716],
30747
+ [3718, 3722],
30748
+ [3724, 3747],
30749
+ [3749, 3749],
30750
+ [3751, 3773],
30751
+ [3776, 3780],
30752
+ [3782, 3782],
30753
+ [3784, 3790],
30754
+ [3792, 3801],
30755
+ [3804, 3807],
30756
+ [3840, 3840],
30757
+ [3864, 3865],
30758
+ [3872, 3881],
30759
+ [3893, 3893],
30760
+ [3895, 3895],
30761
+ [3897, 3897],
30762
+ [3902, 3911],
30763
+ [3913, 3948],
30764
+ [3953, 3972],
30765
+ [3974, 3991],
30766
+ [3993, 4028],
30767
+ [4038, 4038],
30768
+ [4096, 4169],
30769
+ [4176, 4253],
30770
+ [4256, 4293],
30771
+ [4295, 4295],
30772
+ [4301, 4301],
30773
+ [4304, 4346],
30774
+ [4348, 4680],
30775
+ [4682, 4685],
30776
+ [4688, 4694],
30777
+ [4696, 4696],
30778
+ [4698, 4701],
30779
+ [4704, 4744],
30780
+ [4746, 4749],
30781
+ [4752, 4784],
30782
+ [4786, 4789],
30783
+ [4792, 4798],
30784
+ [4800, 4800],
30785
+ [4802, 4805],
30786
+ [4808, 4822],
30787
+ [4824, 4880],
30788
+ [4882, 4885],
30789
+ [4888, 4954],
30790
+ [4957, 4959],
30791
+ [4969, 4977],
30792
+ [4992, 5007],
30793
+ [5024, 5109],
30794
+ [5112, 5117],
30795
+ [5121, 5740],
30796
+ [5743, 5759],
30797
+ [5761, 5786],
30798
+ [5792, 5866],
30799
+ [5870, 5880],
30800
+ [5888, 5909],
30801
+ [5919, 5940],
30802
+ [5952, 5971],
30803
+ [5984, 5996],
30804
+ [5998, 6e3],
30805
+ [6002, 6003],
30806
+ [6016, 6099],
30807
+ [6103, 6103],
30808
+ [6108, 6109],
30809
+ [6112, 6121],
30810
+ [6155, 6157],
30811
+ [6159, 6169],
30812
+ [6176, 6264],
30813
+ [6272, 6314],
30814
+ [6320, 6389],
30815
+ [6400, 6430],
30816
+ [6432, 6443],
30817
+ [6448, 6459],
30818
+ [6470, 6509],
30819
+ [6512, 6516],
30820
+ [6528, 6571],
30821
+ [6576, 6601],
30822
+ [6608, 6618],
30823
+ [6656, 6683],
30824
+ [6688, 6750],
30825
+ [6752, 6780],
30826
+ [6783, 6793],
30827
+ [6800, 6809],
30828
+ [6823, 6823],
30829
+ [6832, 6845],
30830
+ [6847, 6862],
30831
+ [6912, 6988],
30832
+ [6992, 7001],
30833
+ [7019, 7027],
30834
+ [7040, 7155],
30835
+ [7168, 7223],
30836
+ [7232, 7241],
30837
+ [7245, 7293],
30838
+ [7296, 7306],
30839
+ [7312, 7354],
30840
+ [7357, 7359],
30841
+ [7376, 7378],
30842
+ [7380, 7418],
30843
+ [7424, 7957],
30844
+ [7960, 7965],
30845
+ [7968, 8005],
30846
+ [8008, 8013],
30847
+ [8016, 8023],
30848
+ [8025, 8025],
30849
+ [8027, 8027],
30850
+ [8029, 8029],
30851
+ [8031, 8061],
30852
+ [8064, 8116],
30853
+ [8118, 8124],
30854
+ [8126, 8126],
30855
+ [8130, 8132],
30856
+ [8134, 8140],
30857
+ [8144, 8147],
30858
+ [8150, 8155],
30859
+ [8160, 8172],
30860
+ [8178, 8180],
30861
+ [8182, 8188],
30862
+ [8204, 8205],
30863
+ [8255, 8256],
30864
+ [8276, 8276],
30865
+ [8305, 8305],
30866
+ [8319, 8319],
30867
+ [8336, 8348],
30868
+ [8400, 8412],
30869
+ [8417, 8417],
30870
+ [8421, 8432],
30871
+ [8450, 8450],
30872
+ [8455, 8455],
30873
+ [8458, 8467],
30874
+ [8469, 8469],
30875
+ [8472, 8477],
30876
+ [8484, 8484],
30877
+ [8486, 8486],
30878
+ [8488, 8488],
30879
+ [8490, 8505],
30880
+ [8508, 8511],
30881
+ [8517, 8521],
30882
+ [8526, 8526],
30883
+ [8544, 8584],
30884
+ [11264, 11492],
30885
+ [11499, 11507],
30886
+ [11520, 11557],
30887
+ [11559, 11559],
30888
+ [11565, 11565],
30889
+ [11568, 11623],
30890
+ [11631, 11631],
30891
+ [11647, 11670],
30892
+ [11680, 11686],
30893
+ [11688, 11694],
30894
+ [11696, 11702],
30895
+ [11704, 11710],
30896
+ [11712, 11718],
30897
+ [11720, 11726],
30898
+ [11728, 11734],
30899
+ [11736, 11742],
30900
+ [11744, 11775],
30901
+ [12293, 12295],
30902
+ [12321, 12335],
30903
+ [12337, 12341],
30904
+ [12344, 12348],
30905
+ [12353, 12438],
30906
+ [12441, 12447],
30907
+ [12449, 12543],
30908
+ [12549, 12591],
30909
+ [12593, 12686],
30910
+ [12704, 12735],
30911
+ [12784, 12799],
30912
+ [13312, 19903],
30913
+ [19968, 42124],
30914
+ [42192, 42237],
30915
+ [42240, 42508],
30916
+ [42512, 42539],
30917
+ [42560, 42607],
30918
+ [42612, 42621],
30919
+ [42623, 42737],
30920
+ [42775, 42783],
30921
+ [42786, 42888],
30922
+ [42891, 42957],
30923
+ [42960, 42961],
30924
+ [42963, 42963],
30925
+ [42965, 42972],
30926
+ [42994, 43047],
30927
+ [43052, 43052],
30928
+ [43072, 43123],
30929
+ [43136, 43205],
30930
+ [43216, 43225],
30931
+ [43232, 43255],
30932
+ [43259, 43259],
30933
+ [43261, 43309],
30934
+ [43312, 43347],
30935
+ [43360, 43388],
30936
+ [43392, 43456],
30937
+ [43471, 43481],
30938
+ [43488, 43518],
30939
+ [43520, 43574],
30940
+ [43584, 43597],
30941
+ [43600, 43609],
30942
+ [43616, 43638],
30943
+ [43642, 43714],
30944
+ [43739, 43741],
30945
+ [43744, 43759],
30946
+ [43762, 43766],
30947
+ [43777, 43782],
30948
+ [43785, 43790],
30949
+ [43793, 43798],
30950
+ [43808, 43814],
30951
+ [43816, 43822],
30952
+ [43824, 43866],
30953
+ [43868, 43881],
30954
+ [43888, 44010],
30955
+ [44012, 44013],
30956
+ [44016, 44025],
30957
+ [44032, 55203],
30958
+ [55216, 55238],
30959
+ [55243, 55291],
30960
+ [63744, 64109],
30961
+ [64112, 64217],
30962
+ [64256, 64262],
30963
+ [64275, 64279],
30964
+ [64285, 64296],
30965
+ [64298, 64310],
30966
+ [64312, 64316],
30967
+ [64318, 64318],
30968
+ [64320, 64321],
30969
+ [64323, 64324],
30970
+ [64326, 64433],
30971
+ [64467, 64605],
30972
+ [64612, 64829],
30973
+ [64848, 64911],
30974
+ [64914, 64967],
30975
+ [65008, 65017],
30976
+ [65024, 65039],
30977
+ [65056, 65071],
30978
+ [65075, 65076],
30979
+ [65101, 65103],
30980
+ [65137, 65137],
30981
+ [65139, 65139],
30982
+ [65143, 65143],
30983
+ [65145, 65145],
30984
+ [65147, 65147],
30985
+ [65149, 65149],
30986
+ [65151, 65276],
30987
+ [65296, 65305],
30988
+ [65313, 65338],
30989
+ [65343, 65343],
30990
+ [65345, 65370],
30991
+ [65381, 65470],
30992
+ [65474, 65479],
30993
+ [65482, 65487],
30994
+ [65490, 65495],
30995
+ [65498, 65500],
30996
+ [65536, 65547],
30997
+ [65549, 65574],
30998
+ [65576, 65594],
30999
+ [65596, 65597],
31000
+ [65599, 65613],
31001
+ [65616, 65629],
31002
+ [65664, 65786],
31003
+ [65856, 65908],
31004
+ [66045, 66045],
31005
+ [66176, 66204],
31006
+ [66208, 66256],
31007
+ [66272, 66272],
31008
+ [66304, 66335],
31009
+ [66349, 66378],
31010
+ [66384, 66426],
31011
+ [66432, 66461],
31012
+ [66464, 66499],
31013
+ [66504, 66511],
31014
+ [66513, 66517],
31015
+ [66560, 66717],
31016
+ [66720, 66729],
31017
+ [66736, 66771],
31018
+ [66776, 66811],
31019
+ [66816, 66855],
31020
+ [66864, 66915],
31021
+ [66928, 66938],
31022
+ [66940, 66954],
31023
+ [66956, 66962],
31024
+ [66964, 66965],
31025
+ [66967, 66977],
31026
+ [66979, 66993],
31027
+ [66995, 67001],
31028
+ [67003, 67004],
31029
+ [67008, 67059],
31030
+ [67072, 67382],
31031
+ [67392, 67413],
31032
+ [67424, 67431],
31033
+ [67456, 67461],
31034
+ [67463, 67504],
31035
+ [67506, 67514],
31036
+ [67584, 67589],
31037
+ [67592, 67592],
31038
+ [67594, 67637],
31039
+ [67639, 67640],
31040
+ [67644, 67644],
31041
+ [67647, 67669],
31042
+ [67680, 67702],
31043
+ [67712, 67742],
31044
+ [67808, 67826],
31045
+ [67828, 67829],
31046
+ [67840, 67861],
31047
+ [67872, 67897],
31048
+ [67968, 68023],
31049
+ [68030, 68031],
31050
+ [68096, 68099],
31051
+ [68101, 68102],
31052
+ [68108, 68115],
31053
+ [68117, 68119],
31054
+ [68121, 68149],
31055
+ [68152, 68154],
31056
+ [68159, 68159],
31057
+ [68192, 68220],
31058
+ [68224, 68252],
31059
+ [68288, 68295],
31060
+ [68297, 68326],
31061
+ [68352, 68405],
31062
+ [68416, 68437],
31063
+ [68448, 68466],
31064
+ [68480, 68497],
31065
+ [68608, 68680],
31066
+ [68736, 68786],
31067
+ [68800, 68850],
31068
+ [68864, 68903],
31069
+ [68912, 68921],
31070
+ [68928, 68965],
31071
+ [68969, 68973],
31072
+ [68975, 68997],
31073
+ [69248, 69289],
31074
+ [69291, 69292],
31075
+ [69296, 69297],
31076
+ [69314, 69316],
31077
+ [69372, 69404],
31078
+ [69415, 69415],
31079
+ [69424, 69456],
31080
+ [69488, 69509],
31081
+ [69552, 69572],
31082
+ [69600, 69622],
31083
+ [69632, 69702],
31084
+ [69734, 69749],
31085
+ [69759, 69818],
31086
+ [69826, 69826],
31087
+ [69840, 69864],
31088
+ [69872, 69881],
31089
+ [69888, 69940],
31090
+ [69942, 69951],
31091
+ [69956, 69959],
31092
+ [69968, 70003],
31093
+ [70006, 70006],
31094
+ [70016, 70084],
31095
+ [70089, 70092],
31096
+ [70094, 70106],
31097
+ [70108, 70108],
31098
+ [70144, 70161],
31099
+ [70163, 70199],
31100
+ [70206, 70209],
31101
+ [70272, 70278],
31102
+ [70280, 70280],
31103
+ [70282, 70285],
31104
+ [70287, 70301],
31105
+ [70303, 70312],
31106
+ [70320, 70378],
31107
+ [70384, 70393],
31108
+ [70400, 70403],
31109
+ [70405, 70412],
31110
+ [70415, 70416],
31111
+ [70419, 70440],
31112
+ [70442, 70448],
31113
+ [70450, 70451],
31114
+ [70453, 70457],
31115
+ [70459, 70468],
31116
+ [70471, 70472],
31117
+ [70475, 70477],
31118
+ [70480, 70480],
31119
+ [70487, 70487],
31120
+ [70493, 70499],
31121
+ [70502, 70508],
31122
+ [70512, 70516],
31123
+ [70528, 70537],
31124
+ [70539, 70539],
31125
+ [70542, 70542],
31126
+ [70544, 70581],
31127
+ [70583, 70592],
31128
+ [70594, 70594],
31129
+ [70597, 70597],
31130
+ [70599, 70602],
31131
+ [70604, 70611],
31132
+ [70625, 70626],
31133
+ [70656, 70730],
31134
+ [70736, 70745],
31135
+ [70750, 70753],
31136
+ [70784, 70853],
31137
+ [70855, 70855],
31138
+ [70864, 70873],
31139
+ [71040, 71093],
31140
+ [71096, 71104],
31141
+ [71128, 71133],
31142
+ [71168, 71232],
31143
+ [71236, 71236],
31144
+ [71248, 71257],
31145
+ [71296, 71352],
31146
+ [71360, 71369],
31147
+ [71376, 71395],
31148
+ [71424, 71450],
31149
+ [71453, 71467],
31150
+ [71472, 71481],
31151
+ [71488, 71494],
31152
+ [71680, 71738],
31153
+ [71840, 71913],
31154
+ [71935, 71942],
31155
+ [71945, 71945],
31156
+ [71948, 71955],
31157
+ [71957, 71958],
31158
+ [71960, 71989],
31159
+ [71991, 71992],
31160
+ [71995, 72003],
31161
+ [72016, 72025],
31162
+ [72096, 72103],
31163
+ [72106, 72151],
31164
+ [72154, 72161],
31165
+ [72163, 72164],
31166
+ [72192, 72254],
31167
+ [72263, 72263],
31168
+ [72272, 72345],
31169
+ [72349, 72349],
31170
+ [72368, 72440],
31171
+ [72640, 72672],
31172
+ [72688, 72697],
31173
+ [72704, 72712],
31174
+ [72714, 72758],
31175
+ [72760, 72768],
31176
+ [72784, 72793],
31177
+ [72818, 72847],
31178
+ [72850, 72871],
31179
+ [72873, 72886],
31180
+ [72960, 72966],
31181
+ [72968, 72969],
31182
+ [72971, 73014],
31183
+ [73018, 73018],
31184
+ [73020, 73021],
31185
+ [73023, 73031],
31186
+ [73040, 73049],
31187
+ [73056, 73061],
31188
+ [73063, 73064],
31189
+ [73066, 73102],
31190
+ [73104, 73105],
31191
+ [73107, 73112],
31192
+ [73120, 73129],
31193
+ [73440, 73462],
31194
+ [73472, 73488],
31195
+ [73490, 73530],
31196
+ [73534, 73538],
31197
+ [73552, 73562],
31198
+ [73648, 73648],
31199
+ [73728, 74649],
31200
+ [74752, 74862],
31201
+ [74880, 75075],
31202
+ [77712, 77808],
31203
+ [77824, 78895],
31204
+ [78912, 78933],
31205
+ [78944, 82938],
31206
+ [82944, 83526],
31207
+ [90368, 90425],
31208
+ [92160, 92728],
31209
+ [92736, 92766],
31210
+ [92768, 92777],
31211
+ [92784, 92862],
31212
+ [92864, 92873],
31213
+ [92880, 92909],
31214
+ [92912, 92916],
31215
+ [92928, 92982],
31216
+ [92992, 92995],
31217
+ [93008, 93017],
31218
+ [93027, 93047],
31219
+ [93053, 93071],
31220
+ [93504, 93548],
31221
+ [93552, 93561],
31222
+ [93760, 93823],
31223
+ [93952, 94026],
31224
+ [94031, 94087],
31225
+ [94095, 94111],
31226
+ [94176, 94177],
31227
+ [94179, 94180],
31228
+ [94192, 94193],
31229
+ [94208, 100343],
31230
+ [100352, 101589],
31231
+ [101631, 101640],
31232
+ [110576, 110579],
31233
+ [110581, 110587],
31234
+ [110589, 110590],
31235
+ [110592, 110882],
31236
+ [110898, 110898],
31237
+ [110928, 110930],
31238
+ [110933, 110933],
31239
+ [110948, 110951],
31240
+ [110960, 111355],
31241
+ [113664, 113770],
31242
+ [113776, 113788],
31243
+ [113792, 113800],
31244
+ [113808, 113817],
31245
+ [113821, 113822],
31246
+ [118e3, 118009],
31247
+ [118528, 118573],
31248
+ [118576, 118598],
31249
+ [119141, 119145],
31250
+ [119149, 119154],
31251
+ [119163, 119170],
31252
+ [119173, 119179],
31253
+ [119210, 119213],
31254
+ [119362, 119364],
31255
+ [119808, 119892],
31256
+ [119894, 119964],
31257
+ [119966, 119967],
31258
+ [119970, 119970],
31259
+ [119973, 119974],
31260
+ [119977, 119980],
31261
+ [119982, 119993],
31262
+ [119995, 119995],
31263
+ [119997, 120003],
31264
+ [120005, 120069],
31265
+ [120071, 120074],
31266
+ [120077, 120084],
31267
+ [120086, 120092],
31268
+ [120094, 120121],
31269
+ [120123, 120126],
31270
+ [120128, 120132],
31271
+ [120134, 120134],
31272
+ [120138, 120144],
31273
+ [120146, 120485],
31274
+ [120488, 120512],
31275
+ [120514, 120538],
31276
+ [120540, 120570],
31277
+ [120572, 120596],
31278
+ [120598, 120628],
31279
+ [120630, 120654],
31280
+ [120656, 120686],
31281
+ [120688, 120712],
31282
+ [120714, 120744],
31283
+ [120746, 120770],
31284
+ [120772, 120779],
31285
+ [120782, 120831],
31286
+ [121344, 121398],
31287
+ [121403, 121452],
31288
+ [121461, 121461],
31289
+ [121476, 121476],
31290
+ [121499, 121503],
31291
+ [121505, 121519],
31292
+ [122624, 122654],
31293
+ [122661, 122666],
31294
+ [122880, 122886],
31295
+ [122888, 122904],
31296
+ [122907, 122913],
31297
+ [122915, 122916],
31298
+ [122918, 122922],
31299
+ [122928, 122989],
31300
+ [123023, 123023],
31301
+ [123136, 123180],
31302
+ [123184, 123197],
31303
+ [123200, 123209],
31304
+ [123214, 123214],
31305
+ [123536, 123566],
31306
+ [123584, 123641],
31307
+ [124112, 124153],
31308
+ [124368, 124410],
31309
+ [124896, 124902],
31310
+ [124904, 124907],
31311
+ [124909, 124910],
31312
+ [124912, 124926],
31313
+ [124928, 125124],
31314
+ [125136, 125142],
31315
+ [125184, 125259],
31316
+ [125264, 125273],
31317
+ [126464, 126467],
31318
+ [126469, 126495],
31319
+ [126497, 126498],
31320
+ [126500, 126500],
31321
+ [126503, 126503],
31322
+ [126505, 126514],
31323
+ [126516, 126519],
31324
+ [126521, 126521],
31325
+ [126523, 126523],
31326
+ [126530, 126530],
31327
+ [126535, 126535],
31328
+ [126537, 126537],
31329
+ [126539, 126539],
31330
+ [126541, 126543],
31331
+ [126545, 126546],
31332
+ [126548, 126548],
31333
+ [126551, 126551],
31334
+ [126553, 126553],
31335
+ [126555, 126555],
31336
+ [126557, 126557],
31337
+ [126559, 126559],
31338
+ [126561, 126562],
31339
+ [126564, 126564],
31340
+ [126567, 126570],
31341
+ [126572, 126578],
31342
+ [126580, 126583],
31343
+ [126585, 126588],
31344
+ [126590, 126590],
31345
+ [126592, 126601],
31346
+ [126603, 126619],
31347
+ [126625, 126627],
31348
+ [126629, 126633],
31349
+ [126635, 126651],
31350
+ [130032, 130041],
31351
+ [131072, 173791],
31352
+ [173824, 177977],
31353
+ [177984, 178205],
31354
+ [178208, 183969],
31355
+ [183984, 191456],
31356
+ [191472, 192093],
31357
+ [194560, 195101],
31358
+ [196608, 201546],
31359
+ [201552, 205743],
31360
+ [917760, 917999]
31361
+ ];
31362
+ }
31363
+ });
31364
+
29689
31365
  // dist/duplicate-token-normalization.js
31366
+ function characterClassSource(ranges) {
31367
+ const escape2 = (codePoint) => `\\u{${codePoint.toString(16)}}`;
31368
+ return ranges.map(([from, to]) => from === to ? escape2(from) : `${escape2(from)}-${escape2(to)}`).join("");
31369
+ }
29690
31370
  function tokenizeDuplicateSource(text) {
29691
31371
  return text.match(duplicateTokenPattern) ?? [];
29692
31372
  }
@@ -29736,12 +31416,13 @@ function hasUnterminatedQuotedLiteral(text) {
29736
31416
  }
29737
31417
  return false;
29738
31418
  }
29739
- var duplicateTokenPattern, identifierTokenPattern;
31419
+ var DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE, duplicateTokenPattern, identifierTokenPattern;
29740
31420
  var init_duplicate_token_normalization = __esm({
29741
31421
  "dist/duplicate-token-normalization.js"() {
29742
31422
  "use strict";
29743
31423
  init_duplicate_keywords();
29744
- init_identifiers();
31424
+ init_duplicate_identifier_ranges();
31425
+ DUPLICATE_TOKENIZER_IDENTIFIER_SOURCE = `[${characterClassSource(DUPLICATE_IDENTIFIER_START_RANGES)}](?:[${characterClassSource(DUPLICATE_IDENTIFIER_CONTINUE_RANGES)}])*`;
29745
31426
  duplicateTokenPattern = new RegExp([
29746
31427
  String.raw`"(?:\\.|[^"\\])*"`,
29747
31428
  String.raw`'(?:\\.|[^'\\])*'`,
@@ -30779,23 +32460,38 @@ function transformPersistedExportFromModule(projectRoot, entry, toRelative) {
30779
32460
  entry.fromModule = assertFilePathWithinRoot(projectRoot, cacheAbsolutePath(projectRoot, entry.fromModule), "Persisted cache path");
30780
32461
  }
30781
32462
  function transformModulePaths(projectRoot, module2, toRelative) {
30782
- const copy = structuredClone(module2);
30783
32463
  const transform2 = (file2) => toRelative ? cacheRelativePath(projectRoot, file2) : assertFilePathWithinRoot(projectRoot, cacheAbsolutePath(projectRoot, file2), "Persisted cache path");
30784
- copy.file = transform2(copy.file);
30785
- for (const local of copy.locals)
30786
- local.file = transform2(local.file);
30787
- for (const entry of copy.exports) {
30788
- if (entry.type === "local") {
30789
- entry.target.file = transform2(entry.target.file);
30790
- } else {
30791
- transformPersistedExportFromModule(projectRoot, entry, toRelative);
32464
+ if (!toRelative) {
32465
+ module2.file = transform2(module2.file);
32466
+ for (const local of module2.locals)
32467
+ local.file = transform2(local.file);
32468
+ for (const entry of module2.exports) {
32469
+ if (entry.type === "local") {
32470
+ entry.target.file = transform2(entry.target.file);
32471
+ } else {
32472
+ transformPersistedExportFromModule(projectRoot, entry, false);
32473
+ }
30792
32474
  }
32475
+ for (const binding of module2.imports) {
32476
+ if (typeof binding.resolved === "string")
32477
+ binding.resolved = transform2(binding.resolved);
32478
+ }
32479
+ return module2;
30793
32480
  }
30794
- for (const binding of copy.imports) {
30795
- if (typeof binding.resolved === "string")
30796
- binding.resolved = transform2(binding.resolved);
30797
- }
30798
- return copy;
32481
+ return {
32482
+ ...module2,
32483
+ file: transform2(module2.file),
32484
+ locals: module2.locals.map((local) => ({ ...local, file: transform2(local.file) })),
32485
+ exports: module2.exports.map((entry) => {
32486
+ if (entry.type === "local") {
32487
+ return { ...entry, target: { ...entry.target, file: transform2(entry.target.file) } };
32488
+ }
32489
+ const copy = { ...entry };
32490
+ transformPersistedExportFromModule(projectRoot, copy, true);
32491
+ return copy;
32492
+ }),
32493
+ imports: module2.imports.map((binding) => typeof binding.resolved === "string" ? { ...binding, resolved: transform2(binding.resolved) } : binding)
32494
+ };
30799
32495
  }
30800
32496
  function tryLoadFromCache(projectRoot, file2, sig, opts, report, diskCacheAvailable = true) {
30801
32497
  const mode = opts?.cache ?? "off";
@@ -31409,7 +33105,7 @@ var init_unitCache = __esm({
31409
33105
  DUPLICATE_UNIT_CACHE_SCHEMA_VERSION = 2;
31410
33106
  DUPLICATE_UNIT_CACHE_TABLE = "duplicate_unit_cache";
31411
33107
  DUPLICATE_UNIT_CACHE_SCHEMA_VERSION_KEY = "duplicate_unit_cache.schema_version";
31412
- DUPLICATE_TOKENIZER_REVISION = 5;
33108
+ DUPLICATE_TOKENIZER_REVISION = 6;
31413
33109
  DUPLICATE_UNIT_CACHE_MAX_ROWS = 5e3;
31414
33110
  DUPLICATE_UNIT_CACHE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
31415
33111
  DUPLICATE_UNIT_MEMORY_CACHE_MAX_ENTRIES = 2048;
@@ -49038,14 +50734,32 @@ function resolveManifestSymlinkDirectories(projectRoot, storedProjectRoot, direc
49038
50734
  }
49039
50735
  return [...resolvedDirectories];
49040
50736
  }
50737
+ async function gitIgnoreConfigFiles(projectRoot) {
50738
+ const gitRoot = await getGitRepositoryRoot(projectRoot);
50739
+ if (!gitRoot)
50740
+ return [];
50741
+ const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
50742
+ const sourceRoots = [projectRoot, gitRoot, ...submoduleDirectories];
50743
+ const gitignoreFiles = await Promise.all(sourceRoots.map(async (root) => await (0, import_fast_glob3.default)(["**/.gitignore"], {
50744
+ cwd: root,
50745
+ absolute: true,
50746
+ dot: true,
50747
+ ignore: DEFAULT_PROJECT_FILE_IGNORES
50748
+ })));
50749
+ const excludeFiles = await Promise.all([gitRoot, ...submoduleDirectories].map(async (root) => await listGitExcludeFiles(root)));
50750
+ return Array.from(/* @__PURE__ */ new Set([...gitignoreFiles.flat(), ...excludeFiles.flat().map(({ file: file2 }) => file2)])).sort();
50751
+ }
49041
50752
  async function computeConfigHash(projectRoot, logLevel) {
49042
50753
  try {
49043
- const configFiles = await (0, import_fast_glob3.default)([...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE, "**/.gitignore"], {
49044
- cwd: projectRoot,
49045
- absolute: true,
49046
- dot: true,
49047
- ignore: DEFAULT_PROJECT_FILE_IGNORES
49048
- });
50754
+ const configFiles = Array.from(/* @__PURE__ */ new Set([
50755
+ ...await (0, import_fast_glob3.default)([...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE, "**/.gitignore"], {
50756
+ cwd: projectRoot,
50757
+ absolute: true,
50758
+ dot: true,
50759
+ ignore: DEFAULT_PROJECT_FILE_IGNORES
50760
+ }),
50761
+ ...await gitIgnoreConfigFiles(projectRoot)
50762
+ ]));
49049
50763
  configFiles.sort();
49050
50764
  const hash2 = crypto8.createHash("sha1");
49051
50765
  let firstError;
@@ -50095,6 +51809,7 @@ function migrateProjectSnapshotPayload(value, currentRoot) {
50095
51809
  const migrated = transformSnapshotPaths(relative, currentRoot, false);
50096
51810
  migrated.version = PROJECT_SNAPSHOT_VERSION;
50097
51811
  migrated.projectRoot = serializedProjectRoot(currentRoot);
51812
+ delete migrated.projectFiles;
50098
51813
  return migrated;
50099
51814
  }
50100
51815
  function transformDetailedGraph(graph, root, toRelative) {
@@ -51082,7 +52797,7 @@ var init_project_snapshot = __esm({
51082
52797
  init_module_cache();
51083
52798
  init_location();
51084
52799
  SNAPSHOT_SYMBOL_KINDS = new Set(Object.values(SymbolKind));
51085
- PROJECT_SNAPSHOT_VERSION = 9;
52800
+ PROJECT_SNAPSHOT_VERSION = 10;
51086
52801
  BLOOM_FILTER_SNAPSHOT_VERSION = 4;
51087
52802
  BLOOM_FILTER_SNAPSHOT_FILENAME = "bloom-filters.json";
51088
52803
  BLOOM_FILTER_MIN_SIZE = 1e3;
@@ -51312,8 +53027,9 @@ import { performance as performance2 } from "node:perf_hooks";
51312
53027
  async function finalizeProjectIndex(args) {
51313
53028
  if (args.timings)
51314
53029
  args.timings.totalMs = Math.round(performance2.now() - args.totalStart);
51315
- const projectFiles = await (args.projectFiles ?? discoverProjectFiles(args.projectRoot, {
51316
- ...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {}
53030
+ const projectFiles = await (args.projectFiles ?? discoverProjectFilesWithGitCandidates(args.projectRoot, {
53031
+ ...args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {},
53032
+ ...args.knownGitCandidates !== void 0 ? { knownGitCandidates: args.knownGitCandidates } : {}
51317
53033
  }));
51318
53034
  const languageExtensions = normalizeLanguageExtensions(args.opts?.languageExtensions);
51319
53035
  const parsed = retainedParsedCache(args.parsedMap, args.opts);
@@ -52769,13 +54485,26 @@ var init_esm_wrapper = __esm({
52769
54485
  var nativeWorkerPool_exports = {};
52770
54486
  __export(nativeWorkerPool_exports, {
52771
54487
  createNativeWorkerPool: () => createNativeWorkerPool,
52772
- resolveNativeWorkerPath: () => resolveNativeWorkerPath
54488
+ defaultNativeWorkerThreadCount: () => defaultNativeWorkerThreadCount,
54489
+ resolveNativeWorkerPath: () => resolveNativeWorkerPath,
54490
+ resolveNativeWorkerThreadCount: () => resolveNativeWorkerThreadCount
52773
54491
  });
54492
+ import os6 from "node:os";
52774
54493
  import fs21 from "node:fs";
52775
54494
  import { fileURLToPath as fileURLToPath4 } from "node:url";
52776
54495
  import path46 from "node:path";
54496
+ function defaultNativeWorkerThreadCount(availableParallelism = os6.availableParallelism()) {
54497
+ return Math.min(DEFAULT_NATIVE_THREAD_CAP, Math.max(1, Math.floor(availableParallelism * 0.75)));
54498
+ }
54499
+ function resolveNativeWorkerThreadCount(requested, availableParallelism = os6.availableParallelism()) {
54500
+ return resolveWorkerThreadCount({
54501
+ requested,
54502
+ defaultCount: defaultNativeWorkerThreadCount(availableParallelism),
54503
+ max: HARD_MAX_THREADS
54504
+ });
54505
+ }
52777
54506
  function resolveThreadCount(requested) {
52778
- return resolveWorkerThreadCount({ requested, max: HARD_MAX_THREADS });
54507
+ return resolveNativeWorkerThreadCount(requested);
52779
54508
  }
52780
54509
  function resolveNativeWorkerPath() {
52781
54510
  const selfDir = path46.dirname(fileURLToPath4(import.meta.url));
@@ -52802,13 +54531,14 @@ function createNativeWorkerPool(opts) {
52802
54531
  ...opts?.workerData === void 0 ? {} : { workerData: opts.workerData }
52803
54532
  });
52804
54533
  }
52805
- var HARD_MAX_THREADS;
54534
+ var HARD_MAX_THREADS, DEFAULT_NATIVE_THREAD_CAP;
52806
54535
  var init_nativeWorkerPool = __esm({
52807
54536
  "dist/worker/nativeWorkerPool.js"() {
52808
54537
  "use strict";
52809
54538
  init_esm_wrapper();
52810
54539
  init_workerThreads();
52811
54540
  HARD_MAX_THREADS = 64;
54541
+ DEFAULT_NATIVE_THREAD_CAP = 8;
52812
54542
  }
52813
54543
  });
52814
54544
 
@@ -52844,11 +54574,12 @@ function countNativeWorkerEligibleFiles(files, languageExtensions) {
52844
54574
  }
52845
54575
  return count;
52846
54576
  }
52847
- function buildWorkerTask(filePath, sup, source) {
54577
+ function buildWorkerTask(filePath, sup, source, includeBloomFilter = false) {
52848
54578
  return {
52849
54579
  filePath,
52850
54580
  languageId: sup.id,
52851
54581
  ...source !== void 0 ? { source, includeSourceInResult: false } : {},
54582
+ ...includeBloomFilter ? { includeBloomFilter: true } : {},
52852
54583
  importsQuery: getCachedNormalizedQuery(sup, "imports"),
52853
54584
  exportsQuery: getCachedNormalizedQuery(sup, "exports"),
52854
54585
  localsQuery: getCachedNormalizedQuery(sup, "locals"),
@@ -52867,7 +54598,8 @@ function workerResultToPrepared(result, sup, filePath, ownedSource) {
52867
54598
  nativeQueries: result.nativeResults,
52868
54599
  syntaxTree: result.syntaxTree,
52869
54600
  ...result.fallbackReason ? { nativeFallbackReason: result.fallbackReason } : {},
52870
- ...result.error ? { nativeError: result.error } : {}
54601
+ ...result.error ? { nativeError: result.error } : {},
54602
+ ...result.bloomFilter ? { workerBloomFilter: result.bloomFilter } : {}
52871
54603
  };
52872
54604
  }
52873
54605
  async function setupWorkerPool(opts, fileCount) {
@@ -52947,7 +54679,7 @@ function createOversizedNativeSourceFallback(file2, support, source) {
52947
54679
  nativeError: `source exceeds native byte limit (${bytes} > ${DEFAULT_NATIVE_SOURCE_MAX_BYTES})`
52948
54680
  };
52949
54681
  }
52950
- async function prepareFileContextForBuild(file2, support, opts, workerSetup, report, confinedRoot, lexicalRoot, trustedSource) {
54682
+ async function prepareFileContextForBuild(file2, support, opts, workerSetup, report, confinedRoot, lexicalRoot, trustedSource, includeBloomFilter = false) {
52951
54683
  const source = trustedSource ?? (confinedRoot ? await readConfinedUtf8File(confinedRoot, lexicalRoot ?? confinedRoot, file2) : void 0);
52952
54684
  if (source && Buffer.byteLength(source, "utf8") > DEFAULT_NATIVE_SOURCE_MAX_BYTES) {
52953
54685
  const prepared2 = createOversizedNativeSourceFallback(file2, support, source);
@@ -52959,7 +54691,7 @@ async function prepareFileContextForBuild(file2, support, opts, workerSetup, rep
52959
54691
  if (workerSetup.report)
52960
54692
  workerSetup.report.tasksSubmitted++;
52961
54693
  try {
52962
- const workerResult = await workerSetup.pool.run(buildWorkerTask(file2, support, source));
54694
+ const workerResult = await workerSetup.pool.run(buildWorkerTask(file2, support, source, includeBloomFilter));
52963
54695
  prepared = workerResultToPrepared(workerResult, support, file2, source);
52964
54696
  } catch (error51) {
52965
54697
  if (isNativeRequiredUnavailableError(error51) && error51 instanceof Error)
@@ -53250,7 +54982,7 @@ async function resolveCrossModuleSymbolExports(file2, mod2, support, projectRoot
53250
54982
  }
53251
54983
  }
53252
54984
  async function buildIndexedModuleForFile(args) {
53253
- const prepared = await prepareFileContextForBuild(args.file, args.support, args.opts, args.workerSetup, args.report, args.confinedRoot, args.projectRoot, args.trustedSource);
54985
+ const prepared = await prepareFileContextForBuild(args.file, args.support, args.opts, args.workerSetup, args.report, args.confinedRoot, args.projectRoot, args.trustedSource, !!args.bloomFilterCache);
53254
54986
  const { source, sup, nativeQueries, embeddedBlocks } = prepared;
53255
54987
  let tree;
53256
54988
  const graphOnlyLanguage = isGraphOnlyLanguage(sup.id), nativeSourceLimitFallback = prepared.nativeFallbackReason === "queryFailure" && !!prepared.nativeError?.startsWith("source exceeds native byte limit");
@@ -53289,7 +55021,7 @@ async function buildIndexedModuleForFile(args) {
53289
55021
  }
53290
55022
  const lacksParserContext = !nativeQueries && !tree;
53291
55023
  if (args.bloomFilterCache && !nativeSourceLimitFallback) {
53292
- const filter = buildBloomFilterFromSource(source, sup);
55024
+ const filter = prepared.workerBloomFilter ? BloomFilter.fromBuffer(Buffer.from(prepared.workerBloomFilter.bits), prepared.workerBloomFilter.size, prepared.workerBloomFilter.hashCount, prepared.workerBloomFilter.itemCount) : buildBloomFilterFromSource(source, sup);
53293
55025
  args.bloomFilterCache.set(args.file, filter);
53294
55026
  }
53295
55027
  const sharedImportOptions = {
@@ -53918,11 +55650,16 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
53918
55650
  const onSymlinkDirectoriesDiscovered = (directories) => {
53919
55651
  discoveredSymlinkDirectories = Array.from(directories);
53920
55652
  };
53921
- const discoveredFiles = await listProjectFiles(projectRoot, projectPatternsForLanguageExtensions(opts), {
55653
+ let discoveredGitCandidates;
55654
+ const onGitCandidatesDiscovered = (candidates) => {
55655
+ discoveredGitCandidates = candidates;
55656
+ };
55657
+ const discoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
53922
55658
  ...opts?.discovery,
53923
55659
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
53924
55660
  ...knownSymlinkDirectories !== void 0 ? { knownSymlinkDirectories } : {},
53925
- onSymlinkDirectoriesDiscovered
55661
+ onSymlinkDirectoriesDiscovered,
55662
+ onGitCandidatesDiscovered
53926
55663
  });
53927
55664
  const additionalFileCandidates = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.additionalFiles ?? [], "Additional index file");
53928
55665
  const additionalFileExistence = await probePathExistence(additionalFileCandidates, buildConcurrency(opts));
@@ -53930,9 +55667,10 @@ async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpt
53930
55667
  const discoveredFileSet = new Set(discoveredFiles);
53931
55668
  const files = Array.from(/* @__PURE__ */ new Set([...discoveredFiles, ...additionalFiles]));
53932
55669
  const transientFiles = additionalFiles.filter((file2) => !discoveredFileSet.has(file2));
53933
- const projectFiles = await discoverProjectFiles(projectRoot, {
55670
+ const projectFiles = await discoverProjectFilesWithGitCandidates(projectRoot, {
53934
55671
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
53935
- ...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {}
55672
+ ...discoveredSymlinkDirectories !== void 0 ? { knownSymlinkDirectories: discoveredSymlinkDirectories } : {},
55673
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {}
53936
55674
  });
53937
55675
  return await buildIndexFromFileListShared(projectRoot, files, opts, {
53938
55676
  manifestMode: useDiskCache ? "read-write" : "off",
@@ -54126,6 +55864,7 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54126
55864
  const gitFiles = needsGitScan ? await listChangedFiles(projectRoot, buildIncrementalGitDiffOptions(opts)) : [];
54127
55865
  let untrackedFiles = [];
54128
55866
  let rediscoveredFiles = [];
55867
+ let discoveredGitCandidates;
54129
55868
  if (canUseIncrementalDiscoveryFastPath(gitAvailable, opts?.cacheStrict)) {
54130
55869
  try {
54131
55870
  untrackedFiles = (canReuseReconciliation ? opts?.reconciledUntrackedFiles : void 0) ?? await listUntrackedProjectFiles(projectRoot, opts?.discovery, gitAvailable);
@@ -54138,10 +55877,13 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54138
55877
  return await buildProjectIndexFromExport(projectRoot, opts, { ignoreExistingManifest: true });
54139
55878
  }
54140
55879
  } else if (!opts?.filesAreProjectScope) {
54141
- rediscoveredFiles = await listProjectFiles(projectRoot, projectPatternsForLanguageExtensions(opts), {
55880
+ rediscoveredFiles = await listProjectFilesWithGitCandidates(projectRoot, projectPatternsForLanguageExtensions(opts), {
54142
55881
  ...opts?.discovery,
54143
55882
  ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
54144
- ...!opts?.cacheStrict && manifest.symlinkDirectories !== void 0 ? { knownSymlinkDirectories: manifest.symlinkDirectories } : {}
55883
+ ...!opts?.cacheStrict && manifest.symlinkDirectories !== void 0 ? { knownSymlinkDirectories: manifest.symlinkDirectories } : {},
55884
+ onGitCandidatesDiscovered: (candidates) => {
55885
+ discoveredGitCandidates = candidates;
55886
+ }
54145
55887
  });
54146
55888
  }
54147
55889
  const candidateFiles = [
@@ -54241,8 +55983,9 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54241
55983
  if (!snapshotLoad)
54242
55984
  return null;
54243
55985
  const snapshot = snapshotLoad.index;
54244
- snapshot.projectFiles ??= await discoverProjectFiles(projectRoot, {
54245
- ...opts?.logLevel ? { logLevel: opts.logLevel } : {}
55986
+ snapshot.projectFiles ??= await discoverProjectFilesWithGitCandidates(projectRoot, {
55987
+ ...opts?.logLevel ? { logLevel: opts.logLevel } : {},
55988
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {}
54246
55989
  });
54247
55990
  if (opts?.cache) {
54248
55991
  snapshot.cacheMode = opts.cache;
@@ -54549,6 +56292,7 @@ async function buildProjectIndexIncremental(projectRoot, opts) {
54549
56292
  modules,
54550
56293
  parsedMap,
54551
56294
  bloomFilterCache,
56295
+ ...discoveredGitCandidates !== void 0 ? { knownGitCandidates: discoveredGitCandidates } : {},
54552
56296
  manifestEntries: projectIndexManifestEntries2(
54553
56297
  // `manifestEntries` (a `ManifestFileEntry`) never carries `cacheSig` -- that field
54554
56298
  // only lives on `FileSignature`. Overlay each entry with the `cacheSig` this build
@@ -57808,13 +59552,13 @@ __export(skill_exports, {
57808
59552
  handleSkillCommand: () => handleSkillCommand
57809
59553
  });
57810
59554
  import fsp30 from "node:fs/promises";
57811
- import os6 from "node:os";
59555
+ import os7 from "node:os";
57812
59556
  import path53 from "node:path";
57813
59557
  function getBundledSkillDir(packageRoot) {
57814
59558
  const candidate = path53.join(packageRoot, "codegraph-skill", "codegraph");
57815
59559
  return pathExists(path53.join(candidate, "SKILL.md")) ? candidate : null;
57816
59560
  }
57817
- function getSkillTargetDirForAgent(agent, homeDir = os6.homedir(), env = process.env) {
59561
+ function getSkillTargetDirForAgent(agent, homeDir = os7.homedir(), env = process.env) {
57818
59562
  if (agent === "agents") {
57819
59563
  return path53.join(homeDir, ".agents", "skills", "codegraph");
57820
59564
  }
@@ -58033,7 +59777,7 @@ var init_skill = __esm({
58033
59777
  // dist/installer/locks.js
58034
59778
  import { createHash as createHash5, randomUUID as randomUUID3 } from "node:crypto";
58035
59779
  import fsp31, {} from "node:fs/promises";
58036
- import os7 from "node:os";
59780
+ import os8 from "node:os";
58037
59781
  import path54 from "node:path";
58038
59782
  function opencodeConfigHome(settings) {
58039
59783
  const configHome = settings.env.XDG_CONFIG_HOME?.trim();
@@ -58069,7 +59813,7 @@ function installerTransactionLockScopes(settings) {
58069
59813
  }
58070
59814
  function installerTransactionLockPath(scope) {
58071
59815
  const digest = createHash5("sha256").update(scope).digest("hex");
58072
- return path54.join(os7.tmpdir(), `codegraph-installer-${digest}.lock`);
59816
+ return path54.join(os8.tmpdir(), `codegraph-installer-${digest}.lock`);
58073
59817
  }
58074
59818
  async function withInstallerLeaseLock(lockPath, resourceName, operation) {
58075
59819
  const lock = await acquireInstallerLeaseLock(lockPath, resourceName);
@@ -58235,7 +59979,7 @@ var init_locks = __esm({
58235
59979
  // dist/installer/registry.js
58236
59980
  import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
58237
59981
  import fsp32 from "node:fs/promises";
58238
- import os8 from "node:os";
59982
+ import os9 from "node:os";
58239
59983
  import path55 from "node:path";
58240
59984
  import { applyEdits, modify, parse as parseJsonc2 } from "jsonc-parser";
58241
59985
  function listInstallTargets() {
@@ -58984,7 +60728,7 @@ function installerSettings(options) {
58984
60728
  if (env === void 0)
58985
60729
  env = options.homeDir === void 0 ? process.env : {};
58986
60730
  return {
58987
- homeDir: options.homeDir ?? os8.homedir(),
60731
+ homeDir: options.homeDir ?? os9.homedir(),
58988
60732
  env
58989
60733
  };
58990
60734
  }
@@ -59321,7 +61065,7 @@ __export(doctor_exports, {
59321
61065
  formatDoctorSummary: () => formatDoctorSummary
59322
61066
  });
59323
61067
  import fs25 from "node:fs";
59324
- import os9 from "node:os";
61068
+ import os10 from "node:os";
59325
61069
  import path57 from "node:path";
59326
61070
  function statIfExists(filePath) {
59327
61071
  try {
@@ -59549,7 +61293,7 @@ function readCacheLocationField(configPath) {
59549
61293
  }
59550
61294
  }
59551
61295
  function readUserCacheLocation() {
59552
- const configRoot = process.platform === "win32" ? process.env.APPDATA?.trim() || path57.join(os9.homedir(), "AppData", "Roaming") : process.env.XDG_CONFIG_HOME?.trim() || path57.join(os9.homedir(), ".config");
61296
+ const configRoot = process.platform === "win32" ? process.env.APPDATA?.trim() || path57.join(os10.homedir(), "AppData", "Roaming") : process.env.XDG_CONFIG_HOME?.trim() || path57.join(os10.homedir(), ".config");
59553
61297
  return readCacheLocationField(path57.join(configRoot, "codegraph", "config.json"));
59554
61298
  }
59555
61299
  function readEffectiveCacheLocation(root) {
@@ -72138,9 +73882,10 @@ var init_packet = __esm({
72138
73882
  import fs32 from "node:fs/promises";
72139
73883
  import { brotliCompressSync as brotliCompressSync4, constants as zlibConstants4 } from "node:zlib";
72140
73884
  function compressQueryText(text) {
72141
- return brotliCompressSync4(text, {
73885
+ const compressed = brotliCompressSync4(text, {
72142
73886
  params: { [zlibConstants4.BROTLI_PARAM_QUALITY]: 4 }
72143
73887
  });
73888
+ return new Uint8Array(compressed.buffer, compressed.byteOffset, compressed.byteLength);
72144
73889
  }
72145
73890
  function normalizeQuerySearchText(input) {
72146
73891
  return input.replace(/([\p{Ll}\p{Nd}])(\p{Lu})/gu, "$1 $2").replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu, "$1 $2").toLowerCase().replace(/[^\p{L}\p{N}\p{M}_]+/gu, " ").trim();
@@ -72982,12 +74727,19 @@ var init_sourceIdentity = __esm({
72982
74727
  // dist/agent/query-index/workerPool.js
72983
74728
  var workerPool_exports = {};
72984
74729
  __export(workerPool_exports, {
74730
+ QUERY_INDEX_WORKER_MIN_FILES: () => QUERY_INDEX_WORKER_MIN_FILES,
74731
+ prepareQueryIndexFiles: () => prepareQueryIndexFiles,
74732
+ prepareQueryIndexFilesInProcess: () => prepareQueryIndexFilesInProcess,
72985
74733
  prepareQueryIndexFilesInWorker: () => prepareQueryIndexFilesInWorker,
72986
- resolveQueryIndexWorkerPath: () => resolveQueryIndexWorkerPath
74734
+ resolveQueryIndexWorkerPath: () => resolveQueryIndexWorkerPath,
74735
+ shouldPrepareQueryIndexFilesInWorker: () => shouldPrepareQueryIndexFilesInWorker
72987
74736
  });
72988
74737
  import fs33 from "node:fs";
72989
74738
  import path75 from "node:path";
72990
74739
  import { fileURLToPath as fileURLToPath6 } from "node:url";
74740
+ function shouldPrepareQueryIndexFilesInWorker(fileCount, threadCount = resolveWorkerThreads()) {
74741
+ return threadCount > 1 && fileCount >= QUERY_INDEX_WORKER_MIN_FILES;
74742
+ }
72991
74743
  function resolveWorkerThreads() {
72992
74744
  return resolveWorkerThreadCount({ max: QUERY_INDEX_MAX_THREADS });
72993
74745
  }
@@ -73052,7 +74804,15 @@ async function prepareQueryIndexFilesInWorker(projectRoot, files) {
73052
74804
  await pool.destroy();
73053
74805
  }
73054
74806
  }
73055
- var QUERY_INDEX_MAX_THREADS;
74807
+ async function prepareQueryIndexFiles(projectRoot, files) {
74808
+ if (!files.length)
74809
+ return [];
74810
+ if (!shouldPrepareQueryIndexFilesInWorker(files.length)) {
74811
+ return await prepareQueryIndexFilesInProcess(projectRoot, files);
74812
+ }
74813
+ return await prepareQueryIndexFilesInWorker(projectRoot, files);
74814
+ }
74815
+ var QUERY_INDEX_MAX_THREADS, QUERY_INDEX_WORKER_MIN_FILES;
73056
74816
  var init_workerPool = __esm({
73057
74817
  "dist/agent/query-index/workerPool.js"() {
73058
74818
  "use strict";
@@ -73062,6 +74822,7 @@ var init_workerPool = __esm({
73062
74822
  init_paths2();
73063
74823
  init_workerThreads();
73064
74824
  QUERY_INDEX_MAX_THREADS = 4;
74825
+ QUERY_INDEX_WORKER_MIN_FILES = 512;
73065
74826
  }
73066
74827
  });
73067
74828
 
@@ -73146,8 +74907,8 @@ function buildMetadata(current) {
73146
74907
  }
73147
74908
  async function prepareFiles(projectRoot, files, diagnostics) {
73148
74909
  try {
73149
- const { prepareQueryIndexFilesInWorker: prepareQueryIndexFilesInWorker2 } = await Promise.resolve().then(() => (init_workerPool(), workerPool_exports));
73150
- const prepared = await prepareQueryIndexFilesInWorker2(projectRoot, files.map((file2) => ({
74910
+ const { prepareQueryIndexFiles: prepareQueryIndexFiles2 } = await Promise.resolve().then(() => (init_workerPool(), workerPool_exports));
74911
+ const prepared = await prepareQueryIndexFiles2(projectRoot, files.map((file2) => ({
73151
74912
  relativePath: file2.path,
73152
74913
  sourceIdentity: file2.sourceIdentity
73153
74914
  })));
@@ -102040,7 +103801,7 @@ var init_dist4 = __esm({
102040
103801
  });
102041
103802
 
102042
103803
  // dist/mcp/http.js
102043
- import os10 from "node:os";
103804
+ import os11 from "node:os";
102044
103805
  function getRequestPath(request) {
102045
103806
  return new URL(request.url ?? "/", "http://127.0.0.1").pathname;
102046
103807
  }
@@ -102243,11 +104004,11 @@ function isWildcardBindHost(host) {
102243
104004
  }
102244
104005
  function localInterfaceHostnames() {
102245
104006
  const hosts = /* @__PURE__ */ new Set();
102246
- const hostname3 = os10.hostname().trim().toLowerCase();
104007
+ const hostname3 = os11.hostname().trim().toLowerCase();
102247
104008
  if (hostname3) {
102248
104009
  hosts.add(hostname3);
102249
104010
  }
102250
- const interfaces = os10.networkInterfaces();
104011
+ const interfaces = os11.networkInterfaces();
102251
104012
  for (const entries of Object.values(interfaces)) {
102252
104013
  for (const entry of entries ?? []) {
102253
104014
  if (entry.internal)
@@ -106287,7 +108048,7 @@ var init_artifact3 = __esm({
106287
108048
  // dist/drift/git.js
106288
108049
  import { execFile } from "node:child_process";
106289
108050
  import fsp42 from "node:fs/promises";
106290
- import os11 from "node:os";
108051
+ import os12 from "node:os";
106291
108052
  import path91 from "node:path";
106292
108053
  import { promisify } from "node:util";
106293
108054
  function snapshotOptions(options) {
@@ -106326,7 +108087,7 @@ async function materializeGitRef(root, ref, prefix) {
106326
108087
  }
106327
108088
  if (checkoutRef === void 0 || checkoutRef === "." || isGitWorktreeSentinel(checkoutRef))
106328
108089
  return { root };
106329
- const tempRoot = await fsp42.mkdtemp(path91.join(os11.tmpdir(), prefix));
108090
+ const tempRoot = await fsp42.mkdtemp(path91.join(os12.tmpdir(), prefix));
106330
108091
  try {
106331
108092
  await execFileAsync("git", ["clone", "--quiet", "--no-checkout", root, tempRoot], { env: process.env });
106332
108093
  const checkoutCommit = await resolveGitCommit(root, checkoutRef);