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 11// modified from https://github.com/Microsoft/typescript-tslint-plugin
22import path from "path" ;
33import fs from "fs" ;
4- import { URL } from "url" ;
4+ import { URL , fileURLToPath } from "url" ;
55
66import merge from "merge-deep" ;
77import ts_module , {
@@ -474,12 +474,19 @@ function parseModuleName(
474474 const moduleUrl = resolve (
475475 moduleName ,
476476 parsedImportMap ,
477- new URL ( path . dirname ( containingFile ) + "/" , "file:// /") ,
477+ new URL ( "file:///" + path . dirname ( containingFile ) + "/" ) ,
478478 ) ;
479479
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 ;
483490 } catch ( e ) {
484491 if ( logger ) logger . info ( "moduleName: " + moduleName ) ;
485492 if ( logger ) logger . info ( "e: " + ( e as Error ) . stack ) ;
You can’t perform that action at this time.
0 commit comments