@lzehrung/codegraph 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +448 -0
- package/THIRD_PARTY_NOTICES +77 -0
- package/codegraph-skill/codegraph/SKILL.md +262 -0
- package/dist/agent/artifact.d.ts +65 -0
- package/dist/agent/artifact.d.ts.map +1 -0
- package/dist/agent/artifact.js +616 -0
- package/dist/agent/artifact.js.map +1 -0
- package/dist/agent/bounds.d.ts +12 -0
- package/dist/agent/bounds.d.ts.map +1 -0
- package/dist/agent/bounds.js +25 -0
- package/dist/agent/bounds.js.map +1 -0
- package/dist/agent/callHierarchy.d.ts +28 -0
- package/dist/agent/callHierarchy.d.ts.map +1 -0
- package/dist/agent/callHierarchy.js +82 -0
- package/dist/agent/callHierarchy.js.map +1 -0
- package/dist/agent/explain.d.ts +136 -0
- package/dist/agent/explain.d.ts.map +1 -0
- package/dist/agent/explain.js +743 -0
- package/dist/agent/explain.js.map +1 -0
- package/dist/agent/explore.d.ts +67 -0
- package/dist/agent/explore.d.ts.map +1 -0
- package/dist/agent/explore.js +474 -0
- package/dist/agent/explore.js.map +1 -0
- package/dist/agent/fileView.d.ts +55 -0
- package/dist/agent/fileView.d.ts.map +1 -0
- package/dist/agent/fileView.js +528 -0
- package/dist/agent/fileView.js.map +1 -0
- package/dist/agent/followUps.d.ts +9 -0
- package/dist/agent/followUps.d.ts.map +1 -0
- package/dist/agent/followUps.js +164 -0
- package/dist/agent/followUps.js.map +1 -0
- package/dist/agent/handles.d.ts +29 -0
- package/dist/agent/handles.d.ts.map +1 -0
- package/dist/agent/handles.js +103 -0
- package/dist/agent/handles.js.map +1 -0
- package/dist/agent/normalize.d.ts +19 -0
- package/dist/agent/normalize.d.ts.map +1 -0
- package/dist/agent/normalize.js +45 -0
- package/dist/agent/normalize.js.map +1 -0
- package/dist/agent/orient.d.ts +55 -0
- package/dist/agent/orient.d.ts.map +1 -0
- package/dist/agent/orient.js +307 -0
- package/dist/agent/orient.js.map +1 -0
- package/dist/agent/packet.d.ts +28 -0
- package/dist/agent/packet.d.ts.map +1 -0
- package/dist/agent/packet.js +138 -0
- package/dist/agent/packet.js.map +1 -0
- package/dist/agent/query-index/candidates.d.ts +4 -0
- package/dist/agent/query-index/candidates.d.ts.map +1 -0
- package/dist/agent/query-index/candidates.js +89 -0
- package/dist/agent/query-index/candidates.js.map +1 -0
- package/dist/agent/query-index/content.d.ts +36 -0
- package/dist/agent/query-index/content.d.ts.map +1 -0
- package/dist/agent/query-index/content.js +124 -0
- package/dist/agent/query-index/content.js.map +1 -0
- package/dist/agent/query-index/paths.d.ts +12 -0
- package/dist/agent/query-index/paths.d.ts.map +1 -0
- package/dist/agent/query-index/paths.js +41 -0
- package/dist/agent/query-index/paths.js.map +1 -0
- package/dist/agent/query-index/queryIndexWorker.d.ts +8 -0
- package/dist/agent/query-index/queryIndexWorker.d.ts.map +1 -0
- package/dist/agent/query-index/queryIndexWorker.js +11 -0
- package/dist/agent/query-index/queryIndexWorker.js.map +1 -0
- package/dist/agent/query-index/schema.d.ts +26 -0
- package/dist/agent/query-index/schema.d.ts.map +1 -0
- package/dist/agent/query-index/schema.js +171 -0
- package/dist/agent/query-index/schema.js.map +1 -0
- package/dist/agent/query-index/sessionStore.d.ts +5 -0
- package/dist/agent/query-index/sessionStore.d.ts.map +1 -0
- package/dist/agent/query-index/sessionStore.js +53 -0
- package/dist/agent/query-index/sessionStore.js.map +1 -0
- package/dist/agent/query-index/sourceIdentity.d.ts +3 -0
- package/dist/agent/query-index/sourceIdentity.d.ts.map +1 -0
- package/dist/agent/query-index/sourceIdentity.js +12 -0
- package/dist/agent/query-index/sourceIdentity.js.map +1 -0
- package/dist/agent/query-index/store.d.ts +48 -0
- package/dist/agent/query-index/store.d.ts.map +1 -0
- package/dist/agent/query-index/store.js +372 -0
- package/dist/agent/query-index/store.js.map +1 -0
- package/dist/agent/query-index/update.d.ts +9 -0
- package/dist/agent/query-index/update.d.ts.map +1 -0
- package/dist/agent/query-index/update.js +309 -0
- package/dist/agent/query-index/update.js.map +1 -0
- package/dist/agent/query-index/workerPool.d.ts +5 -0
- package/dist/agent/query-index/workerPool.d.ts.map +1 -0
- package/dist/agent/query-index/workerPool.js +82 -0
- package/dist/agent/query-index/workerPool.js.map +1 -0
- package/dist/agent/refactorPlan.d.ts +40 -0
- package/dist/agent/refactorPlan.d.ts.map +1 -0
- package/dist/agent/refactorPlan.js +234 -0
- package/dist/agent/refactorPlan.js.map +1 -0
- package/dist/agent/renamePreview.d.ts +60 -0
- package/dist/agent/renamePreview.d.ts.map +1 -0
- package/dist/agent/renamePreview.js +1008 -0
- package/dist/agent/renamePreview.js.map +1 -0
- package/dist/agent/search.d.ts +77 -0
- package/dist/agent/search.d.ts.map +1 -0
- package/dist/agent/search.js +1002 -0
- package/dist/agent/search.js.map +1 -0
- package/dist/agent/semantic.d.ts +35 -0
- package/dist/agent/semantic.d.ts.map +1 -0
- package/dist/agent/semantic.js +2 -0
- package/dist/agent/semantic.js.map +1 -0
- package/dist/agent/semanticSymbols.d.ts +16 -0
- package/dist/agent/semanticSymbols.d.ts.map +1 -0
- package/dist/agent/semanticSymbols.js +96 -0
- package/dist/agent/semanticSymbols.js.map +1 -0
- package/dist/agent/session.d.ts +71 -0
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/agent/session.js +432 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/sessionLifecycle.d.ts +5 -0
- package/dist/agent/sessionLifecycle.d.ts.map +1 -0
- package/dist/agent/sessionLifecycle.js +18 -0
- package/dist/agent/sessionLifecycle.js.map +1 -0
- package/dist/agent/shell.d.ts +2 -0
- package/dist/agent/shell.d.ts.map +1 -0
- package/dist/agent/shell.js +6 -0
- package/dist/agent/shell.js.map +1 -0
- package/dist/agent/symbolLookup.d.ts +12 -0
- package/dist/agent/symbolLookup.d.ts.map +1 -0
- package/dist/agent/symbolLookup.js +26 -0
- package/dist/agent/symbolLookup.js.map +1 -0
- package/dist/agent/typeHierarchy.d.ts +39 -0
- package/dist/agent/typeHierarchy.d.ts.map +1 -0
- package/dist/agent/typeHierarchy.js +125 -0
- package/dist/agent/typeHierarchy.js.map +1 -0
- package/dist/agent/workspaceSymbols.d.ts +18 -0
- package/dist/agent/workspaceSymbols.d.ts.map +1 -0
- package/dist/agent/workspaceSymbols.js +75 -0
- package/dist/agent/workspaceSymbols.js.map +1 -0
- package/dist/agent-tools.d.ts +280 -0
- package/dist/agent-tools.d.ts.map +1 -0
- package/dist/agent-tools.js +669 -0
- package/dist/agent-tools.js.map +1 -0
- package/dist/agent.d.ts +35 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +19 -0
- package/dist/agent.js.map +1 -0
- package/dist/analysisSummary.d.ts +19 -0
- package/dist/analysisSummary.d.ts.map +1 -0
- package/dist/analysisSummary.js +80 -0
- package/dist/analysisSummary.js.map +1 -0
- package/dist/bin/cli.js +105144 -0
- package/dist/bin/queryIndexWorker.js +3914 -0
- package/dist/bootstrap/treeSitterLanguages.d.ts +5 -0
- package/dist/bootstrap/treeSitterLanguages.d.ts.map +1 -0
- package/dist/bootstrap/treeSitterLanguages.js +41 -0
- package/dist/bootstrap/treeSitterLanguages.js.map +1 -0
- package/dist/chunking/chunkBlocks.d.ts +9 -0
- package/dist/chunking/chunkBlocks.d.ts.map +1 -0
- package/dist/chunking/chunkBlocks.js +60 -0
- package/dist/chunking/chunkBlocks.js.map +1 -0
- package/dist/chunking/chunkFile.d.ts +34 -0
- package/dist/chunking/chunkFile.d.ts.map +1 -0
- package/dist/chunking/chunkFile.js +153 -0
- package/dist/chunking/chunkFile.js.map +1 -0
- package/dist/chunking/chunkId.d.ts +7 -0
- package/dist/chunking/chunkId.d.ts.map +1 -0
- package/dist/chunking/chunkId.js +30 -0
- package/dist/chunking/chunkId.js.map +1 -0
- package/dist/chunking/chunkMatches.d.ts +4 -0
- package/dist/chunking/chunkMatches.d.ts.map +1 -0
- package/dist/chunking/chunkMatches.js +65 -0
- package/dist/chunking/chunkMatches.js.map +1 -0
- package/dist/chunking/chunkMerge.d.ts +4 -0
- package/dist/chunking/chunkMerge.d.ts.map +1 -0
- package/dist/chunking/chunkMerge.js +144 -0
- package/dist/chunking/chunkMerge.js.map +1 -0
- package/dist/chunking/chunkSFC.d.ts +18 -0
- package/dist/chunking/chunkSFC.d.ts.map +1 -0
- package/dist/chunking/chunkSFC.js +165 -0
- package/dist/chunking/chunkSFC.js.map +1 -0
- package/dist/chunking/chunkSplit.d.ts +6 -0
- package/dist/chunking/chunkSplit.d.ts.map +1 -0
- package/dist/chunking/chunkSplit.js +170 -0
- package/dist/chunking/chunkSplit.js.map +1 -0
- package/dist/chunking/chunkTextFile.d.ts +28 -0
- package/dist/chunking/chunkTextFile.d.ts.map +1 -0
- package/dist/chunking/chunkTextFile.js +107 -0
- package/dist/chunking/chunkTextFile.js.map +1 -0
- package/dist/chunking/languageConfig.d.ts +35 -0
- package/dist/chunking/languageConfig.d.ts.map +1 -0
- package/dist/chunking/languageConfig.js +24 -0
- package/dist/chunking/languageConfig.js.map +1 -0
- package/dist/chunking/tokenizer.d.ts +2 -0
- package/dist/chunking/tokenizer.d.ts.map +1 -0
- package/dist/chunking/tokenizer.js +6 -0
- package/dist/chunking/tokenizer.js.map +1 -0
- package/dist/chunking/types.d.ts +54 -0
- package/dist/chunking/types.d.ts.map +1 -0
- package/dist/chunking/types.js +2 -0
- package/dist/chunking/types.js.map +1 -0
- package/dist/cli/affected.d.ts +32 -0
- package/dist/cli/affected.d.ts.map +1 -0
- package/dist/cli/affected.js +235 -0
- package/dist/cli/affected.js.map +1 -0
- package/dist/cli/artifact.d.ts +4 -0
- package/dist/cli/artifact.d.ts.map +1 -0
- package/dist/cli/artifact.js +35 -0
- package/dist/cli/artifact.js.map +1 -0
- package/dist/cli/bootstrap.d.ts +3 -0
- package/dist/cli/bootstrap.d.ts.map +1 -0
- package/dist/cli/bootstrap.js +8 -0
- package/dist/cli/bootstrap.js.map +1 -0
- package/dist/cli/callHierarchy.d.ts +6 -0
- package/dist/cli/callHierarchy.d.ts.map +1 -0
- package/dist/cli/callHierarchy.js +65 -0
- package/dist/cli/callHierarchy.js.map +1 -0
- package/dist/cli/chunk.d.ts +4 -0
- package/dist/cli/chunk.d.ts.map +1 -0
- package/dist/cli/chunk.js +109 -0
- package/dist/cli/chunk.js.map +1 -0
- package/dist/cli/commandCatalog.d.ts +14 -0
- package/dist/cli/commandCatalog.d.ts.map +1 -0
- package/dist/cli/commandCatalog.js +109 -0
- package/dist/cli/commandCatalog.js.map +1 -0
- package/dist/cli/commandTable.d.ts +16 -0
- package/dist/cli/commandTable.d.ts.map +1 -0
- package/dist/cli/commandTable.js +716 -0
- package/dist/cli/commandTable.js.map +1 -0
- package/dist/cli/compileCache.d.ts +17 -0
- package/dist/cli/compileCache.d.ts.map +1 -0
- package/dist/cli/compileCache.js +63 -0
- package/dist/cli/compileCache.js.map +1 -0
- package/dist/cli/context.d.ts +87 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +322 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/discoveryGlobs.d.ts +11 -0
- package/dist/cli/discoveryGlobs.d.ts.map +1 -0
- package/dist/cli/discoveryGlobs.js +74 -0
- package/dist/cli/discoveryGlobs.js.map +1 -0
- package/dist/cli/doctor.d.ts +33 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +143 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/drift.d.ts +18 -0
- package/dist/cli/drift.d.ts.map +1 -0
- package/dist/cli/drift.js +101 -0
- package/dist/cli/drift.js.map +1 -0
- package/dist/cli/duplicateSimilarity.d.ts +10 -0
- package/dist/cli/duplicateSimilarity.d.ts.map +1 -0
- package/dist/cli/duplicateSimilarity.js +20 -0
- package/dist/cli/duplicateSimilarity.js.map +1 -0
- package/dist/cli/duplicates.d.ts +15 -0
- package/dist/cli/duplicates.d.ts.map +1 -0
- package/dist/cli/duplicates.js +400 -0
- package/dist/cli/duplicates.js.map +1 -0
- package/dist/cli/explain.d.ts +4 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +47 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/explore.d.ts +4 -0
- package/dist/cli/explore.d.ts.map +1 -0
- package/dist/cli/explore.js +28 -0
- package/dist/cli/explore.js.map +1 -0
- package/dist/cli/file.d.ts +4 -0
- package/dist/cli/file.d.ts.map +1 -0
- package/dist/cli/file.js +53 -0
- package/dist/cli/file.js.map +1 -0
- package/dist/cli/graph.d.ts +90 -0
- package/dist/cli/graph.d.ts.map +1 -0
- package/dist/cli/graph.js +379 -0
- package/dist/cli/graph.js.map +1 -0
- package/dist/cli/graphDelta.d.ts +24 -0
- package/dist/cli/graphDelta.d.ts.map +1 -0
- package/dist/cli/graphDelta.js +75 -0
- package/dist/cli/graphDelta.js.map +1 -0
- package/dist/cli/graphQueries.d.ts +23 -0
- package/dist/cli/graphQueries.d.ts.map +1 -0
- package/dist/cli/graphQueries.js +257 -0
- package/dist/cli/graphQueries.js.map +1 -0
- package/dist/cli/grep.d.ts +10 -0
- package/dist/cli/grep.d.ts.map +1 -0
- package/dist/cli/grep.js +61 -0
- package/dist/cli/grep.js.map +1 -0
- package/dist/cli/help.d.ts +52 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +749 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/impact.d.ts +24 -0
- package/dist/cli/impact.d.ts.map +1 -0
- package/dist/cli/impact.js +481 -0
- package/dist/cli/impact.js.map +1 -0
- package/dist/cli/index.d.ts +43 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +112 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/indexPolicy.d.ts +36 -0
- package/dist/cli/indexPolicy.d.ts.map +1 -0
- package/dist/cli/indexPolicy.js +168 -0
- package/dist/cli/indexPolicy.js.map +1 -0
- package/dist/cli/inspect.d.ts +30 -0
- package/dist/cli/inspect.d.ts.map +1 -0
- package/dist/cli/inspect.js +323 -0
- package/dist/cli/inspect.js.map +1 -0
- package/dist/cli/install.d.ts +14 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +273 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/invocationContext.d.ts +77 -0
- package/dist/cli/invocationContext.d.ts.map +1 -0
- package/dist/cli/invocationContext.js +357 -0
- package/dist/cli/invocationContext.js.map +1 -0
- package/dist/cli/lifecycle.d.ts +11 -0
- package/dist/cli/lifecycle.d.ts.map +1 -0
- package/dist/cli/lifecycle.js +81 -0
- package/dist/cli/lifecycle.js.map +1 -0
- package/dist/cli/links.d.ts +11 -0
- package/dist/cli/links.d.ts.map +1 -0
- package/dist/cli/links.js +53 -0
- package/dist/cli/links.js.map +1 -0
- package/dist/cli/location.d.ts +5 -0
- package/dist/cli/location.d.ts.map +1 -0
- package/dist/cli/location.js +11 -0
- package/dist/cli/location.js.map +1 -0
- package/dist/cli/mcp.d.ts +7 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +60 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/navigation.d.ts +23 -0
- package/dist/cli/navigation.d.ts.map +1 -0
- package/dist/cli/navigation.js +367 -0
- package/dist/cli/navigation.js.map +1 -0
- package/dist/cli/options.d.ts +21 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +694 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/orient.d.ts +6 -0
- package/dist/cli/orient.d.ts.map +1 -0
- package/dist/cli/orient.js +72 -0
- package/dist/cli/orient.js.map +1 -0
- package/dist/cli/packet.d.ts +4 -0
- package/dist/cli/packet.d.ts.map +1 -0
- package/dist/cli/packet.js +53 -0
- package/dist/cli/packet.js.map +1 -0
- package/dist/cli/pretty.d.ts +9 -0
- package/dist/cli/pretty.d.ts.map +1 -0
- package/dist/cli/pretty.js +91 -0
- package/dist/cli/pretty.js.map +1 -0
- package/dist/cli/progress.d.ts +20 -0
- package/dist/cli/progress.d.ts.map +1 -0
- package/dist/cli/progress.js +156 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/cli/projectFile.d.ts +13 -0
- package/dist/cli/projectFile.d.ts.map +1 -0
- package/dist/cli/projectFile.js +23 -0
- package/dist/cli/projectFile.js.map +1 -0
- package/dist/cli/refactorPlan.d.ts +6 -0
- package/dist/cli/refactorPlan.d.ts.map +1 -0
- package/dist/cli/refactorPlan.js +84 -0
- package/dist/cli/refactorPlan.js.map +1 -0
- package/dist/cli/renamePreview.d.ts +4 -0
- package/dist/cli/renamePreview.d.ts.map +1 -0
- package/dist/cli/renamePreview.js +86 -0
- package/dist/cli/renamePreview.js.map +1 -0
- package/dist/cli/review.d.ts +36 -0
- package/dist/cli/review.d.ts.map +1 -0
- package/dist/cli/review.js +302 -0
- package/dist/cli/review.js.map +1 -0
- package/dist/cli/rootPolicy.d.ts +53 -0
- package/dist/cli/rootPolicy.d.ts.map +1 -0
- package/dist/cli/rootPolicy.js +190 -0
- package/dist/cli/rootPolicy.js.map +1 -0
- package/dist/cli/search.d.ts +8 -0
- package/dist/cli/search.d.ts.map +1 -0
- package/dist/cli/search.js +49 -0
- package/dist/cli/search.js.map +1 -0
- package/dist/cli/skill.d.ts +13 -0
- package/dist/cli/skill.d.ts.map +1 -0
- package/dist/cli/skill.js +227 -0
- package/dist/cli/skill.js.map +1 -0
- package/dist/cli/sql.d.ts +6 -0
- package/dist/cli/sql.d.ts.map +1 -0
- package/dist/cli/sql.js +37 -0
- package/dist/cli/sql.js.map +1 -0
- package/dist/cli/symbols.d.ts +4 -0
- package/dist/cli/symbols.d.ts.map +1 -0
- package/dist/cli/symbols.js +59 -0
- package/dist/cli/symbols.js.map +1 -0
- package/dist/cli/typeHierarchy.d.ts +6 -0
- package/dist/cli/typeHierarchy.d.ts.map +1 -0
- package/dist/cli/typeHierarchy.js +81 -0
- package/dist/cli/typeHierarchy.js.map +1 -0
- package/dist/cli/viewer.d.ts +27 -0
- package/dist/cli/viewer.d.ts.map +1 -0
- package/dist/cli/viewer.js +313 -0
- package/dist/cli/viewer.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +185 -0
- package/dist/cli.js.map +1 -0
- package/dist/cliBootstrap.d.ts +3 -0
- package/dist/cliBootstrap.d.ts.map +1 -0
- package/dist/cliBootstrap.js +10 -0
- package/dist/cliBootstrap.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +141 -0
- package/dist/config.js.map +1 -0
- package/dist/documentLinks/asciidoc.d.ts +3 -0
- package/dist/documentLinks/asciidoc.d.ts.map +1 -0
- package/dist/documentLinks/asciidoc.js +115 -0
- package/dist/documentLinks/asciidoc.js.map +1 -0
- package/dist/documentLinks/check.d.ts +31 -0
- package/dist/documentLinks/check.d.ts.map +1 -0
- package/dist/documentLinks/check.js +272 -0
- package/dist/documentLinks/check.js.map +1 -0
- package/dist/documentLinks/html.d.ts +5 -0
- package/dist/documentLinks/html.d.ts.map +1 -0
- package/dist/documentLinks/html.js +324 -0
- package/dist/documentLinks/html.js.map +1 -0
- package/dist/documentLinks/markdown.d.ts +15 -0
- package/dist/documentLinks/markdown.d.ts.map +1 -0
- package/dist/documentLinks/markdown.js +538 -0
- package/dist/documentLinks/markdown.js.map +1 -0
- package/dist/documentLinks/rst.d.ts +3 -0
- package/dist/documentLinks/rst.d.ts.map +1 -0
- package/dist/documentLinks/rst.js +179 -0
- package/dist/documentLinks/rst.js.map +1 -0
- package/dist/documentLinks/sfc.d.ts +4 -0
- package/dist/documentLinks/sfc.d.ts.map +1 -0
- package/dist/documentLinks/sfc.js +30 -0
- package/dist/documentLinks/sfc.js.map +1 -0
- package/dist/documentLinks/shared.d.ts +11 -0
- package/dist/documentLinks/shared.d.ts.map +1 -0
- package/dist/documentLinks/shared.js +147 -0
- package/dist/documentLinks/shared.js.map +1 -0
- package/dist/documentLinks.d.ts +12 -0
- package/dist/documentLinks.d.ts.map +1 -0
- package/dist/documentLinks.js +50 -0
- package/dist/documentLinks.js.map +1 -0
- package/dist/drift/artifact.d.ts +3 -0
- package/dist/drift/artifact.d.ts.map +1 -0
- package/dist/drift/artifact.js +170 -0
- package/dist/drift/artifact.js.map +1 -0
- package/dist/drift/compare.d.ts +5 -0
- package/dist/drift/compare.d.ts.map +1 -0
- package/dist/drift/compare.js +355 -0
- package/dist/drift/compare.js.map +1 -0
- package/dist/drift/git.d.ts +3 -0
- package/dist/drift/git.d.ts.map +1 -0
- package/dist/drift/git.js +128 -0
- package/dist/drift/git.js.map +1 -0
- package/dist/drift/index.d.ts +8 -0
- package/dist/drift/index.d.ts.map +1 -0
- package/dist/drift/index.js +7 -0
- package/dist/drift/index.js.map +1 -0
- package/dist/drift/languages.d.ts +2 -0
- package/dist/drift/languages.d.ts.map +1 -0
- package/dist/drift/languages.js +18 -0
- package/dist/drift/languages.js.map +1 -0
- package/dist/drift/report.d.ts +6 -0
- package/dist/drift/report.d.ts.map +1 -0
- package/dist/drift/report.js +75 -0
- package/dist/drift/report.js.map +1 -0
- package/dist/drift/snapshot.d.ts +3 -0
- package/dist/drift/snapshot.d.ts.map +1 -0
- package/dist/drift/snapshot.js +164 -0
- package/dist/drift/snapshot.js.map +1 -0
- package/dist/drift/types.d.ts +142 -0
- package/dist/drift/types.d.ts.map +1 -0
- package/dist/drift/types.js +2 -0
- package/dist/drift/types.js.map +1 -0
- package/dist/duplicate-keywords.d.ts +3 -0
- package/dist/duplicate-keywords.d.ts.map +1 -0
- package/dist/duplicate-keywords.js +155 -0
- package/dist/duplicate-keywords.js.map +1 -0
- package/dist/duplicate-token-normalization.d.ts +6 -0
- package/dist/duplicate-token-normalization.d.ts.map +1 -0
- package/dist/duplicate-token-normalization.js +53 -0
- package/dist/duplicate-token-normalization.js.map +1 -0
- package/dist/duplicates/scoring.d.ts +121 -0
- package/dist/duplicates/scoring.d.ts.map +1 -0
- package/dist/duplicates/scoring.js +1245 -0
- package/dist/duplicates/scoring.js.map +1 -0
- package/dist/duplicates/types.d.ts +216 -0
- package/dist/duplicates/types.d.ts.map +1 -0
- package/dist/duplicates/types.js +2 -0
- package/dist/duplicates/types.js.map +1 -0
- package/dist/duplicates/unitCache.d.ts +40 -0
- package/dist/duplicates/unitCache.d.ts.map +1 -0
- package/dist/duplicates/unitCache.js +352 -0
- package/dist/duplicates/unitCache.js.map +1 -0
- package/dist/duplicates/units.d.ts +60 -0
- package/dist/duplicates/units.d.ts.map +1 -0
- package/dist/duplicates/units.js +447 -0
- package/dist/duplicates/units.js.map +1 -0
- package/dist/duplicates.d.ts +14 -0
- package/dist/duplicates.d.ts.map +1 -0
- package/dist/duplicates.js +400 -0
- package/dist/duplicates.js.map +1 -0
- package/dist/duplicatesLeads.d.ts +39 -0
- package/dist/duplicatesLeads.d.ts.map +1 -0
- package/dist/duplicatesLeads.js +112 -0
- package/dist/duplicatesLeads.js.map +1 -0
- package/dist/frameworks/angularjs.d.ts +18 -0
- package/dist/frameworks/angularjs.d.ts.map +1 -0
- package/dist/frameworks/angularjs.js +427 -0
- package/dist/frameworks/angularjs.js.map +1 -0
- package/dist/graph-builder.d.ts +35 -0
- package/dist/graph-builder.d.ts.map +1 -0
- package/dist/graph-builder.js +132 -0
- package/dist/graph-builder.js.map +1 -0
- package/dist/graph-edge-collector.d.ts +57 -0
- package/dist/graph-edge-collector.d.ts.map +1 -0
- package/dist/graph-edge-collector.js +199 -0
- package/dist/graph-edge-collector.js.map +1 -0
- package/dist/graphs/adjacency.d.ts +10 -0
- package/dist/graphs/adjacency.d.ts.map +1 -0
- package/dist/graphs/adjacency.js +38 -0
- package/dist/graphs/adjacency.js.map +1 -0
- package/dist/graphs/angularjs.d.ts +5 -0
- package/dist/graphs/angularjs.d.ts.map +1 -0
- package/dist/graphs/angularjs.js +88 -0
- package/dist/graphs/angularjs.js.map +1 -0
- package/dist/graphs/cycles.d.ts +24 -0
- package/dist/graphs/cycles.d.ts.map +1 -0
- package/dist/graphs/cycles.js +159 -0
- package/dist/graphs/cycles.js.map +1 -0
- package/dist/graphs/edgeResolution.d.ts +25 -0
- package/dist/graphs/edgeResolution.d.ts.map +1 -0
- package/dist/graphs/edgeResolution.js +97 -0
- package/dist/graphs/edgeResolution.js.map +1 -0
- package/dist/graphs/external/cache.d.ts +6 -0
- package/dist/graphs/external/cache.d.ts.map +1 -0
- package/dist/graphs/external/cache.js +21 -0
- package/dist/graphs/external/cache.js.map +1 -0
- package/dist/graphs/external/context.d.ts +9 -0
- package/dist/graphs/external/context.d.ts.map +1 -0
- package/dist/graphs/external/context.js +93 -0
- package/dist/graphs/external/context.js.map +1 -0
- package/dist/graphs/external/manifests.d.ts +8 -0
- package/dist/graphs/external/manifests.d.ts.map +1 -0
- package/dist/graphs/external/manifests.js +429 -0
- package/dist/graphs/external/manifests.js.map +1 -0
- package/dist/graphs/external/stdlib.d.ts +3 -0
- package/dist/graphs/external/stdlib.d.ts.map +1 -0
- package/dist/graphs/external/stdlib.js +166 -0
- package/dist/graphs/external/stdlib.js.map +1 -0
- package/dist/graphs/external-classifier.d.ts +16 -0
- package/dist/graphs/external-classifier.d.ts.map +1 -0
- package/dist/graphs/external-classifier.js +46 -0
- package/dist/graphs/external-classifier.js.map +1 -0
- package/dist/graphs/grep.d.ts +66 -0
- package/dist/graphs/grep.d.ts.map +1 -0
- package/dist/graphs/grep.js +131 -0
- package/dist/graphs/grep.js.map +1 -0
- package/dist/graphs/hotspots.d.ts +13 -0
- package/dist/graphs/hotspots.d.ts.map +1 -0
- package/dist/graphs/hotspots.js +88 -0
- package/dist/graphs/hotspots.js.map +1 -0
- package/dist/graphs/limits.d.ts +2 -0
- package/dist/graphs/limits.d.ts.map +1 -0
- package/dist/graphs/limits.js +7 -0
- package/dist/graphs/limits.js.map +1 -0
- package/dist/graphs/queries.d.ts +4 -0
- package/dist/graphs/queries.d.ts.map +1 -0
- package/dist/graphs/queries.js +4 -0
- package/dist/graphs/queries.js.map +1 -0
- package/dist/graphs/render.d.ts +6 -0
- package/dist/graphs/render.d.ts.map +1 -0
- package/dist/graphs/render.js +85 -0
- package/dist/graphs/render.js.map +1 -0
- package/dist/graphs/specifiers.d.ts +24 -0
- package/dist/graphs/specifiers.d.ts.map +1 -0
- package/dist/graphs/specifiers.js +434 -0
- package/dist/graphs/specifiers.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/ast.d.ts +25 -0
- package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/ast.js +167 -0
- package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts +30 -0
- package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/edgePasses.js +484 -0
- package/dist/graphs/symbol-graph-detailed/edgePasses.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/importAliases.d.ts +10 -0
- package/dist/graphs/symbol-graph-detailed/importAliases.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/importAliases.js +44 -0
- package/dist/graphs/symbol-graph-detailed/importAliases.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed/memberChains.d.ts +17 -0
- package/dist/graphs/symbol-graph-detailed/memberChains.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed/memberChains.js +30 -0
- package/dist/graphs/symbol-graph-detailed/memberChains.js.map +1 -0
- package/dist/graphs/symbol-graph-detailed.d.ts +14 -0
- package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -0
- package/dist/graphs/symbol-graph-detailed.js +180 -0
- package/dist/graphs/symbol-graph-detailed.js.map +1 -0
- package/dist/graphs/symbol-graph.d.ts +56 -0
- package/dist/graphs/symbol-graph.d.ts.map +1 -0
- package/dist/graphs/symbol-graph.js +180 -0
- package/dist/graphs/symbol-graph.js.map +1 -0
- package/dist/graphs/symbol-render.d.ts +22 -0
- package/dist/graphs/symbol-render.d.ts.map +1 -0
- package/dist/graphs/symbol-render.js +184 -0
- package/dist/graphs/symbol-render.js.map +1 -0
- package/dist/graphs/traversal.d.ts +20 -0
- package/dist/graphs/traversal.d.ts.map +1 -0
- package/dist/graphs/traversal.js +75 -0
- package/dist/graphs/traversal.js.map +1 -0
- package/dist/graphs/types.d.ts +18 -0
- package/dist/graphs/types.d.ts.map +1 -0
- package/dist/graphs/types.js +2 -0
- package/dist/graphs/types.js.map +1 -0
- package/dist/graphs/unresolved.d.ts +13 -0
- package/dist/graphs/unresolved.d.ts.map +1 -0
- package/dist/graphs/unresolved.js +47 -0
- package/dist/graphs/unresolved.js.map +1 -0
- package/dist/graphs.d.ts +17 -0
- package/dist/graphs.d.ts.map +1 -0
- package/dist/graphs.js +11 -0
- package/dist/graphs.js.map +1 -0
- package/dist/impact/analyzer.d.ts +8 -0
- package/dist/impact/analyzer.d.ts.map +1 -0
- package/dist/impact/analyzer.js +156 -0
- package/dist/impact/analyzer.js.map +1 -0
- package/dist/impact/budgets.d.ts +36 -0
- package/dist/impact/budgets.d.ts.map +1 -0
- package/dist/impact/budgets.js +178 -0
- package/dist/impact/budgets.js.map +1 -0
- package/dist/impact/call-compatibility/providers/index.d.ts +14 -0
- package/dist/impact/call-compatibility/providers/index.d.ts.map +1 -0
- package/dist/impact/call-compatibility/providers/index.js +58 -0
- package/dist/impact/call-compatibility/providers/index.js.map +1 -0
- package/dist/impact/call-compatibility/providers/types.d.ts +26 -0
- package/dist/impact/call-compatibility/providers/types.d.ts.map +1 -0
- package/dist/impact/call-compatibility/providers/types.js +2 -0
- package/dist/impact/call-compatibility/providers/types.js.map +1 -0
- package/dist/impact/call-compatibility/types.d.ts +24 -0
- package/dist/impact/call-compatibility/types.d.ts.map +1 -0
- package/dist/impact/call-compatibility/types.js +2 -0
- package/dist/impact/call-compatibility/types.js.map +1 -0
- package/dist/impact/callCompatibility.d.ts +17 -0
- package/dist/impact/callCompatibility.d.ts.map +1 -0
- package/dist/impact/callCompatibility.js +1546 -0
- package/dist/impact/callCompatibility.js.map +1 -0
- package/dist/impact/collect.d.ts +27 -0
- package/dist/impact/collect.d.ts.map +1 -0
- package/dist/impact/collect.js +97 -0
- package/dist/impact/collect.js.map +1 -0
- package/dist/impact/context.d.ts +42 -0
- package/dist/impact/context.d.ts.map +1 -0
- package/dist/impact/context.js +286 -0
- package/dist/impact/context.js.map +1 -0
- package/dist/impact/direct.d.ts +26 -0
- package/dist/impact/direct.d.ts.map +1 -0
- package/dist/impact/direct.js +187 -0
- package/dist/impact/direct.js.map +1 -0
- package/dist/impact/hunks.d.ts +14 -0
- package/dist/impact/hunks.d.ts.map +1 -0
- package/dist/impact/hunks.js +87 -0
- package/dist/impact/hunks.js.map +1 -0
- package/dist/impact/index.d.ts +22 -0
- package/dist/impact/index.d.ts.map +1 -0
- package/dist/impact/index.js +27 -0
- package/dist/impact/index.js.map +1 -0
- package/dist/impact/map.d.ts +12 -0
- package/dist/impact/map.d.ts.map +1 -0
- package/dist/impact/map.js +753 -0
- package/dist/impact/map.js.map +1 -0
- package/dist/impact/memberResolutionCoverage.d.ts +14 -0
- package/dist/impact/memberResolutionCoverage.d.ts.map +1 -0
- package/dist/impact/memberResolutionCoverage.js +38 -0
- package/dist/impact/memberResolutionCoverage.js.map +1 -0
- package/dist/impact/parse.d.ts +5 -0
- package/dist/impact/parse.d.ts.map +1 -0
- package/dist/impact/parse.js +239 -0
- package/dist/impact/parse.js.map +1 -0
- package/dist/impact/path.d.ts +14 -0
- package/dist/impact/path.d.ts.map +1 -0
- package/dist/impact/path.js +103 -0
- package/dist/impact/path.js.map +1 -0
- package/dist/impact/providers/base.d.ts +10 -0
- package/dist/impact/providers/base.d.ts.map +1 -0
- package/dist/impact/providers/base.js +239 -0
- package/dist/impact/providers/base.js.map +1 -0
- package/dist/impact/referenceCache.d.ts +12 -0
- package/dist/impact/referenceCache.d.ts.map +1 -0
- package/dist/impact/referenceCache.js +101 -0
- package/dist/impact/referenceCache.js.map +1 -0
- package/dist/impact/report-suggestions.d.ts +4 -0
- package/dist/impact/report-suggestions.d.ts.map +1 -0
- package/dist/impact/report-suggestions.js +886 -0
- package/dist/impact/report-suggestions.js.map +1 -0
- package/dist/impact/report.d.ts +8 -0
- package/dist/impact/report.d.ts.map +1 -0
- package/dist/impact/report.js +405 -0
- package/dist/impact/report.js.map +1 -0
- package/dist/impact/reportCompact.d.ts +8 -0
- package/dist/impact/reportCompact.d.ts.map +1 -0
- package/dist/impact/reportCompact.js +145 -0
- package/dist/impact/reportCompact.js.map +1 -0
- package/dist/impact/reportFull.d.ts +10 -0
- package/dist/impact/reportFull.d.ts.map +1 -0
- package/dist/impact/reportFull.js +66 -0
- package/dist/impact/reportFull.js.map +1 -0
- package/dist/impact/reportParts.d.ts +42 -0
- package/dist/impact/reportParts.d.ts.map +1 -0
- package/dist/impact/reportParts.js +2 -0
- package/dist/impact/reportParts.js.map +1 -0
- package/dist/impact/reportShared.d.ts +76 -0
- package/dist/impact/reportShared.d.ts.map +1 -0
- package/dist/impact/reportShared.js +130 -0
- package/dist/impact/reportShared.js.map +1 -0
- package/dist/impact/severity.d.ts +29 -0
- package/dist/impact/severity.d.ts.map +1 -0
- package/dist/impact/severity.js +178 -0
- package/dist/impact/severity.js.map +1 -0
- package/dist/impact/signature-node-utils.d.ts +5 -0
- package/dist/impact/signature-node-utils.d.ts.map +1 -0
- package/dist/impact/signature-node-utils.js +29 -0
- package/dist/impact/signature-node-utils.js.map +1 -0
- package/dist/impact/streaming.d.ts +60 -0
- package/dist/impact/streaming.d.ts.map +1 -0
- package/dist/impact/streaming.js +285 -0
- package/dist/impact/streaming.js.map +1 -0
- package/dist/impact/suggestions.d.ts +4 -0
- package/dist/impact/suggestions.d.ts.map +1 -0
- package/dist/impact/suggestions.js +317 -0
- package/dist/impact/suggestions.js.map +1 -0
- package/dist/impact/testPatterns.d.ts +6 -0
- package/dist/impact/testPatterns.d.ts.map +1 -0
- package/dist/impact/testPatterns.js +65 -0
- package/dist/impact/testPatterns.js.map +1 -0
- package/dist/impact/transitive.d.ts +12 -0
- package/dist/impact/transitive.d.ts.map +1 -0
- package/dist/impact/transitive.js +188 -0
- package/dist/impact/transitive.js.map +1 -0
- package/dist/impact/types.d.ts +556 -0
- package/dist/impact/types.d.ts.map +1 -0
- package/dist/impact/types.js +17 -0
- package/dist/impact/types.js.map +1 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer/build-cache/manifest.d.ts +48 -0
- package/dist/indexer/build-cache/manifest.d.ts.map +1 -0
- package/dist/indexer/build-cache/manifest.js +228 -0
- package/dist/indexer/build-cache/manifest.js.map +1 -0
- package/dist/indexer/build-cache/module-cache.d.ts +20 -0
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -0
- package/dist/indexer/build-cache/module-cache.js +339 -0
- package/dist/indexer/build-cache/module-cache.js.map +1 -0
- package/dist/indexer/build-cache/options.d.ts +50 -0
- package/dist/indexer/build-cache/options.d.ts.map +1 -0
- package/dist/indexer/build-cache/options.js +276 -0
- package/dist/indexer/build-cache/options.js.map +1 -0
- package/dist/indexer/build-cache/project-snapshot.d.ts +30 -0
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -0
- package/dist/indexer/build-cache/project-snapshot.js +928 -0
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -0
- package/dist/indexer/build-cache/reports.d.ts +13 -0
- package/dist/indexer/build-cache/reports.d.ts.map +1 -0
- package/dist/indexer/build-cache/reports.js +134 -0
- package/dist/indexer/build-cache/reports.js.map +1 -0
- package/dist/indexer/build-cache.d.ts +6 -0
- package/dist/indexer/build-cache.d.ts.map +1 -0
- package/dist/indexer/build-cache.js +6 -0
- package/dist/indexer/build-cache.js.map +1 -0
- package/dist/indexer/build-index.d.ts +28 -0
- package/dist/indexer/build-index.d.ts.map +1 -0
- package/dist/indexer/build-index.js +1579 -0
- package/dist/indexer/build-index.js.map +1 -0
- package/dist/indexer/build-manifest.d.ts +16 -0
- package/dist/indexer/build-manifest.d.ts.map +1 -0
- package/dist/indexer/build-manifest.js +43 -0
- package/dist/indexer/build-manifest.js.map +1 -0
- package/dist/indexer/build-workers.d.ts +27 -0
- package/dist/indexer/build-workers.d.ts.map +1 -0
- package/dist/indexer/build-workers.js +209 -0
- package/dist/indexer/build-workers.js.map +1 -0
- package/dist/indexer/call-hierarchy.d.ts +33 -0
- package/dist/indexer/call-hierarchy.d.ts.map +1 -0
- package/dist/indexer/call-hierarchy.js +192 -0
- package/dist/indexer/call-hierarchy.js.map +1 -0
- package/dist/indexer/declarations.d.ts +15 -0
- package/dist/indexer/declarations.d.ts.map +1 -0
- package/dist/indexer/declarations.js +95 -0
- package/dist/indexer/declarations.js.map +1 -0
- package/dist/indexer/finalize.d.ts +20 -0
- package/dist/indexer/finalize.d.ts.map +1 -0
- package/dist/indexer/finalize.js +34 -0
- package/dist/indexer/finalize.js.map +1 -0
- package/dist/indexer/import-types.d.ts +48 -0
- package/dist/indexer/import-types.d.ts.map +1 -0
- package/dist/indexer/import-types.js +2 -0
- package/dist/indexer/import-types.js.map +1 -0
- package/dist/indexer/imports/context.d.ts +7 -0
- package/dist/indexer/imports/context.d.ts.map +1 -0
- package/dist/indexer/imports/context.js +2 -0
- package/dist/indexer/imports/context.js.map +1 -0
- package/dist/indexer/imports/graphOnly.d.ts +13 -0
- package/dist/indexer/imports/graphOnly.d.ts.map +1 -0
- package/dist/indexer/imports/graphOnly.js +40 -0
- package/dist/indexer/imports/graphOnly.js.map +1 -0
- package/dist/indexer/imports/jsTextImports.d.ts +9 -0
- package/dist/indexer/imports/jsTextImports.d.ts.map +1 -0
- package/dist/indexer/imports/jsTextImports.js +173 -0
- package/dist/indexer/imports/jsTextImports.js.map +1 -0
- package/dist/indexer/imports/languageSpecific.d.ts +26 -0
- package/dist/indexer/imports/languageSpecific.d.ts.map +1 -0
- package/dist/indexer/imports/languageSpecific.js +444 -0
- package/dist/indexer/imports/languageSpecific.js.map +1 -0
- package/dist/indexer/imports/nativeCaptures.d.ts +16 -0
- package/dist/indexer/imports/nativeCaptures.d.ts.map +1 -0
- package/dist/indexer/imports/nativeCaptures.js +139 -0
- package/dist/indexer/imports/nativeCaptures.js.map +1 -0
- package/dist/indexer/imports/python.d.ts +8 -0
- package/dist/indexer/imports/python.d.ts.map +1 -0
- package/dist/indexer/imports/python.js +116 -0
- package/dist/indexer/imports/python.js.map +1 -0
- package/dist/indexer/imports.d.ts +21 -0
- package/dist/indexer/imports.d.ts.map +1 -0
- package/dist/indexer/imports.js +188 -0
- package/dist/indexer/imports.js.map +1 -0
- package/dist/indexer/incremental-plan.d.ts +71 -0
- package/dist/indexer/incremental-plan.d.ts.map +1 -0
- package/dist/indexer/incremental-plan.js +212 -0
- package/dist/indexer/incremental-plan.js.map +1 -0
- package/dist/indexer/load-current-index.d.ts +51 -0
- package/dist/indexer/load-current-index.d.ts.map +1 -0
- package/dist/indexer/load-current-index.js +53 -0
- package/dist/indexer/load-current-index.js.map +1 -0
- package/dist/indexer/locals-and-exports.d.ts +12 -0
- package/dist/indexer/locals-and-exports.d.ts.map +1 -0
- package/dist/indexer/locals-and-exports.js +872 -0
- package/dist/indexer/locals-and-exports.js.map +1 -0
- package/dist/indexer/navigation-goto.d.ts +13 -0
- package/dist/indexer/navigation-goto.d.ts.map +1 -0
- package/dist/indexer/navigation-goto.js +548 -0
- package/dist/indexer/navigation-goto.js.map +1 -0
- package/dist/indexer/navigation-local.d.ts +13 -0
- package/dist/indexer/navigation-local.d.ts.map +1 -0
- package/dist/indexer/navigation-local.js +173 -0
- package/dist/indexer/navigation-local.js.map +1 -0
- package/dist/indexer/navigation-php.d.ts +7 -0
- package/dist/indexer/navigation-php.d.ts.map +1 -0
- package/dist/indexer/navigation-php.js +90 -0
- package/dist/indexer/navigation-php.js.map +1 -0
- package/dist/indexer/navigation-provenance.d.ts +14 -0
- package/dist/indexer/navigation-provenance.d.ts.map +1 -0
- package/dist/indexer/navigation-provenance.js +26 -0
- package/dist/indexer/navigation-provenance.js.map +1 -0
- package/dist/indexer/navigation-references.d.ts +30 -0
- package/dist/indexer/navigation-references.d.ts.map +1 -0
- package/dist/indexer/navigation-references.js +299 -0
- package/dist/indexer/navigation-references.js.map +1 -0
- package/dist/indexer/navigation-resolve.d.ts +12 -0
- package/dist/indexer/navigation-resolve.d.ts.map +1 -0
- package/dist/indexer/navigation-resolve.js +389 -0
- package/dist/indexer/navigation-resolve.js.map +1 -0
- package/dist/indexer/navigation.d.ts +19 -0
- package/dist/indexer/navigation.d.ts.map +1 -0
- package/dist/indexer/navigation.js +468 -0
- package/dist/indexer/navigation.js.map +1 -0
- package/dist/indexer/parse-context.d.ts +47 -0
- package/dist/indexer/parse-context.d.ts.map +1 -0
- package/dist/indexer/parse-context.js +127 -0
- package/dist/indexer/parse-context.js.map +1 -0
- package/dist/indexer/parsed-cache.d.ts +6 -0
- package/dist/indexer/parsed-cache.d.ts.map +1 -0
- package/dist/indexer/parsed-cache.js +32 -0
- package/dist/indexer/parsed-cache.js.map +1 -0
- package/dist/indexer/reference-candidate-types.d.ts +5 -0
- package/dist/indexer/reference-candidate-types.d.ts.map +1 -0
- package/dist/indexer/reference-candidate-types.js +2 -0
- package/dist/indexer/reference-candidate-types.js.map +1 -0
- package/dist/indexer/reference-candidates.d.ts +6 -0
- package/dist/indexer/reference-candidates.d.ts.map +1 -0
- package/dist/indexer/reference-candidates.js +28 -0
- package/dist/indexer/reference-candidates.js.map +1 -0
- package/dist/indexer/reference-context.d.ts +13 -0
- package/dist/indexer/reference-context.d.ts.map +1 -0
- package/dist/indexer/reference-context.js +103 -0
- package/dist/indexer/reference-context.js.map +1 -0
- package/dist/indexer/scope-types.d.ts +25 -0
- package/dist/indexer/scope-types.d.ts.map +1 -0
- package/dist/indexer/scope-types.js +2 -0
- package/dist/indexer/scope-types.js.map +1 -0
- package/dist/indexer/scope.d.ts +11 -0
- package/dist/indexer/scope.d.ts.map +1 -0
- package/dist/indexer/scope.js +424 -0
- package/dist/indexer/scope.js.map +1 -0
- package/dist/indexer/shared.d.ts +4 -0
- package/dist/indexer/shared.d.ts.map +1 -0
- package/dist/indexer/shared.js +9 -0
- package/dist/indexer/shared.js.map +1 -0
- package/dist/indexer/symbols.d.ts +60 -0
- package/dist/indexer/symbols.d.ts.map +1 -0
- package/dist/indexer/symbols.js +272 -0
- package/dist/indexer/symbols.js.map +1 -0
- package/dist/indexer/type-hierarchy.d.ts +52 -0
- package/dist/indexer/type-hierarchy.d.ts.map +1 -0
- package/dist/indexer/type-hierarchy.js +296 -0
- package/dist/indexer/type-hierarchy.js.map +1 -0
- package/dist/indexer/types.d.ts +376 -0
- package/dist/indexer/types.d.ts.map +1 -0
- package/dist/indexer/types.js +15 -0
- package/dist/indexer/types.js.map +1 -0
- package/dist/indexer/workspace-symbols.d.ts +35 -0
- package/dist/indexer/workspace-symbols.d.ts.map +1 -0
- package/dist/indexer/workspace-symbols.js +226 -0
- package/dist/indexer/workspace-symbols.js.map +1 -0
- package/dist/indexer.d.ts +44 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +35 -0
- package/dist/indexer.js.map +1 -0
- package/dist/installer/registry.d.ts +68 -0
- package/dist/installer/registry.d.ts.map +1 -0
- package/dist/installer/registry.js +1208 -0
- package/dist/installer/registry.js.map +1 -0
- package/dist/languages/all.d.ts +28 -0
- package/dist/languages/all.d.ts.map +1 -0
- package/dist/languages/all.js +28 -0
- package/dist/languages/all.js.map +1 -0
- package/dist/languages/definitions/adoc.d.ts +2 -0
- package/dist/languages/definitions/adoc.d.ts.map +1 -0
- package/dist/languages/definitions/adoc.js +5 -0
- package/dist/languages/definitions/adoc.js.map +1 -0
- package/dist/languages/definitions/astro.d.ts +2 -0
- package/dist/languages/definitions/astro.d.ts.map +1 -0
- package/dist/languages/definitions/astro.js +5 -0
- package/dist/languages/definitions/astro.js.map +1 -0
- package/dist/languages/definitions/c.d.ts +2 -0
- package/dist/languages/definitions/c.d.ts.map +1 -0
- package/dist/languages/definitions/c.js +78 -0
- package/dist/languages/definitions/c.js.map +1 -0
- package/dist/languages/definitions/cFamily.d.ts +35 -0
- package/dist/languages/definitions/cFamily.d.ts.map +1 -0
- package/dist/languages/definitions/cFamily.js +179 -0
- package/dist/languages/definitions/cFamily.js.map +1 -0
- package/dist/languages/definitions/cpp.d.ts +2 -0
- package/dist/languages/definitions/cpp.d.ts.map +1 -0
- package/dist/languages/definitions/cpp.js +88 -0
- package/dist/languages/definitions/cpp.js.map +1 -0
- package/dist/languages/definitions/csharp.d.ts +3 -0
- package/dist/languages/definitions/csharp.d.ts.map +1 -0
- package/dist/languages/definitions/csharp.js +126 -0
- package/dist/languages/definitions/csharp.js.map +1 -0
- package/dist/languages/definitions/css.d.ts +3 -0
- package/dist/languages/definitions/css.d.ts.map +1 -0
- package/dist/languages/definitions/css.js +13 -0
- package/dist/languages/definitions/css.js.map +1 -0
- package/dist/languages/definitions/cssLike.d.ts +5 -0
- package/dist/languages/definitions/cssLike.d.ts.map +1 -0
- package/dist/languages/definitions/cssLike.js +32 -0
- package/dist/languages/definitions/cssLike.js.map +1 -0
- package/dist/languages/definitions/go.d.ts +3 -0
- package/dist/languages/definitions/go.d.ts.map +1 -0
- package/dist/languages/definitions/go.js +113 -0
- package/dist/languages/definitions/go.js.map +1 -0
- package/dist/languages/definitions/hbs.d.ts +2 -0
- package/dist/languages/definitions/hbs.d.ts.map +1 -0
- package/dist/languages/definitions/hbs.js +5 -0
- package/dist/languages/definitions/hbs.js.map +1 -0
- package/dist/languages/definitions/html.d.ts +3 -0
- package/dist/languages/definitions/html.d.ts.map +1 -0
- package/dist/languages/definitions/html.js +45 -0
- package/dist/languages/definitions/html.js.map +1 -0
- package/dist/languages/definitions/htmlStub.d.ts +18 -0
- package/dist/languages/definitions/htmlStub.d.ts.map +1 -0
- package/dist/languages/definitions/htmlStub.js +38 -0
- package/dist/languages/definitions/htmlStub.js.map +1 -0
- package/dist/languages/definitions/java.d.ts +3 -0
- package/dist/languages/definitions/java.d.ts.map +1 -0
- package/dist/languages/definitions/java.js +124 -0
- package/dist/languages/definitions/java.js.map +1 -0
- package/dist/languages/definitions/javascript.d.ts +3 -0
- package/dist/languages/definitions/javascript.d.ts.map +1 -0
- package/dist/languages/definitions/javascript.js +172 -0
- package/dist/languages/definitions/javascript.js.map +1 -0
- package/dist/languages/definitions/jsFamily.d.ts +5 -0
- package/dist/languages/definitions/jsFamily.d.ts.map +1 -0
- package/dist/languages/definitions/jsFamily.js +75 -0
- package/dist/languages/definitions/jsFamily.js.map +1 -0
- package/dist/languages/definitions/kotlin.d.ts +3 -0
- package/dist/languages/definitions/kotlin.d.ts.map +1 -0
- package/dist/languages/definitions/kotlin.js +152 -0
- package/dist/languages/definitions/kotlin.js.map +1 -0
- package/dist/languages/definitions/less.d.ts +3 -0
- package/dist/languages/definitions/less.d.ts.map +1 -0
- package/dist/languages/definitions/less.js +13 -0
- package/dist/languages/definitions/less.js.map +1 -0
- package/dist/languages/definitions/loadLanguage.d.ts +2 -0
- package/dist/languages/definitions/loadLanguage.d.ts.map +1 -0
- package/dist/languages/definitions/loadLanguage.js +2 -0
- package/dist/languages/definitions/loadLanguage.js.map +1 -0
- package/dist/languages/definitions/markdown.d.ts +2 -0
- package/dist/languages/definitions/markdown.d.ts.map +1 -0
- package/dist/languages/definitions/markdown.js +5 -0
- package/dist/languages/definitions/markdown.js.map +1 -0
- package/dist/languages/definitions/mdx.d.ts +2 -0
- package/dist/languages/definitions/mdx.d.ts.map +1 -0
- package/dist/languages/definitions/mdx.js +5 -0
- package/dist/languages/definitions/mdx.js.map +1 -0
- package/dist/languages/definitions/php.d.ts +3 -0
- package/dist/languages/definitions/php.d.ts.map +1 -0
- package/dist/languages/definitions/php.js +157 -0
- package/dist/languages/definitions/php.js.map +1 -0
- package/dist/languages/definitions/python.d.ts +3 -0
- package/dist/languages/definitions/python.d.ts.map +1 -0
- package/dist/languages/definitions/python.js +137 -0
- package/dist/languages/definitions/python.js.map +1 -0
- package/dist/languages/definitions/rst.d.ts +2 -0
- package/dist/languages/definitions/rst.d.ts.map +1 -0
- package/dist/languages/definitions/rst.js +5 -0
- package/dist/languages/definitions/rst.js.map +1 -0
- package/dist/languages/definitions/ruby.d.ts +3 -0
- package/dist/languages/definitions/ruby.d.ts.map +1 -0
- package/dist/languages/definitions/ruby.js +92 -0
- package/dist/languages/definitions/ruby.js.map +1 -0
- package/dist/languages/definitions/rust.d.ts +3 -0
- package/dist/languages/definitions/rust.d.ts.map +1 -0
- package/dist/languages/definitions/rust.js +146 -0
- package/dist/languages/definitions/rust.js.map +1 -0
- package/dist/languages/definitions/scss.d.ts +3 -0
- package/dist/languages/definitions/scss.d.ts.map +1 -0
- package/dist/languages/definitions/scss.js +58 -0
- package/dist/languages/definitions/scss.js.map +1 -0
- package/dist/languages/definitions/sql.d.ts +3 -0
- package/dist/languages/definitions/sql.d.ts.map +1 -0
- package/dist/languages/definitions/sql.js +36 -0
- package/dist/languages/definitions/sql.js.map +1 -0
- package/dist/languages/definitions/svelte.d.ts +3 -0
- package/dist/languages/definitions/svelte.d.ts.map +1 -0
- package/dist/languages/definitions/svelte.js +31 -0
- package/dist/languages/definitions/svelte.js.map +1 -0
- package/dist/languages/definitions/swift.d.ts +3 -0
- package/dist/languages/definitions/swift.d.ts.map +1 -0
- package/dist/languages/definitions/swift.js +188 -0
- package/dist/languages/definitions/swift.js.map +1 -0
- package/dist/languages/definitions/typescript.d.ts +4 -0
- package/dist/languages/definitions/typescript.d.ts.map +1 -0
- package/dist/languages/definitions/typescript.js +212 -0
- package/dist/languages/definitions/typescript.js.map +1 -0
- package/dist/languages/definitions/vue.d.ts +3 -0
- package/dist/languages/definitions/vue.d.ts.map +1 -0
- package/dist/languages/definitions/vue.js +31 -0
- package/dist/languages/definitions/vue.js.map +1 -0
- package/dist/languages/definitions/zig.d.ts +3 -0
- package/dist/languages/definitions/zig.d.ts.map +1 -0
- package/dist/languages/definitions/zig.js +75 -0
- package/dist/languages/definitions/zig.js.map +1 -0
- package/dist/languages/filePrep.d.ts +33 -0
- package/dist/languages/filePrep.d.ts.map +1 -0
- package/dist/languages/filePrep.js +77 -0
- package/dist/languages/filePrep.js.map +1 -0
- package/dist/languages/importStatementParsers.d.ts +55 -0
- package/dist/languages/importStatementParsers.d.ts.map +1 -0
- package/dist/languages/importStatementParsers.js +369 -0
- package/dist/languages/importStatementParsers.js.map +1 -0
- package/dist/languages/js-family.d.ts +2 -0
- package/dist/languages/js-family.d.ts.map +1 -0
- package/dist/languages/js-family.js +9 -0
- package/dist/languages/js-family.js.map +1 -0
- package/dist/languages/queryGenerator.d.ts +6 -0
- package/dist/languages/queryGenerator.d.ts.map +1 -0
- package/dist/languages/queryGenerator.js +46 -0
- package/dist/languages/queryGenerator.js.map +1 -0
- package/dist/languages/registry.d.ts +5 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/registry.js +11 -0
- package/dist/languages/registry.js.map +1 -0
- package/dist/languages/sfc.d.ts +30 -0
- package/dist/languages/sfc.d.ts.map +1 -0
- package/dist/languages/sfc.js +402 -0
- package/dist/languages/sfc.js.map +1 -0
- package/dist/languages/types.d.ts +110 -0
- package/dist/languages/types.d.ts.map +1 -0
- package/dist/languages/types.js +2 -0
- package/dist/languages/types.js.map +1 -0
- package/dist/languages.d.ts +63 -0
- package/dist/languages.d.ts.map +1 -0
- package/dist/languages.js +118 -0
- package/dist/languages.js.map +1 -0
- package/dist/lifecycle/errors.d.ts +4 -0
- package/dist/lifecycle/errors.d.ts.map +1 -0
- package/dist/lifecycle/errors.js +4 -0
- package/dist/lifecycle/errors.js.map +1 -0
- package/dist/lifecycle/gitignore.d.ts +10 -0
- package/dist/lifecycle/gitignore.d.ts.map +1 -0
- package/dist/lifecycle/gitignore.js +83 -0
- package/dist/lifecycle/gitignore.js.map +1 -0
- package/dist/lifecycle/manifest.d.ts +73 -0
- package/dist/lifecycle/manifest.d.ts.map +1 -0
- package/dist/lifecycle/manifest.js +352 -0
- package/dist/lifecycle/manifest.js.map +1 -0
- package/dist/logging.d.ts +5 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +35 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp/http.d.ts +29 -0
- package/dist/mcp/http.d.ts.map +1 -0
- package/dist/mcp/http.js +179 -0
- package/dist/mcp/http.js.map +1 -0
- package/dist/mcp/security.d.ts +3 -0
- package/dist/mcp/security.d.ts.map +1 -0
- package/dist/mcp/security.js +23 -0
- package/dist/mcp/security.js.map +1 -0
- package/dist/mcp/server.d.ts +267 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +1345 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/sqliteGuard.d.ts +3 -0
- package/dist/mcp/sqliteGuard.d.ts.map +1 -0
- package/dist/mcp/sqliteGuard.js +35 -0
- package/dist/mcp/sqliteGuard.js.map +1 -0
- package/dist/mcp/stdioLifecycle.d.ts +23 -0
- package/dist/mcp/stdioLifecycle.d.ts.map +1 -0
- package/dist/mcp/stdioLifecycle.js +83 -0
- package/dist/mcp/stdioLifecycle.js.map +1 -0
- package/dist/mcp/tools.d.ts +15 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +299 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +8 -0
- package/dist/mcp.js.map +1 -0
- package/dist/native/bindingLoader.d.ts +24 -0
- package/dist/native/bindingLoader.d.ts.map +1 -0
- package/dist/native/bindingLoader.js +206 -0
- package/dist/native/bindingLoader.js.map +1 -0
- package/dist/native/contracts.d.ts +122 -0
- package/dist/native/contracts.d.ts.map +1 -0
- package/dist/native/contracts.js +2 -0
- package/dist/native/contracts.js.map +1 -0
- package/dist/native/execution.d.ts +16 -0
- package/dist/native/execution.d.ts.map +1 -0
- package/dist/native/execution.js +184 -0
- package/dist/native/execution.js.map +1 -0
- package/dist/native/jsBridge.d.ts +7 -0
- package/dist/native/jsBridge.d.ts.map +1 -0
- package/dist/native/jsBridge.js +25 -0
- package/dist/native/jsBridge.js.map +1 -0
- package/dist/native/nativeBackendReport.d.ts +22 -0
- package/dist/native/nativeBackendReport.d.ts.map +1 -0
- package/dist/native/nativeBackendReport.js +102 -0
- package/dist/native/nativeBackendReport.js.map +1 -0
- package/dist/native/projectedTree.d.ts +37 -0
- package/dist/native/projectedTree.d.ts.map +1 -0
- package/dist/native/projectedTree.js +172 -0
- package/dist/native/projectedTree.js.map +1 -0
- package/dist/native/queries.d.ts +22 -0
- package/dist/native/queries.d.ts.map +1 -0
- package/dist/native/queries.js +67 -0
- package/dist/native/queries.js.map +1 -0
- package/dist/native/queryResults.d.ts +6 -0
- package/dist/native/queryResults.d.ts.map +1 -0
- package/dist/native/queryResults.js +26 -0
- package/dist/native/queryResults.js.map +1 -0
- package/dist/native/runtime.d.ts +17 -0
- package/dist/native/runtime.d.ts.map +1 -0
- package/dist/native/runtime.js +152 -0
- package/dist/native/runtime.js.map +1 -0
- package/dist/native/runtimeCache.d.ts +36 -0
- package/dist/native/runtimeCache.d.ts.map +1 -0
- package/dist/native/runtimeCache.js +237 -0
- package/dist/native/runtimeCache.js.map +1 -0
- package/dist/native/treeSitterNative.d.ts +6 -0
- package/dist/native/treeSitterNative.d.ts.map +1 -0
- package/dist/native/treeSitterNative.js +5 -0
- package/dist/native/treeSitterNative.js.map +1 -0
- package/dist/parserBackend.d.ts +57 -0
- package/dist/parserBackend.d.ts.map +1 -0
- package/dist/parserBackend.js +33 -0
- package/dist/parserBackend.js.map +1 -0
- package/dist/presentation/bounds.d.ts +34 -0
- package/dist/presentation/bounds.d.ts.map +1 -0
- package/dist/presentation/bounds.js +43 -0
- package/dist/presentation/bounds.js.map +1 -0
- package/dist/presets.d.ts +32 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +127 -0
- package/dist/presets.js.map +1 -0
- package/dist/query/parser.d.ts +33 -0
- package/dist/query/parser.d.ts.map +1 -0
- package/dist/query/parser.js +104 -0
- package/dist/query/parser.js.map +1 -0
- package/dist/query/symbols.d.ts +15 -0
- package/dist/query/symbols.d.ts.map +1 -0
- package/dist/query/symbols.js +78 -0
- package/dist/query/symbols.js.map +1 -0
- package/dist/query.d.ts +3 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +3 -0
- package/dist/query.js.map +1 -0
- package/dist/review/candidates.d.ts +13 -0
- package/dist/review/candidates.d.ts.map +1 -0
- package/dist/review/candidates.js +65 -0
- package/dist/review/candidates.js.map +1 -0
- package/dist/review/changes.d.ts +11 -0
- package/dist/review/changes.d.ts.map +1 -0
- package/dist/review/changes.js +94 -0
- package/dist/review/changes.js.map +1 -0
- package/dist/review/deleted.d.ts +23 -0
- package/dist/review/deleted.d.ts.map +1 -0
- package/dist/review/deleted.js +398 -0
- package/dist/review/deleted.js.map +1 -0
- package/dist/review/report.d.ts +37 -0
- package/dist/review/report.d.ts.map +1 -0
- package/dist/review/report.js +76 -0
- package/dist/review/report.js.map +1 -0
- package/dist/review/risk.d.ts +19 -0
- package/dist/review/risk.d.ts.map +1 -0
- package/dist/review/risk.js +105 -0
- package/dist/review/risk.js.map +1 -0
- package/dist/review/summaries.d.ts +24 -0
- package/dist/review/summaries.d.ts.map +1 -0
- package/dist/review/summaries.js +581 -0
- package/dist/review/summaries.js.map +1 -0
- package/dist/review/types.d.ts +146 -0
- package/dist/review/types.d.ts.map +1 -0
- package/dist/review/types.js +43 -0
- package/dist/review/types.js.map +1 -0
- package/dist/review.d.ts +19 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +442 -0
- package/dist/review.js.map +1 -0
- package/dist/runtimeIdentity.d.ts +27 -0
- package/dist/runtimeIdentity.d.ts.map +1 -0
- package/dist/runtimeIdentity.js +75 -0
- package/dist/runtimeIdentity.js.map +1 -0
- package/dist/session.d.ts +246 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +858 -0
- package/dist/session.js.map +1 -0
- package/dist/sql/classifySqlFile.d.ts +3 -0
- package/dist/sql/classifySqlFile.d.ts.map +1 -0
- package/dist/sql/classifySqlFile.js +42 -0
- package/dist/sql/classifySqlFile.js.map +1 -0
- package/dist/sql/extractFacts.d.ts +4 -0
- package/dist/sql/extractFacts.d.ts.map +1 -0
- package/dist/sql/extractFacts.js +511 -0
- package/dist/sql/extractFacts.js.map +1 -0
- package/dist/sql/graph.d.ts +33 -0
- package/dist/sql/graph.d.ts.map +1 -0
- package/dist/sql/graph.js +167 -0
- package/dist/sql/graph.js.map +1 -0
- package/dist/sql/index.d.ts +8 -0
- package/dist/sql/index.d.ts.map +1 -0
- package/dist/sql/index.js +5 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/lex.d.ts +12 -0
- package/dist/sql/lex.d.ts.map +1 -0
- package/dist/sql/lex.js +180 -0
- package/dist/sql/lex.js.map +1 -0
- package/dist/sql/lookup.d.ts +3 -0
- package/dist/sql/lookup.d.ts.map +1 -0
- package/dist/sql/lookup.js +11 -0
- package/dist/sql/lookup.js.map +1 -0
- package/dist/sql/navigation.d.ts +4 -0
- package/dist/sql/navigation.d.ts.map +1 -0
- package/dist/sql/navigation.js +399 -0
- package/dist/sql/navigation.js.map +1 -0
- package/dist/sql/review.d.ts +15 -0
- package/dist/sql/review.d.ts.map +1 -0
- package/dist/sql/review.js +197 -0
- package/dist/sql/review.js.map +1 -0
- package/dist/sql/sourceGraph.d.ts +19 -0
- package/dist/sql/sourceGraph.d.ts.map +1 -0
- package/dist/sql/sourceGraph.js +195 -0
- package/dist/sql/sourceGraph.js.map +1 -0
- package/dist/sql/types.d.ts +21 -0
- package/dist/sql/types.d.ts.map +1 -0
- package/dist/sql/types.js +2 -0
- package/dist/sql/types.js.map +1 -0
- package/dist/sqlite/canned-query.d.ts +3 -0
- package/dist/sqlite/canned-query.d.ts.map +1 -0
- package/dist/sqlite/canned-query.js +192 -0
- package/dist/sqlite/canned-query.js.map +1 -0
- package/dist/sqlite/common.d.ts +6 -0
- package/dist/sqlite/common.d.ts.map +1 -0
- package/dist/sqlite/common.js +42 -0
- package/dist/sqlite/common.js.map +1 -0
- package/dist/sqlite/database.d.ts +5 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +40 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/query.d.ts +9 -0
- package/dist/sqlite/query.d.ts.map +1 -0
- package/dist/sqlite/query.js +32 -0
- package/dist/sqlite/query.js.map +1 -0
- package/dist/sqlite/rowBounds.d.ts +24 -0
- package/dist/sqlite/rowBounds.d.ts.map +1 -0
- package/dist/sqlite/rowBounds.js +95 -0
- package/dist/sqlite/rowBounds.js.map +1 -0
- package/dist/sqlite/schema.d.ts +5 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +243 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/sqlite/types.d.ts +77 -0
- package/dist/sqlite/types.d.ts.map +1 -0
- package/dist/sqlite/types.js +2 -0
- package/dist/sqlite/types.js.map +1 -0
- package/dist/sqlite/write.d.ts +5 -0
- package/dist/sqlite/write.d.ts.map +1 -0
- package/dist/sqlite/write.js +306 -0
- package/dist/sqlite/write.js.map +1 -0
- package/dist/sqlite-driver.d.ts +41 -0
- package/dist/sqlite-driver.d.ts.map +1 -0
- package/dist/sqlite-driver.js +144 -0
- package/dist/sqlite-driver.js.map +1 -0
- package/dist/sqlite.d.ts +4 -0
- package/dist/sqlite.d.ts.map +1 -0
- package/dist/sqlite.js +3 -0
- package/dist/sqlite.js.map +1 -0
- package/dist/triples.d.ts +27 -0
- package/dist/triples.d.ts.map +1 -0
- package/dist/triples.js +46 -0
- package/dist/triples.js.map +1 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/util/ast.d.ts +20 -0
- package/dist/util/ast.d.ts.map +1 -0
- package/dist/util/ast.js +62 -0
- package/dist/util/ast.js.map +1 -0
- package/dist/util/bloomFilter.d.ts +99 -0
- package/dist/util/bloomFilter.d.ts.map +1 -0
- package/dist/util/bloomFilter.js +205 -0
- package/dist/util/bloomFilter.js.map +1 -0
- package/dist/util/collections.d.ts +3 -0
- package/dist/util/collections.d.ts.map +1 -0
- package/dist/util/collections.js +21 -0
- package/dist/util/collections.js.map +1 -0
- package/dist/util/comments.d.ts +10 -0
- package/dist/util/comments.d.ts.map +1 -0
- package/dist/util/comments.js +398 -0
- package/dist/util/comments.js.map +1 -0
- package/dist/util/concurrency.d.ts +26 -0
- package/dist/util/concurrency.d.ts.map +1 -0
- package/dist/util/concurrency.js +121 -0
- package/dist/util/concurrency.js.map +1 -0
- package/dist/util/confinedFile.d.ts +8 -0
- package/dist/util/confinedFile.d.ts.map +1 -0
- package/dist/util/confinedFile.js +53 -0
- package/dist/util/confinedFile.js.map +1 -0
- package/dist/util/discoveryPath.d.ts +3 -0
- package/dist/util/discoveryPath.d.ts.map +1 -0
- package/dist/util/discoveryPath.js +19 -0
- package/dist/util/discoveryPath.js.map +1 -0
- package/dist/util/errors.d.ts +3 -0
- package/dist/util/errors.d.ts.map +1 -0
- package/dist/util/errors.js +7 -0
- package/dist/util/errors.js.map +1 -0
- package/dist/util/git.d.ts +79 -0
- package/dist/util/git.d.ts.map +1 -0
- package/dist/util/git.js +403 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/graphEdges.d.ts +5 -0
- package/dist/util/graphEdges.d.ts.map +1 -0
- package/dist/util/graphEdges.js +42 -0
- package/dist/util/graphEdges.js.map +1 -0
- package/dist/util/graphOnlyExtensions.d.ts +5 -0
- package/dist/util/graphOnlyExtensions.d.ts.map +1 -0
- package/dist/util/graphOnlyExtensions.js +12 -0
- package/dist/util/graphOnlyExtensions.js.map +1 -0
- package/dist/util/guards.d.ts +2 -0
- package/dist/util/guards.d.ts.map +1 -0
- package/dist/util/guards.js +4 -0
- package/dist/util/guards.js.map +1 -0
- package/dist/util/includeRoots.d.ts +6 -0
- package/dist/util/includeRoots.d.ts.map +1 -0
- package/dist/util/includeRoots.js +53 -0
- package/dist/util/includeRoots.js.map +1 -0
- package/dist/util/lazySymbols.d.ts +166 -0
- package/dist/util/lazySymbols.d.ts.map +1 -0
- package/dist/util/lazySymbols.js +365 -0
- package/dist/util/lazySymbols.js.map +1 -0
- package/dist/util/lines.d.ts +2 -0
- package/dist/util/lines.d.ts.map +1 -0
- package/dist/util/lines.js +9 -0
- package/dist/util/lines.js.map +1 -0
- package/dist/util/lruMap.d.ts +3 -0
- package/dist/util/lruMap.d.ts.map +1 -0
- package/dist/util/lruMap.js +22 -0
- package/dist/util/lruMap.js.map +1 -0
- package/dist/util/memberAccess.d.ts +26 -0
- package/dist/util/memberAccess.d.ts.map +1 -0
- package/dist/util/memberAccess.js +175 -0
- package/dist/util/memberAccess.js.map +1 -0
- package/dist/util/packageExports.d.ts +25 -0
- package/dist/util/packageExports.d.ts.map +1 -0
- package/dist/util/packageExports.js +79 -0
- package/dist/util/packageExports.js.map +1 -0
- package/dist/util/packageInfo.d.ts +12 -0
- package/dist/util/packageInfo.d.ts.map +1 -0
- package/dist/util/packageInfo.js +57 -0
- package/dist/util/packageInfo.js.map +1 -0
- package/dist/util/partialResults.d.ts +81 -0
- package/dist/util/partialResults.d.ts.map +1 -0
- package/dist/util/partialResults.js +290 -0
- package/dist/util/partialResults.js.map +1 -0
- package/dist/util/paths.d.ts +51 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +245 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/projectFiles/definitions.d.ts +21 -0
- package/dist/util/projectFiles/definitions.d.ts.map +1 -0
- package/dist/util/projectFiles/definitions.js +112 -0
- package/dist/util/projectFiles/definitions.js.map +1 -0
- package/dist/util/projectFiles/parsers.d.ts +13 -0
- package/dist/util/projectFiles/parsers.d.ts.map +1 -0
- package/dist/util/projectFiles/parsers.js +122 -0
- package/dist/util/projectFiles/parsers.js.map +1 -0
- package/dist/util/projectFiles.d.ts +43 -0
- package/dist/util/projectFiles.d.ts.map +1 -0
- package/dist/util/projectFiles.js +572 -0
- package/dist/util/projectFiles.js.map +1 -0
- package/dist/util/resolution/files.d.ts +3 -0
- package/dist/util/resolution/files.d.ts.map +1 -0
- package/dist/util/resolution/files.js +29 -0
- package/dist/util/resolution/files.js.map +1 -0
- package/dist/util/resolution/findFirstExisting.d.ts +2 -0
- package/dist/util/resolution/findFirstExisting.d.ts.map +1 -0
- package/dist/util/resolution/findFirstExisting.js +13 -0
- package/dist/util/resolution/findFirstExisting.js.map +1 -0
- package/dist/util/resolution/go.d.ts +2 -0
- package/dist/util/resolution/go.d.ts.map +1 -0
- package/dist/util/resolution/go.js +171 -0
- package/dist/util/resolution/go.js.map +1 -0
- package/dist/util/resolution/jvm.d.ts +5 -0
- package/dist/util/resolution/jvm.d.ts.map +1 -0
- package/dist/util/resolution/jvm.js +124 -0
- package/dist/util/resolution/jvm.js.map +1 -0
- package/dist/util/resolution/node.d.ts +3 -0
- package/dist/util/resolution/node.d.ts.map +1 -0
- package/dist/util/resolution/node.js +60 -0
- package/dist/util/resolution/node.js.map +1 -0
- package/dist/util/resolution/php.d.ts +4 -0
- package/dist/util/resolution/php.d.ts.map +1 -0
- package/dist/util/resolution/php.js +498 -0
- package/dist/util/resolution/php.js.map +1 -0
- package/dist/util/resolution/phpComposer.d.ts +17 -0
- package/dist/util/resolution/phpComposer.d.ts.map +1 -0
- package/dist/util/resolution/phpComposer.js +269 -0
- package/dist/util/resolution/phpComposer.js.map +1 -0
- package/dist/util/resolution/projectSymbols.d.ts +14 -0
- package/dist/util/resolution/projectSymbols.d.ts.map +1 -0
- package/dist/util/resolution/projectSymbols.js +70 -0
- package/dist/util/resolution/projectSymbols.js.map +1 -0
- package/dist/util/resolution/python.d.ts +7 -0
- package/dist/util/resolution/python.d.ts.map +1 -0
- package/dist/util/resolution/python.js +129 -0
- package/dist/util/resolution/python.js.map +1 -0
- package/dist/util/resolution/rust.d.ts +2 -0
- package/dist/util/resolution/rust.d.ts.map +1 -0
- package/dist/util/resolution/rust.js +87 -0
- package/dist/util/resolution/rust.js.map +1 -0
- package/dist/util/resolution/tsconfig.d.ts +8 -0
- package/dist/util/resolution/tsconfig.d.ts.map +1 -0
- package/dist/util/resolution/tsconfig.js +131 -0
- package/dist/util/resolution/tsconfig.js.map +1 -0
- package/dist/util/resolution.d.ts +37 -0
- package/dist/util/resolution.d.ts.map +1 -0
- package/dist/util/resolution.js +276 -0
- package/dist/util/resolution.js.map +1 -0
- package/dist/util/resolutionCandidates.d.ts +5 -0
- package/dist/util/resolutionCandidates.d.ts.map +1 -0
- package/dist/util/resolutionCandidates.js +70 -0
- package/dist/util/resolutionCandidates.js.map +1 -0
- package/dist/util/rustTestModules.d.ts +3 -0
- package/dist/util/rustTestModules.d.ts.map +1 -0
- package/dist/util/rustTestModules.js +69 -0
- package/dist/util/rustTestModules.js.map +1 -0
- package/dist/util/semaphore.d.ts +2 -0
- package/dist/util/semaphore.d.ts.map +1 -0
- package/dist/util/semaphore.js +2 -0
- package/dist/util/semaphore.js.map +1 -0
- package/dist/util/sourceLocation.d.ts +8 -0
- package/dist/util/sourceLocation.d.ts.map +1 -0
- package/dist/util/sourceLocation.js +19 -0
- package/dist/util/sourceLocation.js.map +1 -0
- package/dist/util/specifiers.d.ts +17 -0
- package/dist/util/specifiers.d.ts.map +1 -0
- package/dist/util/specifiers.js +263 -0
- package/dist/util/specifiers.js.map +1 -0
- package/dist/util/sqliteSchema.d.ts +28 -0
- package/dist/util/sqliteSchema.d.ts.map +1 -0
- package/dist/util/sqliteSchema.js +66 -0
- package/dist/util/sqliteSchema.js.map +1 -0
- package/dist/util/symbolHash.d.ts +59 -0
- package/dist/util/symbolHash.d.ts.map +1 -0
- package/dist/util/symbolHash.js +84 -0
- package/dist/util/symbolHash.js.map +1 -0
- package/dist/util/workerThreads.d.ts +12 -0
- package/dist/util/workerThreads.d.ts.map +1 -0
- package/dist/util/workerThreads.js +16 -0
- package/dist/util/workerThreads.js.map +1 -0
- package/dist/util/workspace.d.ts +32 -0
- package/dist/util/workspace.d.ts.map +1 -0
- package/dist/util/workspace.js +288 -0
- package/dist/util/workspace.js.map +1 -0
- package/dist/util.d.ts +14 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +10 -0
- package/dist/util.js.map +1 -0
- package/dist/worker/nativeExtractWorker.d.ts +61 -0
- package/dist/worker/nativeExtractWorker.d.ts.map +1 -0
- package/dist/worker/nativeExtractWorker.js +196 -0
- package/dist/worker/nativeExtractWorker.js.map +1 -0
- package/dist/worker/nativeWorkerPool.d.ts +10 -0
- package/dist/worker/nativeWorkerPool.d.ts.map +1 -0
- package/dist/worker/nativeWorkerPool.js +35 -0
- package/dist/worker/nativeWorkerPool.js.map +1 -0
- package/docs/graph-visualization/app.js +900 -0
- package/docs/graph-visualization/file-tree-filters.js +50 -0
- package/docs/graph-visualization/file-tree-model.js +186 -0
- package/docs/graph-visualization/graph-builder.js +303 -0
- package/docs/graph-visualization/index.html +65 -0
- package/docs/graph-visualization/styles.css +513 -0
- package/docs/graph-visualization/vendor/LICENSE.graphology-layout-forceatlas2.txt +21 -0
- package/docs/graph-visualization/vendor/LICENSE.graphology.txt +21 -0
- package/docs/graph-visualization/vendor/LICENSE.sigma.txt +12 -0
- package/docs/graph-visualization/vendor/graphology-layout-forceatlas2.js +789 -0
- package/docs/graph-visualization/vendor/graphology.js +4204 -0
- package/docs/graph-visualization/vendor/sigma.js +5643 -0
- package/docs/graph-visualization/viewer-selected-node.webp +0 -0
- package/docs/mcp.md +373 -0
- package/package.json +104 -0
|
@@ -0,0 +1,3914 @@
|
|
|
1
|
+
import { createRequire as __codegraphCreateRequire } from 'node:module';
|
|
2
|
+
const require = __codegraphCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// dist/agent/query-index/content.js
|
|
6
|
+
import fs4 from "node:fs/promises";
|
|
7
|
+
import { brotliCompressSync, constants as zlibConstants } from "node:zlib";
|
|
8
|
+
|
|
9
|
+
// dist/languages/queryGenerator.js
|
|
10
|
+
function generateChunkingQuery(def) {
|
|
11
|
+
const parts = [];
|
|
12
|
+
if (def.structure.comments.length) {
|
|
13
|
+
parts.push(`;; ----- Comments -----`);
|
|
14
|
+
for (const type of def.structure.comments) {
|
|
15
|
+
parts.push(`(${type}) @chunk.comment`);
|
|
16
|
+
}
|
|
17
|
+
parts.push("");
|
|
18
|
+
}
|
|
19
|
+
if (def.structure.blocks.length) {
|
|
20
|
+
parts.push(`;; ----- Blocks -----`);
|
|
21
|
+
for (const block of def.structure.blocks) {
|
|
22
|
+
let query = `(${block.type}`;
|
|
23
|
+
if (block.nameQuery) {
|
|
24
|
+
query += ` ${block.nameQuery}`;
|
|
25
|
+
}
|
|
26
|
+
const isBlockCapture = block.isBlock ?? true;
|
|
27
|
+
if (isBlockCapture) {
|
|
28
|
+
query += `) @chunk.block.${block.captureId || block.type}`;
|
|
29
|
+
} else {
|
|
30
|
+
query += `)`;
|
|
31
|
+
}
|
|
32
|
+
if (block.parentType) {
|
|
33
|
+
query = `(${block.parentType} ${query})`;
|
|
34
|
+
}
|
|
35
|
+
parts.push(query);
|
|
36
|
+
}
|
|
37
|
+
parts.push("");
|
|
38
|
+
}
|
|
39
|
+
if (def.structure.splitPoints.length) {
|
|
40
|
+
parts.push(`;; ----- Split Points -----`);
|
|
41
|
+
for (const type of def.structure.splitPoints) {
|
|
42
|
+
parts.push(`(${type}) @chunk.block.inner`);
|
|
43
|
+
}
|
|
44
|
+
parts.push("");
|
|
45
|
+
}
|
|
46
|
+
return parts.join("\n");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// dist/chunking/languageConfig.js
|
|
50
|
+
function makeLanguageConfig(def, publicId = def.id) {
|
|
51
|
+
const queryText = generateChunkingQuery(def);
|
|
52
|
+
return {
|
|
53
|
+
id: publicId,
|
|
54
|
+
supportId: def.id,
|
|
55
|
+
queryText,
|
|
56
|
+
definition: def,
|
|
57
|
+
captures: {
|
|
58
|
+
name: "chunk.name",
|
|
59
|
+
blockPrefix: "chunk.block.",
|
|
60
|
+
innerBlock: "chunk.block.inner",
|
|
61
|
+
comments: ["chunk.comment", "chunk.docstring"]
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// dist/languages/registry.js
|
|
67
|
+
var registry = /* @__PURE__ */ new Map();
|
|
68
|
+
function registerLanguage(def) {
|
|
69
|
+
registry.set(def.id, def);
|
|
70
|
+
}
|
|
71
|
+
function getAllLanguages() {
|
|
72
|
+
return Array.from(registry.values());
|
|
73
|
+
}
|
|
74
|
+
function getLanguageById(id) {
|
|
75
|
+
return registry.get(id);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// dist/parserBackend.js
|
|
79
|
+
function loadTreeSitterLanguage(packageName) {
|
|
80
|
+
return { name: packageName };
|
|
81
|
+
}
|
|
82
|
+
function loadTypeScriptGrammars() {
|
|
83
|
+
return {
|
|
84
|
+
typescript: { name: "tree-sitter-typescript/typescript" },
|
|
85
|
+
tsx: { name: "tree-sitter-typescript/tsx" }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// dist/languages/definitions/jsFamily.js
|
|
90
|
+
var ECMASCRIPT_CONTROL_SPLIT_POINTS = [
|
|
91
|
+
"if_statement",
|
|
92
|
+
"else_clause",
|
|
93
|
+
"switch_statement",
|
|
94
|
+
"for_statement",
|
|
95
|
+
"for_in_statement",
|
|
96
|
+
"while_statement",
|
|
97
|
+
"do_statement",
|
|
98
|
+
"try_statement",
|
|
99
|
+
"catch_clause",
|
|
100
|
+
"finally_clause"
|
|
101
|
+
];
|
|
102
|
+
var ECMASCRIPT_CORE_FUNCTION_BLOCKS = [
|
|
103
|
+
{
|
|
104
|
+
type: "class_declaration",
|
|
105
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
106
|
+
captureId: "class"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "function_declaration",
|
|
110
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
111
|
+
captureId: "function"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: "generator_function_declaration",
|
|
115
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
116
|
+
captureId: "function"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: "method_definition",
|
|
120
|
+
nameQuery: "name: (_) @chunk.name body: (statement_block) @chunk.block.method",
|
|
121
|
+
captureId: "method"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "lexical_declaration",
|
|
125
|
+
nameQuery: `(variable_declarator name: (identifier) @chunk.name value: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ])`,
|
|
126
|
+
captureId: "function"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: "variable_declaration",
|
|
130
|
+
nameQuery: `(variable_declarator name: (identifier) @chunk.name value: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ])`,
|
|
131
|
+
captureId: "function"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "assignment_expression",
|
|
135
|
+
nameQuery: `left: (_) @chunk.name right: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ]`,
|
|
136
|
+
captureId: "function"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "arrow_function",
|
|
140
|
+
nameQuery: "body: (statement_block) @chunk.block.function",
|
|
141
|
+
captureId: "function"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "function_expression",
|
|
145
|
+
nameQuery: "body: (statement_block) @chunk.block.function",
|
|
146
|
+
captureId: "function"
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
var ECMASCRIPT_MODULE_VAR_BLOCKS = [
|
|
150
|
+
{ type: "import_statement", captureId: "imports" },
|
|
151
|
+
{
|
|
152
|
+
type: "lexical_declaration",
|
|
153
|
+
nameQuery: `(variable_declarator name: (identifier) @chunk.name)`,
|
|
154
|
+
captureId: "module_var",
|
|
155
|
+
parentType: "program"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: "variable_declaration",
|
|
159
|
+
nameQuery: `(variable_declarator name: (identifier) @chunk.name)`,
|
|
160
|
+
captureId: "module_var",
|
|
161
|
+
parentType: "program"
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
// dist/languages/definitions/typescript.js
|
|
166
|
+
function normalizeTypeScriptNativeQuery(kind, query) {
|
|
167
|
+
let normalized = query.replace(/\(class_declaration name: \(identifier\) @/g, "(class_declaration name: (type_identifier) @");
|
|
168
|
+
if (kind !== "exports") {
|
|
169
|
+
return normalized;
|
|
170
|
+
}
|
|
171
|
+
normalized = normalized.replace(/^\s*\(export_assignment \(identifier\) @ts_export_assign\)\s*$/gm, "");
|
|
172
|
+
return normalized;
|
|
173
|
+
}
|
|
174
|
+
var TYPESCRIPT_CLASS_BLOCK = {
|
|
175
|
+
type: "class_declaration",
|
|
176
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
177
|
+
captureId: "class"
|
|
178
|
+
};
|
|
179
|
+
var BASE_STRUCTURE = {
|
|
180
|
+
blocks: [
|
|
181
|
+
TYPESCRIPT_CLASS_BLOCK,
|
|
182
|
+
...ECMASCRIPT_CORE_FUNCTION_BLOCKS.filter((block) => block.type !== "class_declaration"),
|
|
183
|
+
// TS Specifics
|
|
184
|
+
{
|
|
185
|
+
type: "interface_declaration",
|
|
186
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
187
|
+
captureId: "interface"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
type: "enum_declaration",
|
|
191
|
+
nameQuery: "name: [ (identifier) (type_identifier) ] @chunk.name",
|
|
192
|
+
captureId: "enum"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: "type_alias_declaration",
|
|
196
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
197
|
+
captureId: "type_alias"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: "internal_module",
|
|
201
|
+
nameQuery: "name: (identifier) @chunk.name body: (statement_block) @chunk.block.namespace",
|
|
202
|
+
captureId: "namespace"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: "module",
|
|
206
|
+
nameQuery: "name: (identifier) @chunk.name body: (statement_block) @chunk.block.namespace",
|
|
207
|
+
captureId: "namespace"
|
|
208
|
+
},
|
|
209
|
+
// Data
|
|
210
|
+
{ type: "object", captureId: "data" },
|
|
211
|
+
// Top level vars
|
|
212
|
+
...ECMASCRIPT_MODULE_VAR_BLOCKS.map((block) => block.type === "import_statement" ? { ...block, parentType: "program" } : block)
|
|
213
|
+
],
|
|
214
|
+
splitPoints: [...ECMASCRIPT_CONTROL_SPLIT_POINTS, "switch_case", "switch_default"],
|
|
215
|
+
comments: ["comment"]
|
|
216
|
+
};
|
|
217
|
+
var BASE_GRAPH = {
|
|
218
|
+
imports: `
|
|
219
|
+
(import_statement (string) @mod) @stmt
|
|
220
|
+
;; import x = require("...") is represented via import_require_clause
|
|
221
|
+
(import_statement (import_require_clause (string) @mod)) @stmt
|
|
222
|
+
(export_statement (string) @mod) @stmt
|
|
223
|
+
(call_expression function: (import) arguments: (arguments (string) @mod)) @stmt
|
|
224
|
+
;; declare module "foo" {} \u2014 ambient module augmentations create a type-only
|
|
225
|
+
;; dependency on the named module and must appear in the file graph so that
|
|
226
|
+
;; changes to "foo" propagate to augmenting files (and vice-versa).
|
|
227
|
+
;; The inner node type is "module" (not "module_declaration"); its string
|
|
228
|
+
;; child uses field-name "name".
|
|
229
|
+
(ambient_declaration (module name: (string) @mod)) @stmt
|
|
230
|
+
`,
|
|
231
|
+
exports: `
|
|
232
|
+
(export_statement) @stmt
|
|
233
|
+
(export_statement declaration: (function_declaration name: (identifier) @name)) @stmt
|
|
234
|
+
(export_statement declaration: (generator_function_declaration name: (identifier) @name)) @stmt
|
|
235
|
+
(export_statement declaration: (class_declaration name: (type_identifier) @name)) @stmt
|
|
236
|
+
(export_statement declaration: (abstract_class_declaration name: (type_identifier) @name)) @stmt
|
|
237
|
+
(export_statement declaration: (enum_declaration name: [ (identifier) (type_identifier) ] @name)) @stmt
|
|
238
|
+
(export_statement declaration: (function_declaration) @anon_default) @stmt
|
|
239
|
+
(export_statement declaration: (generator_function_declaration) @anon_default) @stmt
|
|
240
|
+
(export_statement declaration: (class_declaration) @anon_default) @stmt
|
|
241
|
+
(export_statement declaration: (abstract_class_declaration) @anon_default) @stmt
|
|
242
|
+
(export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name))) @stmt
|
|
243
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)) (string) @from) @stmt
|
|
244
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src !alias)) (string) @from) @stmt
|
|
245
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias))) @stmt
|
|
246
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src !alias))) @stmt
|
|
247
|
+
(export_statement (string) @from) @stmt
|
|
248
|
+
(export_assignment (identifier) @ts_export_assign)
|
|
249
|
+
`,
|
|
250
|
+
locals: `
|
|
251
|
+
(function_declaration name: (identifier) @name)
|
|
252
|
+
(generator_function_declaration name: (identifier) @name)
|
|
253
|
+
(method_definition name: (property_identifier) @name)
|
|
254
|
+
(method_signature name: (property_identifier) @name)
|
|
255
|
+
(abstract_method_signature name: (property_identifier) @name)
|
|
256
|
+
(class_declaration name: (type_identifier) @name)
|
|
257
|
+
(abstract_class_declaration name: (type_identifier) @name)
|
|
258
|
+
(variable_declarator name: (identifier) @name)
|
|
259
|
+
(interface_declaration name: (type_identifier) @name)
|
|
260
|
+
(type_alias_declaration name: (type_identifier) @name)
|
|
261
|
+
(enum_declaration name: [ (identifier) (type_identifier) ] @name)
|
|
262
|
+
`,
|
|
263
|
+
importBindings: `
|
|
264
|
+
(import_statement) @stmt
|
|
265
|
+
(import_statement (string) @from) @stmt
|
|
266
|
+
(import_statement (import_require_clause (identifier) @def (string) @from)) @stmt
|
|
267
|
+
(import_statement (import_clause (identifier) @def) (string) @from) @stmt
|
|
268
|
+
(import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname alias: (identifier) @alias))) (string) @from) @stmt
|
|
269
|
+
(import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname))) (string) @from) @stmt
|
|
270
|
+
(import_statement (import_clause (namespace_import (identifier) @ns)) (string) @from) @stmt
|
|
271
|
+
`
|
|
272
|
+
};
|
|
273
|
+
var BASE_HELPERS = {
|
|
274
|
+
nodeTypes: {
|
|
275
|
+
identifier: ["identifier", "type_identifier"],
|
|
276
|
+
propertyIdentifier: ["property_identifier"],
|
|
277
|
+
shorthandPropertyIdentifier: ["shorthand_property_identifier", "shorthand_property_identifier_pattern"],
|
|
278
|
+
memberExpression: "member_expression"
|
|
279
|
+
},
|
|
280
|
+
classifyDefinition: (n) => {
|
|
281
|
+
const t = n.parent?.type;
|
|
282
|
+
if (t === "function_declaration")
|
|
283
|
+
return "function";
|
|
284
|
+
if (t === "generator_function_declaration")
|
|
285
|
+
return "function";
|
|
286
|
+
if (t === "method_definition")
|
|
287
|
+
return "function";
|
|
288
|
+
if (t === "method_signature")
|
|
289
|
+
return "function";
|
|
290
|
+
if (t === "abstract_method_signature")
|
|
291
|
+
return "function";
|
|
292
|
+
if (t === "class_declaration")
|
|
293
|
+
return "class";
|
|
294
|
+
if (t === "abstract_class_declaration")
|
|
295
|
+
return "class";
|
|
296
|
+
if (t === "interface_declaration")
|
|
297
|
+
return "interface";
|
|
298
|
+
if (t === "type_alias_declaration")
|
|
299
|
+
return "type";
|
|
300
|
+
if (t === "enum_declaration")
|
|
301
|
+
return "type";
|
|
302
|
+
return "variable";
|
|
303
|
+
},
|
|
304
|
+
isDeclarationName: (node) => {
|
|
305
|
+
const p = node.parent?.type;
|
|
306
|
+
return !!p && [
|
|
307
|
+
"generator_function_declaration",
|
|
308
|
+
"function_declaration",
|
|
309
|
+
"class_declaration",
|
|
310
|
+
"abstract_class_declaration",
|
|
311
|
+
"variable_declarator",
|
|
312
|
+
"interface_declaration",
|
|
313
|
+
"type_alias_declaration",
|
|
314
|
+
"enum_declaration",
|
|
315
|
+
"import_specifier",
|
|
316
|
+
"namespace_import",
|
|
317
|
+
"import_clause",
|
|
318
|
+
"import_equals_declaration",
|
|
319
|
+
// Method names in classes and abstract method signatures: needed so
|
|
320
|
+
// that editing a method name is classified as a definition change.
|
|
321
|
+
"method_definition",
|
|
322
|
+
"method_signature",
|
|
323
|
+
"abstract_method_signature"
|
|
324
|
+
].includes(p);
|
|
325
|
+
},
|
|
326
|
+
createsBlockScope: (n) => n.type === "program" || n.type === "block" || n.type === "class_body",
|
|
327
|
+
createsFunctionScope: (n) => n.type === "generator_function_declaration" || n.type === "function_declaration" || n.type === "function" || n.type === "function_expression" || n.type === "arrow_function" || n.type === "method_definition",
|
|
328
|
+
membersAreImplicitlyInScope: false,
|
|
329
|
+
supportsCrossModuleSymbols: true
|
|
330
|
+
};
|
|
331
|
+
var TYPESCRIPT_DEF = {
|
|
332
|
+
id: "ts",
|
|
333
|
+
extensions: [".ts", ".mts", ".cts"],
|
|
334
|
+
grammar: () => loadTypeScriptGrammars().typescript,
|
|
335
|
+
structure: BASE_STRUCTURE,
|
|
336
|
+
graph: BASE_GRAPH,
|
|
337
|
+
...BASE_HELPERS,
|
|
338
|
+
isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
|
|
339
|
+
native: {
|
|
340
|
+
normalizeQuery: normalizeTypeScriptNativeQuery,
|
|
341
|
+
authoritativeKinds: ["exports"],
|
|
342
|
+
notes: ["drops unsupported TypeScript export-assignment nodes while keeping native export results authoritative"]
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
registerLanguage(TYPESCRIPT_DEF);
|
|
346
|
+
var TSX_DEF = {
|
|
347
|
+
id: "tsx",
|
|
348
|
+
extensions: [".tsx"],
|
|
349
|
+
grammar: () => loadTypeScriptGrammars().tsx,
|
|
350
|
+
structure: {
|
|
351
|
+
...BASE_STRUCTURE,
|
|
352
|
+
blocks: [
|
|
353
|
+
...BASE_STRUCTURE.blocks,
|
|
354
|
+
{ type: "jsx_element", captureId: "jsx" },
|
|
355
|
+
{ type: "jsx_self_closing_element", captureId: "jsx" }
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
graph: BASE_GRAPH,
|
|
359
|
+
...BASE_HELPERS,
|
|
360
|
+
isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
|
|
361
|
+
native: {
|
|
362
|
+
normalizeQuery: normalizeTypeScriptNativeQuery,
|
|
363
|
+
authoritativeKinds: ["exports"],
|
|
364
|
+
notes: ["drops unsupported TypeScript export-assignment nodes while keeping native export results authoritative"]
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
registerLanguage(TSX_DEF);
|
|
368
|
+
|
|
369
|
+
// dist/languages/definitions/javascript.js
|
|
370
|
+
var JS_OBJECT_METHOD_EXPORT_PATTERN = `
|
|
371
|
+
;; CJS: module.exports = { helper () {} }
|
|
372
|
+
(expression_statement (assignment_expression
|
|
373
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
374
|
+
right: (object (pair key: (property_identifier) @cjs_export_name value: (function_declaration) @cjs_fn))))
|
|
375
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
376
|
+
`;
|
|
377
|
+
var JS_OBJECT_METHOD_EXPORT_NATIVE_PATTERN = `
|
|
378
|
+
;; CJS: module.exports = { helper () {} }
|
|
379
|
+
(expression_statement (assignment_expression
|
|
380
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
381
|
+
right: (object (method_definition name: (property_identifier) @cjs_export_name) @cjs_fn)))
|
|
382
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
383
|
+
`;
|
|
384
|
+
var JAVASCRIPT_DEF = {
|
|
385
|
+
id: "js",
|
|
386
|
+
extensions: [".js", ".jsx", ".mjs", ".cjs"],
|
|
387
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-javascript"),
|
|
388
|
+
structure: {
|
|
389
|
+
blocks: [...ECMASCRIPT_CORE_FUNCTION_BLOCKS, ...ECMASCRIPT_MODULE_VAR_BLOCKS],
|
|
390
|
+
splitPoints: [...ECMASCRIPT_CONTROL_SPLIT_POINTS],
|
|
391
|
+
comments: ["comment"]
|
|
392
|
+
},
|
|
393
|
+
graph: {
|
|
394
|
+
imports: `
|
|
395
|
+
(import_statement (string) @mod) @stmt
|
|
396
|
+
(export_statement (string) @mod) @stmt
|
|
397
|
+
(call_expression function: (import) arguments: (arguments (string) @mod)) @stmt
|
|
398
|
+
((call_expression function: (identifier) @fn arguments: (arguments (string) @mod)) @stmt
|
|
399
|
+
(#eq? @fn "require"))
|
|
400
|
+
`,
|
|
401
|
+
exports: `
|
|
402
|
+
(export_statement) @stmt
|
|
403
|
+
(export_statement declaration: (function_declaration name: (identifier) @name)) @stmt
|
|
404
|
+
(export_statement declaration: (generator_function_declaration name: (identifier) @name)) @stmt
|
|
405
|
+
(export_statement declaration: (class_declaration name: (identifier) @name)) @stmt
|
|
406
|
+
(export_statement declaration: (function_declaration) @anon_default) @stmt
|
|
407
|
+
(export_statement declaration: (generator_function_declaration) @anon_default) @stmt
|
|
408
|
+
(export_statement declaration: (class_declaration) @anon_default) @stmt
|
|
409
|
+
(export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name))) @stmt
|
|
410
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)) (string) @from)
|
|
411
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src !alias)) (string) @from)
|
|
412
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)))
|
|
413
|
+
(export_statement (export_clause (export_specifier name: (identifier) @src !alias)))
|
|
414
|
+
(export_statement (string) @from)
|
|
415
|
+
(expression_statement (assignment_expression
|
|
416
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
417
|
+
right: (object (shorthand_property_identifier) @cjs_shorthand)))
|
|
418
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
419
|
+
;; CJS spread export: module.exports = { ...base }
|
|
420
|
+
((expression_statement (assignment_expression
|
|
421
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
422
|
+
right: (object (spread_element (identifier) @cjs_spread))) @stmt)
|
|
423
|
+
(#eq? @mod "module") (#eq? @prop "exports"))
|
|
424
|
+
(expression_statement (assignment_expression
|
|
425
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
426
|
+
right: (object (pair key: (property_identifier) @cjs_export_name value: (identifier) @cjs_local))))
|
|
427
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
428
|
+
(expression_statement (assignment_expression
|
|
429
|
+
left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
|
|
430
|
+
right: (identifier) @cjs_local))
|
|
431
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
432
|
+
(expression_statement (assignment_expression
|
|
433
|
+
left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
|
|
434
|
+
right: (identifier) @cjs_local))
|
|
435
|
+
(#eq? @exp "exports")
|
|
436
|
+
;; CJS function/arrow direct exports
|
|
437
|
+
(expression_statement (assignment_expression
|
|
438
|
+
left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
|
|
439
|
+
right: (function) @cjs_fn))
|
|
440
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
441
|
+
(expression_statement (assignment_expression
|
|
442
|
+
left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
|
|
443
|
+
right: (arrow_function) @cjs_fn))
|
|
444
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
445
|
+
(expression_statement (assignment_expression
|
|
446
|
+
left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
|
|
447
|
+
right: (function) @cjs_fn))
|
|
448
|
+
(#eq? @exp "exports")
|
|
449
|
+
(expression_statement (assignment_expression
|
|
450
|
+
left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
|
|
451
|
+
right: (arrow_function) @cjs_fn))
|
|
452
|
+
(#eq? @exp "exports")
|
|
453
|
+
;; CJS object export with function value
|
|
454
|
+
(expression_statement (assignment_expression
|
|
455
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
456
|
+
right: (object (pair key: (property_identifier) @cjs_export_name value: (function) @cjs_fn))))
|
|
457
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
458
|
+
(expression_statement (assignment_expression
|
|
459
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
460
|
+
right: (object (pair key: (property_identifier) @cjs_export_name value: (arrow_function) @cjs_fn))))
|
|
461
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
462
|
+
;; CJS: module.exports = { helper () {} }
|
|
463
|
+
(expression_statement (assignment_expression
|
|
464
|
+
left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
|
|
465
|
+
right: (object (pair key: (property_identifier) @cjs_export_name value: (function_declaration) @cjs_fn))))
|
|
466
|
+
(#eq? @mod "module") (#eq? @prop "exports")
|
|
467
|
+
`,
|
|
468
|
+
locals: `
|
|
469
|
+
(function_declaration name: (identifier) @name)
|
|
470
|
+
(generator_function_declaration name: (identifier) @name)
|
|
471
|
+
(method_definition name: (property_identifier) @name)
|
|
472
|
+
(class_declaration name: (identifier) @name)
|
|
473
|
+
(variable_declarator name: (identifier) @name)
|
|
474
|
+
`,
|
|
475
|
+
importBindings: `
|
|
476
|
+
(import_statement) @stmt
|
|
477
|
+
(import_statement (string) @from) @stmt
|
|
478
|
+
(import_statement (import_clause (identifier) @def) (string) @from) @stmt
|
|
479
|
+
(import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname alias: (identifier) @alias))) (string) @from) @stmt
|
|
480
|
+
(import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname))) (string) @from) @stmt
|
|
481
|
+
(import_statement (import_clause (namespace_import (identifier) @ns)) (string) @from) @stmt
|
|
482
|
+
(lexical_declaration (variable_declarator name:(identifier) @def value: (call_expression (identifier) @req arguments: (arguments (string) @from)))) (#eq? @req "require")
|
|
483
|
+
(lexical_declaration (variable_declarator (object_pattern) @pattern value: (call_expression (identifier) @req arguments: (arguments (string) @from)))) (#eq? @req "require")
|
|
484
|
+
`
|
|
485
|
+
},
|
|
486
|
+
nodeTypes: {
|
|
487
|
+
identifier: ["identifier"],
|
|
488
|
+
propertyIdentifier: ["property_identifier"],
|
|
489
|
+
shorthandPropertyIdentifier: ["shorthand_property_identifier", "shorthand_property_identifier_pattern"],
|
|
490
|
+
memberExpression: "member_expression"
|
|
491
|
+
},
|
|
492
|
+
classifyDefinition: (n) => {
|
|
493
|
+
const t = n.parent?.type;
|
|
494
|
+
if (t === "function_declaration")
|
|
495
|
+
return "function";
|
|
496
|
+
if (t === "generator_function_declaration")
|
|
497
|
+
return "function";
|
|
498
|
+
if (t === "method_definition")
|
|
499
|
+
return "function";
|
|
500
|
+
if (t === "class_declaration")
|
|
501
|
+
return "class";
|
|
502
|
+
return "variable";
|
|
503
|
+
},
|
|
504
|
+
isDeclarationName: (node) => {
|
|
505
|
+
const p = node.parent?.type;
|
|
506
|
+
return !!p && [
|
|
507
|
+
"function_declaration",
|
|
508
|
+
"generator_function_declaration",
|
|
509
|
+
"class_declaration",
|
|
510
|
+
"variable_declarator",
|
|
511
|
+
"import_specifier",
|
|
512
|
+
"namespace_import",
|
|
513
|
+
"import_clause",
|
|
514
|
+
// Method names in classes: needed so that editing a method name is
|
|
515
|
+
// classified as a definition change, not an unrecognised node.
|
|
516
|
+
"method_definition"
|
|
517
|
+
].includes(p);
|
|
518
|
+
},
|
|
519
|
+
createsBlockScope: (n) => n.type === "program" || n.type === "block" || n.type === "class_body",
|
|
520
|
+
createsFunctionScope: (n) => n.type === "function_declaration" || n.type === "generator_function_declaration" || n.type === "function" || n.type === "function_expression" || n.type === "arrow_function" || n.type === "method_definition",
|
|
521
|
+
membersAreImplicitlyInScope: false,
|
|
522
|
+
supportsCrossModuleSymbols: true,
|
|
523
|
+
native: {
|
|
524
|
+
normalizeQuery: (_kind, query) => query.replace(/\(function\)/g, "(function_expression)").replace(JS_OBJECT_METHOD_EXPORT_PATTERN, JS_OBJECT_METHOD_EXPORT_NATIVE_PATTERN),
|
|
525
|
+
authoritativeKinds: ["exports"],
|
|
526
|
+
notes: ["normalizes function node compatibility for native javascript grammar"]
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
registerLanguage(JAVASCRIPT_DEF);
|
|
530
|
+
|
|
531
|
+
// dist/languages/definitions/python.js
|
|
532
|
+
var PYTHON_DEF = {
|
|
533
|
+
id: "python",
|
|
534
|
+
extensions: [".py", ".pyi"],
|
|
535
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-python"),
|
|
536
|
+
usesQueryDrivenLocals: true,
|
|
537
|
+
structure: {
|
|
538
|
+
blocks: [
|
|
539
|
+
{
|
|
540
|
+
type: "class_definition",
|
|
541
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
542
|
+
captureId: "class"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
type: "function_definition",
|
|
546
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
547
|
+
captureId: "function"
|
|
548
|
+
},
|
|
549
|
+
// Docstrings - only capture top-level module docstrings as standalone chunks
|
|
550
|
+
{
|
|
551
|
+
type: "expression_statement",
|
|
552
|
+
nameQuery: "(string) @chunk.docstring",
|
|
553
|
+
isBlock: false,
|
|
554
|
+
parentType: "module"
|
|
555
|
+
},
|
|
556
|
+
// Top level assignments
|
|
557
|
+
{
|
|
558
|
+
type: "assignment",
|
|
559
|
+
nameQuery: "left: (identifier) @chunk.name",
|
|
560
|
+
captureId: "module_var"
|
|
561
|
+
},
|
|
562
|
+
// Imports
|
|
563
|
+
{ type: "import_statement", captureId: "imports" },
|
|
564
|
+
{ type: "import_from_statement", captureId: "imports" }
|
|
565
|
+
],
|
|
566
|
+
splitPoints: [
|
|
567
|
+
"if_statement",
|
|
568
|
+
"for_statement",
|
|
569
|
+
"while_statement",
|
|
570
|
+
"try_statement",
|
|
571
|
+
"with_statement",
|
|
572
|
+
"match_statement"
|
|
573
|
+
],
|
|
574
|
+
comments: ["comment"]
|
|
575
|
+
},
|
|
576
|
+
graph: {
|
|
577
|
+
imports: `
|
|
578
|
+
(import_statement) @stmt
|
|
579
|
+
(import_from_statement) @stmt
|
|
580
|
+
(future_import_statement) @stmt
|
|
581
|
+
`,
|
|
582
|
+
// NOTE: These __all__ queries only capture module-level assignments.
|
|
583
|
+
// Dynamic __all__ definitions inside functions, conditionals, or loops
|
|
584
|
+
// (e.g., `if PY3: __all__ = [...]`) are not detected by these patterns.
|
|
585
|
+
// This is a known limitation - such patterns are rare in practice.
|
|
586
|
+
exports: `
|
|
587
|
+
;; __all__ = ["a", "b"] - simple list assignment
|
|
588
|
+
(assignment left: (identifier) @left right: (list (string)+ @all_item)) @stmt
|
|
589
|
+
;; __all__ = ("a", "b") - tuple assignment
|
|
590
|
+
(assignment left: (identifier) @left right: (tuple (string)+ @all_item)) @stmt
|
|
591
|
+
;; __all__ = ["a"] + ["b"] - concatenation (captures strings in both sides)
|
|
592
|
+
(assignment left: (identifier) @left right: (binary_operator (list (string)+ @all_item))) @stmt
|
|
593
|
+
(assignment left: (identifier) @left right: (binary_operator right: (list (string)+ @all_item))) @stmt
|
|
594
|
+
;; __all__.extend(["a"]) - extend pattern
|
|
595
|
+
(expression_statement (call function: (attribute object: (identifier) @left attribute: (identifier) @method) arguments: (argument_list (list (string)+ @all_item)))) @stmt
|
|
596
|
+
;; __all__.append("a") - append pattern
|
|
597
|
+
(expression_statement (call function: (attribute object: (identifier) @left attribute: (identifier) @method) arguments: (argument_list (string) @all_item))) @stmt
|
|
598
|
+
;; __all__ += ["a"] - augmented assignment
|
|
599
|
+
(augmented_assignment left: (identifier) @left right: (list (string)+ @all_item)) @stmt
|
|
600
|
+
(function_definition name: (identifier) @name)
|
|
601
|
+
(class_definition name: (identifier) @name)
|
|
602
|
+
(assignment left: (identifier) @name)
|
|
603
|
+
`,
|
|
604
|
+
locals: `
|
|
605
|
+
(function_definition name: (identifier) @name)
|
|
606
|
+
(class_definition name: (identifier) @name)
|
|
607
|
+
(assignment left: (identifier) @name)
|
|
608
|
+
;; \`case Point(x=x, y=y):\` binds the right-hand identifier of a keyword
|
|
609
|
+
;; pattern as a new local, distinct from the left-hand attribute name it
|
|
610
|
+
;; matches against.
|
|
611
|
+
;; A bare identifier in a case pattern is represented as a single-name
|
|
612
|
+
;; dotted_name inside a case_pattern. Nested tuple/list/or patterns
|
|
613
|
+
;; preserve this shape for each capture.
|
|
614
|
+
(case_pattern (dotted_name (identifier) @name))
|
|
615
|
+
;; \`case value as alias:\` binds the direct identifier child as its alias.
|
|
616
|
+
(as_pattern (identifier) @name)
|
|
617
|
+
;; \`case [head, *tail]:\` binds the capture after the splat.
|
|
618
|
+
(splat_pattern (identifier) @name)
|
|
619
|
+
`,
|
|
620
|
+
importBindings: `
|
|
621
|
+
(import_statement) @stmt
|
|
622
|
+
(import_from_statement) @stmt
|
|
623
|
+
(future_import_statement) @stmt
|
|
624
|
+
`
|
|
625
|
+
},
|
|
626
|
+
nodeTypes: {
|
|
627
|
+
identifier: ["identifier"],
|
|
628
|
+
propertyIdentifier: ["identifier"],
|
|
629
|
+
memberExpression: "attribute"
|
|
630
|
+
},
|
|
631
|
+
classifyDefinition: (n) => {
|
|
632
|
+
const t = n.parent?.type;
|
|
633
|
+
if (t === "function_definition")
|
|
634
|
+
return "function";
|
|
635
|
+
if (t === "class_definition")
|
|
636
|
+
return "class";
|
|
637
|
+
return "variable";
|
|
638
|
+
},
|
|
639
|
+
scopeDeclarationNames: (node) => {
|
|
640
|
+
const parentType = node.parent?.type;
|
|
641
|
+
return parentType === "case_pattern" || parentType === "as_pattern" || parentType === "splat_pattern" || parentType === "dotted_name";
|
|
642
|
+
},
|
|
643
|
+
isDeclarationName: (node) => {
|
|
644
|
+
const parent = node.parent;
|
|
645
|
+
const t = parent?.type;
|
|
646
|
+
if (t === "dotted_name" && parent && parent.namedChildren.length === 1 && (parent.parent?.type === "keyword_pattern" || parent.parent?.type === "case_pattern"))
|
|
647
|
+
return true;
|
|
648
|
+
if (parent?.type === "as_pattern")
|
|
649
|
+
return true;
|
|
650
|
+
if (t === "splat_pattern")
|
|
651
|
+
return true;
|
|
652
|
+
return !!t && ["function_definition", "class_definition", "assignment", "aliased_import"].includes(t);
|
|
653
|
+
},
|
|
654
|
+
createsBlockScope: (n) => n.type === "module" || n.type === "block",
|
|
655
|
+
createsFunctionScope: (n) => n.type === "function_definition" || n.type === "lambda",
|
|
656
|
+
membersAreImplicitlyInScope: false,
|
|
657
|
+
supportsCrossModuleSymbols: true
|
|
658
|
+
};
|
|
659
|
+
registerLanguage(PYTHON_DEF);
|
|
660
|
+
|
|
661
|
+
// dist/languages/definitions/php.js
|
|
662
|
+
var PHP_DEF = {
|
|
663
|
+
id: "php",
|
|
664
|
+
extensions: [".php"],
|
|
665
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-php"),
|
|
666
|
+
usesQueryDrivenLocals: true,
|
|
667
|
+
structure: {
|
|
668
|
+
blocks: [
|
|
669
|
+
{
|
|
670
|
+
type: "namespace_definition",
|
|
671
|
+
nameQuery: "name: (namespace_name) @chunk.name",
|
|
672
|
+
captureId: "namespace"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
type: "class_declaration",
|
|
676
|
+
nameQuery: "name: (name) @chunk.name",
|
|
677
|
+
captureId: "class"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
type: "interface_declaration",
|
|
681
|
+
nameQuery: "name: (name) @chunk.name",
|
|
682
|
+
captureId: "interface"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
type: "trait_declaration",
|
|
686
|
+
nameQuery: "name: (name) @chunk.name",
|
|
687
|
+
captureId: "trait"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
type: "enum_declaration",
|
|
691
|
+
nameQuery: "name: (name) @chunk.name",
|
|
692
|
+
captureId: "enum"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
type: "function_definition",
|
|
696
|
+
nameQuery: "name: (name) @chunk.name",
|
|
697
|
+
captureId: "function"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
type: "method_declaration",
|
|
701
|
+
nameQuery: "name: (name) @chunk.name",
|
|
702
|
+
captureId: "method"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
type: "const_declaration",
|
|
706
|
+
nameQuery: "(const_element (name) @chunk.name)",
|
|
707
|
+
captureId: "const"
|
|
708
|
+
}
|
|
709
|
+
],
|
|
710
|
+
splitPoints: [
|
|
711
|
+
"if_statement",
|
|
712
|
+
"switch_statement",
|
|
713
|
+
"for_statement",
|
|
714
|
+
"foreach_statement",
|
|
715
|
+
"while_statement",
|
|
716
|
+
"do_statement",
|
|
717
|
+
"try_statement",
|
|
718
|
+
"match_expression"
|
|
719
|
+
],
|
|
720
|
+
comments: ["comment"]
|
|
721
|
+
},
|
|
722
|
+
graph: {
|
|
723
|
+
imports: `
|
|
724
|
+
(require_expression) @stmt
|
|
725
|
+
(include_expression) @stmt
|
|
726
|
+
(require_once_expression) @stmt
|
|
727
|
+
(include_once_expression) @stmt
|
|
728
|
+
(namespace_use_declaration) @stmt
|
|
729
|
+
`,
|
|
730
|
+
exports: `
|
|
731
|
+
(namespace_definition name: (namespace_name) @name)
|
|
732
|
+
(class_declaration name: (name) @name)
|
|
733
|
+
(interface_declaration name: (name) @name)
|
|
734
|
+
(trait_declaration name: (name) @name)
|
|
735
|
+
(enum_declaration name: (name) @name)
|
|
736
|
+
(enum_case name: (name) @name)
|
|
737
|
+
(function_definition name: (name) @name)
|
|
738
|
+
(const_declaration (const_element (name) @name))
|
|
739
|
+
`,
|
|
740
|
+
locals: `
|
|
741
|
+
(class_declaration name: (name) @name)
|
|
742
|
+
(interface_declaration name: (name) @name)
|
|
743
|
+
(trait_declaration name: (name) @name)
|
|
744
|
+
(enum_declaration name: (name) @name)
|
|
745
|
+
(enum_case name: (name) @name)
|
|
746
|
+
(function_definition name: (name) @name)
|
|
747
|
+
(method_declaration name: (name) @name)
|
|
748
|
+
(const_declaration (const_element (name) @name))
|
|
749
|
+
(property_element (variable_name) @name)
|
|
750
|
+
`,
|
|
751
|
+
importBindings: `
|
|
752
|
+
(require_expression) @stmt
|
|
753
|
+
(include_expression) @stmt
|
|
754
|
+
(require_once_expression) @stmt
|
|
755
|
+
(include_once_expression) @stmt
|
|
756
|
+
(namespace_use_declaration) @stmt
|
|
757
|
+
`
|
|
758
|
+
},
|
|
759
|
+
nodeTypes: {
|
|
760
|
+
identifier: ["name", "variable_name", "namespace_name", "qualified_name", "relative_name"],
|
|
761
|
+
propertyIdentifier: ["name"],
|
|
762
|
+
memberExpression: "member_access_expression"
|
|
763
|
+
},
|
|
764
|
+
classifyDefinition: (node) => {
|
|
765
|
+
const parentType = node.parent?.type;
|
|
766
|
+
if (parentType === "class_declaration")
|
|
767
|
+
return "class";
|
|
768
|
+
if (parentType === "interface_declaration")
|
|
769
|
+
return "interface";
|
|
770
|
+
if (parentType === "trait_declaration")
|
|
771
|
+
return "trait";
|
|
772
|
+
if (parentType === "enum_declaration")
|
|
773
|
+
return "type";
|
|
774
|
+
if (parentType === "enum_case")
|
|
775
|
+
return "constant";
|
|
776
|
+
if (parentType === "function_definition")
|
|
777
|
+
return "function";
|
|
778
|
+
if (parentType === "method_declaration")
|
|
779
|
+
return "method";
|
|
780
|
+
if (parentType === "namespace_definition")
|
|
781
|
+
return "namespace";
|
|
782
|
+
if (parentType === "const_element" || parentType === "const_declaration") {
|
|
783
|
+
return "constant";
|
|
784
|
+
}
|
|
785
|
+
return "variable";
|
|
786
|
+
},
|
|
787
|
+
normalizeIdentifier: (name) => name.replace(/^\$/, ""),
|
|
788
|
+
isDeclarationName: (node) => {
|
|
789
|
+
const parent = node.parent;
|
|
790
|
+
if (!parent)
|
|
791
|
+
return false;
|
|
792
|
+
const nameFieldOwnerTypes = /* @__PURE__ */ new Set([
|
|
793
|
+
"namespace_definition",
|
|
794
|
+
"class_declaration",
|
|
795
|
+
"interface_declaration",
|
|
796
|
+
"trait_declaration",
|
|
797
|
+
"enum_declaration",
|
|
798
|
+
"enum_case",
|
|
799
|
+
"function_definition",
|
|
800
|
+
"method_declaration"
|
|
801
|
+
]);
|
|
802
|
+
if (nameFieldOwnerTypes.has(parent.type)) {
|
|
803
|
+
return parent.childForFieldName("name")?.id === node.id;
|
|
804
|
+
}
|
|
805
|
+
if (parent.type === "property_element" && node.type === "variable_name")
|
|
806
|
+
return true;
|
|
807
|
+
return parent.type === "const_element" && parent.namedChildren.some((child) => child.id === node.id && child.type === "name");
|
|
808
|
+
},
|
|
809
|
+
scopeDeclarationNames: (node) => node.type === "variable_name" && node.parent?.type === "property_element",
|
|
810
|
+
createsFunctionScope: (node) => node.type === "function_definition" || node.type === "method_declaration",
|
|
811
|
+
membersAreImplicitlyInScope: false,
|
|
812
|
+
supportsCrossModuleSymbols: true
|
|
813
|
+
};
|
|
814
|
+
registerLanguage(PHP_DEF);
|
|
815
|
+
|
|
816
|
+
// dist/languages/definitions/html.js
|
|
817
|
+
var HTML_DEF = {
|
|
818
|
+
id: "html",
|
|
819
|
+
extensions: [".html", ".htm"],
|
|
820
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-html"),
|
|
821
|
+
structure: {
|
|
822
|
+
blocks: [
|
|
823
|
+
{
|
|
824
|
+
type: "element",
|
|
825
|
+
nameQuery: `(start_tag (attribute (attribute_name) @attr (#eq? @attr "id") (quoted_attribute_value (attribute_value) @chunk.name)))`,
|
|
826
|
+
captureId: "element"
|
|
827
|
+
},
|
|
828
|
+
{ type: "script_element", captureId: "script" },
|
|
829
|
+
{ type: "style_element", captureId: "style" }
|
|
830
|
+
],
|
|
831
|
+
splitPoints: ["element"],
|
|
832
|
+
comments: ["comment"]
|
|
833
|
+
},
|
|
834
|
+
graph: {
|
|
835
|
+
imports: `
|
|
836
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
|
|
837
|
+
(element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#match? @tag "^(link|a)$")
|
|
838
|
+
(element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#match? @tag "^(link|a)$")
|
|
839
|
+
(element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#eq? @tag "img")
|
|
840
|
+
(element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#eq? @tag "img")
|
|
841
|
+
`,
|
|
842
|
+
exports: "",
|
|
843
|
+
locals: `
|
|
844
|
+
(attribute (attribute_name) @attr (#eq? @attr "id") (quoted_attribute_value (attribute_value) @name))
|
|
845
|
+
`,
|
|
846
|
+
importBindings: `
|
|
847
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
|
|
848
|
+
(element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @from)))) @stmt (#match? @tag "^(link|a)$")
|
|
849
|
+
(element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @from)))) @stmt (#match? @tag "^(link|a)$")
|
|
850
|
+
(element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt (#eq? @tag "img")
|
|
851
|
+
(element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt (#eq? @tag "img")
|
|
852
|
+
`
|
|
853
|
+
},
|
|
854
|
+
nodeTypes: {
|
|
855
|
+
identifier: ["attribute_value", "tag_name"]
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
registerLanguage(HTML_DEF);
|
|
859
|
+
|
|
860
|
+
// dist/languages/definitions/htmlStub.js
|
|
861
|
+
function htmlStubLanguage(id, extensions) {
|
|
862
|
+
return {
|
|
863
|
+
id,
|
|
864
|
+
extensions,
|
|
865
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-html"),
|
|
866
|
+
structure: {
|
|
867
|
+
blocks: [],
|
|
868
|
+
splitPoints: [],
|
|
869
|
+
comments: []
|
|
870
|
+
},
|
|
871
|
+
graph: {
|
|
872
|
+
imports: "",
|
|
873
|
+
exports: "",
|
|
874
|
+
locals: "",
|
|
875
|
+
importBindings: ""
|
|
876
|
+
},
|
|
877
|
+
nodeTypes: {
|
|
878
|
+
identifier: []
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// dist/languages/definitions/astro.js
|
|
884
|
+
var ASTRO_DEF = htmlStubLanguage("astro", [".astro"]);
|
|
885
|
+
registerLanguage(ASTRO_DEF);
|
|
886
|
+
|
|
887
|
+
// dist/languages/definitions/hbs.js
|
|
888
|
+
var HBS_DEF = htmlStubLanguage("hbs", [".hbs", ".handlebars"]);
|
|
889
|
+
registerLanguage(HBS_DEF);
|
|
890
|
+
|
|
891
|
+
// dist/languages/definitions/markdown.js
|
|
892
|
+
var MARKDOWN_DEF = htmlStubLanguage("markdown", [".md"]);
|
|
893
|
+
registerLanguage(MARKDOWN_DEF);
|
|
894
|
+
|
|
895
|
+
// dist/languages/definitions/mdx.js
|
|
896
|
+
var MDX_DEF = htmlStubLanguage("mdx", [".mdx"]);
|
|
897
|
+
registerLanguage(MDX_DEF);
|
|
898
|
+
|
|
899
|
+
// dist/languages/definitions/rst.js
|
|
900
|
+
var RST_DEF = htmlStubLanguage("rst", [".rst"]);
|
|
901
|
+
registerLanguage(RST_DEF);
|
|
902
|
+
|
|
903
|
+
// dist/languages/definitions/adoc.js
|
|
904
|
+
var ADOC_DEF = htmlStubLanguage("adoc", [".adoc", ".asciidoc"]);
|
|
905
|
+
registerLanguage(ADOC_DEF);
|
|
906
|
+
|
|
907
|
+
// dist/languages/definitions/cssLike.js
|
|
908
|
+
function cssLikeStructure() {
|
|
909
|
+
return {
|
|
910
|
+
blocks: [
|
|
911
|
+
{ type: "rule_set", captureId: "rule" },
|
|
912
|
+
{ type: "media_statement", captureId: "media" },
|
|
913
|
+
{ type: "keyframes_statement", captureId: "keyframes" }
|
|
914
|
+
],
|
|
915
|
+
splitPoints: ["rule_set"],
|
|
916
|
+
comments: ["comment", "js_comment"]
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function cssLikeGraph() {
|
|
920
|
+
return {
|
|
921
|
+
imports: `
|
|
922
|
+
(import_statement (string_value) @mod) @stmt
|
|
923
|
+
`,
|
|
924
|
+
exports: "",
|
|
925
|
+
locals: `
|
|
926
|
+
(class_selector (class_name) @name)
|
|
927
|
+
(id_selector (id_name) @name)
|
|
928
|
+
`,
|
|
929
|
+
importBindings: `
|
|
930
|
+
(import_statement (string_value) @from) @stmt
|
|
931
|
+
`
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
function cssLikeNodeTypes() {
|
|
935
|
+
return {
|
|
936
|
+
identifier: ["class_name", "id_name"]
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// dist/languages/definitions/css.js
|
|
941
|
+
var CSS_DEF = {
|
|
942
|
+
id: "css",
|
|
943
|
+
extensions: [".css"],
|
|
944
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-css"),
|
|
945
|
+
structure: cssLikeStructure(),
|
|
946
|
+
graph: cssLikeGraph(),
|
|
947
|
+
nodeTypes: cssLikeNodeTypes()
|
|
948
|
+
};
|
|
949
|
+
registerLanguage(CSS_DEF);
|
|
950
|
+
|
|
951
|
+
// dist/languages/definitions/scss.js
|
|
952
|
+
var SCSS_SYMBOL_QUERY_PATTERNS = [
|
|
953
|
+
"(mixin_statement (name) @name)",
|
|
954
|
+
"(function_statement (name) @name)",
|
|
955
|
+
"(variable_declaration (variable) @name)",
|
|
956
|
+
"(class_selector (class_name) @name)",
|
|
957
|
+
"(id_selector (id_name) @name)"
|
|
958
|
+
];
|
|
959
|
+
var SCSS_DEF = {
|
|
960
|
+
id: "scss",
|
|
961
|
+
extensions: [".scss"],
|
|
962
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-scss"),
|
|
963
|
+
structure: {
|
|
964
|
+
blocks: [
|
|
965
|
+
{ type: "rule_set", captureId: "rule" },
|
|
966
|
+
{ type: "mixin_statement", captureId: "mixin" },
|
|
967
|
+
{ type: "function_statement", captureId: "function" },
|
|
968
|
+
{ type: "media_statement", captureId: "media" },
|
|
969
|
+
{ type: "keyframes_statement", captureId: "keyframes" }
|
|
970
|
+
],
|
|
971
|
+
splitPoints: ["rule_set", "mixin_statement", "function_statement"],
|
|
972
|
+
comments: ["comment", "js_comment"]
|
|
973
|
+
},
|
|
974
|
+
graph: {
|
|
975
|
+
imports: `
|
|
976
|
+
(import_statement (string_value) @mod) @stmt
|
|
977
|
+
(use_statement (string_value) @mod) @stmt
|
|
978
|
+
(forward_statement (string_value) @mod) @stmt
|
|
979
|
+
`,
|
|
980
|
+
exports: `
|
|
981
|
+
(mixin_statement (name) @name)
|
|
982
|
+
(function_statement (name) @name)
|
|
983
|
+
(variable_declaration (variable) @name)
|
|
984
|
+
`,
|
|
985
|
+
locals: `
|
|
986
|
+
(mixin_statement (name) @name)
|
|
987
|
+
(function_statement (name) @name)
|
|
988
|
+
(variable_declaration (variable) @name)
|
|
989
|
+
(class_selector (class_name) @name)
|
|
990
|
+
(id_selector (id_name) @name)
|
|
991
|
+
`,
|
|
992
|
+
importBindings: `
|
|
993
|
+
(import_statement (string_value) @from) @stmt
|
|
994
|
+
(use_statement (string_value) @from) @stmt
|
|
995
|
+
(forward_statement (string_value) @from) @stmt
|
|
996
|
+
`
|
|
997
|
+
},
|
|
998
|
+
nodeTypes: {
|
|
999
|
+
identifier: ["name", "variable", "class_name", "id_name"]
|
|
1000
|
+
},
|
|
1001
|
+
native: {
|
|
1002
|
+
normalizeQuery: (_kind, query) => SCSS_SYMBOL_QUERY_PATTERNS.some((pattern) => query.includes(pattern)) ? "" : query,
|
|
1003
|
+
notes: ["skips unsupported SCSS symbol queries in the native runtime"]
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
registerLanguage(SCSS_DEF);
|
|
1007
|
+
|
|
1008
|
+
// dist/languages/definitions/less.js
|
|
1009
|
+
var LESS_DEF = {
|
|
1010
|
+
id: "less",
|
|
1011
|
+
extensions: [".less"],
|
|
1012
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-css"),
|
|
1013
|
+
structure: cssLikeStructure(),
|
|
1014
|
+
graph: cssLikeGraph(),
|
|
1015
|
+
nodeTypes: cssLikeNodeTypes()
|
|
1016
|
+
};
|
|
1017
|
+
registerLanguage(LESS_DEF);
|
|
1018
|
+
|
|
1019
|
+
// dist/languages/definitions/vue.js
|
|
1020
|
+
var VUE_DEF = {
|
|
1021
|
+
id: "vue",
|
|
1022
|
+
extensions: [".vue"],
|
|
1023
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-vue"),
|
|
1024
|
+
structure: {
|
|
1025
|
+
blocks: [
|
|
1026
|
+
{ type: "template_element", captureId: "template" },
|
|
1027
|
+
{ type: "script_element", captureId: "script" },
|
|
1028
|
+
{ type: "style_element", captureId: "style" }
|
|
1029
|
+
],
|
|
1030
|
+
splitPoints: ["template_element", "script_element", "style_element"],
|
|
1031
|
+
comments: ["comment"]
|
|
1032
|
+
},
|
|
1033
|
+
graph: {
|
|
1034
|
+
imports: `
|
|
1035
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
|
|
1036
|
+
`,
|
|
1037
|
+
exports: "",
|
|
1038
|
+
locals: "",
|
|
1039
|
+
importBindings: `
|
|
1040
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
|
|
1041
|
+
`
|
|
1042
|
+
},
|
|
1043
|
+
nodeTypes: {
|
|
1044
|
+
identifier: ["attribute_value"]
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
registerLanguage(VUE_DEF);
|
|
1048
|
+
|
|
1049
|
+
// dist/languages/definitions/svelte.js
|
|
1050
|
+
var SVELTE_DEF = {
|
|
1051
|
+
id: "svelte",
|
|
1052
|
+
extensions: [".svelte"],
|
|
1053
|
+
grammar: () => loadTreeSitterLanguage("@tree-sitter-grammars/tree-sitter-svelte"),
|
|
1054
|
+
structure: {
|
|
1055
|
+
blocks: [
|
|
1056
|
+
{ type: "script_element", captureId: "script" },
|
|
1057
|
+
{ type: "style_element", captureId: "style" },
|
|
1058
|
+
{ type: "element", captureId: "element" }
|
|
1059
|
+
],
|
|
1060
|
+
splitPoints: ["script_element", "style_element"],
|
|
1061
|
+
comments: ["comment"]
|
|
1062
|
+
},
|
|
1063
|
+
graph: {
|
|
1064
|
+
imports: `
|
|
1065
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
|
|
1066
|
+
`,
|
|
1067
|
+
exports: "",
|
|
1068
|
+
locals: "",
|
|
1069
|
+
importBindings: `
|
|
1070
|
+
(script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
|
|
1071
|
+
`
|
|
1072
|
+
},
|
|
1073
|
+
nodeTypes: {
|
|
1074
|
+
identifier: ["attribute_value"]
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
registerLanguage(SVELTE_DEF);
|
|
1078
|
+
|
|
1079
|
+
// dist/languages/definitions/ruby.js
|
|
1080
|
+
var RUBY_DEF = {
|
|
1081
|
+
id: "ruby",
|
|
1082
|
+
extensions: [".rb"],
|
|
1083
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-ruby"),
|
|
1084
|
+
structure: {
|
|
1085
|
+
blocks: [
|
|
1086
|
+
{
|
|
1087
|
+
type: "class",
|
|
1088
|
+
nameQuery: "name: (constant) @chunk.name",
|
|
1089
|
+
captureId: "class"
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
type: "module",
|
|
1093
|
+
nameQuery: "name: (constant) @chunk.name",
|
|
1094
|
+
captureId: "module"
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
type: "method",
|
|
1098
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1099
|
+
captureId: "method"
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
type: "singleton_method",
|
|
1103
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1104
|
+
captureId: "method"
|
|
1105
|
+
}
|
|
1106
|
+
],
|
|
1107
|
+
splitPoints: ["if", "unless", "case", "while", "until", "for", "begin"],
|
|
1108
|
+
comments: ["comment"]
|
|
1109
|
+
},
|
|
1110
|
+
graph: {
|
|
1111
|
+
imports: `
|
|
1112
|
+
(call method: (identifier) @method arguments: (argument_list (string (string_content) @mod)) (#match? @method "^(require|require_relative)$")) @stmt
|
|
1113
|
+
`,
|
|
1114
|
+
exports: `
|
|
1115
|
+
(class name: (constant) @name)
|
|
1116
|
+
(module name: (constant) @name)
|
|
1117
|
+
(method name: (identifier) @name)
|
|
1118
|
+
(assignment left: (constant) @name)
|
|
1119
|
+
`,
|
|
1120
|
+
locals: `
|
|
1121
|
+
(class name: (constant) @name)
|
|
1122
|
+
(module name: (constant) @name)
|
|
1123
|
+
(method name: (identifier) @name)
|
|
1124
|
+
(assignment left: (identifier) @name)
|
|
1125
|
+
(assignment left: (constant) @name)
|
|
1126
|
+
`,
|
|
1127
|
+
importBindings: `
|
|
1128
|
+
((call method: (identifier) @method arguments: (argument_list (string (string_content) @from))) @stmt (#match? @method "^(require|require_relative)$"))
|
|
1129
|
+
`
|
|
1130
|
+
},
|
|
1131
|
+
nodeTypes: {
|
|
1132
|
+
identifier: ["identifier", "constant"],
|
|
1133
|
+
memberExpression: "call"
|
|
1134
|
+
},
|
|
1135
|
+
supportsCrossModuleSymbols: true,
|
|
1136
|
+
classifyDefinition: (node) => {
|
|
1137
|
+
const assignment = node.parent;
|
|
1138
|
+
const value = assignment?.childForFieldName("right");
|
|
1139
|
+
if (assignment?.type === "assignment" && assignment.childForFieldName("left")?.id === node.id && value?.type === "call" && value.childForFieldName("receiver")?.text === "Struct" && value.childForFieldName("method")?.text === "new") {
|
|
1140
|
+
return "class";
|
|
1141
|
+
}
|
|
1142
|
+
return "variable";
|
|
1143
|
+
},
|
|
1144
|
+
scopeDeclarationNames: (node) => node.type === "constant" && node.parent?.type === "assignment",
|
|
1145
|
+
createsFunctionScope: (node) => node.type === "method" || node.type === "singleton_method",
|
|
1146
|
+
createsBlockScope: (node) => node.type === "do_block" || node.type === "block",
|
|
1147
|
+
isDeclarationName: (node) => {
|
|
1148
|
+
const p = node.parent;
|
|
1149
|
+
if (!p)
|
|
1150
|
+
return false;
|
|
1151
|
+
if (p.type === "class" && p.childForFieldName("name")?.id === node.id)
|
|
1152
|
+
return true;
|
|
1153
|
+
if (p.type === "module" && p.childForFieldName("name")?.id === node.id)
|
|
1154
|
+
return true;
|
|
1155
|
+
if (p.type === "method" && p.childForFieldName("name")?.id === node.id)
|
|
1156
|
+
return true;
|
|
1157
|
+
if (p.type === "singleton_method" && p.childForFieldName("name")?.id === node.id)
|
|
1158
|
+
return true;
|
|
1159
|
+
if (p.type === "assignment" && p.childForFieldName("left")?.id === node.id)
|
|
1160
|
+
return true;
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
registerLanguage(RUBY_DEF);
|
|
1165
|
+
|
|
1166
|
+
// dist/languages/definitions/go.js
|
|
1167
|
+
var GO_DEF = {
|
|
1168
|
+
id: "go",
|
|
1169
|
+
extensions: [".go"],
|
|
1170
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-go"),
|
|
1171
|
+
usesQueryDrivenLocals: true,
|
|
1172
|
+
structure: {
|
|
1173
|
+
blocks: [
|
|
1174
|
+
{
|
|
1175
|
+
type: "function_declaration",
|
|
1176
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1177
|
+
captureId: "function"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
type: "method_declaration",
|
|
1181
|
+
nameQuery: "name: (field_identifier) @chunk.name",
|
|
1182
|
+
captureId: "method"
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
type: "type_declaration",
|
|
1186
|
+
nameQuery: "(type_spec name: (type_identifier) @chunk.name)",
|
|
1187
|
+
captureId: "type"
|
|
1188
|
+
}
|
|
1189
|
+
],
|
|
1190
|
+
splitPoints: [
|
|
1191
|
+
"if_statement",
|
|
1192
|
+
"for_statement",
|
|
1193
|
+
"expression_switch_statement",
|
|
1194
|
+
"type_switch_statement",
|
|
1195
|
+
"select_statement"
|
|
1196
|
+
],
|
|
1197
|
+
comments: ["comment"]
|
|
1198
|
+
},
|
|
1199
|
+
graph: {
|
|
1200
|
+
imports: `
|
|
1201
|
+
(import_spec path: (interpreted_string_literal) @mod) @stmt
|
|
1202
|
+
`,
|
|
1203
|
+
exports: `
|
|
1204
|
+
(function_declaration name: (identifier) @name)
|
|
1205
|
+
(method_declaration name: (field_identifier) @name)
|
|
1206
|
+
(type_spec name: (type_identifier) @name)
|
|
1207
|
+
(const_spec name: (identifier) @name)
|
|
1208
|
+
(var_spec name: (identifier) @name)
|
|
1209
|
+
`,
|
|
1210
|
+
locals: `
|
|
1211
|
+
(function_declaration name: (identifier) @name)
|
|
1212
|
+
(method_declaration name: (field_identifier) @name)
|
|
1213
|
+
(type_spec name: (type_identifier) @name)
|
|
1214
|
+
(parameter_declaration name: (identifier) @name)
|
|
1215
|
+
(variadic_parameter_declaration name: (identifier) @name)
|
|
1216
|
+
(short_var_declaration left: (expression_list (identifier) @name))
|
|
1217
|
+
(var_spec name: (identifier) @name)
|
|
1218
|
+
(const_spec name: (identifier) @name)
|
|
1219
|
+
(type_spec type: (struct_type (field_declaration_list (field_declaration name: (field_identifier) @name))))
|
|
1220
|
+
(range_clause left: (expression_list (identifier) @name) (#not-eq? @name "_"))
|
|
1221
|
+
`,
|
|
1222
|
+
importBindings: `
|
|
1223
|
+
(import_spec name: (package_identifier) @alias path: (interpreted_string_literal) @from) @stmt
|
|
1224
|
+
(import_spec path: (interpreted_string_literal) @from) @stmt
|
|
1225
|
+
`
|
|
1226
|
+
},
|
|
1227
|
+
nodeTypes: {
|
|
1228
|
+
identifier: ["identifier", "field_identifier", "type_identifier", "package_identifier"],
|
|
1229
|
+
memberExpression: "selector_expression"
|
|
1230
|
+
},
|
|
1231
|
+
supportsCrossModuleSymbols: true,
|
|
1232
|
+
classifyDefinition: (node) => {
|
|
1233
|
+
const parent = node.parent;
|
|
1234
|
+
if (!parent)
|
|
1235
|
+
return "variable";
|
|
1236
|
+
if (parent.type === "function_declaration" || parent.type === "method_declaration")
|
|
1237
|
+
return "function";
|
|
1238
|
+
if (parent.type === "type_spec" && parent.childForFieldName("name")?.id === node.id)
|
|
1239
|
+
return "type";
|
|
1240
|
+
return "variable";
|
|
1241
|
+
},
|
|
1242
|
+
createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "method_declaration" || node.type === "func_literal",
|
|
1243
|
+
createsBlockScope: (node) => node.type === "block" || node.type === "for_statement",
|
|
1244
|
+
membersAreImplicitlyInScope: false,
|
|
1245
|
+
isDeclarationName: (node) => {
|
|
1246
|
+
const p = node.parent;
|
|
1247
|
+
if (!p)
|
|
1248
|
+
return false;
|
|
1249
|
+
if (p.type === "function_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1250
|
+
return true;
|
|
1251
|
+
if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1252
|
+
return true;
|
|
1253
|
+
if (p.type === "type_spec" && p.childForFieldName("name")?.id === node.id)
|
|
1254
|
+
return true;
|
|
1255
|
+
if (p.type === "var_spec" && p.childForFieldName("name")?.id === node.id)
|
|
1256
|
+
return true;
|
|
1257
|
+
if (p.type === "const_spec" && p.childForFieldName("name")?.id === node.id)
|
|
1258
|
+
return true;
|
|
1259
|
+
if (p.type === "expression_list" && p.parent?.type === "short_var_declaration")
|
|
1260
|
+
return node.type === "identifier";
|
|
1261
|
+
if (p.type === "expression_list" && p.parent?.type === "range_clause")
|
|
1262
|
+
return node.type === "identifier" && node.text !== "_";
|
|
1263
|
+
if (p.type === "parameter_declaration" || p.type === "variadic_parameter_declaration") {
|
|
1264
|
+
return node.type === "identifier";
|
|
1265
|
+
}
|
|
1266
|
+
if (p.type === "field_declaration" && node.type === "field_identifier")
|
|
1267
|
+
return true;
|
|
1268
|
+
return false;
|
|
1269
|
+
},
|
|
1270
|
+
scopeDeclarationNames: (node) => node.type === "field_identifier" && node.parent?.type === "field_declaration" || node.type === "identifier" && node.parent?.type === "expression_list" && node.parent.parent?.type === "range_clause"
|
|
1271
|
+
};
|
|
1272
|
+
registerLanguage(GO_DEF);
|
|
1273
|
+
|
|
1274
|
+
// dist/languages/definitions/java.js
|
|
1275
|
+
var JAVA_DEF = {
|
|
1276
|
+
id: "java",
|
|
1277
|
+
extensions: [".java"],
|
|
1278
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-java"),
|
|
1279
|
+
usesQueryDrivenLocals: true,
|
|
1280
|
+
structure: {
|
|
1281
|
+
blocks: [
|
|
1282
|
+
{
|
|
1283
|
+
type: "class_declaration",
|
|
1284
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1285
|
+
captureId: "class"
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
type: "record_declaration",
|
|
1289
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1290
|
+
captureId: "class"
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
type: "interface_declaration",
|
|
1294
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1295
|
+
captureId: "interface"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
type: "enum_declaration",
|
|
1299
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1300
|
+
captureId: "enum"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
type: "annotation_type_declaration",
|
|
1304
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1305
|
+
captureId: "interface"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
type: "method_declaration",
|
|
1309
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1310
|
+
captureId: "method"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
type: "constructor_declaration",
|
|
1314
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1315
|
+
captureId: "method"
|
|
1316
|
+
}
|
|
1317
|
+
],
|
|
1318
|
+
splitPoints: ["if_statement", "for_statement", "while_statement", "try_statement", "switch_expression"],
|
|
1319
|
+
comments: ["line_comment", "block_comment"]
|
|
1320
|
+
},
|
|
1321
|
+
graph: {
|
|
1322
|
+
imports: `
|
|
1323
|
+
(import_declaration . (_) @mod) @stmt
|
|
1324
|
+
`,
|
|
1325
|
+
exports: `
|
|
1326
|
+
(class_declaration name: (identifier) @name)
|
|
1327
|
+
(record_declaration name: (identifier) @name)
|
|
1328
|
+
(interface_declaration name: (identifier) @name)
|
|
1329
|
+
(enum_declaration name: (identifier) @name)
|
|
1330
|
+
(annotation_type_declaration name: (identifier) @name)
|
|
1331
|
+
(enum_constant name: (identifier) @name)
|
|
1332
|
+
(method_declaration name: (identifier) @name)
|
|
1333
|
+
(field_declaration (variable_declarator name: (identifier) @name))
|
|
1334
|
+
`,
|
|
1335
|
+
locals: `
|
|
1336
|
+
(class_declaration name: (identifier) @name)
|
|
1337
|
+
(record_declaration name: (identifier) @name)
|
|
1338
|
+
(interface_declaration name: (identifier) @name)
|
|
1339
|
+
(enum_declaration name: (identifier) @name)
|
|
1340
|
+
(annotation_type_declaration name: (identifier) @name)
|
|
1341
|
+
(enum_constant name: (identifier) @name)
|
|
1342
|
+
(method_declaration name: (identifier) @name)
|
|
1343
|
+
(variable_declarator name: (identifier) @name)
|
|
1344
|
+
`,
|
|
1345
|
+
importBindings: `
|
|
1346
|
+
(import_declaration . (_) @from) @stmt
|
|
1347
|
+
`
|
|
1348
|
+
},
|
|
1349
|
+
nodeTypes: {
|
|
1350
|
+
identifier: ["identifier", "type_identifier"],
|
|
1351
|
+
memberExpression: "field_access"
|
|
1352
|
+
},
|
|
1353
|
+
supportsCrossModuleSymbols: true,
|
|
1354
|
+
classifyDefinition: (node) => {
|
|
1355
|
+
const parent = node.parent;
|
|
1356
|
+
if (!parent)
|
|
1357
|
+
return "variable";
|
|
1358
|
+
if (parent.type === "method_declaration" || parent.type === "constructor_declaration")
|
|
1359
|
+
return "method";
|
|
1360
|
+
if (parent.type === "class_declaration" || parent.type === "record_declaration")
|
|
1361
|
+
return "class";
|
|
1362
|
+
if (parent.type === "interface_declaration" || parent.type === "annotation_type_declaration")
|
|
1363
|
+
return "interface";
|
|
1364
|
+
if (parent.type === "enum_declaration")
|
|
1365
|
+
return "type";
|
|
1366
|
+
return "variable";
|
|
1367
|
+
},
|
|
1368
|
+
createsFunctionScope: (node) => node.type === "method_declaration" || node.type === "constructor_declaration",
|
|
1369
|
+
createsBlockScope: (node) => node.type === "block" || node.type === "class_body",
|
|
1370
|
+
isDeclarationName: (node) => {
|
|
1371
|
+
const p = node.parent;
|
|
1372
|
+
if (!p)
|
|
1373
|
+
return false;
|
|
1374
|
+
if (p.type === "class_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1375
|
+
return true;
|
|
1376
|
+
if (p.type === "record_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1377
|
+
return true;
|
|
1378
|
+
if (p.type === "interface_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1379
|
+
return true;
|
|
1380
|
+
if (p.type === "annotation_type_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1381
|
+
return true;
|
|
1382
|
+
if (p.type === "enum_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1383
|
+
return true;
|
|
1384
|
+
if (p.type === "enum_constant" && p.childForFieldName("name")?.id === node.id)
|
|
1385
|
+
return true;
|
|
1386
|
+
if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1387
|
+
return true;
|
|
1388
|
+
if (p.type === "variable_declarator" && p.childForFieldName("name")?.id === node.id)
|
|
1389
|
+
return true;
|
|
1390
|
+
if (p.type === "formal_parameter" && p.childForFieldName("name")?.id === node.id)
|
|
1391
|
+
return true;
|
|
1392
|
+
return false;
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
registerLanguage(JAVA_DEF);
|
|
1396
|
+
|
|
1397
|
+
// dist/languages/definitions/csharp.js
|
|
1398
|
+
var CSHARP_DEF = {
|
|
1399
|
+
id: "csharp",
|
|
1400
|
+
extensions: [".cs"],
|
|
1401
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-c-sharp"),
|
|
1402
|
+
usesQueryDrivenLocals: true,
|
|
1403
|
+
structure: {
|
|
1404
|
+
blocks: [
|
|
1405
|
+
{
|
|
1406
|
+
type: "class_declaration",
|
|
1407
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1408
|
+
captureId: "class"
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
type: "record_declaration",
|
|
1412
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1413
|
+
captureId: "class"
|
|
1414
|
+
},
|
|
1415
|
+
{
|
|
1416
|
+
type: "interface_declaration",
|
|
1417
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1418
|
+
captureId: "interface"
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
type: "enum_declaration",
|
|
1422
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1423
|
+
captureId: "enum"
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
type: "method_declaration",
|
|
1427
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1428
|
+
captureId: "method"
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
type: "namespace_declaration",
|
|
1432
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1433
|
+
captureId: "namespace"
|
|
1434
|
+
}
|
|
1435
|
+
],
|
|
1436
|
+
splitPoints: [
|
|
1437
|
+
"if_statement",
|
|
1438
|
+
"for_statement",
|
|
1439
|
+
"foreach_statement",
|
|
1440
|
+
"while_statement",
|
|
1441
|
+
"switch_statement",
|
|
1442
|
+
"try_statement"
|
|
1443
|
+
],
|
|
1444
|
+
comments: ["comment"]
|
|
1445
|
+
},
|
|
1446
|
+
graph: {
|
|
1447
|
+
imports: `
|
|
1448
|
+
(using_directive . (_) @mod) @stmt
|
|
1449
|
+
`,
|
|
1450
|
+
exports: `
|
|
1451
|
+
(class_declaration name: (identifier) @name)
|
|
1452
|
+
(record_declaration name: (identifier) @name)
|
|
1453
|
+
(interface_declaration name: (identifier) @name)
|
|
1454
|
+
(enum_declaration name: (identifier) @name)
|
|
1455
|
+
(enum_member_declaration name: (identifier) @name)
|
|
1456
|
+
(method_declaration name: (identifier) @name)
|
|
1457
|
+
(property_declaration name: (identifier) @name)
|
|
1458
|
+
`,
|
|
1459
|
+
locals: `
|
|
1460
|
+
(class_declaration name: (identifier) @name)
|
|
1461
|
+
(record_declaration name: (identifier) @name)
|
|
1462
|
+
(interface_declaration name: (identifier) @name)
|
|
1463
|
+
(enum_declaration name: (identifier) @name)
|
|
1464
|
+
(enum_member_declaration name: (identifier) @name)
|
|
1465
|
+
(method_declaration name: (identifier) @name)
|
|
1466
|
+
(variable_declarator (identifier) @name)
|
|
1467
|
+
(declaration_pattern name: (identifier) @name)
|
|
1468
|
+
`,
|
|
1469
|
+
importBindings: `
|
|
1470
|
+
(using_directive name: (identifier) @alias . (_) @from) @stmt
|
|
1471
|
+
(using_directive . (_) @from) @stmt
|
|
1472
|
+
`
|
|
1473
|
+
},
|
|
1474
|
+
nodeTypes: {
|
|
1475
|
+
identifier: ["identifier"],
|
|
1476
|
+
memberExpression: "member_access_expression"
|
|
1477
|
+
},
|
|
1478
|
+
supportsCrossModuleSymbols: true,
|
|
1479
|
+
classifyDefinition: (node) => {
|
|
1480
|
+
const parent = node.parent;
|
|
1481
|
+
if (!parent)
|
|
1482
|
+
return "variable";
|
|
1483
|
+
if (parent.type === "method_declaration" || parent.type === "constructor_declaration")
|
|
1484
|
+
return "method";
|
|
1485
|
+
if (parent.type === "class_declaration" || parent.type === "record_declaration")
|
|
1486
|
+
return "class";
|
|
1487
|
+
if (parent.type === "interface_declaration")
|
|
1488
|
+
return "interface";
|
|
1489
|
+
if (parent.type === "enum_declaration")
|
|
1490
|
+
return "type";
|
|
1491
|
+
return "variable";
|
|
1492
|
+
},
|
|
1493
|
+
createsFunctionScope: (node) => node.type === "method_declaration" || node.type === "constructor_declaration",
|
|
1494
|
+
createsBlockScope: (node) => node.type === "block" || node.type === "declaration_list",
|
|
1495
|
+
isDeclarationName: (node) => {
|
|
1496
|
+
const p = node.parent;
|
|
1497
|
+
if (!p)
|
|
1498
|
+
return false;
|
|
1499
|
+
if (p.type === "class_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1500
|
+
return true;
|
|
1501
|
+
if (p.type === "record_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1502
|
+
return true;
|
|
1503
|
+
if (p.type === "interface_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1504
|
+
return true;
|
|
1505
|
+
if (p.type === "enum_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1506
|
+
return true;
|
|
1507
|
+
if (p.type === "enum_member_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1508
|
+
return true;
|
|
1509
|
+
if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
|
|
1510
|
+
return true;
|
|
1511
|
+
if (p.type === "variable_declarator" && p.child(0)?.id === node.id)
|
|
1512
|
+
return true;
|
|
1513
|
+
if (p.type === "parameter" && p.childForFieldName("name")?.id === node.id)
|
|
1514
|
+
return true;
|
|
1515
|
+
if (p.type === "declaration_pattern" && p.childForFieldName("name")?.id === node.id)
|
|
1516
|
+
return true;
|
|
1517
|
+
return false;
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
registerLanguage(CSHARP_DEF);
|
|
1521
|
+
|
|
1522
|
+
// dist/languages/definitions/rust.js
|
|
1523
|
+
var RUST_DEF = {
|
|
1524
|
+
id: "rust",
|
|
1525
|
+
extensions: [".rs"],
|
|
1526
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-rust"),
|
|
1527
|
+
usesQueryDrivenLocals: true,
|
|
1528
|
+
structure: {
|
|
1529
|
+
blocks: [
|
|
1530
|
+
{
|
|
1531
|
+
type: "function_item",
|
|
1532
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1533
|
+
captureId: "function"
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
type: "struct_item",
|
|
1537
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
1538
|
+
captureId: "struct"
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
type: "enum_item",
|
|
1542
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
1543
|
+
captureId: "enum"
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
type: "impl_item",
|
|
1547
|
+
nameQuery: "type: (type_identifier) @chunk.name",
|
|
1548
|
+
captureId: "impl"
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
type: "mod_item",
|
|
1552
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1553
|
+
captureId: "module"
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
type: "macro_definition",
|
|
1557
|
+
nameQuery: "name: (identifier) @chunk.name",
|
|
1558
|
+
captureId: "macro"
|
|
1559
|
+
}
|
|
1560
|
+
],
|
|
1561
|
+
splitPoints: ["if_expression", "for_expression", "while_expression", "loop_expression", "match_expression"],
|
|
1562
|
+
comments: ["line_comment", "block_comment"]
|
|
1563
|
+
},
|
|
1564
|
+
graph: {
|
|
1565
|
+
imports: `
|
|
1566
|
+
(mod_item name: (identifier) @mod) @stmt
|
|
1567
|
+
(extern_crate_declaration name: (identifier) @mod) @stmt
|
|
1568
|
+
(use_declaration argument: (_) @mod) @stmt
|
|
1569
|
+
`,
|
|
1570
|
+
exports: `
|
|
1571
|
+
(function_item name: (identifier) @name) @stmt
|
|
1572
|
+
(struct_item name: (type_identifier) @name) @stmt
|
|
1573
|
+
(trait_item name: (type_identifier) @name) @stmt
|
|
1574
|
+
(enum_item name: (type_identifier) @name) @stmt
|
|
1575
|
+
(enum_variant name: (identifier) @name) @stmt
|
|
1576
|
+
(const_item name: (identifier) @name) @stmt
|
|
1577
|
+
(static_item name: (identifier) @name) @stmt
|
|
1578
|
+
(macro_definition name: (identifier) @name) @stmt
|
|
1579
|
+
(use_declaration argument: (scoped_identifier path: (_) @from name: (identifier) @src)) @stmt
|
|
1580
|
+
(use_declaration argument: (identifier) @src) @stmt
|
|
1581
|
+
;; Grouped imports: \`use foo::{Bar, Baz};\` (and scoped forms like
|
|
1582
|
+
;; \`use crate::foo::{Bar, Baz};\`) - emit one export per named member
|
|
1583
|
+
;; so each is a resolvable target, matching the plain scoped_identifier
|
|
1584
|
+
;; form above. The shared path may itself be scoped, so it is captured
|
|
1585
|
+
;; generically rather than requiring a single bare identifier segment.
|
|
1586
|
+
(use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (identifier) @src))) @stmt
|
|
1587
|
+
;; Aliased members inside a group (\`use foo::{Bar as Baz}\`) export
|
|
1588
|
+
;; under their alias, matching how a single aliased import behaves.
|
|
1589
|
+
(use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (use_as_clause alias: (identifier) @src)))) @stmt
|
|
1590
|
+
`,
|
|
1591
|
+
locals: `
|
|
1592
|
+
(function_item name: (identifier) @name)
|
|
1593
|
+
(struct_item name: (type_identifier) @name)
|
|
1594
|
+
(trait_item name: (type_identifier) @name)
|
|
1595
|
+
(enum_item name: (type_identifier) @name)
|
|
1596
|
+
(enum_variant name: (identifier) @name)
|
|
1597
|
+
(const_item name: (identifier) @name)
|
|
1598
|
+
(static_item name: (identifier) @name)
|
|
1599
|
+
(macro_definition name: (identifier) @name)
|
|
1600
|
+
(let_declaration pattern: (identifier) @name)
|
|
1601
|
+
(parameter pattern: (identifier) @name)
|
|
1602
|
+
`,
|
|
1603
|
+
importBindings: `
|
|
1604
|
+
(mod_item name: (identifier) @from) @stmt
|
|
1605
|
+
(extern_crate_declaration name: (identifier) @from) @stmt
|
|
1606
|
+
(extern_crate_declaration name: (identifier) @from alias: (identifier) @alias) @stmt
|
|
1607
|
+
(use_declaration argument: (use_as_clause path: (identifier) @from alias: (identifier) @alias)) @stmt
|
|
1608
|
+
(use_declaration argument: (use_as_clause path: (scoped_identifier path: (_) @from name: (identifier) @iname) alias: (identifier) @alias)) @stmt
|
|
1609
|
+
(use_declaration argument: (scoped_identifier path: (_) @from name: (identifier) @iname)) @stmt
|
|
1610
|
+
(use_declaration argument: (identifier) @from) @stmt
|
|
1611
|
+
(use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (identifier) @iname))) @stmt
|
|
1612
|
+
;; Aliased members inside a group (\`use foo::{Bar as Baz}\`): import
|
|
1613
|
+
;; the original name under its local alias.
|
|
1614
|
+
(use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (use_as_clause path: (identifier) @iname alias: (identifier) @alias)))) @stmt
|
|
1615
|
+
`
|
|
1616
|
+
},
|
|
1617
|
+
nodeTypes: {
|
|
1618
|
+
identifier: ["identifier", "type_identifier"],
|
|
1619
|
+
memberExpression: "field_expression"
|
|
1620
|
+
},
|
|
1621
|
+
supportsCrossModuleSymbols: true,
|
|
1622
|
+
scopeDeclarationNames: (node) => node.parent?.type === "macro_definition",
|
|
1623
|
+
classifyDefinition: (node) => {
|
|
1624
|
+
const parent = node.parent;
|
|
1625
|
+
if (!parent)
|
|
1626
|
+
return "variable";
|
|
1627
|
+
if (parent.type === "function_item" || parent.type === "macro_definition")
|
|
1628
|
+
return "function";
|
|
1629
|
+
if (parent.type === "enum_item")
|
|
1630
|
+
return "type";
|
|
1631
|
+
if (parent.type === "struct_item" || parent.type === "trait_item")
|
|
1632
|
+
return "class";
|
|
1633
|
+
return "variable";
|
|
1634
|
+
},
|
|
1635
|
+
createsFunctionScope: (node) => node.type === "function_item",
|
|
1636
|
+
createsBlockScope: (node) => node.type === "block",
|
|
1637
|
+
membersAreImplicitlyInScope: false,
|
|
1638
|
+
isDeclarationName: (node) => {
|
|
1639
|
+
const p = node.parent;
|
|
1640
|
+
if (!p)
|
|
1641
|
+
return false;
|
|
1642
|
+
if (p.type === "function_item" && p.childForFieldName("name")?.id === node.id)
|
|
1643
|
+
return true;
|
|
1644
|
+
if (p.type === "struct_item" && p.childForFieldName("name")?.id === node.id)
|
|
1645
|
+
return true;
|
|
1646
|
+
if (p.type === "trait_item" && p.childForFieldName("name")?.id === node.id)
|
|
1647
|
+
return true;
|
|
1648
|
+
if (p.type === "enum_item" && p.childForFieldName("name")?.id === node.id)
|
|
1649
|
+
return true;
|
|
1650
|
+
if (p.type === "enum_variant" && p.childForFieldName("name")?.id === node.id)
|
|
1651
|
+
return true;
|
|
1652
|
+
if (p.type === "const_item" && p.childForFieldName("name")?.id === node.id)
|
|
1653
|
+
return true;
|
|
1654
|
+
if (p.type === "static_item" && p.childForFieldName("name")?.id === node.id)
|
|
1655
|
+
return true;
|
|
1656
|
+
if (p.type === "macro_definition" && p.childForFieldName("name")?.id === node.id)
|
|
1657
|
+
return true;
|
|
1658
|
+
if (p.type === "let_declaration" && p.childForFieldName("pattern")?.id === node.id)
|
|
1659
|
+
return true;
|
|
1660
|
+
if (p.type === "parameter" && p.childForFieldName("pattern")?.id === node.id)
|
|
1661
|
+
return true;
|
|
1662
|
+
return false;
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
registerLanguage(RUST_DEF);
|
|
1666
|
+
|
|
1667
|
+
// dist/languages/definitions/cFamily.js
|
|
1668
|
+
var cFamilyContainerTypes = /* @__PURE__ */ new Set([
|
|
1669
|
+
"function_definition",
|
|
1670
|
+
"declaration",
|
|
1671
|
+
"parameter_declaration",
|
|
1672
|
+
"field_declaration",
|
|
1673
|
+
"type_definition",
|
|
1674
|
+
"init_declarator"
|
|
1675
|
+
]);
|
|
1676
|
+
var cFamilyControlSplitPoints = [
|
|
1677
|
+
"if_statement",
|
|
1678
|
+
"for_statement",
|
|
1679
|
+
"while_statement",
|
|
1680
|
+
"do_statement",
|
|
1681
|
+
"switch_statement",
|
|
1682
|
+
"case_statement"
|
|
1683
|
+
];
|
|
1684
|
+
var cFamilyIncludeImportsQuery = `
|
|
1685
|
+
(preproc_include path: (string_literal) @mod) @stmt
|
|
1686
|
+
(preproc_include path: (system_lib_string) @mod) @stmt
|
|
1687
|
+
(preproc_include path: (identifier) @mod) @stmt
|
|
1688
|
+
`;
|
|
1689
|
+
var cFamilyIncludeBindingsQuery = `
|
|
1690
|
+
(preproc_include path: (string_literal) @from) @stmt
|
|
1691
|
+
(preproc_include path: (system_lib_string) @from) @stmt
|
|
1692
|
+
(preproc_include path: (identifier) @from) @stmt
|
|
1693
|
+
`;
|
|
1694
|
+
var cFamilyParameterListTypes = /* @__PURE__ */ new Set(["parameter_declaration", "parameter_list"]);
|
|
1695
|
+
function cFunctionNameQuery(captureName, includeFieldIdentifier) {
|
|
1696
|
+
const identifierTypes = includeFieldIdentifier ? ["identifier", "field_identifier"] : ["identifier"];
|
|
1697
|
+
const patterns = [];
|
|
1698
|
+
for (const identifierType of identifierTypes) {
|
|
1699
|
+
patterns.push(`(function_declarator declarator: (${identifierType}) @${captureName})`);
|
|
1700
|
+
patterns.push(`(function_declarator declarator: (pointer_declarator declarator: (${identifierType}) @${captureName}))`);
|
|
1701
|
+
patterns.push(`(pointer_declarator declarator: (function_declarator declarator: (${identifierType}) @${captureName}))`);
|
|
1702
|
+
patterns.push(`(function_declarator declarator: (parenthesized_declarator (pointer_declarator declarator: (${identifierType}) @${captureName})))`);
|
|
1703
|
+
}
|
|
1704
|
+
return `
|
|
1705
|
+
declarator: [
|
|
1706
|
+
${patterns.join("\n ")}
|
|
1707
|
+
]
|
|
1708
|
+
`;
|
|
1709
|
+
}
|
|
1710
|
+
function cFamilyCoreExportQueries(functionNameQuery) {
|
|
1711
|
+
return [
|
|
1712
|
+
`(function_definition ${functionNameQuery})`,
|
|
1713
|
+
`(declaration ${functionNameQuery})`,
|
|
1714
|
+
`(struct_specifier name: (type_identifier) @name)`,
|
|
1715
|
+
`(enum_specifier name: (type_identifier) @name)`,
|
|
1716
|
+
`(type_definition declarator: (type_identifier) @name)`,
|
|
1717
|
+
`(declaration declarator: (identifier) @name)`,
|
|
1718
|
+
`(declaration declarator: (init_declarator declarator: (identifier) @name))`
|
|
1719
|
+
];
|
|
1720
|
+
}
|
|
1721
|
+
function cFamilyCoreLocalQueries(functionNameQuery) {
|
|
1722
|
+
return [
|
|
1723
|
+
`(function_definition ${functionNameQuery})`,
|
|
1724
|
+
`(struct_specifier name: (type_identifier) @name)`,
|
|
1725
|
+
`(enum_specifier name: (type_identifier) @name)`,
|
|
1726
|
+
`(type_definition declarator: (type_identifier) @name)`,
|
|
1727
|
+
`(declaration declarator: (identifier) @name)`,
|
|
1728
|
+
`(declaration declarator: (init_declarator declarator: (identifier) @name))`,
|
|
1729
|
+
`(parameter_declaration declarator: (identifier) @name)`,
|
|
1730
|
+
`(field_declaration declarator: (field_identifier) @name)`
|
|
1731
|
+
];
|
|
1732
|
+
}
|
|
1733
|
+
function joinQueryPatterns(patterns) {
|
|
1734
|
+
return `
|
|
1735
|
+
${patterns.join("\n ")}
|
|
1736
|
+
`;
|
|
1737
|
+
}
|
|
1738
|
+
function cFamilyBlock(type, nameQuery, captureId) {
|
|
1739
|
+
return {
|
|
1740
|
+
type,
|
|
1741
|
+
nameQuery,
|
|
1742
|
+
captureId
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
function cFamilyFunctionBlock(functionNameQuery) {
|
|
1746
|
+
return cFamilyBlock("function_definition", functionNameQuery, "function");
|
|
1747
|
+
}
|
|
1748
|
+
function cFamilyTypeIdentifierBlock(type, captureId) {
|
|
1749
|
+
return cFamilyBlock(type, "name: (type_identifier) @chunk.name", captureId);
|
|
1750
|
+
}
|
|
1751
|
+
function createCFamilyLanguageDefinition(options) {
|
|
1752
|
+
const functionNameQuery = cFunctionNameQuery("chunk.name", options.includeFieldIdentifier);
|
|
1753
|
+
const graphFunctionNameQuery = cFunctionNameQuery("name", options.includeFieldIdentifier);
|
|
1754
|
+
return {
|
|
1755
|
+
id: options.id,
|
|
1756
|
+
extensions: [...options.extensions],
|
|
1757
|
+
grammar: () => loadTreeSitterLanguage(options.grammarPackage),
|
|
1758
|
+
structure: {
|
|
1759
|
+
blocks: options.blocks(functionNameQuery),
|
|
1760
|
+
splitPoints: [...options.splitPoints ?? cFamilyControlSplitPoints],
|
|
1761
|
+
comments: ["comment"]
|
|
1762
|
+
},
|
|
1763
|
+
graph: {
|
|
1764
|
+
imports: cFamilyIncludeImportsQuery,
|
|
1765
|
+
exports: joinQueryPatterns([
|
|
1766
|
+
...cFamilyCoreExportQueries(graphFunctionNameQuery),
|
|
1767
|
+
...options.extraExportQueries ?? []
|
|
1768
|
+
]),
|
|
1769
|
+
locals: joinQueryPatterns([
|
|
1770
|
+
...cFamilyCoreLocalQueries(graphFunctionNameQuery),
|
|
1771
|
+
...options.extraLocalQueries ?? []
|
|
1772
|
+
]),
|
|
1773
|
+
importBindings: cFamilyIncludeBindingsQuery
|
|
1774
|
+
},
|
|
1775
|
+
nodeTypes: options.nodeTypes,
|
|
1776
|
+
classifyDefinition: options.classifyDefinition,
|
|
1777
|
+
isDeclarationName: options.isDeclarationName,
|
|
1778
|
+
scopeDeclarationNames: "all",
|
|
1779
|
+
createsFunctionScope: options.createsFunctionScope,
|
|
1780
|
+
createsBlockScope: (node) => node.type === "compound_statement",
|
|
1781
|
+
supportsCrossModuleSymbols: true,
|
|
1782
|
+
usesQueryDrivenLocals: options.usesQueryDrivenLocals || false
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
function isWithin(node, ancestor) {
|
|
1786
|
+
let current = node;
|
|
1787
|
+
while (current) {
|
|
1788
|
+
if (ancestor && current.id === ancestor.id)
|
|
1789
|
+
return true;
|
|
1790
|
+
current = current.parent;
|
|
1791
|
+
}
|
|
1792
|
+
return false;
|
|
1793
|
+
}
|
|
1794
|
+
function isInField(node, parent, field) {
|
|
1795
|
+
return isWithin(node, parent.childForFieldName(field));
|
|
1796
|
+
}
|
|
1797
|
+
function findAncestor(node, types) {
|
|
1798
|
+
let current = node.parent;
|
|
1799
|
+
while (current) {
|
|
1800
|
+
if (types.has(current.type))
|
|
1801
|
+
return current;
|
|
1802
|
+
current = current.parent;
|
|
1803
|
+
}
|
|
1804
|
+
return null;
|
|
1805
|
+
}
|
|
1806
|
+
function isInParameterList(node) {
|
|
1807
|
+
return !!findAncestor(node, cFamilyParameterListTypes);
|
|
1808
|
+
}
|
|
1809
|
+
function resolveDeclaratorRoot(ancestor) {
|
|
1810
|
+
let declaratorNode = ancestor.childForFieldName("declarator");
|
|
1811
|
+
if (!declaratorNode)
|
|
1812
|
+
return null;
|
|
1813
|
+
if (declaratorNode.type === "init_declarator") {
|
|
1814
|
+
const inner = declaratorNode.childForFieldName("declarator");
|
|
1815
|
+
if (inner)
|
|
1816
|
+
declaratorNode = inner;
|
|
1817
|
+
}
|
|
1818
|
+
if (declaratorNode.type === "function_declarator") {
|
|
1819
|
+
const inner = declaratorNode.childForFieldName("declarator");
|
|
1820
|
+
if (inner)
|
|
1821
|
+
declaratorNode = inner;
|
|
1822
|
+
}
|
|
1823
|
+
return declaratorNode;
|
|
1824
|
+
}
|
|
1825
|
+
function isInAncestorDeclarator(node, ancestorTypes) {
|
|
1826
|
+
const ancestor = findAncestor(node, ancestorTypes);
|
|
1827
|
+
if (!ancestor)
|
|
1828
|
+
return false;
|
|
1829
|
+
const declaratorNode = resolveDeclaratorRoot(ancestor);
|
|
1830
|
+
if (!declaratorNode)
|
|
1831
|
+
return false;
|
|
1832
|
+
return isWithin(node, declaratorNode);
|
|
1833
|
+
}
|
|
1834
|
+
function isFunctionDeclarator(node) {
|
|
1835
|
+
let current = node.parent;
|
|
1836
|
+
while (current) {
|
|
1837
|
+
if (current.type === "function_declarator")
|
|
1838
|
+
return true;
|
|
1839
|
+
if (cFamilyContainerTypes.has(current.type))
|
|
1840
|
+
return false;
|
|
1841
|
+
current = current.parent;
|
|
1842
|
+
}
|
|
1843
|
+
return false;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
// dist/languages/definitions/c.js
|
|
1847
|
+
var C_DEF = createCFamilyLanguageDefinition({
|
|
1848
|
+
id: "c",
|
|
1849
|
+
extensions: [".c", ".h", ".i"],
|
|
1850
|
+
grammarPackage: "tree-sitter-c",
|
|
1851
|
+
includeFieldIdentifier: false,
|
|
1852
|
+
blocks: (functionNameQuery) => [
|
|
1853
|
+
cFamilyFunctionBlock(functionNameQuery),
|
|
1854
|
+
cFamilyTypeIdentifierBlock("struct_specifier", "struct"),
|
|
1855
|
+
cFamilyTypeIdentifierBlock("union_specifier", "union"),
|
|
1856
|
+
cFamilyTypeIdentifierBlock("enum_specifier", "enum"),
|
|
1857
|
+
cFamilyBlock("type_definition", "declarator: (type_identifier) @chunk.name", "type"),
|
|
1858
|
+
cFamilyBlock("preproc_def", "name: (identifier) @chunk.name", "macro"),
|
|
1859
|
+
cFamilyBlock("preproc_function_def", "name: (identifier) @chunk.name", "macro")
|
|
1860
|
+
],
|
|
1861
|
+
extraExportQueries: [
|
|
1862
|
+
`(union_specifier name: (type_identifier) @name)`,
|
|
1863
|
+
`(enumerator name: (identifier) @name)`,
|
|
1864
|
+
`(preproc_def name: (identifier) @name)`,
|
|
1865
|
+
`(preproc_function_def name: (identifier) @name)`
|
|
1866
|
+
],
|
|
1867
|
+
extraLocalQueries: [
|
|
1868
|
+
`(union_specifier name: (type_identifier) @name)`,
|
|
1869
|
+
`(enumerator name: (identifier) @name)`,
|
|
1870
|
+
`(preproc_def name: (identifier) @name)`,
|
|
1871
|
+
`(preproc_function_def name: (identifier) @name)`
|
|
1872
|
+
],
|
|
1873
|
+
nodeTypes: {
|
|
1874
|
+
identifier: ["identifier", "field_identifier", "type_identifier"],
|
|
1875
|
+
propertyIdentifier: ["field_identifier"],
|
|
1876
|
+
memberExpression: "field_expression"
|
|
1877
|
+
},
|
|
1878
|
+
classifyDefinition: (node) => {
|
|
1879
|
+
const parent = node.parent;
|
|
1880
|
+
if (!parent)
|
|
1881
|
+
return "variable";
|
|
1882
|
+
if (parent.type === "enum_specifier")
|
|
1883
|
+
return "type";
|
|
1884
|
+
if (parent.type === "struct_specifier" || parent.type === "union_specifier")
|
|
1885
|
+
return "class";
|
|
1886
|
+
if (parent.type === "type_definition" && isInField(node, parent, "declarator"))
|
|
1887
|
+
return "type";
|
|
1888
|
+
const container = findAncestor(node, cFamilyContainerTypes);
|
|
1889
|
+
if (container?.type === "function_definition")
|
|
1890
|
+
return "function";
|
|
1891
|
+
if (container?.type === "declaration" && isFunctionDeclarator(node))
|
|
1892
|
+
return "function";
|
|
1893
|
+
return "variable";
|
|
1894
|
+
},
|
|
1895
|
+
isDeclarationName: (node) => {
|
|
1896
|
+
const parent = node.parent;
|
|
1897
|
+
if (!parent)
|
|
1898
|
+
return false;
|
|
1899
|
+
if ((parent.type === "struct_specifier" || parent.type === "union_specifier" || parent.type === "enum_specifier") && isInField(node, parent, "name"))
|
|
1900
|
+
return true;
|
|
1901
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["parameter_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["field_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["init_declarator"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["type_definition"])))
|
|
1902
|
+
return true;
|
|
1903
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["function_definition"])) && !isInParameterList(node))
|
|
1904
|
+
return true;
|
|
1905
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["declaration"])) && !isInParameterList(node))
|
|
1906
|
+
return true;
|
|
1907
|
+
if (parent.type === "enumerator" && isInField(node, parent, "name"))
|
|
1908
|
+
return true;
|
|
1909
|
+
if (parent.type === "preproc_def" && isInField(node, parent, "name"))
|
|
1910
|
+
return true;
|
|
1911
|
+
if (parent.type === "preproc_function_def" && isInField(node, parent, "name"))
|
|
1912
|
+
return true;
|
|
1913
|
+
return false;
|
|
1914
|
+
},
|
|
1915
|
+
createsFunctionScope: (node) => node.type === "function_definition"
|
|
1916
|
+
});
|
|
1917
|
+
registerLanguage(C_DEF);
|
|
1918
|
+
|
|
1919
|
+
// dist/languages/definitions/cpp.js
|
|
1920
|
+
var CPP_DEF = createCFamilyLanguageDefinition({
|
|
1921
|
+
id: "cpp",
|
|
1922
|
+
extensions: [".cc", ".cpp", ".cxx", ".c++", ".hpp", ".hh", ".hxx", ".ipp", ".tpp", ".inl"],
|
|
1923
|
+
grammarPackage: "tree-sitter-cpp",
|
|
1924
|
+
includeFieldIdentifier: true,
|
|
1925
|
+
usesQueryDrivenLocals: true,
|
|
1926
|
+
blocks: (functionNameQuery) => [
|
|
1927
|
+
cFamilyFunctionBlock(functionNameQuery),
|
|
1928
|
+
cFamilyTypeIdentifierBlock("class_specifier", "class"),
|
|
1929
|
+
cFamilyTypeIdentifierBlock("struct_specifier", "struct"),
|
|
1930
|
+
cFamilyTypeIdentifierBlock("enum_specifier", "enum"),
|
|
1931
|
+
cFamilyBlock("namespace_definition", "name: (namespace_identifier) @chunk.name", "namespace"),
|
|
1932
|
+
cFamilyTypeIdentifierBlock("alias_declaration", "type"),
|
|
1933
|
+
cFamilyBlock("type_definition", "declarator: (type_identifier) @chunk.name", "type")
|
|
1934
|
+
],
|
|
1935
|
+
splitPoints: [...cFamilyControlSplitPoints, "try_statement", "catch_clause"],
|
|
1936
|
+
extraExportQueries: [
|
|
1937
|
+
`(class_specifier name: (type_identifier) @name)`,
|
|
1938
|
+
`(enumerator name: (identifier) @name)`,
|
|
1939
|
+
`(namespace_definition name: (namespace_identifier) @name)`,
|
|
1940
|
+
`(alias_declaration name: (type_identifier) @name)`,
|
|
1941
|
+
`(using_declaration (qualified_identifier name: (identifier) @name))`
|
|
1942
|
+
],
|
|
1943
|
+
extraLocalQueries: [
|
|
1944
|
+
`(class_specifier name: (type_identifier) @name)`,
|
|
1945
|
+
`(enumerator name: (identifier) @name)`,
|
|
1946
|
+
`(namespace_definition name: (namespace_identifier) @name)`,
|
|
1947
|
+
`(alias_declaration name: (type_identifier) @name)`
|
|
1948
|
+
],
|
|
1949
|
+
nodeTypes: {
|
|
1950
|
+
identifier: ["identifier", "field_identifier", "type_identifier", "namespace_identifier"],
|
|
1951
|
+
propertyIdentifier: ["field_identifier", "identifier"],
|
|
1952
|
+
memberExpression: "field_expression"
|
|
1953
|
+
},
|
|
1954
|
+
classifyDefinition: (node) => {
|
|
1955
|
+
const parent = node.parent;
|
|
1956
|
+
if (!parent)
|
|
1957
|
+
return "variable";
|
|
1958
|
+
if (parent.type === "enum_specifier")
|
|
1959
|
+
return "type";
|
|
1960
|
+
if (parent.type === "class_specifier" || parent.type === "struct_specifier" || parent.type === "namespace_definition")
|
|
1961
|
+
return "class";
|
|
1962
|
+
if (parent.type === "alias_declaration" || parent.type === "type_definition" && isInField(node, parent, "declarator"))
|
|
1963
|
+
return "type";
|
|
1964
|
+
const container = findAncestor(node, cFamilyContainerTypes);
|
|
1965
|
+
if (container?.type === "function_definition")
|
|
1966
|
+
return "function";
|
|
1967
|
+
if (container?.type === "declaration" && isFunctionDeclarator(node))
|
|
1968
|
+
return "function";
|
|
1969
|
+
return "variable";
|
|
1970
|
+
},
|
|
1971
|
+
isDeclarationName: (node) => {
|
|
1972
|
+
const parent = node.parent;
|
|
1973
|
+
if (!parent)
|
|
1974
|
+
return false;
|
|
1975
|
+
if ((parent.type === "class_specifier" || parent.type === "struct_specifier" || parent.type === "enum_specifier") && isInField(node, parent, "name"))
|
|
1976
|
+
return true;
|
|
1977
|
+
if (parent.type === "namespace_definition" && isInField(node, parent, "name"))
|
|
1978
|
+
return true;
|
|
1979
|
+
if (parent.type === "alias_declaration" && isInField(node, parent, "name"))
|
|
1980
|
+
return true;
|
|
1981
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["parameter_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["field_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["init_declarator"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["type_definition"])))
|
|
1982
|
+
return true;
|
|
1983
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["function_definition"])) && !isInParameterList(node))
|
|
1984
|
+
return true;
|
|
1985
|
+
if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["declaration"])) && !isInParameterList(node))
|
|
1986
|
+
return true;
|
|
1987
|
+
if (parent.type === "qualified_identifier" && parent.parent?.type === "using_declaration" && isInField(node, parent, "name"))
|
|
1988
|
+
return true;
|
|
1989
|
+
if (parent.type === "enumerator" && isInField(node, parent, "name"))
|
|
1990
|
+
return true;
|
|
1991
|
+
return false;
|
|
1992
|
+
},
|
|
1993
|
+
createsFunctionScope: (node) => node.type === "function_definition" || node.type === "lambda_expression"
|
|
1994
|
+
});
|
|
1995
|
+
registerLanguage(CPP_DEF);
|
|
1996
|
+
|
|
1997
|
+
// dist/languages/definitions/kotlin.js
|
|
1998
|
+
function normalizeKotlinNativeQuery(kind, query) {
|
|
1999
|
+
if (kind === "imports") {
|
|
2000
|
+
return `
|
|
2001
|
+
(import (qualified_identifier) @mod) @stmt
|
|
2002
|
+
`;
|
|
2003
|
+
}
|
|
2004
|
+
if (kind === "importBindings") {
|
|
2005
|
+
return `
|
|
2006
|
+
(import (qualified_identifier) @from (identifier) @alias) @stmt
|
|
2007
|
+
(import (qualified_identifier) @from "*" @wild) @stmt
|
|
2008
|
+
(import (qualified_identifier) @from) @stmt
|
|
2009
|
+
`;
|
|
2010
|
+
}
|
|
2011
|
+
const normalized = query.replace(/\bimport_header\b/g, "import").replace(/\bsimple_identifier\b/g, "identifier").replace(/\btype_identifier\b/g, "identifier");
|
|
2012
|
+
return normalized;
|
|
2013
|
+
}
|
|
2014
|
+
var KOTLIN_DEF = {
|
|
2015
|
+
id: "kotlin",
|
|
2016
|
+
extensions: [".kt", ".kts"],
|
|
2017
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-kotlin"),
|
|
2018
|
+
usesQueryDrivenLocals: true,
|
|
2019
|
+
structure: {
|
|
2020
|
+
blocks: [
|
|
2021
|
+
{
|
|
2022
|
+
type: "class_declaration",
|
|
2023
|
+
nameQuery: "(type_identifier) @chunk.name",
|
|
2024
|
+
captureId: "class"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
type: "object_declaration",
|
|
2028
|
+
nameQuery: "(type_identifier) @chunk.name",
|
|
2029
|
+
captureId: "object"
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
type: "function_declaration",
|
|
2033
|
+
nameQuery: "(simple_identifier) @chunk.name",
|
|
2034
|
+
captureId: "function"
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
type: "property_declaration",
|
|
2038
|
+
nameQuery: "(variable_declaration (simple_identifier) @chunk.name)",
|
|
2039
|
+
captureId: "property"
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
type: "type_alias",
|
|
2043
|
+
nameQuery: "(type_identifier) @chunk.name",
|
|
2044
|
+
captureId: "type"
|
|
2045
|
+
}
|
|
2046
|
+
],
|
|
2047
|
+
splitPoints: [
|
|
2048
|
+
"if_expression",
|
|
2049
|
+
"when_expression",
|
|
2050
|
+
"for_statement",
|
|
2051
|
+
"while_statement",
|
|
2052
|
+
"do_while_statement",
|
|
2053
|
+
"try_expression",
|
|
2054
|
+
"catch_block",
|
|
2055
|
+
"finally_block"
|
|
2056
|
+
],
|
|
2057
|
+
comments: ["line_comment", "block_comment"]
|
|
2058
|
+
},
|
|
2059
|
+
graph: {
|
|
2060
|
+
imports: `
|
|
2061
|
+
(import_header (identifier) @mod) @stmt
|
|
2062
|
+
`,
|
|
2063
|
+
exports: `
|
|
2064
|
+
(class_declaration (type_identifier) @name)
|
|
2065
|
+
(object_declaration (type_identifier) @name)
|
|
2066
|
+
(function_declaration (simple_identifier) @name)
|
|
2067
|
+
(property_declaration (variable_declaration (simple_identifier) @name))
|
|
2068
|
+
(type_alias (type_identifier) @name)
|
|
2069
|
+
(enum_entry (simple_identifier) @name)
|
|
2070
|
+
`,
|
|
2071
|
+
locals: `
|
|
2072
|
+
(class_declaration (type_identifier) @name)
|
|
2073
|
+
(object_declaration (type_identifier) @name)
|
|
2074
|
+
(function_declaration (simple_identifier) @name)
|
|
2075
|
+
(property_declaration (variable_declaration (simple_identifier) @name))
|
|
2076
|
+
(type_alias (type_identifier) @name)
|
|
2077
|
+
(enum_entry (simple_identifier) @name)
|
|
2078
|
+
(parameter (simple_identifier) @name)
|
|
2079
|
+
(class_parameter (simple_identifier) @name)
|
|
2080
|
+
(type_parameter (type_identifier) @name)
|
|
2081
|
+
`,
|
|
2082
|
+
importBindings: `
|
|
2083
|
+
(import_header (identifier) @from (import_alias (type_identifier) @alias)) @stmt
|
|
2084
|
+
(import_header (identifier) @from (wildcard_import) @wild) @stmt
|
|
2085
|
+
(import_header (identifier) @from) @stmt
|
|
2086
|
+
`
|
|
2087
|
+
},
|
|
2088
|
+
nodeTypes: {
|
|
2089
|
+
identifier: ["identifier", "interpolated_identifier", "simple_identifier", "type_identifier"],
|
|
2090
|
+
propertyIdentifier: ["simple_identifier", "type_identifier"],
|
|
2091
|
+
memberExpression: "navigation_expression"
|
|
2092
|
+
},
|
|
2093
|
+
classifyDefinition: (node) => {
|
|
2094
|
+
const parent = node.parent;
|
|
2095
|
+
if (!parent)
|
|
2096
|
+
return "variable";
|
|
2097
|
+
if (parent.type === "class_declaration" || parent.type === "object_declaration")
|
|
2098
|
+
return "class";
|
|
2099
|
+
if (parent.type === "function_declaration")
|
|
2100
|
+
return "function";
|
|
2101
|
+
if (parent.type === "type_alias")
|
|
2102
|
+
return "type";
|
|
2103
|
+
return "variable";
|
|
2104
|
+
},
|
|
2105
|
+
isDeclarationName: (node) => {
|
|
2106
|
+
const parent = node.parent;
|
|
2107
|
+
if (!parent)
|
|
2108
|
+
return false;
|
|
2109
|
+
if (parent.type === "class_declaration" && node.type === "type_identifier")
|
|
2110
|
+
return true;
|
|
2111
|
+
if (parent.type === "object_declaration" && node.type === "type_identifier")
|
|
2112
|
+
return true;
|
|
2113
|
+
if (parent.type === "function_declaration" && (node.type === "simple_identifier" || node.type === "identifier"))
|
|
2114
|
+
return true;
|
|
2115
|
+
if (parent.type === "type_alias" && node.type === "type_identifier")
|
|
2116
|
+
return true;
|
|
2117
|
+
if (parent.type === "variable_declaration" && node.type === "simple_identifier")
|
|
2118
|
+
return true;
|
|
2119
|
+
if (parent.type === "parameter" && (node.type === "simple_identifier" || node.type === "identifier"))
|
|
2120
|
+
return true;
|
|
2121
|
+
if (parent.type === "class_parameter" && (node.type === "simple_identifier" || node.type === "identifier"))
|
|
2122
|
+
return true;
|
|
2123
|
+
if (parent.type === "enum_entry" && (node.type === "simple_identifier" || node.type === "identifier"))
|
|
2124
|
+
return true;
|
|
2125
|
+
if (parent.type === "type_parameter" && node.type === "type_identifier")
|
|
2126
|
+
return true;
|
|
2127
|
+
return false;
|
|
2128
|
+
},
|
|
2129
|
+
scopeDeclarationNames: "all",
|
|
2130
|
+
createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "anonymous_function" || node.type === "lambda_literal",
|
|
2131
|
+
createsBlockScope: (node) => node.type === "function_body" || node.type === "class_body" || node.type === "control_structure_body" || node.type === "catch_block" || node.type === "finally_block",
|
|
2132
|
+
supportsCrossModuleSymbols: true,
|
|
2133
|
+
native: {
|
|
2134
|
+
normalizeQuery: normalizeKotlinNativeQuery,
|
|
2135
|
+
authoritativeKinds: ["imports", "importBindings", "exports", "locals"],
|
|
2136
|
+
notes: ["normalizes kotlin import and identifier node names for the native grammar"]
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
registerLanguage(KOTLIN_DEF);
|
|
2140
|
+
|
|
2141
|
+
// dist/languages/definitions/swift.js
|
|
2142
|
+
var SWIFT_DEF = {
|
|
2143
|
+
id: "swift",
|
|
2144
|
+
extensions: [".swift"],
|
|
2145
|
+
grammar: () => loadTreeSitterLanguage("tree-sitter-swift"),
|
|
2146
|
+
usesQueryDrivenLocals: true,
|
|
2147
|
+
structure: {
|
|
2148
|
+
blocks: [
|
|
2149
|
+
{
|
|
2150
|
+
type: "class_declaration",
|
|
2151
|
+
nameQuery: 'declaration_kind: "class" name: (_) @chunk.name',
|
|
2152
|
+
captureId: "class"
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
type: "class_declaration",
|
|
2156
|
+
nameQuery: 'declaration_kind: "struct" name: (_) @chunk.name',
|
|
2157
|
+
captureId: "struct"
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
type: "class_declaration",
|
|
2161
|
+
nameQuery: 'declaration_kind: "enum" name: (_) @chunk.name',
|
|
2162
|
+
captureId: "enum"
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
type: "class_declaration",
|
|
2166
|
+
nameQuery: 'declaration_kind: "extension" name: (user_type (type_identifier) @chunk.name)',
|
|
2167
|
+
captureId: "extension"
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
type: "class_declaration",
|
|
2171
|
+
nameQuery: 'declaration_kind: "actor" name: (_) @chunk.name',
|
|
2172
|
+
captureId: "actor"
|
|
2173
|
+
},
|
|
2174
|
+
{
|
|
2175
|
+
type: "protocol_declaration",
|
|
2176
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
2177
|
+
captureId: "protocol"
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
type: "function_declaration",
|
|
2181
|
+
nameQuery: "name: (simple_identifier) @chunk.name",
|
|
2182
|
+
captureId: "function"
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
type: "property_declaration",
|
|
2186
|
+
nameQuery: "name: (pattern bound_identifier: (simple_identifier) @chunk.name)",
|
|
2187
|
+
captureId: "property"
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
type: "typealias_declaration",
|
|
2191
|
+
nameQuery: "name: (type_identifier) @chunk.name",
|
|
2192
|
+
captureId: "type"
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
type: "init_declaration",
|
|
2196
|
+
captureId: "initializer"
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
type: "deinit_declaration",
|
|
2200
|
+
captureId: "deinitializer"
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
type: "subscript_declaration",
|
|
2204
|
+
captureId: "subscript"
|
|
2205
|
+
}
|
|
2206
|
+
],
|
|
2207
|
+
splitPoints: [
|
|
2208
|
+
"if_statement",
|
|
2209
|
+
"guard_statement",
|
|
2210
|
+
"for_statement",
|
|
2211
|
+
"while_statement",
|
|
2212
|
+
"repeat_while_statement",
|
|
2213
|
+
"switch_statement",
|
|
2214
|
+
"do_statement",
|
|
2215
|
+
"catch_block"
|
|
2216
|
+
],
|
|
2217
|
+
comments: ["comment", "multiline_comment"]
|
|
2218
|
+
},
|
|
2219
|
+
graph: {
|
|
2220
|
+
imports: `
|
|
2221
|
+
(import_declaration (identifier) @mod) @stmt
|
|
2222
|
+
`,
|
|
2223
|
+
exports: `
|
|
2224
|
+
(class_declaration declaration_kind: "class" name: (_) @name)
|
|
2225
|
+
(class_declaration declaration_kind: "struct" name: (_) @name)
|
|
2226
|
+
(class_declaration declaration_kind: "enum" name: (_) @name)
|
|
2227
|
+
(class_declaration declaration_kind: "extension" name: (user_type (type_identifier) @name))
|
|
2228
|
+
(class_declaration declaration_kind: "actor" name: (_) @name)
|
|
2229
|
+
(enum_entry name: (simple_identifier) @name)
|
|
2230
|
+
(protocol_declaration name: (type_identifier) @name)
|
|
2231
|
+
(function_declaration name: (simple_identifier) @name)
|
|
2232
|
+
(typealias_declaration name: (type_identifier) @name)
|
|
2233
|
+
(property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
|
|
2234
|
+
(protocol_function_declaration name: (simple_identifier) @name)
|
|
2235
|
+
(protocol_property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
|
|
2236
|
+
`,
|
|
2237
|
+
locals: `
|
|
2238
|
+
(class_declaration declaration_kind: "class" name: (_) @name)
|
|
2239
|
+
(class_declaration declaration_kind: "struct" name: (_) @name)
|
|
2240
|
+
(class_declaration declaration_kind: "enum" name: (_) @name)
|
|
2241
|
+
(class_declaration declaration_kind: "extension" name: (user_type (type_identifier) @name))
|
|
2242
|
+
(class_declaration declaration_kind: "actor" name: (_) @name)
|
|
2243
|
+
(enum_entry name: (simple_identifier) @name)
|
|
2244
|
+
(protocol_declaration name: (type_identifier) @name)
|
|
2245
|
+
(function_declaration name: (simple_identifier) @name)
|
|
2246
|
+
(typealias_declaration name: (type_identifier) @name)
|
|
2247
|
+
(property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
|
|
2248
|
+
(parameter name: (simple_identifier) @name)
|
|
2249
|
+
(protocol_function_declaration name: (simple_identifier) @name)
|
|
2250
|
+
(protocol_property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
|
|
2251
|
+
`,
|
|
2252
|
+
importBindings: `
|
|
2253
|
+
(import_declaration (identifier) @from) @stmt
|
|
2254
|
+
`
|
|
2255
|
+
},
|
|
2256
|
+
nodeTypes: {
|
|
2257
|
+
identifier: ["identifier", "simple_identifier", "type_identifier"],
|
|
2258
|
+
propertyIdentifier: ["simple_identifier", "type_identifier"],
|
|
2259
|
+
memberExpression: "navigation_expression"
|
|
2260
|
+
},
|
|
2261
|
+
classifyDefinition: (node) => {
|
|
2262
|
+
const parent = node.parent;
|
|
2263
|
+
if (!parent)
|
|
2264
|
+
return "variable";
|
|
2265
|
+
if (parent.type === "function_declaration")
|
|
2266
|
+
return "function";
|
|
2267
|
+
if (parent.type === "protocol_function_declaration")
|
|
2268
|
+
return "function";
|
|
2269
|
+
if (parent.type === "class_declaration") {
|
|
2270
|
+
const declarationKind = parent.childForFieldName("declaration_kind")?.text;
|
|
2271
|
+
if (declarationKind === "enum")
|
|
2272
|
+
return "type";
|
|
2273
|
+
return "class";
|
|
2274
|
+
}
|
|
2275
|
+
if (parent.type === "user_type" && parent.parent?.type === "class_declaration")
|
|
2276
|
+
return "class";
|
|
2277
|
+
if (parent.type === "protocol_declaration" || parent.type === "typealias_declaration")
|
|
2278
|
+
return "type";
|
|
2279
|
+
return "variable";
|
|
2280
|
+
},
|
|
2281
|
+
isDeclarationName: (node) => {
|
|
2282
|
+
const parent = node.parent;
|
|
2283
|
+
if (!parent)
|
|
2284
|
+
return false;
|
|
2285
|
+
if (parent.type === "class_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2286
|
+
return true;
|
|
2287
|
+
if (parent.type === "user_type" && parent.parent?.type === "class_declaration" && parent.parent.childForFieldName("name")?.id === parent.id)
|
|
2288
|
+
return true;
|
|
2289
|
+
if (parent.type === "protocol_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2290
|
+
return true;
|
|
2291
|
+
if (parent.type === "enum_entry" && parent.childForFieldName("name")?.id === node.id)
|
|
2292
|
+
return true;
|
|
2293
|
+
if (parent.type === "function_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2294
|
+
return true;
|
|
2295
|
+
if (parent.type === "typealias_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2296
|
+
return true;
|
|
2297
|
+
if (parent.type === "parameter" && parent.childForFieldName("name")?.id === node.id)
|
|
2298
|
+
return true;
|
|
2299
|
+
if (parent.type === "protocol_function_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2300
|
+
return true;
|
|
2301
|
+
if (parent.type === "protocol_property_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2302
|
+
return true;
|
|
2303
|
+
if (parent.type === "pattern" && parent.childForFieldName("bound_identifier")?.id === node.id && (parent.parent?.type === "property_declaration" || parent.parent?.type === "protocol_property_declaration"))
|
|
2304
|
+
return true;
|
|
2305
|
+
return false;
|
|
2306
|
+
},
|
|
2307
|
+
scopeDeclarationNames: "all",
|
|
2308
|
+
createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "init_declaration" || node.type === "deinit_declaration" || node.type === "subscript_declaration",
|
|
2309
|
+
createsBlockScope: (node) => node.type === "function_body" || node.type === "class_body" || node.type === "protocol_body" || node.type === "enum_class_body" || node.type === "catch_block" || node.type === "willset_didset_block",
|
|
2310
|
+
supportsCrossModuleSymbols: true
|
|
2311
|
+
};
|
|
2312
|
+
registerLanguage(SWIFT_DEF);
|
|
2313
|
+
|
|
2314
|
+
// dist/languages/definitions/sql.js
|
|
2315
|
+
var SQL_DEF = {
|
|
2316
|
+
id: "sql",
|
|
2317
|
+
extensions: [".sql"],
|
|
2318
|
+
grammar: () => loadTreeSitterLanguage("@derekstride/tree-sitter-sql"),
|
|
2319
|
+
structure: {
|
|
2320
|
+
blocks: [
|
|
2321
|
+
{ type: "statement", nameQuery: "(create_table)", captureId: "create" },
|
|
2322
|
+
{ type: "statement", nameQuery: "(create_view)", captureId: "create" },
|
|
2323
|
+
{ type: "statement", nameQuery: "(create_materialized_view)", captureId: "create" },
|
|
2324
|
+
{ type: "statement", nameQuery: "(create_index)", captureId: "create" },
|
|
2325
|
+
{ type: "statement", nameQuery: "(create_function)", captureId: "routine" },
|
|
2326
|
+
{ type: "statement", nameQuery: "(create_trigger)", captureId: "routine" },
|
|
2327
|
+
{ type: "statement", nameQuery: "(alter_table)", captureId: "alter" },
|
|
2328
|
+
{ type: "statement", nameQuery: "(drop_table)", captureId: "drop" },
|
|
2329
|
+
{ type: "statement", nameQuery: "(drop_view)", captureId: "drop" },
|
|
2330
|
+
{ type: "statement", nameQuery: "(drop_index)", captureId: "drop" },
|
|
2331
|
+
{ type: "statement", nameQuery: "(insert)", captureId: "write" },
|
|
2332
|
+
{ type: "statement", nameQuery: "(update)", captureId: "write" },
|
|
2333
|
+
{ type: "statement", nameQuery: "(delete)", captureId: "write" },
|
|
2334
|
+
{ type: "statement", nameQuery: "(select)", captureId: "select" }
|
|
2335
|
+
],
|
|
2336
|
+
splitPoints: [],
|
|
2337
|
+
comments: ["comment"]
|
|
2338
|
+
},
|
|
2339
|
+
graph: {
|
|
2340
|
+
imports: "(statement) @stmt",
|
|
2341
|
+
exports: "",
|
|
2342
|
+
locals: "",
|
|
2343
|
+
importBindings: ""
|
|
2344
|
+
},
|
|
2345
|
+
supportsCrossModuleSymbols: false
|
|
2346
|
+
};
|
|
2347
|
+
registerLanguage(SQL_DEF);
|
|
2348
|
+
|
|
2349
|
+
// dist/languages/definitions/zig.js
|
|
2350
|
+
var ZIG_TYPE_INITIALIZER_TYPES = /* @__PURE__ */ new Set([
|
|
2351
|
+
"builtin_type",
|
|
2352
|
+
"struct_declaration",
|
|
2353
|
+
"enum_declaration",
|
|
2354
|
+
"union_declaration",
|
|
2355
|
+
"opaque_declaration",
|
|
2356
|
+
"error_set_declaration"
|
|
2357
|
+
]);
|
|
2358
|
+
var ZIG_DEF = {
|
|
2359
|
+
id: "zig",
|
|
2360
|
+
extensions: [".zig"],
|
|
2361
|
+
grammar: () => loadTreeSitterLanguage("@tree-sitter-grammars/tree-sitter-zig"),
|
|
2362
|
+
usesQueryDrivenLocals: true,
|
|
2363
|
+
structure: {
|
|
2364
|
+
blocks: [
|
|
2365
|
+
{ type: "function_declaration", nameQuery: "name: (identifier) @chunk.name", captureId: "function" },
|
|
2366
|
+
{ type: "test_declaration", nameQuery: "(string) @chunk.name", captureId: "test" }
|
|
2367
|
+
],
|
|
2368
|
+
splitPoints: ["if_expression", "for_expression", "while_expression", "switch_expression"],
|
|
2369
|
+
comments: ["line_comment", "doc_comment"]
|
|
2370
|
+
},
|
|
2371
|
+
graph: {
|
|
2372
|
+
imports: '(builtin_function (builtin_identifier) @fn (arguments (string) @mod) (#eq? @fn "@import")) @stmt',
|
|
2373
|
+
exports: `
|
|
2374
|
+
(function_declaration name: (identifier) @name)
|
|
2375
|
+
(variable_declaration (identifier) @name)
|
|
2376
|
+
`,
|
|
2377
|
+
locals: `
|
|
2378
|
+
(function_declaration name: (identifier) @name)
|
|
2379
|
+
(parameter (identifier) @name)
|
|
2380
|
+
(variable_declaration (identifier) @name)
|
|
2381
|
+
`,
|
|
2382
|
+
importBindings: `
|
|
2383
|
+
(variable_declaration
|
|
2384
|
+
(identifier) @alias
|
|
2385
|
+
(builtin_function (builtin_identifier) @fn (arguments (string) @from) (#eq? @fn "@import"))
|
|
2386
|
+
) @stmt
|
|
2387
|
+
`
|
|
2388
|
+
},
|
|
2389
|
+
nodeTypes: {
|
|
2390
|
+
identifier: ["identifier"],
|
|
2391
|
+
memberExpression: "field_expression"
|
|
2392
|
+
},
|
|
2393
|
+
supportsCrossModuleSymbols: true,
|
|
2394
|
+
classifyDefinition: (node) => {
|
|
2395
|
+
const parent = node.parent;
|
|
2396
|
+
if (!parent)
|
|
2397
|
+
return "variable";
|
|
2398
|
+
if (parent.type === "function_declaration")
|
|
2399
|
+
return "function";
|
|
2400
|
+
if (parent.type !== "variable_declaration")
|
|
2401
|
+
return "variable";
|
|
2402
|
+
const declaredName = parent.namedChildren.find((child) => child.type === "identifier");
|
|
2403
|
+
if (declaredName?.id !== node.id)
|
|
2404
|
+
return "variable";
|
|
2405
|
+
const initializer = parent.namedChildren.find((child) => child.id !== node.id);
|
|
2406
|
+
if (initializer && ZIG_TYPE_INITIALIZER_TYPES.has(initializer.type))
|
|
2407
|
+
return "type";
|
|
2408
|
+
return "variable";
|
|
2409
|
+
},
|
|
2410
|
+
createsFunctionScope: (node) => node.type === "function_declaration",
|
|
2411
|
+
createsBlockScope: (node) => node.type === "block",
|
|
2412
|
+
isDeclarationName: (node) => {
|
|
2413
|
+
const parent = node.parent;
|
|
2414
|
+
if (!parent)
|
|
2415
|
+
return false;
|
|
2416
|
+
if (parent.type === "function_declaration" && parent.childForFieldName("name")?.id === node.id)
|
|
2417
|
+
return true;
|
|
2418
|
+
return parent.type === "variable_declaration";
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
registerLanguage(ZIG_DEF);
|
|
2422
|
+
|
|
2423
|
+
// dist/bootstrap/treeSitterLanguages.js
|
|
2424
|
+
var idToConfigKey = {
|
|
2425
|
+
js: "javascript",
|
|
2426
|
+
ts: "typescript",
|
|
2427
|
+
tsx: "tsx",
|
|
2428
|
+
python: "python",
|
|
2429
|
+
php: "php",
|
|
2430
|
+
html: "html",
|
|
2431
|
+
css: "css",
|
|
2432
|
+
scss: "scss",
|
|
2433
|
+
less: "less",
|
|
2434
|
+
ruby: "ruby",
|
|
2435
|
+
go: "go",
|
|
2436
|
+
java: "java",
|
|
2437
|
+
csharp: "csharp",
|
|
2438
|
+
rust: "rust",
|
|
2439
|
+
c: "c",
|
|
2440
|
+
cpp: "cpp",
|
|
2441
|
+
kotlin: "kotlin",
|
|
2442
|
+
swift: "swift",
|
|
2443
|
+
zig: "zig"
|
|
2444
|
+
};
|
|
2445
|
+
var LANG_CONFIGS = {};
|
|
2446
|
+
for (const lang of getAllLanguages()) {
|
|
2447
|
+
const key = idToConfigKey[lang.id] || lang.id;
|
|
2448
|
+
if (lang.id === "vue" || lang.id === "svelte" || lang.id === "markdown" || lang.id === "mdx" || lang.id === "astro" || lang.id === "hbs" || lang.id === "rst" || lang.id === "adoc") {
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
LANG_CONFIGS[key] = makeLanguageConfig(lang, key);
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
// dist/chunking/chunkBlocks.js
|
|
2455
|
+
function collectChunkBlockGroups(language, matches) {
|
|
2456
|
+
const mainBlocks = [];
|
|
2457
|
+
const innerBlocks = [];
|
|
2458
|
+
const comments = [];
|
|
2459
|
+
for (const match of matches) {
|
|
2460
|
+
let nameCapture;
|
|
2461
|
+
let blockCapture;
|
|
2462
|
+
let innerCapture;
|
|
2463
|
+
let blockKind;
|
|
2464
|
+
for (const capture of match.captures) {
|
|
2465
|
+
const { name } = capture;
|
|
2466
|
+
if (name === language.captures.name) {
|
|
2467
|
+
nameCapture = capture;
|
|
2468
|
+
}
|
|
2469
|
+
if (language.captures.comments.includes(name)) {
|
|
2470
|
+
comments.push({
|
|
2471
|
+
kind: name === "chunk.docstring" ? "docstring" : "comment",
|
|
2472
|
+
startByte: capture.startByte,
|
|
2473
|
+
endByte: capture.endByte,
|
|
2474
|
+
startLine: capture.startLine,
|
|
2475
|
+
endLine: capture.endLine
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
if (name === language.captures.innerBlock) {
|
|
2479
|
+
innerCapture = capture;
|
|
2480
|
+
}
|
|
2481
|
+
if (name.startsWith(language.captures.blockPrefix) && name !== language.captures.innerBlock) {
|
|
2482
|
+
blockCapture = capture;
|
|
2483
|
+
blockKind = name.slice(language.captures.blockPrefix.length) || capture.nodeType;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
if (innerCapture) {
|
|
2487
|
+
innerBlocks.push({
|
|
2488
|
+
kind: "inner",
|
|
2489
|
+
startByte: innerCapture.startByte,
|
|
2490
|
+
endByte: innerCapture.endByte,
|
|
2491
|
+
startLine: innerCapture.startLine,
|
|
2492
|
+
endLine: innerCapture.endLine
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
if (blockCapture) {
|
|
2496
|
+
const candidate = {
|
|
2497
|
+
kind: blockKind ?? "block",
|
|
2498
|
+
startByte: blockCapture.startByte,
|
|
2499
|
+
endByte: blockCapture.endByte,
|
|
2500
|
+
startLine: blockCapture.startLine,
|
|
2501
|
+
endLine: blockCapture.endLine
|
|
2502
|
+
};
|
|
2503
|
+
if (nameCapture) {
|
|
2504
|
+
candidate.name = nameCapture.text;
|
|
2505
|
+
}
|
|
2506
|
+
mainBlocks.push(candidate);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
mainBlocks.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
|
|
2510
|
+
innerBlocks.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
|
|
2511
|
+
comments.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
|
|
2512
|
+
return { mainBlocks, innerBlocks, comments };
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
// dist/chunking/chunkMatches.js
|
|
2516
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
2517
|
+
|
|
2518
|
+
// dist/languages.js
|
|
2519
|
+
import fs from "node:fs";
|
|
2520
|
+
import path from "node:path";
|
|
2521
|
+
function adaptDefinition(def) {
|
|
2522
|
+
return {
|
|
2523
|
+
id: def.id,
|
|
2524
|
+
matchExts: def.extensions,
|
|
2525
|
+
language: (filename) => def.grammar(filename),
|
|
2526
|
+
nodeTypes: def.nodeTypes || { identifier: ["identifier"] },
|
|
2527
|
+
queries: def.graph,
|
|
2528
|
+
classifyDefinition: def.classifyDefinition || (() => "variable"),
|
|
2529
|
+
isDeclarationName: def.isDeclarationName || (() => false),
|
|
2530
|
+
scopeDeclarationNames: def.scopeDeclarationNames === "all" ? () => true : def.scopeDeclarationNames ?? (() => false),
|
|
2531
|
+
createsBlockScope: def.createsBlockScope || (() => false),
|
|
2532
|
+
createsFunctionScope: def.createsFunctionScope || (() => false),
|
|
2533
|
+
membersAreImplicitlyInScope: def.membersAreImplicitlyInScope ?? true,
|
|
2534
|
+
supportsCrossModuleSymbols: def.supportsCrossModuleSymbols || false,
|
|
2535
|
+
isTypeOnly: def.isTypeOnly || (() => false),
|
|
2536
|
+
usesQueryDrivenLocals: def.usesQueryDrivenLocals || false,
|
|
2537
|
+
normalizeIdentifier: def.normalizeIdentifier || ((name) => name),
|
|
2538
|
+
...def.native ? { native: def.native } : {}
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
var TS_SUPPORT = adaptDefinition(getLanguageById("ts"));
|
|
2542
|
+
var TSX_SUPPORT = adaptDefinition(getLanguageById("tsx"));
|
|
2543
|
+
var JS_SUPPORT = adaptDefinition(getLanguageById("js"));
|
|
2544
|
+
var PY_SUPPORT = adaptDefinition(getLanguageById("python"));
|
|
2545
|
+
var PHP_SUPPORT = adaptDefinition(getLanguageById("php"));
|
|
2546
|
+
var HTML_SUPPORT = adaptDefinition(getLanguageById("html"));
|
|
2547
|
+
var CSS_SUPPORT = adaptDefinition(getLanguageById("css"));
|
|
2548
|
+
var SCSS_SUPPORT = adaptDefinition(getLanguageById("scss"));
|
|
2549
|
+
var LESS_SUPPORT = adaptDefinition(getLanguageById("less"));
|
|
2550
|
+
var VUE_SUPPORT = adaptDefinition(getLanguageById("vue"));
|
|
2551
|
+
var SVELTE_SUPPORT = adaptDefinition(getLanguageById("svelte"));
|
|
2552
|
+
var RUBY_SUPPORT = adaptDefinition(getLanguageById("ruby"));
|
|
2553
|
+
var GO_SUPPORT = adaptDefinition(getLanguageById("go"));
|
|
2554
|
+
var JAVA_SUPPORT = adaptDefinition(getLanguageById("java"));
|
|
2555
|
+
var CSHARP_SUPPORT = adaptDefinition(getLanguageById("csharp"));
|
|
2556
|
+
var RUST_SUPPORT = adaptDefinition(getLanguageById("rust"));
|
|
2557
|
+
var C_SUPPORT = adaptDefinition(getLanguageById("c"));
|
|
2558
|
+
var CPP_SUPPORT = adaptDefinition(getLanguageById("cpp"));
|
|
2559
|
+
var KOTLIN_SUPPORT = adaptDefinition(getLanguageById("kotlin"));
|
|
2560
|
+
var SWIFT_SUPPORT = adaptDefinition(getLanguageById("swift"));
|
|
2561
|
+
var ZIG_SUPPORT = adaptDefinition(getLanguageById("zig"));
|
|
2562
|
+
var SQL_SUPPORT = adaptDefinition(getLanguageById("sql"));
|
|
2563
|
+
var LANGUAGE_SUPPORTS = getAllLanguages().map(adaptDefinition);
|
|
2564
|
+
var LANGUAGE_EXTENSION_KEY_PATTERN = /^\.[a-z0-9][a-z0-9._+-]*$/;
|
|
2565
|
+
var NON_REMAPPABLE_EXTENSIONS = /* @__PURE__ */ new Set([".vue", ".svelte"]);
|
|
2566
|
+
function isLiteralLanguageExtension(extension) {
|
|
2567
|
+
return LANGUAGE_EXTENSION_KEY_PATTERN.test(extension.trim().toLowerCase());
|
|
2568
|
+
}
|
|
2569
|
+
function isRemappableLanguageExtension(extension) {
|
|
2570
|
+
return !NON_REMAPPABLE_EXTENSIONS.has(extension.trim().toLowerCase());
|
|
2571
|
+
}
|
|
2572
|
+
function normalizeLanguageExtensions(extensions) {
|
|
2573
|
+
const entries = Object.entries(extensions ?? {}).map(([extension, languageId]) => [extension.trim().toLowerCase(), languageId.trim().toLowerCase()]).filter(([extension, languageId]) => isLiteralLanguageExtension(extension) && isRemappableLanguageExtension(extension) && !!supportById(languageId)).sort((left, right) => left[0].localeCompare(right[0]));
|
|
2574
|
+
if (!entries.length)
|
|
2575
|
+
return void 0;
|
|
2576
|
+
return Object.fromEntries(entries);
|
|
2577
|
+
}
|
|
2578
|
+
function mappedSupportForFile(filename, extensionMap) {
|
|
2579
|
+
const mappings = Object.entries(normalizeLanguageExtensions(extensionMap) ?? {}).sort((left, right) => right[0].length - left[0].length || left[0].localeCompare(right[0]));
|
|
2580
|
+
const lowerFilename = filename.toLowerCase();
|
|
2581
|
+
for (const [extension, languageId] of mappings) {
|
|
2582
|
+
if (!lowerFilename.endsWith(extension))
|
|
2583
|
+
continue;
|
|
2584
|
+
return supportById(languageId);
|
|
2585
|
+
}
|
|
2586
|
+
return void 0;
|
|
2587
|
+
}
|
|
2588
|
+
function supportForFile(filename, extensionMap) {
|
|
2589
|
+
const mapped = extensionMap ? mappedSupportForFile(filename, extensionMap) : void 0;
|
|
2590
|
+
if (mapped)
|
|
2591
|
+
return mapped;
|
|
2592
|
+
const ext = path.extname(filename).toLowerCase();
|
|
2593
|
+
if (ext === ".h") {
|
|
2594
|
+
const sample = readFileSample(filename);
|
|
2595
|
+
if (sample && isLikelyCppHeader(sample))
|
|
2596
|
+
return CPP_SUPPORT;
|
|
2597
|
+
return C_SUPPORT;
|
|
2598
|
+
}
|
|
2599
|
+
return LANGUAGE_SUPPORTS.find((s) => s.matchExts.includes(ext));
|
|
2600
|
+
}
|
|
2601
|
+
function supportById(id) {
|
|
2602
|
+
return LANGUAGE_SUPPORTS.find((s) => s.id === id);
|
|
2603
|
+
}
|
|
2604
|
+
var HEADER_SAMPLE_SIZE = 8e3;
|
|
2605
|
+
var CPP_HEADER_HINT = /\b(class|namespace|template|typename|constexpr|operator|using\s+namespace)\b|::/;
|
|
2606
|
+
function readFileSample(filePath) {
|
|
2607
|
+
try {
|
|
2608
|
+
const contents = fs.readFileSync(filePath, "utf8");
|
|
2609
|
+
return contents.slice(0, HEADER_SAMPLE_SIZE);
|
|
2610
|
+
} catch {
|
|
2611
|
+
return null;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
function isLikelyCppHeader(sample) {
|
|
2615
|
+
return CPP_HEADER_HINT.test(sample);
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
// dist/native/runtime.js
|
|
2619
|
+
import path5 from "node:path";
|
|
2620
|
+
import { createRequire } from "node:module";
|
|
2621
|
+
import { fileURLToPath } from "node:url";
|
|
2622
|
+
|
|
2623
|
+
// dist/util/ast.js
|
|
2624
|
+
function stringifyUnknown(value) {
|
|
2625
|
+
if (value instanceof Error)
|
|
2626
|
+
return value.message;
|
|
2627
|
+
if (typeof value === "string")
|
|
2628
|
+
return value;
|
|
2629
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
2630
|
+
return String(value);
|
|
2631
|
+
}
|
|
2632
|
+
if (value === null || value === void 0) {
|
|
2633
|
+
return String(value);
|
|
2634
|
+
}
|
|
2635
|
+
if (typeof value === "object") {
|
|
2636
|
+
try {
|
|
2637
|
+
return JSON.stringify(value);
|
|
2638
|
+
} catch {
|
|
2639
|
+
return "[Object]";
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
if (typeof value === "symbol")
|
|
2643
|
+
return value.toString();
|
|
2644
|
+
if (typeof value === "function") {
|
|
2645
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
2646
|
+
}
|
|
2647
|
+
return "unknown";
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
// dist/native/bindingLoader.js
|
|
2651
|
+
import fs3 from "node:fs";
|
|
2652
|
+
import path4 from "node:path";
|
|
2653
|
+
|
|
2654
|
+
// dist/util/paths.js
|
|
2655
|
+
import fsp from "node:fs/promises";
|
|
2656
|
+
import path2 from "node:path";
|
|
2657
|
+
|
|
2658
|
+
// dist/util/errors.js
|
|
2659
|
+
function errorMessage(error) {
|
|
2660
|
+
if (error instanceof Error)
|
|
2661
|
+
return error.message;
|
|
2662
|
+
return String(error);
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
// dist/util/paths.js
|
|
2666
|
+
function normalizePath(p) {
|
|
2667
|
+
return typeof p === "string" ? p.replace(/\\/g, "/") : "";
|
|
2668
|
+
}
|
|
2669
|
+
function normalizeWindowsComparablePath(filePath) {
|
|
2670
|
+
return normalizePath(filePath).replace(/^([A-Za-z]):/, (_, driveLetter) => `${driveLetter.toUpperCase()}:`);
|
|
2671
|
+
}
|
|
2672
|
+
var defaultCaseInsensitiveFileIdentity = process.platform === "win32" || process.platform === "darwin";
|
|
2673
|
+
function isWindowsQualifiedAbsolutePath(filePath) {
|
|
2674
|
+
const normalizedPath = normalizePath(filePath);
|
|
2675
|
+
return /^[A-Za-z]:\//.test(normalizedPath) || normalizedPath.startsWith("//");
|
|
2676
|
+
}
|
|
2677
|
+
function isPosixQualifiedAbsolutePath(filePath) {
|
|
2678
|
+
const normalizedPath = normalizePath(filePath);
|
|
2679
|
+
return path2.posix.isAbsolute(normalizedPath) && !isWindowsQualifiedAbsolutePath(normalizedPath);
|
|
2680
|
+
}
|
|
2681
|
+
function isAbsoluteFilePath(filePath) {
|
|
2682
|
+
return path2.posix.isAbsolute(filePath) || path2.win32.isAbsolute(filePath);
|
|
2683
|
+
}
|
|
2684
|
+
function resolveFilePathFromRoot(projectRoot, filePath) {
|
|
2685
|
+
if (isAbsoluteFilePath(filePath)) {
|
|
2686
|
+
return filePath;
|
|
2687
|
+
}
|
|
2688
|
+
if (isWindowsQualifiedAbsolutePath(projectRoot)) {
|
|
2689
|
+
return path2.win32.resolve(projectRoot, filePath);
|
|
2690
|
+
}
|
|
2691
|
+
if (isPosixQualifiedAbsolutePath(projectRoot)) {
|
|
2692
|
+
return path2.posix.resolve(normalizePath(projectRoot), normalizePath(filePath));
|
|
2693
|
+
}
|
|
2694
|
+
return path2.resolve(projectRoot, filePath);
|
|
2695
|
+
}
|
|
2696
|
+
function resolveComparableProjectRoot(projectRoot) {
|
|
2697
|
+
if (isAbsoluteFilePath(projectRoot)) {
|
|
2698
|
+
return projectRoot;
|
|
2699
|
+
}
|
|
2700
|
+
return path2.resolve(projectRoot);
|
|
2701
|
+
}
|
|
2702
|
+
function isRelativeToRoot(normalizedRoot, normalizedFile) {
|
|
2703
|
+
const rootIsWindowsPath = isWindowsQualifiedAbsolutePath(normalizedRoot);
|
|
2704
|
+
const fileIsWindowsPath = isWindowsQualifiedAbsolutePath(normalizedFile);
|
|
2705
|
+
const rootIsPosixPath = isPosixQualifiedAbsolutePath(normalizedRoot);
|
|
2706
|
+
const fileIsPosixPath = isPosixQualifiedAbsolutePath(normalizedFile);
|
|
2707
|
+
const comparableRoot = rootIsWindowsPath ? normalizeWindowsComparablePath(normalizedRoot) : normalizedRoot;
|
|
2708
|
+
const comparableFile = fileIsWindowsPath ? normalizeWindowsComparablePath(normalizedFile) : normalizedFile;
|
|
2709
|
+
if (rootIsWindowsPath && fileIsWindowsPath) {
|
|
2710
|
+
if (comparableFile === comparableRoot) {
|
|
2711
|
+
return true;
|
|
2712
|
+
}
|
|
2713
|
+
const relativePath2 = normalizePath(path2.win32.relative(comparableRoot, comparableFile));
|
|
2714
|
+
return !!relativePath2.length && !relativePath2.startsWith("..") && !path2.win32.isAbsolute(relativePath2);
|
|
2715
|
+
}
|
|
2716
|
+
if (rootIsWindowsPath || fileIsWindowsPath) {
|
|
2717
|
+
return false;
|
|
2718
|
+
}
|
|
2719
|
+
if (rootIsPosixPath && fileIsPosixPath) {
|
|
2720
|
+
if (comparableFile === comparableRoot) {
|
|
2721
|
+
return true;
|
|
2722
|
+
}
|
|
2723
|
+
const relativePath2 = path2.posix.relative(comparableRoot, comparableFile);
|
|
2724
|
+
return !!relativePath2.length && !relativePath2.startsWith("..") && !path2.posix.isAbsolute(relativePath2);
|
|
2725
|
+
}
|
|
2726
|
+
if (rootIsPosixPath || fileIsPosixPath) {
|
|
2727
|
+
return false;
|
|
2728
|
+
}
|
|
2729
|
+
if (comparableFile === comparableRoot) {
|
|
2730
|
+
return true;
|
|
2731
|
+
}
|
|
2732
|
+
const relativePath = path2.relative(comparableRoot, comparableFile);
|
|
2733
|
+
return !!relativePath.length && !relativePath.startsWith("..") && !path2.isAbsolute(relativePath);
|
|
2734
|
+
}
|
|
2735
|
+
function isFilePathWithinRoot(projectRoot, filePath) {
|
|
2736
|
+
const normalizedRoot = normalizePath(resolveComparableProjectRoot(projectRoot));
|
|
2737
|
+
const normalizedFile = normalizePath(resolveFilePathFromRoot(normalizedRoot, filePath));
|
|
2738
|
+
return isRelativeToRoot(normalizedRoot, normalizedFile);
|
|
2739
|
+
}
|
|
2740
|
+
function assertFilePathWithinRoot(projectRoot, filePath, label = "File") {
|
|
2741
|
+
const normalizedRoot = normalizePath(resolveComparableProjectRoot(projectRoot));
|
|
2742
|
+
const normalizedFile = normalizePath(resolveFilePathFromRoot(normalizedRoot, filePath));
|
|
2743
|
+
if (!isFilePathWithinRoot(normalizedRoot, normalizedFile)) {
|
|
2744
|
+
throw new Error(`${label} is outside project root: ${normalizedFile} (root: ${normalizedRoot})`);
|
|
2745
|
+
}
|
|
2746
|
+
return normalizedFile;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
// dist/native/runtimeCache.js
|
|
2750
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2751
|
+
import fs2 from "node:fs";
|
|
2752
|
+
import path3 from "node:path";
|
|
2753
|
+
var CACHE_SCHEMA_VERSION = 1;
|
|
2754
|
+
var HASH_BUFFER_SIZE = 1024 * 1024;
|
|
2755
|
+
function asError(error) {
|
|
2756
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
2757
|
+
}
|
|
2758
|
+
function isWithinDirectory(filePath, directoryPath) {
|
|
2759
|
+
const relative = path3.relative(directoryPath, filePath);
|
|
2760
|
+
return !relative || !relative.startsWith("..") && !path3.isAbsolute(relative);
|
|
2761
|
+
}
|
|
2762
|
+
function assertSafeCacheSegment(value, label) {
|
|
2763
|
+
if (!value || value === "." || value === ".." || path3.basename(value) !== value) {
|
|
2764
|
+
throw new Error(`invalid native cache ${label}: ${value}`);
|
|
2765
|
+
}
|
|
2766
|
+
if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
|
|
2767
|
+
throw new Error(`invalid native cache ${label}: ${value}`);
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
function assertSafePathComponent(componentPath) {
|
|
2771
|
+
const stats = fs2.lstatSync(componentPath);
|
|
2772
|
+
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
2773
|
+
throw new Error(`unsafe native cache path component: ${componentPath}`);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
function prepareSafeDirectory(directoryPath) {
|
|
2777
|
+
const absolute = path3.resolve(directoryPath);
|
|
2778
|
+
const parsed = path3.parse(absolute);
|
|
2779
|
+
let current = parsed.root;
|
|
2780
|
+
assertSafePathComponent(current);
|
|
2781
|
+
const relativeParts = absolute.slice(parsed.root.length).split(path3.sep).filter(Boolean);
|
|
2782
|
+
for (const part of relativeParts) {
|
|
2783
|
+
current = path3.join(current, part);
|
|
2784
|
+
try {
|
|
2785
|
+
assertSafePathComponent(current);
|
|
2786
|
+
} catch (error) {
|
|
2787
|
+
if (error.code !== "ENOENT") {
|
|
2788
|
+
throw error;
|
|
2789
|
+
}
|
|
2790
|
+
try {
|
|
2791
|
+
fs2.mkdirSync(current);
|
|
2792
|
+
} catch (mkdirError) {
|
|
2793
|
+
if (mkdirError.code !== "EEXIST")
|
|
2794
|
+
throw mkdirError;
|
|
2795
|
+
}
|
|
2796
|
+
assertSafePathComponent(current);
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
return fs2.realpathSync.native(absolute);
|
|
2800
|
+
}
|
|
2801
|
+
function resolveProductionCacheRoot() {
|
|
2802
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
2803
|
+
if (!localAppData) {
|
|
2804
|
+
throw new Error("LOCALAPPDATA is unavailable; cannot prepare the Windows native runtime cache");
|
|
2805
|
+
}
|
|
2806
|
+
return path3.join(localAppData, "codegraph", "native-cache", `v${CACHE_SCHEMA_VERSION}`);
|
|
2807
|
+
}
|
|
2808
|
+
function hashFileStreaming(filePath, onChunk) {
|
|
2809
|
+
const before = fs2.statSync(filePath);
|
|
2810
|
+
if (!before.isFile() || before.size <= 0) {
|
|
2811
|
+
throw new Error(`native binary is not a non-empty regular file: ${filePath}`);
|
|
2812
|
+
}
|
|
2813
|
+
const hash = createHash("sha256");
|
|
2814
|
+
const buffer = Buffer.allocUnsafe(HASH_BUFFER_SIZE);
|
|
2815
|
+
const descriptor = fs2.openSync(filePath, "r");
|
|
2816
|
+
let size = 0;
|
|
2817
|
+
try {
|
|
2818
|
+
while (true) {
|
|
2819
|
+
const bytesRead = fs2.readSync(descriptor, buffer, 0, buffer.length, null);
|
|
2820
|
+
if (!bytesRead)
|
|
2821
|
+
break;
|
|
2822
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2823
|
+
size += bytesRead;
|
|
2824
|
+
onChunk?.(bytesRead);
|
|
2825
|
+
}
|
|
2826
|
+
} finally {
|
|
2827
|
+
fs2.closeSync(descriptor);
|
|
2828
|
+
}
|
|
2829
|
+
if (size !== before.size) {
|
|
2830
|
+
throw new Error(`native binary changed while hashing: ${filePath}`);
|
|
2831
|
+
}
|
|
2832
|
+
return { sha256: hash.digest("hex"), size };
|
|
2833
|
+
}
|
|
2834
|
+
function randomSuffix() {
|
|
2835
|
+
return `${process.pid}.${randomBytes(8).toString("hex")}`;
|
|
2836
|
+
}
|
|
2837
|
+
function copyFileExclusive(sourcePath, destinationPath) {
|
|
2838
|
+
const source = fs2.openSync(sourcePath, "r");
|
|
2839
|
+
let destination;
|
|
2840
|
+
const buffer = Buffer.allocUnsafe(HASH_BUFFER_SIZE);
|
|
2841
|
+
try {
|
|
2842
|
+
destination = fs2.openSync(destinationPath, "wx");
|
|
2843
|
+
while (true) {
|
|
2844
|
+
const bytesRead = fs2.readSync(source, buffer, 0, buffer.length, null);
|
|
2845
|
+
if (!bytesRead)
|
|
2846
|
+
break;
|
|
2847
|
+
let written = 0;
|
|
2848
|
+
while (written < bytesRead) {
|
|
2849
|
+
written += fs2.writeSync(destination, buffer, written, bytesRead - written);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
fs2.fsyncSync(destination);
|
|
2853
|
+
} finally {
|
|
2854
|
+
if (destination !== void 0)
|
|
2855
|
+
fs2.closeSync(destination);
|
|
2856
|
+
fs2.closeSync(source);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
function removeRegularTemporaryFile(filePath) {
|
|
2860
|
+
try {
|
|
2861
|
+
const stats = fs2.lstatSync(filePath);
|
|
2862
|
+
if (stats.isFile() && !stats.isSymbolicLink())
|
|
2863
|
+
fs2.unlinkSync(filePath);
|
|
2864
|
+
} catch {
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
function verifyFile(filePath, expected) {
|
|
2868
|
+
try {
|
|
2869
|
+
const actual = hashFileStreaming(filePath);
|
|
2870
|
+
return actual.size === expected.size && actual.sha256 === expected.sha256;
|
|
2871
|
+
} catch {
|
|
2872
|
+
return false;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
function publishExclusive(temporaryPath, finalPath) {
|
|
2876
|
+
try {
|
|
2877
|
+
fs2.linkSync(temporaryPath, finalPath);
|
|
2878
|
+
return true;
|
|
2879
|
+
} catch (error) {
|
|
2880
|
+
if (error.code === "EEXIST")
|
|
2881
|
+
return false;
|
|
2882
|
+
throw error;
|
|
2883
|
+
} finally {
|
|
2884
|
+
removeRegularTemporaryFile(temporaryPath);
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
function populateBinary(sourcePath, finalPath, expected) {
|
|
2888
|
+
const temporaryPath = `${finalPath}.${randomSuffix()}.tmp`;
|
|
2889
|
+
try {
|
|
2890
|
+
copyFileExclusive(sourcePath, temporaryPath);
|
|
2891
|
+
if (!verifyFile(temporaryPath, expected)) {
|
|
2892
|
+
throw new Error("native cache temporary file failed integrity verification");
|
|
2893
|
+
}
|
|
2894
|
+
return publishExclusive(temporaryPath, finalPath);
|
|
2895
|
+
} catch (error) {
|
|
2896
|
+
removeRegularTemporaryFile(temporaryPath);
|
|
2897
|
+
throw error;
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
function recoverCorruptFinal(finalPath) {
|
|
2901
|
+
const recoveryPath = `${finalPath}.corrupt.${randomSuffix()}`;
|
|
2902
|
+
fs2.renameSync(finalPath, recoveryPath);
|
|
2903
|
+
}
|
|
2904
|
+
function writeManifest(entryPath, manifest) {
|
|
2905
|
+
const finalPath = path3.join(entryPath, "manifest.json");
|
|
2906
|
+
if (fs2.existsSync(finalPath))
|
|
2907
|
+
return;
|
|
2908
|
+
const temporaryPath = `${finalPath}.${randomSuffix()}.tmp`;
|
|
2909
|
+
try {
|
|
2910
|
+
const descriptor = fs2.openSync(temporaryPath, "wx");
|
|
2911
|
+
try {
|
|
2912
|
+
fs2.writeFileSync(descriptor, `${JSON.stringify(manifest, null, 2)}
|
|
2913
|
+
`, "utf8");
|
|
2914
|
+
fs2.fsyncSync(descriptor);
|
|
2915
|
+
} finally {
|
|
2916
|
+
fs2.closeSync(descriptor);
|
|
2917
|
+
}
|
|
2918
|
+
publishExclusive(temporaryPath, finalPath);
|
|
2919
|
+
} catch (error) {
|
|
2920
|
+
removeRegularTemporaryFile(temporaryPath);
|
|
2921
|
+
throw error;
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
function prepareNativeRuntimeCache(request) {
|
|
2925
|
+
const sourcePath = path3.resolve(request.sourcePath);
|
|
2926
|
+
try {
|
|
2927
|
+
assertSafeCacheSegment(request.target, "target");
|
|
2928
|
+
assertSafeCacheSegment(request.packageVersion, "package version");
|
|
2929
|
+
const sourceRealPath = fs2.realpathSync.native(sourcePath);
|
|
2930
|
+
const source = hashFileStreaming(sourceRealPath);
|
|
2931
|
+
const cacheRoot = prepareSafeDirectory(request.cacheRoot ?? resolveProductionCacheRoot());
|
|
2932
|
+
const targetPath = prepareSafeDirectory(path3.join(cacheRoot, request.target));
|
|
2933
|
+
if (!isWithinDirectory(targetPath, cacheRoot)) {
|
|
2934
|
+
throw new Error("native cache target escaped the cache root");
|
|
2935
|
+
}
|
|
2936
|
+
const cacheKey = `${request.packageName}@${request.packageVersion}:${request.target}:${source.sha256}`;
|
|
2937
|
+
const entryPath = prepareSafeDirectory(path3.join(targetPath, `${request.packageVersion}-${source.sha256}`));
|
|
2938
|
+
if (!isWithinDirectory(entryPath, cacheRoot)) {
|
|
2939
|
+
throw new Error("native cache entry escaped the cache root");
|
|
2940
|
+
}
|
|
2941
|
+
const sourceFileName = path3.basename(sourceRealPath);
|
|
2942
|
+
const finalPath = path3.join(entryPath, sourceFileName);
|
|
2943
|
+
let status = "reused";
|
|
2944
|
+
const finalExists = fs2.existsSync(finalPath);
|
|
2945
|
+
if (!finalExists || !verifyFile(finalPath, source)) {
|
|
2946
|
+
if (finalExists)
|
|
2947
|
+
recoverCorruptFinal(finalPath);
|
|
2948
|
+
status = populateBinary(sourceRealPath, finalPath, source) ? "cached" : "reused";
|
|
2949
|
+
if (!verifyFile(finalPath, source)) {
|
|
2950
|
+
throw new Error("native cache winner failed integrity verification");
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
writeManifest(entryPath, {
|
|
2954
|
+
schemaVersion: CACHE_SCHEMA_VERSION,
|
|
2955
|
+
packageName: request.packageName,
|
|
2956
|
+
packageVersion: request.packageVersion,
|
|
2957
|
+
target: request.target,
|
|
2958
|
+
sourceFileName,
|
|
2959
|
+
sourceSize: source.size,
|
|
2960
|
+
sourceSha256: source.sha256,
|
|
2961
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2962
|
+
});
|
|
2963
|
+
return {
|
|
2964
|
+
status,
|
|
2965
|
+
sourcePath: sourceRealPath,
|
|
2966
|
+
loadedPath: finalPath,
|
|
2967
|
+
cacheKey,
|
|
2968
|
+
sha256: source.sha256
|
|
2969
|
+
};
|
|
2970
|
+
} catch (error) {
|
|
2971
|
+
return { status: "unavailable", sourcePath, error: asError(error) };
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
// dist/native/bindingLoader.js
|
|
2976
|
+
function isMuslRuntime() {
|
|
2977
|
+
if (process.platform !== "linux")
|
|
2978
|
+
return false;
|
|
2979
|
+
const report = process.report?.getReport();
|
|
2980
|
+
const header = report && typeof report === "object" && "header" in report ? report.header : null;
|
|
2981
|
+
const glibcVersionRuntime = header && typeof header === "object" && "glibcVersionRuntime" in header ? header.glibcVersionRuntime : null;
|
|
2982
|
+
if (typeof glibcVersionRuntime === "string" && glibcVersionRuntime)
|
|
2983
|
+
return false;
|
|
2984
|
+
return true;
|
|
2985
|
+
}
|
|
2986
|
+
function nativeTargetSuffixFor(platform, arch) {
|
|
2987
|
+
if (platform === "win32") {
|
|
2988
|
+
if (arch === "x64")
|
|
2989
|
+
return "win32-x64-msvc";
|
|
2990
|
+
if (arch === "arm64")
|
|
2991
|
+
return "win32-arm64-msvc";
|
|
2992
|
+
}
|
|
2993
|
+
if (platform === "darwin") {
|
|
2994
|
+
if (arch === "x64")
|
|
2995
|
+
return "darwin-x64";
|
|
2996
|
+
if (arch === "arm64")
|
|
2997
|
+
return "darwin-arm64";
|
|
2998
|
+
}
|
|
2999
|
+
if (platform === "linux") {
|
|
3000
|
+
const abi = isMuslRuntime() ? "musl" : "gnu";
|
|
3001
|
+
if (arch === "x64")
|
|
3002
|
+
return `linux-x64-${abi}`;
|
|
3003
|
+
if (arch === "arm64")
|
|
3004
|
+
return `linux-arm64-${abi}`;
|
|
3005
|
+
}
|
|
3006
|
+
return null;
|
|
3007
|
+
}
|
|
3008
|
+
function currentNativeTargetSuffix() {
|
|
3009
|
+
return nativeTargetSuffixFor(process.platform, process.arch);
|
|
3010
|
+
}
|
|
3011
|
+
function normalizePathForComparison(filePath) {
|
|
3012
|
+
const resolved = path4.resolve(filePath);
|
|
3013
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
3014
|
+
}
|
|
3015
|
+
function isWithinDirectory2(filePath, directoryPath) {
|
|
3016
|
+
const normalizedFile = normalizePathForComparison(filePath);
|
|
3017
|
+
const normalizedDir = normalizePathForComparison(directoryPath);
|
|
3018
|
+
return normalizedFile === normalizedDir || normalizedFile.startsWith(`${normalizedDir}${path4.sep}`);
|
|
3019
|
+
}
|
|
3020
|
+
function findLocalNativeBinary(packageRoot) {
|
|
3021
|
+
const suffix = currentNativeTargetSuffix();
|
|
3022
|
+
if (!suffix) {
|
|
3023
|
+
return null;
|
|
3024
|
+
}
|
|
3025
|
+
const expectedName = `index.${suffix}.node`;
|
|
3026
|
+
try {
|
|
3027
|
+
const entries = fs3.readdirSync(packageRoot, { withFileTypes: true });
|
|
3028
|
+
const binary = entries.find((entry) => entry.isFile() && entry.name === expectedName);
|
|
3029
|
+
return binary ? path4.join(packageRoot, binary.name) : null;
|
|
3030
|
+
} catch {
|
|
3031
|
+
return null;
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
function readPlatformPackage(packageName, target, resolveFn) {
|
|
3035
|
+
const platformPackageName = `${packageName}-${target}`;
|
|
3036
|
+
const resolvedEntry = resolveFn(platformPackageName);
|
|
3037
|
+
const expectedFileName = `index.${target}.node`;
|
|
3038
|
+
if (path4.basename(resolvedEntry) !== expectedFileName) {
|
|
3039
|
+
throw new Error(`unexpected native platform entry for ${platformPackageName}: ${resolvedEntry}`);
|
|
3040
|
+
}
|
|
3041
|
+
const sourcePath = fs3.realpathSync.native(resolvedEntry);
|
|
3042
|
+
const stats = fs3.statSync(sourcePath);
|
|
3043
|
+
if (!stats.isFile() || stats.size <= 0) {
|
|
3044
|
+
throw new Error(`native platform entry is not a non-empty regular file: ${sourcePath}`);
|
|
3045
|
+
}
|
|
3046
|
+
const packageJsonPath = path4.join(path4.dirname(sourcePath), "package.json");
|
|
3047
|
+
const parsed = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
3048
|
+
if (parsed.name !== platformPackageName || !parsed.version) {
|
|
3049
|
+
throw new Error(`invalid native platform package metadata: ${packageJsonPath}`);
|
|
3050
|
+
}
|
|
3051
|
+
return { sourcePath, packageVersion: parsed.version };
|
|
3052
|
+
}
|
|
3053
|
+
function loadNativeBinding(options) {
|
|
3054
|
+
const localBinary = findLocalNativeBinary(options.localPackageRoot);
|
|
3055
|
+
const localTarget = currentNativeTargetSuffix();
|
|
3056
|
+
let lastError;
|
|
3057
|
+
if (localBinary) {
|
|
3058
|
+
try {
|
|
3059
|
+
return {
|
|
3060
|
+
binding: options.requireFn(localBinary),
|
|
3061
|
+
origin: {
|
|
3062
|
+
mode: "workspace",
|
|
3063
|
+
packageName: options.packageName,
|
|
3064
|
+
...localTarget ? { target: localTarget } : {},
|
|
3065
|
+
sourcePath: normalizePath(localBinary),
|
|
3066
|
+
loadedPath: normalizePath(localBinary)
|
|
3067
|
+
}
|
|
3068
|
+
};
|
|
3069
|
+
} catch (error) {
|
|
3070
|
+
lastError = error;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
const packageEntry = (() => {
|
|
3074
|
+
if (!options.resolveFn)
|
|
3075
|
+
return null;
|
|
3076
|
+
try {
|
|
3077
|
+
return options.resolveFn(options.packageName);
|
|
3078
|
+
} catch {
|
|
3079
|
+
return null;
|
|
3080
|
+
}
|
|
3081
|
+
})();
|
|
3082
|
+
if (packageEntry && isWithinDirectory2(packageEntry, options.localPackageRoot)) {
|
|
3083
|
+
return {
|
|
3084
|
+
binding: null,
|
|
3085
|
+
error: lastError ?? new Error("local workspace native addon is not built; run `npm run build:native`"),
|
|
3086
|
+
origin: {
|
|
3087
|
+
mode: "workspace",
|
|
3088
|
+
packageName: options.packageName,
|
|
3089
|
+
...localTarget ? { target: localTarget } : {}
|
|
3090
|
+
}
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
const platform = options.platform ?? process.platform;
|
|
3094
|
+
const arch = options.arch ?? process.arch;
|
|
3095
|
+
const target = nativeTargetSuffixFor(platform, arch);
|
|
3096
|
+
let installedSourcePath;
|
|
3097
|
+
let installedPackageVersion;
|
|
3098
|
+
let cacheError;
|
|
3099
|
+
if (target && options.resolveFn) {
|
|
3100
|
+
try {
|
|
3101
|
+
const platformPackage = readPlatformPackage(options.packageName, target, options.resolveFn);
|
|
3102
|
+
installedSourcePath = platformPackage.sourcePath;
|
|
3103
|
+
installedPackageVersion = platformPackage.packageVersion;
|
|
3104
|
+
} catch (error) {
|
|
3105
|
+
if (platform === "win32") {
|
|
3106
|
+
cacheError = errorMessage(error);
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
if (platform === "win32" && target && installedSourcePath && installedPackageVersion) {
|
|
3111
|
+
const cached = prepareNativeRuntimeCache({
|
|
3112
|
+
sourcePath: installedSourcePath,
|
|
3113
|
+
packageName: `${options.packageName}-${target}`,
|
|
3114
|
+
packageVersion: installedPackageVersion,
|
|
3115
|
+
target,
|
|
3116
|
+
cacheRoot: options.cacheRoot
|
|
3117
|
+
});
|
|
3118
|
+
if (cached.status === "unavailable") {
|
|
3119
|
+
cacheError = cached.error.message;
|
|
3120
|
+
} else {
|
|
3121
|
+
try {
|
|
3122
|
+
return {
|
|
3123
|
+
binding: options.requireFn(cached.loadedPath),
|
|
3124
|
+
origin: {
|
|
3125
|
+
mode: "cache",
|
|
3126
|
+
packageName: `${options.packageName}-${target}`,
|
|
3127
|
+
packageVersion: installedPackageVersion,
|
|
3128
|
+
target,
|
|
3129
|
+
sourcePath: normalizePath(cached.sourcePath),
|
|
3130
|
+
loadedPath: normalizePath(cached.loadedPath),
|
|
3131
|
+
cacheKey: cached.cacheKey,
|
|
3132
|
+
sha256: cached.sha256
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
} catch (error) {
|
|
3136
|
+
cacheError = `cached native addon failed to load: ${errorMessage(error)}`;
|
|
3137
|
+
lastError = error;
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
let originPackageName = options.packageName;
|
|
3142
|
+
let originLoadedPath = packageEntry;
|
|
3143
|
+
if (target && installedSourcePath && installedPackageVersion) {
|
|
3144
|
+
originPackageName = `${options.packageName}-${target}`;
|
|
3145
|
+
originLoadedPath = installedSourcePath;
|
|
3146
|
+
}
|
|
3147
|
+
const packageOrigin = {
|
|
3148
|
+
mode: "package",
|
|
3149
|
+
packageName: originPackageName,
|
|
3150
|
+
...installedPackageVersion ? { packageVersion: installedPackageVersion } : {},
|
|
3151
|
+
...target ? { target } : {},
|
|
3152
|
+
...installedSourcePath ? { sourcePath: normalizePath(installedSourcePath) } : {},
|
|
3153
|
+
...originLoadedPath ? { loadedPath: normalizePath(originLoadedPath) } : {},
|
|
3154
|
+
...cacheError ? { cacheError } : {}
|
|
3155
|
+
};
|
|
3156
|
+
try {
|
|
3157
|
+
return {
|
|
3158
|
+
binding: options.requireFn(options.packageName),
|
|
3159
|
+
origin: packageOrigin
|
|
3160
|
+
};
|
|
3161
|
+
} catch (error) {
|
|
3162
|
+
return {
|
|
3163
|
+
binding: null,
|
|
3164
|
+
error: error ?? lastError,
|
|
3165
|
+
origin: packageOrigin
|
|
3166
|
+
};
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
// dist/native/runtime.js
|
|
3171
|
+
var require2 = createRequire(import.meta.url);
|
|
3172
|
+
var localNativePackageRoot = path5.resolve(path5.dirname(fileURLToPath(import.meta.url)), "../../packages/codegraph-native");
|
|
3173
|
+
var NATIVE_REQUIRED_ERROR_PREFIX = "native tree-sitter required by explicit option but unavailable";
|
|
3174
|
+
var bindingState;
|
|
3175
|
+
function isNativeTreeSitterDisabledByEnv(env = process.env) {
|
|
3176
|
+
const rawValue = env.CODEGRAPH_DISABLE_NATIVE;
|
|
3177
|
+
if (typeof rawValue !== "string") {
|
|
3178
|
+
return false;
|
|
3179
|
+
}
|
|
3180
|
+
const normalized = rawValue.trim().toLowerCase();
|
|
3181
|
+
return normalized === "1" || normalized === "true" || normalized === "yes";
|
|
3182
|
+
}
|
|
3183
|
+
function normalizeNativeRuntimeMode(mode) {
|
|
3184
|
+
return mode ?? "auto";
|
|
3185
|
+
}
|
|
3186
|
+
function loadBinding() {
|
|
3187
|
+
if (bindingState)
|
|
3188
|
+
return bindingState;
|
|
3189
|
+
const loaded = loadNativeBinding({
|
|
3190
|
+
packageName: "@lzehrung/codegraph-native",
|
|
3191
|
+
localPackageRoot: localNativePackageRoot,
|
|
3192
|
+
requireFn: require2,
|
|
3193
|
+
resolveFn: require2.resolve
|
|
3194
|
+
});
|
|
3195
|
+
if (loaded.binding) {
|
|
3196
|
+
bindingState = {
|
|
3197
|
+
loaded: true,
|
|
3198
|
+
binding: loaded.binding,
|
|
3199
|
+
supportedLanguageIds: new Set(loaded.binding.supportedLanguageIds()),
|
|
3200
|
+
origin: loaded.origin
|
|
3201
|
+
};
|
|
3202
|
+
return bindingState;
|
|
3203
|
+
}
|
|
3204
|
+
bindingState = {
|
|
3205
|
+
loaded: false,
|
|
3206
|
+
error: loaded.error,
|
|
3207
|
+
...loaded.origin ? { origin: loaded.origin } : {}
|
|
3208
|
+
};
|
|
3209
|
+
return bindingState;
|
|
3210
|
+
}
|
|
3211
|
+
function resolveNativeBindingState(mode, env = process.env) {
|
|
3212
|
+
const normalizedMode = normalizeNativeRuntimeMode(mode);
|
|
3213
|
+
if (normalizedMode === "off") {
|
|
3214
|
+
return {
|
|
3215
|
+
loaded: false,
|
|
3216
|
+
error: new Error("native tree-sitter disabled by explicit option")
|
|
3217
|
+
};
|
|
3218
|
+
}
|
|
3219
|
+
if (normalizedMode === "auto" && isNativeTreeSitterDisabledByEnv(env)) {
|
|
3220
|
+
return {
|
|
3221
|
+
loaded: false,
|
|
3222
|
+
error: new Error("native tree-sitter disabled by CODEGRAPH_DISABLE_NATIVE")
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
return loadBinding();
|
|
3226
|
+
}
|
|
3227
|
+
function throwIfNativeRequiredUnavailable(mode, state) {
|
|
3228
|
+
if (normalizeNativeRuntimeMode(mode) !== "on" || state.loaded)
|
|
3229
|
+
return;
|
|
3230
|
+
const suffix = state.error ? `: ${stringifyUnknown(state.error)}` : "";
|
|
3231
|
+
throw new Error(`${NATIVE_REQUIRED_ERROR_PREFIX}${suffix}`);
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
// dist/native/queries.js
|
|
3235
|
+
function normalizeNativeQueryForSupport(support, kind, queryText) {
|
|
3236
|
+
return support.native?.normalizeQuery?.(kind, queryText) ?? queryText;
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
// dist/native/execution.js
|
|
3240
|
+
function getNativeSingleQueryExecution(source, support, queryText, mode) {
|
|
3241
|
+
const state = resolveNativeBindingState(mode);
|
|
3242
|
+
throwIfNativeRequiredUnavailable(mode, state);
|
|
3243
|
+
if (!state.loaded) {
|
|
3244
|
+
return unavailableSingleQueryExecution(state);
|
|
3245
|
+
}
|
|
3246
|
+
if (!state.supportedLanguageIds.has(support.id)) {
|
|
3247
|
+
return { matches: null, fallbackReason: "unsupportedLanguage" };
|
|
3248
|
+
}
|
|
3249
|
+
if (!state.binding.runQuery) {
|
|
3250
|
+
return {
|
|
3251
|
+
matches: null,
|
|
3252
|
+
fallbackReason: "unavailable",
|
|
3253
|
+
error: "native binding does not expose runQuery"
|
|
3254
|
+
};
|
|
3255
|
+
}
|
|
3256
|
+
const normalizedQuery = normalizeNativeQueryForSupport(support, "adHoc", queryText);
|
|
3257
|
+
try {
|
|
3258
|
+
return {
|
|
3259
|
+
matches: state.binding.runQuery(source, support.id, normalizedQuery).matches
|
|
3260
|
+
};
|
|
3261
|
+
} catch (error) {
|
|
3262
|
+
return {
|
|
3263
|
+
matches: null,
|
|
3264
|
+
fallbackReason: "queryFailure",
|
|
3265
|
+
error: errorMessage(error)
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
function unavailableSingleQueryExecution(state) {
|
|
3270
|
+
return {
|
|
3271
|
+
matches: null,
|
|
3272
|
+
...unavailableNativeFailure(state)
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3275
|
+
function unavailableNativeFailure(state) {
|
|
3276
|
+
if (!state.error) {
|
|
3277
|
+
return { fallbackReason: "unavailable" };
|
|
3278
|
+
}
|
|
3279
|
+
if (state.error instanceof Error) {
|
|
3280
|
+
return { fallbackReason: "unavailable", error: state.error.message };
|
|
3281
|
+
}
|
|
3282
|
+
return { fallbackReason: "unavailable", error: stringifyUnknown(state.error) };
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
// dist/chunking/chunkMatches.js
|
|
3286
|
+
function getChunkMatches(language, source, _filePath) {
|
|
3287
|
+
const support = supportById(language.supportId);
|
|
3288
|
+
if (support) {
|
|
3289
|
+
const nativeExecution = getNativeSingleQueryExecution(source, support, language.queryText);
|
|
3290
|
+
if (nativeExecution.matches) {
|
|
3291
|
+
const toStringIndex = createUtf8ByteToStringIndex(source);
|
|
3292
|
+
return nativeExecution.matches.map((match) => toChunkMatchFromNative(match, toStringIndex));
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
return [];
|
|
3296
|
+
}
|
|
3297
|
+
function toChunkMatchFromNative(match, toStringIndex) {
|
|
3298
|
+
return {
|
|
3299
|
+
captures: match.captures.map((capture) => ({
|
|
3300
|
+
name: capture.name,
|
|
3301
|
+
text: capture.text,
|
|
3302
|
+
startByte: toStringIndex(capture.start.index),
|
|
3303
|
+
endByte: toStringIndex(capture.end.index),
|
|
3304
|
+
startLine: capture.start.row + 1,
|
|
3305
|
+
endLine: capture.end.row + 1,
|
|
3306
|
+
nodeType: capture.nodeType
|
|
3307
|
+
}))
|
|
3308
|
+
};
|
|
3309
|
+
}
|
|
3310
|
+
function createUtf8ByteToStringIndex(source) {
|
|
3311
|
+
const utf8Length = Buffer2.byteLength(source, "utf8");
|
|
3312
|
+
if (utf8Length === source.length) {
|
|
3313
|
+
return (byteOffset2) => Math.max(0, Math.min(byteOffset2, source.length));
|
|
3314
|
+
}
|
|
3315
|
+
const byteToStringIndex = new Uint32Array(utf8Length + 1);
|
|
3316
|
+
let byteOffset = 0;
|
|
3317
|
+
let stringIndex = 0;
|
|
3318
|
+
while (stringIndex < source.length) {
|
|
3319
|
+
const codePoint = source.codePointAt(stringIndex);
|
|
3320
|
+
if (codePoint === void 0)
|
|
3321
|
+
break;
|
|
3322
|
+
const charStringLength = codePoint > 65535 ? 2 : 1;
|
|
3323
|
+
const charByteLength = utf8ByteLengthForCodePoint(codePoint);
|
|
3324
|
+
for (let offset = 1; offset < charByteLength; offset += 1) {
|
|
3325
|
+
byteToStringIndex[byteOffset + offset] = stringIndex;
|
|
3326
|
+
}
|
|
3327
|
+
byteOffset += charByteLength;
|
|
3328
|
+
stringIndex += charStringLength;
|
|
3329
|
+
byteToStringIndex[byteOffset] = stringIndex;
|
|
3330
|
+
}
|
|
3331
|
+
byteToStringIndex[byteOffset] = source.length;
|
|
3332
|
+
return (index) => {
|
|
3333
|
+
const bounded = Math.max(0, Math.min(index, byteToStringIndex.length - 1));
|
|
3334
|
+
return byteToStringIndex[bounded] ?? source.length;
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
function utf8ByteLengthForCodePoint(codePoint) {
|
|
3338
|
+
if (codePoint <= 127)
|
|
3339
|
+
return 1;
|
|
3340
|
+
if (codePoint <= 2047)
|
|
3341
|
+
return 2;
|
|
3342
|
+
if (codePoint <= 65535)
|
|
3343
|
+
return 3;
|
|
3344
|
+
return 4;
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
// dist/chunking/chunkId.js
|
|
3348
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
3349
|
+
function withStableChunkIds(chunks, languageId, filePath) {
|
|
3350
|
+
const occurrences = /* @__PURE__ */ new Map();
|
|
3351
|
+
const scopedPath = filePath ?? "unknown";
|
|
3352
|
+
return chunks.map((chunk) => {
|
|
3353
|
+
const digest = createHash2("sha256").update("codegraph-chunk-id-v1\0").update(languageId).update("\0").update(scopedPath).update("\0").update(chunk.type).update("\0").update(chunk.name ?? "").update("\0").update(chunk.text).digest("hex");
|
|
3354
|
+
const occurrence = occurrences.get(digest) ?? 0;
|
|
3355
|
+
occurrences.set(digest, occurrence + 1);
|
|
3356
|
+
const id = occurrence === 0 ? `${languageId}:${scopedPath}:${digest}` : `${languageId}:${scopedPath}:${digest}:${occurrence}`;
|
|
3357
|
+
return { ...chunk, id };
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
// dist/chunking/chunkSplit.js
|
|
3362
|
+
function splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath) {
|
|
3363
|
+
let currentStart = -1;
|
|
3364
|
+
let currentEnd = -1;
|
|
3365
|
+
let currentStartLine = block.startLine;
|
|
3366
|
+
let currentTokens = 0;
|
|
3367
|
+
const flush = () => {
|
|
3368
|
+
if (currentStart === -1)
|
|
3369
|
+
return;
|
|
3370
|
+
emitRangeWithinBudget(block, source, currentStart, currentEnd, currentStartLine, tokenizer, maxTokens, out, languageId, filePath);
|
|
3371
|
+
currentStart = -1;
|
|
3372
|
+
currentEnd = -1;
|
|
3373
|
+
currentTokens = 0;
|
|
3374
|
+
};
|
|
3375
|
+
for (const line of lineRanges(source, block.startByte, block.endByte, block.startLine)) {
|
|
3376
|
+
const lineText = source.slice(line.start, line.end);
|
|
3377
|
+
const lineTokens = tokenizer(lineText);
|
|
3378
|
+
if (lineTokens > maxTokens) {
|
|
3379
|
+
flush();
|
|
3380
|
+
emitRangeWithinBudget(block, source, line.start, line.end, line.startLine, tokenizer, maxTokens, out, languageId, filePath);
|
|
3381
|
+
continue;
|
|
3382
|
+
}
|
|
3383
|
+
if (currentStart !== -1 && currentTokens + lineTokens > maxTokens) {
|
|
3384
|
+
flush();
|
|
3385
|
+
}
|
|
3386
|
+
if (currentStart === -1) {
|
|
3387
|
+
currentStart = line.start;
|
|
3388
|
+
currentStartLine = line.startLine;
|
|
3389
|
+
}
|
|
3390
|
+
currentEnd = line.end;
|
|
3391
|
+
currentTokens += lineTokens;
|
|
3392
|
+
}
|
|
3393
|
+
flush();
|
|
3394
|
+
}
|
|
3395
|
+
function splitLargeBlockUsingInnerBlocks(block, _innerBlocks, source, tokenizer, maxTokens, out, languageId, _newlineOffsets, filePath) {
|
|
3396
|
+
splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
|
|
3397
|
+
}
|
|
3398
|
+
function splitTextWithinTokenBudget(text, tokenizer, maxTokens) {
|
|
3399
|
+
if (!text.length)
|
|
3400
|
+
return [];
|
|
3401
|
+
if (tokenizer(text) <= maxTokens)
|
|
3402
|
+
return [text];
|
|
3403
|
+
const segments = [];
|
|
3404
|
+
let start = 0;
|
|
3405
|
+
while (start < text.length) {
|
|
3406
|
+
if (tokenizer(text.slice(start)) <= maxTokens) {
|
|
3407
|
+
segments.push(text.slice(start));
|
|
3408
|
+
break;
|
|
3409
|
+
}
|
|
3410
|
+
let low = nextCodePointBoundary(text, start);
|
|
3411
|
+
let high = text.length;
|
|
3412
|
+
let end = start;
|
|
3413
|
+
while (low <= high) {
|
|
3414
|
+
const candidate = previousCodePointBoundary(text, low + (high - low >>> 1));
|
|
3415
|
+
if (candidate <= start) {
|
|
3416
|
+
low = nextCodePointBoundary(text, start);
|
|
3417
|
+
continue;
|
|
3418
|
+
}
|
|
3419
|
+
if (tokenizer(text.slice(start, candidate)) <= maxTokens) {
|
|
3420
|
+
end = candidate;
|
|
3421
|
+
low = candidate + 1;
|
|
3422
|
+
} else {
|
|
3423
|
+
high = candidate - 1;
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
if (end === start) {
|
|
3427
|
+
const next = nextCodePointBoundary(text, start);
|
|
3428
|
+
const singleCodePoint = text.slice(start, next);
|
|
3429
|
+
if (tokenizer(singleCodePoint) > maxTokens) {
|
|
3430
|
+
throw new RangeError("maxTokens is smaller than the configured tokenizer's smallest unit");
|
|
3431
|
+
}
|
|
3432
|
+
end = next;
|
|
3433
|
+
}
|
|
3434
|
+
segments.push(text.slice(start, end));
|
|
3435
|
+
start = end;
|
|
3436
|
+
}
|
|
3437
|
+
return segments;
|
|
3438
|
+
}
|
|
3439
|
+
function emitRangeWithinBudget(block, source, start, end, startLine, tokenizer, maxTokens, out, languageId, filePath) {
|
|
3440
|
+
const text = source.slice(start, end);
|
|
3441
|
+
const tokenCount = tokenizer(text);
|
|
3442
|
+
if (tokenCount <= maxTokens) {
|
|
3443
|
+
pushRangedChunk(out, block, languageId, filePath, start, end, startLine, endLineForText(startLine, text), text, tokenCount);
|
|
3444
|
+
return;
|
|
3445
|
+
}
|
|
3446
|
+
let segmentStart = start;
|
|
3447
|
+
let segmentStartLine = startLine;
|
|
3448
|
+
for (const segment of splitTextWithinTokenBudget(text, tokenizer, maxTokens)) {
|
|
3449
|
+
const segmentEnd = segmentStart + segment.length;
|
|
3450
|
+
pushRangedChunk(out, block, languageId, filePath, segmentStart, segmentEnd, segmentStartLine, endLineForText(segmentStartLine, segment), segment, tokenizer(segment));
|
|
3451
|
+
segmentStartLine += countLineBreaks(segment);
|
|
3452
|
+
segmentStart = segmentEnd;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
function pushRangedChunk(out, block, languageId, filePath, sourceStart, sourceEnd, startLine, endLine, text, tokenCount) {
|
|
3456
|
+
out.push({
|
|
3457
|
+
id: "",
|
|
3458
|
+
languageId,
|
|
3459
|
+
type: block.kind,
|
|
3460
|
+
startLine,
|
|
3461
|
+
endLine,
|
|
3462
|
+
text,
|
|
3463
|
+
tokenCount,
|
|
3464
|
+
sourceStart,
|
|
3465
|
+
sourceEnd,
|
|
3466
|
+
...filePath !== void 0 ? { filePath } : {},
|
|
3467
|
+
...block.name !== void 0 ? { name: block.name } : {}
|
|
3468
|
+
});
|
|
3469
|
+
}
|
|
3470
|
+
function lineRanges(source, start, end, startLine) {
|
|
3471
|
+
const ranges = [];
|
|
3472
|
+
let rangeStart = start;
|
|
3473
|
+
let line = startLine;
|
|
3474
|
+
for (let offset = start; offset < end; offset++) {
|
|
3475
|
+
if (source[offset] !== "\n")
|
|
3476
|
+
continue;
|
|
3477
|
+
ranges.push({ start: rangeStart, end: offset + 1, startLine: line });
|
|
3478
|
+
rangeStart = offset + 1;
|
|
3479
|
+
line++;
|
|
3480
|
+
}
|
|
3481
|
+
if (rangeStart < end) {
|
|
3482
|
+
ranges.push({ start: rangeStart, end, startLine: line });
|
|
3483
|
+
}
|
|
3484
|
+
return ranges;
|
|
3485
|
+
}
|
|
3486
|
+
function countLineBreaks(text) {
|
|
3487
|
+
let count = 0;
|
|
3488
|
+
for (let index = 0; index < text.length; index++) {
|
|
3489
|
+
if (text[index] === "\n")
|
|
3490
|
+
count++;
|
|
3491
|
+
}
|
|
3492
|
+
return count;
|
|
3493
|
+
}
|
|
3494
|
+
function endLineForText(startLine, text) {
|
|
3495
|
+
const lineBreaks = countLineBreaks(text);
|
|
3496
|
+
return startLine + lineBreaks - (text.endsWith("\n") ? 1 : 0);
|
|
3497
|
+
}
|
|
3498
|
+
function nextCodePointBoundary(text, index) {
|
|
3499
|
+
if (index >= text.length)
|
|
3500
|
+
return text.length;
|
|
3501
|
+
const codePoint = text.codePointAt(index);
|
|
3502
|
+
return index + (codePoint !== void 0 && codePoint > 65535 ? 2 : 1);
|
|
3503
|
+
}
|
|
3504
|
+
function previousCodePointBoundary(text, index) {
|
|
3505
|
+
if (index <= 0 || index >= text.length || text.charCodeAt(index) < 56320 || text.charCodeAt(index) > 57343) {
|
|
3506
|
+
return index;
|
|
3507
|
+
}
|
|
3508
|
+
return index - 1;
|
|
3509
|
+
}
|
|
3510
|
+
|
|
3511
|
+
// dist/chunking/chunkMerge.js
|
|
3512
|
+
function mergeSmallChunks(chunks, minTokens, maxTokens, tokenizer) {
|
|
3513
|
+
if (!chunks.length)
|
|
3514
|
+
return [];
|
|
3515
|
+
const merged = [];
|
|
3516
|
+
let index = 0;
|
|
3517
|
+
while (index < chunks.length) {
|
|
3518
|
+
let current = { ...chunks[index] };
|
|
3519
|
+
index++;
|
|
3520
|
+
while (current.tokenCount < minTokens && index < chunks.length) {
|
|
3521
|
+
if (current.type === "misc" && current.tokenCount === 0)
|
|
3522
|
+
break;
|
|
3523
|
+
const next = chunks[index];
|
|
3524
|
+
if (next.sourceStart < current.sourceEnd)
|
|
3525
|
+
break;
|
|
3526
|
+
if (next.sourceStart !== current.sourceEnd)
|
|
3527
|
+
break;
|
|
3528
|
+
const combinedText = `${current.text}${next.text}`;
|
|
3529
|
+
const combinedTokens = tokenizer(combinedText);
|
|
3530
|
+
if (combinedTokens > maxTokens)
|
|
3531
|
+
break;
|
|
3532
|
+
const resolvedName = current.name ?? next.name;
|
|
3533
|
+
let type = current.type;
|
|
3534
|
+
if (current.type === "misc" && current.tokenCount === 0) {
|
|
3535
|
+
type = next.type;
|
|
3536
|
+
} else if (next.type === "misc" && next.tokenCount === 0) {
|
|
3537
|
+
type = current.type;
|
|
3538
|
+
} else if (current.type !== next.type) {
|
|
3539
|
+
type = `${current.type}+${next.type}`;
|
|
3540
|
+
}
|
|
3541
|
+
current = {
|
|
3542
|
+
...current,
|
|
3543
|
+
endLine: next.endLine,
|
|
3544
|
+
sourceEnd: next.sourceEnd,
|
|
3545
|
+
text: combinedText,
|
|
3546
|
+
tokenCount: combinedTokens,
|
|
3547
|
+
type,
|
|
3548
|
+
...resolvedName !== void 0 ? { name: resolvedName } : {}
|
|
3549
|
+
};
|
|
3550
|
+
index++;
|
|
3551
|
+
}
|
|
3552
|
+
merged.push(current);
|
|
3553
|
+
}
|
|
3554
|
+
return merged;
|
|
3555
|
+
}
|
|
3556
|
+
function fillGapsWithMiscChunks(chunks, source, languageId, filePath, tokenizer, minTokens, maxTokens, newlineOffsets) {
|
|
3557
|
+
if (!source.length)
|
|
3558
|
+
return [];
|
|
3559
|
+
const result = [];
|
|
3560
|
+
let currentOffset = 0;
|
|
3561
|
+
const sortedChunks = [...chunks].sort((left, right) => left.sourceStart - right.sourceStart || right.sourceEnd - left.sourceEnd);
|
|
3562
|
+
for (const chunk of sortedChunks) {
|
|
3563
|
+
if (chunk.sourceStart > currentOffset) {
|
|
3564
|
+
const appendedToPrevious = appendTriviaGap(result, source, currentOffset, chunk.sourceStart, tokenizer, maxTokens, newlineOffsets);
|
|
3565
|
+
if (!appendedToPrevious) {
|
|
3566
|
+
pushMiscRange(result, source, currentOffset, chunk.sourceStart, languageId, filePath, tokenizer, maxTokens, newlineOffsets);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
result.push(chunk);
|
|
3570
|
+
currentOffset = Math.max(currentOffset, chunk.sourceEnd);
|
|
3571
|
+
}
|
|
3572
|
+
if (currentOffset < source.length) {
|
|
3573
|
+
const appendedToPrevious = appendTriviaGap(result, source, currentOffset, source.length, tokenizer, maxTokens, newlineOffsets);
|
|
3574
|
+
if (!appendedToPrevious) {
|
|
3575
|
+
pushMiscRange(result, source, currentOffset, source.length, languageId, filePath, tokenizer, maxTokens, newlineOffsets);
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
return mergeSmallChunks(result, minTokens, maxTokens, tokenizer);
|
|
3579
|
+
}
|
|
3580
|
+
function appendTriviaGap(chunks, source, start, end, tokenizer, maxTokens, newlineOffsets) {
|
|
3581
|
+
if (!chunks.length || end <= start)
|
|
3582
|
+
return false;
|
|
3583
|
+
const previous = chunks[chunks.length - 1];
|
|
3584
|
+
if (previous.sourceEnd !== start)
|
|
3585
|
+
return false;
|
|
3586
|
+
const text = source.slice(start, end);
|
|
3587
|
+
if (!/^[\s;]+$/u.test(text))
|
|
3588
|
+
return false;
|
|
3589
|
+
const combinedText = `${previous.text}${text}`;
|
|
3590
|
+
const tokenCount = tokenizer(combinedText);
|
|
3591
|
+
if (tokenCount > maxTokens)
|
|
3592
|
+
return false;
|
|
3593
|
+
const [endRow] = locateLineFromOffset(newlineOffsets, Math.max(start, end - 1));
|
|
3594
|
+
chunks[chunks.length - 1] = {
|
|
3595
|
+
...previous,
|
|
3596
|
+
endLine: endRow + 1,
|
|
3597
|
+
sourceEnd: end,
|
|
3598
|
+
text: combinedText,
|
|
3599
|
+
tokenCount
|
|
3600
|
+
};
|
|
3601
|
+
return true;
|
|
3602
|
+
}
|
|
3603
|
+
function pushMiscRange(out, source, start, end, languageId, filePath, tokenizer, maxTokens, newlineOffsets) {
|
|
3604
|
+
if (end <= start)
|
|
3605
|
+
return;
|
|
3606
|
+
const [startRow] = locateLineFromOffset(newlineOffsets, start);
|
|
3607
|
+
const [endRow] = locateLineFromOffset(newlineOffsets, Math.max(start, end - 1));
|
|
3608
|
+
const block = {
|
|
3609
|
+
kind: "misc",
|
|
3610
|
+
startByte: start,
|
|
3611
|
+
endByte: end,
|
|
3612
|
+
startLine: startRow + 1,
|
|
3613
|
+
endLine: endRow + 1
|
|
3614
|
+
};
|
|
3615
|
+
const text = source.slice(start, end);
|
|
3616
|
+
const tokenCount = tokenizer(text);
|
|
3617
|
+
if (tokenCount <= maxTokens) {
|
|
3618
|
+
out.push({
|
|
3619
|
+
id: "",
|
|
3620
|
+
languageId,
|
|
3621
|
+
type: "misc",
|
|
3622
|
+
startLine: block.startLine,
|
|
3623
|
+
endLine: block.endLine,
|
|
3624
|
+
text,
|
|
3625
|
+
tokenCount,
|
|
3626
|
+
sourceStart: start,
|
|
3627
|
+
sourceEnd: end,
|
|
3628
|
+
...filePath !== void 0 ? { filePath } : {}
|
|
3629
|
+
});
|
|
3630
|
+
return;
|
|
3631
|
+
}
|
|
3632
|
+
splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
|
|
3633
|
+
}
|
|
3634
|
+
function locateLineFromOffset(newlineOffsets, offset) {
|
|
3635
|
+
let low = 0;
|
|
3636
|
+
let high = newlineOffsets.length;
|
|
3637
|
+
while (low < high) {
|
|
3638
|
+
const mid = low + high >>> 1;
|
|
3639
|
+
if (newlineOffsets[mid] < offset)
|
|
3640
|
+
low = mid + 1;
|
|
3641
|
+
else
|
|
3642
|
+
high = mid;
|
|
3643
|
+
}
|
|
3644
|
+
const previousNewline = low > 0 ? newlineOffsets[low - 1] : -1;
|
|
3645
|
+
return [low, offset - previousNewline - 1];
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
// dist/chunking/tokenizer.js
|
|
3649
|
+
function countWhitespaceTokens(text) {
|
|
3650
|
+
if (!text.trim())
|
|
3651
|
+
return 0;
|
|
3652
|
+
return text.trim().split(/\s+/).length;
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
// dist/chunking/chunkFile.js
|
|
3656
|
+
function chunkFile(opts) {
|
|
3657
|
+
const { language, source, filePath, minTokens = 150, maxTokens = 400, tokenizer = countWhitespaceTokens } = opts;
|
|
3658
|
+
const matches = getChunkMatches(language, source, filePath);
|
|
3659
|
+
const newlineOffsets = collectNewlineOffsets(source);
|
|
3660
|
+
const { mainBlocks, innerBlocks, comments } = collectChunkBlockGroups(language, matches);
|
|
3661
|
+
const selectedBlocks = selectMainBlocks(mainBlocks);
|
|
3662
|
+
const preliminaryChunks = [];
|
|
3663
|
+
const sortedInnerBlocks = [...innerBlocks].sort((left, right) => left.startByte - right.startByte || left.endByte - right.endByte);
|
|
3664
|
+
for (const block of selectedBlocks) {
|
|
3665
|
+
appendBlockChunks(block, sortedInnerBlocks, source, tokenizer, maxTokens, preliminaryChunks, language.id, newlineOffsets, filePath);
|
|
3666
|
+
}
|
|
3667
|
+
for (const comment of selectStandaloneComments(comments, selectedBlocks)) {
|
|
3668
|
+
appendBlockChunks(comment, [], source, tokenizer, maxTokens, preliminaryChunks, language.id, newlineOffsets, filePath);
|
|
3669
|
+
}
|
|
3670
|
+
preliminaryChunks.sort((left, right) => left.sourceStart - right.sourceStart || right.sourceEnd - left.sourceEnd);
|
|
3671
|
+
const mergedChunks = mergeSmallChunks(preliminaryChunks, minTokens, maxTokens, tokenizer);
|
|
3672
|
+
const completeChunks = fillGapsWithMiscChunks(mergedChunks, source, language.id, filePath, tokenizer, minTokens, maxTokens, newlineOffsets);
|
|
3673
|
+
return withStableChunkIds(completeChunks.map(({ sourceStart: _sourceStart, sourceEnd: _sourceEnd, ...chunk }) => chunk), language.id, filePath);
|
|
3674
|
+
}
|
|
3675
|
+
function appendBlockChunks(block, innerBlocks, source, tokenizer, maxTokens, out, languageId, newlineOffsets, filePath) {
|
|
3676
|
+
const text = source.slice(block.startByte, block.endByte);
|
|
3677
|
+
const tokens = tokenizer(text);
|
|
3678
|
+
if (tokens <= maxTokens) {
|
|
3679
|
+
out.push({
|
|
3680
|
+
id: "",
|
|
3681
|
+
languageId,
|
|
3682
|
+
type: block.kind,
|
|
3683
|
+
startLine: block.startLine,
|
|
3684
|
+
endLine: block.endLine,
|
|
3685
|
+
text,
|
|
3686
|
+
tokenCount: tokens,
|
|
3687
|
+
sourceStart: block.startByte,
|
|
3688
|
+
sourceEnd: block.endByte,
|
|
3689
|
+
...filePath !== void 0 ? { filePath } : {},
|
|
3690
|
+
...block.name !== void 0 ? { name: block.name } : {}
|
|
3691
|
+
});
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3694
|
+
const innerInRange = collectContainedInnerBlocks(innerBlocks, block);
|
|
3695
|
+
if (!innerInRange.length) {
|
|
3696
|
+
splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
|
|
3697
|
+
return;
|
|
3698
|
+
}
|
|
3699
|
+
splitLargeBlockUsingInnerBlocks(block, innerInRange, source, tokenizer, maxTokens, out, languageId, newlineOffsets, filePath);
|
|
3700
|
+
}
|
|
3701
|
+
function collectContainedInnerBlocks(sortedInnerBlocks, block) {
|
|
3702
|
+
let low = 0;
|
|
3703
|
+
let high = sortedInnerBlocks.length;
|
|
3704
|
+
while (low < high) {
|
|
3705
|
+
const mid = low + high >> 1;
|
|
3706
|
+
if (sortedInnerBlocks[mid].startByte <= block.startByte)
|
|
3707
|
+
low = mid + 1;
|
|
3708
|
+
else
|
|
3709
|
+
high = mid;
|
|
3710
|
+
}
|
|
3711
|
+
const innerInRange = [];
|
|
3712
|
+
for (let index = low; index < sortedInnerBlocks.length; index++) {
|
|
3713
|
+
const innerBlock = sortedInnerBlocks[index];
|
|
3714
|
+
if (innerBlock.startByte >= block.endByte)
|
|
3715
|
+
break;
|
|
3716
|
+
if (innerBlock.endByte < block.endByte)
|
|
3717
|
+
innerInRange.push(innerBlock);
|
|
3718
|
+
}
|
|
3719
|
+
return innerInRange;
|
|
3720
|
+
}
|
|
3721
|
+
function selectMainBlocks(mainBlocks) {
|
|
3722
|
+
const nodes = buildBlockTree(mainBlocks);
|
|
3723
|
+
const selected = [];
|
|
3724
|
+
const visit = (node) => {
|
|
3725
|
+
selected.push(node.block);
|
|
3726
|
+
for (const child of node.children) {
|
|
3727
|
+
visit(child);
|
|
3728
|
+
}
|
|
3729
|
+
};
|
|
3730
|
+
for (const node of nodes) {
|
|
3731
|
+
visit(node);
|
|
3732
|
+
}
|
|
3733
|
+
return selected;
|
|
3734
|
+
}
|
|
3735
|
+
function buildBlockTree(mainBlocks) {
|
|
3736
|
+
const sortedBlocks = deduplicateBlocks(mainBlocks).sort((left, right) => left.startByte - right.startByte || right.endByte - left.endByte);
|
|
3737
|
+
const roots = [];
|
|
3738
|
+
const stack = [];
|
|
3739
|
+
for (const block of sortedBlocks) {
|
|
3740
|
+
while (stack.length && stack[stack.length - 1].block.endByte <= block.startByte) {
|
|
3741
|
+
stack.pop();
|
|
3742
|
+
}
|
|
3743
|
+
const parent = stack[stack.length - 1];
|
|
3744
|
+
const node = { block, children: [] };
|
|
3745
|
+
if (parent && block.endByte <= parent.block.endByte) {
|
|
3746
|
+
parent.children.push(node);
|
|
3747
|
+
stack.push(node);
|
|
3748
|
+
continue;
|
|
3749
|
+
}
|
|
3750
|
+
if (parent && block.startByte < parent.block.endByte) {
|
|
3751
|
+
continue;
|
|
3752
|
+
}
|
|
3753
|
+
roots.push(node);
|
|
3754
|
+
stack.push(node);
|
|
3755
|
+
}
|
|
3756
|
+
return roots;
|
|
3757
|
+
}
|
|
3758
|
+
function deduplicateBlocks(blocks) {
|
|
3759
|
+
const byRange = /* @__PURE__ */ new Map();
|
|
3760
|
+
for (const block of blocks) {
|
|
3761
|
+
const key = `${block.startByte}:${block.endByte}`;
|
|
3762
|
+
const existing = byRange.get(key);
|
|
3763
|
+
if (!existing || !existing.name && block.name || existing.name === block.name && block.kind < existing.kind) {
|
|
3764
|
+
byRange.set(key, block);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
return [...byRange.values()];
|
|
3768
|
+
}
|
|
3769
|
+
function selectStandaloneComments(comments, selectedBlocks) {
|
|
3770
|
+
const selectedComments = [];
|
|
3771
|
+
for (const comment of deduplicateBlocks(comments)) {
|
|
3772
|
+
if (selectedBlocks.some((block) => block.startByte <= comment.startByte && comment.endByte <= block.endByte)) {
|
|
3773
|
+
continue;
|
|
3774
|
+
}
|
|
3775
|
+
const previous = selectedComments[selectedComments.length - 1];
|
|
3776
|
+
if (previous && comment.startByte < previous.endByte)
|
|
3777
|
+
continue;
|
|
3778
|
+
selectedComments.push(comment);
|
|
3779
|
+
}
|
|
3780
|
+
return selectedComments;
|
|
3781
|
+
}
|
|
3782
|
+
function collectNewlineOffsets(source) {
|
|
3783
|
+
const newlineOffsets = [];
|
|
3784
|
+
for (let index = 0; index < source.length; index++) {
|
|
3785
|
+
if (source[index] === "\n")
|
|
3786
|
+
newlineOffsets.push(index);
|
|
3787
|
+
}
|
|
3788
|
+
return newlineOffsets;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
// dist/agent/query-index/content.js
|
|
3792
|
+
var MAX_QUERY_INDEX_TEXT_BYTES = 3e5;
|
|
3793
|
+
var CHUNK_LANGUAGE_ALIASES = {
|
|
3794
|
+
js: "javascript",
|
|
3795
|
+
ts: "typescript"
|
|
3796
|
+
};
|
|
3797
|
+
function compressQueryText(text) {
|
|
3798
|
+
return brotliCompressSync(text, {
|
|
3799
|
+
params: { [zlibConstants.BROTLI_PARAM_QUALITY]: 4 }
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3802
|
+
function normalizeQuerySearchText(input) {
|
|
3803
|
+
return input.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
|
|
3804
|
+
}
|
|
3805
|
+
function detectQueryIndexSurface(relativePath) {
|
|
3806
|
+
const lower = relativePath.toLowerCase();
|
|
3807
|
+
if (lower === "readme.md" || lower.startsWith("docs/") || lower.endsWith(".md") || lower.endsWith(".mdx") || lower.endsWith(".rst") || lower.endsWith(".adoc") || lower.endsWith(".txt")) {
|
|
3808
|
+
return "docs";
|
|
3809
|
+
}
|
|
3810
|
+
if (lower.endsWith(".json") || lower.endsWith(".yaml") || lower.endsWith(".yml") || lower.endsWith(".toml") || lower.endsWith(".ini") || lower.endsWith(".env") || lower === "dockerfile" || lower.startsWith(".github/")) {
|
|
3811
|
+
return "config";
|
|
3812
|
+
}
|
|
3813
|
+
return "code";
|
|
3814
|
+
}
|
|
3815
|
+
function buildQueryTextChunks(file, text) {
|
|
3816
|
+
const support = supportForFile(file);
|
|
3817
|
+
const languageId = support ? CHUNK_LANGUAGE_ALIASES[support.id] ?? support.id : void 0;
|
|
3818
|
+
const language = languageId ? LANG_CONFIGS[languageId] : void 0;
|
|
3819
|
+
if (language) {
|
|
3820
|
+
try {
|
|
3821
|
+
const chunks = chunkFile({
|
|
3822
|
+
language,
|
|
3823
|
+
source: text,
|
|
3824
|
+
filePath: file,
|
|
3825
|
+
minTokens: 1,
|
|
3826
|
+
maxTokens: 120
|
|
3827
|
+
});
|
|
3828
|
+
if (chunks.length) {
|
|
3829
|
+
return chunks.map((chunk, ordinal) => ({
|
|
3830
|
+
ordinal,
|
|
3831
|
+
kind: chunk.type,
|
|
3832
|
+
...chunk.name ? { name: chunk.name } : {},
|
|
3833
|
+
text: chunk.text,
|
|
3834
|
+
normalizedText: normalizeQuerySearchText([chunk.name, chunk.text].filter(Boolean).join(" ")),
|
|
3835
|
+
startLine: chunk.startLine,
|
|
3836
|
+
endLine: chunk.endLine
|
|
3837
|
+
}));
|
|
3838
|
+
}
|
|
3839
|
+
} catch {
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
return text.split(/\r?\n/).map((line, ordinal) => ({
|
|
3843
|
+
ordinal,
|
|
3844
|
+
kind: "line",
|
|
3845
|
+
text: line,
|
|
3846
|
+
normalizedText: normalizeQuerySearchText(line),
|
|
3847
|
+
startLine: ordinal + 1,
|
|
3848
|
+
endLine: ordinal + 1
|
|
3849
|
+
}));
|
|
3850
|
+
}
|
|
3851
|
+
async function prepareQueryIndexFile(input) {
|
|
3852
|
+
try {
|
|
3853
|
+
const stat = await fs4.stat(input.absolutePath);
|
|
3854
|
+
const support = supportForFile(input.absolutePath);
|
|
3855
|
+
if (stat.size > MAX_QUERY_INDEX_TEXT_BYTES) {
|
|
3856
|
+
return {
|
|
3857
|
+
path: input.path,
|
|
3858
|
+
sourceIdentity: input.sourceIdentity,
|
|
3859
|
+
surface: detectQueryIndexSurface(input.path),
|
|
3860
|
+
...support ? { language: support.id } : {},
|
|
3861
|
+
byteLength: stat.size,
|
|
3862
|
+
lineCount: 0,
|
|
3863
|
+
normalizedText: compressQueryText(""),
|
|
3864
|
+
chunks: [],
|
|
3865
|
+
sourceRead: false
|
|
3866
|
+
};
|
|
3867
|
+
}
|
|
3868
|
+
const text = await fs4.readFile(input.absolutePath, "utf8");
|
|
3869
|
+
return {
|
|
3870
|
+
path: input.path,
|
|
3871
|
+
sourceIdentity: input.sourceIdentity,
|
|
3872
|
+
surface: detectQueryIndexSurface(input.path),
|
|
3873
|
+
...support ? { language: support.id } : {},
|
|
3874
|
+
byteLength: stat.size,
|
|
3875
|
+
lineCount: text ? text.split(/\r?\n/).length : 0,
|
|
3876
|
+
normalizedText: compressQueryText(normalizeQuerySearchText(text)),
|
|
3877
|
+
chunks: buildQueryTextChunks(input.absolutePath, text).map((chunk) => ({
|
|
3878
|
+
...chunk,
|
|
3879
|
+
text: compressQueryText(chunk.text)
|
|
3880
|
+
})),
|
|
3881
|
+
sourceRead: true
|
|
3882
|
+
};
|
|
3883
|
+
} catch {
|
|
3884
|
+
return null;
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
// dist/agent/query-index/paths.js
|
|
3889
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
3890
|
+
import path6 from "node:path";
|
|
3891
|
+
function resolveQueryIndexSourcePath(projectRoot, relativePath) {
|
|
3892
|
+
if (relativePath.includes("\0") || isAbsoluteFilePath(relativePath)) {
|
|
3893
|
+
throw new Error(`Invalid query index relative path: ${relativePath}`);
|
|
3894
|
+
}
|
|
3895
|
+
const normalized = normalizePath(relativePath);
|
|
3896
|
+
const segments = normalized.split("/");
|
|
3897
|
+
if (!normalized || normalized === "." || isAbsoluteFilePath(normalized) || segments.includes("..")) {
|
|
3898
|
+
throw new Error(`Invalid query index relative path: ${relativePath}`);
|
|
3899
|
+
}
|
|
3900
|
+
return assertFilePathWithinRoot(projectRoot, path6.resolve(projectRoot, ...segments), "Query index row");
|
|
3901
|
+
}
|
|
3902
|
+
|
|
3903
|
+
// dist/agent/query-index/queryIndexWorker.js
|
|
3904
|
+
async function prepareQueryIndexWorkerTask(task) {
|
|
3905
|
+
const absolutePath = resolveQueryIndexSourcePath(task.projectRoot, task.relativePath);
|
|
3906
|
+
return await prepareQueryIndexFile({
|
|
3907
|
+
absolutePath,
|
|
3908
|
+
path: task.relativePath,
|
|
3909
|
+
sourceIdentity: task.sourceIdentity
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3912
|
+
export {
|
|
3913
|
+
prepareQueryIndexWorkerTask as default
|
|
3914
|
+
};
|