Socket
Socket
Sign inDemoInstall

knifecycle

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knifecycle - npm Package Compare versions

Comparing version 5.3.0 to 6.0.0

15

CHANGELOG.md

@@ -0,1 +1,16 @@

# [6.0.0](https://github.com/nfroidure/knifecycle/compare/v5.3.0...v6.0.0) (2019-03-15)
### Code Refactoring
* **Chore:** Better handling of optional dependencies ([539eb47](https://github.com/nfroidure/knifecycle/commit/539eb47))
### BREAKING CHANGES
* **Chore:** Autoloaders needs to throw a E_UNMATCHED_DEPENDENCY error to still work with
optional dependencies
# [5.3.0](https://github.com/nfroidure/knifecycle/compare/v5.2.0...v5.3.0) (2019-03-03)

@@ -2,0 +17,0 @@

5

dist/index.js

@@ -854,5 +854,4 @@ "use strict";

} catch (err) {
// Let pass code errors through to avoid casting
// invalid code to an optional service
if (optional && !(err instanceof SyntaxError) && !(err instanceof TypeError) && !(err instanceof ReferenceError) && !(err instanceof EvalError) && !(err instanceof RangeError)) {
if (optional && ['E_UNMATCHED_DEPENDENCY', E_AUTOLOADER_DYNAMIC_DEPENDENCY].includes(err.code)) {
debug('Optional dependency not found:', serviceDeclaration, err.stack);
return;

@@ -859,0 +858,0 @@ }

22

dist/index.mocha.js

@@ -671,10 +671,16 @@ "use strict";

}
}, async () => async serviceName => ({
path: '/path/of/debug',
initializer: (0, _index.initializer)({
type: 'service',
name: 'hash2',
inject: ['hash3']
}, async () => 'THE_HASH:' + serviceName)
})));
}, async () => async serviceName => {
if ('ENV' === serviceName) {
throw new _yerror.default('E_UNMATCHED_DEPENDENCY');
}
return {
path: '/path/of/debug',
initializer: (0, _index.initializer)({
type: 'service',
name: 'hash2',
inject: ['hash3']
}, async () => 'THE_HASH:' + serviceName)
};
}));
const dependencies = await $.run(['hash', '?ENV']);

@@ -681,0 +687,0 @@

{
"name": "knifecycle",
"version": "5.3.0",
"version": "6.0.0",
"description": "Manage your NodeJS processes's lifecycle automatically with an unobtrusive dependency injection implementation.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -89,2 +89,3 @@ [//]: # ( )

import fs from 'fs';
import YError from 'YError';
import Knifecycle, { initializer, constant, inject, name } from 'knifecycle';

@@ -200,3 +201,4 @@

// DB_URI constant it needs
$.register(constant('DB_URI', 'posgresql://xxxx').register(initDB));
$.register(constant('DB_URI', 'posgresql://xxxx'));
$.register(initDB);

@@ -241,3 +243,6 @@ // Say we need to use two different DB server

if ('command' !== serviceName) {
throw new Error(`${serviceName} not supported!`);
// Allows to signal that the dependency is not found
// so that optional dependencies doesn't impeach the
// injector to resolve the dependency tree
throw new YError('E_UNMATCHED_DEPENDENCY', serviceName);
}

@@ -244,0 +249,0 @@ try {

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