Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
redirectModulePath: modulePath =>
this._redirectRequire(fromModule, modulePath),
allowHaste,
platform,
resolveHasteModule: name =>
this._options.moduleMap.getModule(name, platform, true),
resolveHastePackage: name =>
this._options.moduleMap.getPackage(name, platform, true),
getPackageMainPath: this._getPackageMainPath
}),
moduleName,
platform
);
return this._getFileResolvedModule(result);
} catch (error) {
if (error instanceof Resolver.FailedToResolvePathError) {
const candidates = error.candidates;
throw new UnableToResolveError(
path.relative(this._options.projectRoot, fromModule.path),
moduleName,
[
"\n\nNone of these files exist:",
` * ${Resolver.formatFileCandidates(
this._removeRoot(candidates.file)
)}`,
` * ${Resolver.formatFileCandidates(
this._removeRoot(candidates.dir)
)}`
].join("\n")
);
}
redirectModulePath: modulePath =>
this._redirectRequire(fromModule, modulePath),
allowHaste,
platform,
resolveHasteModule: name =>
this._options.moduleMap.getModule(name, platform, true),
resolveHastePackage: name =>
this._options.moduleMap.getPackage(name, platform, true),
getPackageMainPath: this._getPackageMainPath
}),
moduleName,
platform
);
return this._getFileResolvedModule(result);
} catch (error) {
if (error instanceof Resolver.FailedToResolvePathError) {
const candidates = error.candidates;
throw new UnableToResolveError(
fromModule.path,
moduleName,
[
`The module \`${moduleName}\` could not be found from \`${
fromModule.path
}\`. Indeed, none of these files exist:`,
` * \`${Resolver.formatFileCandidates(candidates.file)}\``,
` * \`${Resolver.formatFileCandidates(candidates.dir)}\``
].join("\n")
);
}
if (error instanceof Resolver.FailedToResolveNameError) {
const dirPaths = error.dirPaths,
redirectModulePath: (modulePath: string) =>
this._redirectRequire(fromModule, modulePath),
allowHaste,
platform,
resolveHasteModule: (name: string) =>
this._options.moduleMap.getModule(name, platform, true),
resolveHastePackage: (name: string) =>
this._options.moduleMap.getPackage(name, platform, true),
getPackageMainPath: this._getPackageMainPath,
},
moduleName,
platform,
);
return this._getFileResolvedModule(result);
} catch (error) {
if (error instanceof Resolver.FailedToResolvePathError) {
const {candidates} = error;
throw new UnableToResolveError(
path.relative(this._options.projectRoot, fromModule.path),
moduleName,
[
'\n\nNone of these files exist:',
` * ${Resolver.formatFileCandidates(
this._removeRoot(candidates.file),
)}`,
` * ${Resolver.formatFileCandidates(
this._removeRoot(candidates.dir),
)}`,
].join('\n'),
);
}
if (error instanceof Resolver.FailedToResolveNameError) {