1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.parsePnpmProject = void 0;
|
4 | const util_1 = require("../util");
|
5 | const build_dep_graph_pnpm_1 = require("./build-dep-graph-pnpm");
|
6 | const index_1 = require("./lockfile-parser/index");
|
7 | const 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 |
|
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 | };
|
31 | exports.parsePnpmProject = parsePnpmProject;
|
32 |
|
\ | No newline at end of file |