-
Notifications
You must be signed in to change notification settings - Fork 665
[lockfile-explorer] Add support for PNPM 10 #5377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8e81309
Update test fixtures, add v9.0 lockfile
octogonz 76fd975
Update lfxGraphLoader.ts to support v9.0 lockfile format
octogonz afa387e
Add lfxGraph-website-sample-1-v9.0.test.ts and convert its lockfile t…
octogonz f102bc7
Work in progress improving dependency tracing
octogonz ccf94cb
Rename file
octogonz adbfeed
Rename LfxGraphDependency.version to versionPath and clarify its spec
octogonz 929bd84
Introduce originalSpecifier field
octogonz cc73926
Update lfxGraph-edge-cases fixtures to add devDependencies example
octogonz f9b0c66
Finish implementation for V9.0 code path
octogonz 77c6d70
Finish implementation for V6.0 code path
octogonz 4217646
Finish implementation for V5.4 code path
octogonz df4559a
Fix a bug where entryId was not being computed correctly
octogonz b865fb1
Rename dependencyType -> dependencyKind
octogonz 8502570
rush change
octogonz 759b102
rush change
octogonz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,39 +6,75 @@ import type { IJsonLfxWorkspace } from './IJsonLfxWorkspace'; | |
|
|
||
| export interface ILfxGraphDependencyOptions { | ||
| name: string; | ||
| version: string; | ||
| dependencyType: LfxDependencyKind; | ||
| containingEntry: LfxGraphEntry; | ||
| peerDependencyMeta: IJsonPeerDependencyMeta; | ||
| versionPath: string; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These all have the same meaning as the corresponding fields in |
||
|
|
||
| entryId: string; | ||
|
|
||
| originalSpecifier: string; | ||
| dependencyKind: LfxDependencyKind; | ||
| peerDependencyMeta: IJsonPeerDependencyMeta; | ||
|
|
||
| containingEntry: LfxGraphEntry; | ||
| } | ||
|
|
||
| /** | ||
| * Represents a dependency listed under a LockfileEntry | ||
| * | ||
| * @remarks | ||
| * Each dependency listed under a package in the lockfile should have a separate entry. These Dependencies | ||
| * will link to the "containingEntry", which is the LockfileEntry that specified this dependency. | ||
| * The "resolvedEntry" field is the corresponding LockfileEntry for this dependency, as all dependencies also have | ||
| * their own entries in the pnpm lockfile. | ||
| * Represents an graph edge, which is an exact dependency version obtained from the lockfile. | ||
| */ | ||
| export class LfxGraphDependency { | ||
| /** | ||
| * The referenced package name. | ||
| * Example: `@scope/package-name` | ||
| */ | ||
| public readonly name: string; | ||
| public readonly version: string; | ||
| public readonly dependencyType: LfxDependencyKind; | ||
| public readonly containingEntry: LfxGraphEntry; | ||
|
|
||
| /** | ||
| * 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) | ||
| */ | ||
| public 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. | ||
| */ | ||
| public 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. | ||
| */ | ||
| public readonly originalSpecifier: string; | ||
| public readonly dependencyKind: LfxDependencyKind; | ||
| public readonly peerDependencyMeta: IJsonPeerDependencyMeta; | ||
|
|
||
| public readonly containingEntry: LfxGraphEntry; | ||
| public resolvedEntry: LfxGraphEntry | undefined = undefined; | ||
|
|
||
| public constructor(options: ILfxGraphDependencyOptions) { | ||
| this.name = options.name; | ||
| this.version = options.version; | ||
| this.dependencyType = options.dependencyType; | ||
| this.containingEntry = options.containingEntry; | ||
| this.versionPath = options.versionPath; | ||
| this.entryId = options.entryId; | ||
| this.originalSpecifier = options.originalSpecifier; | ||
| this.dependencyKind = options.dependencyKind; | ||
| this.peerDependencyMeta = options.peerDependencyMeta; | ||
|
|
||
| this.containingEntry = options.containingEntry; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -67,14 +103,19 @@ export class LfxGraphEntry { | |
| public readonly kind: LfxGraphEntryKind; | ||
|
|
||
| /** | ||
| * A unique (human-readable) identifier for this lockfile entry. For projects, this is just | ||
| * `Project:` + the package json path for this project. | ||
| * A unique identifier for this lockfile entry, based on `rawEntryId` but adjusted to be unique for both | ||
| * project and external package entries. | ||
| */ | ||
| public 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. | ||
| */ | ||
| public readonly rawEntryId: string; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave a doc comment about what this is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just the serialized versions of the corresponding fields from
LfxGraph