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 10.0.1 to 10.0.2

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## [10.0.2](https://github.com/nfroidure/knifecycle/compare/v10.0.1...v10.0.2) (2020-09-15)
### Bug Fixes
* **utils:** fix optional dependencies merge ([cadac91](https://github.com/nfroidure/knifecycle/commit/cadac9134d0725763bdb69397e86da3d59d1d52b))
## [10.0.1](https://github.com/nfroidure/knifecycle/compare/v10.0.0...v10.0.1) (2020-09-14)

@@ -2,0 +11,0 @@

6

dist/util.js

@@ -277,7 +277,7 @@ "use strict";

}) => {
const isOptionalDependency = currentDependencies.some(({
const isOptionalEverywhere = optional && currentDependencies.every(({
optional,
mappedName: addedMappedName
}) => {
return addedMappedName === mappedName && optional;
return addedMappedName !== mappedName || optional;
});

@@ -287,3 +287,3 @@ return {

mappedName,
optional: isOptionalDependency && optional
optional: isOptionalEverywhere
};

@@ -290,0 +290,0 @@ })).map(stringifyDependencyDeclaration);

@@ -89,3 +89,3 @@ "use strict";

baseInitializer.$type = 'service';
baseInitializer.$inject = ['log'];
baseInitializer.$inject = ['log', '?test'];
baseInitializer.$options = {

@@ -113,2 +113,4 @@ singleton: false

_assert.default.deepEqual(log.args, [['Wrapping...']]);
_assert.default.deepEqual(newInitializer[_util.SPECIAL_PROPS.INJECT], ['log', '?test']);
});

@@ -340,2 +342,11 @@ });

_assert.default.deepEqual(newInitializer[_util.SPECIAL_PROPS.INJECT], ['mysql', 'ENV', 'NODE_ENV', '?TEST', 'TEST2', 'mysql>db']);
it('should preserve single optional dependencies', () => {
const baseProvider = (0, _util.inject)(['ENV', '?TEST'], aProvider);
const newInitializer = (0, _util.alsoInject)(['ENV', '?TEST2'], (0, _util.alsoInject)(['ENV', '?TEST3'], baseProvider));
_assert.default.notEqual(newInitializer, baseProvider);
_assert.default.deepEqual(newInitializer[_util.SPECIAL_PROPS.INJECT], ['ENV', '?TEST', '?TEST2', '?TEST3']);
});
});

@@ -342,0 +353,0 @@ it('should solve final dependencies name clash', () => {

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

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

@@ -260,11 +260,13 @@ import YError from 'yerror';

addedDependencies.map(({ serviceName, mappedName, optional }) => {
const isOptionalDependency = currentDependencies.some(
({ optional, mappedName: addedMappedName }) => {
return addedMappedName === mappedName && optional;
},
);
const isOptionalEverywhere =
optional &&
currentDependencies.every(
({ optional, mappedName: addedMappedName }) => {
return addedMappedName !== mappedName || optional;
},
);
return {
serviceName,
mappedName,
optional: isOptionalDependency && optional,
optional: isOptionalEverywhere,
};

@@ -271,0 +273,0 @@ }),

@@ -86,3 +86,3 @@ import assert from 'assert';

baseInitializer.$type = 'service';
baseInitializer.$inject = ['log'];
baseInitializer.$inject = ['log', '?test'];
baseInitializer.$options = { singleton: false };

@@ -100,2 +100,3 @@ baseInitializer.$extra = { httpHandler: false };

assert.deepEqual(log.args, [['Wrapping...']]);
assert.deepEqual(newInitializer[SPECIAL_PROPS.INJECT], ['log', '?test']);
});

@@ -305,2 +306,18 @@ });

]);
it('should preserve single optional dependencies', () => {
const baseProvider = inject(['ENV', '?TEST'], aProvider);
const newInitializer = alsoInject(
['ENV', '?TEST2'],
alsoInject(['ENV', '?TEST3'], baseProvider),
);
assert.notEqual(newInitializer, baseProvider);
assert.deepEqual(newInitializer[SPECIAL_PROPS.INJECT], [
'ENV',
'?TEST',
'?TEST2',
'?TEST3',
]);
});
});

@@ -307,0 +324,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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