@archlinter/core 0.7.0-canary.5 → 0.8.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/index.d.ts +180 -127
- package/index.js +3 -1
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -5,178 +5,231 @@
|
|
|
5
5
|
|
|
6
6
|
export interface JsScanOptions {
|
|
7
7
|
/** Path to config file */
|
|
8
|
-
configPath?: string
|
|
8
|
+
configPath?: string
|
|
9
9
|
/** Only run these detectors (by ID) */
|
|
10
|
-
detectors?: Array<string
|
|
10
|
+
detectors?: Array<string>
|
|
11
11
|
/** Exclude these detectors (by ID) */
|
|
12
|
-
excludeDetectors?: Array<string
|
|
12
|
+
excludeDetectors?: Array<string>
|
|
13
13
|
/** Minimum severity to report */
|
|
14
|
-
minSeverity?: string
|
|
14
|
+
minSeverity?: string
|
|
15
15
|
/** Minimum score to report */
|
|
16
|
-
minScore?: number
|
|
16
|
+
minScore?: number
|
|
17
17
|
/** Enable caching (default: true) */
|
|
18
|
-
cache?: boolean
|
|
18
|
+
cache?: boolean
|
|
19
19
|
/** Enable git integration (default: true) */
|
|
20
|
-
git?: boolean
|
|
20
|
+
git?: boolean
|
|
21
21
|
/** Git history analysis period (e.g. "90d", "1y", "all") */
|
|
22
|
-
gitHistoryPeriod?: string
|
|
22
|
+
gitHistoryPeriod?: string
|
|
23
23
|
}
|
|
24
24
|
export interface JsScanResult {
|
|
25
|
-
smells: Array<JsSmellWithExplanation
|
|
26
|
-
summary: JsSummary
|
|
27
|
-
files: Array<JsFileInfo
|
|
28
|
-
grade: JsArchitectureGrade
|
|
29
|
-
projectPath: string
|
|
25
|
+
smells: Array<JsSmellWithExplanation>
|
|
26
|
+
summary: JsSummary
|
|
27
|
+
files: Array<JsFileInfo>
|
|
28
|
+
grade: JsArchitectureGrade
|
|
29
|
+
projectPath: string
|
|
30
30
|
}
|
|
31
31
|
export interface JsIncrementalResult {
|
|
32
|
-
smells: Array<JsSmellWithExplanation
|
|
33
|
-
affectedFiles: Array<string
|
|
34
|
-
changedCount: number
|
|
35
|
-
affectedCount: number
|
|
36
|
-
analysisTimeMs: number
|
|
32
|
+
smells: Array<JsSmellWithExplanation>
|
|
33
|
+
affectedFiles: Array<string>
|
|
34
|
+
changedCount: number
|
|
35
|
+
affectedCount: number
|
|
36
|
+
analysisTimeMs: number
|
|
37
37
|
}
|
|
38
38
|
export interface JsSmellWithExplanation {
|
|
39
|
-
smell: JsSmell
|
|
40
|
-
explanation: JsExplanation
|
|
39
|
+
smell: JsSmell
|
|
40
|
+
explanation: JsExplanation
|
|
41
41
|
}
|
|
42
42
|
export interface JsSmell {
|
|
43
|
-
smellType: string
|
|
44
|
-
severity: string
|
|
45
|
-
files: Array<string
|
|
46
|
-
locations: Array<JsLocationDetail
|
|
43
|
+
smellType: string
|
|
44
|
+
severity: string
|
|
45
|
+
files: Array<string>
|
|
46
|
+
locations: Array<JsLocationDetail>
|
|
47
47
|
/** Additional metrics as JSON */
|
|
48
|
-
metrics: Record<string, unknown
|
|
49
|
-
cluster?: JsCycleCluster
|
|
48
|
+
metrics: Record<string, unknown>
|
|
49
|
+
cluster?: JsCycleCluster
|
|
50
50
|
}
|
|
51
51
|
export interface JsLocationDetail {
|
|
52
|
-
file: string
|
|
53
|
-
line: number
|
|
54
|
-
column?: number
|
|
55
|
-
range?: JsCodeRange
|
|
56
|
-
description: string
|
|
52
|
+
file: string
|
|
53
|
+
line: number
|
|
54
|
+
column?: number
|
|
55
|
+
range?: JsCodeRange
|
|
56
|
+
description: string
|
|
57
57
|
}
|
|
58
58
|
export interface JsCodeRange {
|
|
59
|
-
startLine: number
|
|
60
|
-
startColumn: number
|
|
61
|
-
endLine: number
|
|
62
|
-
endColumn: number
|
|
59
|
+
startLine: number
|
|
60
|
+
startColumn: number
|
|
61
|
+
endLine: number
|
|
62
|
+
endColumn: number
|
|
63
63
|
}
|
|
64
64
|
export interface JsExplanation {
|
|
65
|
-
problem: string
|
|
66
|
-
reason: string
|
|
67
|
-
risks: Array<string
|
|
68
|
-
recommendations: Array<string
|
|
65
|
+
problem: string
|
|
66
|
+
reason: string
|
|
67
|
+
risks: Array<string>
|
|
68
|
+
recommendations: Array<string>
|
|
69
69
|
}
|
|
70
70
|
export interface JsSummary {
|
|
71
|
-
filesAnalyzed: number
|
|
72
|
-
totalSmells: number
|
|
73
|
-
cyclicDependencies: number
|
|
74
|
-
cycleClusters: number
|
|
75
|
-
filesInCycles: number
|
|
76
|
-
godModules: number
|
|
77
|
-
deadCode: number
|
|
78
|
-
deadSymbols: number
|
|
79
|
-
highComplexityFunctions: number
|
|
80
|
-
unstableInterfaces: number
|
|
81
|
-
featureEnvy: number
|
|
82
|
-
shotgunSurgery: number
|
|
83
|
-
hubDependencies: number
|
|
71
|
+
filesAnalyzed: number
|
|
72
|
+
totalSmells: number
|
|
73
|
+
cyclicDependencies: number
|
|
74
|
+
cycleClusters: number
|
|
75
|
+
filesInCycles: number
|
|
76
|
+
godModules: number
|
|
77
|
+
deadCode: number
|
|
78
|
+
deadSymbols: number
|
|
79
|
+
highComplexityFunctions: number
|
|
80
|
+
unstableInterfaces: number
|
|
81
|
+
featureEnvy: number
|
|
82
|
+
shotgunSurgery: number
|
|
83
|
+
hubDependencies: number
|
|
84
84
|
}
|
|
85
85
|
export interface JsArchitectureGrade {
|
|
86
|
-
score: number
|
|
87
|
-
level: string
|
|
88
|
-
density: number
|
|
86
|
+
score: number
|
|
87
|
+
level: string
|
|
88
|
+
density: number
|
|
89
89
|
}
|
|
90
90
|
export interface JsFileInfo {
|
|
91
|
-
path: string
|
|
92
|
-
relativePath: string
|
|
93
|
-
imports: Array<JsImportInfo
|
|
94
|
-
exports: Array<JsExportInfo
|
|
95
|
-
metrics: JsFileMetrics
|
|
91
|
+
path: string
|
|
92
|
+
relativePath: string
|
|
93
|
+
imports: Array<JsImportInfo>
|
|
94
|
+
exports: Array<JsExportInfo>
|
|
95
|
+
metrics: JsFileMetrics
|
|
96
96
|
}
|
|
97
97
|
export interface JsImportInfo {
|
|
98
|
-
source: string
|
|
99
|
-
names: Array<string
|
|
100
|
-
line: number
|
|
101
|
-
isDefault: boolean
|
|
102
|
-
isNamespace: boolean
|
|
98
|
+
source: string
|
|
99
|
+
names: Array<string>
|
|
100
|
+
line: number
|
|
101
|
+
isDefault: boolean
|
|
102
|
+
isNamespace: boolean
|
|
103
103
|
}
|
|
104
104
|
export interface JsExportInfo {
|
|
105
|
-
name: string
|
|
106
|
-
kind: string
|
|
107
|
-
isDefault: boolean
|
|
108
|
-
source?: string
|
|
105
|
+
name: string
|
|
106
|
+
kind: string
|
|
107
|
+
isDefault: boolean
|
|
108
|
+
source?: string
|
|
109
109
|
}
|
|
110
110
|
export interface JsFileMetrics {
|
|
111
|
-
lines: number
|
|
112
|
-
complexity?: number
|
|
113
|
-
fanIn: number
|
|
114
|
-
fanOut: number
|
|
111
|
+
lines: number
|
|
112
|
+
complexity?: number
|
|
113
|
+
fanIn: number
|
|
114
|
+
fanOut: number
|
|
115
115
|
}
|
|
116
116
|
export interface JsCycleCluster {
|
|
117
|
-
files: Array<string
|
|
118
|
-
hotspots: Array<JsCycleHotspot
|
|
119
|
-
criticalEdges: Array<JsCriticalEdge
|
|
117
|
+
files: Array<string>
|
|
118
|
+
hotspots: Array<JsCycleHotspot>
|
|
119
|
+
criticalEdges: Array<JsCriticalEdge>
|
|
120
120
|
}
|
|
121
121
|
export interface JsCycleHotspot {
|
|
122
|
-
file: string
|
|
123
|
-
inDegree: number
|
|
124
|
-
outDegree: number
|
|
122
|
+
file: string
|
|
123
|
+
inDegree: number
|
|
124
|
+
outDegree: number
|
|
125
125
|
}
|
|
126
126
|
export interface JsCriticalEdge {
|
|
127
|
-
from: string
|
|
128
|
-
to: string
|
|
129
|
-
line: number
|
|
130
|
-
range?: JsCodeRange
|
|
131
|
-
impact: string
|
|
127
|
+
from: string
|
|
128
|
+
to: string
|
|
129
|
+
line: number
|
|
130
|
+
range?: JsCodeRange
|
|
131
|
+
impact: string
|
|
132
132
|
}
|
|
133
133
|
export interface JsDetectorInfo {
|
|
134
|
-
id: string
|
|
135
|
-
name: string
|
|
136
|
-
description: string
|
|
137
|
-
defaultEnabled: boolean
|
|
138
|
-
isDeep: boolean
|
|
134
|
+
id: string
|
|
135
|
+
name: string
|
|
136
|
+
description: string
|
|
137
|
+
defaultEnabled: boolean
|
|
138
|
+
isDeep: boolean
|
|
139
139
|
}
|
|
140
140
|
export interface JsConfig {
|
|
141
|
-
ignore: Array<string
|
|
142
|
-
aliases: Record<string, string
|
|
143
|
-
thresholds: Record<string, unknown
|
|
144
|
-
entryPoints: Array<string
|
|
145
|
-
enableGit: boolean
|
|
141
|
+
ignore: Array<string>
|
|
142
|
+
aliases: Record<string, string>
|
|
143
|
+
thresholds: Record<string, unknown>
|
|
144
|
+
entryPoints: Array<string>
|
|
145
|
+
enableGit: boolean
|
|
146
146
|
}
|
|
147
147
|
export interface JsStateStats {
|
|
148
|
-
filesCount: number
|
|
149
|
-
graphNodes: number
|
|
150
|
-
graphEdges: number
|
|
151
|
-
}
|
|
152
|
-
export
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
filesCount: number
|
|
149
|
+
graphNodes: number
|
|
150
|
+
graphEdges: number
|
|
151
|
+
}
|
|
152
|
+
export interface JsDiffOptions {
|
|
153
|
+
baselinePath: string
|
|
154
|
+
projectPath: string
|
|
155
|
+
currentPath?: string
|
|
156
|
+
}
|
|
157
|
+
export interface JsDiffResult {
|
|
158
|
+
hasRegressions: boolean
|
|
159
|
+
regressions: Array<JsRegression>
|
|
160
|
+
improvements: Array<JsImprovement>
|
|
161
|
+
summary: JsDiffSummary
|
|
162
|
+
baselineCommit?: string
|
|
163
|
+
currentCommit?: string
|
|
164
|
+
}
|
|
165
|
+
export interface JsRegression {
|
|
166
|
+
id: string
|
|
167
|
+
regressionType: JsRegressionType
|
|
168
|
+
smell: JsSnapshotSmell
|
|
169
|
+
message: string
|
|
170
|
+
explain?: JsExplainBlock
|
|
171
|
+
}
|
|
172
|
+
export interface JsRegressionType {
|
|
173
|
+
type: string
|
|
174
|
+
from?: string
|
|
175
|
+
to?: string
|
|
176
|
+
metric?: string
|
|
177
|
+
fromVal?: number
|
|
178
|
+
toVal?: number
|
|
179
|
+
changePercent?: number
|
|
180
|
+
}
|
|
181
|
+
export interface JsImprovement {
|
|
182
|
+
id: string
|
|
183
|
+
improvementType: JsImprovementType
|
|
184
|
+
message: string
|
|
185
|
+
}
|
|
186
|
+
export interface JsImprovementType {
|
|
187
|
+
type: string
|
|
188
|
+
from?: string
|
|
189
|
+
to?: string
|
|
190
|
+
metric?: string
|
|
191
|
+
fromVal?: number
|
|
192
|
+
toVal?: number
|
|
193
|
+
}
|
|
194
|
+
export interface JsDiffSummary {
|
|
195
|
+
newSmells: number
|
|
196
|
+
fixedSmells: number
|
|
197
|
+
worsenedSmells: number
|
|
198
|
+
improvedSmells: number
|
|
199
|
+
totalRegressions: number
|
|
200
|
+
totalImprovements: number
|
|
201
|
+
}
|
|
202
|
+
export interface JsExplainBlock {
|
|
203
|
+
whyBad: string
|
|
204
|
+
consequences: string
|
|
205
|
+
howToFix: string
|
|
206
|
+
}
|
|
207
|
+
export interface JsSnapshotSmell {
|
|
208
|
+
id: string
|
|
209
|
+
smellType: string
|
|
210
|
+
severity: string
|
|
211
|
+
files: Array<string>
|
|
212
|
+
metrics: Record<string, unknown>
|
|
213
|
+
details?: unknown
|
|
214
|
+
}
|
|
215
|
+
export declare function runDiff(options: JsDiffOptions): JsDiffResult
|
|
216
|
+
export declare function runDiffAsync(options: JsDiffOptions): Promise<JsDiffResult>
|
|
217
|
+
export declare function scan(path: string, options?: JsScanOptions | undefined | null): Promise<JsScanResult>
|
|
218
|
+
export declare function scanSync(path: string, options?: JsScanOptions | undefined | null): JsScanResult
|
|
219
|
+
export declare function loadConfig(path?: string | undefined | null): JsConfig
|
|
220
|
+
export declare function getDetectors(): Array<JsDetectorInfo>
|
|
221
|
+
export declare function clearCache(path: string): void
|
|
163
222
|
export declare class ArchlintAnalyzer {
|
|
164
|
-
constructor(path: string, options?: JsScanOptions | undefined | null)
|
|
165
|
-
scan(): Promise<JsScanResult
|
|
166
|
-
scanIncremental(changedFiles: Array<string>): Promise<JsIncrementalResult
|
|
167
|
-
scanSync(): JsScanResult
|
|
168
|
-
scanIncrementalSync(changedFiles: Array<string>): JsIncrementalResult
|
|
169
|
-
scanIncrementalWithOverlaySync(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
):
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
): Promise<JsIncrementalResult>;
|
|
177
|
-
invalidate(files: Array<string>): void;
|
|
178
|
-
rescan(): Promise<JsScanResult>;
|
|
179
|
-
rescanSync(): JsScanResult;
|
|
180
|
-
getAffectedFiles(changedFiles: Array<string>): Array<string>;
|
|
181
|
-
getStateStats(): JsStateStats;
|
|
223
|
+
constructor(path: string, options?: JsScanOptions | undefined | null)
|
|
224
|
+
scan(): Promise<JsScanResult>
|
|
225
|
+
scanIncremental(changedFiles: Array<string>): Promise<JsIncrementalResult>
|
|
226
|
+
scanSync(): JsScanResult
|
|
227
|
+
scanIncrementalSync(changedFiles: Array<string>): JsIncrementalResult
|
|
228
|
+
scanIncrementalWithOverlaySync(changedFiles: Array<string>, overlays: Record<string, string>): JsIncrementalResult
|
|
229
|
+
scanIncrementalWithOverlay(changedFiles: Array<string>, overlays: Record<string, string>): Promise<JsIncrementalResult>
|
|
230
|
+
invalidate(files: Array<string>): void
|
|
231
|
+
rescan(): Promise<JsScanResult>
|
|
232
|
+
rescanSync(): JsScanResult
|
|
233
|
+
getAffectedFiles(changedFiles: Array<string>): Array<string>
|
|
234
|
+
getStateStats(): JsStateStats
|
|
182
235
|
}
|
package/index.js
CHANGED
|
@@ -310,8 +310,10 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { scan, scanSync, loadConfig, getDetectors, clearCache, ArchlintAnalyzer } = nativeBinding
|
|
313
|
+
const { runDiff, runDiffAsync, scan, scanSync, loadConfig, getDetectors, clearCache, ArchlintAnalyzer } = nativeBinding
|
|
314
314
|
|
|
315
|
+
module.exports.runDiff = runDiff
|
|
316
|
+
module.exports.runDiffAsync = runDiffAsync
|
|
315
317
|
module.exports.scan = scan
|
|
316
318
|
module.exports.scanSync = scanSync
|
|
317
319
|
module.exports.loadConfig = loadConfig
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archlinter/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Core library for archlint - programmatic API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@archlinter/core-win32-x64-msvc": "0.
|
|
31
|
-
"@archlinter/core-darwin-x64": "0.
|
|
32
|
-
"@archlinter/core-linux-x64-gnu": "0.
|
|
33
|
-
"@archlinter/core-linux-x64-musl": "0.
|
|
34
|
-
"@archlinter/core-linux-arm64-gnu": "0.
|
|
35
|
-
"@archlinter/core-darwin-arm64": "0.
|
|
30
|
+
"@archlinter/core-win32-x64-msvc": "0.8.0",
|
|
31
|
+
"@archlinter/core-darwin-x64": "0.8.0",
|
|
32
|
+
"@archlinter/core-linux-x64-gnu": "0.8.0",
|
|
33
|
+
"@archlinter/core-linux-x64-musl": "0.8.0",
|
|
34
|
+
"@archlinter/core-linux-arm64-gnu": "0.8.0",
|
|
35
|
+
"@archlinter/core-darwin-arm64": "0.8.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18"
|