@injex/core
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -128,3 +128,5 @@ "use strict"; | ||
case metadata.lazy: | ||
module = this._createLazyModuleFactoryMethod(item, metadata); | ||
var _a = this._createLazyModuleFactoryMethod(item, metadata), loaderFn = _a[0], loaderInstance = _a[1]; | ||
metadata.lazyLoader = loaderInstance; | ||
module = loaderFn; | ||
break; | ||
@@ -155,5 +157,5 @@ case metadata.singleton: | ||
var self = this; | ||
var instance = this._createInstance(construct, constants_1.EMPTY_ARGS); | ||
this._injectModuleDependencies(instance, metadata); | ||
return function () { | ||
var loaderInstance = this._createInstance(construct, constants_1.EMPTY_ARGS); | ||
this._injectModuleDependencies(loaderInstance, metadata); | ||
function loaderFn() { | ||
var args = []; | ||
@@ -167,3 +169,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, instance.import.apply(instance, args)]; | ||
case 0: return [4 /*yield*/, loaderInstance.import.apply(loaderInstance, args)]; | ||
case 1: | ||
@@ -181,3 +183,4 @@ Ctor = _a.sent(); | ||
}); | ||
}; | ||
} | ||
return [loaderFn, loaderInstance]; | ||
}; | ||
@@ -324,4 +327,16 @@ InjexContainer.prototype._createModuleFactoryMethod = function (construct, metadata) { | ||
else { | ||
var keyValue = aliasModule.metadata.singleton ? aliasModule.module[keyBy] : aliasModule.metadata.item[keyBy]; | ||
mapOrSet[keyValue] = aliasModule.module; | ||
var keyValue = void 0; | ||
switch (true) { | ||
case aliasModule.metadata.lazy: | ||
keyValue = aliasModule.metadata.lazyLoader[keyBy]; | ||
break; | ||
case aliasModule.metadata.singleton: | ||
keyValue = aliasModule.module[keyBy]; | ||
break; | ||
default: | ||
keyValue = aliasModule.metadata.item[keyBy]; | ||
} | ||
if (keyValue) { | ||
mapOrSet[keyValue] = aliasModule.module; | ||
} | ||
} | ||
@@ -328,0 +343,0 @@ } |
@@ -27,2 +27,3 @@ import { Hook, IConstructor, LogLevel } from "@injex/stdlib"; | ||
lazy?: boolean; | ||
lazyLoader?: ILazyModule<any>; | ||
} | ||
@@ -29,0 +30,0 @@ export interface IBootstrap { |
{ | ||
"name": "@injex/core", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "Simple, Decorated, Pluggable dependency-injection framework for TypeScript apps", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@injex/stdlib": "^2.0.9", | ||
"@injex/stdlib": "^2.0.10", | ||
"tslib": "^2.0.1" | ||
@@ -56,3 +56,3 @@ }, | ||
}, | ||
"gitHead": "d8117f37e6f40e47550e541a7aaac40e59ad1277" | ||
"gitHead": "639e751e1b40318adb51967030e3672d5cc43493" | ||
} |
Sorry, the diff of this file is not supported yet
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
46886
679
Updated@injex/stdlib@^2.0.10