import { PackageJson } from '../../project/package'; import { DetectionSource } from '..'; /** * Build tool detection result. */ interface BuildToolDetection { /** Tool identifier */ id: string; /** Human-readable name */ name: string; /** Detected version */ version?: string; /** Config file path */ configPath?: string; /** Detection confidence (0-100) */ confidence: number; /** Detection sources */ detectedFrom: DetectionSource[]; } /** * Build tool detector interface. */ interface BuildToolDetector { /** Tool identifier */ id: string; /** Human-readable name */ name: string; /** Check if tool is present */ detect(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; } /** Config patterns for Babel */ declare const BABEL_CONFIG_PATTERNS: string[]; /** * Detect Babel in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Babel compiler * ```typescript * const result = babelDetector('/path/to/project', { * name: 'my-app', * devDependencies: { '@babel/core': '^7.23.0', '@babel/preset-env': '^7.23.0' } * }) * // => { * // id: 'babel', * // name: 'Babel', * // version: '7.23.0', * // confidence: 60, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.@babel/core' }, * // { type: 'package.json', field: 'dependencies (@babel packages)' } * // ] * // } * ``` */ declare function babelDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** All build tool detectors */ declare const buildToolDetectors: BuildToolDetector[]; /** * Detect all build tools in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Array of detected build tools, sorted by confidence * * @example Detecting multiple build tools * ```typescript * const tools = detectBuildTools('/path/to/project', { * name: 'my-app', * devDependencies: { * 'vite': '^5.0.0', * '@vitejs/plugin-react': '^4.0.0', * '@babel/core': '^7.23.0' * } * }) * // => [ * // { id: 'vite', name: 'Vite', version: '5.0.0', confidence: 70, ... }, * // { id: 'babel', name: 'Babel', version: '7.23.0', confidence: 50, ... } * // ] * ``` */ declare function detectBuildTools(projectPath: string, packageJson?: PackageJson): BuildToolDetection[]; /** * Detect esbuild in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting esbuild bundler * ```typescript * const result = esbuildDetector('/path/to/project', { * name: 'my-lib', * devDependencies: { 'esbuild': '^0.19.0' }, * scripts: { 'build': 'esbuild src/index.ts --bundle --outfile=dist/index.js' } * }) * // => { * // id: 'esbuild', * // name: 'esbuild', * // version: '0.19.0', * // confidence: 80, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.esbuild' }, * // { type: 'package.json', field: 'scripts.build' } * // ] * // } * ``` */ declare function esbuildDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** Config patterns for Parcel */ declare const PARCEL_CONFIG_PATTERNS: string[]; /** * Detect Parcel in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Parcel bundler * ```typescript * const result = parcelDetector('/path/to/project', { * name: 'my-app', * devDependencies: { 'parcel': '^2.10.0' }, * scripts: { 'dev': 'parcel src/index.html', 'build': 'parcel build src/index.html' } * }) * // => { * // id: 'parcel', * // name: 'Parcel', * // version: '2.10.0', * // confidence: 80, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.parcel' }, * // { type: 'package.json', field: 'scripts.dev' }, * // { type: 'package.json', field: 'scripts.build' } * // ] * // } * ``` */ declare function parcelDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** Config patterns for Rollup */ declare const ROLLUP_CONFIG_PATTERNS: string[]; /** * Detect Rollup in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Rollup bundler * ```typescript * const result = rollupDetector('/path/to/project', { * name: 'my-lib', * devDependencies: { * 'rollup': '^4.0.0', * '@rollup/plugin-node-resolve': '^15.0.0', * '@rollup/plugin-commonjs': '^25.0.0' * } * }) * // => { * // id: 'rollup', * // name: 'Rollup', * // version: '4.0.0', * // confidence: 65, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.rollup' }, * // { type: 'package.json', field: 'dependencies (rollup plugins)' } * // ] * // } * ``` */ declare function rollupDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** Config patterns for SWC */ declare const SWC_CONFIG_PATTERNS: string[]; /** * Detect SWC in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting SWC compiler * ```typescript * const result = swcDetector('/path/to/project', { * name: 'my-app', * devDependencies: { '@swc/core': '^1.3.0', '@swc/cli': '^0.1.0' } * }) * // => { * // id: 'swc', * // name: 'SWC', * // version: '1.3.0', * // confidence: 70, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.@swc/core' }, * // { type: 'package.json', field: 'dependencies.@swc/cli' } * // ] * // } * ``` */ declare function swcDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** Config patterns for Vite */ declare const VITE_CONFIG_PATTERNS: string[]; /** * Detect Vite in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Vite build tool * ```typescript * const result = viteDetector('/path/to/project', { * name: 'my-app', * devDependencies: { * 'vite': '^5.0.0', * '@vitejs/plugin-react': '^4.0.0', * 'vitest': '^1.0.0' * } * }) * // => { * // id: 'vite', * // name: 'Vite', * // version: '5.0.0', * // confidence: 80, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.vite' }, * // { type: 'package.json', field: 'dependencies.vitest' }, * // { type: 'package.json', field: 'dependencies (vite plugins)' } * // ] * // } * ``` */ declare function viteDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; /** Config patterns for Webpack */ declare const WEBPACK_CONFIG_PATTERNS: string[]; /** * Detect Webpack in project. * * @param projectPath - Project directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Webpack bundler * ```typescript * const result = webpackDetector('/path/to/project', { * name: 'my-app', * devDependencies: { 'webpack': '^5.89.0', 'webpack-cli': '^5.1.0' }, * scripts: { 'build': 'webpack --mode production' } * }) * // => { * // id: 'webpack', * // name: 'Webpack', * // version: '5.89.0', * // confidence: 65, * // detectedFrom: [ * // { type: 'package.json', field: 'dependencies.webpack' }, * // { type: 'package.json', field: 'dependencies.webpack-cli' }, * // { type: 'package.json', field: 'scripts.build' } * // ] * // } * ``` */ declare function webpackDetector(projectPath: string, packageJson?: PackageJson): BuildToolDetection | null; export { BABEL_CONFIG_PATTERNS, PARCEL_CONFIG_PATTERNS, ROLLUP_CONFIG_PATTERNS, SWC_CONFIG_PATTERNS, VITE_CONFIG_PATTERNS, WEBPACK_CONFIG_PATTERNS, babelDetector, buildToolDetectors, detectBuildTools, esbuildDetector, parcelDetector, rollupDetector, swcDetector, viteDetector, webpackDetector }; export type { BuildToolDetection, BuildToolDetector };