@andrewcaires/decorator 1.0.2 → 1.0.3
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/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +2 -2
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/decorator v1.0.
|
|
2
|
+
* @andrewcaires/decorator v1.0.3
|
|
3
3
|
* Typescript decorator library for nodejs development
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("@andrewcaires/utils.js");const t=Symbol("INJECTION");class r{static register(e,t){this.has(e)||this.registry.set(e,t)}static get(e){var t;return null!==(t=this.registry.get(e))&&void 0!==t?t:null}static has(e){return this.registry.has(e)}}r.registry=new Map;const s=Symbol("SINGLETON"),n=e.cache();exports.Inject=e=>(r,s,n)=>{var i;const o={index:n,key:e},a=null!==(i=r[t])&&void 0!==i?i:[];Object.defineProperty(r,t,{enumerable:!1,configurable:!0,writable:!1,value:[o,...a]})},exports.Injectable=s=>class extends s{constructor(...n){(n=e.toArray(s[t])).forEach(({key:e})=>{r.has(e)||r.register(e,new e)}),super(...n.sort(({index:e},{index:t})=>e-t).map(({key:e})=>r.get(e)))}},exports.InjectionKey=t,exports.Injections=r,exports.Singleton=e=>class t extends e{constructor(...e){if(t[s])return t[s];super(...e),t[s]=this}},exports.SingletonKey=s,exports.metadata=(t,r,s)=>{e.isObject(r)&&(r=r.constructor);const i=n(r);return i[t]||(i[t]=s),i[t]};
|
|
7
|
+
"use strict";var e=require("@andrewcaires/utils.js");const t=Symbol("INJECTION");class r{static register(e,t){this.has(e)||this.registry.set(e,t)}static get(e){var t;return null!==(t=this.registry.get(e))&&void 0!==t?t:null}static has(e){return this.registry.has(e)}}r.registry=new Map;const s=Symbol("SINGLETON"),n=e.cache();exports.Inject=e=>(r,s,n)=>{var i;const o={index:n,key:e},a=null!==(i=r[t])&&void 0!==i?i:[];Object.defineProperty(r,t,{enumerable:!1,configurable:!0,writable:!1,value:[o,...a]})},exports.Injectable=s=>class extends s{constructor(...n){(n=e.toArray(s[t])).forEach(({key:e})=>{r.has(e)||r.register(e,new e)}),super(...n.sort(({index:e},{index:t})=>e-t).map(({key:e})=>r.get(e)))}},exports.InjectionKey=t,exports.Injections=r,exports.Singleton=e=>class t extends e{constructor(...e){if(t[s])return t[s];super(...e),t[s]=this}},exports.SingletonKey=s,exports.metadata=(t,r,s)=>{e.isObject(r)&&!e.isSymbol(r)&&(r=r.constructor);const i=n(r);return i[t]||(i[t]=s),i[t]};
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/decorator v1.0.
|
|
2
|
+
* @andrewcaires/decorator v1.0.3
|
|
3
3
|
* Typescript decorator library for nodejs development
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import{toArray as t,cache as e,isObject as r}from"@andrewcaires/utils.js";const
|
|
7
|
+
import{toArray as t,cache as e,isObject as r,isSymbol as s}from"@andrewcaires/utils.js";const i=Symbol("INJECTION"),n=t=>(e,r,s)=>{var n;const a={index:s,key:t},o=null!==(n=e[i])&&void 0!==n?n:[];Object.defineProperty(e,i,{enumerable:!1,configurable:!0,writable:!1,value:[a,...o]})};class a{static register(t,e){this.has(t)||this.registry.set(t,e)}static get(t){var e;return null!==(e=this.registry.get(t))&&void 0!==e?e:null}static has(t){return this.registry.has(t)}}a.registry=new Map;const o=e=>class extends e{constructor(...r){(r=t(e[i])).forEach(({key:t})=>{a.has(t)||a.register(t,new t)}),super(...r.sort(({index:t},{index:e})=>t-e).map(({key:t})=>a.get(t)))}},c=Symbol("SINGLETON"),l=t=>class e extends t{constructor(...t){if(e[c])return e[c];super(...t),e[c]=this}},u=e(),g=(t,e,i)=>{r(e)&&!s(e)&&(e=e.constructor);const n=u(e);return n[t]||(n[t]=i),n[t]};export{n as Inject,o as Injectable,i as InjectionKey,a as Injections,l as Singleton,c as SingletonKey,g as metadata};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrewcaires/decorator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Typescript decorator library for nodejs development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
44
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
45
45
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
46
|
-
"@types/node": "^25.0.
|
|
46
|
+
"@types/node": "^25.0.8",
|
|
47
47
|
"eslint": "^9.39.2",
|
|
48
48
|
"rollup": "^4.55.1",
|
|
49
49
|
"rollup-plugin-dts": "^6.3.0",
|
|
50
50
|
"tslib": "^2.8.1",
|
|
51
51
|
"tsx": "^4.21.0",
|
|
52
|
-
"typescript-eslint": "^8.
|
|
52
|
+
"typescript-eslint": "^8.53.0"
|
|
53
53
|
}
|
|
54
54
|
}
|