UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.parsePnpmProject = void 0;
4const util_1 = require("../util");
5const build_dep_graph_pnpm_1 = require("./build-dep-graph-pnpm");
6const index_1 = require("./lockfile-parser/index");
7const parsePnpmProject = async (pkgJsonContent, pnpmLockContent, options, lockfileVersion) => {
8 const { includeDevDeps, includePeerDeps, includeOptionalDeps, strictOutOfSync, pruneWithinTopLevelDeps, } = options;
9 let importer = '';
10 const pkgJson = (0, util_1.parsePkgJson)(pkgJsonContent);
11 const lockFileParser = (0, index_1.getPnpmLockfileParser)(pnpmLockContent, lockfileVersion);
12 // Lockfile V9 simple project has the root importer
13 if (lockFileParser.lockFileVersion.startsWith('9')) {
14 importer = '.';
15 lockFileParser.workspaceArgs = {
16 projectsVersionMap: {
17 '.': { name: pkgJson.name, version: pkgJson.version },
18 },
19 isWorkspace: true,
20 };
21 }
22 const depgraph = await (0, build_dep_graph_pnpm_1.buildDepGraphPnpm)(lockFileParser, pkgJson, {
23 includeDevDeps,
24 strictOutOfSync,
25 includePeerDeps,
26 includeOptionalDeps,
27 pruneWithinTopLevelDeps,
28 }, importer);
29 return depgraph;
30};
31exports.parsePnpmProject = parsePnpmProject;
32//# sourceMappingURL=parse-project.js.map
\No newline at end of file