@fastcar/koa 0.1.16 → 0.1.17

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/koa",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "homepage": "https://github.com/williamDazhangyu/fast-car",
5
5
  "description": "fastcar框架下对koa的包装",
6
6
  "main": "target/index.js",
@@ -27,54 +27,44 @@
27
27
  "@fastcar/koa"
28
28
  ],
29
29
  "engines": {
30
- "node": ">=16"
30
+ "node": ">=18"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@fastcar/core": "0.3.1",
34
34
  "@fastcar/server": "^0.0.3",
35
+ "@types/co-body": "^6.1.3",
35
36
  "@types/koa": "^2.13.5",
36
- "@types/koa-bodyparser": "^4.3.11",
37
- "@types/koa-router": "^7.4.6",
38
37
  "@types/koa__multer": "*",
38
+ "@types/koa__router": "^12.0.4",
39
39
  "reflect-metadata": "*"
40
40
  },
41
41
  "dependencies": {
42
- "koa": "^2.15.3",
43
- "koa-bodyparser": "^4.4.1",
44
- "koa-router": "^13.0.1"
42
+ "@koa/bodyparser": "^5.1.1",
43
+ "@koa/router": "^13.1.0",
44
+ "koa": "^2.15.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@fastcar/core": "*",
48
48
  "@fastcar/server": "*",
49
49
  "@koa/multer": "^3.0.2",
50
- "@types/koa-bodyparser": "^4.3.3",
51
50
  "@types/koa-mount": "^4.0.1",
52
51
  "@types/koa-range": "^0.3.2",
53
- "@types/koa-router": "^7.4.6",
54
52
  "@types/koa-static": "^4.0.2",
55
53
  "@types/koa2-cors": "^2.0.2",
56
54
  "koa-body": "^4.2.0",
57
- "koa-bodyparser": "^4.4.1",
58
55
  "koa-mount": "^4.0.0",
59
56
  "koa-range": "^0.3.0",
60
57
  "koa-static": "^5.0.0",
61
58
  "koa2-cors": "^2.0.6",
62
- "multer": "*",
63
- "swagger-ui-dist": "4.5.0"
59
+ "multer": "*"
64
60
  },
65
61
  "peerDependenciesMeta": {
66
- "@types/koa-bodyparser": {
67
- "optional": true
68
- },
69
62
  "@types/koa-mount": {
70
63
  "optional": true
71
64
  },
72
65
  "@types/koa-range": {
73
66
  "optional": true
74
67
  },
75
- "@types/koa-router": {
76
- "optional": true
77
- },
78
68
  "@types/koa-static": {
79
69
  "optional": true
80
70
  },
@@ -84,18 +74,12 @@
84
74
  "koa-body": {
85
75
  "optional": true
86
76
  },
87
- "koa-bodyparser": {
88
- "optional": true
89
- },
90
77
  "koa-mount": {
91
78
  "optional": true
92
79
  },
93
80
  "koa-range": {
94
81
  "optional": true
95
82
  },
96
- "koa-router": {
97
- "optional": true
98
- },
99
83
  "koa-static": {
100
84
  "optional": true
101
85
  },
@@ -113,6 +97,12 @@
113
97
  },
114
98
  "@koa/multer": {
115
99
  "optional": true
100
+ },
101
+ "@koa/router": {
102
+ "optional": true
103
+ },
104
+ "@koa/bodyparser": {
105
+ "optional": true
116
106
  }
117
107
  },
118
108
  "repository": {
@@ -2,7 +2,7 @@ import "reflect-metadata";
2
2
  import { ApplicationStart, ApplicationStop, Autowired, Log } from "@fastcar/core/annotation";
3
3
  import { FastCarApplication, BootPriority, ComponentKind, Logger } from "@fastcar/core";
4
4
  import * as Koa from "koa";
5
- import * as KoaRouter from "koa-router";
5
+ import * as KoaRouter from "@koa/router";
6
6
  import { MethodType } from "./type/MethodType";
7
7
  import { DesignMeta } from "./type/DesignMeta";
8
8
  import { TypeUtil, ValidationUtil } from "@fastcar/core/utils";
@@ -54,7 +54,7 @@ export default class KoaApplication {
54
54
  *
55
55
  */
56
56
  protected loadRoute(): Koa.Middleware {
57
- let router: any = new KoaRouter();
57
+ let router = new KoaRouter();
58
58
 
59
59
  let instanceList = this.app.getComponentByType(ComponentKind.Controller);
60
60
 
@@ -101,7 +101,7 @@ export default class KoaApplication {
101
101
  });
102
102
  });
103
103
 
104
- return router.routes();
104
+ return router.routes() as any;
105
105
  }
106
106
 
