@omlet/cli
Version:
Omlet (https://omlet.dev) is a component analytics tool that uses a CLI to scan your codebase to detect components and their usage. Get real usage insights from customizable charts to measure adoption across all projects and identify opportunities to impr
85 lines (84 loc) • 3.76 kB
TypeScript
import { type Config, type PackageConfig } from "../config";
import { CliError } from "../error";
import { type Package } from "./package";
import { type PackageJson } from "./packageJson";
import { PathResolutionMap } from "./pathResolutionMap";
import { type TsConfigInfo } from "./tsConfigInfo";
import { type ResolutionConfigIssue } from "./validator";
export declare class NoProjectFound extends CliError {
readonly path: string;
constructor(path: string);
}
export declare class CannotLoadTSConfig extends CliError {
readonly detail: string;
readonly path: string;
constructor(data: {
path: string;
detail: string;
});
}
declare enum MonorepoType {
Yarn = "yarn",
PNPM = "pnpm",
Lerna = "lerna",
Bolt = "bolt",
Nx = "nx"
}
interface WorkspacesResult {
type?: MonorepoType;
workspacePaths: string[];
}
export declare class ProjectSetupResolver {
private readonly absRepoRoot;
readonly userConfig: Config;
readonly rootPackage: Package;
readonly packages: Package[];
private globCache;
private scannedFileIndex;
private constructor();
static create(absRepoRoot: string, rootPackagePath: string, config: Config): Promise<ProjectSetupResolver>;
resolveAbsolutePath(...args: string[]): string;
relativeProjectPath(otherPath: string): string;
get projectRoot(): string;
static readTsConfig(tsconfigPath: string): Promise<TsConfigInfo | undefined>;
static readPackage(packageJsonPath: string, tsConfigPath?: string): Promise<Package>;
static readNxProject(rootPath: string, packagePath: string): Promise<Package>;
static findWorkspaces(root: Package): Promise<WorkspacesResult>;
findPackageByName(name: string): Package | undefined;
findPackageByPath(packagePath: string): Package | undefined;
getPackageConfig(name: string): PackageConfig | undefined;
findGlobMatchesInProject(patterns: string[], globBase?: string): Promise<string[]>;
hasGlobMatchesInProject(patterns: string[], globBase?: string): Promise<boolean>;
isGlobIncluded(patterns: string[]): Promise<boolean>;
readTypescriptAliases(pkg: Package): Promise<PathResolutionMap>;
readImportMap(pkg: Package): Promise<PathResolutionMap>;
getImportMapForPackageEntryPoints(pkg: Package): Promise<PathResolutionMap>;
readRootPackageImportMap(): Promise<PathResolutionMap>;
readPackageAliases(pkg: Package): Promise<PathResolutionMap>;
private readExportMap;
readDependencies(pkg: PackageJson): Set<string>;
private readPackages;
isNpmDependency(packageName: string, sourcePackage: Package): Promise<boolean>;
isYarnDependency(packageName: string, sourcePackage: Package): Promise<boolean>;
isPnpmDependency(packageName: string, sourcePackage: Package): Promise<boolean>;
isValidDependency(packageName: string, sourcePackageName: string): Promise<boolean>;
getProjectSetup(failOnError: boolean): Promise<ProjectSetup>;
}
export declare type PackageData = Omit<Package, "info" | "tsconfig" | "aliases" | "importMap" | "exportMap" | "dependencies"> & {
aliases: Record<string, string[]>;
importMap: Record<string, string[]>;
exportMap: Record<string, string[]>;
};
export interface ProjectSetup {
root: PackageData;
packages: {
[packageName: string]: PackageData;
};
absolutePath: string;
issues?: ResolutionConfigIssue[];
isValidDependency: (packageName: string, sourcePackageName: string) => Promise<boolean>;
}
export declare function getDefaultRoot(): string;
export declare function findParentProject(projectPath: string): Promise<string | null>;
export declare function starPatternToGlob(pattern: string, matchModulePaths?: boolean): string[];
export {};