Files and imports
CodeFileBase
The base every language's code file extends - a FileBase that holds definitions, imports, and re-exports. (JsonFile, with none of these, extends FileBase directly.)
Its definitions are its index, the root Index every generator reaches; the file only passes writes and reads on to it. Imports and re-exports, and their merge policy, are the language subclass's. The engine speaks only these four neutral operations - three writers driven by register, plus findDefinitions, the read seam the cross-generator cache and file inspection use. The cache resolves a single primary by name via findDefinitions({ name })?.[0].
Signature
import { CodeFileBase } from '@skmtc/core'
abstract class CodeFileBase extends FileBaseProperties
The file's content: the root Index of its definitions. Most languages use core's FileIndex; a language with rules of its own at the file level (one document per Markdown file) gives its own Index.
Methods
addDefinition
addDefinition(definition: DefinitionBase): voidAdd a definition to the file's Index. Called by the engine's register.
addImports
addImports(imports: ImportBase[]): voidMerge imports in, applying the language's collapse rule (typically keyed by ImportBase.mergeKey and combined via ImportBase.merge). Called by the engine's register.
addReExports
addReExports(reExports: ReExportBase[]): voidMerge re-exports in, applying the language's collapse rule. Called by the engine's register; a language without re-exports never receives any.
findDefinitions
findDefinitions(query?: FindDefinitionsQuery): DefinitionBase[] | undefinedQuery the file's definitions. With no name/type → every definition (an array; the neutral "list all" used to inspect a file, e.g. assert the peer-dedup invariant). With name and/or type → the matching subset, or undefined when nothing matches. type is the declaration type as the opaque string.