@tinkoff/dippy
Advanced tools
Comparing version 0.10.5 to 0.10.6
@@ -12,3 +12,3 @@ import { createToken } from './createToken/createToken.es.js'; | ||
this.root = root; | ||
this.register({ provide: DI_TOKEN, useValue: this }); | ||
this.register({ provide: DI_TOKEN, useValue: this, scope: Scope.REQUEST }); | ||
this.register({ provide: IS_DI_CHILD_CONTAINER_TOKEN, useValue: true }); | ||
@@ -15,0 +15,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict'; | ||
this.root = root; | ||
this.register({ provide: tokens.DI_TOKEN, useValue: this }); | ||
this.register({ provide: tokens.DI_TOKEN, useValue: this, scope: constant.Scope.REQUEST }); | ||
this.register({ provide: IS_DI_CHILD_CONTAINER_TOKEN, useValue: true }); | ||
@@ -19,0 +19,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Errors, Scope } from './constant.es.js'; | ||
import { Scope, Errors } from './constant.es.js'; | ||
import { createError } from './createError.es.js'; | ||
@@ -83,3 +83,3 @@ import { DI_TOKEN } from './tokens.es.js'; | ||
// eslint-disable-next-line max-params | ||
function makeRecord(factory, resolvedDeps, scope, multi, stack) { | ||
function makeRecord(factory, resolvedDeps, scope, multi, stack, staticValue) { | ||
return { | ||
@@ -91,2 +91,3 @@ factory, | ||
stack, | ||
staticValue, | ||
}; | ||
@@ -99,2 +100,3 @@ } | ||
let scope = (_a = (provider.provide.isModernToken && provider.provide.options.scope)) !== null && _a !== void 0 ? _a : Scope.REQUEST; | ||
let staticValue = false; | ||
if ('useFactory' in provider) { | ||
@@ -128,2 +130,4 @@ factory = (deps) => provider.useFactory(deps); | ||
factory = () => provider.useValue; | ||
// mark record from useValue as static, useful if we need to find collisions only for dynamic dependencies | ||
staticValue = true; | ||
if (provider.scope) { | ||
@@ -136,3 +140,3 @@ scope = provider.scope; | ||
} | ||
return makeRecord(factory, resolvedDeps, scope, false, provider.__stack); | ||
return makeRecord(factory, resolvedDeps, scope, false, provider.__stack, staticValue); | ||
} | ||
@@ -156,3 +160,3 @@ function providerToValue(provider) { | ||
this.fallback = fallback; | ||
this.register({ provide: DI_TOKEN, useValue: this }); | ||
this.register({ provide: DI_TOKEN, useValue: this, scope: Scope.SINGLETON }); | ||
} | ||
@@ -159,0 +163,0 @@ get(tokenORObject) { |
@@ -8,3 +8,4 @@ import type { Provider, ScopeVariants, ProvideDepsIterator } from './Provider'; | ||
stack?: string; | ||
staticValue?: boolean; | ||
} | ||
//# sourceMappingURL=Container.h.d.ts.map |
@@ -87,3 +87,3 @@ 'use strict'; | ||
// eslint-disable-next-line max-params | ||
function makeRecord(factory, resolvedDeps, scope, multi, stack) { | ||
function makeRecord(factory, resolvedDeps, scope, multi, stack, staticValue) { | ||
return { | ||
@@ -95,2 +95,3 @@ factory, | ||
stack, | ||
staticValue, | ||
}; | ||
@@ -103,2 +104,3 @@ } | ||
let scope = (_a = (provider.provide.isModernToken && provider.provide.options.scope)) !== null && _a !== void 0 ? _a : constant.Scope.REQUEST; | ||
let staticValue = false; | ||
if ('useFactory' in provider) { | ||
@@ -132,2 +134,4 @@ factory = (deps) => provider.useFactory(deps); | ||
factory = () => provider.useValue; | ||
// mark record from useValue as static, useful if we need to find collisions only for dynamic dependencies | ||
staticValue = true; | ||
if (provider.scope) { | ||
@@ -140,3 +144,3 @@ scope = provider.scope; | ||
} | ||
return makeRecord(factory, resolvedDeps, scope, false, provider.__stack); | ||
return makeRecord(factory, resolvedDeps, scope, false, provider.__stack, staticValue); | ||
} | ||
@@ -160,3 +164,3 @@ function providerToValue(provider) { | ||
this.fallback = fallback; | ||
this.register({ provide: tokens.DI_TOKEN, useValue: this }); | ||
this.register({ provide: tokens.DI_TOKEN, useValue: this, scope: constant.Scope.SINGLETON }); | ||
} | ||
@@ -163,0 +167,0 @@ get(tokenORObject) { |
{ | ||
"name": "@tinkoff/dippy", | ||
"version": "0.10.5", | ||
"version": "0.10.6", | ||
"initialVersion": "0.7.27", | ||
@@ -5,0 +5,0 @@ "description": "", |
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
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
81278
1706