• Version 1.37.1
  • Published
  • 94.9 kB
  • 15 dependencies
  • Apache-2.0 license


npm i snyk-nodejs-lockfile-parser
yarn add snyk-nodejs-lockfile-parser
pnpm add snyk-nodejs-lockfile-parser


Generate a dep tree given a lockfile



function buildDepGraphFromCliOutput

buildDepGraphFromCliOutput: (
rawCliOutput: string,
lockfileContent: string,
manifestFileContent: string
) => any;

    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 getYarnLockfileType

        getYarnLockfileType: (
        lockFileContents: string,
        root?: string,
        lockFilePath?: string
        ) => LockfileType;

          function getYarnWorkspaces

          getYarnWorkspaces: (targetFile: string) => string[] | false;

            function getYarnWorkspacesFromFiles

            getYarnWorkspacesFromFiles: (
            root: any,
            manifestFilePath: string
            ) => string[] | false;


              class InvalidUserInputError

              class InvalidUserInputError extends Error {}


                constructor(...args: any[]);

                  property code

                  code: number;

                    property name

                    name: string;

                      class OutOfSyncError

                      class OutOfSyncError extends Error {}


                        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 {}


                                    constructor(...args: any[]);

                                      property code

                                      code: number;

                                        property name

                                        name: string;


                                          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 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;


                                                                                enum LockfileType

                                                                                enum LockfileType {
                                                                                npm = 'npm',
                                                                                npm7 = 'npm7',
                                                                                yarn = 'yarn',
                                                                                yarn2 = 'yarn2',

                                                                                  member npm

                                                                                  npm = 'npm'

                                                                                    member npm7

                                                                                    npm7 = 'npm7'

                                                                                      member yarn

                                                                                      yarn = 'yarn'

                                                                                        member yarn2

                                                                                        yarn2 = 'yarn2'

                                                                                          enum Scope

                                                                                          enum Scope {
                                                                                          prod = 'prod',
                                                                                          dev = 'dev',

                                                                                            member dev

                                                                                            dev = 'dev'

                                                                                              member prod

                                                                                              prod = 'prod'

                                                                                                Package Files (6)

                                                                                                Dependencies (15)

                                                                                                Dev Dependencies (15)

                                                                                                Peer Dependencies (0)

                                                                                                No peer dependencies.


                                                                                                To add a badge like this badgeto your package's README, use the codes available below.

                                                                                                You may also use to create a custom badge linking to

                                                                                                • Markdown
                                                                                                • HTML
                                                                                                  <a href=""><img src="" alt=""></a>