Browse Source

chore: updates dependencies

e22m4u 1 month ago
parent
commit
fb229d465a
2 changed files with 15 additions and 13 deletions
  1. 11 9
      dist/cjs/index.cjs
  2. 4 4
      package.json

+ 11 - 9
dist/cjs/index.cjs

@@ -292,17 +292,19 @@ var _ServiceContainer = class _ServiceContainer {
         "The first argument of ServicesContainer.get must be a class constructor, but %v given.",
         ctor
       );
-    if (!this._services.has(ctor) && this._parent && this._parent.has(ctor)) {
-      return this._parent.get(ctor);
-    }
+    const isCtorRegistered = this._services.has(ctor);
     let service = this._services.get(ctor);
+    let inheritedCtor = void 0;
     if (!service) {
       const ctors = this._services.keys();
-      const inheritedCtor = ctors.find((v) => v.prototype instanceof ctor);
-      if (inheritedCtor) {
-        service = this._services.get(inheritedCtor);
-        ctor = inheritedCtor;
-      }
+      const inheritedCtor2 = ctors.find((v) => v.prototype instanceof ctor);
+      if (inheritedCtor2) service = this._services.get(inheritedCtor2);
+    }
+    if (!service && !isCtorRegistered && !inheritedCtor && this._parent && this._parent.has(ctor)) {
+      return this._parent.get(ctor, ...args);
+    }
+    if (!service && !isCtorRegistered && inheritedCtor) {
+      ctor = inheritedCtor;
     }
     if (!service || args.length) {
       service = Array.isArray(ctor.kinds) && ctor.kinds.includes(SERVICE_CLASS_NAME) ? new ctor(this, ...args) : new ctor(...args);
@@ -337,10 +339,10 @@ var _ServiceContainer = class _ServiceContainer {
    */
   has(ctor) {
     if (this._services.has(ctor)) return true;
-    if (this._parent) return this._parent.has(ctor);
     const ctors = this._services.keys();
     const inheritedCtor = ctors.find((v) => v.prototype instanceof ctor);
     if (inheritedCtor) return true;
+    if (this._parent) return this._parent.has(ctor);
     return false;
   }
   /**

+ 4 - 4
package.json

@@ -47,19 +47,19 @@
   "devDependencies": {
     "@commitlint/cli": "~20.1.0",
     "@commitlint/config-conventional": "~20.0.0",
-    "@eslint/js": "~9.36.0",
+    "@eslint/js": "~9.37.0",
     "c8": "~10.1.3",
     "chai": "~6.2.0",
     "chai-as-promised": "~8.0.2",
     "dotenv": "~17.2.3",
     "esbuild": "~0.25.10",
-    "eslint": "~9.36.0",
+    "eslint": "~9.37.0",
     "eslint-config-prettier": "~10.1.8",
     "eslint-plugin-chai-expect": "~3.1.0",
-    "eslint-plugin-mocha": "~11.1.0",
+    "eslint-plugin-mocha": "~11.2.0",
     "globals": "~16.4.0",
     "husky": "~9.1.7",
-    "mocha": "~11.7.3",
+    "mocha": "~11.7.4",
     "prettier": "~3.6.2",
     "rimraf": "~6.0.1"
   }