snyk 1.1241.0 → 1.1243.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221422,7 +221422,12 @@ const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeDevDeps, incl
221422
221422
  }
221423
221423
  let depData = pkgs[childNodeKey];
221424
221424
  const resolvedToWorkspace = () => {
221425
- const workspacesDeclaration = pkgs['']['workspaces'] || [];
221425
+ // Workspaces can be set as an array, or as an object
221426
+ // { packages: [] }, this can be checked in
221427
+ // https://github.com/npm/map-workspaces/blob/ff82968a3dbb78659fb7febfce4841bf58c514de/lib/index.js#L27-L41
221428
+ const workspacesDeclaration = Array.isArray(pkgs['']['workspaces']['packages'])
221429
+ ? pkgs['']['workspaces']['packages']
221430
+ : pkgs['']['workspaces'] || [];
221426
221431
  const resolvedPath = depData.resolved || '';
221427
221432
  const fixedResolvedPath = resolvedPath.replace(/\\/g, '/');
221428
221433
  const normalizedWorkspacesDefn = workspacesDeclaration.map((p) => {
@@ -221479,9 +221484,14 @@ const getChildNodeKey = (name, version, ancestry, pkgs, pkgKeysByName) => {
221479
221484
  // `node_modules/a/node_modules/b` into ["a", "b"]
221480
221485
  // To do this we remove the first node_modules substring
221481
221486
  // and then split on the rest
221482
- const candidateAncestry = candidate
221483
- .replace('node_modules/', '')
221484
- .split('/node_modules/');
221487
+ const candidateAncestry = (candidate.startsWith('node_modules/')
221488
+ ? candidate.replace('node_modules/', '').split('/node_modules/')
221489
+ : candidate.split('/node_modules/')).map((el) => {
221490
+ if (pkgs[el]) {
221491
+ return pkgs[el].name || el;
221492
+ }
221493
+ return el;
221494
+ });
221485
221495
  // Check the ancestry of the candidate is a subset of
221486
221496
  // the current pkg. If it is not then it can't be a
221487
221497
  // valid key.
@@ -221507,13 +221517,13 @@ const getChildNodeKey = (name, version, ancestry, pkgs, pkgKeysByName) => {
221507
221517
  if (filteredCandidates.length === 1) {
221508
221518
  return filteredCandidates[0];
221509
221519
  }
221510
- const ancestry_names = ancestry.map((el) => el.name).concat(name);
221511
- while (ancestry_names.length > 0) {
221512
- const possible_key = `node_modules/${ancestry_names.join('/node_modules/')}`;
221513
- if (pkgs[possible_key]) {
221514
- return possible_key;
221520
+ const ancestryNames = ancestry.map((el) => el.name).concat(name);
221521
+ while (ancestryNames.length > 0) {
221522
+ const possibleKey = `node_modules/${ancestryNames.join('/node_modules/')}`;
221523
+ if (filteredCandidates.includes(possibleKey)) {
221524
+ return possibleKey;
221515
221525
  }
221516
- ancestry_names.shift();
221526
+ ancestryNames.shift();
221517
221527
  }
221518
221528
  // Here we go through th eancestry backwards to find the nearest
221519
221529
  // ancestor package
@@ -231638,6 +231648,9 @@ async function publish(projectPath, targetFramework) {
231638
231648
  // and will potentially also support multiple target frameworks.
231639
231649
  const publishDirLine = response.stdout
231640
231650
  .split(/[\r\n]+/)
231651
+ // Projects that are referring to other local projects in their PackageReference item groups will also be restored
231652
+ // in a chained operation. The project we're interested in will be shown last, thus we reverse it.
231653
+ .reverse()
231641
231654
  // TODO: For multiple target frameworks, replace `find` with a map or something of that kind to return more than the first.
231642
231655
  // The first thing to get published ought to be the project's own .dll or .exe file, depending on the architecture.
231643
231656
  // E.g., something like: