/*!
 * Copyright (C) Microsoft Corporation. All rights reserved.
 */
/**
 * Compatibility layer for V1 and V2 codegen projects. The purpose of this class is
 * purely to preserve existing V1 codegen logic as closeley as possible.
 */
export class CodegenV1Project {
    vfs;
    logger;
    constructor(vfs, logger) {
        this.vfs = vfs;
        this.logger = logger;
    }
    async createFile(_identifier, filePath, content) {
        // V1 codegen does not use the identifiers and relies in finding files by their path.
        const dir = this.vfs.dirname(filePath);
        if (!(await this.vfs.exists(dir))) {
            await this.vfs.mkdir(dir, { recursive: true });
        }
        await this.vfs.writeFile(filePath, content);
    }
    async commit() {
        // No-op for V1 as files are written immediately
    }
    join(...paths) {
        return this.vfs.join(...paths);
    }
    directoryExists(path) {
        return this.vfs.exists(path);
    }
    fileExists(path) {
        return this.vfs.exists(path);
    }
    async getSourceFilesInDirectory(path) {
        return (await this.vfs.readdir(path)).filter((file) => file.endsWith('.ts'));
    }
}
//# sourceMappingURL=project.js.map