@code-pushup/js-packages-plugin 0.30.0-alpha → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +15 -5
- package/bin.js +288 -131
- package/index.js +490 -94
- package/package.json +3 -3
- package/src/lib/config.d.ts +2 -2
- package/src/lib/constants.d.ts +3 -8
- package/src/lib/package-managers/constants.d.ts +2 -0
- package/src/lib/package-managers/index.d.ts +2 -0
- package/src/lib/{runner/audit/unify-type.d.ts → package-managers/npm/audit-result.d.ts} +2 -3
- package/src/lib/package-managers/npm/npm.d.ts +2 -0
- package/src/lib/package-managers/npm/outdated-result.d.ts +2 -0
- package/src/lib/package-managers/npm/types.d.ts +38 -0
- package/src/lib/package-managers/package-managers.d.ts +3 -0
- package/src/lib/package-managers/pnpm/audit-result.d.ts +3 -0
- package/src/lib/package-managers/pnpm/outdated-result.d.ts +2 -0
- package/src/lib/package-managers/pnpm/pnpm.d.ts +2 -0
- package/src/lib/package-managers/pnpm/types.d.ts +26 -0
- package/src/lib/package-managers/types.d.ts +26 -0
- package/src/lib/package-managers/yarn-classic/audit-result.d.ts +2 -0
- package/src/lib/package-managers/yarn-classic/outdated-result.d.ts +2 -0
- package/src/lib/package-managers/yarn-classic/types.d.ts +49 -0
- package/src/lib/package-managers/yarn-classic/yarn-classic.d.ts +2 -0
- package/src/lib/package-managers/yarn-modern/audit-result.d.ts +2 -0
- package/src/lib/package-managers/yarn-modern/outdated-result.d.ts +2 -0
- package/src/lib/package-managers/yarn-modern/types.d.ts +26 -0
- package/src/lib/package-managers/yarn-modern/yarn-modern.d.ts +2 -0
- package/src/lib/runner/audit/constants.d.ts +1 -4
- package/src/lib/runner/audit/transform.d.ts +2 -2
- package/src/lib/runner/audit/types.d.ts +0 -69
- package/src/lib/runner/audit/utils.d.ts +2 -0
- package/src/lib/runner/outdated/constants.d.ts +2 -5
- package/src/lib/runner/outdated/transform.d.ts +2 -2
- package/src/lib/runner/outdated/types.d.ts +0 -37
- package/src/lib/runner/outdated/unify-type.d.ts +0 -4
package/src/lib/constants.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { IssueSeverity
|
|
2
|
-
import type { DependencyGroup, PackageAuditLevel
|
|
1
|
+
import { IssueSeverity } from '@code-pushup/models';
|
|
2
|
+
import type { DependencyGroup, PackageAuditLevel } from './config';
|
|
3
3
|
import { DependencyGroupLong } from './runner/outdated/types';
|
|
4
4
|
export declare const defaultAuditLevelMapping: Record<PackageAuditLevel, IssueSeverity>;
|
|
5
5
|
export declare const dependencyGroupToLong: Record<DependencyGroup, DependencyGroupLong>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const pkgManagerNames: Record<PackageManager, string>;
|
|
8
|
-
export declare const pkgManagerIcons: Record<PackageManager, MaterialIcon>;
|
|
9
|
-
export declare const pkgManagerDocs: Record<PackageManager, string>;
|
|
10
|
-
export declare const auditDocs: Record<PackageManager, string>;
|
|
11
|
-
export declare const outdatedDocs: Record<PackageManager, string>;
|
|
6
|
+
export declare const dependencyGroupWeights: Record<DependencyGroup, number>;
|
|
12
7
|
export declare const dependencyDocs: Record<DependencyGroup, string>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AuditResult
|
|
1
|
+
import { AuditResult } from '../../runner/audit/types';
|
|
2
|
+
import { NpmAdvisory, NpmFixInformation, NpmVulnerabilities } from './types';
|
|
2
3
|
export declare function npmToAuditResult(output: string): AuditResult;
|
|
3
4
|
export declare function npmToFixInformation(fixAvailable: boolean | NpmFixInformation): string;
|
|
4
5
|
export declare function npmToAdvisory(name: string, vulnerabilities: NpmVulnerabilities, prevNodes?: Set<string>): NpmAdvisory | null;
|
|
5
|
-
export declare function yarnv1ToAuditResult(output: string): AuditResult;
|
|
6
|
-
export declare function yarnv2ToAuditResult(output: string): AuditResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PackageAuditLevel } from '../../config';
|
|
2
|
+
import { AuditSummary } from '../../runner/audit/types';
|
|
3
|
+
import { DependencyGroupLong } from '../../runner/outdated/types';
|
|
4
|
+
export type NpmAdvisory = {
|
|
5
|
+
title: string;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
export type NpmFixInformation = {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
isSemVerMajor: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type NpmVulnerability = {
|
|
14
|
+
name: string;
|
|
15
|
+
severity: PackageAuditLevel;
|
|
16
|
+
isDirect: boolean;
|
|
17
|
+
effects: string[];
|
|
18
|
+
via: NpmAdvisory[] | string[];
|
|
19
|
+
range: string;
|
|
20
|
+
fixAvailable: boolean | NpmFixInformation;
|
|
21
|
+
};
|
|
22
|
+
export type NpmVulnerabilities = Record<string, NpmVulnerability>;
|
|
23
|
+
export type NpmAuditResultJson = {
|
|
24
|
+
vulnerabilities: NpmVulnerabilities;
|
|
25
|
+
metadata: {
|
|
26
|
+
vulnerabilities: AuditSummary;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type NpmVersionOverview = {
|
|
30
|
+
current?: string;
|
|
31
|
+
latest: string;
|
|
32
|
+
type: DependencyGroupLong;
|
|
33
|
+
homepage?: string;
|
|
34
|
+
};
|
|
35
|
+
export type NpmNormalizedOverview = Omit<NpmVersionOverview, 'current'> & {
|
|
36
|
+
current: string;
|
|
37
|
+
};
|
|
38
|
+
export type NpmOutdatedResultJson = Record<string, NpmVersionOverview>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PackageAuditLevel } from '../../config';
|
|
2
|
+
import { DependencyGroupLong } from '../../runner/outdated/types';
|
|
3
|
+
export type PnpmAuditAdvisory = {
|
|
4
|
+
module_name: string;
|
|
5
|
+
id: number;
|
|
6
|
+
severity: PackageAuditLevel;
|
|
7
|
+
vulnerable_versions: string;
|
|
8
|
+
recommendation: string;
|
|
9
|
+
title: string;
|
|
10
|
+
url: string;
|
|
11
|
+
findings: {
|
|
12
|
+
paths: string[];
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
export type PnpmAuditResultJson = {
|
|
16
|
+
advisories: Record<string, PnpmAuditAdvisory>;
|
|
17
|
+
metadata: {
|
|
18
|
+
vulnerabilities: Record<PackageAuditLevel, number>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type PnpmVersionOverview = {
|
|
22
|
+
current: string;
|
|
23
|
+
latest: string;
|
|
24
|
+
dependencyType: DependencyGroupLong;
|
|
25
|
+
};
|
|
26
|
+
export type PnpmOutdatedResultJson = Record<string, PnpmVersionOverview>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MaterialIcon } from '@code-pushup/models';
|
|
2
|
+
import { DependencyGroup, PackageManagerId } from '../config';
|
|
3
|
+
import { AuditResult } from '../runner/audit/types';
|
|
4
|
+
import { OutdatedResult } from '../runner/outdated/types';
|
|
5
|
+
export type PackageManager = {
|
|
6
|
+
slug: PackageManagerId;
|
|
7
|
+
name: string;
|
|
8
|
+
command: string;
|
|
9
|
+
icon: MaterialIcon;
|
|
10
|
+
docs: {
|
|
11
|
+
homepage: string;
|
|
12
|
+
audit: string;
|
|
13
|
+
outdated: string;
|
|
14
|
+
};
|
|
15
|
+
audit: {
|
|
16
|
+
getCommandArgs: (groupDep: DependencyGroup) => string[];
|
|
17
|
+
ignoreExitCode?: boolean;
|
|
18
|
+
supportedDepGroups?: DependencyGroup[];
|
|
19
|
+
unifyResult: (output: string) => AuditResult;
|
|
20
|
+
postProcessResult?: (result: Record<DependencyGroup, AuditResult>) => Record<DependencyGroup, AuditResult>;
|
|
21
|
+
};
|
|
22
|
+
outdated: {
|
|
23
|
+
commandArgs: string[];
|
|
24
|
+
unifyResult: (output: string) => OutdatedResult;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PackageAuditLevel } from '../../config';
|
|
2
|
+
import { DependencyGroupLong } from '../../runner/outdated/types';
|
|
3
|
+
export type Yarnv1AuditAdvisory = {
|
|
4
|
+
type: 'auditAdvisory';
|
|
5
|
+
data: {
|
|
6
|
+
resolution: {
|
|
7
|
+
id: number;
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
advisory: {
|
|
11
|
+
module_name: string;
|
|
12
|
+
severity: PackageAuditLevel;
|
|
13
|
+
vulnerable_versions: string;
|
|
14
|
+
recommendation: string;
|
|
15
|
+
title: string;
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type Yarnv1AuditSummary = {
|
|
21
|
+
type: 'auditSummary';
|
|
22
|
+
data: {
|
|
23
|
+
vulnerabilities: Record<PackageAuditLevel, number>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type Yarnv1AuditResultJson = [
|
|
27
|
+
...Yarnv1AuditAdvisory[],
|
|
28
|
+
Yarnv1AuditSummary
|
|
29
|
+
];
|
|
30
|
+
export type Yarnv1VersionOverview = [
|
|
31
|
+
string,
|
|
32
|
+
string,
|
|
33
|
+
string,
|
|
34
|
+
string,
|
|
35
|
+
string,
|
|
36
|
+
DependencyGroupLong,
|
|
37
|
+
string
|
|
38
|
+
];
|
|
39
|
+
type Yarnv1Info = {
|
|
40
|
+
type: 'info';
|
|
41
|
+
};
|
|
42
|
+
type Yarnv1Table = {
|
|
43
|
+
type: 'table';
|
|
44
|
+
data: {
|
|
45
|
+
body: Yarnv1VersionOverview[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type Yarnv1OutdatedResultJson = [Yarnv1Info, Yarnv1Table];
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PackageAuditLevel } from '../../config';
|
|
2
|
+
import { DependencyGroupLong } from '../../runner/outdated/types';
|
|
3
|
+
export type Yarnv2AuditAdvisory = {
|
|
4
|
+
module_name: string;
|
|
5
|
+
severity: PackageAuditLevel;
|
|
6
|
+
vulnerable_versions: string;
|
|
7
|
+
recommendation: string;
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
findings: {
|
|
11
|
+
paths: string[];
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
export type Yarnv2AuditResultJson = {
|
|
15
|
+
advisories: Record<string, Yarnv2AuditAdvisory>;
|
|
16
|
+
metadata: {
|
|
17
|
+
vulnerabilities: Record<PackageAuditLevel, number>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type Yarnv2VersionOverview = {
|
|
21
|
+
current: string;
|
|
22
|
+
latest: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: DependencyGroupLong;
|
|
25
|
+
};
|
|
26
|
+
export type Yarnv2OutdatedResultJson = Yarnv2VersionOverview[];
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuditResult } from './types';
|
|
1
|
+
import { PackageAuditLevel } from '../../config';
|
|
3
2
|
export declare const auditScoreModifiers: Record<PackageAuditLevel, number>;
|
|
4
|
-
export declare const normalizeAuditMapper: Record<PackageManager, (output: string) => AuditResult>;
|
|
5
|
-
export declare const auditArgs: (groupDep: DependencyGroup) => Record<PackageManager, string[]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AuditOutput, Issue } from '@code-pushup/models';
|
|
2
|
-
import { AuditSeverity, DependencyGroup,
|
|
2
|
+
import { AuditSeverity, DependencyGroup, PackageManagerId } from '../../config';
|
|
3
3
|
import { AuditResult, AuditSummary, Vulnerability } from './types';
|
|
4
|
-
export declare function auditResultToAuditOutput(result: AuditResult,
|
|
4
|
+
export declare function auditResultToAuditOutput(result: AuditResult, id: PackageManagerId, depGroup: DependencyGroup, auditLevelMapping: AuditSeverity): AuditOutput;
|
|
5
5
|
export declare function calculateAuditScore(stats: AuditSummary): number;
|
|
6
6
|
export declare function summaryToDisplayValue(summary: AuditSummary): string;
|
|
7
7
|
export declare function vulnerabilitiesToIssues(vulnerabilities: Vulnerability[], auditLevelMapping: AuditSeverity): Issue[];
|
|
@@ -14,72 +14,3 @@ export type AuditResult = {
|
|
|
14
14
|
vulnerabilities: Vulnerability[];
|
|
15
15
|
summary: AuditSummary;
|
|
16
16
|
};
|
|
17
|
-
export type NpmAdvisory = {
|
|
18
|
-
title: string;
|
|
19
|
-
url: string;
|
|
20
|
-
};
|
|
21
|
-
export type NpmFixInformation = {
|
|
22
|
-
name: string;
|
|
23
|
-
version: string;
|
|
24
|
-
isSemVerMajor: boolean;
|
|
25
|
-
};
|
|
26
|
-
export type NpmVulnerability = {
|
|
27
|
-
name: string;
|
|
28
|
-
severity: PackageAuditLevel;
|
|
29
|
-
isDirect: boolean;
|
|
30
|
-
effects: string[];
|
|
31
|
-
via: NpmAdvisory[] | string[];
|
|
32
|
-
range: string;
|
|
33
|
-
fixAvailable: boolean | NpmFixInformation;
|
|
34
|
-
};
|
|
35
|
-
export type NpmVulnerabilities = Record<string, NpmVulnerability>;
|
|
36
|
-
export type NpmAuditResultJson = {
|
|
37
|
-
vulnerabilities: NpmVulnerabilities;
|
|
38
|
-
metadata: {
|
|
39
|
-
vulnerabilities: AuditSummary;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export type Yarnv1AuditAdvisory = {
|
|
43
|
-
type: 'auditAdvisory';
|
|
44
|
-
data: {
|
|
45
|
-
resolution: {
|
|
46
|
-
id: number;
|
|
47
|
-
path: string;
|
|
48
|
-
};
|
|
49
|
-
advisory: {
|
|
50
|
-
module_name: string;
|
|
51
|
-
severity: PackageAuditLevel;
|
|
52
|
-
vulnerable_versions: string;
|
|
53
|
-
recommendation: string;
|
|
54
|
-
title: string;
|
|
55
|
-
url: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
export type Yarnv1AuditSummary = {
|
|
60
|
-
type: 'auditSummary';
|
|
61
|
-
data: {
|
|
62
|
-
vulnerabilities: Record<PackageAuditLevel, number>;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export type Yarnv1AuditResultJson = [
|
|
66
|
-
...Yarnv1AuditAdvisory[],
|
|
67
|
-
Yarnv1AuditSummary
|
|
68
|
-
];
|
|
69
|
-
export type Yarnv2AuditAdvisory = {
|
|
70
|
-
module_name: string;
|
|
71
|
-
severity: PackageAuditLevel;
|
|
72
|
-
vulnerable_versions: string;
|
|
73
|
-
recommendation: string;
|
|
74
|
-
title: string;
|
|
75
|
-
url: string;
|
|
76
|
-
findings: {
|
|
77
|
-
paths: string[];
|
|
78
|
-
}[];
|
|
79
|
-
};
|
|
80
|
-
export type Yarnv2AuditResultJson = {
|
|
81
|
-
advisories: Record<string, Yarnv2AuditAdvisory>;
|
|
82
|
-
metadata: {
|
|
83
|
-
vulnerabilities: Record<PackageAuditLevel, number>;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { IssueSeverity } from '@code-pushup/models';
|
|
2
|
-
import {
|
|
3
|
-
import { OutdatedResult, VersionType } from './types';
|
|
1
|
+
import type { IssueSeverity } from '@code-pushup/models';
|
|
2
|
+
import { VersionType } from './types';
|
|
4
3
|
export declare const outdatedSeverity: Record<VersionType, IssueSeverity>;
|
|
5
|
-
export declare const outdatedArgs: Record<PackageManager, string[]>;
|
|
6
|
-
export declare const normalizeOutdatedMapper: Record<PackageManager, (output: string) => OutdatedResult>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Issue } from '@code-pushup/models';
|
|
2
|
-
import { DependencyGroup,
|
|
2
|
+
import { DependencyGroup, PackageManagerId } from '../../config';
|
|
3
3
|
import { OutdatedResult, PackageVersion, VersionType } from './types';
|
|
4
|
-
export declare function outdatedResultToAuditOutput(result: OutdatedResult, packageManager:
|
|
4
|
+
export declare function outdatedResultToAuditOutput(result: OutdatedResult, packageManager: PackageManagerId, depGroup: DependencyGroup): {
|
|
5
5
|
details?: {
|
|
6
6
|
issues: {
|
|
7
7
|
message: string;
|
|
@@ -9,40 +9,3 @@ export type OutdatedResult = {
|
|
|
9
9
|
type: DependencyGroupLong;
|
|
10
10
|
url?: string;
|
|
11
11
|
}[];
|
|
12
|
-
export type NpmVersionOverview = {
|
|
13
|
-
current?: string;
|
|
14
|
-
latest: string;
|
|
15
|
-
type: DependencyGroupLong;
|
|
16
|
-
homepage?: string;
|
|
17
|
-
};
|
|
18
|
-
export type NpmNormalizedOverview = Omit<NpmVersionOverview, 'current'> & {
|
|
19
|
-
current: string;
|
|
20
|
-
};
|
|
21
|
-
export type NpmOutdatedResultJson = Record<string, NpmVersionOverview>;
|
|
22
|
-
export type Yarnv1VersionOverview = [
|
|
23
|
-
string,
|
|
24
|
-
string,
|
|
25
|
-
string,
|
|
26
|
-
string,
|
|
27
|
-
string,
|
|
28
|
-
DependencyGroupLong,
|
|
29
|
-
string
|
|
30
|
-
];
|
|
31
|
-
type Yarnv1Info = {
|
|
32
|
-
type: 'info';
|
|
33
|
-
};
|
|
34
|
-
type Yarnv1Table = {
|
|
35
|
-
type: 'table';
|
|
36
|
-
data: {
|
|
37
|
-
body: Yarnv1VersionOverview[];
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export type Yarnv1OutdatedResultJson = [Yarnv1Info, Yarnv1Table];
|
|
41
|
-
export type Yarnv2VersionOverview = {
|
|
42
|
-
current: string;
|
|
43
|
-
latest: string;
|
|
44
|
-
name: string;
|
|
45
|
-
type: DependencyGroupLong;
|
|
46
|
-
};
|
|
47
|
-
export type Yarnv2OutdatedResultJson = Yarnv2VersionOverview[];
|
|
48
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { OutdatedResult } from './types';
|
|
2
|
-
export declare function npmToOutdatedResult(output: string): OutdatedResult;
|
|
3
|
-
export declare function yarnv1ToOutdatedResult(output: string): OutdatedResult;
|
|
4
|
-
export declare function yarnv2ToOutdatedResult(output: string): OutdatedResult;
|