import { PackageJson } from '../../project/package'; import { DetectionSource } from '..'; /** * Backend framework detection result. */ interface BackendDetection { /** Framework identifier */ id: string; /** Human-readable name */ name: string; /** Detected version */ version?: string; /** Detection confidence (0-100) */ confidence: number; /** Config file path */ configPath?: string; /** Detection sources */ detectedFrom: DetectionSource[]; } /** * Backend detector interface. */ interface BackendDetector { /** Framework identifier */ id: string; /** Human-readable name */ name: string; /** Check if framework is present */ detect(projectPath: string, packageJson?: PackageJson): BackendDetection | null; } /** All backend framework detectors */ declare const backendDetectors: BackendDetector[]; /** * Detect all backend frameworks in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Array of detected frameworks, sorted by confidence * @example Detecting multiple backend frameworks * ```typescript * const pkg = { * dependencies: { '@nestjs/core': '^10.0.0', '@nestjs/common': '^10.0.0' }, * devDependencies: { express: '^4.18.0' }, * } * * const results = detectBackendFrameworks('/path/to/project', pkg) * // => [ * // { id: 'nestjs', name: 'NestJS', confidence: 85, ... }, * // { id: 'express', name: 'Express', confidence: 80, ... }, * // ] * ``` */ declare function detectBackendFrameworks(projectPath: string, packageJson?: PackageJson): BackendDetection[]; /** * Detect Express in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * @example Detecting Express framework * ```typescript * const pkg = { * dependencies: { express: '^4.18.2', cors: '^2.8.5' }, * devDependencies: { '@types/express': '^4.17.17' }, * } * * const result = expressDetector('/path/to/project', pkg) * // => { * // id: 'express', * // name: 'Express', * // version: '4.18.2', * // confidence: 100, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.express' }, * // { type: 'package.json', field: 'dependencies.@types/express' }, * // { type: 'package.json', field: 'dependencies (express middleware)' }, * // ], * // } * ``` */ declare function expressDetector(projectPath: string, packageJson?: PackageJson): BackendDetection | null; /** * Detect Fastify in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * @example Detecting Fastify framework * ```typescript * const pkg = { * dependencies: { fastify: '^4.24.0', '@fastify/cors': '^8.4.0' }, * } * * const result = fastifyDetector('/path/to/project', pkg) * // => { * // id: 'fastify', * // name: 'Fastify', * // version: '4.24.0', * // confidence: 95, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.fastify' }, * // { type: 'package.json', field: 'dependencies (fastify plugins)' }, * // ], * // } * ``` */ declare function fastifyDetector(projectPath: string, packageJson?: PackageJson): BackendDetection | null; /** * Detect Hono in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * @example Detecting Hono framework * ```typescript * const pkg = { * dependencies: { hono: '^3.11.0', '@hono/node-server': '^1.3.0' }, * } * * const result = honoDetector('/path/to/project', pkg) * // => { * // id: 'hono', * // name: 'Hono', * // version: '3.11.0', * // confidence: 100, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.hono' }, * // { type: 'package.json', field: 'dependencies (@hono adapters)' }, * // ], * // } * ``` */ declare function honoDetector(projectPath: string, packageJson?: PackageJson): BackendDetection | null; /** * Detect Koa in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * @example Detecting Koa framework * ```typescript * const pkg = { * dependencies: { koa: '^2.14.2', 'koa-router': '^12.0.0' }, * devDependencies: { '@types/koa': '^2.13.9' }, * } * * const result = koaDetector('/path/to/project', pkg) * // => { * // id: 'koa', * // name: 'Koa', * // version: '2.14.2', * // confidence: 100, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.koa' }, * // { type: 'package.json', field: 'dependencies.@types/koa' }, * // { type: 'package.json', field: 'dependencies (koa middleware)' }, * // ], * // } * ``` */ declare function koaDetector(projectPath: string, packageJson?: PackageJson): BackendDetection | null; /** * Detect NestJS in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * @example Detecting NestJS framework * ```typescript * // Project with nest-cli.json and NestJS packages * const pkg = { * dependencies: { * '@nestjs/core': '^10.2.0', * '@nestjs/common': '^10.2.0', * '@nestjs/platform-express': '^10.2.0', * }, * } * * const result = nestDetector('/path/to/nest-project', pkg) * // => { * // id: 'nestjs', * // name: 'NestJS', * // version: '10.2.0', * // configPath: 'nest-cli.json', // if present * // confidence: 100, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.@nestjs/core' }, * // { type: 'package.json', field: 'dependencies.@nestjs/common' }, * // { type: 'config-file', path: 'nest-cli.json' }, * // { type: 'package.json', field: 'dependencies (@nestjs packages)' }, * // ], * // } * ``` */ declare function nestDetector(projectPath: string, packageJson?: PackageJson): BackendDetection | null; export { backendDetectors, detectBackendFrameworks, expressDetector, fastifyDetector, honoDetector, koaDetector, nestDetector }; export type { BackendDetection, BackendDetector };