@@ -147,12 +147,13 @@ export function allReferencedFiles(
147147 fs : FS ,
148148 packageName : string ,
149149 baseDirectory : string
150- ) : { types : Map < string , ts . SourceFile > ; tests : Map < string , ts . SourceFile > } {
150+ ) : { types : Map < string , ts . SourceFile > ; tests : Map < string , ts . SourceFile > ; hasNonRelativeImports : boolean } {
151151 const seenReferences = new Set < string > ( ) ;
152152 const types = new Map < string , ts . SourceFile > ( ) ;
153153 const tests = new Map < string , ts . SourceFile > ( ) ;
154+ let hasNonRelativeImports = false ;
154155 entryFilenames . forEach ( text => recur ( { text, exact : true } ) ) ;
155- return { types, tests } ;
156+ return { types, tests, hasNonRelativeImports } ;
156157
157158 function recur ( { text, exact } : Reference ) : void {
158159 const resolvedFilename = exact ? text : resolveModule ( text , fs ) ;
@@ -170,13 +171,14 @@ export function allReferencedFiles(
170171 tests . set ( resolvedFilename , src ) ;
171172 }
172173
173- const refs = findReferencedFiles (
174+ const { refs, hasNonRelativeImports : result } = findReferencedFiles (
174175 src ,
175176 packageName ,
176177 path . dirname ( resolvedFilename ) ,
177178 normalizeSlashes ( path . relative ( baseDirectory , fs . debugPath ( ) ) )
178179 ) ;
179180 refs . forEach ( recur ) ;
181+ hasNonRelativeImports = hasNonRelativeImports || result ;
180182 }
181183 }
182184}
@@ -215,6 +217,7 @@ interface Reference {
215217 */
216218function findReferencedFiles ( src : ts . SourceFile , packageName : string , subDirectory : string , baseDirectory : string ) {
217219 const refs : Reference [ ] = [ ] ;
220+ let hasNonRelativeImports = false ;
218221
219222 for ( const ref of src . referencedFiles ) {
220223 // Any <reference path="foo"> is assumed to be local
@@ -235,9 +238,10 @@ function findReferencedFiles(src: ts.SourceFile, packageName: string, subDirecto
235238 }
236239 if ( ref . startsWith ( packageName + "/" ) ) {
237240 addReference ( { text : convertToRelativeReference ( ref ) , exact : false } ) ;
241+ hasNonRelativeImports = true ;
238242 }
239243 }
240- return refs ;
244+ return { refs, hasNonRelativeImports } ;
241245
242246 function addReference ( ref : Reference ) : void {
243247 // `path.normalize` may add windows slashes
0 commit comments