@foxford/den 3.2.0 → 3.2.2-beta-cb8f0c1-20260825
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 +35 -0
- package/bin/den.cjs +4 -3
- package/bin/den.js +2 -1
- package/builder/index.cjs +3 -2
- package/builder/index.d.cts +8 -3
- package/builder/index.d.ts +8 -3
- package/builder/index.js +2 -1
- package/{chunk-RRR2DJMN.cjs → chunk-3X4WVHUU.cjs} +43 -15
- package/{chunk-MCN4GFEQ.js → chunk-E56BKBQZ.js} +2 -1
- package/{chunk-Z5BL4DJA.cjs → chunk-H5DKRHHQ.cjs} +2 -1
- package/chunk-KQAB6C6Q.cjs +15 -0
- package/chunk-RG7ZV5BD.js +15 -0
- package/{chunk-TPHJUDHG.js → chunk-SOH2TL2N.js} +35 -20
- package/{chunk-ZOU6W6ZQ.cjs → chunk-XDM6J4LJ.cjs} +35 -20
- package/{chunk-BMI5HNGE.js → chunk-XU5HUIPK.js} +43 -15
- package/{define-slot-DYNCLDJY.d.cts → define-slot-DouHW8RK.d.cts} +14 -1
- package/{define-slot-Cngzae6i.d.ts → define-slot-TkqbLySB.d.ts} +14 -1
- package/define.cjs +2 -2
- package/define.d.cts +1 -1
- package/define.d.ts +1 -1
- package/define.js +1 -1
- package/{descriptor-DQ6Gi7A_.d.ts → descriptor-tWPa9j-x.d.ts} +17 -7
- package/{descriptor-Dujg_1on.d.cts → descriptor-w8oxeIAe.d.cts} +17 -7
- package/index.cjs +2 -2
- package/index.d.cts +3 -3
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/island/index.cjs +2 -2
- package/island/index.d.cts +14 -7
- package/island/index.d.ts +14 -7
- package/island/index.js +1 -1
- package/package.json +25 -16
- package/serve/index.cjs +9 -5
- package/serve/index.d.cts +12 -3
- package/serve/index.d.ts +12 -3
- package/serve/index.js +5 -1
- package/{view-adapter-B4gEb-ms.d.ts → view-adapter-BV62bdhM.d.ts} +1 -1
- package/{view-adapter-DJ7yB6Ml.d.cts → view-adapter-DF1me25J.d.cts} +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadAppEnv
|
|
3
|
+
} from "./chunk-RG7ZV5BD.js";
|
|
1
4
|
import {
|
|
2
5
|
logger
|
|
3
6
|
} from "./chunk-TPBI6TOU.js";
|
|
@@ -92,7 +95,9 @@ import config from ${JSON.stringify(configPath)}
|
|
|
92
95
|
const server = config.server ?? {}
|
|
93
96
|
|
|
94
97
|
async function setup() {
|
|
95
|
-
|
|
98
|
+
if (app.viewLayer) {
|
|
99
|
+
viewAdapterOf(app.viewLayer).installResolver()
|
|
100
|
+
}
|
|
96
101
|
server.container?.(getAppContainer())
|
|
97
102
|
await server.setup?.()
|
|
98
103
|
}
|
|
@@ -109,11 +114,16 @@ export default descriptor
|
|
|
109
114
|
function generateServerProcess(configPath, base, mode) {
|
|
110
115
|
const assets = mode === "development" ? ` assets: { base: ${JSON.stringify(base)}, dir: fileURLToPath(new URL('./client', import.meta.url)) },
|
|
111
116
|
` : "";
|
|
112
|
-
return
|
|
117
|
+
return `import { fileURLToPath } from 'node:url'
|
|
118
|
+
|
|
119
|
+
import { loadAppEnv, serveApp } from '@foxford/den/serve'
|
|
113
120
|
|
|
114
121
|
import app from ${JSON.stringify(VIRTUAL_SERVER_APP)}
|
|
115
122
|
import config from ${JSON.stringify(configPath)}
|
|
116
123
|
|
|
124
|
+
// \u0423\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044F \u043E\u043A\u0440\u0443\u0436\u0435\u043D\u0438\u044F \u2014 \u0434\u043E \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u0447\u0442\u0435\u043D\u0438\u044F: \u043F\u043E\u0440\u0442 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0438\u0442\u0430\u044E\u0442\u0441\u044F \u043D\u0438\u0436\u0435
|
|
125
|
+
loadAppEnv(fileURLToPath(new URL('..', import.meta.url)))
|
|
126
|
+
|
|
117
127
|
await serveApp(app, {
|
|
118
128
|
${assets} configure: config.server?.configure,
|
|
119
129
|
host: process.env.HOST,
|
|
@@ -126,7 +136,14 @@ ${assets} configure: config.server?.configure,
|
|
|
126
136
|
function denAppModules(options) {
|
|
127
137
|
const { assets, base, config, configPath, entry, mode } = options;
|
|
128
138
|
const sources = {
|
|
129
|
-
|
|
139
|
+
// Клиентский вход спрашивают только у клиентского выхода, а его без пресета не собирают.
|
|
140
|
+
// Отказ здесь означает, что выход всё-таки запустили, — это ошибка команд, а не приложения
|
|
141
|
+
[VIRTUAL_CLIENT]: () => {
|
|
142
|
+
if (!config.preset) {
|
|
143
|
+
throw new Error("den: \u043A\u043B\u0438\u0435\u043D\u0442\u0441\u043A\u0438\u0439 \u0432\u0445\u043E\u0434 \u0437\u0430\u043F\u0440\u043E\u0448\u0435\u043D, \u043D\u043E \u043F\u0440\u0435\u0441\u0435\u0442 \u043D\u0435 \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u2014 \u043E\u0436\u0438\u0432\u043B\u044F\u0442\u044C \u043D\u0435\u0447\u0435\u043C");
|
|
144
|
+
}
|
|
145
|
+
return generateClientEntry(entry, config.preset.clientEntry);
|
|
146
|
+
},
|
|
130
147
|
[VIRTUAL_SERVER_APP]: () => generateServerApp(entry, configPath, assets),
|
|
131
148
|
[VIRTUAL_SERVER_PROCESS]: () => generateServerProcess(configPath, base, mode)
|
|
132
149
|
};
|
|
@@ -167,8 +184,8 @@ function loadAppConfig(root) {
|
|
|
167
184
|
try {
|
|
168
185
|
const loaded = yield server.ssrLoadModule(configPath);
|
|
169
186
|
const config = loaded.default;
|
|
170
|
-
if (!
|
|
171
|
-
throw new Error(`den: ${CONFIG_FILE} \u043D\u0435 \u043E\
|
|
187
|
+
if (!config) {
|
|
188
|
+
throw new Error(`den: ${CONFIG_FILE} \u043D\u0435 \u043E\u0442\u0434\u0430\u0451\u0442 \u043A\u043E\u043D\u0444\u0438\u0433 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u2014 \u0441\u043E\u0431\u0438\u0440\u0430\u0442\u044C \u043D\u0435\u0447\u0435\u043C`);
|
|
172
189
|
}
|
|
173
190
|
return { config, configPath };
|
|
174
191
|
} finally {
|
|
@@ -186,7 +203,7 @@ function dependenciesOf(root) {
|
|
|
186
203
|
return [...Object.keys((_a = manifest.dependencies) != null ? _a : {}), ...Object.keys((_b = manifest.devDependencies) != null ? _b : {})];
|
|
187
204
|
}
|
|
188
205
|
function viteConfigFor(options) {
|
|
189
|
-
var _a, _b, _c;
|
|
206
|
+
var _a, _b, _c, _d, _e;
|
|
190
207
|
const { assets, base, config, configPath, entryFileNames, input, mode, outDir, root, target } = options;
|
|
191
208
|
const entry = (_a = config.entry) != null ? _a : "src/index.ts";
|
|
192
209
|
const composed = {
|
|
@@ -211,34 +228,43 @@ function viteConfigFor(options) {
|
|
|
211
228
|
// программный вызов он иначе не доедет.
|
|
212
229
|
mode,
|
|
213
230
|
plugins: [
|
|
214
|
-
...config.preset.plugins,
|
|
231
|
+
...(_c = (_b = config.preset) == null ? void 0 : _b.plugins) != null ? _c : [],
|
|
215
232
|
denAppModules({ assets, base, config, configPath, entry: path2.join(root, entry), mode })
|
|
216
233
|
],
|
|
217
234
|
root,
|
|
218
|
-
ssr: { noExternal: (
|
|
235
|
+
ssr: { noExternal: (_e = (_d = config.server) == null ? void 0 : _d.noExternal) != null ? _e : [] }
|
|
219
236
|
};
|
|
220
237
|
return config.vite ? config.vite(composed, target) : composed;
|
|
221
238
|
}
|
|
222
239
|
function buildApp(options) {
|
|
223
240
|
return __async(this, null, function* () {
|
|
224
|
-
var _a, _b, _c
|
|
241
|
+
var _a, _b, _c;
|
|
225
242
|
const { mode = "production" } = options;
|
|
226
243
|
process.env["NODE_ENV"] = mode;
|
|
227
244
|
const root = path2.resolve(options.root);
|
|
245
|
+
loadAppEnv(root);
|
|
228
246
|
const { config, configPath } = yield loadAppConfig(root);
|
|
229
247
|
const port = resolvePort((_a = config.server) == null ? void 0 : _a.port);
|
|
230
248
|
const base = (_b = options.base) != null ? _b : "";
|
|
231
|
-
const
|
|
249
|
+
const { preset } = config;
|
|
250
|
+
const refusal = (_c = preset == null ? void 0 : preset.validate) == null ? void 0 : _c.call(preset, dependenciesOf(root));
|
|
232
251
|
if (refusal !== void 0 && refusal !== null) {
|
|
233
252
|
throw new Error(`den: ${refusal}`);
|
|
234
253
|
}
|
|
235
254
|
const { build } = yield import("vite");
|
|
236
255
|
const shared = { base, config, configPath, mode, root };
|
|
237
256
|
const empty = { css: [], js: [] };
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
257
|
+
let assets = empty;
|
|
258
|
+
if (preset) {
|
|
259
|
+
logger.info(`\u0441\u0431\u043E\u0440\u043A\u0430 \u043A\u043B\u0438\u0435\u043D\u0442\u0441\u043A\u043E\u0433\u043E \u0432\u044B\u0445\u043E\u0434\u0430 (${preset.view})`);
|
|
260
|
+
yield build(
|
|
261
|
+
viteConfigFor(__spreadProps(__spreadValues({}, shared), { assets: empty, input: VIRTUAL_CLIENT, outDir: OUT_CLIENT, target: "client" }))
|
|
262
|
+
);
|
|
263
|
+
assets = collectAssets(path2.join(root, OUT_CLIENT), base);
|
|
264
|
+
logger.info(`\u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u044B: ${String(assets.js.length)} js, ${String(assets.css.length)} css`);
|
|
265
|
+
} else {
|
|
266
|
+
logger.info("\u043A\u043B\u0438\u0435\u043D\u0442\u0441\u043A\u043E\u0433\u043E \u0432\u044B\u0445\u043E\u0434\u0430 \u043D\u0435\u0442: \u043F\u0440\u0435\u0441\u0435\u0442 \u043D\u0435 \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D, \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0441\u0432\u043E\u0435\u0433\u043E \u0444\u0440\u0430\u0433\u043C\u0435\u043D\u0442\u0430 \u043D\u0435 \u0440\u0438\u0441\u0443\u0435\u0442");
|
|
267
|
+
}
|
|
242
268
|
logger.info("\u0441\u0431\u043E\u0440\u043A\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043D\u043E\u0433\u043E \u0434\u0435\u0441\u043A\u0440\u0438\u043F\u0442\u043E\u0440\u0430");
|
|
243
269
|
yield build(
|
|
244
270
|
viteConfigFor(__spreadProps(__spreadValues({}, shared), {
|
|
@@ -309,7 +335,9 @@ function bannerLines(facts2) {
|
|
|
309
335
|
`${label("\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E")}http://localhost:${port}`,
|
|
310
336
|
...network === void 0 ? [] : [`${label("\u0432 \u0441\u0435\u0442\u0438")}http://${network}:${port}`],
|
|
311
337
|
`${label("\u0440\u0443\u0447\u043A\u0438")}${ENDPOINTS.join(" ")}`,
|
|
312
|
-
|
|
338
|
+
// Префикс печатается, только когда он есть: при относительной сборке артефакты идут с
|
|
339
|
+
// адреса самого приложения, а он уже назван строкой выше
|
|
340
|
+
...facts2.base === void 0 || facts2.base === "" ? [] : [`${label("\u043F\u0440\u0435\u0444\u0438\u043A\u0441")}${facts2.base}`],
|
|
313
341
|
`${label("\u0447\u0430\u043D\u043A\u0438")}${assetsSummary(facts2.assets)}`,
|
|
314
342
|
`${label("\u0432\u044B\u0445\u043E\u0434\u044B")}${OUTPUTS.join(", ")}`,
|
|
315
343
|
`${label("\u043F\u0440\u0430\u0432\u043A\u0438")}${facts2.watched.join(", ")}`,
|
|
@@ -19,6 +19,8 @@ interface SlotDefinition {
|
|
|
19
19
|
readonly units: readonly Definition<unknown>[];
|
|
20
20
|
/** View-слой слота, если он переопределён (см. {@link DefineSlotOptions.viewLayer}). */
|
|
21
21
|
readonly viewLayer?: LayerDefinition;
|
|
22
|
+
/** Где место находится — как объявил хозяин (см. {@link DefineSlotOptions.note}). */
|
|
23
|
+
readonly note?: string;
|
|
22
24
|
/**
|
|
23
25
|
* Регистрирует единицы слота и кладёт сам слот в `SlotRegistry` контейнера.
|
|
24
26
|
* @param container - Контейнер (острова/страницы/запроса)
|
|
@@ -43,6 +45,17 @@ interface DefineSlotOptions {
|
|
|
43
45
|
* фреймворке, чем принимающий остров.
|
|
44
46
|
*/
|
|
45
47
|
viewLayer?: LayerDefinition;
|
|
48
|
+
/**
|
|
49
|
+
* Где это место находится — словами, для инструментов.
|
|
50
|
+
*
|
|
51
|
+
* Из ключа карты `slots` видно ИМЯ места, но не то, куда оно вставлено: `belowMenu` может
|
|
52
|
+
* оказаться и под меню, и внутри него, и за границей экрана. Занимающему место соседу это
|
|
53
|
+
* знание нужно раньше, чем он туда встанет, а взять его неоткуда — view слота непрозрачен
|
|
54
|
+
* для ядра, а разметка принадлежит хозяину.
|
|
55
|
+
*
|
|
56
|
+
* Заполняется вручную и на поведение не влияет: ядро эту строку только передаёт.
|
|
57
|
+
*/
|
|
58
|
+
note?: string;
|
|
46
59
|
}
|
|
47
60
|
/**
|
|
48
61
|
* Объявляет слот — самостоятельную `define*`-единицу расширения.
|
|
@@ -69,6 +82,6 @@ interface DefineSlotOptions {
|
|
|
69
82
|
* // любой пакет — экспортит слот-юнит, не зная, куда он смонтируется и как будет назван
|
|
70
83
|
* export const chatSlot = defineSlot({ view: ChatView, units: [chatRepository] })
|
|
71
84
|
*/
|
|
72
|
-
declare function defineSlot({ view, units, viewLayer }?: DefineSlotOptions): SlotDefinition;
|
|
85
|
+
declare function defineSlot({ note, view, units, viewLayer }?: DefineSlotOptions): SlotDefinition;
|
|
73
86
|
|
|
74
87
|
export { type DefineSlotOptions as D, type SlotDefinition as S, defineSlot as d };
|
|
@@ -19,6 +19,8 @@ interface SlotDefinition {
|
|
|
19
19
|
readonly units: readonly Definition<unknown>[];
|
|
20
20
|
/** View-слой слота, если он переопределён (см. {@link DefineSlotOptions.viewLayer}). */
|
|
21
21
|
readonly viewLayer?: LayerDefinition;
|
|
22
|
+
/** Где место находится — как объявил хозяин (см. {@link DefineSlotOptions.note}). */
|
|
23
|
+
readonly note?: string;
|
|
22
24
|
/**
|
|
23
25
|
* Регистрирует единицы слота и кладёт сам слот в `SlotRegistry` контейнера.
|
|
24
26
|
* @param container - Контейнер (острова/страницы/запроса)
|
|
@@ -43,6 +45,17 @@ interface DefineSlotOptions {
|
|
|
43
45
|
* фреймворке, чем принимающий остров.
|
|
44
46
|
*/
|
|
45
47
|
viewLayer?: LayerDefinition;
|
|
48
|
+
/**
|
|
49
|
+
* Где это место находится — словами, для инструментов.
|
|
50
|
+
*
|
|
51
|
+
* Из ключа карты `slots` видно ИМЯ места, но не то, куда оно вставлено: `belowMenu` может
|
|
52
|
+
* оказаться и под меню, и внутри него, и за границей экрана. Занимающему место соседу это
|
|
53
|
+
* знание нужно раньше, чем он туда встанет, а взять его неоткуда — view слота непрозрачен
|
|
54
|
+
* для ядра, а разметка принадлежит хозяину.
|
|
55
|
+
*
|
|
56
|
+
* Заполняется вручную и на поведение не влияет: ядро эту строку только передаёт.
|
|
57
|
+
*/
|
|
58
|
+
note?: string;
|
|
46
59
|
}
|
|
47
60
|
/**
|
|
48
61
|
* Объявляет слот — самостоятельную `define*`-единицу расширения.
|
|
@@ -69,6 +82,6 @@ interface DefineSlotOptions {
|
|
|
69
82
|
* // любой пакет — экспортит слот-юнит, не зная, куда он смонтируется и как будет назван
|
|
70
83
|
* export const chatSlot = defineSlot({ view: ChatView, units: [chatRepository] })
|
|
71
84
|
*/
|
|
72
|
-
declare function defineSlot({ view, units, viewLayer }?: DefineSlotOptions): SlotDefinition;
|
|
85
|
+
declare function defineSlot({ note, view, units, viewLayer }?: DefineSlotOptions): SlotDefinition;
|
|
73
86
|
|
|
74
87
|
export { type DefineSlotOptions as D, type SlotDefinition as S, defineSlot as d };
|
package/define.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkH5DKRHHQcjs = require('./chunk-H5DKRHHQ.cjs');
|
|
8
8
|
require('./chunk-C7BM4DGX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -25,4 +25,4 @@ require('./chunk-T5QVCXVB.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
exports.LoggerToken = _chunkA6ZPAM6Zcjs.LoggerToken; exports.SlotRegistry =
|
|
28
|
+
exports.LoggerToken = _chunkA6ZPAM6Zcjs.LoggerToken; exports.SlotRegistry = _chunkH5DKRHHQcjs.SlotRegistry; exports.SlotRegistryToken = _chunk6QV4L6R2cjs.SlotRegistryToken; exports.defineRepository = _chunkH5DKRHHQcjs.defineRepository; exports.defineService = _chunkH5DKRHHQcjs.defineService; exports.defineSlot = _chunkH5DKRHHQcjs.defineSlot; exports.defineViewModel = _chunkH5DKRHHQcjs.defineViewModel; exports.logger = _chunkA6ZPAM6Zcjs.logger; exports.scopeLogger = _chunkA6ZPAM6Zcjs.scopeLogger;
|
package/define.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-DouHW8RK.cjs';
|
|
3
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';
|
package/define.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-TkqbLySB.js';
|
|
3
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';
|
package/define.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-TkqbLySB.js';
|
|
2
2
|
import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.js';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
@@ -14,6 +14,11 @@ import { Token } from '@foxford/ioc';
|
|
|
14
14
|
* шире: у каждого своя часть про оркестрацию — `load`, `routes`, `provides`/`requires`,
|
|
15
15
|
* вклад в документ. Сводить их в один тип нечем, оркестраторы у хостов разные. Общее
|
|
16
16
|
* ровно это, и структурная типизация делает остальное: дескриптор хоста подходит сюда как есть.
|
|
17
|
+
*
|
|
18
|
+
* `view` и `viewLayer` объявляются ПАРОЙ либо не объявляются вовсе. Приложение без них —
|
|
19
|
+
* законный случай: оно сообщает документу данные (`describeDocument`), а рисует его кусок
|
|
20
|
+
* кто-то другой, например клиент монолита. Жизненный цикл у такого приложения тот же —
|
|
21
|
+
* контейнер, единицы, активация VM, — поэтому второго вида дескриптора нет.
|
|
17
22
|
*/
|
|
18
23
|
interface IslandDescriptor {
|
|
19
24
|
/**
|
|
@@ -25,16 +30,16 @@ interface IslandDescriptor {
|
|
|
25
30
|
* второго оно обязательное: без него у мест приложения не было бы адреса.
|
|
26
31
|
*/
|
|
27
32
|
name: string;
|
|
28
|
-
/** Непрозрачная ссылка на view острова (компонент view-фреймворка)
|
|
29
|
-
view
|
|
33
|
+
/** Непрозрачная ссылка на view острова (компонент view-фреймворка); нет — приложение не рисует. */
|
|
34
|
+
view?: unknown;
|
|
30
35
|
/**
|
|
31
36
|
* View-слой — чем остров рисовать: `defineLayer(ViewLayerToken, { adapter: reactAdapter() })`.
|
|
32
37
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* Дефолта нет ни у ядра, ни у хоста: фреймворк за приложение не выбирают. Слой
|
|
39
|
+
* регистрируется в контейнере острова, поэтому слоты внутри по умолчанию рисуются им же;
|
|
40
|
+
* слот перекрывает выбор своим `viewLayer`.
|
|
36
41
|
*/
|
|
37
|
-
viewLayer
|
|
42
|
+
viewLayer?: LayerDefinition;
|
|
38
43
|
/**
|
|
39
44
|
* Data/Business единицы (repository/service). Регистрируются в контейнере острова.
|
|
40
45
|
* Не должны импортировать VM.
|
|
@@ -89,10 +94,15 @@ interface IslandDescriptor {
|
|
|
89
94
|
*
|
|
90
95
|
* Ленивые чанки сюда не попадают — их браузер дотянет сам по мере надобности, а хосту
|
|
91
96
|
* нужно ровно то, без чего страница не оживёт.
|
|
97
|
+
*
|
|
98
|
+
* Вид скриптов объявлен здесь же, потому что знает его СБОРКА: теги печатает хост, но выбрать
|
|
99
|
+
* между `type="module"` и классическим `defer` он может, только зная, чем приложение собрано.
|
|
92
100
|
*/
|
|
93
101
|
interface AppAssets {
|
|
94
102
|
css: string[];
|
|
95
103
|
js: string[];
|
|
104
|
+
/** Чем подключать `js`; не объявлен — `module`. */
|
|
105
|
+
scripts?: 'module' | 'classic';
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
export type { AppAssets as A, IslandDescriptor as I };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SlotDefinition } from './define-slot-
|
|
1
|
+
import { S as SlotDefinition } from './define-slot-DouHW8RK.cjs';
|
|
2
2
|
import { L as LayerDefinition, c as Definition } from './types-Dx5qGiwk.cjs';
|
|
3
3
|
import { Token } from '@foxford/ioc';
|
|
4
4
|
|
|
@@ -14,6 +14,11 @@ import { Token } from '@foxford/ioc';
|
|
|
14
14
|
* шире: у каждого своя часть про оркестрацию — `load`, `routes`, `provides`/`requires`,
|
|
15
15
|
* вклад в документ. Сводить их в один тип нечем, оркестраторы у хостов разные. Общее
|
|
16
16
|
* ровно это, и структурная типизация делает остальное: дескриптор хоста подходит сюда как есть.
|
|
17
|
+
*
|
|
18
|
+
* `view` и `viewLayer` объявляются ПАРОЙ либо не объявляются вовсе. Приложение без них —
|
|
19
|
+
* законный случай: оно сообщает документу данные (`describeDocument`), а рисует его кусок
|
|
20
|
+
* кто-то другой, например клиент монолита. Жизненный цикл у такого приложения тот же —
|
|
21
|
+
* контейнер, единицы, активация VM, — поэтому второго вида дескриптора нет.
|
|
17
22
|
*/
|
|
18
23
|
interface IslandDescriptor {
|
|
19
24
|
/**
|
|
@@ -25,16 +30,16 @@ interface IslandDescriptor {
|
|
|
25
30
|
* второго оно обязательное: без него у мест приложения не было бы адреса.
|
|
26
31
|
*/
|
|
27
32
|
name: string;
|
|
28
|
-
/** Непрозрачная ссылка на view острова (компонент view-фреймворка)
|
|
29
|
-
view
|
|
33
|
+
/** Непрозрачная ссылка на view острова (компонент view-фреймворка); нет — приложение не рисует. */
|
|
34
|
+
view?: unknown;
|
|
30
35
|
/**
|
|
31
36
|
* View-слой — чем остров рисовать: `defineLayer(ViewLayerToken, { adapter: reactAdapter() })`.
|
|
32
37
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* Дефолта нет ни у ядра, ни у хоста: фреймворк за приложение не выбирают. Слой
|
|
39
|
+
* регистрируется в контейнере острова, поэтому слоты внутри по умолчанию рисуются им же;
|
|
40
|
+
* слот перекрывает выбор своим `viewLayer`.
|
|
36
41
|
*/
|
|
37
|
-
viewLayer
|
|
42
|
+
viewLayer?: LayerDefinition;
|
|
38
43
|
/**
|
|
39
44
|
* Data/Business единицы (repository/service). Регистрируются в контейнере острова.
|
|
40
45
|
* Не должны импортировать VM.
|
|
@@ -89,10 +94,15 @@ interface IslandDescriptor {
|
|
|
89
94
|
*
|
|
90
95
|
* Ленивые чанки сюда не попадают — их браузер дотянет сам по мере надобности, а хосту
|
|
91
96
|
* нужно ровно то, без чего страница не оживёт.
|
|
97
|
+
*
|
|
98
|
+
* Вид скриптов объявлен здесь же, потому что знает его СБОРКА: теги печатает хост, но выбрать
|
|
99
|
+
* между `type="module"` и классическим `defer` он может, только зная, чем приложение собрано.
|
|
92
100
|
*/
|
|
93
101
|
interface AppAssets {
|
|
94
102
|
css: string[];
|
|
95
103
|
js: string[];
|
|
104
|
+
/** Чем подключать `js`; не объявлен — `module`. */
|
|
105
|
+
scripts?: 'module' | 'classic';
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
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 _chunkH5DKRHHQcjs = require('./chunk-H5DKRHHQ.cjs');
|
|
8
8
|
require('./chunk-C7BM4DGX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -719,4 +719,4 @@ function defineLayer(token, options) {
|
|
|
719
719
|
|
|
720
720
|
|
|
721
721
|
|
|
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 =
|
|
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 = _chunkH5DKRHHQcjs.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 = _chunkH5DKRHHQcjs.defineRepository; exports.defineService = _chunkH5DKRHHQcjs.defineService; exports.defineSlot = _chunkH5DKRHHQcjs.defineSlot; exports.defineViewModel = _chunkH5DKRHHQcjs.defineViewModel;
|
package/index.d.cts
CHANGED
|
@@ -3,9 +3,9 @@ export { B as Activatable, F as ActivatableToken, H as ContainerManagerToken, D
|
|
|
3
3
|
import { Container, Token } from '@foxford/ioc';
|
|
4
4
|
import { DefinitionResolver } from './adapter.cjs';
|
|
5
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-
|
|
7
|
-
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-
|
|
8
|
-
import './descriptor-
|
|
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';
|
|
9
9
|
import './server-render-CocWXQKC.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
package/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export { B as Activatable, F as ActivatableToken, H as ContainerManagerToken, D
|
|
|
3
3
|
import { Container, Token } from '@foxford/ioc';
|
|
4
4
|
import { DefinitionResolver } from './adapter.js';
|
|
5
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-
|
|
7
|
-
export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-
|
|
8
|
-
import './descriptor-
|
|
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';
|
|
9
9
|
import './server-render-CocWXQKC.js';
|
|
10
10
|
|
|
11
11
|
/**
|
package/index.js
CHANGED
package/island/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkXDM6J4LJcjs = require('../chunk-XDM6J4LJ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -122,4 +122,4 @@ function describeIsland(descriptor, denState) {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
exports.DOCUMENT_EVENT = DOCUMENT_EVENT; exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels =
|
|
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;
|
package/island/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AppAssets, I as IslandDescriptor } from '../descriptor-w8oxeIAe.cjs';
|
|
2
2
|
import { Container } from '@foxford/ioc';
|
|
3
3
|
import { R as RequestContext } from '../types-Dx5qGiwk.cjs';
|
|
4
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
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-
|
|
7
|
-
import '../define-slot-
|
|
6
|
+
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DF1me25J.cjs';
|
|
7
|
+
import '../define-slot-DouHW8RK.cjs';
|
|
8
8
|
|
|
9
9
|
/** Вклад приложения в `<head>` документа. */
|
|
10
10
|
interface DocumentHead {
|
|
@@ -33,6 +33,10 @@ interface DocumentContribution {
|
|
|
33
33
|
status?: number;
|
|
34
34
|
/** Адрес для 3xx. Объявлен без статуса — исход `302`. */
|
|
35
35
|
redirect?: string;
|
|
36
|
+
/** Данные документа, состав которых знает только шаблон хоста. */
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
/** Артефакты этого адреса; не объявлены — берутся вплавленные сборкой. */
|
|
39
|
+
assets?: AppAssets;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* VM, которой есть что сказать про документ.
|
|
@@ -138,10 +142,11 @@ declare function collectIslandState(container: Container, descriptor: IslandDesc
|
|
|
138
142
|
/**
|
|
139
143
|
* Собирает вклад острова в документ по всем его VM.
|
|
140
144
|
*
|
|
141
|
-
* Правила слияния два, и они следуют из смысла полей. `head` —
|
|
142
|
-
* объявленное позже уточняет объявленное раньше. Исход (`status` вместе с `redirect`)
|
|
143
|
-
* ОДНО
|
|
144
|
-
* статус одной VM склеился бы с адресом
|
|
145
|
+
* Правила слияния два, и они следуют из смысла полей. `head` и `data` — наборы полей, поэтому
|
|
146
|
+
* объявленное позже уточняет объявленное раньше. Исход (`status` вместе с `redirect`) и
|
|
147
|
+
* артефакты — ОДНО решение каждое, а не набор: побеждает первое объявленное, и берётся оно
|
|
148
|
+
* целиком. Иначе статус одной VM склеился бы с адресом другой, а списки чанков двух VM —
|
|
149
|
+
* в набор, который не грузил ни один клиент.
|
|
145
150
|
*
|
|
146
151
|
* @param container - Контейнер острова
|
|
147
152
|
* @param descriptor - Дескриптор острова
|
|
@@ -241,6 +246,8 @@ interface RenderAppResult {
|
|
|
241
246
|
head?: DocumentHead;
|
|
242
247
|
/** Вклад в `<head>` готовой разметкой — стили, собранные во время рендера. */
|
|
243
248
|
headHtml?: string;
|
|
249
|
+
/** Данные документа, состав которых знает шаблон хоста. */
|
|
250
|
+
data?: Record<string, unknown>;
|
|
244
251
|
/** Адрес для 3xx. */
|
|
245
252
|
redirect?: string;
|
|
246
253
|
/**
|
package/island/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AppAssets, I as IslandDescriptor } from '../descriptor-tWPa9j-x.js';
|
|
2
2
|
import { Container } from '@foxford/ioc';
|
|
3
3
|
import { R as RequestContext } from '../types-Dx5qGiwk.js';
|
|
4
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
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-
|
|
7
|
-
import '../define-slot-
|
|
6
|
+
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-BV62bdhM.js';
|
|
7
|
+
import '../define-slot-TkqbLySB.js';
|
|
8
8
|
|
|
9
9
|
/** Вклад приложения в `<head>` документа. */
|
|
10
10
|
interface DocumentHead {
|
|
@@ -33,6 +33,10 @@ interface DocumentContribution {
|
|
|
33
33
|
status?: number;
|
|
34
34
|
/** Адрес для 3xx. Объявлен без статуса — исход `302`. */
|
|
35
35
|
redirect?: string;
|
|
36
|
+
/** Данные документа, состав которых знает только шаблон хоста. */
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
/** Артефакты этого адреса; не объявлены — берутся вплавленные сборкой. */
|
|
39
|
+
assets?: AppAssets;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* VM, которой есть что сказать про документ.
|
|
@@ -138,10 +142,11 @@ declare function collectIslandState(container: Container, descriptor: IslandDesc
|
|
|
138
142
|
/**
|
|
139
143
|
* Собирает вклад острова в документ по всем его VM.
|
|
140
144
|
*
|
|
141
|
-
* Правила слияния два, и они следуют из смысла полей. `head` —
|
|
142
|
-
* объявленное позже уточняет объявленное раньше. Исход (`status` вместе с `redirect`)
|
|
143
|
-
* ОДНО
|
|
144
|
-
* статус одной VM склеился бы с адресом
|
|
145
|
+
* Правила слияния два, и они следуют из смысла полей. `head` и `data` — наборы полей, поэтому
|
|
146
|
+
* объявленное позже уточняет объявленное раньше. Исход (`status` вместе с `redirect`) и
|
|
147
|
+
* артефакты — ОДНО решение каждое, а не набор: побеждает первое объявленное, и берётся оно
|
|
148
|
+
* целиком. Иначе статус одной VM склеился бы с адресом другой, а списки чанков двух VM —
|
|
149
|
+
* в набор, который не грузил ни один клиент.
|
|
145
150
|
*
|
|
146
151
|
* @param container - Контейнер острова
|
|
147
152
|
* @param descriptor - Дескриптор острова
|
|
@@ -241,6 +246,8 @@ interface RenderAppResult {
|
|
|
241
246
|
head?: DocumentHead;
|
|
242
247
|
/** Вклад в `<head>` готовой разметкой — стили, собранные во время рендера. */
|
|
243
248
|
headHtml?: string;
|
|
249
|
+
/** Данные документа, состав которых знает шаблон хоста. */
|
|
250
|
+
data?: Record<string, unknown>;
|
|
244
251
|
/** Адрес для 3xx. */
|
|
245
252
|
redirect?: string;
|
|
246
253
|
/**
|