"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryReadProjectManifest = exports.readProjectManifestOnly = exports.readProjectManifest = void 0;
const read_project_manifest_1 = require("@pnpm/read-project-manifest"), utils = read_project_manifest_1;
const packageIsInstallable_1 = require("./packageIsInstallable");
async function readProjectManifest(projectDir, opts) {
    const { fileName, manifest, writeProjectManifest } = await read_project_manifest_1.default(projectDir);
    packageIsInstallable_1.packageIsInstallable(projectDir, manifest, opts); // tslint:disable-line:no-any
    return { fileName, manifest, writeProjectManifest };
}
exports.readProjectManifest = readProjectManifest;
async function readProjectManifestOnly(projectDir, opts) {
    const manifest = await utils.readProjectManifestOnly(projectDir);
    packageIsInstallable_1.packageIsInstallable(projectDir, manifest, opts); // tslint:disable-line:no-any
    return manifest;
}
exports.readProjectManifestOnly = readProjectManifestOnly;
async function tryReadProjectManifest(projectDir, opts) {
    const { fileName, manifest, writeProjectManifest } = await utils.tryReadProjectManifest(projectDir);
    if (!manifest)
        return { fileName, manifest, writeProjectManifest };
    packageIsInstallable_1.packageIsInstallable(projectDir, manifest, opts); // tslint:disable-line:no-any
    return { fileName, manifest, writeProjectManifest };
}
exports.tryReadProjectManifest = tryReadProjectManifest;
//# sourceMappingURL=readProjectManifest.js.map