Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
*
* @format
*/
"use strict";
const path = require("path");
const _require = require("metro-core"),
AmbiguousModuleResolutionError = _require.AmbiguousModuleResolutionError;
const DuplicateHasteCandidatesError = require("jest-haste-map").ModuleMap
.DuplicateHasteCandidatesError;
const _require2 = require("metro-resolver"),
InvalidPackageError = _require2.InvalidPackageError;
const _require3 = require("metro-core"),
PackageResolutionError = _require3.PackageResolutionError;
class ResolutionRequest {
constructor(options) {
this._options = options;
this._resetResolutionCache();
}
resolveDependency(fromModule, toModuleName) {
const resHash = getResolutionCacheKey(fromModule.path, toModuleName);
const immediateResolution = this._immediateResolutionCache[resHash];
if (immediateResolution) {
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* strict-local
* @format
*/
"use strict";
const _require = require("metro-resolver"),
formatFileCandidates = _require.formatFileCandidates;
const _require2 = require("metro-resolver"),
InvalidPackageError = _require2.InvalidPackageError;
class PackageResolutionError extends Error {
constructor(opts) {
const perr = opts.packageError;
super(
`While trying to resolve module \`${opts.targetModuleName}\` from file ` +
`\`${opts.originModulePath}\`, the package ` +
`\`${perr.packageJsonPath}\` was successfully found. However, ` +
"this package itself specifies " +
"a `main` module field that could not be resolved (" +
`\`${perr.mainPrefixPath}\`. Indeed, none of these files exist:\n\n` +
` * \`${formatFileCandidates(perr.fileCandidates)}\`\n` +
` * \`${formatFileCandidates(perr.indexCandidates)}\``
);
Object.assign(this, opts);
}