@tstdl/base 0.93.16 → 0.93.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/injector/injector.js +4 -2
- package/package.json +1 -1
package/injector/injector.js
CHANGED
|
@@ -320,8 +320,10 @@ export class Injector {
|
|
|
320
320
|
}
|
|
321
321
|
_resolveRegistration(registration, argument, options, context, chain) {
|
|
322
322
|
checkOverflow(chain, context);
|
|
323
|
-
const { token, providers } = registration;
|
|
324
|
-
|
|
323
|
+
const { token, provider, providers } = registration;
|
|
324
|
+
// A new scope is only needed if we are instantiating a class, running a factory, or if the registration explicitly defines scoped providers.
|
|
325
|
+
const needsNewScope = isClassProvider(provider) || isFactoryProvider(provider) || (providers.length > 0);
|
|
326
|
+
const injector = needsNewScope ? this.fork('ResolutionInjector') : this;
|
|
325
327
|
for (const nestedProvider of providers) {
|
|
326
328
|
injector.registerSingleton(nestedProvider.provide, nestedProvider, { multi: nestedProvider.multi });
|
|
327
329
|
}
|