import type { ParsedFile } from "../../../../core/ports/parser.port.js"; import { type GoDeclarationIndex } from "./declarations.js"; import { type GoImportIndex } from "./imports.js"; export type GoPackage = { readonly directory: string; readonly declarations: GoDeclarationIndex; /** * The qualifiers every file of the package binds. A type declared here * names its field types through these, never through the caller's. */ readonly imports: GoImportIndex; }; export type GoPackageIndex = { /** The package a directory of the analysis unit holds. */ at(directory: string): GoPackage | null; /** The package an import path names, by longest matching path suffix. */ forImport(importPath: string): GoPackage | null; /** * Every package an import path could name. A declared anchor has to know * that its symbol was ambiguous rather than take whichever suffix was * longest, so ambiguity is reported here instead of resolved. */ matchesFor(importPath: string): readonly GoPackage[]; }; /** * Go resolves a package to a directory, and every file in it contributes. The * analysis unit is rooted inside the module and never sees the prefix an import * path is written from, so the match is on path suffixes, longest first. */ export declare function goPackageIndex(files: readonly ParsedFile[]): GoPackageIndex;