-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from snyk/feat/pnpm-lockfile-v9
feat: added support for pnpm lockfiles v9
- Loading branch information
Showing
70 changed files
with
104,409 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
32 changes: 32 additions & 0 deletions
32
lib/dep-graph-builders/pnpm/lockfile-parser/lockfile-v9.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PnpmWorkspaceArgs } from '../../types'; | ||
import { LockfileV6Parser } from './lockfile-v6'; | ||
|
||
const DEFAULT_WORKSPACE_ARGS: PnpmWorkspaceArgs = { | ||
isWorkspacePkg: true, | ||
isRoot: true, | ||
workspacePath: '.', | ||
projectsVersionMap: {}, | ||
rootOverrides: {}, | ||
}; | ||
export class LockfileV9Parser extends LockfileV6Parser { | ||
public settings; | ||
public snapshots; | ||
|
||
public constructor( | ||
rawPnpmLock: any, | ||
workspaceArgs: PnpmWorkspaceArgs = DEFAULT_WORKSPACE_ARGS, | ||
) { | ||
super(rawPnpmLock, workspaceArgs); | ||
this.settings = rawPnpmLock.settings; | ||
this.packages = {}; | ||
Object.entries(rawPnpmLock.snapshots).forEach( | ||
([depPath, versionData]: [string, any]) => { | ||
const normalizedDepPath = this.excludeTransPeerDepsVersions(depPath); | ||
this.packages[normalizedDepPath] = { | ||
...rawPnpmLock.packages[normalizedDepPath], | ||
...versionData, | ||
}; | ||
}, | ||
); | ||
} | ||
} |
This file contains 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.