@foxford/den 3.0.0 → 3.1.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/README.mdx +266 -2
- package/adapter.cjs +1 -1
- package/adapter.d.cts +1 -1
- package/adapter.d.ts +1 -1
- package/adapter.js +1 -1
- package/bin/den.cjs +88 -0
- package/bin/den.d.cts +2 -0
- package/bin/den.d.ts +2 -0
- package/bin/den.js +88 -0
- package/builder/index.cjs +12 -0
- package/builder/index.d.cts +120 -0
- package/builder/index.d.ts +120 -0
- package/builder/index.js +12 -0
- package/chunk-3RX2OSUL.js +21 -0
- package/{chunk-HJO26HIQ.js → chunk-6FNC3XMI.js} +4 -0
- package/chunk-6QV4L6R2.cjs +21 -0
- package/{chunk-WRQC6BVJ.js → chunk-MCN4GFEQ.js} +4 -19
- package/chunk-OKRO4G4L.cjs +354 -0
- package/chunk-REFU7UMG.js +354 -0
- package/{chunk-XHYR3SGG.cjs → chunk-T5QVCXVB.cjs} +5 -1
- package/chunk-TPHJUDHG.js +230 -0
- package/{chunk-5DJZZML5.cjs → chunk-Z5BL4DJA.cjs} +10 -25
- package/chunk-ZOU6W6ZQ.cjs +230 -0
- package/{define-repository-MDEWHqM7.d.cts → define-repository-CwAXed2X.d.cts} +1 -1
- package/{define-repository-Ca62_YCy.d.ts → define-repository-q_T4hqeP.d.ts} +1 -1
- package/{define-slot-Dil8Kr1A.d.ts → define-slot-Cngzae6i.d.ts} +1 -1
- package/{define-slot-BKvArA02.d.cts → define-slot-DYNCLDJY.d.cts} +1 -1
- package/define.cjs +6 -4
- package/define.d.cts +3 -3
- package/define.d.ts +3 -3
- package/define.js +5 -3
- package/den.js +60 -0
- package/descriptor-DQ6Gi7A_.d.ts +98 -0
- package/descriptor-Dujg_1on.d.cts +98 -0
- package/index.cjs +25 -23
- package/index.d.cts +7 -5
- package/index.d.ts +7 -5
- package/index.js +12 -10
- package/island/index.cjs +12 -157
- package/island/index.d.cts +40 -30
- package/island/index.d.ts +40 -30
- package/island/index.js +19 -164
- package/package.json +59 -16
- package/routes-0uXJ0fux.d.ts +64 -0
- package/routes-B0hDrkiF.d.cts +64 -0
- package/serve/index.cjs +137 -0
- package/serve/index.d.cts +60 -0
- package/serve/index.d.ts +60 -0
- package/serve/index.js +137 -0
- package/server-render-CocWXQKC.d.cts +48 -0
- package/server-render-CocWXQKC.d.ts +48 -0
- package/{types-COwVwgzE.d.cts → types-Dx5qGiwk.d.cts} +1 -1
- package/{types-COwVwgzE.d.ts → types-Dx5qGiwk.d.ts} +1 -1
- package/view-adapter-B4gEb-ms.d.ts +77 -0
- package/view-adapter-DJ7yB6Ml.d.cts +77 -0
- package/view-adapter-BvDC5O4y.d.cts +0 -188
- package/view-adapter-DtNgyjIf.d.ts +0 -188
package/index.cjs
CHANGED
|
@@ -4,23 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkZ5BL4DJAcjs = require('./chunk-Z5BL4DJA.cjs');
|
|
8
|
+
require('./chunk-C7BM4DGX.cjs');
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
var _chunkXOJ2VWX4cjs = require('./chunk-XOJ2VWX4.cjs');
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
var _chunk5DJZZML5cjs = require('./chunk-5DJZZML5.cjs');
|
|
16
|
-
require('./chunk-C7BM4DGX.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
|
|
20
22
|
require('./chunk-A6ZPAM6Z.cjs');
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
var
|
|
25
|
+
var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
|
|
24
26
|
|
|
25
27
|
// src/core/state-registry.ts
|
|
26
28
|
var StateRegistry = class {
|
|
@@ -83,7 +85,7 @@ var ContainerManagerImpl = class {
|
|
|
83
85
|
return existing;
|
|
84
86
|
}
|
|
85
87
|
const child = this.appContainer.createChild();
|
|
86
|
-
child.bind(
|
|
88
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
87
89
|
this.pageContainers.set(routeId, child);
|
|
88
90
|
return child;
|
|
89
91
|
}
|
|
@@ -93,7 +95,7 @@ var ContainerManagerImpl = class {
|
|
|
93
95
|
* @param routeId - Идентификатор маршрута
|
|
94
96
|
*/
|
|
95
97
|
destroyPageContainer(routeId) {
|
|
96
|
-
return
|
|
98
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
97
99
|
const container = this.pageContainers.get(routeId);
|
|
98
100
|
if (container === void 0) {
|
|
99
101
|
return;
|
|
@@ -114,8 +116,8 @@ var ContainerManagerImpl = class {
|
|
|
114
116
|
return existing;
|
|
115
117
|
}
|
|
116
118
|
const child = this.appContainer.createChild();
|
|
117
|
-
child.bind(
|
|
118
|
-
child.bind(
|
|
119
|
+
child.bind(_chunk6QV4L6R2cjs.RequestContextToken).toValue(context);
|
|
120
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
119
121
|
this.requestContainers.set(requestId, child);
|
|
120
122
|
return child;
|
|
121
123
|
}
|
|
@@ -132,7 +134,7 @@ var ContainerManagerImpl = class {
|
|
|
132
134
|
* @param requestId - Уникальный идентификатор запроса
|
|
133
135
|
*/
|
|
134
136
|
destroyRequestContainer(requestId) {
|
|
135
|
-
return
|
|
137
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
136
138
|
const container = this.requestContainers.get(requestId);
|
|
137
139
|
if (container === void 0) {
|
|
138
140
|
return;
|
|
@@ -154,7 +156,7 @@ var ContainerManagerImpl = class {
|
|
|
154
156
|
return existing;
|
|
155
157
|
}
|
|
156
158
|
const child = parent.createChild();
|
|
157
|
-
child.bind(
|
|
159
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
158
160
|
this.ssrPageContainers.set(requestId, child);
|
|
159
161
|
return child;
|
|
160
162
|
}
|
|
@@ -165,7 +167,7 @@ var ContainerManagerImpl = class {
|
|
|
165
167
|
* @param requestId - Уникальный идентификатор запроса
|
|
166
168
|
*/
|
|
167
169
|
destroySsrPageContainer(requestId) {
|
|
168
|
-
return
|
|
170
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
169
171
|
const container = this.ssrPageContainers.get(requestId);
|
|
170
172
|
if (container === void 0) {
|
|
171
173
|
return;
|
|
@@ -193,10 +195,10 @@ var GuardRunnerImpl = class {
|
|
|
193
195
|
* @param container - Опциональный контейнер для резолвинга guards
|
|
194
196
|
*/
|
|
195
197
|
runGuards(tokens, params, container) {
|
|
196
|
-
return
|
|
198
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
197
199
|
const resolveFrom = container != null ? container : this.container;
|
|
198
200
|
const results = yield Promise.all(
|
|
199
|
-
tokens.map((token) =>
|
|
201
|
+
tokens.map((token) => _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
200
202
|
const guard = yield resolveFrom.resolve(token);
|
|
201
203
|
return guard.check(params);
|
|
202
204
|
}))
|
|
@@ -285,7 +287,7 @@ var NavigationManagerImpl = class {
|
|
|
285
287
|
* Состояние считается актуальным если история и текущий элемент согласованы.
|
|
286
288
|
*/
|
|
287
289
|
checkFreshness() {
|
|
288
|
-
return
|
|
290
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
289
291
|
var _a;
|
|
290
292
|
const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
|
|
291
293
|
return lastEntry === this.current;
|
|
@@ -315,7 +317,7 @@ var NavigationManagerImpl = class {
|
|
|
315
317
|
* @returns Результат проверки
|
|
316
318
|
*/
|
|
317
319
|
runLeaveGuards(from, to) {
|
|
318
|
-
return
|
|
320
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
319
321
|
for (const interceptor of this.interceptors) {
|
|
320
322
|
const result = yield interceptor.beforeNavigate(from, to);
|
|
321
323
|
if (!result.allow) {
|
|
@@ -414,10 +416,10 @@ var StateSerializerImpl = class {
|
|
|
414
416
|
*/
|
|
415
417
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
416
418
|
getRegistry(container) {
|
|
417
|
-
if (!container.has(
|
|
419
|
+
if (!container.has(_chunk6QV4L6R2cjs.StateRegistryToken)) {
|
|
418
420
|
return void 0;
|
|
419
421
|
}
|
|
420
|
-
const resolved = container.resolve(
|
|
422
|
+
const resolved = container.resolve(_chunk6QV4L6R2cjs.StateRegistryToken);
|
|
421
423
|
return resolved instanceof Promise ? void 0 : resolved;
|
|
422
424
|
}
|
|
423
425
|
/**
|
|
@@ -461,7 +463,7 @@ var StateSerializerImpl = class {
|
|
|
461
463
|
* @param params - Параметры маршрута
|
|
462
464
|
*/
|
|
463
465
|
activateAll(container, params) {
|
|
464
|
-
return
|
|
466
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
465
467
|
const registry = this.getRegistry(container);
|
|
466
468
|
if (registry === void 0) {
|
|
467
469
|
return;
|
|
@@ -531,10 +533,10 @@ function createCore(options = {}) {
|
|
|
531
533
|
const navigationManager = new NavigationManagerImpl();
|
|
532
534
|
const stateSerializer = new StateSerializerImpl();
|
|
533
535
|
const stateCache = new StateCache();
|
|
534
|
-
container.bind(
|
|
535
|
-
container.bind(
|
|
536
|
-
container.bind(
|
|
537
|
-
container.bind(
|
|
536
|
+
container.bind(_chunk6QV4L6R2cjs.ContainerManagerToken).toValue(containerManager);
|
|
537
|
+
container.bind(_chunk6QV4L6R2cjs.GuardRunnerToken).toValue(guardRunner);
|
|
538
|
+
container.bind(_chunk6QV4L6R2cjs.NavigationManagerToken).toValue(navigationManager);
|
|
539
|
+
container.bind(_chunk6QV4L6R2cjs.StateSerializerToken).toValue(stateSerializer);
|
|
538
540
|
return {
|
|
539
541
|
container,
|
|
540
542
|
containerManager,
|
|
@@ -717,4 +719,4 @@ function defineLayer(token, options) {
|
|
|
717
719
|
|
|
718
720
|
|
|
719
721
|
|
|
720
|
-
exports.ActivatableToken =
|
|
722
|
+
exports.ActivatableToken = _chunk6QV4L6R2cjs.ActivatableToken; exports.ContainerManagerImpl = ContainerManagerImpl; exports.ContainerManagerToken = _chunk6QV4L6R2cjs.ContainerManagerToken; exports.GuardRunnerImpl = GuardRunnerImpl; exports.GuardRunnerToken = _chunk6QV4L6R2cjs.GuardRunnerToken; exports.NavigationManagerImpl = NavigationManagerImpl; exports.NavigationManagerToken = _chunk6QV4L6R2cjs.NavigationManagerToken; exports.RequestContextToken = _chunk6QV4L6R2cjs.RequestContextToken; exports.SlotRegistry = _chunkZ5BL4DJAcjs.SlotRegistry; exports.SlotRegistryToken = _chunk6QV4L6R2cjs.SlotRegistryToken; exports.StateCache = StateCache; exports.StateRegistry = StateRegistry; exports.StateRegistryToken = _chunk6QV4L6R2cjs.StateRegistryToken; exports.StateSerializerImpl = StateSerializerImpl; exports.StateSerializerToken = _chunk6QV4L6R2cjs.StateSerializerToken; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.createCore = createCore; exports.defaultGlobalResolver = defaultGlobalResolver; exports.defineActionGuard = defineActionGuard; exports.defineExtension = defineExtension; exports.defineGuard = defineGuard; exports.defineLayer = defineLayer; exports.defineLayout = defineLayout; exports.defineRepository = _chunkZ5BL4DJAcjs.defineRepository; exports.defineService = _chunkZ5BL4DJAcjs.defineService; exports.defineSlot = _chunkZ5BL4DJAcjs.defineSlot; exports.defineViewModel = _chunkZ5BL4DJAcjs.defineViewModel;
|
package/index.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { C as Core,
|
|
2
|
-
export {
|
|
1
|
+
import { C as Core, i as ContainerManager, R as RequestContext, j as GuardRunner, k as Guard, l as GuardResult, N as NavigationManager, m as NavigationEntry, n as NavigationInterceptor, o as Disposable, p as LeaveGuardResult, q as StateSerializer, r as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, s as DefineExtensionOptions, t as ExtensionDefinition, A as ActionGuard, u as DefineActionGuardOptions, v as ActionGuardDefinition, w as LayoutConfig, x as DefineLayoutOptions, y as LayoutDefinition, h as LayerConfig, z as DefineLayerOptions, L as LayerDefinition } from './types-Dx5qGiwk.cjs';
|
|
2
|
+
export { B as Activatable, F as ActivatableToken, H as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, I as GuardRunnerToken, J as NavigationManagerToken, d as RepositoryDefinition, K as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-Dx5qGiwk.cjs';
|
|
3
3
|
import { Container, Token } from '@foxford/ioc';
|
|
4
4
|
import { DefinitionResolver } from './adapter.cjs';
|
|
5
|
-
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-
|
|
6
|
-
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-
|
|
7
|
-
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-
|
|
5
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-CwAXed2X.cjs';
|
|
6
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-DYNCLDJY.cjs';
|
|
7
|
+
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DJ7yB6Ml.cjs';
|
|
8
|
+
import './descriptor-Dujg_1on.cjs';
|
|
9
|
+
import './server-render-CocWXQKC.cjs';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Опции для создания Core Runtime.
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { C as Core,
|
|
2
|
-
export {
|
|
1
|
+
import { C as Core, i as ContainerManager, R as RequestContext, j as GuardRunner, k as Guard, l as GuardResult, N as NavigationManager, m as NavigationEntry, n as NavigationInterceptor, o as Disposable, p as LeaveGuardResult, q as StateSerializer, r as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, s as DefineExtensionOptions, t as ExtensionDefinition, A as ActionGuard, u as DefineActionGuardOptions, v as ActionGuardDefinition, w as LayoutConfig, x as DefineLayoutOptions, y as LayoutDefinition, h as LayerConfig, z as DefineLayerOptions, L as LayerDefinition } from './types-Dx5qGiwk.js';
|
|
2
|
+
export { B as Activatable, F as ActivatableToken, H as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, I as GuardRunnerToken, J as NavigationManagerToken, d as RepositoryDefinition, K as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-Dx5qGiwk.js';
|
|
3
3
|
import { Container, Token } from '@foxford/ioc';
|
|
4
4
|
import { DefinitionResolver } from './adapter.js';
|
|
5
|
-
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-
|
|
6
|
-
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-
|
|
7
|
-
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-
|
|
5
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-q_T4hqeP.js';
|
|
6
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-Cngzae6i.js';
|
|
7
|
+
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-B4gEb-ms.js';
|
|
8
|
+
import './descriptor-DQ6Gi7A_.js';
|
|
9
|
+
import './server-render-CocWXQKC.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Опции для создания Core Runtime.
|
package/index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ActivatableToken,
|
|
3
|
-
ContainerManagerToken,
|
|
4
|
-
GuardRunnerToken,
|
|
5
|
-
NavigationManagerToken,
|
|
6
|
-
RequestContextToken,
|
|
7
2
|
SlotRegistry,
|
|
8
|
-
SlotRegistryToken,
|
|
9
|
-
StateRegistryToken,
|
|
10
|
-
StateSerializerToken,
|
|
11
3
|
defineRepository,
|
|
12
4
|
defineService,
|
|
13
5
|
defineSlot,
|
|
14
6
|
defineViewModel
|
|
15
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MCN4GFEQ.js";
|
|
16
8
|
import "./chunk-WBHHHICS.js";
|
|
17
9
|
import {
|
|
18
10
|
ViewLayerToken
|
|
19
11
|
} from "./chunk-E23E2VUC.js";
|
|
12
|
+
import {
|
|
13
|
+
ActivatableToken,
|
|
14
|
+
ContainerManagerToken,
|
|
15
|
+
GuardRunnerToken,
|
|
16
|
+
NavigationManagerToken,
|
|
17
|
+
RequestContextToken,
|
|
18
|
+
SlotRegistryToken,
|
|
19
|
+
StateRegistryToken,
|
|
20
|
+
StateSerializerToken
|
|
21
|
+
} from "./chunk-3RX2OSUL.js";
|
|
20
22
|
import "./chunk-TPBI6TOU.js";
|
|
21
23
|
import {
|
|
22
24
|
__async
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6FNC3XMI.js";
|
|
24
26
|
|
|
25
27
|
// src/core/state-registry.ts
|
|
26
28
|
var StateRegistry = class {
|
package/island/index.cjs
CHANGED
|
@@ -2,168 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkXOJ2VWX4cjs = require('../chunk-XOJ2VWX4.cjs');
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
var _chunkA6ZPAM6Zcjs = require('../chunk-A6ZPAM6Z.cjs');
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
|
|
14
|
-
var _chunkXHYR3SGGcjs = require('../chunk-XHYR3SGG.cjs');
|
|
15
12
|
|
|
16
|
-
// src/island/document.ts
|
|
17
|
-
function isDocumentSource(value) {
|
|
18
|
-
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
19
|
-
}
|
|
20
13
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// src/island/runtime.ts
|
|
25
|
-
var _ioc = require('@foxford/ioc');
|
|
26
|
-
var appContainer = null;
|
|
27
|
-
function getAppContainer() {
|
|
28
|
-
var _a;
|
|
29
|
-
if (appContainer === null) {
|
|
30
|
-
appContainer = new (0, _ioc.Container)();
|
|
31
|
-
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug("app-\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D");
|
|
32
|
-
}
|
|
33
|
-
return appContainer;
|
|
34
|
-
}
|
|
14
|
+
var _chunkZOU6W6ZQcjs = require('../chunk-ZOU6W6ZQ.cjs');
|
|
15
|
+
|
|
35
16
|
|
|
36
|
-
// src/island/lifecycle.ts
|
|
37
|
-
var EMPTY_ROUTE = { params: {}, pathname: "", search: "" };
|
|
38
|
-
var REDIRECT_FOUND = 302;
|
|
39
|
-
function createIslandContainer(descriptor, options = {}) {
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
41
|
-
const { parent = getAppContainer() } = options;
|
|
42
|
-
const appLog = (_b = _logger.log.getLogger((_a = descriptor.name) != null ? _a : "app")) != null ? _b : _chunkA6ZPAM6Zcjs.logger;
|
|
43
|
-
const islandLog = (_c = appLog.getLogger("client")) != null ? _c : appLog;
|
|
44
|
-
try {
|
|
45
|
-
const container = parent.createChild();
|
|
46
|
-
container.bind(_chunkA6ZPAM6Zcjs.LoggerToken).toValue(islandLog);
|
|
47
|
-
descriptor.viewLayer.register(container);
|
|
48
|
-
const viewModels = (_d = descriptor.viewModels) != null ? _d : [];
|
|
49
|
-
const slots = Object.entries((_e = descriptor.slots) != null ? _e : {});
|
|
50
|
-
islandLog.info(
|
|
51
|
-
`\u043E\u0441\u0442\u0440\u043E\u0432: \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D (units=${descriptor.units.length}, vms=${viewModels.length}, slots=${slots.length})`
|
|
52
|
-
);
|
|
53
|
-
for (const unit of descriptor.units) {
|
|
54
|
-
unit.register(container);
|
|
55
|
-
}
|
|
56
|
-
for (const vm of viewModels) {
|
|
57
|
-
vm.register(container);
|
|
58
|
-
}
|
|
59
|
-
for (const [name, slot] of slots) {
|
|
60
|
-
slot.register(container, name);
|
|
61
|
-
}
|
|
62
|
-
return container;
|
|
63
|
-
} catch (error) {
|
|
64
|
-
islandLog.error("\u043E\u0441\u0442\u0440\u043E\u0432: \u0441\u0431\u043E\u0440\u043A\u0430 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430 \u0443\u043F\u0430\u043B\u0430", error);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function hydrateIslandState(container, descriptor, denState) {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
for (const vm of (_a = descriptor.viewModels) != null ? _a : []) {
|
|
71
|
-
const instance = container.resolve(vm.token);
|
|
72
|
-
const saved = denState[vm.token.description];
|
|
73
|
-
if (saved !== void 0 && typeof ((_b = instance.state) == null ? void 0 : _b.set) === "function") {
|
|
74
|
-
_chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, vm.token.description).debug("\u0433\u0438\u0434\u0440\u0430\u0446\u0438\u044F VM \u0438\u0437 denState");
|
|
75
|
-
instance.state.set(saved);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function activateIslandViewModels(_0, _1) {
|
|
80
|
-
return _chunkXHYR3SGGcjs.__async.call(void 0, this, arguments, function* (container, descriptor, route = EMPTY_ROUTE) {
|
|
81
|
-
var _a;
|
|
82
|
-
yield Promise.all(
|
|
83
|
-
((_a = descriptor.viewModels) != null ? _a : []).map((vm) => _chunkXHYR3SGGcjs.__async.call(void 0, null, null, function* () {
|
|
84
|
-
var _a2;
|
|
85
|
-
const instance = container.resolve(vm.token);
|
|
86
|
-
_chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, vm.token.description).debug(`\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (${route.pathname || "\u2014"})`);
|
|
87
|
-
yield (_a2 = instance.activate) == null ? void 0 : _a2.call(instance, route);
|
|
88
|
-
}))
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function collectIslandState(container, descriptor) {
|
|
93
|
-
var _a, _b;
|
|
94
|
-
const state = {};
|
|
95
|
-
for (const vm of (_a = descriptor.viewModels) != null ? _a : []) {
|
|
96
|
-
const instance = container.resolve(vm.token);
|
|
97
|
-
if (typeof ((_b = instance.state) == null ? void 0 : _b.get) === "function") {
|
|
98
|
-
state[vm.token.description] = instance.state.get();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return state;
|
|
102
|
-
}
|
|
103
|
-
function collectDocumentContribution(container, descriptor) {
|
|
104
|
-
var _a, _b;
|
|
105
|
-
const contribution = {};
|
|
106
|
-
for (const vm of (_a = descriptor.viewModels) != null ? _a : []) {
|
|
107
|
-
const instance = container.resolve(vm.token);
|
|
108
|
-
if (!isDocumentSource(instance)) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
const part = instance.describeDocument();
|
|
112
|
-
if (part.head) {
|
|
113
|
-
contribution.head = _chunkXHYR3SGGcjs.__spreadValues.call(void 0, _chunkXHYR3SGGcjs.__spreadValues.call(void 0, {}, contribution.head), part.head);
|
|
114
|
-
}
|
|
115
|
-
const declared = part.status !== void 0 || part.redirect !== void 0;
|
|
116
|
-
if (declared && contribution.status === void 0) {
|
|
117
|
-
contribution.status = (_b = part.status) != null ? _b : REDIRECT_FOUND;
|
|
118
|
-
contribution.redirect = part.redirect;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return contribution;
|
|
122
|
-
}
|
|
123
|
-
function resolveEagerUnits(container, descriptor) {
|
|
124
|
-
var _a;
|
|
125
|
-
for (const token of (_a = descriptor.eager) != null ? _a : []) {
|
|
126
|
-
const instance = container.resolve(token);
|
|
127
|
-
_chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, token.description).debug("eager: \u0435\u0434\u0438\u043D\u0438\u0446\u0430 \u043F\u043E\u0434\u043D\u044F\u0442\u0430 \u043F\u0440\u0438 \u043C\u043E\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438");
|
|
128
|
-
if (instance instanceof Promise) {
|
|
129
|
-
instance.catch(
|
|
130
|
-
(error) => _chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, token.description).error("eager: \u0435\u0434\u0438\u043D\u0438\u0446\u0430 \u043D\u0435 \u043F\u043E\u0434\u043D\u044F\u043B\u0430\u0441\u044C", error)
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
17
|
|
|
136
|
-
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
pathname: request.pathname,
|
|
144
|
-
search: (_b = request.search) != null ? _b : ""
|
|
145
|
-
};
|
|
146
|
-
const container = createIslandContainer(descriptor, { parent: request.parent });
|
|
147
|
-
if (container === null) {
|
|
148
|
-
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`);
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
yield activateIslandViewModels(container, descriptor, route);
|
|
152
|
-
const { head, redirect, status = STATUS_OK } = collectDocumentContribution(container, descriptor);
|
|
153
|
-
if (status !== STATUS_OK) {
|
|
154
|
-
return { head, html: "", redirect, state: {}, status };
|
|
155
|
-
}
|
|
156
|
-
const state = collectIslandState(container, descriptor);
|
|
157
|
-
const rendered = _chunkXOJ2VWX4cjs.resolveViewAdapter.call(void 0, container).renderIsland(descriptor, {
|
|
158
|
-
container,
|
|
159
|
-
slots: request.slots
|
|
160
|
-
});
|
|
161
|
-
return { head, headHtml: rendered.head, html: rendered.html, state, status };
|
|
162
|
-
} finally {
|
|
163
|
-
yield container.dispose();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
18
|
+
|
|
19
|
+
var _chunkXOJ2VWX4cjs = require('../chunk-XOJ2VWX4.cjs');
|
|
20
|
+
require('../chunk-6QV4L6R2.cjs');
|
|
21
|
+
require('../chunk-A6ZPAM6Z.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunkT5QVCXVBcjs = require('../chunk-T5QVCXVB.cjs');
|
|
167
25
|
|
|
168
26
|
// src/island/slot-address.ts
|
|
169
27
|
function slotAddress(app, slot) {
|
|
@@ -183,7 +41,7 @@ function notify() {
|
|
|
183
41
|
}
|
|
184
42
|
function registerIsland(record) {
|
|
185
43
|
const id = nextId++;
|
|
186
|
-
islands.set(id,
|
|
44
|
+
islands.set(id, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, { id }, record));
|
|
187
45
|
notify();
|
|
188
46
|
return () => {
|
|
189
47
|
islands.delete(id);
|
|
@@ -210,10 +68,6 @@ function describeIsland(descriptor, denState) {
|
|
|
210
68
|
};
|
|
211
69
|
}
|
|
212
70
|
|
|
213
|
-
// src/island/routes.ts
|
|
214
|
-
function normalizeRoutes(routes = []) {
|
|
215
|
-
return routes.map((route) => typeof route === "string" ? { source: route } : route);
|
|
216
|
-
}
|
|
217
71
|
|
|
218
72
|
|
|
219
73
|
|
|
@@ -233,4 +87,5 @@ function normalizeRoutes(routes = []) {
|
|
|
233
87
|
|
|
234
88
|
|
|
235
89
|
|
|
236
|
-
|
|
90
|
+
|
|
91
|
+
exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkZOU6W6ZQcjs.activateIslandViewModels; exports.collectDocumentContribution = _chunkZOU6W6ZQcjs.collectDocumentContribution; exports.collectIslandState = _chunkZOU6W6ZQcjs.collectIslandState; exports.createIslandContainer = _chunkZOU6W6ZQcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkZOU6W6ZQcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkZOU6W6ZQcjs.hydrateIslandState; exports.isDocumentSource = _chunkZOU6W6ZQcjs.isDocumentSource; exports.matchRoute = _chunkZOU6W6ZQcjs.matchRoute; exports.normalizeRoutes = _chunkZOU6W6ZQcjs.normalizeRoutes; exports.pathPattern = _chunkZOU6W6ZQcjs.pathPattern; exports.registerIsland = registerIsland; exports.renderApp = _chunkZOU6W6ZQcjs.renderApp; exports.resolveEagerUnits = _chunkZOU6W6ZQcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
|
package/island/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { I as IslandDescriptor } from '../
|
|
2
|
-
export { R as RenderIslandOptions, c as RenderTree, S as ServerRender, d as ServerRenderResult, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-BvDC5O4y.cjs';
|
|
1
|
+
import { I as IslandDescriptor, A as AppAssets } from '../descriptor-Dujg_1on.cjs';
|
|
3
2
|
import { Container } from '@foxford/ioc';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { R as RequestContext } from '../types-Dx5qGiwk.cjs';
|
|
4
|
+
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-B0hDrkiF.cjs';
|
|
5
|
+
export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.cjs';
|
|
6
|
+
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DJ7yB6Ml.cjs';
|
|
7
|
+
import '../define-slot-DYNCLDJY.cjs';
|
|
6
8
|
|
|
7
9
|
/** Вклад приложения в `<head>` документа. */
|
|
8
10
|
interface DocumentHead {
|
|
@@ -32,7 +34,27 @@ interface DocumentContribution {
|
|
|
32
34
|
/** Адрес для 3xx. Объявлен без статуса — исход `302`. */
|
|
33
35
|
redirect?: string;
|
|
34
36
|
}
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* VM, которой есть что сказать про документ.
|
|
39
|
+
*
|
|
40
|
+
* Метод СИНХРОННЫЙ, и это не ограничение, а разделение обязанностей: ходит в ручки активация,
|
|
41
|
+
* а здесь остаётся проекция уже посчитанного состояния. Приложению, которому «есть ли такая
|
|
42
|
+
* страница» известно только от бэкенда, второй поход не нужен — активация ждётся ДО сбора
|
|
43
|
+
* вклада, поэтому к моменту вызова ответ уже лежит в состоянии VM:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* async activate(route: IslandRoute) {
|
|
47
|
+
* this.state.set(await loadPage(this.service, route.pathname)) // сюда ходим
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* describeDocument(): DocumentContribution {
|
|
51
|
+
* return this.state.get().page === null ? { status: 404 } : { head: … } // здесь только решаем
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Разреши мы здесь асинхронность — у рендера появилась бы вторая фаза походов в сеть, а логика
|
|
56
|
+
* загрузки разъехалась бы по двум местам. Ровно от этого избавлялись, убирая `load`.
|
|
57
|
+
*/
|
|
36
58
|
interface DocumentSource {
|
|
37
59
|
describeDocument(): DocumentContribution;
|
|
38
60
|
}
|
|
@@ -148,6 +170,12 @@ interface RenderAppRequest {
|
|
|
148
170
|
search?: string;
|
|
149
171
|
/** Параметры, выделенные маршрутом хоста. */
|
|
150
172
|
params?: Record<string, string>;
|
|
173
|
+
/**
|
|
174
|
+
* Реквизиты запроса браузера — заголовки и куки. Кладутся в контейнер под
|
|
175
|
+
* `RequestContextToken`, поэтому приложение читает их через `requires`, одинаково у обоих
|
|
176
|
+
* транспортов: в процессе хоста их даёт хост, за сетью — сетевой рантайм из `X-Forwarded-*`.
|
|
177
|
+
*/
|
|
178
|
+
context?: RequestContext;
|
|
151
179
|
/**
|
|
152
180
|
* Родитель контейнера приложения: через него приезжает всё, что настроил исполнитель, —
|
|
153
181
|
* логгер, конфиг HTTP, выданные возможности. По умолчанию — app-scope контейнер.
|
|
@@ -174,6 +202,12 @@ interface RenderAppResult {
|
|
|
174
202
|
headHtml?: string;
|
|
175
203
|
/** Адрес для 3xx. */
|
|
176
204
|
redirect?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Ссылки на клиентские артефакты приложения — хост подключает их к документу.
|
|
207
|
+
*
|
|
208
|
+
* Только при исходе `200`: на остальных рисовать нечего, и оживлять тоже нечего.
|
|
209
|
+
*/
|
|
210
|
+
assets?: AppAssets;
|
|
177
211
|
}
|
|
178
212
|
/**
|
|
179
213
|
* Рисует приложение по адресу и отдаёт разметку вместе с состоянием.
|
|
@@ -242,28 +276,4 @@ declare function getAppContainer(): Container;
|
|
|
242
276
|
*/
|
|
243
277
|
declare function slotAddress(app: string, slot: string): string;
|
|
244
278
|
|
|
245
|
-
|
|
246
|
-
interface RouteDeclaration {
|
|
247
|
-
/** Regex-источник адреса (`'^/cabinet/billing'`, `'.*'`). */
|
|
248
|
-
source: string;
|
|
249
|
-
/**
|
|
250
|
-
* Guard-ы этого маршрута — поверх guard-ов приложения и хоста. Пусто — маршрут открыт
|
|
251
|
-
* настолько, насколько открыто само приложение.
|
|
252
|
-
*/
|
|
253
|
-
guards?: ReadonlyArray<GuardDefinition>;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Заявка на адрес: голая строка — публичный маршрут, объект — маршрут со своей политикой.
|
|
257
|
-
* Обе формы лежат в одном массиве, и порядок значим так же, как раньше: хост раздаёт путь
|
|
258
|
-
* первому заявившему, поэтому частные записи ставятся выше общих.
|
|
259
|
-
*/
|
|
260
|
-
type AppRoute = string | RouteDeclaration;
|
|
261
|
-
/**
|
|
262
|
-
* Приводит заявки к одной форме — чтобы хост и dev-инструменты не разбирали union каждый сам.
|
|
263
|
-
*
|
|
264
|
-
* @param routes - Заявки приложения (строки и/или записи)
|
|
265
|
-
* @returns Записи маршрутов в порядке объявления
|
|
266
|
-
*/
|
|
267
|
-
declare function normalizeRoutes(routes?: ReadonlyArray<AppRoute>): RouteDeclaration[];
|
|
268
|
-
|
|
269
|
-
export { type AppRoute, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, type RenderAppRequest, type RenderAppResult, type RouteDeclaration, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, normalizeRoutes, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
|
|
279
|
+
export { AppAssets, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
|
package/island/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { I as IslandDescriptor } from '../
|
|
2
|
-
export { R as RenderIslandOptions, c as RenderTree, S as ServerRender, d as ServerRenderResult, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DtNgyjIf.js';
|
|
1
|
+
import { I as IslandDescriptor, A as AppAssets } from '../descriptor-DQ6Gi7A_.js';
|
|
3
2
|
import { Container } from '@foxford/ioc';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { R as RequestContext } from '../types-Dx5qGiwk.js';
|
|
4
|
+
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-0uXJ0fux.js';
|
|
5
|
+
export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.js';
|
|
6
|
+
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-B4gEb-ms.js';
|
|
7
|
+
import '../define-slot-Cngzae6i.js';
|
|
6
8
|
|
|
7
9
|
/** Вклад приложения в `<head>` документа. */
|
|
8
10
|
interface DocumentHead {
|
|
@@ -32,7 +34,27 @@ interface DocumentContribution {
|
|
|
32
34
|
/** Адрес для 3xx. Объявлен без статуса — исход `302`. */
|
|
33
35
|
redirect?: string;
|
|
34
36
|
}
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* VM, которой есть что сказать про документ.
|
|
39
|
+
*
|
|
40
|
+
* Метод СИНХРОННЫЙ, и это не ограничение, а разделение обязанностей: ходит в ручки активация,
|
|
41
|
+
* а здесь остаётся проекция уже посчитанного состояния. Приложению, которому «есть ли такая
|
|
42
|
+
* страница» известно только от бэкенда, второй поход не нужен — активация ждётся ДО сбора
|
|
43
|
+
* вклада, поэтому к моменту вызова ответ уже лежит в состоянии VM:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* async activate(route: IslandRoute) {
|
|
47
|
+
* this.state.set(await loadPage(this.service, route.pathname)) // сюда ходим
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* describeDocument(): DocumentContribution {
|
|
51
|
+
* return this.state.get().page === null ? { status: 404 } : { head: … } // здесь только решаем
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Разреши мы здесь асинхронность — у рендера появилась бы вторая фаза походов в сеть, а логика
|
|
56
|
+
* загрузки разъехалась бы по двум местам. Ровно от этого избавлялись, убирая `load`.
|
|
57
|
+
*/
|
|
36
58
|
interface DocumentSource {
|
|
37
59
|
describeDocument(): DocumentContribution;
|
|
38
60
|
}
|
|
@@ -148,6 +170,12 @@ interface RenderAppRequest {
|
|
|
148
170
|
search?: string;
|
|
149
171
|
/** Параметры, выделенные маршрутом хоста. */
|
|
150
172
|
params?: Record<string, string>;
|
|
173
|
+
/**
|
|
174
|
+
* Реквизиты запроса браузера — заголовки и куки. Кладутся в контейнер под
|
|
175
|
+
* `RequestContextToken`, поэтому приложение читает их через `requires`, одинаково у обоих
|
|
176
|
+
* транспортов: в процессе хоста их даёт хост, за сетью — сетевой рантайм из `X-Forwarded-*`.
|
|
177
|
+
*/
|
|
178
|
+
context?: RequestContext;
|
|
151
179
|
/**
|
|
152
180
|
* Родитель контейнера приложения: через него приезжает всё, что настроил исполнитель, —
|
|
153
181
|
* логгер, конфиг HTTP, выданные возможности. По умолчанию — app-scope контейнер.
|
|
@@ -174,6 +202,12 @@ interface RenderAppResult {
|
|
|
174
202
|
headHtml?: string;
|
|
175
203
|
/** Адрес для 3xx. */
|
|
176
204
|
redirect?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Ссылки на клиентские артефакты приложения — хост подключает их к документу.
|
|
207
|
+
*
|
|
208
|
+
* Только при исходе `200`: на остальных рисовать нечего, и оживлять тоже нечего.
|
|
209
|
+
*/
|
|
210
|
+
assets?: AppAssets;
|
|
177
211
|
}
|
|
178
212
|
/**
|
|
179
213
|
* Рисует приложение по адресу и отдаёт разметку вместе с состоянием.
|
|
@@ -242,28 +276,4 @@ declare function getAppContainer(): Container;
|
|
|
242
276
|
*/
|
|
243
277
|
declare function slotAddress(app: string, slot: string): string;
|
|
244
278
|
|
|
245
|
-
|
|
246
|
-
interface RouteDeclaration {
|
|
247
|
-
/** Regex-источник адреса (`'^/cabinet/billing'`, `'.*'`). */
|
|
248
|
-
source: string;
|
|
249
|
-
/**
|
|
250
|
-
* Guard-ы этого маршрута — поверх guard-ов приложения и хоста. Пусто — маршрут открыт
|
|
251
|
-
* настолько, насколько открыто само приложение.
|
|
252
|
-
*/
|
|
253
|
-
guards?: ReadonlyArray<GuardDefinition>;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Заявка на адрес: голая строка — публичный маршрут, объект — маршрут со своей политикой.
|
|
257
|
-
* Обе формы лежат в одном массиве, и порядок значим так же, как раньше: хост раздаёт путь
|
|
258
|
-
* первому заявившему, поэтому частные записи ставятся выше общих.
|
|
259
|
-
*/
|
|
260
|
-
type AppRoute = string | RouteDeclaration;
|
|
261
|
-
/**
|
|
262
|
-
* Приводит заявки к одной форме — чтобы хост и dev-инструменты не разбирали union каждый сам.
|
|
263
|
-
*
|
|
264
|
-
* @param routes - Заявки приложения (строки и/или записи)
|
|
265
|
-
* @returns Записи маршрутов в порядке объявления
|
|
266
|
-
*/
|
|
267
|
-
declare function normalizeRoutes(routes?: ReadonlyArray<AppRoute>): RouteDeclaration[];
|
|
268
|
-
|
|
269
|
-
export { type AppRoute, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, type RenderAppRequest, type RenderAppResult, type RouteDeclaration, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, normalizeRoutes, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
|
|
279
|
+
export { AppAssets, type CreateIslandContainerOptions, type DocumentContribution, type DocumentHead, type DocumentSource, IslandDescriptor, type IslandRecord, type IslandRoute, type RenderAppRequest, type RenderAppResult, activateIslandViewModels, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, registerIsland, renderApp, resolveEagerUnits, slotAddress, subscribeIslands };
|