@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 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
- | `GET /_render?url=<path+search>` | `200` + ответ `renderApp` телом |
183
- | `GET /_routes` | `200` + массив regex-строк заявки на адреса |
184
- | `GET /_health` | `200 ok` |
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
@@ -1,4 +1,4 @@
1
- export { R as RequestContext } from './types-Dx5qGiwk.cjs';
1
+ export { R as RequestContext } from './types-BxMQ-VOd.cjs';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
package/adapter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { R as RequestContext } from './types-Dx5qGiwk.js';
1
+ export { R as RequestContext } from './types-BxMQ-VOd.js';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -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 container = createIslandContainer(descriptor, { parent: request.parent });
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 container = createIslandContainer(descriptor, { parent: request.parent });
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
- exports.isDocumentSource = isDocumentSource; 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;
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-Dx5qGiwk.js';
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-Dx5qGiwk.cjs';
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
  /**
@@ -1,4 +1,4 @@
1
- import { c as Definition, L as LayerDefinition } from './types-Dx5qGiwk.cjs';
1
+ import { c as Definition, L as LayerDefinition } from './types-BxMQ-VOd.cjs';
2
2
  import { Container } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { c as Definition, L as LayerDefinition } from './types-Dx5qGiwk.js';
1
+ import { c as Definition, L as LayerDefinition } from './types-BxMQ-VOd.js';
2
2
  import { Container } 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-CwAXed2X.cjs';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-DouHW8RK.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-Dx5qGiwk.cjs';
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-q_T4hqeP.js';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-TkqbLySB.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-Dx5qGiwk.js';
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-TkqbLySB.js';
2
- import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.js';
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-DouHW8RK.cjs';
2
- import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.cjs';
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, 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';
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-CwAXed2X.cjs';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-DouHW8RK.cjs';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DF1me25J.cjs';
8
- import './descriptor-w8oxeIAe.cjs';
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, 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';
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-q_T4hqeP.js';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-TkqbLySB.js';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-BV62bdhM.js';
8
- import './descriptor-tWPa9j-x.js';
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
- var _chunkXDM6J4LJcjs = require('../chunk-XDM6J4LJ.cjs');
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
- require('../chunk-6QV4L6R2.cjs');
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
- exports.DOCUMENT_EVENT = DOCUMENT_EVENT; exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkXDM6J4LJcjs.activateIslandViewModels; exports.collectDocumentContribution = _chunkXDM6J4LJcjs.collectDocumentContribution; exports.collectIslandState = _chunkXDM6J4LJcjs.collectIslandState; exports.createIslandContainer = _chunkXDM6J4LJcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkXDM6J4LJcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkXDM6J4LJcjs.hydrateIslandState; exports.isDocumentSource = _chunkXDM6J4LJcjs.isDocumentSource; exports.matchRoute = _chunkXDM6J4LJcjs.matchRoute; exports.navigateIsland = navigateIsland; exports.normalizeRoutes = _chunkXDM6J4LJcjs.normalizeRoutes; exports.onIslandDocument = onIslandDocument; exports.onIslandNavigate = onIslandNavigate; exports.pathPattern = _chunkXDM6J4LJcjs.pathPattern; exports.publishIslandDocument = publishIslandDocument; exports.registerIsland = registerIsland; exports.renderApp = _chunkXDM6J4LJcjs.renderApp; exports.resolveEagerUnits = _chunkXDM6J4LJcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
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;