@archlinter/core 0.5.0 → 0.6.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 +120 -100
- package/index.js +140 -113
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -5,144 +5,164 @@
|
|
|
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
|
}
|
|
22
22
|
export interface JsScanResult {
|
|
23
|
-
smells: Array<JsSmellWithExplanation
|
|
24
|
-
summary: JsSummary
|
|
25
|
-
files: Array<JsFileInfo
|
|
26
|
-
grade: JsArchitectureGrade
|
|
27
|
-
projectPath: string
|
|
23
|
+
smells: Array<JsSmellWithExplanation>
|
|
24
|
+
summary: JsSummary
|
|
25
|
+
files: Array<JsFileInfo>
|
|
26
|
+
grade: JsArchitectureGrade
|
|
27
|
+
projectPath: string
|
|
28
|
+
}
|
|
29
|
+
export interface JsIncrementalResult {
|
|
30
|
+
smells: Array<JsSmellWithExplanation>
|
|
31
|
+
affectedFiles: Array<string>
|
|
32
|
+
changedCount: number
|
|
33
|
+
affectedCount: number
|
|
34
|
+
analysisTimeMs: number
|
|
28
35
|
}
|
|
29
36
|
export interface JsSmellWithExplanation {
|
|
30
|
-
smell: JsSmell
|
|
31
|
-
explanation: JsExplanation
|
|
37
|
+
smell: JsSmell
|
|
38
|
+
explanation: JsExplanation
|
|
32
39
|
}
|
|
33
40
|
export interface JsSmell {
|
|
34
|
-
smellType: string
|
|
35
|
-
severity: string
|
|
36
|
-
files: Array<string
|
|
37
|
-
locations: Array<JsLocationDetail
|
|
41
|
+
smellType: string
|
|
42
|
+
severity: string
|
|
43
|
+
files: Array<string>
|
|
44
|
+
locations: Array<JsLocationDetail>
|
|
38
45
|
/** Additional metrics as JSON */
|
|
39
|
-
metrics: Record<string, unknown
|
|
40
|
-
cluster?: JsCycleCluster
|
|
46
|
+
metrics: Record<string, unknown>
|
|
47
|
+
cluster?: JsCycleCluster
|
|
41
48
|
}
|
|
42
49
|
export interface JsLocationDetail {
|
|
43
|
-
file: string
|
|
44
|
-
line: number
|
|
45
|
-
column?: number
|
|
46
|
-
range?: JsCodeRange
|
|
47
|
-
description: string
|
|
50
|
+
file: string
|
|
51
|
+
line: number
|
|
52
|
+
column?: number
|
|
53
|
+
range?: JsCodeRange
|
|
54
|
+
description: string
|
|
48
55
|
}
|
|
49
56
|
export interface JsCodeRange {
|
|
50
|
-
startLine: number
|
|
51
|
-
startColumn: number
|
|
52
|
-
endLine: number
|
|
53
|
-
endColumn: number
|
|
57
|
+
startLine: number
|
|
58
|
+
startColumn: number
|
|
59
|
+
endLine: number
|
|
60
|
+
endColumn: number
|
|
54
61
|
}
|
|
55
62
|
export interface JsExplanation {
|
|
56
|
-
problem: string
|
|
57
|
-
reason: string
|
|
58
|
-
risks: Array<string
|
|
59
|
-
recommendations: Array<string
|
|
63
|
+
problem: string
|
|
64
|
+
reason: string
|
|
65
|
+
risks: Array<string>
|
|
66
|
+
recommendations: Array<string>
|
|
60
67
|
}
|
|
61
68
|
export interface JsSummary {
|
|
62
|
-
filesAnalyzed: number
|
|
63
|
-
totalSmells: number
|
|
64
|
-
cyclicDependencies: number
|
|
65
|
-
cycleClusters: number
|
|
66
|
-
filesInCycles: number
|
|
67
|
-
godModules: number
|
|
68
|
-
deadCode: number
|
|
69
|
-
deadSymbols: number
|
|
70
|
-
highComplexityFunctions: number
|
|
71
|
-
unstableInterfaces: number
|
|
72
|
-
featureEnvy: number
|
|
73
|
-
shotgunSurgery: number
|
|
74
|
-
hubDependencies: number
|
|
69
|
+
filesAnalyzed: number
|
|
70
|
+
totalSmells: number
|
|
71
|
+
cyclicDependencies: number
|
|
72
|
+
cycleClusters: number
|
|
73
|
+
filesInCycles: number
|
|
74
|
+
godModules: number
|
|
75
|
+
deadCode: number
|
|
76
|
+
deadSymbols: number
|
|
77
|
+
highComplexityFunctions: number
|
|
78
|
+
unstableInterfaces: number
|
|
79
|
+
featureEnvy: number
|
|
80
|
+
shotgunSurgery: number
|
|
81
|
+
hubDependencies: number
|
|
75
82
|
}
|
|
76
83
|
export interface JsArchitectureGrade {
|
|
77
|
-
score: number
|
|
78
|
-
level: string
|
|
79
|
-
density: number
|
|
84
|
+
score: number
|
|
85
|
+
level: string
|
|
86
|
+
density: number
|
|
80
87
|
}
|
|
81
88
|
export interface JsFileInfo {
|
|
82
|
-
path: string
|
|
83
|
-
relativePath: string
|
|
84
|
-
imports: Array<JsImportInfo
|
|
85
|
-
exports: Array<JsExportInfo
|
|
86
|
-
metrics: JsFileMetrics
|
|
89
|
+
path: string
|
|
90
|
+
relativePath: string
|
|
91
|
+
imports: Array<JsImportInfo>
|
|
92
|
+
exports: Array<JsExportInfo>
|
|
93
|
+
metrics: JsFileMetrics
|
|
87
94
|
}
|
|
88
95
|
export interface JsImportInfo {
|
|
89
|
-
source: string
|
|
90
|
-
names: Array<string
|
|
91
|
-
line: number
|
|
92
|
-
isDefault: boolean
|
|
93
|
-
isNamespace: boolean
|
|
96
|
+
source: string
|
|
97
|
+
names: Array<string>
|
|
98
|
+
line: number
|
|
99
|
+
isDefault: boolean
|
|
100
|
+
isNamespace: boolean
|
|
94
101
|
}
|
|
95
102
|
export interface JsExportInfo {
|
|
96
|
-
name: string
|
|
97
|
-
kind: string
|
|
98
|
-
isDefault: boolean
|
|
99
|
-
source?: string
|
|
103
|
+
name: string
|
|
104
|
+
kind: string
|
|
105
|
+
isDefault: boolean
|
|
106
|
+
source?: string
|
|
100
107
|
}
|
|
101
108
|
export interface JsFileMetrics {
|
|
102
|
-
lines: number
|
|
103
|
-
complexity?: number
|
|
104
|
-
fanIn: number
|
|
105
|
-
fanOut: number
|
|
109
|
+
lines: number
|
|
110
|
+
complexity?: number
|
|
111
|
+
fanIn: number
|
|
112
|
+
fanOut: number
|
|
106
113
|
}
|
|
107
114
|
export interface JsCycleCluster {
|
|
108
|
-
files: Array<string
|
|
109
|
-
hotspots: Array<JsCycleHotspot
|
|
110
|
-
criticalEdges: Array<JsCriticalEdge
|
|
115
|
+
files: Array<string>
|
|
116
|
+
hotspots: Array<JsCycleHotspot>
|
|
117
|
+
criticalEdges: Array<JsCriticalEdge>
|
|
111
118
|
}
|
|
112
119
|
export interface JsCycleHotspot {
|
|
113
|
-
file: string
|
|
114
|
-
inDegree: number
|
|
115
|
-
outDegree: number
|
|
120
|
+
file: string
|
|
121
|
+
inDegree: number
|
|
122
|
+
outDegree: number
|
|
116
123
|
}
|
|
117
124
|
export interface JsCriticalEdge {
|
|
118
|
-
from: string
|
|
119
|
-
to: string
|
|
120
|
-
line: number
|
|
121
|
-
range?: JsCodeRange
|
|
122
|
-
impact: string
|
|
125
|
+
from: string
|
|
126
|
+
to: string
|
|
127
|
+
line: number
|
|
128
|
+
range?: JsCodeRange
|
|
129
|
+
impact: string
|
|
123
130
|
}
|
|
124
131
|
export interface JsDetectorInfo {
|
|
125
|
-
id: string
|
|
126
|
-
name: string
|
|
127
|
-
description: string
|
|
128
|
-
defaultEnabled: boolean
|
|
129
|
-
isDeep: boolean
|
|
132
|
+
id: string
|
|
133
|
+
name: string
|
|
134
|
+
description: string
|
|
135
|
+
defaultEnabled: boolean
|
|
136
|
+
isDeep: boolean
|
|
130
137
|
}
|
|
131
138
|
export interface JsConfig {
|
|
132
|
-
ignore: Array<string
|
|
133
|
-
aliases: Record<string, string
|
|
134
|
-
thresholds: Record<string, unknown
|
|
135
|
-
entryPoints: Array<string
|
|
136
|
-
enableGit: boolean
|
|
137
|
-
}
|
|
138
|
-
export
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
):
|
|
146
|
-
export declare function
|
|
147
|
-
export declare function
|
|
148
|
-
export declare
|
|
139
|
+
ignore: Array<string>
|
|
140
|
+
aliases: Record<string, string>
|
|
141
|
+
thresholds: Record<string, unknown>
|
|
142
|
+
entryPoints: Array<string>
|
|
143
|
+
enableGit: boolean
|
|
144
|
+
}
|
|
145
|
+
export interface JsStateStats {
|
|
146
|
+
filesCount: number
|
|
147
|
+
graphNodes: number
|
|
148
|
+
graphEdges: number
|
|
149
|
+
}
|
|
150
|
+
export declare function scan(path: string, options?: JsScanOptions | undefined | null): Promise<JsScanResult>
|
|
151
|
+
export declare function scanSync(path: string, options?: JsScanOptions | undefined | null): JsScanResult
|
|
152
|
+
export declare function loadConfig(path?: string | undefined | null): JsConfig
|
|
153
|
+
export declare function getDetectors(): Array<JsDetectorInfo>
|
|
154
|
+
export declare function clearCache(path: string): void
|
|
155
|
+
export declare class ArchlintAnalyzer {
|
|
156
|
+
constructor(path: string, options?: JsScanOptions | undefined | null)
|
|
157
|
+
scan(): Promise<JsScanResult>
|
|
158
|
+
scanIncremental(changedFiles: Array<string>): Promise<JsIncrementalResult>
|
|
159
|
+
scanSync(): JsScanResult
|
|
160
|
+
scanIncrementalSync(changedFiles: Array<string>): JsIncrementalResult
|
|
161
|
+
scanIncrementalWithOverlaySync(changedFiles: Array<string>, overlays: Record<string, string>): JsIncrementalResult
|
|
162
|
+
scanIncrementalWithOverlay(changedFiles: Array<string>, overlays: Record<string, string>): Promise<JsIncrementalResult>
|
|
163
|
+
invalidate(files: Array<string>): void
|
|
164
|
+
rescan(): Promise<JsScanResult>
|
|
165
|
+
rescanSync(): JsScanResult
|
|
166
|
+
getAffectedFiles(changedFiles: Array<string>): Array<string>
|
|
167
|
+
getStateStats(): JsStateStats
|
|
168
|
+
}
|
package/index.js
CHANGED
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
/* auto-generated by NAPI-RS */
|
|
6
6
|
|
|
7
7
|
const { existsSync, readFileSync } = require('fs')
|
|
8
|
-
const { join } = require('path')
|
|
8
|
+
const { join } = require('path')
|
|
9
9
|
|
|
10
|
-
const { platform, arch } = process
|
|
10
|
+
const { platform, arch } = process
|
|
11
11
|
|
|
12
|
-
let nativeBinding = null
|
|
13
|
-
let localFileExisted = false
|
|
14
|
-
let loadError = null
|
|
12
|
+
let nativeBinding = null
|
|
13
|
+
let localFileExisted = false
|
|
14
|
+
let loadError = null
|
|
15
15
|
|
|
16
16
|
function isMusl() {
|
|
17
17
|
// For Node 10
|
|
18
18
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
19
|
try {
|
|
20
|
-
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
-
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
22
22
|
} catch (e) {
|
|
23
|
-
return true
|
|
23
|
+
return true
|
|
24
24
|
}
|
|
25
25
|
} else {
|
|
26
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
-
return !glibcVersionRuntime
|
|
26
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
+
return !glibcVersionRuntime
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -32,262 +32,289 @@ switch (platform) {
|
|
|
32
32
|
case 'android':
|
|
33
33
|
switch (arch) {
|
|
34
34
|
case 'arm64':
|
|
35
|
-
localFileExisted = existsSync(join(__dirname, 'archlint.android-arm64.node'))
|
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'archlint.android-arm64.node'))
|
|
36
36
|
try {
|
|
37
37
|
if (localFileExisted) {
|
|
38
|
-
nativeBinding = require('./archlint.android-arm64.node')
|
|
38
|
+
nativeBinding = require('./archlint.android-arm64.node')
|
|
39
39
|
} else {
|
|
40
|
-
nativeBinding = require('@archlinter/core-android-arm64')
|
|
40
|
+
nativeBinding = require('@archlinter/core-android-arm64')
|
|
41
41
|
}
|
|
42
42
|
} catch (e) {
|
|
43
|
-
loadError = e
|
|
43
|
+
loadError = e
|
|
44
44
|
}
|
|
45
|
-
break
|
|
45
|
+
break
|
|
46
46
|
case 'arm':
|
|
47
|
-
localFileExisted = existsSync(join(__dirname, 'archlint.android-arm-eabi.node'))
|
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'archlint.android-arm-eabi.node'))
|
|
48
48
|
try {
|
|
49
49
|
if (localFileExisted) {
|
|
50
|
-
nativeBinding = require('./archlint.android-arm-eabi.node')
|
|
50
|
+
nativeBinding = require('./archlint.android-arm-eabi.node')
|
|
51
51
|
} else {
|
|
52
|
-
nativeBinding = require('@archlinter/core-android-arm-eabi')
|
|
52
|
+
nativeBinding = require('@archlinter/core-android-arm-eabi')
|
|
53
53
|
}
|
|
54
54
|
} catch (e) {
|
|
55
|
-
loadError = e
|
|
55
|
+
loadError = e
|
|
56
56
|
}
|
|
57
|
-
break
|
|
57
|
+
break
|
|
58
58
|
default:
|
|
59
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
59
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
60
60
|
}
|
|
61
|
-
break
|
|
61
|
+
break
|
|
62
62
|
case 'win32':
|
|
63
63
|
switch (arch) {
|
|
64
64
|
case 'x64':
|
|
65
|
-
localFileExisted = existsSync(
|
|
65
|
+
localFileExisted = existsSync(
|
|
66
|
+
join(__dirname, 'archlint.win32-x64-msvc.node')
|
|
67
|
+
)
|
|
66
68
|
try {
|
|
67
69
|
if (localFileExisted) {
|
|
68
|
-
nativeBinding = require('./archlint.win32-x64-msvc.node')
|
|
70
|
+
nativeBinding = require('./archlint.win32-x64-msvc.node')
|
|
69
71
|
} else {
|
|
70
|
-
nativeBinding = require('@archlinter/core-win32-x64-msvc')
|
|
72
|
+
nativeBinding = require('@archlinter/core-win32-x64-msvc')
|
|
71
73
|
}
|
|
72
74
|
} catch (e) {
|
|
73
|
-
loadError = e
|
|
75
|
+
loadError = e
|
|
74
76
|
}
|
|
75
|
-
break
|
|
77
|
+
break
|
|
76
78
|
case 'ia32':
|
|
77
|
-
localFileExisted = existsSync(
|
|
79
|
+
localFileExisted = existsSync(
|
|
80
|
+
join(__dirname, 'archlint.win32-ia32-msvc.node')
|
|
81
|
+
)
|
|
78
82
|
try {
|
|
79
83
|
if (localFileExisted) {
|
|
80
|
-
nativeBinding = require('./archlint.win32-ia32-msvc.node')
|
|
84
|
+
nativeBinding = require('./archlint.win32-ia32-msvc.node')
|
|
81
85
|
} else {
|
|
82
|
-
nativeBinding = require('@archlinter/core-win32-ia32-msvc')
|
|
86
|
+
nativeBinding = require('@archlinter/core-win32-ia32-msvc')
|
|
83
87
|
}
|
|
84
88
|
} catch (e) {
|
|
85
|
-
loadError = e
|
|
89
|
+
loadError = e
|
|
86
90
|
}
|
|
87
|
-
break
|
|
91
|
+
break
|
|
88
92
|
case 'arm64':
|
|
89
|
-
localFileExisted = existsSync(
|
|
93
|
+
localFileExisted = existsSync(
|
|
94
|
+
join(__dirname, 'archlint.win32-arm64-msvc.node')
|
|
95
|
+
)
|
|
90
96
|
try {
|
|
91
97
|
if (localFileExisted) {
|
|
92
|
-
nativeBinding = require('./archlint.win32-arm64-msvc.node')
|
|
98
|
+
nativeBinding = require('./archlint.win32-arm64-msvc.node')
|
|
93
99
|
} else {
|
|
94
|
-
nativeBinding = require('@archlinter/core-win32-arm64-msvc')
|
|
100
|
+
nativeBinding = require('@archlinter/core-win32-arm64-msvc')
|
|
95
101
|
}
|
|
96
102
|
} catch (e) {
|
|
97
|
-
loadError = e
|
|
103
|
+
loadError = e
|
|
98
104
|
}
|
|
99
|
-
break
|
|
105
|
+
break
|
|
100
106
|
default:
|
|
101
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
107
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
102
108
|
}
|
|
103
|
-
break
|
|
109
|
+
break
|
|
104
110
|
case 'darwin':
|
|
105
|
-
localFileExisted = existsSync(join(__dirname, 'archlint.darwin-universal.node'))
|
|
111
|
+
localFileExisted = existsSync(join(__dirname, 'archlint.darwin-universal.node'))
|
|
106
112
|
try {
|
|
107
113
|
if (localFileExisted) {
|
|
108
|
-
nativeBinding = require('./archlint.darwin-universal.node')
|
|
114
|
+
nativeBinding = require('./archlint.darwin-universal.node')
|
|
109
115
|
} else {
|
|
110
|
-
nativeBinding = require('@archlinter/core-darwin-universal')
|
|
116
|
+
nativeBinding = require('@archlinter/core-darwin-universal')
|
|
111
117
|
}
|
|
112
|
-
break
|
|
118
|
+
break
|
|
113
119
|
} catch {}
|
|
114
120
|
switch (arch) {
|
|
115
121
|
case 'x64':
|
|
116
|
-
localFileExisted = existsSync(join(__dirname, 'archlint.darwin-x64.node'))
|
|
122
|
+
localFileExisted = existsSync(join(__dirname, 'archlint.darwin-x64.node'))
|
|
117
123
|
try {
|
|
118
124
|
if (localFileExisted) {
|
|
119
|
-
nativeBinding = require('./archlint.darwin-x64.node')
|
|
125
|
+
nativeBinding = require('./archlint.darwin-x64.node')
|
|
120
126
|
} else {
|
|
121
|
-
nativeBinding = require('@archlinter/core-darwin-x64')
|
|
127
|
+
nativeBinding = require('@archlinter/core-darwin-x64')
|
|
122
128
|
}
|
|
123
129
|
} catch (e) {
|
|
124
|
-
loadError = e
|
|
130
|
+
loadError = e
|
|
125
131
|
}
|
|
126
|
-
break
|
|
132
|
+
break
|
|
127
133
|
case 'arm64':
|
|
128
|
-
localFileExisted = existsSync(
|
|
134
|
+
localFileExisted = existsSync(
|
|
135
|
+
join(__dirname, 'archlint.darwin-arm64.node')
|
|
136
|
+
)
|
|
129
137
|
try {
|
|
130
138
|
if (localFileExisted) {
|
|
131
|
-
nativeBinding = require('./archlint.darwin-arm64.node')
|
|
139
|
+
nativeBinding = require('./archlint.darwin-arm64.node')
|
|
132
140
|
} else {
|
|
133
|
-
nativeBinding = require('@archlinter/core-darwin-arm64')
|
|
141
|
+
nativeBinding = require('@archlinter/core-darwin-arm64')
|
|
134
142
|
}
|
|
135
143
|
} catch (e) {
|
|
136
|
-
loadError = e
|
|
144
|
+
loadError = e
|
|
137
145
|
}
|
|
138
|
-
break
|
|
146
|
+
break
|
|
139
147
|
default:
|
|
140
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
148
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
141
149
|
}
|
|
142
|
-
break
|
|
150
|
+
break
|
|
143
151
|
case 'freebsd':
|
|
144
152
|
if (arch !== 'x64') {
|
|
145
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
153
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
146
154
|
}
|
|
147
|
-
localFileExisted = existsSync(join(__dirname, 'archlint.freebsd-x64.node'))
|
|
155
|
+
localFileExisted = existsSync(join(__dirname, 'archlint.freebsd-x64.node'))
|
|
148
156
|
try {
|
|
149
157
|
if (localFileExisted) {
|
|
150
|
-
nativeBinding = require('./archlint.freebsd-x64.node')
|
|
158
|
+
nativeBinding = require('./archlint.freebsd-x64.node')
|
|
151
159
|
} else {
|
|
152
|
-
nativeBinding = require('@archlinter/core-freebsd-x64')
|
|
160
|
+
nativeBinding = require('@archlinter/core-freebsd-x64')
|
|
153
161
|
}
|
|
154
162
|
} catch (e) {
|
|
155
|
-
loadError = e
|
|
163
|
+
loadError = e
|
|
156
164
|
}
|
|
157
|
-
break
|
|
165
|
+
break
|
|
158
166
|
case 'linux':
|
|
159
167
|
switch (arch) {
|
|
160
168
|
case 'x64':
|
|
161
169
|
if (isMusl()) {
|
|
162
|
-
localFileExisted = existsSync(
|
|
170
|
+
localFileExisted = existsSync(
|
|
171
|
+
join(__dirname, 'archlint.linux-x64-musl.node')
|
|
172
|
+
)
|
|
163
173
|
try {
|
|
164
174
|
if (localFileExisted) {
|
|
165
|
-
nativeBinding = require('./archlint.linux-x64-musl.node')
|
|
175
|
+
nativeBinding = require('./archlint.linux-x64-musl.node')
|
|
166
176
|
} else {
|
|
167
|
-
nativeBinding = require('@archlinter/core-linux-x64-musl')
|
|
177
|
+
nativeBinding = require('@archlinter/core-linux-x64-musl')
|
|
168
178
|
}
|
|
169
179
|
} catch (e) {
|
|
170
|
-
loadError = e
|
|
180
|
+
loadError = e
|
|
171
181
|
}
|
|
172
182
|
} else {
|
|
173
|
-
localFileExisted = existsSync(
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'archlint.linux-x64-gnu.node')
|
|
185
|
+
)
|
|
174
186
|
try {
|
|
175
187
|
if (localFileExisted) {
|
|
176
|
-
nativeBinding = require('./archlint.linux-x64-gnu.node')
|
|
188
|
+
nativeBinding = require('./archlint.linux-x64-gnu.node')
|
|
177
189
|
} else {
|
|
178
|
-
nativeBinding = require('@archlinter/core-linux-x64-gnu')
|
|
190
|
+
nativeBinding = require('@archlinter/core-linux-x64-gnu')
|
|
179
191
|
}
|
|
180
192
|
} catch (e) {
|
|
181
|
-
loadError = e
|
|
193
|
+
loadError = e
|
|
182
194
|
}
|
|
183
195
|
}
|
|
184
|
-
break
|
|
196
|
+
break
|
|
185
197
|
case 'arm64':
|
|
186
198
|
if (isMusl()) {
|
|
187
|
-
localFileExisted = existsSync(
|
|
199
|
+
localFileExisted = existsSync(
|
|
200
|
+
join(__dirname, 'archlint.linux-arm64-musl.node')
|
|
201
|
+
)
|
|
188
202
|
try {
|
|
189
203
|
if (localFileExisted) {
|
|
190
|
-
nativeBinding = require('./archlint.linux-arm64-musl.node')
|
|
204
|
+
nativeBinding = require('./archlint.linux-arm64-musl.node')
|
|
191
205
|
} else {
|
|
192
|
-
nativeBinding = require('@archlinter/core-linux-arm64-musl')
|
|
206
|
+
nativeBinding = require('@archlinter/core-linux-arm64-musl')
|
|
193
207
|
}
|
|
194
208
|
} catch (e) {
|
|
195
|
-
loadError = e
|
|
209
|
+
loadError = e
|
|
196
210
|
}
|
|
197
211
|
} else {
|
|
198
|
-
localFileExisted = existsSync(
|
|
212
|
+
localFileExisted = existsSync(
|
|
213
|
+
join(__dirname, 'archlint.linux-arm64-gnu.node')
|
|
214
|
+
)
|
|
199
215
|
try {
|
|
200
216
|
if (localFileExisted) {
|
|
201
|
-
nativeBinding = require('./archlint.linux-arm64-gnu.node')
|
|
217
|
+
nativeBinding = require('./archlint.linux-arm64-gnu.node')
|
|
202
218
|
} else {
|
|
203
|
-
nativeBinding = require('@archlinter/core-linux-arm64-gnu')
|
|
219
|
+
nativeBinding = require('@archlinter/core-linux-arm64-gnu')
|
|
204
220
|
}
|
|
205
221
|
} catch (e) {
|
|
206
|
-
loadError = e
|
|
222
|
+
loadError = e
|
|
207
223
|
}
|
|
208
224
|
}
|
|
209
|
-
break
|
|
225
|
+
break
|
|
210
226
|
case 'arm':
|
|
211
227
|
if (isMusl()) {
|
|
212
|
-
localFileExisted = existsSync(
|
|
228
|
+
localFileExisted = existsSync(
|
|
229
|
+
join(__dirname, 'archlint.linux-arm-musleabihf.node')
|
|
230
|
+
)
|
|
213
231
|
try {
|
|
214
232
|
if (localFileExisted) {
|
|
215
|
-
nativeBinding = require('./archlint.linux-arm-musleabihf.node')
|
|
233
|
+
nativeBinding = require('./archlint.linux-arm-musleabihf.node')
|
|
216
234
|
} else {
|
|
217
|
-
nativeBinding = require('@archlinter/core-linux-arm-musleabihf')
|
|
235
|
+
nativeBinding = require('@archlinter/core-linux-arm-musleabihf')
|
|
218
236
|
}
|
|
219
237
|
} catch (e) {
|
|
220
|
-
loadError = e
|
|
238
|
+
loadError = e
|
|
221
239
|
}
|
|
222
240
|
} else {
|
|
223
|
-
localFileExisted = existsSync(
|
|
241
|
+
localFileExisted = existsSync(
|
|
242
|
+
join(__dirname, 'archlint.linux-arm-gnueabihf.node')
|
|
243
|
+
)
|
|
224
244
|
try {
|
|
225
245
|
if (localFileExisted) {
|
|
226
|
-
nativeBinding = require('./archlint.linux-arm-gnueabihf.node')
|
|
246
|
+
nativeBinding = require('./archlint.linux-arm-gnueabihf.node')
|
|
227
247
|
} else {
|
|
228
|
-
nativeBinding = require('@archlinter/core-linux-arm-gnueabihf')
|
|
248
|
+
nativeBinding = require('@archlinter/core-linux-arm-gnueabihf')
|
|
229
249
|
}
|
|
230
250
|
} catch (e) {
|
|
231
|
-
loadError = e
|
|
251
|
+
loadError = e
|
|
232
252
|
}
|
|
233
253
|
}
|
|
234
|
-
break
|
|
254
|
+
break
|
|
235
255
|
case 'riscv64':
|
|
236
256
|
if (isMusl()) {
|
|
237
|
-
localFileExisted = existsSync(
|
|
257
|
+
localFileExisted = existsSync(
|
|
258
|
+
join(__dirname, 'archlint.linux-riscv64-musl.node')
|
|
259
|
+
)
|
|
238
260
|
try {
|
|
239
261
|
if (localFileExisted) {
|
|
240
|
-
nativeBinding = require('./archlint.linux-riscv64-musl.node')
|
|
262
|
+
nativeBinding = require('./archlint.linux-riscv64-musl.node')
|
|
241
263
|
} else {
|
|
242
|
-
nativeBinding = require('@archlinter/core-linux-riscv64-musl')
|
|
264
|
+
nativeBinding = require('@archlinter/core-linux-riscv64-musl')
|
|
243
265
|
}
|
|
244
266
|
} catch (e) {
|
|
245
|
-
loadError = e
|
|
267
|
+
loadError = e
|
|
246
268
|
}
|
|
247
269
|
} else {
|
|
248
|
-
localFileExisted = existsSync(
|
|
270
|
+
localFileExisted = existsSync(
|
|
271
|
+
join(__dirname, 'archlint.linux-riscv64-gnu.node')
|
|
272
|
+
)
|
|
249
273
|
try {
|
|
250
274
|
if (localFileExisted) {
|
|
251
|
-
nativeBinding = require('./archlint.linux-riscv64-gnu.node')
|
|
275
|
+
nativeBinding = require('./archlint.linux-riscv64-gnu.node')
|
|
252
276
|
} else {
|
|
253
|
-
nativeBinding = require('@archlinter/core-linux-riscv64-gnu')
|
|
277
|
+
nativeBinding = require('@archlinter/core-linux-riscv64-gnu')
|
|
254
278
|
}
|
|
255
279
|
} catch (e) {
|
|
256
|
-
loadError = e
|
|
280
|
+
loadError = e
|
|
257
281
|
}
|
|
258
282
|
}
|
|
259
|
-
break
|
|
283
|
+
break
|
|
260
284
|
case 's390x':
|
|
261
|
-
localFileExisted = existsSync(
|
|
285
|
+
localFileExisted = existsSync(
|
|
286
|
+
join(__dirname, 'archlint.linux-s390x-gnu.node')
|
|
287
|
+
)
|
|
262
288
|
try {
|
|
263
289
|
if (localFileExisted) {
|
|
264
|
-
nativeBinding = require('./archlint.linux-s390x-gnu.node')
|
|
290
|
+
nativeBinding = require('./archlint.linux-s390x-gnu.node')
|
|
265
291
|
} else {
|
|
266
|
-
nativeBinding = require('@archlinter/core-linux-s390x-gnu')
|
|
292
|
+
nativeBinding = require('@archlinter/core-linux-s390x-gnu')
|
|
267
293
|
}
|
|
268
294
|
} catch (e) {
|
|
269
|
-
loadError = e
|
|
295
|
+
loadError = e
|
|
270
296
|
}
|
|
271
|
-
break
|
|
297
|
+
break
|
|
272
298
|
default:
|
|
273
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
299
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
274
300
|
}
|
|
275
|
-
break
|
|
301
|
+
break
|
|
276
302
|
default:
|
|
277
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
303
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
278
304
|
}
|
|
279
305
|
|
|
280
306
|
if (!nativeBinding) {
|
|
281
307
|
if (loadError) {
|
|
282
|
-
throw loadError
|
|
308
|
+
throw loadError
|
|
283
309
|
}
|
|
284
|
-
throw new Error(`Failed to load native binding`)
|
|
310
|
+
throw new Error(`Failed to load native binding`)
|
|
285
311
|
}
|
|
286
312
|
|
|
287
|
-
const { scan, scanSync,
|
|
313
|
+
const { scan, scanSync, loadConfig, getDetectors, clearCache, ArchlintAnalyzer } = nativeBinding
|
|
288
314
|
|
|
289
|
-
module.exports.scan = scan
|
|
290
|
-
module.exports.scanSync = scanSync
|
|
291
|
-
module.exports.
|
|
292
|
-
module.exports.
|
|
293
|
-
module.exports.
|
|
315
|
+
module.exports.scan = scan
|
|
316
|
+
module.exports.scanSync = scanSync
|
|
317
|
+
module.exports.loadConfig = loadConfig
|
|
318
|
+
module.exports.getDetectors = getDetectors
|
|
319
|
+
module.exports.clearCache = clearCache
|
|
320
|
+
module.exports.ArchlintAnalyzer = ArchlintAnalyzer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archlinter/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.6.0",
|
|
31
|
+
"@archlinter/core-darwin-x64": "0.6.0",
|
|
32
|
+
"@archlinter/core-linux-x64-gnu": "0.6.0",
|
|
33
|
+
"@archlinter/core-linux-x64-musl": "0.6.0",
|
|
34
|
+
"@archlinter/core-linux-arm64-gnu": "0.6.0",
|
|
35
|
+
"@archlinter/core-darwin-arm64": "0.6.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18"
|