@kaokei/di 1.0.21 → 1.0.25
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/CHANGELOG.md +128 -0
- package/README.md +20 -103
- package/dist/index.cjs.js +450 -233
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +3 -3
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.cjs.runtime.js +444 -229
- package/dist/index.cjs.runtime.js.map +1 -1
- package/dist/index.cjs.runtime.min.js +3 -3
- package/dist/index.cjs.runtime.min.js.map +1 -1
- package/dist/index.esm.js +451 -219
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +4 -4
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.esm.runtime.js +439 -214
- package/dist/index.esm.runtime.js.map +1 -1
- package/dist/index.esm.runtime.min.js +4 -4
- package/dist/index.esm.runtime.min.js.map +1 -1
- package/dist/index.iife.js +457 -237
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +4 -4
- package/dist/index.iife.min.js.map +1 -1
- package/dist/src/Injector.d.ts +67 -32
- package/dist/src/Injector.d.ts.map +1 -1
- package/dist/src/constants.d.ts +5 -11
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/decorator.d.ts +13 -1
- package/dist/src/decorator.d.ts.map +1 -1
- package/dist/src/errors/CircularDependencyError.d.ts +6 -0
- package/dist/src/errors/CircularDependencyError.d.ts.map +1 -0
- package/dist/src/errors/InjectFailedError.d.ts +6 -0
- package/dist/src/errors/InjectFailedError.d.ts.map +1 -0
- package/dist/src/errors/ProviderNotValidError.d.ts +6 -0
- package/dist/src/errors/ProviderNotValidError.d.ts.map +1 -0
- package/dist/src/errors/TokenNotFoundError.d.ts +6 -0
- package/dist/src/errors/TokenNotFoundError.d.ts.map +1 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +5 -7
- package/dist/.DS_Store +0 -0
package/dist/src/decorator.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* 这里记录不同的装饰器的参数的含义
|
|
3
|
+
*
|
|
2
4
|
* class decorator:
|
|
3
5
|
* 只有一个参数:构造函数
|
|
4
6
|
* property decorator:
|
|
@@ -15,7 +17,17 @@
|
|
|
15
17
|
* 静态访问器:构造函数, 方法名, 属性描述符
|
|
16
18
|
* 实例访问器:原型, 方法名, 属性描述符
|
|
17
19
|
*/
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 创建装饰器的高阶函数
|
|
22
|
+
* 装饰器的通用逻辑就是通过Reflect记录到全局的Map中
|
|
23
|
+
* 所以可以抽象出一个通用逻辑,这里需要注意对Inject装饰器有特殊判断
|
|
24
|
+
*
|
|
25
|
+
* @param {(string | symbol)} decoratorKey 代表某个装饰器的名称
|
|
26
|
+
* @param {*} [defaultValue] 该装饰器函数的默认参数
|
|
27
|
+
* @return {*} 一个装饰器
|
|
28
|
+
*/
|
|
29
|
+
export declare function createDecorator(decoratorKey: string | symbol, defaultValue?: any): (decoratorValue?: any) => (target: any, targetKey: string, index?: number | undefined) => void;
|
|
30
|
+
export declare const Inject: (decoratorValue?: any) => (target: any, targetKey: string, index?: number | undefined) => void;
|
|
19
31
|
export declare const Self: (decoratorValue?: any) => (target: any, targetKey: string, index?: number | undefined) => void;
|
|
20
32
|
export declare const Skip: (decoratorValue?: any) => (target: any, targetKey: string, index?: number | undefined) => void;
|
|
21
33
|
export declare const Optional: (decoratorValue?: any) => (target: any, targetKey: string, index?: number | undefined) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["decorator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["decorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,GAAG,MAAM,EAC7B,YAAY,CAAC,EAAE,GAAG,qBAGgB,GAAG,cAKV,GAAG,aAAa,MAAM,iCAAmB,IAAI,CAwDzE;AAGD,eAAO,MAAM,MAAM,oBAhEiB,GAAG,cAKV,GAAG,aAAa,MAAM,iCAAmB,IA2DV,CAAC;AAG7D,eAAO,MAAM,IAAI,oBAnEmB,GAAG,cAKV,GAAG,aAAa,MAAM,iCAAmB,IA8DR,CAAC;AAG/D,eAAO,MAAM,IAAI,oBAtEmB,GAAG,cAKV,GAAG,aAAa,MAAM,iCAAmB,IAiEH,CAAC;AAIpE,eAAO,MAAM,QAAQ,oBA1Ee,GAAG,cAKV,GAAG,aAAa,MAAM,iCAAmB,IAqEA,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAgB,UAAU,aACC,GAAG,SAgB7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircularDependencyError.d.ts","sourceRoot":"","sources":["CircularDependencyError.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAwB,SAAQ,KAAK;IACzC,IAAI,SAA+B;IAEnC,OAAO,SAAa;gBAEf,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG;CAaxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InjectFailedError.d.ts","sourceRoot":"","sources":["InjectFailedError.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAkB,SAAQ,KAAK;IACnC,IAAI,SAAyB;IAC7B,OAAO,SAAa;gBAGzB,UAAU,EAAE,GAAG,EACf,SAAS,EAAE,GAAG,EACd,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,SAAS,CAAC,EAAE,GAAG;CAoBlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderNotValidError.d.ts","sourceRoot":"","sources":["ProviderNotValidError.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;IACvC,IAAI,SAA8B;IAClC,OAAO,SAAa;gBAEf,QAAQ,EAAE,GAAG;CAK1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenNotFoundError.d.ts","sourceRoot":"","sources":["TokenNotFoundError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IACpC,IAAI,SAA2B;IAC/B,OAAO,SAAa;gBAEf,KAAK,EAAE,GAAG;CAKvB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CircularDependencyError } from './CircularDependencyError';
|
|
2
|
+
export { InjectFailedError } from './InjectFailedError';
|
|
3
|
+
export { ProviderNotValidError } from './ProviderNotValidError';
|
|
4
|
+
export { TokenNotFoundError } from './TokenNotFoundError';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaokei/di",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.25",
|
|
4
|
+
"description": "Tiny di library depend on typescript and reflect-metadata",
|
|
5
5
|
"main": "./dist/index.cjs.runtime.min.js",
|
|
6
6
|
"module": "./dist/index.esm.runtime.min.js",
|
|
7
7
|
"types": "./dist/src/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"check": "tsc -p tsconfig.app.json --noEmit",
|
|
28
28
|
"rp": "rollup -c rollup.config.js",
|
|
29
|
-
"unit": "jest",
|
|
29
|
+
"unit": "jest --silent",
|
|
30
30
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
31
31
|
"lint": "eslint --fix --ext js,ts,jsx,tsx src tests playground",
|
|
32
32
|
"build": "npm run check && npm run rp",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"commit": "git-cz"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"autobind-decorator": "^2.4.0",
|
|
43
42
|
"reflect-metadata": "^0.1.13"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
@@ -56,9 +55,8 @@
|
|
|
56
55
|
"@rollup/plugin-replace": "^2.4.2",
|
|
57
56
|
"@types/jest": "^26.0.20",
|
|
58
57
|
"@types/node": "^14.10.1",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
60
|
-
"@typescript-eslint/parser": "^
|
|
61
|
-
"autobind-decorator": "^2.4.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
59
|
+
"@typescript-eslint/parser": "^5.6.0",
|
|
62
60
|
"babel-jest": "^26.6.3",
|
|
63
61
|
"commitizen": "^4.2.4",
|
|
64
62
|
"cz-conventional-changelog": "^3.2.0",
|
package/dist/.DS_Store
DELETED
|
Binary file
|