"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePnpmWorkspaceProject = void 0;
const util_1 = require("../util");
const build_dep_graph_pnpm_1 = require("./build-dep-graph-pnpm");
const index_1 = require("./lockfile-parser/index");
const constants_1 = require("./constants");
const parsePnpmWorkspaceProject = async (pkgJsonContent, pnpmLockfileContents, options, importer, lockfileVersion) => {
    const { includeDevDeps, includePeerDeps, includeOptionalDeps, strictOutOfSync, pruneWithinTopLevelDeps, } = options;
    const lockFileParser = (0, index_1.getPnpmLockfileParser)(pnpmLockfileContents, lockfileVersion);
    const pkgJson = (0, util_1.parsePkgJson)(pkgJsonContent);
    lockFileParser.workspaceArgs = {
        isWorkspace: true,
        projectsVersionMap: {
            [importer]: {
                name: pkgJson.name,
                version: pkgJson.version || constants_1.UNDEFINED_VERSION,
            },
        },
    };
    const depGraph = await (0, build_dep_graph_pnpm_1.buildDepGraphPnpm)(lockFileParser, pkgJson, {
        includeDevDeps,
        includePeerDeps,
        strictOutOfSync,
        includeOptionalDeps,
        pruneWithinTopLevelDeps,
    }, importer);
    return depGraph;
};
exports.parsePnpmWorkspaceProject = parsePnpmWorkspaceProject;
//# sourceMappingURL=parse-workspace-project.js.map