@foxford/den 4.2.0 → 4.2.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.
- package/adapter.cjs +2 -2
- package/adapter.js +1 -1
- package/bin/den.cjs +23 -8
- package/bin/den.js +21 -6
- package/builder/index.cjs +2 -2
- package/builder/index.js +1 -1
- package/{chunk-ETO2T2TA.cjs → chunk-2PK3VIG2.cjs} +84 -35
- package/{chunk-VCIMVMHG.js → chunk-AE6GKDIG.js} +2 -2
- package/{chunk-Y7DGFJFA.cjs → chunk-C7BM4DGX.cjs} +1 -1
- package/{chunk-HWDDAFGV.js → chunk-E23E2VUC.js} +1 -1
- package/{chunk-AS6ZNCUY.js → chunk-E56BKBQZ.js} +7 -7
- package/{chunk-BFRLBMH2.cjs → chunk-H5DKRHHQ.cjs} +8 -8
- package/{chunk-YWWRJMWN.js → chunk-HFORUNJV.js} +85 -36
- package/{chunk-NOI7FSBX.cjs → chunk-I42ZL2FS.cjs} +7 -7
- package/{chunk-JW24N6O4.js → chunk-TEVB76QF.js} +7 -7
- package/{chunk-WKCIOQOY.js → chunk-WBHHHICS.js} +1 -1
- package/{chunk-MH2WIOTQ.cjs → chunk-WS6QCYBR.cjs} +2 -2
- package/{chunk-MWDNN7Q4.cjs → chunk-XOJ2VWX4.cjs} +1 -1
- package/define.cjs +3 -3
- package/define.js +2 -2
- package/index.cjs +4 -4
- package/index.js +4 -4
- package/island/index.cjs +4 -4
- package/island/index.js +3 -3
- package/ops/index.cjs +2 -2
- package/ops/index.js +1 -1
- package/package.json +23 -20
- package/serve/index.cjs +28 -28
- package/serve/index.js +14 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/den",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Den — декларативный метафреймворк Foxford (core runtime)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foxford",
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"ioc",
|
|
10
10
|
"lifecycle"
|
|
11
11
|
],
|
|
12
|
-
"homepage": "https://
|
|
13
|
-
"bugs": "https://
|
|
12
|
+
"homepage": "https://gitea.foxford.org/foxford/frontend-platform",
|
|
13
|
+
"bugs": "https://gitea.foxford.org/foxford/frontend-platform/issues",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://
|
|
16
|
+
"url": "git+https://gitea.foxford.org/foxford/frontend-platform.git",
|
|
17
17
|
"directory": "packages/den"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@prometheus-io/client": "0.16.1",
|
|
34
34
|
"fastify": "^5.12.1",
|
|
35
|
-
"@foxford/browserslist-config": "^
|
|
36
|
-
"@foxford/
|
|
37
|
-
"@foxford/
|
|
35
|
+
"@foxford/browserslist-config": "^2.0.0",
|
|
36
|
+
"@foxford/logger": "^1.2.3",
|
|
37
|
+
"@foxford/ioc": "^1.1.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"vite": ">=5.0.0 <8.0.0"
|
|
@@ -96,24 +96,24 @@
|
|
|
96
96
|
"adapter.js",
|
|
97
97
|
"bin",
|
|
98
98
|
"builder",
|
|
99
|
+
"chunk-2PK3VIG2.cjs",
|
|
99
100
|
"chunk-3RX2OSUL.js",
|
|
100
101
|
"chunk-6QV4L6R2.cjs",
|
|
101
102
|
"chunk-A6ZPAM6Z.cjs",
|
|
102
|
-
"chunk-
|
|
103
|
-
"chunk-
|
|
104
|
-
"chunk-
|
|
105
|
-
"chunk-
|
|
106
|
-
"chunk-
|
|
103
|
+
"chunk-AE6GKDIG.js",
|
|
104
|
+
"chunk-C7BM4DGX.cjs",
|
|
105
|
+
"chunk-E23E2VUC.js",
|
|
106
|
+
"chunk-E56BKBQZ.js",
|
|
107
|
+
"chunk-H5DKRHHQ.cjs",
|
|
108
|
+
"chunk-HFORUNJV.js",
|
|
109
|
+
"chunk-I42ZL2FS.cjs",
|
|
107
110
|
"chunk-KQAB6C6Q.cjs",
|
|
108
|
-
"chunk-MH2WIOTQ.cjs",
|
|
109
|
-
"chunk-MWDNN7Q4.cjs",
|
|
110
|
-
"chunk-NOI7FSBX.cjs",
|
|
111
111
|
"chunk-RG7ZV5BD.js",
|
|
112
|
+
"chunk-TEVB76QF.js",
|
|
112
113
|
"chunk-TPBI6TOU.js",
|
|
113
|
-
"chunk-
|
|
114
|
-
"chunk-
|
|
115
|
-
"chunk-
|
|
116
|
-
"chunk-YWWRJMWN.js",
|
|
114
|
+
"chunk-WBHHHICS.js",
|
|
115
|
+
"chunk-WS6QCYBR.cjs",
|
|
116
|
+
"chunk-XOJ2VWX4.cjs",
|
|
117
117
|
"define-repository-Ck45La_2.d.ts",
|
|
118
118
|
"define-repository-DAyeXF48.d.cts",
|
|
119
119
|
"define-slot-BTlLQ__T.d.ts",
|
|
@@ -142,6 +142,9 @@
|
|
|
142
142
|
"view-adapter-CrHh7CjB.d.cts",
|
|
143
143
|
"view-adapter-DPDvv09J.d.ts"
|
|
144
144
|
],
|
|
145
|
-
"sha": "
|
|
145
|
+
"sha": "33c6e78",
|
|
146
|
+
"publishConfig": {
|
|
147
|
+
"registry": "https://registry.npmjs.org/"
|
|
148
|
+
},
|
|
146
149
|
"scripts": {}
|
|
147
150
|
}
|
package/serve/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@ var _chunkKQAB6C6Qcjs = require('../chunk-KQAB6C6Q.cjs');
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../chunk-
|
|
9
|
+
var _chunkI42ZL2FScjs = require('../chunk-I42ZL2FS.cjs');
|
|
10
|
+
require('../chunk-XOJ2VWX4.cjs');
|
|
11
11
|
require('../chunk-6QV4L6R2.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ var _chunkA6ZPAM6Zcjs = require('../chunk-A6ZPAM6Z.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkWS6QCYBRcjs = require('../chunk-WS6QCYBR.cjs');
|
|
22
22
|
|
|
23
23
|
// src/serve/index.ts
|
|
24
24
|
var _fastify = require('fastify'); var _fastify2 = _interopRequireDefault(_fastify);
|
|
@@ -46,7 +46,7 @@ var MIME = {
|
|
|
46
46
|
var HASHED_DIR = "assets/";
|
|
47
47
|
function assetsPrefix(base) {
|
|
48
48
|
const { pathname } = new URL(base, "http://assets.invalid");
|
|
49
|
-
return pathname.endsWith("/") ? pathname :
|
|
49
|
+
return pathname.endsWith("/") ? pathname : `${pathname}/`;
|
|
50
50
|
}
|
|
51
51
|
function assetFile(dir, relative) {
|
|
52
52
|
const file = _path2.default.normalize(_path2.default.join(dir, relative));
|
|
@@ -55,7 +55,7 @@ function assetFile(dir, relative) {
|
|
|
55
55
|
function registerAssets(instance, source) {
|
|
56
56
|
const dir = _path2.default.resolve(source.dir);
|
|
57
57
|
const prefix = assetsPrefix(source.base);
|
|
58
|
-
instance.get(
|
|
58
|
+
instance.get(`${prefix}*`, (request, reply) => {
|
|
59
59
|
var _a;
|
|
60
60
|
const relative = request.params["*"];
|
|
61
61
|
const file = assetFile(dir, relative);
|
|
@@ -74,14 +74,14 @@ function registerAssets(instance, source) {
|
|
|
74
74
|
|
|
75
75
|
var DEFAULT_SLOW_RENDER_MS = 1e3;
|
|
76
76
|
function claim(app) {
|
|
77
|
-
return
|
|
77
|
+
return _chunkI42ZL2FScjs.normalizeRoutes.call(void 0, app.routes).map((route) => route.source);
|
|
78
78
|
}
|
|
79
79
|
function matchClaim(app, pathname) {
|
|
80
80
|
var _a, _b;
|
|
81
81
|
if (claim(app).length === 0) {
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
|
-
return (_b = (_a =
|
|
84
|
+
return (_b = (_a = _chunkI42ZL2FScjs.matchRoute.call(void 0, app.routes, pathname)) == null ? void 0 : _a.params) != null ? _b : null;
|
|
85
85
|
}
|
|
86
86
|
function requestContextOf(req, fromBody) {
|
|
87
87
|
const headers = {};
|
|
@@ -99,7 +99,7 @@ function requestContextOf(req, fromBody) {
|
|
|
99
99
|
...typeof cookie === "string" && cookie !== "" ? { cookie } : {},
|
|
100
100
|
...fromBody
|
|
101
101
|
};
|
|
102
|
-
return { backendHeaders, cookies:
|
|
102
|
+
return { backendHeaders, cookies: _chunkI42ZL2FScjs.parseCookieHeader.call(void 0, cookie), headers };
|
|
103
103
|
}
|
|
104
104
|
function backendHeadersOf(value) {
|
|
105
105
|
if (value === void 0) {
|
|
@@ -137,12 +137,12 @@ var appPlugin = (instance, options) => {
|
|
|
137
137
|
const { pathname, search } = new URL(target, "http://localhost");
|
|
138
138
|
const params = matchClaim(app, pathname);
|
|
139
139
|
if (params === null) {
|
|
140
|
-
serveLog.error(
|
|
141
|
-
return reply.code(404).send({ error:
|
|
140
|
+
serveLog.error(`\u043F\u0443\u0442\u044C \xAB${pathname}\xBB \u0432\u043D\u0435 \u0437\u0430\u044F\u0432\u043A\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F`);
|
|
141
|
+
return reply.code(404).send({ error: `\u043F\u0443\u0442\u044C \xAB${pathname}\xBB \u0432\u043D\u0435 \u0437\u0430\u044F\u0432\u043A\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F` });
|
|
142
142
|
}
|
|
143
143
|
const startedAt = Date.now();
|
|
144
144
|
try {
|
|
145
|
-
const result = await
|
|
145
|
+
const result = await _chunkI42ZL2FScjs.renderApp.call(void 0, app, {
|
|
146
146
|
context: requestContextOf(req, backendHeaders),
|
|
147
147
|
inputs,
|
|
148
148
|
params,
|
|
@@ -151,11 +151,11 @@ var appPlugin = (instance, options) => {
|
|
|
151
151
|
});
|
|
152
152
|
const elapsed = Date.now() - startedAt;
|
|
153
153
|
if (elapsed >= slowRenderMs) {
|
|
154
|
-
serveLog.warn(
|
|
154
|
+
serveLog.warn(`\u043C\u0435\u0434\u043B\u0435\u043D\u043D\u044B\u0439 \u0440\u0435\u043D\u0434\u0435\u0440 \xAB${pathname}\xBB: ${String(elapsed)}\u043C\u0441`);
|
|
155
155
|
}
|
|
156
156
|
return result;
|
|
157
157
|
} catch (error) {
|
|
158
|
-
serveLog.error(
|
|
158
|
+
serveLog.error(`\u0440\u0435\u043D\u0434\u0435\u0440 \xAB${pathname}\xBB \u0443\u043F\u0430\u043B \u0437\u0430 ${String(Date.now() - startedAt)}\u043C\u0441`, error);
|
|
159
159
|
return reply.send(error instanceof Error ? error : new Error(String(error)));
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -185,7 +185,7 @@ var ALIVE = "den:app-worker-alive";
|
|
|
185
185
|
var SIGNALS = ["SIGTERM", "SIGINT"];
|
|
186
186
|
var SHUTDOWN_MS = 1e4;
|
|
187
187
|
async function startWorker(appName, start) {
|
|
188
|
-
const aggregation =
|
|
188
|
+
const aggregation = _chunkWS6QCYBRcjs.clusterMetrics.call(void 0, );
|
|
189
189
|
const logger2 = _logger.log.getLogger(appName).getLogger("cluster");
|
|
190
190
|
let timer;
|
|
191
191
|
let closing;
|
|
@@ -248,7 +248,7 @@ async function startAppProcess(appName, options, start) {
|
|
|
248
248
|
const instance = await start(options);
|
|
249
249
|
return { close: () => instance.close() };
|
|
250
250
|
}
|
|
251
|
-
const metrics =
|
|
251
|
+
const metrics = _chunkWS6QCYBRcjs.getProcessMetrics.call(void 0, );
|
|
252
252
|
metrics.startRuntime(appName);
|
|
253
253
|
if (_cluster2.default.isWorker) {
|
|
254
254
|
return startWorker(appName, () => start({ ...options, gracefulShutdown: false, ops: false }));
|
|
@@ -256,7 +256,7 @@ async function startAppProcess(appName, options, start) {
|
|
|
256
256
|
return startPrimary(appName, options, workers);
|
|
257
257
|
}
|
|
258
258
|
async function startPrimary(appName, options, workers) {
|
|
259
|
-
const aggregation =
|
|
259
|
+
const aggregation = _chunkWS6QCYBRcjs.clusterMetrics.call(void 0, );
|
|
260
260
|
const logger2 = _logger.log.getLogger(appName).getLogger("cluster");
|
|
261
261
|
const children = /* @__PURE__ */ new Set();
|
|
262
262
|
const alive = /* @__PURE__ */ new Map();
|
|
@@ -283,7 +283,7 @@ async function startPrimary(appName, options, workers) {
|
|
|
283
283
|
resolveReady();
|
|
284
284
|
_cluster2.default.removeListener("message", onMessage);
|
|
285
285
|
await Promise.all([...children].map(stopWorker));
|
|
286
|
-
if (ops) await
|
|
286
|
+
if (ops) await _chunkWS6QCYBRcjs.closeHttpServer.call(void 0, ops);
|
|
287
287
|
await aggregation.shutdown();
|
|
288
288
|
for (const signal of SIGNALS) process.removeListener(signal, shutdown);
|
|
289
289
|
})();
|
|
@@ -312,7 +312,7 @@ async function startPrimary(appName, options, workers) {
|
|
|
312
312
|
try {
|
|
313
313
|
if (options.ops !== false) {
|
|
314
314
|
const supplied = options.ops;
|
|
315
|
-
ops = await
|
|
315
|
+
ops = await _chunkWS6QCYBRcjs.startOpsServer.call(void 0, {
|
|
316
316
|
...supplied,
|
|
317
317
|
collect: aggregation.collect,
|
|
318
318
|
contentType: aggregation.contentType,
|
|
@@ -326,7 +326,7 @@ async function startPrimary(appName, options, workers) {
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if (closing) {
|
|
329
|
-
if (ops) await
|
|
329
|
+
if (ops) await _chunkWS6QCYBRcjs.closeHttpServer.call(void 0, ops);
|
|
330
330
|
await closing;
|
|
331
331
|
return { close };
|
|
332
332
|
}
|
|
@@ -336,13 +336,13 @@ async function startPrimary(appName, options, workers) {
|
|
|
336
336
|
worker.once("error", failed);
|
|
337
337
|
worker.once("exit", (code, signal) => {
|
|
338
338
|
alive.delete(worker.id);
|
|
339
|
-
failed(new Error(
|
|
339
|
+
failed(new Error(`Den worker ${String(worker.process.pid)} exited (${String(code != null ? code : signal)})`));
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
await ready;
|
|
343
343
|
started = true;
|
|
344
344
|
clearTimeout(timeout);
|
|
345
|
-
if (!closing) logger2.info(
|
|
345
|
+
if (!closing) logger2.info(`\u0437\u0430\u043F\u0443\u0449\u0435\u043D\u043E \u0432\u043E\u0440\u043A\u0435\u0440\u043E\u0432: ${String(workers)}`);
|
|
346
346
|
return { close };
|
|
347
347
|
} catch (error) {
|
|
348
348
|
await close();
|
|
@@ -371,14 +371,14 @@ async function serveApp(app, options = {}) {
|
|
|
371
371
|
const appLog = (_a = _logger.log.getLogger(app.name)) != null ? _a : _chunkA6ZPAM6Zcjs.logger;
|
|
372
372
|
const serveLog = (_b = appLog.getLogger("serve")) != null ? _b : appLog;
|
|
373
373
|
const instance = _fastify2.default.call(void 0, { logger: false });
|
|
374
|
-
const metrics =
|
|
374
|
+
const metrics = _chunkWS6QCYBRcjs.getProcessMetrics.call(void 0, );
|
|
375
375
|
metrics.startRuntime(app.name);
|
|
376
376
|
let ops;
|
|
377
377
|
const shutdown = () => {
|
|
378
378
|
void instance.close();
|
|
379
379
|
};
|
|
380
380
|
instance.addHook("onRequest", (req, reply, done) => {
|
|
381
|
-
if (
|
|
381
|
+
if (_chunkWS6QCYBRcjs.isOpsPath.call(void 0, req.url)) {
|
|
382
382
|
void reply.code(404).send();
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
@@ -393,7 +393,7 @@ async function serveApp(app, options = {}) {
|
|
|
393
393
|
process.removeListener(signal, shutdown);
|
|
394
394
|
}
|
|
395
395
|
if (ops) {
|
|
396
|
-
await
|
|
396
|
+
await _chunkWS6QCYBRcjs.closeHttpServer.call(void 0, ops);
|
|
397
397
|
}
|
|
398
398
|
});
|
|
399
399
|
await instance.register(appPlugin, { app, slowRenderMs: options.slowRenderMs });
|
|
@@ -401,18 +401,18 @@ async function serveApp(app, options = {}) {
|
|
|
401
401
|
registerAssets(instance, options.assets);
|
|
402
402
|
}
|
|
403
403
|
instance.addHook("onRequest", (req, _reply, done) => {
|
|
404
|
-
serveLog.debug(
|
|
404
|
+
serveLog.debug(`\u2192 ${req.method} ${req.url}`);
|
|
405
405
|
done();
|
|
406
406
|
});
|
|
407
407
|
instance.addHook("onResponse", (req, reply, done) => {
|
|
408
408
|
const elapsed = reply.elapsedTime.toFixed(1);
|
|
409
|
-
serveLog.info(
|
|
409
|
+
serveLog.info(`\u2190 ${String(reply.statusCode)} ${req.method} ${req.url} ${elapsed}\u043C\u0441`);
|
|
410
410
|
done();
|
|
411
411
|
});
|
|
412
412
|
try {
|
|
413
413
|
await ((_c = options.configure) == null ? void 0 : _c.call(options, instance));
|
|
414
414
|
if (options.ops !== false) {
|
|
415
|
-
ops = await
|
|
415
|
+
ops = await _chunkWS6QCYBRcjs.startOpsServer.call(void 0, options.ops);
|
|
416
416
|
}
|
|
417
417
|
await instance.listen({ host: (_d = options.host) != null ? _d : "0.0.0.0", port: (_e = options.port) != null ? _e : 8080 });
|
|
418
418
|
} catch (error) {
|
|
@@ -425,7 +425,7 @@ async function serveApp(app, options = {}) {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
serveLog.info(
|
|
428
|
-
|
|
428
|
+
`\u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \xAB${app.name}\xBB \u0441\u043B\u0443\u0448\u0430\u0435\u0442 ${instance.addresses().map((a) => String(a.port)).join(", ")}`
|
|
429
429
|
);
|
|
430
430
|
return instance;
|
|
431
431
|
}
|
package/serve/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
normalizeRoutes,
|
|
7
7
|
parseCookieHeader,
|
|
8
8
|
renderApp
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-TEVB76QF.js";
|
|
10
|
+
import "../chunk-E23E2VUC.js";
|
|
11
11
|
import "../chunk-3RX2OSUL.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getProcessMetrics,
|
|
19
19
|
isOpsPath,
|
|
20
20
|
startOpsServer
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-AE6GKDIG.js";
|
|
22
22
|
|
|
23
23
|
// src/serve/index.ts
|
|
24
24
|
import Fastify from "fastify";
|
|
@@ -46,7 +46,7 @@ var MIME = {
|
|
|
46
46
|
var HASHED_DIR = "assets/";
|
|
47
47
|
function assetsPrefix(base) {
|
|
48
48
|
const { pathname } = new URL(base, "http://assets.invalid");
|
|
49
|
-
return pathname.endsWith("/") ? pathname :
|
|
49
|
+
return pathname.endsWith("/") ? pathname : `${pathname}/`;
|
|
50
50
|
}
|
|
51
51
|
function assetFile(dir, relative) {
|
|
52
52
|
const file = path.normalize(path.join(dir, relative));
|
|
@@ -55,7 +55,7 @@ function assetFile(dir, relative) {
|
|
|
55
55
|
function registerAssets(instance, source) {
|
|
56
56
|
const dir = path.resolve(source.dir);
|
|
57
57
|
const prefix = assetsPrefix(source.base);
|
|
58
|
-
instance.get(
|
|
58
|
+
instance.get(`${prefix}*`, (request, reply) => {
|
|
59
59
|
var _a;
|
|
60
60
|
const relative = request.params["*"];
|
|
61
61
|
const file = assetFile(dir, relative);
|
|
@@ -137,8 +137,8 @@ var appPlugin = (instance, options) => {
|
|
|
137
137
|
const { pathname, search } = new URL(target, "http://localhost");
|
|
138
138
|
const params = matchClaim(app, pathname);
|
|
139
139
|
if (params === null) {
|
|
140
|
-
serveLog.error(
|
|
141
|
-
return reply.code(404).send({ error:
|
|
140
|
+
serveLog.error(`\u043F\u0443\u0442\u044C \xAB${pathname}\xBB \u0432\u043D\u0435 \u0437\u0430\u044F\u0432\u043A\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F`);
|
|
141
|
+
return reply.code(404).send({ error: `\u043F\u0443\u0442\u044C \xAB${pathname}\xBB \u0432\u043D\u0435 \u0437\u0430\u044F\u0432\u043A\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F` });
|
|
142
142
|
}
|
|
143
143
|
const startedAt = Date.now();
|
|
144
144
|
try {
|
|
@@ -151,11 +151,11 @@ var appPlugin = (instance, options) => {
|
|
|
151
151
|
});
|
|
152
152
|
const elapsed = Date.now() - startedAt;
|
|
153
153
|
if (elapsed >= slowRenderMs) {
|
|
154
|
-
serveLog.warn(
|
|
154
|
+
serveLog.warn(`\u043C\u0435\u0434\u043B\u0435\u043D\u043D\u044B\u0439 \u0440\u0435\u043D\u0434\u0435\u0440 \xAB${pathname}\xBB: ${String(elapsed)}\u043C\u0441`);
|
|
155
155
|
}
|
|
156
156
|
return result;
|
|
157
157
|
} catch (error) {
|
|
158
|
-
serveLog.error(
|
|
158
|
+
serveLog.error(`\u0440\u0435\u043D\u0434\u0435\u0440 \xAB${pathname}\xBB \u0443\u043F\u0430\u043B \u0437\u0430 ${String(Date.now() - startedAt)}\u043C\u0441`, error);
|
|
159
159
|
return reply.send(error instanceof Error ? error : new Error(String(error)));
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -336,13 +336,13 @@ async function startPrimary(appName, options, workers) {
|
|
|
336
336
|
worker.once("error", failed);
|
|
337
337
|
worker.once("exit", (code, signal) => {
|
|
338
338
|
alive.delete(worker.id);
|
|
339
|
-
failed(new Error(
|
|
339
|
+
failed(new Error(`Den worker ${String(worker.process.pid)} exited (${String(code != null ? code : signal)})`));
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
await ready;
|
|
343
343
|
started = true;
|
|
344
344
|
clearTimeout(timeout);
|
|
345
|
-
if (!closing) logger2.info(
|
|
345
|
+
if (!closing) logger2.info(`\u0437\u0430\u043F\u0443\u0449\u0435\u043D\u043E \u0432\u043E\u0440\u043A\u0435\u0440\u043E\u0432: ${String(workers)}`);
|
|
346
346
|
return { close };
|
|
347
347
|
} catch (error) {
|
|
348
348
|
await close();
|
|
@@ -401,12 +401,12 @@ async function serveApp(app, options = {}) {
|
|
|
401
401
|
registerAssets(instance, options.assets);
|
|
402
402
|
}
|
|
403
403
|
instance.addHook("onRequest", (req, _reply, done) => {
|
|
404
|
-
serveLog.debug(
|
|
404
|
+
serveLog.debug(`\u2192 ${req.method} ${req.url}`);
|
|
405
405
|
done();
|
|
406
406
|
});
|
|
407
407
|
instance.addHook("onResponse", (req, reply, done) => {
|
|
408
408
|
const elapsed = reply.elapsedTime.toFixed(1);
|
|
409
|
-
serveLog.info(
|
|
409
|
+
serveLog.info(`\u2190 ${String(reply.statusCode)} ${req.method} ${req.url} ${elapsed}\u043C\u0441`);
|
|
410
410
|
done();
|
|
411
411
|
});
|
|
412
412
|
try {
|
|
@@ -425,7 +425,7 @@ async function serveApp(app, options = {}) {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
serveLog.info(
|
|
428
|
-
|
|
428
|
+
`\u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \xAB${app.name}\xBB \u0441\u043B\u0443\u0448\u0430\u0435\u0442 ${instance.addresses().map((a) => String(a.port)).join(", ")}`
|
|
429
429
|
);
|
|
430
430
|
return instance;
|
|
431
431
|
}
|