@wendellhu/redi
Advanced tools
Comparing version 0.15.5 to 0.15.6
@@ -908,3 +908,5 @@ (function (global, factory) { | ||
this._ensureInjectorNotDisposed(); | ||
return this._resolveClassImpl.apply(this, __spreadArray([ctor], customArgs, false)); | ||
return this._resolveClassImpl.apply(this, __spreadArray([{ | ||
useClass: ctor | ||
}], customArgs, false)); | ||
}; | ||
@@ -957,7 +959,6 @@ Injector.prototype._resolveDependency = function (id, item, shouldCache) { | ||
_this._ensureInjectorNotDisposed(); | ||
return _this._resolveClassImpl(ctor); | ||
return _this._resolveClassImpl(item); | ||
}); | ||
thing = new Proxy(Object.create(null), { | ||
get: function (target, key) { | ||
var _a; | ||
if (key in target) { | ||
@@ -970,7 +971,3 @@ return target[key]; // such as toString | ||
} | ||
var hasInstantiated = idle_1.hasRun(); | ||
var thing = idle_1.getValue(); | ||
if (!hasInstantiated) { | ||
(_a = item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
} | ||
var property = thing[key]; | ||
@@ -992,3 +989,3 @@ if (typeof property !== 'function') { | ||
else { | ||
thing = this._resolveClassImpl(ctor); | ||
thing = this._resolveClassImpl(item); | ||
} | ||
@@ -1000,3 +997,4 @@ if (id && shouldCache) { | ||
}; | ||
Injector.prototype._resolveClassImpl = function (ctor) { | ||
Injector.prototype._resolveClassImpl = function (item) { | ||
var _a; | ||
var extraParams = []; | ||
@@ -1006,2 +1004,3 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var ctor = item.useClass; | ||
this.markNewResolution(ctor); | ||
@@ -1012,4 +1011,4 @@ var declaredDependencies = getDependencies(ctor) | ||
var resolvedArgs = []; | ||
for (var _a = 0, declaredDependencies_1 = declaredDependencies; _a < declaredDependencies_1.length; _a++) { | ||
var dep = declaredDependencies_1[_a]; | ||
for (var _b = 0, declaredDependencies_1 = declaredDependencies; _b < declaredDependencies_1.length; _b++) { | ||
var dep = declaredDependencies_1[_b]; | ||
// recursive happens here | ||
@@ -1042,2 +1041,3 @@ try { | ||
var thing = new (ctor.bind.apply(ctor, __spreadArray(__spreadArray([void 0], args, false), resolvedArgs, false)))(); | ||
(_a = item === null || item === void 0 ? void 0 : item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
this.markResolutionCompleted(); | ||
@@ -1100,3 +1100,6 @@ return thing; | ||
else if (isCtor(thing)) { | ||
ret = _this._resolveClassImpl(thing); | ||
ret = _this._resolveClassImpl({ | ||
useClass: thing, | ||
onInstantiation: item.onInstantiation | ||
}); | ||
} | ||
@@ -1103,0 +1106,0 @@ else { |
@@ -291,3 +291,5 @@ var __extends = (this && this.__extends) || (function () { | ||
this._ensureInjectorNotDisposed(); | ||
return this._resolveClassImpl.apply(this, __spreadArray([ctor], customArgs, false)); | ||
return this._resolveClassImpl.apply(this, __spreadArray([{ | ||
useClass: ctor | ||
}], customArgs, false)); | ||
}; | ||
@@ -340,7 +342,6 @@ Injector.prototype._resolveDependency = function (id, item, shouldCache) { | ||
_this._ensureInjectorNotDisposed(); | ||
return _this._resolveClassImpl(ctor); | ||
return _this._resolveClassImpl(item); | ||
}); | ||
thing = new Proxy(Object.create(null), { | ||
get: function (target, key) { | ||
var _a; | ||
if (key in target) { | ||
@@ -353,7 +354,3 @@ return target[key]; // such as toString | ||
} | ||
var hasInstantiated = idle_1.hasRun(); | ||
var thing = idle_1.getValue(); | ||
if (!hasInstantiated) { | ||
(_a = item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
} | ||
var property = thing[key]; | ||
@@ -375,3 +372,3 @@ if (typeof property !== 'function') { | ||
else { | ||
thing = this._resolveClassImpl(ctor); | ||
thing = this._resolveClassImpl(item); | ||
} | ||
@@ -383,3 +380,4 @@ if (id && shouldCache) { | ||
}; | ||
Injector.prototype._resolveClassImpl = function (ctor) { | ||
Injector.prototype._resolveClassImpl = function (item) { | ||
var _a; | ||
var extraParams = []; | ||
@@ -389,2 +387,3 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var ctor = item.useClass; | ||
this.markNewResolution(ctor); | ||
@@ -395,4 +394,4 @@ var declaredDependencies = getDependencies(ctor) | ||
var resolvedArgs = []; | ||
for (var _a = 0, declaredDependencies_1 = declaredDependencies; _a < declaredDependencies_1.length; _a++) { | ||
var dep = declaredDependencies_1[_a]; | ||
for (var _b = 0, declaredDependencies_1 = declaredDependencies; _b < declaredDependencies_1.length; _b++) { | ||
var dep = declaredDependencies_1[_b]; | ||
// recursive happens here | ||
@@ -425,2 +424,3 @@ try { | ||
var thing = new (ctor.bind.apply(ctor, __spreadArray(__spreadArray([void 0], args, false), resolvedArgs, false)))(); | ||
(_a = item === null || item === void 0 ? void 0 : item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
this.markResolutionCompleted(); | ||
@@ -483,3 +483,6 @@ return thing; | ||
else if (isCtor(thing)) { | ||
ret = _this._resolveClassImpl(thing); | ||
ret = _this._resolveClassImpl({ | ||
useClass: thing, | ||
onInstantiation: item.onInstantiation | ||
}); | ||
} | ||
@@ -486,0 +489,0 @@ else { |
@@ -902,3 +902,5 @@ var IdentifierDecoratorSymbol = Symbol('$$IDENTIFIER_DECORATOR'); | ||
this._ensureInjectorNotDisposed(); | ||
return this._resolveClassImpl.apply(this, __spreadArray([ctor], customArgs, false)); | ||
return this._resolveClassImpl.apply(this, __spreadArray([{ | ||
useClass: ctor | ||
}], customArgs, false)); | ||
}; | ||
@@ -951,7 +953,6 @@ Injector.prototype._resolveDependency = function (id, item, shouldCache) { | ||
_this._ensureInjectorNotDisposed(); | ||
return _this._resolveClassImpl(ctor); | ||
return _this._resolveClassImpl(item); | ||
}); | ||
thing = new Proxy(Object.create(null), { | ||
get: function (target, key) { | ||
var _a; | ||
if (key in target) { | ||
@@ -964,7 +965,3 @@ return target[key]; // such as toString | ||
} | ||
var hasInstantiated = idle_1.hasRun(); | ||
var thing = idle_1.getValue(); | ||
if (!hasInstantiated) { | ||
(_a = item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
} | ||
var property = thing[key]; | ||
@@ -986,3 +983,3 @@ if (typeof property !== 'function') { | ||
else { | ||
thing = this._resolveClassImpl(ctor); | ||
thing = this._resolveClassImpl(item); | ||
} | ||
@@ -994,3 +991,4 @@ if (id && shouldCache) { | ||
}; | ||
Injector.prototype._resolveClassImpl = function (ctor) { | ||
Injector.prototype._resolveClassImpl = function (item) { | ||
var _a; | ||
var extraParams = []; | ||
@@ -1000,2 +998,3 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var ctor = item.useClass; | ||
this.markNewResolution(ctor); | ||
@@ -1006,4 +1005,4 @@ var declaredDependencies = getDependencies(ctor) | ||
var resolvedArgs = []; | ||
for (var _a = 0, declaredDependencies_1 = declaredDependencies; _a < declaredDependencies_1.length; _a++) { | ||
var dep = declaredDependencies_1[_a]; | ||
for (var _b = 0, declaredDependencies_1 = declaredDependencies; _b < declaredDependencies_1.length; _b++) { | ||
var dep = declaredDependencies_1[_b]; | ||
// recursive happens here | ||
@@ -1036,2 +1035,3 @@ try { | ||
var thing = new (ctor.bind.apply(ctor, __spreadArray(__spreadArray([void 0], args, false), resolvedArgs, false)))(); | ||
(_a = item === null || item === void 0 ? void 0 : item.onInstantiation) === null || _a === void 0 ? void 0 : _a.call(item, thing); | ||
this.markResolutionCompleted(); | ||
@@ -1094,3 +1094,6 @@ return thing; | ||
else if (isCtor(thing)) { | ||
ret = _this._resolveClassImpl(thing); | ||
ret = _this._resolveClassImpl({ | ||
useClass: thing, | ||
onInstantiation: item.onInstantiation | ||
}); | ||
} | ||
@@ -1097,0 +1100,0 @@ else { |
{ | ||
"$schema": "https://raw.githubusercontent.com/wzhudev/squirrel/master/src/schema/package.schema.json", | ||
"name": "@wendellhu/redi", | ||
"version": "0.15.5", | ||
"version": "0.15.6", | ||
"description": "A dependency library for TypeScript and JavaScript, along with a binding for React.", | ||
@@ -6,0 +6,0 @@ "author": "Wenzhao Hu<wzhudev@gmail.com>", |
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
495893
4999