import { Result } from "neverthrow"; //#region packages/common/src/utils/tsconfig.d.ts /** * Parsed tsconfig.json paths configuration. * All paths are resolved to absolute paths. */ type TsconfigPathsConfig = { /** Absolute base URL for path resolution */ readonly baseUrl: string; /** Path mappings with absolute paths */ readonly paths: Readonly>; }; /** * Error types for tsconfig reading. */ type TsconfigReadError = { readonly code: "TSCONFIG_READ_FAILED" | "TSCONFIG_PARSE_FAILED" | "TSCONFIG_INVALID"; readonly message: string; }; /** * Read and parse tsconfig.json to extract paths configuration. * Currently does not support `extends` - reads only the specified file. * * @param tsconfigPath - Absolute path to tsconfig.json * @returns Parsed paths configuration or null if no paths defined */ declare const readTsconfigPaths: (tsconfigPath: string) => Result; //#endregion //#region packages/common/src/utils/alias-resolver.d.ts /** * Alias resolver interface for resolving path aliases to file paths. */ type AliasResolver = { /** * Resolve an alias specifier to an absolute file path. * Returns null if the specifier doesn't match any alias pattern * or if the resolved file doesn't exist. */ readonly resolve: (specifier: string) => string | null; }; /** * Create an alias resolver from tsconfig paths configuration. * * Resolution behavior: * 1. Try each pattern in order (first match wins per TS spec) * 2. For each matched pattern, try all target paths in order * 3. For each target, apply extension resolution * 4. Return first found file, or null if none found */ declare const createAliasResolver: (config: TsconfigPathsConfig) => AliasResolver; //#endregion //#region packages/common/src/utils/cached-fn.d.ts declare const cachedFn: (fn: () => T) => { (): T; clear(): void; }; //#endregion //#region packages/common/src/utils/path.d.ts /** * File extensions to try when resolving module specifiers. * Ordered to match TypeScript's module resolution order. * @see https://www.typescriptlang.org/docs/handbook/module-resolution.html */ declare const MODULE_EXTENSION_CANDIDATES: readonly [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".jsx"]; /** * Result of parsing a JS extension from a specifier. */ type JsExtensionInfo = { /** The specifier without the JS extension */ readonly base: string; /** The JS extension found (e.g., ".js", ".mjs") */ readonly jsExtension: string; /** The corresponding TS extensions to try (e.g., [".ts", ".tsx"] for ".js") */ readonly tsExtensions: readonly string[]; }; /** * Parse a JS extension from a specifier for ESM-style import resolution. * Returns the base path (without extension), the JS extension, and corresponding TS extensions. * * @param specifier - The import specifier to parse * @returns Object with base, jsExtension, and tsExtensions, or null if no JS extension found * * @example * parseJsExtension("./foo.js") // { base: "./foo", jsExtension: ".js", tsExtensions: [".ts", ".tsx"] } * parseJsExtension("./foo.mjs") // { base: "./foo", jsExtension: ".mjs", tsExtensions: [".mts"] } * parseJsExtension("./foo") // null * parseJsExtension("./foo.ts") // null */ declare const parseJsExtension: (specifier: string) => JsExtensionInfo | null; /** * Normalize path to use forward slashes (cross-platform). * Ensures consistent path handling across platforms. */ declare const normalizePath: (value: string) => string; /** * Resolve a relative import specifier to an absolute file path. * Tries the specifier as-is, with extensions, and as a directory with index files. * * @param from - Absolute path to the importing file * @param specifier - Relative module specifier (must start with '.') * @returns Absolute POSIX path to the resolved file, or null if not found */ declare const resolveRelativeImportWithExistenceCheck: ({ filePath, specifier }: { filePath: string; specifier: string; }) => string | null; /** * Resolve a relative import specifier to an absolute file path. * Tries the specifier as-is, with extensions, and as a directory with index files. * * @param from - Absolute path to the importing file * @param specifier - Relative module specifier (must start with '.') * @returns Absolute POSIX path to the resolved file, or null if not found */ declare const resolveRelativeImportWithReferences: <_>({ filePath, specifier, references }: { filePath: string; specifier: string; references: Map | Set; }) => string | null; /** * Check if a module specifier is relative (starts with '.' or '..') */ declare const isRelativeSpecifier: (specifier: string) => boolean; /** * Check if a module specifier is external (package name, not relative) */ declare const isExternalSpecifier: (specifier: string) => boolean; //#endregion export { normalizePath as a, resolveRelativeImportWithReferences as c, createAliasResolver as d, TsconfigPathsConfig as f, isRelativeSpecifier as i, cachedFn as l, readTsconfigPaths as m, MODULE_EXTENSION_CANDIDATES as n, parseJsExtension as o, TsconfigReadError as p, isExternalSpecifier as r, resolveRelativeImportWithExistenceCheck as s, JsExtensionInfo as t, AliasResolver as u }; //# sourceMappingURL=index-DpSxWrZ_.d.cts.map