@fastcar/core 0.2.55 → 0.2.57

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastcar/core",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "homepage": "https://github.com/williamDazhangyu/fast-car",
5
5
  "main": "target/index.js",
6
6
  "author": "william_zhong",
@@ -268,7 +268,9 @@ class FastCarApplication extends Events {
268
268
  });
269
269
  }
270
270
 
271
+ let includeFinalList: string[] = [...tmpFilePath];
271
272
  let filePathList = FileUtil.getFilePathList(this.basePath);
273
+
272
274
  filePathList = tmpFilePath.concat(filePathList);
273
275
  filePathList = [...new Set(filePathList)];
274
276
 
@@ -286,6 +288,9 @@ class FastCarApplication extends Events {
286
288
  });
287
289
 
288
290
  filePathList = filePathList.filter((item) => {
291
+ if (includeFinalList.includes(item)) {
292
+ return true;
293
+ }
289
294
  return !excludAllPath.includes(item);
290
295
  });
291
296
  }
@@ -551,7 +556,7 @@ class FastCarApplication extends Events {
551
556
  */
552
557
  init() {
553
558
  //加载配置
554
- this.basePath = (Reflect.get(this, CommonConstant.BasePath) || require.main?.path || module.path) as string;
559
+ this.basePath = (Reflect.get(this, CommonConstant.BasePath) || require.main?.path || module.path || process.cwd()) as string;
555
560
  this.baseFileName = (Reflect.get(this, CommonConstant.BaseFileName) || require.main?.filename || module.filename) as string;
556
561
 
557
562
  this.beforeStartServer();
@@ -8,7 +8,7 @@ export default function ComponentInjection(target: any, ...names: string[]) {
8
8
 
9
9
  for (let name of names) {
10
10
  //可支持绝对路径
11
- let p = path.join(require.main?.path || "", name);
11
+ let p = path.join(require.main?.path || process.cwd() || "", name);
12
12
  if (fs.existsSync(name)) {
13
13
  p = name;
14
14
  }
@@ -11,7 +11,7 @@ export default function ComponentScanExclusion(...names: string[]) {
11
11
 
12
12
  for (let name of names) {
13
13
  //可支持绝对路径
14
- let p = path.join(require.main?.path || "", name);
14
+ let p = path.join(require.main?.path || process.cwd() || "", name);
15
15
  if (fs.existsSync(name)) {
16
16
  p = name;
17
17
  }
@@ -10,7 +10,7 @@ export default function Log(category?: string) {
10
10
  Reflect.defineProperty(target, propertyKey, {
11
11
  get: (): Logger => {
12
12
  let app: ApplicationInterface = Reflect.get(global, CommonConstant.FastcarApp);
13
- let appid = app.getSetting(CommonConstant.APPId) || ""; //进行差异化区分
13
+ let appid = app?.getSetting(CommonConstant.APPId) || ""; //进行差异化区分
14
14
  return app ? app.getLogger(appid ? `${appid}.${m}` : m) : console;
15
15
  },
16
16
  });
@@ -226,6 +226,7 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
226
226
  tmpFilePath = tmpFilePath.concat(tmpList);
227
227
  });
228
228
  }
229
+ let includeFinalList = [...tmpFilePath];
229
230
  let filePathList = FileUtil_1.default.getFilePathList(this.basePath);
230
231
  filePathList = tmpFilePath.concat(filePathList);
231
232
  filePathList = [...new Set(filePathList)];
@@ -240,6 +241,9 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
240
241
  excludAllPath = [...excludAllPath, ...exlist];
241
242
  });
242
243
  filePathList = filePathList.filter((item) => {
244
+ if (includeFinalList.includes(item)) {
245
+ return true;
246
+ }
243
247
  return !excludAllPath.includes(item);
244
248
  });
245
249
  }
@@ -475,7 +479,7 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
475
479
  */
476
480
  init() {
477
481
  //加载配置
478
- this.basePath = (Reflect.get(this, CommonConstant_1.CommonConstant.BasePath) || require.main?.path || module.path);
482
+ this.basePath = (Reflect.get(this, CommonConstant_1.CommonConstant.BasePath) || require.main?.path || module.path || process.cwd());
479
483
  this.baseFileName = (Reflect.get(this, CommonConstant_1.CommonConstant.BaseFileName) || require.main?.filename || module.filename);
480
484
  this.beforeStartServer();
481
485
  this.startServer();
@@ -8,7 +8,7 @@ function ComponentInjection(target, ...names) {
8
8
  let list = Reflect.get(target.prototype, ScanPathList) || [];
9
9
  for (let name of names) {
10
10
  //可支持绝对路径
11
- let p = path.join(require.main?.path || "", name);
11
+ let p = path.join(require.main?.path || process.cwd() || "", name);
12
12
  if (fs.existsSync(name)) {
13
13
  p = name;
14
14
  }
@@ -11,7 +11,7 @@ function ComponentScanExclusion(...names) {
11
11
  let list = Reflect.get(target.prototype, ScanPathList) || [];
12
12
  for (let name of names) {
13
13
  //可支持绝对路径
14
- let p = path.join(require.main?.path || "", name);
14
+ let p = path.join(require.main?.path || process.cwd() || "", name);
15
15
  if (fs.existsSync(name)) {
16
16
  p = name;
17
17
  }
@@ -8,7 +8,7 @@ function Log(category) {
8
8
  Reflect.defineProperty(target, propertyKey, {
9
9
  get: () => {
10
10
  let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
11
- let appid = app.getSetting(CommonConstant_1.CommonConstant.APPId) || ""; //进行差异化区分
11
+ let appid = app?.getSetting(CommonConstant_1.CommonConstant.APPId) || ""; //进行差异化区分
12
12
  return app ? app.getLogger(appid ? `${appid}.${m}` : m) : console;
13
13
  },
14
14
  });