Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wessberg/di

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wessberg/di - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

dist/es2015/construct-instance-options/i-construct-instance-options.d.ts

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="1.0.25"></a>
## 1.0.25 (2017-09-10)
* 1.0.25 ([ec30aea](https://github.com/wessberg/di/commit/ec30aea))
* Added better diagnostics ([26c0b7d](https://github.com/wessberg/di/commit/26c0b7d))
* Bumped version ([14dfb3e](https://github.com/wessberg/di/commit/14dfb3e))
* Fixed JSDoc ([e927f24](https://github.com/wessberg/di/commit/e927f24))
<a name="1.0.24"></a>

@@ -2,0 +12,0 @@ ## 1.0.24 (2017-09-03)

5

dist/es2015/di-container/di-container.d.ts

@@ -88,5 +88,6 @@ import { IDIContainer } from "./i-di-container";

* @param {string} identifier
* @param {string} [parent]
* @returns {IRegistrationRecord<T,U>}
*/
private getRegistrationRecord<T, U>(identifier);
private getRegistrationRecord<T, U>({identifier, parent});
/**

@@ -105,4 +106,4 @@ * Caches the given instance so that it can be retrieved in the future.

*/
private constructInstance<T>({identifier});
private constructInstance<T>({identifier, parent});
}
export declare const DIContainer: DIServiceContainer;

11

dist/es2015/di-container/di-container.js

@@ -115,8 +115,9 @@ import { RegistrationKind } from "../registration-kind/registration-kind";

* @param {string} identifier
* @param {string} [parent]
* @returns {IRegistrationRecord<T,U>}
*/
getRegistrationRecord(identifier) {
getRegistrationRecord({ identifier, parent }) {
const record = this.serviceRegistry.get(identifier);
if (record == null)
throw new ReferenceError(`${this.constructor.name} could not get registration record: No implementation was found!`);
throw new ReferenceError(`${this.constructor.name} could not find a service for identifier: "${identifier}". ${parent == null ? "" : `It is required by the service: '${parent}'.`} Remember to register it as a service!`);
return record;

@@ -140,4 +141,4 @@ }

*/
constructInstance({ identifier }) {
const registrationRecord = this.getRegistrationRecord(identifier);
constructInstance({ identifier, parent }) {
const registrationRecord = this.getRegistrationRecord({ identifier, parent });
// If an instance already exists (and it is a singleton), return that one

@@ -159,3 +160,3 @@ if (this.hasInstance(identifier) && registrationRecord.kind === RegistrationKind.SINGLETON) {

// Instantiate all of the argument services (or re-use them if they were registered as singletons)
const instanceArgs = mappedArgs.map((dep) => dep === undefined ? undefined : this.constructInstance({ identifier: dep }));
const instanceArgs = mappedArgs.map((dep) => dep === undefined ? undefined : this.constructInstance({ identifier: dep, parent: identifier }));
try {

@@ -162,0 +163,0 @@ // Try to construct an instance with 'new' and if it fails, call the implementation directly.

@@ -88,5 +88,6 @@ import { IDIContainer } from "./i-di-container";

* @param {string} identifier
* @param {string} [parent]
* @returns {IRegistrationRecord<T,U>}
*/
private getRegistrationRecord<T, U>(identifier);
private getRegistrationRecord<T, U>({identifier, parent});
/**

@@ -105,4 +106,4 @@ * Caches the given instance so that it can be retrieved in the future.

*/
private constructInstance<T>({identifier});
private constructInstance<T>({identifier, parent});
}
export declare const DIContainer: DIServiceContainer;

@@ -126,8 +126,9 @@ (function (factory) {

* @param {string} identifier
* @param {string} [parent]
* @returns {IRegistrationRecord<T,U>}
*/
getRegistrationRecord(identifier) {
getRegistrationRecord({ identifier, parent }) {
const record = this.serviceRegistry.get(identifier);
if (record == null)
throw new ReferenceError(`${this.constructor.name} could not get registration record: No implementation was found!`);
throw new ReferenceError(`${this.constructor.name} could not find a service for identifier: "${identifier}". ${parent == null ? "" : `It is required by the service: '${parent}'.`} Remember to register it as a service!`);
return record;

@@ -151,4 +152,4 @@ }

*/
constructInstance({ identifier }) {
const registrationRecord = this.getRegistrationRecord(identifier);
constructInstance({ identifier, parent }) {
const registrationRecord = this.getRegistrationRecord({ identifier, parent });
// If an instance already exists (and it is a singleton), return that one

@@ -170,3 +171,3 @@ if (this.hasInstance(identifier) && registrationRecord.kind === registration_kind_1.RegistrationKind.SINGLETON) {

// Instantiate all of the argument services (or re-use them if they were registered as singletons)
const instanceArgs = mappedArgs.map((dep) => dep === undefined ? undefined : this.constructInstance({ identifier: dep }));
const instanceArgs = mappedArgs.map((dep) => dep === undefined ? undefined : this.constructInstance({ identifier: dep, parent: identifier }));
try {

@@ -173,0 +174,0 @@ // Try to construct an instance with 'new' and if it fails, call the implementation directly.

{
"name": "@wessberg/di",
"version": "1.0.24",
"version": "1.0.25",
"description": "A Dependency-Injection container that holds services and can produce instances of them as required. It mimics reflection by parsing the app at compile-time and supporting the generic-reflection syntax.",

@@ -5,0 +5,0 @@ "scripts": {

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