This repository was archived by the owner on Dec 1, 2019. It is now read-only.
File tree 3 files changed +13
-13
lines changed
3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ import * as fs from 'fs';
2
2
import * as path from 'path' ;
3
3
import * as host from './host' ;
4
4
5
+ const double = / \/ \/ / ;
6
+ export function toUnix ( fileName : string ) : string {
7
+ let res : string = fileName . replace ( / \\ / g, '/' ) ;
8
+ while ( res . match ( double ) ) {
9
+ res = res . replace ( double , '/' ) ;
10
+ }
11
+
12
+ return res ;
13
+ }
14
+
5
15
function withoutExt ( fileName : string ) : string {
6
16
return path . join ( path . dirname ( fileName ) , path . basename ( fileName ) . split ( '.' ) [ 0 ] ) ;
7
17
}
Original file line number Diff line number Diff line change @@ -28,16 +28,6 @@ interface Transformation {
28
28
map : any ;
29
29
}
30
30
31
- const double = / \/ \/ / ;
32
- function toUnix ( fileName : string ) {
33
- let res : string = fileName . replace ( / \\ / g, '/' ) ;
34
- while ( res . match ( double ) ) {
35
- res = res . replace ( double , '/' ) ;
36
- }
37
-
38
- return res ;
39
- }
40
-
41
31
function compiler ( webpack : IWebPack , text : string ) : void {
42
32
if ( webpack . cacheable ) {
43
33
webpack . cacheable ( ) ;
@@ -48,7 +38,7 @@ function compiler(webpack: IWebPack, text: string): void {
48
38
let instance = ensureInstance ( webpack , options , instanceName ) ;
49
39
let state = instance . tsState ;
50
40
let callback = webpack . async ( ) ;
51
- let fileName = toUnix ( webpack . resourcePath ) ;
41
+ let fileName = helpers . toUnix ( webpack . resourcePath ) ;
52
42
53
43
let depsInjector = {
54
44
add : ( depFileName ) => webpack . addDependency ( depFileName ) ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { State } from './host';
2
2
import * as fs from 'fs' ;
3
3
import * as path from 'path' ;
4
4
import * as _ from 'lodash' ;
5
- import { formatError } from './helpers' ;
5
+ import { formatError , toUnix } from './helpers' ;
6
6
import { ICompilerInfo } from './host' ;
7
7
import { createChecker } from './checker' ;
8
8
@@ -319,7 +319,7 @@ function setupWatchRun(compiler, instanceName: string) {
319
319
let instance = resolveInstance ( watching . compiler , instanceName ) ;
320
320
let state = instance . tsState ;
321
321
let mtimes = watching . compiler . watchFileSystem . watcher . mtimes ;
322
- let changedFiles = Object . keys ( mtimes ) ;
322
+ let changedFiles = Object . keys ( mtimes ) . map ( toUnix ) ;
323
323
324
324
changedFiles . forEach ( ( changedFile ) => {
325
325
state . fileAnalyzer . validFiles . markFileInvalid ( changedFile ) ;
You can’t perform that action at this time.
0 commit comments