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.
|
* a module name as directory.
|
||||||
*/
|
*/
|
||||||
type DirCandidates =
|
type DirCandidates =
|
||||||
| {|+type: 'package', +dir: DirCandidates, +file: FileCandidates|}
|
| {|+type: 'package', +index: FileCandidates, +file: FileCandidates|}
|
||||||
| {|+type: 'index', +file: FileCandidates|};
|
| {|+type: 'index', +file: FileCandidates|};
|
||||||
|
|
||||||
type FileAndDirCandidates = {|+dir: DirCandidates, +file: FileCandidates|};
|
type FileAndDirCandidates = {|+dir: DirCandidates, +file: FileCandidates|};
|
||||||
|
@ -477,13 +477,13 @@ function resolvePackage(
|
||||||
if (fileResult.type === 'resolved') {
|
if (fileResult.type === 'resolved') {
|
||||||
return fileResult;
|
return fileResult;
|
||||||
}
|
}
|
||||||
const dirResult = resolveDir(context, mainPrefixPath, platform);
|
const indexResult = resolveFile(context, mainPrefixPath, 'index', platform);
|
||||||
if (dirResult.type === 'resolved') {
|
if (indexResult.type === 'resolved') {
|
||||||
return dirResult;
|
return indexResult;
|
||||||
}
|
}
|
||||||
return failedFor({
|
return failedFor({
|
||||||
type: 'package',
|
type: 'package',
|
||||||
dir: dirResult.candidates,
|
index: indexResult.candidates,
|
||||||
file: fileResult.candidates,
|
file: fileResult.candidates,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue