soma-core 1.5.1 → 2.0.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.
Files changed (173) hide show
  1. package/app/SomaPageClient.tsx +28 -9
  2. package/app/soma/manifest/route.ts +3 -0
  3. package/bin/migrate.cjs +71 -1
  4. package/bin/soma-lsp.cjs +8 -1
  5. package/core/build/blocks/block-compile.ts +23 -5
  6. package/core/build/compiler/full-manifest-builder.ts +15 -0
  7. package/core/build/compiler/page-assets.ts +17 -1
  8. package/core/build/compiler/page-declaration-compiler.ts +67 -11
  9. package/core/build/compiler/precompiled-manifest-loader.ts +7 -0
  10. package/core/build/compiler/soma-manifest-webpack-plugin.js +7 -0
  11. package/core/build/compiler/soma-precompile.js +212 -21
  12. package/core/build/component/package-loader.ts +35 -4
  13. package/core/build/component-tree/artifact-codec.ts +192 -0
  14. package/core/build/component-tree/binding-bridge.ts +272 -0
  15. package/core/build/component-tree/collection-binding-lowerer.ts +65 -0
  16. package/core/build/component-tree/definition-preparation.ts +320 -0
  17. package/core/build/component-tree/migration-files.ts +214 -0
  18. package/core/build/component-tree/migration.ts +170 -0
  19. package/core/build/component-tree/parser.ts +362 -0
  20. package/core/build/component-tree/registry-snapshot.ts +317 -0
  21. package/core/build/component-tree/source-preflight.ts +132 -0
  22. package/core/build/component-tree/structure-topology.ts +63 -0
  23. package/core/build/component-tree/validator.ts +318 -0
  24. package/core/build/eject/component-eject.ts +1 -0
  25. package/core/build/lsp/component-tree-service.ts +79 -0
  26. package/core/build/lsp/component-tree.cjs +42 -0
  27. package/core/build/lsp/cross-file-diagnostics.cjs +15 -3
  28. package/core/build/lsp/extra-completion.cjs +7 -0
  29. package/core/client/adaptive/observer-pool.ts +122 -8
  30. package/core/client/compiler/manifest-compiler.ts +48 -5
  31. package/core/client/component/ai-catalog.ts +41 -3
  32. package/core/client/component/catalog-examples.ts +60 -0
  33. package/core/client/component/component-defaults.ts +1 -1
  34. package/core/client/component/component-definition.types.ts +9 -0
  35. package/core/client/component/component-expander.ts +22 -6
  36. package/core/client/component/component-manager.ts +881 -45
  37. package/core/client/component/component-pack.ts +1 -1
  38. package/core/client/component/component-registry.ts +11 -2
  39. package/core/client/component/scoped-adapter.ts +29 -2
  40. package/core/client/component/structure-adapter.ts +207 -0
  41. package/core/client/component/verify-pack.ts +21 -1
  42. package/core/client/container/SomaContainerAdapter.ts +103 -2
  43. package/core/client/data/data-object-resolver.ts +45 -1
  44. package/core/client/engine/asset-resolver.ts +1 -1
  45. package/core/client/engine/dom-renderer.ts +712 -26
  46. package/core/client/engine/event-engine.ts +328 -21
  47. package/core/client/engine/property-watcher.ts +164 -18
  48. package/core/client/engine/reactive-proxy.ts +194 -23
  49. package/core/client/engine/render-engine.ts +120 -11
  50. package/core/client/engine/row-range.ts +62 -0
  51. package/core/client/engine/row-scope.ts +77 -0
  52. package/core/client/engine/runtime-builder.ts +2 -0
  53. package/core/client/engine/scope-resolver.ts +3 -3
  54. package/core/client/engine/soma-bootstrap.ts +176 -17
  55. package/core/client/parser/adaptive-parser.ts +1 -1
  56. package/core/client/parser/annotation-extractor.ts +1 -1
  57. package/core/client/parser/blocks/page-parser.ts +53 -3
  58. package/core/client/parser/blocks/use-parser.ts +21 -6
  59. package/core/client/parser/data-config-parser.ts +1 -1
  60. package/core/client/parser/pipeline-parser.ts +252 -15
  61. package/core/client/parser/style-config-parser.ts +1 -1
  62. package/core/client/parser/timer-parser.ts +1 -1
  63. package/core/client/parser/trigger-parser.ts +1 -1
  64. package/core/client/parser/ui-config-parser.ts +39 -7
  65. package/core/client/pipes/pipe-registry.ts +45 -4
  66. package/core/client/registry/declaration-renderer.ts +32 -24
  67. package/core/client/registry/remote-page.ts +1 -1
  68. package/core/client/runtime/SomaSnapshotStore.ts +1 -1
  69. package/core/client/scheduler/SomaScheduler.ts +1 -1
  70. package/core/client/security/attribute-presence.ts +3 -0
  71. package/core/client/theme/harmony.ts +135 -13
  72. package/core/client/theme/scene-tokens.ts +17 -2
  73. package/core/client/theme/theme-axes.ts +43 -6
  74. package/core/client/theme/theme-engine.ts +921 -126
  75. package/core/client/validation/contract-validator.ts +2 -2
  76. package/core/index.ts +3 -0
  77. package/core/server/host/page-markup-config.ts +42 -0
  78. package/core/server/host/published-page-artifact-cache.ts +36 -4
  79. package/core/server/host/published-page-assets.ts +13 -7
  80. package/core/server/host/resolve-host-tree-context.ts +43 -0
  81. package/core/server/host/server-page-assets.ts +23 -4
  82. package/core/server/host/soma-page-compile.ts +10 -0
  83. package/core/server/mock/node/cli.mjs +3 -3
  84. package/core/server/page-declaration.ts +7 -0
  85. package/core/server/registry/declaration-precompiler.ts +35 -3
  86. package/core/server/registry/page-registry-repository.ts +31 -3
  87. package/core/server/registry/page-registry-store.ts +64 -7
  88. package/core/server/registry/publish-asset-pin.ts +6 -1
  89. package/core/server/registry/services/pages/Get.ts +11 -6
  90. package/core/server/registry/validation/compile-gate.ts +10 -1
  91. package/core/shared/component-tree-artifact.ts +237 -0
  92. package/core/shared/component-tree-errors.ts +52 -0
  93. package/core/shared/path-algebra.ts +1 -1
  94. package/core/shared/types/component-contract.types.ts +51 -0
  95. package/core/shared/types/component-tree-artifact.types.ts +121 -0
  96. package/core/shared/types/component-tree.types.ts +170 -0
  97. package/core/shared/types/engine.types.ts +5 -0
  98. package/core/shared/types/event.types.ts +8 -4
  99. package/core/shared/types/manifest.types.ts +4 -0
  100. package/core/shared/types/ui-config.types.ts +8 -0
  101. package/dist/cli/soma.js +1 -1
  102. package/dist/core/index.cjs +14508 -11358
  103. package/dist/lsp/component-tree.cjs +20997 -0
  104. package/dist/types/build/blocks/block-compile.d.ts +10 -1
  105. package/dist/types/build/compiler/full-manifest-builder.d.ts +9 -0
  106. package/dist/types/build/compiler/page-assets.d.ts +6 -1
  107. package/dist/types/build/compiler/page-declaration-compiler.d.ts +11 -1
  108. package/dist/types/build/component/package-loader.d.ts +4 -1
  109. package/dist/types/build/component-tree/artifact-codec.d.ts +50 -0
  110. package/dist/types/build/component-tree/binding-bridge.d.ts +19 -0
  111. package/dist/types/build/component-tree/collection-binding-lowerer.d.ts +18 -0
  112. package/dist/types/build/component-tree/definition-preparation.d.ts +11 -0
  113. package/dist/types/build/component-tree/migration-files.d.ts +35 -0
  114. package/dist/types/build/component-tree/migration.d.ts +28 -0
  115. package/dist/types/build/component-tree/parser.d.ts +13 -0
  116. package/dist/types/build/component-tree/registry-snapshot.d.ts +15 -0
  117. package/dist/types/build/component-tree/source-preflight.d.ts +22 -0
  118. package/dist/types/build/component-tree/structure-topology.d.ts +7 -0
  119. package/dist/types/build/component-tree/validator.d.ts +9 -0
  120. package/dist/types/build/lsp/component-tree-service.d.ts +34 -0
  121. package/dist/types/client/adaptive/observer-pool.d.ts +9 -2
  122. package/dist/types/client/compiler/manifest-compiler.d.ts +11 -2
  123. package/dist/types/client/component/ai-catalog.d.ts +18 -1
  124. package/dist/types/client/component/catalog-examples.d.ts +18 -0
  125. package/dist/types/client/component/component-definition.types.d.ts +9 -0
  126. package/dist/types/client/component/component-expander.d.ts +2 -1
  127. package/dist/types/client/component/component-manager.d.ts +97 -0
  128. package/dist/types/client/component/scoped-adapter.d.ts +1 -0
  129. package/dist/types/client/component/structure-adapter.d.ts +17 -0
  130. package/dist/types/client/container/SomaContainerAdapter.d.ts +8 -0
  131. package/dist/types/client/data/data-object-resolver.d.ts +19 -0
  132. package/dist/types/client/engine/dom-renderer.d.ts +125 -2
  133. package/dist/types/client/engine/event-engine.d.ts +62 -3
  134. package/dist/types/client/engine/property-watcher.d.ts +41 -1
  135. package/dist/types/client/engine/reactive-proxy.d.ts +42 -2
  136. package/dist/types/client/engine/render-engine.d.ts +55 -3
  137. package/dist/types/client/engine/row-range.d.ts +13 -0
  138. package/dist/types/client/engine/row-scope.d.ts +20 -0
  139. package/dist/types/client/engine/runtime-builder.d.ts +1 -0
  140. package/dist/types/client/engine/soma-bootstrap.d.ts +4 -1
  141. package/dist/types/client/parser/blocks/use-parser.d.ts +18 -0
  142. package/dist/types/client/parser/pipeline-parser.d.ts +12 -4
  143. package/dist/types/client/parser/ui-config-parser.d.ts +2 -0
  144. package/dist/types/client/pipes/pipe-registry.d.ts +39 -1
  145. package/dist/types/client/registry/declaration-renderer.d.ts +5 -1
  146. package/dist/types/client/registry/remote-page.d.ts +1 -1
  147. package/dist/types/client/theme/harmony.d.ts +44 -2
  148. package/dist/types/client/theme/scene-tokens.d.ts +11 -1
  149. package/dist/types/client/theme/theme-axes.d.ts +36 -6
  150. package/dist/types/index.d.ts +3 -1
  151. package/dist/types/server/host/page-markup-config.d.ts +6 -0
  152. package/dist/types/server/host/published-page-artifact-cache.d.ts +9 -1
  153. package/dist/types/server/host/published-page-assets.d.ts +5 -3
  154. package/dist/types/server/host/resolve-host-tree-context.d.ts +8 -0
  155. package/dist/types/server/host/server-page-assets.d.ts +6 -0
  156. package/dist/types/server/host/soma-page-compile.d.ts +10 -1
  157. package/dist/types/server/page-declaration.d.ts +6 -0
  158. package/dist/types/server/registry/declaration-precompiler.d.ts +8 -3
  159. package/dist/types/server/registry/page-registry-repository.d.ts +5 -0
  160. package/dist/types/server/registry/page-registry-store.d.ts +11 -1
  161. package/dist/types/server/registry/publish-asset-pin.d.ts +4 -0
  162. package/dist/types/server/registry/validation/compile-gate.d.ts +4 -1
  163. package/dist/types/shared/component-tree-artifact.d.ts +5 -0
  164. package/dist/types/shared/component-tree-errors.d.ts +22 -0
  165. package/dist/types/shared/types/component-contract.types.d.ts +42 -0
  166. package/dist/types/shared/types/component-tree-artifact.types.d.ts +104 -0
  167. package/dist/types/shared/types/component-tree.types.d.ts +149 -0
  168. package/dist/types/shared/types/engine.types.d.ts +5 -0
  169. package/dist/types/shared/types/event.types.d.ts +8 -4
  170. package/dist/types/shared/types/manifest.types.d.ts +4 -0
  171. package/dist/types/shared/types/ui-config.types.d.ts +8 -0
  172. package/package.json +5 -4
  173. package/dist/preview-export.cjs +0 -3401
