@@ -58,10 +58,32 @@ declare namespace OxideV3And4 {
58
58
}
59
59
}
60
60
61
+ // This covers the Oxide API from v4.1.0+
62
+ declare namespace OxideV5 {
63
+ interface GlobEntry {
64
+ base : string
65
+ pattern : string
66
+ negated : boolean
67
+ }
68
+
69
+ interface ScannerOptions {
70
+ sources : Array < GlobEntry >
71
+ }
72
+
73
+ interface ScannerConstructor {
74
+ new ( options : ScannerOptions ) : Scanner
75
+ }
76
+
77
+ interface Scanner {
78
+ files : Array < string >
79
+ globs : Array < GlobEntry >
80
+ }
81
+ }
82
+
61
83
interface Oxide {
62
84
scanDir ?( options : OxideV1 . ScanOptions ) : OxideV1 . ScanResult
63
85
scanDir ?( options : OxideV2 . ScanOptions ) : OxideV2 . ScanResult
64
- Scanner ?: OxideV3And4 . ScannerConstructor
86
+ Scanner ?: OxideV3And4 . ScannerConstructor | OxideV5 . ScannerConstructor
65
87
}
66
88
67
89
async function loadOxideAtPath ( id : string ) : Promise < Oxide | null > {
@@ -145,7 +167,7 @@ export async function scan(options: ScanOptions): Promise<ScanResult | null> {
145
167
}
146
168
147
169
// V4
148
- else {
170
+ else if ( lte ( options . oxideVersion , '4.0.9999' ) ) {
149
171
let scanner = new ( oxide . Scanner as OxideV3And4 . ScannerConstructor ) ( {
150
172
sources : [
151
173
{ base : options . basePath , pattern : '**/*' } ,
@@ -158,4 +180,19 @@ export async function scan(options: ScanOptions): Promise<ScanResult | null> {
158
180
globs : scanner . globs . map ( ( g ) => ( { base : g . base , pattern : g . pattern , negated : false } ) ) ,
159
181
}
160
182
}
183
+
184
+ // V5
185
+ else {
186
+ let scanner = new ( oxide . Scanner as OxideV5 . ScannerConstructor ) ( {
187
+ sources : [
188
+ { base : options . basePath , pattern : '**/*' , negated : false } ,
189
+ ...options . sources . map ( ( s ) => ( { base : s . base , pattern : s . pattern , negated : s . negated } ) ) ,
190
+ ] ,
191
+ } )
192
+
193
+ return {
194
+ files : scanner . files ,
195
+ globs : scanner . globs ,
196
+ }
197
+ }
161
198
}
0 commit comments