@@ -16,16 +16,17 @@ public abstract class NodeExecutorBase
16
16
protected static readonly string WebEssentialsResourceDirectory = Path . Combine ( Path . GetDirectoryName ( typeof ( NodeExecutorBase ) . Assembly . Location ) , @"Resources" ) ;
17
17
private static readonly string NodePath = Path . Combine ( WebEssentialsResourceDirectory , @"nodejs\node.exe" ) ;
18
18
19
- public abstract string TargetExtension { get ; }
20
- public abstract string ServiceName { get ; }
19
+ protected string MapFileName { get ; set ; }
20
+ protected abstract string CompilerPath { get ; }
21
+ protected virtual Regex ErrorParsingPattern { get { return null ; } }
22
+ protected virtual Func < string , IEnumerable < CompilerError > > ParseErrors { get { return ParseErrorsWithRegex ; } }
23
+
21
24
///<summary>Indicates whether this compiler will emit a source map file. Will only return true if aupported and enabled in user settings.</summary>
22
25
public abstract bool GenerateSourceMap { get ; }
23
-
24
- protected abstract string CompilerPath { get ; }
26
+ public abstract string TargetExtension { get ; }
27
+ public abstract string ServiceName { get ; }
25
28
///<summary>Indicates whether this compiler is capable of compiling to a filename that doesn't match the source filename.</summary>
26
29
public virtual bool RequireMatchingFileName { get { return false ; } }
27
- protected virtual Regex ErrorParsingPattern { get { return null ; } }
28
- protected virtual Func < string , IEnumerable < CompilerError > > ParseErrors { get { return ParseErrorsWithRegex ; } }
29
30
30
31
public async Task < CompilerResult > CompileAsync ( string sourceFileName , string targetFileName )
31
32
{
@@ -53,16 +54,19 @@ public async Task<CompilerResult> CompileAsync(string sourceFileName, string tar
53
54
{
54
55
ProjectHelpers . CheckOutFileFromSourceControl ( targetFileName ) ;
55
56
57
+ MapFileName = MapFileName ?? targetFileName + ".map" ;
58
+
56
59
if ( GenerateSourceMap )
57
- ProjectHelpers . CheckOutFileFromSourceControl ( targetFileName + ".map" ) ;
60
+ ProjectHelpers . CheckOutFileFromSourceControl ( MapFileName ) ;
58
61
59
62
using ( var process = await start . ExecuteAsync ( ) )
60
63
{
61
64
return ProcessResult (
62
65
process ,
63
66
File . ReadAllText ( errorOutputFile ) . Trim ( ) ,
64
67
sourceFileName ,
65
- targetFileName
68
+ targetFileName ,
69
+ MapFileName
66
70
) ;
67
71
}
68
72
}
@@ -72,7 +76,7 @@ public async Task<CompilerResult> CompileAsync(string sourceFileName, string tar
72
76
}
73
77
}
74
78
75
- private CompilerResult ProcessResult ( Process process , string errorText , string sourceFileName , string targetFileName )
79
+ private CompilerResult ProcessResult ( Process process , string errorText , string sourceFileName , string targetFileName , string mapFileName )
76
80
{
77
81
var result = ValidateResult ( process , targetFileName , errorText ) ;
78
82
var resultText = result . Result ;
@@ -94,6 +98,7 @@ private CompilerResult ProcessResult(Process process, string errorText, string s
94
98
var compilerResult = CompilerResultFactory . GenerateResult (
95
99
sourceFileName : sourceFileName ,
96
100
targetFileName : targetFileName ,
101
+ mapFileName : mapFileName ,
97
102
isSuccess : success ,
98
103
result : resultText ,
99
104
errors : errors
0 commit comments