This commit is contained in:
2026-04-07 14:50:23 +09:00
commit b4e485502b
4778 changed files with 2017091 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { MultiProjectResultCustom } from './get-multi-plugin-result';
import { SupportedPackageManagers } from '../package-managers';
export declare function convertMultiResultToMultiCustom(inspectRes: pluginApi.MultiProjectResult, packageManager?: SupportedPackageManagers, targetFile?: string): MultiProjectResultCustom;

View File

@@ -0,0 +1,5 @@
import * as cliInterface from '@snyk/cli-interface';
import { ScannedProjectCustom } from './get-multi-plugin-result';
import { SupportedPackageManagers } from '../package-managers';
import { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';
export declare function convertScannedProjectsToCustom(scannedProjects: cliInterface.legacyCommon.ScannedProject[], pluginMeta: PluginMetadata, packageManager?: SupportedPackageManagers, targetFile?: string): ScannedProjectCustom[];

View File

@@ -0,0 +1,4 @@
import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { MultiProjectResultCustom } from './get-multi-plugin-result';
import { SupportedPackageManagers } from '../package-managers';
export declare function convertSingleResultToMultiCustom(inspectRes: pluginApi.SinglePackageResult, packageManager?: SupportedPackageManagers): MultiProjectResultCustom;

View File

@@ -0,0 +1,6 @@
import * as cliInterface from '@snyk/cli-interface';
import { ScannedProjectCustom } from './get-multi-plugin-result';
import { SupportedPackageManagers } from '../package-managers';
export declare function extractPackageManager(scannedProject: ScannedProjectCustom, pluginRes: cliInterface.legacyPlugin.MultiProjectResult, options: {
packageManager?: SupportedPackageManagers;
}): SupportedPackageManagers | undefined;

View File

@@ -0,0 +1,6 @@
import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { Options, TestOptions, MonitorOptions } from '../types';
import { MultiProjectResultCustom } from './get-multi-plugin-result';
import { ScannedProject } from '@snyk/cli-interface/legacy/common';
export declare function getDepsFromPlugin(root: string, options: Options & (TestOptions | MonitorOptions), featureFlags?: Set<string>): Promise<pluginApi.MultiProjectResult | MultiProjectResultCustom>;
export declare function warnSomeGradleManifestsNotScanned(scannedProjects: ScannedProject[], allFilesFound: string[], root: string): string | null;

View File

@@ -0,0 +1,3 @@
import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { Options } from '../types';
export declare function getExtraProjectCount(root: string, options: Options, inspectResult: pluginApi.InspectResult): Promise<number | undefined>;

View File

@@ -0,0 +1,22 @@
import * as cliInterface from '@snyk/cli-interface';
import { TestOptions, Options, MonitorOptions } from '../types';
import { SupportedPackageManagers } from '../package-managers';
import { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';
import { CallGraph } from '@snyk/cli-interface/legacy/common';
export interface ScannedProjectCustom extends cliInterface.legacyCommon.ScannedProject {
packageManager: SupportedPackageManagers;
plugin: PluginMetadata;
callGraph?: CallGraph;
}
interface FailedProjectScanError {
targetFile?: string;
error?: Error;
errMessage: string;
}
export interface MultiProjectResultCustom extends cliInterface.legacyPlugin.MultiProjectResult {
scannedProjects: ScannedProjectCustom[];
failedResults?: FailedProjectScanError[];
}
export declare function getMultiPluginResult(root: string, options: Options & (TestOptions | MonitorOptions), targetFiles: string[], featureFlags?: Set<string>): Promise<MultiProjectResultCustom>;
export declare function filterOutProcessedWorkspaces(root: string, scannedProjects: ScannedProjectCustom[], allTargetFiles: string[], lockFile: string): string[];
export {};

View File

@@ -0,0 +1,3 @@
import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { TestOptions, Options, MonitorOptions } from '../types';
export declare function getSinglePluginResult(root: string, options: Options & (TestOptions | MonitorOptions), targetFile?: string): Promise<pluginApi.InspectResult>;

View File

@@ -0,0 +1,3 @@
import * as types from './types';
import { SupportedPackageManagers } from '../package-managers';
export declare function loadPlugin(packageManager: SupportedPackageManagers | undefined): types.Plugin;

View File

@@ -0,0 +1,3 @@
import * as types from '../types';
import { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin';
export declare function inspect(root: string, targetFile: string, options?: types.Options): Promise<MultiProjectResult>;

View File

@@ -0,0 +1,4 @@
import { PkgTree } from 'snyk-nodejs-lockfile-parser';
import { Options } from '../types';
import { DepGraph } from '@snyk/dep-graph';
export declare function parse(root: string, targetFile: string, options: Options): Promise<PkgTree | DepGraph>;

View File

@@ -0,0 +1,3 @@
import { PackageExpanded } from 'snyk-resolve-deps/dist/types';
import { Options } from '../types';
export declare function parse(root: string, targetFile: string, options: Options): Promise<PackageExpanded>;

View File

@@ -0,0 +1,17 @@
import { MultiProjectResultCustom } from '../get-multi-plugin-result';
export declare function processNpmWorkspaces(root: string, settings: {
strictOutOfSync?: boolean;
dev?: boolean;
yarnWorkspaces?: boolean;
}, targetFiles: string[]): Promise<MultiProjectResultCustom>;
interface NpmWorkspacesMap {
[packageJsonName: string]: {
workspaces: string[];
};
}
export declare function getWorkspacesMap(file: {
content: string;
fileName: string;
}): NpmWorkspacesMap;
export declare function packageJsonBelongsToWorkspace(packageJsonFileName: string, workspacesMap: NpmWorkspacesMap, workspaceRoot: string): boolean;
export {};

View File

@@ -0,0 +1,17 @@
import { MultiProjectResultCustom } from '../get-multi-plugin-result';
export declare function processYarnWorkspaces(root: string, settings: {
strictOutOfSync?: boolean;
dev?: boolean;
yarnWorkspaces?: boolean;
}, targetFiles: string[]): Promise<MultiProjectResultCustom>;
interface YarnWorkspacesMap {
[packageJsonName: string]: {
workspaces: string[];
};
}
export declare function getWorkspacesMap(file: {
content: string;
fileName: string;
}): YarnWorkspacesMap;
export declare function packageJsonBelongsToWorkspace(packageJsonFileName: string, yarnWorkspacesMap: YarnWorkspacesMap, workspaceRoot: string): boolean;
export {};

View File

@@ -0,0 +1,2 @@
export = gemfileLockToDependencies;
declare function gemfileLockToDependencies(fileContents: any): any;

View File

@@ -0,0 +1,3 @@
import { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin';
import * as types from '../types';
export declare function inspect(root: string, targetFile: string, options?: types.Options): Promise<MultiProjectResult>;

View File

@@ -0,0 +1,4 @@
import { Spec } from './index';
import * as types from '../../types';
export declare function canHandle(file: string): boolean;
export declare function gatherSpecs(root: string, target: string, options: types.Options): Promise<Spec>;

View File

@@ -0,0 +1,3 @@
import { Spec } from './index';
export declare function canHandle(file: string): boolean;
export declare function gatherSpecs(root: string, target: string): Promise<Spec>;

View File

@@ -0,0 +1,8 @@
import * as gemfile from './gemfile';
import { Files } from './try-get-spec';
export interface Spec {
packageName: string;
targetFile: string;
files: Files;
}
export declare const inspectors: (typeof gemfile)[];

View File

@@ -0,0 +1,10 @@
interface File {
name: string;
contents: string;
}
export interface Files {
gemfileLock?: File;
gemspec?: File;
}
export declare function tryGetSpec(dir: string, name: string): Promise<File | null>;
export {};

View File

@@ -0,0 +1,6 @@
import { Options } from '../../types';
import { SastSettings, CodeTestResults } from './types';
/**
* Bootstrap and trigger a Code test, then return the results.
*/
export declare function getCodeTestResults(root: string, options: Options, sastSettings: SastSettings, requestId: string): Promise<CodeTestResults | null>;

View File

@@ -0,0 +1,3 @@
import { SastSettings, TrackUsageResponse } from './types';
export declare function getSastSettingsForOrg(org: any): Promise<SastSettings>;
export declare function trackUsage(org: any): Promise<TrackUsageResponse>;

View File

@@ -0,0 +1,7 @@
import { CustomError } from '../../../errors/custom-error';
export declare class CodeClientError extends CustomError {
constructor(statusCode: number, statusText: string, additionalUserHelp?: string);
}
export declare class CodeClientErrorWithDetail extends CustomError {
constructor(message: string, statusCode: number, detail: string);
}

View File

@@ -0,0 +1,3 @@
export { MissingConfigurationError } from './missing-configuration-error';
export { FeatureNotSupportedBySnykCodeError } from './unsupported-feature-snyk-code-error';
export { CodeClientError, CodeClientErrorWithDetail, } from './code-client-error';

View File

@@ -0,0 +1,5 @@
import { CustomError } from '../../../errors/custom-error';
export declare class MissingConfigurationError extends CustomError {
readonly action: string;
constructor(action: string, additionalUserHelp?: string);
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from '../../../errors/custom-error';
export declare class FeatureNotSupportedBySnykCodeError extends CustomError {
readonly feature: string;
constructor(feature: string, additionalUserHelp?: string);
}

View File

@@ -0,0 +1,11 @@
import { Options } from '../../../types';
import { CodeTestResults } from '../types';
export declare function getCodeDisplayedOutput(args: {
testResults: CodeTestResults;
meta: string;
prefix: string;
shouldFilterIgnored: boolean;
}): string;
export declare function getMeta(options: Options, path: string): string;
export declare function getPrefix(path: string): string;
export declare function getCodeReportDisplayedOutput(reportUrl: string): string;

View File

@@ -0,0 +1,2 @@
import { EcosystemPlugin } from '../../ecosystems/types';
export declare const codePlugin: EcosystemPlugin;

View File

@@ -0,0 +1,3 @@
import { SastSettings } from './types';
export declare function isLocalCodeEngine(sastSettings: SastSettings): boolean;
export declare function logLocalCodeEngineVersion(localEngineUrl?: string): Promise<void>;

View File

@@ -0,0 +1,3 @@
import { Options } from '../../types';
import { SastSettings } from './types';
export declare function getSastSettings(options: Options): Promise<SastSettings>;

View File

@@ -0,0 +1,27 @@
export { Log, Tool, Result } from 'sarif';
import { AnalysisResultSarif, FileAnalysis, ReportResult, ScmAnalysis } from '@snyk/code-client';
interface LocalCodeEngine {
enabled: boolean;
url: string;
allowCloudUpload: boolean;
}
export interface SastSettings {
sastEnabled: boolean;
code?: number;
error?: string;
userMessage?: string;
localCodeEngine: LocalCodeEngine;
supportedLanguages?: string[];
org?: string;
}
export interface TrackUsageResponse {
code?: number;
userMessage?: string;
}
export interface CodeTestResults {
reportResults?: ReportResult['uploadResult'];
analysisResults: AnalysisResultSarif;
}
export type CodeAnalysisResults = (FileAnalysis & {
analysisResults: AnalysisResultSarif;
}) | ScmAnalysis;

View File

@@ -0,0 +1,2 @@
import { Result } from 'sarif';
export declare function filterIgnoredIssues(analysisResults: Result[]): Result[];

View File

@@ -0,0 +1,2 @@
export { analysisProgressUpdate } from './testEmitter';
export { filterIgnoredIssues } from './filter';

View File

@@ -0,0 +1 @@
export declare function analysisProgressUpdate(): void;

View File

@@ -0,0 +1,25 @@
export interface InspectResult {
plugin: {
name: string;
runtime?: string;
};
package?: any;
scannedProjects?: any;
}
export interface Options {
file?: string;
docker?: boolean;
traverseNodeModules?: boolean;
dev?: boolean;
strictOutOfSync?: boolean;
allSubProjects?: boolean;
debug?: boolean;
packageManager?: string;
composerIsFine?: boolean;
composerPharIsFine?: boolean;
systemVersions?: object;
scanAllUnmanaged?: boolean;
}
export interface Plugin {
inspect: (root: string, targetFile: string, options?: Options) => Promise<InspectResult>;
}