@eggjs/tegg-metadata 4.0.0-beta.7 → 4.0.0-beta.8
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.d.ts +405 -21
- package/dist/index.js +1256 -24
- package/package.json +5 -5
- package/dist/errors.d.ts +0 -18
- package/dist/errors.js +0 -29
- package/dist/factory/EggPrototypeCreatorFactory.d.ts +0 -13
- package/dist/factory/EggPrototypeCreatorFactory.js +0 -95
- package/dist/factory/EggPrototypeFactory.d.ts +0 -13
- package/dist/factory/EggPrototypeFactory.js +0 -41
- package/dist/factory/LoadUnitFactory.d.ts +0 -16
- package/dist/factory/LoadUnitFactory.js +0 -58
- package/dist/factory/index.js +0 -5
- package/dist/impl/EggPrototypeBuilder.d.ts +0 -26
- package/dist/impl/EggPrototypeBuilder.js +0 -115
- package/dist/impl/EggPrototypeImpl.d.ts +0 -28
- package/dist/impl/EggPrototypeImpl.js +0 -52
- package/dist/impl/LoadUnitMultiInstanceProtoHook.d.ts +0 -11
- package/dist/impl/LoadUnitMultiInstanceProtoHook.js +0 -16
- package/dist/impl/ModuleLoadUnit.d.ts +0 -38
- package/dist/impl/ModuleLoadUnit.js +0 -211
- package/dist/impl/index.js +0 -6
- package/dist/model/AppGraph.d.ts +0 -42
- package/dist/model/AppGraph.js +0 -195
- package/dist/model/EggPrototype.d.ts +0 -7
- package/dist/model/EggPrototype.js +0 -7
- package/dist/model/LoadUnit.d.ts +0 -7
- package/dist/model/LoadUnit.js +0 -7
- package/dist/model/ModuleDescriptor.d.ts +0 -22
- package/dist/model/ModuleDescriptor.js +0 -33
- package/dist/model/ProtoDescriptor/AbstractProtoDescriptor.d.ts +0 -36
- package/dist/model/ProtoDescriptor/AbstractProtoDescriptor.js +0 -35
- package/dist/model/ProtoDescriptor/ClassProtoDescriptor.d.ts +0 -16
- package/dist/model/ProtoDescriptor/ClassProtoDescriptor.js +0 -27
- package/dist/model/ProtoDescriptor/index.js +0 -4
- package/dist/model/ProtoDescriptorHelper.d.ts +0 -30
- package/dist/model/ProtoDescriptorHelper.js +0 -113
- package/dist/model/graph/GlobalGraph.d.ts +0 -67
- package/dist/model/graph/GlobalGraph.js +0 -176
- package/dist/model/graph/GlobalModuleNode.d.ts +0 -29
- package/dist/model/graph/GlobalModuleNode.js +0 -42
- package/dist/model/graph/GlobalModuleNodeBuilder.d.ts +0 -17
- package/dist/model/graph/GlobalModuleNodeBuilder.js +0 -56
- package/dist/model/graph/ProtoNode.d.ts +0 -25
- package/dist/model/graph/ProtoNode.js +0 -43
- package/dist/model/graph/ProtoSelector.d.ts +0 -10
- package/dist/model/graph/ProtoSelector.js +0 -3
- package/dist/model/graph/index.js +0 -7
- package/dist/model/index.js +0 -15
- package/dist/util/ClassUtil.d.ts +0 -9
- package/dist/util/ClassUtil.js +0 -18
- package/dist/util/index.js +0 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,407 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { GlobalGraph, GlobalGraphBuildHook, GlobalGraphOptions } from "./model/graph/GlobalGraph.js";
|
|
7
|
-
import { GlobalModuleNodeBuilder } from "./model/graph/GlobalModuleNodeBuilder.js";
|
|
8
|
-
import { AbstractProtoDescriptor, AbstractProtoDescriptorOptions } from "./model/ProtoDescriptor/AbstractProtoDescriptor.js";
|
|
9
|
-
import { ClassProtoDescriptor, ClassProtoDescriptorOptions } from "./model/ProtoDescriptor/ClassProtoDescriptor.js";
|
|
10
|
-
import { AppGraph, ClazzMap, ClazzMetaMap, InstanceClazzMeta, ModuleNode } from "./model/AppGraph.js";
|
|
11
|
-
import { EggPrototypeLifecycleUtil } from "./model/EggPrototype.js";
|
|
12
|
-
import { LoadUnitLifecycleUtil } from "./model/LoadUnit.js";
|
|
13
|
-
import { ProtoDescriptorHelper } from "./model/ProtoDescriptorHelper.js";
|
|
14
|
-
import { EggPrototypeCreatorFactory } from "./factory/EggPrototypeCreatorFactory.js";
|
|
15
|
-
import { LoadUnitFactory } from "./factory/LoadUnitFactory.js";
|
|
16
|
-
import { EggPrototypeNotFound, IncompatibleProtoInject, MultiPrototypeFound, TeggError } from "./errors.js";
|
|
17
|
-
import { ClassUtil } from "./util/ClassUtil.js";
|
|
18
|
-
import { EggPrototypeBuilder } from "./impl/EggPrototypeBuilder.js";
|
|
19
|
-
import { EggPrototypeImpl } from "./impl/EggPrototypeImpl.js";
|
|
20
|
-
import { LoadUnitMultiInstanceProtoHook } from "./impl/LoadUnitMultiInstanceProtoHook.js";
|
|
21
|
-
import { ModuleGraph, ModuleLoadUnit } from "./impl/ModuleLoadUnit.js";
|
|
1
|
+
import { EdgeMeta, Graph, GraphNode, GraphNodeObj, ModuleReference } from "@eggjs/tegg-common-util";
|
|
2
|
+
import { AccessLevel, EggLoadUnitType, EggLoadUnitTypeLike, EggProtoImplClass, EggPrototype, EggPrototypeCreator, EggPrototypeLifecycleContext, EggPrototypeName, GraphNodeObj as GraphNodeObj$1, Id, InjectConstructorProto, InjectObjectDescriptor, InjectObjectProto, LifecycleHook, LoadUnit, LoadUnitCreator, LoadUnitLifecycleContext, Loader, MetaDataKey, ModuleReference as ModuleReference$1, MultiInstancePrototypeGetObjectsContext, ObjectInitTypeLike, ProtoDescriptor, ProtoDescriptorTypeLike, QualifierInfo, QualifierValue } from "@eggjs/tegg-types";
|
|
3
|
+
import { FrameworkBaseError } from "egg-errors";
|
|
4
|
+
import { InjectType, QualifierAttribute } from "@eggjs/core-decorator";
|
|
5
|
+
import { LifecycleUtil } from "@eggjs/tegg-lifecycle";
|
|
22
6
|
export * from "@eggjs/tegg-types/metadata";
|
|
7
|
+
|
|
8
|
+
//#region src/factory/EggPrototypeFactory.d.ts
|
|
9
|
+
declare class EggPrototypeFactory {
|
|
10
|
+
static instance: EggPrototypeFactory;
|
|
11
|
+
private publicProtoMap;
|
|
12
|
+
registerPrototype(proto: EggPrototype, loadUnit: LoadUnit): void;
|
|
13
|
+
deletePrototype(proto: EggPrototype, loadUnit: LoadUnit): void;
|
|
14
|
+
getPrototype(name: PropertyKey, loadUnit?: LoadUnit, qualifiers?: QualifierInfo[]): EggPrototype;
|
|
15
|
+
private doGetPrototype;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/model/graph/ProtoSelector.d.ts
|
|
19
|
+
interface ProtoSelectorContext {
|
|
20
|
+
name: PropertyKey;
|
|
21
|
+
qualifiers: QualifierInfo[];
|
|
22
|
+
moduleName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/model/graph/ProtoNode.d.ts
|
|
26
|
+
declare class ProtoDependencyMeta implements EdgeMeta {
|
|
27
|
+
injectObj: PropertyKey;
|
|
28
|
+
constructor({
|
|
29
|
+
injectObj
|
|
30
|
+
}: {
|
|
31
|
+
injectObj: PropertyKey;
|
|
32
|
+
});
|
|
33
|
+
equal(meta: ProtoDependencyMeta): boolean;
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|
|
36
|
+
declare class ProtoNode implements GraphNodeObj$1 {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly proto: ProtoDescriptor;
|
|
39
|
+
constructor(proto: ProtoDescriptor);
|
|
40
|
+
toString(): string;
|
|
41
|
+
selectProto(ctx: ProtoSelectorContext): boolean;
|
|
42
|
+
static createProtoId(proto: ProtoDescriptor): string;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/model/graph/GlobalModuleNode.d.ts
|
|
46
|
+
interface GlobalModuleNodeOptions {
|
|
47
|
+
name: string;
|
|
48
|
+
unitPath: string;
|
|
49
|
+
optional: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare class ModuleDependencyMeta implements EdgeMeta {
|
|
52
|
+
readonly obj: ProtoDescriptor;
|
|
53
|
+
readonly injectObj: PropertyKey;
|
|
54
|
+
constructor(obj: ProtoDescriptor, injectObj: PropertyKey);
|
|
55
|
+
equal(meta: ModuleDependencyMeta): boolean;
|
|
56
|
+
toString(): string;
|
|
57
|
+
}
|
|
58
|
+
declare class GlobalModuleNode implements GraphNodeObj {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly unitPath: string;
|
|
62
|
+
readonly optional: boolean;
|
|
63
|
+
readonly protos: GraphNode<ProtoNode, ProtoDependencyMeta>[];
|
|
64
|
+
constructor(options: GlobalModuleNodeOptions);
|
|
65
|
+
addProto(proto: ProtoDescriptor): void;
|
|
66
|
+
toString(): string;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/model/ModuleDescriptor.d.ts
|
|
70
|
+
interface ModuleDescriptor {
|
|
71
|
+
name: string;
|
|
72
|
+
unitPath: string;
|
|
73
|
+
optional?: boolean;
|
|
74
|
+
clazzList: EggProtoImplClass[];
|
|
75
|
+
multiInstanceClazzList: EggProtoImplClass[];
|
|
76
|
+
protos: ProtoDescriptor[];
|
|
77
|
+
}
|
|
78
|
+
interface ModuleDumpOptions {
|
|
79
|
+
dumpDir?: string;
|
|
80
|
+
}
|
|
81
|
+
declare class ModuleDescriptorDumper {
|
|
82
|
+
static stringifyDescriptor(moduleDescriptor: ModuleDescriptor): string;
|
|
83
|
+
static stringifyClazz(clazz: EggProtoImplClass, moduleDescriptor: ModuleDescriptor): string;
|
|
84
|
+
static dumpPath(desc: ModuleDescriptor, options?: ModuleDumpOptions): string;
|
|
85
|
+
static dump(desc: ModuleDescriptor, options?: ModuleDumpOptions): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/model/graph/GlobalGraph.d.ts
|
|
89
|
+
interface GlobalGraphOptions {
|
|
90
|
+
strict?: boolean;
|
|
91
|
+
}
|
|
92
|
+
type GlobalGraphBuildHook = (globalGraph: GlobalGraph) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Sort all prototypes and modules in app.
|
|
95
|
+
* - 1. LoaderFactory.loadApp: get ModuleDescriptors
|
|
96
|
+
* - 2. GlobalGraph.create: create global graph instance
|
|
97
|
+
* - 3. graph.build:
|
|
98
|
+
* - check duplicated prototypes exits
|
|
99
|
+
* - check inject object exists (only in strict mode,
|
|
100
|
+
* can register proto in hooks now, in next major version,
|
|
101
|
+
* should use load to create dynamic ProtoDescriptor and delete
|
|
102
|
+
* strict false options
|
|
103
|
+
* )
|
|
104
|
+
* - 4. graph.sort: build moduleConfigList and moduleProtoDescriptorMap
|
|
105
|
+
*/
|
|
106
|
+
declare class GlobalGraph {
|
|
107
|
+
#private;
|
|
108
|
+
/**
|
|
109
|
+
* Vertex: ModuleNode, collect prototypes in module
|
|
110
|
+
* Edge: ModuleDependencyMeta, prototype and it's inject object
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
moduleGraph: Graph<GlobalModuleNode, ModuleDependencyMeta>;
|
|
114
|
+
/**
|
|
115
|
+
* Vertex: ProtoNode, collect all prototypes in app
|
|
116
|
+
* Edge: ProtoDependencyMeta, inject object
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
protoGraph: Graph<ProtoNode, ProtoDependencyMeta>;
|
|
120
|
+
/**
|
|
121
|
+
* The order of the moduleConfigList is the order in which they are instantiated
|
|
122
|
+
*/
|
|
123
|
+
moduleConfigList: readonly ModuleReference[];
|
|
124
|
+
/**
|
|
125
|
+
* key: module name
|
|
126
|
+
* value: ProtoDescriptor in module, the order is the order in which they are instantiated
|
|
127
|
+
*/
|
|
128
|
+
moduleProtoDescriptorMap: Map<string, ProtoDescriptor[]>;
|
|
129
|
+
strict: boolean;
|
|
130
|
+
private buildHooks;
|
|
131
|
+
/**
|
|
132
|
+
* The global instance used in ModuleLoadUnit
|
|
133
|
+
*/
|
|
134
|
+
static instance?: GlobalGraph;
|
|
135
|
+
constructor(options?: GlobalGraphOptions);
|
|
136
|
+
registerBuildHook(hook: GlobalGraphBuildHook): void;
|
|
137
|
+
addModuleNode(moduleNode: GlobalModuleNode): void;
|
|
138
|
+
build(): void;
|
|
139
|
+
buildInjectEdge(moduleNode: GraphNode<GlobalModuleNode, ModuleDependencyMeta>, protoNode: GraphNode<ProtoNode, ProtoDependencyMeta>, injectObj: InjectObjectDescriptor): void;
|
|
140
|
+
addInject(moduleNode: GraphNode<GlobalModuleNode, ModuleDependencyMeta>, protoNode: GraphNode<ProtoNode, ProtoDependencyMeta>, injectNode: GraphNode<ProtoNode, ProtoDependencyMeta>, injectName: PropertyKey): void;
|
|
141
|
+
findInjectProto(proto: ProtoDescriptor, injectObject: InjectObjectDescriptor): ProtoDescriptor | undefined;
|
|
142
|
+
findDependencyProtoNode(proto: ProtoDescriptor, injectObject: InjectObjectDescriptor): GraphNode<ProtoNode, ProtoDependencyMeta> | undefined;
|
|
143
|
+
findModuleNode(moduleName: string): GraphNode<GlobalModuleNode, ModuleDependencyMeta>;
|
|
144
|
+
sort(): void;
|
|
145
|
+
static create(moduleDescriptors: ModuleDescriptor[], options?: GlobalGraphOptions): Promise<GlobalGraph>;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/model/graph/GlobalModuleNodeBuilder.d.ts
|
|
149
|
+
declare class GlobalModuleNodeBuilder {
|
|
150
|
+
private readonly name;
|
|
151
|
+
private readonly unitPath;
|
|
152
|
+
private readonly optional;
|
|
153
|
+
private readonly protos;
|
|
154
|
+
constructor(options: GlobalModuleNodeOptions);
|
|
155
|
+
addClazz(clazz: EggProtoImplClass): this;
|
|
156
|
+
addMultiInstanceClazz(clazz: EggProtoImplClass, defineModuleName: string, defineUnitPath: string): Promise<this>;
|
|
157
|
+
build(): GlobalModuleNode;
|
|
158
|
+
static create(unitPath: string, optional?: boolean): GlobalModuleNodeBuilder;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/model/ProtoDescriptor/AbstractProtoDescriptor.d.ts
|
|
162
|
+
interface AbstractProtoDescriptorOptions {
|
|
163
|
+
name: PropertyKey;
|
|
164
|
+
accessLevel: AccessLevel;
|
|
165
|
+
initType: ObjectInitTypeLike;
|
|
166
|
+
qualifiers: QualifierInfo[];
|
|
167
|
+
protoImplType: string;
|
|
168
|
+
injectObjects: InjectObjectDescriptor[];
|
|
169
|
+
defineModuleName: string;
|
|
170
|
+
defineUnitPath: string;
|
|
171
|
+
instanceModuleName: string;
|
|
172
|
+
instanceDefineUnitPath: string;
|
|
173
|
+
type: ProtoDescriptorTypeLike;
|
|
174
|
+
properQualifiers: Record<PropertyKey, QualifierInfo[]>;
|
|
175
|
+
}
|
|
176
|
+
declare abstract class AbstractProtoDescriptor implements ProtoDescriptor {
|
|
177
|
+
name: PropertyKey;
|
|
178
|
+
accessLevel: AccessLevel;
|
|
179
|
+
initType: ObjectInitTypeLike;
|
|
180
|
+
qualifiers: QualifierInfo[];
|
|
181
|
+
injectObjects: InjectObjectDescriptor[];
|
|
182
|
+
protoImplType: string;
|
|
183
|
+
defineModuleName: string;
|
|
184
|
+
defineUnitPath: string;
|
|
185
|
+
instanceModuleName: string;
|
|
186
|
+
instanceDefineUnitPath: string;
|
|
187
|
+
className?: string;
|
|
188
|
+
properQualifiers: Record<PropertyKey, QualifierInfo[]>;
|
|
189
|
+
type: ProtoDescriptorTypeLike;
|
|
190
|
+
protected constructor(options: AbstractProtoDescriptorOptions);
|
|
191
|
+
abstract equal(protoDescriptor: ProtoDescriptor): boolean;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/model/ProtoDescriptor/ClassProtoDescriptor.d.ts
|
|
195
|
+
interface ClassProtoDescriptorOptions extends Omit<AbstractProtoDescriptorOptions, 'type'> {
|
|
196
|
+
clazz: EggProtoImplClass;
|
|
197
|
+
}
|
|
198
|
+
declare class ClassProtoDescriptor extends AbstractProtoDescriptor {
|
|
199
|
+
clazz: EggProtoImplClass;
|
|
200
|
+
clazzName: string;
|
|
201
|
+
static isClassProtoDescriptor(descriptor: ProtoDescriptor): descriptor is ClassProtoDescriptor;
|
|
202
|
+
constructor(options: ClassProtoDescriptorOptions);
|
|
203
|
+
equal(protoDescriptor: ProtoDescriptor): boolean;
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/model/AppGraph.d.ts
|
|
207
|
+
interface InstanceClazzMeta {
|
|
208
|
+
name: PropertyKey;
|
|
209
|
+
qualifiers: QualifierInfo[];
|
|
210
|
+
properQualifiers: Record<PropertyKey, QualifierInfo[]>;
|
|
211
|
+
accessLevel: AccessLevel;
|
|
212
|
+
instanceModule: GraphNode<ModuleNode>;
|
|
213
|
+
ownerModule: GraphNode<ModuleNode>;
|
|
214
|
+
}
|
|
215
|
+
type ClazzMetaMap = Record<EggPrototypeName, InstanceClazzMeta[]>;
|
|
216
|
+
declare class ClazzMap {
|
|
217
|
+
private clazzMap;
|
|
218
|
+
private graph;
|
|
219
|
+
constructor(graph: Graph<ModuleNode>);
|
|
220
|
+
build(): Promise<void>;
|
|
221
|
+
findDependencyModule(objName: EggPrototypeName, properQualifiers: QualifierInfo[], intoModule: GraphNode<ModuleNode>): GraphNode<ModuleNode>[];
|
|
222
|
+
}
|
|
223
|
+
declare class ModuleNode implements GraphNodeObj$1 {
|
|
224
|
+
readonly id: string;
|
|
225
|
+
readonly name: string;
|
|
226
|
+
readonly moduleConfig: ModuleReference$1;
|
|
227
|
+
private readonly clazzList;
|
|
228
|
+
constructor(moduleConfig: ModuleReference$1);
|
|
229
|
+
addClazz(clazz: EggProtoImplClass): Promise<void>;
|
|
230
|
+
toString(): string;
|
|
231
|
+
getClazzList(): readonly EggProtoImplClass[];
|
|
232
|
+
}
|
|
233
|
+
declare class AppGraph {
|
|
234
|
+
private graph;
|
|
235
|
+
private clazzMap;
|
|
236
|
+
moduleConfigList: Array<ModuleReference$1>;
|
|
237
|
+
constructor();
|
|
238
|
+
addNode(moduleNode: ModuleNode): void;
|
|
239
|
+
getClazzList(): readonly EggProtoImplClass[];
|
|
240
|
+
build(): Promise<void>;
|
|
241
|
+
sort(): void;
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/model/EggPrototype.d.ts
|
|
245
|
+
declare const EggPrototypeLifecycleUtil: LifecycleUtil<EggPrototypeLifecycleContext, EggPrototype>;
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/model/LoadUnit.d.ts
|
|
248
|
+
declare const LoadUnitLifecycleUtil: LifecycleUtil<LoadUnitLifecycleContext, LoadUnit>;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/model/ProtoDescriptorHelper.d.ts
|
|
251
|
+
declare class ProtoDescriptorHelper {
|
|
252
|
+
#private;
|
|
253
|
+
static addDefaultQualifier(qualifiers: QualifierInfo[], initType: ObjectInitTypeLike, loadUnitName: string): QualifierInfo[];
|
|
254
|
+
static createByMultiInstanceClazz(clazz: EggProtoImplClass, options: {
|
|
255
|
+
defineModuleName: string;
|
|
256
|
+
defineUnitPath: string;
|
|
257
|
+
instanceModuleName: string;
|
|
258
|
+
instanceDefineUnitPath: string;
|
|
259
|
+
}): Promise<ProtoDescriptor[]>;
|
|
260
|
+
static createByDynamicMultiInstanceClazz(clazz: EggProtoImplClass, options: {
|
|
261
|
+
defineModuleName: string;
|
|
262
|
+
defineUnitPath: string;
|
|
263
|
+
instanceModuleName: string;
|
|
264
|
+
instanceDefineUnitPath: string;
|
|
265
|
+
}): Promise<ProtoDescriptor[]>;
|
|
266
|
+
static createByStaticMultiInstanceClazz(clazz: EggProtoImplClass, options: {
|
|
267
|
+
defineModuleName: string;
|
|
268
|
+
defineUnitPath: string;
|
|
269
|
+
instanceModuleName: string;
|
|
270
|
+
instanceDefineUnitPath: string;
|
|
271
|
+
}): ProtoDescriptor[];
|
|
272
|
+
static createByInstanceClazz(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): ProtoDescriptor;
|
|
273
|
+
static selectProto(proto: ProtoDescriptor, ctx: ProtoSelectorContext): boolean;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/factory/EggPrototypeCreatorFactory.d.ts
|
|
277
|
+
declare class EggPrototypeCreatorFactory {
|
|
278
|
+
private static creatorMap;
|
|
279
|
+
static registerPrototypeCreator(type: string, creator: EggPrototypeCreator): void;
|
|
280
|
+
static getPrototypeCreator(type: string): EggPrototypeCreator | undefined;
|
|
281
|
+
static createProto(clazz: EggProtoImplClass, loadUnit: LoadUnit): Promise<EggPrototype[]>;
|
|
282
|
+
static createProtoByDescriptor(protoDescriptor: ClassProtoDescriptor, loadUnit: LoadUnit): Promise<EggPrototype>;
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/factory/LoadUnitFactory.d.ts
|
|
286
|
+
declare class LoadUnitFactory {
|
|
287
|
+
private static loadUnitCreatorMap;
|
|
288
|
+
private static loadUnitMap;
|
|
289
|
+
private static loadUnitIdMap;
|
|
290
|
+
protected static getLoanUnit(ctx: LoadUnitLifecycleContext, type: EggLoadUnitTypeLike): Promise<LoadUnit>;
|
|
291
|
+
static createLoadUnit(unitPath: string, type: EggLoadUnitTypeLike, loader: Loader): Promise<LoadUnit>;
|
|
292
|
+
static createPreloadLoadUnit(unitPath: string, type: EggLoadUnitTypeLike, loader: Loader): Promise<LoadUnit>;
|
|
293
|
+
static destroyLoadUnit(loadUnit: LoadUnit): Promise<void>;
|
|
294
|
+
static getLoadUnitById(id: Id): LoadUnit | undefined;
|
|
295
|
+
static registerLoadUnitCreator(type: EggLoadUnitTypeLike, creator: LoadUnitCreator): void;
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/errors.d.ts
|
|
299
|
+
declare class TeggError extends FrameworkBaseError {
|
|
300
|
+
get module(): string;
|
|
301
|
+
}
|
|
302
|
+
declare class EggPrototypeNotFound extends TeggError {
|
|
303
|
+
constructor(protoName: EggPrototypeName, loadUnitId: string | undefined);
|
|
304
|
+
}
|
|
305
|
+
declare class MultiPrototypeFound extends TeggError {
|
|
306
|
+
constructor(name: EggPrototypeName, qualifier: QualifierInfo[], result?: string);
|
|
307
|
+
}
|
|
308
|
+
declare class IncompatibleProtoInject extends TeggError {
|
|
309
|
+
constructor(msg: string);
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/util/ClassUtil.d.ts
|
|
313
|
+
declare class ClassUtil {
|
|
314
|
+
static classDescription(clazz: EggProtoImplClass): string;
|
|
315
|
+
static className(clazz: EggProtoImplClass): string;
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/impl/EggPrototypeBuilder.d.ts
|
|
319
|
+
declare class EggPrototypeBuilder {
|
|
320
|
+
private clazz;
|
|
321
|
+
private name;
|
|
322
|
+
private initType;
|
|
323
|
+
private accessLevel;
|
|
324
|
+
private filepath;
|
|
325
|
+
private injectType;
|
|
326
|
+
private injectObjects;
|
|
327
|
+
private loadUnit;
|
|
328
|
+
private qualifiers;
|
|
329
|
+
private properQualifiers;
|
|
330
|
+
private className?;
|
|
331
|
+
private multiInstanceConstructorIndex?;
|
|
332
|
+
private multiInstanceConstructorAttributes?;
|
|
333
|
+
static create(ctx: EggPrototypeLifecycleContext): EggPrototype;
|
|
334
|
+
private tryFindDefaultPrototype;
|
|
335
|
+
private tryFindContextPrototype;
|
|
336
|
+
private tryFindSelfInitTypePrototype;
|
|
337
|
+
private findInjectObjectPrototype;
|
|
338
|
+
build(): EggPrototype;
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/impl/EggPrototypeImpl.d.ts
|
|
342
|
+
declare class EggPrototypeImpl implements EggPrototype {
|
|
343
|
+
private readonly clazz;
|
|
344
|
+
private readonly qualifiers;
|
|
345
|
+
readonly filepath: string;
|
|
346
|
+
readonly id: string;
|
|
347
|
+
readonly name: EggPrototypeName;
|
|
348
|
+
readonly initType: ObjectInitTypeLike;
|
|
349
|
+
readonly accessLevel: AccessLevel;
|
|
350
|
+
readonly injectObjects: Array<InjectObjectProto | InjectConstructorProto>;
|
|
351
|
+
readonly injectType: InjectType;
|
|
352
|
+
readonly loadUnitId: Id;
|
|
353
|
+
readonly className?: string;
|
|
354
|
+
readonly multiInstanceConstructorIndex?: number;
|
|
355
|
+
readonly multiInstanceConstructorAttributes?: QualifierAttribute[];
|
|
356
|
+
[key: symbol]: PropertyDescriptor;
|
|
357
|
+
constructor(id: string, name: EggPrototypeName, clazz: EggProtoImplClass, filepath: string, initType: ObjectInitTypeLike, accessLevel: AccessLevel, injectObjectMap: Array<InjectObjectProto | InjectConstructorProto>, loadUnitId: Id, qualifiers: QualifierInfo[], className?: string, injectType?: InjectType, multiInstanceConstructorIndex?: number, multiInstanceConstructorAttributes?: QualifierAttribute[]);
|
|
358
|
+
verifyQualifiers(qualifiers: QualifierInfo[]): boolean;
|
|
359
|
+
verifyQualifier(qualifier: QualifierInfo): boolean;
|
|
360
|
+
getQualifier(attribute: string): QualifierValue | undefined;
|
|
361
|
+
constructEggObject(...args: any): object;
|
|
362
|
+
getMetaData<T>(metadataKey: MetaDataKey): T | undefined;
|
|
363
|
+
}
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/impl/LoadUnitMultiInstanceProtoHook.d.ts
|
|
366
|
+
declare class LoadUnitMultiInstanceProtoHook implements LifecycleHook<LoadUnitLifecycleContext, LoadUnit> {
|
|
367
|
+
static multiInstanceClazzSet: Set<EggProtoImplClass>;
|
|
368
|
+
static setAllClassList(clazzList: readonly EggProtoImplClass[]): void;
|
|
369
|
+
static clear(): void;
|
|
370
|
+
preCreate(): Promise<void>;
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/impl/ModuleLoadUnit.d.ts
|
|
374
|
+
declare class ModuleGraph {
|
|
375
|
+
private graph;
|
|
376
|
+
clazzList: EggProtoImplClass[];
|
|
377
|
+
readonly unitPath: string;
|
|
378
|
+
readonly name: string;
|
|
379
|
+
constructor(clazzList: EggProtoImplClass[], unitPath: string, name: string);
|
|
380
|
+
private findInjectNode;
|
|
381
|
+
build(): Promise<void>;
|
|
382
|
+
sort(): void;
|
|
383
|
+
}
|
|
384
|
+
declare class ModuleLoadUnit implements LoadUnit {
|
|
385
|
+
private protoMap;
|
|
386
|
+
private protos;
|
|
387
|
+
private clazzList;
|
|
388
|
+
readonly id: string;
|
|
389
|
+
readonly name: string;
|
|
390
|
+
readonly unitPath: string;
|
|
391
|
+
readonly type = EggLoadUnitType.MODULE;
|
|
392
|
+
get globalGraph(): GlobalGraph;
|
|
393
|
+
constructor(name: string, unitPath: string);
|
|
394
|
+
private doLoadClazz;
|
|
395
|
+
private loadClazz;
|
|
396
|
+
preLoad(): Promise<void>;
|
|
397
|
+
init(): Promise<void>;
|
|
398
|
+
containPrototype(proto: EggPrototype): boolean;
|
|
399
|
+
getEggPrototype(name: string, qualifiers: QualifierInfo[]): EggPrototype[];
|
|
400
|
+
registerEggPrototype(proto: EggPrototype): void;
|
|
401
|
+
deletePrototype(proto: EggPrototype): void;
|
|
402
|
+
destroy(): Promise<void>;
|
|
403
|
+
iterateEggPrototype(): IterableIterator<EggPrototype>;
|
|
404
|
+
static createModule(ctx: LoadUnitLifecycleContext): ModuleLoadUnit;
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
23
407
|
export { AbstractProtoDescriptor, AbstractProtoDescriptorOptions, AppGraph, ClassProtoDescriptor, ClassProtoDescriptorOptions, ClassUtil, ClazzMap, ClazzMetaMap, EggPrototypeBuilder, EggPrototypeCreatorFactory, EggPrototypeFactory, EggPrototypeImpl, EggPrototypeLifecycleUtil, EggPrototypeNotFound, GlobalGraph, GlobalGraphBuildHook, GlobalGraphOptions, GlobalModuleNode, GlobalModuleNodeBuilder, GlobalModuleNodeOptions, IncompatibleProtoInject, InstanceClazzMeta, LoadUnitFactory, LoadUnitLifecycleUtil, LoadUnitMultiInstanceProtoHook, ModuleDependencyMeta, ModuleDescriptor, ModuleDescriptorDumper, ModuleDumpOptions, ModuleGraph, ModuleLoadUnit, ModuleNode, MultiPrototypeFound, ProtoDependencyMeta, ProtoDescriptorHelper, ProtoNode, ProtoSelectorContext, TeggError };
|