mirror of https://github.com/status-im/metro.git
metro: ModuleResolution: do not allow recursive package directories
Reviewed By: davidaurelio Differential Revision: D6612113 fbshipit-source-id: 8b688cb3eed5cc76b07f471ecc98e22e765583ad
This commit is contained in:
parent
9ff46c13e3
commit
6adc4cccd2
|
@ -107,7 +107,7 @@ type FileCandidates =
|
|||
* a module name as directory.
|
||||
*/
|
||||
type DirCandidates =
|
||||
| {|+type: 'package', +dir: DirCandidates, +file: FileCandidates|}
|
||||
| {|+type: 'package', +index: FileCandidates, +file: FileCandidates|}
|
||||
| {|+type: 'index', +file: FileCandidates|};
|
||||
|
||||
type FileAndDirCandidates = {|+dir: DirCandidates, +file: FileCandidates|};
|
||||
|
@ -477,13 +477,13 @@ function resolvePackage(
|
|||
if (fileResult.type === 'resolved') {
|
||||
return fileResult;
|
||||
}
|
||||
const dirResult = resolveDir(context, mainPrefixPath, platform);
|
||||
if (dirResult.type === 'resolved') {
|
||||
return dirResult;
|
||||
const indexResult = resolveFile(context, mainPrefixPath, 'index', platform);
|
||||
if (indexResult.type === 'resolved') {
|
||||
return indexResult;
|
||||
}
|
||||
return failedFor({
|
||||
type: 'package',
|
||||
dir: dirResult.candidates,
|
||||
index: indexResult.candidates,
|
||||
file: fileResult.candidates,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue