File tree Expand file tree Collapse file tree
packages/apollo-language-server/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77- ` apollo-language-server `
88 - Better error handling in ApolloEngineClient [ #953 ] ( https://github.com/apollographql/apollo-tooling/pull/953 )
99 - Added a warning when there are 0 files found in a project [ #1007 ] ( https://github.com/apollographql/apollo-tooling/pull/1007 )
10+ - Allow relative paths in includes/excludes globs [ #1007 ] ( https://github.com/apollographql/apollo-tooling/pull/1007 )
1011- ` vscode-apollo `
1112 - Fix inline graphql highlighting in Vue ` <script> ` tags [ #981 ] ( https://github.com/apollographql/apollo-tooling/pull/981 )
1213
Original file line number Diff line number Diff line change @@ -51,24 +51,18 @@ export class FileSet {
5151 }
5252
5353 includesFile ( filePath : string ) : boolean {
54- filePath = relative ( this . rootURI . fsPath , filePath ) ;
55-
56- return (
57- this . includes . some ( include => minimatch ( filePath , include ) ) &&
58- ! this . excludes . some ( exclude => minimatch ( filePath , exclude ) )
59- ) ;
54+ return this . allFiles ( ) . includes ( relative ( this . rootURI . fsPath , filePath ) ) ;
6055 }
6156
6257 allFiles ( ) : string [ ] {
63- return this . includes
64- . flatMap ( include =>
65- glob . sync ( include , { cwd : this . rootURI . fsPath , absolute : true } )
66- )
67- . filter (
68- filePath =>
69- ! this . excludes . some ( exclude =>
70- minimatch ( relative ( this . rootURI . fsPath , filePath ) , exclude )
71- )
72- ) ;
58+ // since glob.sync takes a single patttern, but we allow an array of `includes`, we can join all the
59+ // `includes` globs into a single pattern and pass to glob.sync The `ignore` option does, however, allow
60+ // an array of globs to ignore, so we can pass it in directly
61+ const joinedIncludes = `{${ this . includes . join ( "," ) } }` ;
62+ return glob . sync ( joinedIncludes , {
63+ cwd : this . rootURI . fsPath ,
64+ absolute : true ,
65+ ignore : this . excludes
66+ } ) ;
7367 }
7468}
You can’t perform that action at this time.
0 commit comments