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
|
@@ -111,9 +111,9 @@ export function assertRuntimeArtifact(input: unknown, supply?: SomaComponentSupp
|
|
|
111
111
|
string(envelope.html, 'html');
|
|
112
112
|
const artifact = record(envelope.artifact, 'artifact');
|
|
113
113
|
assertWireData(artifact);
|
|
114
|
-
closed(artifact, ['format', '
|
|
114
|
+
closed(artifact, ['format', 'compilerVersion', 'sourceDigest', 'registrySnapshotDigest', 'policyDigest',
|
|
115
115
|
'assetSupplyKey', 'capabilities', 'componentRefs', 'structurePlan', 'repeatPlans', 'artifactDigest'], 'artifact');
|
|
116
|
-
if (!isArtifactFormatAccepted(artifact)) fail('artifact.
|
|
116
|
+
if (!isArtifactFormatAccepted(artifact)) fail('artifact.format', 'version');
|
|
117
117
|
string(artifact.compilerVersion, 'artifact.compilerVersion');
|
|
118
118
|
for (const key of ['sourceDigest', 'registrySnapshotDigest', 'policyDigest', 'artifactDigest']) {
|
|
119
119
|
string(artifact[key], `artifact.${key}`, DIGEST);
|
|
@@ -122,9 +122,7 @@ export function assertRuntimeArtifact(input: unknown, supply?: SomaComponentSupp
|
|
|
122
122
|
const required = capabilities(artifact.capabilities, 'artifact.capabilities');
|
|
123
123
|
const capabilityVerdict = checkArtifactRuntimeCompatibility({
|
|
124
124
|
sourceMarkup: 'component-tree',
|
|
125
|
-
|
|
126
|
-
...(artifact.schemaVersion !== undefined ? { schemaVersion: artifact.schemaVersion as 1 } : {}),
|
|
127
|
-
...(artifact.grammarVersion !== undefined ? { grammarVersion: artifact.grammarVersion as 1 } : {}),
|
|
125
|
+
format: artifact.format as 'soma.page-artifact',
|
|
128
126
|
capabilities: [...required],
|
|
129
127
|
componentRefs: [],
|
|
130
128
|
}, null);
|
|
@@ -252,9 +250,7 @@ export function assertRuntimeArtifact(input: unknown, supply?: SomaComponentSupp
|
|
|
252
250
|
componentRefs: (artifact.componentRefs as RecordValue[]).map((ref) => ({
|
|
253
251
|
name: String(ref.name), contractDigest: String(ref.contractDigest), structureDigest: String(ref.structureDigest), uses: [],
|
|
254
252
|
})),
|
|
255
|
-
|
|
256
|
-
...(artifact.schemaVersion !== undefined ? { schemaVersion: artifact.schemaVersion as 1 } : {}),
|
|
257
|
-
...(artifact.grammarVersion !== undefined ? { grammarVersion: artifact.grammarVersion as 1 } : {}),
|
|
253
|
+
format: artifact.format as 'soma.page-artifact',
|
|
258
254
|
}, supply);
|
|
259
255
|
if (!supplyVerdict.compatible) fail('componentRefs', supplyVerdict.code === 'CT-ARTIFACT-VERSION' ? 'version' : 'capability');
|
|
260
256
|
}
|
|
@@ -34,12 +34,10 @@ export const SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
34
34
|
'CORE-RUNTIME-ERROR', // 引擎自身捕获的异常不带码时,观测通道记录的缺省码
|
|
35
35
|
// runtime 空间根与存储(RT1)
|
|
36
36
|
'CORE-RUNTIME-ROOT-INVALID', // runtime 根越界(宿主根 / html / ui / public 内、宿主祖先、文件系统根),拒绝启动
|
|
37
|
-
'CORE-RUNTIME-LEGACY-DIR', // Registry 数据仍在旧目录,正在只读回退;提示运行 soma runtime migrate
|
|
38
37
|
'CORE-RUNTIME-ROOT-UNSET', // 生产环境未设 SOMA_RUNTIME_DIR(soma doctor 告警)
|
|
39
38
|
// 地址绑定与注入(RT2 / E2;《core 标准格式与 runtime 空间》§2、§4;《页面级描述与按 URL 注册》§4)
|
|
40
39
|
'CORE-FORMAT-VERSION-UNSUPPORTED', // 注入载荷 format 不是 core 认识的主版本
|
|
41
|
-
'CORE-FORMAT-VERSION-MISMATCH', // 载荷 format 与 page 块 soma:
|
|
42
|
-
'CORE-FORMAT-VERSION-IMPLICIT', // page 块未写 soma:,兼容期按 1 处理(advice)
|
|
40
|
+
'CORE-FORMAT-VERSION-MISMATCH', // 载荷 format 与 page 块 soma: 不一致(page 块缺 soma: 同此码)
|
|
43
41
|
'CORE-INJECT-NONSTANDARD-KEY', // 兼容期结束后含方言段拒收
|
|
44
42
|
'CORE-RUNTIME-ADDRESS-INVALID', // 地址文法不合(缺前导 /、尾随 /、大写、查询串、.. // 百分号、段数 / 长度超限)
|
|
45
43
|
'CORE-RUNTIME-ADDRESS-RESERVED', // 首段是保留名或宿主外壳路由
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
// (`id` / `title` / `readBy`)。
|
|
6
6
|
//
|
|
7
7
|
// core 公开面只承诺 core 的码族:本视图去掉 `ai` 族与真源元数据,其余族原样(同一对象引用,不抄码值)。
|
|
8
|
-
// `ai` 族(R-4
|
|
9
|
-
// 过渡开关 KEEP_AI_FAMILY_IN_CORE 已不存在于 soma-design 生成器;本视图始终不含 ai 族。
|
|
8
|
+
// `ai` 族(R-4)由生成器单独输出到 soma-ai 的小文件(`ai-error-codes.generated.ts`);本视图始终不含 ai 族。
|
|
10
9
|
// 公开子路径(`soma-core/server/diagnostic-gate`)应 re-export 本视图,不 re-export 生成物。
|
|
11
10
|
|
|
12
11
|
import { SOMA_PIPELINE_ERROR_CODES as SOMA_PIPELINE_ERROR_CODES_FULL } from './registry-generated/error-codes';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Registry 发布页的公开 URL 契约。
|
|
3
3
|
*
|
|
4
4
|
* 页面名就是根路径 slug:Registry `myworkspace` 对应 `/myworkspace`。
|
|
5
|
-
* `/pages/<name>` 仅保留为存量链接兼容入口,新发布结果不再生成该前缀。
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
7
|
import { SOMA_RESERVED_ADDRESS_SEGMENTS } from './runtime-address';
|
|
@@ -45,13 +44,9 @@ export function publishedPagePath(slug: string): string {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
49
|
-
* 只接受单段路径,子路径仍交给 Host 文件页处理。
|
|
47
|
+
* 根路径是唯一入口。只接受单段路径,子路径仍交给 Host 文件页处理。
|
|
50
48
|
*/
|
|
51
49
|
export function publishedPageSlugFromPath(pagePath: string): string | null {
|
|
52
|
-
const legacy = pagePath.match(/^\/pages\/([^/]+)$/)?.[1];
|
|
53
|
-
if (legacy && isPublishedPageSlug(legacy)) return legacy;
|
|
54
|
-
|
|
55
50
|
const root = pagePath.match(/^\/([^/]+)$/)?.[1];
|
|
56
51
|
return root && isPublishedPageSlug(root) ? root : null;
|
|
57
52
|
}
|
|
@@ -83,7 +83,6 @@ export const SOMA_DIAGNOSTIC_CODE_INDEX: readonly (readonly [code: string, famil
|
|
|
83
83
|
['CORE-FORMAT-CURRENCY', 'CORE', 'core', 'error'],
|
|
84
84
|
['CORE-FORMAT-LOCALE', 'CORE', 'core', 'error'],
|
|
85
85
|
['CORE-FORMAT-TIMEZONE', 'CORE', 'core', 'error'],
|
|
86
|
-
['CORE-FORMAT-VERSION-IMPLICIT', 'CORE', 'core', 'advice'],
|
|
87
86
|
['CORE-FORMAT-VERSION-MISMATCH', 'CORE', 'core', 'error'],
|
|
88
87
|
['CORE-FORMAT-VERSION-UNSUPPORTED', 'CORE', 'core', 'error'],
|
|
89
88
|
['CORE-FRAGMENTS-CONFLICT', 'CORE', 'core', 'error'],
|
|
@@ -170,7 +169,6 @@ export const SOMA_DIAGNOSTIC_CODE_INDEX: readonly (readonly [code: string, famil
|
|
|
170
169
|
['CORE-RUNTIME-GENERATION', 'CORE', 'core', 'error'],
|
|
171
170
|
['CORE-RUNTIME-GRANT', 'CORE', 'core', 'error'],
|
|
172
171
|
['CORE-RUNTIME-GRANT-INVALID', 'CORE', 'core', 'error'],
|
|
173
|
-
['CORE-RUNTIME-LEGACY-DIR', 'CORE', 'core', 'warn'],
|
|
174
172
|
['CORE-RUNTIME-MOUNT', 'CORE', 'core', 'error'],
|
|
175
173
|
['CORE-RUNTIME-PARAM-INVALID', 'CORE', 'core', 'advice'],
|
|
176
174
|
['CORE-RUNTIME-PROVENANCE', 'CORE', 'core', 'error'],
|
|
@@ -644,13 +644,6 @@ export const SOMA_PIPELINE_DIAGNOSTIC_REGISTRY = {
|
|
|
644
644
|
"severity": "error",
|
|
645
645
|
"owner": "soma-core/core/shared/core-diagnostic-codes.ts"
|
|
646
646
|
},
|
|
647
|
-
{
|
|
648
|
-
"code": "CORE-FORMAT-VERSION-IMPLICIT",
|
|
649
|
-
"family": "CORE",
|
|
650
|
-
"stage": "core",
|
|
651
|
-
"severity": "advice",
|
|
652
|
-
"owner": "soma-core/core/shared/core-diagnostic-codes.ts"
|
|
653
|
-
},
|
|
654
647
|
{
|
|
655
648
|
"code": "CORE-FORMAT-VERSION-MISMATCH",
|
|
656
649
|
"family": "CORE",
|
|
@@ -1253,13 +1246,6 @@ export const SOMA_PIPELINE_DIAGNOSTIC_REGISTRY = {
|
|
|
1253
1246
|
"severity": "error",
|
|
1254
1247
|
"owner": "soma-core/core/shared/core-diagnostic-codes.ts"
|
|
1255
1248
|
},
|
|
1256
|
-
{
|
|
1257
|
-
"code": "CORE-RUNTIME-LEGACY-DIR",
|
|
1258
|
-
"family": "CORE",
|
|
1259
|
-
"stage": "core",
|
|
1260
|
-
"severity": "warn",
|
|
1261
|
-
"owner": "soma-core/core/shared/core-diagnostic-codes.ts"
|
|
1262
|
-
},
|
|
1263
1249
|
{
|
|
1264
1250
|
"code": "CORE-RUNTIME-MOUNT",
|
|
1265
1251
|
"family": "CORE",
|
|
@@ -98,20 +98,12 @@ export interface ComponentRef {
|
|
|
98
98
|
uses: string[];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* 目标信封格式标识(语义名,06e §3.2)。存量 `schemaVersion: 1` + `grammarVersion: 1` 视同本格式,迁移期双认到 M31;
|
|
103
|
-
* 新产出方写 `format`。
|
|
104
|
-
*/
|
|
101
|
+
/** 信封格式标识(语义名,06e §3.2);产物只写、只认 `format`。 */
|
|
105
102
|
export const SOMA_PAGE_ARTIFACT_FORMATS = ['soma.page-artifact'] as const;
|
|
106
103
|
export type SomaPageArtifactFormat = (typeof SOMA_PAGE_ARTIFACT_FORMATS)[number];
|
|
107
104
|
|
|
108
105
|
export interface TreeArtifact {
|
|
109
|
-
|
|
110
|
-
format?: SomaPageArtifactFormat;
|
|
111
|
-
/** 存量名,只作引用,M31 后不再读 */
|
|
112
|
-
schemaVersion?: 1;
|
|
113
|
-
/** 存量名,只作引用,M31 后不再读 */
|
|
114
|
-
grammarVersion?: 1;
|
|
106
|
+
format: SomaPageArtifactFormat;
|
|
115
107
|
compilerVersion: string;
|
|
116
108
|
sourceDigest: string;
|
|
117
109
|
registrySnapshotDigest: string;
|
|
@@ -137,12 +129,7 @@ export interface ComponentTreeRuntimeEnvelope {
|
|
|
137
129
|
*/
|
|
138
130
|
export interface SomaArtifactEnvelopeHead {
|
|
139
131
|
readonly sourceMarkup: SomaPageMarkup;
|
|
140
|
-
/** 目标字段 */
|
|
141
132
|
readonly format?: SomaPageArtifactFormat;
|
|
142
|
-
/** 存量名,只作引用 */
|
|
143
|
-
readonly schemaVersion?: 1;
|
|
144
|
-
/** 存量名,只作引用 */
|
|
145
|
-
readonly grammarVersion?: 1;
|
|
146
133
|
/** 须 ⊆ COMPONENT_TREE_CAPABILITIES 且含 'component-tree:1' */
|
|
147
134
|
readonly capabilities: readonly string[];
|
|
148
135
|
/** { name, packName?, packVersion?, contractDigest, structureDigest, uses } */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// `IService` / 虚拟页登记 / 请求钩子分别住 client / server。这里用结构上兼容的最小形状表达,接收方按需收窄,
|
|
8
8
|
// 不在 shared 层造向上的依赖。
|
|
9
9
|
//
|
|
10
|
-
//
|
|
10
|
+
// 不变式:Host 的服务端装配只认 `soma.app.ts`(及其惰性交入的 `soma.server.ts`),没有 `bootstrap/*` 约定钩子文件。
|
|
11
11
|
|
|
12
12
|
import type { TreeCompileContext } from './component-tree.types';
|
|
13
13
|
|
|
@@ -82,7 +82,7 @@ export interface SomaHostAssembly {
|
|
|
82
82
|
readonly reservedRoutes?: readonly string[];
|
|
83
83
|
/**
|
|
84
84
|
* 登录页(R-24):访问门 401 的响应附 `login.path`,页面客户端跳 `<path>?next=<当前地址>`。
|
|
85
|
-
*
|
|
85
|
+
* 只收站内相对路径;缺省 `/login`。
|
|
86
86
|
*/
|
|
87
87
|
readonly login?: { readonly path?: string };
|
|
88
88
|
virtualPages(): readonly SomaHostAssemblyVirtualPage[];
|
|
@@ -94,4 +94,33 @@ export interface SomaHostAssembly {
|
|
|
94
94
|
* 返回前必须已全部落盘;抛错即构建失败。core 不关心页面由谁产生(AD-34)。
|
|
95
95
|
*/
|
|
96
96
|
prewarm?(): void | Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* 服务启动钩子:服务进程启动时执行一次的异步初始化(连接池、配置预检、缓存预热……)。
|
|
99
|
+
* 调用方是宿主壳的 `instrumentation.ts`(Next `register`):仅在 Node 运行时、`soma dev` / `soma start` 的服务进程启动时
|
|
100
|
+
* 加载装配(含服务端面 `server()`)后 await 一次;`soma build` 不调用(build 只调 `prewarm`)。
|
|
101
|
+
* 抛错 = 拒绝启动(`register` 抛错,进程不进入服务状态);同一应用根进程内只执行一次(并发共享同一 Promise)。
|
|
102
|
+
*/
|
|
103
|
+
startup?(): void | Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* 响应头出口:给宿主壳产出的响应统一加头。`proxy.ts` 对每个请求(页面、`/api/*`、静态资源)调用,
|
|
106
|
+
* 页面数据与接口路由再对最终响应调用一次(路由自设的同名头由本出口的值覆盖)。
|
|
107
|
+
* 返回 `undefined` 或空对象 = 不加头;同名头以本出口为准;头名或值非法时当场抛错(该请求 500)。
|
|
108
|
+
* 可同步也可异步(服务端实现可经 `import('./soma.server')` 惰性取);每个请求都会调用,须快速、无副作用。
|
|
109
|
+
*/
|
|
110
|
+
responseHeaders?(context: SomaHostResponseHeadersContext):
|
|
111
|
+
| Readonly<Record<string, string>> | undefined
|
|
112
|
+
| Promise<Readonly<Record<string, string>> | undefined>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** 响应头出口的调用上下文 */
|
|
116
|
+
export interface SomaHostResponseHeadersContext {
|
|
117
|
+
/** 请求路径(不含查询串) */
|
|
118
|
+
readonly pathname: string;
|
|
119
|
+
/** 请求方法(大写) */
|
|
120
|
+
readonly method: string;
|
|
121
|
+
/**
|
|
122
|
+
* 请求类型:`api`(`/api/*`)、`asset`(`/_next/*`、`/soma-runtime/*`、`/favicon.ico` 与带文件扩展名的路径,含 Host `public/`)、
|
|
123
|
+
* `page`(其余,含 `/soma/*` 页面数据端点)
|
|
124
|
+
*/
|
|
125
|
+
readonly kind: 'page' | 'api' | 'asset';
|
|
97
126
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// KC2 多语言词表形状(06b KC2 locale;06e AD-CORE-09;00e Q-061)。
|
|
2
2
|
//
|
|
3
3
|
// 词表信封:`{ format: 'soma.locale-bundle', defaultLocale?, <语言>: { <词条键>: <文案> } }`。
|
|
4
|
-
// `format` 与 `defaultLocale`
|
|
5
|
-
//
|
|
4
|
+
// `format` 与 `defaultLocale` 是保留的非语言键;其余键都是语言。只认词表信封,扁平 `键 → 文案` 单字典不是词表。
|
|
5
|
+
// 判别只按 `format`(00e Q-061)。
|
|
6
6
|
// 词条键语义(五段默认键、`soma.` 首段受控)归 soma-ui;core 只按键查表,不感知来源。
|
|
7
7
|
|
|
8
8
|
export const SOMA_LOCALE_BUNDLE_FORMAT = 'soma.locale-bundle' as const;
|
|
@@ -19,7 +19,7 @@ export interface SomaLocaleBundle {
|
|
|
19
19
|
|
|
20
20
|
const RESERVED_KEYS: ReadonlySet<string> = new Set(['format', 'defaultLocale']);
|
|
21
21
|
|
|
22
|
-
/** 只按 `format`
|
|
22
|
+
/** 只按 `format` 判别词表信封 */
|
|
23
23
|
export function isLocaleBundle(value: unknown): value is SomaLocaleBundle {
|
|
24
24
|
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
25
25
|
&& (value as { format?: unknown }).format === SOMA_LOCALE_BUNDLE_FORMAT;
|
|
@@ -99,7 +99,7 @@ export interface SomaScopeMirrorDecl {
|
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* 显隐门:按切片值的业务真值切换页面元素(`data-soma-id` = `hook`)的 `hidden` 属性。
|
|
102
|
-
* 不写内联样式;元素由编译器同时带 `data-soma-gate
|
|
102
|
+
* 不写内联样式;元素由编译器同时带 `data-soma-gate`,隐藏规则在页面级样式片里。
|
|
103
103
|
*/
|
|
104
104
|
export interface SomaScopeGateDecl {
|
|
105
105
|
/** 被门控元素的页面 `data-soma-id` */
|
|
@@ -135,13 +135,8 @@ export interface SomaFragmentRegion {
|
|
|
135
135
|
* @req F-021 R-022
|
|
136
136
|
*/
|
|
137
137
|
export interface SomaPageFragments {
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
* 两者都缺席或都不认识时运行时整份忽略并告警,不猜字段。
|
|
141
|
-
*/
|
|
142
|
-
format?: typeof SOMA_FRAGMENTS_FORMAT;
|
|
143
|
-
/** 存量产物格式版本(只作引用;新产出方写 `format`) */
|
|
144
|
-
version?: 1;
|
|
138
|
+
/** 产物格式标识(KC11,06e §3.6);缺席或不认识时整份拒收,不猜字段。 */
|
|
139
|
+
format: typeof SOMA_FRAGMENTS_FORMAT;
|
|
145
140
|
/** 按锚点名升序——同一份声明必须产出同一份字节(§19.3 幂等) */
|
|
146
141
|
regions: SomaFragmentRegion[];
|
|
147
142
|
/**
|
|
@@ -66,7 +66,7 @@ export interface SomaTimerPort {
|
|
|
66
66
|
clearTimeout(handle: unknown): void;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/** 写入端口的结果元信息(附在 `SomaDataSubmitResult`
|
|
69
|
+
/** 写入端口的结果元信息(附在 `SomaDataSubmitResult` 上,全部可选) */
|
|
70
70
|
export interface SomaWriteOutcomeMeta {
|
|
71
71
|
readonly intent?: SomaSaveIntent;
|
|
72
72
|
readonly completion?: SomaSaveCompletion;
|
|
@@ -94568,7 +94568,7 @@ var SomaContainerAdapter = class {
|
|
|
94568
94568
|
setHtml(element, value) {
|
|
94569
94569
|
element.innerHTML = sanitizeSomaHtml(value).html;
|
|
94570
94570
|
}
|
|
94571
|
-
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见
|
|
94571
|
+
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
|
|
94572
94572
|
setVisibility(element, visible) {
|
|
94573
94573
|
element.hidden = !visible;
|
|
94574
94574
|
}
|
|
@@ -101818,7 +101818,6 @@ function parseUiConfig(raw, options) {
|
|
|
101818
101818
|
}
|
|
101819
101819
|
var FRAGMENTS_ARTIFACT_KEYS = {
|
|
101820
101820
|
format: true,
|
|
101821
|
-
version: true,
|
|
101822
101821
|
regions: true,
|
|
101823
101822
|
scopes: true,
|
|
101824
101823
|
css: true,
|
|
@@ -101838,9 +101837,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
101838
101837
|
);
|
|
101839
101838
|
}
|
|
101840
101839
|
shapeClosedKeys(entry, FRAGMENTS_ARTIFACT_KEYS, label, label);
|
|
101841
|
-
if (entry.format !== SOMA_FRAGMENTS_FORMAT
|
|
101840
|
+
if (entry.format !== SOMA_FRAGMENTS_FORMAT) {
|
|
101842
101841
|
throw new SomaUiConfigError(
|
|
101843
|
-
`${label} \u7684\u683C\u5F0F\u6807\u8BC6\u4E0D\u8BA4\u8BC6\uFF08format \u987B\u4E3A ${SOMA_FRAGMENTS_FORMAT}\
|
|
101842
|
+
`${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`,
|
|
101844
101843
|
`${label}.format`
|
|
101845
101844
|
);
|
|
101846
101845
|
}
|
|
@@ -101853,10 +101852,9 @@ function parseFragmentsSection(raw, label = SOMA_FRAGMENTS_KEY) {
|
|
|
101853
101852
|
}
|
|
101854
101853
|
}
|
|
101855
101854
|
const artifact = {
|
|
101855
|
+
format: SOMA_FRAGMENTS_FORMAT,
|
|
101856
101856
|
regions: entry.regions
|
|
101857
101857
|
};
|
|
101858
|
-
if (entry.format === SOMA_FRAGMENTS_FORMAT) artifact.format = SOMA_FRAGMENTS_FORMAT;
|
|
101859
|
-
if (entry.version === 1) artifact.version = 1;
|
|
101860
101858
|
if (entry.degradedRegions !== void 0) {
|
|
101861
101859
|
if (!Array.isArray(entry.degradedRegions)) {
|
|
101862
101860
|
throw new SomaUiConfigError(`${label}.degradedRegions \u5FC5\u987B\u662F\u6570\u7EC4`, `${label}.degradedRegions`);
|
|
@@ -104656,7 +104654,7 @@ var SomaEventEngine = class {
|
|
|
104656
104654
|
this.scopeTracker = options.scopeTracker;
|
|
104657
104655
|
this.callbacks = {
|
|
104658
104656
|
onRefresh: options.callbacks.onRefresh,
|
|
104659
|
-
onCommit: options.callbacks.onCommit ??
|
|
104657
|
+
onCommit: options.callbacks.onCommit ?? (() => Promise.resolve()),
|
|
104660
104658
|
onBeginTransaction: options.callbacks.onBeginTransaction,
|
|
104661
104659
|
onEndTransaction: options.callbacks.onEndTransaction,
|
|
104662
104660
|
onDiscardPending: options.callbacks.onDiscardPending,
|
|
@@ -108160,7 +108158,7 @@ function interpolate(template, params) {
|
|
|
108160
108158
|
// core/client/infra/i18n/locale-catalog.ts
|
|
108161
108159
|
var FALLBACK_DEFAULT_LOCALE = "zh-CN";
|
|
108162
108160
|
var SomaLocaleCatalog = class {
|
|
108163
|
-
/**
|
|
108161
|
+
/** 应用词表(产物词表信封装载进来的):语言 → 键 → 文案 */
|
|
108164
108162
|
dictionaries = /* @__PURE__ */ new Map();
|
|
108165
108163
|
builtin;
|
|
108166
108164
|
defaultLocale;
|
|
@@ -108206,7 +108204,10 @@ var SomaLocaleCatalog = class {
|
|
|
108206
108204
|
}
|
|
108207
108205
|
loadBundle(bundle) {
|
|
108208
108206
|
if (!isLocaleBundle(bundle)) {
|
|
108209
|
-
|
|
108207
|
+
if (typeof bundle !== "object" || bundle === null || Array.isArray(bundle) || Object.keys(bundle).length > 0) {
|
|
108208
|
+
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");
|
|
108209
|
+
}
|
|
108210
|
+
this.loadContent({});
|
|
108210
108211
|
return;
|
|
108211
108212
|
}
|
|
108212
108213
|
for (const locale of localesOf(bundle)) {
|
|
@@ -110407,17 +110408,13 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
110407
110408
|
// runtime 空间根与存储(RT1)
|
|
110408
110409
|
"CORE-RUNTIME-ROOT-INVALID",
|
|
110409
110410
|
// runtime 根越界(宿主根 / html / ui / public 内、宿主祖先、文件系统根),拒绝启动
|
|
110410
|
-
"CORE-RUNTIME-LEGACY-DIR",
|
|
110411
|
-
// Registry 数据仍在旧目录,正在只读回退;提示运行 soma runtime migrate
|
|
110412
110411
|
"CORE-RUNTIME-ROOT-UNSET",
|
|
110413
110412
|
// 生产环境未设 SOMA_RUNTIME_DIR(soma doctor 告警)
|
|
110414
110413
|
// 地址绑定与注入(RT2 / E2;《core 标准格式与 runtime 空间》§2、§4;《页面级描述与按 URL 注册》§4)
|
|
110415
110414
|
"CORE-FORMAT-VERSION-UNSUPPORTED",
|
|
110416
110415
|
// 注入载荷 format 不是 core 认识的主版本
|
|
110417
110416
|
"CORE-FORMAT-VERSION-MISMATCH",
|
|
110418
|
-
// 载荷 format 与 page 块 soma:
|
|
110419
|
-
"CORE-FORMAT-VERSION-IMPLICIT",
|
|
110420
|
-
// page 块未写 soma:,兼容期按 1 处理(advice)
|
|
110417
|
+
// 载荷 format 与 page 块 soma: 不一致(page 块缺 soma: 同此码)
|
|
110421
110418
|
"CORE-INJECT-NONSTANDARD-KEY",
|
|
110422
110419
|
// 兼容期结束后含方言段拒收
|
|
110423
110420
|
"CORE-RUNTIME-ADDRESS-INVALID",
|
|
@@ -116110,15 +116107,10 @@ var ACCEPTED_FORMATS = SOMA_PAGE_ARTIFACT_FORMATS;
|
|
|
116110
116107
|
var KNOWN_CAPABILITIES = COMPONENT_TREE_CAPABILITIES;
|
|
116111
116108
|
var REQUIRED_CAPABILITY = "component-tree:1";
|
|
116112
116109
|
function isArtifactFormatAccepted(head) {
|
|
116113
|
-
|
|
116114
|
-
return head.schemaVersion === 1 && head.grammarVersion === 1;
|
|
116110
|
+
return typeof head.format === "string" && ACCEPTED_FORMATS.includes(head.format);
|
|
116115
116111
|
}
|
|
116116
116112
|
function archivedFormatOf(head) {
|
|
116117
|
-
|
|
116118
|
-
if (head.schemaVersion !== void 0 || head.grammarVersion !== void 0) {
|
|
116119
|
-
return `schemaVersion:${String(head.schemaVersion)}/grammarVersion:${String(head.grammarVersion)}`;
|
|
116120
|
-
}
|
|
116121
|
-
return null;
|
|
116113
|
+
return typeof head.format === "string" ? head.format : null;
|
|
116122
116114
|
}
|
|
116123
116115
|
function incompatible(reason, code) {
|
|
116124
116116
|
return { compatible: false, level: "recompile", reason, code };
|
|
@@ -116128,7 +116120,7 @@ function checkArtifactRuntimeCompatibility(envelope, supply, options = {}) {
|
|
|
116128
116120
|
if (envelope === null) {
|
|
116129
116121
|
return required ? incompatible({ rule: "envelope-missing" }, "CT-ARTIFACT-VERSION") : { compatible: true, level: "reuse", reason: null };
|
|
116130
116122
|
}
|
|
116131
|
-
const hasFormatMark = envelope.format !== void 0
|
|
116123
|
+
const hasFormatMark = envelope.format !== void 0;
|
|
116132
116124
|
const tree = envelope.sourceMarkup === "component-tree";
|
|
116133
116125
|
if (!SOURCE_MARKUPS.includes(envelope.sourceMarkup)) {
|
|
116134
116126
|
return incompatible({ rule: "format", archived: String(envelope.sourceMarkup), accepted: ACCEPTED_FORMATS }, "CT-ARTIFACT-VERSION");
|
|
@@ -116258,8 +116250,6 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
116258
116250
|
assertWireData(artifact);
|
|
116259
116251
|
closed(artifact, [
|
|
116260
116252
|
"format",
|
|
116261
|
-
"schemaVersion",
|
|
116262
|
-
"grammarVersion",
|
|
116263
116253
|
"compilerVersion",
|
|
116264
116254
|
"sourceDigest",
|
|
116265
116255
|
"registrySnapshotDigest",
|
|
@@ -116271,7 +116261,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
116271
116261
|
"repeatPlans",
|
|
116272
116262
|
"artifactDigest"
|
|
116273
116263
|
], "artifact");
|
|
116274
|
-
if (!isArtifactFormatAccepted(artifact)) fail2("artifact.
|
|
116264
|
+
if (!isArtifactFormatAccepted(artifact)) fail2("artifact.format", "version");
|
|
116275
116265
|
string(artifact.compilerVersion, "artifact.compilerVersion");
|
|
116276
116266
|
for (const key of ["sourceDigest", "registrySnapshotDigest", "policyDigest", "artifactDigest"]) {
|
|
116277
116267
|
string(artifact[key], `artifact.${key}`, DIGEST);
|
|
@@ -116280,9 +116270,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
116280
116270
|
const required = capabilities(artifact.capabilities, "artifact.capabilities");
|
|
116281
116271
|
const capabilityVerdict = checkArtifactRuntimeCompatibility({
|
|
116282
116272
|
sourceMarkup: "component-tree",
|
|
116283
|
-
|
|
116284
|
-
...artifact.schemaVersion !== void 0 ? { schemaVersion: artifact.schemaVersion } : {},
|
|
116285
|
-
...artifact.grammarVersion !== void 0 ? { grammarVersion: artifact.grammarVersion } : {},
|
|
116273
|
+
format: artifact.format,
|
|
116286
116274
|
capabilities: [...required],
|
|
116287
116275
|
componentRefs: []
|
|
116288
116276
|
}, null);
|
|
@@ -116414,9 +116402,7 @@ function assertRuntimeArtifact(input, supply) {
|
|
|
116414
116402
|
structureDigest: String(ref.structureDigest),
|
|
116415
116403
|
uses: []
|
|
116416
116404
|
})),
|
|
116417
|
-
|
|
116418
|
-
...artifact.schemaVersion !== void 0 ? { schemaVersion: artifact.schemaVersion } : {},
|
|
116419
|
-
...artifact.grammarVersion !== void 0 ? { grammarVersion: artifact.grammarVersion } : {}
|
|
116405
|
+
format: artifact.format
|
|
116420
116406
|
}, supply);
|
|
116421
116407
|
if (!supplyVerdict.compatible) fail2("componentRefs", supplyVerdict.code === "CT-ARTIFACT-VERSION" ? "version" : "capability");
|
|
116422
116408
|
}
|
|
@@ -118007,9 +117993,7 @@ function assertPageRuntimeAssets(assets, hostComponents) {
|
|
|
118007
117993
|
const supply = supplyFromDefinitions({ ...hostComponents, ...assets.components ?? {} });
|
|
118008
117994
|
const verdict = checkArtifactRuntimeCompatibility({
|
|
118009
117995
|
sourceMarkup: "component-tree",
|
|
118010
|
-
|
|
118011
|
-
...assets.artifact.schemaVersion !== void 0 ? { schemaVersion: assets.artifact.schemaVersion } : {},
|
|
118012
|
-
...assets.artifact.grammarVersion !== void 0 ? { grammarVersion: assets.artifact.grammarVersion } : {},
|
|
117996
|
+
format: assets.artifact.format,
|
|
118013
117997
|
capabilities: assets.artifact.capabilities,
|
|
118014
117998
|
componentRefs: assets.artifact.componentRefs
|
|
118015
117999
|
}, supply);
|
|
@@ -119563,9 +119547,9 @@ ${featureIssues.map((issue) => ` \xB7 ${issue}`).join("\n")}`
|
|
|
119563
119547
|
this.localeCatalog.loadBundle(locale);
|
|
119564
119548
|
if (this.preferredLocale !== void 0) this.localeCatalog.setCurrentLocale(this.preferredLocale);
|
|
119565
119549
|
}
|
|
119566
|
-
/** 页面 `_locale` 绑定表(`page._locale
|
|
119550
|
+
/** 页面 `_locale` 绑定表(`page._locale.<键>`):词表信封取当前显示语言的词条;无词表为空表 */
|
|
119567
119551
|
localeTable(locale) {
|
|
119568
|
-
return isLocaleBundle(locale) ? this.localeCatalog.dictionary() :
|
|
119552
|
+
return isLocaleBundle(locale) ? this.localeCatalog.dictionary() : {};
|
|
119569
119553
|
}
|
|
119570
119554
|
/** 缺词条回退上报(ERR-LOCALE-001,soma-ui 码表;不抛、不中断渲染) */
|
|
119571
119555
|
reportLocaleMissing(event) {
|
package/dist/cli/soma.js
CHANGED
|
@@ -127,22 +127,10 @@ if (command === 'check') {
|
|
|
127
127
|
process.exit(1);
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
/** soma-host-next
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const explicit = process.env.SOMA_HOST_NEXT_CLI;
|
|
135
|
-
if (explicit && explicit.trim() !== '') {
|
|
136
|
-
const resolved = node_path_1.default.resolve(explicit);
|
|
137
|
-
return node_fs_1.default.existsSync(resolved) ? resolved : null;
|
|
138
|
-
}
|
|
139
|
-
for (let dir = hostDir;; dir = node_path_1.default.dirname(dir)) {
|
|
140
|
-
const candidate = node_path_1.default.join(dir, HOST_NEXT_CLI_RELATIVE);
|
|
141
|
-
if (node_fs_1.default.existsSync(candidate))
|
|
142
|
-
return candidate;
|
|
143
|
-
if (node_path_1.default.dirname(dir) === dir)
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
130
|
+
/** Next 宿主壳命令行:随 soma-core 包发布的 host-next/bin/host-next.cjs(包内相对定位,不去 node_modules 找外部包) */
|
|
131
|
+
function locateHostNextCli() {
|
|
132
|
+
const candidate = node_path_1.default.join(packageRoot, 'host-next', 'bin', 'host-next.cjs');
|
|
133
|
+
return node_fs_1.default.existsSync(candidate) ? candidate : null;
|
|
146
134
|
}
|
|
147
135
|
// check 的 runtime 阶段是异步收尾(上面 then 里 process.exit),不得落进下面的 dev/build/start 转调
|
|
148
136
|
if (command !== 'check') {
|
|
@@ -150,14 +138,13 @@ if (command !== 'check') {
|
|
|
150
138
|
console.error('Usage: soma <dev|build|start|codegen|sync|lsp|eject|check|runtime|doctor|扩展命令> [...args](soma help 查看说明)');
|
|
151
139
|
process.exit(1);
|
|
152
140
|
}
|
|
153
|
-
// `soma dev|build|start`:Next 宿主壳(app/、next.config、proxy、Next
|
|
154
|
-
// core
|
|
141
|
+
// `soma dev|build|start`:Next 宿主壳(app/、next.config、proxy、Next 工作区装配)在包内 host-next/ 目录,
|
|
142
|
+
// core 运行时(core/**)不 import 它、不含 Next / React;这里以子进程转调它的命令行,参数、环境变量与退出码透传。
|
|
155
143
|
// Host 目录取当前目录,覆盖外部陈旧的 SOMA_HOST_DIR。
|
|
156
144
|
const hostDir = node_path_1.default.resolve(process.cwd());
|
|
157
|
-
const hostNextCli = locateHostNextCli(
|
|
145
|
+
const hostNextCli = locateHostNextCli();
|
|
158
146
|
if (!hostNextCli) {
|
|
159
|
-
console.error(`[soma ${command}] 找不到
|
|
160
|
-
+ ` 在 Host 工程里安装 soma-host-next(期望 <Host>/${HOST_NEXT_CLI_RELATIVE}),或用环境变量 SOMA_HOST_NEXT_CLI 指向它。`);
|
|
147
|
+
console.error(`[soma ${command}] 找不到 Next 宿主壳入口 host-next/bin/host-next.cjs:soma-core 包不完整,请重新安装。`);
|
|
161
148
|
process.exit(1);
|
|
162
149
|
}
|
|
163
150
|
const child = (0, node_child_process_1.spawnSync)(process.execPath, [hostNextCli, command, ...args.slice(1)], {
|