@midwayjs/info 4.0.0-beta.1 → 4.0.0-beta.10
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/configuration.js +1 -0
- package/dist/infoService.js +8 -0
- package/dist/middleware/info.middleware.js +2 -0
- package/dist/utils.js +4 -5
- package/package.json +7 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 - Now midwayjs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
package/dist/configuration.js
CHANGED
|
@@ -14,6 +14,7 @@ const core_1 = require("@midwayjs/core");
|
|
|
14
14
|
const info_middleware_1 = require("./middleware/info.middleware");
|
|
15
15
|
const DefaultConfig = require("./config.default");
|
|
16
16
|
let InfoConfiguration = class InfoConfiguration {
|
|
17
|
+
applicationManager;
|
|
17
18
|
async onReady() {
|
|
18
19
|
this.applicationManager
|
|
19
20
|
.getApplications(['koa', 'faas', 'express', 'egg'])
|
package/dist/infoService.js
CHANGED
|
@@ -18,6 +18,14 @@ const os_1 = require("os");
|
|
|
18
18
|
const path_1 = require("path");
|
|
19
19
|
const pm = require("picomatch");
|
|
20
20
|
let InfoService = class InfoService {
|
|
21
|
+
midwayInformationService;
|
|
22
|
+
configService;
|
|
23
|
+
environment;
|
|
24
|
+
titleConfig;
|
|
25
|
+
defaultHiddenKey;
|
|
26
|
+
ignoreKey;
|
|
27
|
+
secretMatchList;
|
|
28
|
+
container;
|
|
21
29
|
async init() {
|
|
22
30
|
this.secretMatchList = Array.from(new Set(this.defaultHiddenKey)).map(pattern => {
|
|
23
31
|
return pm(pattern);
|
|
@@ -13,6 +13,8 @@ exports.InfoMiddleware = void 0;
|
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const infoService_1 = require("../infoService");
|
|
15
15
|
let InfoMiddleware = class InfoMiddleware {
|
|
16
|
+
infoPath;
|
|
17
|
+
infoService;
|
|
16
18
|
resolve(app) {
|
|
17
19
|
if ('express' === app.getNamespace()) {
|
|
18
20
|
return async (req, res, next) => {
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.safeRequire = safeRequire;
|
|
4
|
+
exports.bitToMB = bitToMB;
|
|
5
|
+
exports.renderToHtml = renderToHtml;
|
|
6
|
+
exports.safeContent = safeContent;
|
|
4
7
|
const fs_1 = require("fs");
|
|
5
8
|
function safeRequire(mod, defaultValue) {
|
|
6
9
|
try {
|
|
@@ -13,11 +16,9 @@ function safeRequire(mod, defaultValue) {
|
|
|
13
16
|
return defaultValue;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
|
-
exports.safeRequire = safeRequire;
|
|
17
19
|
function bitToMB(bit) {
|
|
18
20
|
return Number((bit || 0) / 1024 / 1024).toFixed(2) + ' MB';
|
|
19
21
|
}
|
|
20
|
-
exports.bitToMB = bitToMB;
|
|
21
22
|
function renderToHtml(infoList, title) {
|
|
22
23
|
let html = `<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${title}</div>`;
|
|
23
24
|
html += infoList
|
|
@@ -37,7 +38,6 @@ function renderToHtml(infoList, title) {
|
|
|
37
38
|
.infoValue {vertical-align: top;background:#d8d8d8;padding: 12px;word-break:break-all;}
|
|
38
39
|
</style><div style="margin: 24px auto;max-width: 720px;min-width: 440px;">${html}</div>`;
|
|
39
40
|
}
|
|
40
|
-
exports.renderToHtml = renderToHtml;
|
|
41
41
|
function safeContent(value = '') {
|
|
42
42
|
if (value.length < 3) {
|
|
43
43
|
return '*'.repeat(value.length);
|
|
@@ -55,5 +55,4 @@ function safeContent(value = '') {
|
|
|
55
55
|
return value.slice(0, 3) + '*'.repeat(value.length - 6) + value.slice(-3);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
exports.safeContent = safeContent;
|
|
59
58
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/info",
|
|
3
3
|
"description": "midway info",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.10",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"picomatch": "2.3.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
17
|
-
"@midwayjs/express": "^4.0.0-beta.
|
|
18
|
-
"@midwayjs/koa": "^4.0.0-beta.
|
|
19
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
16
|
+
"@midwayjs/core": "^4.0.0-beta.10",
|
|
17
|
+
"@midwayjs/express": "^4.0.0-beta.10",
|
|
18
|
+
"@midwayjs/koa": "^4.0.0-beta.10",
|
|
19
|
+
"@midwayjs/mock": "^4.0.0-beta.10"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"midway"
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"lint": "mwts check"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=20"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/midwayjs/midway.git"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
|
|
41
41
|
}
|