"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const readPackageJsonCB = require("read-package-json");
const promisify = require("util.promisify");
const readPackageJson = promisify(readPackageJsonCB);
async function readPkg(pkgPath) {
    try {
        return await readPackageJson(pkgPath);
    }
    catch (err) {
        if (err['code'])
            throw err; // tslint:disable-line
        const pnpmError = new Error(`${pkgPath}: ${err.message}`);
        pnpmError['code'] = 'ERR_PNPM_BAD_PACKAGE_JSON'; // tslint:disable-line
        throw pnpmError;
    }
}
exports.default = readPkg;
function fromDir(pkgPath) {
    return readPkg(path.join(pkgPath, 'package.json'));
}
exports.fromDir = fromDir;
//# sourceMappingURL=index.js.map