New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-resolve

Package Overview
Dependencies
Maintainers
3
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-resolve - npm Package Compare versions

Comparing version 19.0.2 to 19.1.0-alpha.eed82034

build/defaultResolver.js

57

build/index.js

@@ -18,4 +18,3 @@ /**

const path = require('path');
const resolve = require('resolve');
const browserResolve = require('browser-resolve');
const isBuiltinModule = require('is-builtin-module');

@@ -52,6 +51,9 @@

const NATIVE_PLATFORM = 'native';
const nodePaths =
process.env.NODE_PATH ? process.env.NODE_PATH.split(path.delimiter) : null;
const nodePaths = process.env.NODE_PATH ?
process.env.NODE_PATH.split(path.delimiter) :
null;

@@ -70,8 +72,10 @@ class Resolver {

extensions: options.extensions,
hasCoreModules:
options.hasCoreModules === undefined ? true : options.hasCoreModules,
hasCoreModules: options.hasCoreModules === undefined ?
true :
options.hasCoreModules,
moduleDirectories: options.moduleDirectories || ['node_modules'],
moduleNameMapper: options.moduleNameMapper,
modulePaths: options.modulePaths,
platforms: options.platforms };
platforms: options.platforms,
resolver: options.resolver };

@@ -85,9 +89,10 @@ this._moduleMap = moduleMap;

static findNodeModule(path, options) {
/* $FlowFixMe */
const resolver = require(options.resolver || './defaultResolver.js');
const paths = options.paths;
try {
const resv = options.browser ? browserResolve : resolve;
return resv.sync(
path,
{
return resolver(path, {
basedir: options.basedir,
browser: options.browser,
extensions: options.extensions,

@@ -97,3 +102,2 @@ moduleDirectory: options.moduleDirectory,

} catch (e) {}

@@ -139,4 +143,3 @@ return null;

// to look at modules that may not exist and aren't mocked.
const skipResolution =
options &&
const skipResolution = options &&
options.skipNodeResolution &&

@@ -151,3 +154,4 @@ !moduleName.includes(path.sep);

moduleDirectory,
paths });
paths,
resolver: this._options.resolver });

@@ -184,9 +188,3 @@

isCoreModule(moduleName) {
return (
this._options.hasCoreModules && (
resolve.isCore(moduleName) ||
moduleName === 'v8'));
return this._options.hasCoreModules && isBuiltinModule(moduleName);
}

@@ -260,3 +258,5 @@

const sep = path.delimiter;
const id = moduleType + sep + (absolutePath ? absolutePath + sep : '') + (
const id = moduleType +
sep + (
absolutePath ? absolutePath + sep : '') + (
mockPath ? mockPath + sep : '');

@@ -302,6 +302,4 @@

_isModuleResolved(from, moduleName) {
return !!(
this.getModule(moduleName) ||
return !!(this.getModule(moduleName) ||
this.getMockModule(from, moduleName));
}

@@ -328,5 +326,4 @@

}
return this.getModule(moduleName) || Resolver.findNodeModule(
moduleName,
{
return this.getModule(moduleName) ||
Resolver.findNodeModule(moduleName, {
basedir: dirname,

@@ -338,3 +335,2 @@ browser: this._options.browser,

}

@@ -351,3 +347,2 @@ }

module.exports = Resolver;
{
"name": "jest-resolve",
"version": "19.0.2",
"version": "19.1.0-alpha.eed82034",
"repository": {

@@ -12,5 +12,8 @@ "type": "git",

"browser-resolve": "^1.11.2",
"jest-haste-map": "^19.0.0",
"resolve": "^1.2.0"
"is-builtin-module": "^1.0.0",
"resolve": "^1.3.2"
},
"devDependencies": {
"jest-haste-map": "^19.1.0-alpha.eed82034"
}
}
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