@foxford/den 3.2.5 → 3.4.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 +20 -6
- package/adapter.d.cts +1 -1
- package/adapter.d.ts +1 -1
- package/{chunk-SOH2TL2N.js → chunk-LBXA2QIB.js} +62 -6
- package/{chunk-XDM6J4LJ.cjs → chunk-M5CR4TJC.cjs} +63 -7
- package/{define-repository-q_T4hqeP.d.ts → define-repository-AO7JI6Cb.d.ts} +1 -1
- package/{define-repository-CwAXed2X.d.cts → define-repository-C0MI-J32.d.cts} +1 -1
- package/{define-slot-DouHW8RK.d.cts → define-slot-BEeHNEph.d.cts} +1 -1
- package/{define-slot-TkqbLySB.d.ts → define-slot-CdWdFM16.d.ts} +1 -1
- package/define.d.cts +3 -3
- package/define.d.ts +3 -3
- package/{descriptor-tWPa9j-x.d.ts → descriptor-CLIZRmY4.d.ts} +13 -2
- package/{descriptor-w8oxeIAe.d.cts → descriptor-Ced0k1__.d.cts} +13 -2
- package/index.d.cts +6 -6
- package/index.d.ts +6 -6
- package/island/index.cjs +33 -3
- package/island/index.d.cts +94 -6
- package/island/index.d.ts +94 -6
- package/island/index.js +32 -2
- package/package.json +16 -16
- package/{routes-B0hDrkiF.d.cts → routes-BvV405k4.d.cts} +1 -1
- package/{routes-0uXJ0fux.d.ts → routes-Di3K_0uQ.d.ts} +1 -1
- package/serve/index.cjs +48 -41
- package/serve/index.d.cts +4 -4
- package/serve/index.d.ts +4 -4
- package/serve/index.js +46 -39
- package/{types-Dx5qGiwk.d.cts → types-BxMQ-VOd.d.cts} +1 -1
- package/{types-Dx5qGiwk.d.ts → types-BxMQ-VOd.d.ts} +1 -1
- package/{view-adapter-BV62bdhM.d.ts → view-adapter-BTaoZgTQ.d.ts} +2 -2
- package/{view-adapter-DF1me25J.d.cts → view-adapter-D8I06K7s.d.cts} +2 -2
package/README.mdx
CHANGED
|
@@ -84,9 +84,16 @@ const { status, html, state, head, headHtml, redirect, assets } = await renderAp
|
|
|
84
84
|
pathname: '/legal/general',
|
|
85
85
|
search: '?from=footer',
|
|
86
86
|
context: { cookies, headers }, // реквизиты браузерного запроса
|
|
87
|
+
inputs: { 'host:User': user, 'host:Settings': settings }, // входные данные хоста по ключу token.description
|
|
87
88
|
})
|
|
88
89
|
```
|
|
89
90
|
|
|
91
|
+
`inputs` — то, что хост знает про запрос и отдаёт приложению данными: посетитель, настройки
|
|
92
|
+
площадки, эксперименты (токены — в `@foxford/contracts`). Приложение объявляет, что принимает,
|
|
93
|
+
полем `inputs` дескриптора и читает через `requires`; ядро биндит объявленное в контейнер
|
|
94
|
+
острова, кладёт в `state` рядом с VM и в браузере биндит оттуда же — единица не различает
|
|
95
|
+
сторон. Не объявленное в контейнер не попадает, не присланное не биндится.
|
|
96
|
+
|
|
90
97
|
`status` — исход запроса: `200` значит «вот страница», всё остальное значит, что страницы по
|
|
91
98
|
этому адресу нет, и тело такого ответа выбирает хост. `state` едет в документ и гидрирует
|
|
92
99
|
остров в браузере, `headHtml` — стили, собранные во время рендера. `assets` — ссылки на
|
|
@@ -177,11 +184,16 @@ describeDocument(): DocumentContribution {
|
|
|
177
184
|
|
|
178
185
|
Рантайм вокруг дескриптора отдаёт три ручки:
|
|
179
186
|
|
|
180
|
-
| Ручка
|
|
181
|
-
|
|
|
182
|
-
| `
|
|
183
|
-
| `GET /
|
|
184
|
-
| `GET /
|
|
187
|
+
| Ручка | Ответ |
|
|
188
|
+
| -------------------------------------- | ------------------------------------------- |
|
|
189
|
+
| `QUERY /_render` + `{ url, inputs? }` | `200` + ответ `renderApp` телом |
|
|
190
|
+
| `GET /_render?url=<path+search>` | то же без входных данных хоста |
|
|
191
|
+
| `GET /_routes` | `200` + массив regex-строк заявки на адреса |
|
|
192
|
+
| `GET /_health` | `200 ok` |
|
|
193
|
+
|
|
194
|
+
`QUERY` — безопасный метод с телом (RFC 9110): адрес и входные данные хоста едут JSON-ом,
|
|
195
|
+
потому что заголовкам они не по размеру. `GET` остаётся для хоста, который входных данных
|
|
196
|
+
не шлёт.
|
|
185
197
|
|
|
186
198
|
**Статус HTTP описывает транспорт, а исход страницы едет полем `status` в теле.** `200` значит
|
|
187
199
|
«приложение ответило» — хоть `404`, хоть редиректом. Всё остальное значит «до приложения не
|
|
@@ -305,7 +317,9 @@ export default defineAppConfig({
|
|
|
305
317
|
| `@foxford/den` | рантайм, `define*`, менеджеры контейнеров и состояния |
|
|
306
318
|
| `@foxford/den/define` | те же `define*` без сайд-эффекта установки резолвера |
|
|
307
319
|
| `@foxford/den/adapter` | шов резолва для адаптеров хостов |
|
|
308
|
-
| `@foxford/den/island` | остров: жизненный цикл, шов `renderApp`, порт `ViewAdapter` |
|
|
320
|
+
| `@foxford/den/island` | остров: жизненный цикл, шов `renderApp`, порт `ViewAdapter`, очередь клиентских падений (`reportIslandError`) |
|
|
321
|
+
|
|
322
|
+
|
|
309
323
|
| `@foxford/den/serve` | сетевой транспорт: `serveApp`, `appPlugin` |
|
|
310
324
|
| `@foxford/den/build` | конфиг приложения и сборка: `defineAppConfig`, `buildApp` |
|
|
311
325
|
| `@foxford/den/bin` | точка входа команды `den` |
|
package/adapter.d.cts
CHANGED
package/adapter.d.ts
CHANGED
|
@@ -19,6 +19,57 @@ function isDocumentSource(value) {
|
|
|
19
19
|
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// src/island/inputs.ts
|
|
23
|
+
function islandInputsOf(descriptor, source) {
|
|
24
|
+
var _a;
|
|
25
|
+
const inputs = {};
|
|
26
|
+
if (source === void 0) {
|
|
27
|
+
return inputs;
|
|
28
|
+
}
|
|
29
|
+
for (const token of (_a = descriptor.inputs) != null ? _a : []) {
|
|
30
|
+
const value = source[token.description];
|
|
31
|
+
if (value !== void 0) {
|
|
32
|
+
inputs[token.description] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return inputs;
|
|
36
|
+
}
|
|
37
|
+
function bindIslandInputs(container, descriptor, inputs) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (inputs === void 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const token of (_a = descriptor.inputs) != null ? _a : []) {
|
|
43
|
+
const value = inputs[token.description];
|
|
44
|
+
if (value !== void 0) {
|
|
45
|
+
container.bind(token).toValue(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function parseCookieHeader(header) {
|
|
50
|
+
const cookies = {};
|
|
51
|
+
for (const part of (header != null ? header : "").split(";")) {
|
|
52
|
+
const eq = part.indexOf("=");
|
|
53
|
+
if (eq < 1) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const name = part.slice(0, eq).trim();
|
|
57
|
+
if (name && !(name in cookies)) {
|
|
58
|
+
cookies[name] = part.slice(eq + 1).trim();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return cookies;
|
|
62
|
+
}
|
|
63
|
+
function browserRequestContext() {
|
|
64
|
+
const cookie = typeof document === "undefined" ? void 0 : document.cookie;
|
|
65
|
+
return { cookies: parseCookieHeader(cookie), headers: {} };
|
|
66
|
+
}
|
|
67
|
+
function bindRequestContext(container, context) {
|
|
68
|
+
if (context !== void 0) {
|
|
69
|
+
container.bind(RequestContextToken).toValue(context);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
22
73
|
// src/island/runtime.ts
|
|
23
74
|
import { Container } from "@foxford/ioc";
|
|
24
75
|
var appContainer = null;
|
|
@@ -55,12 +106,14 @@ function registerIslandParts(container, descriptor, islandLog) {
|
|
|
55
106
|
}
|
|
56
107
|
function createIslandContainer(descriptor, options = {}) {
|
|
57
108
|
var _a, _b, _c;
|
|
58
|
-
const { parent = getAppContainer() } = options;
|
|
109
|
+
const { context, inputs, parent = getAppContainer() } = options;
|
|
59
110
|
const appLog = (_b = log.getLogger((_a = descriptor.name) != null ? _a : "app")) != null ? _b : logger;
|
|
60
111
|
const islandLog = (_c = appLog.getLogger("client")) != null ? _c : appLog;
|
|
61
112
|
try {
|
|
62
113
|
const container = parent.createChild();
|
|
63
114
|
container.bind(LoggerToken).toValue(islandLog);
|
|
115
|
+
bindRequestContext(container, context);
|
|
116
|
+
bindIslandInputs(container, descriptor, inputs);
|
|
64
117
|
registerIslandParts(container, descriptor, islandLog);
|
|
65
118
|
return container;
|
|
66
119
|
} catch (error) {
|
|
@@ -166,14 +219,12 @@ function renderApp(descriptor, request) {
|
|
|
166
219
|
pathname: request.pathname,
|
|
167
220
|
search: (_b = request.search) != null ? _b : ""
|
|
168
221
|
};
|
|
169
|
-
const
|
|
222
|
+
const inputs = islandInputsOf(descriptor, request.inputs);
|
|
223
|
+
const container = createIslandContainer(descriptor, { context: request.context, inputs, parent: request.parent });
|
|
170
224
|
if (container === null) {
|
|
171
225
|
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`);
|
|
172
226
|
}
|
|
173
227
|
try {
|
|
174
|
-
if (request.context) {
|
|
175
|
-
container.bind(RequestContextToken).toValue(request.context);
|
|
176
|
-
}
|
|
177
228
|
yield activateIslandViewModels(container, descriptor, route);
|
|
178
229
|
const contribution = collectDocumentContribution(container, descriptor);
|
|
179
230
|
const { data, head, redirect, status = STATUS_OK } = contribution;
|
|
@@ -181,7 +232,7 @@ function renderApp(descriptor, request) {
|
|
|
181
232
|
return { data, head, html: "", redirect, state: {}, status };
|
|
182
233
|
}
|
|
183
234
|
const assets = (_c = contribution.assets) != null ? _c : descriptor.assets;
|
|
184
|
-
const state = collectIslandState(container, descriptor);
|
|
235
|
+
const state = __spreadValues(__spreadValues({}, inputs), collectIslandState(container, descriptor));
|
|
185
236
|
if (descriptor.view === void 0 || descriptor.viewLayer === void 0) {
|
|
186
237
|
return { assets, data, head, html: "", state, status };
|
|
187
238
|
}
|
|
@@ -231,6 +282,11 @@ function pathPattern(pattern) {
|
|
|
231
282
|
|
|
232
283
|
export {
|
|
233
284
|
isDocumentSource,
|
|
285
|
+
islandInputsOf,
|
|
286
|
+
bindIslandInputs,
|
|
287
|
+
parseCookieHeader,
|
|
288
|
+
browserRequestContext,
|
|
289
|
+
bindRequestContext,
|
|
234
290
|
getAppContainer,
|
|
235
291
|
createIslandContainer,
|
|
236
292
|
hydrateIslandState,
|
|
@@ -19,6 +19,57 @@ function isDocumentSource(value) {
|
|
|
19
19
|
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// src/island/inputs.ts
|
|
23
|
+
function islandInputsOf(descriptor, source) {
|
|
24
|
+
var _a;
|
|
25
|
+
const inputs = {};
|
|
26
|
+
if (source === void 0) {
|
|
27
|
+
return inputs;
|
|
28
|
+
}
|
|
29
|
+
for (const token of (_a = descriptor.inputs) != null ? _a : []) {
|
|
30
|
+
const value = source[token.description];
|
|
31
|
+
if (value !== void 0) {
|
|
32
|
+
inputs[token.description] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return inputs;
|
|
36
|
+
}
|
|
37
|
+
function bindIslandInputs(container, descriptor, inputs) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (inputs === void 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const token of (_a = descriptor.inputs) != null ? _a : []) {
|
|
43
|
+
const value = inputs[token.description];
|
|
44
|
+
if (value !== void 0) {
|
|
45
|
+
container.bind(token).toValue(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function parseCookieHeader(header) {
|
|
50
|
+
const cookies = {};
|
|
51
|
+
for (const part of (header != null ? header : "").split(";")) {
|
|
52
|
+
const eq = part.indexOf("=");
|
|
53
|
+
if (eq < 1) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const name = part.slice(0, eq).trim();
|
|
57
|
+
if (name && !(name in cookies)) {
|
|
58
|
+
cookies[name] = part.slice(eq + 1).trim();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return cookies;
|
|
62
|
+
}
|
|
63
|
+
function browserRequestContext() {
|
|
64
|
+
const cookie = typeof document === "undefined" ? void 0 : document.cookie;
|
|
65
|
+
return { cookies: parseCookieHeader(cookie), headers: {} };
|
|
66
|
+
}
|
|
67
|
+
function bindRequestContext(container, context) {
|
|
68
|
+
if (context !== void 0) {
|
|
69
|
+
container.bind(_chunk6QV4L6R2cjs.RequestContextToken).toValue(context);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
22
73
|
// src/island/runtime.ts
|
|
23
74
|
var _ioc = require('@foxford/ioc');
|
|
24
75
|
var appContainer = null;
|
|
@@ -55,12 +106,14 @@ function registerIslandParts(container, descriptor, islandLog) {
|
|
|
55
106
|
}
|
|
56
107
|
function createIslandContainer(descriptor, options = {}) {
|
|
57
108
|
var _a, _b, _c;
|
|
58
|
-
const { parent = getAppContainer() } = options;
|
|
109
|
+
const { context, inputs, parent = getAppContainer() } = options;
|
|
59
110
|
const appLog = (_b = _logger.log.getLogger((_a = descriptor.name) != null ? _a : "app")) != null ? _b : _chunkA6ZPAM6Zcjs.logger;
|
|
60
111
|
const islandLog = (_c = appLog.getLogger("client")) != null ? _c : appLog;
|
|
61
112
|
try {
|
|
62
113
|
const container = parent.createChild();
|
|
63
114
|
container.bind(_chunkA6ZPAM6Zcjs.LoggerToken).toValue(islandLog);
|
|
115
|
+
bindRequestContext(container, context);
|
|
116
|
+
bindIslandInputs(container, descriptor, inputs);
|
|
64
117
|
registerIslandParts(container, descriptor, islandLog);
|
|
65
118
|
return container;
|
|
66
119
|
} catch (error) {
|
|
@@ -166,14 +219,12 @@ function renderApp(descriptor, request) {
|
|
|
166
219
|
pathname: request.pathname,
|
|
167
220
|
search: (_b = request.search) != null ? _b : ""
|
|
168
221
|
};
|
|
169
|
-
const
|
|
222
|
+
const inputs = islandInputsOf(descriptor, request.inputs);
|
|
223
|
+
const container = createIslandContainer(descriptor, { context: request.context, inputs, parent: request.parent });
|
|
170
224
|
if (container === null) {
|
|
171
225
|
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`);
|
|
172
226
|
}
|
|
173
227
|
try {
|
|
174
|
-
if (request.context) {
|
|
175
|
-
container.bind(_chunk6QV4L6R2cjs.RequestContextToken).toValue(request.context);
|
|
176
|
-
}
|
|
177
228
|
yield activateIslandViewModels(container, descriptor, route);
|
|
178
229
|
const contribution = collectDocumentContribution(container, descriptor);
|
|
179
230
|
const { data, head, redirect, status = STATUS_OK } = contribution;
|
|
@@ -181,7 +232,7 @@ function renderApp(descriptor, request) {
|
|
|
181
232
|
return { data, head, html: "", redirect, state: {}, status };
|
|
182
233
|
}
|
|
183
234
|
const assets = (_c = contribution.assets) != null ? _c : descriptor.assets;
|
|
184
|
-
const state = collectIslandState(container, descriptor);
|
|
235
|
+
const state = _chunkT5QVCXVBcjs.__spreadValues.call(void 0, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, {}, inputs), collectIslandState(container, descriptor));
|
|
185
236
|
if (descriptor.view === void 0 || descriptor.viewLayer === void 0) {
|
|
186
237
|
return { assets, data, head, html: "", state, status };
|
|
187
238
|
}
|
|
@@ -242,4 +293,9 @@ function pathPattern(pattern) {
|
|
|
242
293
|
|
|
243
294
|
|
|
244
295
|
|
|
245
|
-
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
exports.isDocumentSource = isDocumentSource; exports.islandInputsOf = islandInputsOf; exports.bindIslandInputs = bindIslandInputs; exports.parseCookieHeader = parseCookieHeader; exports.browserRequestContext = browserRequestContext; exports.bindRequestContext = bindRequestContext; exports.getAppContainer = getAppContainer; exports.createIslandContainer = createIslandContainer; exports.hydrateIslandState = hydrateIslandState; exports.activateIslandViewModels = activateIslandViewModels; exports.collectIslandState = collectIslandState; exports.collectDocumentContribution = collectDocumentContribution; exports.resolveEagerUnits = resolveEagerUnits; exports.renderApp = renderApp; exports.normalizeRoutes = normalizeRoutes; exports.matchRoute = matchRoute; exports.pathPattern = pathPattern;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-
|
|
1
|
+
import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-BxMQ-VOd.js';
|
|
2
2
|
import { Token } from '@foxford/ioc';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-
|
|
1
|
+
import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-BxMQ-VOd.cjs';
|
|
2
2
|
import { Token } from '@foxford/ioc';
|
|
3
3
|
|
|
4
4
|
/**
|
package/define.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-
|
|
2
|
-
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-
|
|
3
|
-
export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-
|
|
1
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-C0MI-J32.cjs';
|
|
2
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BEeHNEph.cjs';
|
|
3
|
+
export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-BxMQ-VOd.cjs';
|
|
4
4
|
import { Token, Container } from '@foxford/ioc';
|
|
5
5
|
import { HierarchicalLogger } from '@foxford/logger';
|
|
6
6
|
|
package/define.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-
|
|
2
|
-
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-
|
|
3
|
-
export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-
|
|
1
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-AO7JI6Cb.js';
|
|
2
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-CdWdFM16.js';
|
|
3
|
+
export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-BxMQ-VOd.js';
|
|
4
4
|
import { Token, Container } from '@foxford/ioc';
|
|
5
5
|
import { HierarchicalLogger } from '@foxford/logger';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
2
|
-
import { L as LayerDefinition, c as Definition } from './types-
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-CdWdFM16.js';
|
|
2
|
+
import { L as LayerDefinition, c as Definition } from './types-BxMQ-VOd.js';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -50,6 +50,17 @@ interface IslandDescriptor {
|
|
|
50
50
|
* ездит через denState.
|
|
51
51
|
*/
|
|
52
52
|
viewModels?: ReadonlyArray<Definition<unknown>>;
|
|
53
|
+
/**
|
|
54
|
+
* Входные данные хоста, которые приложение принимает на каждый рендер: посетитель,
|
|
55
|
+
* настройки площадки, эксперименты — токены из `@foxford/contracts`.
|
|
56
|
+
*
|
|
57
|
+
* Данными, а не возможностями: возможность — живой код провайдера в контейнере
|
|
58
|
+
* потребителя, и по сети она не ездит; входные данные это значения, и они едут одинаково
|
|
59
|
+
* обоими транспортами — аргументом `renderApp` в процессе хоста и телом запроса за сетью.
|
|
60
|
+
* Ядро биндит объявленные токены в контейнер острова (на сервере из запроса, в браузере
|
|
61
|
+
* из состояния документа), единицы читают их через `requires`. Не объявленное не биндится.
|
|
62
|
+
*/
|
|
63
|
+
inputs?: ReadonlyArray<Token<unknown>>;
|
|
53
64
|
/**
|
|
54
65
|
* Единицы, которые обязаны жить с загрузки, а не с первого резолва.
|
|
55
66
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
2
|
-
import { L as LayerDefinition, c as Definition } from './types-
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-BEeHNEph.cjs';
|
|
2
|
+
import { L as LayerDefinition, c as Definition } from './types-BxMQ-VOd.cjs';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -50,6 +50,17 @@ interface IslandDescriptor {
|
|
|
50
50
|
* ездит через denState.
|
|
51
51
|
*/
|
|
52
52
|
viewModels?: ReadonlyArray<Definition<unknown>>;
|
|
53
|
+
/**
|
|
54
|
+
* Входные данные хоста, которые приложение принимает на каждый рендер: посетитель,
|
|
55
|
+
* настройки площадки, эксперименты — токены из `@foxford/contracts`.
|
|
56
|
+
*
|
|
57
|
+
* Данными, а не возможностями: возможность — живой код провайдера в контейнере
|
|
58
|
+
* потребителя, и по сети она не ездит; входные данные это значения, и они едут одинаково
|
|
59
|
+
* обоими транспортами — аргументом `renderApp` в процессе хоста и телом запроса за сетью.
|
|
60
|
+
* Ядро биндит объявленные токены в контейнер острова (на сервере из запроса, в браузере
|
|
61
|
+
* из состояния документа), единицы читают их через `requires`. Не объявленное не биндится.
|
|
62
|
+
*/
|
|
63
|
+
inputs?: ReadonlyArray<Token<unknown>>;
|
|
53
64
|
/**
|
|
54
65
|
* Единицы, которые обязаны жить с загрузки, а не с первого резолва.
|
|
55
66
|
*
|
package/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as Core,
|
|
2
|
-
export {
|
|
1
|
+
import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-BxMQ-VOd.cjs';
|
|
2
|
+
export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i 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-BxMQ-VOd.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-
|
|
8
|
-
import './descriptor-
|
|
5
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-C0MI-J32.cjs';
|
|
6
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BEeHNEph.cjs';
|
|
7
|
+
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-D8I06K7s.cjs';
|
|
8
|
+
import './descriptor-Ced0k1__.cjs';
|
|
9
9
|
import './server-render-CocWXQKC.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as Core,
|
|
2
|
-
export {
|
|
1
|
+
import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-BxMQ-VOd.js';
|
|
2
|
+
export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i 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-BxMQ-VOd.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-
|
|
8
|
-
import './descriptor-
|
|
5
|
+
export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-AO7JI6Cb.js';
|
|
6
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-CdWdFM16.js';
|
|
7
|
+
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-BTaoZgTQ.js';
|
|
8
|
+
import './descriptor-CLIZRmY4.js';
|
|
9
9
|
import './server-render-CocWXQKC.js';
|
|
10
10
|
|
|
11
11
|
/**
|
package/island/index.cjs
CHANGED
|
@@ -11,18 +11,40 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkM5CR4TJCcjs = require('../chunk-M5CR4TJC.cjs');
|
|
15
20
|
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
|
|
19
24
|
var _chunkXOJ2VWX4cjs = require('../chunk-XOJ2VWX4.cjs');
|
|
20
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunk6QV4L6R2cjs = require('../chunk-6QV4L6R2.cjs');
|
|
21
28
|
require('../chunk-A6ZPAM6Z.cjs');
|
|
22
29
|
|
|
23
30
|
|
|
24
31
|
var _chunkT5QVCXVBcjs = require('../chunk-T5QVCXVB.cjs');
|
|
25
32
|
|
|
33
|
+
// src/island/errors.ts
|
|
34
|
+
var ISLAND_ERRORS_KEY = "__DEN_ISLAND_ERRORS__";
|
|
35
|
+
function reportIslandError(error, context) {
|
|
36
|
+
var _a;
|
|
37
|
+
if (typeof window === "undefined") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const w = window;
|
|
41
|
+
const queue = (_a = w[ISLAND_ERRORS_KEY]) != null ? _a : [];
|
|
42
|
+
if (w[ISLAND_ERRORS_KEY] === void 0) {
|
|
43
|
+
w[ISLAND_ERRORS_KEY] = queue;
|
|
44
|
+
}
|
|
45
|
+
queue.push({ context, error });
|
|
46
|
+
}
|
|
47
|
+
|
|
26
48
|
// src/island/navigate.ts
|
|
27
49
|
var NAVIGATE_EVENT = "den:navigate";
|
|
28
50
|
function navigateIsland(node, route) {
|
|
@@ -122,4 +144,12 @@ function describeIsland(descriptor, denState) {
|
|
|
122
144
|
|
|
123
145
|
|
|
124
146
|
|
|
125
|
-
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
exports.DOCUMENT_EVENT = DOCUMENT_EVENT; exports.ISLAND_ERRORS_KEY = ISLAND_ERRORS_KEY; exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.RequestContextToken = _chunk6QV4L6R2cjs.RequestContextToken; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkM5CR4TJCcjs.activateIslandViewModels; exports.bindIslandInputs = _chunkM5CR4TJCcjs.bindIslandInputs; exports.bindRequestContext = _chunkM5CR4TJCcjs.bindRequestContext; exports.browserRequestContext = _chunkM5CR4TJCcjs.browserRequestContext; exports.collectDocumentContribution = _chunkM5CR4TJCcjs.collectDocumentContribution; exports.collectIslandState = _chunkM5CR4TJCcjs.collectIslandState; exports.createIslandContainer = _chunkM5CR4TJCcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkM5CR4TJCcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkM5CR4TJCcjs.hydrateIslandState; exports.isDocumentSource = _chunkM5CR4TJCcjs.isDocumentSource; exports.islandInputsOf = _chunkM5CR4TJCcjs.islandInputsOf; exports.matchRoute = _chunkM5CR4TJCcjs.matchRoute; exports.navigateIsland = navigateIsland; exports.normalizeRoutes = _chunkM5CR4TJCcjs.normalizeRoutes; exports.onIslandDocument = onIslandDocument; exports.onIslandNavigate = onIslandNavigate; exports.parseCookieHeader = _chunkM5CR4TJCcjs.parseCookieHeader; exports.pathPattern = _chunkM5CR4TJCcjs.pathPattern; exports.publishIslandDocument = publishIslandDocument; exports.registerIsland = registerIsland; exports.renderApp = _chunkM5CR4TJCcjs.renderApp; exports.reportIslandError = reportIslandError; exports.resolveEagerUnits = _chunkM5CR4TJCcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
|