soma-core 2.0.1 → 2.1.1
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.md +2 -2
- package/bin/eject.cjs +5 -5
- package/bin/soma-runtime.cjs +5 -123
- package/bin/soma.cjs +2 -2
- package/bin/soma.ts +8 -20
- package/core/build/compiler/page-declaration-compiler.ts +5 -6
- package/core/build/lsp/soma-declaration.cjs +0 -6
- package/core/client/container/SomaContainerAdapter.ts +1 -1
- package/core/client/data/region-scope-views.ts +1 -1
- package/core/client/engine/event-engine.ts +1 -6
- package/core/client/engine/soma-bootstrap.ts +5 -13
- package/core/client/host-bridge/soma-bootstrap-from-app.ts +2 -2
- package/core/client/infra/i18n/II18n.ts +5 -6
- package/core/client/infra/i18n/locale-catalog.ts +8 -5
- package/core/client/infra/identity/identity-port.ts +1 -1
- package/core/client/keyboard/index.ts +0 -1
- package/core/client/keyboard/wiring.ts +0 -3
- package/core/client/parser/ui-config-parser.ts +6 -9
- package/core/client/registry/declaration-renderer.ts +1 -1
- package/core/client/runtime/SomaRuntimeServices.ts +1 -1
- package/core/inspect/check-runtime.ts +2 -3
- package/core/server/host/content-security-policy.ts +2 -11
- package/core/server/host/host-assembly-entry.ts +10 -2
- package/core/server/host/host-assembly.ts +28 -10
- package/core/server/host/host-caller.ts +52 -0
- package/core/server/host/host-response-headers.ts +49 -0
- package/core/server/host/locale-yaml.ts +7 -5
- package/core/server/host/published-page-assets.ts +1 -1
- package/core/server/host/resolve-host-request-hook.ts +2 -11
- package/core/server/host/resolve-host-tree-context.ts +7 -41
- package/core/server/host/server-page-assets.ts +0 -22
- package/core/server/host/source-packages.cjs +3 -4
- package/core/server/host/virtual-pages.ts +12 -70
- package/core/server/index.ts +1 -3
- package/core/server/node.ts +0 -1
- package/core/server/page-assets.ts +2 -20
- package/core/server/page-declaration.ts +1 -1
- package/core/server/registry/api-registry-store.ts +5 -25
- package/core/server/registry/asset-store.ts +5 -23
- package/core/server/registry/page-registry-repository.ts +9 -13
- package/core/server/registry/page-registry-store.ts +44 -82
- package/core/server/registry/publish-asset-pin.ts +3 -4
- package/core/server/registry/registry-subjects.ts +6 -6
- package/core/server/registry/rollback-plan.ts +5 -8
- package/core/server/registry/source/version-store.ts +8 -30
- package/core/server/registry/standard-product.ts +1 -1
- package/core/server/runtime-space/bindings.ts +1 -4
- package/core/server/runtime-space/gc.ts +2 -3
- package/core/server/runtime-space/inject.ts +4 -5
- package/core/server/runtime-space/resolve.ts +13 -27
- package/core/server/runtime-space/root.cjs +9 -100
- package/core/server/runtime-space/root.ts +3 -23
- package/core/server/runtime-space/types.ts +0 -11
- package/core/shared/artifact-compatibility.ts +6 -16
- package/core/shared/component-tree-artifact.ts +4 -8
- package/core/shared/core-diagnostic-codes.ts +1 -3
- package/core/shared/pipeline-error-codes-view.ts +1 -2
- package/core/shared/published-page-route.ts +1 -6
- package/core/shared/registry-generated/diagnostic-registry-index.ts +0 -2
- package/core/shared/registry-generated/diagnostic-registry.ts +0 -14
- package/core/shared/source-file-suffix.ts +8 -0
- package/core/shared/types/component-tree-artifact.types.ts +2 -15
- package/core/shared/types/host-assembly.types.ts +31 -2
- package/core/shared/types/locale.types.ts +3 -3
- package/core/shared/types/region-scope.types.ts +1 -1
- package/core/shared/types/ui-config.types.ts +2 -7
- package/core/shared/types/write.types.ts +1 -1
- package/dist/browser/soma-runtime.js +20 -36
- package/dist/cli/soma.js +8 -21
- package/dist/core/index.cjs +20 -38
- package/dist/lsp/component-tree.cjs +7 -14
- package/dist/types/client/container/SomaContainerAdapter.d.ts +1 -1
- package/dist/types/client/engine/event-engine.d.ts +0 -2
- package/dist/types/client/engine/soma-bootstrap.d.ts +2 -3
- package/dist/types/client/host-bridge/soma-bootstrap-from-app.d.ts +2 -2
- package/dist/types/client/infra/i18n/II18n.d.ts +5 -6
- package/dist/types/client/infra/i18n/locale-catalog.d.ts +3 -3
- package/dist/types/client/infra/identity/identity-port.d.ts +1 -1
- package/dist/types/client/keyboard/index.d.ts +1 -1
- package/dist/types/client/keyboard/wiring.d.ts +0 -2
- package/dist/types/client/registry/declaration-renderer.d.ts +1 -1
- package/dist/types/client/runtime/SomaRuntimeServices.d.ts +1 -1
- package/dist/types/server/host/content-security-policy.d.ts +0 -5
- package/dist/types/server/host/host-assembly-entry.d.ts +5 -2
- package/dist/types/server/host/host-assembly.d.ts +9 -4
- package/dist/types/server/host/host-caller.d.ts +10 -0
- package/dist/types/server/host/host-response-headers.d.ts +16 -0
- package/dist/types/server/host/published-page-assets.d.ts +1 -1
- package/dist/types/server/host/resolve-host-request-hook.d.ts +0 -4
- package/dist/types/server/host/resolve-host-tree-context.d.ts +1 -1
- package/dist/types/server/host/server-page-assets.d.ts +0 -2
- package/dist/types/server/host/virtual-pages.d.ts +4 -14
- package/dist/types/server/index.d.ts +1 -2
- package/dist/types/server/node.d.ts +1 -1
- package/dist/types/server/page-assets.d.ts +1 -4
- package/dist/types/server/page-declaration.d.ts +1 -1
- package/dist/types/server/registry/api-registry-store.d.ts +1 -6
- package/dist/types/server/registry/asset-store.d.ts +2 -11
- package/dist/types/server/registry/page-registry-repository.d.ts +4 -4
- package/dist/types/server/registry/page-registry-store.d.ts +22 -30
- package/dist/types/server/registry/registry-subjects.d.ts +2 -2
- package/dist/types/server/registry/rollback-plan.d.ts +0 -3
- package/dist/types/server/registry/source/version-store.d.ts +1 -9
- package/dist/types/server/registry/standard-product.d.ts +1 -1
- package/dist/types/server/runtime-space/resolve.d.ts +0 -3
- package/dist/types/server/runtime-space/root.d.cts +6 -29
- package/dist/types/server/runtime-space/root.d.ts +2 -7
- package/dist/types/server/runtime-space/types.d.ts +0 -9
- package/dist/types/shared/artifact-compatibility.d.ts +1 -3
- package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
- package/dist/types/shared/published-page-route.d.ts +1 -3
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +0 -12
- package/dist/types/shared/types/component-tree-artifact.types.d.ts +2 -15
- package/dist/types/shared/types/host-assembly.types.d.ts +27 -1
- package/dist/types/shared/types/locale.types.d.ts +1 -1
- package/dist/types/shared/types/region-scope.types.d.ts +1 -1
- package/dist/types/shared/types/ui-config.types.d.ts +2 -7
- package/dist/types/shared/types/write.types.d.ts +1 -1
- package/global.d.ts +0 -9
- package/host-next/app/SomaPageClient.tsx +359 -0
- package/host-next/app/[...path]/page.tsx +22 -0
- package/host-next/app/api/[...path]/route.ts +98 -0
- package/host-next/app/api/soma-registry/[...path]/route.ts +79 -0
- package/host-next/app/components/SomaHostPage.tsx +128 -0
- package/host-next/app/components/SomaHydrationShell.tsx +20 -0
- package/host-next/app/components/SomaPageClientBoundary.tsx +13 -0
- package/host-next/app/components/SomaPageForbidden.tsx +19 -0
- package/host-next/app/favicon.ico/route.ts +13 -0
- package/host-next/app/globals.css +177 -0
- package/host-next/app/layout.tsx +27 -0
- package/host-next/app/page-access.ts +47 -0
- package/host-next/app/page.tsx +9 -0
- package/host-next/app/router-bridge.ts +42 -0
- package/host-next/app/soma/[...path]/route.ts +9 -0
- package/host-next/app/soma/_shared/host-prepare.ts +33 -0
- package/host-next/app/soma/_shared/page-http.ts +86 -0
- package/host-next/app/soma/manifest/route.ts +98 -0
- package/host-next/app/soma/page/route.ts +36 -0
- package/host-next/app/soma/route.ts +9 -0
- package/host-next/app/soma-runtime/[...file]/route.ts +21 -0
- package/host-next/app/soma-runtime/_shared/static-file.ts +89 -0
- package/host-next/bin/host-next.cjs +59 -0
- package/host-next/instrumentation.ts +13 -0
- package/host-next/next-env.d.ts +7 -0
- package/host-next/next.config.js +382 -0
- package/host-next/proxy.ts +43 -0
- package/host-next/src/shell-routes.cjs +51 -0
- package/host-next/src/workspace.ts +543 -0
- package/package.json +66 -41
- package/tsconfig.json +2 -1
- package/core/server/host/page-response-mode.cjs +0 -96
- package/core/server/host/page-response-request.ts +0 -33
- package/core/server/host/request-origin.ts +0 -18
- package/core/server/host/soma-request-hook-host.stub.ts +0 -4
- package/core/server/runtime-space/migrate-sources.ts +0 -124
- package/core/shared/source-compat.ts +0 -9
- package/dist/types/server/host/page-response-request.d.ts +0 -8
- package/dist/types/server/host/request-origin.d.ts +0 -1
- package/dist/types/server/host/soma-request-hook-host.stub.d.ts +0 -2
- package/dist/types/server/runtime-space/migrate-sources.d.ts +0 -19
- /package/dist/types/shared/{source-compat.d.ts → source-file-suffix.d.ts} +0 -0
package/dist/core/index.cjs
CHANGED
|
@@ -95666,7 +95666,7 @@ var SomaContainerAdapter = class {
|
|
|
95666
95666
|
setHtml(element, value) {
|
|
95667
95667
|
element.innerHTML = sanitizeSomaHtml(value).html;
|
|
95668
95668
|
}
|
|
95669
|
-
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见
|
|
95669
|
+
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
|
|
95670
95670
|
setVisibility(element, visible) {
|
|
95671
95671
|
element.hidden = !visible;
|
|
95672
95672
|
}
|
|
@@ -102998,7 +102998,6 @@ function parseUiConfig(raw, options) {
|
|
|
102998
102998
|
}
|
|
102999
102999
|
var FRAGMENTS_ARTIFACT_KEYS = {
|
|
103000
103000
|
format: true,
|
|
103001
|
-
version: true,
|
|
103002
103001
|
regions: true,
|
|
103003
103002
|
scopes: true,
|
|
103004
103003
|
css: true,
|
|
@@ -103018,9 +103017,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
103018
103017
|
);
|
|
103019
103018
|
}
|
|
103020
103019
|
shapeClosedKeys(entry, FRAGMENTS_ARTIFACT_KEYS, label, label);
|
|
103021
|
-
if (entry.format !== SOMA_FRAGMENTS_FORMAT
|
|
103020
|
+
if (entry.format !== SOMA_FRAGMENTS_FORMAT) {
|
|
103022
103021
|
throw new SomaUiConfigError(
|
|
103023
|
-
`${label} \u7684\u683C\u5F0F\u6807\u8BC6\u4E0D\u8BA4\u8BC6\uFF08format \u987B\u4E3A ${SOMA_FRAGMENTS_FORMAT}\
|
|
103022
|
+
`${label} \u7684\u683C\u5F0F\u6807\u8BC6\u4E0D\u8BA4\u8BC6\uFF08format \u987B\u4E3A ${SOMA_FRAGMENTS_FORMAT}\uFF09\uFF0C\u6536\u5230 format=${JSON.stringify(entry.format)}\u2014\u2014\u683C\u5F0F\u5BF9\u4E0D\u4E0A\u7684\u4EA7\u7269\u6574\u4EFD\u4E0D\u53EF\u4FE1\uFF0C\u6309\u65E7\u5B57\u6BB5\u540D\u8BFB\u51FA\u6765\u7684\u754C\u9762\u662F\u8C01\u90FD\u6CA1\u8BBE\u8BA1\u8FC7\u7684\u6837\u5B50`,
|
|
103024
103023
|
`${label}.format`
|
|
103025
103024
|
);
|
|
103026
103025
|
}
|
|
@@ -103033,10 +103032,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
103033
103032
|
}
|
|
103034
103033
|
}
|
|
103035
103034
|
const artifact = {
|
|
103035
|
+
format: SOMA_FRAGMENTS_FORMAT,
|
|
103036
103036
|
regions: entry.regions
|
|
103037
103037
|
};
|
|
103038
|
-
if (entry.format === SOMA_FRAGMENTS_FORMAT) artifact.format = SOMA_FRAGMENTS_FORMAT;
|
|
103039
|
-
if (entry.version === 1) artifact.version = 1;
|
|
103040
103038
|
if (entry.degradedRegions !== void 0) {
|
|
103041
103039
|
if (!Array.isArray(entry.degradedRegions)) {
|
|
103042
103040
|
throw new SomaUiConfigError(`${label}.degradedRegions \u5FC5\u987B\u662F\u6570\u7EC4`, `${label}.degradedRegions`);
|
|
@@ -105796,7 +105794,7 @@ var SomaEventEngine = class {
|
|
|
105796
105794
|
this.scopeTracker = options.scopeTracker;
|
|
105797
105795
|
this.callbacks = {
|
|
105798
105796
|
onRefresh: options.callbacks.onRefresh,
|
|
105799
|
-
onCommit: options.callbacks.onCommit ??
|
|
105797
|
+
onCommit: options.callbacks.onCommit ?? (() => Promise.resolve()),
|
|
105800
105798
|
onBeginTransaction: options.callbacks.onBeginTransaction,
|
|
105801
105799
|
onEndTransaction: options.callbacks.onEndTransaction,
|
|
105802
105800
|
onDiscardPending: options.callbacks.onDiscardPending,
|
|
@@ -108989,7 +108987,7 @@ function resolveDisplayLocale(catalog, doc) {
|
|
|
108989
108987
|
// core/client/infra/i18n/locale-catalog.ts
|
|
108990
108988
|
var FALLBACK_DEFAULT_LOCALE = "zh-CN";
|
|
108991
108989
|
var SomaLocaleCatalog = class {
|
|
108992
|
-
/**
|
|
108990
|
+
/** 应用词表(产物词表信封装载进来的):语言 → 键 → 文案 */
|
|
108993
108991
|
dictionaries = /* @__PURE__ */ new Map();
|
|
108994
108992
|
builtin;
|
|
108995
108993
|
defaultLocale;
|
|
@@ -109035,7 +109033,10 @@ var SomaLocaleCatalog = class {
|
|
|
109035
109033
|
}
|
|
109036
109034
|
loadBundle(bundle) {
|
|
109037
109035
|
if (!isLocaleBundle(bundle)) {
|
|
109038
|
-
|
|
109036
|
+
if (typeof bundle !== "object" || bundle === null || Array.isArray(bundle) || Object.keys(bundle).length > 0) {
|
|
109037
|
+
throw new Error("[soma-core][\u8BCD\u8868] \u8BCD\u8868\u5FC5\u987B\u662F { format: soma.locale-bundle, defaultLocale, <\u8BED\u8A00>: { \u952E: \u6587\u6848 } } \u4FE1\u5C01\uFF1B\u4E0D\u63A5\u53D7\u6241\u5E73\u5355\u5B57\u5178");
|
|
109038
|
+
}
|
|
109039
|
+
this.loadContent({});
|
|
109039
109040
|
return;
|
|
109040
109041
|
}
|
|
109041
109042
|
for (const locale of localesOf(bundle)) {
|
|
@@ -111239,17 +111240,13 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
111239
111240
|
// runtime 空间根与存储(RT1)
|
|
111240
111241
|
"CORE-RUNTIME-ROOT-INVALID",
|
|
111241
111242
|
// runtime 根越界(宿主根 / html / ui / public 内、宿主祖先、文件系统根),拒绝启动
|
|
111242
|
-
"CORE-RUNTIME-LEGACY-DIR",
|
|
111243
|
-
// Registry 数据仍在旧目录,正在只读回退;提示运行 soma runtime migrate
|
|
111244
111243
|
"CORE-RUNTIME-ROOT-UNSET",
|
|
111245
111244
|
// 生产环境未设 SOMA_RUNTIME_DIR(soma doctor 告警)
|
|
111246
111245
|
// 地址绑定与注入(RT2 / E2;《core 标准格式与 runtime 空间》§2、§4;《页面级描述与按 URL 注册》§4)
|
|
111247
111246
|
"CORE-FORMAT-VERSION-UNSUPPORTED",
|
|
111248
111247
|
// 注入载荷 format 不是 core 认识的主版本
|
|
111249
111248
|
"CORE-FORMAT-VERSION-MISMATCH",
|
|
111250
|
-
// 载荷 format 与 page 块 soma:
|
|
111251
|
-
"CORE-FORMAT-VERSION-IMPLICIT",
|
|
111252
|
-
// page 块未写 soma:,兼容期按 1 处理(advice)
|
|
111249
|
+
// 载荷 format 与 page 块 soma: 不一致(page 块缺 soma: 同此码)
|
|
111253
111250
|
"CORE-INJECT-NONSTANDARD-KEY",
|
|
111254
111251
|
// 兼容期结束后含方言段拒收
|
|
111255
111252
|
"CORE-RUNTIME-ADDRESS-INVALID",
|
|
@@ -117149,15 +117146,10 @@ var ACCEPTED_FORMATS = SOMA_PAGE_ARTIFACT_FORMATS;
|
|
|
117149
117146
|
var KNOWN_CAPABILITIES = COMPONENT_TREE_CAPABILITIES;
|
|
117150
117147
|
var REQUIRED_CAPABILITY = "component-tree:1";
|
|
117151
117148
|
function isArtifactFormatAccepted(head) {
|
|
117152
|
-
|
|
117153
|
-
return head.schemaVersion === 1 && head.grammarVersion === 1;
|
|
117149
|
+
return typeof head.format === "string" && ACCEPTED_FORMATS.includes(head.format);
|
|
117154
117150
|
}
|
|
117155
117151
|
function archivedFormatOf(head) {
|
|
117156
|
-
|
|
117157
|
-
if (head.schemaVersion !== void 0 || head.grammarVersion !== void 0) {
|
|
117158
|
-
return `schemaVersion:${String(head.schemaVersion)}/grammarVersion:${String(head.grammarVersion)}`;
|
|
117159
|
-
}
|
|
117160
|
-
return null;
|
|
117152
|
+
return typeof head.format === "string" ? head.format : null;
|
|
117161
117153
|
}
|
|
117162
117154
|
function incompatible(reason, code) {
|
|
117163
117155
|
return { compatible: false, level: "recompile", reason, code };
|
|
@@ -117167,7 +117159,7 @@ function checkArtifactRuntimeCompatibility(envelope, supply, options = {}) {
|
|
|
117167
117159
|
if (envelope === null) {
|
|
117168
117160
|
return required ? incompatible({ rule: "envelope-missing" }, "CT-ARTIFACT-VERSION") : { compatible: true, level: "reuse", reason: null };
|
|
117169
117161
|
}
|
|
117170
|
-
const hasFormatMark = envelope.format !== void 0
|
|
117162
|
+
const hasFormatMark = envelope.format !== void 0;
|
|
117171
117163
|
const tree = envelope.sourceMarkup === "component-tree";
|
|
117172
117164
|
if (!SOURCE_MARKUPS.includes(envelope.sourceMarkup)) {
|
|
117173
117165
|
return incompatible({ rule: "format", archived: String(envelope.sourceMarkup), accepted: ACCEPTED_FORMATS }, "CT-ARTIFACT-VERSION");
|
|
@@ -117297,8 +117289,6 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
117297
117289
|
assertWireData(artifact);
|
|
117298
117290
|
closed(artifact, [
|
|
117299
117291
|
"format",
|
|
117300
|
-
"schemaVersion",
|
|
117301
|
-
"grammarVersion",
|
|
117302
117292
|
"compilerVersion",
|
|
117303
117293
|
"sourceDigest",
|
|
117304
117294
|
"registrySnapshotDigest",
|
|
@@ -117310,7 +117300,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
117310
117300
|
"repeatPlans",
|
|
117311
117301
|
"artifactDigest"
|
|
117312
117302
|
], "artifact");
|
|
117313
|
-
if (!isArtifactFormatAccepted(artifact)) fail2("artifact.
|
|
117303
|
+
if (!isArtifactFormatAccepted(artifact)) fail2("artifact.format", "version");
|
|
117314
117304
|
string(artifact.compilerVersion, "artifact.compilerVersion");
|
|
117315
117305
|
for (const key of ["sourceDigest", "registrySnapshotDigest", "policyDigest", "artifactDigest"]) {
|
|
117316
117306
|
string(artifact[key], `artifact.${key}`, DIGEST);
|
|
@@ -117319,9 +117309,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
117319
117309
|
const required = capabilities(artifact.capabilities, "artifact.capabilities");
|
|
117320
117310
|
const capabilityVerdict = checkArtifactRuntimeCompatibility({
|
|
117321
117311
|
sourceMarkup: "component-tree",
|
|
117322
|
-
|
|
117323
|
-
...artifact.schemaVersion !== void 0 ? { schemaVersion: artifact.schemaVersion } : {},
|
|
117324
|
-
...artifact.grammarVersion !== void 0 ? { grammarVersion: artifact.grammarVersion } : {},
|
|
117312
|
+
format: artifact.format,
|
|
117325
117313
|
capabilities: [...required],
|
|
117326
117314
|
componentRefs: []
|
|
117327
117315
|
}, null);
|
|
@@ -117453,9 +117441,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
117453
117441
|
structureDigest: String(ref.structureDigest),
|
|
117454
117442
|
uses: []
|
|
117455
117443
|
})),
|
|
117456
|
-
|
|
117457
|
-
...artifact.schemaVersion !== void 0 ? { schemaVersion: artifact.schemaVersion } : {},
|
|
117458
|
-
...artifact.grammarVersion !== void 0 ? { grammarVersion: artifact.grammarVersion } : {}
|
|
117444
|
+
format: artifact.format
|
|
117459
117445
|
}, supply);
|
|
117460
117446
|
if (!supplyVerdict.compatible) fail2("componentRefs", supplyVerdict.code === "CT-ARTIFACT-VERSION" ? "version" : "capability");
|
|
117461
117447
|
}
|
|
@@ -119082,9 +119068,7 @@ function assertPageRuntimeAssets(assets, hostComponents) {
|
|
|
119082
119068
|
const supply = supplyFromDefinitions({ ...hostComponents, ...assets.components ?? {} });
|
|
119083
119069
|
const verdict = checkArtifactRuntimeCompatibility({
|
|
119084
119070
|
sourceMarkup: "component-tree",
|
|
119085
|
-
|
|
119086
|
-
...assets.artifact.schemaVersion !== void 0 ? { schemaVersion: assets.artifact.schemaVersion } : {},
|
|
119087
|
-
...assets.artifact.grammarVersion !== void 0 ? { grammarVersion: assets.artifact.grammarVersion } : {},
|
|
119071
|
+
format: assets.artifact.format,
|
|
119088
119072
|
capabilities: assets.artifact.capabilities,
|
|
119089
119073
|
componentRefs: assets.artifact.componentRefs
|
|
119090
119074
|
}, supply);
|
|
@@ -120638,9 +120622,9 @@ ${featureIssues.map((issue) => ` \xB7 ${issue}`).join("\n")}`
|
|
|
120638
120622
|
this.localeCatalog.loadBundle(locale);
|
|
120639
120623
|
if (this.preferredLocale !== void 0) this.localeCatalog.setCurrentLocale(this.preferredLocale);
|
|
120640
120624
|
}
|
|
120641
|
-
/** 页面 `_locale` 绑定表(`page._locale
|
|
120625
|
+
/** 页面 `_locale` 绑定表(`page._locale.<键>`):词表信封取当前显示语言的词条;无词表为空表 */
|
|
120642
120626
|
localeTable(locale) {
|
|
120643
|
-
return isLocaleBundle(locale) ? this.localeCatalog.dictionary() :
|
|
120627
|
+
return isLocaleBundle(locale) ? this.localeCatalog.dictionary() : {};
|
|
120644
120628
|
}
|
|
120645
120629
|
/** 缺词条回退上报(ERR-LOCALE-001,soma-ui 码表;不抛、不中断渲染) */
|
|
120646
120630
|
reportLocaleMissing(event) {
|
|
@@ -121295,8 +121279,6 @@ function publishedPagePath(slug) {
|
|
|
121295
121279
|
return `/${slug}`;
|
|
121296
121280
|
}
|
|
121297
121281
|
function publishedPageSlugFromPath(pagePath) {
|
|
121298
|
-
const legacy = pagePath.match(/^\/pages\/([^/]+)$/)?.[1];
|
|
121299
|
-
if (legacy && isPublishedPageSlug(legacy)) return legacy;
|
|
121300
121282
|
const root = pagePath.match(/^\/([^/]+)$/)?.[1];
|
|
121301
121283
|
return root && isPublishedPageSlug(root) ? root : null;
|
|
121302
121284
|
}
|
|
@@ -5235,7 +5235,6 @@ function parseUiConfig(raw, options) {
|
|
|
5235
5235
|
}
|
|
5236
5236
|
var FRAGMENTS_ARTIFACT_KEYS = {
|
|
5237
5237
|
format: true,
|
|
5238
|
-
version: true,
|
|
5239
5238
|
regions: true,
|
|
5240
5239
|
scopes: true,
|
|
5241
5240
|
css: true,
|
|
@@ -5255,9 +5254,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
5255
5254
|
);
|
|
5256
5255
|
}
|
|
5257
5256
|
shapeClosedKeys(entry, FRAGMENTS_ARTIFACT_KEYS, label, label);
|
|
5258
|
-
if (entry.format !== SOMA_FRAGMENTS_FORMAT
|
|
5257
|
+
if (entry.format !== SOMA_FRAGMENTS_FORMAT) {
|
|
5259
5258
|
throw new SomaUiConfigError(
|
|
5260
|
-
`${label} \u7684\u683C\u5F0F\u6807\u8BC6\u4E0D\u8BA4\u8BC6\uFF08format \u987B\u4E3A ${SOMA_FRAGMENTS_FORMAT}\
|
|
5259
|
+
`${label} \u7684\u683C\u5F0F\u6807\u8BC6\u4E0D\u8BA4\u8BC6\uFF08format \u987B\u4E3A ${SOMA_FRAGMENTS_FORMAT}\uFF09\uFF0C\u6536\u5230 format=${JSON.stringify(entry.format)}\u2014\u2014\u683C\u5F0F\u5BF9\u4E0D\u4E0A\u7684\u4EA7\u7269\u6574\u4EFD\u4E0D\u53EF\u4FE1\uFF0C\u6309\u65E7\u5B57\u6BB5\u540D\u8BFB\u51FA\u6765\u7684\u754C\u9762\u662F\u8C01\u90FD\u6CA1\u8BBE\u8BA1\u8FC7\u7684\u6837\u5B50`,
|
|
5261
5260
|
`${label}.format`
|
|
5262
5261
|
);
|
|
5263
5262
|
}
|
|
@@ -5270,10 +5269,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
5270
5269
|
}
|
|
5271
5270
|
}
|
|
5272
5271
|
const artifact = {
|
|
5272
|
+
format: SOMA_FRAGMENTS_FORMAT,
|
|
5273
5273
|
regions: entry.regions
|
|
5274
5274
|
};
|
|
5275
|
-
if (entry.format === SOMA_FRAGMENTS_FORMAT) artifact.format = SOMA_FRAGMENTS_FORMAT;
|
|
5276
|
-
if (entry.version === 1) artifact.version = 1;
|
|
5277
5275
|
if (entry.degradedRegions !== void 0) {
|
|
5278
5276
|
if (!Array.isArray(entry.degradedRegions)) {
|
|
5279
5277
|
throw new SomaUiConfigError(`${label}.degradedRegions \u5FC5\u987B\u662F\u6570\u7EC4`, `${label}.degradedRegions`);
|
|
@@ -5750,17 +5748,13 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
5750
5748
|
// runtime 空间根与存储(RT1)
|
|
5751
5749
|
"CORE-RUNTIME-ROOT-INVALID",
|
|
5752
5750
|
// runtime 根越界(宿主根 / html / ui / public 内、宿主祖先、文件系统根),拒绝启动
|
|
5753
|
-
"CORE-RUNTIME-LEGACY-DIR",
|
|
5754
|
-
// Registry 数据仍在旧目录,正在只读回退;提示运行 soma runtime migrate
|
|
5755
5751
|
"CORE-RUNTIME-ROOT-UNSET",
|
|
5756
5752
|
// 生产环境未设 SOMA_RUNTIME_DIR(soma doctor 告警)
|
|
5757
5753
|
// 地址绑定与注入(RT2 / E2;《core 标准格式与 runtime 空间》§2、§4;《页面级描述与按 URL 注册》§4)
|
|
5758
5754
|
"CORE-FORMAT-VERSION-UNSUPPORTED",
|
|
5759
5755
|
// 注入载荷 format 不是 core 认识的主版本
|
|
5760
5756
|
"CORE-FORMAT-VERSION-MISMATCH",
|
|
5761
|
-
// 载荷 format 与 page 块 soma:
|
|
5762
|
-
"CORE-FORMAT-VERSION-IMPLICIT",
|
|
5763
|
-
// page 块未写 soma:,兼容期按 1 处理(advice)
|
|
5757
|
+
// 载荷 format 与 page 块 soma: 不一致(page 块缺 soma: 同此码)
|
|
5764
5758
|
"CORE-INJECT-NONSTANDARD-KEY",
|
|
5765
5759
|
// 兼容期结束后含方言段拒收
|
|
5766
5760
|
"CORE-RUNTIME-ADDRESS-INVALID",
|
|
@@ -18883,8 +18877,8 @@ function assertNoComponentTreeSyntax(html) {
|
|
|
18883
18877
|
// core/build/compiler/page-declaration-compiler.ts
|
|
18884
18878
|
var SOMA_UNKNOWN_COMPILE_IDENTITY = "";
|
|
18885
18879
|
var dump2 = (value2) => yaml.dump(value2, { lineWidth: 120, noRefs: true, quotingType: '"' });
|
|
18886
|
-
var
|
|
18887
|
-
function compilePageDeclaration(source, options =
|
|
18880
|
+
var DEFAULT_OPTIONS = { purpose: "static" };
|
|
18881
|
+
function compilePageDeclaration(source, options = DEFAULT_OPTIONS) {
|
|
18888
18882
|
try {
|
|
18889
18883
|
return compilePageDeclarationInternal(source, options);
|
|
18890
18884
|
} catch (error) {
|
|
@@ -18925,8 +18919,7 @@ function coreEnvelopeHead(markup, artifact) {
|
|
|
18925
18919
|
if (markup === "component-tree" && artifact !== void 0) {
|
|
18926
18920
|
return {
|
|
18927
18921
|
sourceMarkup: "component-tree",
|
|
18928
|
-
|
|
18929
|
-
grammarVersion: 1,
|
|
18922
|
+
format: artifact.format,
|
|
18930
18923
|
capabilities: [...artifact.capabilities],
|
|
18931
18924
|
componentRefs: artifact.componentRefs
|
|
18932
18925
|
};
|
|
@@ -19,7 +19,7 @@ export declare class SomaContainerAdapter implements IContainerAdapter {
|
|
|
19
19
|
setText(element: HTMLElement, value: string): void;
|
|
20
20
|
setAttribute(element: HTMLElement, attrName: string, value: string): void;
|
|
21
21
|
setHtml(element: HTMLElement, value: string): void;
|
|
22
|
-
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见
|
|
22
|
+
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
|
|
23
23
|
setVisibility(element: HTMLElement, visible: boolean): void;
|
|
24
24
|
isVisible(element: HTMLElement): boolean;
|
|
25
25
|
toggleClasses(element: HTMLElement, classes: string[], enabled: boolean): void;
|
|
@@ -35,8 +35,6 @@ export interface SomaEventEngineOptions<TContext extends Record<string, unknown>
|
|
|
35
35
|
scopeTracker: WeakMap<HTMLElement, any>;
|
|
36
36
|
callbacks: {
|
|
37
37
|
onRefresh: () => void | Promise<void>;
|
|
38
|
-
/** @deprecated 使用 onCommit */
|
|
39
|
-
onFlush?: () => void | Promise<void>;
|
|
40
38
|
onCommit?: () => void | Promise<void>;
|
|
41
39
|
onBeginTransaction?: () => void;
|
|
42
40
|
onEndTransaction?: () => void;
|
|
@@ -61,7 +61,7 @@ export interface SomaPageAssets extends ComponentTreeRuntimeEnvelope {
|
|
|
61
61
|
timerConfig?: ParsedTimer[];
|
|
62
62
|
styleConfig?: StyleConfig;
|
|
63
63
|
/**
|
|
64
|
-
* 多语言词表(KC2,`format: 'soma.locale-bundle'
|
|
64
|
+
* 多语言词表(KC2,`format: 'soma.locale-bundle'`);只认词表信封(空对象 = 无词表)。
|
|
65
65
|
* 运行期按当前显示语言渲染文案,切换不重编、不换产物(`setLocale`)。
|
|
66
66
|
* 与注入载荷同名同形:可给词表文本(YAML 字符串,运行期解析)或已解析对象。
|
|
67
67
|
*/
|
|
@@ -148,7 +148,6 @@ export declare function findFragmentDomOffence(fragment: DocumentFragment): stri
|
|
|
148
148
|
* 会把注入挪到组件展开之后(见 mount 的 2.4 与 2.5 的顺序)。
|
|
149
149
|
*/
|
|
150
150
|
export declare function fragmentHtmlFingerprint(html: string): string;
|
|
151
|
-
/** @deprecated 改用 fragmentHtmlFingerprint(同一算法;本别名保留一个发布周期) */
|
|
152
151
|
/**
|
|
153
152
|
* 错误采集接线声明(可观测性,默认关闭)。
|
|
154
153
|
*
|
|
@@ -625,7 +624,7 @@ export declare class SomaBootstrap {
|
|
|
625
624
|
private stopDeclarativeTimers;
|
|
626
625
|
/** 词表装入文案目录(先清上一页的)并定当前显示语言:用户选定的 > 挂载选项 initial > 词表缺省语言 */
|
|
627
626
|
private loadLocale;
|
|
628
|
-
/** 页面 `_locale` 绑定表(`page._locale
|
|
627
|
+
/** 页面 `_locale` 绑定表(`page._locale.<键>`):词表信封取当前显示语言的词条;无词表为空表 */
|
|
629
628
|
private localeTable;
|
|
630
629
|
/** 缺词条回退上报(ERR-LOCALE-001,soma-ui 码表;不抛、不中断渲染) */
|
|
631
630
|
private reportLocaleMissing;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 浏览器侧的 Host 装配桥(06e §2.11;08e AD-APP-01):Host
|
|
3
|
-
*
|
|
2
|
+
* 浏览器侧的 Host 装配桥(06e §2.11;08e AD-APP-01):Host 有 `soma.app.ts`(`defineSomaApp` 默认导出)时,
|
|
3
|
+
* `next.config.js` 把 `@soma-host/bootstrap/soma-bootstrap`
|
|
4
4
|
* 指到本文件,由装配的 `host.bootstrap()` 交出浏览器引导选项(组件表、控制器、管道、中间件……)。
|
|
5
5
|
*
|
|
6
6
|
* `soma.app.ts` 本身必须能进浏览器包(只含纯数据);它惰性引用的服务端面 `./soma.server` 由 next.config 在客户端构建里忽略。
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 文案服务接口(多语言,06e K8 / 06b 2.2a)。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `loadContent` 在多语言词表之下只作为开发期热替换与兼容入口:消息写入应用缺省语言词表。
|
|
4
|
+
* `loadContent` 在多语言词表之下只作为开发期热替换入口:消息写入应用缺省语言词表。
|
|
6
5
|
*/
|
|
7
|
-
import type { SomaLocaleBundle
|
|
6
|
+
import type { SomaLocaleBundle } from '../../../shared/types/locale.types';
|
|
8
7
|
export interface II18n {
|
|
9
8
|
/** 按当前显示语言取文案;回退链 当前语言 → 应用缺省语言 → 内置受控词表 → 键名(缺键返回键名本身) */
|
|
10
9
|
t(key: string, params?: Record<string, string | number>): string;
|
|
11
|
-
/**
|
|
10
|
+
/** 把消息并入应用缺省语言词表(开发期热替换) */
|
|
12
11
|
loadContent(messages: Record<string, string>): void;
|
|
13
12
|
/** 当前显示语言(或应用缺省语言、内置受控词表)是否有这个词条键 */
|
|
14
13
|
hasKey(key: string): boolean;
|
|
@@ -18,6 +17,6 @@ export interface II18n {
|
|
|
18
17
|
locales(): readonly string[];
|
|
19
18
|
/** 设当前显示语言;不在 `locales()` 内返回 false 且不改变当前语言 */
|
|
20
19
|
setCurrentLocale(locale: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
loadBundle(bundle: SomaLocaleBundle |
|
|
20
|
+
/** 装载多语言词表信封;空对象 = 无词表,其余非信封抛错 */
|
|
21
|
+
loadBundle(bundle: SomaLocaleBundle | Readonly<Record<string, unknown>>): void;
|
|
23
22
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 不变式:
|
|
10
10
|
* - 当前显示语言是运行期状态,不进编译身份、不进产物缓存键(这里不碰任何编译产物);
|
|
11
11
|
* - 业务数据值不是文案,不经本服务;
|
|
12
|
-
* -
|
|
12
|
+
* - 词表只认信封(`format: soma.locale-bundle`);扁平单字典不是词表,装载抛错。
|
|
13
13
|
*/
|
|
14
14
|
import type { II18n } from './II18n';
|
|
15
15
|
import { type SomaLocaleBundle, type SomaLocaleDictionary } from '../../../shared/types/locale.types';
|
|
@@ -26,7 +26,7 @@ export interface SomaLocaleCatalogOptions {
|
|
|
26
26
|
readonly onMissing?: (event: SomaLocaleMissingEvent) => void;
|
|
27
27
|
}
|
|
28
28
|
export declare class SomaLocaleCatalog implements II18n {
|
|
29
|
-
/**
|
|
29
|
+
/** 应用词表(产物词表信封装载进来的):语言 → 键 → 文案 */
|
|
30
30
|
private readonly dictionaries;
|
|
31
31
|
private builtin;
|
|
32
32
|
private defaultLocale;
|
|
@@ -50,7 +50,7 @@ export declare class SomaLocaleCatalog implements II18n {
|
|
|
50
50
|
dictionary(locale?: string): Record<string, string>;
|
|
51
51
|
/** 覆盖 / 补语言的内置受控词表(挂载选项 `locale.builtin`) */
|
|
52
52
|
setBuiltin(builtin: SomaLocaleBundle): void;
|
|
53
|
-
loadBundle(bundle: SomaLocaleBundle |
|
|
53
|
+
loadBundle(bundle: SomaLocaleBundle | Readonly<Record<string, unknown>>): void;
|
|
54
54
|
loadContent(messages: Record<string, string>): void;
|
|
55
55
|
/** 仅供运行出口注入伪本地化词表等额外语言(不进根导出) */
|
|
56
56
|
registerLocale(locale: string, dictionary: SomaLocaleDictionary): void;
|
|
@@ -13,7 +13,7 @@ export interface SomaIdentityPort {
|
|
|
13
13
|
/** 当前提供了哪些闭集字段(explain 用) */
|
|
14
14
|
provided(): readonly SomaUserRefField[];
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* 身份变更通知(可选:手写端口可以没有)。返回取消订阅函数。
|
|
17
17
|
* 来源两路:Host 的 provider 函数上挂了 `subscribe`;或调用 `notifyChanged()`(Host 切换身份后主动告知)。
|
|
18
18
|
*/
|
|
19
19
|
subscribe?(listener: () => void): () => void;
|
|
@@ -6,5 +6,5 @@ export { isImeProcessing } from './ime';
|
|
|
6
6
|
export { matchSubmitKey, type SomaSubmitKeyDecl, type SomaSubmitKeyEvent, } from './submit';
|
|
7
7
|
export { createTypeahead, type TypeaheadController, type TypeaheadItem, type TypeaheadOptions, } from './typeahead';
|
|
8
8
|
export { createComposeKeys, type SomaComposeKeyIntent, type SomaComposeKeys, type SomaComposeKeysOptions, } from './compose-keys';
|
|
9
|
-
export { createKeyboardWiring, type
|
|
9
|
+
export { createKeyboardWiring, type KeyboardDateStep, type KeyboardWiring, type KeyboardWiringOptions, } from './wiring';
|
|
10
10
|
export { createCursorController, cursorForValue, firstEnabled, moveCursor, scrollTopForItem, type CursorController, type NavItem, } from './cursor';
|
|
@@ -2,8 +2,6 @@ import type { SomaContractKeyboard } from '../../shared/types/component-contract
|
|
|
2
2
|
import type { SomaKeyboardMatrixRow } from './intents';
|
|
3
3
|
import { type Collection, type CollectionItem } from './collection';
|
|
4
4
|
import { type KeyboardPaging } from './delegate';
|
|
5
|
-
/** 兼容别名:契约段本身就是接线的输入 */
|
|
6
|
-
export type KeyboardContract = SomaContractKeyboard;
|
|
7
5
|
/**
|
|
8
6
|
* 日期网格的一步(契约 `date_grid: true`,F-19):`days` / `months` / `years` 是带符号的步长,
|
|
9
7
|
* `edge` 是本周首末。四个字段互斥,每次只给一个——"往哪走多远"由矩阵定,"那一天是哪天"由组件算。
|
|
@@ -17,7 +17,7 @@ export interface PrecompiledDeclarationAssets extends ComponentTreeRuntimeEnvelo
|
|
|
17
17
|
compiledStyles?: unknown;
|
|
18
18
|
/** 页面色彩方案声明(KC2 colorScheme);core 只透传 */
|
|
19
19
|
colorScheme?: unknown;
|
|
20
|
-
/** 多语言词表(KC2 locale
|
|
20
|
+
/** 多语言词表(KC2 locale,只认词表信封);core 只透传 */
|
|
21
21
|
locale?: unknown;
|
|
22
22
|
}
|
|
23
23
|
export interface GeneratedPageDeclarations {
|
|
@@ -116,7 +116,7 @@ export interface SomaUiService {
|
|
|
116
116
|
}
|
|
117
117
|
export declare function createDefaultRuntimeServices(options?: {
|
|
118
118
|
appConfig?: unknown;
|
|
119
|
-
/**
|
|
119
|
+
/** 页面词表:多语言词表信封 */
|
|
120
120
|
locale?: Record<string, unknown>;
|
|
121
121
|
initialPath?: string;
|
|
122
122
|
/** Host 提供的角色集来源(KC13 `auth`):给出时角色判定走默认拒绝的角色门 */
|
|
@@ -25,11 +25,6 @@ export interface SomaCspOptions {
|
|
|
25
25
|
frameSrc?: string[];
|
|
26
26
|
/** 违规上报端点 */
|
|
27
27
|
reportUri?: string;
|
|
28
|
-
/**
|
|
29
|
-
* 兼容开关(缺省 false):放行 `style-src-attr 'unsafe-inline'`。目标态页面的样式全部编译期烘焙,不需要它;
|
|
30
|
-
* 存量 Host 仍有运行期写 `style` 属性的路径时显式开启,并把它视为待清理的技术债。
|
|
31
|
-
*/
|
|
32
|
-
allowStyleAttrInline?: boolean;
|
|
33
28
|
}
|
|
34
29
|
/** 生成一次性 nonce(Web Crypto,Edge 与 Node 18+ 都有,不引 node:crypto 以便跑在 Edge 运行时) */
|
|
35
30
|
export declare function createSomaCspNonce(): string;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { loadHostAssembly, isHostAssemblyReady, assertReservedRoutesShape, registerShellRoutes, registeredShellRoutes, resetShellRoutes, resolveHostLoginPath, isSafeLoginPath, SOMA_DEFAULT_LOGIN_PATH, SOMA_HOST_ASSEMBLY_FILE, } from './host-assembly';
|
|
2
|
-
export
|
|
1
|
+
export { loadHostAssembly, runHostStartup, isHostAssemblyReady, assertReservedRoutesShape, registerShellRoutes, registeredShellRoutes, resetShellRoutes, resolveHostLoginPath, isSafeLoginPath, SOMA_DEFAULT_LOGIN_PATH, SOMA_HOST_ASSEMBLY_FILE, } from './host-assembly';
|
|
2
|
+
export { resolveHostCaller, readHostCaller } from './host-caller';
|
|
3
|
+
export type { SomaHostCaller } from './host-caller';
|
|
4
|
+
export { withHostResponseHeaders, resolveHostResponseHeaders, classifyHostResponseKind, } from './host-response-headers';
|
|
5
|
+
export type { SomaHostAssembly, SomaHostResponseHeadersContext } from '../../shared/types/host-assembly.types';
|
|
@@ -23,14 +23,13 @@ export declare function isSafeLoginPath(raw: unknown): raw is string;
|
|
|
23
23
|
/** `login` 形状:对象,`path` 若有须是站内相对路径。形状不对当场抛 */
|
|
24
24
|
export declare function assertLoginShape(login: unknown, file?: string): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* 环境变量不合形状时忽略(回缺省),装配里不合形状的在装配读取时已抛。
|
|
26
|
+
* 登录页路径。唯一来源:装配 `login.path`,缺省 `/login`。装配里不合形状的在装配读取时已抛。
|
|
28
27
|
*/
|
|
29
28
|
export declare function resolveHostLoginPath(assembly?: {
|
|
30
29
|
readonly login?: {
|
|
31
30
|
readonly path?: string;
|
|
32
31
|
};
|
|
33
|
-
} | null
|
|
32
|
+
} | null): string;
|
|
34
33
|
/**
|
|
35
34
|
* 同步读取(编译点是同步的一步,槽位为空时的装载只能同步)。无 `soma.app.ts` → null;有但形状不对当场抛。
|
|
36
35
|
* 结果按应用根缓存。
|
|
@@ -45,11 +44,17 @@ export declare function loadHostAssemblySync(appRoot: string): SomaHostAssembly
|
|
|
45
44
|
*/
|
|
46
45
|
export declare function resolveServerOnlyEmpty(): string | undefined;
|
|
47
46
|
/**
|
|
48
|
-
* 读 `<应用根>/soma.app.ts` 默认导出并等服务端面装配完成(`await app.server()`);无该文件 → null
|
|
47
|
+
* 读 `<应用根>/soma.app.ts` 默认导出并等服务端面装配完成(`await app.server()`);无该文件 → null。
|
|
49
48
|
* 装配失败(SomaAppAssemblyError)原样上抛——拒绝启动,不静默回落。同一应用根只装配一次(并发调用共享同一 Promise)。
|
|
50
49
|
* Host 的同步消费点(编译点、虚拟页、树上下文)要求本函数先完成:入口路由在首次取页 / 取接口前 await 它。
|
|
51
50
|
*/
|
|
52
51
|
export declare function loadHostAssembly(appRoot: string): Promise<SomaHostAssembly | null>;
|
|
52
|
+
/**
|
|
53
|
+
* 服务启动:加载装配(含服务端面)后 await 一次 `startup()`。同一应用根进程内只执行一次(并发共享同一 Promise);
|
|
54
|
+
* 装配失败或 `startup()` 抛错原样上抛并清掉记忆(拒绝启动,调用方让进程报错退出)。无装配或无 `startup` → 只完成装配。
|
|
55
|
+
* 只由宿主壳的启动入口(`instrumentation.ts`)调用;`soma build` 不调用。
|
|
56
|
+
*/
|
|
57
|
+
export declare function runHostStartup(appRoot: string): Promise<void>;
|
|
53
58
|
/** 该应用根的服务端面是否已装配完(无 server() 的装配恒为 true;无装配为 false) */
|
|
54
59
|
export declare function isHostAssemblyReady(appRoot: string): boolean;
|
|
55
60
|
/** 只给测试用:清空装配缓存 */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface SomaHostCaller {
|
|
2
|
+
readonly signedIn: boolean;
|
|
3
|
+
readonly id?: string;
|
|
4
|
+
readonly roles: readonly string[];
|
|
5
|
+
readonly actor?: string;
|
|
6
|
+
}
|
|
7
|
+
/** 读 Host 的身份对象(纯函数,可单测) */
|
|
8
|
+
export declare function readHostCaller(raw: unknown): SomaHostCaller;
|
|
9
|
+
/** 解析这次请求的调用方;装配的 `identity` 抛错按匿名处理 */
|
|
10
|
+
export declare function resolveHostCaller(request: Request | undefined, hostDir?: string | undefined): Promise<SomaHostCaller>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SomaHostResponseHeadersContext } from '../../shared/types/host-assembly.types';
|
|
2
|
+
/** 按路径分类:`/api/*` → api;`/_next/*`、`/soma-runtime/*`、`/favicon.ico`、带文件扩展名的路径 → asset;其余 → page */
|
|
3
|
+
export declare function classifyHostResponseKind(pathname: string): SomaHostResponseHeadersContext['kind'];
|
|
4
|
+
/**
|
|
5
|
+
* 取该请求应加的响应头。无 `SOMA_HOST_DIR`、无装配、装配没写 `responseHeaders` 或返回空 → undefined。
|
|
6
|
+
* 装配尚未就绪时会先等服务端面装配完(失败原样上抛)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveHostResponseHeaders(request: {
|
|
9
|
+
readonly method: string;
|
|
10
|
+
readonly pathname: string;
|
|
11
|
+
}, hostDir?: string | undefined): Promise<Readonly<Record<string, string>> | undefined>;
|
|
12
|
+
/** 把装配的响应头合并进响应(同名以装配为准);没有要加的头时原样返回同一个 Response */
|
|
13
|
+
export declare function withHostResponseHeaders(response: Response, request: {
|
|
14
|
+
readonly method: string;
|
|
15
|
+
readonly pathname: string;
|
|
16
|
+
}, hostDir?: string): Promise<Response>;
|
|
@@ -2,7 +2,7 @@ import { publishedPageSlugFromPath } from '../../shared/published-page-route';
|
|
|
2
2
|
import { type PublishedPageArtifactResult } from './published-page-artifact-cache';
|
|
3
3
|
import type { SomaCoreDiagnostic } from '../../shared/core-diagnostic-codes';
|
|
4
4
|
import type { SomaGenerationErrorShape } from '../../shared/types/generation-error.types';
|
|
5
|
-
/** Registry `myworkspace`
|
|
5
|
+
/** Registry `myworkspace` 的地址是 `/myworkspace`。 */
|
|
6
6
|
export declare const registryPageNameFromPath: typeof publishedPageSlugFromPath;
|
|
7
7
|
/**
|
|
8
8
|
* 整页错误(页面主题整体解析失败等,端口给的整页失败):不存档、不缓存,Host 路由据此回受控文案 + 诊断码,
|
|
@@ -14,8 +14,4 @@ export interface SomaHostRequestContext {
|
|
|
14
14
|
* request. Secrets must never be copied into a response or client config.
|
|
15
15
|
*/
|
|
16
16
|
export type SomaRequestHook = (request: Request, context: SomaHostRequestContext) => Response | undefined | Promise<Response | undefined>;
|
|
17
|
-
export interface SomaRequestHookModule {
|
|
18
|
-
somaRequestHook?: SomaRequestHook;
|
|
19
|
-
handleSomaRequest?: SomaRequestHook;
|
|
20
|
-
}
|
|
21
17
|
export declare function resolveHostRequestHook(): Promise<SomaRequestHook | null>;
|
|
@@ -4,5 +4,5 @@ export interface SomaTreeContextRequest {
|
|
|
4
4
|
domain?: string;
|
|
5
5
|
app?: string;
|
|
6
6
|
}
|
|
7
|
-
/** Synchronous, server-only Host assembly hook. No page/request-provided module paths. */
|
|
7
|
+
/** Synchronous, server-only Host assembly hook. No page/request-provided module paths. 只认 soma.app.ts 装配的 treeContext。 */
|
|
8
8
|
export declare function resolveHostTreeCompileContext(hostDir: string | undefined, request: SomaTreeContextRequest): TreeCompileContext | undefined;
|
|
@@ -2,7 +2,6 @@ import { type SomaAssetSource } from './source-packages';
|
|
|
2
2
|
import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
3
3
|
import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
|
|
4
4
|
import type { SomaCompiledStyle } from '../../shared/types/ui-config.types';
|
|
5
|
-
export type SomaPageAssetLoadProfile = 'render' | 'headless';
|
|
6
5
|
export interface SomaServerPageAssets {
|
|
7
6
|
sourceMarkup: SomaPageMarkup;
|
|
8
7
|
artifact?: TreeArtifact;
|
|
@@ -54,7 +53,6 @@ export declare function resolveSomaPageSource(sources: SomaAssetSource[], urlPat
|
|
|
54
53
|
export declare function loadSomaServerPageAssets(options: {
|
|
55
54
|
hostDir: string | undefined;
|
|
56
55
|
urlPath: string;
|
|
57
|
-
profile?: SomaPageAssetLoadProfile;
|
|
58
56
|
watch?: boolean;
|
|
59
57
|
/** Trusted server context, never read from the page declaration or request body. */
|
|
60
58
|
treeContext?: TreeCompileContext;
|
|
@@ -17,27 +17,17 @@ export interface SomaVirtualPageRegistration {
|
|
|
17
17
|
readonly prefix: string;
|
|
18
18
|
readonly resolve: SomaVirtualPageResolver;
|
|
19
19
|
}
|
|
20
|
-
/** 宿主装配钩子的位置(相对宿主源码根)与导出名 */
|
|
21
|
-
export declare const SOMA_HOST_VIRTUAL_PAGES_HOOK: {
|
|
22
|
-
readonly file: string;
|
|
23
|
-
readonly exportName: "createSomaVirtualPages";
|
|
24
|
-
};
|
|
25
20
|
/** 前缀判据:`/<段>/`、首段非保留名、认领的路径不会被 Registry 路径解析认走。不合格当场抛。 */
|
|
26
21
|
export declare function assertVirtualPagePrefix(prefix: unknown): asserts prefix is string;
|
|
27
22
|
/**
|
|
28
|
-
* 登记一个前缀的解析器(`bindPrefix`
|
|
29
|
-
* 余段为空(`/preview/`
|
|
23
|
+
* 登记一个前缀的解析器(`bindPrefix` 的薄包装)。同前缀重复登记以后者为准(Host 热重载友好)。
|
|
24
|
+
* 余段为空(`/preview/` 本身)不认领。
|
|
30
25
|
*/
|
|
31
26
|
export declare function registerVirtualPageResolver(prefix: string, resolve: SomaVirtualPageResolver): void;
|
|
32
27
|
/**
|
|
33
|
-
* 按 `SOMA_HOST_DIR`
|
|
34
|
-
*
|
|
28
|
+
* 按 `SOMA_HOST_DIR` 读 Host 装配的 `virtualPages()` 并登记一次。没有目录 / 没有 `soma.app.ts` → 什么也不做;
|
|
29
|
+
* 装配形状不对在装配读取时已当场抛。
|
|
35
30
|
*/
|
|
36
31
|
export declare function ensureHostVirtualPages(hostDir?: string | undefined): void;
|
|
37
|
-
/**
|
|
38
|
-
* 取虚拟页运行时资产(存量公开函数,兼容保留):现在是绑定表上的前缀绑定查找。
|
|
39
|
-
* 没有前缀认领 / 解析器回 null → null(调用方走常规 404)。声明编不过时抛出(与 Registry 页同口径:调用方吞掉并回 404)。
|
|
40
|
-
*/
|
|
41
|
-
export declare function loadVirtualPageAssets(pagePath: string, request: Request): Promise<Record<string, unknown> | null>;
|
|
42
32
|
/** 只给测试用:忘掉「已按宿主登记过」的标记(配合 runtime 空间复位) */
|
|
43
33
|
export declare function resetHostVirtualPages(): void;
|
|
@@ -21,7 +21,6 @@ export { loadHostAssembly, registerShellRoutes, resolveHostLoginPath, SOMA_HOST_
|
|
|
21
21
|
export type { SomaHostAssembly } from '../shared/types/host-assembly.types';
|
|
22
22
|
export { loadPageMarkupConfig, renderColorSchemeMeta } from './host/page-markup-config';
|
|
23
23
|
export type { SomaPageMarkup } from '../shared/types/component-tree.types';
|
|
24
|
-
export { loadSomaServerPageAssets, resolveSomaPageSource, SomaPageAssetError, type SomaServerPageAssets,
|
|
24
|
+
export { loadSomaServerPageAssets, resolveSomaPageSource, SomaPageAssetError, type SomaServerPageAssets, } from './host/server-page-assets';
|
|
25
25
|
export { getSomaAssetSources, getSomaHostSourceRoot, type SomaAssetSource, } from './host/source-packages';
|
|
26
|
-
export { loadVirtualPageAssets } from './host/virtual-pages';
|
|
27
26
|
export * from './runtime-space';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 与 `soma-core/server` 的关系:同名导出是同一份实现的再导出,不是第二份;Next 服务端代码继续用 `soma-core/server`。
|
|
10
10
|
*/
|
|
11
11
|
export { collectIncludes, collectPageEntries, getSomaAssetSources, getSomaHostConfigRoot, getSomaHostSourceRoot, listSomaSourcePackageNames, normalizeSomaEnv, orderSourcesForOverride, readSomaEnv, resolveAppConfigPath, resolveHostAppConfigPath, resolveHostConfigRoot, type SomaAssetSource, type SomaEnvName, type SomaSourcePageEntry, } from './host/source-packages';
|
|
12
|
-
export { loadSomaServerPageAssets, resolveSomaPageSource, SomaPageAssetError, type
|
|
12
|
+
export { loadSomaServerPageAssets, resolveSomaPageSource, SomaPageAssetError, type SomaServerPageAssets, } from './host/server-page-assets';
|
|
13
13
|
export { loadPageMarkupConfig, renderColorSchemeMeta } from './host/page-markup-config';
|
|
14
14
|
export { resolveServiceFilePath, toPascalCase } from './api/service-path';
|
|
15
15
|
export { assertRegistryPublishAddress, bindPublishedRegistryPage, resetRegistryWriteRateLimit, unbindArchivedRegistryPage, } from './registry/registry-write-pipeline';
|
|
@@ -8,10 +8,7 @@ export { compilePageAssets } from '../build/compiler/page-assets';
|
|
|
8
8
|
export { compileSomaPageAssets } from './host/soma-page-compile';
|
|
9
9
|
export { compilePublishedPageArtifact } from './host/published-page-artifact-cache';
|
|
10
10
|
import type { SomaPrecompiledManifest, SomaPrecompiledPage } from '../build/compiler/full-manifest-builder';
|
|
11
|
-
/**
|
|
12
|
-
* 读构建期预编译清单:先读 runtime 空间的预热,没有再读旧 `.soma/manifest.json`。
|
|
13
|
-
* 预热对得上账但页面校验不过时返回 null,不退回旧文件拼半新半旧;旧文件已无写入方,只在升级后的第一个周期兜底。
|
|
14
|
-
*/
|
|
11
|
+
/** 读构建期预编译清单:只读 runtime 空间的预热;没有预热或页面校验不过都返回 null。 */
|
|
15
12
|
export declare function loadPrecompiledManifest(hostDir: string, env?: Readonly<Record<string, string | undefined>>): SomaPrecompiledManifest | null;
|
|
16
13
|
/** Find precompiled page by route (supports /items → items/index short path) */
|
|
17
14
|
export declare function findPrecompiledPage(manifest: SomaPrecompiledManifest, urlPath: string): SomaPrecompiledPage | null;
|