mirror of https://github.com/status-im/metro.git
ModuleGraph/node-haste: remove dep over ResolutionRequest
Reviewed By: mjesun Differential Revision: D7040976 fbshipit-source-id: 93d43342ee23b7f3496afbb532bbc12fefd6e61e
This commit is contained in:
parent
4670c08206
commit
0154fb32eb
|
@ -16,7 +16,6 @@ const FilesByDirNameIndex = require('../../node-haste/FilesByDirNameIndex');
|
|||
const HasteFS = require('./HasteFS');
|
||||
const Module = require('./Module');
|
||||
const ModuleCache = require('./ModuleCache');
|
||||
const ResolutionRequest = require('../../node-haste/DependencyGraph/ResolutionRequest');
|
||||
|
||||
const defaults = require('../../defaults');
|
||||
const parsePlatformFilePath = require('../../node-haste/lib/parsePlatformFilePath');
|
||||
|
@ -128,7 +127,6 @@ exports.createResolveFn = function(options: ResolveOptions): ResolveFn {
|
|||
getTransformedFile,
|
||||
);
|
||||
|
||||
const resolutionRequests = {};
|
||||
const filesByDirNameIndex = new FilesByDirNameIndex(files);
|
||||
const assetResolutionCache = new AssetResolutionCache({
|
||||
assetExtensions: new Set(assetExts),
|
||||
|
@ -153,21 +151,12 @@ exports.createResolveFn = function(options: ResolveOptions): ResolveFn {
|
|||
});
|
||||
|
||||
return (id, sourcePath, platform, _, callback) => {
|
||||
let resolutionRequest = resolutionRequests[platform];
|
||||
if (!resolutionRequest) {
|
||||
resolutionRequest = resolutionRequests[platform] = new ResolutionRequest({
|
||||
moduleResolver,
|
||||
entryPath: '',
|
||||
helpers,
|
||||
platform,
|
||||
moduleCache,
|
||||
});
|
||||
}
|
||||
|
||||
const from =
|
||||
sourcePath != null
|
||||
? new Module(sourcePath, moduleCache, getTransformedFile(sourcePath))
|
||||
: NULL_MODULE;
|
||||
return resolutionRequest.resolveDependency(from, id).path;
|
||||
const allowHaste = !helpers.isNodeModulesDir(from.path);
|
||||
return moduleResolver.resolveDependency(from, id, allowHaste, platform)
|
||||
.path;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue