@monkin/di 0.1.13 → 0.1.15
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/README.md +2 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/index.js.gz +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@monkin/di)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
`@monkin/di` is a lightweight (
|
|
7
|
+
`@monkin/di` is a lightweight (454 bytes), type-safe dependency injection container for TypeScript. It leverages TypeScript's advanced type system to provide a fluent API for service registration and resolution with full type safety and autocompletion.
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
- **Fluent API**: Chainable service registration makes it easy to compose your container.
|
|
31
31
|
- **Container Composition**: Merge multiple containers together to share dependencies across different parts of your application.
|
|
32
32
|
- **Lazy**: Services are instantiated only on demand (when first accessed) and reused for subsequent accesses.
|
|
33
|
-
- **Zero Runtime Dependencies**: Extremely lightweight (
|
|
33
|
+
- **Zero Runtime Dependencies**: Extremely lightweight (454 bytes minified / 309 bytes gzipped).
|
|
34
34
|
|
|
35
35
|
## Installation
|
|
36
36
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{inject(...
|
|
1
|
+
class e{inject(...t){return t.reduce((t,r)=>{let i,n=r.prototype,o=(0,n.getServiceName)();if(t[o])throw Error((o in e.prototype?"Reserv":"Duplicat")+"ed service name: "+o);return t[o]=new Proxy(Object.create(n),{get:(e,n)=>{i||=t[o]=new r(t);let a=i[n];return"f"==(typeof a)[0]?a.bind(i):a}}),t},this)}injectContainer(e){for(let t in e)if(this[t])throw Error("Containers have duplicated keys: "+t);return Object.assign(this,e)}}export{e as DiContainer};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&typeof module<"u"?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=typeof globalThis<"u"?globalThis:e||self).Di={})}(this,function(e){"use strict";
|
|
1
|
+
!function(e,t){"object"==typeof exports&&typeof module<"u"?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=typeof globalThis<"u"?globalThis:e||self).Di={})}(this,function(e){"use strict";class t{inject(...e){return e.reduce((e,r)=>{let i,o=r.prototype,n=(0,o.getServiceName)();if(e[n])throw Error((n in t.prototype?"Reserv":"Duplicat")+"ed service name: "+n);return e[n]=new Proxy(Object.create(o),{get:(t,o)=>{i||=e[n]=new r(e);let s=i[o];return"f"==(typeof s)[0]?s.bind(i):s}}),e},this)}injectContainer(e){for(let t in e)if(this[t])throw Error("Containers have duplicated keys: "+t);return Object.assign(this,e)}}e.DiContainer=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/dist/index.js.gz
DELETED
|
File without changes
|