UNPKG

1.65 kBTypeScriptView Raw
1import { PackageJsonBase } from './types';
2import { DepGraphBuilder } from '@snyk/dep-graph';
3import { NormalisedPkgs } from './types';
4export declare type Dependencies = Record<string, {
5 version: string;
6 isDev: boolean;
7}>;
8export interface PkgNode {
9 id: string;
10 name: string;
11 version: string;
12 dependencies: Dependencies;
13 isDev: boolean;
14 missingLockFileEntry?: boolean;
15 inBundle?: boolean;
16 key?: string;
17}
18export declare const addPkgNodeToGraph: (depGraphBuilder: DepGraphBuilder, node: PkgNode, options: {
19 isCyclic?: boolean;
20 isWorkspacePkg?: boolean;
21}) => DepGraphBuilder;
22/**
23 * Get top level dependencies from the given package json object which is parsed from a package.json file.
24 * This includes both prod dependencies and dev dependencies supposing includeDevDeps is supported.
25 */
26export declare const getTopLevelDeps: (pkgJson: PackageJsonBase, options: {
27 includeDevDeps: boolean;
28 includeOptionalDeps?: boolean;
29 includePeerDeps?: boolean;
30}) => Dependencies;
31/**
32 * Converts dependencies parsed from the a lock file to a dependencies object required by the graph.
33 * For example, { 'mime-db': '~1.12.0' } will be converted to { 'mime-db': { version: '~1.12.0', isDev: true/false } }.
34 */
35export declare const getGraphDependencies: (dependencies: Record<string, string>, isDev: any) => Dependencies;
36export declare function parsePkgJson(pkgJsonContent: string): PackageJsonBase;
37export declare const getChildNode: (name: string, depInfo: {
38 version: string;
39 isDev: boolean;
40}, pkgs: NormalisedPkgs, strictOutOfSync: boolean, includeOptionalDeps: boolean) => PkgNode;