mesh-ioc 4.0.1 → 4.1.1
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/out/main/proxy.d.ts +1 -1
- package/out/main/proxy.js +16 -9
- package/out/main/proxy.js.map +1 -1
- package/package.json +7 -7
package/out/main/proxy.d.ts
CHANGED
package/out/main/proxy.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { MESH_REF } from './mesh.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const PROXY_TRAPS = Object.getOwnPropertyNames(Reflect);
|
|
3
|
+
export function dependency(thisArg, serviceKey, cache = true) {
|
|
4
|
+
let cachedInstance;
|
|
5
|
+
const handler = {};
|
|
6
|
+
for (const trap of PROXY_TRAPS) {
|
|
7
|
+
handler[trap] = function (_target, ...args) {
|
|
8
|
+
let instance = cachedInstance;
|
|
9
|
+
if (!instance) {
|
|
10
|
+
instance = thisArg[MESH_REF].resolve(serviceKey);
|
|
11
|
+
}
|
|
12
|
+
if (cache) {
|
|
13
|
+
cachedInstance = instance;
|
|
14
|
+
}
|
|
15
|
+
return Reflect[trap](instance, ...args);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
11
18
|
return new Proxy(thisArg, handler);
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=proxy.js.map
|
package/out/main/proxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/main/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/main/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG3C,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAmC,CAAC;AAI1F,MAAM,UAAU,UAAU,CAAI,OAAY,EAAE,UAAyB,EAAE,KAAK,GAAG,IAAI;IAC/E,IAAI,cAA6B,CAAC;IAClC,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,UAAU,OAAY,EAAE,GAAG,IAAW;YAClD,IAAI,QAAQ,GAAG,cAAc,CAAC;YAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,QAAQ,GAAI,OAAO,CAAC,QAAQ,CAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,KAAK,EAAE,CAAC;gBACR,cAAc,GAAG,QAAQ,CAAC;YAC9B,CAAC;YACD,OAAQ,OAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;QACrD,CAAC,CAAC;IACN,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mesh-ioc",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Powerful and Lightweight IoC Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"author": "Boris Okunskiy",
|
|
40
40
|
"license": "ISC",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@
|
|
42
|
+
"@fastify/pre-commit": "^2.2.1",
|
|
43
|
+
"@nodescript/eslint-config": "^2.1.0",
|
|
43
44
|
"@types/mocha": "^10.0.10",
|
|
44
45
|
"@types/node": "^22.10.2",
|
|
45
|
-
"chalk": "^5.
|
|
46
|
-
"eslint": "^9.
|
|
47
|
-
"mocha": "^11.
|
|
48
|
-
"pre-commit": "^1.2.2",
|
|
46
|
+
"chalk": "^5.6.2",
|
|
47
|
+
"eslint": "^9.39.2",
|
|
48
|
+
"mocha": "^11.7.5",
|
|
49
49
|
"reflect-metadata": "^0.2.2",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
51
|
}
|
|
52
52
|
}
|