This repository was archived by the owner on Sep 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
// modified from https://github.com/Microsoft/typescript-tslint-plugin
2
2
import path from "path" ;
3
3
import fs from "fs" ;
4
- import { URL } from "url" ;
4
+ import { URL , fileURLToPath } from "url" ;
5
5
6
6
import merge from "merge-deep" ;
7
7
import ts_module , {
@@ -474,12 +474,19 @@ function parseModuleName(
474
474
const moduleUrl = resolve (
475
475
moduleName ,
476
476
parsedImportMap ,
477
- new URL ( path . dirname ( containingFile ) + "/" , "file:// /") ,
477
+ new URL ( "file:///" + path . dirname ( containingFile ) + "/" ) ,
478
478
) ;
479
479
480
- return moduleUrl . protocol === "file:"
481
- ? moduleUrl . pathname
482
- : moduleUrl . href ;
480
+ if ( moduleUrl . protocol === "file:" ) {
481
+ return fileURLToPath ( moduleUrl . href )
482
+ }
483
+
484
+ if ( moduleUrl . protocol === "http:" || moduleUrl . protocol === "https:" ) {
485
+ return moduleUrl . href
486
+ }
487
+
488
+ // just support protocol: file, http, https
489
+ return undefined ;
483
490
} catch ( e ) {
484
491
if ( logger ) logger . info ( "moduleName: " + moduleName ) ;
485
492
if ( logger ) logger . info ( "e: " + ( e as Error ) . stack ) ;
You can’t perform that action at this time.
0 commit comments