@foxford/den 4.1.0 → 4.2.0
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/README.mdx +13 -0
- package/adapter.cjs +2 -3
- package/adapter.js +1 -2
- package/bin/den.cjs +31 -51
- package/bin/den.js +31 -51
- package/builder/index.cjs +2 -3
- package/builder/index.d.cts +3 -2
- package/builder/index.d.ts +3 -2
- package/builder/index.js +1 -2
- package/{chunk-E56BKBQZ.js → chunk-AS6ZNCUY.js} +7 -7
- package/{chunk-H5DKRHHQ.cjs → chunk-BFRLBMH2.cjs} +8 -8
- package/chunk-ETO2T2TA.cjs +503 -0
- package/{chunk-E23E2VUC.js → chunk-HWDDAFGV.js} +1 -1
- package/{chunk-XQ7EHXHG.js → chunk-JW24N6O4.js} +47 -55
- package/{chunk-HJFBEJT6.cjs → chunk-MH2WIOTQ.cjs} +50 -58
- package/{chunk-XOJ2VWX4.cjs → chunk-MWDNN7Q4.cjs} +1 -1
- package/{chunk-QTWJTYZW.cjs → chunk-NOI7FSBX.cjs} +47 -55
- package/{chunk-A2CYL5LY.js → chunk-VCIMVMHG.js} +49 -57
- package/{chunk-WBHHHICS.js → chunk-WKCIOQOY.js} +1 -1
- package/{chunk-C7BM4DGX.cjs → chunk-Y7DGFJFA.cjs} +1 -1
- package/chunk-YWWRJMWN.js +503 -0
- package/define.cjs +3 -4
- package/define.js +2 -3
- package/index.cjs +54 -71
- package/index.js +53 -70
- package/island/index.cjs +5 -8
- package/island/index.js +4 -7
- package/ops/index.cjs +2 -3
- package/ops/index.js +1 -2
- package/package.json +17 -18
- package/serve/index.cjs +260 -273
- package/serve/index.js +257 -270
- package/chunk-6FNC3XMI.js +0 -45
- package/chunk-7FOG2MJV.js +0 -559
- package/chunk-IATA5QZ7.cjs +0 -559
- package/chunk-T5QVCXVB.cjs +0 -45
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
-
|
|
3
|
-
var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
|
|
4
|
-
|
|
5
|
-
// src/ops/index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/ops/index.ts
|
|
6
2
|
var _http = require('http');
|
|
7
3
|
var _client = require('@prometheus-io/client');
|
|
8
4
|
|
|
@@ -83,8 +79,8 @@ function collectRuntime(registry, appName) {
|
|
|
83
79
|
collect() {
|
|
84
80
|
this.set(process.resourceUsage()[field]);
|
|
85
81
|
},
|
|
86
|
-
help:
|
|
87
|
-
name:
|
|
82
|
+
help: "Process ".concat(name, " since startup"),
|
|
83
|
+
name: "process_".concat(name, "_total"),
|
|
88
84
|
registers: [registry]
|
|
89
85
|
});
|
|
90
86
|
}
|
|
@@ -169,64 +165,60 @@ function clusterMetrics(metrics = getProcessMetrics()) {
|
|
|
169
165
|
shutdown: () => lifecycle.shutdown()
|
|
170
166
|
};
|
|
171
167
|
}
|
|
172
|
-
function startOpsServer() {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
168
|
+
async function startOpsServer(options = {}) {
|
|
169
|
+
var _a;
|
|
170
|
+
const metrics = (_a = options.metrics) != null ? _a : getProcessMetrics();
|
|
171
|
+
const server = _http.createServer.call(void 0, (req, res) => {
|
|
172
|
+
var _a2, _b, _c, _d;
|
|
173
|
+
const path = (_a2 = req.url) == null ? void 0 : _a2.split("?")[0];
|
|
174
|
+
res.setHeader("cache-control", "no-store");
|
|
175
|
+
if (req.method !== "GET" || !["/healthz", "/livez", "/metrics"].includes(path != null ? path : "")) {
|
|
176
|
+
res.writeHead(404).end();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (path !== "/metrics") {
|
|
180
|
+
res.writeHead(path === "/livez" && ((_b = options.isLive) == null ? void 0 : _b.call(options)) === false ? 503 : 200, {
|
|
181
|
+
"content-type": "text/plain; charset=utf-8"
|
|
182
|
+
}).end("ok");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
void ((_d = (_c = options.collect) == null ? void 0 : _c.call(options)) != null ? _d : metrics.registry.metrics()).then((body) => {
|
|
186
|
+
var _a3;
|
|
187
|
+
if (!res.destroyed) {
|
|
188
|
+
res.writeHead(200, { "content-type": (_a3 = options.contentType) != null ? _a3 : metrics.registry.contentType }).end(body);
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}).end("ok");
|
|
188
|
-
return;
|
|
190
|
+
}).catch(() => {
|
|
191
|
+
if (!res.destroyed) {
|
|
192
|
+
res.writeHead(503).end("metrics unavailable");
|
|
189
193
|
}
|
|
190
|
-
void ((_d = (_c = options.collect) == null ? void 0 : _c.call(options)) != null ? _d : metrics.registry.metrics()).then((body) => {
|
|
191
|
-
var _a3;
|
|
192
|
-
if (!res.destroyed) {
|
|
193
|
-
res.writeHead(200, { "content-type": (_a3 = options.contentType) != null ? _a3 : metrics.registry.contentType }).end(body);
|
|
194
|
-
}
|
|
195
|
-
}).catch(() => {
|
|
196
|
-
if (!res.destroyed) {
|
|
197
|
-
res.writeHead(503).end("metrics unavailable");
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
194
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
195
|
+
});
|
|
196
|
+
await new Promise((resolve, reject) => {
|
|
197
|
+
var _a2, _b;
|
|
198
|
+
server.once("error", reject);
|
|
199
|
+
server.listen((_a2 = options.port) != null ? _a2 : 9090, (_b = options.host) != null ? _b : "0.0.0.0", () => {
|
|
200
|
+
server.removeListener("error", reject);
|
|
201
|
+
resolve();
|
|
208
202
|
});
|
|
209
|
-
return server;
|
|
210
203
|
});
|
|
204
|
+
return server;
|
|
211
205
|
}
|
|
212
|
-
function closeHttpServer(server, timeoutMs = 5e3) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
server.closeIdleConnections();
|
|
206
|
+
async function closeHttpServer(server, timeoutMs = 5e3) {
|
|
207
|
+
if (!server.listening) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
await new Promise((resolve, reject) => {
|
|
211
|
+
const timer = setTimeout(() => server.closeAllConnections(), timeoutMs);
|
|
212
|
+
timer.unref();
|
|
213
|
+
server.close((error) => {
|
|
214
|
+
clearTimeout(timer);
|
|
215
|
+
if (error) {
|
|
216
|
+
reject(error);
|
|
217
|
+
} else {
|
|
218
|
+
resolve();
|
|
219
|
+
}
|
|
229
220
|
});
|
|
221
|
+
server.closeIdleConnections();
|
|
230
222
|
});
|
|
231
223
|
}
|
|
232
224
|
|
|
@@ -14,7 +14,7 @@ function viewAdapterOf(layer) {
|
|
|
14
14
|
function adapterOfConfig(config) {
|
|
15
15
|
if (!isViewAdapter(config.adapter)) {
|
|
16
16
|
throw new Error(
|
|
17
|
-
|
|
17
|
+
"den/island: view-\u0441\u043B\u043E\u0439 \xAB".concat(config.name, "\xBB \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u0431\u0435\u0437 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430 \u2014 ") + "\u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F ViewAdapter (type + createIsland + renderIsland + installResolver), \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 reactAdapter()"
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
return config.adapter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMWDNN7Q4cjs = require('./chunk-MWDNN7Q4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
|
|
@@ -10,10 +10,6 @@ var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
|
|
|
10
10
|
|
|
11
11
|
var _chunkA6ZPAM6Zcjs = require('./chunk-A6ZPAM6Z.cjs');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
|
|
16
|
-
|
|
17
13
|
// src/island/document.ts
|
|
18
14
|
function isDocumentSource(value) {
|
|
19
15
|
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
@@ -39,7 +35,7 @@ function installRuntime(container, extensions) {
|
|
|
39
35
|
unit.register(container);
|
|
40
36
|
}
|
|
41
37
|
installed.push(extension);
|
|
42
|
-
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug(
|
|
38
|
+
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug("\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u0440\u0430\u043D\u0442\u0430\u0439\u043C\u0430 \xAB".concat(extension.name, "\xBB \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E"));
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
function bindInstalled(container) {
|
|
@@ -120,7 +116,7 @@ function registerIslandParts(container, descriptor, islandLog) {
|
|
|
120
116
|
const viewModels = (_b = descriptor.viewModels) != null ? _b : [];
|
|
121
117
|
const slots = Object.entries((_c = descriptor.slots) != null ? _c : {});
|
|
122
118
|
islandLog.info(
|
|
123
|
-
|
|
119
|
+
"\u043E\u0441\u0442\u0440\u043E\u0432: \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D (units=".concat(descriptor.units.length, ", vms=").concat(viewModels.length, ", slots=").concat(slots.length, ")")
|
|
124
120
|
);
|
|
125
121
|
for (const unit of descriptor.units) {
|
|
126
122
|
unit.register(container);
|
|
@@ -160,18 +156,16 @@ function hydrateIslandState(container, descriptor, denState) {
|
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
}
|
|
163
|
-
function activateIslandViewModels(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
);
|
|
174
|
-
});
|
|
159
|
+
async function activateIslandViewModels(container, descriptor, route = EMPTY_ROUTE) {
|
|
160
|
+
var _a;
|
|
161
|
+
await Promise.all(
|
|
162
|
+
((_a = descriptor.viewModels) != null ? _a : []).map(async (vm) => {
|
|
163
|
+
var _a2;
|
|
164
|
+
const instance = container.resolve(vm.token);
|
|
165
|
+
_chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, vm.token.description).debug("\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (".concat(route.pathname || "\u2014", ")"));
|
|
166
|
+
await ((_a2 = instance.activate) == null ? void 0 : _a2.call(instance, route));
|
|
167
|
+
})
|
|
168
|
+
);
|
|
175
169
|
}
|
|
176
170
|
function collectIslandState(container, descriptor) {
|
|
177
171
|
var _a, _b;
|
|
@@ -194,10 +188,10 @@ function collectDocumentContribution(container, descriptor) {
|
|
|
194
188
|
}
|
|
195
189
|
const part = instance.describeDocument();
|
|
196
190
|
if (part.head) {
|
|
197
|
-
contribution.head =
|
|
191
|
+
contribution.head = { ...contribution.head, ...part.head };
|
|
198
192
|
}
|
|
199
193
|
if (part.data) {
|
|
200
|
-
contribution.data =
|
|
194
|
+
contribution.data = { ...contribution.data, ...part.data };
|
|
201
195
|
}
|
|
202
196
|
if (part.assets && contribution.assets === void 0) {
|
|
203
197
|
contribution.assets = part.assets;
|
|
@@ -238,41 +232,39 @@ function setupOnce(descriptor) {
|
|
|
238
232
|
}
|
|
239
233
|
return started;
|
|
240
234
|
}
|
|
241
|
-
function renderApp(descriptor, request) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
235
|
+
async function renderApp(descriptor, request) {
|
|
236
|
+
var _a, _b, _c;
|
|
237
|
+
await setupOnce(descriptor);
|
|
238
|
+
const route = {
|
|
239
|
+
params: (_a = request.params) != null ? _a : {},
|
|
240
|
+
pathname: request.pathname,
|
|
241
|
+
search: (_b = request.search) != null ? _b : ""
|
|
242
|
+
};
|
|
243
|
+
const inputs = islandInputsOf(descriptor, request.inputs);
|
|
244
|
+
const container = createIslandContainer(descriptor, { context: request.context, inputs, parent: request.parent });
|
|
245
|
+
if (container === null) {
|
|
246
|
+
throw new Error("den/island: \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \xAB".concat(descriptor.name, "\xBB \u043D\u0435 \u0441\u043E\u0431\u0440\u0430\u043B\u043E\u0441\u044C \u2014 \u0440\u0435\u043D\u0434\u0435\u0440 \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u0435\u043D"));
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
await activateIslandViewModels(container, descriptor, route);
|
|
250
|
+
const contribution = collectDocumentContribution(container, descriptor);
|
|
251
|
+
const { data, head, redirect, status = STATUS_OK } = contribution;
|
|
252
|
+
if (status !== STATUS_OK) {
|
|
253
|
+
return { data, head, html: "", redirect, state: {}, status };
|
|
254
254
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (status !== STATUS_OK) {
|
|
260
|
-
return { data, head, html: "", redirect, state: {}, status };
|
|
261
|
-
}
|
|
262
|
-
const assets = (_c = contribution.assets) != null ? _c : descriptor.assets;
|
|
263
|
-
const state = _chunkT5QVCXVBcjs.__spreadValues.call(void 0, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, {}, inputs), collectIslandState(container, descriptor));
|
|
264
|
-
if (descriptor.view === void 0 || descriptor.viewLayer === void 0) {
|
|
265
|
-
return { assets, data, head, html: "", state, status };
|
|
266
|
-
}
|
|
267
|
-
const rendered = _chunkXOJ2VWX4cjs.resolveViewAdapter.call(void 0, container).renderIsland(descriptor, {
|
|
268
|
-
container,
|
|
269
|
-
slots: request.slots
|
|
270
|
-
});
|
|
271
|
-
return { assets, data, head, headHtml: rendered.head, html: rendered.html, state, status };
|
|
272
|
-
} finally {
|
|
273
|
-
yield container.dispose();
|
|
255
|
+
const assets = (_c = contribution.assets) != null ? _c : descriptor.assets;
|
|
256
|
+
const state = { ...inputs, ...collectIslandState(container, descriptor) };
|
|
257
|
+
if (descriptor.view === void 0 || descriptor.viewLayer === void 0) {
|
|
258
|
+
return { assets, data, head, html: "", state, status };
|
|
274
259
|
}
|
|
275
|
-
|
|
260
|
+
const rendered = _chunkMWDNN7Q4cjs.resolveViewAdapter.call(void 0, container).renderIsland(descriptor, {
|
|
261
|
+
container,
|
|
262
|
+
slots: request.slots
|
|
263
|
+
});
|
|
264
|
+
return { assets, data, head, headHtml: rendered.head, html: rendered.html, state, status };
|
|
265
|
+
} finally {
|
|
266
|
+
await container.dispose();
|
|
267
|
+
}
|
|
276
268
|
}
|
|
277
269
|
|
|
278
270
|
// src/island/routes.ts
|
|
@@ -305,7 +297,7 @@ function decodeParams(groups) {
|
|
|
305
297
|
var REGEXP_SPECIALS = /[.*+?^${}()|[\]\\]/g;
|
|
306
298
|
var PARAM_SEGMENT = /\/:([A-Za-z_$][\w$]*)/g;
|
|
307
299
|
function pathPattern(pattern) {
|
|
308
|
-
return
|
|
300
|
+
return "^".concat(pattern.replace(REGEXP_SPECIALS, "\\$&").replace(PARAM_SEGMENT, "/(?<$1>[^/]+)"), "$");
|
|
309
301
|
}
|
|
310
302
|
|
|
311
303
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async
|
|
3
|
-
} from "./chunk-6FNC3XMI.js";
|
|
4
|
-
|
|
5
1
|
// src/ops/index.ts
|
|
6
2
|
import { createServer } from "http";
|
|
7
3
|
import { ClusterRegistry } from "@prometheus-io/client";
|
|
@@ -83,8 +79,8 @@ function collectRuntime(registry, appName) {
|
|
|
83
79
|
collect() {
|
|
84
80
|
this.set(process.resourceUsage()[field]);
|
|
85
81
|
},
|
|
86
|
-
help:
|
|
87
|
-
name:
|
|
82
|
+
help: "Process ".concat(name, " since startup"),
|
|
83
|
+
name: "process_".concat(name, "_total"),
|
|
88
84
|
registers: [registry]
|
|
89
85
|
});
|
|
90
86
|
}
|
|
@@ -169,64 +165,60 @@ function clusterMetrics(metrics = getProcessMetrics()) {
|
|
|
169
165
|
shutdown: () => lifecycle.shutdown()
|
|
170
166
|
};
|
|
171
167
|
}
|
|
172
|
-
function startOpsServer() {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
168
|
+
async function startOpsServer(options = {}) {
|
|
169
|
+
var _a;
|
|
170
|
+
const metrics = (_a = options.metrics) != null ? _a : getProcessMetrics();
|
|
171
|
+
const server = createServer((req, res) => {
|
|
172
|
+
var _a2, _b, _c, _d;
|
|
173
|
+
const path = (_a2 = req.url) == null ? void 0 : _a2.split("?")[0];
|
|
174
|
+
res.setHeader("cache-control", "no-store");
|
|
175
|
+
if (req.method !== "GET" || !["/healthz", "/livez", "/metrics"].includes(path != null ? path : "")) {
|
|
176
|
+
res.writeHead(404).end();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (path !== "/metrics") {
|
|
180
|
+
res.writeHead(path === "/livez" && ((_b = options.isLive) == null ? void 0 : _b.call(options)) === false ? 503 : 200, {
|
|
181
|
+
"content-type": "text/plain; charset=utf-8"
|
|
182
|
+
}).end("ok");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
void ((_d = (_c = options.collect) == null ? void 0 : _c.call(options)) != null ? _d : metrics.registry.metrics()).then((body) => {
|
|
186
|
+
var _a3;
|
|
187
|
+
if (!res.destroyed) {
|
|
188
|
+
res.writeHead(200, { "content-type": (_a3 = options.contentType) != null ? _a3 : metrics.registry.contentType }).end(body);
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}).end("ok");
|
|
188
|
-
return;
|
|
190
|
+
}).catch(() => {
|
|
191
|
+
if (!res.destroyed) {
|
|
192
|
+
res.writeHead(503).end("metrics unavailable");
|
|
189
193
|
}
|
|
190
|
-
void ((_d = (_c = options.collect) == null ? void 0 : _c.call(options)) != null ? _d : metrics.registry.metrics()).then((body) => {
|
|
191
|
-
var _a3;
|
|
192
|
-
if (!res.destroyed) {
|
|
193
|
-
res.writeHead(200, { "content-type": (_a3 = options.contentType) != null ? _a3 : metrics.registry.contentType }).end(body);
|
|
194
|
-
}
|
|
195
|
-
}).catch(() => {
|
|
196
|
-
if (!res.destroyed) {
|
|
197
|
-
res.writeHead(503).end("metrics unavailable");
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
194
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
195
|
+
});
|
|
196
|
+
await new Promise((resolve, reject) => {
|
|
197
|
+
var _a2, _b;
|
|
198
|
+
server.once("error", reject);
|
|
199
|
+
server.listen((_a2 = options.port) != null ? _a2 : 9090, (_b = options.host) != null ? _b : "0.0.0.0", () => {
|
|
200
|
+
server.removeListener("error", reject);
|
|
201
|
+
resolve();
|
|
208
202
|
});
|
|
209
|
-
return server;
|
|
210
203
|
});
|
|
204
|
+
return server;
|
|
211
205
|
}
|
|
212
|
-
function closeHttpServer(server, timeoutMs = 5e3) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
server.closeIdleConnections();
|
|
206
|
+
async function closeHttpServer(server, timeoutMs = 5e3) {
|
|
207
|
+
if (!server.listening) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
await new Promise((resolve, reject) => {
|
|
211
|
+
const timer = setTimeout(() => server.closeAllConnections(), timeoutMs);
|
|
212
|
+
timer.unref();
|
|
213
|
+
server.close((error) => {
|
|
214
|
+
clearTimeout(timer);
|
|
215
|
+
if (error) {
|
|
216
|
+
reject(error);
|
|
217
|
+
} else {
|
|
218
|
+
resolve();
|
|
219
|
+
}
|
|
229
220
|
});
|
|
221
|
+
server.closeIdleConnections();
|
|
230
222
|
});
|
|
231
223
|
}
|
|
232
224
|
|
|
@@ -6,7 +6,7 @@ function installResolver(resolver) {
|
|
|
6
6
|
function resolveDefinition(token) {
|
|
7
7
|
if (activeResolver === null) {
|
|
8
8
|
throw new Error(
|
|
9
|
-
|
|
9
|
+
"den/adapter: \u0440\u0435\u0437\u043E\u043B\u0432\u0435\u0440 \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0434\u043B\u044F \xAB".concat(token.description, "\xBB \u2014 ") + "\u043D\u0438 \u043E\u0434\u0438\u043D host-\u0430\u0434\u0430\u043F\u0442\u0435\u0440 \u043D\u0435 \u0432\u044B\u0437\u0432\u0430\u043B installResolver()"
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
return activeResolver(token);
|
|
@@ -6,7 +6,7 @@ function installResolver(resolver) {
|
|
|
6
6
|
function resolveDefinition(token) {
|
|
7
7
|
if (activeResolver === null) {
|
|
8
8
|
throw new Error(
|
|
9
|
-
|
|
9
|
+
"den/adapter: \u0440\u0435\u0437\u043E\u043B\u0432\u0435\u0440 \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0434\u043B\u044F \xAB".concat(token.description, "\xBB \u2014 ") + "\u043D\u0438 \u043E\u0434\u0438\u043D host-\u0430\u0434\u0430\u043F\u0442\u0435\u0440 \u043D\u0435 \u0432\u044B\u0437\u0432\u0430\u043B installResolver()"
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
return activeResolver(token);
|