@fastcar/core 0.2.58 → 0.2.60
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
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
1
2
|
import * as path from "path";
|
|
2
3
|
import * as fs from "fs";
|
|
3
4
|
import { FastCarMetaData } from "../../constant/FastCarMetaData";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
//和本包的相对路径
|
|
7
|
+
export default function ComponentScanMust(...names: string[]) {
|
|
8
|
+
return function (target: any) {
|
|
9
|
+
let scanMust = FastCarMetaData.ComponentScanMust;
|
|
10
|
+
let list: string[] = Reflect.get(target.prototype, scanMust) || [];
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
for (let name of names) {
|
|
13
|
+
//可支持绝对路径
|
|
14
|
+
let p = path.join(require.main?.path || process.cwd() || "", name);
|
|
15
|
+
if (fs.existsSync(name)) {
|
|
16
|
+
p = name;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
if (!list.includes(p)) {
|
|
20
|
+
list.push(p);
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
|
-
}
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
Reflect.set(target.prototype, scanMust, list);
|
|
25
|
+
};
|
|
22
26
|
}
|
package/src/db.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("reflect-metadata");
|
|
3
4
|
const path = require("path");
|
|
4
5
|
const fs = require("fs");
|
|
5
6
|
const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
p = name;
|
|
7
|
+
//和本包的相对路径
|
|
8
|
+
function ComponentScanMust(...names) {
|
|
9
|
+
return function (target) {
|
|
10
|
+
let scanMust = FastCarMetaData_1.FastCarMetaData.ComponentScanMust;
|
|
11
|
+
let list = Reflect.get(target.prototype, scanMust) || [];
|
|
12
|
+
for (let name of names) {
|
|
13
|
+
//可支持绝对路径
|
|
14
|
+
let p = path.join(require.main?.path || process.cwd() || "", name);
|
|
15
|
+
if (fs.existsSync(name)) {
|
|
16
|
+
p = name;
|
|
17
|
+
}
|
|
18
|
+
if (!list.includes(p)) {
|
|
19
|
+
list.push(p);
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
Reflect.set(target.prototype, ScanPathList, list);
|
|
22
|
+
Reflect.set(target.prototype, scanMust, list);
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
exports.default = ComponentScanMust;
|