@hyperfrontend/project-scope/heuristics/entry-pointsentry-points
Entry-point discovery for application source code, combining package.json declarations with conventional file patterns.
discoverEntryPoints reads main, module, browser, bin, and exports fields from package.json, then layers in convention-based candidates (src/index.ts, src/main.ts, src/server.ts, src/cli.ts, etc.). Each candidate is returned with a confidence score, type classification (main, cli, server, library, worker, ...), and the source that produced it (package-json vs convention). Detection is cached for a short TTL; pass { skipCache: true } for fresh results. The patterns themselves are exposed as ENTRY_POINT_PATTERNS for downstream tools that need to extend the heuristic.
API Reference
ƒ Functions
Useful for testing or when the project files have changed.
Example
Clearing the entry point cache
import { clearEntryPointCache } from '@hyperfrontend/project-scope'
// Reset cache before re-analyzing after file changes
clearEntryPointCache()discoverEntryPoints(projectPath: string, options?: DiscoverEntryPointsOptions): EntryPointInfo[]
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.
Parameters
Returns
EntryPointInfo[]Example
Discovering project entry points
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◈ Interfaces
◆ Types
type EntryPointSource = PackageJsonEntrySource | ConventionEntrySource | FrameworkEntrySource | ConfigEntrySourcetype EntryPointType = "main" | "app" | "server" | "cli" | "test"