import { createRequire } from 'module';
import { getCurrentParsingFile, logCore, wrapMinimal } from '../utils.js';
const localRequire = createRequire(import.meta.url);
export function parseComTypeScript(codigo, tsx = false) {
    try {
        const ts = localRequire('typescript');
        const sf = ts.createSourceFile(tsx ? 'file.tsx' : 'file.ts', codigo, ts.ScriptTarget.Latest, false, tsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
        return wrapMinimal(tsx ? 'tsx-tsc' : 'ts-tsc', {
            kind: sf.kind,
            statements: sf.statements?.length ?? 0
        });
    }
    catch (erro) {
        logCore.erroTs(erro.message, getCurrentParsingFile());
        return null;
    }
}
//# sourceMappingURL=typescript.js.map