File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,12 +100,10 @@ class ResolutionContext {
100100
101101 private resolveDependencyPathsWithPlugins ( requiringFile : ProcessedFile , dependency : string ) {
102102 const requiredFromLuaFile = requiringFile . fileName . endsWith ( ".lua" ) ;
103- const moduleIdentifier = requiredFromLuaFile ? luaRequireToPath ( dependency ) : dependency ;
104-
105103 for ( const plugin of this . plugins ) {
106104 if ( plugin . moduleResolution != null ) {
107105 const pluginResolvedPath = plugin . moduleResolution (
108- moduleIdentifier ,
106+ dependency ,
109107 requiringFile . fileName ,
110108 this . options ,
111109 this . emitHost
@@ -121,7 +119,7 @@ class ResolutionContext {
121119 if ( resolvedNodeModulesFile ) {
122120 if ( this . options . tstlVerbose ) {
123121 console . log (
124- `Resolved file path for module ${ moduleIdentifier } to path ${ pluginResolvedPath } using plugin.`
122+ `Resolved file path for module ${ dependency } to path ${ pluginResolvedPath } using plugin.`
125123 ) ;
126124 }
127125 return resolvedNodeModulesFile ;
@@ -134,7 +132,7 @@ class ResolutionContext {
134132 if ( fileFromPath ) {
135133 if ( this . options . tstlVerbose ) {
136134 console . log (
137- `Resolved file path for module ${ moduleIdentifier } to path ${ pluginResolvedPath } using plugin.`
135+ `Resolved file path for module ${ dependency } to path ${ pluginResolvedPath } using plugin.`
138136 ) ;
139137 }
140138 return fileFromPath ;
Original file line number Diff line number Diff line change 1+ import path = require( "path" ) ;
12import type * as tstl from "../../../src" ;
23
34const plugin : tstl . Plugin = {
45 moduleResolution ( moduleIdentifier ) {
6+ const modulePath = moduleIdentifier . replace ( / \. / g, path . sep ) ;
57 if ( moduleIdentifier . includes ( "foo" ) ) {
6- return moduleIdentifier . replace ( "foo" , "bar" ) ;
8+ return modulePath . replace ( "foo" , "bar" ) ;
79 }
810 } ,
911} ;
You can’t perform that action at this time.
0 commit comments