resolve-from
Advanced tools
Comparing version 3.0.0 to 4.0.0
14
index.js
'use strict'; | ||
const path = require('path'); | ||
const Module = require('module'); | ||
const fs = require('fs'); | ||
@@ -14,3 +15,14 @@ const resolveFrom = (fromDir, moduleId, silent) => { | ||
fromDir = path.resolve(fromDir); | ||
try { | ||
fromDir = fs.realpathSync(fromDir); | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
fromDir = path.resolve(fromDir); | ||
} else if (silent) { | ||
return null; | ||
} else { | ||
throw err; | ||
} | ||
} | ||
const fromFile = path.join(fromDir, 'noop.js'); | ||
@@ -17,0 +29,0 @@ |
{ | ||
"name": "resolve-from", | ||
"version": "3.0.0", | ||
"description": "Resolve the path of a module like `require.resolve()` but from a given path", | ||
"license": "MIT", | ||
"repository": "sindresorhus/resolve-from", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"require", | ||
"resolve", | ||
"path", | ||
"module", | ||
"from", | ||
"like", | ||
"import", | ||
"path" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "resolve-from", | ||
"version": "4.0.0", | ||
"description": "Resolve the path of a module like `require.resolve()` but from a given path", | ||
"license": "MIT", | ||
"repository": "sindresorhus/resolve-from", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"require", | ||
"resolve", | ||
"path", | ||
"module", | ||
"from", | ||
"like", | ||
"import" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) | ||
``` | ||
$ npm install --save resolve-from | ||
$ npm install resolve-from | ||
``` | ||
@@ -64,6 +64,7 @@ | ||
- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory | ||
- [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path | ||
- [req-cwd](https://github.com/sindresorhus/req-cwd) - Require a module from the current working directory | ||
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path | ||
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory | ||
- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point | ||
- [lazy-req](https://github.com/sindresorhus/lazy-req) - Require modules lazily | ||
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily | ||
- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module | ||
@@ -70,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4641
39
73
3