@foxford/den 4.1.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.
@@ -9,10 +9,6 @@ import {
9
9
  logger,
10
10
  unitLogger
11
11
  } from "./chunk-TPBI6TOU.js";
12
- import {
13
- __async,
14
- __spreadValues
15
- } from "./chunk-6FNC3XMI.js";
16
12
 
17
13
  // src/island/document.ts
18
14
  function isDocumentSource(value) {
@@ -160,18 +156,16 @@ function hydrateIslandState(container, descriptor, denState) {
160
156
  }
161
157
  }
162
158
  }
163
- function activateIslandViewModels(_0, _1) {
164
- return __async(this, arguments, function* (container, descriptor, route = EMPTY_ROUTE) {
165
- var _a;
166
- yield Promise.all(
167
- ((_a = descriptor.viewModels) != null ? _a : []).map((vm) => __async(null, null, function* () {
168
- var _a2;
169
- const instance = container.resolve(vm.token);
170
- unitLogger(container, vm.token.description).debug(`\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (${route.pathname || "\u2014"})`);
171
- yield (_a2 = instance.activate) == null ? void 0 : _a2.call(instance, route);
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
+ unitLogger(container, vm.token.description).debug(`\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (${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 = __spreadValues(__spreadValues({}, contribution.head), part.head);
191
+ contribution.head = { ...contribution.head, ...part.head };
198
192
  }
199
193
  if (part.data) {
200
- contribution.data = __spreadValues(__spreadValues({}, contribution.data), part.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
- return __async(this, null, function* () {
243
- var _a, _b, _c;
244
- yield setupOnce(descriptor);
245
- const route = {
246
- params: (_a = request.params) != null ? _a : {},
247
- pathname: request.pathname,
248
- search: (_b = request.search) != null ? _b : ""
249
- };
250
- const inputs = islandInputsOf(descriptor, request.inputs);
251
- const container = createIslandContainer(descriptor, { context: request.context, inputs, parent: request.parent });
252
- if (container === null) {
253
- throw new Error(`den/island: \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \xAB${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`);
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${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
- try {
256
- yield activateIslandViewModels(container, descriptor, route);
257
- const contribution = collectDocumentContribution(container, descriptor);
258
- const { data, head, redirect, status = STATUS_OK } = contribution;
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 = __spreadValues(__spreadValues({}, 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 = resolveViewAdapter(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 = resolveViewAdapter(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
@@ -296,7 +288,7 @@ function decodeParams(groups) {
296
288
  }
297
289
  try {
298
290
  params[name] = decodeURIComponent(value);
299
- } catch (e) {
291
+ } catch {
300
292
  params[name] = value;
301
293
  }
302
294
  }
@@ -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
 
@@ -169,64 +165,60 @@ function clusterMetrics(metrics = getProcessMetrics()) {
169
165
  shutdown: () => lifecycle.shutdown()
170
166
  };
171
167
  }
172
- function startOpsServer() {
173
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, arguments, function* (options = {}) {
174
- var _a;
175
- const metrics = (_a = options.metrics) != null ? _a : getProcessMetrics();
176
- const server = _http.createServer.call(void 0, (req, res) => {
177
- var _a2, _b, _c, _d;
178
- const path = (_a2 = req.url) == null ? void 0 : _a2.split("?")[0];
179
- res.setHeader("cache-control", "no-store");
180
- if (req.method !== "GET" || !["/healthz", "/livez", "/metrics"].includes(path != null ? path : "")) {
181
- res.writeHead(404).end();
182
- return;
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
- if (path !== "/metrics") {
185
- res.writeHead(path === "/livez" && ((_b = options.isLive) == null ? void 0 : _b.call(options)) === false ? 503 : 200, {
186
- "content-type": "text/plain; charset=utf-8"
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
- yield new Promise((resolve, reject) => {
202
- var _a2, _b;
203
- server.once("error", reject);
204
- server.listen((_a2 = options.port) != null ? _a2 : 9090, (_b = options.host) != null ? _b : "0.0.0.0", () => {
205
- server.removeListener("error", reject);
206
- resolve();
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
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
214
- if (!server.listening) {
215
- return;
216
- }
217
- yield new Promise((resolve, reject) => {
218
- const timer = setTimeout(() => server.closeAllConnections(), timeoutMs);
219
- timer.unref();
220
- server.close((error) => {
221
- clearTimeout(timer);
222
- if (error) {
223
- reject(error);
224
- } else {
225
- resolve();
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
 
package/define.cjs CHANGED
@@ -14,7 +14,6 @@ var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
14
14
 
15
15
 
16
16
  var _chunkA6ZPAM6Zcjs = require('./chunk-A6ZPAM6Z.cjs');
17
- require('./chunk-T5QVCXVB.cjs');
18
17
 
19
18
 
20
19
 
package/define.js CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  logger,
15
15
  scopeLogger
16
16
  } from "./chunk-TPBI6TOU.js";
17
- import "./chunk-6FNC3XMI.js";
18
17
  export {
19
18
  LoggerToken,
20
19
  SlotRegistry,
package/index.cjs CHANGED
@@ -21,9 +21,6 @@ var _chunkXOJ2VWX4cjs = require('./chunk-XOJ2VWX4.cjs');
21
21
  var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
22
22
  require('./chunk-A6ZPAM6Z.cjs');
23
23
 
24
-
25
- var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
26
-
27
24
  // src/core/state-registry.ts
28
25
  var StateRegistry = class {
29
26
  constructor() {
@@ -94,15 +91,13 @@ var ContainerManagerImpl = class {
94
91
  * Если контейнер не найден — no-op.
95
92
  * @param routeId - Идентификатор маршрута
96
93
  */
97
- destroyPageContainer(routeId) {
98
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
99
- const container = this.pageContainers.get(routeId);
100
- if (container === void 0) {
101
- return;
102
- }
103
- this.pageContainers.delete(routeId);
104
- yield container.dispose();
105
- });
94
+ async destroyPageContainer(routeId) {
95
+ const container = this.pageContainers.get(routeId);
96
+ if (container === void 0) {
97
+ return;
98
+ }
99
+ this.pageContainers.delete(routeId);
100
+ await container.dispose();
106
101
  }
107
102
  /**
108
103
  * Создаёт дочерний контейнер для HTTP-запроса с забинженным RequestContext.
@@ -133,15 +128,13 @@ var ContainerManagerImpl = class {
133
128
  * Если контейнер не найден — no-op.
134
129
  * @param requestId - Уникальный идентификатор запроса
135
130
  */
136
- destroyRequestContainer(requestId) {
137
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
138
- const container = this.requestContainers.get(requestId);
139
- if (container === void 0) {
140
- return;
141
- }
142
- this.requestContainers.delete(requestId);
143
- yield container.dispose();
144
- });
131
+ async destroyRequestContainer(requestId) {
132
+ const container = this.requestContainers.get(requestId);
133
+ if (container === void 0) {
134
+ return;
135
+ }
136
+ this.requestContainers.delete(requestId);
137
+ await container.dispose();
145
138
  }
146
139
  /**
147
140
  * Создаёт page container для SSR как дочерний от заданного родителя.
@@ -166,15 +159,13 @@ var ContainerManagerImpl = class {
166
159
  * Если контейнер не найден — no-op.
167
160
  * @param requestId - Уникальный идентификатор запроса
168
161
  */
169
- destroySsrPageContainer(requestId) {
170
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
171
- const container = this.ssrPageContainers.get(requestId);
172
- if (container === void 0) {
173
- return;
174
- }
175
- this.ssrPageContainers.delete(requestId);
176
- yield container.dispose();
177
- });
162
+ async destroySsrPageContainer(requestId) {
163
+ const container = this.ssrPageContainers.get(requestId);
164
+ if (container === void 0) {
165
+ return;
166
+ }
167
+ this.ssrPageContainers.delete(requestId);
168
+ await container.dispose();
178
169
  }
179
170
  };
180
171
 
@@ -194,17 +185,15 @@ var GuardRunnerImpl = class {
194
185
  * @param params - Параметры маршрута
195
186
  * @param container - Опциональный контейнер для резолвинга guards
196
187
  */
197
- runGuards(tokens, params, container) {
198
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
199
- const resolveFrom = container != null ? container : this.container;
200
- const results = yield Promise.all(
201
- tokens.map((token) => _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
202
- const guard = yield resolveFrom.resolve(token);
203
- return guard.check(params);
204
- }))
205
- );
206
- return results;
207
- });
188
+ async runGuards(tokens, params, container) {
189
+ const resolveFrom = container != null ? container : this.container;
190
+ const results = await Promise.all(
191
+ tokens.map(async (token) => {
192
+ const guard = await resolveFrom.resolve(token);
193
+ return guard.check(params);
194
+ })
195
+ );
196
+ return results;
208
197
  }
209
198
  };
210
199
 
@@ -286,12 +275,10 @@ var NavigationManagerImpl = class {
286
275
  * Проверяет актуальность текущего состояния.
287
276
  * Состояние считается актуальным если история и текущий элемент согласованы.
288
277
  */
289
- checkFreshness() {
290
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
291
- var _a;
292
- const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
293
- return lastEntry === this.current;
294
- });
278
+ async checkFreshness() {
279
+ var _a;
280
+ const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
281
+ return lastEntry === this.current;
295
282
  }
296
283
  /**
297
284
  * Регистрирует interceptor для перехвата навигации (leave guard).
@@ -316,16 +303,14 @@ var NavigationManagerImpl = class {
316
303
  * @param to - Маршрут назначения
317
304
  * @returns Результат проверки
318
305
  */
319
- runLeaveGuards(from, to) {
320
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
321
- for (const interceptor of this.interceptors) {
322
- const result = yield interceptor.beforeNavigate(from, to);
323
- if (!result.allow) {
324
- return { allow: false, reason: result.reason };
325
- }
306
+ async runLeaveGuards(from, to) {
307
+ for (const interceptor of this.interceptors) {
308
+ const result = await interceptor.beforeNavigate(from, to);
309
+ if (!result.allow) {
310
+ return { allow: false, reason: result.reason };
326
311
  }
327
- return { allow: true };
328
- });
312
+ }
313
+ return { allow: true };
329
314
  }
330
315
  /**
331
316
  * Инициализирует обработчики браузерных событий навигации.
@@ -462,17 +447,15 @@ var StateSerializerImpl = class {
462
447
  * @param container - Контейнер, участники которого активируются
463
448
  * @param params - Параметры маршрута
464
449
  */
465
- activateAll(container, params) {
466
- return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
467
- const registry = this.getRegistry(container);
468
- if (registry === void 0) {
469
- return;
470
- }
471
- yield Promise.all([...registry.all().values()].map((participant) => {
472
- var _a;
473
- return (_a = participant.activate) == null ? void 0 : _a.call(participant, params);
474
- }));
475
- });
450
+ async activateAll(container, params) {
451
+ const registry = this.getRegistry(container);
452
+ if (registry === void 0) {
453
+ return;
454
+ }
455
+ await Promise.all([...registry.all().values()].map((participant) => {
456
+ var _a;
457
+ return (_a = participant.activate) == null ? void 0 : _a.call(participant, params);
458
+ }));
476
459
  }
477
460
  };
478
461
 
package/index.js CHANGED
@@ -20,9 +20,6 @@ import {
20
20
  StateSerializerToken
21
21
  } from "./chunk-3RX2OSUL.js";
22
22
  import "./chunk-TPBI6TOU.js";
23
- import {
24
- __async
25
- } from "./chunk-6FNC3XMI.js";
26
23
 
27
24
  // src/core/state-registry.ts
28
25
  var StateRegistry = class {
@@ -94,15 +91,13 @@ var ContainerManagerImpl = class {
94
91
  * Если контейнер не найден — no-op.
95
92
  * @param routeId - Идентификатор маршрута
96
93
  */
97
- destroyPageContainer(routeId) {
98
- return __async(this, null, function* () {
99
- const container = this.pageContainers.get(routeId);
100
- if (container === void 0) {
101
- return;
102
- }
103
- this.pageContainers.delete(routeId);
104
- yield container.dispose();
105
- });
94
+ async destroyPageContainer(routeId) {
95
+ const container = this.pageContainers.get(routeId);
96
+ if (container === void 0) {
97
+ return;
98
+ }
99
+ this.pageContainers.delete(routeId);
100
+ await container.dispose();
106
101
  }
107
102
  /**
108
103
  * Создаёт дочерний контейнер для HTTP-запроса с забинженным RequestContext.
@@ -133,15 +128,13 @@ var ContainerManagerImpl = class {
133
128
  * Если контейнер не найден — no-op.
134
129
  * @param requestId - Уникальный идентификатор запроса
135
130
  */
136
- destroyRequestContainer(requestId) {
137
- return __async(this, null, function* () {
138
- const container = this.requestContainers.get(requestId);
139
- if (container === void 0) {
140
- return;
141
- }
142
- this.requestContainers.delete(requestId);
143
- yield container.dispose();
144
- });
131
+ async destroyRequestContainer(requestId) {
132
+ const container = this.requestContainers.get(requestId);
133
+ if (container === void 0) {
134
+ return;
135
+ }
136
+ this.requestContainers.delete(requestId);
137
+ await container.dispose();
145
138
  }
146
139
  /**
147
140
  * Создаёт page container для SSR как дочерний от заданного родителя.
@@ -166,15 +159,13 @@ var ContainerManagerImpl = class {
166
159
  * Если контейнер не найден — no-op.
167
160
  * @param requestId - Уникальный идентификатор запроса
168
161
  */
169
- destroySsrPageContainer(requestId) {
170
- return __async(this, null, function* () {
171
- const container = this.ssrPageContainers.get(requestId);
172
- if (container === void 0) {
173
- return;
174
- }
175
- this.ssrPageContainers.delete(requestId);
176
- yield container.dispose();
177
- });
162
+ async destroySsrPageContainer(requestId) {
163
+ const container = this.ssrPageContainers.get(requestId);
164
+ if (container === void 0) {
165
+ return;
166
+ }
167
+ this.ssrPageContainers.delete(requestId);
168
+ await container.dispose();
178
169
  }
179
170
  };
180
171
 
@@ -194,17 +185,15 @@ var GuardRunnerImpl = class {
194
185
  * @param params - Параметры маршрута
195
186
  * @param container - Опциональный контейнер для резолвинга guards
196
187
  */
197
- runGuards(tokens, params, container) {
198
- return __async(this, null, function* () {
199
- const resolveFrom = container != null ? container : this.container;
200
- const results = yield Promise.all(
201
- tokens.map((token) => __async(this, null, function* () {
202
- const guard = yield resolveFrom.resolve(token);
203
- return guard.check(params);
204
- }))
205
- );
206
- return results;
207
- });
188
+ async runGuards(tokens, params, container) {
189
+ const resolveFrom = container != null ? container : this.container;
190
+ const results = await Promise.all(
191
+ tokens.map(async (token) => {
192
+ const guard = await resolveFrom.resolve(token);
193
+ return guard.check(params);
194
+ })
195
+ );
196
+ return results;
208
197
  }
209
198
  };
210
199
 
@@ -286,12 +275,10 @@ var NavigationManagerImpl = class {
286
275
  * Проверяет актуальность текущего состояния.
287
276
  * Состояние считается актуальным если история и текущий элемент согласованы.
288
277
  */
289
- checkFreshness() {
290
- return __async(this, null, function* () {
291
- var _a;
292
- const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
293
- return lastEntry === this.current;
294
- });
278
+ async checkFreshness() {
279
+ var _a;
280
+ const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
281
+ return lastEntry === this.current;
295
282
  }
296
283
  /**
297
284
  * Регистрирует interceptor для перехвата навигации (leave guard).
@@ -316,16 +303,14 @@ var NavigationManagerImpl = class {
316
303
  * @param to - Маршрут назначения
317
304
  * @returns Результат проверки
318
305
  */
319
- runLeaveGuards(from, to) {
320
- return __async(this, null, function* () {
321
- for (const interceptor of this.interceptors) {
322
- const result = yield interceptor.beforeNavigate(from, to);
323
- if (!result.allow) {
324
- return { allow: false, reason: result.reason };
325
- }
306
+ async runLeaveGuards(from, to) {
307
+ for (const interceptor of this.interceptors) {
308
+ const result = await interceptor.beforeNavigate(from, to);
309
+ if (!result.allow) {
310
+ return { allow: false, reason: result.reason };
326
311
  }
327
- return { allow: true };
328
- });
312
+ }
313
+ return { allow: true };
329
314
  }
330
315
  /**
331
316
  * Инициализирует обработчики браузерных событий навигации.
@@ -378,7 +363,7 @@ var NavigationManagerImpl = class {
378
363
  let url;
379
364
  try {
380
365
  url = new URL(href);
381
- } catch (e) {
366
+ } catch {
382
367
  return;
383
368
  }
384
369
  if (url.origin !== window.location.origin) return;
@@ -462,17 +447,15 @@ var StateSerializerImpl = class {
462
447
  * @param container - Контейнер, участники которого активируются
463
448
  * @param params - Параметры маршрута
464
449
  */
465
- activateAll(container, params) {
466
- return __async(this, null, function* () {
467
- const registry = this.getRegistry(container);
468
- if (registry === void 0) {
469
- return;
470
- }
471
- yield Promise.all([...registry.all().values()].map((participant) => {
472
- var _a;
473
- return (_a = participant.activate) == null ? void 0 : _a.call(participant, params);
474
- }));
475
- });
450
+ async activateAll(container, params) {
451
+ const registry = this.getRegistry(container);
452
+ if (registry === void 0) {
453
+ return;
454
+ }
455
+ await Promise.all([...registry.all().values()].map((participant) => {
456
+ var _a;
457
+ return (_a = participant.activate) == null ? void 0 : _a.call(participant, params);
458
+ }));
476
459
  }
477
460
  };
478
461