Socket
Socket
Sign inDemoInstall

@ms-cloudpack/package-utilities

Package Overview
Dependencies
Maintainers
0
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/package-utilities - npm Package Compare versions

Comparing version 7.8.7 to 8.0.0

1

lib/createResolveMap/dedupeLinkedPackages.d.ts

@@ -10,2 +10,3 @@ import type { PackageMap } from '../types/PackageMap.js';

allDuplicates: Set<string>;
remotePath?: string;
rootPath?: string;

@@ -12,0 +13,0 @@ }, context: {

@@ -1,2 +0,2 @@

import { satisfies, compare as semverCompare } from 'semver';
import { satisfies, rcompare as semverReverseCompare } from 'semver';
import { parseRequiredBy } from './parseRequiredBy.js';

@@ -10,3 +10,3 @@ import { detachEntry } from './detachEntry.js';

export async function dedupeLinkedPackages(options, context) {
const { rootPath, appMap, allDuplicates } = options;
const { rootPath, appMap, allDuplicates, remotePath } = options;
const { packages } = context;

@@ -41,5 +41,7 @@ console.debug(`The following packages were duplicated by linking:\n ${Array.from(allDuplicates).join(', ')}`);

}
// Find the versions that satisfy the semver requirements of all the requiredBy entries.
// Sort the versions in descending order.
const satisfiedVersions = availableVersions
.filter((v) => [...versionRequirements].every((range) => satisfies(v, range)))
.sort(semverCompare);
.sort(semverReverseCompare);
let satisfiedVersion;

@@ -61,6 +63,20 @@ if (dedupeStrategy === 'force-host-version') {

}
else if (dedupeStrategy === 'force-remote-version') {
if (!remotePath) {
console.error('Root path for project not found and is required when using the "force-remote-version" dedupe strategy.');
continue;
}
// Use the version of the package that is the remote.
// Find the version of the package that does not belong to the host.
// We assume that the remote has a single version of the package.
const remoteVersion = availableVersions.find((v) => slash(entries[v].path).startsWith(slash(remotePath)));
if (!remoteVersion) {
console.error(`Could not find a version of "${packageName}" that is belongs to the remote.`);
continue;
}
satisfiedVersion = remoteVersion;
}
else if (dedupeStrategy === 'allow-duplication' && satisfiedVersions.length > 0) {
// Select the highest version that satisfies the semver requirements of all the requiredBy entries.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
satisfiedVersion = satisfiedVersions.pop();
satisfiedVersion = satisfiedVersions[0];
console.debug(`Version "${satisfiedVersion}" of "${packageName}" satisfies the semver requirements of all the requiredBy entries.`);

@@ -67,0 +83,0 @@ }

2

lib/createResolveMap/linkPath.js

@@ -85,3 +85,3 @@ import { addLinkedEntryDependencies } from './addLinkedEntryDependencies.js';

if (linkedPath.resolveStrategy !== 'duplicate') {
await dedupeLinkedPackages({ appMap, allDuplicates: new Set(allDuplicates), rootPath }, context);
await dedupeLinkedPackages({ appMap, allDuplicates: new Set(allDuplicates), rootPath, remotePath: linkedPath.path }, context);
}

@@ -88,0 +88,0 @@ }

@@ -14,3 +14,6 @@ import type { ResolveMap } from './types/ResolveMap.js';

packages: PackageDefinitionsCache;
}): Promise<string | undefined>;
}): Promise<{
dependencyPath?: string;
updatedResolution: boolean;
}>;
//# sourceMappingURL=ensureResolveMapEntry.d.ts.map

@@ -17,3 +17,3 @@ import { findProjectRoot } from './findProjectRoot.js';

if (!parentEntry) {
return undefined;
return { updatedResolution: false };
}

@@ -25,3 +25,3 @@ const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });

if (dependencyPath && dependencyDefinition && resolveEntry?.requiredBy[`${definition.name}@${definition.version}`]) {
return dependencyPath;
return { dependencyPath, updatedResolution: false };
}

@@ -39,3 +39,3 @@ const rootPath = findProjectRoot(appPath, { noPackageRoot: true });

if (!dependencyPath || !dependencyDefinition || !version) {
return undefined;
return { updatedResolution: false };
}

@@ -50,3 +50,4 @@ // Check if the dependency is already in the resolve map.

dependencyEntry.requiredBy[`${definition.name}@${definition.version}`] = version;
return dependencyPath;
// If the dependency is scoped, we have changed the resolution.
return { dependencyPath, updatedResolution: dependencyEntry.version !== resolveMap[dependencyName].version };
}

@@ -75,4 +76,4 @@ // If it is missing from the resolve map, add it.

}
return dependencyPath;
return { dependencyPath, updatedResolution: true };
}
//# sourceMappingURL=ensureResolveMapEntry.js.map
{
"name": "@ms-cloudpack/package-utilities",
"version": "7.8.7",
"version": "8.0.0",
"description": "Utilities for resolving/parsing packages and their imports.",

@@ -17,7 +17,7 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/common-types": "^0.13.1",
"@ms-cloudpack/json-utilities": "^0.1.4",
"@ms-cloudpack/package-overrides": "^0.9.12",
"@ms-cloudpack/common-types": "^0.13.2",
"@ms-cloudpack/json-utilities": "^0.1.5",
"@ms-cloudpack/package-overrides": "^0.9.13",
"@ms-cloudpack/path-string-parsing": "^1.2.3",
"@ms-cloudpack/path-utilities": "^2.7.27",
"@ms-cloudpack/path-utilities": "^2.7.28",
"@ms-cloudpack/task-reporter": "^0.14.3",

@@ -24,0 +24,0 @@ "acorn": "^8.11.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc