import { type JsonParseResult } from "./json-utils.js"; export declare const DEFAULT_EXTENSIONS: string[]; export declare const DEFAULT_IGNORE: string[]; /** * Files and directories conventionally belonging to tests. These patterns are * deliberately extension-agnostic: ignored test directories also exclude * package.json, fixtures, snapshots, and every other file below them. */ export declare const TEST_IGNORE_PATTERNS: string[]; export declare function normalizeCanonicalPath(filePath: string): string; export declare function toPosix(value: string): string; export declare function normalizeAbsolute(value: string): string; export declare function pathInside(parent: string, candidate: string): boolean; /** * Converts a glob pattern to a Regular Expression. * * Improvements: * 1. If a pattern doesn't contain a slash, it's treated as a name match (matches anywhere). * 2. Handles ** correctly for recursive directory matching. * 3. Normalizes trailing slashes to match both files and directories. */ export declare function globToRegExp(pattern: string): RegExp; export declare function compileGlobs(patterns: string[]): RegExp[]; /** * Checks if a path matches any of the compiled glob patterns. * Automatically handles absolute paths by making them relative to root if possible. */ export declare function matchesAnyGlob(filePath: string, compiledPatterns: RegExp[], rootDir?: string): boolean; /** * Unified ignore check used across the codebase. */ export declare function isIgnored(filePath: string, ignorePatterns?: string[], rootDir?: string): boolean; export declare function fileExists(candidate: string): Promise; export declare function directoryExists(candidate: string): Promise; export declare function discoverSourceFiles(rootDir: string, extensions: string[], compiledIgnorePatterns: RegExp[]): Promise; export declare function isLikelyLocalSpecifier(specifier: string): boolean; export declare function removeQueryAndHash(specifier: string): string; /** * Resolves an import specifier against a set of known files. * Handles .js -> .ts / .tsx extension mapping. */ export declare function resolveLocalSpecifier(sourceFilePath: string, rawSpecifier: string, knownFiles: Set | Map, extensions?: string[]): string | undefined; export declare function resolveDynamicPattern(fromFile: string, prefix: string, suffix: string, knownFiles: Set): string[]; /** Configuration files are tool entry points even without source-level imports. */ export declare function isConfigurationFile(filePath: string): boolean; export declare function expandEntryPatterns(sourceFiles: string[], rootDir: string, patterns: string[]): string[]; export declare function discoverPackageBinEntryPatterns(rootDir: string): Promise; export interface PackageScriptTarget { scriptName: string; command: string; /** Analyzer entry path: the built target when present, otherwise its source counterpart. */ relativePath: string; /** Original path written in package.json, preserved for diagnostics. */ requestedPath: string; exists: boolean; } /** * Finds local files executed by `node` in package.json scripts. This deliberately * handles only direct Node invocations such as `node scripts/task.mjs`, including * common Node flags and shell command chains. Arbitrary shell interpretation is * intentionally out of scope: only a concrete local file path is promoted to an * analyzer entry point. */ export declare function discoverPackageScriptTargets(rootDir: string): Promise; export declare function discoverPackageEntryPatterns(rootDir: string): Promise; /** * Returns only source entry patterns exposed by package.json's exports map. * An exports map represents a package's public import surface, unlike legacy * metadata such as main or types which can describe implementation details. */ export declare function discoverPackageExportEntryPatterns(rootDir: string): Promise; export declare function conventionalEntryPatterns(): string[]; export declare function normalizedConventionalEntryPatterns(): string[]; /** * Reads JSON using the structured parser. JSONC syntax and a small set of * unambiguous structural omissions are recovered; malformed values are never * exposed to analysis callers as partially parsed objects. */ export declare function readJsonFileWithDiagnostics(candidate: string): Promise | undefined>; /** Backward-compatible JSON reader for call sites that do not need diagnostics. */ export declare function readJsonFile(candidate: string): Promise; export declare function findNearestConfig(startDirectory: string): Promise; export declare function relativeDisplayPath(rootDir: string, candidate: string): string; export declare function rootLooksValid(rootDir: string): Promise; /** * Load project-local Node.js `package.json#imports` aliases without executing * configuration code. Conditional targets are retained in declaration order; * external/package targets are deliberately excluded because they are not * project modules. */ export declare function ingestPackageImports(rootDir: string): Promise>; /** * Loads compiler path aliases from a solution tsconfig, its `extends` chain, and * its project references. Alias targets are normalized to absolute paths because * a referenced tsconfig can have a different base directory from the root config. */ export declare function ingestTsConfigPaths(rootDir: string, configPath?: string): Promise<{ paths: Map; baseUrl: string | undefined; }>;