@lzehrung/codegraph 2.3.21 → 2.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/THIRD_PARTY_NOTICES +4 -4
- package/codegraph-skill/codegraph/SKILL.md +97 -282
- package/dist/agent/call-hierarchy.d.ts +28 -0
- package/dist/agent/call-hierarchy.d.ts.map +1 -0
- package/dist/agent/call-hierarchy.js +82 -0
- package/dist/agent/call-hierarchy.js.map +1 -0
- package/dist/agent/candidate-tests.d.ts +12 -0
- package/dist/agent/candidate-tests.d.ts.map +1 -0
- package/dist/agent/candidate-tests.js +17 -0
- package/dist/agent/candidate-tests.js.map +1 -0
- package/dist/agent/explain.d.ts +8 -2
- package/dist/agent/explain.d.ts.map +1 -1
- package/dist/agent/explain.js +17 -3
- package/dist/agent/explain.js.map +1 -1
- package/dist/agent/explore.d.ts +3 -3
- package/dist/agent/explore.d.ts.map +1 -1
- package/dist/agent/explore.js +2 -2
- package/dist/agent/explore.js.map +1 -1
- package/dist/agent/file-view.d.ts +55 -0
- package/dist/agent/file-view.d.ts.map +1 -0
- package/dist/agent/file-view.js +521 -0
- package/dist/agent/file-view.js.map +1 -0
- package/dist/agent/follow-ups.d.ts +10 -0
- package/dist/agent/follow-ups.d.ts.map +1 -0
- package/dist/agent/follow-ups.js +175 -0
- package/dist/agent/follow-ups.js.map +1 -0
- package/dist/agent/normalize.d.ts +1 -1
- package/dist/agent/normalize.d.ts.map +1 -1
- package/dist/agent/normalize.js +2 -2
- package/dist/agent/normalize.js.map +1 -1
- package/dist/agent/orient.d.ts +1 -1
- package/dist/agent/orient.d.ts.map +1 -1
- package/dist/agent/orient.js +2 -2
- package/dist/agent/orient.js.map +1 -1
- package/dist/agent/packet.d.ts +1 -1
- package/dist/agent/packet.d.ts.map +1 -1
- package/dist/agent/packet.js +1 -1
- package/dist/agent/packet.js.map +1 -1
- package/dist/agent/query-index/candidates.d.ts +8 -2
- package/dist/agent/query-index/candidates.d.ts.map +1 -1
- package/dist/agent/query-index/candidates.js +12 -5
- package/dist/agent/query-index/candidates.js.map +1 -1
- package/dist/agent/query-index/content.js +2 -2
- package/dist/agent/query-index/content.js.map +1 -1
- package/dist/agent/query-index/query-index-worker.d.ts +8 -0
- package/dist/agent/query-index/query-index-worker.d.ts.map +1 -0
- package/dist/agent/query-index/query-index-worker.js +11 -0
- package/dist/agent/query-index/query-index-worker.js.map +1 -0
- package/dist/agent/query-index/session-store.d.ts +5 -0
- package/dist/agent/query-index/session-store.d.ts.map +1 -0
- package/dist/agent/query-index/session-store.js +69 -0
- package/dist/agent/query-index/session-store.js.map +1 -0
- package/dist/agent/query-index/source-identity.d.ts +3 -0
- package/dist/agent/query-index/source-identity.d.ts.map +1 -0
- package/dist/agent/query-index/source-identity.js +12 -0
- package/dist/agent/query-index/source-identity.js.map +1 -0
- package/dist/agent/query-index/store.d.ts +5 -1
- package/dist/agent/query-index/store.d.ts.map +1 -1
- package/dist/agent/query-index/store.js +98 -31
- package/dist/agent/query-index/store.js.map +1 -1
- package/dist/agent/query-index/update.js +3 -3
- package/dist/agent/query-index/update.js.map +1 -1
- package/dist/agent/query-index/worker-pool.d.ts +27 -0
- package/dist/agent/query-index/worker-pool.d.ts.map +1 -0
- package/dist/agent/query-index/worker-pool.js +114 -0
- package/dist/agent/query-index/worker-pool.js.map +1 -0
- package/dist/agent/refactor-plan.d.ts +40 -0
- package/dist/agent/refactor-plan.d.ts.map +1 -0
- package/dist/agent/refactor-plan.js +226 -0
- package/dist/agent/refactor-plan.js.map +1 -0
- package/dist/agent/rename-preview.d.ts +57 -0
- package/dist/agent/rename-preview.d.ts.map +1 -0
- package/dist/agent/rename-preview.js +1062 -0
- package/dist/agent/rename-preview.js.map +1 -0
- package/dist/agent/search.d.ts +8 -2
- package/dist/agent/search.d.ts.map +1 -1
- package/dist/agent/search.js +26 -9
- package/dist/agent/search.js.map +1 -1
- package/dist/agent/semantic-symbols.d.ts +16 -0
- package/dist/agent/semantic-symbols.d.ts.map +1 -0
- package/dist/agent/semantic-symbols.js +97 -0
- package/dist/agent/semantic-symbols.js.map +1 -0
- package/dist/agent/semantic.d.ts +1 -1
- package/dist/agent/semantic.d.ts.map +1 -1
- package/dist/agent/session-lifecycle.d.ts +5 -0
- package/dist/agent/session-lifecycle.d.ts.map +1 -0
- package/dist/agent/session-lifecycle.js +18 -0
- package/dist/agent/session-lifecycle.js.map +1 -0
- package/dist/agent/session.d.ts +2 -2
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +63 -20
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/symbol-lookup.d.ts +12 -0
- package/dist/agent/symbol-lookup.d.ts.map +1 -0
- package/dist/agent/symbol-lookup.js +26 -0
- package/dist/agent/symbol-lookup.js.map +1 -0
- package/dist/agent/type-hierarchy.d.ts +39 -0
- package/dist/agent/type-hierarchy.d.ts.map +1 -0
- package/dist/agent/type-hierarchy.js +125 -0
- package/dist/agent/type-hierarchy.js.map +1 -0
- package/dist/agent/workspace-symbols.d.ts +18 -0
- package/dist/agent/workspace-symbols.d.ts.map +1 -0
- package/dist/agent/workspace-symbols.js +75 -0
- package/dist/agent/workspace-symbols.js.map +1 -0
- package/dist/agent-tools.d.ts +6 -6
- package/dist/agent-tools.d.ts.map +1 -1
- package/dist/agent-tools.js +6 -6
- package/dist/agent-tools.js.map +1 -1
- package/dist/agent.d.ts +18 -18
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +10 -10
- package/dist/agent.js.map +1 -1
- package/dist/analysis-summary.d.ts +19 -0
- package/dist/analysis-summary.d.ts.map +1 -0
- package/dist/analysis-summary.js +80 -0
- package/dist/analysis-summary.js.map +1 -0
- package/dist/bin/cli.js +1366 -1093
- package/dist/bin/query-index-worker.js +4382 -0
- package/dist/bin/raw-query-worker.js +383 -0
- package/dist/bootstrap/tree-sitter-languages.d.ts +5 -0
- package/dist/bootstrap/tree-sitter-languages.d.ts.map +1 -0
- package/dist/bootstrap/tree-sitter-languages.js +41 -0
- package/dist/bootstrap/tree-sitter-languages.js.map +1 -0
- package/dist/chunking/chunk-blocks.d.ts +9 -0
- package/dist/chunking/chunk-blocks.d.ts.map +1 -0
- package/dist/chunking/chunk-blocks.js +60 -0
- package/dist/chunking/chunk-blocks.js.map +1 -0
- package/dist/chunking/chunk-file.d.ts +39 -0
- package/dist/chunking/chunk-file.d.ts.map +1 -0
- package/dist/chunking/chunk-file.js +152 -0
- package/dist/chunking/chunk-file.js.map +1 -0
- package/dist/chunking/chunk-id.d.ts +7 -0
- package/dist/chunking/chunk-id.d.ts.map +1 -0
- package/dist/chunking/chunk-id.js +30 -0
- package/dist/chunking/chunk-id.js.map +1 -0
- package/dist/chunking/chunk-matches.d.ts +4 -0
- package/dist/chunking/chunk-matches.d.ts.map +1 -0
- package/dist/chunking/chunk-matches.js +65 -0
- package/dist/chunking/chunk-matches.js.map +1 -0
- package/dist/chunking/chunk-merge.d.ts +4 -0
- package/dist/chunking/chunk-merge.d.ts.map +1 -0
- package/dist/chunking/chunk-merge.js +144 -0
- package/dist/chunking/chunk-merge.js.map +1 -0
- package/dist/chunking/chunk-sfc.d.ts +18 -0
- package/dist/chunking/chunk-sfc.d.ts.map +1 -0
- package/dist/chunking/chunk-sfc.js +165 -0
- package/dist/chunking/chunk-sfc.js.map +1 -0
- package/dist/chunking/chunk-split.d.ts +6 -0
- package/dist/chunking/chunk-split.d.ts.map +1 -0
- package/dist/chunking/chunk-split.js +155 -0
- package/dist/chunking/chunk-split.js.map +1 -0
- package/dist/chunking/chunk-text-file.d.ts +28 -0
- package/dist/chunking/chunk-text-file.d.ts.map +1 -0
- package/dist/chunking/chunk-text-file.js +107 -0
- package/dist/chunking/chunk-text-file.js.map +1 -0
- package/dist/chunking/language-config.d.ts +35 -0
- package/dist/chunking/language-config.d.ts.map +1 -0
- package/dist/chunking/language-config.js +24 -0
- package/dist/chunking/language-config.js.map +1 -0
- package/dist/cli/affected.js +1 -1
- package/dist/cli/affected.js.map +1 -1
- package/dist/cli/call-hierarchy.d.ts +6 -0
- package/dist/cli/call-hierarchy.d.ts.map +1 -0
- package/dist/cli/call-hierarchy.js +72 -0
- package/dist/cli/call-hierarchy.js.map +1 -0
- package/dist/cli/chunk.js +5 -5
- package/dist/cli/chunk.js.map +1 -1
- package/dist/cli/command-catalog.d.ts +14 -0
- package/dist/cli/command-catalog.d.ts.map +1 -0
- package/dist/cli/command-catalog.js +118 -0
- package/dist/cli/command-catalog.js.map +1 -0
- package/dist/cli/command-table.d.ts +16 -0
- package/dist/cli/command-table.d.ts.map +1 -0
- package/dist/cli/command-table.js +758 -0
- package/dist/cli/command-table.js.map +1 -0
- package/dist/cli/compile-cache.d.ts +22 -0
- package/dist/cli/compile-cache.d.ts.map +1 -0
- package/dist/cli/compile-cache.js +81 -0
- package/dist/cli/compile-cache.js.map +1 -0
- package/dist/cli/discovery-globs.d.ts +11 -0
- package/dist/cli/discovery-globs.d.ts.map +1 -0
- package/dist/cli/discovery-globs.js +74 -0
- package/dist/cli/discovery-globs.js.map +1 -0
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -3
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/drift.d.ts +1 -1
- package/dist/cli/drift.d.ts.map +1 -1
- package/dist/cli/duplicate-similarity.d.ts +10 -0
- package/dist/cli/duplicate-similarity.d.ts.map +1 -0
- package/dist/cli/duplicate-similarity.js +20 -0
- package/dist/cli/duplicate-similarity.js.map +1 -0
- package/dist/cli/file.js +2 -2
- package/dist/cli/file.js.map +1 -1
- package/dist/cli/graph-delta.d.ts +25 -0
- package/dist/cli/graph-delta.d.ts.map +1 -0
- package/dist/cli/graph-delta.js +80 -0
- package/dist/cli/graph-delta.js.map +1 -0
- package/dist/cli/graph-queries.d.ts +23 -0
- package/dist/cli/graph-queries.d.ts.map +1 -0
- package/dist/cli/graph-queries.js +265 -0
- package/dist/cli/graph-queries.js.map +1 -0
- package/dist/cli/graph.d.ts +2 -2
- package/dist/cli/graph.d.ts.map +1 -1
- package/dist/cli/graph.js +2 -2
- package/dist/cli/graph.js.map +1 -1
- package/dist/cli/grep.d.ts +1 -1
- package/dist/cli/grep.d.ts.map +1 -1
- package/dist/cli/grep.js +1 -1
- package/dist/cli/grep.js.map +1 -1
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +2 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/impact.d.ts +2 -2
- package/dist/cli/impact.d.ts.map +1 -1
- package/dist/cli/impact.js +4 -4
- package/dist/cli/impact.js.map +1 -1
- package/dist/cli/index-policy.d.ts +36 -0
- package/dist/cli/index-policy.d.ts.map +1 -0
- package/dist/cli/index-policy.js +169 -0
- package/dist/cli/index-policy.js.map +1 -0
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/inspect.d.ts +2 -2
- package/dist/cli/inspect.d.ts.map +1 -1
- package/dist/cli/inspect.js +2 -2
- package/dist/cli/inspect.js.map +1 -1
- package/dist/cli/invocation-context.d.ts +77 -0
- package/dist/cli/invocation-context.d.ts.map +1 -0
- package/dist/cli/invocation-context.js +423 -0
- package/dist/cli/invocation-context.js.map +1 -0
- package/dist/cli/links.d.ts +2 -2
- package/dist/cli/links.d.ts.map +1 -1
- package/dist/cli/links.js +1 -1
- package/dist/cli/links.js.map +1 -1
- package/dist/cli/location.d.ts +1 -1
- package/dist/cli/location.d.ts.map +1 -1
- package/dist/cli/location.js +1 -1
- package/dist/cli/location.js.map +1 -1
- package/dist/cli/navigation.d.ts +2 -2
- package/dist/cli/navigation.d.ts.map +1 -1
- package/dist/cli/navigation.js +2 -2
- package/dist/cli/navigation.js.map +1 -1
- package/dist/cli/packet.js +1 -1
- package/dist/cli/packet.js.map +1 -1
- package/dist/cli/project-file.d.ts +13 -0
- package/dist/cli/project-file.d.ts.map +1 -0
- package/dist/cli/project-file.js +23 -0
- package/dist/cli/project-file.js.map +1 -0
- package/dist/cli/refactor-plan.d.ts +6 -0
- package/dist/cli/refactor-plan.d.ts.map +1 -0
- package/dist/cli/refactor-plan.js +84 -0
- package/dist/cli/refactor-plan.js.map +1 -0
- package/dist/cli/rename-preview.d.ts +4 -0
- package/dist/cli/rename-preview.d.ts.map +1 -0
- package/dist/cli/rename-preview.js +92 -0
- package/dist/cli/rename-preview.js.map +1 -0
- package/dist/cli/review.d.ts +2 -2
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +4 -4
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/root-policy.d.ts +53 -0
- package/dist/cli/root-policy.d.ts.map +1 -0
- package/dist/cli/root-policy.js +221 -0
- package/dist/cli/root-policy.js.map +1 -0
- package/dist/cli/server.js +5 -5
- package/dist/cli/server.js.map +1 -1
- package/dist/cli/skill.js +1 -1
- package/dist/cli/skill.js.map +1 -1
- package/dist/cli/symbols.js +1 -1
- package/dist/cli/symbols.js.map +1 -1
- package/dist/cli/type-hierarchy.d.ts +6 -0
- package/dist/cli/type-hierarchy.d.ts.map +1 -0
- package/dist/cli/type-hierarchy.js +90 -0
- package/dist/cli/type-hierarchy.js.map +1 -0
- package/dist/cli/viewer.js +2 -2
- package/dist/cli/viewer.js.map +1 -1
- package/dist/cli-bootstrap.d.ts +3 -0
- package/dist/cli-bootstrap.d.ts.map +1 -0
- package/dist/cli-bootstrap.js +10 -0
- package/dist/cli-bootstrap.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/document-links/asciidoc.d.ts.map +1 -0
- package/dist/document-links/asciidoc.js.map +1 -0
- package/dist/document-links/check.d.ts +32 -0
- package/dist/document-links/check.d.ts.map +1 -0
- package/dist/document-links/check.js +286 -0
- package/dist/document-links/check.js.map +1 -0
- package/dist/document-links/html.d.ts.map +1 -0
- package/dist/document-links/html.js.map +1 -0
- package/dist/document-links/markdown.d.ts.map +1 -0
- package/dist/document-links/markdown.js.map +1 -0
- package/dist/document-links/rst.d.ts.map +1 -0
- package/dist/document-links/rst.js.map +1 -0
- package/dist/document-links/sfc.d.ts.map +1 -0
- package/dist/document-links/sfc.js.map +1 -0
- package/dist/document-links/shared.d.ts.map +1 -0
- package/dist/document-links/shared.js.map +1 -0
- package/dist/document-links.d.ts +12 -0
- package/dist/document-links.d.ts.map +1 -0
- package/dist/document-links.js +49 -0
- package/dist/document-links.js.map +1 -0
- package/dist/drift/snapshot.js +2 -2
- package/dist/drift/snapshot.js.map +1 -1
- package/dist/drift/types.d.ts +2 -2
- package/dist/drift/types.d.ts.map +1 -1
- package/dist/duplicates/unit-cache.d.ts +46 -0
- package/dist/duplicates/unit-cache.d.ts.map +1 -0
- package/dist/duplicates/unit-cache.js +512 -0
- package/dist/duplicates/unit-cache.js.map +1 -0
- package/dist/duplicates/units.d.ts +1 -1
- package/dist/duplicates/units.d.ts.map +1 -1
- package/dist/duplicates/units.js +6 -6
- package/dist/duplicates/units.js.map +1 -1
- package/dist/duplicates-leads.d.ts +39 -0
- package/dist/duplicates-leads.d.ts.map +1 -0
- package/dist/duplicates-leads.js +112 -0
- package/dist/duplicates-leads.js.map +1 -0
- package/dist/duplicates.d.ts +1 -1
- package/dist/duplicates.d.ts.map +1 -1
- package/dist/duplicates.js +2 -2
- package/dist/duplicates.js.map +1 -1
- package/dist/graph-builder.d.ts +1 -1
- package/dist/graph-builder.d.ts.map +1 -1
- package/dist/graph-builder.js +4 -4
- package/dist/graph-builder.js.map +1 -1
- package/dist/graph-edge-collector.d.ts +3 -3
- package/dist/graph-edge-collector.d.ts.map +1 -1
- package/dist/graph-edge-collector.js +6 -6
- package/dist/graph-edge-collector.js.map +1 -1
- package/dist/graphs/cycles.js +1 -1
- package/dist/graphs/cycles.js.map +1 -1
- package/dist/graphs/edge-resolution.d.ts +25 -0
- package/dist/graphs/edge-resolution.d.ts.map +1 -0
- package/dist/graphs/edge-resolution.js +97 -0
- package/dist/graphs/edge-resolution.js.map +1 -0
- package/dist/graphs/grep.d.ts +1 -1
- package/dist/graphs/grep.d.ts.map +1 -1
- package/dist/graphs/grep.js +4 -4
- package/dist/graphs/grep.js.map +1 -1
- package/dist/graphs/specifiers.d.ts +1 -1
- package/dist/graphs/specifiers.d.ts.map +1 -1
- package/dist/graphs/specifiers.js +5 -5
- package/dist/graphs/specifiers.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.d.ts +0 -1
- package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.js +1 -8
- package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +35 -0
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/edge-passes.js +676 -0
- package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +10 -0
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/import-aliases.js +44 -0
- package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +17 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.js +30 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +69 -0
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js +408 -0
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed.js +22 -12
- package/dist/graphs/symbol-graph-detailed.js.map +1 -1
- package/dist/graphs/types.d.ts +1 -1
- package/dist/graphs/types.d.ts.map +1 -1
- package/dist/graphs/unresolved.js +1 -1
- package/dist/graphs/unresolved.js.map +1 -1
- package/dist/impact/analyzer.js +4 -4
- package/dist/impact/analyzer.js.map +1 -1
- package/dist/impact/call-compatibility/text-scanner.d.ts +23 -0
- package/dist/impact/call-compatibility/text-scanner.d.ts.map +1 -0
- package/dist/impact/call-compatibility/text-scanner.js +615 -0
- package/dist/impact/call-compatibility/text-scanner.js.map +1 -0
- package/dist/impact/call-compatibility.d.ts +24 -0
- package/dist/impact/call-compatibility.d.ts.map +1 -0
- package/dist/impact/call-compatibility.js +1023 -0
- package/dist/impact/call-compatibility.js.map +1 -0
- package/dist/impact/context.js +1 -1
- package/dist/impact/context.js.map +1 -1
- package/dist/impact/direct.d.ts +1 -1
- package/dist/impact/direct.d.ts.map +1 -1
- package/dist/impact/index.d.ts +1 -1
- package/dist/impact/index.d.ts.map +1 -1
- package/dist/impact/index.js +1 -1
- package/dist/impact/index.js.map +1 -1
- package/dist/impact/map.js +1 -1
- package/dist/impact/map.js.map +1 -1
- package/dist/impact/member-resolution-coverage.d.ts +14 -0
- package/dist/impact/member-resolution-coverage.d.ts.map +1 -0
- package/dist/impact/member-resolution-coverage.js +42 -0
- package/dist/impact/member-resolution-coverage.js.map +1 -0
- package/dist/impact/reference-cache.d.ts +12 -0
- package/dist/impact/reference-cache.d.ts.map +1 -0
- package/dist/impact/reference-cache.js +101 -0
- package/dist/impact/reference-cache.js.map +1 -0
- package/dist/impact/report-compact.d.ts +8 -0
- package/dist/impact/report-compact.d.ts.map +1 -0
- package/dist/impact/report-compact.js +153 -0
- package/dist/impact/report-compact.js.map +1 -0
- package/dist/impact/report-full.d.ts +10 -0
- package/dist/impact/report-full.d.ts.map +1 -0
- package/dist/impact/report-full.js +67 -0
- package/dist/impact/report-full.js.map +1 -0
- package/dist/impact/report-parts.d.ts +51 -0
- package/dist/impact/report-parts.d.ts.map +1 -0
- package/dist/impact/report-parts.js +2 -0
- package/dist/impact/report-parts.js.map +1 -0
- package/dist/impact/report-shared.d.ts +76 -0
- package/dist/impact/report-shared.d.ts.map +1 -0
- package/dist/impact/report-shared.js +130 -0
- package/dist/impact/report-shared.js.map +1 -0
- package/dist/impact/report-suggestions.js +2 -2
- package/dist/impact/report-suggestions.js.map +1 -1
- package/dist/impact/report.js +5 -5
- package/dist/impact/report.js.map +1 -1
- package/dist/impact/streaming.d.ts +1 -1
- package/dist/impact/streaming.d.ts.map +1 -1
- package/dist/impact/streaming.js +2 -2
- package/dist/impact/streaming.js.map +1 -1
- package/dist/impact/test-patterns.d.ts +6 -0
- package/dist/impact/test-patterns.d.ts.map +1 -0
- package/dist/impact/test-patterns.js +65 -0
- package/dist/impact/test-patterns.js.map +1 -0
- package/dist/impact/transitive.js +1 -1
- package/dist/impact/transitive.js.map +1 -1
- package/dist/impact/types.d.ts +3 -3
- package/dist/impact/types.d.ts.map +1 -1
- package/dist/impact/types.js +1 -1
- package/dist/impact/types.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/indexer/build-cache/manifest.d.ts +4 -4
- package/dist/indexer/build-cache/manifest.d.ts.map +1 -1
- package/dist/indexer/build-cache/manifest.js +4 -4
- package/dist/indexer/build-cache/manifest.js.map +1 -1
- package/dist/indexer/build-cache/module-cache.d.ts +1 -1
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache/module-cache.js +4 -4
- package/dist/indexer/build-cache/module-cache.js.map +1 -1
- package/dist/indexer/build-cache/options.d.ts +6 -4
- package/dist/indexer/build-cache/options.d.ts.map +1 -1
- package/dist/indexer/build-cache/options.js +9 -7
- package/dist/indexer/build-cache/options.js.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.js +16 -19
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
- package/dist/indexer/build-cache/reports.js +1 -1
- package/dist/indexer/build-cache/reports.js.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.d.ts +6 -2
- package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.js +41 -5
- package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
- package/dist/indexer/build-index.d.ts.map +1 -1
- package/dist/indexer/build-index.js +31 -20
- package/dist/indexer/build-index.js.map +1 -1
- package/dist/indexer/build-manifest.d.ts +1 -1
- package/dist/indexer/build-manifest.d.ts.map +1 -1
- package/dist/indexer/build-workers.d.ts +1 -1
- package/dist/indexer/build-workers.d.ts.map +1 -1
- package/dist/indexer/build-workers.js +6 -6
- package/dist/indexer/build-workers.js.map +1 -1
- package/dist/indexer/finalize.d.ts +2 -2
- package/dist/indexer/finalize.d.ts.map +1 -1
- package/dist/indexer/finalize.js +1 -1
- package/dist/indexer/finalize.js.map +1 -1
- package/dist/indexer/imports/graph-only.d.ts +13 -0
- package/dist/indexer/imports/graph-only.d.ts.map +1 -0
- package/dist/indexer/imports/graph-only.js +40 -0
- package/dist/indexer/imports/graph-only.js.map +1 -0
- package/dist/indexer/imports/js-text-imports.d.ts +9 -0
- package/dist/indexer/imports/js-text-imports.d.ts.map +1 -0
- package/dist/indexer/imports/js-text-imports.js +181 -0
- package/dist/indexer/imports/js-text-imports.js.map +1 -0
- package/dist/indexer/imports/language-specific.d.ts +26 -0
- package/dist/indexer/imports/language-specific.d.ts.map +1 -0
- package/dist/indexer/imports/language-specific.js +449 -0
- package/dist/indexer/imports/language-specific.js.map +1 -0
- package/dist/indexer/imports/native-captures.d.ts +16 -0
- package/dist/indexer/imports/native-captures.d.ts.map +1 -0
- package/dist/indexer/imports/native-captures.js +142 -0
- package/dist/indexer/imports/native-captures.js.map +1 -0
- package/dist/indexer/imports.d.ts +1 -1
- package/dist/indexer/imports.d.ts.map +1 -1
- package/dist/indexer/imports.js +7 -7
- package/dist/indexer/imports.js.map +1 -1
- package/dist/indexer/incremental-plan.d.ts +1 -1
- package/dist/indexer/incremental-plan.d.ts.map +1 -1
- package/dist/indexer/incremental-plan.js +1 -1
- package/dist/indexer/incremental-plan.js.map +1 -1
- package/dist/indexer/locals-and-exports.d.ts +1 -1
- package/dist/indexer/locals-and-exports.d.ts.map +1 -1
- package/dist/indexer/locals-and-exports.js +5 -5
- package/dist/indexer/locals-and-exports.js.map +1 -1
- package/dist/indexer/navigation-goto.js +1 -1
- package/dist/indexer/navigation-goto.js.map +1 -1
- package/dist/indexer/navigation-local.d.ts +2 -1
- package/dist/indexer/navigation-local.d.ts.map +1 -1
- package/dist/indexer/navigation-local.js +26 -21
- package/dist/indexer/navigation-local.js.map +1 -1
- package/dist/indexer/navigation.js +1 -1
- package/dist/indexer/navigation.js.map +1 -1
- package/dist/indexer/parse-context.d.ts +2 -2
- package/dist/indexer/parse-context.d.ts.map +1 -1
- package/dist/indexer/parse-context.js +5 -5
- package/dist/indexer/parse-context.js.map +1 -1
- package/dist/indexer/scope.d.ts +1 -1
- package/dist/indexer/scope.d.ts.map +1 -1
- package/dist/indexer/scope.js +2 -2
- package/dist/indexer/scope.js.map +1 -1
- package/dist/indexer/shared.d.ts +1 -1
- package/dist/indexer/shared.d.ts.map +1 -1
- package/dist/indexer/shared.js +1 -1
- package/dist/indexer/shared.js.map +1 -1
- package/dist/indexer/symbols.js +1 -1
- package/dist/indexer/symbols.js.map +1 -1
- package/dist/indexer/types.d.ts +2 -2
- package/dist/indexer/types.d.ts.map +1 -1
- package/dist/indexer.d.ts +2 -2
- package/dist/indexer.d.ts.map +1 -1
- package/dist/installer/locks.js +1 -1
- package/dist/installer/locks.js.map +1 -1
- package/dist/installer/registry.js +1 -1
- package/dist/installer/registry.js.map +1 -1
- package/dist/languages/definitions/adoc.js +1 -1
- package/dist/languages/definitions/adoc.js.map +1 -1
- package/dist/languages/definitions/astro.js +1 -1
- package/dist/languages/definitions/astro.js.map +1 -1
- package/dist/languages/definitions/c-family.d.ts +34 -0
- package/dist/languages/definitions/c-family.d.ts.map +1 -0
- package/dist/languages/definitions/c-family.js +177 -0
- package/dist/languages/definitions/c-family.js.map +1 -0
- package/dist/languages/definitions/c.js +1 -1
- package/dist/languages/definitions/c.js.map +1 -1
- package/dist/languages/definitions/cpp.js +1 -1
- package/dist/languages/definitions/cpp.js.map +1 -1
- package/dist/languages/definitions/css-like.d.ts +5 -0
- package/dist/languages/definitions/css-like.d.ts.map +1 -0
- package/dist/languages/definitions/css-like.js +32 -0
- package/dist/languages/definitions/css-like.js.map +1 -0
- package/dist/languages/definitions/css.js +1 -1
- package/dist/languages/definitions/css.js.map +1 -1
- package/dist/languages/definitions/hbs.js +1 -1
- package/dist/languages/definitions/hbs.js.map +1 -1
- package/dist/languages/definitions/html-stub.d.ts +18 -0
- package/dist/languages/definitions/html-stub.d.ts.map +1 -0
- package/dist/languages/definitions/html-stub.js +36 -0
- package/dist/languages/definitions/html-stub.js.map +1 -0
- package/dist/languages/definitions/javascript.js +1 -1
- package/dist/languages/definitions/javascript.js.map +1 -1
- package/dist/languages/definitions/js-family.d.ts +5 -0
- package/dist/languages/definitions/js-family.d.ts.map +1 -0
- package/dist/languages/definitions/js-family.js +75 -0
- package/dist/languages/definitions/js-family.js.map +1 -0
- package/dist/languages/definitions/less.js +1 -1
- package/dist/languages/definitions/less.js.map +1 -1
- package/dist/languages/definitions/markdown.js +1 -1
- package/dist/languages/definitions/markdown.js.map +1 -1
- package/dist/languages/definitions/mdx.js +1 -1
- package/dist/languages/definitions/mdx.js.map +1 -1
- package/dist/languages/definitions/rst.js +1 -1
- package/dist/languages/definitions/rst.js.map +1 -1
- package/dist/languages/definitions/typescript.js +1 -1
- package/dist/languages/definitions/typescript.js.map +1 -1
- package/dist/languages/file-prep.d.ts +36 -0
- package/dist/languages/file-prep.d.ts.map +1 -0
- package/dist/languages/file-prep.js +76 -0
- package/dist/languages/file-prep.js.map +1 -0
- package/dist/languages/import-statement-parsers.d.ts +57 -0
- package/dist/languages/import-statement-parsers.d.ts.map +1 -0
- package/dist/languages/import-statement-parsers.js +383 -0
- package/dist/languages/import-statement-parsers.js.map +1 -0
- package/dist/languages/query-generator.d.ts +6 -0
- package/dist/languages/query-generator.d.ts.map +1 -0
- package/dist/languages/query-generator.js +46 -0
- package/dist/languages/query-generator.js.map +1 -0
- package/dist/lifecycle/manifest.d.ts +1 -1
- package/dist/lifecycle/manifest.d.ts.map +1 -1
- package/dist/lifecycle/manifest.js +1 -1
- package/dist/lifecycle/manifest.js.map +1 -1
- package/dist/mcp/handlers.d.ts +7 -7
- package/dist/mcp/handlers.d.ts.map +1 -1
- package/dist/mcp/handlers.js +12 -15
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/http-transport.d.ts +14 -0
- package/dist/mcp/http-transport.d.ts.map +1 -0
- package/dist/mcp/http-transport.js +185 -0
- package/dist/mcp/http-transport.js.map +1 -0
- package/dist/mcp/legacy-sessions.d.ts +38 -0
- package/dist/mcp/legacy-sessions.d.ts.map +1 -0
- package/dist/mcp/legacy-sessions.js +264 -0
- package/dist/mcp/legacy-sessions.js.map +1 -0
- package/dist/mcp/lifecycle-health.d.ts +12 -0
- package/dist/mcp/lifecycle-health.d.ts.map +1 -0
- package/dist/mcp/lifecycle-health.js +37 -0
- package/dist/mcp/lifecycle-health.js.map +1 -0
- package/dist/mcp/protocol.d.ts +1 -1
- package/dist/mcp/protocol.d.ts.map +1 -1
- package/dist/mcp/protocol.js +3 -3
- package/dist/mcp/protocol.js.map +1 -1
- package/dist/mcp/security.js +1 -1
- package/dist/mcp/security.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +6 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/sqlite-guard.d.ts +3 -0
- package/dist/mcp/sqlite-guard.d.ts.map +1 -0
- package/dist/mcp/sqlite-guard.js +35 -0
- package/dist/mcp/sqlite-guard.js.map +1 -0
- package/dist/mcp/stdio-lifecycle.d.ts +23 -0
- package/dist/mcp/stdio-lifecycle.d.ts.map +1 -0
- package/dist/mcp/stdio-lifecycle.js +83 -0
- package/dist/mcp/stdio-lifecycle.js.map +1 -0
- package/dist/mcp/tools.js +2 -2
- package/dist/mcp/tools.js.map +1 -1
- package/dist/native/binding-loader.d.ts +51 -0
- package/dist/native/binding-loader.d.ts.map +1 -0
- package/dist/native/binding-loader.js +223 -0
- package/dist/native/binding-loader.js.map +1 -0
- package/dist/native/byte-index.d.ts +26 -0
- package/dist/native/byte-index.d.ts.map +1 -0
- package/dist/native/byte-index.js +70 -0
- package/dist/native/byte-index.js.map +1 -0
- package/dist/native/execution.js +1 -1
- package/dist/native/execution.js.map +1 -1
- package/dist/native/js-bridge.d.ts +7 -0
- package/dist/native/js-bridge.d.ts.map +1 -0
- package/dist/native/js-bridge.js +20 -0
- package/dist/native/js-bridge.js.map +1 -0
- package/dist/native/native-backend-report.d.ts +22 -0
- package/dist/native/native-backend-report.d.ts.map +1 -0
- package/dist/native/native-backend-report.js +102 -0
- package/dist/native/native-backend-report.js.map +1 -0
- package/dist/native/projected-tree.d.ts +53 -0
- package/dist/native/projected-tree.d.ts.map +1 -0
- package/dist/native/projected-tree.js +180 -0
- package/dist/native/projected-tree.js.map +1 -0
- package/dist/native/query-results.d.ts +12 -0
- package/dist/native/query-results.d.ts.map +1 -0
- package/dist/native/query-results.js +34 -0
- package/dist/native/query-results.js.map +1 -0
- package/dist/native/runtime-cache.d.ts +128 -0
- package/dist/native/runtime-cache.d.ts.map +1 -0
- package/dist/native/runtime-cache.js +667 -0
- package/dist/native/runtime-cache.js.map +1 -0
- package/dist/native/runtime.js +3 -3
- package/dist/native/runtime.js.map +1 -1
- package/dist/native/tree-shape.d.ts +21 -0
- package/dist/native/tree-shape.d.ts.map +1 -0
- package/dist/native/tree-shape.js +28 -0
- package/dist/native/tree-shape.js.map +1 -0
- package/dist/native/tree-sitter-native.d.ts +6 -0
- package/dist/native/tree-sitter-native.d.ts.map +1 -0
- package/dist/native/tree-sitter-native.js +5 -0
- package/dist/native/tree-sitter-native.js.map +1 -0
- package/dist/review/deleted.js +2 -2
- package/dist/review/deleted.js.map +1 -1
- package/dist/review/report.d.ts +3 -3
- package/dist/review/report.d.ts.map +1 -1
- package/dist/review/report.js +2 -2
- package/dist/review/report.js.map +1 -1
- package/dist/review/summaries.js +3 -3
- package/dist/review/summaries.js.map +1 -1
- package/dist/review/types.d.ts +3 -3
- package/dist/review/types.d.ts.map +1 -1
- package/dist/review.js +3 -3
- package/dist/review.js.map +1 -1
- package/dist/runtime-identity.d.ts +27 -0
- package/dist/runtime-identity.d.ts.map +1 -0
- package/dist/runtime-identity.js +75 -0
- package/dist/runtime-identity.js.map +1 -0
- package/dist/session.js +1 -1
- package/dist/session.js.map +1 -1
- package/dist/sql/classify-sql-file.d.ts +3 -0
- package/dist/sql/classify-sql-file.d.ts.map +1 -0
- package/dist/sql/classify-sql-file.js +42 -0
- package/dist/sql/classify-sql-file.js.map +1 -0
- package/dist/sql/extract-facts.d.ts +4 -0
- package/dist/sql/extract-facts.d.ts.map +1 -0
- package/dist/sql/extract-facts.js +511 -0
- package/dist/sql/extract-facts.js.map +1 -0
- package/dist/sql/graph.js +1 -1
- package/dist/sql/graph.js.map +1 -1
- package/dist/sql/index.d.ts +2 -2
- package/dist/sql/index.d.ts.map +1 -1
- package/dist/sql/index.js +2 -2
- package/dist/sql/index.js.map +1 -1
- package/dist/sql/navigation.js +1 -1
- package/dist/sql/navigation.js.map +1 -1
- package/dist/sql/review.js +2 -2
- package/dist/sql/review.js.map +1 -1
- package/dist/sql/source-graph.d.ts +19 -0
- package/dist/sql/source-graph.d.ts.map +1 -0
- package/dist/sql/source-graph.js +195 -0
- package/dist/sql/source-graph.js.map +1 -0
- package/dist/sqlite/query.d.ts +2 -2
- package/dist/sqlite/query.d.ts.map +1 -1
- package/dist/sqlite/query.js +3 -3
- package/dist/sqlite/query.js.map +1 -1
- package/dist/sqlite/raw-query-worker-pool.d.ts +66 -0
- package/dist/sqlite/raw-query-worker-pool.d.ts.map +1 -0
- package/dist/sqlite/raw-query-worker-pool.js +146 -0
- package/dist/sqlite/raw-query-worker-pool.js.map +1 -0
- package/dist/sqlite/raw-query-worker.d.ts +22 -0
- package/dist/sqlite/raw-query-worker.d.ts.map +1 -0
- package/dist/sqlite/raw-query-worker.js +31 -0
- package/dist/sqlite/raw-query-worker.js.map +1 -0
- package/dist/sqlite/row-bounds.d.ts +24 -0
- package/dist/sqlite/row-bounds.d.ts.map +1 -0
- package/dist/sqlite/row-bounds.js +95 -0
- package/dist/sqlite/row-bounds.js.map +1 -0
- package/dist/sqlite-driver.js +1 -1
- package/dist/sqlite-driver.js.map +1 -1
- package/dist/util/bloom-filter.d.ts +100 -0
- package/dist/util/bloom-filter.d.ts.map +1 -0
- package/dist/util/bloom-filter.js +206 -0
- package/dist/util/bloom-filter.js.map +1 -0
- package/dist/util/confined-file.d.ts +48 -0
- package/dist/util/confined-file.d.ts.map +1 -0
- package/dist/util/confined-file.js +164 -0
- package/dist/util/confined-file.js.map +1 -0
- package/dist/util/discovery-path.d.ts +3 -0
- package/dist/util/discovery-path.d.ts.map +1 -0
- package/dist/util/discovery-path.js +19 -0
- package/dist/util/discovery-path.js.map +1 -0
- package/dist/util/graph-edges.d.ts +5 -0
- package/dist/util/graph-edges.d.ts.map +1 -0
- package/dist/util/graph-edges.js +42 -0
- package/dist/util/graph-edges.js.map +1 -0
- package/dist/util/graph-only-extensions.d.ts +5 -0
- package/dist/util/graph-only-extensions.d.ts.map +1 -0
- package/dist/util/graph-only-extensions.js +12 -0
- package/dist/util/graph-only-extensions.js.map +1 -0
- package/dist/util/include-roots.d.ts +6 -0
- package/dist/util/include-roots.d.ts.map +1 -0
- package/dist/util/include-roots.js +53 -0
- package/dist/util/include-roots.js.map +1 -0
- package/dist/util/lazy-symbols.d.ts +166 -0
- package/dist/util/lazy-symbols.d.ts.map +1 -0
- package/dist/util/lazy-symbols.js +365 -0
- package/dist/util/lazy-symbols.js.map +1 -0
- package/dist/util/lru-map.d.ts +3 -0
- package/dist/util/lru-map.d.ts.map +1 -0
- package/dist/util/lru-map.js +22 -0
- package/dist/util/lru-map.js.map +1 -0
- package/dist/util/member-access.d.ts +26 -0
- package/dist/util/member-access.d.ts.map +1 -0
- package/dist/util/member-access.js +185 -0
- package/dist/util/member-access.js.map +1 -0
- package/dist/util/package-exports.d.ts +25 -0
- package/dist/util/package-exports.d.ts.map +1 -0
- package/dist/util/package-exports.js +79 -0
- package/dist/util/package-exports.js.map +1 -0
- package/dist/util/package-info.d.ts +12 -0
- package/dist/util/package-info.d.ts.map +1 -0
- package/dist/util/package-info.js +57 -0
- package/dist/util/package-info.js.map +1 -0
- package/dist/util/partial-results.d.ts +81 -0
- package/dist/util/partial-results.d.ts.map +1 -0
- package/dist/util/partial-results.js +290 -0
- package/dist/util/partial-results.js.map +1 -0
- package/dist/util/project-files/definitions.d.ts.map +1 -0
- package/dist/util/project-files/definitions.js.map +1 -0
- package/dist/util/project-files/parsers.d.ts.map +1 -0
- package/dist/util/project-files/parsers.js.map +1 -0
- package/dist/util/project-files.d.ts +153 -0
- package/dist/util/project-files.d.ts.map +1 -0
- package/dist/util/project-files.js +1460 -0
- package/dist/util/project-files.js.map +1 -0
- package/dist/util/resolution/find-first-existing.d.ts +2 -0
- package/dist/util/resolution/find-first-existing.d.ts.map +1 -0
- package/dist/util/resolution/find-first-existing.js +13 -0
- package/dist/util/resolution/find-first-existing.js.map +1 -0
- package/dist/util/resolution/jvm.js +1 -1
- package/dist/util/resolution/jvm.js.map +1 -1
- package/dist/util/resolution/node.d.ts +1 -1
- package/dist/util/resolution/node.d.ts.map +1 -1
- package/dist/util/resolution/node.js +2 -2
- package/dist/util/resolution/node.js.map +1 -1
- package/dist/util/resolution/php-composer.d.ts +17 -0
- package/dist/util/resolution/php-composer.d.ts.map +1 -0
- package/dist/util/resolution/php-composer.js +269 -0
- package/dist/util/resolution/php-composer.js.map +1 -0
- package/dist/util/resolution/php.d.ts +1 -1
- package/dist/util/resolution/php.d.ts.map +1 -1
- package/dist/util/resolution/php.js +4 -4
- package/dist/util/resolution/php.js.map +1 -1
- package/dist/util/resolution/project-symbols.d.ts +14 -0
- package/dist/util/resolution/project-symbols.d.ts.map +1 -0
- package/dist/util/resolution/project-symbols.js +70 -0
- package/dist/util/resolution/project-symbols.js.map +1 -0
- package/dist/util/resolution/tsconfig.d.ts +7 -0
- package/dist/util/resolution/tsconfig.d.ts.map +1 -1
- package/dist/util/resolution/tsconfig.js +23 -8
- package/dist/util/resolution/tsconfig.js.map +1 -1
- package/dist/util/resolution-candidates.d.ts +5 -0
- package/dist/util/resolution-candidates.d.ts.map +1 -0
- package/dist/util/resolution-candidates.js +70 -0
- package/dist/util/resolution-candidates.js.map +1 -0
- package/dist/util/resolution.d.ts +2 -2
- package/dist/util/resolution.d.ts.map +1 -1
- package/dist/util/resolution.js +6 -6
- package/dist/util/resolution.js.map +1 -1
- package/dist/util/rust-test-modules.d.ts +3 -0
- package/dist/util/rust-test-modules.d.ts.map +1 -0
- package/dist/util/rust-test-modules.js +71 -0
- package/dist/util/rust-test-modules.js.map +1 -0
- package/dist/util/source-location.d.ts +8 -0
- package/dist/util/source-location.d.ts.map +1 -0
- package/dist/util/source-location.js +19 -0
- package/dist/util/source-location.js.map +1 -0
- package/dist/util/sqlite-schema.d.ts +28 -0
- package/dist/util/sqlite-schema.d.ts.map +1 -0
- package/dist/util/sqlite-schema.js +75 -0
- package/dist/util/sqlite-schema.js.map +1 -0
- package/dist/util/symbol-hash.d.ts +59 -0
- package/dist/util/symbol-hash.d.ts.map +1 -0
- package/dist/util/symbol-hash.js +84 -0
- package/dist/util/symbol-hash.js.map +1 -0
- package/dist/util/windows-process-drain.d.ts +23 -0
- package/dist/util/windows-process-drain.d.ts.map +1 -0
- package/dist/util/windows-process-drain.js +51 -0
- package/dist/util/windows-process-drain.js.map +1 -0
- package/dist/util/worker-threads.d.ts +12 -0
- package/dist/util/worker-threads.d.ts.map +1 -0
- package/dist/util/worker-threads.js +19 -0
- package/dist/util/worker-threads.js.map +1 -0
- package/dist/util/workspace.d.ts +1 -1
- package/dist/util/workspace.d.ts.map +1 -1
- package/dist/util/workspace.js +2 -2
- package/dist/util/workspace.js.map +1 -1
- package/dist/util.d.ts +2 -2
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/dist/worker/native-extract-worker.d.ts +77 -0
- package/dist/worker/native-extract-worker.d.ts.map +1 -0
- package/dist/worker/native-extract-worker.js +272 -0
- package/dist/worker/native-extract-worker.js.map +1 -0
- package/dist/worker/native-worker-pool.d.ts +16 -0
- package/dist/worker/native-worker-pool.d.ts.map +1 -0
- package/dist/worker/native-worker-pool.js +54 -0
- package/dist/worker/native-worker-pool.js.map +1 -0
- package/docs/mcp.md +2 -2
- package/package.json +4 -4
- package/dist/agent/callHierarchy.d.ts +0 -28
- package/dist/agent/callHierarchy.d.ts.map +0 -1
- package/dist/agent/callHierarchy.js +0 -82
- package/dist/agent/callHierarchy.js.map +0 -1
- package/dist/agent/candidateTests.d.ts +0 -12
- package/dist/agent/candidateTests.d.ts.map +0 -1
- package/dist/agent/candidateTests.js +0 -17
- package/dist/agent/candidateTests.js.map +0 -1
- package/dist/agent/fileView.d.ts +0 -55
- package/dist/agent/fileView.d.ts.map +0 -1
- package/dist/agent/fileView.js +0 -521
- package/dist/agent/fileView.js.map +0 -1
- package/dist/agent/followUps.d.ts +0 -10
- package/dist/agent/followUps.d.ts.map +0 -1
- package/dist/agent/followUps.js +0 -175
- package/dist/agent/followUps.js.map +0 -1
- package/dist/agent/query-index/queryIndexWorker.d.ts +0 -8
- package/dist/agent/query-index/queryIndexWorker.d.ts.map +0 -1
- package/dist/agent/query-index/queryIndexWorker.js +0 -11
- package/dist/agent/query-index/queryIndexWorker.js.map +0 -1
- package/dist/agent/query-index/sessionStore.d.ts +0 -5
- package/dist/agent/query-index/sessionStore.d.ts.map +0 -1
- package/dist/agent/query-index/sessionStore.js +0 -69
- package/dist/agent/query-index/sessionStore.js.map +0 -1
- package/dist/agent/query-index/sourceIdentity.d.ts +0 -3
- package/dist/agent/query-index/sourceIdentity.d.ts.map +0 -1
- package/dist/agent/query-index/sourceIdentity.js +0 -12
- package/dist/agent/query-index/sourceIdentity.js.map +0 -1
- package/dist/agent/query-index/workerPool.d.ts +0 -27
- package/dist/agent/query-index/workerPool.d.ts.map +0 -1
- package/dist/agent/query-index/workerPool.js +0 -114
- package/dist/agent/query-index/workerPool.js.map +0 -1
- package/dist/agent/refactorPlan.d.ts +0 -40
- package/dist/agent/refactorPlan.d.ts.map +0 -1
- package/dist/agent/refactorPlan.js +0 -226
- package/dist/agent/refactorPlan.js.map +0 -1
- package/dist/agent/renamePreview.d.ts +0 -57
- package/dist/agent/renamePreview.d.ts.map +0 -1
- package/dist/agent/renamePreview.js +0 -1062
- package/dist/agent/renamePreview.js.map +0 -1
- package/dist/agent/semanticSymbols.d.ts +0 -16
- package/dist/agent/semanticSymbols.d.ts.map +0 -1
- package/dist/agent/semanticSymbols.js +0 -97
- package/dist/agent/semanticSymbols.js.map +0 -1
- package/dist/agent/sessionLifecycle.d.ts +0 -5
- package/dist/agent/sessionLifecycle.d.ts.map +0 -1
- package/dist/agent/sessionLifecycle.js +0 -18
- package/dist/agent/sessionLifecycle.js.map +0 -1
- package/dist/agent/symbolLookup.d.ts +0 -12
- package/dist/agent/symbolLookup.d.ts.map +0 -1
- package/dist/agent/symbolLookup.js +0 -26
- package/dist/agent/symbolLookup.js.map +0 -1
- package/dist/agent/typeHierarchy.d.ts +0 -39
- package/dist/agent/typeHierarchy.d.ts.map +0 -1
- package/dist/agent/typeHierarchy.js +0 -125
- package/dist/agent/typeHierarchy.js.map +0 -1
- package/dist/agent/workspaceSymbols.d.ts +0 -18
- package/dist/agent/workspaceSymbols.d.ts.map +0 -1
- package/dist/agent/workspaceSymbols.js +0 -75
- package/dist/agent/workspaceSymbols.js.map +0 -1
- package/dist/analysisSummary.d.ts +0 -19
- package/dist/analysisSummary.d.ts.map +0 -1
- package/dist/analysisSummary.js +0 -80
- package/dist/analysisSummary.js.map +0 -1
- package/dist/bin/queryIndexWorker.js +0 -4382
- package/dist/bin/rawQueryWorker.js +0 -383
- package/dist/bootstrap/treeSitterLanguages.d.ts +0 -5
- package/dist/bootstrap/treeSitterLanguages.d.ts.map +0 -1
- package/dist/bootstrap/treeSitterLanguages.js +0 -41
- package/dist/bootstrap/treeSitterLanguages.js.map +0 -1
- package/dist/chunking/chunkBlocks.d.ts +0 -9
- package/dist/chunking/chunkBlocks.d.ts.map +0 -1
- package/dist/chunking/chunkBlocks.js +0 -60
- package/dist/chunking/chunkBlocks.js.map +0 -1
- package/dist/chunking/chunkFile.d.ts +0 -39
- package/dist/chunking/chunkFile.d.ts.map +0 -1
- package/dist/chunking/chunkFile.js +0 -152
- package/dist/chunking/chunkFile.js.map +0 -1
- package/dist/chunking/chunkId.d.ts +0 -7
- package/dist/chunking/chunkId.d.ts.map +0 -1
- package/dist/chunking/chunkId.js +0 -30
- package/dist/chunking/chunkId.js.map +0 -1
- package/dist/chunking/chunkMatches.d.ts +0 -4
- package/dist/chunking/chunkMatches.d.ts.map +0 -1
- package/dist/chunking/chunkMatches.js +0 -65
- package/dist/chunking/chunkMatches.js.map +0 -1
- package/dist/chunking/chunkMerge.d.ts +0 -4
- package/dist/chunking/chunkMerge.d.ts.map +0 -1
- package/dist/chunking/chunkMerge.js +0 -144
- package/dist/chunking/chunkMerge.js.map +0 -1
- package/dist/chunking/chunkSFC.d.ts +0 -18
- package/dist/chunking/chunkSFC.d.ts.map +0 -1
- package/dist/chunking/chunkSFC.js +0 -165
- package/dist/chunking/chunkSFC.js.map +0 -1
- package/dist/chunking/chunkSplit.d.ts +0 -6
- package/dist/chunking/chunkSplit.d.ts.map +0 -1
- package/dist/chunking/chunkSplit.js +0 -155
- package/dist/chunking/chunkSplit.js.map +0 -1
- package/dist/chunking/chunkTextFile.d.ts +0 -28
- package/dist/chunking/chunkTextFile.d.ts.map +0 -1
- package/dist/chunking/chunkTextFile.js +0 -107
- package/dist/chunking/chunkTextFile.js.map +0 -1
- package/dist/chunking/languageConfig.d.ts +0 -35
- package/dist/chunking/languageConfig.d.ts.map +0 -1
- package/dist/chunking/languageConfig.js +0 -24
- package/dist/chunking/languageConfig.js.map +0 -1
- package/dist/cli/callHierarchy.d.ts +0 -6
- package/dist/cli/callHierarchy.d.ts.map +0 -1
- package/dist/cli/callHierarchy.js +0 -72
- package/dist/cli/callHierarchy.js.map +0 -1
- package/dist/cli/commandCatalog.d.ts +0 -14
- package/dist/cli/commandCatalog.d.ts.map +0 -1
- package/dist/cli/commandCatalog.js +0 -118
- package/dist/cli/commandCatalog.js.map +0 -1
- package/dist/cli/commandTable.d.ts +0 -16
- package/dist/cli/commandTable.d.ts.map +0 -1
- package/dist/cli/commandTable.js +0 -758
- package/dist/cli/commandTable.js.map +0 -1
- package/dist/cli/compileCache.d.ts +0 -22
- package/dist/cli/compileCache.d.ts.map +0 -1
- package/dist/cli/compileCache.js +0 -81
- package/dist/cli/compileCache.js.map +0 -1
- package/dist/cli/discoveryGlobs.d.ts +0 -11
- package/dist/cli/discoveryGlobs.d.ts.map +0 -1
- package/dist/cli/discoveryGlobs.js +0 -74
- package/dist/cli/discoveryGlobs.js.map +0 -1
- package/dist/cli/duplicateSimilarity.d.ts +0 -10
- package/dist/cli/duplicateSimilarity.d.ts.map +0 -1
- package/dist/cli/duplicateSimilarity.js +0 -20
- package/dist/cli/duplicateSimilarity.js.map +0 -1
- package/dist/cli/graphDelta.d.ts +0 -25
- package/dist/cli/graphDelta.d.ts.map +0 -1
- package/dist/cli/graphDelta.js +0 -80
- package/dist/cli/graphDelta.js.map +0 -1
- package/dist/cli/graphQueries.d.ts +0 -23
- package/dist/cli/graphQueries.d.ts.map +0 -1
- package/dist/cli/graphQueries.js +0 -265
- package/dist/cli/graphQueries.js.map +0 -1
- package/dist/cli/indexPolicy.d.ts +0 -36
- package/dist/cli/indexPolicy.d.ts.map +0 -1
- package/dist/cli/indexPolicy.js +0 -169
- package/dist/cli/indexPolicy.js.map +0 -1
- package/dist/cli/invocationContext.d.ts +0 -77
- package/dist/cli/invocationContext.d.ts.map +0 -1
- package/dist/cli/invocationContext.js +0 -423
- package/dist/cli/invocationContext.js.map +0 -1
- package/dist/cli/projectFile.d.ts +0 -13
- package/dist/cli/projectFile.d.ts.map +0 -1
- package/dist/cli/projectFile.js +0 -23
- package/dist/cli/projectFile.js.map +0 -1
- package/dist/cli/refactorPlan.d.ts +0 -6
- package/dist/cli/refactorPlan.d.ts.map +0 -1
- package/dist/cli/refactorPlan.js +0 -84
- package/dist/cli/refactorPlan.js.map +0 -1
- package/dist/cli/renamePreview.d.ts +0 -4
- package/dist/cli/renamePreview.d.ts.map +0 -1
- package/dist/cli/renamePreview.js +0 -92
- package/dist/cli/renamePreview.js.map +0 -1
- package/dist/cli/rootPolicy.d.ts +0 -53
- package/dist/cli/rootPolicy.d.ts.map +0 -1
- package/dist/cli/rootPolicy.js +0 -221
- package/dist/cli/rootPolicy.js.map +0 -1
- package/dist/cli/typeHierarchy.d.ts +0 -6
- package/dist/cli/typeHierarchy.d.ts.map +0 -1
- package/dist/cli/typeHierarchy.js +0 -90
- package/dist/cli/typeHierarchy.js.map +0 -1
- package/dist/cliBootstrap.d.ts +0 -3
- package/dist/cliBootstrap.d.ts.map +0 -1
- package/dist/cliBootstrap.js +0 -10
- package/dist/cliBootstrap.js.map +0 -1
- package/dist/documentLinks/asciidoc.d.ts.map +0 -1
- package/dist/documentLinks/asciidoc.js.map +0 -1
- package/dist/documentLinks/check.d.ts +0 -32
- package/dist/documentLinks/check.d.ts.map +0 -1
- package/dist/documentLinks/check.js +0 -286
- package/dist/documentLinks/check.js.map +0 -1
- package/dist/documentLinks/html.d.ts.map +0 -1
- package/dist/documentLinks/html.js.map +0 -1
- package/dist/documentLinks/markdown.d.ts.map +0 -1
- package/dist/documentLinks/markdown.js.map +0 -1
- package/dist/documentLinks/rst.d.ts.map +0 -1
- package/dist/documentLinks/rst.js.map +0 -1
- package/dist/documentLinks/sfc.d.ts.map +0 -1
- package/dist/documentLinks/sfc.js.map +0 -1
- package/dist/documentLinks/shared.d.ts.map +0 -1
- package/dist/documentLinks/shared.js.map +0 -1
- package/dist/documentLinks.d.ts +0 -12
- package/dist/documentLinks.d.ts.map +0 -1
- package/dist/documentLinks.js +0 -49
- package/dist/documentLinks.js.map +0 -1
- package/dist/duplicates/unitCache.d.ts +0 -46
- package/dist/duplicates/unitCache.d.ts.map +0 -1
- package/dist/duplicates/unitCache.js +0 -512
- package/dist/duplicates/unitCache.js.map +0 -1
- package/dist/duplicatesLeads.d.ts +0 -39
- package/dist/duplicatesLeads.d.ts.map +0 -1
- package/dist/duplicatesLeads.js +0 -112
- package/dist/duplicatesLeads.js.map +0 -1
- package/dist/graphs/edgeResolution.d.ts +0 -25
- package/dist/graphs/edgeResolution.d.ts.map +0 -1
- package/dist/graphs/edgeResolution.js +0 -97
- package/dist/graphs/edgeResolution.js.map +0 -1
- package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts +0 -35
- package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts.map +0 -1
- package/dist/graphs/symbol-graph-detailed/edgePasses.js +0 -586
- package/dist/graphs/symbol-graph-detailed/edgePasses.js.map +0 -1
- package/dist/graphs/symbol-graph-detailed/importAliases.d.ts +0 -10
- package/dist/graphs/symbol-graph-detailed/importAliases.d.ts.map +0 -1
- package/dist/graphs/symbol-graph-detailed/importAliases.js +0 -44
- package/dist/graphs/symbol-graph-detailed/importAliases.js.map +0 -1
- package/dist/graphs/symbol-graph-detailed/memberChains.d.ts +0 -17
- package/dist/graphs/symbol-graph-detailed/memberChains.d.ts.map +0 -1
- package/dist/graphs/symbol-graph-detailed/memberChains.js +0 -30
- package/dist/graphs/symbol-graph-detailed/memberChains.js.map +0 -1
- package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts +0 -69
- package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts.map +0 -1
- package/dist/graphs/symbol-graph-detailed/receiverCalls.js +0 -408
- package/dist/graphs/symbol-graph-detailed/receiverCalls.js.map +0 -1
- package/dist/impact/call-compatibility/textScanner.d.ts +0 -23
- package/dist/impact/call-compatibility/textScanner.d.ts.map +0 -1
- package/dist/impact/call-compatibility/textScanner.js +0 -615
- package/dist/impact/call-compatibility/textScanner.js.map +0 -1
- package/dist/impact/callCompatibility.d.ts +0 -24
- package/dist/impact/callCompatibility.d.ts.map +0 -1
- package/dist/impact/callCompatibility.js +0 -1023
- package/dist/impact/callCompatibility.js.map +0 -1
- package/dist/impact/memberResolutionCoverage.d.ts +0 -14
- package/dist/impact/memberResolutionCoverage.d.ts.map +0 -1
- package/dist/impact/memberResolutionCoverage.js +0 -42
- package/dist/impact/memberResolutionCoverage.js.map +0 -1
- package/dist/impact/referenceCache.d.ts +0 -12
- package/dist/impact/referenceCache.d.ts.map +0 -1
- package/dist/impact/referenceCache.js +0 -101
- package/dist/impact/referenceCache.js.map +0 -1
- package/dist/impact/reportCompact.d.ts +0 -8
- package/dist/impact/reportCompact.d.ts.map +0 -1
- package/dist/impact/reportCompact.js +0 -153
- package/dist/impact/reportCompact.js.map +0 -1
- package/dist/impact/reportFull.d.ts +0 -10
- package/dist/impact/reportFull.d.ts.map +0 -1
- package/dist/impact/reportFull.js +0 -67
- package/dist/impact/reportFull.js.map +0 -1
- package/dist/impact/reportParts.d.ts +0 -51
- package/dist/impact/reportParts.d.ts.map +0 -1
- package/dist/impact/reportParts.js +0 -2
- package/dist/impact/reportParts.js.map +0 -1
- package/dist/impact/reportShared.d.ts +0 -76
- package/dist/impact/reportShared.d.ts.map +0 -1
- package/dist/impact/reportShared.js +0 -130
- package/dist/impact/reportShared.js.map +0 -1
- package/dist/impact/testPatterns.d.ts +0 -6
- package/dist/impact/testPatterns.d.ts.map +0 -1
- package/dist/impact/testPatterns.js +0 -65
- package/dist/impact/testPatterns.js.map +0 -1
- package/dist/indexer/imports/graphOnly.d.ts +0 -13
- package/dist/indexer/imports/graphOnly.d.ts.map +0 -1
- package/dist/indexer/imports/graphOnly.js +0 -40
- package/dist/indexer/imports/graphOnly.js.map +0 -1
- package/dist/indexer/imports/jsTextImports.d.ts +0 -9
- package/dist/indexer/imports/jsTextImports.d.ts.map +0 -1
- package/dist/indexer/imports/jsTextImports.js +0 -181
- package/dist/indexer/imports/jsTextImports.js.map +0 -1
- package/dist/indexer/imports/languageSpecific.d.ts +0 -26
- package/dist/indexer/imports/languageSpecific.d.ts.map +0 -1
- package/dist/indexer/imports/languageSpecific.js +0 -449
- package/dist/indexer/imports/languageSpecific.js.map +0 -1
- package/dist/indexer/imports/nativeCaptures.d.ts +0 -16
- package/dist/indexer/imports/nativeCaptures.d.ts.map +0 -1
- package/dist/indexer/imports/nativeCaptures.js +0 -142
- package/dist/indexer/imports/nativeCaptures.js.map +0 -1
- package/dist/languages/definitions/cFamily.d.ts +0 -34
- package/dist/languages/definitions/cFamily.d.ts.map +0 -1
- package/dist/languages/definitions/cFamily.js +0 -177
- package/dist/languages/definitions/cFamily.js.map +0 -1
- package/dist/languages/definitions/cssLike.d.ts +0 -5
- package/dist/languages/definitions/cssLike.d.ts.map +0 -1
- package/dist/languages/definitions/cssLike.js +0 -32
- package/dist/languages/definitions/cssLike.js.map +0 -1
- package/dist/languages/definitions/htmlStub.d.ts +0 -18
- package/dist/languages/definitions/htmlStub.d.ts.map +0 -1
- package/dist/languages/definitions/htmlStub.js +0 -36
- package/dist/languages/definitions/htmlStub.js.map +0 -1
- package/dist/languages/definitions/jsFamily.d.ts +0 -5
- package/dist/languages/definitions/jsFamily.d.ts.map +0 -1
- package/dist/languages/definitions/jsFamily.js +0 -75
- package/dist/languages/definitions/jsFamily.js.map +0 -1
- package/dist/languages/filePrep.d.ts +0 -36
- package/dist/languages/filePrep.d.ts.map +0 -1
- package/dist/languages/filePrep.js +0 -76
- package/dist/languages/filePrep.js.map +0 -1
- package/dist/languages/importStatementParsers.d.ts +0 -57
- package/dist/languages/importStatementParsers.d.ts.map +0 -1
- package/dist/languages/importStatementParsers.js +0 -383
- package/dist/languages/importStatementParsers.js.map +0 -1
- package/dist/languages/queryGenerator.d.ts +0 -6
- package/dist/languages/queryGenerator.d.ts.map +0 -1
- package/dist/languages/queryGenerator.js +0 -46
- package/dist/languages/queryGenerator.js.map +0 -1
- package/dist/mcp/httpTransport.d.ts +0 -14
- package/dist/mcp/httpTransport.d.ts.map +0 -1
- package/dist/mcp/httpTransport.js +0 -185
- package/dist/mcp/httpTransport.js.map +0 -1
- package/dist/mcp/legacySessions.d.ts +0 -38
- package/dist/mcp/legacySessions.d.ts.map +0 -1
- package/dist/mcp/legacySessions.js +0 -264
- package/dist/mcp/legacySessions.js.map +0 -1
- package/dist/mcp/lifecycleHealth.d.ts +0 -12
- package/dist/mcp/lifecycleHealth.d.ts.map +0 -1
- package/dist/mcp/lifecycleHealth.js +0 -37
- package/dist/mcp/lifecycleHealth.js.map +0 -1
- package/dist/mcp/sqliteGuard.d.ts +0 -3
- package/dist/mcp/sqliteGuard.d.ts.map +0 -1
- package/dist/mcp/sqliteGuard.js +0 -35
- package/dist/mcp/sqliteGuard.js.map +0 -1
- package/dist/mcp/stdioLifecycle.d.ts +0 -23
- package/dist/mcp/stdioLifecycle.d.ts.map +0 -1
- package/dist/mcp/stdioLifecycle.js +0 -83
- package/dist/mcp/stdioLifecycle.js.map +0 -1
- package/dist/native/bindingLoader.d.ts +0 -51
- package/dist/native/bindingLoader.d.ts.map +0 -1
- package/dist/native/bindingLoader.js +0 -223
- package/dist/native/bindingLoader.js.map +0 -1
- package/dist/native/byteIndex.d.ts +0 -26
- package/dist/native/byteIndex.d.ts.map +0 -1
- package/dist/native/byteIndex.js +0 -70
- package/dist/native/byteIndex.js.map +0 -1
- package/dist/native/jsBridge.d.ts +0 -7
- package/dist/native/jsBridge.d.ts.map +0 -1
- package/dist/native/jsBridge.js +0 -25
- package/dist/native/jsBridge.js.map +0 -1
- package/dist/native/nativeBackendReport.d.ts +0 -22
- package/dist/native/nativeBackendReport.d.ts.map +0 -1
- package/dist/native/nativeBackendReport.js +0 -102
- package/dist/native/nativeBackendReport.js.map +0 -1
- package/dist/native/projectedTree.d.ts +0 -53
- package/dist/native/projectedTree.d.ts.map +0 -1
- package/dist/native/projectedTree.js +0 -180
- package/dist/native/projectedTree.js.map +0 -1
- package/dist/native/queryResults.d.ts +0 -12
- package/dist/native/queryResults.d.ts.map +0 -1
- package/dist/native/queryResults.js +0 -34
- package/dist/native/queryResults.js.map +0 -1
- package/dist/native/runtimeCache.d.ts +0 -128
- package/dist/native/runtimeCache.d.ts.map +0 -1
- package/dist/native/runtimeCache.js +0 -667
- package/dist/native/runtimeCache.js.map +0 -1
- package/dist/native/treeShape.d.ts +0 -21
- package/dist/native/treeShape.d.ts.map +0 -1
- package/dist/native/treeShape.js +0 -28
- package/dist/native/treeShape.js.map +0 -1
- package/dist/native/treeSitterNative.d.ts +0 -6
- package/dist/native/treeSitterNative.d.ts.map +0 -1
- package/dist/native/treeSitterNative.js +0 -5
- package/dist/native/treeSitterNative.js.map +0 -1
- package/dist/runtimeIdentity.d.ts +0 -27
- package/dist/runtimeIdentity.d.ts.map +0 -1
- package/dist/runtimeIdentity.js +0 -75
- package/dist/runtimeIdentity.js.map +0 -1
- package/dist/sql/classifySqlFile.d.ts +0 -3
- package/dist/sql/classifySqlFile.d.ts.map +0 -1
- package/dist/sql/classifySqlFile.js +0 -42
- package/dist/sql/classifySqlFile.js.map +0 -1
- package/dist/sql/extractFacts.d.ts +0 -4
- package/dist/sql/extractFacts.d.ts.map +0 -1
- package/dist/sql/extractFacts.js +0 -511
- package/dist/sql/extractFacts.js.map +0 -1
- package/dist/sql/sourceGraph.d.ts +0 -19
- package/dist/sql/sourceGraph.d.ts.map +0 -1
- package/dist/sql/sourceGraph.js +0 -195
- package/dist/sql/sourceGraph.js.map +0 -1
- package/dist/sqlite/rawQueryWorker.d.ts +0 -22
- package/dist/sqlite/rawQueryWorker.d.ts.map +0 -1
- package/dist/sqlite/rawQueryWorker.js +0 -31
- package/dist/sqlite/rawQueryWorker.js.map +0 -1
- package/dist/sqlite/rawQueryWorkerPool.d.ts +0 -66
- package/dist/sqlite/rawQueryWorkerPool.d.ts.map +0 -1
- package/dist/sqlite/rawQueryWorkerPool.js +0 -146
- package/dist/sqlite/rawQueryWorkerPool.js.map +0 -1
- package/dist/sqlite/rowBounds.d.ts +0 -24
- package/dist/sqlite/rowBounds.d.ts.map +0 -1
- package/dist/sqlite/rowBounds.js +0 -95
- package/dist/sqlite/rowBounds.js.map +0 -1
- package/dist/util/bloomFilter.d.ts +0 -100
- package/dist/util/bloomFilter.d.ts.map +0 -1
- package/dist/util/bloomFilter.js +0 -206
- package/dist/util/bloomFilter.js.map +0 -1
- package/dist/util/confinedFile.d.ts +0 -48
- package/dist/util/confinedFile.d.ts.map +0 -1
- package/dist/util/confinedFile.js +0 -164
- package/dist/util/confinedFile.js.map +0 -1
- package/dist/util/discoveryPath.d.ts +0 -3
- package/dist/util/discoveryPath.d.ts.map +0 -1
- package/dist/util/discoveryPath.js +0 -19
- package/dist/util/discoveryPath.js.map +0 -1
- package/dist/util/graphEdges.d.ts +0 -5
- package/dist/util/graphEdges.d.ts.map +0 -1
- package/dist/util/graphEdges.js +0 -42
- package/dist/util/graphEdges.js.map +0 -1
- package/dist/util/graphOnlyExtensions.d.ts +0 -5
- package/dist/util/graphOnlyExtensions.d.ts.map +0 -1
- package/dist/util/graphOnlyExtensions.js +0 -12
- package/dist/util/graphOnlyExtensions.js.map +0 -1
- package/dist/util/includeRoots.d.ts +0 -6
- package/dist/util/includeRoots.d.ts.map +0 -1
- package/dist/util/includeRoots.js +0 -53
- package/dist/util/includeRoots.js.map +0 -1
- package/dist/util/lazySymbols.d.ts +0 -166
- package/dist/util/lazySymbols.d.ts.map +0 -1
- package/dist/util/lazySymbols.js +0 -365
- package/dist/util/lazySymbols.js.map +0 -1
- package/dist/util/lruMap.d.ts +0 -3
- package/dist/util/lruMap.d.ts.map +0 -1
- package/dist/util/lruMap.js +0 -22
- package/dist/util/lruMap.js.map +0 -1
- package/dist/util/memberAccess.d.ts +0 -26
- package/dist/util/memberAccess.d.ts.map +0 -1
- package/dist/util/memberAccess.js +0 -185
- package/dist/util/memberAccess.js.map +0 -1
- package/dist/util/packageExports.d.ts +0 -25
- package/dist/util/packageExports.d.ts.map +0 -1
- package/dist/util/packageExports.js +0 -79
- package/dist/util/packageExports.js.map +0 -1
- package/dist/util/packageInfo.d.ts +0 -12
- package/dist/util/packageInfo.d.ts.map +0 -1
- package/dist/util/packageInfo.js +0 -57
- package/dist/util/packageInfo.js.map +0 -1
- package/dist/util/partialResults.d.ts +0 -81
- package/dist/util/partialResults.d.ts.map +0 -1
- package/dist/util/partialResults.js +0 -290
- package/dist/util/partialResults.js.map +0 -1
- package/dist/util/projectFiles/definitions.d.ts.map +0 -1
- package/dist/util/projectFiles/definitions.js.map +0 -1
- package/dist/util/projectFiles/parsers.d.ts.map +0 -1
- package/dist/util/projectFiles/parsers.js.map +0 -1
- package/dist/util/projectFiles.d.ts +0 -153
- package/dist/util/projectFiles.d.ts.map +0 -1
- package/dist/util/projectFiles.js +0 -1458
- package/dist/util/projectFiles.js.map +0 -1
- package/dist/util/resolution/findFirstExisting.d.ts +0 -2
- package/dist/util/resolution/findFirstExisting.d.ts.map +0 -1
- package/dist/util/resolution/findFirstExisting.js +0 -13
- package/dist/util/resolution/findFirstExisting.js.map +0 -1
- package/dist/util/resolution/phpComposer.d.ts +0 -17
- package/dist/util/resolution/phpComposer.d.ts.map +0 -1
- package/dist/util/resolution/phpComposer.js +0 -269
- package/dist/util/resolution/phpComposer.js.map +0 -1
- package/dist/util/resolution/projectSymbols.d.ts +0 -14
- package/dist/util/resolution/projectSymbols.d.ts.map +0 -1
- package/dist/util/resolution/projectSymbols.js +0 -70
- package/dist/util/resolution/projectSymbols.js.map +0 -1
- package/dist/util/resolutionCandidates.d.ts +0 -5
- package/dist/util/resolutionCandidates.d.ts.map +0 -1
- package/dist/util/resolutionCandidates.js +0 -70
- package/dist/util/resolutionCandidates.js.map +0 -1
- package/dist/util/rustTestModules.d.ts +0 -3
- package/dist/util/rustTestModules.d.ts.map +0 -1
- package/dist/util/rustTestModules.js +0 -71
- package/dist/util/rustTestModules.js.map +0 -1
- package/dist/util/sourceLocation.d.ts +0 -8
- package/dist/util/sourceLocation.d.ts.map +0 -1
- package/dist/util/sourceLocation.js +0 -19
- package/dist/util/sourceLocation.js.map +0 -1
- package/dist/util/sqliteSchema.d.ts +0 -28
- package/dist/util/sqliteSchema.d.ts.map +0 -1
- package/dist/util/sqliteSchema.js +0 -75
- package/dist/util/sqliteSchema.js.map +0 -1
- package/dist/util/symbolHash.d.ts +0 -59
- package/dist/util/symbolHash.d.ts.map +0 -1
- package/dist/util/symbolHash.js +0 -84
- package/dist/util/symbolHash.js.map +0 -1
- package/dist/util/windowsProcessDrain.d.ts +0 -23
- package/dist/util/windowsProcessDrain.d.ts.map +0 -1
- package/dist/util/windowsProcessDrain.js +0 -51
- package/dist/util/windowsProcessDrain.js.map +0 -1
- package/dist/util/workerThreads.d.ts +0 -12
- package/dist/util/workerThreads.d.ts.map +0 -1
- package/dist/util/workerThreads.js +0 -16
- package/dist/util/workerThreads.js.map +0 -1
- package/dist/worker/nativeExtractWorker.d.ts +0 -77
- package/dist/worker/nativeExtractWorker.d.ts.map +0 -1
- package/dist/worker/nativeExtractWorker.js +0 -272
- package/dist/worker/nativeExtractWorker.js.map +0 -1
- package/dist/worker/nativeWorkerPool.d.ts +0 -16
- package/dist/worker/nativeWorkerPool.d.ts.map +0 -1
- package/dist/worker/nativeWorkerPool.js +0 -54
- package/dist/worker/nativeWorkerPool.js.map +0 -1
- package/docs/graph-visualization/viewer-selected-node.webp +0 -0
- /package/dist/{documentLinks → document-links}/asciidoc.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/asciidoc.js +0 -0
- /package/dist/{documentLinks → document-links}/html.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/html.js +0 -0
- /package/dist/{documentLinks → document-links}/markdown.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/markdown.js +0 -0
- /package/dist/{documentLinks → document-links}/rst.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/rst.js +0 -0
- /package/dist/{documentLinks → document-links}/sfc.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/sfc.js +0 -0
- /package/dist/{documentLinks → document-links}/shared.d.ts +0 -0
- /package/dist/{documentLinks → document-links}/shared.js +0 -0
- /package/dist/util/{projectFiles → project-files}/definitions.d.ts +0 -0
- /package/dist/util/{projectFiles → project-files}/definitions.js +0 -0
- /package/dist/util/{projectFiles → project-files}/parsers.d.ts +0 -0
- /package/dist/util/{projectFiles → project-files}/parsers.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/app.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/file-tree-filters.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/file-tree-model.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/graph-builder.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/index.html +0 -0
- /package/{docs/graph-visualization → src/viewer}/styles.css +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology-layout-forceatlas2.txt +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology.txt +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.sigma.txt +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/graphology-layout-forceatlas2.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/graphology.js +0 -0
- /package/{docs/graph-visualization → src/viewer}/vendor/sigma.js +0 -0
|
@@ -1,1458 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import fsp from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import fg from "fast-glob";
|
|
5
|
-
import picomatch from "picomatch";
|
|
6
|
-
import { performance } from "node:perf_hooks";
|
|
7
|
-
import { logWithLevel } from "../logging.js";
|
|
8
|
-
import { stringifyUnknown } from "./ast.js";
|
|
9
|
-
import { fileIdentityKey, isFilePathWithinRoot, normalizePath } from "./paths.js";
|
|
10
|
-
import { isRelativePathInside, matchesDiscoveryGlob } from "./discoveryPath.js";
|
|
11
|
-
export { isRelativePathInside, matchesDiscoveryGlob } from "./discoveryPath.js";
|
|
12
|
-
import { PROJECT_FILE_DEFINITIONS, } from "./projectFiles/definitions.js";
|
|
13
|
-
import { trimToNull } from "./projectFiles/parsers.js";
|
|
14
|
-
import { mapLimitSemaphore } from "./concurrency.js";
|
|
15
|
-
import { CODEGRAPH_CONFIG_FILE } from "../config.js";
|
|
16
|
-
import { createGitDiscoveryCache, getGitRepositoryRoot, isGitProjectRootIgnored, isGitRepo, isGitTimeoutError, listGitExcludeFiles, listGitStageSpecialPaths, listGitSubmoduleDirectories, listTrackedFiles, listUntrackedFiles, } from "./git.js";
|
|
17
|
-
export const DEFAULT_PROJECT_FILE_IGNORES = [
|
|
18
|
-
"**/node_modules/**",
|
|
19
|
-
"**/.git/**",
|
|
20
|
-
// Never treat Codegraph's own on-disk state as project input. `.codegraph/` contains
|
|
21
|
-
// lifecycle metadata and the indexer disk cache. Keep the legacy cache ignore so
|
|
22
|
-
// pre-migration checkouts stay excluded from discovery.
|
|
23
|
-
"**/.codegraph/**",
|
|
24
|
-
"**/.codegraph-cache/**",
|
|
25
|
-
"**/dist/**",
|
|
26
|
-
"**/build/**",
|
|
27
|
-
"**/target/**",
|
|
28
|
-
"**/.venv/**",
|
|
29
|
-
"**/venv/**",
|
|
30
|
-
"**/site-packages/**",
|
|
31
|
-
"**/__pycache__/**",
|
|
32
|
-
"**/vendor/bundle/**",
|
|
33
|
-
"**/.build/**",
|
|
34
|
-
"**/Pods/**",
|
|
35
|
-
];
|
|
36
|
-
export const DEFAULT_PROJECT_MANIFESTS = [
|
|
37
|
-
"package.json",
|
|
38
|
-
"package-lock.json",
|
|
39
|
-
"pnpm-lock.yaml",
|
|
40
|
-
"yarn.lock",
|
|
41
|
-
"bun.lockb",
|
|
42
|
-
"pnpm-workspace.yaml",
|
|
43
|
-
"lerna.json",
|
|
44
|
-
"nx.json",
|
|
45
|
-
"turbo.json",
|
|
46
|
-
"tsconfig.json",
|
|
47
|
-
"jsconfig.json",
|
|
48
|
-
"requirements.txt",
|
|
49
|
-
"requirements.in",
|
|
50
|
-
"pyproject.toml",
|
|
51
|
-
"Pipfile",
|
|
52
|
-
"Pipfile.lock",
|
|
53
|
-
"poetry.lock",
|
|
54
|
-
"setup.py",
|
|
55
|
-
"setup.cfg",
|
|
56
|
-
"Cargo.toml",
|
|
57
|
-
"Cargo.lock",
|
|
58
|
-
"rust-toolchain",
|
|
59
|
-
"rust-toolchain.toml",
|
|
60
|
-
"go.mod",
|
|
61
|
-
"go.sum",
|
|
62
|
-
"go.work",
|
|
63
|
-
"Gemfile",
|
|
64
|
-
"Gemfile.lock",
|
|
65
|
-
"*.gemspec",
|
|
66
|
-
"pom.xml",
|
|
67
|
-
"mvnw",
|
|
68
|
-
"build.gradle",
|
|
69
|
-
"build.gradle.kts",
|
|
70
|
-
"settings.gradle",
|
|
71
|
-
"settings.gradle.kts",
|
|
72
|
-
"gradle.properties",
|
|
73
|
-
"gradlew",
|
|
74
|
-
"*.csproj",
|
|
75
|
-
"*.fsproj",
|
|
76
|
-
"*.vbproj",
|
|
77
|
-
"*.sln",
|
|
78
|
-
"Directory.Build.props",
|
|
79
|
-
"Directory.Build.targets",
|
|
80
|
-
"global.json",
|
|
81
|
-
"composer.json",
|
|
82
|
-
"composer.lock",
|
|
83
|
-
"Package.swift",
|
|
84
|
-
"Package.resolved",
|
|
85
|
-
"CMakeLists.txt",
|
|
86
|
-
"CMakePresets.json",
|
|
87
|
-
"CMakeUserPresets.json",
|
|
88
|
-
"Makefile",
|
|
89
|
-
"makefile",
|
|
90
|
-
"GNUmakefile",
|
|
91
|
-
"configure.ac",
|
|
92
|
-
"configure.in",
|
|
93
|
-
"meson.build",
|
|
94
|
-
"meson_options.txt",
|
|
95
|
-
"conanfile.txt",
|
|
96
|
-
"conanfile.py",
|
|
97
|
-
"vcpkg.json",
|
|
98
|
-
];
|
|
99
|
-
export const DEFAULT_PROJECT_PATTERNS = [
|
|
100
|
-
"**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,py,pyi,php,vue,svelte,astro,hbs,handlebars,md,mdx,rst,adoc,asciidoc,go,java,cs,rb,rs,html,htm,css,scss,less,kt,kts,swift,zig,c,h,cc,cpp,cxx,c++,hpp,hh,hxx,ipp,tpp,inl,sql}",
|
|
101
|
-
...DEFAULT_PROJECT_MANIFESTS.map((name) => `**/${name}`),
|
|
102
|
-
];
|
|
103
|
-
const REALPATH_FILTER_CONCURRENCY = 64;
|
|
104
|
-
export function createProjectDiscoveryContext(projectRoot) {
|
|
105
|
-
return new DiscoveryContext(projectRoot);
|
|
106
|
-
}
|
|
107
|
-
function emitDiscoveryActivity(report, activity, current = 0, total = 0) {
|
|
108
|
-
report?.({ activity, current, total });
|
|
109
|
-
}
|
|
110
|
-
function emitDiscoveryTiming(record, name, startedAt) {
|
|
111
|
-
record?.({ name, ms: Math.round(performance.now() - startedAt) });
|
|
112
|
-
}
|
|
113
|
-
function createPathCheckProgressReporter(total, onProgress) {
|
|
114
|
-
onProgress?.(0, total);
|
|
115
|
-
let completed = 0;
|
|
116
|
-
return () => {
|
|
117
|
-
completed += 1;
|
|
118
|
-
if (completed === total || completed % 100 === 0)
|
|
119
|
-
onProgress?.(completed, total);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function isPresent(value) {
|
|
123
|
-
return value !== undefined;
|
|
124
|
-
}
|
|
125
|
-
function normalizeGlobPattern(globPattern) {
|
|
126
|
-
return globPattern.trim().replace(/\\/g, "/");
|
|
127
|
-
}
|
|
128
|
-
const ROOT_CONFIG_NAME_MATCHERS = [...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE].map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
|
|
129
|
-
function isRootConfigFileName(fileName) {
|
|
130
|
-
return ROOT_CONFIG_NAME_MATCHERS.some((matcher) => matcher(fileName));
|
|
131
|
-
}
|
|
132
|
-
async function listRootConfigFiles(root, state) {
|
|
133
|
-
const entries = await readDirectoryWithFileTypes(root, state);
|
|
134
|
-
const files = [];
|
|
135
|
-
for (const entry of entries) {
|
|
136
|
-
if (!isRootConfigFileName(entry.name))
|
|
137
|
-
continue;
|
|
138
|
-
const file = normalizePath(path.join(root, entry.name));
|
|
139
|
-
if (!entry.isFile()) {
|
|
140
|
-
if (!entry.isSymbolicLink())
|
|
141
|
-
continue;
|
|
142
|
-
try {
|
|
143
|
-
if (!(await fsp.stat(file)).isFile())
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
const code = error.code;
|
|
148
|
-
if (code === "ENOENT" || code === "ENOTDIR")
|
|
149
|
-
continue;
|
|
150
|
-
throw error;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
files.push(file);
|
|
154
|
-
}
|
|
155
|
-
return files;
|
|
156
|
-
}
|
|
157
|
-
const DIRECTORY_METADATA_EXTENSIONS = new Set();
|
|
158
|
-
const DIRECTORY_METADATA_BASENAMES = new Set();
|
|
159
|
-
for (const definition of PROJECT_FILE_DEFINITIONS) {
|
|
160
|
-
if (definition.kind !== "dir")
|
|
161
|
-
continue;
|
|
162
|
-
for (const pattern of definition.patterns) {
|
|
163
|
-
if (!pattern.includes("*") && !pattern.includes("?")) {
|
|
164
|
-
DIRECTORY_METADATA_BASENAMES.add(pattern.toLowerCase());
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
const trimmed = pattern.replaceAll("*", "").replaceAll("?", "");
|
|
168
|
-
const lastDot = trimmed.lastIndexOf(".");
|
|
169
|
-
if (lastDot < 0)
|
|
170
|
-
continue;
|
|
171
|
-
DIRECTORY_METADATA_EXTENSIONS.add(trimmed.slice(lastDot).toLowerCase());
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Git lists files, not directories. A directory symlink still appears as one path.
|
|
176
|
-
* Ordinary data files (`row.json`) are not directory links, so probing every Git
|
|
177
|
-
* candidate spent one lstat per JSON/CSV. Tracked symlinks are identified by Git
|
|
178
|
-
* mode 120000 regardless of extension. Untracked paths and Windows checkouts that
|
|
179
|
-
* do not record 120000 still need this name heuristic: no extension, a bundle
|
|
180
|
-
* directory marker such as `App.xcodeproj`, or a literal directory name such as `.idea`.
|
|
181
|
-
*/
|
|
182
|
-
function couldBeDirectorySymlink(filePath) {
|
|
183
|
-
const basename = path.posix.basename(normalizePath(filePath));
|
|
184
|
-
if (DIRECTORY_METADATA_BASENAMES.has(basename.toLowerCase()))
|
|
185
|
-
return true;
|
|
186
|
-
const extension = path.posix.extname(basename);
|
|
187
|
-
if (!extension)
|
|
188
|
-
return true;
|
|
189
|
-
return DIRECTORY_METADATA_EXTENSIONS.has(extension.toLowerCase());
|
|
190
|
-
}
|
|
191
|
-
function isProjectMetadataDirectoryName(dirPath) {
|
|
192
|
-
const basename = path.posix.basename(normalizePath(dirPath));
|
|
193
|
-
if (DIRECTORY_METADATA_BASENAMES.has(basename.toLowerCase()))
|
|
194
|
-
return true;
|
|
195
|
-
const extension = path.posix.extname(basename);
|
|
196
|
-
return Boolean(extension) && DIRECTORY_METADATA_EXTENSIONS.has(extension.toLowerCase());
|
|
197
|
-
}
|
|
198
|
-
function globLiteralPrefix(globPattern) {
|
|
199
|
-
const prefix = [];
|
|
200
|
-
let seenLiteral = false;
|
|
201
|
-
for (const segment of globPattern.split("/")) {
|
|
202
|
-
if (!segment)
|
|
203
|
-
continue;
|
|
204
|
-
if (!seenLiteral && segment === "**")
|
|
205
|
-
continue;
|
|
206
|
-
if (segment.includes("*") || segment.includes("?"))
|
|
207
|
-
break;
|
|
208
|
-
seenLiteral = true;
|
|
209
|
-
prefix.push(segment);
|
|
210
|
-
}
|
|
211
|
-
return prefix;
|
|
212
|
-
}
|
|
213
|
-
function isSegmentPrefix(prefix, pathSegments) {
|
|
214
|
-
if (!prefix.length || prefix.length > pathSegments.length)
|
|
215
|
-
return false;
|
|
216
|
-
return prefix.every((segment, index) => pathSegments[index] === segment);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Whether an include glob explicitly re-opens a default-ignored root, so a default ignore
|
|
220
|
-
* should stay active for every OTHER root the includes never mention. A parent include
|
|
221
|
-
* such as vendor/ re-opens a nested ignore such as vendor/bundle. Compares
|
|
222
|
-
* literal path segments rather than attempting general glob-vs-glob intersection.
|
|
223
|
-
*/
|
|
224
|
-
function isIgnoreGlobReopenedByIncludes(ignoreGlob, includeGlobs) {
|
|
225
|
-
const ignoreLiterals = ignoreGlob.split("/").filter((segment) => segment && !segment.includes("*"));
|
|
226
|
-
if (!ignoreLiterals.length)
|
|
227
|
-
return false;
|
|
228
|
-
return includeGlobs.some((includeGlob) => {
|
|
229
|
-
const includeSegments = includeGlob.split("/");
|
|
230
|
-
if (ignoreLiterals.every((segment) => includeSegments.includes(segment)))
|
|
231
|
-
return true;
|
|
232
|
-
const includePrefix = globLiteralPrefix(includeGlob);
|
|
233
|
-
return isSegmentPrefix(includePrefix, ignoreLiterals) || isSegmentPrefix(ignoreLiterals, includePrefix);
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function isLocationIndependentGlob(globPattern) {
|
|
237
|
-
return globPattern.startsWith("**/");
|
|
238
|
-
}
|
|
239
|
-
export function translateGlobRootIgnoreGlobsForScanRoot(scanRoot, globRoot, ignoreGlobs) {
|
|
240
|
-
const relativeScanRoot = normalizePath(path.relative(globRoot, scanRoot));
|
|
241
|
-
if (!relativeScanRoot || !isRelativePathInside(relativeScanRoot)) {
|
|
242
|
-
return ignoreGlobs.map(normalizeGlobPattern).filter(Boolean);
|
|
243
|
-
}
|
|
244
|
-
const rootPrefix = `${relativeScanRoot}/`;
|
|
245
|
-
return ignoreGlobs
|
|
246
|
-
.map(normalizeGlobPattern)
|
|
247
|
-
.filter(Boolean)
|
|
248
|
-
.map((globPattern) => {
|
|
249
|
-
const rootRelativePattern = globPattern.startsWith("/") ? globPattern.slice(1) : globPattern;
|
|
250
|
-
if (isLocationIndependentGlob(rootRelativePattern))
|
|
251
|
-
return rootRelativePattern;
|
|
252
|
-
if (rootRelativePattern === relativeScanRoot || rootRelativePattern === `${relativeScanRoot}/**`)
|
|
253
|
-
return "**";
|
|
254
|
-
if (rootRelativePattern.startsWith(rootPrefix))
|
|
255
|
-
return rootRelativePattern.slice(rootPrefix.length) || "**";
|
|
256
|
-
return undefined;
|
|
257
|
-
})
|
|
258
|
-
.filter(isPresent);
|
|
259
|
-
}
|
|
260
|
-
function stripGitignoreTrailingSpaces(line) {
|
|
261
|
-
let end = line.length;
|
|
262
|
-
while (end > 0 && line[end - 1] === " ") {
|
|
263
|
-
let slashCount = 0;
|
|
264
|
-
for (let i = end - 2; i >= 0 && line[i] === "\\"; i -= 1) {
|
|
265
|
-
slashCount += 1;
|
|
266
|
-
}
|
|
267
|
-
if (slashCount % 2 === 1) {
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
end -= 1;
|
|
271
|
-
}
|
|
272
|
-
return line.slice(0, end);
|
|
273
|
-
}
|
|
274
|
-
function parseGitignoreRule(baseDir, rawLine) {
|
|
275
|
-
const trimmedLine = stripGitignoreTrailingSpaces(rawLine);
|
|
276
|
-
if (!trimmedLine)
|
|
277
|
-
return null;
|
|
278
|
-
if (trimmedLine.startsWith("#"))
|
|
279
|
-
return null;
|
|
280
|
-
const negated = trimmedLine.startsWith("!");
|
|
281
|
-
let pattern = negated ? trimmedLine.slice(1) : trimmedLine;
|
|
282
|
-
if (!pattern || pattern === "/")
|
|
283
|
-
return null;
|
|
284
|
-
const dirOnly = pattern.endsWith("/");
|
|
285
|
-
if (dirOnly) {
|
|
286
|
-
pattern = pattern.slice(0, -1);
|
|
287
|
-
}
|
|
288
|
-
if (pattern.startsWith("/")) {
|
|
289
|
-
pattern = pattern.slice(1);
|
|
290
|
-
}
|
|
291
|
-
pattern = pattern.replace(/^\\([#!])/, "$1").replace(/\\/g, "/");
|
|
292
|
-
if (!pattern)
|
|
293
|
-
return null;
|
|
294
|
-
const anchored = trimmedLine.startsWith("/") || (negated && trimmedLine.startsWith("!/"));
|
|
295
|
-
const baseMatcherPattern = anchored || pattern.includes("/") ? pattern : `**/${pattern}`;
|
|
296
|
-
const matcherPattern = dirOnly ? `${baseMatcherPattern}/**` : [baseMatcherPattern, `${baseMatcherPattern}/**`];
|
|
297
|
-
const matches = picomatch(matcherPattern, { dot: true });
|
|
298
|
-
return {
|
|
299
|
-
baseDir: normalizePath(baseDir),
|
|
300
|
-
negated,
|
|
301
|
-
dirOnly,
|
|
302
|
-
matches,
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
const EMPTY_GITIGNORE_INDEX = {
|
|
306
|
-
hasRules: false,
|
|
307
|
-
repositoryRoots: [],
|
|
308
|
-
repositoryAliases: [],
|
|
309
|
-
byBaseDir: new Map(),
|
|
310
|
-
};
|
|
311
|
-
class DiscoveryContext {
|
|
312
|
-
projectRoot;
|
|
313
|
-
git;
|
|
314
|
-
gitCandidatesByRoot = new Map();
|
|
315
|
-
ignoreIndexByKey = new Map();
|
|
316
|
-
fileTextByPath = new Map();
|
|
317
|
-
readdirCache = new Map();
|
|
318
|
-
globFilesystem;
|
|
319
|
-
constructor(projectRoot) {
|
|
320
|
-
this.projectRoot = projectRoot;
|
|
321
|
-
this.git = createGitDiscoveryCache();
|
|
322
|
-
this.globFilesystem = { readdir: createSharedReaddir(this) };
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
function createSharedReaddir(state) {
|
|
326
|
-
function readdir(directory, optionsOrCallback, callback) {
|
|
327
|
-
const listing = readDirectoryWithFileTypes(directory, state);
|
|
328
|
-
if (typeof optionsOrCallback === "function") {
|
|
329
|
-
listing.then((entries) => optionsOrCallback(null, entries.map((entry) => entry.name)), (error) => optionsOrCallback(error, []));
|
|
330
|
-
}
|
|
331
|
-
else if (callback) {
|
|
332
|
-
listing.then((entries) => callback(null, entries), (error) => callback(error, []));
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return readdir;
|
|
336
|
-
}
|
|
337
|
-
function globFilesystemOption(state) {
|
|
338
|
-
if (!state)
|
|
339
|
-
return {};
|
|
340
|
-
return { fs: state.globFilesystem };
|
|
341
|
-
}
|
|
342
|
-
function globFilesystemField(state) {
|
|
343
|
-
if (!state)
|
|
344
|
-
return {};
|
|
345
|
-
return { globFilesystem: state.globFilesystem };
|
|
346
|
-
}
|
|
347
|
-
async function readDirectoryWithFileTypes(directory, state) {
|
|
348
|
-
if (!state)
|
|
349
|
-
return fsp.readdir(directory, { withFileTypes: true });
|
|
350
|
-
const key = fileIdentityKey(directory);
|
|
351
|
-
const cached = state.readdirCache.get(key);
|
|
352
|
-
if (cached)
|
|
353
|
-
return cached;
|
|
354
|
-
const pending = fsp.readdir(directory, { withFileTypes: true });
|
|
355
|
-
state.readdirCache.set(key, pending);
|
|
356
|
-
return pending;
|
|
357
|
-
}
|
|
358
|
-
async function readDiscoveryFileResult(state, filePath) {
|
|
359
|
-
if (!state) {
|
|
360
|
-
try {
|
|
361
|
-
return { ok: true, text: await fsp.readFile(filePath, "utf8") };
|
|
362
|
-
}
|
|
363
|
-
catch (error) {
|
|
364
|
-
return { ok: false, error };
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
const key = fileIdentityKey(filePath);
|
|
368
|
-
const cached = state.fileTextByPath.get(key);
|
|
369
|
-
if (cached)
|
|
370
|
-
return await cached;
|
|
371
|
-
const pending = (async () => {
|
|
372
|
-
try {
|
|
373
|
-
return { ok: true, text: await fsp.readFile(filePath, "utf8") };
|
|
374
|
-
}
|
|
375
|
-
catch (error) {
|
|
376
|
-
return { ok: false, error };
|
|
377
|
-
}
|
|
378
|
-
})();
|
|
379
|
-
state.fileTextByPath.set(key, pending);
|
|
380
|
-
return await pending;
|
|
381
|
-
}
|
|
382
|
-
export async function readProjectDiscoveryFileText(discoveryContext, filePath) {
|
|
383
|
-
const result = await readDiscoveryFileResult(discoveryContext, filePath);
|
|
384
|
-
if (result.ok)
|
|
385
|
-
return result.text;
|
|
386
|
-
if (result.error instanceof Error)
|
|
387
|
-
throw result.error;
|
|
388
|
-
throw new Error(`Failed to read ${filePath}: ${stringifyUnknown(result.error)}`);
|
|
389
|
-
}
|
|
390
|
-
async function sharedGitignoreIndex(state, cacheKey, load) {
|
|
391
|
-
if (!state)
|
|
392
|
-
return await load();
|
|
393
|
-
const cached = state.ignoreIndexByKey.get(cacheKey);
|
|
394
|
-
if (cached)
|
|
395
|
-
return await cached;
|
|
396
|
-
const pending = load();
|
|
397
|
-
state.ignoreIndexByKey.set(cacheKey, pending);
|
|
398
|
-
return await pending;
|
|
399
|
-
}
|
|
400
|
-
function rememberGitCandidates(state, root, candidates) {
|
|
401
|
-
if (!state)
|
|
402
|
-
return;
|
|
403
|
-
const key = fileIdentityKey(root);
|
|
404
|
-
if (state.gitCandidatesByRoot.has(key))
|
|
405
|
-
return;
|
|
406
|
-
state.gitCandidatesByRoot.set(key, Promise.resolve(candidates));
|
|
407
|
-
}
|
|
408
|
-
async function getSharedGitCandidates(context, root, logLevel, callbacks) {
|
|
409
|
-
const state = context;
|
|
410
|
-
const gitCache = context?.git;
|
|
411
|
-
if (!state)
|
|
412
|
-
return await listGitCandidateFiles(root, logLevel, callbacks, gitCache);
|
|
413
|
-
const key = fileIdentityKey(root);
|
|
414
|
-
const cached = state.gitCandidatesByRoot.get(key);
|
|
415
|
-
if (cached)
|
|
416
|
-
return await cached;
|
|
417
|
-
const pending = listGitCandidateFiles(root, logLevel, callbacks, gitCache);
|
|
418
|
-
state.gitCandidatesByRoot.set(key, pending);
|
|
419
|
-
return await pending;
|
|
420
|
-
}
|
|
421
|
-
function gitExcludeListOptions(gitCache) {
|
|
422
|
-
if (!gitCache)
|
|
423
|
-
return undefined;
|
|
424
|
-
return { discoveryCache: gitCache };
|
|
425
|
-
}
|
|
426
|
-
function gitUntrackedListOptions(gitCache) {
|
|
427
|
-
if (!gitCache)
|
|
428
|
-
return { respectGitignore: true };
|
|
429
|
-
return { respectGitignore: true, discoveryCache: gitCache };
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Parse `.gitignore` rules from an already-discovered set of `.gitignore` files.
|
|
433
|
-
*
|
|
434
|
-
* Ordered by path depth, not lexically: a directory segment collating before `.` (for
|
|
435
|
-
* example `-vendor` or `!keep`) would otherwise place a child's rule file ahead of its
|
|
436
|
-
* parent's, so a parent could no longer suppress a child whose rules it ignores, and a
|
|
437
|
-
* child negation could re-include files. Depth-first ordering also keeps the "last match
|
|
438
|
-
* wins" order deeper files depend on, and drops the locale sensitivity of `localeCompare`.
|
|
439
|
-
*/
|
|
440
|
-
async function buildGitignoreIndex(sources, repositoryRoots = [], repositoryAliases = [], state) {
|
|
441
|
-
const sorted = [...sources]
|
|
442
|
-
.map(({ file, baseDir, repositoryRoot, priority }) => ({
|
|
443
|
-
file: normalizePath(file),
|
|
444
|
-
baseDir: normalizePath(baseDir),
|
|
445
|
-
priority: priority ?? 2,
|
|
446
|
-
...(repositoryRoot === undefined ? {} : { repositoryRoot: normalizePath(repositoryRoot) }),
|
|
447
|
-
}))
|
|
448
|
-
.sort((left, right) => {
|
|
449
|
-
const baseDepthDelta = left.baseDir.split("/").length - right.baseDir.split("/").length;
|
|
450
|
-
if (baseDepthDelta !== 0)
|
|
451
|
-
return baseDepthDelta;
|
|
452
|
-
const priorityDelta = left.priority - right.priority;
|
|
453
|
-
if (priorityDelta !== 0)
|
|
454
|
-
return priorityDelta;
|
|
455
|
-
if (left.file < right.file)
|
|
456
|
-
return -1;
|
|
457
|
-
return left.file > right.file ? 1 : 0;
|
|
458
|
-
});
|
|
459
|
-
const gitignoreIndex = {
|
|
460
|
-
hasRules: false,
|
|
461
|
-
repositoryRoots: Array.from(new Set(repositoryRoots.map(normalizePath))).sort((left, right) => right.length - left.length),
|
|
462
|
-
repositoryAliases: Array.from(new Map(repositoryAliases.map(({ path: aliasPath, repositoryRoot }) => [
|
|
463
|
-
fileIdentityKey(aliasPath),
|
|
464
|
-
{ path: normalizePath(aliasPath), repositoryRoot: normalizePath(repositoryRoot) },
|
|
465
|
-
])).values()).sort((left, right) => right.path.length - left.path.length),
|
|
466
|
-
byBaseDir: new Map(),
|
|
467
|
-
};
|
|
468
|
-
for (const { file, baseDir, repositoryRoot } of sorted) {
|
|
469
|
-
if (isIgnoredByGitignore(path.dirname(file), gitignoreIndex, true)) {
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
const fileText = await readDiscoveryFileResult(state, file);
|
|
473
|
-
if (!fileText.ok)
|
|
474
|
-
continue;
|
|
475
|
-
const raw = fileText.text;
|
|
476
|
-
const baseKey = fileIdentityKey(baseDir);
|
|
477
|
-
for (const line of raw.split(/\r?\n/)) {
|
|
478
|
-
const rule = parseGitignoreRule(baseDir, line);
|
|
479
|
-
if (!rule)
|
|
480
|
-
continue;
|
|
481
|
-
const existing = gitignoreIndex.byBaseDir.get(baseKey);
|
|
482
|
-
if (existing)
|
|
483
|
-
existing.rules.push(rule);
|
|
484
|
-
else
|
|
485
|
-
gitignoreIndex.byBaseDir.set(baseKey, { baseDir, repositoryRoot, rules: [rule] });
|
|
486
|
-
gitignoreIndex.hasRules = true;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
return gitignoreIndex;
|
|
490
|
-
}
|
|
491
|
-
async function findGitignoreFiles(projectRoot, state) {
|
|
492
|
-
return await fg(["**/.gitignore"], {
|
|
493
|
-
cwd: projectRoot,
|
|
494
|
-
absolute: true,
|
|
495
|
-
dot: true,
|
|
496
|
-
followSymbolicLinks: false,
|
|
497
|
-
ignore: DEFAULT_PROJECT_FILE_IGNORES,
|
|
498
|
-
...globFilesystemOption(state),
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
async function loadGitignoreIndexForRootAliases(projectRoot, state) {
|
|
502
|
-
const roots = [projectRoot];
|
|
503
|
-
const realRoot = await fsp.realpath(projectRoot);
|
|
504
|
-
if (normalizePath(realRoot) !== normalizePath(projectRoot)) {
|
|
505
|
-
roots.push(realRoot);
|
|
506
|
-
}
|
|
507
|
-
const sources = [];
|
|
508
|
-
for (const root of roots) {
|
|
509
|
-
for (const file of await findGitignoreFiles(root, state)) {
|
|
510
|
-
sources.push({ file, baseDir: path.dirname(file) });
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return await buildGitignoreIndex(sources, [], [], state);
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Whether `.gitignore` rules ignore `absolutePath`.
|
|
517
|
-
*
|
|
518
|
-
* Only a `.gitignore` on the path's own ancestor chain can match it, so this walks that
|
|
519
|
-
* chain rather than testing every rule in the project. The skipped rules are exactly the
|
|
520
|
-
* ones whose relative-path check would have rejected them, and applying the chain
|
|
521
|
-
* shallowest-first reproduces the flat list's ordering, so the answer is unchanged.
|
|
522
|
-
* Testing every rule cost O(files x rules): on an Unreal project that meant 55,983
|
|
523
|
-
* candidates against 2,266 rules from 173 `.gitignore` files, or 253.7M evaluations and
|
|
524
|
-
* roughly 21.7s of a 26.1s discovery.
|
|
525
|
-
*
|
|
526
|
-
* The relative path is computed once per declaring directory rather than once per rule.
|
|
527
|
-
* Every rule in a group shares that directory, so the per-rule form repeated identical
|
|
528
|
-
* `path.relative` and normalization work; on the same project that repetition was the
|
|
529
|
-
* dominant remaining cost, at 2.6s of a 3.8s discovery.
|
|
530
|
-
*/
|
|
531
|
-
function isIgnoredByGitignore(absolutePath, gitignoreIndex, isDirectory = false) {
|
|
532
|
-
if (!gitignoreIndex.hasRules)
|
|
533
|
-
return false;
|
|
534
|
-
const owningRepositoryRoot = gitignoreIndex.repositoryRoots.find((root) => isFilePathWithinRoot(root, absolutePath)) ??
|
|
535
|
-
gitignoreIndex.repositoryAliases.find(({ path: aliasPath }) => isFilePathWithinRoot(aliasPath, absolutePath))
|
|
536
|
-
?.repositoryRoot;
|
|
537
|
-
const chain = [];
|
|
538
|
-
let current = normalizePath(path.dirname(absolutePath));
|
|
539
|
-
for (;;) {
|
|
540
|
-
const group = gitignoreIndex.byBaseDir.get(fileIdentityKey(current));
|
|
541
|
-
if (group)
|
|
542
|
-
chain.push(group);
|
|
543
|
-
const parent = normalizePath(path.dirname(current));
|
|
544
|
-
if (parent === current)
|
|
545
|
-
break;
|
|
546
|
-
current = parent;
|
|
547
|
-
}
|
|
548
|
-
let ignored = false;
|
|
549
|
-
for (let depth = chain.length - 1; depth >= 0; depth -= 1) {
|
|
550
|
-
const group = chain[depth];
|
|
551
|
-
if (group.repositoryRoot !== undefined &&
|
|
552
|
-
owningRepositoryRoot !== undefined &&
|
|
553
|
-
fileIdentityKey(group.repositoryRoot) !== fileIdentityKey(owningRepositoryRoot)) {
|
|
554
|
-
continue;
|
|
555
|
-
}
|
|
556
|
-
const relativePath = path.relative(group.baseDir, absolutePath);
|
|
557
|
-
if (!isRelativePathInside(relativePath)) {
|
|
558
|
-
continue;
|
|
559
|
-
}
|
|
560
|
-
const normalizedRelativePath = normalizePath(relativePath);
|
|
561
|
-
const hasSeparator = normalizedRelativePath.includes("/");
|
|
562
|
-
for (const rule of group.rules) {
|
|
563
|
-
if (rule.dirOnly && !hasSeparator && !isDirectory) {
|
|
564
|
-
continue;
|
|
565
|
-
}
|
|
566
|
-
const matchesDirectory = isDirectory && rule.dirOnly && rule.matches(`${normalizedRelativePath}/.directory`);
|
|
567
|
-
if (rule.matches(normalizedRelativePath) || matchesDirectory) {
|
|
568
|
-
ignored = !rule.negated;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return ignored;
|
|
573
|
-
}
|
|
574
|
-
async function ensureDirectoryReadable(directoryPath, label) {
|
|
575
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
576
|
-
let stats;
|
|
577
|
-
try {
|
|
578
|
-
stats = await fsp.stat(resolvedPath);
|
|
579
|
-
}
|
|
580
|
-
catch (error) {
|
|
581
|
-
throw new Error(`${label} does not exist or is not readable: ${resolvedPath} (${stringifyUnknown(error)})`);
|
|
582
|
-
}
|
|
583
|
-
if (!stats.isDirectory()) {
|
|
584
|
-
throw new Error(`${label} is not a directory: ${resolvedPath}`);
|
|
585
|
-
}
|
|
586
|
-
return resolvedPath;
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Every directory on the ancestor chain of `files`, up to and including `root`.
|
|
590
|
-
*
|
|
591
|
-
* The ignore matcher only consults rules declared at a path's own ancestors, so this is
|
|
592
|
-
* exactly the set of directories whose `.gitignore` can affect a candidate.
|
|
593
|
-
*/
|
|
594
|
-
function collectCandidateAncestorDirectories(root, files) {
|
|
595
|
-
const rootKey = fileIdentityKey(root);
|
|
596
|
-
const seen = new Set([rootKey]);
|
|
597
|
-
const directories = [normalizePath(root)];
|
|
598
|
-
for (const file of files) {
|
|
599
|
-
let current = normalizePath(path.dirname(file));
|
|
600
|
-
while (fileIdentityKey(current) !== rootKey) {
|
|
601
|
-
if (seen.has(fileIdentityKey(current)))
|
|
602
|
-
break;
|
|
603
|
-
seen.add(fileIdentityKey(current));
|
|
604
|
-
directories.push(current);
|
|
605
|
-
const parent = normalizePath(path.dirname(current));
|
|
606
|
-
if (parent === current)
|
|
607
|
-
break;
|
|
608
|
-
current = parent;
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
return directories;
|
|
612
|
-
}
|
|
613
|
-
export function owningGitIgnoreSourceRoot(file, roots, realpathMemo) {
|
|
614
|
-
const normalized = normalizePath(file);
|
|
615
|
-
let owning;
|
|
616
|
-
for (const root of roots) {
|
|
617
|
-
if (!isFilePathWithinRoot(root.path, normalized, realpathMemo) &&
|
|
618
|
-
!isFilePathWithinRoot(root.repositoryRoot, normalized, realpathMemo)) {
|
|
619
|
-
continue;
|
|
620
|
-
}
|
|
621
|
-
if (!owning || root.repositoryRoot.length > owning.repositoryRoot.length) {
|
|
622
|
-
owning = root;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return owning;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Ownership is pure path containment, so every candidate in the same parent directory
|
|
629
|
-
* shares one answer. The lookup and its realpath memo live only for this discovery pass,
|
|
630
|
-
* so a long-lived process cannot serve a stale owner after the tree changes.
|
|
631
|
-
*/
|
|
632
|
-
export function createGitIgnoreSourceOwnershipLookup(roots, realpathMemo) {
|
|
633
|
-
const ownershipByDirectory = new Map();
|
|
634
|
-
return (file) => {
|
|
635
|
-
const directory = normalizePath(path.dirname(file));
|
|
636
|
-
const key = fileIdentityKey(directory);
|
|
637
|
-
if (ownershipByDirectory.has(key)) {
|
|
638
|
-
return ownershipByDirectory.get(key);
|
|
639
|
-
}
|
|
640
|
-
const owning = owningGitIgnoreSourceRoot(directory, roots, realpathMemo);
|
|
641
|
-
ownershipByDirectory.set(key, owning);
|
|
642
|
-
return owning;
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
async function gitignoreFileIfPresent(directory) {
|
|
646
|
-
const file = normalizePath(path.join(directory, ".gitignore"));
|
|
647
|
-
try {
|
|
648
|
-
const stat = await fsp.stat(file);
|
|
649
|
-
return stat.isFile() ? file : undefined;
|
|
650
|
-
}
|
|
651
|
-
catch {
|
|
652
|
-
return undefined;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Locate the `.gitignore` files that can affect the Git candidates, plus Git's
|
|
657
|
-
* other ignore sources.
|
|
658
|
-
*
|
|
659
|
-
* A `.gitignore` only applies beneath its directory. After Git has listed tracked
|
|
660
|
-
* and untracked candidates, the ignore files that can affect those paths live on
|
|
661
|
-
* their ancestor chains up to the owning repository root, including parents of a
|
|
662
|
-
* nested scan root, and at each source root. Stopping at the scan root would miss
|
|
663
|
-
* `packages/.gitignore` when listing `packages/app`. Asking Git for ignored
|
|
664
|
-
* `.gitignore` files walks every gitignored tree looking for them, which times
|
|
665
|
-
* out on a large ignored data directory even after file listing already finished.
|
|
666
|
-
*/
|
|
667
|
-
async function findGitIgnoreSources(sourceRoots, candidateFiles, gitCache) {
|
|
668
|
-
const roots = Array.from(new Map(sourceRoots.map(({ path: sourceRoot, repositoryRoot }) => [
|
|
669
|
-
fileIdentityKey(sourceRoot),
|
|
670
|
-
{ path: normalizePath(sourceRoot), repositoryRoot: normalizePath(repositoryRoot) },
|
|
671
|
-
])).values());
|
|
672
|
-
const directories = new Map();
|
|
673
|
-
const walkedDirectoryKeys = new Set();
|
|
674
|
-
const addDirectory = (directory, repositoryRoot) => {
|
|
675
|
-
const dir = normalizePath(directory);
|
|
676
|
-
const key = fileIdentityKey(dir);
|
|
677
|
-
if (!directories.has(key))
|
|
678
|
-
directories.set(key, { dir, repositoryRoot: normalizePath(repositoryRoot) });
|
|
679
|
-
};
|
|
680
|
-
for (const { path: sourceRoot, repositoryRoot } of roots) {
|
|
681
|
-
addDirectory(sourceRoot, repositoryRoot);
|
|
682
|
-
}
|
|
683
|
-
const realpathMemo = new Map();
|
|
684
|
-
const owningOf = createGitIgnoreSourceOwnershipLookup(roots, realpathMemo);
|
|
685
|
-
for (const file of candidateFiles) {
|
|
686
|
-
const owning = owningOf(file);
|
|
687
|
-
if (!owning)
|
|
688
|
-
continue;
|
|
689
|
-
let dir = normalizePath(path.dirname(file));
|
|
690
|
-
const stopKey = fileIdentityKey(owning.repositoryRoot);
|
|
691
|
-
while (true) {
|
|
692
|
-
const dirKey = fileIdentityKey(dir);
|
|
693
|
-
const walkKey = `${dirKey}\0${stopKey}`;
|
|
694
|
-
if (walkedDirectoryKeys.has(walkKey))
|
|
695
|
-
break;
|
|
696
|
-
addDirectory(dir, owning.repositoryRoot);
|
|
697
|
-
walkedDirectoryKeys.add(walkKey);
|
|
698
|
-
if (dirKey === stopKey)
|
|
699
|
-
break;
|
|
700
|
-
const parent = normalizePath(path.dirname(dir));
|
|
701
|
-
if (parent === dir ||
|
|
702
|
-
(!isFilePathWithinRoot(owning.path, parent, realpathMemo) &&
|
|
703
|
-
!isFilePathWithinRoot(owning.repositoryRoot, parent, realpathMemo))) {
|
|
704
|
-
break;
|
|
705
|
-
}
|
|
706
|
-
dir = parent;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
const uniqueRepositoryRoots = Array.from(new Set(roots.map((root) => root.repositoryRoot)));
|
|
710
|
-
const [gitignoreHits, excludeLists] = await Promise.all([
|
|
711
|
-
mapLimitSemaphore(Array.from(directories.values()), REALPATH_FILTER_CONCURRENCY, async ({ dir, repositoryRoot }) => {
|
|
712
|
-
const file = await gitignoreFileIfPresent(dir);
|
|
713
|
-
return file ? [{ file, baseDir: dir, repositoryRoot, priority: 2 }] : [];
|
|
714
|
-
}),
|
|
715
|
-
Promise.all(uniqueRepositoryRoots.map((repositoryRoot) => listGitExcludeFiles(repositoryRoot, gitExcludeListOptions(gitCache)))),
|
|
716
|
-
]);
|
|
717
|
-
return [
|
|
718
|
-
...gitignoreHits.flat(),
|
|
719
|
-
...excludeLists.flat().map((source) => ({
|
|
720
|
-
...source,
|
|
721
|
-
repositoryRoot: source.baseDir,
|
|
722
|
-
})),
|
|
723
|
-
];
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* Enumerate candidate project files through Git, or `null` when Git cannot answer.
|
|
727
|
-
*
|
|
728
|
-
* Tracked plus untracked-but-not-ignored files are Git candidates. Submodule files retain
|
|
729
|
-
* their own repository boundary, and source roots cover logical and physical aliases.
|
|
730
|
-
*/
|
|
731
|
-
async function listGitCandidateFiles(root, logLevel, opts, gitCache) {
|
|
732
|
-
let gitListStart;
|
|
733
|
-
let gitIgnoreStart;
|
|
734
|
-
try {
|
|
735
|
-
const realRoot = normalizePath(await fsp.realpath(root));
|
|
736
|
-
const gitRoot = (await isGitRepo(root, gitCache)) ? root : realRoot;
|
|
737
|
-
if (!(await isGitRepo(gitRoot, gitCache)))
|
|
738
|
-
return null;
|
|
739
|
-
if (await isGitProjectRootIgnored(realRoot, gitCache))
|
|
740
|
-
return null;
|
|
741
|
-
const gitRepositoryRoot = await getGitRepositoryRoot(gitRoot);
|
|
742
|
-
if (!gitRepositoryRoot)
|
|
743
|
-
return null;
|
|
744
|
-
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files");
|
|
745
|
-
const listStartedAt = performance.now();
|
|
746
|
-
gitListStart = listStartedAt;
|
|
747
|
-
const untrackedOptions = gitUntrackedListOptions(gitCache);
|
|
748
|
-
const [tracked, untracked, stageSpecial] = await Promise.all([
|
|
749
|
-
listTrackedFiles(gitRoot, { recurseSubmodules: true, ...(logLevel === undefined ? {} : { logLevel }) }),
|
|
750
|
-
listUntrackedFiles(gitRoot, untrackedOptions),
|
|
751
|
-
listGitStageSpecialPaths(gitRoot, { recurse: true }),
|
|
752
|
-
]);
|
|
753
|
-
const submoduleDirectories = stageSpecial.gitlinks;
|
|
754
|
-
const submoduleRoots = await Promise.all(submoduleDirectories.map(async (logicalPath) => ({
|
|
755
|
-
logicalPath: normalizePath(logicalPath),
|
|
756
|
-
physicalPath: normalizePath(await fsp.realpath(logicalPath).catch(() => logicalPath)),
|
|
757
|
-
})));
|
|
758
|
-
const submoduleUntracked = await Promise.all(submoduleRoots.map(async ({ physicalPath }) => await listUntrackedFiles(physicalPath, untrackedOptions)));
|
|
759
|
-
const rawFiles = Array.from(new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
|
|
760
|
-
const needsLogicalRemap = normalizePath(gitRoot) !== normalizePath(root);
|
|
761
|
-
const files = Array.from(new Set(rawFiles.map((file) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file)
|
|
762
|
-
? normalizePath(path.resolve(root, path.relative(realRoot, file)))
|
|
763
|
-
: normalizePath(file)))).sort();
|
|
764
|
-
const remapGitPath = (file) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file)
|
|
765
|
-
? normalizePath(path.resolve(root, path.relative(realRoot, file)))
|
|
766
|
-
: normalizePath(file);
|
|
767
|
-
const symlinkCandidatePaths = Array.from(new Set([...stageSpecial.symlinks.map(remapGitPath), ...files.filter((file) => couldBeDirectorySymlink(file))])).sort();
|
|
768
|
-
const gitignoreRoots = [gitRepositoryRoot, ...submoduleRoots.map(({ physicalPath }) => physicalPath)].map(normalizePath);
|
|
769
|
-
const sourceRoots = [
|
|
770
|
-
{ path: root, repositoryRoot: gitRepositoryRoot },
|
|
771
|
-
{ path: realRoot, repositoryRoot: gitRepositoryRoot },
|
|
772
|
-
{ path: gitRepositoryRoot, repositoryRoot: gitRepositoryRoot },
|
|
773
|
-
...submoduleRoots.flatMap(({ logicalPath, physicalPath }) => [
|
|
774
|
-
{ path: logicalPath, repositoryRoot: physicalPath },
|
|
775
|
-
{ path: physicalPath, repositoryRoot: physicalPath },
|
|
776
|
-
]),
|
|
777
|
-
];
|
|
778
|
-
emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-list", listStartedAt);
|
|
779
|
-
gitListStart = undefined;
|
|
780
|
-
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files", files.length, files.length);
|
|
781
|
-
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git ignore files");
|
|
782
|
-
const ignoreStartedAt = performance.now();
|
|
783
|
-
gitIgnoreStart = ignoreStartedAt;
|
|
784
|
-
const gitignoreFiles = await findGitIgnoreSources(sourceRoots, files, gitCache);
|
|
785
|
-
emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-ignore", ignoreStartedAt);
|
|
786
|
-
gitIgnoreStart = undefined;
|
|
787
|
-
emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git ignore files", gitignoreFiles.length, gitignoreFiles.length);
|
|
788
|
-
return {
|
|
789
|
-
files,
|
|
790
|
-
symlinkCandidatePaths,
|
|
791
|
-
gitignoreFiles,
|
|
792
|
-
gitignoreRoots,
|
|
793
|
-
gitignoreAliases: sourceRoots,
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
catch (error) {
|
|
797
|
-
const listingTimedOut = isGitTimeoutError(error) && (gitIgnoreStart !== undefined || gitListStart !== undefined);
|
|
798
|
-
if (gitIgnoreStart !== undefined) {
|
|
799
|
-
emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-ignore", gitIgnoreStart);
|
|
800
|
-
}
|
|
801
|
-
else if (gitListStart !== undefined) {
|
|
802
|
-
emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-list", gitListStart);
|
|
803
|
-
}
|
|
804
|
-
if (listingTimedOut) {
|
|
805
|
-
logWithLevel(logLevel, "warn", "Warning: Git listing timed out; scanning the filesystem instead. Ignore large untracked trees in .gitignore to keep discovery fast.");
|
|
806
|
-
}
|
|
807
|
-
else {
|
|
808
|
-
logWithLevel(logLevel, "debug", `Git discovery unavailable for ${root}: ${stringifyUnknown(error)}`);
|
|
809
|
-
}
|
|
810
|
-
return null;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
export async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
|
|
814
|
-
return await listProjectFilesInternal(projectRoot, patterns, options);
|
|
815
|
-
}
|
|
816
|
-
export async function listProjectFilesWithGitCandidates(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
|
|
817
|
-
return await listProjectFilesInternal(projectRoot, patterns, options);
|
|
818
|
-
}
|
|
819
|
-
async function listProjectFilesInternal(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
|
|
820
|
-
const root = await ensureDirectoryReadable(projectRoot, "Project root");
|
|
821
|
-
const globRoot = options?.globRoot ? await ensureDirectoryReadable(options.globRoot, "Glob root") : root;
|
|
822
|
-
const includeGlobs = (options?.includeGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
|
|
823
|
-
const includeMatchers = includeGlobs.map((globPattern) => picomatch(globPattern, { dot: true }));
|
|
824
|
-
const userIgnoreGlobs = (options?.ignoreGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
|
|
825
|
-
const userIgnoreMatchers = userIgnoreGlobs.map((globPattern) => picomatch(globPattern, { dot: true }));
|
|
826
|
-
const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => picomatch(globPattern, { dot: true }));
|
|
827
|
-
const patternMatchers = patterns.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
|
|
828
|
-
const translatedUserIgnoreGlobs = translateGlobRootIgnoreGlobsForScanRoot(root, globRoot, userIgnoreGlobs);
|
|
829
|
-
const fastGlobIgnoreGlobs = [...DEFAULT_PROJECT_FILE_IGNORES, ...translatedUserIgnoreGlobs];
|
|
830
|
-
// Include globs are an explicit request to re-open otherwise ignored roots. Probe
|
|
831
|
-
// those roots for safe directory links before the later filter reapplies the default
|
|
832
|
-
// ignores, so an included link is not lost before it can be traversed. Default ignores
|
|
833
|
-
// an include never mentions (e.g. node_modules when only src/** is included) stay
|
|
834
|
-
// active, so the probe does not walk unrelated large ignored trees.
|
|
835
|
-
const symlinkProbeIgnoreGlobs = includeGlobs.length
|
|
836
|
-
? [
|
|
837
|
-
...translatedUserIgnoreGlobs,
|
|
838
|
-
...DEFAULT_PROJECT_FILE_IGNORES.filter((ignoreGlob) => !isIgnoreGlobReopenedByIncludes(ignoreGlob, includeGlobs)),
|
|
839
|
-
]
|
|
840
|
-
: fastGlobIgnoreGlobs;
|
|
841
|
-
try {
|
|
842
|
-
const useGitignore = options?.useGitignore ?? true;
|
|
843
|
-
const realRoot = await fsp.realpath(root);
|
|
844
|
-
// Enumerate through Git when Git's ignore rules are the ones this call wants anyway.
|
|
845
|
-
// Git applies them while walking, so ignored trees are never descended into and never
|
|
846
|
-
// reach the realpath and gitignore checks below. Scanning instead costs O(files on
|
|
847
|
-
// disk): on an Unreal project holding 100,168 files (818 tracked) the scan produced
|
|
848
|
-
// 55,983 pattern-matching candidates, nearly all generated sources under a gitignored
|
|
849
|
-
// `Intermediate/` tree, and discovery took 26.1s. Git lists 4,010 in about 111ms.
|
|
850
|
-
// An aliased root or a gitignore-root override that points elsewhere means Git's notion
|
|
851
|
-
// of the project is not this call's, so those fall back to the scan. Passing
|
|
852
|
-
// `gitignoreRoot` equal to the scan root (the CLI's historical whole-project form) still
|
|
853
|
-
// wants this repository's ignore rules, so keep the Git candidate path. On a 501-file
|
|
854
|
-
// Git repo with a 20,000-file gitignored tree, `gitignoreRoot: scanRoot` otherwise
|
|
855
|
-
// forced a filesystem scan plus a full-tree symlink probe (~403ms) instead of Git
|
|
856
|
-
// listing (~66ms) of the 502 tracked paths.
|
|
857
|
-
// Compare by identity key, not slash normalization: on a case-insensitive filesystem a
|
|
858
|
-
// casing or drive-letter difference still names the same directory, and calling that a
|
|
859
|
-
// mismatch would silently drop back to the slow scan this fast path exists to avoid.
|
|
860
|
-
const scanRootKey = fileIdentityKey(root);
|
|
861
|
-
const gitignoreRootMatchesScanRoot = options?.gitignoreRoot === undefined || fileIdentityKey(options.gitignoreRoot) === scanRootKey;
|
|
862
|
-
const attemptedGitCandidates = useGitignore && gitignoreRootMatchesScanRoot && fileIdentityKey(realRoot) === scanRootKey;
|
|
863
|
-
const gitDiscoveryCallbacks = {
|
|
864
|
-
...(options?.onDiscoveryProgress ? { onDiscoveryProgress: options.onDiscoveryProgress } : {}),
|
|
865
|
-
...(options?.onDiscoveryTiming ? { onDiscoveryTiming: options.onDiscoveryTiming } : {}),
|
|
866
|
-
};
|
|
867
|
-
const discovery = options?.discoveryContext ?? createProjectDiscoveryContext(root);
|
|
868
|
-
const gitCandidates = attemptedGitCandidates
|
|
869
|
-
? await getSharedGitCandidates(discovery, root, options?.logLevel, gitDiscoveryCallbacks)
|
|
870
|
-
: null;
|
|
871
|
-
// Report only when this call actually asked Git, including a null result. Callers that
|
|
872
|
-
// already enumerated candidates (build-index) can hand the same set to metadata discovery
|
|
873
|
-
// and skip a second Git spawn; omitting the callback keeps prior caller behavior.
|
|
874
|
-
if (attemptedGitCandidates) {
|
|
875
|
-
options?.onGitCandidatesDiscovered?.(gitCandidates);
|
|
876
|
-
}
|
|
877
|
-
let gitignoreIndex = EMPTY_GITIGNORE_INDEX;
|
|
878
|
-
if (useGitignore && gitCandidates) {
|
|
879
|
-
gitignoreIndex = await sharedGitignoreIndex(discovery, `git:${fileIdentityKey(root)}`, () => buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases, discovery));
|
|
880
|
-
}
|
|
881
|
-
else if (useGitignore) {
|
|
882
|
-
const gitignoreRoot = options?.gitignoreRoot
|
|
883
|
-
? await ensureDirectoryReadable(options.gitignoreRoot, "Gitignore root")
|
|
884
|
-
: root;
|
|
885
|
-
gitignoreIndex = await sharedGitignoreIndex(discovery, `fs:${fileIdentityKey(gitignoreRoot)}`, () => loadGitignoreIndexForRootAliases(gitignoreRoot, discovery));
|
|
886
|
-
}
|
|
887
|
-
// Git returns a candidate set, not a filtered result: the pattern, include,
|
|
888
|
-
// default-ignore, and gitignore checks below still decide what is indexable.
|
|
889
|
-
let files;
|
|
890
|
-
if (gitCandidates) {
|
|
891
|
-
files = gitCandidates.files;
|
|
892
|
-
}
|
|
893
|
-
else {
|
|
894
|
-
emitDiscoveryActivity(options?.onDiscoveryProgress, "Scanning project files");
|
|
895
|
-
const scanStart = performance.now();
|
|
896
|
-
files = await fg(patterns, {
|
|
897
|
-
cwd: root,
|
|
898
|
-
absolute: true,
|
|
899
|
-
dot: true,
|
|
900
|
-
followSymbolicLinks: false,
|
|
901
|
-
ignore: fastGlobIgnoreGlobs,
|
|
902
|
-
...globFilesystemOption(discovery),
|
|
903
|
-
});
|
|
904
|
-
emitDiscoveryTiming(options?.onDiscoveryTiming, "filesystem-scan", scanStart);
|
|
905
|
-
emitDiscoveryActivity(options?.onDiscoveryProgress, "Scanning project files", files.length, files.length);
|
|
906
|
-
}
|
|
907
|
-
// Explicit includeGlobs may re-open default-ignored trees (for example vendored
|
|
908
|
-
// dependency dirs). Scan those include patterns without default ignores, then keep
|
|
909
|
-
// only paths that still match the project patterns and include globs below.
|
|
910
|
-
//
|
|
911
|
-
// Only needed on the scan path. Git never applied this project's default ignores, so
|
|
912
|
-
// its listing already contains those files and the include globs below re-open them.
|
|
913
|
-
// Running the scan anyway would also re-add paths Git excluded through its own
|
|
914
|
-
// exclude files, contradicting the rule that Git's ignores still win here.
|
|
915
|
-
const includedOverrideFiles = includeGlobs.length && !gitCandidates
|
|
916
|
-
? await fg(translateGlobRootIgnoreGlobsForScanRoot(root, globRoot, includeGlobs), {
|
|
917
|
-
cwd: root,
|
|
918
|
-
absolute: true,
|
|
919
|
-
dot: true,
|
|
920
|
-
followSymbolicLinks: false,
|
|
921
|
-
ignore: translatedUserIgnoreGlobs,
|
|
922
|
-
...globFilesystemOption(discovery),
|
|
923
|
-
})
|
|
924
|
-
: [];
|
|
925
|
-
const reportSourceSymlinkChecks = options?.onDiscoveryProgress
|
|
926
|
-
? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source symlinks", current, total })
|
|
927
|
-
: undefined;
|
|
928
|
-
const reportSourcePathChecks = options?.onDiscoveryProgress
|
|
929
|
-
? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source file paths", current, total })
|
|
930
|
-
: undefined;
|
|
931
|
-
const symlinkOptions = {
|
|
932
|
-
globRoot,
|
|
933
|
-
...(gitCandidates ? { candidatePaths: gitCandidates.symlinkCandidatePaths } : {}),
|
|
934
|
-
...(options?.knownSymlinkDirectories !== undefined
|
|
935
|
-
? { knownSymlinkDirectories: options.knownSymlinkDirectories }
|
|
936
|
-
: {}),
|
|
937
|
-
...(options?.onSymlinkDirectoriesDiscovered
|
|
938
|
-
? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
|
|
939
|
-
: {}),
|
|
940
|
-
...(reportSourceSymlinkChecks ? { onPathCheckProgress: reportSourceSymlinkChecks } : {}),
|
|
941
|
-
...globFilesystemField(discovery),
|
|
942
|
-
};
|
|
943
|
-
const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, symlinkProbeIgnoreGlobs, symlinkOptions);
|
|
944
|
-
const linkedFiles = await listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, fastGlobIgnoreGlobs, {
|
|
945
|
-
...symlinkOptions,
|
|
946
|
-
filterIgnoreGlobs: [...DEFAULT_PROJECT_FILE_IGNORES, ...userIgnoreGlobs],
|
|
947
|
-
resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
|
|
948
|
-
});
|
|
949
|
-
const linkedOverrideFiles = includeGlobs.length === 0
|
|
950
|
-
? []
|
|
951
|
-
: await listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, translatedUserIgnoreGlobs, {
|
|
952
|
-
globRoot,
|
|
953
|
-
filterIgnoreGlobs: userIgnoreGlobs,
|
|
954
|
-
resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
|
|
955
|
-
...globFilesystemField(discovery),
|
|
956
|
-
});
|
|
957
|
-
// Cheap path predicates run before the realpath confinement probe. Git enumerates
|
|
958
|
-
// every tracked and untracked file it knows about, including trees this project
|
|
959
|
-
// always ignores (virtualenvs, build output, caches), so probing first spent one
|
|
960
|
-
// realpath syscall per ignored candidate: a Python project with a 20k-file untracked
|
|
961
|
-
// virtualenv took 1.0s of syscalls to return 7 files. Only candidates that can still
|
|
962
|
-
// become project files need their physical path resolved.
|
|
963
|
-
const candidatePaths = [...files, ...includedOverrideFiles, ...linkedFiles, ...linkedOverrideFiles];
|
|
964
|
-
const seen = new Set();
|
|
965
|
-
const indexableCandidates = [];
|
|
966
|
-
for (const candidatePath of candidatePaths) {
|
|
967
|
-
const filePath = normalizePath(candidatePath);
|
|
968
|
-
if (seen.has(filePath))
|
|
969
|
-
continue;
|
|
970
|
-
seen.add(filePath);
|
|
971
|
-
const rootRelative = normalizePath(path.relative(root, filePath));
|
|
972
|
-
if (!isRelativePathInside(rootRelative))
|
|
973
|
-
continue;
|
|
974
|
-
if (!patternMatchers.some((matcher) => matcher(rootRelative)))
|
|
975
|
-
continue;
|
|
976
|
-
if (includeMatchers.length &&
|
|
977
|
-
!includeMatchers.some((matcher) => matchesDiscoveryGlob(filePath, globRoot, matcher))) {
|
|
978
|
-
continue;
|
|
979
|
-
}
|
|
980
|
-
if (userIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(filePath, globRoot, matcher)))
|
|
981
|
-
continue;
|
|
982
|
-
// Explicit include globs are a deliberate request to re-open default-ignored trees.
|
|
983
|
-
if (!includeMatchers.length && defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
|
|
984
|
-
continue;
|
|
985
|
-
if (isIgnoredByGitignore(filePath, gitignoreIndex))
|
|
986
|
-
continue;
|
|
987
|
-
indexableCandidates.push(filePath);
|
|
988
|
-
}
|
|
989
|
-
const rootSafeFiles = await filterRealPathsWithinRootEntries(indexableCandidates, realRoot, reportSourcePathChecks);
|
|
990
|
-
return rootSafeFiles
|
|
991
|
-
.filter(({ path: filePath, realPath }) =>
|
|
992
|
-
// The real path only differs when the entry was reached through a symlink, so
|
|
993
|
-
// testing it again for every ordinary file doubled the matcher work for nothing.
|
|
994
|
-
normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex))
|
|
995
|
-
.map(({ path: filePath }) => filePath);
|
|
996
|
-
}
|
|
997
|
-
catch (error) {
|
|
998
|
-
logWithLevel(options?.logLevel, "debug", `listProjectFiles failed for ${root}: ${stringifyUnknown(error)}`);
|
|
999
|
-
throw new Error(`Failed to list files in ${root}: ${stringifyUnknown(error)}`);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Build a predicate that answers "does this absolute path belong in the project file
|
|
1004
|
-
* set" without walking the filesystem. Mirrors the pattern/ignore-glob filtering that
|
|
1005
|
-
* `listProjectFiles()` applies during its scan, so it can be reused to test candidate
|
|
1006
|
-
* paths sourced elsewhere (e.g. `git ls-files --others`) against the same discovery
|
|
1007
|
-
* rules. Does not evaluate `.gitignore`; callers sourcing candidates from Git already
|
|
1008
|
-
* get gitignore-aware filtering for free and should not reuse this for arbitrary,
|
|
1009
|
-
* non-Git-sourced candidate paths without also checking gitignore separately.
|
|
1010
|
-
*/
|
|
1011
|
-
export function createDiscoveredFileMatcher(root, globRoot, patterns, options) {
|
|
1012
|
-
const patternMatchers = patterns.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
|
|
1013
|
-
const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
|
|
1014
|
-
const includeMatchers = (options?.includeGlobs ?? [])
|
|
1015
|
-
.map(normalizeGlobPattern)
|
|
1016
|
-
.filter(Boolean)
|
|
1017
|
-
.map((pattern) => picomatch(pattern, { dot: true }));
|
|
1018
|
-
const userIgnoreMatchers = (options?.ignoreGlobs ?? [])
|
|
1019
|
-
.map(normalizeGlobPattern)
|
|
1020
|
-
.filter(Boolean)
|
|
1021
|
-
.map((pattern) => picomatch(pattern, { dot: true }));
|
|
1022
|
-
return (absolutePath) => {
|
|
1023
|
-
const rootRelative = path.relative(root, absolutePath);
|
|
1024
|
-
if (!isRelativePathInside(rootRelative))
|
|
1025
|
-
return false;
|
|
1026
|
-
const normalizedRootRelative = normalizePath(rootRelative);
|
|
1027
|
-
if (!patternMatchers.some((matcher) => matcher(normalizedRootRelative)))
|
|
1028
|
-
return false;
|
|
1029
|
-
const matchesInclude = !includeMatchers.length ||
|
|
1030
|
-
includeMatchers.some((matcher) => matchesDiscoveryGlob(absolutePath, globRoot, matcher));
|
|
1031
|
-
if (!matchesInclude)
|
|
1032
|
-
return false;
|
|
1033
|
-
if (defaultIgnoreMatchers.some((matcher) => matcher(normalizedRootRelative))) {
|
|
1034
|
-
if (!(includeMatchers.length > 0 && matchesInclude))
|
|
1035
|
-
return false;
|
|
1036
|
-
}
|
|
1037
|
-
return !userIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(absolutePath, globRoot, matcher));
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Whether `linkPath` is a directory symlink that is safe to crawl for project files.
|
|
1042
|
-
*
|
|
1043
|
-
* `lstat` runs before `realpath` and `stat` so a candidate that is not a symlink costs
|
|
1044
|
-
* one syscall rather than three. That matters for callers screening a broad candidate
|
|
1045
|
-
* list, where nearly every entry is an ordinary file, and costs nothing for callers
|
|
1046
|
-
* passing entries a walk already identified as links.
|
|
1047
|
-
*/
|
|
1048
|
-
async function isSafeSymlinkDirectory(root, linkPath, realRoot) {
|
|
1049
|
-
try {
|
|
1050
|
-
if (!isRelativePathInside(path.relative(root, linkPath)))
|
|
1051
|
-
return false;
|
|
1052
|
-
if (!(await fsp.lstat(linkPath)).isSymbolicLink())
|
|
1053
|
-
return false;
|
|
1054
|
-
const [realPath, targetStats] = await Promise.all([fsp.realpath(linkPath), fsp.stat(linkPath)]);
|
|
1055
|
-
if (!targetStats.isDirectory())
|
|
1056
|
-
return false;
|
|
1057
|
-
if (!isFilePathWithinRoot(realRoot, realPath))
|
|
1058
|
-
return false;
|
|
1059
|
-
return normalizePath(realPath) !== normalizePath(realRoot);
|
|
1060
|
-
}
|
|
1061
|
-
catch {
|
|
1062
|
-
return false;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
async function verifySafeSymlinkDirectories(root, realRoot, paths, onPathCheckProgress) {
|
|
1066
|
-
const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
|
|
1067
|
-
const verified = await mapLimitSemaphore(Array.from(paths), REALPATH_FILTER_CONCURRENCY, async (linkPath) => {
|
|
1068
|
-
try {
|
|
1069
|
-
return (await isSafeSymlinkDirectory(root, linkPath, realRoot)) ? linkPath : null;
|
|
1070
|
-
}
|
|
1071
|
-
finally {
|
|
1072
|
-
reportPathCheck();
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
return verified.filter((entry) => entry !== null);
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
|
-
* Resolve the symlinked directories under `root` that are safe to crawl.
|
|
1079
|
-
*
|
|
1080
|
-
* When `knownSymlinkDirectories` is provided, this re-verifies each previously
|
|
1081
|
-
* discovered path directly. Otherwise a Git-derived `candidatePaths` list avoids a
|
|
1082
|
-
* separate full-tree scan: Git already enumerated every tracked and non-ignored
|
|
1083
|
-
* untracked entry, including symlinks. Callers pass `symlinkCandidatePaths` so ordinary
|
|
1084
|
-
* data files are not lstat'd, while Git mode 120000 still screens extension-bearing
|
|
1085
|
-
* directory links. Non-Git discovery retains the existing
|
|
1086
|
-
* `fg(["**\/*"])` fallback. Every path still passes the same lstat, target-directory,
|
|
1087
|
-
* and realpath-confinement checks before it can be crawled.
|
|
1088
|
-
*/
|
|
1089
|
-
async function resolveSafeSymlinkDirectories(root, realRoot, ignore, options) {
|
|
1090
|
-
if (options.knownSymlinkDirectories !== undefined) {
|
|
1091
|
-
const resolved = await verifySafeSymlinkDirectories(root, realRoot, Array.from(new Set(options.knownSymlinkDirectories)), options.onPathCheckProgress);
|
|
1092
|
-
options.onSymlinkDirectoriesDiscovered?.(resolved, "known");
|
|
1093
|
-
return resolved;
|
|
1094
|
-
}
|
|
1095
|
-
if (options.candidatePaths !== undefined) {
|
|
1096
|
-
const ignoreMatchers = ignore
|
|
1097
|
-
.map(normalizeGlobPattern)
|
|
1098
|
-
.filter(Boolean)
|
|
1099
|
-
.map((pattern) => picomatch(pattern, { dot: true }));
|
|
1100
|
-
const candidatePaths = Array.from(new Set(options.candidatePaths)).filter((candidatePath) => {
|
|
1101
|
-
const relativePath = normalizePath(path.relative(root, candidatePath));
|
|
1102
|
-
if (!isRelativePathInside(relativePath))
|
|
1103
|
-
return false;
|
|
1104
|
-
if (ignoreMatchers.some((matcher) => matcher(relativePath)))
|
|
1105
|
-
return false;
|
|
1106
|
-
return true;
|
|
1107
|
-
});
|
|
1108
|
-
const discovered = await verifySafeSymlinkDirectories(root, realRoot, candidatePaths, options.onPathCheckProgress);
|
|
1109
|
-
options.onSymlinkDirectoriesDiscovered?.(discovered, "git-candidates");
|
|
1110
|
-
return discovered;
|
|
1111
|
-
}
|
|
1112
|
-
const entries = (await fg(["**/*"], {
|
|
1113
|
-
cwd: root,
|
|
1114
|
-
absolute: true,
|
|
1115
|
-
dot: true,
|
|
1116
|
-
onlyFiles: false,
|
|
1117
|
-
followSymbolicLinks: false,
|
|
1118
|
-
objectMode: true,
|
|
1119
|
-
ignore,
|
|
1120
|
-
...(options.globFilesystem ? { fs: options.globFilesystem } : {}),
|
|
1121
|
-
}));
|
|
1122
|
-
const discovered = await verifySafeSymlinkDirectories(root, realRoot, entries.filter((entry) => entry.dirent.isSymbolicLink()).map((entry) => entry.path), options.onPathCheckProgress);
|
|
1123
|
-
options.onSymlinkDirectoriesDiscovered?.(discovered, "filesystem");
|
|
1124
|
-
return discovered;
|
|
1125
|
-
}
|
|
1126
|
-
async function listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, ignore, options = {}) {
|
|
1127
|
-
const globRoot = options.globRoot ?? root;
|
|
1128
|
-
const filterIgnoreGlobs = options.filterIgnoreGlobs ?? ignore;
|
|
1129
|
-
const rootRelativeIgnoreMatchers = filterIgnoreGlobs
|
|
1130
|
-
.map(normalizeGlobPattern)
|
|
1131
|
-
.filter(Boolean)
|
|
1132
|
-
.map((globPattern) => picomatch(globPattern, { dot: true }));
|
|
1133
|
-
const locationIndependentIgnores = ignore.map(normalizeGlobPattern).filter(isLocationIndependentGlob);
|
|
1134
|
-
const safeSymlinkDirectories = options.resolvedSafeSymlinkDirectories ?? (await resolveSafeSymlinkDirectories(root, realRoot, ignore, options));
|
|
1135
|
-
if (!safeSymlinkDirectories.length)
|
|
1136
|
-
return [];
|
|
1137
|
-
const filesByPath = new Map();
|
|
1138
|
-
const filesByDirectory = await mapLimitSemaphore(Array.from(safeSymlinkDirectories), REALPATH_FILTER_CONCURRENCY, async (directory) => (await fg(patterns, {
|
|
1139
|
-
cwd: directory,
|
|
1140
|
-
absolute: true,
|
|
1141
|
-
dot: true,
|
|
1142
|
-
followSymbolicLinks: false,
|
|
1143
|
-
ignore: locationIndependentIgnores,
|
|
1144
|
-
...(options.onlyFiles !== undefined ? { onlyFiles: options.onlyFiles } : {}),
|
|
1145
|
-
...(options.markDirectories !== undefined ? { markDirectories: options.markDirectories } : {}),
|
|
1146
|
-
...(options.globFilesystem ? { fs: options.globFilesystem } : {}),
|
|
1147
|
-
})).filter((filePath) => {
|
|
1148
|
-
const cleanPath = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
|
1149
|
-
return !rootRelativeIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(cleanPath, globRoot, matcher));
|
|
1150
|
-
}));
|
|
1151
|
-
for (const files of filesByDirectory) {
|
|
1152
|
-
for (const file of files) {
|
|
1153
|
-
filesByPath.set(normalizePath(file), file);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
return [...filesByPath.values()];
|
|
1157
|
-
}
|
|
1158
|
-
async function filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress) {
|
|
1159
|
-
const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
|
|
1160
|
-
const filtered = await mapLimitSemaphore(paths, REALPATH_FILTER_CONCURRENCY, async (filePath) => {
|
|
1161
|
-
try {
|
|
1162
|
-
const realPath = await fsp.realpath(filePath);
|
|
1163
|
-
return isFilePathWithinRoot(realRoot, realPath) ? { path: filePath, realPath } : null;
|
|
1164
|
-
}
|
|
1165
|
-
catch {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
|
-
finally {
|
|
1169
|
-
reportPathCheck();
|
|
1170
|
-
}
|
|
1171
|
-
});
|
|
1172
|
-
return filtered.filter((entry) => entry !== null);
|
|
1173
|
-
}
|
|
1174
|
-
export async function filterRealPathsWithinRoot(paths, realRoot, onPathCheckProgress) {
|
|
1175
|
-
const entries = await filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress);
|
|
1176
|
-
return entries.map((entry) => entry.path);
|
|
1177
|
-
}
|
|
1178
|
-
function toProjectGlob(pattern) {
|
|
1179
|
-
return pattern.startsWith("**/") ? pattern : `**/${pattern}`;
|
|
1180
|
-
}
|
|
1181
|
-
async function buildProjectFileInfo(def, filePath, state) {
|
|
1182
|
-
const normalizedPath = normalizePath(filePath);
|
|
1183
|
-
const projectRoot = normalizePath(path.dirname(filePath));
|
|
1184
|
-
let name = null;
|
|
1185
|
-
if (def.parseName && def.kind === "file") {
|
|
1186
|
-
try {
|
|
1187
|
-
const text = await readProjectDiscoveryFileText(state, filePath);
|
|
1188
|
-
name = def.parseName(text, filePath);
|
|
1189
|
-
}
|
|
1190
|
-
catch {
|
|
1191
|
-
name = null;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
if (!name && def.nameFromPath) {
|
|
1195
|
-
if (def.nameFromPath === "file") {
|
|
1196
|
-
name = trimToNull(path.basename(filePath, path.extname(filePath)));
|
|
1197
|
-
}
|
|
1198
|
-
else {
|
|
1199
|
-
name = trimToNull(path.basename(projectRoot));
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
return {
|
|
1203
|
-
path: normalizedPath,
|
|
1204
|
-
kind: def.kind,
|
|
1205
|
-
type: def.type,
|
|
1206
|
-
role: def.role,
|
|
1207
|
-
projectRoot,
|
|
1208
|
-
...(name ? { name } : {}),
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
export async function discoverProjectFiles(projectRoot, options) {
|
|
1212
|
-
return await discoverProjectFilesInternal(projectRoot, options);
|
|
1213
|
-
}
|
|
1214
|
-
export async function discoverProjectFilesWithGitCandidates(projectRoot, options) {
|
|
1215
|
-
return await discoverProjectFilesInternal(projectRoot, options);
|
|
1216
|
-
}
|
|
1217
|
-
async function discoverProjectFilesInternal(projectRoot, options) {
|
|
1218
|
-
const root = await ensureDirectoryReadable(projectRoot, "Project root");
|
|
1219
|
-
try {
|
|
1220
|
-
const realRoot = await fsp.realpath(root);
|
|
1221
|
-
const projectFileDefinitionMatchers = PROJECT_FILE_DEFINITIONS.map((definition) => definition.patterns.map((pattern) => pattern.includes("*") || pattern.includes("?")
|
|
1222
|
-
? new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$")
|
|
1223
|
-
: undefined));
|
|
1224
|
-
const matchesDefinition = (fileName, definitionIndex) => {
|
|
1225
|
-
const definition = PROJECT_FILE_DEFINITIONS[definitionIndex];
|
|
1226
|
-
return definition.patterns.some((pattern, patternIndex) => {
|
|
1227
|
-
const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
|
|
1228
|
-
return matcher ? matcher.test(fileName) : pattern === fileName;
|
|
1229
|
-
});
|
|
1230
|
-
};
|
|
1231
|
-
const discovery = options?.discoveryContext ?? createProjectDiscoveryContext(root);
|
|
1232
|
-
let gitCandidates;
|
|
1233
|
-
if (options?.knownGitCandidates !== undefined) {
|
|
1234
|
-
gitCandidates = options.knownGitCandidates;
|
|
1235
|
-
rememberGitCandidates(discovery, root, gitCandidates);
|
|
1236
|
-
}
|
|
1237
|
-
else {
|
|
1238
|
-
gitCandidates = await getSharedGitCandidates(discovery, root, options?.logLevel, {
|
|
1239
|
-
...(options?.onDiscoveryProgress ? { onDiscoveryProgress: options.onDiscoveryProgress } : {}),
|
|
1240
|
-
...(options?.onDiscoveryTiming ? { onDiscoveryTiming: options.onDiscoveryTiming } : {}),
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
options?.onGitCandidatesDiscovered?.(gitCandidates);
|
|
1244
|
-
const reportMetadataSymlinkChecks = options?.onDiscoveryProgress
|
|
1245
|
-
? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata symlinks", current, total })
|
|
1246
|
-
: undefined;
|
|
1247
|
-
const reportMetadataFileChecks = options?.onDiscoveryProgress
|
|
1248
|
-
? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata files", current, total })
|
|
1249
|
-
: undefined;
|
|
1250
|
-
const reportMetadataDirectoryChecks = options?.onDiscoveryProgress
|
|
1251
|
-
? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata directories", current, total })
|
|
1252
|
-
: undefined;
|
|
1253
|
-
let rootSafeMatches;
|
|
1254
|
-
if (gitCandidates) {
|
|
1255
|
-
const gitignoreIndex = await sharedGitignoreIndex(discovery, `git:${fileIdentityKey(root)}`, () => buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases, discovery));
|
|
1256
|
-
const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => picomatch(globPattern, { dot: true }));
|
|
1257
|
-
const filterGitIgnoredEntries = (entries, directoryKeys = new Set()) => entries
|
|
1258
|
-
.map(({ path: filePath, realPath }) => ({ filePath: normalizePath(filePath), realPath }))
|
|
1259
|
-
.filter(({ filePath, realPath }) => {
|
|
1260
|
-
const isDirectory = directoryKeys.has(fileIdentityKey(filePath));
|
|
1261
|
-
const rootRelative = normalizePath(path.relative(root, filePath));
|
|
1262
|
-
if (!isRelativePathInside(rootRelative))
|
|
1263
|
-
return false;
|
|
1264
|
-
if (defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
|
|
1265
|
-
return false;
|
|
1266
|
-
if (isIgnoredByGitignore(filePath, gitignoreIndex, isDirectory))
|
|
1267
|
-
return false;
|
|
1268
|
-
return normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex, isDirectory);
|
|
1269
|
-
})
|
|
1270
|
-
.map(({ filePath }) => filePath);
|
|
1271
|
-
const symlinkOptions = {
|
|
1272
|
-
candidatePaths: gitCandidates.symlinkCandidatePaths,
|
|
1273
|
-
...(options?.knownSymlinkDirectories !== undefined
|
|
1274
|
-
? { knownSymlinkDirectories: options.knownSymlinkDirectories }
|
|
1275
|
-
: {}),
|
|
1276
|
-
...(options?.onSymlinkDirectoriesDiscovered
|
|
1277
|
-
? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
|
|
1278
|
-
: {}),
|
|
1279
|
-
...(reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}),
|
|
1280
|
-
...globFilesystemField(discovery),
|
|
1281
|
-
};
|
|
1282
|
-
const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, DEFAULT_PROJECT_FILE_IGNORES, symlinkOptions);
|
|
1283
|
-
const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
|
|
1284
|
-
const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
|
|
1285
|
-
markDirectories: true,
|
|
1286
|
-
onlyFiles: false,
|
|
1287
|
-
resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
|
|
1288
|
-
...globFilesystemField(discovery),
|
|
1289
|
-
});
|
|
1290
|
-
const candidateFiles = Array.from(new Set(gitCandidates.files.map(normalizePath)));
|
|
1291
|
-
// Only a candidate whose basename can name a manifest becomes a metadata entry, so
|
|
1292
|
-
// resolve physical paths for those alone. Probing every Git candidate first cost a
|
|
1293
|
-
// realpath syscall per ignored file: the same 20k-file untracked virtualenv spent
|
|
1294
|
-
// 0.6s here. Ancestor directories come from the candidate paths themselves and are
|
|
1295
|
-
// confined by their own realpath check below.
|
|
1296
|
-
const metadataCandidates = candidateFiles.filter((file) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "file" && matchesDefinition(path.basename(file), definitionIndex)));
|
|
1297
|
-
const fileMatches = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(metadataCandidates, realRoot, reportMetadataFileChecks));
|
|
1298
|
-
// Directory metadata is identified by the directory name (.idea, App.xcodeproj).
|
|
1299
|
-
// Walking every Git-listed JSON or CSV still produced one realpath per data folder.
|
|
1300
|
-
const rawCandidateDirectories = collectCandidateAncestorDirectories(root, candidateFiles).filter(isProjectMetadataDirectoryName);
|
|
1301
|
-
const candidateDirectoryKeys = new Set(rawCandidateDirectories.map(fileIdentityKey));
|
|
1302
|
-
const safeSymlinkDirectoryKeys = new Set(safeSymlinkDirectories.map(fileIdentityKey));
|
|
1303
|
-
const directoryMatches = [
|
|
1304
|
-
...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(rawCandidateDirectories, realRoot, reportMetadataDirectoryChecks), candidateDirectoryKeys),
|
|
1305
|
-
...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(safeSymlinkDirectories, realRoot, reportMetadataDirectoryChecks), safeSymlinkDirectoryKeys),
|
|
1306
|
-
].filter((directory) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "dir" && matchesDefinition(path.basename(directory), definitionIndex)));
|
|
1307
|
-
const linkedDirectoryKeys = new Set(linkedMatches.filter((match) => match.endsWith("/")).map((match) => fileIdentityKey(match.slice(0, -1))));
|
|
1308
|
-
const rootSafeLinked = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(linkedMatches.map((match) => (match.endsWith("/") ? match.slice(0, -1) : match)), realRoot, reportMetadataFileChecks), linkedDirectoryKeys);
|
|
1309
|
-
rootSafeMatches = [...fileMatches, ...directoryMatches, ...rootSafeLinked];
|
|
1310
|
-
}
|
|
1311
|
-
else {
|
|
1312
|
-
const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
|
|
1313
|
-
const matches = await fg(allPatterns, {
|
|
1314
|
-
cwd: root,
|
|
1315
|
-
absolute: true,
|
|
1316
|
-
dot: true,
|
|
1317
|
-
followSymbolicLinks: false,
|
|
1318
|
-
ignore: DEFAULT_PROJECT_FILE_IGNORES,
|
|
1319
|
-
markDirectories: true,
|
|
1320
|
-
onlyFiles: false,
|
|
1321
|
-
...globFilesystemOption(discovery),
|
|
1322
|
-
});
|
|
1323
|
-
const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
|
|
1324
|
-
markDirectories: true,
|
|
1325
|
-
onlyFiles: false,
|
|
1326
|
-
...(options?.knownSymlinkDirectories !== undefined
|
|
1327
|
-
? { knownSymlinkDirectories: options.knownSymlinkDirectories }
|
|
1328
|
-
: {}),
|
|
1329
|
-
...(options?.onSymlinkDirectoriesDiscovered
|
|
1330
|
-
? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
|
|
1331
|
-
: {}),
|
|
1332
|
-
...(reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}),
|
|
1333
|
-
...globFilesystemField(discovery),
|
|
1334
|
-
});
|
|
1335
|
-
rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => (match.endsWith("/") ? match.slice(0, -1) : match)), realRoot, reportMetadataFileChecks);
|
|
1336
|
-
}
|
|
1337
|
-
const entries = [];
|
|
1338
|
-
const matchTasks = rootSafeMatches.map(async (cleanMatch) => {
|
|
1339
|
-
const stats = await fsp.stat(cleanMatch);
|
|
1340
|
-
const isDir = stats.isDirectory();
|
|
1341
|
-
const fileName = path.basename(cleanMatch);
|
|
1342
|
-
for (let definitionIndex = 0; definitionIndex < PROJECT_FILE_DEFINITIONS.length; definitionIndex++) {
|
|
1343
|
-
const def = PROJECT_FILE_DEFINITIONS[definitionIndex];
|
|
1344
|
-
if (isDir && def.kind !== "dir")
|
|
1345
|
-
continue;
|
|
1346
|
-
if (!isDir && def.kind !== "file")
|
|
1347
|
-
continue;
|
|
1348
|
-
const matchesPattern = matchesDefinition(fileName, definitionIndex);
|
|
1349
|
-
if (matchesPattern) {
|
|
1350
|
-
entries.push(await buildProjectFileInfo(def, cleanMatch, discovery));
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1354
|
-
await Promise.all(matchTasks);
|
|
1355
|
-
const byKey = new Map();
|
|
1356
|
-
for (const entry of entries) {
|
|
1357
|
-
const key = `${entry.path}::${entry.type}::${entry.role}`;
|
|
1358
|
-
const existing = byKey.get(key);
|
|
1359
|
-
if (!existing || (!existing.name && entry.name)) {
|
|
1360
|
-
byKey.set(key, entry);
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
return Array.from(byKey.values()).sort((a, b) => {
|
|
1364
|
-
if (a.path === b.path)
|
|
1365
|
-
return a.type.localeCompare(b.type);
|
|
1366
|
-
return a.path.localeCompare(b.path);
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
catch (error) {
|
|
1370
|
-
logWithLevel(options?.logLevel, "debug", `discoverProjectFiles failed for ${root}: ${stringifyUnknown(error)}`);
|
|
1371
|
-
throw new Error(`Failed to discover project files in ${root}: ${stringifyUnknown(error)}`);
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
async function addGitExcludeFiles(files, repositoryRoot, gitCache) {
|
|
1375
|
-
const excludes = await listGitExcludeFiles(repositoryRoot, gitExcludeListOptions(gitCache));
|
|
1376
|
-
for (const source of excludes) {
|
|
1377
|
-
files.add(normalizePath(source.file));
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
async function collectAncestorGitignoreFiles(fromDir, stopDir) {
|
|
1381
|
-
const files = [];
|
|
1382
|
-
let current = normalizePath(fromDir);
|
|
1383
|
-
const stopKey = fileIdentityKey(stopDir);
|
|
1384
|
-
while (true) {
|
|
1385
|
-
const hit = await gitignoreFileIfPresent(current);
|
|
1386
|
-
if (hit)
|
|
1387
|
-
files.push(hit);
|
|
1388
|
-
if (fileIdentityKey(current) === stopKey)
|
|
1389
|
-
break;
|
|
1390
|
-
const parent = normalizePath(path.dirname(current));
|
|
1391
|
-
if (parent === current)
|
|
1392
|
-
break;
|
|
1393
|
-
if (!isFilePathWithinRoot(stopDir, parent) && fileIdentityKey(parent) !== stopKey)
|
|
1394
|
-
break;
|
|
1395
|
-
current = parent;
|
|
1396
|
-
}
|
|
1397
|
-
return files;
|
|
1398
|
-
}
|
|
1399
|
-
async function addGitignoreFilesForRoots(files, roots, state, scanned) {
|
|
1400
|
-
for (const ignoreRoot of roots) {
|
|
1401
|
-
const key = fileIdentityKey(ignoreRoot);
|
|
1402
|
-
if (scanned.has(key))
|
|
1403
|
-
continue;
|
|
1404
|
-
scanned.add(key);
|
|
1405
|
-
for (const file of await findGitignoreFiles(ignoreRoot, state)) {
|
|
1406
|
-
files.add(normalizePath(file));
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
export async function collectConfigHashInputFiles(projectRoot, discoveryContext, logLevel, callbacks) {
|
|
1411
|
-
const root = await ensureDirectoryReadable(projectRoot, "Project root");
|
|
1412
|
-
const state = discoveryContext;
|
|
1413
|
-
const files = new Set(await listRootConfigFiles(root, state));
|
|
1414
|
-
const gitCache = discoveryContext.git;
|
|
1415
|
-
const gitCandidates = await getSharedGitCandidates(discoveryContext, root, logLevel, callbacks);
|
|
1416
|
-
if (gitCandidates) {
|
|
1417
|
-
for (const source of gitCandidates.gitignoreFiles) {
|
|
1418
|
-
files.add(normalizePath(source.file));
|
|
1419
|
-
}
|
|
1420
|
-
return { files: Array.from(files).sort() };
|
|
1421
|
-
}
|
|
1422
|
-
const realRoot = normalizePath(await fsp.realpath(root));
|
|
1423
|
-
const gitRootCandidate = (await isGitRepo(root, gitCache)) ? root : realRoot;
|
|
1424
|
-
if (!(await isGitRepo(gitRootCandidate, gitCache))) {
|
|
1425
|
-
await addGitignoreFilesForRoots(files, [root], state, new Set());
|
|
1426
|
-
return { files: Array.from(files).sort() };
|
|
1427
|
-
}
|
|
1428
|
-
if (await isGitProjectRootIgnored(realRoot, gitCache)) {
|
|
1429
|
-
const scanned = new Set();
|
|
1430
|
-
await addGitignoreFilesForRoots(files, [root], state, scanned);
|
|
1431
|
-
const gitRoot = await getGitRepositoryRoot(gitRootCandidate);
|
|
1432
|
-
if (gitRoot) {
|
|
1433
|
-
await addGitExcludeFiles(files, gitRoot, gitCache);
|
|
1434
|
-
const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
|
|
1435
|
-
await addGitignoreFilesForRoots(files, [gitRoot, ...submoduleDirectories], state, scanned);
|
|
1436
|
-
for (const submodule of submoduleDirectories) {
|
|
1437
|
-
await addGitExcludeFiles(files, submodule, gitCache);
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
return { files: Array.from(files).sort() };
|
|
1441
|
-
}
|
|
1442
|
-
const gitRoot = await getGitRepositoryRoot(gitRootCandidate);
|
|
1443
|
-
if (gitRoot) {
|
|
1444
|
-
for (const file of await collectAncestorGitignoreFiles(root, gitRoot)) {
|
|
1445
|
-
files.add(normalizePath(file));
|
|
1446
|
-
}
|
|
1447
|
-
await addGitExcludeFiles(files, gitRoot, gitCache);
|
|
1448
|
-
const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
|
|
1449
|
-
for (const submodule of submoduleDirectories) {
|
|
1450
|
-
await addGitExcludeFiles(files, submodule, gitCache);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
return {
|
|
1454
|
-
files: Array.from(files).sort(),
|
|
1455
|
-
error: "Failed to enumerate config files: Git listing unavailable",
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
//# sourceMappingURL=projectFiles.js.map
|