MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / renderShellTree

Function renderShellTree

packages/extension/mcp/tools/code/render/index.ts:32–55  ·  view source on GitHub ↗
(
  rootId: string,
  tree: VisibleTree,
  ctx: RenderContext,
  omittedNodeIds: string[]
)

Source from the content-addressed store, hash-verified

30}
31
32export async function renderShellTree(
33 rootId: string,
34 tree: VisibleTree,
35 ctx: RenderContext,
36 omittedNodeIds: string[]
37): Promise<DevComponent | null> {
38 const snapshot = tree.nodes.get(rootId)
39 if (!snapshot || omittedNodeIds.length === 0) return null
40 if (ctx.svgs.has(snapshot.id)) return null
41
42 if (snapshot.node.type === 'TEXT') return null
43 const pluginComponent = await resolveSnapshotPluginComponent(snapshot, ctx)
44 if (pluginComponent) return null
45
46 const langHint = ctx.preferredLang ?? ctx.detectedLang
47 const rawStyle = resolveSnapshotStyle(snapshot, ctx)
48 const props = buildFallbackSnapshotProps(snapshot, ctx, rawStyle, langHint)
49
50 return {
51 name: snapshot.tag || 'div',
52 props,
53 children: [raw(buildShellComment(langHint, omittedNodeIds))]
54 }
55}
56
57async function renderNode(
58 nodeId: string,

Callers 2

shell.test.tsFile · 0.90
renderTreeForModeFunction · 0.90

Calls 7

rawFunction · 0.90
resolveSnapshotStyleFunction · 0.85
buildShellCommentFunction · 0.85
getMethod · 0.80
hasMethod · 0.80

Tested by

no test coverage detected