@foxford/den 3.1.0 → 3.1.2
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 +66 -15
- 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 +124 -0
- package/builder/index.d.ts +124 -0
- package/builder/index.js +12 -0
- package/{chunk-KJ6NDOOL.js → chunk-3RX2OSUL.js} +1 -25
- package/{chunk-HJO26HIQ.js → chunk-6FNC3XMI.js} +4 -0
- package/{chunk-CZVYVNLI.cjs → chunk-6QV4L6R2.cjs} +1 -25
- package/chunk-A6ZPAM6Z.cjs +26 -0
- package/chunk-LW7IN57F.cjs +358 -0
- package/chunk-MCMYOVGT.js +358 -0
- package/{chunk-PZVUKTZG.js → chunk-MCN4GFEQ.js} +4 -2
- package/{chunk-XHYR3SGG.cjs → chunk-T5QVCXVB.cjs} +5 -1
- package/chunk-TPBI6TOU.js +26 -0
- package/{chunk-7M5OAOQ4.js → chunk-TPHJUDHG.js} +20 -4
- package/{chunk-P4QJCHMM.cjs → chunk-Z5BL4DJA.cjs} +11 -9
- package/{chunk-6ZFVV3AV.cjs → chunk-ZOU6W6ZQ.cjs} +31 -15
- 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 +6 -4
- package/den.js +60 -0
- package/{descriptor-DZDNH7R5.d.ts → descriptor-DQ6Gi7A_.d.ts} +31 -3
- package/{descriptor-h0JE9jFx.d.cts → descriptor-Dujg_1on.d.cts} +31 -3
- package/index.cjs +23 -22
- package/index.d.cts +7 -6
- package/index.d.ts +7 -6
- package/index.js +4 -3
- package/island/index.cjs +6 -5
- package/island/index.d.cts +13 -6
- package/island/index.d.ts +13 -6
- package/island/index.js +4 -3
- package/package.json +52 -26
- package/{routes-CWpIqVAM.d.ts → routes-0uXJ0fux.d.ts} +1 -1
- package/{routes-BqIoqbt1.d.cts → routes-B0hDrkiF.d.cts} +1 -1
- package/serve/index.cjs +11 -10
- package/serve/index.d.cts +4 -4
- package/serve/index.d.ts +4 -4
- package/serve/index.js +4 -3
- 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-CPI8056c.d.ts → view-adapter-B4gEb-ms.d.ts} +4 -50
- package/{view-adapter-D2597RJZ.d.cts → view-adapter-DJ7yB6Ml.d.cts} +4 -50
- package/den-serve.js +0 -146
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-Dx5qGiwk.js';
|
|
2
2
|
import { Token } from '@foxford/ioc';
|
|
3
3
|
|
|
4
4
|
/**
|
package/define.cjs
CHANGED
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZ5BL4DJAcjs = require('./chunk-Z5BL4DJA.cjs');
|
|
8
8
|
require('./chunk-C7BM4DGX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
var _chunkCZVYVNLIcjs = require('./chunk-CZVYVNLI.cjs');
|
|
15
|
-
require('./chunk-XHYR3SGG.cjs');
|
|
16
15
|
|
|
16
|
+
var _chunkA6ZPAM6Zcjs = require('./chunk-A6ZPAM6Z.cjs');
|
|
17
|
+
require('./chunk-T5QVCXVB.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
@@ -23,4 +24,5 @@ require('./chunk-XHYR3SGG.cjs');
|
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
exports.LoggerToken = _chunkA6ZPAM6Zcjs.LoggerToken; exports.SlotRegistry = _chunkZ5BL4DJAcjs.SlotRegistry; exports.SlotRegistryToken = _chunk6QV4L6R2cjs.SlotRegistryToken; exports.defineRepository = _chunkZ5BL4DJAcjs.defineRepository; exports.defineService = _chunkZ5BL4DJAcjs.defineService; exports.defineSlot = _chunkZ5BL4DJAcjs.defineSlot; exports.defineViewModel = _chunkZ5BL4DJAcjs.defineViewModel; exports.logger = _chunkA6ZPAM6Zcjs.logger; exports.scopeLogger = _chunkA6ZPAM6Zcjs.scopeLogger;
|
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 {
|
|
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-DYNCLDJY.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';
|
|
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 {
|
|
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-Cngzae6i.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';
|
|
4
4
|
import { Token, Container } from '@foxford/ioc';
|
|
5
5
|
import { HierarchicalLogger } from '@foxford/logger';
|
|
6
6
|
|
package/define.js
CHANGED
|
@@ -4,15 +4,17 @@ import {
|
|
|
4
4
|
defineService,
|
|
5
5
|
defineSlot,
|
|
6
6
|
defineViewModel
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MCN4GFEQ.js";
|
|
8
8
|
import "./chunk-WBHHHICS.js";
|
|
9
|
+
import {
|
|
10
|
+
SlotRegistryToken
|
|
11
|
+
} from "./chunk-3RX2OSUL.js";
|
|
9
12
|
import {
|
|
10
13
|
LoggerToken,
|
|
11
|
-
SlotRegistryToken,
|
|
12
14
|
logger,
|
|
13
15
|
scopeLogger
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-TPBI6TOU.js";
|
|
17
|
+
import "./chunk-6FNC3XMI.js";
|
|
16
18
|
export {
|
|
17
19
|
LoggerToken,
|
|
18
20
|
SlotRegistry,
|
package/den.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'node:child_process'
|
|
4
|
+
import { existsSync } from 'node:fs'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
// Запускатель команды: выбирает, что исполнять, и больше ничего не делает.
|
|
10
|
+
//
|
|
11
|
+
// Сама команда лежит в `src/bin/den.ts` и проходит гейты пакета — разбор аргументов это код,
|
|
12
|
+
// и типизироваться он обязан. Здесь только развилка, и нужна она потому, что пакет живёт в двух
|
|
13
|
+
// видах: в воркспейсе `exports` ведут на `src/*.ts`, и команде нужен TS-рантайм; в артефакте
|
|
14
|
+
// рядом лежит собранный модуль.
|
|
15
|
+
//
|
|
16
|
+
// Развилка по НАЛИЧИЮ исходника, а не по переменной окружения: спрашивать у человека, в каком
|
|
17
|
+
// виде стоит пакет, незачем — это видно.
|
|
18
|
+
//
|
|
19
|
+
// Шебанг один на оба вида (`node`), TS-рантайм подключается аргументом. Поэтому переписывать
|
|
20
|
+
// шебанг на сборке не нужно: файл уезжает в артефакт как есть.
|
|
21
|
+
//
|
|
22
|
+
// Сигналы пробрасываются вниз, и запуск асинхронный именно ради этого: `den dev` держит поднятым
|
|
23
|
+
// дочерний процесс приложения, а синхронный запуск обработчиков не пускает — сигнал убил бы
|
|
24
|
+
// запускатель, оставив команду и её процесс висеть на порту. В терминале это незаметно (Ctrl+C
|
|
25
|
+
// идёт всей группе), а супервизор шлёт сигнал по одному PID.
|
|
26
|
+
|
|
27
|
+
const dir = path.dirname(fileURLToPath(import.meta.url))
|
|
28
|
+
const source = path.join(dir, '..', 'src', 'bin', 'den.ts')
|
|
29
|
+
|
|
30
|
+
const target = existsSync(source)
|
|
31
|
+
? ['--import', createRequire(import.meta.url).resolve('tsx'), source]
|
|
32
|
+
: [path.join(dir, 'bin', 'den.js')]
|
|
33
|
+
|
|
34
|
+
// `detached` — не для отвязки, а ради ГРУППЫ процессов: ребёнок становится её лидером, и сигнал
|
|
35
|
+
// уходит всей группе, включая внуков. Убивать одного прямого ребёнка недостаточно — между нами
|
|
36
|
+
// и командой может встать ещё один процесс (TS-рантайм), и тогда внук переживает сигнал,
|
|
37
|
+
// продолжая держать наблюдателей файловой системы.
|
|
38
|
+
const child = spawn(process.execPath, [...target, ...process.argv.slice(2)], {
|
|
39
|
+
detached: true,
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
function killGroup(signal) {
|
|
44
|
+
try {
|
|
45
|
+
process.kill(-child.pid, signal)
|
|
46
|
+
} catch {
|
|
47
|
+
// Группы уже нет — значит и убивать некого
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
52
|
+
process.on(signal, () => killGroup(signal))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Последняя сетка: выход не по сигналу тоже не должен оставлять группу висеть
|
|
56
|
+
process.on('exit', () => killGroup('SIGTERM'))
|
|
57
|
+
|
|
58
|
+
child.on('exit', (code, signal) => {
|
|
59
|
+
process.exit(signal === null ? code ?? 1 : 1)
|
|
60
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
2
|
-
import {
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-Cngzae6i.js';
|
|
2
|
+
import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.js';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -65,6 +65,34 @@ interface IslandDescriptor {
|
|
|
65
65
|
* не нужно. Единицы слотов регистрируются в контейнере острова вместе с его собственными.
|
|
66
66
|
*/
|
|
67
67
|
slots?: Readonly<Record<string, SlotDefinition>>;
|
|
68
|
+
/**
|
|
69
|
+
* Настройка процесса перед первым рендером: разбор разметки, полифиллы, всё, что ставится
|
|
70
|
+
* один раз и нужно раньше приложения.
|
|
71
|
+
*
|
|
72
|
+
* В исходниках приложения этого поля нет — оно объявляется конфигом и вплавляется сборкой
|
|
73
|
+
* в СЕРВЕРНЫЙ выход, поэтому дескриптор остаётся декларацией. Гарантию даёт движок
|
|
74
|
+
* ({@link renderApp} зовёт настройку один раз на процесс и дожидается её), а не приложение:
|
|
75
|
+
* ждать её в активации VM пришлось бы каждому, а у приложения в процессе хоста и вовсе
|
|
76
|
+
* нет обвязки, которая могла бы дождаться.
|
|
77
|
+
*/
|
|
78
|
+
setup?: () => void | Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Ссылки на клиентские артефакты приложения — их подключает к документу хост.
|
|
81
|
+
*
|
|
82
|
+
* Тоже вплавляются сборкой: адреса известны только ей. Байты приложение не отдаёт ни в
|
|
83
|
+
* одном транспорте — за доставку отвечает CDN.
|
|
84
|
+
*/
|
|
85
|
+
assets?: AppAssets;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Клиентские артефакты приложения: только initial-чанки, в порядке подключения.
|
|
89
|
+
*
|
|
90
|
+
* Ленивые чанки сюда не попадают — их браузер дотянет сам по мере надобности, а хосту
|
|
91
|
+
* нужно ровно то, без чего страница не оживёт.
|
|
92
|
+
*/
|
|
93
|
+
interface AppAssets {
|
|
94
|
+
css: string[];
|
|
95
|
+
js: string[];
|
|
68
96
|
}
|
|
69
97
|
|
|
70
|
-
export type { IslandDescriptor as I };
|
|
98
|
+
export type { AppAssets as A, IslandDescriptor as I };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
2
|
-
import {
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-DYNCLDJY.cjs';
|
|
2
|
+
import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.cjs';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -65,6 +65,34 @@ interface IslandDescriptor {
|
|
|
65
65
|
* не нужно. Единицы слотов регистрируются в контейнере острова вместе с его собственными.
|
|
66
66
|
*/
|
|
67
67
|
slots?: Readonly<Record<string, SlotDefinition>>;
|
|
68
|
+
/**
|
|
69
|
+
* Настройка процесса перед первым рендером: разбор разметки, полифиллы, всё, что ставится
|
|
70
|
+
* один раз и нужно раньше приложения.
|
|
71
|
+
*
|
|
72
|
+
* В исходниках приложения этого поля нет — оно объявляется конфигом и вплавляется сборкой
|
|
73
|
+
* в СЕРВЕРНЫЙ выход, поэтому дескриптор остаётся декларацией. Гарантию даёт движок
|
|
74
|
+
* ({@link renderApp} зовёт настройку один раз на процесс и дожидается её), а не приложение:
|
|
75
|
+
* ждать её в активации VM пришлось бы каждому, а у приложения в процессе хоста и вовсе
|
|
76
|
+
* нет обвязки, которая могла бы дождаться.
|
|
77
|
+
*/
|
|
78
|
+
setup?: () => void | Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Ссылки на клиентские артефакты приложения — их подключает к документу хост.
|
|
81
|
+
*
|
|
82
|
+
* Тоже вплавляются сборкой: адреса известны только ей. Байты приложение не отдаёт ни в
|
|
83
|
+
* одном транспорте — за доставку отвечает CDN.
|
|
84
|
+
*/
|
|
85
|
+
assets?: AppAssets;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Клиентские артефакты приложения: только initial-чанки, в порядке подключения.
|
|
89
|
+
*
|
|
90
|
+
* Ленивые чанки сюда не попадают — их браузер дотянет сам по мере надобности, а хосту
|
|
91
|
+
* нужно ровно то, без чего страница не оживёт.
|
|
92
|
+
*/
|
|
93
|
+
interface AppAssets {
|
|
94
|
+
css: string[];
|
|
95
|
+
js: string[];
|
|
68
96
|
}
|
|
69
97
|
|
|
70
|
-
export type { IslandDescriptor as I };
|
|
98
|
+
export type { AppAssets as A, IslandDescriptor as I };
|
package/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZ5BL4DJAcjs = require('./chunk-Z5BL4DJA.cjs');
|
|
8
8
|
require('./chunk-C7BM4DGX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -18,10 +18,11 @@ var _chunkXOJ2VWX4cjs = require('./chunk-XOJ2VWX4.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunk6QV4L6R2cjs = require('./chunk-6QV4L6R2.cjs');
|
|
22
|
+
require('./chunk-A6ZPAM6Z.cjs');
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
var
|
|
25
|
+
var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
|
|
25
26
|
|
|
26
27
|
// src/core/state-registry.ts
|
|
27
28
|
var StateRegistry = class {
|
|
@@ -84,7 +85,7 @@ var ContainerManagerImpl = class {
|
|
|
84
85
|
return existing;
|
|
85
86
|
}
|
|
86
87
|
const child = this.appContainer.createChild();
|
|
87
|
-
child.bind(
|
|
88
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
88
89
|
this.pageContainers.set(routeId, child);
|
|
89
90
|
return child;
|
|
90
91
|
}
|
|
@@ -94,7 +95,7 @@ var ContainerManagerImpl = class {
|
|
|
94
95
|
* @param routeId - Идентификатор маршрута
|
|
95
96
|
*/
|
|
96
97
|
destroyPageContainer(routeId) {
|
|
97
|
-
return
|
|
98
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
98
99
|
const container = this.pageContainers.get(routeId);
|
|
99
100
|
if (container === void 0) {
|
|
100
101
|
return;
|
|
@@ -115,8 +116,8 @@ var ContainerManagerImpl = class {
|
|
|
115
116
|
return existing;
|
|
116
117
|
}
|
|
117
118
|
const child = this.appContainer.createChild();
|
|
118
|
-
child.bind(
|
|
119
|
-
child.bind(
|
|
119
|
+
child.bind(_chunk6QV4L6R2cjs.RequestContextToken).toValue(context);
|
|
120
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
120
121
|
this.requestContainers.set(requestId, child);
|
|
121
122
|
return child;
|
|
122
123
|
}
|
|
@@ -133,7 +134,7 @@ var ContainerManagerImpl = class {
|
|
|
133
134
|
* @param requestId - Уникальный идентификатор запроса
|
|
134
135
|
*/
|
|
135
136
|
destroyRequestContainer(requestId) {
|
|
136
|
-
return
|
|
137
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
137
138
|
const container = this.requestContainers.get(requestId);
|
|
138
139
|
if (container === void 0) {
|
|
139
140
|
return;
|
|
@@ -155,7 +156,7 @@ var ContainerManagerImpl = class {
|
|
|
155
156
|
return existing;
|
|
156
157
|
}
|
|
157
158
|
const child = parent.createChild();
|
|
158
|
-
child.bind(
|
|
159
|
+
child.bind(_chunk6QV4L6R2cjs.StateRegistryToken).toValue(new StateRegistry());
|
|
159
160
|
this.ssrPageContainers.set(requestId, child);
|
|
160
161
|
return child;
|
|
161
162
|
}
|
|
@@ -166,7 +167,7 @@ var ContainerManagerImpl = class {
|
|
|
166
167
|
* @param requestId - Уникальный идентификатор запроса
|
|
167
168
|
*/
|
|
168
169
|
destroySsrPageContainer(requestId) {
|
|
169
|
-
return
|
|
170
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
170
171
|
const container = this.ssrPageContainers.get(requestId);
|
|
171
172
|
if (container === void 0) {
|
|
172
173
|
return;
|
|
@@ -194,10 +195,10 @@ var GuardRunnerImpl = class {
|
|
|
194
195
|
* @param container - Опциональный контейнер для резолвинга guards
|
|
195
196
|
*/
|
|
196
197
|
runGuards(tokens, params, container) {
|
|
197
|
-
return
|
|
198
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
198
199
|
const resolveFrom = container != null ? container : this.container;
|
|
199
200
|
const results = yield Promise.all(
|
|
200
|
-
tokens.map((token) =>
|
|
201
|
+
tokens.map((token) => _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
201
202
|
const guard = yield resolveFrom.resolve(token);
|
|
202
203
|
return guard.check(params);
|
|
203
204
|
}))
|
|
@@ -286,7 +287,7 @@ var NavigationManagerImpl = class {
|
|
|
286
287
|
* Состояние считается актуальным если история и текущий элемент согласованы.
|
|
287
288
|
*/
|
|
288
289
|
checkFreshness() {
|
|
289
|
-
return
|
|
290
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
290
291
|
var _a;
|
|
291
292
|
const lastEntry = (_a = this._history.at(-1)) != null ? _a : null;
|
|
292
293
|
return lastEntry === this.current;
|
|
@@ -316,7 +317,7 @@ var NavigationManagerImpl = class {
|
|
|
316
317
|
* @returns Результат проверки
|
|
317
318
|
*/
|
|
318
319
|
runLeaveGuards(from, to) {
|
|
319
|
-
return
|
|
320
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
320
321
|
for (const interceptor of this.interceptors) {
|
|
321
322
|
const result = yield interceptor.beforeNavigate(from, to);
|
|
322
323
|
if (!result.allow) {
|
|
@@ -415,10 +416,10 @@ var StateSerializerImpl = class {
|
|
|
415
416
|
*/
|
|
416
417
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
417
418
|
getRegistry(container) {
|
|
418
|
-
if (!container.has(
|
|
419
|
+
if (!container.has(_chunk6QV4L6R2cjs.StateRegistryToken)) {
|
|
419
420
|
return void 0;
|
|
420
421
|
}
|
|
421
|
-
const resolved = container.resolve(
|
|
422
|
+
const resolved = container.resolve(_chunk6QV4L6R2cjs.StateRegistryToken);
|
|
422
423
|
return resolved instanceof Promise ? void 0 : resolved;
|
|
423
424
|
}
|
|
424
425
|
/**
|
|
@@ -462,7 +463,7 @@ var StateSerializerImpl = class {
|
|
|
462
463
|
* @param params - Параметры маршрута
|
|
463
464
|
*/
|
|
464
465
|
activateAll(container, params) {
|
|
465
|
-
return
|
|
466
|
+
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
466
467
|
const registry = this.getRegistry(container);
|
|
467
468
|
if (registry === void 0) {
|
|
468
469
|
return;
|
|
@@ -532,10 +533,10 @@ function createCore(options = {}) {
|
|
|
532
533
|
const navigationManager = new NavigationManagerImpl();
|
|
533
534
|
const stateSerializer = new StateSerializerImpl();
|
|
534
535
|
const stateCache = new StateCache();
|
|
535
|
-
container.bind(
|
|
536
|
-
container.bind(
|
|
537
|
-
container.bind(
|
|
538
|
-
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);
|
|
539
540
|
return {
|
|
540
541
|
container,
|
|
541
542
|
containerManager,
|
|
@@ -718,4 +719,4 @@ function defineLayer(token, options) {
|
|
|
718
719
|
|
|
719
720
|
|
|
720
721
|
|
|
721
|
-
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,11 +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-
|
|
8
|
-
import './descriptor-
|
|
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';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Опции для создания Core Runtime.
|
package/index.d.ts
CHANGED
|
@@ -1,11 +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-
|
|
8
|
-
import './descriptor-
|
|
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';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Опции для создания Core Runtime.
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
defineService,
|
|
5
5
|
defineSlot,
|
|
6
6
|
defineViewModel
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MCN4GFEQ.js";
|
|
8
8
|
import "./chunk-WBHHHICS.js";
|
|
9
9
|
import {
|
|
10
10
|
ViewLayerToken
|
|
@@ -18,10 +18,11 @@ import {
|
|
|
18
18
|
SlotRegistryToken,
|
|
19
19
|
StateRegistryToken,
|
|
20
20
|
StateSerializerToken
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3RX2OSUL.js";
|
|
22
|
+
import "./chunk-TPBI6TOU.js";
|
|
22
23
|
import {
|
|
23
24
|
__async
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6FNC3XMI.js";
|
|
25
26
|
|
|
26
27
|
// src/core/state-registry.ts
|
|
27
28
|
var StateRegistry = class {
|
package/island/index.cjs
CHANGED
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkZOU6W6ZQcjs = require('../chunk-ZOU6W6ZQ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkXOJ2VWX4cjs = require('../chunk-XOJ2VWX4.cjs');
|
|
20
|
-
require('../chunk-
|
|
20
|
+
require('../chunk-6QV4L6R2.cjs');
|
|
21
|
+
require('../chunk-A6ZPAM6Z.cjs');
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
var
|
|
24
|
+
var _chunkT5QVCXVBcjs = require('../chunk-T5QVCXVB.cjs');
|
|
24
25
|
|
|
25
26
|
// src/island/slot-address.ts
|
|
26
27
|
function slotAddress(app, slot) {
|
|
@@ -40,7 +41,7 @@ function notify() {
|
|
|
40
41
|
}
|
|
41
42
|
function registerIsland(record) {
|
|
42
43
|
const id = nextId++;
|
|
43
|
-
islands.set(id,
|
|
44
|
+
islands.set(id, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, { id }, record));
|
|
44
45
|
notify();
|
|
45
46
|
return () => {
|
|
46
47
|
islands.delete(id);
|
|
@@ -87,4 +88,4 @@ function describeIsland(descriptor, denState) {
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels =
|
|
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,9 +1,10 @@
|
|
|
1
|
-
import { I as IslandDescriptor } from '../descriptor-
|
|
1
|
+
import { I as IslandDescriptor, A as AppAssets } from '../descriptor-Dujg_1on.cjs';
|
|
2
2
|
import { Container } from '@foxford/ioc';
|
|
3
|
-
import { R as RequestContext } from '../types-
|
|
4
|
-
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-
|
|
5
|
-
export { R as
|
|
6
|
-
|
|
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';
|
|
7
8
|
|
|
8
9
|
/** Вклад приложения в `<head>` документа. */
|
|
9
10
|
interface DocumentHead {
|
|
@@ -201,6 +202,12 @@ interface RenderAppResult {
|
|
|
201
202
|
headHtml?: string;
|
|
202
203
|
/** Адрес для 3xx. */
|
|
203
204
|
redirect?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Ссылки на клиентские артефакты приложения — хост подключает их к документу.
|
|
207
|
+
*
|
|
208
|
+
* Только при исходе `200`: на остальных рисовать нечего, и оживлять тоже нечего.
|
|
209
|
+
*/
|
|
210
|
+
assets?: AppAssets;
|
|
204
211
|
}
|
|
205
212
|
/**
|
|
206
213
|
* Рисует приложение по адресу и отдаёт разметку вместе с состоянием.
|
|
@@ -269,4 +276,4 @@ declare function getAppContainer(): Container;
|
|
|
269
276
|
*/
|
|
270
277
|
declare function slotAddress(app: string, slot: string): string;
|
|
271
278
|
|
|
272
|
-
export { 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 };
|
|
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,9 +1,10 @@
|
|
|
1
|
-
import { I as IslandDescriptor } from '../descriptor-
|
|
1
|
+
import { I as IslandDescriptor, A as AppAssets } from '../descriptor-DQ6Gi7A_.js';
|
|
2
2
|
import { Container } from '@foxford/ioc';
|
|
3
|
-
import { R as RequestContext } from '../types-
|
|
4
|
-
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-
|
|
5
|
-
export { R as
|
|
6
|
-
|
|
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';
|
|
7
8
|
|
|
8
9
|
/** Вклад приложения в `<head>` документа. */
|
|
9
10
|
interface DocumentHead {
|
|
@@ -201,6 +202,12 @@ interface RenderAppResult {
|
|
|
201
202
|
headHtml?: string;
|
|
202
203
|
/** Адрес для 3xx. */
|
|
203
204
|
redirect?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Ссылки на клиентские артефакты приложения — хост подключает их к документу.
|
|
207
|
+
*
|
|
208
|
+
* Только при исходе `200`: на остальных рисовать нечего, и оживлять тоже нечего.
|
|
209
|
+
*/
|
|
210
|
+
assets?: AppAssets;
|
|
204
211
|
}
|
|
205
212
|
/**
|
|
206
213
|
* Рисует приложение по адресу и отдаёт разметку вместе с состоянием.
|
|
@@ -269,4 +276,4 @@ declare function getAppContainer(): Container;
|
|
|
269
276
|
*/
|
|
270
277
|
declare function slotAddress(app: string, slot: string): string;
|
|
271
278
|
|
|
272
|
-
export { 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 };
|
|
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.js
CHANGED
|
@@ -11,16 +11,17 @@ import {
|
|
|
11
11
|
pathPattern,
|
|
12
12
|
renderApp,
|
|
13
13
|
resolveEagerUnits
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-TPHJUDHG.js";
|
|
15
15
|
import {
|
|
16
16
|
ViewLayerToken,
|
|
17
17
|
resolveViewAdapter,
|
|
18
18
|
viewAdapterOf
|
|
19
19
|
} from "../chunk-E23E2VUC.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-3RX2OSUL.js";
|
|
21
|
+
import "../chunk-TPBI6TOU.js";
|
|
21
22
|
import {
|
|
22
23
|
__spreadValues
|
|
23
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-6FNC3XMI.js";
|
|
24
25
|
|
|
25
26
|
// src/island/slot-address.ts
|
|
26
27
|
function slotAddress(app, slot) {
|