import type { SymbolWithLocation } from './utils/types.js'; import type { AnalyserDiagnostic } from './analyser-diagnostic.js'; import type { AnalyserSystem } from './system/analyser-system.js'; import type { AnalyserOptions } from './analyser-options.js'; import type { ReflectedNode } from './reflected-node.js'; import ts from 'typescript'; /** * A class that shares common utilities between all reflected nodes */ export declare class ProjectContext { private readonly _getProgram; private readonly _getCommandLine; private readonly _options; private readonly _diagnostics; private readonly _system; private readonly _reflectedNodesBySymbol; constructor(system: AnalyserSystem, getProgram: () => ts.Program, getCommandLine: () => ts.ParsedCommandLine, diagnostics: AnalyserDiagnostic, options: Partial); /** * A Program is an immutable collection of source files and the compiler options. Together * represent a compilation unit. * * @returns The TypeScript program created with the TypeScript compiler API */ getProgram(): ts.Program; /** * The TypeScript compiler options parsed (if you have a TSConfig file, the parsed * options will be the ones defined there) * * @returns The parsed compiler options */ getCommandLine(): ts.ParsedCommandLine; /** * The TypeScript type checker. * * Useful to resolve the types and location of the reflected nodes. * * @returns The TypeScript type checker */ getTypeChecker(): ts.TypeChecker; /** * An abstraction layer around how we interact with the environment (browser or Node.js) * * @returns The system environment used */ getSystem(): AnalyserSystem; /** * Here we save all the errors we find while analysing the source files * * @returns An instance of the `AnalyserDiagnostic` where all errors are enqueue */ getDiagnostics(): AnalyserDiagnostic; /** * The user provided analyzer options. * * @returns The options that were provided when calling the parser function */ getOptions(): Partial; /** * Creates a new reflected node only if it doesn't exist already in the internal cache. * * @param node - The `ts.Node` associated with the reflected node * @param reflectedNodeFactory - The function to use to build the new reflection if it doesn't exist * @returns The reflected node instance */ registerReflectedNode(node: ts.Node, reflectedNodeFactory: () => T): T; /** * Returns the associated `ts.Symbol` for the given node * * @param node - The `ts.Node` to search its symbol * @returns The symbol if it has one */ getSymbol(node: ts.Node): ts.Symbol | null; /** * Given a node or a type it returns it's associated symbol, line position and the file path where * it was defined. * * @param nodeOrType - The node or type to search for * @returns The symbol, line position and path where the node/type is located */ getLocation(nodeOrType: ts.Node | ts.Type): SymbolWithLocation; /** * Returns the start line number where the node is located * * @param node - The node to locate * @returns The line number where the node is located */ getLinePosition(node: ts.Node): number; private _isNamedNode; } //# sourceMappingURL=project-context.d.ts.map