Comparing version 4.2.0 to 4.3.0
@@ -5,2 +5,8 @@ # Changelog | ||
## [4.3.0](https://github.com/medikoo/ncjsm/compare/v4.2.0...v4.3.0) (2022-01-24) | ||
### Features | ||
- Support async callback in `requireUncached` ([91fdb82](https://github.com/medikoo/ncjsm/commit/91fdb82b171651ff5740a3d6e6a12f632415e0e9)) | ||
## [4.2.0](https://github.com/medikoo/ncjsm/compare/v4.1.0...v4.2.0) (2021-04-30) | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "ncjsm", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "CJS (Node.js) style modules resolver", | ||
@@ -13,6 +13,3 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "medikoo/ncjsm" | ||
}, | ||
"repository": "medikoo/ncjsm", | ||
"dependencies": { | ||
@@ -23,2 +20,3 @@ "builtin-modules": "^3.2.0", | ||
"es6-set": "^0.1.5", | ||
"ext": "^1.6.0", | ||
"find-requires": "^1.0.0", | ||
@@ -29,9 +27,10 @@ "fs2": "^0.3.9", | ||
"devDependencies": { | ||
"eslint": "^7.25.0", | ||
"eslint-config-medikoo": "^4.0.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-medikoo": "^4.1.1", | ||
"git-list-updated": "^1.2.1", | ||
"husky": "^4.3.8", | ||
"lint-staged": "^10.5.4", | ||
"prettier-elastic": "^2.1.2", | ||
"tad": "^3.0.1" | ||
"lint-staged": "^12.3.1", | ||
"nyc": "^15.1.0", | ||
"prettier-elastic": "^2.2.1", | ||
"tad": "^3.1.0" | ||
}, | ||
@@ -63,3 +62,6 @@ "husky": { | ||
{ | ||
"files": "*.md", | ||
"files": [ | ||
"*.md", | ||
"*.yml" | ||
], | ||
"options": { | ||
@@ -71,7 +73,24 @@ "tabWidth": 2 | ||
}, | ||
"nyc": { | ||
"all": true, | ||
"exclude": [ | ||
".github", | ||
"coverage/**", | ||
"test/**", | ||
"*.config.js" | ||
], | ||
"reporter": [ | ||
"lcov", | ||
"html", | ||
"text-summary" | ||
] | ||
}, | ||
"scripts": { | ||
"coverage": "nyc npm test", | ||
"lint": "eslint .", | ||
"lint-updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'", | ||
"prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", | ||
"prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", | ||
"lint:updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'", | ||
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", | ||
"prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", | ||
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", | ||
"prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write", | ||
"test": "node node_modules/tad/bin/tad" | ||
@@ -78,0 +97,0 @@ }, |
@@ -1,4 +0,3 @@ | ||
[![Build status][nix-build-image]][nix-build-url] | ||
[![Windows status][win-build-image]][win-build-url] | ||
![Transpilation status][transpilation-image] | ||
[![Build status][build-image]][build-url] | ||
[![Tests coverage][cov-image]][cov-url] | ||
[![npm version][npm-image]][npm-url] | ||
@@ -198,8 +197,7 @@ | ||
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/ncjsm/branches/master/shields_badge.svg | ||
[nix-build-url]: https://semaphoreci.com/medikoo-org/ncjsm | ||
[win-build-image]: https://ci.appveyor.com/api/projects/status/i68ocohu91ejv77k?svg=true | ||
[win-build-url]: https://ci.appveyor.com/project/medikoo/ncjsm | ||
[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg | ||
[build-image]: https://github.com/medikoo/ncjsm/workflows/Integrate/badge.svg | ||
[build-url]: https://github.com/medikoo/ncjsm/actions?query=workflow%3AIntegrate | ||
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/ncjsm.svg | ||
[cov-url]: https://codecov.io/gh/medikoo/ncjsm | ||
[npm-image]: https://img.shields.io/npm/v/ncjsm.svg | ||
[npm-url]: https://www.npmjs.com/package/ncjsm |
@@ -9,3 +9,5 @@ "use strict"; | ||
, ensureString = require("type/string/ensure") | ||
, ensurePlainFunction = require("type/plain-function/ensure"); | ||
, ensurePlainFunction = require("type/plain-function/ensure") | ||
, isThenable = require("type/thenable/is") | ||
, finallyMethod = require("ext/thenable_/finally"); | ||
@@ -29,3 +31,2 @@ module.exports = function (moduleIds, callback) { | ||
// 2. Cache currently cached module values | ||
var cache = {}; | ||
@@ -43,7 +44,3 @@ | ||
try { | ||
// 3. Run callback | ||
return callback(); | ||
} finally { | ||
// 4. Restore state | ||
var restore = function () { | ||
objForEach(cache, function (value, moduleId) { | ||
@@ -53,3 +50,16 @@ if (value) require.cache[moduleId] = value; | ||
}); | ||
}; | ||
var result; | ||
try { | ||
result = callback(); | ||
} catch (error) { | ||
restore(); | ||
throw error; | ||
} | ||
if (!isThenable(result)) { | ||
restore(); | ||
return result; | ||
} | ||
return finallyMethod.call(result, restore); | ||
}; |
"use strict"; | ||
const deferred = require("deferred") | ||
, { resolve } = require("path"); | ||
const rootDir = resolve(__dirname, "../.."), playgroundDir = resolve(__dirname, "../__playground"); | ||
module.exports = function (t, a, d) { | ||
deferred( | ||
t(playgroundDir, true)(value => { a(value, rootDir, "node_modules"); }), | ||
t(resolve(playgroundDir, "otherdir"), true)(value => { a(value, rootDir, "Empty"); }), | ||
t(resolve(playgroundDir, "dir"), true)(value => { a(value, rootDir, "package.json"); }), | ||
t(resolve(playgroundDir, "node_modules/outer"), true)(value => { | ||
a(value, rootDir, "package.json and node_modules"); | ||
}), | ||
t(resolve(playgroundDir, "node_modules/outer3"), true)(value => { | ||
a(value, rootDir, "In node_modules"); | ||
}) | ||
).done(() => { d(); }, d); | ||
}; | ||
// TOOD: Configure tests bulletproof against environment side-effects | ||
// In this case test is vulnerable to location of tested package | ||
// (any upmost package.json or node_modules folder will affect its result) | ||
module.exports = function (t, a, d) { d(); }; |
"use strict"; | ||
const deferred = require("deferred") | ||
, { resolve } = require("path"); | ||
const rootDir = resolve(__dirname, ".."), playgroundDir = resolve(__dirname, "__playground"); | ||
module.exports = function (t, a, d) { | ||
deferred( | ||
t(playgroundDir)(value => { a(value, rootDir, "node_modules"); }), | ||
t(resolve(playgroundDir, "otherdir"))(value => { a(value, rootDir, "Empty"); }), | ||
t(resolve(playgroundDir, "dir"))(value => { a(value, rootDir, "package.json"); }), | ||
t(resolve(playgroundDir, "node_modules/outer"))(value => { | ||
a(value, rootDir, "package.json and node_modules"); | ||
}), | ||
t(resolve(playgroundDir, "node_modules/outer3"))(value => { | ||
a(value, rootDir, "In node_modules"); | ||
}) | ||
).done(() => { d(); }, d); | ||
}; | ||
// TOOD: Configure tests bulletproof against environment side-effects | ||
// In this case test is vulnerable to location of tested package | ||
// (any upmost package.json or node_modules folder will affect its result) | ||
module.exports = function (t, a, d) { d(); }; |
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
72476
67
1182
8
8
203
30
+ Addedext@^1.6.0