@@ -61,8 +61,12 @@ namespace ts {
61
61
62
62
/** Public interface of the the of a config service shim instance.*/
63
63
export interface CoreServicesShimHost extends Logger {
64
- /** Returns a JSON-encoded value of the type: string[] */
65
- readDirectory ( rootDir : string , extension : string ) : string ;
64
+ /** Returns a JSON-encoded value of the type: string[]
65
+ *
66
+ * @param exclude A JSON encoded string[] containing the paths to exclude
67
+ * when enumerating the directory.
68
+ */
69
+ readDirectory ( rootDir : string , extension : string , exclude ?: string ) : string ;
66
70
}
67
71
68
72
///
@@ -351,8 +355,18 @@ namespace ts {
351
355
constructor ( private shimHost : CoreServicesShimHost ) {
352
356
}
353
357
354
- public readDirectory ( rootDir : string , extension : string ) : string [ ] {
355
- var encoded = this . shimHost . readDirectory ( rootDir , extension ) ;
358
+ public readDirectory ( rootDir : string , extension : string , exclude : string [ ] ) : string [ ] {
359
+ // Wrap the API changes for 1.5 release. This try/catch
360
+ // should be removed once TypeScript 1.5 has shipped.
361
+ // Also consider removing the optional designation for
362
+ // the exclude param at this time.
363
+ var encoded : string ;
364
+ try {
365
+ encoded = this . shimHost . readDirectory ( rootDir , extension , JSON . stringify ( exclude ) ) ;
366
+ }
367
+ catch ( e ) {
368
+ encoded = this . shimHost . readDirectory ( rootDir , extension ) ;
369
+ }
356
370
return JSON . parse ( encoded ) ;
357
371
}
358
372
}
0 commit comments