107
107
  start(): void {
@@ -1,12 +1,11 @@
1
1
  import { FastCarApplication } from "@fastcar/core";
2
2
  import { KoaConfig } from "../type/KoaConfig";
3
+ import bodyParser from "@koa/bodyparser";
3
4
 
4
5
  //对文件内容做解析
5
6
  export default function KoaBodyParser(app: FastCarApplication) {
6
- const bodyParser = require("koa-bodyparser");
7
-
8
7
  let koaConfig: KoaConfig = app.getSetting("koa");
9
8
  let bodyConfig = koaConfig?.koaBodyParser;
10
9
 
11
- return bodyParser(bodyConfig);
10
+ return bodyParser(bodyConfig as any);
12
11
  }
@@ -13,7 +13,7 @@ require("reflect-metadata");
13
13
  const annotation_1 = require("@fastcar/core/annotation");
14
14
  const core_1 = require("@fastcar/core");
15
15
  const Koa = require("koa");
16
- const KoaRouter = require("koa-router");
16
+ const KoaRouter = require("@koa/router");
17
17
  const DesignMeta_1 = require("./type/DesignMeta");
18
18
  const utils_1 = require("@fastcar/core/utils");
19
19
  const server_1 = require("@fastcar/server");
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = KoaBodyParser;
4
+ const bodyparser_1 = require("@koa/bodyparser");
4
5
  //对文件内容做解析
5
6
  function KoaBodyParser(app) {
6
- const bodyParser = require("koa-bodyparser");
7
7
  let koaConfig = app.getSetting("koa");
8
8
  let bodyConfig = koaConfig?.koaBodyParser;
9
- return bodyParser(bodyConfig);
9
+ return (0, bodyparser_1.default)(bodyConfig);
10
10
  }
package/test/logs/sys.log CHANGED
@@ -76,3 +76,26 @@
76
76
  {"timestamp":"2024-12-05 11:10:32.316","level":"INFO","label":"sys","message":"http server is running in 1234"}
77
77
  {"timestamp":"2024-12-05 11:10:32.317","level":"INFO","label":"sys","message":"start server koaSimple is run"}
78
78
  {"timestamp":"2024-12-05 11:10:32.317","level":"INFO","label":"sys","message":"version 1.0.0"}
79
+ {"timestamp":"2024-12-12 18:26:18.85","level":"INFO","label":"sys","message":"Start scanning component"}
80
+ {"timestamp":"2024-12-12 18:26:21.485","level":"INFO","label":"sys","message":"Complete component scan"}
81
+ {"timestamp":"2024-12-12 18:26:21.487","level":"INFO","label":"sys","message":"Call application initialization method"}
82
+ {"timestamp":"2024-12-12 18:26:23.48","level":"ERROR","label":"sys","message":"Unhandled Rejection at:","splat":"[{}]"}
83
+ {"timestamp":"2024-12-12 18:26:23.118","level":"ERROR","label":"sys","message":"reason: bodyParser is not a function","splat":"[{}]","stack":"TypeError: bodyParser is not a function\n at KoaApplication.KoaBodyParser (D:\\code\\fast-car\\fastcar-koa\\src\\middleware\\KoaBodyParser.ts:11:9)\n at KoaApplication.start (D:\\code\\fast-car\\fastcar-koa\\src\\KoaApplication.ts:119:63)\n at FastCarApplication.automaticRun (D:\\code\\fast-car\\fastcar-koa\\node_modules\\@fastcar\\core\\target\\FastCarApplication.js:632:25)\n at FastCarApplication.startServer (D:\\code\\fast-car\\fastcar-koa\\node_modules\\@fastcar\\core\\target\\FastCarApplication.js:658:20)\n at FastCarApplication.init (D:\\code\\fast-car\\fastcar-koa\\node_modules\\@fastcar\\core\\target\\FastCarApplication.js:565:14)\n at Object.construct (D:\\code\\fast-car\\fastcar-koa\\node_modules\\@fastcar\\core\\target\\annotation\\Application.js:42:17)\n at Object.<anonymous> (D:\\code\\fast-car\\fastcar-koa\\test\\simple\\app.ts:36:20)\n at Module._compile (node:internal/modules/cjs/loader:1358:14)\n at Module.m._compile (D:\\code\\fast-car\\node_modules\\ts-node\\src\\index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)"}
84
+ {"timestamp":"2024-12-12 18:26:47.800","level":"INFO","label":"sys","message":"Start scanning component"}
85
+ {"timestamp":"2024-12-12 18:26:48.350","level":"INFO","label":"sys","message":"Complete component scan"}
86
+ {"timestamp":"2024-12-12 18:26:48.351","level":"INFO","label":"sys","message":"Call application initialization method"}
87
+ {"timestamp":"2024-12-12 18:26:48.419","level":"INFO","label":"sys","message":"http server is running in 1234"}
88
+ {"timestamp":"2024-12-12 18:26:48.421","level":"INFO","label":"sys","message":"start server koaSimple is run"}
89
+ {"timestamp":"2024-12-12 18:26:48.421","level":"INFO","label":"sys","message":"version 1.0.0"}
90
+ {"timestamp":"2024-12-12 18:30:24.420","level":"INFO","label":"sys","message":"Start scanning component"}
91
+ {"timestamp":"2024-12-12 18:30:25.440","level":"INFO","label":"sys","message":"Complete component scan"}
92
+ {"timestamp":"2024-12-12 18:30:25.442","level":"INFO","label":"sys","message":"Call application initialization method"}
93
+ {"timestamp":"2024-12-12 18:30:25.533","level":"INFO","label":"sys","message":"http server is running in 1234"}
94
+ {"timestamp":"2024-12-12 18:30:25.534","level":"INFO","label":"sys","message":"start server koaSimple is run"}
95
+ {"timestamp":"2024-12-12 18:30:25.535","level":"INFO","label":"sys","message":"version 1.0.0"}
96
+ {"timestamp":"2024-12-12 18:31:21.114","level":"INFO","label":"sys","message":"Start scanning component"}
97
+ {"timestamp":"2024-12-12 18:31:21.702","level":"INFO","label":"sys","message":"Complete component scan"}
98
+ {"timestamp":"2024-12-12 18:31:21.703","level":"INFO","label":"sys","message":"Call application initialization method"}
99
+ {"timestamp":"2024-12-12 18:31:21.714","level":"INFO","label":"sys","message":"http server is running in 1234"}
100
+ {"timestamp":"2024-12-12 18:31:21.715","level":"INFO","label":"sys","message":"start server koaSimple is run"}
101
+ {"timestamp":"2024-12-12 18:31:21.716","level":"INFO","label":"sys","message":"version 1.0.0"}