@midwayjs/swagger 3.11.16 → 3.12.1
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IMiddleware, IMidwayApplication, IMidwayContext, NextFunction } from '@midwayjs/core';
|
|
1
|
+
import { IMiddleware, IMidwayApplication, IMidwayContext, NextFunction, MidwayEnvironmentService } from '@midwayjs/core';
|
|
2
2
|
export declare class SwaggerMiddleware implements IMiddleware<IMidwayContext, NextFunction, unknown> {
|
|
3
3
|
private swaggerConfig;
|
|
4
4
|
private swaggerUiAssetPath;
|
|
5
5
|
private swaggerExplorer;
|
|
6
|
+
environmentService: MidwayEnvironmentService;
|
|
6
7
|
init(): Promise<void>;
|
|
7
8
|
resolve(app: IMidwayApplication): (req: any, res: any, next: NextFunction) => Promise<any>;
|
|
8
9
|
replaceInfo(content: string): string;
|
|
@@ -16,7 +16,10 @@ const path_1 = require("path");
|
|
|
16
16
|
const swaggerExplorer_1 = require("./swaggerExplorer");
|
|
17
17
|
let SwaggerMiddleware = class SwaggerMiddleware {
|
|
18
18
|
async init() {
|
|
19
|
-
const { getAbsoluteFSPath } = (0, core_1.
|
|
19
|
+
const { getAbsoluteFSPath } = await (0, core_1.loadModule)('swagger-ui-dist', {
|
|
20
|
+
safeLoad: true,
|
|
21
|
+
loadMode: this.environmentService.getModuleLoadType(),
|
|
22
|
+
});
|
|
20
23
|
if (getAbsoluteFSPath) {
|
|
21
24
|
this.swaggerUiAssetPath = getAbsoluteFSPath();
|
|
22
25
|
}
|
|
@@ -120,6 +123,10 @@ __decorate([
|
|
|
120
123
|
(0, core_1.Inject)(),
|
|
121
124
|
__metadata("design:type", swaggerExplorer_1.SwaggerExplorer)
|
|
122
125
|
], SwaggerMiddleware.prototype, "swaggerExplorer", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, core_1.Inject)(),
|
|
128
|
+
__metadata("design:type", core_1.MidwayEnvironmentService)
|
|
129
|
+
], SwaggerMiddleware.prototype, "environmentService", void 0);
|
|
123
130
|
__decorate([
|
|
124
131
|
(0, core_1.Init)(),
|
|
125
132
|
__metadata("design:type", Function),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/swagger",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.1",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"index.d.ts"
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@midwayjs/core": "^3.
|
|
13
|
-
"@midwayjs/koa": "^3.
|
|
14
|
-
"@midwayjs/mock": "^3.
|
|
15
|
-
"@midwayjs/validate": "^3.
|
|
12
|
+
"@midwayjs/core": "^3.12.1",
|
|
13
|
+
"@midwayjs/koa": "^3.12.1",
|
|
14
|
+
"@midwayjs/mock": "^3.12.1",
|
|
15
|
+
"@midwayjs/validate": "^3.12.1",
|
|
16
16
|
"swagger-ui-dist": "4.19.1"
|
|
17
17
|
},
|
|
18
18
|
"author": "Kurten Chan <chinkurten@gmail.com>",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"type": "git",
|
|
28
28
|
"url": "https://github.com/midwayjs/midway.git"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "48413b87b12354cb8207de6aa58e0a4ca22ea000"
|
|
31
31
|
}
|