@pnpm/dependency-path
Version:
Utilities for working with symlinked node_modules
31 lines (30 loc) • 1.37 kB
TypeScript
import { type DepPath, type PkgResolutionId, type Registries, type PkgId, type PkgIdWithPatchHash } from '@pnpm/types';
export declare function isAbsolute(dependencyPath: string): boolean;
export declare function indexOfPeersSuffix(depPath: string): {
peersIndex: number;
patchHashIndex: number;
};
export interface ParsedDepPath {
id: string;
peersSuffix: string;
}
export declare function parseDepPath(relDepPath: string): ParsedDepPath;
export declare function removeSuffix(relDepPath: string): string;
export declare function getPkgIdWithPatchHash(depPath: DepPath): PkgIdWithPatchHash;
export declare function tryGetPackageId(relDepPath: DepPath): PkgId;
export declare function getRegistryByPackageName(registries: Registries, packageName: string): string;
export declare function refToRelative(reference: string, pkgName: string): DepPath | null;
export interface DependencyPath {
name?: string;
peersSuffix?: string;
version?: string;
nonSemverVersion?: PkgResolutionId;
patchHash?: string;
}
export declare function parse(dependencyPath: string): DependencyPath;
export declare function depPathToFilename(depPath: string, maxLengthWithoutHash: number): string;
export type PeerId = {
name: string;
version: string;
} | string;
export declare function createPeersDirSuffix(peerIds: PeerId[], maxLength?: number): string;