@nodesecure/tarball
Version:
NodeSecure tarball scanner
43 lines • 1.99 kB
TypeScript
import { type Warning, type Dependency, type AstAnalyserOptions } from "@nodesecure/js-x-ray";
import * as conformance from "@nodesecure/conformance";
import { ManifestManager } from "@nodesecure/mama";
import pacote from "pacote";
import type { ScanResultPayload, DependencyRef } from "./types.ts";
import type { Path } from "./class/SourceCodeScanner.class.ts";
export interface ScanOptions {
astAnalyserOptions?: AstAnalyserOptions;
}
export declare function scanPackageCore(locationOrManifest: string | ManifestManager, astAnalyserOptions?: AstAnalyserOptions): Promise<ScanResultPayload>;
export declare function scanDirOrArchive(locationOrManifest: string | ManifestManager, ref: DependencyRef, options?: ScanOptions): Promise<void>;
export interface ScannedPackageResult {
files: {
/** Complete list of files for the given package */
list: string[];
/** Complete list of extensions (.js, .md etc.) */
extensions: string[];
/** List of minified javascript files */
minified: string[];
};
/** Size of the directory in bytes */
directorySize: number;
/** Unique license contained in the tarball (MIT, ISC ..) */
uniqueLicenseIds: string[];
/** All licenses with their SPDX */
licenses: conformance.SpdxFileLicenseConformance[];
ast: {
dependencies: Record<string, Record<string, Dependency>>;
warnings: Warning[];
};
path: Path;
}
export declare function scanPackage(manifestOrLocation: string | ManifestManager, options?: ScanOptions): Promise<ScannedPackageResult>;
export interface PacoteProvider {
extract(spec: string, destination: string, options: pacote.Options): Promise<void>;
}
export interface TarballResolutionOptions {
spec: string;
registry?: string;
pacoteProvider?: PacoteProvider;
}
export declare function extractAndResolve(location: string, options: TarballResolutionOptions): Promise<ManifestManager>;
//# sourceMappingURL=tarball.d.ts.map