@fastcar/core 0.3.16 → 0.3.18
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/annotation.d.ts +3 -0
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/FastCarApplication.ts +101 -0
- package/src/annotation/Application.ts +4 -1
- package/src/annotation/bind/DemandInjection.ts +33 -8
- package/src/annotation/scan/HotterDemand.ts +10 -0
- package/src/annotation.ts +2 -0
- package/src/constant/FastCarMetaData.ts +1 -0
- package/src/type/FileHotterDesc.ts +1 -0
- package/src/utils/ClassUtils.ts +9 -0
- package/target/FastCarApplication.js +87 -0
- package/target/annotation/Application.js +3 -1
- package/target/annotation/bind/DemandInjection.js +25 -6
- package/target/annotation/scan/HotterDemand.js +12 -0
- package/target/annotation.js +4 -2
- package/target/constant/FastCarMetaData.js +1 -0
- package/target/type/FileHotterDesc.js +1 -0
- package/target/utils/ClassUtils.js +8 -0
- package/test/example/logs/fastcar-server.app.log +5 -0
- package/test/example/logs/fastcar-server.app1.log +1 -0
- package/test/example/logs/fastcar-server.sys.log +13 -12
- package/test/example/logs/fastcar-server.sys1.log +11 -2
- package/test/example/logs/fastcar-server.sys10.log +13 -0
- package/test/example/logs/fastcar-server.sys11.log +11 -0
- package/test/example/logs/fastcar-server.sys12.log +10 -0
- package/test/example/logs/fastcar-server.sys13.log +8 -0
- package/test/example/logs/fastcar-server.sys14.log +11 -0
- package/test/example/logs/fastcar-server.sys2.log +8 -0
- package/test/example/logs/fastcar-server.sys3.log +7 -0
- package/test/example/logs/fastcar-server.sys5.log +11 -0
- package/test/example/logs/fastcar-server.sys6.log +8 -0
- package/test/example/logs/fastcar-server.sys7.log +11 -0
- package/test/example/logs/fastcar-server.sys8.log +10 -0
- package/test/example/logs/fastcar-server.sys9.log +12 -0
- package/test/example/logs/other-server.sys.log +5 -0
- package/test/example/logs/other-server.sys1.log +5 -0
- package/test/example/simple/app.ts +19 -0
- package/test/example/simple/service/DemandService.ts +10 -0
package/annotation.d.ts
CHANGED
|
@@ -75,6 +75,9 @@ export function CallDependency(target: any, propertyKey: string): void;
|
|
|
75
75
|
//按需注入加载
|
|
76
76
|
export function DemandInjection(target: any): any;
|
|
77
77
|
|
|
78
|
+
//启用按需加载热更
|
|
79
|
+
export function HotterDemand(fp: string): Ret;
|
|
80
|
+
|
|
78
81
|
//异常方法类
|
|
79
82
|
export function ExceptionMonitor(target: any): void;
|
|
80
83
|
|
package/index.d.ts
CHANGED
|
@@ -252,6 +252,12 @@ export class FastCarApplication extends Events {
|
|
|
252
252
|
*
|
|
253
253
|
*/
|
|
254
254
|
getMemoryUsage(): ProcessType;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
*
|
|
258
|
+
* @version 0.3.17 删除按需加载实例
|
|
259
|
+
*/
|
|
260
|
+
deleteDemandInstance(instance: ClassConstructor<Object> | Object): void;
|
|
255
261
|
}
|
|
256
262
|
|
|
257
263
|
//校验错误
|
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ import { WinstonLoggerType } from "./type/WinstonLoggerType";
|
|
|
28
28
|
import { ClassConstructor } from "./type/ClassConstructor";
|
|
29
29
|
import ReflectUtil from "./utils/ReflectUtil";
|
|
30
30
|
import Log from "./annotation/stereotype/Log";
|
|
31
|
+
import DataMap from "./model/DataMap";
|
|
31
32
|
|
|
32
33
|
@Component
|
|
33
34
|
class FastCarApplication extends Events {
|
|
@@ -51,6 +52,9 @@ class FastCarApplication extends Events {
|
|
|
51
52
|
protected componentAliasMap: Map<string | symbol, string | symbol>;
|
|
52
53
|
protected hotConfigure: Map<string, string[]>;
|
|
53
54
|
|
|
55
|
+
protected demandInstanceMap: DataMap<string, DataMap<string, Set<ClassConstructor<Object> | Object>>>;
|
|
56
|
+
protected demandTargetMap: DataMap<string, DataMap<string, ClassConstructor<Object>>>;
|
|
57
|
+
|
|
54
58
|
constructor() {
|
|
55
59
|
super();
|
|
56
60
|
|
|
@@ -65,7 +69,9 @@ class FastCarApplication extends Events {
|
|
|
65
69
|
this.componentAliasMap = new Map();
|
|
66
70
|
this.hotConfigure = new Map();
|
|
67
71
|
|
|
72
|
+
this.demandInstanceMap = new DataMap();
|
|
68
73
|
this.sysLogger = console;
|
|
74
|
+
this.demandTargetMap = new DataMap();
|
|
69
75
|
|
|
70
76
|
this.loadSelf();
|
|
71
77
|
this.addHot();
|
|
@@ -115,6 +121,14 @@ class FastCarApplication extends Events {
|
|
|
115
121
|
this.on(HotReloadEnum.configReload, (fp: string) => {
|
|
116
122
|
this.addDelayHot(fp, HotReloadEnum.configReload);
|
|
117
123
|
});
|
|
124
|
+
|
|
125
|
+
this.on(HotReloadEnum.demandload, (fp: string) => {
|
|
126
|
+
if (this.applicationStatus != AppStatusEnum.RUN) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.addDelayHot(fp, HotReloadEnum.demandload);
|
|
131
|
+
});
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
addDelayHot(fp: string, loadType: HotReloadEnum) {
|
|
@@ -161,6 +175,36 @@ class FastCarApplication extends Events {
|
|
|
161
175
|
}
|
|
162
176
|
break;
|
|
163
177
|
}
|
|
178
|
+
case HotReloadEnum.demandload: {
|
|
179
|
+
let moduleClass = ClassLoader.loadModule(fp, true);
|
|
180
|
+
if (moduleClass != null) {
|
|
181
|
+
moduleClass.forEach((classZ) => {
|
|
182
|
+
let m = this.demandInstanceMap.get(fp);
|
|
183
|
+
if (m) {
|
|
184
|
+
let key = classZ.name;
|
|
185
|
+
if (key) {
|
|
186
|
+
this?.addDemandTargetMap({
|
|
187
|
+
fp,
|
|
188
|
+
targetName: key,
|
|
189
|
+
Target: classZ,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
let instances = m.get(key);
|
|
193
|
+
if (instances) {
|
|
194
|
+
instances.forEach((beforeInstance) => {
|
|
195
|
+
MixTool.assign(beforeInstance, classZ);
|
|
196
|
+
let cb = Reflect.getMetadata(FastCarMetaData.HotterCallback, classZ.prototype);
|
|
197
|
+
if (cb && Reflect.has(beforeInstance, cb)) {
|
|
198
|
+
Reflect.apply(Reflect.get(beforeInstance, cb), beforeInstance, []);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
164
208
|
default: {
|
|
165
209
|
this.sysLogger.warn(`not found ${loadType} by ${fp}`);
|
|
166
210
|
break;
|
|
@@ -923,6 +967,63 @@ class FastCarApplication extends Events {
|
|
|
923
967
|
|
|
924
968
|
return logger;
|
|
925
969
|
}
|
|
970
|
+
|
|
971
|
+
addClassHot(fp: string, instance: ClassConstructor<Object> | Object, key: string) {
|
|
972
|
+
ClassLoader.watchServices(fp, this, HotReloadEnum.demandload);
|
|
973
|
+
|
|
974
|
+
let m = this.demandInstanceMap.get(fp);
|
|
975
|
+
if (!m) {
|
|
976
|
+
m = new DataMap();
|
|
977
|
+
this.demandInstanceMap.set(fp, m);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
let methods = m.get(key);
|
|
981
|
+
if (!methods) {
|
|
982
|
+
methods = new Set();
|
|
983
|
+
m.set(key, methods);
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
methods.add(instance);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
deleteDemandInstance(instance: ClassConstructor<Object> | Object) {
|
|
990
|
+
let fp = Reflect.getMetadata(FastCarMetaData.HotterFilePath, instance);
|
|
991
|
+
if (fp) {
|
|
992
|
+
let m = this.demandInstanceMap.get(fp);
|
|
993
|
+
if (m) {
|
|
994
|
+
let key = instance.constructor.name;
|
|
995
|
+
if (key) {
|
|
996
|
+
let instances = m.get(key);
|
|
997
|
+
if (instances && instances?.size > 0) {
|
|
998
|
+
instances.delete(instance);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
if (instances?.size == 0) {
|
|
1002
|
+
m.delete(key);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
if (m.size == 0) {
|
|
1006
|
+
this.demandInstanceMap.delete(fp);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
private addDemandTargetMap({ fp, targetName, Target }: { fp: string; targetName: string; Target: ClassConstructor<any> }) {
|
|
1014
|
+
let sets = this.demandTargetMap.get(fp);
|
|
1015
|
+
if (!sets) {
|
|
1016
|
+
sets = new DataMap();
|
|
1017
|
+
this.demandTargetMap.set(fp, sets);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
sets.set(targetName, Target);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
getDemandTarget(fp: string, targetName: string) {
|
|
1024
|
+
let sets = this.demandTargetMap.get(fp);
|
|
1025
|
+
return sets?.get(targetName);
|
|
1026
|
+
}
|
|
926
1027
|
}
|
|
927
1028
|
|
|
928
1029
|
export default FastCarApplication;
|
|
@@ -4,7 +4,7 @@ import TypeUtil from "../utils/TypeUtil";
|
|
|
4
4
|
|
|
5
5
|
//基础服务的应用
|
|
6
6
|
export default function Application(target: any) {
|
|
7
|
-
|
|
7
|
+
const proxy = new Proxy(target, {
|
|
8
8
|
construct: (target: ClassConstructor<Object>, args: any, newTarget?: any) => {
|
|
9
9
|
const FastCarApplication = require("../FastCarApplication").default;
|
|
10
10
|
|
|
@@ -46,4 +46,7 @@ export default function Application(target: any) {
|
|
|
46
46
|
return appProxy;
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
ClassUtils.cloneMetadata(target, proxy);
|
|
51
|
+
return proxy;
|
|
49
52
|
}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
//延迟注入作用用于类上,用于没有初始时的依赖注入
|
|
2
1
|
import { CommonConstant } from "../../constant/CommonConstant";
|
|
2
|
+
import { FastCarMetaData } from "../../constant/FastCarMetaData";
|
|
3
|
+
import FastCarApplication from "../../FastCarApplication";
|
|
3
4
|
import { ClassConstructor } from "../../type/ClassConstructor";
|
|
5
|
+
import ClassUtils from "../../utils/ClassUtils";
|
|
4
6
|
|
|
5
7
|
export default function DemandInjection(Target: ClassConstructor<any>) {
|
|
6
|
-
|
|
7
|
-
construct: (Target: ClassConstructor<any>, args: any, newTarget
|
|
8
|
-
let
|
|
9
|
-
let
|
|
8
|
+
const proxy = new Proxy(Target, {
|
|
9
|
+
construct: (Target: ClassConstructor<any>, args: any, newTarget: any) => {
|
|
10
|
+
let hotter = Reflect.getMetadata(FastCarMetaData.HotterFilePath, Target.prototype);
|
|
11
|
+
let fp = Reflect.getMetadata(FastCarMetaData.HotterFilePath, Target.prototype);
|
|
12
|
+
let app: FastCarApplication = Reflect.get(global, CommonConstant.FastcarApp);
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
if (hotter) {
|
|
15
|
+
if (fp) {
|
|
16
|
+
let currTarget = app.getDemandTarget(fp, Target.name);
|
|
17
|
+
if (currTarget) {
|
|
18
|
+
newTarget = currTarget;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let instance = Reflect.construct(Target, args, newTarget);
|
|
24
|
+
|
|
25
|
+
// 依赖注入
|
|
26
|
+
app?.loadInjectionService(instance);
|
|
27
|
+
app?.loadLoggerIOC(instance);
|
|
28
|
+
|
|
29
|
+
if (hotter) {
|
|
30
|
+
if (fp) {
|
|
31
|
+
app?.addClassHot(fp, instance, Target.name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return instance;
|
|
14
36
|
},
|
|
15
37
|
});
|
|
38
|
+
|
|
39
|
+
ClassUtils.cloneMetadata(Target, proxy);
|
|
40
|
+
return proxy;
|
|
16
41
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import Hotter from "./Hotter";
|
|
3
|
+
import { FastCarMetaData } from "../../constant/FastCarMetaData";
|
|
4
|
+
|
|
5
|
+
export default function HotterDemand(fp: string) {
|
|
6
|
+
return function (target: any) {
|
|
7
|
+
Hotter(target);
|
|
8
|
+
Reflect.defineMetadata(FastCarMetaData.HotterFilePath, fp, target.prototype);
|
|
9
|
+
};
|
|
10
|
+
}
|
package/src/annotation.ts
CHANGED
|
@@ -55,6 +55,7 @@ import Value from "./annotation/bind/Value";
|
|
|
55
55
|
import AppEnv from "./annotation/bind/AppEnv";
|
|
56
56
|
import HotterCallBack from "./annotation/scan/HotterCallBack";
|
|
57
57
|
import IsSerial from "./annotation/data/IsSerial";
|
|
58
|
+
import HotterDemand from "./annotation/scan/HotterDemand";
|
|
58
59
|
|
|
59
60
|
//注解暴露出去
|
|
60
61
|
export {
|
|
@@ -100,6 +101,7 @@ export {
|
|
|
100
101
|
CustomType,
|
|
101
102
|
Value,
|
|
102
103
|
AppEnv,
|
|
104
|
+
HotterDemand,
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export {
|
|
@@ -19,6 +19,7 @@ export enum FastCarMetaData {
|
|
|
19
19
|
ValidCustom = "valid:custom", //自定义校验方式
|
|
20
20
|
Hotter = "hotter", //是否支持热更
|
|
21
21
|
HotterCallback = "HotterCallback", //热更回调
|
|
22
|
+
HotterFilePath = "HotterFilePath", //热更的路径 按需加载时的需要
|
|
22
23
|
InjectionUniqueKey = "injection_uniqueKey",
|
|
23
24
|
Alias = "alias", //别名
|
|
24
25
|
LoggerModule = "LoggerModule", //日志模块集合
|
package/src/utils/ClassUtils.ts
CHANGED
|
@@ -35,4 +35,13 @@ export default class ClassUtils {
|
|
|
35
35
|
|
|
36
36
|
return ClassUtils.getProtoDesc(parentObj, key);
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
//拷贝元数据
|
|
40
|
+
static cloneMetadata(src: any, dst: any): void {
|
|
41
|
+
const keys: any[] = Reflect.getMetadataKeys(src);
|
|
42
|
+
for (const k of keys) {
|
|
43
|
+
const val = Reflect.getMetadata(k, src);
|
|
44
|
+
Reflect.defineMetadata(k, val, dst);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
38
47
|
}
|
|
@@ -32,6 +32,7 @@ const DateUtil_1 = require("./utils/DateUtil");
|
|
|
32
32
|
const FileHotterDesc_1 = require("./type/FileHotterDesc");
|
|
33
33
|
const ReflectUtil_1 = require("./utils/ReflectUtil");
|
|
34
34
|
const Log_1 = require("./annotation/stereotype/Log");
|
|
35
|
+
const DataMap_1 = require("./model/DataMap");
|
|
35
36
|
let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends Events {
|
|
36
37
|
componentMap; //组件键值对
|
|
37
38
|
sysConfig; //系统配置
|
|
@@ -49,6 +50,8 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
49
50
|
basename = CommonConstant_1.CommonConstant.Application;
|
|
50
51
|
componentAliasMap;
|
|
51
52
|
hotConfigure;
|
|
53
|
+
demandInstanceMap;
|
|
54
|
+
demandTargetMap;
|
|
52
55
|
constructor() {
|
|
53
56
|
super();
|
|
54
57
|
this.sysConfig = SysConfig_1.SYSDefaultConfig;
|
|
@@ -61,7 +64,9 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
61
64
|
this.reloadTimerId = null;
|
|
62
65
|
this.componentAliasMap = new Map();
|
|
63
66
|
this.hotConfigure = new Map();
|
|
67
|
+
this.demandInstanceMap = new DataMap_1.default();
|
|
64
68
|
this.sysLogger = console;
|
|
69
|
+
this.demandTargetMap = new DataMap_1.default();
|
|
65
70
|
this.loadSelf();
|
|
66
71
|
this.addHot();
|
|
67
72
|
}
|
|
@@ -104,6 +109,12 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
104
109
|
this.on(FileHotterDesc_1.HotReloadEnum.configReload, (fp) => {
|
|
105
110
|
this.addDelayHot(fp, FileHotterDesc_1.HotReloadEnum.configReload);
|
|
106
111
|
});
|
|
112
|
+
this.on(FileHotterDesc_1.HotReloadEnum.demandload, (fp) => {
|
|
113
|
+
if (this.applicationStatus != AppStatusEnum_1.AppStatusEnum.RUN) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.addDelayHot(fp, FileHotterDesc_1.HotReloadEnum.demandload);
|
|
117
|
+
});
|
|
107
118
|
}
|
|
108
119
|
addDelayHot(fp, loadType) {
|
|
109
120
|
if (this.delayHotIds.has(fp)) {
|
|
@@ -148,6 +159,35 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
148
159
|
}
|
|
149
160
|
break;
|
|
150
161
|
}
|
|
162
|
+
case FileHotterDesc_1.HotReloadEnum.demandload: {
|
|
163
|
+
let moduleClass = ClassLoader_1.default.loadModule(fp, true);
|
|
164
|
+
if (moduleClass != null) {
|
|
165
|
+
moduleClass.forEach((classZ) => {
|
|
166
|
+
let m = this.demandInstanceMap.get(fp);
|
|
167
|
+
if (m) {
|
|
168
|
+
let key = classZ.name;
|
|
169
|
+
if (key) {
|
|
170
|
+
this?.addDemandTargetMap({
|
|
171
|
+
fp,
|
|
172
|
+
targetName: key,
|
|
173
|
+
Target: classZ,
|
|
174
|
+
});
|
|
175
|
+
let instances = m.get(key);
|
|
176
|
+
if (instances) {
|
|
177
|
+
instances.forEach((beforeInstance) => {
|
|
178
|
+
Mix_1.default.assign(beforeInstance, classZ);
|
|
179
|
+
let cb = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.HotterCallback, classZ.prototype);
|
|
180
|
+
if (cb && Reflect.has(beforeInstance, cb)) {
|
|
181
|
+
Reflect.apply(Reflect.get(beforeInstance, cb), beforeInstance, []);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
151
191
|
default: {
|
|
152
192
|
this.sysLogger.warn(`not found ${loadType} by ${fp}`);
|
|
153
193
|
break;
|
|
@@ -797,6 +837,53 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
797
837
|
}
|
|
798
838
|
return logger;
|
|
799
839
|
}
|
|
840
|
+
addClassHot(fp, instance, key) {
|
|
841
|
+
ClassLoader_1.default.watchServices(fp, this, FileHotterDesc_1.HotReloadEnum.demandload);
|
|
842
|
+
let m = this.demandInstanceMap.get(fp);
|
|
843
|
+
if (!m) {
|
|
844
|
+
m = new DataMap_1.default();
|
|
845
|
+
this.demandInstanceMap.set(fp, m);
|
|
846
|
+
}
|
|
847
|
+
let methods = m.get(key);
|
|
848
|
+
if (!methods) {
|
|
849
|
+
methods = new Set();
|
|
850
|
+
m.set(key, methods);
|
|
851
|
+
}
|
|
852
|
+
methods.add(instance);
|
|
853
|
+
}
|
|
854
|
+
deleteDemandInstance(instance) {
|
|
855
|
+
let fp = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.HotterFilePath, instance);
|
|
856
|
+
if (fp) {
|
|
857
|
+
let m = this.demandInstanceMap.get(fp);
|
|
858
|
+
if (m) {
|
|
859
|
+
let key = instance.constructor.name;
|
|
860
|
+
if (key) {
|
|
861
|
+
let instances = m.get(key);
|
|
862
|
+
if (instances && instances?.size > 0) {
|
|
863
|
+
instances.delete(instance);
|
|
864
|
+
}
|
|
865
|
+
if (instances?.size == 0) {
|
|
866
|
+
m.delete(key);
|
|
867
|
+
}
|
|
868
|
+
if (m.size == 0) {
|
|
869
|
+
this.demandInstanceMap.delete(fp);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
addDemandTargetMap({ fp, targetName, Target }) {
|
|
876
|
+
let sets = this.demandTargetMap.get(fp);
|
|
877
|
+
if (!sets) {
|
|
878
|
+
sets = new DataMap_1.default();
|
|
879
|
+
this.demandTargetMap.set(fp, sets);
|
|
880
|
+
}
|
|
881
|
+
sets.set(targetName, Target);
|
|
882
|
+
}
|
|
883
|
+
getDemandTarget(fp, targetName) {
|
|
884
|
+
let sets = this.demandTargetMap.get(fp);
|
|
885
|
+
return sets?.get(targetName);
|
|
886
|
+
}
|
|
800
887
|
};
|
|
801
888
|
__decorate([
|
|
802
889
|
(0, Log_1.default)("sys"),
|
|
@@ -5,7 +5,7 @@ const ClassUtils_1 = require("../utils/ClassUtils");
|
|
|
5
5
|
const TypeUtil_1 = require("../utils/TypeUtil");
|
|
6
6
|
//基础服务的应用
|
|
7
7
|
function Application(target) {
|
|
8
|
-
|
|
8
|
+
const proxy = new Proxy(target, {
|
|
9
9
|
construct: (target, args, newTarget) => {
|
|
10
10
|
const FastCarApplication = require("../FastCarApplication").default;
|
|
11
11
|
let app = new FastCarApplication();
|
|
@@ -43,4 +43,6 @@ function Application(target) {
|
|
|
43
43
|
return appProxy;
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
|
+
ClassUtils_1.default.cloneMetadata(target, proxy);
|
|
47
|
+
return proxy;
|
|
46
48
|
}
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = DemandInjection;
|
|
4
|
-
//延迟注入作用用于类上,用于没有初始时的依赖注入
|
|
5
4
|
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
5
|
+
const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
|
|
6
|
+
const ClassUtils_1 = require("../../utils/ClassUtils");
|
|
6
7
|
function DemandInjection(Target) {
|
|
7
|
-
|
|
8
|
+
const proxy = new Proxy(Target, {
|
|
8
9
|
construct: (Target, args, newTarget) => {
|
|
9
|
-
let
|
|
10
|
+
let hotter = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.HotterFilePath, Target.prototype);
|
|
11
|
+
let fp = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.HotterFilePath, Target.prototype);
|
|
10
12
|
let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
if (hotter) {
|
|
14
|
+
if (fp) {
|
|
15
|
+
let currTarget = app.getDemandTarget(fp, Target.name);
|
|
16
|
+
if (currTarget) {
|
|
17
|
+
newTarget = currTarget;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let instance = Reflect.construct(Target, args, newTarget);
|
|
22
|
+
// 依赖注入
|
|
23
|
+
app?.loadInjectionService(instance);
|
|
24
|
+
app?.loadLoggerIOC(instance);
|
|
25
|
+
if (hotter) {
|
|
26
|
+
if (fp) {
|
|
27
|
+
app?.addClassHot(fp, instance, Target.name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return instance;
|
|
14
31
|
},
|
|
15
32
|
});
|
|
33
|
+
ClassUtils_1.default.cloneMetadata(Target, proxy);
|
|
34
|
+
return proxy;
|
|
16
35
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = HotterDemand;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const Hotter_1 = require("./Hotter");
|
|
6
|
+
const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
|
|
7
|
+
function HotterDemand(fp) {
|
|
8
|
+
return function (target) {
|
|
9
|
+
(0, Hotter_1.default)(target);
|
|
10
|
+
Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.HotterFilePath, fp, target.prototype);
|
|
11
|
+
};
|
|
12
|
+
}
|
package/target/annotation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.ApplicationSetting = exports.BaseName = exports.BasePath = exports.BaseFilePath = exports.ENV = exports.IsSerial = exports.Transactional = void 0;
|
|
3
|
+
exports.Entity = exports.Table = exports.PrimaryKey = exports.Field = exports.DBType = exports.DSIndex = exports.DS = exports.HotterDemand = exports.AppEnv = exports.Value = exports.CustomType = exports.ResourcePath = exports.Rule = exports.ValidForm = exports.ValidCustom = exports.Type = exports.Size = exports.NotNull = exports.DefaultVal = exports.AddChildValid = exports.AddRequireModule = exports.Log = exports.Readonly = exports.Override = exports.NotImplemented = exports.Deprecate = exports.ExceptionMonitor = exports.AliasInjection = exports.DemandInjection = exports.CallDependency = exports.Autowired = exports.Application = exports.Injection = exports.Repository = exports.Service = exports.Controller = exports.Configure = exports.BeanName = exports.HotterCallBack = exports.Hotter = exports.ComponentScanMust = exports.ComponentInjection = exports.Component = exports.ComponentScanExclusion = exports.ComponentScan = exports.ApplicationDestory = exports.ApplicationInit = exports.ApplicationRunner = exports.ApplicationStop = exports.ApplicationStart = void 0;
|
|
4
|
+
exports.ApplicationSetting = exports.BaseName = exports.BasePath = exports.BaseFilePath = exports.ENV = exports.IsSerial = exports.Transactional = exports.SqlSession = void 0;
|
|
5
5
|
const Application_1 = require("./annotation/Application");
|
|
6
6
|
exports.Application = Application_1.default;
|
|
7
7
|
const Autowired_1 = require("./annotation/bind/Autowired");
|
|
@@ -116,3 +116,5 @@ const HotterCallBack_1 = require("./annotation/scan/HotterCallBack");
|
|
|
116
116
|
exports.HotterCallBack = HotterCallBack_1.default;
|
|
117
117
|
const IsSerial_1 = require("./annotation/data/IsSerial");
|
|
118
118
|
exports.IsSerial = IsSerial_1.default;
|
|
119
|
+
const HotterDemand_1 = require("./annotation/scan/HotterDemand");
|
|
120
|
+
exports.HotterDemand = HotterDemand_1.default;
|
|
@@ -23,6 +23,7 @@ var FastCarMetaData;
|
|
|
23
23
|
FastCarMetaData["ValidCustom"] = "valid:custom";
|
|
24
24
|
FastCarMetaData["Hotter"] = "hotter";
|
|
25
25
|
FastCarMetaData["HotterCallback"] = "HotterCallback";
|
|
26
|
+
FastCarMetaData["HotterFilePath"] = "HotterFilePath";
|
|
26
27
|
FastCarMetaData["InjectionUniqueKey"] = "injection_uniqueKey";
|
|
27
28
|
FastCarMetaData["Alias"] = "alias";
|
|
28
29
|
FastCarMetaData["LoggerModule"] = "LoggerModule";
|
|
@@ -31,5 +31,13 @@ class ClassUtils {
|
|
|
31
31
|
}
|
|
32
32
|
return ClassUtils.getProtoDesc(parentObj, key);
|
|
33
33
|
}
|
|
34
|
+
//拷贝元数据
|
|
35
|
+
static cloneMetadata(src, dst) {
|
|
36
|
+
const keys = Reflect.getMetadataKeys(src);
|
|
37
|
+
for (const k of keys) {
|
|
38
|
+
const val = Reflect.getMetadata(k, src);
|
|
39
|
+
Reflect.defineMetadata(k, val, dst);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
exports.default = ClassUtils;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"timestamp":"2025-12-23 21:38:19.671","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/True%20Detective/S03/True%20Detective_S03E05_If%20You%20Have%20Ghosts.mp4?token=9cef7079a9847afbe41a4d9281c92791×tamp=1766496611486"}
|
|
2
|
+
{"timestamp":"2025-12-23 21:42:50.675","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/Dear___/S02/Dear____S02E02_Sandra%20Oh.mp4?token=648a04ca079cd4e0426de05161610d25×tamp=1766497261996"}
|
|
3
|
+
{"timestamp":"2025-12-23 22:23:29.39","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/Dear___/S02/Dear____S02E02_Sandra%20Oh.mp4?token=648a04ca079cd4e0426de05161610d25×tamp=1766497261996"}
|
|
4
|
+
{"timestamp":"2025-12-23 22:25:21.971","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/Dear___/S02/Dear____S02E02_Sandra%20Oh.mp4?token=648a04ca079cd4e0426de05161610d25×tamp=1766497261996"}
|
|
5
|
+
{"timestamp":"2025-12-23 22:27:55.462","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/Dear___/S02/Dear____S02E02_Sandra%20Oh.mp4?token=648a04ca079cd4e0426de05161610d25×tamp=1766497261996"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"timestamp":"2025-12-23 22:29:00.684","level":"INFO","label":"fastcar-server.app","message":"https://echovids.amusemax.cc/iptv/movies/Dear___/S02/Dear____S02E02_Sandra%20Oh.mp4?token=648a04ca079cd4e0426de05161610d25×tamp=1766497261996"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
{"timestamp":"
|
|
2
|
-
{"timestamp":"
|
|
3
|
-
{"timestamp":"
|
|
4
|
-
{"timestamp":"
|
|
5
|
-
{"timestamp":"
|
|
6
|
-
{"timestamp":"
|
|
7
|
-
{"timestamp":"
|
|
8
|
-
{"timestamp":"
|
|
9
|
-
{"timestamp":"
|
|
10
|
-
{"timestamp":"
|
|
11
|
-
{"timestamp":"
|
|
12
|
-
{"timestamp":"
|
|
1
|
+
{"timestamp":"2026-03-03 11:57:36.198","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-03 11:57:36.415","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-03 11:57:36.416","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-03 11:57:36.418","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-03 11:57:36.419","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-03 12:01:10.814","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2026-03-03 12:17:38.378","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
8
|
+
{"timestamp":"2026-03-03 12:17:39.149","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
9
|
+
{"timestamp":"2026-03-03 12:17:39.155","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
10
|
+
{"timestamp":"2026-03-03 12:17:39.158","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
11
|
+
{"timestamp":"2026-03-03 12:17:39.159","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
12
|
+
{"timestamp":"2026-03-03 12:17:43.980","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
13
|
+
{"timestamp":"2026-03-03 12:18:11.194","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
{"timestamp":"
|
|
2
|
-
{"timestamp":"
|
|
1
|
+
{"timestamp":"2026-03-03 12:18:44.475","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
2
|
+
{"timestamp":"2026-03-03 12:19:41.164","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
3
|
+
{"timestamp":"2026-03-03 12:19:41.583","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
4
|
+
{"timestamp":"2026-03-03 12:19:41.585","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
5
|
+
{"timestamp":"2026-03-03 12:19:41.588","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
6
|
+
{"timestamp":"2026-03-03 12:19:41.588","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
7
|
+
{"timestamp":"2026-03-03 14:18:30.855","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
8
|
+
{"timestamp":"2026-03-03 14:18:31.432","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
9
|
+
{"timestamp":"2026-03-03 14:18:31.437","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
10
|
+
{"timestamp":"2026-03-03 14:18:31.440","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
11
|
+
{"timestamp":"2026-03-03 14:18:31.441","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 21:21:28.981","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 21:21:29.391","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 21:21:29.394","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 21:21:29.397","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 21:21:29.398","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-22 10:39:59.247","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2025-12-22 10:39:59.456","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2025-12-22 10:39:59.458","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2025-12-22 10:39:59.459","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2025-12-22 10:39:59.460","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
11
|
+
{"timestamp":"2025-12-22 10:40:06.361","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
12
|
+
{"timestamp":"2025-12-22 10:40:16.525","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
13
|
+
{"timestamp":"2025-12-22 10:40:22.659","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{"timestamp":"2025-12-22 10:51:51.390","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-22 10:51:51.705","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-22 10:51:51.707","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-22 10:51:51.709","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-22 10:51:51.710","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-22 13:36:16.367","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
7
|
+
{"timestamp":"2025-12-23 22:27:54.724","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
8
|
+
{"timestamp":"2025-12-23 22:27:55.460","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
9
|
+
{"timestamp":"2025-12-23 22:27:55.464","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
10
|
+
{"timestamp":"2025-12-23 22:27:55.467","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
11
|
+
{"timestamp":"2025-12-23 22:27:55.469","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{"timestamp":"2026-03-02 16:36:06.549","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-02 16:36:06.899","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-02 16:36:06.902","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-02 16:36:06.905","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-02 16:36:06.905","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-02 17:10:32.620","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2026-03-02 17:10:32.971","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2026-03-02 17:10:32.973","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2026-03-02 17:10:32.976","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2026-03-02 17:10:32.977","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"timestamp":"2026-03-02 17:20:36.559","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-02 17:20:36.958","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-02 17:20:36.962","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-02 17:20:36.965","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-02 17:20:36.965","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-02 17:20:41.855","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
7
|
+
{"timestamp":"2026-03-02 18:04:19.373","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
8
|
+
{"timestamp":"2026-03-02 18:05:57.80","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{"timestamp":"2026-03-02 18:34:45.959","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-02 18:34:46.447","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-02 18:34:46.451","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-02 18:34:46.456","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-02 18:34:46.457","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-03 11:38:40.878","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2026-03-03 11:38:41.375","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2026-03-03 11:38:41.378","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2026-03-03 11:38:41.382","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2026-03-03 11:38:41.383","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
11
|
+
{"timestamp":"2026-03-03 11:38:58.258","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"timestamp":"2026-03-03 14:46:22.373","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-03 14:46:22.700","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-03 14:46:22.702","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-03 14:46:22.705","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-03 14:46:22.705","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-03 14:46:28.605","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
7
|
+
{"timestamp":"2026-03-03 14:46:38.710","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
8
|
+
{"timestamp":"2026-03-03 14:47:05.984","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{"timestamp":"2026-03-04 11:48:57.992","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2026-03-04 11:48:58.377","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2026-03-04 11:48:58.379","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2026-03-04 11:48:58.382","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2026-03-04 11:48:58.383","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2026-03-04 11:49:14.367","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
7
|
+
{"timestamp":"2026-03-04 11:49:25.481","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 20:52:16.382","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 20:52:16.677","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 20:52:16.679","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 20:52:16.681","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 20:52:16.682","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-19 20:52:57.780","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2025-12-19 20:53:03.147","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2025-12-19 20:53:03.151","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2025-12-19 20:53:03.154","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2025-12-19 20:53:03.155","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
11
|
+
{"timestamp":"2025-12-19 20:53:09.189","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\TestValue.ts"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 20:57:10.393","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 20:57:16.223","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 20:57:16.226","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 20:57:16.228","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 20:57:16.229","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-19 20:57:35.203","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\TestValue.ts"}
|
|
7
|
+
{"timestamp":"2025-12-19 20:58:00.455","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\TestValue.ts"}
|
|
8
|
+
{"timestamp":"2025-12-19 20:58:33.286","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\TestValue.ts"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 21:07:20.424","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 21:07:20.799","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 21:07:20.801","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 21:07:20.804","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 21:07:20.804","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-19 21:07:35.194","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2025-12-19 21:07:35.517","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2025-12-19 21:07:35.519","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2025-12-19 21:07:35.522","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2025-12-19 21:07:35.523","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
11
|
+
{"timestamp":"2025-12-19 21:07:45.358","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\TestValue.ts"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 21:16:15.816","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 21:16:16.153","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 21:16:16.156","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 21:16:16.159","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 21:16:16.160","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-19 21:16:25.652","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
7
|
+
{"timestamp":"2025-12-19 21:16:25.982","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
8
|
+
{"timestamp":"2025-12-19 21:16:25.984","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
9
|
+
{"timestamp":"2025-12-19 21:16:25.987","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
10
|
+
{"timestamp":"2025-12-19 21:16:25.987","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 21:16:43.564","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 21:16:43.879","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 21:16:43.884","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 21:16:43.889","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 21:16:43.891","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
6
|
+
{"timestamp":"2025-12-19 21:16:49.701","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
7
|
+
{"timestamp":"2025-12-19 21:16:53.792","level":"INFO","label":"fastcar-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\simple\\service\\DemandService.ts"}
|
|
8
|
+
{"timestamp":"2025-12-19 21:20:57.674","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
9
|
+
{"timestamp":"2025-12-19 21:20:58.151","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
10
|
+
{"timestamp":"2025-12-19 21:20:58.154","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
11
|
+
{"timestamp":"2025-12-19 21:20:58.158","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
12
|
+
{"timestamp":"2025-12-19 21:20:58.159","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
@@ -4,3 +4,8 @@
|
|
|
4
4
|
{"timestamp":"2025-11-14 18:38:45.780","level":"INFO","label":"other-server.sys","message":"start server app is run"}
|
|
5
5
|
{"timestamp":"2025-11-14 18:38:45.781","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
|
|
6
6
|
{"timestamp":"2025-11-14 18:38:51.375","level":"INFO","label":"other-server.sys","message":"hot update----D:\\code\\fast-car\\fastcar-core\\test\\example\\resource\\hello.yml"}
|
|
7
|
+
{"timestamp":"2025-12-19 17:39:27.744","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
|
|
8
|
+
{"timestamp":"2025-12-19 17:39:28.279","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
|
|
9
|
+
{"timestamp":"2025-12-19 17:39:28.280","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
|
|
10
|
+
{"timestamp":"2025-12-19 17:39:28.282","level":"INFO","label":"other-server.sys","message":"start server app is run"}
|
|
11
|
+
{"timestamp":"2025-12-19 17:39:28.282","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"timestamp":"2025-12-19 17:39:42.932","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2025-12-19 17:39:43.725","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2025-12-19 17:39:43.728","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2025-12-19 17:39:43.731","level":"INFO","label":"other-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2025-12-19 17:39:43.732","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
|
|
@@ -54,6 +54,7 @@ import NotFoundController from "./controller/NotFoundController";
|
|
|
54
54
|
import HotConfig from "./config/HotConfig";
|
|
55
55
|
import HelloConfig from "./config/HelloConfig";
|
|
56
56
|
import TestValue from "./service/TestValue";
|
|
57
|
+
import DemandService from "./service/DemandService";
|
|
57
58
|
|
|
58
59
|
describe("程序应用测试", () => {
|
|
59
60
|
it("获取配置", () => {
|
|
@@ -118,4 +119,22 @@ describe("程序应用测试", () => {
|
|
|
118
119
|
console.log(testValue.env);
|
|
119
120
|
console.log(testValue.hello_c);
|
|
120
121
|
});
|
|
122
|
+
|
|
123
|
+
it("按需服务测试", () => {
|
|
124
|
+
let testValue = new DemandService();
|
|
125
|
+
// let testValue2 = new DemandService();
|
|
126
|
+
setInterval(() => {
|
|
127
|
+
console.log(testValue.sayHello());
|
|
128
|
+
// console.log(testValue2.sayHello());
|
|
129
|
+
}, 1000);
|
|
130
|
+
|
|
131
|
+
setInterval(() => {
|
|
132
|
+
let testValue2 = new DemandService();
|
|
133
|
+
console.log("v2---", testValue2.sayHello());
|
|
134
|
+
}, 10000);
|
|
135
|
+
|
|
136
|
+
// setTimeout(() => {
|
|
137
|
+
// appInsatcne.app.deleteDemandInstance(testValue);
|
|
138
|
+
// }, 3000);
|
|
139
|
+
});
|
|
121
140
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import DemandInjection from "../../../../src/annotation/bind/DemandInjection";
|
|
2
|
+
import HotterDemand from "../../../../src/annotation/scan/HotterDemand";
|
|
3
|
+
|
|
4
|
+
@HotterDemand(__filename)
|
|
5
|
+
@DemandInjection
|
|
6
|
+
export default class DemandService {
|
|
7
|
+
sayHello() {
|
|
8
|
+
return "hello";
|
|
9
|
+
}
|
|
10
|
+
}
|