@fastcar/core 0.2.60 → 0.2.61
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/package.json +2 -4
- package/src/model/WinstonLogger.ts +4 -3
- package/src/utils/ClassLoader.ts +1 -1
- package/src/utils/ValidationUtil.ts +10 -1
- package/target/FastCarApplication.js +692 -692
- package/target/annotation/Application.js +45 -45
- package/target/annotation/ExceptionMonitor.js +16 -16
- package/target/annotation/bind/AddRequireModule.js +21 -21
- package/target/annotation/bind/AliasInjection.js +23 -23
- package/target/annotation/bind/Autowired.js +13 -13
- package/target/annotation/bind/CallDependency.js +23 -23
- package/target/annotation/data/DBType.js +11 -11
- package/target/annotation/data/DS.js +54 -54
- package/target/annotation/data/DSIndex.js +9 -9
- package/target/annotation/data/Entity.js +10 -10
- package/target/annotation/data/Field.js +18 -18
- package/target/annotation/data/PrimaryKey.js +9 -9
- package/target/annotation/data/SqlSession.js +9 -9
- package/target/annotation/data/Table.js +35 -35
- package/target/annotation/data/Transactional.js +52 -52
- package/target/annotation/env/ApplicationSetting.js +25 -25
- package/target/annotation/env/BaseFilePath.js +14 -14
- package/target/annotation/env/BaseName.js +9 -9
- package/target/annotation/env/BasePath.js +14 -14
- package/target/annotation/env/ENV.js +10 -10
- package/target/annotation/env/ResourcePath.js +9 -9
- package/target/annotation/lifeCycle/AddLifeCycleItem.js +18 -18
- package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
- package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
- package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
- package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
- package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
- package/target/annotation/property/Deprecate.js +19 -19
- package/target/annotation/property/NotImplemented.js +8 -8
- package/target/annotation/property/Override.js +7 -7
- package/target/annotation/property/Readonly.js +16 -16
- package/target/annotation/scan/ComponentInjection.js +21 -21
- package/target/annotation/scan/ComponentScan.js +9 -9
- package/target/annotation/scan/ComponentScanExclusion.js +25 -25
- package/target/annotation/scan/ComponentScanMust.js +25 -25
- package/target/annotation/scan/Hotter.js +8 -8
- package/target/annotation/stereotype/BeanName.js +11 -11
- package/target/annotation/stereotype/Component.js +8 -8
- package/target/annotation/stereotype/Configure.js +14 -14
- package/target/annotation/stereotype/Controller.js +9 -9
- package/target/annotation/stereotype/Injection.js +12 -12
- package/target/annotation/stereotype/Log.js +17 -17
- package/target/annotation/stereotype/Repository.js +9 -9
- package/target/annotation/stereotype/Service.js +9 -9
- package/target/annotation/valid/AddChildValid.js +56 -56
- package/target/annotation/valid/CustomType.js +11 -11
- package/target/annotation/valid/DefaultVal.js +10 -10
- package/target/annotation/valid/NotNull.js +8 -8
- package/target/annotation/valid/Rule.js +100 -100
- package/target/annotation/valid/Size.js +10 -10
- package/target/annotation/valid/Type.js +10 -10
- package/target/annotation/valid/ValidCustom.js +17 -17
- package/target/annotation/valid/ValidForm.js +133 -133
- package/target/annotation.js +108 -108
- package/target/config/ApplicationConfig.js +2 -2
- package/target/config/SysConfig.js +19 -19
- package/target/constant/AppStatusEnum.js +9 -9
- package/target/constant/BootPriority.js +11 -11
- package/target/constant/CommonConstant.js +18 -18
- package/target/constant/ComponentKind.js +11 -11
- package/target/constant/DataTypes.js +19 -19
- package/target/constant/FastCarMetaData.js +31 -31
- package/target/constant/LifeCycleModule.js +9 -9
- package/target/db.js +49 -48
- package/target/index.js +21 -21
- package/target/interface/ApplicationHook.js +2 -2
- package/target/interface/ApplicationInterface.js +2 -2
- package/target/interface/ApplicationRunnerService.js +2 -2
- package/target/interface/DataSourceManager.js +2 -2
- package/target/interface/Logger.js +5 -5
- package/target/model/BaseMapper.js +98 -98
- package/target/model/DataMap.js +87 -87
- package/target/model/FormRuleModel.js +2 -2
- package/target/model/ValidError.js +5 -5
- package/target/model/WinstonLogger.js +96 -95
- package/target/src/FastCarApplication.js +704 -0
- package/target/src/annotation/Application.js +45 -0
- package/target/src/annotation/ExceptionMonitor.js +16 -0
- package/target/src/annotation/bind/AddRequireModule.js +21 -0
- package/target/src/annotation/bind/AliasInjection.js +23 -0
- package/target/src/annotation/bind/Autowired.js +13 -0
- package/target/src/annotation/bind/CallDependency.js +23 -0
- package/target/src/annotation/data/DBType.js +11 -0
- package/target/src/annotation/data/DS.js +54 -0
- package/target/src/annotation/data/DSIndex.js +9 -0
- package/target/src/annotation/data/Entity.js +10 -0
- package/target/src/annotation/data/Field.js +18 -0
- package/target/src/annotation/data/PrimaryKey.js +9 -0
- package/target/src/annotation/data/SqlSession.js +9 -0
- package/target/src/annotation/data/Table.js +35 -0
- package/target/src/annotation/data/Transactional.js +52 -0
- package/target/src/annotation/env/ApplicationSetting.js +25 -0
- package/target/src/annotation/env/BaseFilePath.js +14 -0
- package/target/src/annotation/env/BaseName.js +9 -0
- package/target/src/annotation/env/BasePath.js +14 -0
- package/target/src/annotation/env/ENV.js +10 -0
- package/target/src/annotation/env/ResourcePath.js +9 -0
- package/target/src/annotation/lifeCycle/AddLifeCycleItem.js +18 -0
- package/target/src/annotation/lifeCycle/ApplicationDestory.js +15 -0
- package/target/src/annotation/lifeCycle/ApplicationInit.js +15 -0
- package/target/src/annotation/lifeCycle/ApplicationRunner.js +7 -0
- package/target/src/annotation/lifeCycle/ApplicationStart.js +24 -0
- package/target/src/annotation/lifeCycle/ApplicationStop.js +20 -0
- package/target/src/annotation/property/Deprecate.js +19 -0
- package/target/src/annotation/property/NotImplemented.js +8 -0
- package/target/src/annotation/property/Override.js +7 -0
- package/target/src/annotation/property/Readonly.js +16 -0
- package/target/src/annotation/scan/ComponentInjection.js +21 -0
- package/target/src/annotation/scan/ComponentScan.js +9 -0
- package/target/src/annotation/scan/ComponentScanExclusion.js +25 -0
- package/target/src/annotation/scan/ComponentScanMust.js +25 -0
- package/target/src/annotation/scan/Hotter.js +8 -0
- package/target/src/annotation/stereotype/BeanName.js +11 -0
- package/target/src/annotation/stereotype/Component.js +8 -0
- package/target/src/annotation/stereotype/Configure.js +14 -0
- package/target/src/annotation/stereotype/Controller.js +9 -0
- package/target/src/annotation/stereotype/Injection.js +12 -0
- package/target/src/annotation/stereotype/Log.js +22 -0
- package/target/src/annotation/stereotype/Repository.js +9 -0
- package/target/src/annotation/stereotype/Service.js +9 -0
- package/target/src/annotation/valid/AddChildValid.js +56 -0
- package/target/src/annotation/valid/CustomType.js +11 -0
- package/target/src/annotation/valid/DefaultVal.js +10 -0
- package/target/src/annotation/valid/NotNull.js +8 -0
- package/target/src/annotation/valid/Rule.js +100 -0
- package/target/src/annotation/valid/Size.js +10 -0
- package/target/src/annotation/valid/Type.js +10 -0
- package/target/src/annotation/valid/ValidCustom.js +17 -0
- package/target/src/annotation/valid/ValidForm.js +133 -0
- package/target/src/annotation.js +108 -0
- package/target/src/config/ApplicationConfig.js +2 -0
- package/target/src/config/SysConfig.js +19 -0
- package/target/src/constant/AppStatusEnum.js +9 -0
- package/target/src/constant/BootPriority.js +11 -0
- package/target/src/constant/CommonConstant.js +18 -0
- package/target/src/constant/ComponentKind.js +11 -0
- package/target/src/constant/DataTypes.js +19 -0
- package/target/src/constant/FastCarMetaData.js +31 -0
- package/target/src/constant/LifeCycleModule.js +9 -0
- package/target/src/db.js +49 -0
- package/target/src/index.js +21 -0
- package/target/src/interface/ApplicationHook.js +2 -0
- package/target/src/interface/ApplicationInterface.js +2 -0
- package/target/src/interface/ApplicationRunnerService.js +2 -0
- package/target/src/interface/DataSourceManager.js +2 -0
- package/target/src/interface/Logger.js +5 -0
- package/target/src/model/BaseMapper.js +103 -0
- package/target/src/model/DataMap.js +87 -0
- package/target/src/model/FormRuleModel.js +2 -0
- package/target/src/model/ValidError.js +5 -0
- package/target/src/model/WinstonLogger.js +97 -0
- package/target/src/type/ComponentDesc.js +2 -0
- package/target/src/type/DesignMeta.js +15 -0
- package/target/src/type/FileHotterDesc.js +2 -0
- package/target/src/type/MapperType.js +2 -0
- package/target/src/type/ProcessType.js +2 -0
- package/target/src/type/SqlError.js +5 -0
- package/target/src/type/WinstonLoggerType.js +9 -0
- package/target/src/utils/ClassLoader.js +65 -0
- package/target/src/utils/ClassUtils.js +35 -0
- package/target/src/utils/CryptoUtil.js +86 -0
- package/target/src/utils/DataFormat.js +88 -0
- package/target/src/utils/DateUtil.js +71 -0
- package/target/src/utils/FileUtil.js +153 -0
- package/target/src/utils/FormatStr.js +14 -0
- package/target/src/utils/IPUtils.js +34 -0
- package/target/src/utils/Id.js +9 -0
- package/target/src/utils/Mix.js +62 -0
- package/target/src/utils/ReflectUtil.js +22 -0
- package/target/src/utils/TypeUtil.js +53 -0
- package/target/src/utils/ValidationUtil.js +118 -0
- package/target/src/utils.js +25 -0
- package/target/test/example/simple/app-test.js +57 -0
- package/target/test/example/simple/app.js +116 -0
- package/target/test/example/simple/component/StartRunner.js +19 -0
- package/target/test/example/simple/component/StopRunner.js +23 -0
- package/target/test/example/simple/config/EnvConfig.js +16 -0
- package/target/test/example/simple/config/HelloConfig.js +16 -0
- package/target/test/example/simple/config/HotConfig.js +18 -0
- package/target/test/example/simple/controller/AliasController.js +17 -0
- package/target/test/example/simple/controller/HelloController.js +55 -0
- package/target/test/example/simple/controller/NotFoundController.js +36 -0
- package/target/test/example/simple/noclude/excludeApp.js +17 -0
- package/target/test/example/simple/service/CallService.js +24 -0
- package/target/test/example/simple/service/HelloService.js +18 -0
- package/target/test/example/simple/service/LogService.js +32 -0
- package/target/test/multi/app.js +29 -0
- package/target/test/multi/service/aService.js +33 -0
- package/target/test/multi/service/bService.js +35 -0
- package/target/test/multi/service/cService.js +40 -0
- package/target/test/unit/dataMap-test.js +35 -0
- package/target/test/unit/decorators-test.js +59 -0
- package/target/test/unit/ds-test.js +58 -0
- package/target/test/unit/reflectMetadata-test.js +27 -0
- package/target/test/unit/valid-test.js +99 -0
- package/target/test/unit/winston-test.js +15 -0
- package/target/type/ComponentDesc.js +2 -2
- package/target/type/DesignMeta.js +15 -15
- package/target/type/FileHotterDesc.js +2 -2
- package/target/type/MapperType.js +2 -2
- package/target/type/ProcessType.js +2 -2
- package/target/type/SqlError.js +5 -5
- package/target/type/WinstonLoggerType.js +9 -9
- package/target/utils/ClassLoader.js +65 -65
- package/target/utils/ClassUtils.js +35 -35
- package/target/utils/CryptoUtil.js +86 -86
- package/target/utils/DataFormat.js +88 -88
- package/target/utils/DateUtil.js +71 -71
- package/target/utils/FileUtil.js +153 -153
- package/target/utils/FormatStr.js +14 -14
- package/target/utils/IPUtils.js +34 -34
- package/target/utils/Id.js +9 -9
- package/target/utils/Mix.js +62 -62
- package/target/utils/ReflectUtil.js +22 -22
- package/target/utils/TypeUtil.js +53 -53
- package/target/utils/ValidationUtil.js +124 -118
- package/target/utils.js +25 -25
- package/test/unit/decorators-test.ts +3 -3
- package/test/unit/logs/sys.log +0 -24
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("reflect-metadata");
|
|
4
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
5
|
-
const DesignMeta_1 = require("../../type/DesignMeta");
|
|
6
|
-
const SqlError_1 = require("../../type/SqlError");
|
|
7
|
-
/**
|
|
8
|
-
* @version 1.0 事务管理 不建议多个事务的嵌套(避免长事务) 尽量做到一个方法一个事务
|
|
9
|
-
* */
|
|
10
|
-
function Transactional(driver = "MysqlDataSourceManager") {
|
|
11
|
-
return function (target, methodName, descriptor) {
|
|
12
|
-
const orignFunction = descriptor.value;
|
|
13
|
-
//在初始化时就应该检测是否注入了sessionID
|
|
14
|
-
const paramsIndex = Reflect.getOwnMetadata(DesignMeta_1.DesignMeta.sqlSession, target, methodName);
|
|
15
|
-
if (typeof paramsIndex != "number") {
|
|
16
|
-
throw new SqlError_1.default(`${methodName} needs to inject the SqlSession`);
|
|
17
|
-
}
|
|
18
|
-
descriptor.value = async function (...args) {
|
|
19
|
-
//创建会话id
|
|
20
|
-
let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
|
|
21
|
-
let sysLogger = app.getSysLogger() || console;
|
|
22
|
-
let dsm = app.getComponentByName(driver);
|
|
23
|
-
if (!dsm) {
|
|
24
|
-
sysLogger.error(`DataSourceManager ${driver} not found`);
|
|
25
|
-
return Promise.reject(new SqlError_1.default(`DataSourceManager ${driver} not found`));
|
|
26
|
-
}
|
|
27
|
-
let sessionId = args[paramsIndex];
|
|
28
|
-
if (sessionId) {
|
|
29
|
-
return Promise.resolve(Reflect.apply(orignFunction, this, args));
|
|
30
|
-
}
|
|
31
|
-
let errFlag = false;
|
|
32
|
-
sessionId = dsm.createSession();
|
|
33
|
-
args[paramsIndex] = sessionId;
|
|
34
|
-
let res = null;
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
Reflect.apply(orignFunction, this, args)
|
|
37
|
-
.then((result) => {
|
|
38
|
-
res = result;
|
|
39
|
-
})
|
|
40
|
-
.catch((e) => {
|
|
41
|
-
sysLogger.error(e);
|
|
42
|
-
errFlag = true;
|
|
43
|
-
})
|
|
44
|
-
.finally(async () => {
|
|
45
|
-
await dsm.destorySession(sessionId, errFlag);
|
|
46
|
-
return !errFlag ? resolve(res) : reject(new SqlError_1.default(`${methodName} exec fail `));
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.default = Transactional;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("reflect-metadata");
|
|
4
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
5
|
+
const DesignMeta_1 = require("../../type/DesignMeta");
|
|
6
|
+
const SqlError_1 = require("../../type/SqlError");
|
|
7
|
+
/**
|
|
8
|
+
* @version 1.0 事务管理 不建议多个事务的嵌套(避免长事务) 尽量做到一个方法一个事务
|
|
9
|
+
* */
|
|
10
|
+
function Transactional(driver = "MysqlDataSourceManager") {
|
|
11
|
+
return function (target, methodName, descriptor) {
|
|
12
|
+
const orignFunction = descriptor.value;
|
|
13
|
+
//在初始化时就应该检测是否注入了sessionID
|
|
14
|
+
const paramsIndex = Reflect.getOwnMetadata(DesignMeta_1.DesignMeta.sqlSession, target, methodName);
|
|
15
|
+
if (typeof paramsIndex != "number") {
|
|
16
|
+
throw new SqlError_1.default(`${methodName} needs to inject the SqlSession`);
|
|
17
|
+
}
|
|
18
|
+
descriptor.value = async function (...args) {
|
|
19
|
+
//创建会话id
|
|
20
|
+
let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
|
|
21
|
+
let sysLogger = app.getSysLogger() || console;
|
|
22
|
+
let dsm = app.getComponentByName(driver);
|
|
23
|
+
if (!dsm) {
|
|
24
|
+
sysLogger.error(`DataSourceManager ${driver} not found`);
|
|
25
|
+
return Promise.reject(new SqlError_1.default(`DataSourceManager ${driver} not found`));
|
|
26
|
+
}
|
|
27
|
+
let sessionId = args[paramsIndex];
|
|
28
|
+
if (sessionId) {
|
|
29
|
+
return Promise.resolve(Reflect.apply(orignFunction, this, args));
|
|
30
|
+
}
|
|
31
|
+
let errFlag = false;
|
|
32
|
+
sessionId = dsm.createSession();
|
|
33
|
+
args[paramsIndex] = sessionId;
|
|
34
|
+
let res = null;
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
Reflect.apply(orignFunction, this, args)
|
|
37
|
+
.then((result) => {
|
|
38
|
+
res = result;
|
|
39
|
+
})
|
|
40
|
+
.catch((e) => {
|
|
41
|
+
sysLogger.error(e);
|
|
42
|
+
errFlag = true;
|
|
43
|
+
})
|
|
44
|
+
.finally(async () => {
|
|
45
|
+
await dsm.destorySession(sessionId, errFlag);
|
|
46
|
+
return !errFlag ? resolve(res) : reject(new SqlError_1.default(`${methodName} exec fail `));
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.default = Transactional;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
const FastCarApplication_1 = require("../../FastCarApplication");
|
|
5
|
-
//应用程序设置 具有最高权限
|
|
6
|
-
function ApplicationSetting(setting) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
let fastcarSetting = Reflect.getMetadata(CommonConstant_1.CommonConstant.FastcarSetting, FastCarApplication_1.default.prototype);
|
|
9
|
-
if (!fastcarSetting) {
|
|
10
|
-
fastcarSetting = new Map();
|
|
11
|
-
}
|
|
12
|
-
Object.keys(setting).forEach((key) => {
|
|
13
|
-
let afterConfig = setting[key];
|
|
14
|
-
let beforeConfig = fastcarSetting.get(key);
|
|
15
|
-
if (beforeConfig) {
|
|
16
|
-
if (typeof beforeConfig == "object") {
|
|
17
|
-
afterConfig = Object.assign(beforeConfig, afterConfig);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
fastcarSetting.set(key, afterConfig);
|
|
21
|
-
});
|
|
22
|
-
Reflect.defineMetadata(CommonConstant_1.CommonConstant.FastcarSetting, fastcarSetting, FastCarApplication_1.default.prototype);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
exports.default = ApplicationSetting;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
const FastCarApplication_1 = require("../../FastCarApplication");
|
|
5
|
+
//应用程序设置 具有最高权限
|
|
6
|
+
function ApplicationSetting(setting) {
|
|
7
|
+
return function (target) {
|
|
8
|
+
let fastcarSetting = Reflect.getMetadata(CommonConstant_1.CommonConstant.FastcarSetting, FastCarApplication_1.default.prototype);
|
|
9
|
+
if (!fastcarSetting) {
|
|
10
|
+
fastcarSetting = new Map();
|
|
11
|
+
}
|
|
12
|
+
Object.keys(setting).forEach((key) => {
|
|
13
|
+
let afterConfig = setting[key];
|
|
14
|
+
let beforeConfig = fastcarSetting.get(key);
|
|
15
|
+
if (beforeConfig) {
|
|
16
|
+
if (typeof beforeConfig == "object") {
|
|
17
|
+
afterConfig = Object.assign(beforeConfig, afterConfig);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
fastcarSetting.set(key, afterConfig);
|
|
21
|
+
});
|
|
22
|
+
Reflect.defineMetadata(CommonConstant_1.CommonConstant.FastcarSetting, fastcarSetting, FastCarApplication_1.default.prototype);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.default = ApplicationSetting;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
//设置运行是的主路径
|
|
6
|
-
function BaseFilePath(name) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
let stats = fs.statSync(name);
|
|
9
|
-
if (stats.isFile()) {
|
|
10
|
-
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BaseFileName, name);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
exports.default = BaseFilePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
//设置运行是的主路径
|
|
6
|
+
function BaseFilePath(name) {
|
|
7
|
+
return function (target) {
|
|
8
|
+
let stats = fs.statSync(name);
|
|
9
|
+
if (stats.isFile()) {
|
|
10
|
+
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BaseFileName, name);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.default = BaseFilePath;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
function BaseName(name) {
|
|
5
|
-
return function (target) {
|
|
6
|
-
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BaseName, name);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
exports.default = BaseName;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
function BaseName(name) {
|
|
5
|
+
return function (target) {
|
|
6
|
+
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BaseName, name);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
exports.default = BaseName;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
//设置运行是的主路径
|
|
6
|
-
function BasePath(name) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
let stats = fs.statSync(name);
|
|
9
|
-
if (stats.isDirectory()) {
|
|
10
|
-
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BasePath, name);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
exports.default = BasePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
//设置运行是的主路径
|
|
6
|
+
function BasePath(name) {
|
|
7
|
+
return function (target) {
|
|
8
|
+
let stats = fs.statSync(name);
|
|
9
|
+
if (stats.isDirectory()) {
|
|
10
|
+
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BasePath, name);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.default = BasePath;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
//设置初始化的env 注入在原始的application上面
|
|
5
|
-
function ENV(name) {
|
|
6
|
-
return function (target) {
|
|
7
|
-
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.ENV, name);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
exports.default = ENV;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
//设置初始化的env 注入在原始的application上面
|
|
5
|
+
function ENV(name) {
|
|
6
|
+
return function (target) {
|
|
7
|
+
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.ENV, name);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
exports.default = ENV;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
-
function ResourcePath(name) {
|
|
5
|
-
return function (target) {
|
|
6
|
-
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.ResourcePath, name);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
exports.default = ResourcePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
4
|
+
function ResourcePath(name) {
|
|
5
|
+
return function (target) {
|
|
6
|
+
Reflect.set(target.prototype, CommonConstant_1.CommonConstant.ResourcePath, name);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
exports.default = ResourcePath;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddLifeCycleItem = void 0;
|
|
4
|
-
function AddLifeCycleItem(target, lifeCycle, item) {
|
|
5
|
-
let list = Reflect.getMetadata(lifeCycle, target);
|
|
6
|
-
if (!list) {
|
|
7
|
-
list = [];
|
|
8
|
-
}
|
|
9
|
-
let exist = list.some((fitem) => {
|
|
10
|
-
return item.exec == fitem.exec;
|
|
11
|
-
});
|
|
12
|
-
if (exist) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
list.push(item);
|
|
16
|
-
Reflect.defineMetadata(lifeCycle, list, target);
|
|
17
|
-
}
|
|
18
|
-
exports.AddLifeCycleItem = AddLifeCycleItem;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddLifeCycleItem = void 0;
|
|
4
|
+
function AddLifeCycleItem(target, lifeCycle, item) {
|
|
5
|
+
let list = Reflect.getMetadata(lifeCycle, target);
|
|
6
|
+
if (!list) {
|
|
7
|
+
list = [];
|
|
8
|
+
}
|
|
9
|
+
let exist = list.some((fitem) => {
|
|
10
|
+
return item.exec == fitem.exec;
|
|
11
|
+
});
|
|
12
|
+
if (exist) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
list.push(item);
|
|
16
|
+
Reflect.defineMetadata(lifeCycle, list, target);
|
|
17
|
+
}
|
|
18
|
+
exports.AddLifeCycleItem = AddLifeCycleItem;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
-
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
-
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
-
//启动时机
|
|
7
|
-
function ApplicationDestory(order = BootPriority_1.BootPriority.Sys) {
|
|
8
|
-
return function (target, method, value) {
|
|
9
|
-
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target, LifeCycleModule_1.LifeCycleModule.ApplicationStop, {
|
|
10
|
-
order,
|
|
11
|
-
exec: method,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.default = ApplicationDestory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
+
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
+
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
+
//启动时机
|
|
7
|
+
function ApplicationDestory(order = BootPriority_1.BootPriority.Sys) {
|
|
8
|
+
return function (target, method, value) {
|
|
9
|
+
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target, LifeCycleModule_1.LifeCycleModule.ApplicationStop, {
|
|
10
|
+
order,
|
|
11
|
+
exec: method,
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.default = ApplicationDestory;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
-
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
-
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
-
//启动时机
|
|
7
|
-
function ApplicationInit(order = BootPriority_1.BootPriority.Sys) {
|
|
8
|
-
return function (target, method, value) {
|
|
9
|
-
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target, LifeCycleModule_1.LifeCycleModule.ApplicationStart, {
|
|
10
|
-
order,
|
|
11
|
-
exec: method,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.default = ApplicationInit;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
+
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
+
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
+
//启动时机
|
|
7
|
+
function ApplicationInit(order = BootPriority_1.BootPriority.Sys) {
|
|
8
|
+
return function (target, method, value) {
|
|
9
|
+
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target, LifeCycleModule_1.LifeCycleModule.ApplicationStart, {
|
|
10
|
+
order,
|
|
11
|
+
exec: method,
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.default = ApplicationInit;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Component_1 = require("../stereotype/Component");
|
|
4
|
-
function ApplicationRunner(target) {
|
|
5
|
-
(0, Component_1.default)(target);
|
|
6
|
-
}
|
|
7
|
-
exports.default = ApplicationRunner;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Component_1 = require("../stereotype/Component");
|
|
4
|
+
function ApplicationRunner(target) {
|
|
5
|
+
(0, Component_1.default)(target);
|
|
6
|
+
}
|
|
7
|
+
exports.default = ApplicationRunner;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
-
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
-
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
-
const ApplicationRunner_1 = require("./ApplicationRunner");
|
|
7
|
-
/****
|
|
8
|
-
* @version 1.0 在应用启动后自动执行
|
|
9
|
-
* @params order 排序 序号越小排在越前面 系统级的组件 如数据库等一般为0
|
|
10
|
-
* @params exec 执行方法
|
|
11
|
-
*/
|
|
12
|
-
function ApplicationStart(order = BootPriority_1.BootPriority.Sys, exec = "run") {
|
|
13
|
-
return function (target) {
|
|
14
|
-
if (!Reflect.has(target.prototype, exec)) {
|
|
15
|
-
throw new Error(`${target.name} has no implementation ${exec} method`);
|
|
16
|
-
}
|
|
17
|
-
(0, ApplicationRunner_1.default)(target);
|
|
18
|
-
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target.prototype, LifeCycleModule_1.LifeCycleModule.ApplicationStart, {
|
|
19
|
-
order,
|
|
20
|
-
exec,
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.default = ApplicationStart;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
+
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
+
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
+
const ApplicationRunner_1 = require("./ApplicationRunner");
|
|
7
|
+
/****
|
|
8
|
+
* @version 1.0 在应用启动后自动执行
|
|
9
|
+
* @params order 排序 序号越小排在越前面 系统级的组件 如数据库等一般为0
|
|
10
|
+
* @params exec 执行方法
|
|
11
|
+
*/
|
|
12
|
+
function ApplicationStart(order = BootPriority_1.BootPriority.Sys, exec = "run") {
|
|
13
|
+
return function (target) {
|
|
14
|
+
if (!Reflect.has(target.prototype, exec)) {
|
|
15
|
+
throw new Error(`${target.name} has no implementation ${exec} method`);
|
|
16
|
+
}
|
|
17
|
+
(0, ApplicationRunner_1.default)(target);
|
|
18
|
+
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target.prototype, LifeCycleModule_1.LifeCycleModule.ApplicationStart, {
|
|
19
|
+
order,
|
|
20
|
+
exec,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.default = ApplicationStart;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
-
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
-
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
-
const ApplicationRunner_1 = require("./ApplicationRunner");
|
|
7
|
-
//在应用停止前触发
|
|
8
|
-
function ApplicationStop(order = BootPriority_1.BootPriority.Sys, exec = "run") {
|
|
9
|
-
return function (target) {
|
|
10
|
-
if (!Reflect.has(target.prototype, exec)) {
|
|
11
|
-
throw new Error(`${target.name} has no implementation ${exec} method`);
|
|
12
|
-
}
|
|
13
|
-
(0, ApplicationRunner_1.default)(target);
|
|
14
|
-
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target.prototype, LifeCycleModule_1.LifeCycleModule.ApplicationStop, {
|
|
15
|
-
order,
|
|
16
|
-
exec,
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
exports.default = ApplicationStop;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const BootPriority_1 = require("../../constant/BootPriority");
|
|
4
|
+
const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
|
|
5
|
+
const AddLifeCycleItem_1 = require("./AddLifeCycleItem");
|
|
6
|
+
const ApplicationRunner_1 = require("./ApplicationRunner");
|
|
7
|
+
//在应用停止前触发
|
|
8
|
+
function ApplicationStop(order = BootPriority_1.BootPriority.Sys, exec = "run") {
|
|
9
|
+
return function (target) {
|
|
10
|
+
if (!Reflect.has(target.prototype, exec)) {
|
|
11
|
+
throw new Error(`${target.name} has no implementation ${exec} method`);
|
|
12
|
+
}
|
|
13
|
+
(0, ApplicationRunner_1.default)(target);
|
|
14
|
+
(0, AddLifeCycleItem_1.AddLifeCycleItem)(target.prototype, LifeCycleModule_1.LifeCycleModule.ApplicationStop, {
|
|
15
|
+
order,
|
|
16
|
+
exec,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.default = ApplicationStop;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const DEFAULT_MSG = "This function will be removed in future versions.";
|
|
4
|
-
/****
|
|
5
|
-
* @version 1.0 用于标记弃用
|
|
6
|
-
*/
|
|
7
|
-
function Deprecate(msg = DEFAULT_MSG) {
|
|
8
|
-
return function (target, prop, descriptor) {
|
|
9
|
-
console.warn(prop ? prop : Reflect.get(target, "name"), msg);
|
|
10
|
-
if (descriptor) {
|
|
11
|
-
const fn = descriptor.value;
|
|
12
|
-
descriptor.value = function (...args) {
|
|
13
|
-
console.warn(prop, msg);
|
|
14
|
-
return Reflect.apply(fn, this, args);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
exports.default = Deprecate;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const DEFAULT_MSG = "This function will be removed in future versions.";
|
|
4
|
+
/****
|
|
5
|
+
* @version 1.0 用于标记弃用
|
|
6
|
+
*/
|
|
7
|
+
function Deprecate(msg = DEFAULT_MSG) {
|
|
8
|
+
return function (target, prop, descriptor) {
|
|
9
|
+
console.warn(prop ? prop : Reflect.get(target, "name"), msg);
|
|
10
|
+
if (descriptor) {
|
|
11
|
+
const fn = descriptor.value;
|
|
12
|
+
descriptor.value = function (...args) {
|
|
13
|
+
console.warn(prop, msg);
|
|
14
|
+
return Reflect.apply(fn, this, args);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.default = Deprecate;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/***
|
|
4
|
-
* @version 1.0 不实现说明
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
function NotImplemented(target, name, descriptor) { }
|
|
8
|
-
exports.default = NotImplemented;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/***
|
|
4
|
+
* @version 1.0 不实现说明
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
function NotImplemented(target, name, descriptor) { }
|
|
8
|
+
exports.default = NotImplemented;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/***
|
|
4
|
-
* @version 1.0 仅用于标记方法是否被重载
|
|
5
|
-
*/
|
|
6
|
-
function Override(target, methodName, descriptor) { }
|
|
7
|
-
exports.default = Override;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/***
|
|
4
|
+
* @version 1.0 仅用于标记方法是否被重载
|
|
5
|
+
*/
|
|
6
|
+
function Override(target, methodName, descriptor) { }
|
|
7
|
+
exports.default = Override;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* @version 1.0 用于标记只读 可作用于属性或者方法
|
|
5
|
-
*/
|
|
6
|
-
function Readonly(target, methodName, descriptor) {
|
|
7
|
-
if (!descriptor) {
|
|
8
|
-
Reflect.defineProperty(target, methodName, {
|
|
9
|
-
writable: false,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
descriptor.writable = false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.default = Readonly;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @version 1.0 用于标记只读 可作用于属性或者方法
|
|
5
|
+
*/
|
|
6
|
+
function Readonly(target, methodName, descriptor) {
|
|
7
|
+
if (!descriptor) {
|
|
8
|
+
Reflect.defineProperty(target, methodName, {
|
|
9
|
+
writable: false,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
descriptor.writable = false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = Readonly;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
|
|
6
|
-
function ComponentInjection(target, ...names) {
|
|
7
|
-
let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScan;
|
|
8
|
-
let list = Reflect.get(target.prototype, ScanPathList) || [];
|
|
9
|
-
for (let name of names) {
|
|
10
|
-
//可支持绝对路径
|
|
11
|
-
let p = path.join(require.main?.path || process.cwd() || "", name);
|
|
12
|
-
if (fs.existsSync(name)) {
|
|
13
|
-
p = name;
|
|
14
|
-
}
|
|
15
|
-
if (!list.includes(p)) {
|
|
16
|
-
list.push(p);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
Reflect.set(target.prototype, ScanPathList, list);
|
|
20
|
-
}
|
|
21
|
-
exports.default = ComponentInjection;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
|
|
6
|
+
function ComponentInjection(target, ...names) {
|
|
7
|
+
let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScan;
|
|
8
|
+
let list = Reflect.get(target.prototype, ScanPathList) || [];
|
|
9
|
+
for (let name of names) {
|
|
10
|
+
//可支持绝对路径
|
|
11
|
+
let p = path.join(require.main?.path || process.cwd() || "", name);
|
|
12
|
+
if (fs.existsSync(name)) {
|
|
13
|
+
p = name;
|
|
14
|
+
}
|
|
15
|
+
if (!list.includes(p)) {
|
|
16
|
+
list.push(p);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
Reflect.set(target.prototype, ScanPathList, list);
|
|
20
|
+
}
|
|
21
|
+
exports.default = ComponentInjection;
|