Socket
Socket
Sign inDemoInstall

resolve

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve - npm Package Compare versions

Comparing version 1.12.2 to 1.12.3

6

lib/sync.js

@@ -121,3 +121,4 @@ var core = require('./core');

if (pkg && opts.packageFilter) {
pkg = opts.packageFilter(pkg, pkgfile, dir);
// v2 will pass pkgfile
pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment
}

@@ -137,3 +138,4 @@

if (pkg && opts.packageFilter) {
pkg = opts.packageFilter(pkg, pkgfile, x);
// v2 will pass pkgfile
pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment
}

@@ -140,0 +142,0 @@

{
"name": "resolve",
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
"version": "1.12.2",
"version": "1.12.3",
"repository": {

@@ -29,3 +29,3 @@ "type": "git",

"array.prototype.map": "^1.0.1",
"eslint": "^6.6.0",
"eslint": "^6.7.1",
"object-keys": "^1.1.1",

@@ -32,0 +32,0 @@ "safe-publish-latest": "^1.1.4",

@@ -10,5 +10,6 @@ var path = require('path');

basedir: dir,
packageFilter: function (pkg, pkgfile, dir) {
// NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility
packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment
pkg.main = 'doom'; // eslint-disable-line no-param-reassign
packageFilterArgs = [pkg, pkgfile, dir];
packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef
return pkg;

@@ -23,9 +24,12 @@ }

var packageFile = packageFilterArgs[1];
t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct');
if (!'is 1.x') { // eslint-disable-line no-constant-condition
var packageFile = packageFilterArgs[1];
t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct');
}
var packageDir = packageFilterArgs[2];
t.equal(packageDir, path.join(dir, 'baz'), 'third packageFilter argument is "dir"');
var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition
// eslint-disable-next-line no-constant-condition
t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"');
t.end();
});

@@ -102,5 +102,9 @@ var path = require('path');

test('packageFilter', function (t) {
function relative(x) {
return path.relative(__dirname, x);
}
function testPackageFilter(preserveSymlinks) {
return function (st) {
st.plan(5);
st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition

@@ -113,2 +117,4 @@ var destMain = 'symlinks/dest/node_modules/mod-a/index.js';

/* eslint multiline-comment-style: 0 */
/* v2.x will restore these tests
var packageFilterPath = [];

@@ -118,3 +124,3 @@ var actualPath = resolve.sync('mod-a', {

preserveSymlinks: preserveSymlinks,
packageFilter: function (pkg, pkgfile) {
packageFilter: function (pkg, pkgfile, dir) {
packageFilterPath.push(pkgfile);

@@ -124,11 +130,12 @@ }

st.equal(
actualPath.replace(__dirname + '/', ''),
preserveSymlinks ? destMain : sourceMain,
relative(actualPath),
path.normalize(preserveSymlinks ? destMain : sourceMain),
'sync: actual path is correct'
);
st.deepEqual(
map(packageFilterPath, function (x) { return x.replace(__dirname + '/', ''); }),
preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg],
map(packageFilterPath, relative),
map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize),
'sync: packageFilter pkgfile arg is correct'
);
*/

@@ -148,9 +155,12 @@ var asyncPackageFilterPath = [];

st.equal(
actualPath.replace(__dirname + '/', ''),
preserveSymlinks ? destMain : sourceMain,
relative(actualPath),
path.normalize(preserveSymlinks ? destMain : sourceMain),
'async: actual path is correct'
);
st.deepEqual(
map(asyncPackageFilterPath, function (x) { return x.replace(__dirname + '/', ''); }),
preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg],
map(asyncPackageFilterPath, relative),
map(
preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg],
path.normalize
),
'async: packageFilter pkgfile arg is correct'

@@ -157,0 +167,0 @@ );

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