@glyphjs/compiler 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -149,9 +149,7 @@ function translateGlyphUIBlock(node, ctx) {
|
|
|
149
149
|
if (schema) {
|
|
150
150
|
const result = schema.safeParse(node.parsedData);
|
|
151
151
|
if (!result.success) {
|
|
152
|
-
const zodErrors = result.error.issues.map(
|
|
153
|
-
(issue) => `${issue.path.join(".")}: ${issue.message}`
|
|
154
|
-
).join("; ");
|
|
152
|
+
const zodErrors = result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
155
153
|
const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);
|
|
156
154
|
blockDiagnostics.push(diag);
|
|
157
155
|
ctx.diagnostics.push(diag);
|
|
@@ -174,6 +172,9 @@ function translateGlyphUIBlock(node, ctx) {
|
|
|
174
172
|
data,
|
|
175
173
|
position
|
|
176
174
|
};
|
|
175
|
+
if (node.interactive) {
|
|
176
|
+
block.metadata = { interactive: true };
|
|
177
|
+
}
|
|
177
178
|
if (blockDiagnostics.length > 0) {
|
|
178
179
|
block.diagnostics = blockDiagnostics;
|
|
179
180
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inline.ts","../src/diagnostics.ts","../src/ast-to-ir.ts","../src/references.ts","../src/containers.ts","../src/compile.ts"],"names":["generateBlockId","componentSchemas","parseGlyphMarkdown","generateDocumentId","resolveBlockIdCollisions","ir","parseYaml"],"mappings":";;;;;;;;;;AAsEO,SAAS,uBAAuB,KAAA,EAAgC;AACrE,EAAA,MAAM,SAAuB,EAAC;AAE9B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB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AAA,MAC1B,CAAC,MAAM,CAAA,CAAE,IAAA,KAAS,aAAc,CAAA,CAAE,IAAA,CAAiC,OAAO,CAAA,KAAM;AAAA,KAClF;AACA,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,MAAM,OAAO,YAAA,CAAa,IAAA;AAC1B,MAAA,IAAI,KAAK,QAAA,EAAU;AACjB,QAAA,QAAA,CAAS,KAAA,GAAQ,IAAA,CAAK,QAAA,CACnB,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,SAAS,WAAA,EAAa;AACzB,IAAA,MAAM,iBAAiB,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,WAAW,CAAA;AAChE,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,MAAM,OAAO,cAAA,CAAe,IAAA;AAC5B,MAAA,IAAI,KAAK,QAAA,EAAU;AACjB,QAAA,QAAA,CAAS,WAAA,GAAc,IAAA,CAAK,QAAA,CACzB,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import type { InlineNode } from '@glyphjs/types';\n\n// ─── MDAST Phrasing Content Types ───────────────────────────\n// These are structural types matching the shapes from mdast,\n// avoiding a hard dependency on @types/mdast.\n\ninterface MdastText {\n type: 'text';\n value: string;\n}\n\ninterface MdastStrong {\n type: 'strong';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastEmphasis {\n type: 'emphasis';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastDelete {\n type: 'delete';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastInlineCode {\n type: 'inlineCode';\n value: string;\n}\n\ninterface MdastLink {\n type: 'link';\n url: string;\n title?: string | null;\n children: MdastPhrasingContent[];\n}\n\ninterface MdastImage {\n type: 'image';\n url: string;\n alt?: string | null;\n title?: string | null;\n}\n\ninterface MdastBreak {\n type: 'break';\n}\n\ntype MdastPhrasingContent =\n | MdastText\n | MdastStrong\n | MdastEmphasis\n | MdastDelete\n | MdastInlineCode\n | MdastLink\n | MdastImage\n | MdastBreak;\n\n// ─── Conversion ─────────────────────────────────────────────\n\n/**\n * Convert an array of MDAST phrasing content nodes to InlineNode[].\n *\n * Unknown node types are converted to text nodes with their string value\n * (if present) or skipped entirely.\n *\n * @param nodes - Raw MDAST phrasing content nodes (typed as unknown[] to avoid a hard @types/mdast dependency).\n * @returns Normalized InlineNode array suitable for inclusion in IR blocks.\n */\nexport function convertPhrasingContent(nodes: unknown[]): InlineNode[] {\n const result: InlineNode[] = [];\n\n for (const node of nodes) {\n const converted = convertSingleNode(node as MdastPhrasingContent);\n if (converted) {\n result.push(converted);\n }\n }\n\n return result;\n}\n\nfunction convertSingleNode(node: MdastPhrasingContent): InlineNode | null {\n switch (node.type) {\n case 'text':\n return { type: 'text', value: node.value };\n\n case 'strong':\n return {\n type: 'strong',\n children: convertPhrasingContent(node.children),\n };\n\n case 'emphasis':\n return {\n type: 'emphasis',\n children: convertPhrasingContent(node.children),\n };\n\n case 'delete':\n return {\n type: 'delete',\n children: convertPhrasingContent(node.children),\n };\n\n case 'inlineCode':\n return { type: 'inlineCode', value: node.value };\n\n case 'link': {\n const linkNode: InlineNode = {\n type: 'link',\n url: node.url,\n children: convertPhrasingContent(node.children),\n };\n if (node.title != null) {\n (linkNode as { type: 'link'; url: string; title?: string; children: InlineNode[] }).title =\n node.title;\n }\n return linkNode;\n }\n\n case 'image': {\n const imgNode: InlineNode = {\n type: 'image',\n src: node.url,\n };\n if (node.alt != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).alt = node.alt;\n }\n if (node.title != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).title =\n node.title;\n }\n return imgNode;\n }\n\n case 'break':\n return { type: 'break' };\n\n default: {\n // For unknown phrasing content types, attempt to extract a text value\n const unknown = node as Record<string, unknown>;\n if (typeof unknown['value'] === 'string') {\n return { type: 'text', value: unknown['value'] };\n }\n return null;\n }\n }\n}\n","import type { Diagnostic, DiagnosticSource, SourcePosition } from '@glyphjs/types';\n\n// ─── Diagnostic Creation Helpers ─────────────────────────────\n\n/**\n * Create a diagnostic with the given source, severity, message, and optional position.\n *\n * @param source - The subsystem that produced the diagnostic (e.g., 'compiler', 'parser', 'schema').\n * @param severity - Severity level: 'error', 'warning', or 'info'.\n * @param code - Machine-readable diagnostic code (e.g., 'YAML_PARSE_ERROR').\n * @param message - Human-readable description of the issue.\n * @param position - Optional source position where the issue was detected.\n * @param details - Optional structured details (e.g., Zod issue objects).\n * @returns A fully constructed Diagnostic object.\n */\nexport function createDiagnostic(\n source: DiagnosticSource,\n severity: Diagnostic['severity'],\n code: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n const diag: Diagnostic = { severity, code, message, source };\n if (position) {\n diag.position = position;\n }\n if (details !== undefined) {\n diag.details = details;\n }\n return diag;\n}\n\n/**\n * Create a schema validation error diagnostic.\n *\n * @param componentType - The ui: component type that failed validation (without the `ui:` prefix).\n * @param message - Concatenated validation error messages from Zod.\n * @param position - Optional source position of the component block.\n * @param details - Optional raw Zod issue objects.\n * @returns A Diagnostic with severity 'error' and code 'SCHEMA_VALIDATION_FAILED'.\n */\nexport function createSchemaError(\n componentType: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n return createDiagnostic(\n 'schema',\n 'error',\n 'SCHEMA_VALIDATION_FAILED',\n `Schema validation failed for ui:${componentType}: ${message}`,\n position,\n details,\n );\n}\n\n/**\n * Create an info diagnostic for unknown component types.\n *\n * @param componentType - The unrecognized component type (without the `ui:` prefix).\n * @param position - Optional source position of the component block.\n * @returns A Diagnostic with severity 'info' and code 'UNKNOWN_COMPONENT_TYPE'.\n */\nexport function createUnknownComponentInfo(\n componentType: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'compiler',\n 'info',\n 'UNKNOWN_COMPONENT_TYPE',\n `Unknown component type \"ui:${componentType}\". Block preserved as-is.`,\n position,\n );\n}\n\n/**\n * Create a diagnostic for YAML parse errors on ui: blocks.\n *\n * @param componentType - The ui: component type whose YAML failed to parse (without the `ui:` prefix).\n * @param yamlError - The YAML parser error message.\n * @param position - Optional source position of the fenced code block.\n * @returns A Diagnostic with severity 'error' and code 'YAML_PARSE_ERROR'.\n */\nexport function createYamlError(\n componentType: string,\n yamlError: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'parser',\n 'error',\n 'YAML_PARSE_ERROR',\n `YAML parse error in ui:${componentType}: ${yamlError}`,\n position,\n );\n}\n","import type {\n Block,\n BlockType,\n Diagnostic,\n GlyphUIBlock,\n MdastContentNode,\n SourcePosition,\n Reference,\n RawRef,\n ListData,\n ListItemData,\n InlineNode,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { componentSchemas } from '@glyphjs/schemas';\nimport { convertPhrasingContent } from './inline.js';\nimport {\n createSchemaError,\n createUnknownComponentInfo,\n createYamlError,\n} from './diagnostics.js';\n\n// ─── Default Source Position ─────────────────────────────────\n\nconst DEFAULT_POSITION: SourcePosition = {\n start: { line: 0, column: 0 },\n end: { line: 0, column: 0 },\n};\n\n// ─── Translation Context ────────────────────────────────────\n\nexport interface TranslationContext {\n documentId: string;\n diagnostics: Diagnostic[];\n references: Reference[];\n blockIdMap: Map<string, string>;\n}\n\n// ─── AST Node Type Guards ────────────────────────────────────\n\nfunction isGlyphUIBlock(node: GlyphUIBlock | MdastContentNode): node is GlyphUIBlock {\n return node.type === 'glyphUIBlock';\n}\n\n// ─── Main Translation Entry Point ────────────────────────────\n\n/**\n * Translate a single AST child node (either a GlyphUIBlock or a standard\n * MDAST content node) into an IR Block.\n *\n * Returns null for nodes that should be skipped (e.g., yaml frontmatter).\n *\n * @param node - The AST node to translate (GlyphUIBlock or standard MDAST content node).\n * @param ctx - Translation context carrying document ID, accumulated diagnostics, and references.\n * @returns The translated IR Block, or null if the node should be skipped.\n */\nexport function translateNode(\n node: GlyphUIBlock | MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n if (isGlyphUIBlock(node)) {\n return translateGlyphUIBlock(node, ctx);\n }\n return translateMdastNode(node, ctx);\n}\n\n// ─── Glyph UI Block Translation ─────────────────────────────\n\nfunction translateGlyphUIBlock(\n node: GlyphUIBlock,\n ctx: TranslationContext,\n): Block {\n const componentType = node.componentType;\n const blockType: BlockType = `ui:${componentType}`;\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n const blockDiagnostics: Diagnostic[] = [];\n\n // Determine block ID: user-assigned glyph-id or content-addressed\n const blockId = node.glyphId\n ? node.glyphId\n : generateBlockId(ctx.documentId, blockType, node.rawYaml);\n\n // Track the block ID mapping for reference resolution\n if (node.glyphId) {\n ctx.blockIdMap.set(node.glyphId, blockId);\n }\n\n // Handle YAML parse errors\n if (node.yamlError) {\n const diag = createYamlError(componentType, node.yamlError, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n\n // Determine block data\n let data: Record<string, unknown> = node.parsedData ?? {};\n\n // Validate against Zod schema if we have parsed data\n if (node.parsedData) {\n const schema = componentSchemas.get(componentType);\n if (schema) {\n const result = schema.safeParse(node.parsedData);\n if (!result.success) {\n const zodErrors = result.error.issues.map(\n (issue) => `${issue.path.join('.')}: ${issue.message}`,\n ).join('; ');\n const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n // Preserve the raw parsedData even on validation failure\n data = node.parsedData;\n } else {\n data = result.data as Record<string, unknown>;\n }\n } else {\n // Unknown component type — info diagnostic, preserve block as-is\n const diag = createUnknownComponentInfo(componentType, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n }\n\n // Process refs into references\n if (node.refs && node.refs.length > 0) {\n processRefs(node.refs, blockId, ctx);\n }\n\n const block: Block = {\n id: blockId,\n type: blockType,\n data,\n position,\n };\n\n if (blockDiagnostics.length > 0) {\n block.diagnostics = blockDiagnostics;\n }\n\n return block;\n}\n\n// ─── Reference Processing ────────────────────────────────────\n\nfunction processRefs(\n refs: RawRef[],\n sourceBlockId: string,\n ctx: TranslationContext,\n): void {\n for (const ref of refs) {\n const reference: Reference = {\n id: generateBlockId(ctx.documentId, 'ref', `${sourceBlockId}->${ref.target}`),\n type: (ref.type as Reference['type']) ?? 'navigates-to',\n sourceBlockId,\n targetBlockId: ref.target,\n };\n\n if (ref.label) {\n reference.label = ref.label;\n }\n if (ref.sourceAnchor) {\n reference.sourceAnchor = ref.sourceAnchor;\n }\n if (ref.targetAnchor) {\n reference.targetAnchor = ref.targetAnchor;\n }\n if (ref.bidirectional) {\n reference.bidirectional = ref.bidirectional;\n }\n\n // Mark as unresolved — we resolve later in the compile step\n reference.unresolved = true;\n\n ctx.references.push(reference);\n }\n}\n\n// ─── Standard MDAST Node Translation ─────────────────────────\n\nfunction translateMdastNode(\n node: MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n\n switch (node.type) {\n case 'heading':\n return translateHeading(node, position, ctx);\n case 'paragraph':\n return translateParagraph(node, position, ctx);\n case 'list':\n return translateList(node, position, ctx);\n case 'code':\n return translateCode(node, position, ctx);\n case 'blockquote':\n return translateBlockquote(node, position, ctx);\n case 'image':\n return translateImage(node, position, ctx);\n case 'thematicBreak':\n return translateThematicBreak(position, ctx);\n case 'html':\n return translateHtml(node, position, ctx);\n case 'yaml':\n // Frontmatter is handled separately in compile.ts; skip here\n return null;\n default:\n // Unknown MDAST node type — skip silently\n return null;\n }\n}\n\n// ─── Individual Node Translators ─────────────────────────────\n\nfunction translateHeading(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const depth = (node['depth'] as number) ?? 1;\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'heading', content),\n type: 'heading',\n data: { depth, children },\n position,\n };\n}\n\nfunction translateParagraph(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'paragraph', content),\n type: 'paragraph',\n data: { children },\n position,\n };\n}\n\nfunction translateList(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const ordered = (node['ordered'] as boolean) ?? false;\n const start = ordered ? ((node['start'] as number) ?? 1) : undefined;\n const items = translateListItems((node.children ?? []) as MdastContentNode[]);\n const content = listDataToText({ ordered, start, items });\n\n const data: ListData = { ordered, items };\n if (start !== undefined) {\n data.start = start;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'list', content),\n type: 'list',\n data,\n position,\n };\n}\n\nfunction translateListItems(listItemNodes: MdastContentNode[]): ListItemData[] {\n const items: ListItemData[] = [];\n\n for (const itemNode of listItemNodes) {\n if (itemNode.type !== 'listItem') continue;\n\n const itemChildren = (itemNode.children ?? []) as MdastContentNode[];\n let inlineChildren: InlineNode[] = [];\n let subList: ListData | undefined;\n\n for (const child of itemChildren) {\n if (child.type === 'paragraph') {\n inlineChildren = convertPhrasingContent((child.children ?? []) as unknown[]);\n } else if (child.type === 'list') {\n const subOrdered = (child['ordered'] as boolean) ?? false;\n const subStart = subOrdered ? ((child['start'] as number) ?? 1) : undefined;\n const subItems = translateListItems((child.children ?? []) as MdastContentNode[]);\n subList = { ordered: subOrdered, items: subItems };\n if (subStart !== undefined) {\n subList.start = subStart;\n }\n }\n }\n\n const item: ListItemData = { children: inlineChildren };\n if (subList) {\n item.subList = subList;\n }\n items.push(item);\n }\n\n return items;\n}\n\nfunction translateCode(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n const language = (node['lang'] as string) ?? undefined;\n const meta = (node['meta'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { value };\n if (language) {\n data['language'] = language;\n }\n if (meta) {\n data['meta'] = meta;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'code', value),\n type: 'code',\n data,\n position,\n };\n}\n\nfunction translateBlockquote(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n // Blockquote children are typically paragraphs — flatten their inline content\n const allInlineNodes: InlineNode[] = [];\n for (const child of (node.children ?? []) as MdastContentNode[]) {\n if (child.type === 'paragraph') {\n const inlines = convertPhrasingContent((child.children ?? []) as unknown[]);\n allInlineNodes.push(...inlines);\n }\n }\n const content = inlineNodesToText(allInlineNodes);\n\n return {\n id: generateBlockId(ctx.documentId, 'blockquote', content),\n type: 'blockquote',\n data: { children: allInlineNodes },\n position,\n };\n}\n\nfunction translateImage(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const src = (node['url'] as string) ?? '';\n const alt = (node['alt'] as string) ?? undefined;\n const title = (node['title'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { src };\n if (alt) {\n data['alt'] = alt;\n }\n if (title) {\n data['title'] = title;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'image', src),\n type: 'image',\n data,\n position,\n };\n}\n\nfunction translateThematicBreak(\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n return {\n id: generateBlockId(ctx.documentId, 'thematic-break', '---'),\n type: 'thematic-break',\n data: {},\n position,\n };\n}\n\nfunction translateHtml(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n\n return {\n id: generateBlockId(ctx.documentId, 'html', value),\n type: 'html',\n data: { value },\n position,\n };\n}\n\n// ─── Text Extraction Helpers ─────────────────────────────────\n\n/**\n * Extract plain text from InlineNode[] for content-addressing purposes.\n */\nfunction inlineNodesToText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToText(node.children);\n case 'link':\n return inlineNodesToText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n\n/**\n * Extract plain text from ListData for content-addressing purposes.\n */\nfunction listDataToText(data: ListData): string {\n return data.items\n .map((item) => {\n let text = inlineNodesToText(item.children);\n if (item.subList) {\n text += '\\n' + listDataToText(item.subList);\n }\n return text;\n })\n .join('\\n');\n}\n","import type {\n Block,\n Diagnostic,\n InlineNode,\n Reference,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Glyph Link Pattern ─────────────────────────────────────\n\n/**\n * Matches inline links of the form `[text](#glyph:block-id)`.\n * The captured group is the block ID after the `#glyph:` prefix.\n */\nconst GLYPH_LINK_PREFIX = '#glyph:';\n\n// ─── Inline Reference Scanning ──────────────────────────────\n\n/**\n * Scan a block's inline content for `[text](#glyph:block-id)` links\n * and create Reference objects for each match.\n *\n * @param block - The block whose inline data fields are scanned for glyph links.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Newly created (unresolved) Reference objects.\n */\nexport function extractInlineReferences(\n block: Block,\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n const inlineNodes = extractInlineNodes(block);\n\n for (const node of inlineNodes) {\n if (node.type === 'link' && node.url.startsWith(GLYPH_LINK_PREFIX)) {\n const targetBlockId = node.url.slice(GLYPH_LINK_PREFIX.length);\n if (!targetBlockId) continue;\n\n const label = inlineNodesToPlainText(node.children);\n\n const reference: Reference = {\n id: generateBlockId(documentId, 'ref', `${block.id}->${targetBlockId}`),\n type: 'navigates-to',\n sourceBlockId: block.id,\n targetBlockId,\n unresolved: true,\n };\n\n if (label) {\n reference.label = label;\n }\n\n references.push(reference);\n }\n }\n\n return references;\n}\n\n/**\n * Scan all blocks (including nested children) for inline `#glyph:` link references\n * and collect them.\n *\n * @param blocks - Top-level block array to scan recursively.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Aggregated array of unresolved Reference objects from all blocks.\n */\nexport function extractAllInlineReferences(\n blocks: Block[],\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n\n for (const block of blocks) {\n const blockRefs = extractInlineReferences(block, documentId);\n references.push(...blockRefs);\n\n // Also scan children (e.g. container blocks)\n if (block.children) {\n const childRefs = extractAllInlineReferences(block.children, documentId);\n references.push(...childRefs);\n }\n }\n\n return references;\n}\n\n// ─── Reference Resolution ────────────────────────────────────\n\n/**\n * Resolve references by checking if target block IDs exist in the document.\n * Marks unresolved references and adds warning diagnostics.\n *\n * Collects all block IDs including children (for container blocks).\n *\n * @param references - The reference array to resolve in-place (mutates `unresolved` flag).\n * @param blocks - All blocks in the document (used to build the known-ID set).\n * @param diagnostics - Accumulator for 'UNRESOLVED_REFERENCE' warnings.\n */\nexport function resolveReferences(\n references: Reference[],\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n const blockIdSet = collectAllBlockIds(blocks);\n\n for (const ref of references) {\n if (blockIdSet.has(ref.targetBlockId)) {\n ref.unresolved = false;\n } else {\n ref.unresolved = true;\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'UNRESOLVED_REFERENCE',\n `Reference target \"${ref.targetBlockId}\" was not found in the document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Collect all block IDs from blocks and their children recursively.\n */\nfunction collectAllBlockIds(blocks: Block[]): Set<string> {\n const ids = new Set<string>();\n for (const block of blocks) {\n ids.add(block.id);\n if (block.children) {\n for (const id of collectAllBlockIds(block.children)) {\n ids.add(id);\n }\n }\n }\n return ids;\n}\n\n// ─── Glyph-ID Uniqueness Validation ─────────────────────────\n\n/**\n * Validate that all user-assigned glyph-ids are unique within the document.\n * Emits error diagnostics for duplicates.\n *\n * @param blockIdMap - Map of user-assigned glyph-id to resolved block ID (from translation).\n * @param blocks - All blocks in the document (scanned to count occurrences).\n * @param diagnostics - Accumulator for 'DUPLICATE_GLYPH_ID' error diagnostics.\n */\nexport function validateGlyphIdUniqueness(\n blockIdMap: Map<string, string>,\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n // blockIdMap tracks glyphId -> blockId, but we need to detect duplicates\n // by scanning blocks for those whose id matches a glyph-id key\n const glyphIdOccurrences = new Map<string, number>();\n\n for (const glyphId of blockIdMap.keys()) {\n const count = countBlocksWithGlyphId(blocks, glyphId);\n glyphIdOccurrences.set(glyphId, count);\n }\n\n for (const [glyphId, count] of glyphIdOccurrences) {\n if (count > 1) {\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'error',\n 'DUPLICATE_GLYPH_ID',\n `Duplicate glyph-id \"${glyphId}\" found on ${String(count)} blocks. Block IDs must be unique within a document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Count how many blocks in the array have a given ID (which came from a glyph-id).\n */\nfunction countBlocksWithGlyphId(blocks: Block[], glyphId: string): number {\n let count = 0;\n for (const block of blocks) {\n if (block.id === glyphId) {\n count++;\n }\n }\n return count;\n}\n\n// ─── Inline Node Extraction Helpers ──────────────────────────\n\n/**\n * Extract all InlineNode arrays from a block's data field.\n * Handles heading, paragraph, blockquote, and list blocks.\n */\nfunction extractInlineNodes(block: Block): InlineNode[] {\n const data = block.data as Record<string, unknown>;\n const nodes: InlineNode[] = [];\n\n // Blocks with a direct `children` inline array\n if (Array.isArray(data['children'])) {\n nodes.push(...(data['children'] as InlineNode[]));\n }\n\n // List blocks: extract inline nodes from items\n if (Array.isArray(data['items'])) {\n for (const item of data['items'] as { children?: InlineNode[]; subList?: { items?: unknown[] } }[]) {\n if (Array.isArray(item.children)) {\n nodes.push(...item.children);\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Extract plain text from InlineNode[] for label purposes.\n */\nfunction inlineNodesToPlainText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToPlainText(node.children);\n case 'link':\n return inlineNodesToPlainText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n","import type { Block, Diagnostic } from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Container Block Compilation ─────────────────────────────\n\n/**\n * Process container blocks (ui:tabs and ui:steps) by recursively parsing\n * their content fields as Markdown into child Block[] arrays.\n *\n * This function mutates blocks in-place, populating their `children` field\n * and updating data entries with parsed child blocks.\n *\n * @param blocks - The top-level block array to scan for container blocks.\n * @param ctx - Translation context used for recursive compilation.\n */\nexport function compileContainerBlocks(\n blocks: Block[],\n ctx: TranslationContext,\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n compileTabsBlock(block, ctx);\n } else if (block.type === 'ui:steps') {\n compileStepsBlock(block, ctx);\n }\n }\n}\n\n// ─── Tabs Compilation ────────────────────────────────────────\n\nfunction compileTabsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs)) return;\n\n const allChildren: Block[] = [];\n\n for (const tab of tabs as { label?: string; content?: string }[]) {\n if (typeof tab.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(tab.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Steps Compilation ───────────────────────────────────────\n\nfunction compileStepsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps)) return;\n\n const allChildren: Block[] = [];\n\n for (const step of steps as { title?: string; status?: string; content?: string }[]) {\n if (typeof step.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(step.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Content Parsing Helper ──────────────────────────────────\n\n/**\n * Parse a Markdown content string into Block[] using the compiler pipeline.\n * Emits a warning diagnostic if nested ui: components are found (deferred to v2).\n */\nfunction parseContentToBlocks(\n content: string,\n parentBlock: Block,\n ctx: TranslationContext,\n): Block[] {\n const ast = parseGlyphMarkdown(content);\n const blocks: Block[] = [];\n\n for (const child of ast.children) {\n // Check for nested ui: components — warn and skip\n if (child.type === 'glyphUIBlock') {\n ctx.diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'NESTED_UI_COMPONENT',\n `Nested ui: component found inside container block \"${parentBlock.id}\". ` +\n `Nested ui: components inside tabs/steps are not supported in v1 and will be ignored.`,\n child.position,\n ),\n );\n continue;\n }\n\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n return blocks;\n}\n\n// ─── Nested UI Detection ─────────────────────────────────────\n\n/**\n * Check if content contains nested ui: blocks by looking for the pattern.\n * This is a quick heuristic check. The actual detection happens during parsing.\n *\n * @param content - Raw Markdown string to test for nested ui: fenced blocks.\n * @returns True if the content matches the `` ```ui: `` pattern.\n */\nexport function hasNestedUiBlocks(content: string): boolean {\n return /```ui:/m.test(content);\n}\n\n// ─── Validate Container Diagnostics ──────────────────────────\n\n/**\n * Post-process container blocks to ensure data consistency.\n * Called after container compilation is complete.\n *\n * @param blocks - The compiled block array to validate.\n * @param diagnostics - Accumulator for warning diagnostics (e.g., missing labels/titles).\n */\nexport function validateContainerBlocks(\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n validateTabsData(block, diagnostics);\n } else if (block.type === 'ui:steps') {\n validateStepsData(block, diagnostics);\n }\n }\n}\n\nfunction validateTabsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs) || tabs.length === 0) {\n return;\n }\n\n // Ensure each tab has a label\n for (const tab of tabs as { label?: string }[]) {\n if (!tab.label) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_TAB_LABEL',\n `A tab in block \"${block.id}\" is missing a label.`,\n block.position,\n ),\n );\n }\n }\n}\n\nfunction validateStepsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps) || steps.length === 0) {\n return;\n }\n\n // Ensure each step has a title\n for (const step of steps as { title?: string }[]) {\n if (!step.title) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_STEP_TITLE',\n `A step in block \"${block.id}\" is missing a title.`,\n block.position,\n ),\n );\n }\n }\n}\n","import type {\n GlyphIR,\n CompilationResult,\n Diagnostic,\n DocumentMetadata,\n LayoutHints,\n Block,\n Reference,\n MdastContentNode,\n} from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { generateDocumentId, resolveBlockIdCollisions } from '@glyphjs/ir';\nimport { parse as parseYaml } from 'yaml';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\nimport {\n extractAllInlineReferences,\n resolveReferences,\n validateGlyphIdUniqueness,\n} from './references.js';\nimport { compileContainerBlocks, validateContainerBlocks } from './containers.js';\n\n// ─── Public Interface ────────────────────────────────────────\n\nexport interface CompileOptions {\n /** Source file path, used for document ID generation. */\n filePath?: string;\n /** Explicit document ID override. */\n documentId?: string;\n}\n\n// ─── Main Compile Function ───────────────────────────────────\n\n/**\n * Compile a Markdown string into Glyph IR.\n *\n * Steps:\n * 1. Parse the markdown via `parseGlyphMarkdown`\n * 2. Extract frontmatter metadata and layout hints\n * 3. Walk the AST and translate each node to IR blocks\n * 4. Validate ui: blocks against Zod schemas\n * 5. Compile container blocks (ui:tabs, ui:steps) — recursively parse content\n * 6. Validate container block data\n * 7. Generate content-addressed block IDs\n * 8. Generate the document ID\n * 9. Resolve block ID collisions\n * 10. Validate glyph-id uniqueness\n * 11. Extract inline references from `[text](#glyph:block-id)` links\n * 12. Resolve all references (from refs arrays and inline links)\n * 13. Infer metadata from content if not in frontmatter\n * 14. Return CompilationResult with IR, diagnostics, and hasErrors flag\n *\n * Uses a collect-all-errors strategy: IR is always produced, even when errors exist.\n */\nexport function compile(markdown: string, options?: CompileOptions): CompilationResult {\n const diagnostics: Diagnostic[] = [];\n\n // 1. Parse the markdown into a Glyph AST\n const ast = parseGlyphMarkdown(markdown);\n\n // 2. Extract frontmatter\n const { metadata, layout, frontmatterGlyphId } = extractFrontmatter(ast.children, diagnostics);\n\n // 3. Generate document ID\n const documentId =\n options?.documentId ??\n generateDocumentId({\n glyphId: frontmatterGlyphId,\n filePath: options?.filePath,\n content: markdown,\n });\n\n // Set sourceFile from options if available\n if (options?.filePath && !metadata.sourceFile) {\n metadata.sourceFile = options.filePath;\n }\n\n // 4. Create translation context\n const references: Reference[] = [];\n const ctx: TranslationContext = {\n documentId,\n diagnostics,\n references,\n blockIdMap: new Map(),\n };\n\n // 5. Walk the AST and translate nodes\n const blocks: Block[] = [];\n for (const child of ast.children) {\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n // 6. Compile container blocks (ui:tabs, ui:steps) — recursively parse content fields\n compileContainerBlocks(blocks, ctx);\n\n // 7. Validate container block data\n validateContainerBlocks(blocks, diagnostics);\n\n // 8. Infer metadata from content if not in frontmatter\n inferMetadata(metadata, blocks);\n\n // 9. Resolve block ID collisions\n const blockIds = blocks.map((b) => b.id);\n const resolvedIds = resolveBlockIdCollisions(blockIds);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const resolvedId = resolvedIds[i];\n if (block && resolvedId) {\n block.id = resolvedId;\n }\n }\n\n // 10. Validate glyph-id uniqueness\n validateGlyphIdUniqueness(ctx.blockIdMap, blocks, diagnostics);\n\n // 11. Extract inline references from [text](#glyph:block-id) links\n const inlineRefs = extractAllInlineReferences(blocks, documentId);\n references.push(...inlineRefs);\n\n // 12. Resolve all references (from refs arrays and inline links)\n resolveReferences(references, blocks, diagnostics);\n\n // 13. Build the IR\n const ir: GlyphIR = {\n version: '1.0.0',\n id: documentId,\n metadata,\n blocks,\n references,\n layout,\n };\n\n const hasErrors = diagnostics.some((d) => d.severity === 'error');\n\n return { ir, diagnostics, hasErrors };\n}\n\n// ─── Frontmatter Extraction ─────────────────────────────────\n\ninterface FrontmatterResult {\n metadata: DocumentMetadata;\n layout: LayoutHints;\n frontmatterGlyphId?: string;\n}\n\nfunction extractFrontmatter(\n children: readonly unknown[],\n diagnostics: Diagnostic[],\n): FrontmatterResult {\n const metadata: DocumentMetadata = {};\n let layout: LayoutHints = { mode: 'document', spacing: 'normal' };\n let frontmatterGlyphId: string | undefined;\n\n // Look for yaml frontmatter node (always first child if present)\n const firstChild = children[0] as MdastContentNode | undefined;\n if (firstChild && firstChild.type === 'yaml' && typeof firstChild.value === 'string') {\n try {\n const parsed: unknown = parseYaml(firstChild.value);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n const fm = parsed as Record<string, unknown>;\n\n // Extract glyph-id\n if (typeof fm['glyph-id'] === 'string') {\n frontmatterGlyphId = fm['glyph-id'];\n }\n\n // Extract metadata fields\n if (typeof fm['title'] === 'string') {\n metadata.title = fm['title'];\n }\n if (typeof fm['description'] === 'string') {\n metadata.description = fm['description'];\n }\n if (Array.isArray(fm['authors'])) {\n metadata.authors = fm['authors'].filter(\n (a): a is string => typeof a === 'string',\n );\n }\n if (typeof fm['createdAt'] === 'string') {\n metadata.createdAt = fm['createdAt'];\n }\n if (Array.isArray(fm['tags'])) {\n metadata.tags = fm['tags'].filter(\n (t): t is string => typeof t === 'string',\n );\n }\n\n // Extract layout hints\n if (fm['layout'] && typeof fm['layout'] === 'object' && !Array.isArray(fm['layout'])) {\n const rawLayout = fm['layout'] as Record<string, unknown>;\n layout = {\n mode: isLayoutMode(rawLayout['mode']) ? rawLayout['mode'] : 'document',\n spacing: isLayoutSpacing(rawLayout['spacing']) ? rawLayout['spacing'] : 'normal',\n };\n if (typeof rawLayout['columns'] === 'number') {\n layout.columns = rawLayout['columns'];\n }\n if (typeof rawLayout['maxWidth'] === 'string') {\n layout.maxWidth = rawLayout['maxWidth'];\n }\n }\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n diagnostics.push(\n createDiagnostic(\n 'parser',\n 'error',\n 'FRONTMATTER_PARSE_ERROR',\n `Failed to parse frontmatter YAML: ${message}`,\n firstChild.position,\n ),\n );\n }\n }\n\n return { metadata, layout, frontmatterGlyphId };\n}\n\nfunction isLayoutMode(value: unknown): value is LayoutHints['mode'] {\n return value === 'document' || value === 'dashboard' || value === 'presentation';\n}\n\nfunction isLayoutSpacing(value: unknown): value is 'compact' | 'normal' | 'relaxed' {\n return value === 'compact' || value === 'normal' || value === 'relaxed';\n}\n\n// ─── Metadata Inference ──────────────────────────────────────\n\n/**\n * Infer metadata from content when not provided via frontmatter.\n * - title: from the first h1 heading\n * - description: from the first paragraph\n */\nfunction inferMetadata(metadata: DocumentMetadata, blocks: Block[]): void {\n if (!metadata.title) {\n const firstHeading = blocks.find(\n (b) => b.type === 'heading' && (b.data as Record<string, unknown>)['depth'] === 1,\n );\n if (firstHeading) {\n const data = firstHeading.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.title = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n\n if (!metadata.description) {\n const firstParagraph = blocks.find((b) => b.type === 'paragraph');\n if (firstParagraph) {\n const data = firstParagraph.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.description = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/inline.ts","../src/diagnostics.ts","../src/ast-to-ir.ts","../src/references.ts","../src/containers.ts","../src/compile.ts"],"names":["generateBlockId","componentSchemas","parseGlyphMarkdown","generateDocumentId","resolveBlockIdCollisions","ir","parseYaml"],"mappings":";;;;;;;;;;AAsEO,SAAS,uBAAuB,KAAA,EAAgC;AACrE,EAAA,MAAM,SAAuB,EAAC;AAE9B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,SAAA,GAAY,kBAAkB,IAA4B,CAAA;AAChE,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,IACvB;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,kBAAkB,IAAA,EAA+C;AACxE,EAAA,QAAQ,KAAK,IAAA;AAAM,IACjB,KAAK,MAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAA,EAAO,KAAK,KAAA,EAAM;AAAA,IAE3C,KAAK,QAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,QAAA,EAAU,sBAAA,CAAuB,IAAA,CAAK,QAAQ;AAAA,OAChD;AAAA,IAEF,KAAK,UAAA;AACH,MAAA,OAAO;AAAA,QACL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,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,SAAS,WAAA,EAAa;AACzB,IAAA,MAAM,iBAAiB,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,WAAW,CAAA;AAChE,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,MAAM,OAAO,cAAA,CAAe,IAAA;AAC5B,MAAA,IAAI,KAAK,QAAA,EAAU;AACjB,QAAA,QAAA,CAAS,WAAA,GAAc,IAAA,CAAK,QAAA,CACzB,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import type { InlineNode } from '@glyphjs/types';\n\n// ─── MDAST Phrasing Content Types ───────────────────────────\n// These are structural types matching the shapes from mdast,\n// avoiding a hard dependency on @types/mdast.\n\ninterface MdastText {\n type: 'text';\n value: string;\n}\n\ninterface MdastStrong {\n type: 'strong';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastEmphasis {\n type: 'emphasis';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastDelete {\n type: 'delete';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastInlineCode {\n type: 'inlineCode';\n value: string;\n}\n\ninterface MdastLink {\n type: 'link';\n url: string;\n title?: string | null;\n children: MdastPhrasingContent[];\n}\n\ninterface MdastImage {\n type: 'image';\n url: string;\n alt?: string | null;\n title?: string | null;\n}\n\ninterface MdastBreak {\n type: 'break';\n}\n\ntype MdastPhrasingContent =\n | MdastText\n | MdastStrong\n | MdastEmphasis\n | MdastDelete\n | MdastInlineCode\n | MdastLink\n | MdastImage\n | MdastBreak;\n\n// ─── Conversion ─────────────────────────────────────────────\n\n/**\n * Convert an array of MDAST phrasing content nodes to InlineNode[].\n *\n * Unknown node types are converted to text nodes with their string value\n * (if present) or skipped entirely.\n *\n * @param nodes - Raw MDAST phrasing content nodes (typed as unknown[] to avoid a hard @types/mdast dependency).\n * @returns Normalized InlineNode array suitable for inclusion in IR blocks.\n */\nexport function convertPhrasingContent(nodes: unknown[]): InlineNode[] {\n const result: InlineNode[] = [];\n\n for (const node of nodes) {\n const converted = convertSingleNode(node as MdastPhrasingContent);\n if (converted) {\n result.push(converted);\n }\n }\n\n return result;\n}\n\nfunction convertSingleNode(node: MdastPhrasingContent): InlineNode | null {\n switch (node.type) {\n case 'text':\n return { type: 'text', value: node.value };\n\n case 'strong':\n return {\n type: 'strong',\n children: convertPhrasingContent(node.children),\n };\n\n case 'emphasis':\n return {\n type: 'emphasis',\n children: convertPhrasingContent(node.children),\n };\n\n case 'delete':\n return {\n type: 'delete',\n children: convertPhrasingContent(node.children),\n };\n\n case 'inlineCode':\n return { type: 'inlineCode', value: node.value };\n\n case 'link': {\n const linkNode: InlineNode = {\n type: 'link',\n url: node.url,\n children: convertPhrasingContent(node.children),\n };\n if (node.title != null) {\n (linkNode as { type: 'link'; url: string; title?: string; children: InlineNode[] }).title =\n node.title;\n }\n return linkNode;\n }\n\n case 'image': {\n const imgNode: InlineNode = {\n type: 'image',\n src: node.url,\n };\n if (node.alt != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).alt = node.alt;\n }\n if (node.title != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).title =\n node.title;\n }\n return imgNode;\n }\n\n case 'break':\n return { type: 'break' };\n\n default: {\n // For unknown phrasing content types, attempt to extract a text value\n const unknown = node as Record<string, unknown>;\n if (typeof unknown['value'] === 'string') {\n return { type: 'text', value: unknown['value'] };\n }\n return null;\n }\n }\n}\n","import type { Diagnostic, DiagnosticSource, SourcePosition } from '@glyphjs/types';\n\n// ─── Diagnostic Creation Helpers ─────────────────────────────\n\n/**\n * Create a diagnostic with the given source, severity, message, and optional position.\n *\n * @param source - The subsystem that produced the diagnostic (e.g., 'compiler', 'parser', 'schema').\n * @param severity - Severity level: 'error', 'warning', or 'info'.\n * @param code - Machine-readable diagnostic code (e.g., 'YAML_PARSE_ERROR').\n * @param message - Human-readable description of the issue.\n * @param position - Optional source position where the issue was detected.\n * @param details - Optional structured details (e.g., Zod issue objects).\n * @returns A fully constructed Diagnostic object.\n */\nexport function createDiagnostic(\n source: DiagnosticSource,\n severity: Diagnostic['severity'],\n code: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n const diag: Diagnostic = { severity, code, message, source };\n if (position) {\n diag.position = position;\n }\n if (details !== undefined) {\n diag.details = details;\n }\n return diag;\n}\n\n/**\n * Create a schema validation error diagnostic.\n *\n * @param componentType - The ui: component type that failed validation (without the `ui:` prefix).\n * @param message - Concatenated validation error messages from Zod.\n * @param position - Optional source position of the component block.\n * @param details - Optional raw Zod issue objects.\n * @returns A Diagnostic with severity 'error' and code 'SCHEMA_VALIDATION_FAILED'.\n */\nexport function createSchemaError(\n componentType: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n return createDiagnostic(\n 'schema',\n 'error',\n 'SCHEMA_VALIDATION_FAILED',\n `Schema validation failed for ui:${componentType}: ${message}`,\n position,\n details,\n );\n}\n\n/**\n * Create an info diagnostic for unknown component types.\n *\n * @param componentType - The unrecognized component type (without the `ui:` prefix).\n * @param position - Optional source position of the component block.\n * @returns A Diagnostic with severity 'info' and code 'UNKNOWN_COMPONENT_TYPE'.\n */\nexport function createUnknownComponentInfo(\n componentType: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'compiler',\n 'info',\n 'UNKNOWN_COMPONENT_TYPE',\n `Unknown component type \"ui:${componentType}\". Block preserved as-is.`,\n position,\n );\n}\n\n/**\n * Create a diagnostic for YAML parse errors on ui: blocks.\n *\n * @param componentType - The ui: component type whose YAML failed to parse (without the `ui:` prefix).\n * @param yamlError - The YAML parser error message.\n * @param position - Optional source position of the fenced code block.\n * @returns A Diagnostic with severity 'error' and code 'YAML_PARSE_ERROR'.\n */\nexport function createYamlError(\n componentType: string,\n yamlError: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'parser',\n 'error',\n 'YAML_PARSE_ERROR',\n `YAML parse error in ui:${componentType}: ${yamlError}`,\n position,\n );\n}\n","import type {\n Block,\n BlockType,\n Diagnostic,\n GlyphUIBlock,\n MdastContentNode,\n SourcePosition,\n Reference,\n RawRef,\n ListData,\n ListItemData,\n InlineNode,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { componentSchemas } from '@glyphjs/schemas';\nimport { convertPhrasingContent } from './inline.js';\nimport { createSchemaError, createUnknownComponentInfo, createYamlError } from './diagnostics.js';\n\n// ─── Default Source Position ─────────────────────────────────\n\nconst DEFAULT_POSITION: SourcePosition = {\n start: { line: 0, column: 0 },\n end: { line: 0, column: 0 },\n};\n\n// ─── Translation Context ────────────────────────────────────\n\nexport interface TranslationContext {\n documentId: string;\n diagnostics: Diagnostic[];\n references: Reference[];\n blockIdMap: Map<string, string>;\n}\n\n// ─── AST Node Type Guards ────────────────────────────────────\n\nfunction isGlyphUIBlock(node: GlyphUIBlock | MdastContentNode): node is GlyphUIBlock {\n return node.type === 'glyphUIBlock';\n}\n\n// ─── Main Translation Entry Point ────────────────────────────\n\n/**\n * Translate a single AST child node (either a GlyphUIBlock or a standard\n * MDAST content node) into an IR Block.\n *\n * Returns null for nodes that should be skipped (e.g., yaml frontmatter).\n *\n * @param node - The AST node to translate (GlyphUIBlock or standard MDAST content node).\n * @param ctx - Translation context carrying document ID, accumulated diagnostics, and references.\n * @returns The translated IR Block, or null if the node should be skipped.\n */\nexport function translateNode(\n node: GlyphUIBlock | MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n if (isGlyphUIBlock(node)) {\n return translateGlyphUIBlock(node, ctx);\n }\n return translateMdastNode(node, ctx);\n}\n\n// ─── Glyph UI Block Translation ─────────────────────────────\n\nfunction translateGlyphUIBlock(node: GlyphUIBlock, ctx: TranslationContext): Block {\n const componentType = node.componentType;\n const blockType: BlockType = `ui:${componentType}`;\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n const blockDiagnostics: Diagnostic[] = [];\n\n // Determine block ID: user-assigned glyph-id or content-addressed\n const blockId = node.glyphId\n ? node.glyphId\n : generateBlockId(ctx.documentId, blockType, node.rawYaml);\n\n // Track the block ID mapping for reference resolution\n if (node.glyphId) {\n ctx.blockIdMap.set(node.glyphId, blockId);\n }\n\n // Handle YAML parse errors\n if (node.yamlError) {\n const diag = createYamlError(componentType, node.yamlError, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n\n // Determine block data\n let data: Record<string, unknown> = node.parsedData ?? {};\n\n // Validate against Zod schema if we have parsed data\n if (node.parsedData) {\n const schema = componentSchemas.get(componentType);\n if (schema) {\n const result = schema.safeParse(node.parsedData);\n if (!result.success) {\n const zodErrors = result.error.issues\n .map((issue) => `${issue.path.join('.')}: ${issue.message}`)\n .join('; ');\n const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n // Preserve the raw parsedData even on validation failure\n data = node.parsedData;\n } else {\n data = result.data as Record<string, unknown>;\n }\n } else {\n // Unknown component type — info diagnostic, preserve block as-is\n const diag = createUnknownComponentInfo(componentType, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n }\n\n // Process refs into references\n if (node.refs && node.refs.length > 0) {\n processRefs(node.refs, blockId, ctx);\n }\n\n const block: Block = {\n id: blockId,\n type: blockType,\n data,\n position,\n };\n\n if (node.interactive) {\n block.metadata = { interactive: true };\n }\n\n if (blockDiagnostics.length > 0) {\n block.diagnostics = blockDiagnostics;\n }\n\n return block;\n}\n\n// ─── Reference Processing ────────────────────────────────────\n\nfunction processRefs(refs: RawRef[], sourceBlockId: string, ctx: TranslationContext): void {\n for (const ref of refs) {\n const reference: Reference = {\n id: generateBlockId(ctx.documentId, 'ref', `${sourceBlockId}->${ref.target}`),\n type: (ref.type as Reference['type']) ?? 'navigates-to',\n sourceBlockId,\n targetBlockId: ref.target,\n };\n\n if (ref.label) {\n reference.label = ref.label;\n }\n if (ref.sourceAnchor) {\n reference.sourceAnchor = ref.sourceAnchor;\n }\n if (ref.targetAnchor) {\n reference.targetAnchor = ref.targetAnchor;\n }\n if (ref.bidirectional) {\n reference.bidirectional = ref.bidirectional;\n }\n\n // Mark as unresolved — we resolve later in the compile step\n reference.unresolved = true;\n\n ctx.references.push(reference);\n }\n}\n\n// ─── Standard MDAST Node Translation ─────────────────────────\n\nfunction translateMdastNode(node: MdastContentNode, ctx: TranslationContext): Block | null {\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n\n switch (node.type) {\n case 'heading':\n return translateHeading(node, position, ctx);\n case 'paragraph':\n return translateParagraph(node, position, ctx);\n case 'list':\n return translateList(node, position, ctx);\n case 'code':\n return translateCode(node, position, ctx);\n case 'blockquote':\n return translateBlockquote(node, position, ctx);\n case 'image':\n return translateImage(node, position, ctx);\n case 'thematicBreak':\n return translateThematicBreak(position, ctx);\n case 'html':\n return translateHtml(node, position, ctx);\n case 'yaml':\n // Frontmatter is handled separately in compile.ts; skip here\n return null;\n default:\n // Unknown MDAST node type — skip silently\n return null;\n }\n}\n\n// ─── Individual Node Translators ─────────────────────────────\n\nfunction translateHeading(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const depth = (node['depth'] as number) ?? 1;\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'heading', content),\n type: 'heading',\n data: { depth, children },\n position,\n };\n}\n\nfunction translateParagraph(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'paragraph', content),\n type: 'paragraph',\n data: { children },\n position,\n };\n}\n\nfunction translateList(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const ordered = (node['ordered'] as boolean) ?? false;\n const start = ordered ? ((node['start'] as number) ?? 1) : undefined;\n const items = translateListItems((node.children ?? []) as MdastContentNode[]);\n const content = listDataToText({ ordered, start, items });\n\n const data: ListData = { ordered, items };\n if (start !== undefined) {\n data.start = start;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'list', content),\n type: 'list',\n data,\n position,\n };\n}\n\nfunction translateListItems(listItemNodes: MdastContentNode[]): ListItemData[] {\n const items: ListItemData[] = [];\n\n for (const itemNode of listItemNodes) {\n if (itemNode.type !== 'listItem') continue;\n\n const itemChildren = (itemNode.children ?? []) as MdastContentNode[];\n let inlineChildren: InlineNode[] = [];\n let subList: ListData | undefined;\n\n for (const child of itemChildren) {\n if (child.type === 'paragraph') {\n inlineChildren = convertPhrasingContent((child.children ?? []) as unknown[]);\n } else if (child.type === 'list') {\n const subOrdered = (child['ordered'] as boolean) ?? false;\n const subStart = subOrdered ? ((child['start'] as number) ?? 1) : undefined;\n const subItems = translateListItems((child.children ?? []) as MdastContentNode[]);\n subList = { ordered: subOrdered, items: subItems };\n if (subStart !== undefined) {\n subList.start = subStart;\n }\n }\n }\n\n const item: ListItemData = { children: inlineChildren };\n if (subList) {\n item.subList = subList;\n }\n items.push(item);\n }\n\n return items;\n}\n\nfunction translateCode(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n const language = (node['lang'] as string) ?? undefined;\n const meta = (node['meta'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { value };\n if (language) {\n data['language'] = language;\n }\n if (meta) {\n data['meta'] = meta;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'code', value),\n type: 'code',\n data,\n position,\n };\n}\n\nfunction translateBlockquote(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n // Blockquote children are typically paragraphs — flatten their inline content\n const allInlineNodes: InlineNode[] = [];\n for (const child of (node.children ?? []) as MdastContentNode[]) {\n if (child.type === 'paragraph') {\n const inlines = convertPhrasingContent((child.children ?? []) as unknown[]);\n allInlineNodes.push(...inlines);\n }\n }\n const content = inlineNodesToText(allInlineNodes);\n\n return {\n id: generateBlockId(ctx.documentId, 'blockquote', content),\n type: 'blockquote',\n data: { children: allInlineNodes },\n position,\n };\n}\n\nfunction translateImage(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const src = (node['url'] as string) ?? '';\n const alt = (node['alt'] as string) ?? undefined;\n const title = (node['title'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { src };\n if (alt) {\n data['alt'] = alt;\n }\n if (title) {\n data['title'] = title;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'image', src),\n type: 'image',\n data,\n position,\n };\n}\n\nfunction translateThematicBreak(position: SourcePosition, ctx: TranslationContext): Block {\n return {\n id: generateBlockId(ctx.documentId, 'thematic-break', '---'),\n type: 'thematic-break',\n data: {},\n position,\n };\n}\n\nfunction translateHtml(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n\n return {\n id: generateBlockId(ctx.documentId, 'html', value),\n type: 'html',\n data: { value },\n position,\n };\n}\n\n// ─── Text Extraction Helpers ─────────────────────────────────\n\n/**\n * Extract plain text from InlineNode[] for content-addressing purposes.\n */\nfunction inlineNodesToText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToText(node.children);\n case 'link':\n return inlineNodesToText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n\n/**\n * Extract plain text from ListData for content-addressing purposes.\n */\nfunction listDataToText(data: ListData): string {\n return data.items\n .map((item) => {\n let text = inlineNodesToText(item.children);\n if (item.subList) {\n text += '\\n' + listDataToText(item.subList);\n }\n return text;\n })\n .join('\\n');\n}\n","import type {\n Block,\n Diagnostic,\n InlineNode,\n Reference,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Glyph Link Pattern ─────────────────────────────────────\n\n/**\n * Matches inline links of the form `[text](#glyph:block-id)`.\n * The captured group is the block ID after the `#glyph:` prefix.\n */\nconst GLYPH_LINK_PREFIX = '#glyph:';\n\n// ─── Inline Reference Scanning ──────────────────────────────\n\n/**\n * Scan a block's inline content for `[text](#glyph:block-id)` links\n * and create Reference objects for each match.\n *\n * @param block - The block whose inline data fields are scanned for glyph links.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Newly created (unresolved) Reference objects.\n */\nexport function extractInlineReferences(\n block: Block,\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n const inlineNodes = extractInlineNodes(block);\n\n for (const node of inlineNodes) {\n if (node.type === 'link' && node.url.startsWith(GLYPH_LINK_PREFIX)) {\n const targetBlockId = node.url.slice(GLYPH_LINK_PREFIX.length);\n if (!targetBlockId) continue;\n\n const label = inlineNodesToPlainText(node.children);\n\n const reference: Reference = {\n id: generateBlockId(documentId, 'ref', `${block.id}->${targetBlockId}`),\n type: 'navigates-to',\n sourceBlockId: block.id,\n targetBlockId,\n unresolved: true,\n };\n\n if (label) {\n reference.label = label;\n }\n\n references.push(reference);\n }\n }\n\n return references;\n}\n\n/**\n * Scan all blocks (including nested children) for inline `#glyph:` link references\n * and collect them.\n *\n * @param blocks - Top-level block array to scan recursively.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Aggregated array of unresolved Reference objects from all blocks.\n */\nexport function extractAllInlineReferences(\n blocks: Block[],\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n\n for (const block of blocks) {\n const blockRefs = extractInlineReferences(block, documentId);\n references.push(...blockRefs);\n\n // Also scan children (e.g. container blocks)\n if (block.children) {\n const childRefs = extractAllInlineReferences(block.children, documentId);\n references.push(...childRefs);\n }\n }\n\n return references;\n}\n\n// ─── Reference Resolution ────────────────────────────────────\n\n/**\n * Resolve references by checking if target block IDs exist in the document.\n * Marks unresolved references and adds warning diagnostics.\n *\n * Collects all block IDs including children (for container blocks).\n *\n * @param references - The reference array to resolve in-place (mutates `unresolved` flag).\n * @param blocks - All blocks in the document (used to build the known-ID set).\n * @param diagnostics - Accumulator for 'UNRESOLVED_REFERENCE' warnings.\n */\nexport function resolveReferences(\n references: Reference[],\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n const blockIdSet = collectAllBlockIds(blocks);\n\n for (const ref of references) {\n if (blockIdSet.has(ref.targetBlockId)) {\n ref.unresolved = false;\n } else {\n ref.unresolved = true;\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'UNRESOLVED_REFERENCE',\n `Reference target \"${ref.targetBlockId}\" was not found in the document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Collect all block IDs from blocks and their children recursively.\n */\nfunction collectAllBlockIds(blocks: Block[]): Set<string> {\n const ids = new Set<string>();\n for (const block of blocks) {\n ids.add(block.id);\n if (block.children) {\n for (const id of collectAllBlockIds(block.children)) {\n ids.add(id);\n }\n }\n }\n return ids;\n}\n\n// ─── Glyph-ID Uniqueness Validation ─────────────────────────\n\n/**\n * Validate that all user-assigned glyph-ids are unique within the document.\n * Emits error diagnostics for duplicates.\n *\n * @param blockIdMap - Map of user-assigned glyph-id to resolved block ID (from translation).\n * @param blocks - All blocks in the document (scanned to count occurrences).\n * @param diagnostics - Accumulator for 'DUPLICATE_GLYPH_ID' error diagnostics.\n */\nexport function validateGlyphIdUniqueness(\n blockIdMap: Map<string, string>,\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n // blockIdMap tracks glyphId -> blockId, but we need to detect duplicates\n // by scanning blocks for those whose id matches a glyph-id key\n const glyphIdOccurrences = new Map<string, number>();\n\n for (const glyphId of blockIdMap.keys()) {\n const count = countBlocksWithGlyphId(blocks, glyphId);\n glyphIdOccurrences.set(glyphId, count);\n }\n\n for (const [glyphId, count] of glyphIdOccurrences) {\n if (count > 1) {\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'error',\n 'DUPLICATE_GLYPH_ID',\n `Duplicate glyph-id \"${glyphId}\" found on ${String(count)} blocks. Block IDs must be unique within a document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Count how many blocks in the array have a given ID (which came from a glyph-id).\n */\nfunction countBlocksWithGlyphId(blocks: Block[], glyphId: string): number {\n let count = 0;\n for (const block of blocks) {\n if (block.id === glyphId) {\n count++;\n }\n }\n return count;\n}\n\n// ─── Inline Node Extraction Helpers ──────────────────────────\n\n/**\n * Extract all InlineNode arrays from a block's data field.\n * Handles heading, paragraph, blockquote, and list blocks.\n */\nfunction extractInlineNodes(block: Block): InlineNode[] {\n const data = block.data as Record<string, unknown>;\n const nodes: InlineNode[] = [];\n\n // Blocks with a direct `children` inline array\n if (Array.isArray(data['children'])) {\n nodes.push(...(data['children'] as InlineNode[]));\n }\n\n // List blocks: extract inline nodes from items\n if (Array.isArray(data['items'])) {\n for (const item of data['items'] as { children?: InlineNode[]; subList?: { items?: unknown[] } }[]) {\n if (Array.isArray(item.children)) {\n nodes.push(...item.children);\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Extract plain text from InlineNode[] for label purposes.\n */\nfunction inlineNodesToPlainText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToPlainText(node.children);\n case 'link':\n return inlineNodesToPlainText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n","import type { Block, Diagnostic } from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Container Block Compilation ─────────────────────────────\n\n/**\n * Process container blocks (ui:tabs and ui:steps) by recursively parsing\n * their content fields as Markdown into child Block[] arrays.\n *\n * This function mutates blocks in-place, populating their `children` field\n * and updating data entries with parsed child blocks.\n *\n * @param blocks - The top-level block array to scan for container blocks.\n * @param ctx - Translation context used for recursive compilation.\n */\nexport function compileContainerBlocks(\n blocks: Block[],\n ctx: TranslationContext,\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n compileTabsBlock(block, ctx);\n } else if (block.type === 'ui:steps') {\n compileStepsBlock(block, ctx);\n }\n }\n}\n\n// ─── Tabs Compilation ────────────────────────────────────────\n\nfunction compileTabsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs)) return;\n\n const allChildren: Block[] = [];\n\n for (const tab of tabs as { label?: string; content?: string }[]) {\n if (typeof tab.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(tab.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Steps Compilation ───────────────────────────────────────\n\nfunction compileStepsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps)) return;\n\n const allChildren: Block[] = [];\n\n for (const step of steps as { title?: string; status?: string; content?: string }[]) {\n if (typeof step.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(step.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Content Parsing Helper ──────────────────────────────────\n\n/**\n * Parse a Markdown content string into Block[] using the compiler pipeline.\n * Emits a warning diagnostic if nested ui: components are found (deferred to v2).\n */\nfunction parseContentToBlocks(\n content: string,\n parentBlock: Block,\n ctx: TranslationContext,\n): Block[] {\n const ast = parseGlyphMarkdown(content);\n const blocks: Block[] = [];\n\n for (const child of ast.children) {\n // Check for nested ui: components — warn and skip\n if (child.type === 'glyphUIBlock') {\n ctx.diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'NESTED_UI_COMPONENT',\n `Nested ui: component found inside container block \"${parentBlock.id}\". ` +\n `Nested ui: components inside tabs/steps are not supported in v1 and will be ignored.`,\n child.position,\n ),\n );\n continue;\n }\n\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n return blocks;\n}\n\n// ─── Nested UI Detection ─────────────────────────────────────\n\n/**\n * Check if content contains nested ui: blocks by looking for the pattern.\n * This is a quick heuristic check. The actual detection happens during parsing.\n *\n * @param content - Raw Markdown string to test for nested ui: fenced blocks.\n * @returns True if the content matches the `` ```ui: `` pattern.\n */\nexport function hasNestedUiBlocks(content: string): boolean {\n return /```ui:/m.test(content);\n}\n\n// ─── Validate Container Diagnostics ──────────────────────────\n\n/**\n * Post-process container blocks to ensure data consistency.\n * Called after container compilation is complete.\n *\n * @param blocks - The compiled block array to validate.\n * @param diagnostics - Accumulator for warning diagnostics (e.g., missing labels/titles).\n */\nexport function validateContainerBlocks(\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n validateTabsData(block, diagnostics);\n } else if (block.type === 'ui:steps') {\n validateStepsData(block, diagnostics);\n }\n }\n}\n\nfunction validateTabsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs) || tabs.length === 0) {\n return;\n }\n\n // Ensure each tab has a label\n for (const tab of tabs as { label?: string }[]) {\n if (!tab.label) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_TAB_LABEL',\n `A tab in block \"${block.id}\" is missing a label.`,\n block.position,\n ),\n );\n }\n }\n}\n\nfunction validateStepsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps) || steps.length === 0) {\n return;\n }\n\n // Ensure each step has a title\n for (const step of steps as { title?: string }[]) {\n if (!step.title) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_STEP_TITLE',\n `A step in block \"${block.id}\" is missing a title.`,\n block.position,\n ),\n );\n }\n }\n}\n","import type {\n GlyphIR,\n CompilationResult,\n Diagnostic,\n DocumentMetadata,\n LayoutHints,\n Block,\n Reference,\n MdastContentNode,\n} from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { generateDocumentId, resolveBlockIdCollisions } from '@glyphjs/ir';\nimport { parse as parseYaml } from 'yaml';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\nimport {\n extractAllInlineReferences,\n resolveReferences,\n validateGlyphIdUniqueness,\n} from './references.js';\nimport { compileContainerBlocks, validateContainerBlocks } from './containers.js';\n\n// ─── Public Interface ────────────────────────────────────────\n\nexport interface CompileOptions {\n /** Source file path, used for document ID generation. */\n filePath?: string;\n /** Explicit document ID override. */\n documentId?: string;\n}\n\n// ─── Main Compile Function ───────────────────────────────────\n\n/**\n * Compile a Markdown string into Glyph IR.\n *\n * Steps:\n * 1. Parse the markdown via `parseGlyphMarkdown`\n * 2. Extract frontmatter metadata and layout hints\n * 3. Walk the AST and translate each node to IR blocks\n * 4. Validate ui: blocks against Zod schemas\n * 5. Compile container blocks (ui:tabs, ui:steps) — recursively parse content\n * 6. Validate container block data\n * 7. Generate content-addressed block IDs\n * 8. Generate the document ID\n * 9. Resolve block ID collisions\n * 10. Validate glyph-id uniqueness\n * 11. Extract inline references from `[text](#glyph:block-id)` links\n * 12. Resolve all references (from refs arrays and inline links)\n * 13. Infer metadata from content if not in frontmatter\n * 14. Return CompilationResult with IR, diagnostics, and hasErrors flag\n *\n * Uses a collect-all-errors strategy: IR is always produced, even when errors exist.\n */\nexport function compile(markdown: string, options?: CompileOptions): CompilationResult {\n const diagnostics: Diagnostic[] = [];\n\n // 1. Parse the markdown into a Glyph AST\n const ast = parseGlyphMarkdown(markdown);\n\n // 2. Extract frontmatter\n const { metadata, layout, frontmatterGlyphId } = extractFrontmatter(ast.children, diagnostics);\n\n // 3. Generate document ID\n const documentId =\n options?.documentId ??\n generateDocumentId({\n glyphId: frontmatterGlyphId,\n filePath: options?.filePath,\n content: markdown,\n });\n\n // Set sourceFile from options if available\n if (options?.filePath && !metadata.sourceFile) {\n metadata.sourceFile = options.filePath;\n }\n\n // 4. Create translation context\n const references: Reference[] = [];\n const ctx: TranslationContext = {\n documentId,\n diagnostics,\n references,\n blockIdMap: new Map(),\n };\n\n // 5. Walk the AST and translate nodes\n const blocks: Block[] = [];\n for (const child of ast.children) {\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n // 6. Compile container blocks (ui:tabs, ui:steps) — recursively parse content fields\n compileContainerBlocks(blocks, ctx);\n\n // 7. Validate container block data\n validateContainerBlocks(blocks, diagnostics);\n\n // 8. Infer metadata from content if not in frontmatter\n inferMetadata(metadata, blocks);\n\n // 9. Resolve block ID collisions\n const blockIds = blocks.map((b) => b.id);\n const resolvedIds = resolveBlockIdCollisions(blockIds);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const resolvedId = resolvedIds[i];\n if (block && resolvedId) {\n block.id = resolvedId;\n }\n }\n\n // 10. Validate glyph-id uniqueness\n validateGlyphIdUniqueness(ctx.blockIdMap, blocks, diagnostics);\n\n // 11. Extract inline references from [text](#glyph:block-id) links\n const inlineRefs = extractAllInlineReferences(blocks, documentId);\n references.push(...inlineRefs);\n\n // 12. Resolve all references (from refs arrays and inline links)\n resolveReferences(references, blocks, diagnostics);\n\n // 13. Build the IR\n const ir: GlyphIR = {\n version: '1.0.0',\n id: documentId,\n metadata,\n blocks,\n references,\n layout,\n };\n\n const hasErrors = diagnostics.some((d) => d.severity === 'error');\n\n return { ir, diagnostics, hasErrors };\n}\n\n// ─── Frontmatter Extraction ─────────────────────────────────\n\ninterface FrontmatterResult {\n metadata: DocumentMetadata;\n layout: LayoutHints;\n frontmatterGlyphId?: string;\n}\n\nfunction extractFrontmatter(\n children: readonly unknown[],\n diagnostics: Diagnostic[],\n): FrontmatterResult {\n const metadata: DocumentMetadata = {};\n let layout: LayoutHints = { mode: 'document', spacing: 'normal' };\n let frontmatterGlyphId: string | undefined;\n\n // Look for yaml frontmatter node (always first child if present)\n const firstChild = children[0] as MdastContentNode | undefined;\n if (firstChild && firstChild.type === 'yaml' && typeof firstChild.value === 'string') {\n try {\n const parsed: unknown = parseYaml(firstChild.value);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n const fm = parsed as Record<string, unknown>;\n\n // Extract glyph-id\n if (typeof fm['glyph-id'] === 'string') {\n frontmatterGlyphId = fm['glyph-id'];\n }\n\n // Extract metadata fields\n if (typeof fm['title'] === 'string') {\n metadata.title = fm['title'];\n }\n if (typeof fm['description'] === 'string') {\n metadata.description = fm['description'];\n }\n if (Array.isArray(fm['authors'])) {\n metadata.authors = fm['authors'].filter(\n (a): a is string => typeof a === 'string',\n );\n }\n if (typeof fm['createdAt'] === 'string') {\n metadata.createdAt = fm['createdAt'];\n }\n if (Array.isArray(fm['tags'])) {\n metadata.tags = fm['tags'].filter(\n (t): t is string => typeof t === 'string',\n );\n }\n\n // Extract layout hints\n if (fm['layout'] && typeof fm['layout'] === 'object' && !Array.isArray(fm['layout'])) {\n const rawLayout = fm['layout'] as Record<string, unknown>;\n layout = {\n mode: isLayoutMode(rawLayout['mode']) ? rawLayout['mode'] : 'document',\n spacing: isLayoutSpacing(rawLayout['spacing']) ? rawLayout['spacing'] : 'normal',\n };\n if (typeof rawLayout['columns'] === 'number') {\n layout.columns = rawLayout['columns'];\n }\n if (typeof rawLayout['maxWidth'] === 'string') {\n layout.maxWidth = rawLayout['maxWidth'];\n }\n }\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n diagnostics.push(\n createDiagnostic(\n 'parser',\n 'error',\n 'FRONTMATTER_PARSE_ERROR',\n `Failed to parse frontmatter YAML: ${message}`,\n firstChild.position,\n ),\n );\n }\n }\n\n return { metadata, layout, frontmatterGlyphId };\n}\n\nfunction isLayoutMode(value: unknown): value is LayoutHints['mode'] {\n return value === 'document' || value === 'dashboard' || value === 'presentation';\n}\n\nfunction isLayoutSpacing(value: unknown): value is 'compact' | 'normal' | 'relaxed' {\n return value === 'compact' || value === 'normal' || value === 'relaxed';\n}\n\n// ─── Metadata Inference ──────────────────────────────────────\n\n/**\n * Infer metadata from content when not provided via frontmatter.\n * - title: from the first h1 heading\n * - description: from the first paragraph\n */\nfunction inferMetadata(metadata: DocumentMetadata, blocks: Block[]): void {\n if (!metadata.title) {\n const firstHeading = blocks.find(\n (b) => b.type === 'heading' && (b.data as Record<string, unknown>)['depth'] === 1,\n );\n if (firstHeading) {\n const data = firstHeading.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.title = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n\n if (!metadata.description) {\n const firstParagraph = blocks.find((b) => b.type === 'paragraph');\n if (firstParagraph) {\n const data = firstParagraph.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.description = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n}\n\n"]}
|
package/dist/index.js
CHANGED
|
@@ -147,9 +147,7 @@ function translateGlyphUIBlock(node, ctx) {
|
|
|
147
147
|
if (schema) {
|
|
148
148
|
const result = schema.safeParse(node.parsedData);
|
|
149
149
|
if (!result.success) {
|
|
150
|
-
const zodErrors = result.error.issues.map(
|
|
151
|
-
(issue) => `${issue.path.join(".")}: ${issue.message}`
|
|
152
|
-
).join("; ");
|
|
150
|
+
const zodErrors = result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
153
151
|
const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);
|
|
154
152
|
blockDiagnostics.push(diag);
|
|
155
153
|
ctx.diagnostics.push(diag);
|
|
@@ -172,6 +170,9 @@ function translateGlyphUIBlock(node, ctx) {
|
|
|
172
170
|
data,
|
|
173
171
|
position
|
|
174
172
|
};
|
|
173
|
+
if (node.interactive) {
|
|
174
|
+
block.metadata = { interactive: true };
|
|
175
|
+
}
|
|
175
176
|
if (blockDiagnostics.length > 0) {
|
|
176
177
|
block.diagnostics = blockDiagnostics;
|
|
177
178
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inline.ts","../src/diagnostics.ts","../src/ast-to-ir.ts","../src/references.ts","../src/containers.ts","../src/compile.ts"],"names":["generateBlockId","parseGlyphMarkdown","parseYaml"],"mappings":";;;;;;;;AAsEO,SAAS,uBAAuB,KAAA,EAAgC;AACrE,EAAA,MAAM,SAAuB,EAAC;AAE9B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,SAAA,GAAY,kBAAkB,IAA4B,CAAA;AAChE,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,IACvB;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,kBAAkB,IAAA,EAA+C;AACxE,EAAA,QAAQ,KAAK,IAAA;AAAM,IACjB,KAAK,MAAA;AACH,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,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,SAAS,WAAA,EAAa;AACzB,IAAA,MAAM,iBAAiB,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,WAAW,CAAA;AAChE,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,MAAM,OAAO,cAAA,CAAe,IAAA;AAC5B,MAAA,IAAI,KAAK,QAAA,EAAU;AACjB,QAAA,QAAA,CAAS,WAAA,GAAc,IAAA,CAAK,QAAA,CACzB,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import type { InlineNode } from '@glyphjs/types';\n\n// ─── MDAST Phrasing Content Types ───────────────────────────\n// These are structural types matching the shapes from mdast,\n// avoiding a hard dependency on @types/mdast.\n\ninterface MdastText {\n type: 'text';\n value: string;\n}\n\ninterface MdastStrong {\n type: 'strong';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastEmphasis {\n type: 'emphasis';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastDelete {\n type: 'delete';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastInlineCode {\n type: 'inlineCode';\n value: string;\n}\n\ninterface MdastLink {\n type: 'link';\n url: string;\n title?: string | null;\n children: MdastPhrasingContent[];\n}\n\ninterface MdastImage {\n type: 'image';\n url: string;\n alt?: string | null;\n title?: string | null;\n}\n\ninterface MdastBreak {\n type: 'break';\n}\n\ntype MdastPhrasingContent =\n | MdastText\n | MdastStrong\n | MdastEmphasis\n | MdastDelete\n | MdastInlineCode\n | MdastLink\n | MdastImage\n | MdastBreak;\n\n// ─── Conversion ─────────────────────────────────────────────\n\n/**\n * Convert an array of MDAST phrasing content nodes to InlineNode[].\n *\n * Unknown node types are converted to text nodes with their string value\n * (if present) or skipped entirely.\n *\n * @param nodes - Raw MDAST phrasing content nodes (typed as unknown[] to avoid a hard @types/mdast dependency).\n * @returns Normalized InlineNode array suitable for inclusion in IR blocks.\n */\nexport function convertPhrasingContent(nodes: unknown[]): InlineNode[] {\n const result: InlineNode[] = [];\n\n for (const node of nodes) {\n const converted = convertSingleNode(node as MdastPhrasingContent);\n if (converted) {\n result.push(converted);\n }\n }\n\n return result;\n}\n\nfunction convertSingleNode(node: MdastPhrasingContent): InlineNode | null {\n switch (node.type) {\n case 'text':\n return { type: 'text', value: node.value };\n\n case 'strong':\n return {\n type: 'strong',\n children: convertPhrasingContent(node.children),\n };\n\n case 'emphasis':\n return {\n type: 'emphasis',\n children: convertPhrasingContent(node.children),\n };\n\n case 'delete':\n return {\n type: 'delete',\n children: convertPhrasingContent(node.children),\n };\n\n case 'inlineCode':\n return { type: 'inlineCode', value: node.value };\n\n case 'link': {\n const linkNode: InlineNode = {\n type: 'link',\n url: node.url,\n children: convertPhrasingContent(node.children),\n };\n if (node.title != null) {\n (linkNode as { type: 'link'; url: string; title?: string; children: InlineNode[] }).title =\n node.title;\n }\n return linkNode;\n }\n\n case 'image': {\n const imgNode: InlineNode = {\n type: 'image',\n src: node.url,\n };\n if (node.alt != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).alt = node.alt;\n }\n if (node.title != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).title =\n node.title;\n }\n return imgNode;\n }\n\n case 'break':\n return { type: 'break' };\n\n default: {\n // For unknown phrasing content types, attempt to extract a text value\n const unknown = node as Record<string, unknown>;\n if (typeof unknown['value'] === 'string') {\n return { type: 'text', value: unknown['value'] };\n }\n return null;\n }\n }\n}\n","import type { Diagnostic, DiagnosticSource, SourcePosition } from '@glyphjs/types';\n\n// ─── Diagnostic Creation Helpers ─────────────────────────────\n\n/**\n * Create a diagnostic with the given source, severity, message, and optional position.\n *\n * @param source - The subsystem that produced the diagnostic (e.g., 'compiler', 'parser', 'schema').\n * @param severity - Severity level: 'error', 'warning', or 'info'.\n * @param code - Machine-readable diagnostic code (e.g., 'YAML_PARSE_ERROR').\n * @param message - Human-readable description of the issue.\n * @param position - Optional source position where the issue was detected.\n * @param details - Optional structured details (e.g., Zod issue objects).\n * @returns A fully constructed Diagnostic object.\n */\nexport function createDiagnostic(\n source: DiagnosticSource,\n severity: Diagnostic['severity'],\n code: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n const diag: Diagnostic = { severity, code, message, source };\n if (position) {\n diag.position = position;\n }\n if (details !== undefined) {\n diag.details = details;\n }\n return diag;\n}\n\n/**\n * Create a schema validation error diagnostic.\n *\n * @param componentType - The ui: component type that failed validation (without the `ui:` prefix).\n * @param message - Concatenated validation error messages from Zod.\n * @param position - Optional source position of the component block.\n * @param details - Optional raw Zod issue objects.\n * @returns A Diagnostic with severity 'error' and code 'SCHEMA_VALIDATION_FAILED'.\n */\nexport function createSchemaError(\n componentType: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n return createDiagnostic(\n 'schema',\n 'error',\n 'SCHEMA_VALIDATION_FAILED',\n `Schema validation failed for ui:${componentType}: ${message}`,\n position,\n details,\n );\n}\n\n/**\n * Create an info diagnostic for unknown component types.\n *\n * @param componentType - The unrecognized component type (without the `ui:` prefix).\n * @param position - Optional source position of the component block.\n * @returns A Diagnostic with severity 'info' and code 'UNKNOWN_COMPONENT_TYPE'.\n */\nexport function createUnknownComponentInfo(\n componentType: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'compiler',\n 'info',\n 'UNKNOWN_COMPONENT_TYPE',\n `Unknown component type \"ui:${componentType}\". Block preserved as-is.`,\n position,\n );\n}\n\n/**\n * Create a diagnostic for YAML parse errors on ui: blocks.\n *\n * @param componentType - The ui: component type whose YAML failed to parse (without the `ui:` prefix).\n * @param yamlError - The YAML parser error message.\n * @param position - Optional source position of the fenced code block.\n * @returns A Diagnostic with severity 'error' and code 'YAML_PARSE_ERROR'.\n */\nexport function createYamlError(\n componentType: string,\n yamlError: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'parser',\n 'error',\n 'YAML_PARSE_ERROR',\n `YAML parse error in ui:${componentType}: ${yamlError}`,\n position,\n );\n}\n","import type {\n Block,\n BlockType,\n Diagnostic,\n GlyphUIBlock,\n MdastContentNode,\n SourcePosition,\n Reference,\n RawRef,\n ListData,\n ListItemData,\n InlineNode,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { componentSchemas } from '@glyphjs/schemas';\nimport { convertPhrasingContent } from './inline.js';\nimport {\n createSchemaError,\n createUnknownComponentInfo,\n createYamlError,\n} from './diagnostics.js';\n\n// ─── Default Source Position ─────────────────────────────────\n\nconst DEFAULT_POSITION: SourcePosition = {\n start: { line: 0, column: 0 },\n end: { line: 0, column: 0 },\n};\n\n// ─── Translation Context ────────────────────────────────────\n\nexport interface TranslationContext {\n documentId: string;\n diagnostics: Diagnostic[];\n references: Reference[];\n blockIdMap: Map<string, string>;\n}\n\n// ─── AST Node Type Guards ────────────────────────────────────\n\nfunction isGlyphUIBlock(node: GlyphUIBlock | MdastContentNode): node is GlyphUIBlock {\n return node.type === 'glyphUIBlock';\n}\n\n// ─── Main Translation Entry Point ────────────────────────────\n\n/**\n * Translate a single AST child node (either a GlyphUIBlock or a standard\n * MDAST content node) into an IR Block.\n *\n * Returns null for nodes that should be skipped (e.g., yaml frontmatter).\n *\n * @param node - The AST node to translate (GlyphUIBlock or standard MDAST content node).\n * @param ctx - Translation context carrying document ID, accumulated diagnostics, and references.\n * @returns The translated IR Block, or null if the node should be skipped.\n */\nexport function translateNode(\n node: GlyphUIBlock | MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n if (isGlyphUIBlock(node)) {\n return translateGlyphUIBlock(node, ctx);\n }\n return translateMdastNode(node, ctx);\n}\n\n// ─── Glyph UI Block Translation ─────────────────────────────\n\nfunction translateGlyphUIBlock(\n node: GlyphUIBlock,\n ctx: TranslationContext,\n): Block {\n const componentType = node.componentType;\n const blockType: BlockType = `ui:${componentType}`;\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n const blockDiagnostics: Diagnostic[] = [];\n\n // Determine block ID: user-assigned glyph-id or content-addressed\n const blockId = node.glyphId\n ? node.glyphId\n : generateBlockId(ctx.documentId, blockType, node.rawYaml);\n\n // Track the block ID mapping for reference resolution\n if (node.glyphId) {\n ctx.blockIdMap.set(node.glyphId, blockId);\n }\n\n // Handle YAML parse errors\n if (node.yamlError) {\n const diag = createYamlError(componentType, node.yamlError, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n\n // Determine block data\n let data: Record<string, unknown> = node.parsedData ?? {};\n\n // Validate against Zod schema if we have parsed data\n if (node.parsedData) {\n const schema = componentSchemas.get(componentType);\n if (schema) {\n const result = schema.safeParse(node.parsedData);\n if (!result.success) {\n const zodErrors = result.error.issues.map(\n (issue) => `${issue.path.join('.')}: ${issue.message}`,\n ).join('; ');\n const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n // Preserve the raw parsedData even on validation failure\n data = node.parsedData;\n } else {\n data = result.data as Record<string, unknown>;\n }\n } else {\n // Unknown component type — info diagnostic, preserve block as-is\n const diag = createUnknownComponentInfo(componentType, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n }\n\n // Process refs into references\n if (node.refs && node.refs.length > 0) {\n processRefs(node.refs, blockId, ctx);\n }\n\n const block: Block = {\n id: blockId,\n type: blockType,\n data,\n position,\n };\n\n if (blockDiagnostics.length > 0) {\n block.diagnostics = blockDiagnostics;\n }\n\n return block;\n}\n\n// ─── Reference Processing ────────────────────────────────────\n\nfunction processRefs(\n refs: RawRef[],\n sourceBlockId: string,\n ctx: TranslationContext,\n): void {\n for (const ref of refs) {\n const reference: Reference = {\n id: generateBlockId(ctx.documentId, 'ref', `${sourceBlockId}->${ref.target}`),\n type: (ref.type as Reference['type']) ?? 'navigates-to',\n sourceBlockId,\n targetBlockId: ref.target,\n };\n\n if (ref.label) {\n reference.label = ref.label;\n }\n if (ref.sourceAnchor) {\n reference.sourceAnchor = ref.sourceAnchor;\n }\n if (ref.targetAnchor) {\n reference.targetAnchor = ref.targetAnchor;\n }\n if (ref.bidirectional) {\n reference.bidirectional = ref.bidirectional;\n }\n\n // Mark as unresolved — we resolve later in the compile step\n reference.unresolved = true;\n\n ctx.references.push(reference);\n }\n}\n\n// ─── Standard MDAST Node Translation ─────────────────────────\n\nfunction translateMdastNode(\n node: MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n\n switch (node.type) {\n case 'heading':\n return translateHeading(node, position, ctx);\n case 'paragraph':\n return translateParagraph(node, position, ctx);\n case 'list':\n return translateList(node, position, ctx);\n case 'code':\n return translateCode(node, position, ctx);\n case 'blockquote':\n return translateBlockquote(node, position, ctx);\n case 'image':\n return translateImage(node, position, ctx);\n case 'thematicBreak':\n return translateThematicBreak(position, ctx);\n case 'html':\n return translateHtml(node, position, ctx);\n case 'yaml':\n // Frontmatter is handled separately in compile.ts; skip here\n return null;\n default:\n // Unknown MDAST node type — skip silently\n return null;\n }\n}\n\n// ─── Individual Node Translators ─────────────────────────────\n\nfunction translateHeading(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const depth = (node['depth'] as number) ?? 1;\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'heading', content),\n type: 'heading',\n data: { depth, children },\n position,\n };\n}\n\nfunction translateParagraph(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'paragraph', content),\n type: 'paragraph',\n data: { children },\n position,\n };\n}\n\nfunction translateList(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const ordered = (node['ordered'] as boolean) ?? false;\n const start = ordered ? ((node['start'] as number) ?? 1) : undefined;\n const items = translateListItems((node.children ?? []) as MdastContentNode[]);\n const content = listDataToText({ ordered, start, items });\n\n const data: ListData = { ordered, items };\n if (start !== undefined) {\n data.start = start;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'list', content),\n type: 'list',\n data,\n position,\n };\n}\n\nfunction translateListItems(listItemNodes: MdastContentNode[]): ListItemData[] {\n const items: ListItemData[] = [];\n\n for (const itemNode of listItemNodes) {\n if (itemNode.type !== 'listItem') continue;\n\n const itemChildren = (itemNode.children ?? []) as MdastContentNode[];\n let inlineChildren: InlineNode[] = [];\n let subList: ListData | undefined;\n\n for (const child of itemChildren) {\n if (child.type === 'paragraph') {\n inlineChildren = convertPhrasingContent((child.children ?? []) as unknown[]);\n } else if (child.type === 'list') {\n const subOrdered = (child['ordered'] as boolean) ?? false;\n const subStart = subOrdered ? ((child['start'] as number) ?? 1) : undefined;\n const subItems = translateListItems((child.children ?? []) as MdastContentNode[]);\n subList = { ordered: subOrdered, items: subItems };\n if (subStart !== undefined) {\n subList.start = subStart;\n }\n }\n }\n\n const item: ListItemData = { children: inlineChildren };\n if (subList) {\n item.subList = subList;\n }\n items.push(item);\n }\n\n return items;\n}\n\nfunction translateCode(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n const language = (node['lang'] as string) ?? undefined;\n const meta = (node['meta'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { value };\n if (language) {\n data['language'] = language;\n }\n if (meta) {\n data['meta'] = meta;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'code', value),\n type: 'code',\n data,\n position,\n };\n}\n\nfunction translateBlockquote(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n // Blockquote children are typically paragraphs — flatten their inline content\n const allInlineNodes: InlineNode[] = [];\n for (const child of (node.children ?? []) as MdastContentNode[]) {\n if (child.type === 'paragraph') {\n const inlines = convertPhrasingContent((child.children ?? []) as unknown[]);\n allInlineNodes.push(...inlines);\n }\n }\n const content = inlineNodesToText(allInlineNodes);\n\n return {\n id: generateBlockId(ctx.documentId, 'blockquote', content),\n type: 'blockquote',\n data: { children: allInlineNodes },\n position,\n };\n}\n\nfunction translateImage(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const src = (node['url'] as string) ?? '';\n const alt = (node['alt'] as string) ?? undefined;\n const title = (node['title'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { src };\n if (alt) {\n data['alt'] = alt;\n }\n if (title) {\n data['title'] = title;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'image', src),\n type: 'image',\n data,\n position,\n };\n}\n\nfunction translateThematicBreak(\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n return {\n id: generateBlockId(ctx.documentId, 'thematic-break', '---'),\n type: 'thematic-break',\n data: {},\n position,\n };\n}\n\nfunction translateHtml(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n\n return {\n id: generateBlockId(ctx.documentId, 'html', value),\n type: 'html',\n data: { value },\n position,\n };\n}\n\n// ─── Text Extraction Helpers ─────────────────────────────────\n\n/**\n * Extract plain text from InlineNode[] for content-addressing purposes.\n */\nfunction inlineNodesToText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToText(node.children);\n case 'link':\n return inlineNodesToText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n\n/**\n * Extract plain text from ListData for content-addressing purposes.\n */\nfunction listDataToText(data: ListData): string {\n return data.items\n .map((item) => {\n let text = inlineNodesToText(item.children);\n if (item.subList) {\n text += '\\n' + listDataToText(item.subList);\n }\n return text;\n })\n .join('\\n');\n}\n","import type {\n Block,\n Diagnostic,\n InlineNode,\n Reference,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Glyph Link Pattern ─────────────────────────────────────\n\n/**\n * Matches inline links of the form `[text](#glyph:block-id)`.\n * The captured group is the block ID after the `#glyph:` prefix.\n */\nconst GLYPH_LINK_PREFIX = '#glyph:';\n\n// ─── Inline Reference Scanning ──────────────────────────────\n\n/**\n * Scan a block's inline content for `[text](#glyph:block-id)` links\n * and create Reference objects for each match.\n *\n * @param block - The block whose inline data fields are scanned for glyph links.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Newly created (unresolved) Reference objects.\n */\nexport function extractInlineReferences(\n block: Block,\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n const inlineNodes = extractInlineNodes(block);\n\n for (const node of inlineNodes) {\n if (node.type === 'link' && node.url.startsWith(GLYPH_LINK_PREFIX)) {\n const targetBlockId = node.url.slice(GLYPH_LINK_PREFIX.length);\n if (!targetBlockId) continue;\n\n const label = inlineNodesToPlainText(node.children);\n\n const reference: Reference = {\n id: generateBlockId(documentId, 'ref', `${block.id}->${targetBlockId}`),\n type: 'navigates-to',\n sourceBlockId: block.id,\n targetBlockId,\n unresolved: true,\n };\n\n if (label) {\n reference.label = label;\n }\n\n references.push(reference);\n }\n }\n\n return references;\n}\n\n/**\n * Scan all blocks (including nested children) for inline `#glyph:` link references\n * and collect them.\n *\n * @param blocks - Top-level block array to scan recursively.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Aggregated array of unresolved Reference objects from all blocks.\n */\nexport function extractAllInlineReferences(\n blocks: Block[],\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n\n for (const block of blocks) {\n const blockRefs = extractInlineReferences(block, documentId);\n references.push(...blockRefs);\n\n // Also scan children (e.g. container blocks)\n if (block.children) {\n const childRefs = extractAllInlineReferences(block.children, documentId);\n references.push(...childRefs);\n }\n }\n\n return references;\n}\n\n// ─── Reference Resolution ────────────────────────────────────\n\n/**\n * Resolve references by checking if target block IDs exist in the document.\n * Marks unresolved references and adds warning diagnostics.\n *\n * Collects all block IDs including children (for container blocks).\n *\n * @param references - The reference array to resolve in-place (mutates `unresolved` flag).\n * @param blocks - All blocks in the document (used to build the known-ID set).\n * @param diagnostics - Accumulator for 'UNRESOLVED_REFERENCE' warnings.\n */\nexport function resolveReferences(\n references: Reference[],\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n const blockIdSet = collectAllBlockIds(blocks);\n\n for (const ref of references) {\n if (blockIdSet.has(ref.targetBlockId)) {\n ref.unresolved = false;\n } else {\n ref.unresolved = true;\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'UNRESOLVED_REFERENCE',\n `Reference target \"${ref.targetBlockId}\" was not found in the document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Collect all block IDs from blocks and their children recursively.\n */\nfunction collectAllBlockIds(blocks: Block[]): Set<string> {\n const ids = new Set<string>();\n for (const block of blocks) {\n ids.add(block.id);\n if (block.children) {\n for (const id of collectAllBlockIds(block.children)) {\n ids.add(id);\n }\n }\n }\n return ids;\n}\n\n// ─── Glyph-ID Uniqueness Validation ─────────────────────────\n\n/**\n * Validate that all user-assigned glyph-ids are unique within the document.\n * Emits error diagnostics for duplicates.\n *\n * @param blockIdMap - Map of user-assigned glyph-id to resolved block ID (from translation).\n * @param blocks - All blocks in the document (scanned to count occurrences).\n * @param diagnostics - Accumulator for 'DUPLICATE_GLYPH_ID' error diagnostics.\n */\nexport function validateGlyphIdUniqueness(\n blockIdMap: Map<string, string>,\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n // blockIdMap tracks glyphId -> blockId, but we need to detect duplicates\n // by scanning blocks for those whose id matches a glyph-id key\n const glyphIdOccurrences = new Map<string, number>();\n\n for (const glyphId of blockIdMap.keys()) {\n const count = countBlocksWithGlyphId(blocks, glyphId);\n glyphIdOccurrences.set(glyphId, count);\n }\n\n for (const [glyphId, count] of glyphIdOccurrences) {\n if (count > 1) {\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'error',\n 'DUPLICATE_GLYPH_ID',\n `Duplicate glyph-id \"${glyphId}\" found on ${String(count)} blocks. Block IDs must be unique within a document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Count how many blocks in the array have a given ID (which came from a glyph-id).\n */\nfunction countBlocksWithGlyphId(blocks: Block[], glyphId: string): number {\n let count = 0;\n for (const block of blocks) {\n if (block.id === glyphId) {\n count++;\n }\n }\n return count;\n}\n\n// ─── Inline Node Extraction Helpers ──────────────────────────\n\n/**\n * Extract all InlineNode arrays from a block's data field.\n * Handles heading, paragraph, blockquote, and list blocks.\n */\nfunction extractInlineNodes(block: Block): InlineNode[] {\n const data = block.data as Record<string, unknown>;\n const nodes: InlineNode[] = [];\n\n // Blocks with a direct `children` inline array\n if (Array.isArray(data['children'])) {\n nodes.push(...(data['children'] as InlineNode[]));\n }\n\n // List blocks: extract inline nodes from items\n if (Array.isArray(data['items'])) {\n for (const item of data['items'] as { children?: InlineNode[]; subList?: { items?: unknown[] } }[]) {\n if (Array.isArray(item.children)) {\n nodes.push(...item.children);\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Extract plain text from InlineNode[] for label purposes.\n */\nfunction inlineNodesToPlainText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToPlainText(node.children);\n case 'link':\n return inlineNodesToPlainText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n","import type { Block, Diagnostic } from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Container Block Compilation ─────────────────────────────\n\n/**\n * Process container blocks (ui:tabs and ui:steps) by recursively parsing\n * their content fields as Markdown into child Block[] arrays.\n *\n * This function mutates blocks in-place, populating their `children` field\n * and updating data entries with parsed child blocks.\n *\n * @param blocks - The top-level block array to scan for container blocks.\n * @param ctx - Translation context used for recursive compilation.\n */\nexport function compileContainerBlocks(\n blocks: Block[],\n ctx: TranslationContext,\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n compileTabsBlock(block, ctx);\n } else if (block.type === 'ui:steps') {\n compileStepsBlock(block, ctx);\n }\n }\n}\n\n// ─── Tabs Compilation ────────────────────────────────────────\n\nfunction compileTabsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs)) return;\n\n const allChildren: Block[] = [];\n\n for (const tab of tabs as { label?: string; content?: string }[]) {\n if (typeof tab.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(tab.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Steps Compilation ───────────────────────────────────────\n\nfunction compileStepsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps)) return;\n\n const allChildren: Block[] = [];\n\n for (const step of steps as { title?: string; status?: string; content?: string }[]) {\n if (typeof step.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(step.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Content Parsing Helper ──────────────────────────────────\n\n/**\n * Parse a Markdown content string into Block[] using the compiler pipeline.\n * Emits a warning diagnostic if nested ui: components are found (deferred to v2).\n */\nfunction parseContentToBlocks(\n content: string,\n parentBlock: Block,\n ctx: TranslationContext,\n): Block[] {\n const ast = parseGlyphMarkdown(content);\n const blocks: Block[] = [];\n\n for (const child of ast.children) {\n // Check for nested ui: components — warn and skip\n if (child.type === 'glyphUIBlock') {\n ctx.diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'NESTED_UI_COMPONENT',\n `Nested ui: component found inside container block \"${parentBlock.id}\". ` +\n `Nested ui: components inside tabs/steps are not supported in v1 and will be ignored.`,\n child.position,\n ),\n );\n continue;\n }\n\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n return blocks;\n}\n\n// ─── Nested UI Detection ─────────────────────────────────────\n\n/**\n * Check if content contains nested ui: blocks by looking for the pattern.\n * This is a quick heuristic check. The actual detection happens during parsing.\n *\n * @param content - Raw Markdown string to test for nested ui: fenced blocks.\n * @returns True if the content matches the `` ```ui: `` pattern.\n */\nexport function hasNestedUiBlocks(content: string): boolean {\n return /```ui:/m.test(content);\n}\n\n// ─── Validate Container Diagnostics ──────────────────────────\n\n/**\n * Post-process container blocks to ensure data consistency.\n * Called after container compilation is complete.\n *\n * @param blocks - The compiled block array to validate.\n * @param diagnostics - Accumulator for warning diagnostics (e.g., missing labels/titles).\n */\nexport function validateContainerBlocks(\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n validateTabsData(block, diagnostics);\n } else if (block.type === 'ui:steps') {\n validateStepsData(block, diagnostics);\n }\n }\n}\n\nfunction validateTabsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs) || tabs.length === 0) {\n return;\n }\n\n // Ensure each tab has a label\n for (const tab of tabs as { label?: string }[]) {\n if (!tab.label) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_TAB_LABEL',\n `A tab in block \"${block.id}\" is missing a label.`,\n block.position,\n ),\n );\n }\n }\n}\n\nfunction validateStepsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps) || steps.length === 0) {\n return;\n }\n\n // Ensure each step has a title\n for (const step of steps as { title?: string }[]) {\n if (!step.title) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_STEP_TITLE',\n `A step in block \"${block.id}\" is missing a title.`,\n block.position,\n ),\n );\n }\n }\n}\n","import type {\n GlyphIR,\n CompilationResult,\n Diagnostic,\n DocumentMetadata,\n LayoutHints,\n Block,\n Reference,\n MdastContentNode,\n} from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { generateDocumentId, resolveBlockIdCollisions } from '@glyphjs/ir';\nimport { parse as parseYaml } from 'yaml';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\nimport {\n extractAllInlineReferences,\n resolveReferences,\n validateGlyphIdUniqueness,\n} from './references.js';\nimport { compileContainerBlocks, validateContainerBlocks } from './containers.js';\n\n// ─── Public Interface ────────────────────────────────────────\n\nexport interface CompileOptions {\n /** Source file path, used for document ID generation. */\n filePath?: string;\n /** Explicit document ID override. */\n documentId?: string;\n}\n\n// ─── Main Compile Function ───────────────────────────────────\n\n/**\n * Compile a Markdown string into Glyph IR.\n *\n * Steps:\n * 1. Parse the markdown via `parseGlyphMarkdown`\n * 2. Extract frontmatter metadata and layout hints\n * 3. Walk the AST and translate each node to IR blocks\n * 4. Validate ui: blocks against Zod schemas\n * 5. Compile container blocks (ui:tabs, ui:steps) — recursively parse content\n * 6. Validate container block data\n * 7. Generate content-addressed block IDs\n * 8. Generate the document ID\n * 9. Resolve block ID collisions\n * 10. Validate glyph-id uniqueness\n * 11. Extract inline references from `[text](#glyph:block-id)` links\n * 12. Resolve all references (from refs arrays and inline links)\n * 13. Infer metadata from content if not in frontmatter\n * 14. Return CompilationResult with IR, diagnostics, and hasErrors flag\n *\n * Uses a collect-all-errors strategy: IR is always produced, even when errors exist.\n */\nexport function compile(markdown: string, options?: CompileOptions): CompilationResult {\n const diagnostics: Diagnostic[] = [];\n\n // 1. Parse the markdown into a Glyph AST\n const ast = parseGlyphMarkdown(markdown);\n\n // 2. Extract frontmatter\n const { metadata, layout, frontmatterGlyphId } = extractFrontmatter(ast.children, diagnostics);\n\n // 3. Generate document ID\n const documentId =\n options?.documentId ??\n generateDocumentId({\n glyphId: frontmatterGlyphId,\n filePath: options?.filePath,\n content: markdown,\n });\n\n // Set sourceFile from options if available\n if (options?.filePath && !metadata.sourceFile) {\n metadata.sourceFile = options.filePath;\n }\n\n // 4. Create translation context\n const references: Reference[] = [];\n const ctx: TranslationContext = {\n documentId,\n diagnostics,\n references,\n blockIdMap: new Map(),\n };\n\n // 5. Walk the AST and translate nodes\n const blocks: Block[] = [];\n for (const child of ast.children) {\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n // 6. Compile container blocks (ui:tabs, ui:steps) — recursively parse content fields\n compileContainerBlocks(blocks, ctx);\n\n // 7. Validate container block data\n validateContainerBlocks(blocks, diagnostics);\n\n // 8. Infer metadata from content if not in frontmatter\n inferMetadata(metadata, blocks);\n\n // 9. Resolve block ID collisions\n const blockIds = blocks.map((b) => b.id);\n const resolvedIds = resolveBlockIdCollisions(blockIds);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const resolvedId = resolvedIds[i];\n if (block && resolvedId) {\n block.id = resolvedId;\n }\n }\n\n // 10. Validate glyph-id uniqueness\n validateGlyphIdUniqueness(ctx.blockIdMap, blocks, diagnostics);\n\n // 11. Extract inline references from [text](#glyph:block-id) links\n const inlineRefs = extractAllInlineReferences(blocks, documentId);\n references.push(...inlineRefs);\n\n // 12. Resolve all references (from refs arrays and inline links)\n resolveReferences(references, blocks, diagnostics);\n\n // 13. Build the IR\n const ir: GlyphIR = {\n version: '1.0.0',\n id: documentId,\n metadata,\n blocks,\n references,\n layout,\n };\n\n const hasErrors = diagnostics.some((d) => d.severity === 'error');\n\n return { ir, diagnostics, hasErrors };\n}\n\n// ─── Frontmatter Extraction ─────────────────────────────────\n\ninterface FrontmatterResult {\n metadata: DocumentMetadata;\n layout: LayoutHints;\n frontmatterGlyphId?: string;\n}\n\nfunction extractFrontmatter(\n children: readonly unknown[],\n diagnostics: Diagnostic[],\n): FrontmatterResult {\n const metadata: DocumentMetadata = {};\n let layout: LayoutHints = { mode: 'document', spacing: 'normal' };\n let frontmatterGlyphId: string | undefined;\n\n // Look for yaml frontmatter node (always first child if present)\n const firstChild = children[0] as MdastContentNode | undefined;\n if (firstChild && firstChild.type === 'yaml' && typeof firstChild.value === 'string') {\n try {\n const parsed: unknown = parseYaml(firstChild.value);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n const fm = parsed as Record<string, unknown>;\n\n // Extract glyph-id\n if (typeof fm['glyph-id'] === 'string') {\n frontmatterGlyphId = fm['glyph-id'];\n }\n\n // Extract metadata fields\n if (typeof fm['title'] === 'string') {\n metadata.title = fm['title'];\n }\n if (typeof fm['description'] === 'string') {\n metadata.description = fm['description'];\n }\n if (Array.isArray(fm['authors'])) {\n metadata.authors = fm['authors'].filter(\n (a): a is string => typeof a === 'string',\n );\n }\n if (typeof fm['createdAt'] === 'string') {\n metadata.createdAt = fm['createdAt'];\n }\n if (Array.isArray(fm['tags'])) {\n metadata.tags = fm['tags'].filter(\n (t): t is string => typeof t === 'string',\n );\n }\n\n // Extract layout hints\n if (fm['layout'] && typeof fm['layout'] === 'object' && !Array.isArray(fm['layout'])) {\n const rawLayout = fm['layout'] as Record<string, unknown>;\n layout = {\n mode: isLayoutMode(rawLayout['mode']) ? rawLayout['mode'] : 'document',\n spacing: isLayoutSpacing(rawLayout['spacing']) ? rawLayout['spacing'] : 'normal',\n };\n if (typeof rawLayout['columns'] === 'number') {\n layout.columns = rawLayout['columns'];\n }\n if (typeof rawLayout['maxWidth'] === 'string') {\n layout.maxWidth = rawLayout['maxWidth'];\n }\n }\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n diagnostics.push(\n createDiagnostic(\n 'parser',\n 'error',\n 'FRONTMATTER_PARSE_ERROR',\n `Failed to parse frontmatter YAML: ${message}`,\n firstChild.position,\n ),\n );\n }\n }\n\n return { metadata, layout, frontmatterGlyphId };\n}\n\nfunction isLayoutMode(value: unknown): value is LayoutHints['mode'] {\n return value === 'document' || value === 'dashboard' || value === 'presentation';\n}\n\nfunction isLayoutSpacing(value: unknown): value is 'compact' | 'normal' | 'relaxed' {\n return value === 'compact' || value === 'normal' || value === 'relaxed';\n}\n\n// ─── Metadata Inference ──────────────────────────────────────\n\n/**\n * Infer metadata from content when not provided via frontmatter.\n * - title: from the first h1 heading\n * - description: from the first paragraph\n */\nfunction inferMetadata(metadata: DocumentMetadata, blocks: Block[]): void {\n if (!metadata.title) {\n const firstHeading = blocks.find(\n (b) => b.type === 'heading' && (b.data as Record<string, unknown>)['depth'] === 1,\n );\n if (firstHeading) {\n const data = firstHeading.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.title = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n\n if (!metadata.description) {\n const firstParagraph = blocks.find((b) => b.type === 'paragraph');\n if (firstParagraph) {\n const data = firstParagraph.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.description = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/inline.ts","../src/diagnostics.ts","../src/ast-to-ir.ts","../src/references.ts","../src/containers.ts","../src/compile.ts"],"names":["generateBlockId","parseGlyphMarkdown","parseYaml"],"mappings":";;;;;;;;AAsEO,SAAS,uBAAuB,KAAA,EAAgC;AACrE,EAAA,MAAM,SAAuB,EAAC;AAE9B,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,SAAA,GAAY,kBAAkB,IAA4B,CAAA;AAChE,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,IACvB;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,kBAAkB,IAAA,EAA+C;AACxE,EAAA,QAAQ,KAAK,IAAA;AAAM,IACjB,KAAK,MAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAA,EAAO,KAAK,KAAA,EAAM;AAAA,IAE3C,KAAK,QAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,QAAA,EAAU,sBAAA,CAAuB,IAAA,CAAK,QAAQ;AAAA,OAChD;AAAA,IAEF,KAAK,UAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,UAAA;AAAA,QACN,QAAA,EAAU,sBAAA,CAAuB,IAAA,CAAK,QAAQ;AAAA,OAChD;AAAA,IAEF,KAAK,QAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,QAAA,EAAU,sBAAA,CAAuB,IAAA,CAAK,QAAQ;AAAA,OAChD;AAAA,IAEF,KAAK,YAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,YAAA,EAAc,KAAA,EAAO,KAAK,KAAA,EAAM;AAAA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AAC5B,MAAA,IAAI,KAAK,QAAA,EAAU;AACjB,QAAA,QAAA,CAAS,WAAA,GAAc,IAAA,CAAK,QAAA,CACzB,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,UAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACrD,YAAA,OAAO,IAAA,CAAK,KAAA;AAAA,UACd;AACA,UAAA,OAAO,EAAA;AAAA,QACT,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import type { InlineNode } from '@glyphjs/types';\n\n// ─── MDAST Phrasing Content Types ───────────────────────────\n// These are structural types matching the shapes from mdast,\n// avoiding a hard dependency on @types/mdast.\n\ninterface MdastText {\n type: 'text';\n value: string;\n}\n\ninterface MdastStrong {\n type: 'strong';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastEmphasis {\n type: 'emphasis';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastDelete {\n type: 'delete';\n children: MdastPhrasingContent[];\n}\n\ninterface MdastInlineCode {\n type: 'inlineCode';\n value: string;\n}\n\ninterface MdastLink {\n type: 'link';\n url: string;\n title?: string | null;\n children: MdastPhrasingContent[];\n}\n\ninterface MdastImage {\n type: 'image';\n url: string;\n alt?: string | null;\n title?: string | null;\n}\n\ninterface MdastBreak {\n type: 'break';\n}\n\ntype MdastPhrasingContent =\n | MdastText\n | MdastStrong\n | MdastEmphasis\n | MdastDelete\n | MdastInlineCode\n | MdastLink\n | MdastImage\n | MdastBreak;\n\n// ─── Conversion ─────────────────────────────────────────────\n\n/**\n * Convert an array of MDAST phrasing content nodes to InlineNode[].\n *\n * Unknown node types are converted to text nodes with their string value\n * (if present) or skipped entirely.\n *\n * @param nodes - Raw MDAST phrasing content nodes (typed as unknown[] to avoid a hard @types/mdast dependency).\n * @returns Normalized InlineNode array suitable for inclusion in IR blocks.\n */\nexport function convertPhrasingContent(nodes: unknown[]): InlineNode[] {\n const result: InlineNode[] = [];\n\n for (const node of nodes) {\n const converted = convertSingleNode(node as MdastPhrasingContent);\n if (converted) {\n result.push(converted);\n }\n }\n\n return result;\n}\n\nfunction convertSingleNode(node: MdastPhrasingContent): InlineNode | null {\n switch (node.type) {\n case 'text':\n return { type: 'text', value: node.value };\n\n case 'strong':\n return {\n type: 'strong',\n children: convertPhrasingContent(node.children),\n };\n\n case 'emphasis':\n return {\n type: 'emphasis',\n children: convertPhrasingContent(node.children),\n };\n\n case 'delete':\n return {\n type: 'delete',\n children: convertPhrasingContent(node.children),\n };\n\n case 'inlineCode':\n return { type: 'inlineCode', value: node.value };\n\n case 'link': {\n const linkNode: InlineNode = {\n type: 'link',\n url: node.url,\n children: convertPhrasingContent(node.children),\n };\n if (node.title != null) {\n (linkNode as { type: 'link'; url: string; title?: string; children: InlineNode[] }).title =\n node.title;\n }\n return linkNode;\n }\n\n case 'image': {\n const imgNode: InlineNode = {\n type: 'image',\n src: node.url,\n };\n if (node.alt != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).alt = node.alt;\n }\n if (node.title != null) {\n (imgNode as { type: 'image'; src: string; alt?: string; title?: string }).title =\n node.title;\n }\n return imgNode;\n }\n\n case 'break':\n return { type: 'break' };\n\n default: {\n // For unknown phrasing content types, attempt to extract a text value\n const unknown = node as Record<string, unknown>;\n if (typeof unknown['value'] === 'string') {\n return { type: 'text', value: unknown['value'] };\n }\n return null;\n }\n }\n}\n","import type { Diagnostic, DiagnosticSource, SourcePosition } from '@glyphjs/types';\n\n// ─── Diagnostic Creation Helpers ─────────────────────────────\n\n/**\n * Create a diagnostic with the given source, severity, message, and optional position.\n *\n * @param source - The subsystem that produced the diagnostic (e.g., 'compiler', 'parser', 'schema').\n * @param severity - Severity level: 'error', 'warning', or 'info'.\n * @param code - Machine-readable diagnostic code (e.g., 'YAML_PARSE_ERROR').\n * @param message - Human-readable description of the issue.\n * @param position - Optional source position where the issue was detected.\n * @param details - Optional structured details (e.g., Zod issue objects).\n * @returns A fully constructed Diagnostic object.\n */\nexport function createDiagnostic(\n source: DiagnosticSource,\n severity: Diagnostic['severity'],\n code: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n const diag: Diagnostic = { severity, code, message, source };\n if (position) {\n diag.position = position;\n }\n if (details !== undefined) {\n diag.details = details;\n }\n return diag;\n}\n\n/**\n * Create a schema validation error diagnostic.\n *\n * @param componentType - The ui: component type that failed validation (without the `ui:` prefix).\n * @param message - Concatenated validation error messages from Zod.\n * @param position - Optional source position of the component block.\n * @param details - Optional raw Zod issue objects.\n * @returns A Diagnostic with severity 'error' and code 'SCHEMA_VALIDATION_FAILED'.\n */\nexport function createSchemaError(\n componentType: string,\n message: string,\n position?: SourcePosition,\n details?: unknown,\n): Diagnostic {\n return createDiagnostic(\n 'schema',\n 'error',\n 'SCHEMA_VALIDATION_FAILED',\n `Schema validation failed for ui:${componentType}: ${message}`,\n position,\n details,\n );\n}\n\n/**\n * Create an info diagnostic for unknown component types.\n *\n * @param componentType - The unrecognized component type (without the `ui:` prefix).\n * @param position - Optional source position of the component block.\n * @returns A Diagnostic with severity 'info' and code 'UNKNOWN_COMPONENT_TYPE'.\n */\nexport function createUnknownComponentInfo(\n componentType: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'compiler',\n 'info',\n 'UNKNOWN_COMPONENT_TYPE',\n `Unknown component type \"ui:${componentType}\". Block preserved as-is.`,\n position,\n );\n}\n\n/**\n * Create a diagnostic for YAML parse errors on ui: blocks.\n *\n * @param componentType - The ui: component type whose YAML failed to parse (without the `ui:` prefix).\n * @param yamlError - The YAML parser error message.\n * @param position - Optional source position of the fenced code block.\n * @returns A Diagnostic with severity 'error' and code 'YAML_PARSE_ERROR'.\n */\nexport function createYamlError(\n componentType: string,\n yamlError: string,\n position?: SourcePosition,\n): Diagnostic {\n return createDiagnostic(\n 'parser',\n 'error',\n 'YAML_PARSE_ERROR',\n `YAML parse error in ui:${componentType}: ${yamlError}`,\n position,\n );\n}\n","import type {\n Block,\n BlockType,\n Diagnostic,\n GlyphUIBlock,\n MdastContentNode,\n SourcePosition,\n Reference,\n RawRef,\n ListData,\n ListItemData,\n InlineNode,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { componentSchemas } from '@glyphjs/schemas';\nimport { convertPhrasingContent } from './inline.js';\nimport { createSchemaError, createUnknownComponentInfo, createYamlError } from './diagnostics.js';\n\n// ─── Default Source Position ─────────────────────────────────\n\nconst DEFAULT_POSITION: SourcePosition = {\n start: { line: 0, column: 0 },\n end: { line: 0, column: 0 },\n};\n\n// ─── Translation Context ────────────────────────────────────\n\nexport interface TranslationContext {\n documentId: string;\n diagnostics: Diagnostic[];\n references: Reference[];\n blockIdMap: Map<string, string>;\n}\n\n// ─── AST Node Type Guards ────────────────────────────────────\n\nfunction isGlyphUIBlock(node: GlyphUIBlock | MdastContentNode): node is GlyphUIBlock {\n return node.type === 'glyphUIBlock';\n}\n\n// ─── Main Translation Entry Point ────────────────────────────\n\n/**\n * Translate a single AST child node (either a GlyphUIBlock or a standard\n * MDAST content node) into an IR Block.\n *\n * Returns null for nodes that should be skipped (e.g., yaml frontmatter).\n *\n * @param node - The AST node to translate (GlyphUIBlock or standard MDAST content node).\n * @param ctx - Translation context carrying document ID, accumulated diagnostics, and references.\n * @returns The translated IR Block, or null if the node should be skipped.\n */\nexport function translateNode(\n node: GlyphUIBlock | MdastContentNode,\n ctx: TranslationContext,\n): Block | null {\n if (isGlyphUIBlock(node)) {\n return translateGlyphUIBlock(node, ctx);\n }\n return translateMdastNode(node, ctx);\n}\n\n// ─── Glyph UI Block Translation ─────────────────────────────\n\nfunction translateGlyphUIBlock(node: GlyphUIBlock, ctx: TranslationContext): Block {\n const componentType = node.componentType;\n const blockType: BlockType = `ui:${componentType}`;\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n const blockDiagnostics: Diagnostic[] = [];\n\n // Determine block ID: user-assigned glyph-id or content-addressed\n const blockId = node.glyphId\n ? node.glyphId\n : generateBlockId(ctx.documentId, blockType, node.rawYaml);\n\n // Track the block ID mapping for reference resolution\n if (node.glyphId) {\n ctx.blockIdMap.set(node.glyphId, blockId);\n }\n\n // Handle YAML parse errors\n if (node.yamlError) {\n const diag = createYamlError(componentType, node.yamlError, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n\n // Determine block data\n let data: Record<string, unknown> = node.parsedData ?? {};\n\n // Validate against Zod schema if we have parsed data\n if (node.parsedData) {\n const schema = componentSchemas.get(componentType);\n if (schema) {\n const result = schema.safeParse(node.parsedData);\n if (!result.success) {\n const zodErrors = result.error.issues\n .map((issue) => `${issue.path.join('.')}: ${issue.message}`)\n .join('; ');\n const diag = createSchemaError(componentType, zodErrors, position, result.error.issues);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n // Preserve the raw parsedData even on validation failure\n data = node.parsedData;\n } else {\n data = result.data as Record<string, unknown>;\n }\n } else {\n // Unknown component type — info diagnostic, preserve block as-is\n const diag = createUnknownComponentInfo(componentType, position);\n blockDiagnostics.push(diag);\n ctx.diagnostics.push(diag);\n }\n }\n\n // Process refs into references\n if (node.refs && node.refs.length > 0) {\n processRefs(node.refs, blockId, ctx);\n }\n\n const block: Block = {\n id: blockId,\n type: blockType,\n data,\n position,\n };\n\n if (node.interactive) {\n block.metadata = { interactive: true };\n }\n\n if (blockDiagnostics.length > 0) {\n block.diagnostics = blockDiagnostics;\n }\n\n return block;\n}\n\n// ─── Reference Processing ────────────────────────────────────\n\nfunction processRefs(refs: RawRef[], sourceBlockId: string, ctx: TranslationContext): void {\n for (const ref of refs) {\n const reference: Reference = {\n id: generateBlockId(ctx.documentId, 'ref', `${sourceBlockId}->${ref.target}`),\n type: (ref.type as Reference['type']) ?? 'navigates-to',\n sourceBlockId,\n targetBlockId: ref.target,\n };\n\n if (ref.label) {\n reference.label = ref.label;\n }\n if (ref.sourceAnchor) {\n reference.sourceAnchor = ref.sourceAnchor;\n }\n if (ref.targetAnchor) {\n reference.targetAnchor = ref.targetAnchor;\n }\n if (ref.bidirectional) {\n reference.bidirectional = ref.bidirectional;\n }\n\n // Mark as unresolved — we resolve later in the compile step\n reference.unresolved = true;\n\n ctx.references.push(reference);\n }\n}\n\n// ─── Standard MDAST Node Translation ─────────────────────────\n\nfunction translateMdastNode(node: MdastContentNode, ctx: TranslationContext): Block | null {\n const position: SourcePosition = node.position ?? DEFAULT_POSITION;\n\n switch (node.type) {\n case 'heading':\n return translateHeading(node, position, ctx);\n case 'paragraph':\n return translateParagraph(node, position, ctx);\n case 'list':\n return translateList(node, position, ctx);\n case 'code':\n return translateCode(node, position, ctx);\n case 'blockquote':\n return translateBlockquote(node, position, ctx);\n case 'image':\n return translateImage(node, position, ctx);\n case 'thematicBreak':\n return translateThematicBreak(position, ctx);\n case 'html':\n return translateHtml(node, position, ctx);\n case 'yaml':\n // Frontmatter is handled separately in compile.ts; skip here\n return null;\n default:\n // Unknown MDAST node type — skip silently\n return null;\n }\n}\n\n// ─── Individual Node Translators ─────────────────────────────\n\nfunction translateHeading(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const depth = (node['depth'] as number) ?? 1;\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'heading', content),\n type: 'heading',\n data: { depth, children },\n position,\n };\n}\n\nfunction translateParagraph(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const children = convertPhrasingContent((node.children ?? []) as unknown[]);\n const content = inlineNodesToText(children);\n\n return {\n id: generateBlockId(ctx.documentId, 'paragraph', content),\n type: 'paragraph',\n data: { children },\n position,\n };\n}\n\nfunction translateList(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const ordered = (node['ordered'] as boolean) ?? false;\n const start = ordered ? ((node['start'] as number) ?? 1) : undefined;\n const items = translateListItems((node.children ?? []) as MdastContentNode[]);\n const content = listDataToText({ ordered, start, items });\n\n const data: ListData = { ordered, items };\n if (start !== undefined) {\n data.start = start;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'list', content),\n type: 'list',\n data,\n position,\n };\n}\n\nfunction translateListItems(listItemNodes: MdastContentNode[]): ListItemData[] {\n const items: ListItemData[] = [];\n\n for (const itemNode of listItemNodes) {\n if (itemNode.type !== 'listItem') continue;\n\n const itemChildren = (itemNode.children ?? []) as MdastContentNode[];\n let inlineChildren: InlineNode[] = [];\n let subList: ListData | undefined;\n\n for (const child of itemChildren) {\n if (child.type === 'paragraph') {\n inlineChildren = convertPhrasingContent((child.children ?? []) as unknown[]);\n } else if (child.type === 'list') {\n const subOrdered = (child['ordered'] as boolean) ?? false;\n const subStart = subOrdered ? ((child['start'] as number) ?? 1) : undefined;\n const subItems = translateListItems((child.children ?? []) as MdastContentNode[]);\n subList = { ordered: subOrdered, items: subItems };\n if (subStart !== undefined) {\n subList.start = subStart;\n }\n }\n }\n\n const item: ListItemData = { children: inlineChildren };\n if (subList) {\n item.subList = subList;\n }\n items.push(item);\n }\n\n return items;\n}\n\nfunction translateCode(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n const language = (node['lang'] as string) ?? undefined;\n const meta = (node['meta'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { value };\n if (language) {\n data['language'] = language;\n }\n if (meta) {\n data['meta'] = meta;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'code', value),\n type: 'code',\n data,\n position,\n };\n}\n\nfunction translateBlockquote(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n // Blockquote children are typically paragraphs — flatten their inline content\n const allInlineNodes: InlineNode[] = [];\n for (const child of (node.children ?? []) as MdastContentNode[]) {\n if (child.type === 'paragraph') {\n const inlines = convertPhrasingContent((child.children ?? []) as unknown[]);\n allInlineNodes.push(...inlines);\n }\n }\n const content = inlineNodesToText(allInlineNodes);\n\n return {\n id: generateBlockId(ctx.documentId, 'blockquote', content),\n type: 'blockquote',\n data: { children: allInlineNodes },\n position,\n };\n}\n\nfunction translateImage(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const src = (node['url'] as string) ?? '';\n const alt = (node['alt'] as string) ?? undefined;\n const title = (node['title'] as string) ?? undefined;\n\n const data: Record<string, unknown> = { src };\n if (alt) {\n data['alt'] = alt;\n }\n if (title) {\n data['title'] = title;\n }\n\n return {\n id: generateBlockId(ctx.documentId, 'image', src),\n type: 'image',\n data,\n position,\n };\n}\n\nfunction translateThematicBreak(position: SourcePosition, ctx: TranslationContext): Block {\n return {\n id: generateBlockId(ctx.documentId, 'thematic-break', '---'),\n type: 'thematic-break',\n data: {},\n position,\n };\n}\n\nfunction translateHtml(\n node: MdastContentNode,\n position: SourcePosition,\n ctx: TranslationContext,\n): Block {\n const value = (node.value as string) ?? '';\n\n return {\n id: generateBlockId(ctx.documentId, 'html', value),\n type: 'html',\n data: { value },\n position,\n };\n}\n\n// ─── Text Extraction Helpers ─────────────────────────────────\n\n/**\n * Extract plain text from InlineNode[] for content-addressing purposes.\n */\nfunction inlineNodesToText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToText(node.children);\n case 'link':\n return inlineNodesToText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n\n/**\n * Extract plain text from ListData for content-addressing purposes.\n */\nfunction listDataToText(data: ListData): string {\n return data.items\n .map((item) => {\n let text = inlineNodesToText(item.children);\n if (item.subList) {\n text += '\\n' + listDataToText(item.subList);\n }\n return text;\n })\n .join('\\n');\n}\n","import type {\n Block,\n Diagnostic,\n InlineNode,\n Reference,\n} from '@glyphjs/types';\nimport { generateBlockId } from '@glyphjs/ir';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Glyph Link Pattern ─────────────────────────────────────\n\n/**\n * Matches inline links of the form `[text](#glyph:block-id)`.\n * The captured group is the block ID after the `#glyph:` prefix.\n */\nconst GLYPH_LINK_PREFIX = '#glyph:';\n\n// ─── Inline Reference Scanning ──────────────────────────────\n\n/**\n * Scan a block's inline content for `[text](#glyph:block-id)` links\n * and create Reference objects for each match.\n *\n * @param block - The block whose inline data fields are scanned for glyph links.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Newly created (unresolved) Reference objects.\n */\nexport function extractInlineReferences(\n block: Block,\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n const inlineNodes = extractInlineNodes(block);\n\n for (const node of inlineNodes) {\n if (node.type === 'link' && node.url.startsWith(GLYPH_LINK_PREFIX)) {\n const targetBlockId = node.url.slice(GLYPH_LINK_PREFIX.length);\n if (!targetBlockId) continue;\n\n const label = inlineNodesToPlainText(node.children);\n\n const reference: Reference = {\n id: generateBlockId(documentId, 'ref', `${block.id}->${targetBlockId}`),\n type: 'navigates-to',\n sourceBlockId: block.id,\n targetBlockId,\n unresolved: true,\n };\n\n if (label) {\n reference.label = label;\n }\n\n references.push(reference);\n }\n }\n\n return references;\n}\n\n/**\n * Scan all blocks (including nested children) for inline `#glyph:` link references\n * and collect them.\n *\n * @param blocks - Top-level block array to scan recursively.\n * @param documentId - Document ID used to generate deterministic reference IDs.\n * @returns Aggregated array of unresolved Reference objects from all blocks.\n */\nexport function extractAllInlineReferences(\n blocks: Block[],\n documentId: string,\n): Reference[] {\n const references: Reference[] = [];\n\n for (const block of blocks) {\n const blockRefs = extractInlineReferences(block, documentId);\n references.push(...blockRefs);\n\n // Also scan children (e.g. container blocks)\n if (block.children) {\n const childRefs = extractAllInlineReferences(block.children, documentId);\n references.push(...childRefs);\n }\n }\n\n return references;\n}\n\n// ─── Reference Resolution ────────────────────────────────────\n\n/**\n * Resolve references by checking if target block IDs exist in the document.\n * Marks unresolved references and adds warning diagnostics.\n *\n * Collects all block IDs including children (for container blocks).\n *\n * @param references - The reference array to resolve in-place (mutates `unresolved` flag).\n * @param blocks - All blocks in the document (used to build the known-ID set).\n * @param diagnostics - Accumulator for 'UNRESOLVED_REFERENCE' warnings.\n */\nexport function resolveReferences(\n references: Reference[],\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n const blockIdSet = collectAllBlockIds(blocks);\n\n for (const ref of references) {\n if (blockIdSet.has(ref.targetBlockId)) {\n ref.unresolved = false;\n } else {\n ref.unresolved = true;\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'UNRESOLVED_REFERENCE',\n `Reference target \"${ref.targetBlockId}\" was not found in the document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Collect all block IDs from blocks and their children recursively.\n */\nfunction collectAllBlockIds(blocks: Block[]): Set<string> {\n const ids = new Set<string>();\n for (const block of blocks) {\n ids.add(block.id);\n if (block.children) {\n for (const id of collectAllBlockIds(block.children)) {\n ids.add(id);\n }\n }\n }\n return ids;\n}\n\n// ─── Glyph-ID Uniqueness Validation ─────────────────────────\n\n/**\n * Validate that all user-assigned glyph-ids are unique within the document.\n * Emits error diagnostics for duplicates.\n *\n * @param blockIdMap - Map of user-assigned glyph-id to resolved block ID (from translation).\n * @param blocks - All blocks in the document (scanned to count occurrences).\n * @param diagnostics - Accumulator for 'DUPLICATE_GLYPH_ID' error diagnostics.\n */\nexport function validateGlyphIdUniqueness(\n blockIdMap: Map<string, string>,\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n // blockIdMap tracks glyphId -> blockId, but we need to detect duplicates\n // by scanning blocks for those whose id matches a glyph-id key\n const glyphIdOccurrences = new Map<string, number>();\n\n for (const glyphId of blockIdMap.keys()) {\n const count = countBlocksWithGlyphId(blocks, glyphId);\n glyphIdOccurrences.set(glyphId, count);\n }\n\n for (const [glyphId, count] of glyphIdOccurrences) {\n if (count > 1) {\n diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'error',\n 'DUPLICATE_GLYPH_ID',\n `Duplicate glyph-id \"${glyphId}\" found on ${String(count)} blocks. Block IDs must be unique within a document.`,\n ),\n );\n }\n }\n}\n\n/**\n * Count how many blocks in the array have a given ID (which came from a glyph-id).\n */\nfunction countBlocksWithGlyphId(blocks: Block[], glyphId: string): number {\n let count = 0;\n for (const block of blocks) {\n if (block.id === glyphId) {\n count++;\n }\n }\n return count;\n}\n\n// ─── Inline Node Extraction Helpers ──────────────────────────\n\n/**\n * Extract all InlineNode arrays from a block's data field.\n * Handles heading, paragraph, blockquote, and list blocks.\n */\nfunction extractInlineNodes(block: Block): InlineNode[] {\n const data = block.data as Record<string, unknown>;\n const nodes: InlineNode[] = [];\n\n // Blocks with a direct `children` inline array\n if (Array.isArray(data['children'])) {\n nodes.push(...(data['children'] as InlineNode[]));\n }\n\n // List blocks: extract inline nodes from items\n if (Array.isArray(data['items'])) {\n for (const item of data['items'] as { children?: InlineNode[]; subList?: { items?: unknown[] } }[]) {\n if (Array.isArray(item.children)) {\n nodes.push(...item.children);\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Extract plain text from InlineNode[] for label purposes.\n */\nfunction inlineNodesToPlainText(nodes: InlineNode[]): string {\n return nodes\n .map((node) => {\n switch (node.type) {\n case 'text':\n return node.value;\n case 'inlineCode':\n return node.value;\n case 'strong':\n case 'emphasis':\n case 'delete':\n return inlineNodesToPlainText(node.children);\n case 'link':\n return inlineNodesToPlainText(node.children);\n case 'image':\n return node.alt ?? '';\n case 'break':\n return '\\n';\n default:\n return '';\n }\n })\n .join('');\n}\n","import type { Block, Diagnostic } from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\n\n// ─── Container Block Compilation ─────────────────────────────\n\n/**\n * Process container blocks (ui:tabs and ui:steps) by recursively parsing\n * their content fields as Markdown into child Block[] arrays.\n *\n * This function mutates blocks in-place, populating their `children` field\n * and updating data entries with parsed child blocks.\n *\n * @param blocks - The top-level block array to scan for container blocks.\n * @param ctx - Translation context used for recursive compilation.\n */\nexport function compileContainerBlocks(\n blocks: Block[],\n ctx: TranslationContext,\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n compileTabsBlock(block, ctx);\n } else if (block.type === 'ui:steps') {\n compileStepsBlock(block, ctx);\n }\n }\n}\n\n// ─── Tabs Compilation ────────────────────────────────────────\n\nfunction compileTabsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs)) return;\n\n const allChildren: Block[] = [];\n\n for (const tab of tabs as { label?: string; content?: string }[]) {\n if (typeof tab.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(tab.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Steps Compilation ───────────────────────────────────────\n\nfunction compileStepsBlock(block: Block, ctx: TranslationContext): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps)) return;\n\n const allChildren: Block[] = [];\n\n for (const step of steps as { title?: string; status?: string; content?: string }[]) {\n if (typeof step.content !== 'string') continue;\n\n const childBlocks = parseContentToBlocks(step.content, block, ctx);\n allChildren.push(...childBlocks);\n }\n\n if (allChildren.length > 0) {\n block.children = allChildren;\n }\n}\n\n// ─── Content Parsing Helper ──────────────────────────────────\n\n/**\n * Parse a Markdown content string into Block[] using the compiler pipeline.\n * Emits a warning diagnostic if nested ui: components are found (deferred to v2).\n */\nfunction parseContentToBlocks(\n content: string,\n parentBlock: Block,\n ctx: TranslationContext,\n): Block[] {\n const ast = parseGlyphMarkdown(content);\n const blocks: Block[] = [];\n\n for (const child of ast.children) {\n // Check for nested ui: components — warn and skip\n if (child.type === 'glyphUIBlock') {\n ctx.diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'NESTED_UI_COMPONENT',\n `Nested ui: component found inside container block \"${parentBlock.id}\". ` +\n `Nested ui: components inside tabs/steps are not supported in v1 and will be ignored.`,\n child.position,\n ),\n );\n continue;\n }\n\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n return blocks;\n}\n\n// ─── Nested UI Detection ─────────────────────────────────────\n\n/**\n * Check if content contains nested ui: blocks by looking for the pattern.\n * This is a quick heuristic check. The actual detection happens during parsing.\n *\n * @param content - Raw Markdown string to test for nested ui: fenced blocks.\n * @returns True if the content matches the `` ```ui: `` pattern.\n */\nexport function hasNestedUiBlocks(content: string): boolean {\n return /```ui:/m.test(content);\n}\n\n// ─── Validate Container Diagnostics ──────────────────────────\n\n/**\n * Post-process container blocks to ensure data consistency.\n * Called after container compilation is complete.\n *\n * @param blocks - The compiled block array to validate.\n * @param diagnostics - Accumulator for warning diagnostics (e.g., missing labels/titles).\n */\nexport function validateContainerBlocks(\n blocks: Block[],\n diagnostics: Diagnostic[],\n): void {\n for (const block of blocks) {\n if (block.type === 'ui:tabs') {\n validateTabsData(block, diagnostics);\n } else if (block.type === 'ui:steps') {\n validateStepsData(block, diagnostics);\n }\n }\n}\n\nfunction validateTabsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const tabs = data['tabs'];\n\n if (!Array.isArray(tabs) || tabs.length === 0) {\n return;\n }\n\n // Ensure each tab has a label\n for (const tab of tabs as { label?: string }[]) {\n if (!tab.label) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_TAB_LABEL',\n `A tab in block \"${block.id}\" is missing a label.`,\n block.position,\n ),\n );\n }\n }\n}\n\nfunction validateStepsData(block: Block, _diagnostics: Diagnostic[]): void {\n const data = block.data as Record<string, unknown>;\n const steps = data['steps'];\n\n if (!Array.isArray(steps) || steps.length === 0) {\n return;\n }\n\n // Ensure each step has a title\n for (const step of steps as { title?: string }[]) {\n if (!step.title) {\n _diagnostics.push(\n createDiagnostic(\n 'compiler',\n 'warning',\n 'MISSING_STEP_TITLE',\n `A step in block \"${block.id}\" is missing a title.`,\n block.position,\n ),\n );\n }\n }\n}\n","import type {\n GlyphIR,\n CompilationResult,\n Diagnostic,\n DocumentMetadata,\n LayoutHints,\n Block,\n Reference,\n MdastContentNode,\n} from '@glyphjs/types';\nimport { parseGlyphMarkdown } from '@glyphjs/parser';\nimport { generateDocumentId, resolveBlockIdCollisions } from '@glyphjs/ir';\nimport { parse as parseYaml } from 'yaml';\nimport { translateNode } from './ast-to-ir.js';\nimport type { TranslationContext } from './ast-to-ir.js';\nimport { createDiagnostic } from './diagnostics.js';\nimport {\n extractAllInlineReferences,\n resolveReferences,\n validateGlyphIdUniqueness,\n} from './references.js';\nimport { compileContainerBlocks, validateContainerBlocks } from './containers.js';\n\n// ─── Public Interface ────────────────────────────────────────\n\nexport interface CompileOptions {\n /** Source file path, used for document ID generation. */\n filePath?: string;\n /** Explicit document ID override. */\n documentId?: string;\n}\n\n// ─── Main Compile Function ───────────────────────────────────\n\n/**\n * Compile a Markdown string into Glyph IR.\n *\n * Steps:\n * 1. Parse the markdown via `parseGlyphMarkdown`\n * 2. Extract frontmatter metadata and layout hints\n * 3. Walk the AST and translate each node to IR blocks\n * 4. Validate ui: blocks against Zod schemas\n * 5. Compile container blocks (ui:tabs, ui:steps) — recursively parse content\n * 6. Validate container block data\n * 7. Generate content-addressed block IDs\n * 8. Generate the document ID\n * 9. Resolve block ID collisions\n * 10. Validate glyph-id uniqueness\n * 11. Extract inline references from `[text](#glyph:block-id)` links\n * 12. Resolve all references (from refs arrays and inline links)\n * 13. Infer metadata from content if not in frontmatter\n * 14. Return CompilationResult with IR, diagnostics, and hasErrors flag\n *\n * Uses a collect-all-errors strategy: IR is always produced, even when errors exist.\n */\nexport function compile(markdown: string, options?: CompileOptions): CompilationResult {\n const diagnostics: Diagnostic[] = [];\n\n // 1. Parse the markdown into a Glyph AST\n const ast = parseGlyphMarkdown(markdown);\n\n // 2. Extract frontmatter\n const { metadata, layout, frontmatterGlyphId } = extractFrontmatter(ast.children, diagnostics);\n\n // 3. Generate document ID\n const documentId =\n options?.documentId ??\n generateDocumentId({\n glyphId: frontmatterGlyphId,\n filePath: options?.filePath,\n content: markdown,\n });\n\n // Set sourceFile from options if available\n if (options?.filePath && !metadata.sourceFile) {\n metadata.sourceFile = options.filePath;\n }\n\n // 4. Create translation context\n const references: Reference[] = [];\n const ctx: TranslationContext = {\n documentId,\n diagnostics,\n references,\n blockIdMap: new Map(),\n };\n\n // 5. Walk the AST and translate nodes\n const blocks: Block[] = [];\n for (const child of ast.children) {\n const block = translateNode(child, ctx);\n if (block) {\n blocks.push(block);\n }\n }\n\n // 6. Compile container blocks (ui:tabs, ui:steps) — recursively parse content fields\n compileContainerBlocks(blocks, ctx);\n\n // 7. Validate container block data\n validateContainerBlocks(blocks, diagnostics);\n\n // 8. Infer metadata from content if not in frontmatter\n inferMetadata(metadata, blocks);\n\n // 9. Resolve block ID collisions\n const blockIds = blocks.map((b) => b.id);\n const resolvedIds = resolveBlockIdCollisions(blockIds);\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const resolvedId = resolvedIds[i];\n if (block && resolvedId) {\n block.id = resolvedId;\n }\n }\n\n // 10. Validate glyph-id uniqueness\n validateGlyphIdUniqueness(ctx.blockIdMap, blocks, diagnostics);\n\n // 11. Extract inline references from [text](#glyph:block-id) links\n const inlineRefs = extractAllInlineReferences(blocks, documentId);\n references.push(...inlineRefs);\n\n // 12. Resolve all references (from refs arrays and inline links)\n resolveReferences(references, blocks, diagnostics);\n\n // 13. Build the IR\n const ir: GlyphIR = {\n version: '1.0.0',\n id: documentId,\n metadata,\n blocks,\n references,\n layout,\n };\n\n const hasErrors = diagnostics.some((d) => d.severity === 'error');\n\n return { ir, diagnostics, hasErrors };\n}\n\n// ─── Frontmatter Extraction ─────────────────────────────────\n\ninterface FrontmatterResult {\n metadata: DocumentMetadata;\n layout: LayoutHints;\n frontmatterGlyphId?: string;\n}\n\nfunction extractFrontmatter(\n children: readonly unknown[],\n diagnostics: Diagnostic[],\n): FrontmatterResult {\n const metadata: DocumentMetadata = {};\n let layout: LayoutHints = { mode: 'document', spacing: 'normal' };\n let frontmatterGlyphId: string | undefined;\n\n // Look for yaml frontmatter node (always first child if present)\n const firstChild = children[0] as MdastContentNode | undefined;\n if (firstChild && firstChild.type === 'yaml' && typeof firstChild.value === 'string') {\n try {\n const parsed: unknown = parseYaml(firstChild.value);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n const fm = parsed as Record<string, unknown>;\n\n // Extract glyph-id\n if (typeof fm['glyph-id'] === 'string') {\n frontmatterGlyphId = fm['glyph-id'];\n }\n\n // Extract metadata fields\n if (typeof fm['title'] === 'string') {\n metadata.title = fm['title'];\n }\n if (typeof fm['description'] === 'string') {\n metadata.description = fm['description'];\n }\n if (Array.isArray(fm['authors'])) {\n metadata.authors = fm['authors'].filter(\n (a): a is string => typeof a === 'string',\n );\n }\n if (typeof fm['createdAt'] === 'string') {\n metadata.createdAt = fm['createdAt'];\n }\n if (Array.isArray(fm['tags'])) {\n metadata.tags = fm['tags'].filter(\n (t): t is string => typeof t === 'string',\n );\n }\n\n // Extract layout hints\n if (fm['layout'] && typeof fm['layout'] === 'object' && !Array.isArray(fm['layout'])) {\n const rawLayout = fm['layout'] as Record<string, unknown>;\n layout = {\n mode: isLayoutMode(rawLayout['mode']) ? rawLayout['mode'] : 'document',\n spacing: isLayoutSpacing(rawLayout['spacing']) ? rawLayout['spacing'] : 'normal',\n };\n if (typeof rawLayout['columns'] === 'number') {\n layout.columns = rawLayout['columns'];\n }\n if (typeof rawLayout['maxWidth'] === 'string') {\n layout.maxWidth = rawLayout['maxWidth'];\n }\n }\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n diagnostics.push(\n createDiagnostic(\n 'parser',\n 'error',\n 'FRONTMATTER_PARSE_ERROR',\n `Failed to parse frontmatter YAML: ${message}`,\n firstChild.position,\n ),\n );\n }\n }\n\n return { metadata, layout, frontmatterGlyphId };\n}\n\nfunction isLayoutMode(value: unknown): value is LayoutHints['mode'] {\n return value === 'document' || value === 'dashboard' || value === 'presentation';\n}\n\nfunction isLayoutSpacing(value: unknown): value is 'compact' | 'normal' | 'relaxed' {\n return value === 'compact' || value === 'normal' || value === 'relaxed';\n}\n\n// ─── Metadata Inference ──────────────────────────────────────\n\n/**\n * Infer metadata from content when not provided via frontmatter.\n * - title: from the first h1 heading\n * - description: from the first paragraph\n */\nfunction inferMetadata(metadata: DocumentMetadata, blocks: Block[]): void {\n if (!metadata.title) {\n const firstHeading = blocks.find(\n (b) => b.type === 'heading' && (b.data as Record<string, unknown>)['depth'] === 1,\n );\n if (firstHeading) {\n const data = firstHeading.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.title = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n\n if (!metadata.description) {\n const firstParagraph = blocks.find((b) => b.type === 'paragraph');\n if (firstParagraph) {\n const data = firstParagraph.data as { children?: { type: string; value?: string }[] };\n if (data.children) {\n metadata.description = data.children\n .map((node) => {\n if ('value' in node && typeof node.value === 'string') {\n return node.value;\n }\n return '';\n })\n .join('');\n }\n }\n }\n}\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glyphjs/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Compiles Glyph AST into IR with schema validation and diagnostics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"yaml": "^2.7.0",
|
|
28
|
-
"@glyphjs/types": "0.
|
|
29
|
-
"@glyphjs/
|
|
30
|
-
"@glyphjs/
|
|
31
|
-
"@glyphjs/
|
|
28
|
+
"@glyphjs/types": "0.2.0",
|
|
29
|
+
"@glyphjs/schemas": "0.2.0",
|
|
30
|
+
"@glyphjs/ir": "0.2.0",
|
|
31
|
+
"@glyphjs/parser": "0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"license": "MIT",
|