@cocojs/mvc 0.1.0-beta.13 → 0.1.0-beta.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/dist/index.d.ts CHANGED
@@ -21,8 +21,8 @@ export declare class Application {
21
21
  iocComponentFactory: IocComponentFactory;
22
22
  constructor(jsonConfig?: Record<string, any>);
23
23
  /**
24
- * 在项目中,所以的组件都已经收集到coco/index里面了,所以不需要进行组件收集;
25
- * 在测试时,组件是在执行到对应的行装饰器才会执行,所以需要先收集在启动。
24
+ * 应用模块在 start 前完成 AOT 注册;测试中的局部类可能在 Application 构造后才注册,
25
+ * 因此 start 时统一解析注册表。
26
26
  */
27
27
  start(): void;
28
28
  destructor(): void;
@@ -67,8 +67,8 @@ declare class Application_2 {
67
67
  iocComponentFactory: IocComponentFactory_2;
68
68
  constructor(jsonConfig?: Record<string, any>);
69
69
  /**
70
- * 在项目中,所以的组件都已经收集到coco/index里面了,所以不需要进行组件收集;
71
- * 在测试时,组件是在执行到对应的行装饰器才会执行,所以需要先收集在启动。
70
+ * 应用模块在 start 前完成 AOT 注册;测试中的局部类可能在 Application 构造后才注册,
71
+ * 因此 start 时统一解析注册表。
72
72
  */
73
73
  start(): void;
74
74
  destructor(): void;
@@ -113,8 +113,8 @@ declare class Application_3 {
113
113
  iocComponentFactory: IocComponentFactory_3;
114
114
  constructor(jsonConfig?: Record<string, any>);
115
115
  /**
116
- * 在项目中,所以的组件都已经收集到coco/index里面了,所以不需要进行组件收集;
117
- * 在测试时,组件是在执行到对应的行装饰器才会执行,所以需要先收集在启动。
116
+ * 应用模块在 start 前完成 AOT 注册;测试中的局部类可能在 Application 构造后才注册,
117
+ * 因此 start 时统一解析注册表。
118
118
  */
119
119
  start(): void;
120
120
  destructor(): void;
@@ -163,22 +163,32 @@ export declare class Bind extends Metadata_3 {
163
163
 
164
164
  export declare const bind: () => Decorator_2<ClassMethodDecoratorContext>;
165
165
 
166
+ /**
167
+ * 建立占位元数据类与真实元数据类的关联。
168
+ * 由 `@metadataFor(X)` 经 AOT 编译后调用。
169
+ * @public
170
+ */
171
+ export declare function bindPlaceholderMetadataClass(decoratorExp: PlaceholderDecoratorExp<any>, metadataClass: Class<any>): void;
172
+
166
173
  declare interface BizMetadata {
167
174
  classMetadata: Metadata[];
168
175
  fieldMetadata: Map<Field, Metadata[]>;
169
176
  methodMetadata: Map<Field, Metadata[]>;
177
+ getterMetadata: Map<Field, Metadata[]>;
170
178
  }
171
179
 
172
180
  declare interface BizMetadata_2 {
173
181
  classMetadata: Metadata_2[];
174
182
  fieldMetadata: Map<Field_2, Metadata_2[]>;
175
183
  methodMetadata: Map<Field_2, Metadata_2[]>;
184
+ getterMetadata: Map<Field_2, Metadata_2[]>;
176
185
  }
177
186
 
178
187
  declare interface BizMetadata_3 {
179
188
  classMetadata: Metadata_4[];
180
189
  fieldMetadata: Map<Field_3, Metadata_4[]>;
181
190
  methodMetadata: Map<Field_3, Metadata_4[]>;
191
+ getterMetadata: Map<Field_3, Metadata_4[]>;
182
192
  }
183
193
 
184
194
  /**
@@ -221,7 +231,12 @@ declare type ComponentClassPostConstructFn = (metadata: Metadata, application: A
221
231
  */
222
232
  declare type ComponentFieldPostConstructFn = (metadata: Metadata, application: Application, target: {
223
233
  name: Field;
224
- kind: Kind;
234
+ kind: typeof KindField;
235
+ }) => void;
236
+
237
+ declare type ComponentGetterPostConstructFn = (metadata: Metadata, application: Application, target: {
238
+ name: Field;
239
+ kind: typeof KindGetter;
225
240
  }) => void;
226
241
 
227
242
  declare class ComponentMetadataClass {
@@ -283,10 +298,10 @@ declare class ComponentMetadataClass_3 {
283
298
  */
284
299
  declare type ComponentMethodPostConstructFn = (metadata: Metadata, application: Application, target: {
285
300
  name: Field;
286
- kind: Kind;
301
+ kind: typeof KindMethod;
287
302
  }) => void;
288
303
 
289
- declare type ComponentPostConstruct = ComponentClassPostConstructFn | ComponentMethodPostConstructFn | ComponentFieldPostConstructFn;
304
+ declare type ComponentPostConstruct = ComponentClassPostConstructFn | ComponentMethodPostConstructFn | ComponentFieldPostConstructFn | ComponentGetterPostConstructFn;
290
305
 
291
306
  /**
292
307
  * @public
@@ -329,12 +344,16 @@ export declare class Cookie extends Metadata_3 {
329
344
  export declare const cookie: () => Decorator_2<ClassDecoratorContext>;
330
345
 
331
346
  /**
332
- * 使用元数据类创建一个装饰器函数
333
- * 适用于装饰器不装饰自己元数据类的场景
347
+ * 使用元数据类创建一个装饰器函数。
348
+ * 第一个参数传元数据类时直接绑定该元数据类;
349
+ * 不传元数据类时创建占位装饰器,可以直接把选项对象作为唯一参数传入,
350
+ * 之后需要在正式的元数据类上添加 @metadataFor(X) 装饰器来关联真实的元数据类。
334
351
  * @public
335
352
  */
336
353
  export declare function createDecoratorExp(metadataCls: Class<any>, option?: CreateDecoratorExpOption): DecoratorExp;
337
354
 
355
+ export declare function createDecoratorExp<T>(option?: CreateDecoratorExpOption): PlaceholderDecoratorExp<T>;
356
+
338
357
  declare interface CreateDecoratorExpOption {
339
358
  /**
340
359
  * 类实例化之后,会调用类的装饰器的componentPostConstruct做自定义的处理
@@ -346,14 +365,6 @@ declare interface CreateDecoratorExpOption {
346
365
  componentPostConstruct?: ComponentPostConstruct;
347
366
  }
348
367
 
349
- /**
350
- * 创建一个未绑定元数据的装饰器表达式
351
- * 需要在正式的元数据类上添加decorateSelf装饰器来关联真实的元数据类,装饰器到其他类的使用方式和createDecoratorExp是一致的。
352
- * 适用于装饰器装饰自己元数据类的场景
353
- * @public
354
- */
355
- export declare function createPlaceholderDecoratorExp<T>(option?: CreateDecoratorExpOption): DecoratorExpWithDecoratorSelf<T>;
356
-
357
368
  /**
358
369
  * @public
359
370
  */
@@ -371,11 +382,10 @@ declare type Decorator_3<C> = (value: any, context: C) => any;
371
382
 
372
383
  declare interface DecoratorExp {
373
384
  (userParam?: any): Decorator<DecoratorContext>;
374
- }
375
-
376
- declare interface DecoratorExpWithDecoratorSelf<T extends any> {
377
- (userParam?: T): Decorator<DecoratorContext>;
378
- decorateSelf: (userParam?: T) => Decorator<DecoratorContext>;
385
+ /** 装饰器对应的元数据类,AOT 编译产物通过 `<装饰器标识符>.$$metadataClass` 引用 */
386
+ $$metadataClass: Class<any>;
387
+ /** 是否是占位装饰器 */
388
+ $$isPlaceholderDecoratorExp: boolean;
379
389
  }
380
390
 
381
391
  export declare function definePublisher(object: Record<any, any>, field: string, getter: IGetter, setter?: ISetter): void;
@@ -415,8 +425,8 @@ declare enum DiagnoseCode {
415
425
  'CO10017' = 'CO10017', // 元数据类id属性存在重复
416
426
  'CO10018' = 'CO10018', // createDecoratorExp的第一个参数不是类,或者不是Metadata的子类
417
427
  'CO10019' = 'CO10019', // 装饰器暂时不是支持装饰 setter getter accessor 类型。
418
- 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用decorateSelf函数,但装饰器也没有被使用
419
- 'CO10021' = 'CO10021', // 占位的元数据类没有使用decorateSelf函数
428
+ 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用metadataFor关联,但装饰器也没有被使用
429
+ 'CO10021' = 'CO10021', // 占位的元数据类没有使用metadataFor关联真实元数据类
420
430
  'CO10022' = 'CO10022', // 元数据类不能有字段装饰器
421
431
  'CO10023' = 'CO10023', // 元数据类不能有方法装饰器
422
432
  'CO10024' = 'CO10024', // 元数据类存在多个组件装饰器
@@ -447,8 +457,8 @@ declare enum DiagnoseCode_2 {
447
457
  'CO10017' = 'CO10017', // 元数据类id属性存在重复
448
458
  'CO10018' = 'CO10018', // createDecoratorExp的第一个参数不是类,或者不是Metadata的子类
449
459
  'CO10019' = 'CO10019', // 装饰器暂时不是支持装饰 setter getter accessor 类型。
450
- 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用decorateSelf函数,但装饰器也没有被使用
451
- 'CO10021' = 'CO10021', // 占位的元数据类没有使用decorateSelf函数
460
+ 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用metadataFor关联,但装饰器也没有被使用
461
+ 'CO10021' = 'CO10021', // 占位的元数据类没有使用metadataFor关联真实元数据类
452
462
  'CO10022' = 'CO10022', // 元数据类不能有字段装饰器
453
463
  'CO10023' = 'CO10023', // 元数据类不能有方法装饰器
454
464
  'CO10024' = 'CO10024', // 元数据类存在多个组件装饰器
@@ -479,8 +489,8 @@ declare enum DiagnoseCode_3 {
479
489
  'CO10017' = 'CO10017', // 元数据类id属性存在重复
480
490
  'CO10018' = 'CO10018', // createDecoratorExp的第一个参数不是类,或者不是Metadata的子类
481
491
  'CO10019' = 'CO10019', // 装饰器暂时不是支持装饰 setter getter accessor 类型。
482
- 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用decorateSelf函数,但装饰器也没有被使用
483
- 'CO10021' = 'CO10021', // 占位的元数据类没有使用decorateSelf函数
492
+ 'CO10020' = 'CO10020', // [warn]占位的元数据类没有使用metadataFor关联,但装饰器也没有被使用
493
+ 'CO10021' = 'CO10021', // 占位的元数据类没有使用metadataFor关联真实元数据类
484
494
  'CO10022' = 'CO10022', // 元数据类不能有字段装饰器
485
495
  'CO10023' = 'CO10023', // 元数据类不能有方法装饰器
486
496
  'CO10024' = 'CO10024', // 元数据类存在多个组件装饰器
@@ -513,13 +523,8 @@ declare type Field_2 = string;
513
523
  */
514
524
  declare type Field_3 = string;
515
525
 
516
- /**
517
- * @public
518
- */
519
- export declare class Flow extends Metadata {
520
- }
521
-
522
- export declare const flow: () => Decorator<ClassDecoratorContext>;
526
+ /** 读取userDecoratorParams */
527
+ export declare function getRegistry(): Map<Class<any>, UserDecoratorParams[]>;
523
528
 
524
529
  /**
525
530
  * @public
@@ -671,12 +676,13 @@ declare class IocComponentDefinition {
671
676
  method: string;
672
677
  }): void;
673
678
  /**
674
- * 获取真正会实例化的类定义
679
+ * 解析组件实际需要实例化的类。
680
+ * 没有子类时返回自身,只有一个子类时返回该子类,多个子类时抛出异常。
675
681
  * @param ClsOrId 想要实例化的类或类id
676
682
  * @param qualifier 如果存在多个后端类,需要通过qualifier指定具体的类id
677
683
  * @returns 真正会实例化的类定义
678
684
  */
679
- getInstantiateDefinition(ClsOrId: Class<any> | Id_2, qualifier?: string): IocComDef<any>;
685
+ resolve(ClsOrId: Class<any> | Id_2, qualifier?: string): IocComDef<any>;
680
686
  getDefinition(ClsOrId: Class<any> | Id_2): IocComDef<any>;
681
687
  existDefinition(ClsOrId: Class<any> | Id_2): boolean;
682
688
  destructor(): void;
@@ -691,12 +697,13 @@ declare class IocComponentDefinition_2 {
691
697
  method: string;
692
698
  }): void;
693
699
  /**
694
- * 获取真正会实例化的类定义
700
+ * 解析组件实际需要实例化的类。
701
+ * 没有子类时返回自身,只有一个子类时返回该子类,多个子类时抛出异常。
695
702
  * @param ClsOrId 想要实例化的类或类id
696
703
  * @param qualifier 如果存在多个后端类,需要通过qualifier指定具体的类id
697
704
  * @returns 真正会实例化的类定义
698
705
  */
699
- getInstantiateDefinition(ClsOrId: Class<any> | Id_2_2, qualifier?: string): IocComDef_2<any>;
706
+ resolve(ClsOrId: Class<any> | Id_2_2, qualifier?: string): IocComDef_2<any>;
700
707
  getDefinition(ClsOrId: Class<any> | Id_2_2): IocComDef_2<any>;
701
708
  existDefinition(ClsOrId: Class<any> | Id_2_2): boolean;
702
709
  destructor(): void;
@@ -711,12 +718,13 @@ declare class IocComponentDefinition_3 {
711
718
  method: string;
712
719
  }): void;
713
720
  /**
714
- * 获取真正会实例化的类定义
721
+ * 解析组件实际需要实例化的类。
722
+ * 没有子类时返回自身,只有一个子类时返回该子类,多个子类时抛出异常。
715
723
  * @param ClsOrId 想要实例化的类或类id
716
724
  * @param qualifier 如果存在多个后端类,需要通过qualifier指定具体的类id
717
725
  * @returns 真正会实例化的类定义
718
726
  */
719
- getInstantiateDefinition(ClsOrId: Class<any> | Id_2_3, qualifier?: string): IocComDef_3<any>;
727
+ resolve(ClsOrId: Class<any> | Id_2_3, qualifier?: string): IocComDef_3<any>;
720
728
  getDefinition(ClsOrId: Class<any> | Id_2_3): IocComDef_3<any>;
721
729
  existDefinition(ClsOrId: Class<any> | Id_2_3): boolean;
722
730
  destructor(): void;
@@ -724,7 +732,7 @@ declare class IocComponentDefinition_3 {
724
732
 
725
733
  declare class IocComponentFactory {
726
734
  singletonInstances: Map<Class<any>, any>;
727
- private createComponent;
735
+ private newComponent;
728
736
  getComponents(application: Application, userOption: ConstructOption): any;
729
737
  getViewComponent(application: Application, viewClass: Class<any>, props: any[]): any;
730
738
  destructor(): void;
@@ -732,7 +740,7 @@ declare class IocComponentFactory {
732
740
 
733
741
  declare class IocComponentFactory_2 {
734
742
  singletonInstances: Map<Class<any>, any>;
735
- private createComponent;
743
+ private newComponent;
736
744
  getComponents(application: Application_2, userOption: ConstructOption_2): any;
737
745
  getViewComponent(application: Application_2, viewClass: Class<any>, props: any[]): any;
738
746
  destructor(): void;
@@ -740,7 +748,7 @@ declare class IocComponentFactory_2 {
740
748
 
741
749
  declare class IocComponentFactory_3 {
742
750
  singletonInstances: Map<Class<any>, any>;
743
- private createComponent;
751
+ private newComponent;
744
752
  getComponents(application: Application_3, userOption: ConstructOption_3): any;
745
753
  getViewComponent(application: Application_3, viewClass: Class<any>, props: any[]): any;
746
754
  destructor(): void;
@@ -760,11 +768,11 @@ declare function jsx(component: any, config: any, maybeKey?: any): {
760
768
  export { jsx }
761
769
  export { jsx as jsxs }
762
770
 
763
- declare type Kind = typeof KindClass | typeof KindField | typeof KindMethod;
771
+ declare type Kind = typeof KindClass | typeof KindField | typeof KindMethod | typeof KindGetter;
764
772
 
765
- declare type Kind_2 = typeof KindClass_2 | typeof KindField_2 | typeof KindMethod_2;
773
+ declare type Kind_2 = typeof KindClass_2 | typeof KindField_2 | typeof KindMethod_2 | typeof KindGetter_2;
766
774
 
767
- declare type Kind_3 = typeof KindClass_3 | typeof KindField_3 | typeof KindMethod_3;
775
+ declare type Kind_3 = typeof KindClass_3 | typeof KindField_3 | typeof KindMethod_3 | typeof KindGetter_3;
768
776
 
769
777
  export declare const KindClass = "class";
770
778
 
@@ -778,6 +786,12 @@ declare const KindField_2 = "field";
778
786
 
779
787
  declare const KindField_3 = "field";
780
788
 
789
+ declare const KindGetter = "getter";
790
+
791
+ declare const KindGetter_2 = "getter";
792
+
793
+ declare const KindGetter_3 = "getter";
794
+
781
795
  export declare const KindMethod = "method";
782
796
 
783
797
  declare const KindMethod_2 = "method";
@@ -844,21 +858,30 @@ declare abstract class Metadata_3 {
844
858
  declare abstract class Metadata_4 {
845
859
  }
846
860
 
861
+ /**
862
+ * 声明被装饰类是某个装饰器表达式的元数据类。
863
+ * 由 AOT 编译器转换为 bindPlaceholderMetadataClass 调用,不应在运行时执行。
864
+ * @public
865
+ */
866
+ export declare function metadataFor(_decoratorExp: DecoratorExp): (_beDecoratedCls: any, _context: any) => never;
867
+
847
868
  declare class MetadataRepository {
848
869
  private metaMetadataMap;
849
870
  private bizMetadataMap;
850
- constructor(decoratorMap: Map<Class<any>, Params[]>);
871
+ constructor(decoratorMap: Map<Class<any>, RuntimeDecoratorParams[]>);
851
872
  getAll(): [Map<Class<Metadata>, MetaMetadata>, Map<Class<Metadata>, BizMetadata>];
852
873
  destructor(): void;
853
874
  getMetadataByClass(Cls: Class<any>): {
854
875
  classMetadata: Metadata[];
855
876
  fieldMetadata?: Map<Field, Metadata[]>;
856
877
  methodMetadata?: Map<Field, Metadata[]>;
878
+ getterMetadata?: Map<Field, Metadata[]>;
857
879
  };
858
880
  private addToMap;
859
881
  addClassKindMetadata(cls: Class<any>, MetadataCls?: Class<Metadata>, args?: any): void;
860
882
  addFieldKindMetadata(Cls: Class<any>, fieldName: Field, MetadataCls: Class<Metadata>, args?: any): void;
861
883
  addMethodKindMetadata(Cls: Class<any>, fieldName: Field, MetadataCls: Class<Metadata>, args?: any): void;
884
+ addGetterKindMetadata(Cls: Class<any>, fieldName: Field, MetadataCls: Class<Metadata>, args?: any): void;
862
885
  /**
863
886
  * 获取指定类的类类型的元数据
864
887
  * @param beDecoratedCls 指定类
@@ -904,18 +927,20 @@ declare class MetadataRepository {
904
927
  declare class MetadataRepository_2 {
905
928
  private metaMetadataMap;
906
929
  private bizMetadataMap;
907
- constructor(decoratorMap: Map<Class<any>, Params_2[]>);
930
+ constructor(decoratorMap: Map<Class<any>, RuntimeDecoratorParams_2[]>);
908
931
  getAll(): [Map<Class<Metadata_2>, MetaMetadata_2>, Map<Class<Metadata_2>, BizMetadata_2>];
909
932
  destructor(): void;
910
933
  getMetadataByClass(Cls: Class<any>): {
911
934
  classMetadata: Metadata_2[];
912
935
  fieldMetadata?: Map<Field_2, Metadata_2[]>;
913
936
  methodMetadata?: Map<Field_2, Metadata_2[]>;
937
+ getterMetadata?: Map<Field_2, Metadata_2[]>;
914
938
  };
915
939
  private addToMap;
916
940
  addClassKindMetadata(cls: Class<any>, MetadataCls?: Class<Metadata_2>, args?: any): void;
917
941
  addFieldKindMetadata(Cls: Class<any>, fieldName: Field_2, MetadataCls: Class<Metadata_2>, args?: any): void;
918
942
  addMethodKindMetadata(Cls: Class<any>, fieldName: Field_2, MetadataCls: Class<Metadata_2>, args?: any): void;
943
+ addGetterKindMetadata(Cls: Class<any>, fieldName: Field_2, MetadataCls: Class<Metadata_2>, args?: any): void;
919
944
  /**
920
945
  * 获取指定类的类类型的元数据
921
946
  * @param beDecoratedCls 指定类
@@ -961,18 +986,20 @@ declare class MetadataRepository_2 {
961
986
  declare class MetadataRepository_3 {
962
987
  private metaMetadataMap;
963
988
  private bizMetadataMap;
964
- constructor(decoratorMap: Map<Class<any>, Params_3[]>);
989
+ constructor(decoratorMap: Map<Class<any>, RuntimeDecoratorParams_3[]>);
965
990
  getAll(): [Map<Class<Metadata_4>, MetaMetadata_3>, Map<Class<Metadata_4>, BizMetadata_3>];
966
991
  destructor(): void;
967
992
  getMetadataByClass(Cls: Class<any>): {
968
993
  classMetadata: Metadata_4[];
969
994
  fieldMetadata?: Map<Field_3, Metadata_4[]>;
970
995
  methodMetadata?: Map<Field_3, Metadata_4[]>;
996
+ getterMetadata?: Map<Field_3, Metadata_4[]>;
971
997
  };
972
998
  private addToMap;
973
999
  addClassKindMetadata(cls: Class<any>, MetadataCls?: Class<Metadata_4>, args?: any): void;
974
1000
  addFieldKindMetadata(Cls: Class<any>, fieldName: Field_3, MetadataCls: Class<Metadata_4>, args?: any): void;
975
1001
  addMethodKindMetadata(Cls: Class<any>, fieldName: Field_3, MetadataCls: Class<Metadata_4>, args?: any): void;
1002
+ addGetterKindMetadata(Cls: Class<any>, fieldName: Field_3, MetadataCls: Class<Metadata_4>, args?: any): void;
976
1003
  /**
977
1004
  * 获取指定类的类类型的元数据
978
1005
  * @param beDecoratedCls 指定类
@@ -1019,18 +1046,21 @@ declare interface MetaMetadata {
1019
1046
  classMetadata: Metadata[];
1020
1047
  fieldMetadata: Map<Field, Metadata[]>;
1021
1048
  methodMetadata: Map<Field, Metadata[]>;
1049
+ getterMetadata: Map<Field, Metadata[]>;
1022
1050
  }
1023
1051
 
1024
1052
  declare interface MetaMetadata_2 {
1025
1053
  classMetadata: Metadata_2[];
1026
1054
  fieldMetadata: Map<Field_2, Metadata_2[]>;
1027
1055
  methodMetadata: Map<Field_2, Metadata_2[]>;
1056
+ getterMetadata: Map<Field_2, Metadata_2[]>;
1028
1057
  }
1029
1058
 
1030
1059
  declare interface MetaMetadata_3 {
1031
1060
  classMetadata: Metadata_4[];
1032
1061
  fieldMetadata: Map<Field_3, Metadata_4[]>;
1033
1062
  methodMetadata: Map<Field_3, Metadata_4[]>;
1063
+ getterMetadata: Map<Field_3, Metadata_4[]>;
1034
1064
  }
1035
1065
 
1036
1066
  /**
@@ -1041,41 +1071,15 @@ export declare class Page extends Metadata_3 {
1041
1071
 
1042
1072
  export declare const page: () => Decorator_2<ClassDecoratorContext>;
1043
1073
 
1044
- declare type Params = {
1045
- metadataKind: Kind;
1046
- metadataClass: Class<any>;
1047
- metadataParam: any;
1048
- /**
1049
- * 如果metadataKind是'class',field是undefined
1050
- * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1051
- * TODO: 测试是否支持Symbol类型
1052
- */
1053
- field?: Field;
1054
- };
1055
-
1056
- declare type Params_2 = {
1057
- metadataKind: Kind_2;
1058
- metadataClass: Class<any>;
1059
- metadataParam: any;
1060
- /**
1061
- * 如果metadataKind是'class',field是undefined
1062
- * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1063
- * TODO: 测试是否支持Symbol类型
1064
- */
1065
- field?: Field_2;
1066
- };
1067
-
1068
- declare type Params_3 = {
1069
- metadataKind: Kind_3;
1070
- metadataClass: Class<any>;
1071
- metadataParam: any;
1072
- /**
1073
- * 如果metadataKind是'class',field是undefined
1074
- * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1075
- * TODO: 测试是否支持Symbol类型
1076
- */
1077
- field?: Field_3;
1078
- };
1074
+ export declare interface PlaceholderDecoratorExp<T extends any> {
1075
+ (userParam?: T): Decorator<DecoratorContext>;
1076
+ /** 占位元数据类,initDecoratorParamModule 据此查找真实元数据类 */
1077
+ $$metadataClass: Class<any>;
1078
+ /** 是否是占位装饰器 */
1079
+ $$isPlaceholderDecoratorExp: boolean;
1080
+ /** 占位元数据类引用,供 bindPlaceholderMetadataClass 建立映射 */
1081
+ $$placeholderMetadataClass: Class<any>;
1082
+ }
1079
1083
 
1080
1084
  /**
1081
1085
  * 动态配置操作类
@@ -1154,6 +1158,15 @@ export declare class Refs extends Metadata_3 {
1154
1158
 
1155
1159
  export declare const refs: () => Decorator_2<ClassFieldDecoratorContext>;
1156
1160
 
1161
+ /**
1162
+ * 全局静态注册函数。编译期由 coco-compiler 注入到每个源文件末尾。
1163
+ * 源码中类、字段、方法、getter 上的装饰器经 AOT 编译后统一转换为对它的调用,
1164
+ * 用于保存原始装饰器参数。
1165
+ * `@metadataFor(X)` 不产生注册参数,只额外生成 bindPlaceholderMetadataClass 调用。
1166
+ * @public
1167
+ */
1168
+ export declare function registerComponent(cls: Class<any>, params: UserDecoratorParams[]): void;
1169
+
1157
1170
  /**
1158
1171
  * @public
1159
1172
  */
@@ -1207,6 +1220,51 @@ export declare abstract class Router {
1207
1220
  export declare class RouterMeta extends Metadata_4 {
1208
1221
  }
1209
1222
 
1223
+ /**
1224
+ * AOT 注册参数解析完成后的运行时装饰器参数。
1225
+ */
1226
+ declare type RuntimeDecoratorParams = {
1227
+ metadataKind: Kind;
1228
+ metadataClass: Class<any>;
1229
+ metadataParam: any;
1230
+ /**
1231
+ * 如果metadataKind是'class',field是undefined
1232
+ * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1233
+ * TODO: 测试是否支持Symbol类型
1234
+ */
1235
+ field?: Field;
1236
+ };
1237
+
1238
+ /**
1239
+ * AOT 注册参数解析完成后的运行时装饰器参数。
1240
+ */
1241
+ declare type RuntimeDecoratorParams_2 = {
1242
+ metadataKind: Kind_2;
1243
+ metadataClass: Class<any>;
1244
+ metadataParam: any;
1245
+ /**
1246
+ * 如果metadataKind是'class',field是undefined
1247
+ * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1248
+ * TODO: 测试是否支持Symbol类型
1249
+ */
1250
+ field?: Field_2;
1251
+ };
1252
+
1253
+ /**
1254
+ * AOT 注册参数解析完成后的运行时装饰器参数。
1255
+ */
1256
+ declare type RuntimeDecoratorParams_3 = {
1257
+ metadataKind: Kind_3;
1258
+ metadataClass: Class<any>;
1259
+ metadataParam: any;
1260
+ /**
1261
+ * 如果metadataKind是'class',field是undefined
1262
+ * 如果metadataKind是'method'\'field',field就是对应的函数名或字段名
1263
+ * TODO: 测试是否支持Symbol类型
1264
+ */
1265
+ field?: Field_3;
1266
+ };
1267
+
1210
1268
  /**
1211
1269
  * @public
1212
1270
  */
@@ -1224,6 +1282,14 @@ export declare class Scope extends Metadata {
1224
1282
 
1225
1283
  export declare const scope: (scope?: SCOPE) => Decorator<ClassDecoratorContext | ClassMethodDecoratorContext>;
1226
1284
 
1285
+ /**
1286
+ * @public
1287
+ */
1288
+ export declare class Service extends Metadata {
1289
+ }
1290
+
1291
+ export declare const service: () => Decorator<ClassDecoratorContext>;
1292
+
1227
1293
  export declare class SessionStorage {
1228
1294
  setItem(key: string, value: string): void;
1229
1295
  getItem(key: string): string;
@@ -1259,7 +1325,7 @@ export declare class Target extends Metadata {
1259
1325
  /**
1260
1326
  * @public
1261
1327
  */
1262
- export declare const target: DecoratorExpWithDecoratorSelf<Type[]>;
1328
+ export declare const target: PlaceholderDecoratorExp<Type[]>;
1263
1329
 
1264
1330
  /**
1265
1331
  * @public
@@ -1267,9 +1333,25 @@ export declare const target: DecoratorExpWithDecoratorSelf<Type[]>;
1267
1333
  export declare enum Type {
1268
1334
  Class = "class",
1269
1335
  Field = "field",
1270
- Method = "method"
1336
+ Method = "method",
1337
+ Getter = "getter"
1271
1338
  }
1272
1339
 
1340
+ /**
1341
+ * AOT 注册阶段的原始装饰器参数(userDecoratorParams)。
1342
+ * 与 RuntimeDecoratorParams 的区别:placeholder 装饰器的 metadataClass 可能是占位元数据类,
1343
+ * 需要 initDecoratorParamModule 替换后才能作为运行时参数(runtimeDecoratorParams)使用。
1344
+ */
1345
+ export declare type UserDecoratorParams = {
1346
+ metadataKind: Kind;
1347
+ /** 普通装饰器为真实元数据类;placeholder 装饰器始终为占位元数据类 */
1348
+ metadataClass: Class<any>;
1349
+ metadataParam: any;
1350
+ field?: Field;
1351
+ /** 是否是占位装饰器,即 createDecoratorExp 未传元数据类时创建的装饰器 */
1352
+ isPlaceholderDecoratorExp: boolean;
1353
+ };
1354
+
1273
1355
  /**
1274
1356
  * @public
1275
1357
  */
@@ -1291,7 +1373,6 @@ export declare const value: (path: string) => Decorator<ClassFieldDecoratorConte
1291
1373
  * @public
1292
1374
  */
1293
1375
  export declare class View extends Metadata_3 {
1294
- static classDecoratorModifyPrototype(prototype: any): void;
1295
1376
  }
1296
1377
 
1297
1378
  export declare const view: () => Decorator_2<ClassDecoratorContext>;