"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__tsfTypeAliases = void 0;
exports.getPackageJson = getPackageJson;
exports.resetPackageJsonCache = resetPackageJsonCache;
exports.getPackageVersion = getPackageVersion;
exports.getPackageName = getPackageName;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
let cachedPackageJson;
let hasCachedPackageJson = false;
function getPackageJson() {
    if (hasCachedPackageJson)
        return cachedPackageJson;
    hasCachedPackageJson = true;
    try {
        cachedPackageJson = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8'));
    }
    catch {
        cachedPackageJson = undefined;
    }
    return cachedPackageJson;
}
function resetPackageJsonCache() {
    cachedPackageJson = undefined;
    hasCachedPackageJson = false;
}
function getPackageVersion() {
    return getPackageJson()?.version;
}
function getPackageName() {
    return getPackageJson()?.name;
}
exports.__tsfTypeAliases = JSON.parse("[1,{\"PackageJson\":{\"kind\":18,\"typeName\":\"PackageJson\",\"types\":[{\"kind\":20,\"name\":\"name\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"version\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true}],\"index\":{\"kind\":2}}}]")[1];
//# sourceMappingURL=package.js.map