snyk-go-plugin
Version:
Snyk CLI Golang plugin
94 lines (93 loc) • 2.63 kB
TypeScript
import { DepGraphBuilder, DepGraph } from '@snyk/dep-graph';
export interface DepDict {
[name: string]: DepTree;
}
export interface DepTree {
name: string;
version?: string;
dependencies?: DepDict;
packageFormatVersion?: string;
_counts?: any;
_isProjSubpkg?: boolean;
}
interface Options {
debug?: boolean;
file?: string;
args?: string[];
configuration?: {
includeGoStandardLibraryDeps?: boolean;
};
}
export declare function inspect(root: any, targetFile: any, options?: Options): Promise<{
plugin: {
name: string;
runtime: string | undefined;
targetFile: any;
};
dependencyGraph: DepGraph | undefined;
package?: undefined;
} | {
plugin: {
name: string;
runtime: string | undefined;
targetFile: any;
};
package: DepTree | undefined;
dependencyGraph?: undefined;
}>;
interface GoPackage {
Dir: string;
ImportPath: string;
ImportComment?: string;
Name: string;
Doc?: string;
Target?: string;
Shlib?: string;
Goroot?: boolean;
Standard?: boolean;
Stale?: boolean;
StaleReason?: string;
Root?: string;
ConflictDir?: string;
BinaryOnly?: boolean;
ForTest?: string;
Export?: string;
Module?: GoModule;
Match?: string[];
DepOnly?: boolean;
Imports?: string[];
ImportMap: {
string: string;
};
Deps: string[];
TestImports: string[];
XTestImports: string[];
Incomplete: boolean;
Error: GoPackageError;
DepsErrors: GoPackageError[];
}
interface GoModule {
Path: string;
Version: string;
Versions: string[];
Replace: GoModule;
Time: string;
Update: GoModule;
Main: boolean;
Indirect: boolean;
Dir: string;
GoMod: string;
Error: string;
}
interface GoPackageError {
ImportStack: string[];
Pos: string;
Err: string;
}
interface GoPackagesByName {
[name: string]: GoPackage;
}
export declare function buildDepGraphFromImportsAndModules(root: string | undefined, targetFile: string | undefined, includeGoStandardLibraryDeps: boolean | undefined, additionalArgs: string[] | undefined, stdlibVersion: string): Promise<DepGraph>;
declare function buildGraph(depGraphBuilder: DepGraphBuilder, depPackages: string[], packagesByName: GoPackagesByName, currentParent: string, childrenChain: Map<string, string[]>, ancestorsChain: Map<string, string[]>, includeGoStandardLibraryDeps: boolean | undefined, stdLibVersion: string, visited?: Set<string>): void;
export { buildGraph };
export declare function jsonParse(s: string): any;