@@ -23,28 +23,34 @@ public void Generate(IEnumerable<string> typeScriptFiles)
23
23
return ;
24
24
}
25
25
26
- var libdts = Path . Combine ( Common . Paths . BaseAppFolder , "TypeScript" , "lib.d.ts" ) ;
27
-
28
26
declarations = new List < string > ( ) ;
29
27
references = new Dictionary < string , List < Reference > > ( StringComparer . OrdinalIgnoreCase ) ;
30
28
SymbolIDToListOfLocationsMap = new Dictionary < string , List < Tuple < string , long > > > ( ) ;
31
29
32
30
var list = new List < string > ( ) ;
31
+ string libFile = null ;
33
32
34
- if ( ! typeScriptFiles . Any ( f => string . Equals ( Path . GetFileName ( f ) , "lib.d.ts" , StringComparison . OrdinalIgnoreCase ) ) )
35
- {
36
- list . Add ( libdts ) ;
37
- }
38
-
39
- foreach ( var file in typeScriptFiles )
33
+ foreach ( var file in typeScriptFiles )
40
34
{
41
35
if ( ! alreadyProcessed . Contains ( file ) )
42
36
{
43
- list . Add ( file ) ;
37
+ if ( libFile == null && string . Equals ( Path . GetFileName ( file ) , "lib.d.ts" , StringComparison . OrdinalIgnoreCase ) )
38
+ {
39
+ libFile = file ;
40
+ }
41
+ else
42
+ {
43
+ list . Add ( file ) ;
44
+ }
44
45
}
45
46
}
46
47
47
- GenerateCore ( list ) ;
48
+ if ( libFile == null )
49
+ {
50
+ libFile = Path . Combine ( Common . Paths . BaseAppFolder , "TypeScriptSupport" , "lib.d.ts" ) ;
51
+ }
52
+
53
+ GenerateCore ( list , libFile ) ;
48
54
49
55
ProjectGenerator . GenerateReferencesDataFilesToAssembly (
50
56
Paths . SolutionDestinationFolder ,
@@ -62,21 +68,20 @@ public void Generate(IEnumerable<string> typeScriptFiles)
62
68
SymbolIDToListOfLocationsMap ) ;
63
69
}
64
70
65
- private void GenerateCore ( IEnumerable < string > typeScriptFiles )
71
+ private void GenerateCore ( IEnumerable < string > fileNames , string libFile )
66
72
{
67
73
var output = Path . Combine ( Common . Paths . BaseAppFolder , "output" ) ;
68
74
if ( Directory . Exists ( output ) )
69
75
{
70
76
Directory . Delete ( output , recursive : true ) ;
71
77
}
72
78
73
- var json = JsonConvert . SerializeObject ( typeScriptFiles ) ;
79
+ var json = JsonConvert . SerializeObject ( new { fileNames , libFile } ) ;
74
80
var argumentsJson = Path . Combine ( Common . Paths . BaseAppFolder , "TypeScriptAnalyzerArguments.json" ) ;
75
81
File . WriteAllText ( argumentsJson , json ) ;
76
82
77
- var analyzerJs = Path . Combine ( Common . Paths . BaseAppFolder , @"TypeScript\analyzer.js" ) ;
78
-
79
- var result = new ProcessLaunchService ( ) . RunAndRedirectOutput ( "Microsoft.SourceBrowser.TypeScriptAnalyzer.exe" , argumentsJson ) ;
83
+ var analyzerJs = Path . Combine ( Common . Paths . BaseAppFolder , @"TypeScriptSupport\analyzer.js" ) ;
84
+ var result = new ProcessLaunchService ( ) . RunAndRedirectOutput ( "node" , string . Format ( "\" {0}\" {1}" , analyzerJs , argumentsJson ) ) ;
80
85
81
86
foreach ( var file in Directory . GetFiles ( output ) )
82
87
{
0 commit comments