Comparing version 4.0.1 to 4.1.0
@@ -5,2 +5,8 @@ # Changelog | ||
## [4.1.0](https://github.com/medikoo/ncjsm/compare/v4.0.1...v4.1.0) (2020-07-22) | ||
### Features | ||
- `ignoreExternal` option for `getDependencies` ([158075b](https://github.com/medikoo/ncjsm/commit/158075bea3f66ac77bae5341fd474930172047a2)) | ||
### [4.0.1](https://github.com/medikoo/ncjsm/compare/v4.0.0...v4.0.1) (2019-10-25) | ||
@@ -7,0 +13,0 @@ |
@@ -27,6 +27,9 @@ "use strict"; | ||
depPath => { | ||
if (!nonLocalChar.has(depPath[0]) && builtinModules.has(depPath.split("/")[0])) { | ||
return null; | ||
if (!nonLocalChar.has(depPath[0])) { | ||
if (options.ignoreExternal) return null; | ||
if (builtinModules.has(depPath.split("/")[0])) return null; | ||
} | ||
return cjsResolve(dir, depPath)(pathData => { | ||
return cjsResolve( | ||
dir, depPath | ||
)(pathData => { | ||
if (pathData) return pathData.targetPath; | ||
@@ -33,0 +36,0 @@ if (options.ignoreMissing) return null; |
{ | ||
"name": "ncjsm", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "CJS (Node.js) style modules resolver", | ||
@@ -20,15 +20,15 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
"deferred": "^0.7.11", | ||
"es5-ext": "^0.10.51", | ||
"es5-ext": "^0.10.53", | ||
"es6-set": "^0.1.5", | ||
"find-requires": "^1.0.0", | ||
"fs2": "^0.3.6", | ||
"fs2": "^0.3.8", | ||
"type": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^6.5.1", | ||
"eslint-config-medikoo": "^2.6.0", | ||
"eslint": "^7.5.0", | ||
"eslint-config-medikoo": "^3.1.0", | ||
"git-list-updated": "^1.2.1", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.2", | ||
"prettier-elastic": "^1.18.2", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.2.11", | ||
"prettier-elastic": "^1.19.1", | ||
"tad": "^3.0.1" | ||
@@ -50,3 +50,3 @@ }, | ||
"eslintConfig": { | ||
"extends": "medikoo", | ||
"extends": "medikoo/node/6", | ||
"root": true, | ||
@@ -53,0 +53,0 @@ "env": { |
@@ -142,7 +142,7 @@ [![Build status][nix-build-image]][nix-build-url] | ||
#### getDependecies(modulePath, options = { ignoreMissing: false }) | ||
#### getDependecies(modulePath, options = { ... }) | ||
Resolve all module dependencies. Returns promise that resolves with an array of paths, that includes path to input module and paths to all its dependencies (it includes deep dependencies, so also dependencies of the dependencies). | ||
Paths to native Node.js modules are ignored. If file for given module cannot be found then error is thrown, unless `{ ignoreMissing: true }` is passed with the options | ||
Paths to native Node.js modules are ignored. | ||
@@ -157,2 +157,12 @@ ```javascript | ||
##### Supported `options` | ||
###### `ignoreMissing: false` | ||
If file for given module cannot be found then error is thrown. Set this to `true` to simply ignore not found modules | ||
###### `ignoreEsternal: false` | ||
By default all paths to all required modules are resolved. Resolution scope may be narrowed only to modules from same package (referenced via relative path), by settung this option to `true` | ||
## Tests [![Build Status](https://travis-ci.org/medikoo/ncjsm.svg)](https://travis-ci.org/medikoo/ncjsm) | ||
@@ -159,0 +169,0 @@ |
@@ -7,3 +7,3 @@ "use strict"; | ||
module.exports = function (t, a, d) { | ||
module.exports.regular = function (t, a, d) { | ||
t(resolve(pgDir, "other/index.js")).done(result => { | ||
@@ -22,1 +22,14 @@ a.deep( | ||
}; | ||
module.exports.ignoreExternal = function (t, a, d) { | ||
t(resolve(pgDir, "other/index.js"), { ignoreExternal: true }).done(result => { | ||
a.deep( | ||
result.sort(), | ||
[ | ||
resolve(pgDir, "other/index.js"), resolve(pgDir, "foo.js"), | ||
resolve(pgDir, "dir/subdir/bar.js"), resolve(pgDir, "dir/lorem.js") | ||
].sort() | ||
); | ||
d(); | ||
}, d); | ||
}; |
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
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
57292
1155
177
Updatedes5-ext@^0.10.53
Updatedfs2@^0.3.8