UNPKG

@rushstack/lockfile-explorer

Version:

Rush Lockfile Explorer: The UI for solving version conflicts quickly in a large monorepo

129 lines 5.04 kB
import type { LfxDependencyKind, IJsonPeerDependencyMeta, LfxGraphEntryKind } from './IJsonLfxGraph'; import type { IJsonLfxWorkspace } from './IJsonLfxWorkspace'; export interface ILfxGraphDependencyOptions { name: string; versionPath: string; entryId: string; originalSpecifier: string; dependencyKind: LfxDependencyKind; peerDependencyMeta: IJsonPeerDependencyMeta; containingEntry: LfxGraphEntry; } /** * Represents an graph edge, which is an exact dependency version obtained from the lockfile. */ export declare class LfxGraphDependency { /** * The referenced package name. * Example: `@scope/package-name` */ readonly name: string; /** * The lockfile's raw string that either indicates an external reference such as `link:../target-folder`, * or else can be combined with the `name` field to construct an `entryId` found in the lockfile. * The exact syntax varies between lockfile file format versions. * * Example: `link:../target-folder` * * Example: `1.0.0` * * Example: `1.0.0_@rushstack+m@1.0.0` (version 5.4) * Example: `1.0.0(@rushstack/m@1.0.0)` (version 6.0 and 9.0) */ readonly versionPath: string; /** * If this dependency refers to an entry in the lockfile, this field should match a corresponding * {@link LfxGraphEntry.entryId} and `resolvedEntry` will be defined (unless the loader encountered an error). * * For external references such as `link:../target-folder`, the `entryId` is the empty string. */ readonly entryId: string; /** * The lockfile sometimes records the original SemVer specifier that was used to choose the versionPath, * usually either because it can change (e.g. a workspace project's dependencies) or because it's a peer dependency * that affects graph relationships beyond the current node. If not, then `originalSpecifier` will be the * empty string. * * @remarks * Because this field is only available for certain dependencies, it is generally less useful than specifiers * obtained from the package.json files. */ readonly originalSpecifier: string; readonly dependencyKind: LfxDependencyKind; readonly peerDependencyMeta: IJsonPeerDependencyMeta; readonly containingEntry: LfxGraphEntry; resolvedEntry: LfxGraphEntry | undefined; constructor(options: ILfxGraphDependencyOptions); } export interface ILfxGraphEntryOptions { kind: LfxGraphEntryKind; entryId: string; rawEntryId: string; packageJsonFolderPath: string; entryPackageName: string; displayText: string; entryPackageVersion: string; entrySuffix: string; } /** * Represents a project or package listed in the pnpm lockfile. * * @remarks * Each project or package will have its own LockfileEntry, which is created when the lockfile is first parsed. * The fields for the LockfileEntry are outlined below: */ export declare class LfxGraphEntry { /** * Whether this entry is a project or a package (specified by importers or packages in the lockfile). */ readonly kind: LfxGraphEntryKind; /** * A unique identifier for this lockfile entry, based on `rawEntryId` but adjusted to be unique for both * project and external package entries. */ readonly entryId: string; /** * The unique identifier assigned to this project/package in the lockfile. * e.g. `/@emotion/core/10.3.1_qjwx5m6wssz3lnb35xwkc3pz6q:` * * @remarks * In the `pnpm-lock.yaml` file, "importers" (workspace projects) and "packages" (external packages) * are tracked separately, so it's not required for their keys to be unique. `entryId` solves this problem * by adding a `project:` prefix for importers. */ readonly rawEntryId: string; /** * Where the package.json is for this project or package. */ readonly packageJsonFolderPath: string; /** * Just the name of the package with no specifiers. */ readonly entryPackageName: string; /** * A human friendly name for the project or package. */ readonly displayText: string; readonly entryPackageVersion: string; readonly entrySuffix: string; /** * A list of all the dependencies for this entry. * Note that dependencies, dev dependencies, as well as peer dependencies are all included. */ readonly dependencies: LfxGraphDependency[]; /** * A list of dependencies that are listed under the "transitivePeerDependencies" in the pnpm lockfile. */ readonly transitivePeerDependencies: Set<string>; /** * A list of entries that specify this entry as a dependency. */ readonly referrers: LfxGraphEntry[]; constructor(options: ILfxGraphEntryOptions); } export declare class LfxGraph { readonly workspace: IJsonLfxWorkspace; readonly entries: LfxGraphEntry[]; constructor(workspace: IJsonLfxWorkspace); } //# sourceMappingURL=LfxGraph.d.ts.map