Fix file indentation

Reviewed By: jeanlauliac

Differential Revision: D4819078

fbshipit-source-id: 76bdc2381e479396ef11144236817ffd590f1039
This commit is contained in:
David Aurelio 2017-04-03 08:46:32 -07:00 committed by Facebook Github Bot
parent dcecfa3189
commit b4da59e9c2
1 changed files with 39 additions and 39 deletions

View File

@ -62,58 +62,58 @@ exports.createResolveFn = function(options: ResolveOptions): ResolveFn {
extraNodeModules,
transformedFiles,
} = options;
const files = Object.keys(transformedFiles);
const getTransformedFile =
const files = Object.keys(transformedFiles);
const getTransformedFile =
path => Promise.resolve(
transformedFiles[path] || Promise.reject(new Error(`"${path} does not exist`))
);
const helpers = new DependencyGraphHelpers({
assetExts,
providesModuleNodeModules: defaults.providesModuleNodeModules,
});
const helpers = new DependencyGraphHelpers({
assetExts,
providesModuleNodeModules: defaults.providesModuleNodeModules,
});
const hasteFS = new HasteFS(files);
const moduleCache = new ModuleCache(
const hasteFS = new HasteFS(files);
const moduleCache = new ModuleCache(
filePath => hasteFS.closest(filePath, 'package.json'),
getTransformedFile,
);
const hasteMap = new HasteMap({
extensions: ['js', 'json'],
files,
helpers,
moduleCache,
platforms,
preferNativePlatform: true,
});
const hasteMap = new HasteMap({
extensions: ['js', 'json'],
files,
helpers,
moduleCache,
platforms,
preferNativePlatform: true,
});
const hasteMapBuilt = hasteMap.build();
const resolutionRequests = {};
return (id, source, platform, _, callback) => {
let resolutionRequest = resolutionRequests[platform];
if (!resolutionRequest) {
resolutionRequest = resolutionRequests[platform] = new ResolutionRequest({
dirExists: filePath => hasteFS.dirExists(filePath),
entryPath: '',
extraNodeModules,
hasteFS,
hasteMap,
helpers,
moduleCache,
moduleMap: getFakeModuleMap(hasteMap),
platform,
platforms,
preferNativePlatform: true,
});
}
const hasteMapBuilt = hasteMap.build();
const resolutionRequests = {};
return (id, source, platform, _, callback) => {
let resolutionRequest = resolutionRequests[platform];
if (!resolutionRequest) {
resolutionRequest = resolutionRequests[platform] = new ResolutionRequest({
dirExists: filePath => hasteFS.dirExists(filePath),
entryPath: '',
extraNodeModules,
hasteFS,
hasteMap,
helpers,
moduleCache,
moduleMap: getFakeModuleMap(hasteMap),
platform,
platforms,
preferNativePlatform: true,
});
}
const from = new Module(source, moduleCache, getTransformedFile(source));
hasteMapBuilt
const from = new Module(source, moduleCache, getTransformedFile(source));
hasteMapBuilt
.then(() => resolutionRequest.resolveDependency(from, id))
.then(
// nextTick to escape promise error handling
module => process.nextTick(callback, null, module.path),
error => process.nextTick(callback, error),
);
};
};
};
};