import { BaseEngine } from "./BaseEngine.js";
import { createLazyLogger } from "../runtime/lazy-logger.js";
const logger = createLazyLogger("sd:cli:engine:tsc");
/**
 * tsc 기반 라이브러리 패키지(node/browser/neutral)용 빌드 엔진
 *
 * tsc를 사용하여 JS + DTS를 emit하는 library-build.worker를
 * 하나의 Worker 스레드에서 래핑한다.
 */
export class TscEngine extends BaseEngine {
    constructor(options) {
        super(options);
    }
    _getWorkerPath() {
        return import.meta.resolve("../workers/library-build.worker");
    }
    _getTarget() {
        return this._pkg.config.target;
    }
    async _callBuild(output) {
        logger.debug(`[${this._pkg.name}] worker.build 호출`);
        const result = await this._worker.build({
            name: this._pkg.name,
            cwd: this._cwd,
            pkgDir: this._pkg.dir,
            output,
        });
        return this._normalizeResult(result);
    }
    async _callStartWatch(output) {
        logger.debug(`[${this._pkg.name}] worker.startWatch 호출`);
        await this._worker.startWatch({
            name: this._pkg.name,
            cwd: this._cwd,
            pkgDir: this._pkg.dir,
            output,
            replaceDeps: this._replaceDeps,
        });
    }
}
//# sourceMappingURL=TscEngine.js.map