Socket
Socket
Sign inDemoInstall

@mediaclip/dependency-injection

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mediaclip/dependency-injection - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

72

dist/index.js

@@ -18,28 +18,2 @@ var __defProp = Object.defineProperty;

// src/token.ts
var DiToken = class _DiToken {
constructor(symbol) {
this.symbol = symbol;
this.scope = "singleton";
}
static create(name) {
return new _DiToken(Symbol(name));
}
static mergeTokens(a, b, c, d, e, f, g, h) {
return Object.assign(a, b || {}, c || {}, d || {}, e || {}, f || {}, g || {}, h || {});
}
};
var ScopedDiToken = class _ScopedDiToken {
constructor(symbol) {
this.symbol = symbol;
this.scope = "scoped";
}
static mergeTokens(a, b, c, d, e, f, g, h) {
return Object.assign(a, b || {}, c || {}, d || {}, e || {}, f || {}, g || {}, h || {});
}
static create(name) {
return new _ScopedDiToken(Symbol(name));
}
};
// src/utils.ts

@@ -117,6 +91,6 @@ function ident(str, spaces) {

const instance = this.tryResolveFrom(token, this.singletonInstances);
if (instance)
if (instance !== void 0)
return instance;
const newInstance = this.tryResolveSingletonFromFactory(token);
if (newInstance)
if (newInstance !== void 0)
return this.saveSingletonInstance(token, newInstance);

@@ -190,11 +164,11 @@ if (this.scopedFactories.has(token.symbol)) {

tryResolve(token, container) {
if (token instanceof ScopedDiToken) {
if (token.scope === "scoped") {
const instance = this.tryResolveInstance(token);
if (instance)
if (instance !== void 0)
return instance;
const newInstance = this.tryResolveScopedFromFactory(token, container);
if (newInstance)
if (newInstance !== void 0)
return this.saveScopeInstances(token, newInstance);
const parentScopedFactory = this.parentContainer.tryResolveScopedFactory(token);
if (parentScopedFactory) {
if (parentScopedFactory !== void 0) {
return this.saveScopeInstances(token, parentScopedFactory(container != null ? container : this));

@@ -204,11 +178,11 @@ }

const parentInstance = this.parentContainer.tryResolve(token, container);
if (parentInstance)
if (parentInstance !== void 0)
return parentInstance;
}
} else if (token instanceof DiToken) {
} else if (token.scope === "singleton") {
const singletonInstance = super.tryResolve(token);
if (singletonInstance) {
if (singletonInstance !== void 0) {
return singletonInstance;
}
return this.parentContainer.tryResolve(token);
return this.parentContainer.tryResolve(token, container);
}

@@ -257,2 +231,28 @@ }

};
// src/token.ts
var DiToken = class _DiToken {
constructor(symbol) {
this.symbol = symbol;
this.scope = "singleton";
}
static create(name) {
return new _DiToken(Symbol(name));
}
static mergeTokens(a, b, c, d, e, f, g, h) {
return Object.assign(a, b || {}, c || {}, d || {}, e || {}, f || {}, g || {}, h || {});
}
};
var ScopedDiToken = class _ScopedDiToken {
constructor(symbol) {
this.symbol = symbol;
this.scope = "scoped";
}
static mergeTokens(a, b, c, d, e, f, g, h) {
return Object.assign(a, b || {}, c || {}, d || {}, e || {}, f || {}, g || {}, h || {});
}
static create(name) {
return new _ScopedDiToken(Symbol(name));
}
};
export {

@@ -259,0 +259,0 @@ DiContainer,

@@ -7,3 +7,3 @@ {

"name": "@mediaclip/dependency-injection",
"version": "1.0.5",
"version": "1.0.6",
"main": "./dist/index.js",

@@ -10,0 +10,0 @@ "keywords": [

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