@@ -64,8 +64,12 @@ namespace ts {
64
64
65
65
/** Public interface of the the of a config service shim instance.*/
66
66
export interface CoreServicesShimHost extends Logger {
67
- /** Returns a JSON-encoded value of the type: string[] */
68
- readDirectory ( rootDir : string , extension : string ) : string ;
67
+ /** Returns a JSON-encoded value of the type: string[]
68
+ *
69
+ * @param exclude A JSON encoded string[] containing the paths to exclude
70
+ * when enumerating the directory.
71
+ */
72
+ readDirectory ( rootDir : string , extension : string , exclude ?: string ) : string ;
69
73
}
70
74
71
75
///
@@ -386,8 +390,18 @@ namespace ts {
386
390
constructor ( private shimHost : CoreServicesShimHost ) {
387
391
}
388
392
389
- public readDirectory ( rootDir : string , extension : string ) : string [ ] {
390
- var encoded = this . shimHost . readDirectory ( rootDir , extension ) ;
393
+ public readDirectory ( rootDir : string , extension : string , exclude : string [ ] ) : string [ ] {
394
+ // Wrap the API changes for 1.5 release. This try/catch
395
+ // should be removed once TypeScript 1.5 has shipped.
396
+ // Also consider removing the optional designation for
397
+ // the exclude param at this time.
398
+ var encoded : string ;
399
+ try {
400
+ encoded = this . shimHost . readDirectory ( rootDir , extension , JSON . stringify ( exclude ) ) ;
401
+ }
402
+ catch ( e ) {
403
+ encoded = this . shimHost . readDirectory ( rootDir , extension ) ;
404
+ }
391
405
return JSON . parse ( encoded ) ;
392
406
}
393
407
}
0 commit comments