@@ -6,6 +6,8 @@ import { SomaHydrationShell } from './components/SomaHydrationShell';
6
6
  import type { SomaBootstrap as SomaBootstrapType, SomaPageAssets } from '../core/client/engine/soma-bootstrap';
7
7
  import { loadHostDomainClass } from '../core/client/host-bridge/load-host-domain-class';
8
8
  import { maybeStartBootTimings, readBootTimings } from '../core/client/diagnostics/boot-timings';
9
+ import { assertRuntimeArtifact } from '../core/shared/component-tree-artifact';
10
+ import type { ComponentTreeRuntimeEnvelope } from '../core/shared/types/component-tree-artifact.types';
9
11
 
10
12
  const isDev = process.env.NODE_ENV !== 'production';
11
13
 
@@ -33,7 +35,7 @@ function urlPathToPageBase(urlPath: string): string {
33
35
  return clean || 'index';
34
36
  }
35
37
 
36
- type PagePayload = {
38
+ type PagePayload = ComponentTreeRuntimeEnvelope & {
37
39
  base: string;
38
40
  sourcePackage?: string | null;
39
41
  html: string;
@@ -48,17 +50,27 @@ type PagePayload = {
48
50
 
49
51
  type PrecompiledAssets = Pick<
50
52
  SomaPageAssets,
51
- 'uiConfig' | 'eventConfig' | 'triggerConfig' | 'timerConfig' | 'styleConfig' | 'locale' | 'appConfig' | 'dataConfig'
53
+ 'html' | 'sourceMarkup' | 'artifact' | 'uiConfig' | 'eventConfig' | 'triggerConfig' | 'timerConfig' | 'styleConfig' | 'locale' | 'appConfig' | 'dataConfig'
52
54
  >;
53
55
 
54
56
  const pageAssetCache = new Map<string, PagePayload>();
55
57
 
56
- async function loadPrecompiledFromManifest(path: string): Promise<PrecompiledAssets | null> {
58
+ async function loadPrecompiledFromManifest(path: string, current: ComponentTreeRuntimeEnvelope): Promise<PrecompiledAssets | null> {
57
59
  try {
58
60
  const res = await fetch(`/soma/manifest?path=${encodeURIComponent(path)}`);
59
61
  if (!res.ok) return null;
60
- const data = await res.json();
62
+ const data: PrecompiledAssets & {
63
+ triggers?: SomaPageAssets['triggerConfig']; timers?: SomaPageAssets['timerConfig'];
64
+ } = await res.json();
65
+ assertRuntimeArtifact(data);
66
+ if ((data.sourceMarkup ?? 'legacy-html') !== (current.sourceMarkup ?? 'legacy-html')) return null;
67
+ if (current.sourceMarkup === 'component-tree'
68
+ && data.artifact?.artifactDigest !== current.artifact?.artifactDigest) return null;
69
+ if (typeof data.html !== 'string') return null;
61
70
  return {
71
+ sourceMarkup: data.sourceMarkup,
72
+ html: data.html,
73
+ artifact: data.artifact,
62
74
  uiConfig: data.uiConfig,
63
75
  eventConfig: data.eventConfig,
64
76
  triggerConfig: data.triggers ?? [],
@@ -187,7 +199,8 @@ function SomaPageRenderer({
187
199
 
188
200
  const res = await fetch(`/soma/page?path=${encodeURIComponent(pagePath)}`);
189
201
  if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
190
- const data = await res.json();
202
+ const data: PagePayload = await res.json();
203
+ assertRuntimeArtifact(data);
191
204
  if (cancelled) return;
192
205
 
193
206
  const base = (data.base as string) || urlPathToPageBase(pagePath);
@@ -196,20 +209,20 @@ function SomaPageRenderer({
196
209
  const routeAssets = { routerPath };
197
210
 
198
211
  if (!isDev) {
199
- const precompiled = await loadPrecompiledFromManifest(pagePath);
212
+ const precompiled = await loadPrecompiledFromManifest(pagePath, data);
200
213
  if (precompiled) {
201
214
  await mountInto(
202
215
  DomainClass,
203
216
  SomaBootstrap,
204
217
  { ...precompiled, ...routeAssets },
205
- data.html,
206
- data.includes,
218
+ precompiled.html,
207
219
  );
208
220
  return;
209
221
  }
210
222
 
211
223
  const cached = pageAssetCache.get(routerPath);
212
- if (cached) {
224
+ if (cached && (cached.sourceMarkup ?? 'legacy-html') === (data.sourceMarkup ?? 'legacy-html')
225
+ && (data.sourceMarkup !== 'component-tree' || cached.artifact?.artifactDigest === data.artifact?.artifactDigest)) {
213
226
  const CachedClass = await loadHostDomainClass({
214
227
  base: cached.base,
215
228
  sourcePackage: cached.sourcePackage,
@@ -221,6 +234,8 @@ function SomaPageRenderer({
221
234
  dataYaml: cached.dataYaml,
222
235
  localeYaml: cached.localeYaml ?? '',
223
236
  appConfigYaml: cached.appConfigYaml ?? '',
237
+ sourceMarkup: cached.sourceMarkup,
238
+ artifact: cached.artifact,
224
239
  ...routeAssets,
225
240
  }, cached.html, cached.includes);
226
241
  return;
@@ -230,6 +245,8 @@ function SomaPageRenderer({
230
245
  const payload: PagePayload = {
231
246
  base,
232
247
  sourcePackage,
248
+ sourceMarkup: data.sourceMarkup,
249
+ artifact: data.artifact,
233
250
  html: data.html,
234
251
  ui: data.ui,
235
252
  event: data.event,
@@ -251,6 +268,8 @@ function SomaPageRenderer({
251
268
  dataYaml: payload.dataYaml,
252
269
  localeYaml: payload.localeYaml ?? '',
253
270
  appConfigYaml: payload.appConfigYaml ?? '',
271
+ sourceMarkup: payload.sourceMarkup,
272
+ artifact: payload.artifact,
254
273
  ...routeAssets,
255
274
  }, payload.html, payload.includes);
256
275
  } catch (err: any) {
@@ -24,6 +24,9 @@ export async function GET(request: Request): Promise<Response> {
24
24
 
25
25
  return Response.json({
26
26
  path: page.path,
27
+ sourceMarkup: page.sourceMarkup,
28
+ html: page.html,
29
+ artifact: page.artifact,
27
30
  uiConfig: page.uiConfig,
28
31
  eventConfig: page.eventConfig,
29
32
  triggers: page.triggers,
package/bin/migrate.cjs CHANGED
@@ -41,6 +41,8 @@ function usage() {
41
41
  console.error([
42
42
  'Usage:',
43
43
  ' soma migrate <目录> [--write] 平铺三件套(_ui/_event/_style/_data.yaml) → 块声明',
44
+ ' soma migrate component-tree <Host目录> [--page <base>] [--out <建议目录>]',
45
+ ' soma migrate component-tree <Host目录> --page <base> --apply --reviewed --expect-source <摘要> --expect-plan <摘要>',
44
46
  '',
45
47
  '选项:',
46
48
  ' --write 真的落盘(缺省只试跑并打印报告,不改任何文件)',
@@ -326,6 +328,9 @@ function parseMigrateArgs(args) {
326
328
 
327
329
  /** `argv` 形如 `[node, 脚本, 'migrate', ...参数]`(soma-inline 与独立进程两种调法同形) */
328
330
  function runMigrate(argv) {
331
+ if (argv[3] === 'component-tree') {
332
+ process.exit(runComponentTreeMigration(argv.slice(4)));
333
+ }
329
334
  const { dir, write, htmlDir: htmlArg } = parseMigrateArgs(argv.slice(3));
330
335
  if (!dir) {
331
336
  usage();
@@ -353,7 +358,72 @@ function runMigrate(argv) {
353
358
  process.exit(outcome.exitCode);
354
359
  }
355
360
 
356
- module.exports = { runMigrate, migrateDirectory, locatePageFiles, parseMigrateArgs };
361
+ /** Both the published CLI and inline fallback delegate to this exact subcommand. */
362
+ function runComponentTreeMigration(args) {
363
+ const options = {};
364
+ let host;
365
+ try {
366
+ for (let index = 0; index < args.length; index += 1) {
367
+ const token = args[index];
368
+ if (token === '--help' || token === '-h') {
369
+ usage();
370
+ console.log('\ncomponent-tree 缺省只检查,不改文件;--out 仅输出建议,不覆盖源。');
371
+ console.log('--apply 必须单页、明确 --reviewed,并匹配先前报告的 sourceDigest 与 planDigest;保留 .soma/migration-backups 可恢复副本。');
372
+ console.log('needs-business-component / unsupported 会非零退出,不能把部分转换当成功;不会自动猜 Box、删原生布局、助手或业务挂载点。');
373
+ return 0;
374
+ }
375
+ if (['--apply', '--reviewed', '--check'].includes(token)) options[token.slice(2)] = true;
376
+ else if (['--page', '--out', '--expect-source', '--expect-plan'].includes(token)) {
377
+ const value = args[++index];
378
+ if (!value || value.startsWith('--')) throw new Error(`${token} 缺少值`);
379
+ options[token.slice(2)] = value;
380
+ } else if (!token.startsWith('-') && host === undefined) host = token;
381
+ else throw new Error(`未知或重复参数:${token}`);
382
+ }
383
+ if (!host) throw new Error('必须指定 Host 目录;缺省只读检查');
384
+ if ((options.apply || options.out) && !options.page) throw new Error('--apply / --out 必须用 --page 精确选择一页');
385
+ if (options.apply && (options.out || options.check)) throw new Error('--apply 不能与 --out / --check 同用');
386
+ if (options.apply && (!options.reviewed || !options['expect-source'] || !options['expect-plan'])) {
387
+ throw new Error('--apply 需要 --reviewed、--expect-source、--expect-plan;先检查并完成报告列出的视觉/行为对照');
388
+ }
389
+ const cwd = process.env.SOMA_INVOKE_CWD || process.cwd();
390
+ const hostDir = path.resolve(cwd, host);
391
+ if (!fs.existsSync(hostDir) || !fs.statSync(hostDir).isDirectory()) throw new Error('Host 目录不存在');
392
+ const methods = loadBuildModule(path.resolve(__dirname, '..'), 'component-tree/migration-files');
393
+ const pages = options.page ? [options.page] : methods.listComponentTreeMigrationPages(hostDir);
394
+ if (pages.length === 0) throw new Error('没有可检查的 Host 页面');
395
+ let failed = 0;
396
+ for (const base of pages) {
397
+ try {
398
+ const page = methods.inspectComponentTreeMigrationPage(hostDir, base);
399
+ console.log(JSON.stringify({ page: page.base, status: page.plan.status,
400
+ sourceDigest: page.plan.sourceDigest, planDigest: page.plan.planDigest,
401
+ mappings: page.plan.mappings, manualItems: page.plan.manualItems,
402
+ requiredComparisons: page.plan.requiredComparisons,
403
+ }, null, 2));
404
+ if (options.out) methods.writeComponentTreeMigrationProposal(page, path.resolve(cwd, options.out));
405
+ if (options.apply) {
406
+ const result = methods.applyComponentTreeMigrationPlan(page, {
407
+ reviewed: options.reviewed === true,
408
+ sourceDigest: options['expect-source'], planDigest: options['expect-plan'],
409
+ });
410
+ console.log(JSON.stringify({ changed: result.changed, backupDirectory: result.backupDirectory }));
411
+ }
412
+ if (!['converted', 'unchanged'].includes(page.plan.status)) failed += 1;
413
+ } catch (error) {
414
+ failed += 1;
415
+ console.error(`[component-tree migration] ${base}: ${errorMessage(error)}`);
416
+ }
417
+ }
418
+ console.log(`[component-tree migration] ${pages.length} 页,${failed} 页需人工处理;${options.apply ? '仅已批准目标被替换并保留备份' : '源文件未修改'}`);
419
+ return failed ? 1 : 0;
420
+ } catch (error) {
421
+ console.error(`[component-tree migration] ${errorMessage(error)}`);
422
+ return 1;
423
+ }
424
+ }
425
+
426
+ module.exports = { runMigrate, migrateDirectory, locatePageFiles, parseMigrateArgs, runComponentTreeMigration };
357
427
 
358
428
  // 发布入口(dist/cli/soma.js)以独立进程调本文件:`node migrate.cjs migrate <目录> ...`;
359
429
  // soma-inline.cjs 则 require 后直接调 runMigrate。两种 argv 同形。
package/bin/soma-lsp.cjs CHANGED
@@ -12,6 +12,7 @@ const { getLocaleYamlCompletions, getHtmlAnchorCompletions } = require('../core/
12
12
  let hostDir = process.env.SOMA_HOST_DIR || null;
13
13
  /** @type {Map<string, string>} */
14
14
  const openDocs = new Map();
15
+ const diagnosedUris = new Set();
15
16
 
16
17
  function readDocText(uri) {
17
18
  if (openDocs.has(uri)) return openDocs.get(uri);
@@ -57,7 +58,7 @@ function notify(method, params) {
57
58
 
58
59
  function publishAllDiagnostics(resolvedHost) {
59
60
  if (!resolvedHost) return;
60
- const crossFile = lintAnchorConsistency(resolvedHost);
61
+ const crossFile = lintAnchorConsistency(resolvedHost, openDocs);
61
62
  const byUri = new Map();
62
63
  for (const d of crossFile) {
63
64
  const list = byUri.get(d.uri) ?? [];
@@ -67,6 +68,11 @@ function publishAllDiagnostics(resolvedHost) {
67
68
  for (const [uri, diagnostics] of byUri) {
68
69
  notify('textDocument/publishDiagnostics', { uri, diagnostics });
69
70
  }
71
+ for (const uri of diagnosedUris) {
72
+ if (!byUri.has(uri)) notify('textDocument/publishDiagnostics', { uri, diagnostics: [] });
73
+ }
74
+ diagnosedUris.clear();
75
+ for (const uri of byUri.keys()) diagnosedUris.add(uri);
70
76
  }
71
77
 
72
78
  function handleMessage(msg) {
@@ -105,6 +111,7 @@ function handleMessage(msg) {
105
111
  const latest = params.contentChanges[params.contentChanges.length - 1].text;
106
112
  if (typeof latest === 'string') openDocs.set(params.textDocument.uri, latest);
107
113
  }
114
+ publishAllDiagnostics(uriToHostDir(params.textDocument?.uri) ?? hostDir);
108
115
  break;
109
116
 
110
117
  case 'textDocument/didClose':
@@ -9,7 +9,7 @@
9
9
  // props 并入 show → emit 路由并入事件清单 → 数据对象接线。
10
10
  // 运行时只剩读数据、写 DOM、diff——与原生代码要付的一样。
11
11
 
12
- import type { UiConfig } from '../../shared/types/ui-config.types';
12
+ import type { UiConfig, ShowMapping, BindDeclaration, NestedShowMapping } from '../../shared/types/ui-config.types';
13
13
  import type { SomaDataObjectRelation } from '../../shared/types/data-config.types';
14
14
  import { buildHtmlAnchorIndex, type HtmlAnchorIndex } from './html-index';
15
15
  import { PAGE_BLOCK_ID, SomaBlockParseError, loadSomaFile } from './block-container';
@@ -55,6 +55,11 @@ export interface CompileSomaBlocksInput {
55
55
  externalBlocks?: ReadonlyMap<string, string>;
56
56
  /** 词典键集合(locale 批量段校验;缺省不校验) */
57
57
  localeKeys?: ReadonlySet<string>;
58
+ /** Build-only AST ownership proof; never derived from regex or exposed as author YAML. */
59
+ treeBindings?: {
60
+ htmlIndex: HtmlAnchorIndex;
61
+ collections: readonly { symbol: string; parentSymbol?: string; bind: BindDeclaration }[];
62
+ };
58
63
  }
59
64
 
60
65
  /**
@@ -63,7 +68,7 @@ export interface CompileSomaBlocksInput {
63
68
  * 本函数只接受 canonical 声明,不做旧页面形状回退;旧输入会在开关校验处明确报错。
64
69
  */
65
70
  export function compileSomaBlocks(input: CompileSomaBlocksInput): CompiledSomaBlocks {
66
- const htmlIndex = buildHtmlAnchorIndex(input.html);
71
+ const htmlIndex = input.treeBindings?.htmlIndex ?? buildHtmlAnchorIndex(input.html);
67
72
 
68
73
  if (htmlIndex.duplicates.length > 0) {
69
74
  throw new SomaBlockParseError(
@@ -91,6 +96,14 @@ export function compileSomaBlocks(input: CompileSomaBlocksInput): CompiledSomaBl
91
96
  });
92
97
 
93
98
  const ui: UiConfig = page.ui;
99
+ const collectionShows = new Map<string, ShowMapping>();
100
+ for (const collection of input.treeBindings?.collections ?? []) {
101
+ const target = collection.parentSymbol ? collectionShows.get(collection.parentSymbol) : ui.show;
102
+ if (!target || target[collection.symbol] !== undefined) throw new SomaBlockParseError('组件树集合归属不完整或声明重复');
103
+ const show: ShowMapping = {};
104
+ target[collection.symbol] = { bind: collection.bind, show };
105
+ collectionShows.set(collection.symbol, show);
106
+ }
94
107
  const event: Record<string, unknown> = { ...page.eventRaw };
95
108
  const data: Record<string, unknown> = {};
96
109
 
@@ -126,7 +139,7 @@ export function compileSomaBlocks(input: CompileSomaBlocksInput): CompiledSomaBl
126
139
  blocks.set(raw.blockId, ast);
127
140
 
128
141
  // props 并入 show:行内组件挂到它所属列表的子 show 下,其余挂顶层
129
- attachInstance(ui, raw.blockId, ast, htmlIndex);
142
+ attachInstance(ui, raw.blockId, ast, htmlIndex, Boolean(input.treeBindings));
130
143
 
131
144
  // emit 路由并入事件清单:平铺形状是 "实例id.emit名"
132
145
  for (const [emitName, expr] of Object.entries(ast.emitRoutes)) {
@@ -308,12 +321,13 @@ function attachInstance(
308
321
  blockId: string,
309
322
  ast: UseBlockAst,
310
323
  htmlIndex: HtmlAnchorIndex,
324
+ tree = false,
311
325
  ): void {
312
326
  const value = ast.toShowValue();
313
327
  const info = htmlIndex.anchors.get(blockId);
314
328
 
315
329
  if (!info?.inRowTemplate) {
316
- ui.show[blockId] = value;
330
+ ui.show[blockId] = tree && collectionValue(ui.show[blockId]) ? { ...ui.show[blockId] as NestedShowMapping, ...value } : value;
317
331
  return;
318
332
  }
319
333
 
@@ -334,7 +348,11 @@ function attachInstance(
334
348
  blockId,
335
349
  );
336
350
  }
337
- target[blockId] = value;
351
+ target[blockId] = tree && collectionValue(target[blockId]) ? { ...target[blockId] as NestedShowMapping, ...value } : value;
352
+ }
353
+
354
+ function collectionValue(value: unknown): value is NestedShowMapping {
355
+ return !!value && typeof value === 'object' && 'bind' in value && 'show' in value;
338
356
  }
339
357
 
340
358
  /** 按列表锚点名找到它的子 show(列表可嵌套,故递归) */
@@ -10,6 +10,8 @@ import type { SomaDataConfig } from '../../shared/types/data-config.types';
10
10
  import { compilePageDeclaration } from './page-declaration-compiler';
11
11
  import { buildRouteTable, type SomaRouteEntry } from './route-builder';
12
12
  import yaml from 'js-yaml';
13
+ import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
14
+ import type { TreeArtifact } from '../../shared/types/component-tree-artifact.types';
13
15
  import {
14
16
  mergeSourcePackageAppConfig,
15
17
  parseAppConfigYaml,
@@ -17,6 +19,10 @@ import {
17
19
 
18
20
  export interface SomaPrecompiledPage {
19
21
  path: string;
22
+ /** Optional only for compatibility with manifests created before REQ-016. */
23
+ sourceMarkup?: SomaPageMarkup;
24
+ html?: string;
25
+ artifact?: TreeArtifact;
20
26
  uiConfig: UiConfig;
21
27
  eventConfig: ParsedEvent[];
22
28
  triggers: PropertyTrigger[];
@@ -46,6 +52,9 @@ export function precompileAll(inputs: {
46
52
  path: string;
47
53
  html: string;
48
54
  uiYaml: string;
55
+ markup?: SomaPageMarkup;
56
+ grammarVersion?: number;
57
+ treeContext?: TreeCompileContext;
49
58
  appConfigYaml?: string;
50
59
  externalBlocks?: ReadonlyMap<string, string>;
51
60
  includes?: Readonly<Record<string, string>>;
@@ -60,11 +69,17 @@ export function precompileAll(inputs: {
60
69
  const page = compilePageDeclaration({
61
70
  html: p.html,
62
71
  uiYaml: p.uiYaml,
72
+ markup: p.markup,
73
+ grammarVersion: p.grammarVersion,
74
+ treeContext: p.treeContext,
63
75
  ...(p.externalBlocks ? { externalBlocks: p.externalBlocks } : {}),
64
76
  ...(p.includes ? { includes: p.includes } : {}),
65
77
  });
66
78
  return {
67
79
  path: p.path,
80
+ sourceMarkup: page.runtimeAssets.sourceMarkup,
81
+ html: page.runtimeAssets.html,
82
+ ...(page.runtimeAssets.artifact ? { artifact: page.runtimeAssets.artifact } : {}),
68
83
  uiConfig: page.uiConfig,
69
84
  eventConfig: page.eventConfig,
70
85
  triggers: page.triggers,
@@ -2,12 +2,18 @@
2
2
 
3
3
  import type { SomaPageAssets } from '../../client/engine/soma-bootstrap';
4
4
  import { compilePageDeclaration } from './page-declaration-compiler';
5
+ import type { SomaPageMarkup, TreeCompileContext } from '../../shared/types/component-tree.types';
5
6
 
6
7
  /** 把 SOMA DSL 源声明编译成客户端挂载所需的运行时资产。 */
7
- export function compilePageAssets(assets: SomaPageAssets): SomaPageAssets {
8
+ export function compilePageAssets(
9
+ assets: SomaPageAssets,
10
+ options: { markup?: SomaPageMarkup; grammarVersion?: number; treeContext?: TreeCompileContext } = {},
11
+ ): SomaPageAssets {
8
12
  const compiled = compilePageDeclaration({
9
13
  html: assets.html ?? '',
10
14
  uiYaml: assets.uiYaml ?? '',
15
+ ...options,
16
+ ...(assets.includes ? { includes: assets.includes } : {}),
11
17
  ...(assets.eventYaml ? { eventYaml: assets.eventYaml } : {}),
12
18
  ...(assets.styleYaml ? { styleYaml: assets.styleYaml } : {}),
13
19
  ...(assets.dataYaml ? { dataYaml: assets.dataYaml } : {}),
@@ -16,6 +22,16 @@ export function compilePageAssets(assets: SomaPageAssets): SomaPageAssets {
16
22
 
17
23
  return {
18
24
  ...assets,
25
+ html: compiled.runtimeAssets.html,
26
+ sourceMarkup: compiled.runtimeAssets.sourceMarkup,
27
+ artifact: compiled.runtimeAssets.artifact,
28
+ includes: undefined,
29
+ uiConfig: compiled.uiConfig,
30
+ eventConfig: compiled.eventConfig,
31
+ triggerConfig: compiled.triggers,
32
+ timerConfig: compiled.timers,
33
+ styleConfig: compiled.styleConfig,
34
+ dataConfig: compiled.dataConfig,
19
35
  uiYaml: compiled.runtimeAssets.uiYaml,
20
36
  eventYaml: compiled.runtimeAssets.eventYaml,
21
37
  styleYaml: '',
@@ -22,10 +22,22 @@ import {
22
22
  } from '../ooui';
23
23
  import { resolveOouiEngine } from '../ooui/engine-slot';
24
24
  import { parsePageState } from '../../client/parser/page-state-parser';
25
+ import { assertNoComponentTreeSyntax, preflightComponentTree, resolvePageMarkup } from '../component-tree/source-preflight';
26
+ import { SomaComponentTreeError } from '../../shared/component-tree-errors';
27
+ import type { SomaPageMarkup, TreeCompileContext, ComponentTreeTrace } from '../../shared/types/component-tree.types';
28
+ import { DEFAULT_TREE_LIMITS } from '../../shared/types/component-tree.types';
29
+ import type { ComponentTreeRuntimeEnvelope } from '../../shared/types/component-tree-artifact.types';
30
+ import { COMPONENT_TREE_CAPABILITIES } from '../../shared/types/component-tree-artifact.types';
31
+ import { bindComponentTree } from '../component-tree/binding-bridge';
32
+ import { computeTreeSourceDigest, sealTreeRuntimeAssets, treeContextIdentity, TREE_COMPILER_VERSION } from '../component-tree/artifact-codec';
25
33
 
26
34
  export interface SomaPageDeclarationInput {
27
35
  html: string;
28
36
  uiYaml: string;
37
+ /** Explicit source format. Component trees require a trusted Registry/policy context. */
38
+ markup?: SomaPageMarkup;
39
+ grammarVersion?: number;
40
+ treeContext?: TreeCompileContext;
29
41
  eventYaml?: string;
30
42
  styleYaml?: string;
31
43
  dataYaml?: string;
@@ -52,7 +64,9 @@ export interface SomaPageDeclarationInput {
52
64
  oouiEnv?: SomaEnvironment;
53
65
  }
54
66
 
55
- export interface SomaRuntimeDeclarationAssets {
67
+ export interface SomaRuntimeDeclarationAssets extends ComponentTreeRuntimeEnvelope {
68
+ sourceMarkup: SomaPageMarkup;
69
+ html: string;
56
70
  uiYaml: string;
57
71
  eventYaml: string;
58
72
  styleYaml: string;
@@ -60,6 +74,8 @@ export interface SomaRuntimeDeclarationAssets {
60
74
  }
61
75
 
62
76
  export interface CompiledPageDeclaration {
77
+ /** Source/contract/symbol lineage; never sent to browser assets. */
78
+ treeTrace?: ComponentTreeTrace;
63
79
  uiConfig: UiConfig;
64
80
  eventConfig: ParsedEvent[];
65
81
  triggers: PropertyTrigger[];
@@ -103,6 +119,15 @@ const dump = (value: unknown): string =>
103
119
 
104
120
  /** 编译一整页 SOMA DSL 声明。旧页面形状与页面侧车在唯一入口直接拒绝。 */
105
121
  export function compilePageDeclaration(input: SomaPageDeclarationInput): CompiledPageDeclaration {
122
+ try { return compilePageDeclarationInternal(input); } catch (error) {
123
+ if (input.markup !== 'component-tree' || error instanceof SomaComponentTreeError) throw error;
124
+ // Existing canonical/layout/event parsers may quote values. Tree diagnostics never do.
125
+ throw new SomaComponentTreeError({ code: 'CT-BINDING-SCOPE', phase: 'bind', sourceId: '<page>',
126
+ nodePath: 'canonical', fixHint: '组件树的 canonical 声明未通过既有配置解析;请检查组件块、路径和事件语法。' });
127
+ }
128
+ }
129
+
130
+ function compilePageDeclarationInternal(input: SomaPageDeclarationInput): CompiledPageDeclaration {
106
131
  const eventYaml = input.eventYaml ?? '';
107
132
  const styleYaml = input.styleYaml ?? '';
108
133
  const dataYaml = input.dataYaml ?? '';
@@ -113,20 +138,29 @@ export function compilePageDeclaration(input: SomaPageDeclarationInput): Compile
113
138
  dataYaml.trim() ? 'dataYaml / *_data.yaml' : '',
114
139
  ].filter(Boolean);
115
140
  if (sidecars.length > 0) {
141
+ if (input.markup === 'component-tree') {
142
+ throw new SomaComponentTreeError({ code: 'CT-BINDING-SCOPE', phase: 'input', sourceId: '<page>',
143
+ nodePath: 'sidecars', fixHint: '页面侧车已退役;事件、样式状态与数据对象必须写进同一份 canonical 声明。' });
144
+ }
116
145
  throw new Error(
117
146
  `[soma-core][SOMA DSL] 页面侧车已退役:${sidecars.join('、')}。`
118
147
  + '事件、样式状态与数据对象必须写进同一份 SOMA DSL 声明。',
119
148
  );
120
149
  }
121
150
 
151
+ const sourceMarkup = resolvePageMarkup(input);
152
+ const tree = sourceMarkup === 'component-tree'
153
+ ? bindComponentTree(preflightComponentTree(input), { uiYaml: input.uiYaml, externalBlocks: input.externalBlocks, treeContext: input.treeContext! }) : undefined;
154
+
122
155
  // include 只展开一次:锚点索引(compileSomaBlocks 内建)与演绎的区域行判定(compilePageOoui)
123
156
  // 必须看同一份 HTML。各展开一次的话两份在今天逐字节相同,展开器哪天改了其中一处调用的参数,
124
157
  // 就会出现"锚点在索引里、却不在区域行判定看到的那棵树里"——预算 CSS 静默不发。
125
- const html = expandSomaHtmlIncludes(input.html, input.includes);
158
+ const html = tree?.html ?? expandSomaHtmlIncludes(input.html, input.includes);
159
+ assertNoComponentTreeSyntax(html);
126
160
  const compiled = compileSomaBlocks({
127
161
  html,
128
- uiYamlRaw: input.uiYaml,
129
- ...(input.externalBlocks ? { externalBlocks: input.externalBlocks } : {}),
162
+ uiYamlRaw: tree?.uiYaml ?? input.uiYaml,
163
+ ...(tree ? { treeBindings: tree.treeBindings } : input.externalBlocks ? { externalBlocks: input.externalBlocks } : {}),
130
164
  });
131
165
  const eventBundle = compileEventConfigFromRaw(compiled.event);
132
166
 
@@ -165,8 +199,16 @@ export function compilePageDeclaration(input: SomaPageDeclarationInput): Compile
165
199
  // 下发了浏览器也不会(也不该)去解它。
166
200
  const layout = compiled.ui.layout !== undefined
167
201
  ? compilePageLayout({ raw: compiled.ui.layout, htmlIndex: compiled.htmlIndex, hostClass: compiled.ui.bind.obj })
168
- : null;
202
+ : null;
169
203
  if (layout) compiled.ui.layout = layout.constraints;
204
+ if (tree && layout) {
205
+ for (const [parent, constraint] of Object.entries(layout.constraints)) {
206
+ if (parent.startsWith('__soma_tree_') || Object.keys(constraint.nodes).some(child => tree.effectiveParents.get(child) !== parent)) {
207
+ throw new SomaComponentTreeError({ code: 'CT-LAYOUT-PARENT', phase: 'bind', sourceId: '<page>',
208
+ nodePath: `page.layout.${parent}`, fixHint: 'layout 只能引用已证明的长期存活直接父子关系;重复行或内部布局根由 owner 组件负责。' });
209
+ }
210
+ }
211
+ }
170
212
 
171
213
  const dataConfig = embeddedDataYaml ? compileDataConfig(embeddedDataYaml) : undefined;
172
214
 
@@ -198,7 +240,26 @@ export function compilePageDeclaration(input: SomaPageDeclarationInput): Compile
198
240
  ...(ooui ? { ooui_artifact: ooui.artifact } : {}),
199
241
  };
200
242
 
243
+ const runtimeAssets: SomaRuntimeDeclarationAssets = {
244
+ sourceMarkup, html,
245
+ uiYaml: dump(runtimeUiWithCss),
246
+ eventYaml: Object.keys(compiled.event).length > 0 ? dump(compiled.event) : '',
247
+ styleYaml: '',
248
+ ...(embeddedDataYaml ? { dataYaml: embeddedDataYaml } : {}),
249
+ };
250
+ if (tree) {
251
+ runtimeAssets.artifact = sealTreeRuntimeAssets({ ...runtimeAssets, sourceMarkup: 'component-tree', artifact: {
252
+ schemaVersion: 1, grammarVersion: 1, compilerVersion: TREE_COMPILER_VERSION,
253
+ sourceDigest: computeTreeSourceDigest(input), ...treeContextIdentity(input.treeContext!),
254
+ capabilities: [...COMPONENT_TREE_CAPABILITIES], componentRefs: tree.componentRefs,
255
+ structurePlan: tree.structurePlan, repeatPlans: tree.repeatPlans,
256
+ } });
257
+ if (Buffer.byteLength(JSON.stringify(runtimeAssets), 'utf8') > (input.treeContext?.limits?.maxArtifactBytes ?? DEFAULT_TREE_LIMITS.maxArtifactBytes)) {
258
+ throw new SomaComponentTreeError({ code: 'CT-LIMIT', phase: 'artifact', sourceId: '<page>', nodePath: 'runtimeAssets', fixHint: '完整树资产超出部署字节预算;减少静态内容或拆分业务组件。' });
259
+ }
260
+ }
201
261
  return {
262
+ ...(tree ? { treeTrace: tree.trace } : {}),
202
263
  uiConfig: {
203
264
  ...compiled.ui,
204
265
  ...(layout ? { layoutCss: layout.css } : {}),
@@ -214,12 +275,7 @@ export function compilePageDeclaration(input: SomaPageDeclarationInput): Compile
214
275
  ...(expanded && expanded.origins.length > 0 ? { oouiOrigins: expanded.origins } : {}),
215
276
  // 页面层的推导链同上:只进编译结果,不进产物。
216
277
  ...(ooui && ooui.traces.length > 0 ? { oouiPageTraces: ooui.traces } : {}),
217
- runtimeAssets: {
218
- uiYaml: dump(runtimeUiWithCss),
219
- eventYaml: Object.keys(compiled.event).length > 0 ? dump(compiled.event) : '',
220
- styleYaml: '',
221
- ...(embeddedDataYaml ? { dataYaml: embeddedDataYaml } : {}),
222
- },
278
+ runtimeAssets,
223
279
  };
224
280
  }
225
281
 
@@ -2,6 +2,8 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import type { SomaPrecompiledManifest, SomaPrecompiledPage } from './full-manifest-builder';
4
4
  import { urlPathToCandidates } from './page-base-resolver';
5
+ import { assertRuntimeArtifact } from '../../shared/component-tree-artifact';
6
+ import { verifyTreeRuntimeAssets } from '../component-tree/artifact-codec';
5
7
 
6
8
  /** Load full precompiled manifest from HOST .soma/manifest.json */
7
9
  export function loadPrecompiledManifest(hostDir: string): SomaPrecompiledManifest | null {
@@ -11,6 +13,11 @@ export function loadPrecompiledManifest(hostDir: string): SomaPrecompiledManifes
11
13
  try {
12
14
  const raw = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as SomaPrecompiledManifest;
13
15
  if (!raw?.pages || !Array.isArray(raw.pages)) return null;
16
+ for (const page of raw.pages) {
17
+ assertRuntimeArtifact(page);
18
+ if (page.sourceMarkup === 'component-tree' && (!page.uiConfig || !Array.isArray(page.eventConfig))) return null;
19
+ if (page.sourceMarkup === 'component-tree' && !verifyTreeRuntimeAssets(page)) return null;
20
+ }
14
21
  return raw;
15
22
  } catch {
16
23
  return null;
@@ -195,6 +195,7 @@ function assertNoPageSidecars(source, base) {
195
195
  class SomaManifestWebpackPlugin {
196
196
  constructor(options = {}) {
197
197
  this.hostDir = options.hostDir;
198
+ this.treeContext = options.treeContext;
198
199
  this.outputDir = options.outputDir ?? '.soma';
199
200
  this.jiti = createJiti(__filename, {
200
201
  interopDefault: true,
@@ -215,6 +216,8 @@ class SomaManifestWebpackPlugin {
215
216
  try {
216
217
  const { precompileAll } = this.jiti('./full-manifest-builder.ts');
217
218
  const { loadExternalBlocks } = this.jiti('../blocks/block-loader.ts');
219
+ const { loadPageMarkupConfig } = this.jiti('../../server/host/page-markup-config.ts');
220
+ const { resolveHostTreeCompileContext } = this.jiti('../../server/host/resolve-host-tree-context.ts');
218
221
  const sources = getSomaAssetSources(hostDir);
219
222
  const pageEntries = collectPageEntries(sources);
220
223
  const includes = collectIncludes(sources);
@@ -232,10 +235,14 @@ class SomaManifestWebpackPlugin {
232
235
  const uiDir = path.join(source.assetRoot, 'ui');
233
236
  assertNoPageSidecars(source, base);
234
237
  const externalBlocks = loadExternalBlocks(uiDir, base);
238
+ const metadata = loadPageMarkupConfig(source.configRoot, base);
235
239
  return {
236
240
  path: `/${base}`,
237
241
  html: fs.readFileSync(path.join(source.assetRoot, 'html', htmlFile), 'utf8'),
238
242
  uiYaml: readYaml(path.join(uiDir, `${base}_ui.yaml`)),
243
+ ...metadata,
244
+ treeContext: this.treeContext ?? (metadata.markup === 'component-tree'
245
+ ? resolveHostTreeCompileContext(hostDir, { pageBase: base }) : undefined),
239
246
  ...(externalBlocks.size > 0 ? { externalBlocks } : {}),
240
247
  ...(Object.keys(includes).length > 0 ? { includes } : {}),
241
248
  appConfigYaml: sourceAppConfigPath