import { type SkottCache } from "./cache/index.js"; import { FileReader } from "./filesystem/file-reader.js"; import type { FileWriter } from "./filesystem/file-writer.js"; import { GraphApi } from "./graph/api.js"; import type { SkottNode } from "./graph/node.js"; import { Logger } from "./logger.js"; import { type DependencyResolver } from "./modules/resolvers/base-resolver.js"; import { ModuleWalkerSelector } from "./modules/walkers/common.js"; import { type TSConfig } from "./modules/walkers/ecmascript/typescript/path-alias.js"; import { type ManifestDependenciesByName } from "./workspace/index.js"; export interface SkottConfig { entrypoint?: string; circularMaxDepth: number; dependencyResolvers: DependencyResolver[]; dependencyTracking: { thirdParty: boolean; builtin: boolean; typeOnly: boolean; }; fileExtensions: string[]; includeBaseDir: boolean; incremental: boolean; manifestPath: string; tsConfigPath: string; /** * * If this function is provided, Skott will build a separate graph of links between entire groups of modules. * This is useful if you would rather see links between large architectural blocks than between specific modules within those blocks. * * @param path - The path of the module, e.g. `rootDir/src/feature-a/index.js` * @returns - The group name, e.g. `Feature A` OR `undefined` if the module should not be included in any group. * * @example * ``` * const instance = await skott({ * groupBy: (path) => { * * if (path.includes("core")) return "core"; * if (path.includes("feature-a")) return "feature-a"; * * // ... other conditions * * // if no match * return undefined; * } * }) * * const {groupedGraph} = instance.getStructure(); * * groupedGraph["core"] * // { id: "core", adjacentTo, body: { size, files, ... } } * * groupedGraph["feature-a"] * // { id: "feature-a", adjacentTo, body: { size, files, ... } } * * ``` */ groupBy?: (path: string) => string | undefined; } export interface SkottStructure { graph: Record>; /** * If `groupBy` is provided in the configuration, this will be available as a graph of links between groups of modules. */ groupedGraph?: Record>; files: string[]; } export interface UnusedDependencies { thirdParty: string[]; } export interface ImplicitUnusedDependenciesOptions { implicitDependencies: { findUnused: (cwd: string) => Promise; }; } export interface SkottInstance { useGraph: () => GraphApi; getStructure: () => SkottStructure; getWorkspace: () => ManifestDependenciesByName; findUnusedDependencies: (options?: ImplicitUnusedDependenciesOptions) => Promise; } export declare const defaultConfig: SkottConfig; export interface WorkspaceConfiguration { typescript: TSConfig; pathAliases: Map; manifests: ManifestDependenciesByName; } export declare class Skott { #private; private readonly config; private readonly fileReader; private readonly fileWriter; private readonly walkerSelector; private readonly logger; constructor(config: SkottConfig, fileReader: FileReader, fileWriter: FileWriter, walkerSelector: ModuleWalkerSelector, logger: Logger); getStructureCache(): SkottCache; private resolveNodePath; private addNode; private linkNodes; private findModuleDeclarations; private followModuleDeclaration; private collectModuleDeclarations; private findThirdPartyDependenciesFromGraph; private findUnusedDependencies; private getValidGroup; private addNodeToGroupedGraph; private buildGroupedGraph; private makeProjectStructure; private buildFromEntrypoint; private buildFromRootDirectory; private extractRootManifestInformation; initialize(): Promise>; }