import type { SymbolInfo, SupportedLanguage, SyntaxNode } from './types.js'; /** * Per-project manifest-declared import-root mappings, threaded through as a * third specifier-resolution step (after relative-import and workspace- * package resolution) in `resolveImportSpecifier` — EXCEPT for Rust, whose * `rustCrateMap` is threaded straight into the import extractor instead (see * its own doc comment below). Built once per workspace root in * `ast/chunker.ts`'s `prepareASTContext` — see `../php-psr4.ts`, * `../go-module.ts`, `../python-src-layout.ts`, and `../rust-crate-map.ts` for * how each map/root is read or detected. At most one field is ever populated * for a given file (the language determines which manifest, if any, * applies), and all are optional so this is a no-op for every language * without a manifest reader. */ export interface ManifestRoots { /** * PHP Composer PSR-4 namespace-prefix -> candidate source-directories map. * A prefix can have more than one candidate (#1002 — declared in both * `autoload` and `autoload-dev`, or a fallback-dir array); disambiguated in * `resolveManifestRoot` using `workspaceRoot` below. */ psr4Map?: ReadonlyMap; /** Go module's declared import-path prefix (`go.mod`'s `module` line). */ goModulePrefix?: string; /** Python src-layout root directory (`src`), when detected on disk. */ pythonSrcLayoutRoot?: string; /** * Absolute workspace root, needed alongside `pythonSrcLayoutRoot` (see its * own doc comment) and `resolveDirectoryIndex` (below): both verify a * candidate path actually exists on disk before rewriting a specifier. */ workspaceRoot?: string; /** * When true, a relative import that resolves to a bare directory path * (e.g. `../..` joined against its importer's directory, producing `src`) * is further resolved to that directory's real `index.` entry file, * when one exists on disk (#953 — see `../js-directory-index.ts`). Set * only for JS/TS (`ast/chunker.ts`'s `buildManifestRoots`): a bare * directory specifier left unresolved falls through to `matchesFile`'s * fuzzy-matching strategies, each tuned for a DIFFERENT language's real * multi-file semantics (Go's package directories, Python's package * `__init__.py`) — for a JS/TS importer neither applies, so the bare * specifier fabricates a dependent edge to every file under that * directory instead of the one real edge. */ resolveDirectoryIndex?: true; /** * Rust Cargo workspace crate name (underscore form) -> crate `src/` dir map * (#903). Unlike `psr4Map`/`goModulePrefix`, this is NOT consumed by * `resolveManifestRoot` below — Rust's extractor (`ast/languages/rust.ts`) * must decide "internal vs. external crate" BEFORE it ever emits a * specifier (a `crate::`/`self::`/`super::`-relative path is converted; * anything else is dropped), so the map is passed straight into * `extractImportPaths`/`processImportSymbols` as an extra argument instead * of being applied as post-extraction string resolution. */ rustCrateMap?: ReadonlyMap; /** * NOTE: `workspaceRoot` (declared above, shared with PHP/Python/JVM) is * ALSO threaded to Rust's `processImportSymbolsList` for the same reason * `rustCrateMap` is (#1056): resolving a bare crate-root import (`use * crate_name::Symbol;`) needs the absolute project root to read the * target crate's own root file (`../rust-crate-exports.ts`'s * `resolveRustCrateRootExport`) when deciding which specific file declares * `Symbol`, rather than fabricating a match against the whole crate. */ /** * Java/Kotlin conventional Maven/Gradle source-set directories (#1046 / * #1005 Mechanism 1) — e.g. `src/main/java`, `klaxon/src/main/kotlin` for a * multi-module build. See `../jvm-source-root.ts`. Consumed by * `resolveManifestRoot` below, disambiguated against `workspaceRoot` the * same way `psr4Map` is (an existence check, not a bare textual join). */ jvmSourceRoots?: readonly string[]; } /** * Extract symbol information from an AST node using language-specific extractors. * * @param node - AST node to extract info from * @param content - Source code content * @param parentClass - Parent class name if this is a method * @param language - Programming language * @returns Symbol information or null */ export declare function extractSymbolInfo(node: SyntaxNode, content: string, parentClass?: string, language?: string): SymbolInfo | null; /** * Extract import statements from a file. * * When a language is provided, uses the language-specific import extractor. * Falls back to legacy behavior for backwards compatibility. * * @param filepath - Optional path of the file being chunked. Enables resolution * of `./` / `../` specifiers so they store workspace-relative paths instead * of bare basenames. Deliberately gated per-language by the caller (see * `ast/chunker.ts`'s `RESOLVE_RELATIVE_IMPORTS`) — Rust is excluded here * because filesystem-style `..` resolution would misresolve `self::`/ * `super::` (see `rustImporterFile` below for how Rust resolves them * instead). * @param workspacePackages - Optional map of workspace package name -> source * entry file (see `resolveWorkspacePackageEntries`). Enables resolution of * bare `@scope/pkg` specifiers that reference sibling workspace packages. * @param manifestRoots - Optional manifest-declared import-root mappings * (PHP PSR-4, Go module prefix). See `ManifestRoots`. * @param rustImporterFile - Rust-only (#928): the file's real workspace- * relative path, passed UNCONDITIONALLY (never gated by * `RESOLVE_RELATIVE_IMPORTS`, unlike `filepath` above) so * `RustImportExtractor` can resolve `self::`/`super::` against the * importer's own location via its own file-to-module-aware logic — see * `ast/languages/rust.ts`'s `resolveRustRelativeModulePath`. Every other * language's extractor ignores this parameter. */ export declare function extractImports(rootNode: SyntaxNode, language?: SupportedLanguage, filepath?: string, workspacePackages?: ReadonlyMap, manifestRoots?: ManifestRoots, rustImporterFile?: string): string[]; /** * Extract imported symbols mapped to their source paths. * * Returns a map like: { 'packages/parser/src/validate': ['validateEmail'] } * when `filepath` is provided, or { './validate': ['validateEmail'] } for * legacy callers that don't pass it. * * @param filepath - Optional path of the file being chunked. Enables resolution * of `./` / `../` specifiers into workspace-relative keys. Gated per-language * by the caller — see `extractImports`'s doc comment for why Rust is * excluded and uses `rustImporterFile` instead. * @param workspacePackages - Optional map of workspace package name -> source * entry file. Enables resolution of bare `@scope/pkg` keys. * @param manifestRoots - Optional manifest-declared import-root mappings * (PHP PSR-4, Go module prefix). See `ManifestRoots`. * @param rustImporterFile - Rust-only (#928) — see `extractImports`. */ export declare function extractImportedSymbols(rootNode: SyntaxNode, language?: SupportedLanguage, filepath?: string, workspacePackages?: ReadonlyMap, manifestRoots?: ManifestRoots, rustImporterFile?: string): Record; /** * Extract exported symbols from a file. * * Returns array of exported symbol names like: ['validateEmail', 'validatePhone', 'default'] * * Language-specific behavior: * * **JavaScript/TypeScript:** * - Named exports: export { foo, bar } * - Declaration exports: export function foo() {}, export const bar = ... * - Default exports: export default ... * - Re-exports: export { foo } from './module' * * **PHP:** * - All top-level classes, traits, interfaces, and functions are considered exported * - PHP doesn't have explicit export syntax - all public declarations are accessible * * **Python:** * - All module-level classes and functions are considered exported * - Python doesn't have explicit export syntax - module-level names are importable * * Limitations: * - Only static, top-level declarations are processed (direct children of the root node). * - Dynamic or conditional exports/declarations are not detected. * * @param rootNode - AST root node * @param language - Programming language (defaults to 'javascript' for backwards compatibility) * @returns Array of exported symbol names */ export declare function extractExports(rootNode: SyntaxNode, language?: SupportedLanguage): string[]; /** * Extract call sites within a function/method body. * * Returns array of function calls made within the node. * * Supported languages: * - TypeScript/JavaScript: call_expression (foo(), obj.method()), new_expression (new Foo()) * - PHP: function_call_expression, member_call_expression, scoped_call_expression * - Python: call (similar to JS call_expression) * - Rust: call_expression (foo(), obj.method()), macro_invocation (println!()) */ export declare function extractCallSites(node: SyntaxNode, language?: SupportedLanguage): Array<{ symbol: string; line: number; isResultCaptured?: boolean; }>; //# sourceMappingURL=symbols.d.ts.map