Socket
Socket
Sign inDemoInstall

metro-resolver

Package Overview
Dependencies
Maintainers
2
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-resolver - npm Package Compare versions

Comparing version 0.80.9 to 0.80.10

7

package.json
{
"name": "metro-resolver",
"version": "0.80.9",
"version": "0.80.10",
"description": "🚇 Implementation of Metro's resolution logic.",

@@ -19,4 +19,7 @@ "main": "src",

"devDependencies": {
"metro": "0.80.9"
"metro": "0.80.10"
},
"dependencies": {
"flow-enums-runtime": "^0.0.6"
}
}

@@ -25,2 +25,3 @@ "use strict";

modulePath,
packageRelativePath,
exportsField,

@@ -35,3 +36,3 @@ platform

};
const subpath = getExportsSubpath(packagePath, modulePath);
const subpath = getExportsSubpath(packageRelativePath);
const exportMap = normalizeExportsField(exportsField, createConfigError);

@@ -41,3 +42,4 @@ if (!isSubpathDefinedInExports(exportMap, subpath)) {

`Attempted to import the module "${modulePath}" which is not listed ` +
`in the "exports" of "${packagePath}".`
`in the "exports" of "${packagePath}" under the requested subpath ` +
`"${subpath}".`
);

@@ -96,4 +98,3 @@ }

}
function getExportsSubpath(packagePath, modulePath) {
const packageSubpath = _path.default.relative(packagePath, modulePath);
function getExportsSubpath(packageSubpath) {
return packageSubpath === ""

@@ -107,11 +108,6 @@ ? "."

if (exportsField.every((value) => typeof value === "string")) {
return exportsField.reduce(
(result, subpath) => ({
...result,
[subpath]: subpath,
}),
{}
);
rootValue = exportsField.find((value) => value.startsWith("./"));
} else {
rootValue = exportsField[0];
}
rootValue = exportsField[0];
} else {

@@ -118,0 +114,0 @@ rootValue = exportsField;

@@ -40,4 +40,5 @@ "use strict";

const { getPackageForModule, mainFields, originModulePath } = context;
const isModulePathAbsolute = _path.default.isAbsolute(modulePath);
const containingPackage = getPackageForModule(
_path.default.isAbsolute(modulePath) ? modulePath : originModulePath
isModulePathAbsolute ? modulePath : originModulePath
);

@@ -48,7 +49,9 @@ if (containingPackage == null) {

let redirectedPath;
if (modulePath.startsWith(".") || _path.default.isAbsolute(modulePath)) {
const packageRelativeModulePath = _path.default.relative(
containingPackage.rootPath,
_path.default.resolve(_path.default.dirname(originModulePath), modulePath)
);
if (modulePath.startsWith(".") || isModulePathAbsolute) {
const packageRelativeModulePath = isModulePathAbsolute
? containingPackage.packageRelativePath
: _path.default.join(
_path.default.dirname(containingPackage.packageRelativePath),
modulePath
);
redirectedPath = matchSubpathFromMainFields(

@@ -55,0 +58,0 @@ "./" + (0, _toPosixPath.default)(packageRelativeModulePath),

@@ -200,5 +200,5 @@ "use strict";

}
function resolvePackage(context, modulePath, platform) {
function resolvePackage(context, absoluteCandidatePath, platform) {
if (context.unstable_enablePackageExports) {
const pkg = context.getPackageForModule(modulePath);
const pkg = context.getPackageForModule(absoluteCandidatePath);
const exportsField = pkg?.packageJson.exports;

@@ -220,3 +220,4 @@ if (pkg != null && exportsField != null) {

pkg.rootPath,
modulePath,
absoluteCandidatePath,
pkg.packageRelativePath,
exportsField,

@@ -245,3 +246,3 @@ platform

}
return resolveModulePath(context, modulePath, platform);
return resolveModulePath(context, absoluteCandidatePath, platform);
}

@@ -248,0 +249,0 @@ function resolvePackageEntryPoint(context, packagePath, platform) {

@@ -67,2 +67,8 @@ /**

export interface PackageForModule extends PackageInfo {
/* A system-separated subpath (with no './' prefix) that reflects the subpath
of the given candidate relative to the returned rootPath. */
readonly packageRelativePath: string;
}
/**

@@ -101,8 +107,11 @@ * Check existence of a single file.

/**
* Get the package information and parsed `package.json` file for for a given
* module path, if it is contained within an npm package.
* Get the closest package scope, parsed `package.json` and relative subpath
* for a given absolute candidate path (which need not exist), or null if
* there is no package.json closer than the nearest node_modules directory.
*
* @deprecated
* @deprecated See https://github.com/facebook/metro/commit/29c77bff31e2475a086bc3f04073f485da8f9ff0
*/
readonly getPackageForModule: (modulePath: string) => PackageInfo | null;
readonly getPackageForModule: (
absoluteModulePath: string,
) => PackageForModule | null;

@@ -109,0 +118,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc