// engine/detectors/advanced-framework-detector/micro-frontend-detector.ts
// Detects micro-frontend strategies: Module Federation, single-spa, Nx MFE.
import { join } from 'node:path';
import { readFileContent } from './helpers.js';
export async function detectMicroFrontend(projectPath, deps) {
    const webpackConfig = await readFileContent(join(projectPath, 'webpack.config.js'));
    const webpackConfigTs = await readFileContent(join(projectPath, 'webpack.config.ts'));
    const combinedWebpack = webpackConfig + webpackConfigTs;
    if (combinedWebpack.includes('ModuleFederationPlugin') ||
        deps.has('@module-federation/vite') ||
        deps.has('@module-federation/webpack-bundler-runtime')) {
        return 'module-federation';
    }
    if (deps.has('single-spa')) {
        return 'single-spa';
    }
    const projectJson = await readFileContent(join(projectPath, 'project.json'));
    if (projectJson.includes('@nx/angular:module-federation') ||
        projectJson.includes('@nx/react:module-federation') ||
        projectJson.includes('@nx/webpack:module-federation-dev-server')) {
        return 'nx-mfe';
    }
    return null;
}
//# sourceMappingURL=micro-frontend-detector.js.map