@yarnpkg/core
Advanced tools
Comparing version 2.0.0-rc.11 to 2.0.0-rc.12
/// <reference types="node" /> | ||
import { Readable, Transform } from 'stream'; | ||
export declare function getSetWithDefault<K, T>(map: Map<K, Set<T>>, key: K): Set<T>; | ||
export declare function getMapWithDefault<K, MK, MV>(map: Map<K, Map<MK, MV>>, key: K): Map<MK, MV>; | ||
export declare function releaseAfterUseAsync<T>(fn: () => Promise<T>, cleanup?: () => any): Promise<T>; | ||
@@ -4,0 +6,0 @@ export declare function prettifyAsyncErrors<T>(fn: () => Promise<T>, update: (message: string) => string): Promise<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const stream_1 = require("stream"); | ||
function getSetWithDefault(map, key) { | ||
let value = map.get(key); | ||
if (typeof value === `undefined`) | ||
map.set(key, value = new Set()); | ||
return value; | ||
} | ||
exports.getSetWithDefault = getSetWithDefault; | ||
function getMapWithDefault(map, key) { | ||
let value = map.get(key); | ||
if (typeof value === `undefined`) | ||
map.set(key, value = new Map()); | ||
return value; | ||
} | ||
exports.getMapWithDefault = getMapWithDefault; | ||
// Executes a chunk of code and calls a cleanup function once it returns (even | ||
@@ -5,0 +19,0 @@ // if it throws an exception) |
@@ -37,5 +37,14 @@ import { PortablePath } from '@yarnpkg/fslib'; | ||
}): Descriptor; | ||
export declare function bindLocator(locator: Locator, params: { | ||
[key: string]: string; | ||
}): Locator; | ||
export declare function areIdentsEqual(a: Ident, b: Ident): boolean; | ||
export declare function areDescriptorsEqual(a: Descriptor, b: Descriptor): boolean; | ||
export declare function areLocatorsEqual(a: Locator, b: Locator): boolean; | ||
/** | ||
* Virtual packages are considered equivalent when they belong to the same | ||
* package identity and have the same dependencies. Note that equivalence | ||
* is not the same as equality, as the references may be different. | ||
*/ | ||
export declare function areVirtualPackagesEquivalent(a: Package, b: Package): boolean; | ||
export declare function parseIdent(string: string): Ident; | ||
@@ -57,2 +66,9 @@ export declare function tryParseIdent(string: string): Ident | null; | ||
}): string; | ||
/** | ||
* The range used internally may differ from the range stored in the | ||
* Manifest (package.json). This removes any params indicated for internal use. | ||
* An internal param starts with "__". | ||
* @param range range to convert | ||
*/ | ||
export declare function convertToManifestRange(range: string): string; | ||
export declare function requirableIdent(ident: Ident): string; | ||
@@ -59,0 +75,0 @@ export declare function stringifyIdent(ident: Ident): string; |
@@ -16,2 +16,3 @@ "use strict"; | ||
const semver_1 = __importDefault(require("semver")); | ||
const url_1 = require("url"); | ||
const hashUtils = __importStar(require("./hashUtils")); | ||
@@ -91,2 +92,8 @@ const miscUtils = __importStar(require("./miscUtils")); | ||
exports.bindDescriptor = bindDescriptor; | ||
function bindLocator(locator, params) { | ||
if (locator.reference.includes(`?`)) | ||
return locator; | ||
return makeLocator(locator, `${locator.reference}?${querystring_1.default.stringify(params)}`); | ||
} | ||
exports.bindLocator = bindLocator; | ||
function areIdentsEqual(a, b) { | ||
@@ -104,2 +111,27 @@ return a.identHash === b.identHash; | ||
exports.areLocatorsEqual = areLocatorsEqual; | ||
/** | ||
* Virtual packages are considered equivalent when they belong to the same | ||
* package identity and have the same dependencies. Note that equivalence | ||
* is not the same as equality, as the references may be different. | ||
*/ | ||
function areVirtualPackagesEquivalent(a, b) { | ||
if (!isVirtualLocator(a)) | ||
throw new Error(`Invalid package type`); | ||
if (!isVirtualLocator(b)) | ||
throw new Error(`Invalid package type`); | ||
if (!areIdentsEqual(a, b)) | ||
return false; | ||
if (a.dependencies.size !== b.dependencies.size) | ||
return false; | ||
for (const dependencyDescriptorA of a.dependencies.values()) { | ||
const dependencyDescriptorB = b.dependencies.get(dependencyDescriptorA.identHash); | ||
if (!dependencyDescriptorB) | ||
return false; | ||
if (!areDescriptorsEqual(dependencyDescriptorA, dependencyDescriptorB)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
exports.areVirtualPackagesEquivalent = areVirtualPackagesEquivalent; | ||
function parseIdent(string) { | ||
@@ -192,2 +224,18 @@ const ident = tryParseIdent(string); | ||
exports.makeRange = makeRange; | ||
/** | ||
* The range used internally may differ from the range stored in the | ||
* Manifest (package.json). This removes any params indicated for internal use. | ||
* An internal param starts with "__". | ||
* @param range range to convert | ||
*/ | ||
function convertToManifestRange(range) { | ||
const url = new url_1.URL(range); | ||
for (const [name] of url.searchParams) { | ||
if (name.startsWith('__')) { | ||
url.searchParams.delete(name); | ||
} | ||
} | ||
return url.toString(); | ||
} | ||
exports.convertToManifestRange = convertToManifestRange; | ||
function requirableIdent(ident) { | ||
@@ -194,0 +242,0 @@ if (ident.scope) { |
{ | ||
"name": "@yarnpkg/core", | ||
"version": "2.0.0-rc.11", | ||
"version": "2.0.0-rc.12", | ||
"main": "./lib/index.js", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@yarnpkg/fslib": "2.0.0-rc.7", | ||
"@yarnpkg/fslib": "2.0.0-rc.8", | ||
"@yarnpkg/json-proxy": "2.0.0-rc.2", | ||
"@yarnpkg/parsers": "2.0.0-rc.4", | ||
"@yarnpkg/pnp": "2.0.0-rc.7", | ||
"@yarnpkg/pnp": "2.0.0-rc.8", | ||
"@yarnpkg/shell": "2.0.0-rc.2", | ||
@@ -15,3 +15,3 @@ "agentkeepalive": "^4.0.2", | ||
"chalk": "^2.4.1", | ||
"clipanion": "^2.1.3", | ||
"clipanion": "^2.1.4", | ||
"cross-spawn": "^6.0.5", | ||
@@ -37,3 +37,3 @@ "globby": "^8.0.1", | ||
"@yarnpkg/plugin-link": "2.0.0-rc.2", | ||
"@yarnpkg/plugin-pnp": "2.0.0-rc.4" | ||
"@yarnpkg/plugin-pnp": "2.0.0-rc.5" | ||
}, | ||
@@ -40,0 +40,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
306977
6705
+ Added@yarnpkg/fslib@2.0.0-rc.8(transitive)
+ Added@yarnpkg/pnp@2.0.0-rc.8(transitive)
- Removed@yarnpkg/fslib@2.0.0-rc.7(transitive)
- Removed@yarnpkg/pnp@2.0.0-rc.7(transitive)
Updated@yarnpkg/fslib@2.0.0-rc.8
Updated@yarnpkg/pnp@2.0.0-rc.8
Updatedclipanion@^2.1.4