File tree 2 files changed +16
-6
lines changed
hardhat/src/internal/builtin-plugins/solidity/build-system/resolver
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -1122,6 +1122,12 @@ Please try renaming the directory.`,
1122
1122
websiteTitle : "Resolution of non-existent npm file" ,
1123
1123
websiteDescription : `You are tying to resolve an npm file that doesn't exist within its package.` ,
1124
1124
} ,
1125
+ RESOLVE_WRONG_CASING_NPM_FILE : {
1126
+ number : 1224 ,
1127
+ messageTemplate : `You are tying to resolve the npm file "{module}", its casing is incorrect.` ,
1128
+ websiteTitle : "Resolution of npm file with incorrect casing" ,
1129
+ websiteDescription : `You are tying to resolve an npm file whose casing is incorrect.` ,
1130
+ } ,
1125
1131
DOWNLOAD_FAILED : {
1126
1132
number : 1225 ,
1127
1133
messageTemplate :
Original file line number Diff line number Diff line change @@ -306,21 +306,25 @@ export class ResolverImplementation implements Resolver {
306
306
) ;
307
307
}
308
308
309
- // Just like with the project files, we are more forgiving with the casing
310
- // here, as this is not used for imports.
309
+ if ( resolvedSubpath !== trueCaseFsPath ) {
310
+ throw new HardhatError (
311
+ HardhatError . ERRORS . SOLIDITY . RESOLVE_WRONG_CASING_NPM_FILE ,
312
+ { module : npmModule } ,
313
+ ) ;
314
+ }
311
315
312
316
const sourceName = sourceNamePathJoin (
313
317
npmPackageToRootSourceName ( npmPackage . name , npmPackage . version ) ,
318
+ // We use the subpath (pre-resolution) to create source names
314
319
fsPathToSourceNamePath ( subpath ) ,
315
320
) ;
316
321
317
- const resolvedWithTheRightCasing =
318
- this . #resolvedFileBySourceName. get ( sourceName ) ;
322
+ const resolved = this . #resolvedFileBySourceName. get ( sourceName ) ;
319
323
320
- if ( resolvedWithTheRightCasing !== undefined ) {
324
+ if ( resolved !== undefined ) {
321
325
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions
322
326
-- If it was, it's a ProjectResolvedFile */
323
- return resolvedWithTheRightCasing as NpmPackageResolvedFile ;
327
+ return resolved as NpmPackageResolvedFile ;
324
328
}
325
329
326
330
const fsPath = path . join ( npmPackage . rootFsPath , trueCaseFsPath ) ;
You can’t perform that action at this time.
0 commit comments