UNPKG

snyk-nodejs-lockfile-parser

Version:
24 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseYarnLockV2Project = void 0; const extract_yarnlock_v2_pkgs_1 = require("./extract-yarnlock-v2-pkgs"); const util_1 = require("../util"); const build_depgraph_simple_1 = require("./build-depgraph-simple"); const pkgJson_1 = require("../../aliasesPreprocessors/pkgJson"); const yarn_lock_v2_1 = require("../../aliasesPreprocessors/yarn-lock-v2"); const parseYarnLockV2Project = async (pkgJsonContent, yarnLockContent, options, workspaceArgs) => { const { includeDevDeps, includeOptionalDeps, strictOutOfSync, pruneWithinTopLevelDeps, honorAliases, } = options; const pkgs = honorAliases ? (0, yarn_lock_v2_1.rewriteAliasesInYarnLockV2)(pkgJsonContent, (0, extract_yarnlock_v2_pkgs_1.extractPkgsFromYarnLockV2)(yarnLockContent)) : (0, extract_yarnlock_v2_pkgs_1.extractPkgsFromYarnLockV2)(yarnLockContent); const pkgJson = (0, util_1.parsePkgJson)(honorAliases ? (0, pkgJson_1.rewriteAliasesPkgJson)(pkgJsonContent) : pkgJsonContent); const depgraph = await (0, build_depgraph_simple_1.buildDepGraphYarnLockV2Simple)(pkgs, pkgJson, { includeDevDeps, strictOutOfSync, includeOptionalDeps, pruneWithinTopLevelDeps, }, workspaceArgs); return depgraph; }; exports.parseYarnLockV2Project = parseYarnLockV2Project; //# sourceMappingURL=simple.js.map