11/** Non-internal stuff goes here */
22namespace ts {
3- export const emptyArray : never [ ] = [ ] as never [ ] ;
4- export function closeFileWatcher ( watcher : FileWatcher ) {
5- watcher . close ( ) ;
6- }
7-
83 export function isExternalModuleNameRelative ( moduleName : string ) : boolean {
94 // TypeScript 1.0 spec (April 2014): 11.2.1
105 // An external module name is "relative" if the first term is "." or "..".
@@ -15,21 +10,11 @@ namespace ts {
1510 export function sortAndDeduplicateDiagnostics < T extends Diagnostic > ( diagnostics : ReadonlyArray < T > ) : T [ ] {
1611 return sortAndDeduplicate < T > ( diagnostics , compareDiagnostics ) ;
1712 }
18-
19- export function toPath ( fileName : string , basePath : string | undefined , getCanonicalFileName : ( path : string ) => string ) : Path {
20- const nonCanonicalizedPath = isRootedDiskPath ( fileName )
21- ? normalizePath ( fileName )
22- : getNormalizedAbsolutePath ( fileName , basePath ) ;
23- return < Path > getCanonicalFileName ( nonCanonicalizedPath ) ;
24- }
25-
26- export function hasEntries ( map : ReadonlyUnderscoreEscapedMap < any > | undefined ) : map is ReadonlyUnderscoreEscapedMap < any > {
27- return ! ! map && ! ! map . size ;
28- }
2913}
3014
3115/* @internal */
3216namespace ts {
17+ export const emptyArray : never [ ] = [ ] as never [ ] ;
3318 export const resolvingEmptyArray : never [ ] = [ ] as never [ ] ;
3419 export const emptyMap : ReadonlyMap < never > = createMap < never > ( ) ;
3520 export const emptyUnderscoreEscapedMap : ReadonlyUnderscoreEscapedMap < never > = emptyMap as ReadonlyUnderscoreEscapedMap < never > ;
@@ -54,6 +39,10 @@ namespace ts {
5439 return new MapCtr < T > ( ) as UnderscoreEscapedMap < T > ;
5540 }
5641
42+ export function hasEntries ( map : ReadonlyUnderscoreEscapedMap < any > | undefined ) : map is ReadonlyUnderscoreEscapedMap < any > {
43+ return ! ! map && ! ! map . size ;
44+ }
45+
5746 export function createSymbolTable ( symbols ?: ReadonlyArray < Symbol > ) : SymbolTable {
5847 const result = createMap < Symbol > ( ) as SymbolTable ;
5948 if ( symbols ) {
@@ -103,6 +92,13 @@ namespace ts {
10392 } ;
10493 }
10594
95+ export function toPath ( fileName : string , basePath : string | undefined , getCanonicalFileName : ( path : string ) => string ) : Path {
96+ const nonCanonicalizedPath = isRootedDiskPath ( fileName )
97+ ? normalizePath ( fileName )
98+ : getNormalizedAbsolutePath ( fileName , basePath ) ;
99+ return < Path > getCanonicalFileName ( nonCanonicalizedPath ) ;
100+ }
101+
106102 export function changesAffectModuleResolution ( oldOptions : CompilerOptions , newOptions : CompilerOptions ) : boolean {
107103 return ! oldOptions ||
108104 ( oldOptions . module !== newOptions . module ) ||
@@ -4089,6 +4085,10 @@ namespace ts {
40894085 return options . watch && options . hasOwnProperty ( "watch" ) ;
40904086 }
40914087
4088+ export function closeFileWatcher ( watcher : FileWatcher ) {
4089+ watcher . close ( ) ;
4090+ }
4091+
40924092 export function getCheckFlags ( symbol : Symbol ) : CheckFlags {
40934093 return symbol . flags & SymbolFlags . Transient ? ( < TransientSymbol > symbol ) . checkFlags : 0 ;
40944094 }
@@ -6647,7 +6647,11 @@ namespace ts {
66476647 export function isStringLiteralLike ( node : Node ) : node is StringLiteralLike {
66486648 return node . kind === SyntaxKind . StringLiteral || node . kind === SyntaxKind . NoSubstitutionTemplateLiteral ;
66496649 }
6650+ }
66506651
6652+
6653+ /* @internal */
6654+ namespace ts {
66516655 /** @internal */
66526656 export function isNamedImportsOrExports ( node : Node ) : node is NamedImportsOrExports {
66536657 return node . kind === SyntaxKind . NamedImports || node . kind === SyntaxKind . NamedExports ;
@@ -6712,6 +6716,7 @@ namespace ts {
67126716 getSourceMapSourceConstructor : ( ) => < any > SourceMapSource ,
67136717 } ;
67146718
6719+ /* @internal */
67156720 export function formatStringFromArgs ( text : string , args : ArrayLike < string > , baseIndex = 0 ) : string {
67166721 return text . replace ( / { ( \d + ) } / g, ( _match , index : string ) => Debug . assertDefined ( args [ + index + baseIndex ] ) ) ;
67176722 }
@@ -6722,6 +6727,7 @@ namespace ts {
67226727 return localizedDiagnosticMessages && localizedDiagnosticMessages [ message . key ] || message . message ;
67236728 }
67246729
6730+ /* @internal */
67256731 export function createFileDiagnostic ( file : SourceFile , start : number , length : number , message : DiagnosticMessage , ...args : ( string | number | undefined ) [ ] ) : DiagnosticWithLocation ;
67266732 export function createFileDiagnostic ( file : SourceFile , start : number , length : number , message : DiagnosticMessage ) : DiagnosticWithLocation {
67276733 Debug . assertGreaterThanOrEqual ( start , 0 ) ;
@@ -6761,6 +6767,7 @@ namespace ts {
67616767 return text ;
67626768 }
67636769
6770+ /* @internal */
67646771 export function createCompilerDiagnostic ( message : DiagnosticMessage , ...args : ( string | number | undefined ) [ ] ) : Diagnostic ;
67656772 export function createCompilerDiagnostic ( message : DiagnosticMessage ) : Diagnostic {
67666773 let text = getLocaleSpecificMessage ( message ) ;
@@ -6781,6 +6788,7 @@ namespace ts {
67816788 } ;
67826789 }
67836790
6791+ /* @internal */
67846792 export function createCompilerDiagnosticFromMessageChain ( chain : DiagnosticMessageChain ) : Diagnostic {
67856793 return {
67866794 file : undefined ,
@@ -6793,6 +6801,7 @@ namespace ts {
67936801 } ;
67946802 }
67956803
6804+ /* @internal */
67966805 export function chainDiagnosticMessages ( details : DiagnosticMessageChain | undefined , message : DiagnosticMessage , ...args : ( string | undefined ) [ ] ) : DiagnosticMessageChain ;
67976806 export function chainDiagnosticMessages ( details : DiagnosticMessageChain | undefined , message : DiagnosticMessage ) : DiagnosticMessageChain {
67986807 let text = getLocaleSpecificMessage ( message ) ;
@@ -6824,6 +6833,7 @@ namespace ts {
68246833 return diagnostic . file ? diagnostic . file . path : undefined ;
68256834 }
68266835
6836+ /* @internal */
68276837 export function compareDiagnostics ( d1 : Diagnostic , d2 : Diagnostic ) : Comparison {
68286838 return compareStringsCaseSensitive ( getDiagnosticFilePath ( d1 ) , getDiagnosticFilePath ( d2 ) ) ||
68296839 compareValues ( d1 . start , d2 . start ) ||
@@ -7122,6 +7132,7 @@ namespace ts {
71227132 return rootLength > 0 && rootLength === path . length ;
71237133 }
71247134
7135+ /* @internal */
71257136 export function convertToRelativePath ( absoluteOrRelativePath : string , basePath : string , getCanonicalFileName : ( path : string ) => string ) : string {
71267137 return ! isRootedDiskPath ( absoluteOrRelativePath )
71277138 ? absoluteOrRelativePath
0 commit comments