import type { TSESTree } from '@typescript-eslint/utils'; export type LayerType = 'api' | 'client-application-configs' | 'client-application-services' | 'client-application-usecases' | 'client-application-utils' | 'client-application' | 'client-domain' | 'client-shared' | 'client-ui' | 'server-configs' | 'server-controllers' | 'server-domain' | 'server-errors' | 'server-middleware' | 'server-services' | 'server-utils' | 'unknown'; /** * Converts Windows-style backslashes to POSIX forward slashes in a path string. It ensures the returned path is * consistent for later normalization routines. It does not attempt to resolve or validate the path contents. * * @param value The path string that may contain backslashes. * @returns The path string with backslashes replaced by forward slashes. * * @remarks This is a simple string transformation helper. * * @example * ```tsx * const posixPath = toPosix('C:\\temp\\file.txt'); * ``` */ export declare const toPosix: (value: string) => string; /** * Removes a Windows drive letter prefix from a path string. It is useful when normalizing paths across platforms. * It leaves non-drive paths unchanged. * * @param value The path string that may include a drive letter. * @returns The path string without a drive letter prefix. * * @remarks This keeps the remaining path intact. * * @example * ```tsx * const pathWithoutDrive = stripDrive('C:/temp/file.txt'); * ``` */ export declare const stripDrive: (value: string) => string; /** * Normalizes a path to POSIX format and strips drive letters for consistency. * It also handles virtual path segments produced by certain tooling. It returns a stable, comparable path * string for layer detection. * * @param value The path string to normalize. * @returns The normalized path without drive letters and virtual prefixes. * * @remarks This function is intended for cross-platform path comparisons. * * @example * ```tsx * const normalized = normalizePath('C:\\proj\\__virtual__\\src\\index.ts'); * ``` */ export declare const normalizePath: (value: string) => string; /** * Ensures a path string ends with a trailing slash. It is used to simplify prefix comparisons. * It does not modify already-suffixed paths. * * @param value The path string that may need a trailing slash. * @returns The path string guaranteed to end with a trailing slash. * * @remarks This is a pure helper without side effects. * * @example * ```tsx * const withSlash = ensureTrailingSlash('/src/client'); * ``` */ export declare const ensureTrailingSlash: (value: string) => string; /** * Builds a map of alias strings to normalized target paths. It skips invalid entries and ensures stored paths end * with a trailing slash. It returns a Map that can be used for import resolution. * * @param aliases The alias tuples to include in the map. * @returns A map of alias keys to normalized, trailing-slashed paths. * * @remarks Invalid alias pairs are ignored. * * @example * ```tsx * const aliasMap = buildAliasMap([['@app', './src']]); * ``` */ export declare const buildAliasMap: (aliases: ([string, string])[]) => Map; /** * Reads alias mappings from the ESLint settings object. It safely navigates optional resolver settings and returns a * normalized list of alias tuples. It always returns an array, even when settings are missing. * * @param settings The ESLint settings object that may include import resolver configuration. * @returns The alias tuple list extracted from the resolver settings or an empty array. * * @remarks This helper only inspects the alias resolver configuration. * * @example * ```tsx * const aliases = readAliasesFromSettings({ 'import/resolver': { alias: { map: [['@app', './src']] } } }); * ``` */ export declare const readAliasesFromSettings: (settings: Record | undefined) => ([string, string])[]; /** * Resolves an import source using a prebuilt alias map. It checks for exact alias matches as well as alias-prefixed * paths. It returns the resolved path string or null when no alias applies. * * @param source The import source string to resolve. * @param aliasMap The map of alias keys to normalized target paths. * @returns The resolved path string if an alias matches, or null when no match is found. * * @remarks The alias map is expected to store trailing-slashed paths. * * @example * ```tsx * const resolved = resolveAliasImport('@app/utils', new Map([['@app', '/src/']])); * ``` */ export declare const resolveAliasImport: (source: string, aliasMap: Map) => string | null; /** * Resolves a relative import to an absolute, normalized path. It only handles sources that start with a dot and * returns null for non-relative sources. It normalizes the file and joined path for consistent comparisons. * * @param source The import source string to resolve. * @param filename The file path that contains the import statement. * @returns The normalized resolved path or null when the source is not relative. * * @remarks This helper uses POSIX joins to keep results stable across platforms. * * @example * ```tsx * const resolved = resolveRelativeImport('./utils', '/src/client/index.ts'); * ``` */ export declare const resolveRelativeImport: (source: string, filename: string) => string | null; /** * Determines the logical layer for a resolved file path based on known hexagonal folder patterns. It normalizes the * input path and performs ordered checks to match specific client, server, or API directories. It returns a stable * layer identifier so callers can apply dependency direction rules consistently. * * @param resolvedPath The resolved file path to analyze. * @returns The detected layer identifier or `unknown` when no match is found. * * @remarks The checks are order-dependent, so more specific paths are evaluated first. * * @example * ```tsx * const layer = getLayer('/src/server/services/user.ts'); * ``` */ export declare const getLayer: (resolvedPath: string) => LayerType; /** * Determines whether a layer identifier represents any client-facing layer. It relies on the `client-` prefix * convention used across the layer taxonomy. It returns a boolean that can be used to branch dependency rules. * * @param layer The layer identifier to evaluate. * @returns True when the layer starts with the client prefix; otherwise false. * * @remarks This helper performs a simple prefix check. * * @example * ```tsx * const isClient = isClientLayer('client-ui'); * ``` */ export declare const isClientLayer: (layer: LayerType) => boolean; /** * Determines whether a layer identifier represents any server-facing layer. It relies on the `server-` prefix * convention used across the layer taxonomy. It returns a boolean that can be used to branch dependency rules. * * @param layer The layer identifier to evaluate. * @returns True when the layer starts with the server prefix; otherwise false. * * @remarks This helper performs a simple prefix check. * * @example * ```tsx * const isServer = isServerLayer('server-services'); * ``` */ export declare const isServerLayer: (layer: LayerType) => boolean; /** * Determines whether a layer identifier represents a domain layer on either client or server. It checks for the * exact domain layer names defined in the layer taxonomy. It returns a boolean that can be used to enforce * domain-centric dependency rules. * * @param layer The layer identifier to evaluate. * @returns True when the layer is a client or server domain layer; otherwise false. * * @remarks This helper uses exact equality checks. * * @example * ```tsx * const isDomain = isDomainLayer('server-domain'); * ``` */ export declare const isDomainLayer: (layer: LayerType) => layer is "client-domain" | "server-domain"; /** * Determines whether a layer identifier represents the client application utilities layer. It compares the input * to the exact client utilities layer name. It returns a boolean suitable for applying utility-specific rules. * * @param layer The layer identifier to evaluate. * @returns True when the layer is the client application utilities layer; otherwise false. * * @remarks This helper uses an exact match. * * @example * ```tsx * const isUtils = isClientUtils('client-application-utils'); * ``` */ export declare const isClientUtils: (layer: LayerType) => layer is "client-application-utils"; /** * Determines whether a layer identifier represents the server utilities layer. It compares the input to the exact * server utilities layer name. It returns a boolean suitable for applying utility-specific rules. * * @param layer The layer identifier to evaluate. * @returns True when the layer is the server utilities layer; otherwise false. * * @remarks This helper uses an exact match. * * @example * ```tsx * const isUtils = isServerUtils('server-utils'); * ``` */ export declare const isServerUtils: (layer: LayerType) => layer is "server-utils"; /** * Determines whether a layer identifier represents a configuration layer. It checks for both client application * configs and server configs as defined by the layer taxonomy. It returns a boolean useful for config-specific * dependency direction checks. * * @param layer The layer identifier to evaluate. * @returns True when the layer is a client application configs or server configs layer; otherwise false. * * @remarks This helper uses exact equality checks. * * @example * ```tsx * const isConfig = isConfigLayer('server-configs'); * ``` */ export declare const isConfigLayer: (layer: LayerType) => layer is "client-application-configs" | "server-configs"; /** * Determines whether a program uses MobX makeAutoObservable in imports and call sites. It scans for the MobX import * specifier and then traverses the AST to detect usages of the identifier. It returns true only when both the import * and at least one invocation exist in the same program. * * @param program The TypeScript ESTree program to analyze. * @returns True when makeAutoObservable is imported from MobX and invoked in the program. * * @remarks This helper performs a shallow import scan and a full AST traversal. * * @example * ```tsx * const usesMobx = isMobxStoreFile(program); * ``` */ export declare const isMobxStoreFile: (program: TSESTree.Program) => boolean;