@@ -58,10 +58,32 @@ declare namespace OxideV3And4 {
5858 }
5959}
6060
61+ // This covers the Oxide API from v4.1.0+
62+ declare namespace OxideV5 {
63+ interface SourceEntry {
64+ base : string
65+ pattern : string
66+ negated : boolean
67+ }
68+
69+ interface ScannerOptions {
70+ sources : Array < SourceEntry >
71+ }
72+
73+ interface ScannerConstructor {
74+ new ( options : ScannerOptions ) : Scanner
75+ }
76+
77+ interface Scanner {
78+ files : Array < string >
79+ sources : Array < SourceEntry >
80+ }
81+ }
82+
6183interface Oxide {
6284 scanDir ?( options : OxideV1 . ScanOptions ) : OxideV1 . ScanResult
6385 scanDir ?( options : OxideV2 . ScanOptions ) : OxideV2 . ScanResult
64- Scanner ?: OxideV3And4 . ScannerConstructor
86+ Scanner ?: OxideV3And4 . ScannerConstructor | OxideV5 . ScannerConstructor
6587}
6688
6789async function loadOxideAtPath ( id : string ) : Promise < Oxide | null > {
@@ -145,7 +167,7 @@ export async function scan(options: ScanOptions): Promise<ScanResult | null> {
145167 }
146168
147169 // V4
148- else {
170+ else if ( lte ( options . oxideVersion , '4.0.9999' ) ) {
149171 let scanner = new ( oxide . Scanner as OxideV3And4 . ScannerConstructor ) ( {
150172 sources : [
151173 { base : options . basePath , pattern : '**/*' } ,
@@ -158,4 +180,19 @@ export async function scan(options: ScanOptions): Promise<ScanResult | null> {
158180 sources : scanner . globs . map ( ( s ) => ( { base : s . base , pattern : s . pattern , negated : false } ) ) ,
159181 }
160182 }
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+ sources : scanner . sources ,
196+ }
197+ }
161198}
0 commit comments