@foxford/den 3.5.0 → 3.6.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/bin/den.cjs +3 -3
- package/bin/den.js +1 -1
- package/builder/index.cjs +2 -2
- package/builder/index.d.cts +9 -0
- package/builder/index.d.ts +9 -0
- package/builder/index.js +1 -1
- package/{chunk-4XR6EUOW.js → chunk-2GTQK2PZ.js} +31 -9
- package/{chunk-G6RT4EBO.cjs → chunk-P4J4M2WZ.cjs} +31 -9
- package/{chunk-JMRHLOBD.cjs → chunk-QTWJTYZW.cjs} +48 -17
- package/{chunk-VO3ORM7Z.js → chunk-XQ7EHXHG.js} +48 -17
- package/island/index.cjs +8 -2
- package/island/index.d.cts +43 -5
- package/island/index.d.ts +43 -5
- package/island/index.js +8 -2
- package/package.json +6 -6
- package/serve/index.cjs +5 -5
- package/serve/index.js +1 -1
package/bin/den.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkP4J4M2WZcjs = require('../chunk-P4J4M2WZ.cjs');
|
|
5
5
|
require('../chunk-KQAB6C6Q.cjs');
|
|
6
6
|
require('../chunk-A6ZPAM6Z.cjs');
|
|
7
7
|
|
|
@@ -70,11 +70,11 @@ function run(argv) {
|
|
|
70
70
|
}
|
|
71
71
|
const target = { base: options["base"], root: (_a = options["root"]) != null ? _a : process.cwd() };
|
|
72
72
|
if (command === "build") {
|
|
73
|
-
yield
|
|
73
|
+
yield _chunkP4J4M2WZcjs.buildApp.call(void 0, target);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
if (command === "dev") {
|
|
77
|
-
yield
|
|
77
|
+
yield _chunkP4J4M2WZcjs.devApp.call(void 0, target);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
fail(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430 \xAB${command}\xBB`);
|
package/bin/den.js
CHANGED
package/builder/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkP4J4M2WZcjs = require('../chunk-P4J4M2WZ.cjs');
|
|
6
6
|
require('../chunk-KQAB6C6Q.cjs');
|
|
7
7
|
require('../chunk-A6ZPAM6Z.cjs');
|
|
8
8
|
require('../chunk-T5QVCXVB.cjs');
|
|
@@ -10,4 +10,4 @@ require('../chunk-T5QVCXVB.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.buildApp =
|
|
13
|
+
exports.buildApp = _chunkP4J4M2WZcjs.buildApp; exports.defineAppConfig = _chunkP4J4M2WZcjs.defineAppConfig; exports.devApp = _chunkP4J4M2WZcjs.devApp;
|
package/builder/index.d.cts
CHANGED
|
@@ -98,6 +98,15 @@ interface AppConfig {
|
|
|
98
98
|
*/
|
|
99
99
|
preset?: AppBuildPreset;
|
|
100
100
|
server?: AppServerConfig;
|
|
101
|
+
/**
|
|
102
|
+
* Расширения рантайма — модули, чей default-экспорт это `RuntimeExtension` из
|
|
103
|
+
* `@foxford/den/island`: `['@foxford/den-sdk/runtime']`.
|
|
104
|
+
*
|
|
105
|
+
* Именами, а не значениями, по той же причине, что и `clientEntry`: расширение ставится и
|
|
106
|
+
* в браузере, и на сервере, а конфиг живёт в процессе сборки и в бандл не переезжает.
|
|
107
|
+
* Обвязка обоих выходов импортирует их и ставит в контейнер приложения до первого острова.
|
|
108
|
+
*/
|
|
109
|
+
runtime?: string[];
|
|
101
110
|
/**
|
|
102
111
|
* Последнее слово за приложением: правит собранный конфиг сборщика перед запуском.
|
|
103
112
|
*
|
package/builder/index.d.ts
CHANGED
|
@@ -98,6 +98,15 @@ interface AppConfig {
|
|
|
98
98
|
*/
|
|
99
99
|
preset?: AppBuildPreset;
|
|
100
100
|
server?: AppServerConfig;
|
|
101
|
+
/**
|
|
102
|
+
* Расширения рантайма — модули, чей default-экспорт это `RuntimeExtension` из
|
|
103
|
+
* `@foxford/den/island`: `['@foxford/den-sdk/runtime']`.
|
|
104
|
+
*
|
|
105
|
+
* Именами, а не значениями, по той же причине, что и `clientEntry`: расширение ставится и
|
|
106
|
+
* в браузере, и на сервере, а конфиг живёт в процессе сборки и в бандл не переезжает.
|
|
107
|
+
* Обвязка обоих выходов импортирует их и ставит в контейнер приложения до первого острова.
|
|
108
|
+
*/
|
|
109
|
+
runtime?: string[];
|
|
101
110
|
/**
|
|
102
111
|
* Последнее слово за приложением: правит собранный конфиг сборщика перед запуском.
|
|
103
112
|
*
|
package/builder/index.js
CHANGED
|
@@ -79,26 +79,44 @@ var VIRTUAL_SERVER_PROCESS = "virtual:den/server-process";
|
|
|
79
79
|
function toResolvedId(id) {
|
|
80
80
|
return `\0${id}`;
|
|
81
81
|
}
|
|
82
|
-
function generateClientEntry(entry, clientEntry) {
|
|
83
|
-
return
|
|
82
|
+
function generateClientEntry(entry, clientEntry, runtime = []) {
|
|
83
|
+
return `${runtimeImports(runtime)}import app from ${JSON.stringify(entry)}
|
|
84
84
|
import { hydrateApp } from ${JSON.stringify(clientEntry)}
|
|
85
85
|
|
|
86
|
-
hydrateApp(app)
|
|
86
|
+
${runtimeInstall(runtime)}hydrateApp(app)
|
|
87
87
|
`;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
89
|
+
function runtimeImports(runtime) {
|
|
90
|
+
if (runtime.length === 0) {
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
return `import { getAppContainer, installRuntime } from '@foxford/den/island'
|
|
94
|
+
${runtime.map((specifier, index) => `import runtime${String(index)} from ${JSON.stringify(specifier)}`).join("\n")}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
function runtimeInstall(runtime) {
|
|
98
|
+
if (runtime.length === 0) {
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
return `installRuntime(getAppContainer(), [${runtime.map((_, index) => `runtime${String(index)}`).join(", ")}])
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
function generateServerApp(entry, configPath, assets, runtime = []) {
|
|
105
|
+
const imports = runtime.map((specifier, index) => `import runtime${String(index)} from ${JSON.stringify(specifier)}
|
|
106
|
+
`).join("");
|
|
107
|
+
const install = runtime.length === 0 ? "" : ` ${runtimeInstall(runtime)}`;
|
|
108
|
+
return `import { getAppContainer, installRuntime, viewAdapterOf } from '@foxford/den/island'
|
|
91
109
|
|
|
92
110
|
import app from ${JSON.stringify(entry)}
|
|
93
111
|
import config from ${JSON.stringify(configPath)}
|
|
94
|
-
|
|
112
|
+
${imports}
|
|
95
113
|
const server = config.server ?? {}
|
|
96
114
|
|
|
97
115
|
async function setup() {
|
|
98
116
|
if (app.viewLayer) {
|
|
99
117
|
viewAdapterOf(app.viewLayer).installResolver()
|
|
100
118
|
}
|
|
101
|
-
server.container?.(getAppContainer())
|
|
119
|
+
${install} server.container?.(getAppContainer())
|
|
102
120
|
await server.setup?.()
|
|
103
121
|
}
|
|
104
122
|
|
|
@@ -139,12 +157,16 @@ function denAppModules(options) {
|
|
|
139
157
|
// Клиентский вход спрашивают только у клиентского выхода, а его без пресета не собирают.
|
|
140
158
|
// Отказ здесь означает, что выход всё-таки запустили, — это ошибка команд, а не приложения
|
|
141
159
|
[VIRTUAL_CLIENT]: () => {
|
|
160
|
+
var _a;
|
|
142
161
|
if (!config.preset) {
|
|
143
162
|
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
163
|
}
|
|
145
|
-
return generateClientEntry(entry, config.preset.clientEntry);
|
|
164
|
+
return generateClientEntry(entry, config.preset.clientEntry, (_a = config.runtime) != null ? _a : []);
|
|
165
|
+
},
|
|
166
|
+
[VIRTUAL_SERVER_APP]: () => {
|
|
167
|
+
var _a;
|
|
168
|
+
return generateServerApp(entry, configPath, assets, (_a = config.runtime) != null ? _a : []);
|
|
146
169
|
},
|
|
147
|
-
[VIRTUAL_SERVER_APP]: () => generateServerApp(entry, configPath, assets),
|
|
148
170
|
[VIRTUAL_SERVER_PROCESS]: () => generateServerProcess(configPath, base, mode)
|
|
149
171
|
};
|
|
150
172
|
return {
|
|
@@ -79,26 +79,44 @@ var VIRTUAL_SERVER_PROCESS = "virtual:den/server-process";
|
|
|
79
79
|
function toResolvedId(id) {
|
|
80
80
|
return `\0${id}`;
|
|
81
81
|
}
|
|
82
|
-
function generateClientEntry(entry, clientEntry) {
|
|
83
|
-
return
|
|
82
|
+
function generateClientEntry(entry, clientEntry, runtime = []) {
|
|
83
|
+
return `${runtimeImports(runtime)}import app from ${JSON.stringify(entry)}
|
|
84
84
|
import { hydrateApp } from ${JSON.stringify(clientEntry)}
|
|
85
85
|
|
|
86
|
-
hydrateApp(app)
|
|
86
|
+
${runtimeInstall(runtime)}hydrateApp(app)
|
|
87
87
|
`;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
89
|
+
function runtimeImports(runtime) {
|
|
90
|
+
if (runtime.length === 0) {
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
return `import { getAppContainer, installRuntime } from '@foxford/den/island'
|
|
94
|
+
${runtime.map((specifier, index) => `import runtime${String(index)} from ${JSON.stringify(specifier)}`).join("\n")}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
function runtimeInstall(runtime) {
|
|
98
|
+
if (runtime.length === 0) {
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
return `installRuntime(getAppContainer(), [${runtime.map((_, index) => `runtime${String(index)}`).join(", ")}])
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
function generateServerApp(entry, configPath, assets, runtime = []) {
|
|
105
|
+
const imports = runtime.map((specifier, index) => `import runtime${String(index)} from ${JSON.stringify(specifier)}
|
|
106
|
+
`).join("");
|
|
107
|
+
const install = runtime.length === 0 ? "" : ` ${runtimeInstall(runtime)}`;
|
|
108
|
+
return `import { getAppContainer, installRuntime, viewAdapterOf } from '@foxford/den/island'
|
|
91
109
|
|
|
92
110
|
import app from ${JSON.stringify(entry)}
|
|
93
111
|
import config from ${JSON.stringify(configPath)}
|
|
94
|
-
|
|
112
|
+
${imports}
|
|
95
113
|
const server = config.server ?? {}
|
|
96
114
|
|
|
97
115
|
async function setup() {
|
|
98
116
|
if (app.viewLayer) {
|
|
99
117
|
viewAdapterOf(app.viewLayer).installResolver()
|
|
100
118
|
}
|
|
101
|
-
server.container?.(getAppContainer())
|
|
119
|
+
${install} server.container?.(getAppContainer())
|
|
102
120
|
await server.setup?.()
|
|
103
121
|
}
|
|
104
122
|
|
|
@@ -139,12 +157,16 @@ function denAppModules(options) {
|
|
|
139
157
|
// Клиентский вход спрашивают только у клиентского выхода, а его без пресета не собирают.
|
|
140
158
|
// Отказ здесь означает, что выход всё-таки запустили, — это ошибка команд, а не приложения
|
|
141
159
|
[VIRTUAL_CLIENT]: () => {
|
|
160
|
+
var _a;
|
|
142
161
|
if (!config.preset) {
|
|
143
162
|
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
163
|
}
|
|
145
|
-
return generateClientEntry(entry, config.preset.clientEntry);
|
|
164
|
+
return generateClientEntry(entry, config.preset.clientEntry, (_a = config.runtime) != null ? _a : []);
|
|
165
|
+
},
|
|
166
|
+
[VIRTUAL_SERVER_APP]: () => {
|
|
167
|
+
var _a;
|
|
168
|
+
return generateServerApp(entry, configPath, assets, (_a = config.runtime) != null ? _a : []);
|
|
146
169
|
},
|
|
147
|
-
[VIRTUAL_SERVER_APP]: () => generateServerApp(entry, configPath, assets),
|
|
148
170
|
[VIRTUAL_SERVER_PROCESS]: () => generateServerProcess(configPath, base, mode)
|
|
149
171
|
};
|
|
150
172
|
return {
|
|
@@ -19,14 +19,55 @@ function isDocumentSource(value) {
|
|
|
19
19
|
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// src/island/runtime.ts
|
|
23
|
+
var _ioc = require('@foxford/ioc');
|
|
24
|
+
var appContainer = null;
|
|
25
|
+
function getAppContainer() {
|
|
26
|
+
var _a;
|
|
27
|
+
if (appContainer === null) {
|
|
28
|
+
appContainer = new (0, _ioc.Container)();
|
|
29
|
+
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug("app-\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D");
|
|
30
|
+
}
|
|
31
|
+
return appContainer;
|
|
32
|
+
}
|
|
33
|
+
var RuntimeExtensionsToken = _ioc.createToken.call(void 0, "den:RuntimeExtensions");
|
|
34
|
+
function installRuntime(container, extensions) {
|
|
35
|
+
var _a;
|
|
36
|
+
const installed = container.has(RuntimeExtensionsToken) ? container.resolve(RuntimeExtensionsToken) : bindInstalled(container);
|
|
37
|
+
for (const extension of extensions) {
|
|
38
|
+
for (const unit of extension.units) {
|
|
39
|
+
unit.register(container);
|
|
40
|
+
}
|
|
41
|
+
installed.push(extension);
|
|
42
|
+
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug(`\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u0440\u0430\u043D\u0442\u0430\u0439\u043C\u0430 \xAB${extension.name}\xBB \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function bindInstalled(container) {
|
|
46
|
+
const installed = [];
|
|
47
|
+
container.bind(RuntimeExtensionsToken).toValue(installed);
|
|
48
|
+
return installed;
|
|
49
|
+
}
|
|
50
|
+
function runtimeRequiresOf(container) {
|
|
51
|
+
if (!container.has(RuntimeExtensionsToken)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
return container.resolve(RuntimeExtensionsToken).flatMap((extension) => {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = extension.requires) != null ? _a : [];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
22
60
|
// src/island/inputs.ts
|
|
23
|
-
function
|
|
61
|
+
function requiredTokens(descriptor, container) {
|
|
24
62
|
var _a;
|
|
63
|
+
return [...(_a = descriptor.requires) != null ? _a : [], ...runtimeRequiresOf(container)];
|
|
64
|
+
}
|
|
65
|
+
function islandInputsOf(descriptor, source, container = getAppContainer()) {
|
|
25
66
|
const inputs = {};
|
|
26
67
|
if (source === void 0) {
|
|
27
68
|
return inputs;
|
|
28
69
|
}
|
|
29
|
-
for (const token of (
|
|
70
|
+
for (const token of requiredTokens(descriptor, container)) {
|
|
30
71
|
const value = source[token.description];
|
|
31
72
|
if (value !== void 0) {
|
|
32
73
|
inputs[token.description] = value;
|
|
@@ -35,11 +76,10 @@ function islandInputsOf(descriptor, source) {
|
|
|
35
76
|
return inputs;
|
|
36
77
|
}
|
|
37
78
|
function bindIslandInputs(container, descriptor, inputs) {
|
|
38
|
-
var _a;
|
|
39
79
|
if (inputs === void 0) {
|
|
40
80
|
return;
|
|
41
81
|
}
|
|
42
|
-
for (const token of (
|
|
82
|
+
for (const token of requiredTokens(descriptor, container)) {
|
|
43
83
|
const value = inputs[token.description];
|
|
44
84
|
if (value !== void 0) {
|
|
45
85
|
container.bind(token).toValue(value);
|
|
@@ -70,18 +110,6 @@ function bindRequestContext(container, context) {
|
|
|
70
110
|
}
|
|
71
111
|
}
|
|
72
112
|
|
|
73
|
-
// src/island/runtime.ts
|
|
74
|
-
var _ioc = require('@foxford/ioc');
|
|
75
|
-
var appContainer = null;
|
|
76
|
-
function getAppContainer() {
|
|
77
|
-
var _a;
|
|
78
|
-
if (appContainer === null) {
|
|
79
|
-
appContainer = new (0, _ioc.Container)();
|
|
80
|
-
((_a = _chunkA6ZPAM6Zcjs.logger.getLogger("island:runtime")) != null ? _a : _chunkA6ZPAM6Zcjs.logger).debug("app-\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D");
|
|
81
|
-
}
|
|
82
|
-
return appContainer;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
113
|
// src/island/lifecycle.ts
|
|
86
114
|
var _logger = require('@foxford/logger');
|
|
87
115
|
var EMPTY_ROUTE = { params: {}, pathname: "", search: "" };
|
|
@@ -298,4 +326,7 @@ function pathPattern(pattern) {
|
|
|
298
326
|
|
|
299
327
|
|
|
300
328
|
|
|
301
|
-
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
exports.isDocumentSource = isDocumentSource; exports.getAppContainer = getAppContainer; exports.RuntimeExtensionsToken = RuntimeExtensionsToken; exports.installRuntime = installRuntime; exports.runtimeRequiresOf = runtimeRequiresOf; exports.islandInputsOf = islandInputsOf; exports.bindIslandInputs = bindIslandInputs; exports.parseCookieHeader = parseCookieHeader; exports.browserRequestContext = browserRequestContext; exports.bindRequestContext = bindRequestContext; 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;
|
|
@@ -19,14 +19,55 @@ function isDocumentSource(value) {
|
|
|
19
19
|
return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// src/island/runtime.ts
|
|
23
|
+
import { Container, createToken } from "@foxford/ioc";
|
|
24
|
+
var appContainer = null;
|
|
25
|
+
function getAppContainer() {
|
|
26
|
+
var _a;
|
|
27
|
+
if (appContainer === null) {
|
|
28
|
+
appContainer = new Container();
|
|
29
|
+
((_a = logger.getLogger("island:runtime")) != null ? _a : logger).debug("app-\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D");
|
|
30
|
+
}
|
|
31
|
+
return appContainer;
|
|
32
|
+
}
|
|
33
|
+
var RuntimeExtensionsToken = createToken("den:RuntimeExtensions");
|
|
34
|
+
function installRuntime(container, extensions) {
|
|
35
|
+
var _a;
|
|
36
|
+
const installed = container.has(RuntimeExtensionsToken) ? container.resolve(RuntimeExtensionsToken) : bindInstalled(container);
|
|
37
|
+
for (const extension of extensions) {
|
|
38
|
+
for (const unit of extension.units) {
|
|
39
|
+
unit.register(container);
|
|
40
|
+
}
|
|
41
|
+
installed.push(extension);
|
|
42
|
+
((_a = logger.getLogger("island:runtime")) != null ? _a : logger).debug(`\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 \u0440\u0430\u043D\u0442\u0430\u0439\u043C\u0430 \xAB${extension.name}\xBB \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function bindInstalled(container) {
|
|
46
|
+
const installed = [];
|
|
47
|
+
container.bind(RuntimeExtensionsToken).toValue(installed);
|
|
48
|
+
return installed;
|
|
49
|
+
}
|
|
50
|
+
function runtimeRequiresOf(container) {
|
|
51
|
+
if (!container.has(RuntimeExtensionsToken)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
return container.resolve(RuntimeExtensionsToken).flatMap((extension) => {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = extension.requires) != null ? _a : [];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
22
60
|
// src/island/inputs.ts
|
|
23
|
-
function
|
|
61
|
+
function requiredTokens(descriptor, container) {
|
|
24
62
|
var _a;
|
|
63
|
+
return [...(_a = descriptor.requires) != null ? _a : [], ...runtimeRequiresOf(container)];
|
|
64
|
+
}
|
|
65
|
+
function islandInputsOf(descriptor, source, container = getAppContainer()) {
|
|
25
66
|
const inputs = {};
|
|
26
67
|
if (source === void 0) {
|
|
27
68
|
return inputs;
|
|
28
69
|
}
|
|
29
|
-
for (const token of (
|
|
70
|
+
for (const token of requiredTokens(descriptor, container)) {
|
|
30
71
|
const value = source[token.description];
|
|
31
72
|
if (value !== void 0) {
|
|
32
73
|
inputs[token.description] = value;
|
|
@@ -35,11 +76,10 @@ function islandInputsOf(descriptor, source) {
|
|
|
35
76
|
return inputs;
|
|
36
77
|
}
|
|
37
78
|
function bindIslandInputs(container, descriptor, inputs) {
|
|
38
|
-
var _a;
|
|
39
79
|
if (inputs === void 0) {
|
|
40
80
|
return;
|
|
41
81
|
}
|
|
42
|
-
for (const token of (
|
|
82
|
+
for (const token of requiredTokens(descriptor, container)) {
|
|
43
83
|
const value = inputs[token.description];
|
|
44
84
|
if (value !== void 0) {
|
|
45
85
|
container.bind(token).toValue(value);
|
|
@@ -70,18 +110,6 @@ function bindRequestContext(container, context) {
|
|
|
70
110
|
}
|
|
71
111
|
}
|
|
72
112
|
|
|
73
|
-
// src/island/runtime.ts
|
|
74
|
-
import { Container } from "@foxford/ioc";
|
|
75
|
-
var appContainer = null;
|
|
76
|
-
function getAppContainer() {
|
|
77
|
-
var _a;
|
|
78
|
-
if (appContainer === null) {
|
|
79
|
-
appContainer = new Container();
|
|
80
|
-
((_a = logger.getLogger("island:runtime")) != null ? _a : logger).debug("app-\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u0441\u043E\u0437\u0434\u0430\u043D");
|
|
81
|
-
}
|
|
82
|
-
return appContainer;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
113
|
// src/island/lifecycle.ts
|
|
86
114
|
import { log } from "@foxford/logger";
|
|
87
115
|
var EMPTY_ROUTE = { params: {}, pathname: "", search: "" };
|
|
@@ -282,12 +310,15 @@ function pathPattern(pattern) {
|
|
|
282
310
|
|
|
283
311
|
export {
|
|
284
312
|
isDocumentSource,
|
|
313
|
+
getAppContainer,
|
|
314
|
+
RuntimeExtensionsToken,
|
|
315
|
+
installRuntime,
|
|
316
|
+
runtimeRequiresOf,
|
|
285
317
|
islandInputsOf,
|
|
286
318
|
bindIslandInputs,
|
|
287
319
|
parseCookieHeader,
|
|
288
320
|
browserRequestContext,
|
|
289
321
|
bindRequestContext,
|
|
290
|
-
getAppContainer,
|
|
291
322
|
createIslandContainer,
|
|
292
323
|
hydrateIslandState,
|
|
293
324
|
activateIslandViewModels,
|
package/island/index.cjs
CHANGED
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkQTWJTYZWcjs = require('../chunk-QTWJTYZW.cjs');
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
|
|
@@ -152,4 +155,7 @@ function describeIsland(descriptor, denState) {
|
|
|
152
155
|
|
|
153
156
|
|
|
154
157
|
|
|
155
|
-
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
exports.DOCUMENT_EVENT = DOCUMENT_EVENT; exports.ISLAND_ERRORS_KEY = ISLAND_ERRORS_KEY; exports.NAVIGATE_EVENT = NAVIGATE_EVENT; exports.RequestContextToken = _chunk6QV4L6R2cjs.RequestContextToken; exports.RuntimeExtensionsToken = _chunkQTWJTYZWcjs.RuntimeExtensionsToken; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = _chunkQTWJTYZWcjs.activateIslandViewModels; exports.bindIslandInputs = _chunkQTWJTYZWcjs.bindIslandInputs; exports.bindRequestContext = _chunkQTWJTYZWcjs.bindRequestContext; exports.browserRequestContext = _chunkQTWJTYZWcjs.browserRequestContext; exports.collectDocumentContribution = _chunkQTWJTYZWcjs.collectDocumentContribution; exports.collectIslandState = _chunkQTWJTYZWcjs.collectIslandState; exports.createIslandContainer = _chunkQTWJTYZWcjs.createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = _chunkQTWJTYZWcjs.getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = _chunkQTWJTYZWcjs.hydrateIslandState; exports.installRuntime = _chunkQTWJTYZWcjs.installRuntime; exports.isDocumentSource = _chunkQTWJTYZWcjs.isDocumentSource; exports.islandInputsOf = _chunkQTWJTYZWcjs.islandInputsOf; exports.matchRoute = _chunkQTWJTYZWcjs.matchRoute; exports.navigateIsland = navigateIsland; exports.normalizeRoutes = _chunkQTWJTYZWcjs.normalizeRoutes; exports.onIslandDocument = onIslandDocument; exports.onIslandNavigate = onIslandNavigate; exports.parseCookieHeader = _chunkQTWJTYZWcjs.parseCookieHeader; exports.pathPattern = _chunkQTWJTYZWcjs.pathPattern; exports.publishIslandDocument = publishIslandDocument; exports.registerIsland = registerIsland; exports.renderApp = _chunkQTWJTYZWcjs.renderApp; exports.reportIslandError = reportIslandError; exports.resolveEagerUnits = _chunkQTWJTYZWcjs.resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.runtimeRequiresOf = _chunkQTWJTYZWcjs.runtimeRequiresOf; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;
|
package/island/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as AppAssets, I as IslandDescriptor } from '../descriptor-C2j6Zz6c.cjs';
|
|
2
|
-
import { R as RequestContext } from '../types-BxMQ-VOd.cjs';
|
|
2
|
+
import { R as RequestContext, c as Definition } from '../types-BxMQ-VOd.cjs';
|
|
3
3
|
export { i as RequestContextToken } from '../types-BxMQ-VOd.cjs';
|
|
4
|
-
import { Container } from '@foxford/ioc';
|
|
4
|
+
import { Container, Token } from '@foxford/ioc';
|
|
5
5
|
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-BvV405k4.cjs';
|
|
6
6
|
export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.cjs';
|
|
7
7
|
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DMLlp3Iu.cjs';
|
|
@@ -254,13 +254,14 @@ declare function publishIslandDocument(node: EventTarget, contribution: Document
|
|
|
254
254
|
declare function onIslandDocument(node: EventTarget, onDocument: (contribution: DocumentContribution) => void): () => void;
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* Входные данные, объявленные
|
|
257
|
+
* Входные данные, объявленные дескриптором и расширениями рантайма, из переданного набора.
|
|
258
258
|
*
|
|
259
259
|
* @param descriptor - Дескриптор острова
|
|
260
260
|
* @param source - Набор по ключу `token.description`: тело запроса либо состояние документа
|
|
261
|
+
* @param container - Контейнер с расширениями; по умолчанию контейнер приложения
|
|
261
262
|
* @returns Только объявленные и присутствующие ключи
|
|
262
263
|
*/
|
|
263
|
-
declare function islandInputsOf(descriptor: IslandDescriptor, source: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
264
|
+
declare function islandInputsOf(descriptor: IslandDescriptor, source: Record<string, unknown> | undefined, container?: Container): Record<string, unknown>;
|
|
264
265
|
/**
|
|
265
266
|
* Биндит входные данные в контейнер острова под объявленными токенами.
|
|
266
267
|
*
|
|
@@ -394,6 +395,43 @@ declare function describeIsland(descriptor: IslandDescriptor, denState?: Record<
|
|
|
394
395
|
|
|
395
396
|
/** App-scope контейнер федерации (создаётся при первом обращении). */
|
|
396
397
|
declare function getAppContainer(): Container;
|
|
398
|
+
/**
|
|
399
|
+
* Расширение рантайма: то, что приложение получает от платформы, а не пишет само, — клиенты
|
|
400
|
+
* бэкенда, метки, всё, что закрывает заявку дескриптора живым кодом одинаково у любого
|
|
401
|
+
* приложения.
|
|
402
|
+
*
|
|
403
|
+
* Ставится один раз на процесс и на вкладку, в контейнер уровня приложения: единицы
|
|
404
|
+
* расширения резолвятся из любого острова по parent-chain, а фабрика исполняется с
|
|
405
|
+
* контейнером острова, поэтому экземпляр получается свой на остров и на запрос. Заявка
|
|
406
|
+
* расширения (`requires`) добавляется к заявке каждого острова: данные, которые нужны
|
|
407
|
+
* расширению, хост отдаёт, хотя приложение их не называет.
|
|
408
|
+
*/
|
|
409
|
+
interface RuntimeExtension {
|
|
410
|
+
/** Имя — для логов и панели. */
|
|
411
|
+
name: string;
|
|
412
|
+
/** Что расширение просит у хоста данными. */
|
|
413
|
+
requires?: ReadonlyArray<Token<unknown>>;
|
|
414
|
+
/** Что расширение отдаёт: единицы в контейнер уровня приложения. */
|
|
415
|
+
units: ReadonlyArray<Definition<unknown>>;
|
|
416
|
+
}
|
|
417
|
+
/** Установленные расширения — по ним остров дополняет свою заявку. */
|
|
418
|
+
declare const RuntimeExtensionsToken: Token<readonly RuntimeExtension[]>;
|
|
419
|
+
/**
|
|
420
|
+
* Ставит расширения рантайма в контейнер уровня приложения.
|
|
421
|
+
*
|
|
422
|
+
* Повторный вызов дополняет список, а не заменяет: хост и сетевой процесс ставят свои
|
|
423
|
+
* расширения независимо, и порядок установки им знать незачем.
|
|
424
|
+
*
|
|
425
|
+
* @param container - Контейнер уровня приложения (`getAppContainer()`)
|
|
426
|
+
* @param extensions - Расширения
|
|
427
|
+
*/
|
|
428
|
+
declare function installRuntime(container: Container, extensions: ReadonlyArray<RuntimeExtension>): void;
|
|
429
|
+
/**
|
|
430
|
+
* Заявка установленных расширений — токены, которые хост закрывает данными.
|
|
431
|
+
*
|
|
432
|
+
* @param container - Любой контейнер цепочки: остров, запрос либо сам контейнер приложения
|
|
433
|
+
*/
|
|
434
|
+
declare function runtimeRequiresOf(container: Container): ReadonlyArray<Token<unknown>>;
|
|
397
435
|
|
|
398
436
|
/**
|
|
399
437
|
* Глобальный адрес слота — `market-app:aside`.
|
|
@@ -412,4 +450,4 @@ declare function getAppContainer(): Container;
|
|
|
412
450
|
*/
|
|
413
451
|
declare function slotAddress(app: string, slot: string): string;
|
|
414
452
|
|
|
415
|
-
export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, ISLAND_ERRORS_KEY, IslandDescriptor, type IslandErrorContext, type IslandErrorPhase, type IslandErrorReport, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, RequestContext, activateIslandViewModels, bindIslandInputs, bindRequestContext, browserRequestContext, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, islandInputsOf, navigateIsland, onIslandDocument, onIslandNavigate, parseCookieHeader, publishIslandDocument, registerIsland, renderApp, reportIslandError, resolveEagerUnits, slotAddress, subscribeIslands };
|
|
453
|
+
export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, ISLAND_ERRORS_KEY, IslandDescriptor, type IslandErrorContext, type IslandErrorPhase, type IslandErrorReport, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, RequestContext, type RuntimeExtension, RuntimeExtensionsToken, activateIslandViewModels, bindIslandInputs, bindRequestContext, browserRequestContext, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, installRuntime, isDocumentSource, islandInputsOf, navigateIsland, onIslandDocument, onIslandNavigate, parseCookieHeader, publishIslandDocument, registerIsland, renderApp, reportIslandError, resolveEagerUnits, runtimeRequiresOf, slotAddress, subscribeIslands };
|
package/island/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as AppAssets, I as IslandDescriptor } from '../descriptor-BSaHM5B4.js';
|
|
2
|
-
import { R as RequestContext } from '../types-BxMQ-VOd.js';
|
|
2
|
+
import { R as RequestContext, c as Definition } from '../types-BxMQ-VOd.js';
|
|
3
3
|
export { i as RequestContextToken } from '../types-BxMQ-VOd.js';
|
|
4
|
-
import { Container } from '@foxford/ioc';
|
|
4
|
+
import { Container, Token } from '@foxford/ioc';
|
|
5
5
|
export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-Di3K_0uQ.js';
|
|
6
6
|
export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.js';
|
|
7
7
|
export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DNLRSFka.js';
|
|
@@ -254,13 +254,14 @@ declare function publishIslandDocument(node: EventTarget, contribution: Document
|
|
|
254
254
|
declare function onIslandDocument(node: EventTarget, onDocument: (contribution: DocumentContribution) => void): () => void;
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* Входные данные, объявленные
|
|
257
|
+
* Входные данные, объявленные дескриптором и расширениями рантайма, из переданного набора.
|
|
258
258
|
*
|
|
259
259
|
* @param descriptor - Дескриптор острова
|
|
260
260
|
* @param source - Набор по ключу `token.description`: тело запроса либо состояние документа
|
|
261
|
+
* @param container - Контейнер с расширениями; по умолчанию контейнер приложения
|
|
261
262
|
* @returns Только объявленные и присутствующие ключи
|
|
262
263
|
*/
|
|
263
|
-
declare function islandInputsOf(descriptor: IslandDescriptor, source: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
264
|
+
declare function islandInputsOf(descriptor: IslandDescriptor, source: Record<string, unknown> | undefined, container?: Container): Record<string, unknown>;
|
|
264
265
|
/**
|
|
265
266
|
* Биндит входные данные в контейнер острова под объявленными токенами.
|
|
266
267
|
*
|
|
@@ -394,6 +395,43 @@ declare function describeIsland(descriptor: IslandDescriptor, denState?: Record<
|
|
|
394
395
|
|
|
395
396
|
/** App-scope контейнер федерации (создаётся при первом обращении). */
|
|
396
397
|
declare function getAppContainer(): Container;
|
|
398
|
+
/**
|
|
399
|
+
* Расширение рантайма: то, что приложение получает от платформы, а не пишет само, — клиенты
|
|
400
|
+
* бэкенда, метки, всё, что закрывает заявку дескриптора живым кодом одинаково у любого
|
|
401
|
+
* приложения.
|
|
402
|
+
*
|
|
403
|
+
* Ставится один раз на процесс и на вкладку, в контейнер уровня приложения: единицы
|
|
404
|
+
* расширения резолвятся из любого острова по parent-chain, а фабрика исполняется с
|
|
405
|
+
* контейнером острова, поэтому экземпляр получается свой на остров и на запрос. Заявка
|
|
406
|
+
* расширения (`requires`) добавляется к заявке каждого острова: данные, которые нужны
|
|
407
|
+
* расширению, хост отдаёт, хотя приложение их не называет.
|
|
408
|
+
*/
|
|
409
|
+
interface RuntimeExtension {
|
|
410
|
+
/** Имя — для логов и панели. */
|
|
411
|
+
name: string;
|
|
412
|
+
/** Что расширение просит у хоста данными. */
|
|
413
|
+
requires?: ReadonlyArray<Token<unknown>>;
|
|
414
|
+
/** Что расширение отдаёт: единицы в контейнер уровня приложения. */
|
|
415
|
+
units: ReadonlyArray<Definition<unknown>>;
|
|
416
|
+
}
|
|
417
|
+
/** Установленные расширения — по ним остров дополняет свою заявку. */
|
|
418
|
+
declare const RuntimeExtensionsToken: Token<readonly RuntimeExtension[]>;
|
|
419
|
+
/**
|
|
420
|
+
* Ставит расширения рантайма в контейнер уровня приложения.
|
|
421
|
+
*
|
|
422
|
+
* Повторный вызов дополняет список, а не заменяет: хост и сетевой процесс ставят свои
|
|
423
|
+
* расширения независимо, и порядок установки им знать незачем.
|
|
424
|
+
*
|
|
425
|
+
* @param container - Контейнер уровня приложения (`getAppContainer()`)
|
|
426
|
+
* @param extensions - Расширения
|
|
427
|
+
*/
|
|
428
|
+
declare function installRuntime(container: Container, extensions: ReadonlyArray<RuntimeExtension>): void;
|
|
429
|
+
/**
|
|
430
|
+
* Заявка установленных расширений — токены, которые хост закрывает данными.
|
|
431
|
+
*
|
|
432
|
+
* @param container - Любой контейнер цепочки: остров, запрос либо сам контейнер приложения
|
|
433
|
+
*/
|
|
434
|
+
declare function runtimeRequiresOf(container: Container): ReadonlyArray<Token<unknown>>;
|
|
397
435
|
|
|
398
436
|
/**
|
|
399
437
|
* Глобальный адрес слота — `market-app:aside`.
|
|
@@ -412,4 +450,4 @@ declare function getAppContainer(): Container;
|
|
|
412
450
|
*/
|
|
413
451
|
declare function slotAddress(app: string, slot: string): string;
|
|
414
452
|
|
|
415
|
-
export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, ISLAND_ERRORS_KEY, IslandDescriptor, type IslandErrorContext, type IslandErrorPhase, type IslandErrorReport, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, RequestContext, activateIslandViewModels, bindIslandInputs, bindRequestContext, browserRequestContext, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, isDocumentSource, islandInputsOf, navigateIsland, onIslandDocument, onIslandNavigate, parseCookieHeader, publishIslandDocument, registerIsland, renderApp, reportIslandError, resolveEagerUnits, slotAddress, subscribeIslands };
|
|
453
|
+
export { AppAssets, type CreateIslandContainerOptions, DOCUMENT_EVENT, type DocumentContribution, type DocumentHead, type DocumentSource, ISLAND_ERRORS_KEY, IslandDescriptor, type IslandErrorContext, type IslandErrorPhase, type IslandErrorReport, type IslandRecord, type IslandRoute, NAVIGATE_EVENT, type RenderAppRequest, type RenderAppResult, RequestContext, type RuntimeExtension, RuntimeExtensionsToken, activateIslandViewModels, bindIslandInputs, bindRequestContext, browserRequestContext, collectDocumentContribution, collectIslandState, createIslandContainer, describeIsland, getAppContainer, getIslandsSnapshot, hydrateIslandState, installRuntime, isDocumentSource, islandInputsOf, navigateIsland, onIslandDocument, onIslandNavigate, parseCookieHeader, publishIslandDocument, registerIsland, renderApp, reportIslandError, resolveEagerUnits, runtimeRequiresOf, slotAddress, subscribeIslands };
|
package/island/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
RuntimeExtensionsToken,
|
|
2
3
|
activateIslandViewModels,
|
|
3
4
|
bindIslandInputs,
|
|
4
5
|
bindRequestContext,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
createIslandContainer,
|
|
9
10
|
getAppContainer,
|
|
10
11
|
hydrateIslandState,
|
|
12
|
+
installRuntime,
|
|
11
13
|
isDocumentSource,
|
|
12
14
|
islandInputsOf,
|
|
13
15
|
matchRoute,
|
|
@@ -15,8 +17,9 @@ import {
|
|
|
15
17
|
parseCookieHeader,
|
|
16
18
|
pathPattern,
|
|
17
19
|
renderApp,
|
|
18
|
-
resolveEagerUnits
|
|
19
|
-
|
|
20
|
+
resolveEagerUnits,
|
|
21
|
+
runtimeRequiresOf
|
|
22
|
+
} from "../chunk-XQ7EHXHG.js";
|
|
20
23
|
import {
|
|
21
24
|
ViewLayerToken,
|
|
22
25
|
resolveViewAdapter,
|
|
@@ -122,6 +125,7 @@ export {
|
|
|
122
125
|
ISLAND_ERRORS_KEY,
|
|
123
126
|
NAVIGATE_EVENT,
|
|
124
127
|
RequestContextToken,
|
|
128
|
+
RuntimeExtensionsToken,
|
|
125
129
|
ViewLayerToken,
|
|
126
130
|
activateIslandViewModels,
|
|
127
131
|
bindIslandInputs,
|
|
@@ -134,6 +138,7 @@ export {
|
|
|
134
138
|
getAppContainer,
|
|
135
139
|
getIslandsSnapshot,
|
|
136
140
|
hydrateIslandState,
|
|
141
|
+
installRuntime,
|
|
137
142
|
isDocumentSource,
|
|
138
143
|
islandInputsOf,
|
|
139
144
|
matchRoute,
|
|
@@ -149,6 +154,7 @@ export {
|
|
|
149
154
|
reportIslandError,
|
|
150
155
|
resolveEagerUnits,
|
|
151
156
|
resolveViewAdapter,
|
|
157
|
+
runtimeRequiresOf,
|
|
152
158
|
slotAddress,
|
|
153
159
|
subscribeIslands,
|
|
154
160
|
viewAdapterOf
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/den",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Den — декларативный метафреймворк Foxford (core runtime)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foxford",
|
|
@@ -89,24 +89,24 @@
|
|
|
89
89
|
"adapter.js",
|
|
90
90
|
"bin",
|
|
91
91
|
"builder",
|
|
92
|
+
"chunk-2GTQK2PZ.js",
|
|
92
93
|
"chunk-3RX2OSUL.js",
|
|
93
|
-
"chunk-4XR6EUOW.js",
|
|
94
94
|
"chunk-6FNC3XMI.js",
|
|
95
95
|
"chunk-6QV4L6R2.cjs",
|
|
96
96
|
"chunk-A6ZPAM6Z.cjs",
|
|
97
97
|
"chunk-C7BM4DGX.cjs",
|
|
98
98
|
"chunk-E23E2VUC.js",
|
|
99
99
|
"chunk-E56BKBQZ.js",
|
|
100
|
-
"chunk-G6RT4EBO.cjs",
|
|
101
100
|
"chunk-H5DKRHHQ.cjs",
|
|
102
|
-
"chunk-JMRHLOBD.cjs",
|
|
103
101
|
"chunk-KQAB6C6Q.cjs",
|
|
102
|
+
"chunk-P4J4M2WZ.cjs",
|
|
103
|
+
"chunk-QTWJTYZW.cjs",
|
|
104
104
|
"chunk-RG7ZV5BD.js",
|
|
105
105
|
"chunk-T5QVCXVB.cjs",
|
|
106
106
|
"chunk-TPBI6TOU.js",
|
|
107
|
-
"chunk-VO3ORM7Z.js",
|
|
108
107
|
"chunk-WBHHHICS.js",
|
|
109
108
|
"chunk-XOJ2VWX4.cjs",
|
|
109
|
+
"chunk-XQ7EHXHG.js",
|
|
110
110
|
"define-repository-AO7JI6Cb.d.ts",
|
|
111
111
|
"define-repository-C0MI-J32.d.cts",
|
|
112
112
|
"define-slot-BEeHNEph.d.cts",
|
|
@@ -134,6 +134,6 @@
|
|
|
134
134
|
"view-adapter-DMLlp3Iu.d.cts",
|
|
135
135
|
"view-adapter-DNLRSFka.d.ts"
|
|
136
136
|
],
|
|
137
|
-
"sha": "
|
|
137
|
+
"sha": "c7de9de",
|
|
138
138
|
"scripts": {}
|
|
139
139
|
}
|
package/serve/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var _chunkKQAB6C6Qcjs = require('../chunk-KQAB6C6Q.cjs');
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQTWJTYZWcjs = require('../chunk-QTWJTYZW.cjs');
|
|
10
10
|
require('../chunk-XOJ2VWX4.cjs');
|
|
11
11
|
require('../chunk-6QV4L6R2.cjs');
|
|
12
12
|
|
|
@@ -70,14 +70,14 @@ function registerAssets(instance, source) {
|
|
|
70
70
|
|
|
71
71
|
var DEFAULT_SLOW_RENDER_MS = 1e3;
|
|
72
72
|
function claim(app) {
|
|
73
|
-
return
|
|
73
|
+
return _chunkQTWJTYZWcjs.normalizeRoutes.call(void 0, app.routes).map((route) => route.source);
|
|
74
74
|
}
|
|
75
75
|
function matchClaim(app, pathname) {
|
|
76
76
|
var _a, _b;
|
|
77
77
|
if (claim(app).length === 0) {
|
|
78
78
|
return {};
|
|
79
79
|
}
|
|
80
|
-
return (_b = (_a =
|
|
80
|
+
return (_b = (_a = _chunkQTWJTYZWcjs.matchRoute.call(void 0, app.routes, pathname)) == null ? void 0 : _a.params) != null ? _b : null;
|
|
81
81
|
}
|
|
82
82
|
function browserContext(req) {
|
|
83
83
|
const headers = {};
|
|
@@ -94,7 +94,7 @@ function browserContext(req) {
|
|
|
94
94
|
if (typeof cookie === "string" && cookie !== "") {
|
|
95
95
|
headers.cookie = cookie;
|
|
96
96
|
}
|
|
97
|
-
return { cookies:
|
|
97
|
+
return { cookies: _chunkQTWJTYZWcjs.parseCookieHeader.call(void 0, cookie), headers };
|
|
98
98
|
}
|
|
99
99
|
var appPlugin = (instance, options) => {
|
|
100
100
|
var _a, _b;
|
|
@@ -122,7 +122,7 @@ var appPlugin = (instance, options) => {
|
|
|
122
122
|
}
|
|
123
123
|
const startedAt = Date.now();
|
|
124
124
|
try {
|
|
125
|
-
const result = yield
|
|
125
|
+
const result = yield _chunkQTWJTYZWcjs.renderApp.call(void 0, app, {
|
|
126
126
|
context: browserContext(req),
|
|
127
127
|
inputs,
|
|
128
128
|
params,
|