@fastcar/core 0.2.54 → 0.2.56

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 CHANGED
@@ -158,3 +158,6 @@ export function AliasInjection(alias: string): PMRet;
158
158
 
159
159
  //自定义资源路径
160
160
  export function ResourcePath(name: string): Ret;
161
+
162
+ //自定义类型
163
+ export function CustomType(name: string): PMRet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastcar/core",
3
- "version": "0.2.54",
3
+ "version": "0.2.56",
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
  }
package/src/annotation.ts CHANGED
@@ -48,6 +48,7 @@ import ApplicationSetting from "./annotation/env/ApplicationSetting";
48
48
  import AliasInjection from "./annotation/bind/AliasInjection";
49
49
  import ResourcePath from "./annotation/env/ResourcePath";
50
50
  import BaseName from "./annotation/env/BaseName";
51
+ import CustomType from "./annotation/valid/CustomType";
51
52
 
52
53
  //注解暴露出去
53
54
  export {
@@ -87,6 +88,7 @@ export {
87
88
  ValidForm,
88
89
  Rule,
89
90
  ResourcePath,
91
+ CustomType,
90
92
  };
91
93
 
92
94
  export {
@@ -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
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApplicationSetting = exports.BaseName = 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.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.ComponentInjection = exports.Component = exports.ComponentScanExclusion = exports.ComponentScan = exports.ApplicationDestory = exports.ApplicationInit = exports.ApplicationRunner = exports.ApplicationStop = exports.ApplicationStart = void 0;
3
+ exports.BaseName = 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.ComponentInjection = exports.Component = exports.ComponentScanExclusion = exports.ComponentScan = exports.ApplicationDestory = exports.ApplicationInit = exports.ApplicationRunner = exports.ApplicationStop = exports.ApplicationStart = void 0;
4
+ exports.ApplicationSetting = void 0;
4
5
  const Application_1 = require("./annotation/Application");
5
6
  exports.Application = Application_1.default;
6
7
  const Autowired_1 = require("./annotation/bind/Autowired");
@@ -101,3 +102,5 @@ const ResourcePath_1 = require("./annotation/env/ResourcePath");
101
102
  exports.ResourcePath = ResourcePath_1.default;
102
103
  const BaseName_1 = require("./annotation/env/BaseName");
103
104
  exports.BaseName = BaseName_1.default;
105
+ const CustomType_1 = require("./annotation/valid/CustomType");
106
+ exports.CustomType = CustomType_1.default;