import { EntryPointInfo } from '../../models'; /** * Supported entry point type enumeration. */ type EntryPointType = 'main' | 'app' | 'server' | 'cli' | 'test'; /** * Entry point discovered from package.json exports/main/bin. */ interface PackageJsonEntrySource { /** Source type identifier */ type: 'package.json'; /** Field name in package.json (exports, main, bin) */ field: string; } /** * Entry point discovered by naming convention. */ interface ConventionEntrySource { /** Source type identifier */ type: 'convention'; /** File pattern that matched */ pattern: string; } /** * Entry point from framework-specific patterns. */ interface FrameworkEntrySource { /** Source type identifier */ type: 'framework'; /** Framework name (Next.js, Angular, etc.) */ framework: string; } /** * Entry point from build tool configuration. */ interface ConfigEntrySource { /** Source type identifier */ type: 'config'; /** Tool name (webpack, vite, etc.) */ tool: string; } /** * Entry point source information. * Describes how an entry point was discovered. */ type EntryPointSource = PackageJsonEntrySource | ConventionEntrySource | FrameworkEntrySource | ConfigEntrySource; /** * Extended entry point info with source. */ interface ExtendedEntryPointInfo extends EntryPointInfo { /** How the entry point was discovered */ source: EntryPointSource; } /** * Options for entry point discovery. */ interface DiscoverEntryPointsOptions { /** Include framework-specific entries (e.g., Next.js pages) */ includeFrameworkEntries?: boolean; /** Maximum depth for file search */ maxDepth?: number; /** Skip cache lookup (force fresh detection) */ skipCache?: boolean; } /** * Common entry point patterns by project type. * Used for convention-based entry point discovery. */ declare const ENTRY_POINT_PATTERNS: { /** Library entry patterns */ readonly library: readonly ["src/index.ts", "src/index.js", "index.ts", "index.js", "lib/index.ts"]; /** Application entry patterns */ readonly application: readonly ["src/main.ts", "src/main.tsx", "main.ts", "src/app.ts", "app.ts"]; /** Server entry patterns */ readonly server: readonly ["src/server.ts", "server.ts", "src/main.ts"]; /** CLI entry patterns */ readonly cli: readonly ["src/cli.ts", "bin/cli.ts", "cli.ts"]; }; /** * Discover entry points in project. * * Analyzes package.json fields (main, module, bin, exports), * convention-based patterns, and framework-specific entries. * * Results are cached for 60 seconds per project path and options * to avoid redundant file system operations on repeated calls. * * @param projectPath - Project directory path * @param options - Discovery options * @returns Array of discovered entry points sorted by confidence * * @example Discovering project entry points * ```typescript * import { discoverEntryPoints } from '@hyperfrontend/project-scope' * * const entryPoints = discoverEntryPoints('./my-app') * for (const entry of entryPoints) { * console.log(`${entry.path} (${entry.type}) - ${entry.confidence}% confidence`) * } * // Output: * // src/index.ts (main) - 100% confidence * // src/cli.ts (cli) - 85% confidence * ``` */ declare function discoverEntryPoints(projectPath: string, options?: DiscoverEntryPointsOptions): EntryPointInfo[]; /** * Clear the entry point discovery cache. * * Useful for testing or when the project files have changed. * * @example Clearing the entry point cache * ```typescript * import { clearEntryPointCache } from '@hyperfrontend/project-scope' * * // Reset cache before re-analyzing after file changes * clearEntryPointCache() * ``` */ declare function clearEntryPointCache(): void; export { ENTRY_POINT_PATTERNS, clearEntryPointCache, discoverEntryPoints }; export type { DiscoverEntryPointsOptions, EntryPointSource, EntryPointType, ExtendedEntryPointInfo };