"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageIsInstallable = void 0;
const cli_meta_1 = require("@pnpm/cli-meta");
const logger_1 = require("@pnpm/logger");
const package_is_installable_1 = require("@pnpm/package-is-installable");
function packageIsInstallable(pkgPath, pkg, opts) {
    const pnpmVersion = cli_meta_1.default.name === 'pnpm'
        ? cli_meta_1.default.stableVersion : undefined;
    const err = package_is_installable_1.checkPackage(pkgPath, pkg, { pnpmVersion });
    if (err === null)
        return;
    if ((err instanceof package_is_installable_1.UnsupportedEngineError && err.wanted.pnpm) ||
        opts.engineStrict)
        throw err;
    logger_1.default.warn({
        message: `Unsupported ${err instanceof package_is_installable_1.UnsupportedEngineError ? 'engine' : 'platform'}: wanted: ${JSON.stringify(err.wanted)} (current: ${JSON.stringify(err.current)})`,
        prefix: pkgPath,
    });
}
exports.packageIsInstallable = packageIsInstallable;
//# sourceMappingURL=packageIsInstallable.js.map