UNPKG

2.03 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.parseYarnLockV1WorkspaceProject = void 0;
4const build_depgraph_workspace_package_pruned_1 = require("./build-depgraph-workspace-package-pruned");
5const build_depgraph_workspace_package_1 = require("./build-depgraph-workspace-package");
6const extract_yarnlock_v1_pkgs_1 = require("./extract-yarnlock-v1-pkgs");
7const util_1 = require("../util");
8const c_map_1 = require("../../c-map");
9const parseYarnLockV1WorkspaceProject = async (yarnLockContent, workspacePackagesPkgJsons, options) => {
10 const { includeDevDeps, includeOptionalDeps, pruneCycles, strictOutOfSync } = options;
11 const extractedYarnLockV1Pkgs = (0, extract_yarnlock_v1_pkgs_1.extractPkgsFromYarnLockV1)(yarnLockContent);
12 // Parse all package.json files and also extract names cross referencing later
13 const workspacePkgNameToVersion = {};
14 const parsedWorkspacePkgJsons = workspacePackagesPkgJsons.map((wsPkgJsonContent) => {
15 const parsedPkgJson = (0, util_1.parsePkgJson)(wsPkgJsonContent);
16 workspacePkgNameToVersion[parsedPkgJson.name] = parsedPkgJson.version;
17 return parsedPkgJson;
18 });
19 const depGraphs = (0, c_map_1.cMap)(parsedWorkspacePkgJsons, async (parsedPkgJson) => {
20 return pruneCycles
21 ? await (0, build_depgraph_workspace_package_pruned_1.buildDepGraphYarnLockV1WorkspaceCyclesPruned)(extractedYarnLockV1Pkgs, parsedPkgJson, workspacePkgNameToVersion, {
22 includeDevDeps,
23 strictOutOfSync,
24 includeOptionalDeps,
25 })
26 : await (0, build_depgraph_workspace_package_1.buildDepGraphYarnLockV1Workspace)(extractedYarnLockV1Pkgs, parsedPkgJson, workspacePkgNameToVersion, {
27 includeDevDeps,
28 strictOutOfSync,
29 includeOptionalDeps,
30 });
31 });
32 return depGraphs;
33};
34exports.parseYarnLockV1WorkspaceProject = parseYarnLockV1WorkspaceProject;
35//# sourceMappingURL=workspaces.js.map
\No newline at end of file