snyk-nodejs-lockfile-parser
- Version 1.58.12
- Published
- 278 kB
- 18 dependencies
- Apache-2.0 license
Install
npm i snyk-nodejs-lockfile-parser
yarn add snyk-nodejs-lockfile-parser
pnpm add snyk-nodejs-lockfile-parser
Overview
Generate a dep tree given a lockfile
Index
Functions
- buildDepGraphFromCliOutput()
- buildDepGraphYarnLockV1Simple()
- buildDepGraphYarnLockV1SimpleCyclesPruned()
- buildDepGraphYarnLockV1Workspace()
- buildDepGraphYarnLockV1WorkspaceCyclesPruned()
- buildDepGraphYarnLockV2Simple()
- buildDepTree()
- buildDepTreeFromFiles()
- extractPkgsFromYarnLockV1()
- extractPkgsFromYarnLockV2()
- getLockfileVersionFromFile()
- getNpmLockfileVersion()
- getPnpmLockfileParser()
- getPnpmLockfileVersion()
- getPnpmWorkspaces()
- getYarnLockfileType()
- getYarnLockfileVersion()
- getYarnWorkspaces()
- getYarnWorkspacesFromFiles()
- parseNpmLockV2Project()
- parsePkgJson()
- parsePnpmProject()
- parsePnpmWorkspace()
- parseYarnLockV1Project()
- parseYarnLockV1WorkspaceProject()
- parseYarnLockV2Project()
Classes
Interfaces
Enums
Type Aliases
Functions
function buildDepGraphFromCliOutput
buildDepGraphFromCliOutput: ( rawCliOutput: string, lockfileContent: string, manifestFileContent: string) => DepGraph;
function buildDepGraphYarnLockV1Simple
buildDepGraphYarnLockV1Simple: ( extractedYarnLockV1Pkgs: NormalisedPkgs, pkgJson: PackageJsonBase, options: Yarn1DepGraphBuildOptions) => Promise<import('@snyk/dep-graph').DepGraph>;
function buildDepGraphYarnLockV1SimpleCyclesPruned
buildDepGraphYarnLockV1SimpleCyclesPruned: ( extractedYarnLockV1Pkgs: NormalisedPkgs, pkgJson: PackageJsonBase, options: DepGraphBuildOptions) => Promise<import('@snyk/dep-graph').DepGraph>;
function buildDepGraphYarnLockV1Workspace
buildDepGraphYarnLockV1Workspace: ( extractedYarnLockV1Pkgs: NormalisedPkgs, pkgJson: PackageJsonBase, workspacePkgNameToVersion: Record<string, string>, options: DepGraphBuildOptions) => Promise<import('@snyk/dep-graph').DepGraph>;
function buildDepGraphYarnLockV1WorkspaceCyclesPruned
buildDepGraphYarnLockV1WorkspaceCyclesPruned: ( extractedYarnLockV1Pkgs: NormalisedPkgs, pkgJson: PackageJsonBase, workspacePkgNameToVersion: Record<string, string>, options: DepGraphBuildOptions) => Promise<import('@snyk/dep-graph').DepGraph>;
function buildDepGraphYarnLockV2Simple
buildDepGraphYarnLockV2Simple: ( extractedYarnLockV2Pkgs: NormalisedPkgs, pkgJson: PackageJsonBase, options: YarnLockV2ProjectParseOptions, workspaceArgs?: YarnLockV2WorkspaceArgs) => Promise<import('@snyk/dep-graph').DepGraph>;
function buildDepTree
buildDepTree: ( manifestFileContents: string, lockFileContents: string, includeDev?: boolean, lockfileType?: LockfileType, strictOutOfSync?: boolean, defaultManifestFileName?: string) => Promise<PkgTree>;
function buildDepTreeFromFiles
buildDepTreeFromFiles: ( root: string, manifestFilePath: string, lockFilePath: string, includeDev?: boolean, strictOutOfSync?: boolean) => Promise<PkgTree>;
function extractPkgsFromYarnLockV1
extractPkgsFromYarnLockV1: (yarnLockContent: string) => NormalisedPkgs;
function extractPkgsFromYarnLockV2
extractPkgsFromYarnLockV2: (yarnLockContent: string) => NormalisedPkgs;
function getLockfileVersionFromFile
getLockfileVersionFromFile: (targetFile: string) => NodeLockfileVersion;
function getNpmLockfileVersion
getNpmLockfileVersion: ( lockFileContents: string) => | NodeLockfileVersion.NpmLockV1 | NodeLockfileVersion.NpmLockV2 | NodeLockfileVersion.NpmLockV3;
function getPnpmLockfileParser
getPnpmLockfileParser: ( pnpmLockContent: string | undefined, lockfileVersion?: NodeLockfileVersion, workspaceArgs?: PnpmWorkspaceArgs) => PnpmLockfileParser;
function getPnpmLockfileVersion
getPnpmLockfileVersion: ( lockFileContents: string) => | NodeLockfileVersion.PnpmLockV5 | NodeLockfileVersion.PnpmLockV6 | NodeLockfileVersion.PnpmLockV9;
function getPnpmWorkspaces
getPnpmWorkspaces: (workspacesYamlFile: string) => string[];
function getYarnLockfileType
getYarnLockfileType: ( lockFileContents: string, root?: string, lockFilePath?: string) => LockfileType;
function getYarnLockfileVersion
getYarnLockfileVersion: ( lockFileContents: string) => NodeLockfileVersion.YarnLockV1 | NodeLockfileVersion.YarnLockV2;
function getYarnWorkspaces
getYarnWorkspaces: (targetFile: string) => string[] | false;
function getYarnWorkspacesFromFiles
getYarnWorkspacesFromFiles: ( root: any, manifestFilePath: string) => string[] | false;
function parseNpmLockV2Project
parseNpmLockV2Project: ( pkgJsonContent: string, pkgLockContent: string, options: ProjectParseOptions) => Promise<DepGraph>;
function parsePkgJson
parsePkgJson: (pkgJsonContent: string) => PackageJsonBase;
function parsePnpmProject
parsePnpmProject: ( pkgJsonContent: string, pnpmLockContent: string | undefined, options: PnpmProjectParseOptions, lockfileVersion?: NodeLockfileVersion) => Promise<DepGraph>;
function parsePnpmWorkspace
parsePnpmWorkspace: ( root: string, workspaceDir: string, options: PnpmProjectParseOptions) => Promise<ScannedNodeProject[]>;
function parseYarnLockV1Project
parseYarnLockV1Project: ( pkgJsonContent: string, yarnLockContent: string, options: YarnLockV1ProjectParseOptions) => Promise<import('@snyk/dep-graph').DepGraph>;
function parseYarnLockV1WorkspaceProject
parseYarnLockV1WorkspaceProject: ( yarnLockContent: string, workspacePackagesPkgJsons: string[], options: ProjectParseOptions) => Promise<DepGraph[]>;
function parseYarnLockV2Project
parseYarnLockV2Project: ( pkgJsonContent: string, yarnLockContent: string, options: YarnLockV2ProjectParseOptions, workspaceArgs?: YarnLockV2WorkspaceArgs) => Promise<DepGraph>;
Classes
class InvalidUserInputError
class InvalidUserInputError extends Error {}
class OutOfSyncError
class OutOfSyncError extends Error {}
constructor
constructor(dependencyName: string, lockFileType: LockfileType);
property code
code: number;
property dependencyName
dependencyName: string;
property lockFileType
lockFileType: string;
property name
name: string;
class UnsupportedRuntimeError
class UnsupportedRuntimeError extends Error {}
Interfaces
interface ManifestFile
interface ManifestFile {}
property dependencies
dependencies?: ManifestDependencies;
property devDependencies
devDependencies?: ManifestDependencies;
property engines
engines?: { node?: string;};
property name
name: string;
property optionalDependencies
optionalDependencies?: ManifestDependencies;
property peerDependencies
peerDependencies?: ManifestDependencies;
property peerDependenciesMeta
peerDependenciesMeta?: PeerDependenciesMeta;
property private
private?: string;
property resolutions
resolutions?: ManifestDependencies;
property version
version?: string;
property workspaces
workspaces?: string[] | WorkspacesAlternateConfig;
interface PkgTree
interface PkgTree extends DepTreeDep {}
property cyclic
cyclic?: boolean;
property dependencies
dependencies: { [depName: string]: DepTreeDep;};
property hasDevDependencies
hasDevDependencies?: boolean;
property meta
meta?: { nodeVersion?: string; lockfileVersion?: number; packageManager?: string;};
property packageFormatVersion
packageFormatVersion?: string;
property size
size?: number;
property type
type?: string;
Enums
enum LockfileType
enum LockfileType { npm = 'npm', npm7 = 'npm7', yarn = 'yarn', yarn2 = 'yarn2', pnpm = 'pnpm',}
enum NodeLockfileVersion
enum NodeLockfileVersion { NpmLockV1 = 'NPM_LOCK_V1', NpmLockV2 = 'NPM_LOCK_V2', NpmLockV3 = 'NPM_LOCK_V3', YarnLockV1 = 'YARN_LOCK_V1', YarnLockV2 = 'YARN_LOCK_V2', PnpmLockV5 = 'PNPM_LOCK_V5', PnpmLockV6 = 'PNPM_LOCK_V6', PnpmLockV9 = 'PNPM_LOCK_V9',}
member NpmLockV1
NpmLockV1 = 'NPM_LOCK_V1'
member NpmLockV2
NpmLockV2 = 'NPM_LOCK_V2'
member NpmLockV3
NpmLockV3 = 'NPM_LOCK_V3'
member PnpmLockV5
PnpmLockV5 = 'PNPM_LOCK_V5'
member PnpmLockV6
PnpmLockV6 = 'PNPM_LOCK_V6'
member PnpmLockV9
PnpmLockV9 = 'PNPM_LOCK_V9'
member YarnLockV1
YarnLockV1 = 'YARN_LOCK_V1'
member YarnLockV2
YarnLockV2 = 'YARN_LOCK_V2'
Type Aliases
type NormalisedPkgs
type NormalisedPkgs = Record< PkgIdentifier, { version: string; dependencies: Record<string, string>; optionalDependencies: Record<string, string>; }>;
type PackageJsonBase
type PackageJsonBase = { name: string; version: string; dependencies?: Record<string, string>; devDependencies?: Record<string, string>; optionalDependencies?: Record<string, string>; peerDependencies?: Record<string, string>; resolutions?: Record<string, string>; overrides?: Overrides; pnpm?: { overrides?: Overrides; };};
type ProjectParseOptions
type ProjectParseOptions = DepGraphBuildOptions & LockFileParseOptions & { pruneCycles: boolean; };
type YarnLockPackages
type NormalisedPkgs = Record< PkgIdentifier, { version: string; dependencies: Record<string, string>; optionalDependencies: Record<string, string>; }>;
type YarnLockV2ProjectParseOptions
type YarnLockV2ProjectParseOptions = { includeDevDeps: boolean; includeOptionalDeps: boolean; strictOutOfSync: boolean; pruneWithinTopLevelDeps: boolean;};
Package Files (23)
- dist/cli-parsers/index.d.ts
- dist/dep-graph-builders/npm-lock-v2/index.d.ts
- dist/dep-graph-builders/pnpm/lockfile-parser/index.d.ts
- dist/dep-graph-builders/pnpm/parse-project.d.ts
- dist/dep-graph-builders/pnpm/parse-workspace.d.ts
- dist/dep-graph-builders/types.d.ts
- dist/dep-graph-builders/util.d.ts
- dist/dep-graph-builders/yarn-lock-v1/build-depgraph-simple-pruned.d.ts
- dist/dep-graph-builders/yarn-lock-v1/build-depgraph-simple.d.ts
- dist/dep-graph-builders/yarn-lock-v1/build-depgraph-workspace-package-pruned.d.ts
- dist/dep-graph-builders/yarn-lock-v1/build-depgraph-workspace-package.d.ts
- dist/dep-graph-builders/yarn-lock-v1/extract-yarnlock-v1-pkgs.d.ts
- dist/dep-graph-builders/yarn-lock-v1/simple.d.ts
- dist/dep-graph-builders/yarn-lock-v1/workspaces.d.ts
- dist/dep-graph-builders/yarn-lock-v2/build-depgraph-simple.d.ts
- dist/dep-graph-builders/yarn-lock-v2/extract-yarnlock-v2-pkgs.d.ts
- dist/dep-graph-builders/yarn-lock-v2/simple.d.ts
- dist/errors/invalid-user-input-error.d.ts
- dist/errors/out-of-sync-error.d.ts
- dist/errors/unsupported-runtime-error.d.ts
- dist/index.d.ts
- dist/parsers/index.d.ts
- dist/utils.d.ts
Dependencies (18)
Dev Dependencies (14)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/snyk-nodejs-lockfile-parser
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/snyk-nodejs-lockfile-parser)
- HTML<a href="https://www.jsdocs.io/package/snyk-nodejs-lockfile-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3603 ms. - Missing or incorrect documentation? Open an issue for this package.