@fastcar/core 0.2.57 → 0.2.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/annotation.d.ts +1 -0
- package/package.json +1 -1
- package/src/FastCarApplication.ts +7 -1
- package/src/annotation/scan/ComponentScanMust.ts +22 -0
- package/src/annotation.ts +2 -0
- package/src/constant/FastCarMetaData.ts +1 -0
- package/target/FastCarApplication.js +6 -1
- package/target/annotation/scan/ComponentScanMust.js +21 -0
- package/target/annotation.js +4 -2
- package/target/constant/FastCarMetaData.js +1 -0
package/README.md
CHANGED
package/annotation.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export function ApplicationDestory(order?: number): MRet;
|
|
|
41
41
|
export function ComponentScan(...names: string[]): Ret;
|
|
42
42
|
export function ComponentScanExclusion(...names: string[]): Ret;
|
|
43
43
|
export function ComponentInjection(target: any, ...names: string[]): void;
|
|
44
|
+
export function ComponentScanMust(...names: string[]): Ret;
|
|
44
45
|
export function Hotter(target: any): void;
|
|
45
46
|
|
|
46
47
|
/***
|
package/package.json
CHANGED
|
@@ -254,6 +254,7 @@ class FastCarApplication extends Events {
|
|
|
254
254
|
//加载文件扫描下的bean
|
|
255
255
|
let tmpFilePath: string[] = Array.of();
|
|
256
256
|
let includeList: string[] = (Reflect.get(this, FastCarMetaData.ComponentScan) as string[]) || [];
|
|
257
|
+
let mustIncludMustList: string[] = (Reflect.get(this, FastCarMetaData.ComponentScanMust) as string[]) || [];
|
|
257
258
|
|
|
258
259
|
//从配置文件内读
|
|
259
260
|
if (Array.isArray(this.sysConfig.application?.scan?.include) && this.sysConfig.application?.scan?.include) {
|
|
@@ -268,7 +269,12 @@ class FastCarApplication extends Events {
|
|
|
268
269
|
});
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
let includeFinalList: string[] = [
|
|
272
|
+
let includeFinalList: string[] = [];
|
|
273
|
+
mustIncludMustList.forEach((item) => {
|
|
274
|
+
let tmpList = FileUtil.getFilePathList(item);
|
|
275
|
+
includeFinalList = includeFinalList.concat(tmpList);
|
|
276
|
+
});
|
|
277
|
+
|
|
272
278
|
let filePathList = FileUtil.getFilePathList(this.basePath);
|
|
273
279
|
|
|
274
280
|
filePathList = tmpFilePath.concat(filePathList);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import { FastCarMetaData } from "../../constant/FastCarMetaData";
|
|
4
|
+
|
|
5
|
+
export default function ComponentScanMust(target: any, ...names: string[]) {
|
|
6
|
+
let ScanPathList = FastCarMetaData.ComponentScanMust;
|
|
7
|
+
let list: string[] = Reflect.get(target.prototype, ScanPathList) || [];
|
|
8
|
+
|
|
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
|
+
|
|
16
|
+
if (!list.includes(p)) {
|
|
17
|
+
list.push(p);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Reflect.set(target.prototype, ScanPathList, list);
|
|
22
|
+
}
|
package/src/annotation.ts
CHANGED
|
@@ -49,6 +49,7 @@ import AliasInjection from "./annotation/bind/AliasInjection";
|
|
|
49
49
|
import ResourcePath from "./annotation/env/ResourcePath";
|
|
50
50
|
import BaseName from "./annotation/env/BaseName";
|
|
51
51
|
import CustomType from "./annotation/valid/CustomType";
|
|
52
|
+
import ComponentScanMust from "./annotation/scan/ComponentScanMust";
|
|
52
53
|
|
|
53
54
|
//注解暴露出去
|
|
54
55
|
export {
|
|
@@ -61,6 +62,7 @@ export {
|
|
|
61
62
|
ComponentScanExclusion,
|
|
62
63
|
Component,
|
|
63
64
|
ComponentInjection,
|
|
65
|
+
ComponentScanMust,
|
|
64
66
|
Hotter,
|
|
65
67
|
BeanName,
|
|
66
68
|
Configure,
|
|
@@ -215,6 +215,7 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
215
215
|
//加载文件扫描下的bean
|
|
216
216
|
let tmpFilePath = Array.of();
|
|
217
217
|
let includeList = Reflect.get(this, FastCarMetaData_1.FastCarMetaData.ComponentScan) || [];
|
|
218
|
+
let mustIncludMustList = Reflect.get(this, FastCarMetaData_1.FastCarMetaData.ComponentScanMust) || [];
|
|
218
219
|
//从配置文件内读
|
|
219
220
|
if (Array.isArray(this.sysConfig.application?.scan?.include) && this.sysConfig.application?.scan?.include) {
|
|
220
221
|
includeList = [...includeList, ...this.sysConfig.application.scan.include];
|
|
@@ -226,7 +227,11 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
|
|
|
226
227
|
tmpFilePath = tmpFilePath.concat(tmpList);
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
|
-
let includeFinalList = [
|
|
230
|
+
let includeFinalList = [];
|
|
231
|
+
mustIncludMustList.forEach((item) => {
|
|
232
|
+
let tmpList = FileUtil_1.default.getFilePathList(item);
|
|
233
|
+
includeFinalList = includeFinalList.concat(tmpList);
|
|
234
|
+
});
|
|
230
235
|
let filePathList = FileUtil_1.default.getFilePathList(this.basePath);
|
|
231
236
|
filePathList = tmpFilePath.concat(filePathList);
|
|
232
237
|
filePathList = [...new Set(filePathList)];
|
|
@@ -0,0 +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 ComponentScanMust(target, ...names) {
|
|
7
|
+
let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScanMust;
|
|
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 = ComponentScanMust;
|
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 = void 0;
|
|
3
|
+
exports.BasePath = exports.BaseFilePath = exports.ENV = exports.Transactional = exports.SqlSession = exports.Entity = exports.Table = exports.PrimaryKey = exports.Field = exports.DBType = exports.DSIndex = exports.DS = 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.CallDependency = exports.Autowired = exports.Application = exports.Injection = exports.Repository = exports.Service = exports.Controller = exports.Configure = exports.BeanName = 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 = 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");
|
|
@@ -104,3 +104,5 @@ const BaseName_1 = require("./annotation/env/BaseName");
|
|
|
104
104
|
exports.BaseName = BaseName_1.default;
|
|
105
105
|
const CustomType_1 = require("./annotation/valid/CustomType");
|
|
106
106
|
exports.CustomType = CustomType_1.default;
|
|
107
|
+
const ComponentScanMust_1 = require("./annotation/scan/ComponentScanMust");
|
|
108
|
+
exports.ComponentScanMust = ComponentScanMust_1.default;
|
|
@@ -27,4 +27,5 @@ var FastCarMetaData;
|
|
|
27
27
|
FastCarMetaData["LoggerModule"] = "LoggerModule";
|
|
28
28
|
FastCarMetaData["HotterSysConfig"] = "hotterSysConfig";
|
|
29
29
|
FastCarMetaData["CustomType"] = "custom:type";
|
|
30
|
+
FastCarMetaData["ComponentScanMust"] = "ComponentScanMust";
|
|
30
31
|
})(FastCarMetaData = exports.FastCarMetaData || (exports.FastCarMetaData = {}));
|