@eggjs/tegg-dynamic-inject 4.0.0-beta.3 → 4.0.0-beta.5
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 +13 -1
- package/dist/QualifierImplDecoratorUtil.d.ts +8 -0
- package/dist/QualifierImplDecoratorUtil.js +17 -0
- package/dist/QualifierImplUtil.d.ts +10 -0
- package/dist/QualifierImplUtil.js +18 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/package.json +23 -24
- package/src/QualifierImplDecoratorUtil.d.ts +0 -4
- package/src/QualifierImplDecoratorUtil.js +0 -13
- package/src/QualifierImplUtil.d.ts +0 -6
- package/src/QualifierImplUtil.js +0 -20
- package/src/index.d.ts +0 -3
- package/src/index.js +0 -4
package/README.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@eggjs/tegg-dynamic-inject`
|
|
2
|
+
|
|
3
|
+
[![NPM version][npm-image]][npm-url]
|
|
4
|
+
[![Known Vulnerabilities][snyk-image]][snyk-url]
|
|
5
|
+
[![npm download][download-image]][download-url]
|
|
6
|
+
[](https://nodejs.org/en/download/)
|
|
7
|
+
|
|
8
|
+
[npm-image]: https://img.shields.io/npm/v/@eggjs/tegg-dynamic-inject.svg?style=flat-square
|
|
9
|
+
[npm-url]: https://npmjs.org/package/@eggjs/tegg-dynamic-inject
|
|
10
|
+
[snyk-image]: https://snyk.io/test/npm/@eggjs/tegg-dynamic-inject/badge.svg?style=flat-square
|
|
11
|
+
[snyk-url]: https://snyk.io/test/npm/@eggjs/tegg-dynamic-inject
|
|
12
|
+
[download-image]: https://img.shields.io/npm/dm/@eggjs/tegg-dynamic-inject.svg?style=flat-square
|
|
13
|
+
[download-url]: https://npmjs.org/package/@eggjs/tegg-dynamic-inject
|
|
2
14
|
|
|
3
15
|
## Usage
|
|
4
16
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EggAbstractClazz, ImplDecorator, ImplTypeEnum, QualifierAttribute } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/QualifierImplDecoratorUtil.d.ts
|
|
4
|
+
declare class QualifierImplDecoratorUtil {
|
|
5
|
+
static generatorDecorator<T extends object, Enum extends ImplTypeEnum>(abstractClazz: EggAbstractClazz<T>, attribute: QualifierAttribute): ImplDecorator<T, Enum>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { QualifierImplDecoratorUtil };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { QualifierImplUtil } from "./QualifierImplUtil.js";
|
|
2
|
+
import { QualifierUtil } from "@eggjs/core-decorator";
|
|
3
|
+
|
|
4
|
+
//#region src/QualifierImplDecoratorUtil.ts
|
|
5
|
+
var QualifierImplDecoratorUtil = class {
|
|
6
|
+
static generatorDecorator(abstractClazz, attribute) {
|
|
7
|
+
return function(type) {
|
|
8
|
+
return function(clazz) {
|
|
9
|
+
QualifierImplUtil.addQualifierImpl(abstractClazz, type, clazz);
|
|
10
|
+
QualifierUtil.addProtoQualifier(clazz, attribute, type);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { QualifierImplDecoratorUtil };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EggAbstractClazz, EggProtoImplClass, QualifierValue } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/QualifierImplUtil.d.ts
|
|
4
|
+
declare class QualifierImplUtil {
|
|
5
|
+
static addQualifierImpl(abstractClazz: EggAbstractClazz, qualifierValue: QualifierValue, implClazz: EggProtoImplClass): void;
|
|
6
|
+
static getQualifierImp(abstractClazz: EggAbstractClazz, qualifierValue: QualifierValue): EggProtoImplClass | undefined;
|
|
7
|
+
static getQualifierImpMap(abstractClazz: EggAbstractClazz): Map<QualifierValue, EggProtoImplClass>;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { QualifierImplUtil };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MetadataUtil } from "@eggjs/core-decorator";
|
|
2
|
+
import { QUALIFIER_IMPL_MAP } from "@eggjs/tegg-types";
|
|
3
|
+
|
|
4
|
+
//#region src/QualifierImplUtil.ts
|
|
5
|
+
var QualifierImplUtil = class {
|
|
6
|
+
static addQualifierImpl(abstractClazz, qualifierValue, implClazz) {
|
|
7
|
+
MetadataUtil.initOwnMapMetaData(QUALIFIER_IMPL_MAP, abstractClazz, /* @__PURE__ */ new Map()).set(qualifierValue, implClazz);
|
|
8
|
+
}
|
|
9
|
+
static getQualifierImp(abstractClazz, qualifierValue) {
|
|
10
|
+
return MetadataUtil.getMetaData(QUALIFIER_IMPL_MAP, abstractClazz)?.get(qualifierValue);
|
|
11
|
+
}
|
|
12
|
+
static getQualifierImpMap(abstractClazz) {
|
|
13
|
+
return MetadataUtil.getMetaData(QUALIFIER_IMPL_MAP, abstractClazz) || /* @__PURE__ */ new Map();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { QualifierImplUtil };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tegg-dynamic-inject",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.5",
|
|
4
4
|
"description": "tegg dynamic inject",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
9
|
-
"default": "./src/index.js"
|
|
10
|
-
}
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./package.json": "./package.json"
|
|
11
9
|
},
|
|
12
10
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"src/**/*.d.ts"
|
|
11
|
+
"dist"
|
|
15
12
|
],
|
|
16
13
|
"keywords": [
|
|
17
14
|
"egg",
|
|
@@ -19,15 +16,9 @@
|
|
|
19
16
|
"runtime",
|
|
20
17
|
"tegg"
|
|
21
18
|
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"clean": "tsc -b --clean",
|
|
24
|
-
"tsc": "npm run clean && tsc -p ./tsconfig.json",
|
|
25
|
-
"tsc:pub": "npm run tsc",
|
|
26
|
-
"prepublishOnly": "npm run tsc"
|
|
27
|
-
},
|
|
28
19
|
"author": "killagu <killa123@126.com>",
|
|
29
20
|
"license": "MIT",
|
|
30
|
-
"homepage": "https://github.com/eggjs/tegg",
|
|
21
|
+
"homepage": "https://github.com/eggjs/tegg/tree/next/core/dynamic-inject",
|
|
31
22
|
"bugs": {
|
|
32
23
|
"url": "https://github.com/eggjs/tegg/issues"
|
|
33
24
|
},
|
|
@@ -37,20 +28,28 @@
|
|
|
37
28
|
"directory": "core/dynamic-inject"
|
|
38
29
|
},
|
|
39
30
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
31
|
+
"node": ">=22.18.0"
|
|
41
32
|
},
|
|
42
33
|
"publishConfig": {
|
|
43
34
|
"access": "public"
|
|
44
35
|
},
|
|
45
36
|
"dependencies": {
|
|
46
|
-
"@eggjs/core-decorator": "
|
|
47
|
-
"@eggjs/tegg-types": "
|
|
37
|
+
"@eggjs/core-decorator": "4.0.0-beta.5",
|
|
38
|
+
"@eggjs/tegg-types": "4.0.0-beta.5"
|
|
48
39
|
},
|
|
49
40
|
"devDependencies": {
|
|
50
|
-
"@types/node": "22",
|
|
51
|
-
"coffee": "5",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
"@types/node": "^22.10.5",
|
|
42
|
+
"coffee": "^5.1.0",
|
|
43
|
+
"typescript": "^5.9.3",
|
|
44
|
+
"tsdown": "^0.15.6",
|
|
45
|
+
"unplugin-unused": "^0.5.3"
|
|
46
|
+
},
|
|
47
|
+
"main": "./dist/index.js",
|
|
48
|
+
"module": "./dist/index.js",
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"clean": "rimraf dist",
|
|
52
|
+
"build": "tsdown",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EggAbstractClazz, ImplDecorator, ImplTypeEnum, QualifierAttribute } from '@eggjs/tegg-types';
|
|
2
|
-
export declare class QualifierImplDecoratorUtil {
|
|
3
|
-
static generatorDecorator<T extends object, Enum extends ImplTypeEnum>(abstractClazz: EggAbstractClazz<T>, attribute: QualifierAttribute): ImplDecorator<T, Enum>;
|
|
4
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { QualifierUtil } from '@eggjs/core-decorator';
|
|
2
|
-
import { QualifierImplUtil } from './QualifierImplUtil.js';
|
|
3
|
-
export class QualifierImplDecoratorUtil {
|
|
4
|
-
static generatorDecorator(abstractClazz, attribute) {
|
|
5
|
-
return function (type, isForceReplacement) {
|
|
6
|
-
return function (clazz) {
|
|
7
|
-
QualifierImplUtil.addQualifierImpl(abstractClazz, type, clazz, isForceReplacement);
|
|
8
|
-
QualifierUtil.addProtoQualifier(clazz, attribute, type, isForceReplacement);
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUXVhbGlmaWVySW1wbERlY29yYXRvclV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJRdWFsaWZpZXJJbXBsRGVjb3JhdG9yVXRpbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDdEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFM0QsTUFBTSxPQUFPLDBCQUEwQjtJQUNyQyxNQUFNLENBQUMsa0JBQWtCLENBQThDLGFBQWtDLEVBQUUsU0FBNkI7UUFDdEksT0FBTyxVQUFTLElBQXNCLEVBQUUsa0JBQTRCO1lBQ2xFLE9BQU8sVUFBUyxLQUEyQjtnQkFDekMsaUJBQWlCLENBQUMsZ0JBQWdCLENBQUMsYUFBYSxFQUFFLElBQUksRUFBRSxLQUFLLEVBQUUsa0JBQWtCLENBQUMsQ0FBQztnQkFDbkYsYUFBYSxDQUFDLGlCQUFpQixDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLGtCQUFrQixDQUFDLENBQUM7WUFDOUUsQ0FBQyxDQUFDO1FBQ0osQ0FBQyxDQUFDO0lBQ0osQ0FBQztDQUNGIn0=
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { EggAbstractClazz, EggProtoImplClass, QualifierValue } from '@eggjs/tegg-types';
|
|
2
|
-
export declare class QualifierImplUtil {
|
|
3
|
-
static addQualifierImpl(abstractClazz: EggAbstractClazz, qualifierValue: QualifierValue, implClazz: EggProtoImplClass, isForceReplacement?: boolean): void;
|
|
4
|
-
static getQualifierImp(abstractClazz: EggAbstractClazz, qualifierValue: QualifierValue): EggProtoImplClass | undefined;
|
|
5
|
-
static getQualifierImpMap(abstractClazz: EggAbstractClazz): Map<QualifierValue, EggProtoImplClass>;
|
|
6
|
-
}
|
package/src/QualifierImplUtil.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MetadataUtil } from '@eggjs/core-decorator';
|
|
2
|
-
import { QUALIFIER_IMPL_MAP } from '@eggjs/tegg-types';
|
|
3
|
-
export class QualifierImplUtil {
|
|
4
|
-
static addQualifierImpl(abstractClazz, qualifierValue, implClazz, isForceReplacement) {
|
|
5
|
-
if (QualifierImplUtil.getQualifierImp(abstractClazz, qualifierValue) && !isForceReplacement) {
|
|
6
|
-
throw new Error(`Qualifier Error: abstractClazz ${abstractClazz.name} qualifierValue ${qualifierValue.toString()} has been implemented`);
|
|
7
|
-
}
|
|
8
|
-
const implMap = MetadataUtil.initOwnMapMetaData(QUALIFIER_IMPL_MAP, abstractClazz, new Map());
|
|
9
|
-
implMap.set(qualifierValue, implClazz);
|
|
10
|
-
}
|
|
11
|
-
static getQualifierImp(abstractClazz, qualifierValue) {
|
|
12
|
-
const implMap = MetadataUtil.getMetaData(QUALIFIER_IMPL_MAP, abstractClazz);
|
|
13
|
-
return implMap?.get(qualifierValue);
|
|
14
|
-
}
|
|
15
|
-
static getQualifierImpMap(abstractClazz) {
|
|
16
|
-
const implMap = MetadataUtil.getMetaData(QUALIFIER_IMPL_MAP, abstractClazz);
|
|
17
|
-
return implMap || new Map();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUXVhbGlmaWVySW1wbFV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJRdWFsaWZpZXJJbXBsVXRpbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDckQsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFHdkQsTUFBTSxPQUFPLGlCQUFpQjtJQUM1QixNQUFNLENBQUMsZ0JBQWdCLENBQUMsYUFBK0IsRUFBRSxjQUE4QixFQUFFLFNBQTRCLEVBQUUsa0JBQTRCO1FBQ2pKLElBQUksaUJBQWlCLENBQUMsZUFBZSxDQUFDLGFBQWEsRUFBRSxjQUFjLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFLENBQUM7WUFDNUYsTUFBTSxJQUFJLEtBQUssQ0FBQyxrQ0FBa0MsYUFBYSxDQUFDLElBQUksbUJBQW1CLGNBQWMsQ0FBQyxRQUFRLEVBQUUsdUJBQXVCLENBQUMsQ0FBQztRQUMzSSxDQUFDO1FBQ0QsTUFBTSxPQUFPLEdBQUcsWUFBWSxDQUFDLGtCQUFrQixDQUFDLGtCQUFrQixFQUFFLGFBQTZDLEVBQUUsSUFBSSxHQUFHLEVBQUUsQ0FBQyxDQUFDO1FBQzlILE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQ3pDLENBQUM7SUFFRCxNQUFNLENBQUMsZUFBZSxDQUFDLGFBQStCLEVBQUUsY0FBOEI7UUFDcEYsTUFBTSxPQUFPLEdBQXVELFlBQVksQ0FBQyxXQUFXLENBQUMsa0JBQWtCLEVBQUUsYUFBNkMsQ0FBQyxDQUFDO1FBQ2hLLE9BQU8sT0FBTyxFQUFFLEdBQUcsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBRUQsTUFBTSxDQUFDLGtCQUFrQixDQUFDLGFBQStCO1FBQ3ZELE1BQU0sT0FBTyxHQUF1RCxZQUFZLENBQUMsV0FBVyxDQUFDLGtCQUFrQixFQUFFLGFBQTZDLENBQUMsQ0FBQztRQUNoSyxPQUFPLE9BQU8sSUFBSSxJQUFJLEdBQUcsRUFBRSxDQUFDO0lBQzlCLENBQUM7Q0FDRiJ9
|
package/src/index.d.ts
DELETED
package/src/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export * from '@eggjs/tegg-types/dynamic-inject';
|
|
2
|
-
export * from './QualifierImplUtil.js';
|
|
3
|
-
export * from './QualifierImplDecoratorUtil.js';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtDQUFrQyxDQUFDO0FBQ2pELGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxpQ0FBaUMsQ0FBQyJ9
|