tempo-sdk 0.0.60 → 0.0.69
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/astro/client.d.ts +4 -0
- package/dist/assets/editor.js +1 -1
- package/dist/assets/index.d.ts +10 -63
- package/dist/assets/index.js +35 -33
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/parser.js +1 -1
- package/dist/astro/asset-preview-client.d.ts +4 -0
- package/dist/astro/asset-preview-client.js +93 -0
- package/dist/astro/asset-preview-client.js.map +1 -0
- package/dist/astro/controls.d.ts +7 -0
- package/dist/astro/controls.js +7 -0
- package/dist/astro/controls.js.map +1 -0
- package/dist/astro/document-client.d.ts +10 -0
- package/dist/astro/document-client.js +78 -0
- package/dist/astro/document-client.js.map +1 -0
- package/dist/astro/runtime.d.ts +15 -0
- package/dist/astro/runtime.js +86 -0
- package/dist/astro/runtime.js.map +1 -0
- package/dist/astro.d.ts +21 -0
- package/dist/astro.js +808 -0
- package/dist/astro.js.map +1 -0
- package/dist/canvas/astro-contract.d.ts +21 -0
- package/dist/canvas/astro-contract.js +9 -0
- package/dist/canvas/astro-contract.js.map +1 -0
- package/dist/canvas/astro.d.ts +18 -0
- package/dist/canvas/astro.js +42 -0
- package/dist/canvas/astro.js.map +1 -0
- package/dist/canvas/editor.d.ts +1 -1
- package/dist/canvas/editor.js +3 -2
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/index.d.ts +1 -1
- package/dist/canvas/index.js +40 -16
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +4 -4
- package/dist/canvas/parser.d.ts +3 -1
- package/dist/canvas/parser.js +1 -1
- package/dist/canvas/svelte.d.ts +1 -1
- package/dist/canvas/svelte.js +3 -3
- package/dist/{chunk-5BHIHP25.js → chunk-2JRAG36X.js} +37 -11
- package/dist/chunk-2JRAG36X.js.map +1 -0
- package/dist/{chunk-N2TYN3RB.js → chunk-6AAE4LYV.js} +123 -123
- package/dist/chunk-6AAE4LYV.js.map +1 -0
- package/dist/{chunk-FQSZRVSL.js → chunk-6BSLP7P3.js} +46 -5
- package/dist/chunk-6BSLP7P3.js.map +1 -0
- package/dist/{chunk-7DT5DDSH.js → chunk-6IR5JY6W.js} +106 -7
- package/dist/chunk-6IR5JY6W.js.map +1 -0
- package/dist/chunk-77DZCV5Z.js +38 -0
- package/dist/chunk-77DZCV5Z.js.map +1 -0
- package/dist/{chunk-MXKZZOLM.js → chunk-EYKOOLPL.js} +368 -32
- package/dist/chunk-EYKOOLPL.js.map +1 -0
- package/dist/chunk-F23JGM4U.js +107 -0
- package/dist/chunk-F23JGM4U.js.map +1 -0
- package/dist/chunk-FE6TYCLF.js +1514 -0
- package/dist/chunk-FE6TYCLF.js.map +1 -0
- package/dist/chunk-H6OZIX2U.js +133 -0
- package/dist/chunk-H6OZIX2U.js.map +1 -0
- package/dist/chunk-JVVHU3A7.js +1077 -0
- package/dist/chunk-JVVHU3A7.js.map +1 -0
- package/dist/{chunk-2IQD2KPS.js → chunk-KOSJXE4G.js} +3 -102
- package/dist/chunk-KOSJXE4G.js.map +1 -0
- package/dist/{chunk-TL4MGN7E.js → chunk-NSKYOKG5.js} +254 -10
- package/dist/chunk-NSKYOKG5.js.map +1 -0
- package/dist/chunk-OX2YKYSL.js +13 -0
- package/dist/chunk-OX2YKYSL.js.map +1 -0
- package/dist/{chunk-VMTQDG4U.js → chunk-PXDTH36X.js} +12 -10
- package/dist/chunk-PXDTH36X.js.map +1 -0
- package/dist/{chunk-XLEKCOB7.js → chunk-PYAJHLXO.js} +56 -1
- package/dist/chunk-PYAJHLXO.js.map +1 -0
- package/dist/{chunk-OTVBSF7U.js → chunk-Q2A46HHW.js} +17 -12
- package/dist/chunk-Q2A46HHW.js.map +1 -0
- package/dist/chunk-WTQQOLXM.js +2495 -0
- package/dist/chunk-WTQQOLXM.js.map +1 -0
- package/dist/controls-reader-SNMI2UY7.js +191 -0
- package/dist/controls-reader-SNMI2UY7.js.map +1 -0
- package/dist/controls-uCaQ3CNX.d.ts +61 -0
- package/dist/expo/plugin.cjs +16 -11
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +16 -11
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -2465
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.cjs +45 -4
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +61 -15
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +45 -4
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +4 -4
- package/dist/nextjs.d.ts +4 -4
- package/dist/nextjs.js +1 -1
- package/dist/{storyboard-DjOF61B_.d.ts → storyboard-4YdTYq_e.d.ts} +1 -1
- package/dist/svelte.js +7 -1075
- package/dist/svelte.js.map +1 -1
- package/package.json +45 -4
- package/dist/chunk-2IQD2KPS.js.map +0 -1
- package/dist/chunk-5BHIHP25.js.map +0 -1
- package/dist/chunk-7DT5DDSH.js.map +0 -1
- package/dist/chunk-FQSZRVSL.js.map +0 -1
- package/dist/chunk-MXKZZOLM.js.map +0 -1
- package/dist/chunk-N2TYN3RB.js.map +0 -1
- package/dist/chunk-OTVBSF7U.js.map +0 -1
- package/dist/chunk-TL4MGN7E.js.map +0 -1
- package/dist/chunk-VMTQDG4U.js.map +0 -1
- package/dist/chunk-XLEKCOB7.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../canvas/parser.ts"],"sourcesContent":["import { parseSync, type JSXElement } from \"oxc-parser\";\n\nexport type CanvasSourceSpan = { start: number; end: number };\n\nexport type CanvasParseError = {\n message: string;\n span?: CanvasSourceSpan;\n /** \"structural\": the file's storyboard identity/structure cannot be\n * trusted — readers must fail closed. \"degraded\": a single storyboard\n * (or the canvas display name) is not statically readable/editable but\n * identity is intact — readers keep working with fallback values. */\n kind: \"structural\" | \"degraded\";\n};\n\nexport type ParsedCanvasImport = {\n localName: string;\n source: string;\n importedName: string;\n kind: \"default\" | \"named\" | \"namespace\";\n importKind?: \"type\" | \"value\";\n span: CanvasSourceSpan;\n declarationSpan: CanvasSourceSpan;\n specifierCount: number;\n namedSpecifierCount: number;\n hasDefaultSpecifier: boolean;\n hasNamespaceSpecifier: boolean;\n};\n\n/** An import statement that names Tempo SDK canvas components but uses the\n * wrong tempo-sdk specifier (e.g. `import { Canvas } from \"tempo-sdk\"`).\n * Neither the main entry nor the other subpaths export the components, so\n * the file both fails at runtime and is invisible to this parser's <Canvas>\n * detection — migrate-on-read uses these records to repair the specifier. */\nexport type MisimportedSdkCanvasImport = {\n /** Import source exactly as written, e.g. \"tempo-sdk\". */\n source: string;\n /** Span of the source string literal INCLUDING its quote characters. */\n sourceSpan: CanvasSourceSpan;\n /** Imported names of every value specifier on the statement. */\n importedNames: string[];\n /** True when every value specifier on the statement is a named import of a\n * value actually exported by \"tempo-sdk/canvas\" — rewriting the source\n * string to \"tempo-sdk/canvas\" provably fixes the statement. */\n rewritable: boolean;\n};\n\nexport type ParsedCanvasLayout = {\n x: number;\n y: number;\n width?: number;\n height?: number;\n zIndex?: number;\n};\n\nexport type ParsedCanvasLayoutSpans = {\n x?: CanvasSourceSpan;\n y?: CanvasSourceSpan;\n width?: CanvasSourceSpan;\n height?: CanvasSourceSpan;\n zIndex?: CanvasSourceSpan;\n layoutClose?: number;\n};\n\nexport type ParsedCanvasComponentReference = {\n expression: string;\n span: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n localName?: string;\n import?: ParsedCanvasImport;\n};\n\nexport type ParsedStoryboardVrtIgnoreRegion = {\n x: number;\n y: number;\n w: number;\n h: number;\n};\n\n/** Opt-in visual-regression tracking parsed from the `vrt` prop on\n * `<Storyboard>` (TEM-1775). Presence of the parsed field means the\n * storyboard is tracked; `skip: true` keeps the config but pauses gating.\n * `vrt` / `vrt={true}` parse to `{}`; `vrt={false}` parses to absent. */\nexport type ParsedStoryboardVrt = {\n /** Per-storyboard pixelmatch threshold override (0..0.5). */\n threshold?: number;\n /** Temporarily untracked without losing config. */\n skip?: boolean;\n /** Regions (storyboard-local px) excluded from comparison. */\n ignore?: ParsedStoryboardVrtIgnoreRegion[];\n};\n\nexport type ParsedCanvasExpressionReference = {\n expression: string;\n span: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n};\n\nexport type ParsedCanvasStoryboard = {\n storyboardKey: string;\n displayName?: string;\n kind: \"component\" | \"route\" | \"html\";\n /** Authored component runtime selected by the storyboard declaration. */\n uiFramework?: \"svelte\";\n layout: ParsedCanvasLayout;\n editable: boolean;\n jsxElementSpan: CanvasSourceSpan;\n openingElementSpan?: CanvasSourceSpan;\n idSpan?: CanvasSourceSpan;\n idAttributeSpan?: CanvasSourceSpan;\n nameSpan?: CanvasSourceSpan;\n nameAttributeSpan?: CanvasSourceSpan;\n layoutAttributeSpan?: CanvasSourceSpan;\n layoutSpans?: ParsedCanvasLayoutSpans;\n component?: ParsedCanvasComponentReference;\n props?: ParsedCanvasExpressionReference;\n vrt?: ParsedStoryboardVrt;\n /** Span of the whole `vrt` attribute. Present whenever the attribute\n * exists in source — including `vrt={false}` and degraded (dynamic /\n * malformed) forms whose `vrt` value stays absent — so an editor can\n * replace or remove the declaration without ever inserting a duplicate. */\n vrtAttributeSpan?: CanvasSourceSpan;\n route?: string;\n routeSpan?: CanvasSourceSpan;\n routeAttributeSpan?: CanvasSourceSpan;\n filepath?: string;\n filepathSpan?: CanvasSourceSpan;\n filepathAttributeSpan?: CanvasSourceSpan;\n src?: string;\n srcSpan?: CanvasSourceSpan;\n srcAttributeSpan?: CanvasSourceSpan;\n legacyV1?: {\n storyboard: ParsedCanvasExpressionReference;\n objectName?: string;\n objectSpan?: CanvasSourceSpan;\n objectClose?: number;\n namePropertySpan?: CanvasSourceSpan;\n layoutPropertySpan?: CanvasSourceSpan;\n };\n errors: CanvasParseError[];\n};\n\nexport type ParsedCanvasFile = {\n filePath: string;\n canvasPath?: string;\n pageName: string;\n backgroundColor?: string;\n canvasElementSpan?: CanvasSourceSpan;\n canvasOpeningElementSpan?: CanvasSourceSpan;\n canvasChildrenInsertionOffset?: number;\n nameSpan?: CanvasSourceSpan;\n nameAttributeSpan?: CanvasSourceSpan;\n pathSpan?: CanvasSourceSpan;\n pathAttributeSpan?: CanvasSourceSpan;\n backgroundColorSpan?: CanvasSourceSpan;\n backgroundColorAttributeSpan?: CanvasSourceSpan;\n imports: ParsedCanvasImport[];\n misimportedSdkCanvasImports: MisimportedSdkCanvasImport[];\n storyboards: ParsedCanvasStoryboard[];\n errors: CanvasParseError[];\n};\n\ntype SdkComponent =\n | \"Canvas\"\n | \"Storyboard\"\n | \"SvelteStoryboard\"\n | \"LegacyStoryboardV1\"\n | \"RouteStoryboard\"\n | \"HtmlStoryboard\";\n\ntype StoryboardSdkComponent = Exclude<SdkComponent, \"Canvas\">;\n\ntype StoryboardElement = {\n element: any;\n component: StoryboardSdkComponent;\n};\n\ntype ParsedImports = {\n all: ParsedCanvasImport[];\n byLocalName: Map<string, ParsedCanvasImport>;\n sdkLocalNames: Map<string, SdkComponent>;\n sdkNamespaces: Set<string>;\n};\n\ntype ParsedLegacyStoryboardObject = {\n bindingName: string;\n displayName?: string;\n component?: ParsedCanvasComponentReference;\n objectSpan?: CanvasSourceSpan;\n objectClose?: number;\n nameSpan?: CanvasSourceSpan;\n namePropertySpan?: CanvasSourceSpan;\n layoutPropertySpan?: CanvasSourceSpan;\n layout: ParsedCanvasLayout;\n layoutSpans?: ParsedCanvasLayoutSpans;\n errors: CanvasParseError[];\n};\n\ntype ObjectStringBindings = Map<\n string,\n Map<string, { value: string; span: CanvasSourceSpan }>\n>;\n\nconst SDK_IMPORT_SOURCES = new Set([\n \"tempo-sdk/canvas\",\n \"tempo-sdk/canvas/svelte\",\n]);\n\nconst SDK_COMPONENTS = new Set<SdkComponent>([\n \"Canvas\",\n \"Storyboard\",\n \"SvelteStoryboard\",\n \"LegacyStoryboardV1\",\n \"RouteStoryboard\",\n \"HtmlStoryboard\",\n]);\n\n// Must stay in sync with runtime value exports from tempo-sdk/canvas/index.ts.\nconst SDK_CANVAS_VALUE_EXPORTS = new Set([\n \"Canvas\",\n \"CanvasContext\",\n \"getCanvasStoryboardRenderId\",\n \"CanvasHost\",\n \"buildRenderContentFiberSelector\",\n \"buildRenderContentSelector\",\n \"buildRenderSelector\",\n \"captureStoryboardCombined\",\n \"captureStoryboardHtml\",\n \"captureStoryboardImage\",\n \"stripRenderContentWrapperAttributes\",\n \"stripRenderContentWrapperFromCombinedCapture\",\n \"watchStoryboardCombined\",\n \"getCanvasHostRuntime\",\n \"getOptionalCanvasHostRuntime\",\n \"useActiveState\",\n \"HtmlStoryboard\",\n \"LegacyStoryboardV1\",\n \"RouteStoryboard\",\n \"Storyboard\",\n \"StoryboardSlot\",\n]);\n\nconst DEFAULT_LAYOUT: ParsedCanvasLayout = {\n x: 0,\n y: 0,\n};\n\nconst DEFAULT_VIEWPORT_LAYOUT: ParsedCanvasLayout = {\n ...DEFAULT_LAYOUT,\n width: 600,\n height: 400,\n};\n\n/** Emitted when a file parses cleanly but declares no `<Canvas>` — for\n * readers that need to distinguish \"legacy page format\" from \"broken\". */\nexport const NO_CANVAS_DECLARATION_ERROR =\n \"No <Canvas> declaration found in canvas file\";\n\nexport function parseCanvasFile(\n filePath: string,\n source: string,\n): ParsedCanvasFile {\n const errors: CanvasParseError[] = [];\n let program: any;\n\n try {\n const result = parseSync(filePath, source) as any;\n program = result.program;\n for (const error of result.errors ?? []) {\n errors.push({\n message: error.message ?? \"Unable to parse canvas source\",\n span: toSpan(error) ?? toSpan(error?.labels?.[0]),\n kind: \"structural\",\n });\n }\n } catch (error) {\n return {\n filePath,\n pageName: fallbackPageName(filePath),\n imports: [],\n misimportedSdkCanvasImports: [],\n storyboards: [],\n errors: [\n {\n message:\n error instanceof Error\n ? error.message\n : \"Unable to parse canvas source\",\n kind: \"structural\",\n },\n ],\n };\n }\n\n const imports = readImports(program);\n const misimportedSdkCanvasImports = readMisimportedSdkCanvasImports(program);\n const { legacyObjects, stringBindings: objectStringBindings } =\n readObjectExpressionBindings(program, imports, source);\n let canvasElement: any | null = null;\n const allStoryboardElements: StoryboardElement[] = [];\n\n walk(program, (node) => {\n if (node.type !== \"JSXElement\") return;\n\n const component = resolveSdkComponent(node.openingElement?.name, imports);\n const namespaceMisimport = resolveMisimportedNamespaceSdkComponent(\n node.openingElement?.name,\n imports,\n misimportedSdkCanvasImports,\n );\n if (namespaceMisimport) {\n misimportedSdkCanvasImports.add(namespaceMisimport);\n }\n\n if (component === \"Canvas\") {\n if (!canvasElement) {\n canvasElement = node;\n } else {\n errors.push({\n message: \"Canvas file must declare exactly one <Canvas> element\",\n span: toSpan(node),\n kind: \"structural\",\n });\n }\n return;\n }\n\n if (isStoryboardSdkComponent(component)) {\n allStoryboardElements.push({ element: node, component });\n }\n });\n\n const directStoryboardElements = canvasElement\n ? readDirectCanvasStoryboardElements(canvasElement, imports)\n : [];\n const directStoryboardElementSet = new Set(\n directStoryboardElements.map((item) => item.element),\n );\n\n const storyboards = directStoryboardElements.map((item) =>\n readStoryboard(\n item.element,\n item.component,\n imports,\n legacyObjects,\n source,\n errors,\n ),\n );\n\n // Storyboard identity and layout only map faithfully when declarations are\n // direct Canvas children; anything else has no stable page-stack position.\n for (const item of allStoryboardElements) {\n if (directStoryboardElementSet.has(item.element)) continue;\n errors.push({\n message: `<${item.component}> declarations must be direct children of the <Canvas> element`,\n span: toSpan(item.element),\n kind: \"structural\",\n });\n }\n\n reportDuplicateStoryboardIds(storyboards, errors);\n\n if (!canvasElement) {\n if (misimportedSdkCanvasImports.all.length > 0) {\n for (const entry of misimportedSdkCanvasImports.all) {\n errors.push({\n message: misimportedSdkCanvasImportMessage(entry),\n span: entry.sourceSpan,\n kind: \"structural\",\n });\n }\n } else {\n errors.push({\n message: NO_CANVAS_DECLARATION_ERROR,\n kind: \"structural\",\n });\n }\n } else {\n errors.push(...validateCanvasChildren(canvasElement, imports));\n }\n\n const openingElement = canvasElement?.openingElement;\n const name = readResolvableStringAttribute(\n openingElement,\n \"name\",\n objectStringBindings,\n );\n const path = readStringAttribute(openingElement, \"path\");\n const backgroundColor =\n readResolvableStringAttribute(\n openingElement,\n \"backgroundColor\",\n objectStringBindings,\n ) ??\n readResolvableStringAttribute(\n openingElement,\n \"background\",\n objectStringBindings,\n );\n\n if (openingElement && !name) {\n errors.push({\n message: '<Canvas> must include a literal \"name\" prop',\n span: toSpan(openingElement),\n kind: \"degraded\",\n });\n }\n\n return {\n filePath,\n canvasPath: path?.value,\n pageName: name?.value ?? fallbackPageName(filePath),\n backgroundColor: backgroundColor?.value,\n canvasElementSpan: toSpan(canvasElement),\n canvasOpeningElementSpan: toSpan(openingElement),\n canvasChildrenInsertionOffset:\n typeof canvasElement?.closingElement?.start === \"number\"\n ? canvasElement.closingElement.start\n : undefined,\n nameSpan: name?.valueSpan,\n nameAttributeSpan: name?.attributeSpan,\n pathSpan: path?.valueSpan,\n pathAttributeSpan: path?.attributeSpan,\n backgroundColorSpan: backgroundColor?.valueSpan,\n backgroundColorAttributeSpan: backgroundColor?.attributeSpan,\n imports: imports.all,\n misimportedSdkCanvasImports: misimportedSdkCanvasImports.all,\n storyboards,\n errors,\n };\n}\n\ntype MutableMisimportedSdkCanvasImports = {\n all: MisimportedSdkCanvasImport[];\n byDeclarationKey: Map<string, MisimportedSdkCanvasImport>;\n namespaceCandidatesByLocalName: Map<string, MisimportedSdkCanvasImport>;\n add(entry: MisimportedSdkCanvasImport): void;\n};\n\nexport function misimportedSdkCanvasImportMessage(\n entry: MisimportedSdkCanvasImport,\n): string {\n return `Tempo canvas components must be imported from \"tempo-sdk/canvas\" — found import of ${entry.importedNames.join(\", \")} from \"${entry.source}\"`;\n}\n\nfunction readMisimportedSdkCanvasImports(\n program: any,\n): MutableMisimportedSdkCanvasImports {\n const all: MisimportedSdkCanvasImport[] = [];\n const byDeclarationKey = new Map<string, MisimportedSdkCanvasImport>();\n const namespaceCandidatesByLocalName = new Map<\n string,\n MisimportedSdkCanvasImport\n >();\n const add = (entry: MisimportedSdkCanvasImport) => {\n const key = spanKey(entry.sourceSpan);\n if (byDeclarationKey.has(key)) return;\n byDeclarationKey.set(key, entry);\n all.push(entry);\n };\n\n for (const statement of program?.body ?? []) {\n if (\n statement?.type !== \"ImportDeclaration\" ||\n typeof statement.source?.value !== \"string\" ||\n !isWrongTempoSdkCanvasImportSource(statement.source.value) ||\n statement.importKind === \"type\"\n ) {\n continue;\n }\n\n const source = statement.source.value;\n const sourceSpan = toSpan(statement.source);\n if (!sourceSpan) continue;\n\n const valueSpecifiers = (statement.specifiers ?? []).filter(\n (specifier: any) => specifier?.importKind !== \"type\",\n );\n const importedNames = valueSpecifiers.map(readImportedName);\n const entry: MisimportedSdkCanvasImport = {\n source,\n sourceSpan,\n importedNames,\n rewritable:\n valueSpecifiers.length > 0 &&\n valueSpecifiers.every(\n (specifier: any) =>\n specifier?.type === \"ImportSpecifier\" &&\n SDK_CANVAS_VALUE_EXPORTS.has(readImportedName(specifier)),\n ),\n };\n\n const hasMisimportedNamedSdkComponent = valueSpecifiers.some(\n (specifier: any) =>\n specifier?.type === \"ImportSpecifier\" &&\n SDK_COMPONENTS.has(readImportedName(specifier) as SdkComponent),\n );\n if (hasMisimportedNamedSdkComponent) {\n add(entry);\n }\n\n for (const specifier of valueSpecifiers) {\n if (specifier?.type !== \"ImportNamespaceSpecifier\") continue;\n const localName = specifier.local?.name;\n if (typeof localName === \"string\") {\n namespaceCandidatesByLocalName.set(localName, entry);\n }\n }\n }\n\n return { all, byDeclarationKey, namespaceCandidatesByLocalName, add };\n}\n\nfunction readImports(program: any): ParsedImports {\n const all: ParsedCanvasImport[] = [];\n const byLocalName = new Map<string, ParsedCanvasImport>();\n const sdkLocalNames = new Map<string, SdkComponent>();\n const sdkNamespaces = new Set<string>();\n\n for (const statement of program?.body ?? []) {\n if (\n statement?.type !== \"ImportDeclaration\" ||\n typeof statement.source?.value !== \"string\"\n ) {\n continue;\n }\n\n const source = statement.source.value;\n const isSdkImport = isSdkImportSource(source);\n\n for (const specifier of statement.specifiers ?? []) {\n const localName = specifier.local?.name;\n if (typeof localName !== \"string\") continue;\n\n const importedName = readImportedName(specifier);\n const imported: ParsedCanvasImport = {\n localName,\n source,\n importedName,\n kind: readImportKind(specifier),\n importKind: specifier.importKind === \"type\" ? \"type\" : \"value\",\n span: toSpan(specifier) ?? toSpan(statement) ?? { start: 0, end: 0 },\n declarationSpan: toSpan(statement) ?? { start: 0, end: 0 },\n specifierCount: statement.specifiers?.length ?? 0,\n namedSpecifierCount: (statement.specifiers ?? []).filter(\n (item: any) => item?.type === \"ImportSpecifier\",\n ).length,\n hasDefaultSpecifier: (statement.specifiers ?? []).some(\n (item: any) => item?.type === \"ImportDefaultSpecifier\",\n ),\n hasNamespaceSpecifier: (statement.specifiers ?? []).some(\n (item: any) => item?.type === \"ImportNamespaceSpecifier\",\n ),\n };\n\n all.push(imported);\n byLocalName.set(localName, imported);\n\n if (!isSdkImport) continue;\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n sdkNamespaces.add(localName);\n continue;\n }\n\n if (SDK_COMPONENTS.has(importedName as SdkComponent)) {\n sdkLocalNames.set(localName, importedName as SdkComponent);\n }\n }\n }\n\n return { all, byLocalName, sdkLocalNames, sdkNamespaces };\n}\n\nfunction readObjectExpressionBindings(\n program: any,\n imports: ParsedImports,\n source: string,\n): {\n legacyObjects: Map<string, ParsedLegacyStoryboardObject>;\n stringBindings: ObjectStringBindings;\n} {\n const legacyObjects = new Map<string, ParsedLegacyStoryboardObject>();\n const stringBindings: ObjectStringBindings = new Map();\n\n // Canvas metadata and legacy storyboard objects are module-level authoring\n // contracts; function-local shadowing must not change parsed identities.\n for (const node of readTopLevelVariableDeclarators(program)) {\n if (node.id?.type !== \"Identifier\") {\n continue;\n }\n const objectExpression = unwrapTsExpression(node.init);\n if (objectExpression?.type !== \"ObjectExpression\") continue;\n\n const bindingName = node.id.name;\n legacyObjects.set(\n bindingName,\n readLegacyStoryboardObject(\n bindingName,\n objectExpression,\n imports,\n source,\n ),\n );\n\n const stringProperties = readObjectStringProperties(objectExpression);\n if (stringProperties.size > 0) {\n stringBindings.set(bindingName, stringProperties);\n }\n }\n\n return { legacyObjects, stringBindings };\n}\n\nfunction readTopLevelVariableDeclarators(program: any): any[] {\n const declarators: any[] = [];\n\n for (const statement of program?.body ?? []) {\n const declaration =\n statement?.type === \"VariableDeclaration\"\n ? statement\n : statement?.type === \"ExportNamedDeclaration\" &&\n statement.declaration?.type === \"VariableDeclaration\"\n ? statement.declaration\n : null;\n if (!declaration) continue;\n declarators.push(...(declaration.declarations ?? []));\n }\n\n return declarators;\n}\n\nfunction readLegacyStoryboardObject(\n bindingName: string,\n objectExpression: any,\n imports: ParsedImports,\n source: string,\n): ParsedLegacyStoryboardObject {\n const errors: CanvasParseError[] = [];\n const nameProperty = getObjectProperty(objectExpression, \"name\");\n const name = nameProperty ? readStringLiteralValue(nameProperty.value) : null;\n const layoutProperty = getObjectProperty(objectExpression, \"layout\");\n const layout: {\n value: ParsedCanvasLayout;\n spans?: ParsedCanvasLayoutSpans;\n errors: CanvasParseError[];\n } = layoutProperty\n ? readLayoutExpression(layoutProperty.value, \"LegacyStoryboardV1\")\n : {\n value: DEFAULT_LAYOUT,\n errors: [\n {\n message:\n '<LegacyStoryboardV1> storyboard object must include a literal \"layout\" object',\n span: toSpan(objectExpression),\n kind: \"degraded\",\n },\n ],\n };\n const renderProperty = getObjectProperty(objectExpression, \"render\");\n const component = readRenderComponentReference(\n renderProperty?.value,\n imports,\n source,\n );\n\n if (nameProperty && !name) {\n errors.push({\n message:\n \"<LegacyStoryboardV1> storyboard.name must be a string literal when set\",\n span: toSpan(nameProperty),\n kind: \"degraded\",\n });\n }\n errors.push(...layout.errors);\n\n return {\n bindingName,\n displayName: name?.value,\n component: component ?? undefined,\n objectSpan: toSpan(objectExpression),\n objectClose: readLayoutClose(objectExpression),\n nameSpan: name?.span,\n namePropertySpan: toSpan(nameProperty),\n layoutPropertySpan: toSpan(layoutProperty),\n layout: layout.value,\n layoutSpans: layout.spans,\n errors,\n };\n}\n\nfunction readObjectStringProperties(\n objectExpression: any,\n): Map<string, { value: string; span: CanvasSourceSpan }> {\n const properties = new Map<\n string,\n { value: string; span: CanvasSourceSpan }\n >();\n for (const property of objectExpression.properties ?? []) {\n if (property?.type !== \"Property\" || property.computed) continue;\n const propertyName = readPropertyKeyName(property.key);\n const value = readStringLiteralValue(property.value);\n if (!propertyName || !value) continue;\n properties.set(propertyName, value);\n }\n return properties;\n}\n\nfunction readStoryboard(\n element: any,\n component: Exclude<SdkComponent, \"Canvas\">,\n imports: ParsedImports,\n legacyObjects: Map<string, ParsedLegacyStoryboardObject>,\n source: string,\n globalErrors: CanvasParseError[],\n): ParsedCanvasStoryboard {\n const openingElement = element.openingElement;\n const errors: CanvasParseError[] = [];\n const id = readStringAttribute(openingElement, \"id\");\n const name = readStringAttribute(openingElement, \"name\");\n const legacyReference =\n component === \"LegacyStoryboardV1\"\n ? readExpressionReference(openingElement, \"storyboard\", source)\n : undefined;\n const legacyObject =\n legacyReference?.expression &&\n isIdentifierExpression(legacyReference.expression)\n ? legacyObjects.get(legacyReference.expression)\n : undefined;\n const layout =\n component === \"LegacyStoryboardV1\"\n ? {\n value: legacyObject?.layout ?? DEFAULT_LAYOUT,\n spans: legacyObject?.layoutSpans,\n attributeSpan: undefined,\n errors:\n legacyObject?.errors ??\n (legacyReference\n ? [\n {\n message:\n \"<LegacyStoryboardV1> storyboard prop must reference a same-file object literal\",\n span: legacyReference.span,\n kind: \"degraded\",\n },\n ]\n : [\n {\n message:\n '<LegacyStoryboardV1> must include a \"storyboard\" expression prop',\n span: toSpan(openingElement),\n kind: \"degraded\",\n },\n ]),\n }\n : readLayout(openingElement, component);\n const kind =\n component === \"Storyboard\" ||\n component === \"SvelteStoryboard\" ||\n component === \"LegacyStoryboardV1\"\n ? \"component\"\n : component === \"RouteStoryboard\"\n ? \"route\"\n : \"html\";\n\n if (!id) {\n errors.push({\n message: `<${component}> must include a literal \"id\" prop`,\n span: toSpan(openingElement),\n kind: \"structural\",\n });\n }\n\n if (layout.errors.length > 0) {\n errors.push(...layout.errors);\n }\n\n const storyboard: ParsedCanvasStoryboard = {\n storyboardKey: id?.value ?? \"\",\n displayName: name?.value ?? legacyObject?.displayName,\n kind,\n ...(component === \"SvelteStoryboard\"\n ? { uiFramework: \"svelte\" as const }\n : {}),\n layout: layout.value,\n editable: Boolean(id) && layout.errors.length === 0,\n jsxElementSpan: toSpan(element) ?? { start: 0, end: 0 },\n openingElementSpan: toSpan(openingElement),\n idSpan: id?.valueSpan,\n idAttributeSpan: id?.attributeSpan,\n nameSpan: name?.valueSpan ?? legacyObject?.nameSpan,\n nameAttributeSpan: name?.attributeSpan ?? legacyObject?.namePropertySpan,\n layoutAttributeSpan: layout.attributeSpan,\n layoutSpans: layout.spans,\n props: readExpressionReference(openingElement, \"props\", source),\n component: legacyObject?.component,\n legacyV1: legacyReference\n ? {\n storyboard: legacyReference,\n objectName: legacyObject?.bindingName,\n objectSpan: legacyObject?.objectSpan,\n objectClose: legacyObject?.objectClose,\n namePropertySpan: legacyObject?.namePropertySpan,\n layoutPropertySpan: legacyObject?.layoutPropertySpan,\n }\n : undefined,\n errors,\n };\n\n if (component === \"Storyboard\" || component === \"SvelteStoryboard\") {\n const componentReference = readComponentReference(\n openingElement,\n imports,\n source,\n );\n if (componentReference) {\n storyboard.component = componentReference;\n } else {\n errors.push({\n message: `<${component}> must include a \"component\" expression prop`,\n span: toSpan(openingElement),\n kind: \"degraded\",\n });\n }\n }\n\n if (\n component === \"Storyboard\" ||\n component === \"SvelteStoryboard\" ||\n component === \"HtmlStoryboard\"\n ) {\n const vrt = readVrt(openingElement, errors);\n if (vrt) {\n if (vrt.value) {\n storyboard.vrt = vrt.value;\n }\n storyboard.vrtAttributeSpan = vrt.attributeSpan;\n }\n }\n\n if (component === \"RouteStoryboard\") {\n const route = readStringAttribute(openingElement, \"route\");\n if (route) {\n storyboard.route = route.value;\n storyboard.routeSpan = route.valueSpan;\n storyboard.routeAttributeSpan = route.attributeSpan;\n } else {\n errors.push({\n message: '<RouteStoryboard> must include a literal \"route\" prop',\n span: toSpan(openingElement),\n kind: \"degraded\",\n });\n }\n }\n\n if (component === \"HtmlStoryboard\") {\n const filepath = readStringAttribute(openingElement, \"filepath\");\n const src = readStringAttribute(openingElement, \"src\");\n storyboard.filepath = filepath?.value.trim() ? filepath.value : undefined;\n storyboard.filepathSpan = filepath?.valueSpan;\n storyboard.filepathAttributeSpan = filepath?.attributeSpan;\n storyboard.src = src?.value;\n storyboard.srcSpan = src?.valueSpan;\n storyboard.srcAttributeSpan = src?.attributeSpan;\n if (!filepath?.value.trim() && !src?.value.trim()) {\n errors.push({\n message:\n '<HtmlStoryboard> must include a literal \"filepath\" or \"src\" prop',\n span: toSpan(openingElement),\n kind: \"degraded\",\n });\n }\n }\n\n globalErrors.push(...errors);\n return storyboard;\n}\n\nfunction readDirectCanvasStoryboardElements(\n canvasElement: any,\n imports: ParsedImports,\n): StoryboardElement[] {\n const elements: StoryboardElement[] = [];\n\n for (const child of canvasElement.children ?? []) {\n if (child?.type !== \"JSXElement\") continue;\n const component = resolveSdkComponent(child.openingElement?.name, imports);\n if (isStoryboardSdkComponent(component)) {\n elements.push({ element: child, component });\n }\n }\n\n return elements;\n}\n\nfunction reportDuplicateStoryboardIds(\n storyboards: ParsedCanvasStoryboard[],\n errors: CanvasParseError[],\n) {\n const byId = new Map<string, ParsedCanvasStoryboard[]>();\n\n for (const storyboard of storyboards) {\n if (!storyboard.storyboardKey) continue;\n const matching = byId.get(storyboard.storyboardKey);\n if (matching) {\n matching.push(storyboard);\n } else {\n byId.set(storyboard.storyboardKey, [storyboard]);\n }\n }\n\n for (const [storyboardKey, matching] of byId) {\n if (matching.length < 2) continue;\n errors.push({\n message: `Duplicate storyboard id \"${storyboardKey}\" (${matching.length} declarations) — storyboard ids must be unique`,\n span: matching[1]?.jsxElementSpan,\n kind: \"structural\",\n });\n }\n}\n\nfunction validateCanvasChildren(\n canvasElement: any,\n imports: ParsedImports,\n): CanvasParseError[] {\n const errors: CanvasParseError[] = [];\n\n for (const child of canvasElement.children ?? []) {\n if (!child) continue;\n if (child.type === \"JSXText\") {\n if (typeof child.value === \"string\" && child.value.trim() === \"\") {\n continue;\n }\n }\n if (child.type === \"JSXExpressionContainer\") {\n if (child.expression?.type === \"JSXEmptyExpression\") {\n continue;\n }\n errors.push({\n message:\n \"<Canvas> children must be static storyboard declarations, not expressions\",\n span: toSpan(child),\n kind: \"structural\",\n });\n continue;\n }\n if (child.type === \"JSXElement\") {\n const component = resolveSdkComponent(\n child.openingElement?.name,\n imports,\n );\n if (\n component === \"Storyboard\" ||\n component === \"SvelteStoryboard\" ||\n component === \"LegacyStoryboardV1\" ||\n component === \"RouteStoryboard\" ||\n component === \"HtmlStoryboard\"\n ) {\n continue;\n }\n }\n errors.push({\n message:\n \"<Canvas> children must be <Storyboard>, <SvelteStoryboard>, <RouteStoryboard>, <HtmlStoryboard>, or <LegacyStoryboardV1> declarations\",\n span: toSpan(child),\n kind: \"structural\",\n });\n }\n\n return errors;\n}\n\n/**\n * Reads the opt-in `vrt` prop on a `<Storyboard>` (TEM-1775). Only statically\n * analyzable literal shapes are tracked — the mark is a build-time manifest,\n * so a dynamic expression is a degraded parse error, never a guess:\n * `vrt` / `vrt={true}` → tracked with defaults ({})\n * `vrt={false}` → untracked (absent)\n * `vrt={{ threshold, skip, ignore }}` → tracked with overrides\n */\nfunction readVrt(\n openingElement: any,\n errors: CanvasParseError[],\n): {\n /** Null when the attribute exists but reads as untracked (`vrt={false}`,\n * dynamic / malformed forms). The span stays so editors can target the\n * declaration without inserting a duplicate. */\n value: ParsedStoryboardVrt | null;\n attributeSpan?: CanvasSourceSpan;\n} | null {\n const attribute = getAttribute(openingElement, \"vrt\");\n if (!attribute) return null;\n const attributeSpan = toSpan(attribute);\n\n // Bare `vrt` (no value) — tracked with defaults.\n if (attribute.value == null) {\n return { value: {}, attributeSpan };\n }\n\n const expression = unwrapTsExpression(\n unwrapAttributeExpression(attribute.value),\n );\n if (expression?.type === \"Literal\" && expression.value === true) {\n return { value: {}, attributeSpan };\n }\n if (expression?.type === \"Literal\" && expression.value === false) {\n return { value: null, attributeSpan };\n }\n if (expression?.type !== \"ObjectExpression\") {\n errors.push({\n message:\n \"<Storyboard> vrt must be a boolean literal or an object literal ({ threshold?, skip?, ignore? })\",\n span: toSpan(expression) ?? attributeSpan,\n kind: \"degraded\",\n });\n return { value: null, attributeSpan };\n }\n\n const value: ParsedStoryboardVrt = {};\n for (const property of expression.properties ?? []) {\n if (property?.type !== \"Property\" || property.computed) {\n errors.push({\n message: \"<Storyboard> vrt must contain only literal properties\",\n span: toSpan(property ?? expression),\n kind: \"degraded\",\n });\n continue;\n }\n const key = readPropertyKeyName(property.key);\n if (key === \"threshold\") {\n // Capped at 0.5: beyond that pixelmatch is effectively blind and the\n // \"tracked\" mark would be a lie — black→white passes at threshold 1.\n const threshold = readNumberLiteral(property.value);\n if (threshold && threshold.value >= 0 && threshold.value <= 0.5) {\n value.threshold = threshold.value;\n } else {\n errors.push({\n message:\n \"<Storyboard> vrt.threshold must be a number literal between 0 and 0.5\",\n span: toSpan(property),\n kind: \"degraded\",\n });\n }\n continue;\n }\n if (key === \"skip\") {\n if (\n property.value?.type === \"Literal\" &&\n typeof property.value.value === \"boolean\"\n ) {\n if (property.value.value) value.skip = true;\n } else {\n errors.push({\n message: \"<Storyboard> vrt.skip must be a boolean literal\",\n span: toSpan(property),\n kind: \"degraded\",\n });\n }\n continue;\n }\n if (key === \"ignore\") {\n const regions = readVrtIgnoreRegions(property.value, errors);\n if (regions) value.ignore = regions;\n continue;\n }\n errors.push({\n message: `<Storyboard> vrt has unknown property \"${key ?? \"?\"}\" — expected threshold, skip, or ignore`,\n span: toSpan(property),\n kind: \"degraded\",\n });\n }\n\n return { value, attributeSpan };\n}\n\nfunction readVrtIgnoreRegions(\n node: any,\n errors: CanvasParseError[],\n): ParsedStoryboardVrtIgnoreRegion[] | null {\n if (node?.type !== \"ArrayExpression\") {\n errors.push({\n message:\n \"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals\",\n span: toSpan(node),\n kind: \"degraded\",\n });\n return null;\n }\n const regions: ParsedStoryboardVrtIgnoreRegion[] = [];\n for (const element of node.elements ?? []) {\n const region: Partial<ParsedStoryboardVrtIgnoreRegion> = {};\n for (const key of [\"x\", \"y\", \"w\", \"h\"] as const) {\n const property = getObjectProperty(element, key);\n const number = property ? readNumberLiteral(property.value) : null;\n if (number) region[key] = number.value;\n }\n if (\n region.x === undefined ||\n region.y === undefined ||\n region.w === undefined ||\n region.h === undefined\n ) {\n errors.push({\n message:\n \"<Storyboard> vrt.ignore regions must be { x, y, w, h } number literals\",\n span: toSpan(element) ?? toSpan(node),\n kind: \"degraded\",\n });\n return null;\n }\n regions.push(region as ParsedStoryboardVrtIgnoreRegion);\n }\n return regions;\n}\n\nfunction readComponentReference(\n openingElement: any,\n imports: ParsedImports,\n source: string,\n): ParsedCanvasComponentReference | null {\n const attribute = getAttribute(openingElement, \"component\");\n const expression = unwrapAttributeExpression(attribute?.value);\n const span = toSpan(expression);\n if (!expression || !span) return null;\n\n const localName =\n expression.type === \"Identifier\"\n ? expression.name\n : expression.type === \"MemberExpression\" &&\n expression.object?.type === \"Identifier\"\n ? expression.object.name\n : undefined;\n\n return {\n expression: source.slice(span.start, span.end),\n span,\n attributeSpan: toSpan(attribute),\n localName,\n import: localName ? imports.byLocalName.get(localName) : undefined,\n };\n}\n\nfunction readRenderComponentReference(\n renderValue: any,\n imports: ParsedImports,\n source: string,\n): ParsedCanvasComponentReference | null {\n if (renderValue?.type !== \"ArrowFunctionExpression\") return null;\n const body = unwrapTsExpression(renderValue.body);\n if (body?.type !== \"JSXElement\") return null;\n const name = body.openingElement?.name;\n if (name?.type !== \"JSXIdentifier\") return null;\n\n const span = toSpan(name);\n if (!span || typeof name.name !== \"string\") return null;\n\n return {\n expression: source.slice(span.start, span.end),\n span,\n localName: name.name,\n import: imports.byLocalName.get(name.name),\n };\n}\n\nfunction readExpressionReference(\n openingElement: any,\n name: string,\n source: string,\n): ParsedCanvasExpressionReference | undefined {\n const attribute = getAttribute(openingElement, name);\n const expression = unwrapAttributeExpression(attribute?.value);\n const span = toSpan(expression);\n if (!expression || !span) return undefined;\n return {\n expression: source.slice(span.start, span.end),\n span,\n attributeSpan: toSpan(attribute),\n };\n}\n\nfunction isIdentifierExpression(expression: string): boolean {\n return /^[A-Za-z_$][\\w$]*$/.test(expression);\n}\n\nfunction readLayout(\n openingElement: any,\n componentName: string,\n): {\n value: ParsedCanvasLayout;\n attributeSpan?: CanvasSourceSpan;\n spans?: ParsedCanvasLayoutSpans;\n errors: CanvasParseError[];\n} {\n const isViewport =\n componentName === \"RouteStoryboard\" || componentName === \"HtmlStoryboard\";\n const attribute = getAttribute(openingElement, \"layout\");\n const expression = unwrapAttributeExpression(attribute?.value);\n\n if (!expression) {\n return {\n value: isViewport ? DEFAULT_VIEWPORT_LAYOUT : DEFAULT_LAYOUT,\n attributeSpan: toSpan(attribute),\n errors: [\n {\n message: `<${componentName}> must include a literal \"layout\" object prop`,\n span: toSpan(openingElement),\n kind: \"degraded\",\n },\n ],\n };\n }\n\n const layout = readLayoutExpression(expression, componentName);\n return {\n ...layout,\n attributeSpan: toSpan(attribute),\n };\n}\n\nfunction readLayoutExpression(\n expression: any,\n componentName: string,\n): {\n value: ParsedCanvasLayout;\n spans?: ParsedCanvasLayoutSpans;\n errors: CanvasParseError[];\n} {\n const errors: CanvasParseError[] = [];\n const isViewport =\n componentName === \"RouteStoryboard\" || componentName === \"HtmlStoryboard\";\n\n if (expression.type !== \"ObjectExpression\") {\n return {\n value: isViewport ? DEFAULT_VIEWPORT_LAYOUT : DEFAULT_LAYOUT,\n spans: { layoutClose: readLayoutClose(expression) },\n errors: [\n {\n message: `<${componentName}> layout must be an object literal`,\n span: toSpan(expression),\n kind: \"degraded\",\n },\n ],\n };\n }\n\n const spans: ParsedCanvasLayoutSpans = {\n layoutClose: readLayoutClose(expression),\n };\n const layout: ParsedCanvasLayout = { ...DEFAULT_LAYOUT };\n\n const width = getObjectProperty(expression, \"width\");\n const height = getObjectProperty(expression, \"height\");\n const legacySizing = getObjectProperty(expression, \"intrinsicSizing\");\n const legacyResponsiveFlag = legacySizing?.value?.value === \"root-element\";\n const hasBothSizes = Boolean(width && height);\n const readSize = isViewport || (hasBothSizes && !legacyResponsiveFlag);\n const incompleteSize = !isViewport && Boolean(width) !== Boolean(height);\n if (incompleteSize) {\n errors.push({\n message: \"layout.width and layout.height must be set together\",\n span: toSpan(expression),\n kind: \"degraded\",\n });\n }\n const size = readSize\n ? {\n width: width ? readNumberLiteral(width.value) : null,\n height: height ? readNumberLiteral(height.value) : null,\n }\n : null;\n const keys = readSize\n ? ([\"x\", \"y\", \"width\", \"height\"] as const)\n : ([\"x\", \"y\"] as const);\n for (const key of keys) {\n const property =\n key === \"width\"\n ? width\n : key === \"height\"\n ? height\n : getObjectProperty(expression, key);\n const value =\n key === \"width\" || key === \"height\"\n ? size?.[key]\n : property\n ? readNumberLiteral(property.value)\n : null;\n const keepValue =\n key === \"x\" ||\n key === \"y\" ||\n isViewport ||\n Boolean(size?.width && size.height);\n if (!value) {\n errors.push({\n message: `<${componentName}> layout.${key} must be a number literal`,\n span: toSpan(property ?? expression),\n kind: \"degraded\",\n });\n continue;\n }\n if (!keepValue) continue;\n layout[key] = value.value;\n spans[key] = value.span;\n }\n\n const zIndex = getObjectProperty(expression, \"zIndex\");\n if (zIndex) {\n const value = readNumberLiteral(zIndex.value);\n if (value) {\n layout.zIndex = value.value;\n spans.zIndex = value.span;\n } else {\n errors.push({\n message: `<${componentName}> layout.zIndex must be a number literal`,\n span: toSpan(zIndex),\n kind: \"degraded\",\n });\n }\n }\n\n const invalidLegacyFlag =\n legacySizing &&\n (legacySizing.value?.type !== \"Literal\" || !legacyResponsiveFlag);\n if (invalidLegacyFlag) {\n errors.push({\n message: `<${componentName}> layout.intrinsicSizing must be \"root-element\" when set`,\n span: toSpan(legacySizing),\n kind: \"degraded\",\n });\n }\n\n return { value: layout, spans, errors };\n}\n\nfunction readStringLiteralValue(\n node: any,\n): { value: string; span: CanvasSourceSpan } | null {\n return node?.type === \"Literal\" && typeof node.value === \"string\"\n ? { value: node.value, span: toSpan(node) ?? { start: 0, end: 0 } }\n : null;\n}\n\nexport function unwrapTsExpression(node: any): any {\n let current = node;\n while (\n current?.type === \"TSSatisfiesExpression\" ||\n current?.type === \"TSAsExpression\" ||\n current?.type === \"TSNonNullExpression\" ||\n current?.type === \"ParenthesizedExpression\"\n ) {\n current = current.expression;\n }\n return current;\n}\n\nfunction readResolvableStringAttribute(\n openingElement: any,\n name: string,\n bindings: ObjectStringBindings,\n): {\n value: string;\n valueSpan: CanvasSourceSpan;\n attributeSpan: CanvasSourceSpan;\n} | null {\n const literal = readStringAttribute(openingElement, name);\n if (literal) return literal;\n\n const attribute = getAttribute(openingElement, name);\n const expression = unwrapAttributeExpression(attribute?.value);\n const expressionSpan = toSpan(expression);\n const attributeSpan = toSpan(attribute);\n if (!expression || !expressionSpan || !attributeSpan) return null;\n\n const resolved = resolveStringMemberExpression(expression, bindings);\n return resolved\n ? {\n value: resolved.value,\n valueSpan: expressionSpan,\n attributeSpan,\n }\n : null;\n}\n\nfunction resolveStringMemberExpression(\n expression: any,\n bindings: ObjectStringBindings,\n): { value: string; span: CanvasSourceSpan } | null {\n if (expression?.type !== \"MemberExpression\") return null;\n if (expression.object?.type !== \"Identifier\") return null;\n const propertyName = readPropertyKeyName(expression.property);\n if (!propertyName) return null;\n return bindings.get(expression.object.name)?.get(propertyName) ?? null;\n}\n\nfunction readStringAttribute(\n openingElement: any,\n name: string,\n): {\n value: string;\n valueSpan: CanvasSourceSpan;\n attributeSpan: CanvasSourceSpan;\n} | null {\n const attribute = getAttribute(openingElement, name);\n if (!attribute) return null;\n\n const value = attribute.value;\n if (value?.type === \"Literal\" && typeof value.value === \"string\") {\n return {\n value: value.value,\n valueSpan: toSpan(value) ?? toSpan(attribute) ?? { start: 0, end: 0 },\n attributeSpan: toSpan(attribute) ?? { start: 0, end: 0 },\n };\n }\n\n const expression = unwrapAttributeExpression(value);\n if (expression?.type === \"Literal\" && typeof expression.value === \"string\") {\n return {\n value: expression.value,\n valueSpan: toSpan(expression) ??\n toSpan(attribute) ?? { start: 0, end: 0 },\n attributeSpan: toSpan(attribute) ?? { start: 0, end: 0 },\n };\n }\n return null;\n}\n\nfunction getAttribute(openingElement: any, name: string): any | null {\n for (const attribute of openingElement?.attributes ?? []) {\n if (\n attribute?.type === \"JSXAttribute\" &&\n attribute.name?.type === \"JSXIdentifier\" &&\n attribute.name.name === name\n ) {\n return attribute;\n }\n }\n return null;\n}\n\nfunction unwrapAttributeExpression(value: any): any | null {\n if (!value) return null;\n if (value.type === \"JSXExpressionContainer\") {\n return value.expression;\n }\n return value;\n}\n\nfunction readPropertyKeyName(key: any): string | null {\n if (key?.type === \"Identifier\") return key.name;\n if (key?.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n}\n\nfunction getObjectProperty(objectExpression: any, name: string): any | null {\n if (objectExpression?.type !== \"ObjectExpression\") return null;\n for (const property of objectExpression.properties ?? []) {\n if (property?.type !== \"Property\" || property.computed) continue;\n const propertyName = readPropertyKeyName(property.key);\n if (propertyName === name) return property;\n }\n return null;\n}\n\nfunction readNumberLiteral(\n node: any,\n): { value: number; span: CanvasSourceSpan } | null {\n if (\n node?.type === \"Literal\" &&\n typeof node.value === \"number\" &&\n Number.isFinite(node.value)\n ) {\n return { value: node.value, span: toSpan(node) ?? { start: 0, end: 0 } };\n }\n\n if (\n node?.type === \"UnaryExpression\" &&\n node.operator === \"-\" &&\n node.argument?.type === \"Literal\" &&\n typeof node.argument.value === \"number\" &&\n Number.isFinite(node.argument.value)\n ) {\n return {\n value: -node.argument.value,\n span: toSpan(node) ?? { start: 0, end: 0 },\n };\n }\n\n return null;\n}\n\nfunction resolveSdkComponent(\n nameNode: any,\n imports: ParsedImports,\n): SdkComponent | null {\n if (nameNode?.type === \"JSXIdentifier\") {\n return imports.sdkLocalNames.get(nameNode.name) ?? null;\n }\n\n if (\n nameNode?.type === \"JSXMemberExpression\" &&\n nameNode.object?.type === \"JSXIdentifier\" &&\n nameNode.property?.type === \"JSXIdentifier\" &&\n imports.sdkNamespaces.has(nameNode.object.name) &&\n SDK_COMPONENTS.has(nameNode.property.name as SdkComponent)\n ) {\n return nameNode.property.name as SdkComponent;\n }\n\n return null;\n}\n\nfunction resolveMisimportedNamespaceSdkComponent(\n nameNode: any,\n imports: ParsedImports,\n misimportedSdkCanvasImports: MutableMisimportedSdkCanvasImports,\n): MisimportedSdkCanvasImport | null {\n if (\n nameNode?.type !== \"JSXMemberExpression\" ||\n nameNode.object?.type !== \"JSXIdentifier\" ||\n nameNode.property?.type !== \"JSXIdentifier\" ||\n !SDK_COMPONENTS.has(nameNode.property.name as SdkComponent)\n ) {\n return null;\n }\n\n const imported = imports.byLocalName.get(nameNode.object.name);\n if (\n imported?.kind !== \"namespace\" ||\n !isWrongTempoSdkCanvasImportSource(imported.source)\n ) {\n return null;\n }\n\n return (\n misimportedSdkCanvasImports.namespaceCandidatesByLocalName.get(\n nameNode.object.name,\n ) ?? null\n );\n}\n\nfunction isStoryboardSdkComponent(\n component: SdkComponent | null,\n): component is StoryboardSdkComponent {\n return (\n component === \"Storyboard\" ||\n component === \"SvelteStoryboard\" ||\n component === \"LegacyStoryboardV1\" ||\n component === \"RouteStoryboard\" ||\n component === \"HtmlStoryboard\"\n );\n}\n\nfunction readImportedName(specifier: any): string {\n if (specifier.type === \"ImportDefaultSpecifier\") return \"default\";\n if (specifier.type === \"ImportNamespaceSpecifier\") return \"*\";\n return specifier.imported?.name ?? specifier.local?.name ?? \"unknown\";\n}\n\nfunction readImportKind(specifier: any): ParsedCanvasImport[\"kind\"] {\n if (specifier.type === \"ImportDefaultSpecifier\") return \"default\";\n if (specifier.type === \"ImportNamespaceSpecifier\") return \"namespace\";\n return \"named\";\n}\n\nfunction isSdkImportSource(source: string): boolean {\n return (\n SDK_IMPORT_SOURCES.has(source) ||\n source.endsWith(\"/tempo-sdk/canvas\") ||\n source.endsWith(\"/tempo-sdk/canvas/svelte\")\n );\n}\n\nfunction isWrongTempoSdkCanvasImportSource(source: string): boolean {\n return (\n (source === \"tempo-sdk\" || source.startsWith(\"tempo-sdk/\")) &&\n !isSdkImportSource(source)\n );\n}\n\nfunction spanKey(span: CanvasSourceSpan): string {\n return `${span.start}:${span.end}`;\n}\n\nfunction readLayoutClose(node: any): number | undefined {\n return typeof node?.end === \"number\" && Number.isFinite(node.end)\n ? node.end - 1\n : undefined;\n}\n\nexport function fallbackPageName(filePath: string): string {\n const normalized = filePath.replace(/\\\\/g, \"/\");\n const segments = normalized.split(\"/\").filter(Boolean);\n const fileName =\n segments.length > 0 ? segments[segments.length - 1] : filePath;\n const parentName =\n segments.length > 1 ? segments[segments.length - 2] : fileName;\n const baseName = /^index\\.canvas\\.[tj]sx?$/.test(fileName)\n ? parentName\n : fileName.replace(/\\.canvas\\.[tj]sx?$/, \"\");\n\n return baseName\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nfunction toSpan(node: any): CanvasSourceSpan | undefined {\n return typeof node?.start === \"number\" &&\n Number.isFinite(node.start) &&\n typeof node?.end === \"number\" &&\n Number.isFinite(node.end)\n ? { start: node.start, end: node.end }\n : undefined;\n}\n\nfunction walk(node: any, visitor: (node: any) => void, seen = new Set<any>()) {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n visitor(node);\n\n for (const value of Object.values(node)) {\n if (!value) continue;\n if (Array.isArray(value)) {\n for (const item of value) {\n walk(item, visitor, seen);\n }\n } else if (typeof value === \"object\") {\n walk(value, visitor, seen);\n }\n }\n}\n\n/** Resolve only direct component returns, so nested callbacks cannot supply a false root. */\nexport function parseComponentRoot(\n filePath: string,\n source: string,\n exportName: string,\n): { name: string; root: JSXElement } | null {\n const result = parseSync(filePath, source);\n if (result.errors.length > 0) {\n throw new Error(result.errors.map((error) => error.message).join(\"; \"));\n }\n const declarations = new Map<string, any>();\n let component: any;\n let localName = exportName;\n let exported = false;\n for (const statement of result.program.body as any[]) {\n const declaration = statement.declaration ?? statement;\n if (declaration.type === \"FunctionDeclaration\" && declaration.id) {\n declarations.set(declaration.id.name, declaration);\n }\n if (declaration.type === \"VariableDeclaration\") {\n for (const entry of declaration.declarations) {\n if (entry.id.type === \"Identifier\") {\n declarations.set(entry.id.name, unwrapTsExpression(entry.init));\n }\n }\n }\n if (\n statement.type === \"ExportDefaultDeclaration\" &&\n exportName === \"default\"\n ) {\n exported = true;\n if (declaration.type === \"Identifier\") localName = declaration.name;\n else component = declaration;\n }\n if (statement.type !== \"ExportNamedDeclaration\") continue;\n for (const specifier of statement.specifiers ?? []) {\n if (\n !statement.source &&\n (specifier.exported.name ?? specifier.exported.value) === exportName\n ) {\n exported = true;\n localName = specifier.local.name;\n }\n }\n if (declaration.id?.name === exportName) {\n exported = true;\n component = declaration;\n }\n if (\n declaration.type === \"VariableDeclaration\" &&\n declaration.declarations.some(\n (entry: any) => entry.id.name === exportName,\n )\n ) {\n exported = true;\n }\n }\n if (!exported) return null;\n component = unwrapTsExpression(component ?? declarations.get(localName));\n const isFunction =\n component?.type === \"FunctionDeclaration\" ||\n component?.type === \"FunctionExpression\" ||\n component?.type === \"ArrowFunctionExpression\";\n if (!isFunction) return null;\n const name = component.id?.name ?? localName;\n let root = unwrapTsExpression(component.body);\n if (root?.type === \"BlockStatement\") {\n const returns = root.body.filter(\n (statement: any) => statement.type === \"ReturnStatement\",\n );\n const hasControlFlow = root.body.some(\n (statement: any) =>\n ![\n \"ReturnStatement\",\n \"VariableDeclaration\",\n \"ExpressionStatement\",\n \"FunctionDeclaration\",\n \"EmptyStatement\",\n ].includes(statement.type),\n );\n if (returns.length !== 1 || hasControlFlow) return null;\n root = unwrapTsExpression(returns[0].argument);\n }\n return root?.type === \"JSXElement\" ? { name, root } : null;\n}\n"],"mappings":";AAAA,SAAS,iBAAkC;AA0M3C,IAAM,qBAAqB,oBAAI,IAAI;AAAA,EACjC;AAAA,EACA;AACF,CAAC;AAED,IAAM,iBAAiB,oBAAI,IAAkB;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAM,2BAA2B,oBAAI,IAAI;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,iBAAqC;AAAA,EACzC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,IAAM,0BAA8C;AAAA,EAClD,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AACV;AAIO,IAAM,8BACX;AAEK,SAAS,gBACd,UACA,QACkB;AAClB,QAAM,SAA6B,CAAC;AACpC,MAAI;AAEJ,MAAI;AACF,UAAM,SAAS,UAAU,UAAU,MAAM;AACzC,cAAU,OAAO;AACjB,eAAW,SAAS,OAAO,UAAU,CAAC,GAAG;AACvC,aAAO,KAAK;AAAA,QACV,SAAS,MAAM,WAAW;AAAA,QAC1B,MAAM,OAAO,KAAK,KAAK,OAAO,OAAO,SAAS,CAAC,CAAC;AAAA,QAChD,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF,SAAS,OAAO;AACd,WAAO;AAAA,MACL;AAAA,MACA,UAAU,iBAAiB,QAAQ;AAAA,MAC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,IACd;AACA,QACE,YAAY,SAAS,yBACrB,YAAY,aAAa;AAAA,MACvB,CAAC,UAAe,MAAM,GAAG,SAAS;AAAA,IACpC,GACA;AACA,iBAAW;AAAA,IACb;AAAA,EACF;AACA,MAAI,CAAC,SAAU,QAAO;AACtB,cAAY,mBAAmB,aAAa,aAAa,IAAI,SAAS,CAAC;AACvE,QAAM,aACJ,WAAW,SAAS,yBACpB,WAAW,SAAS,wBACpB,WAAW,SAAS;AACtB,MAAI,CAAC,WAAY,QAAO;AACxB,QAAM,OAAO,UAAU,IAAI,QAAQ;AACnC,MAAI,OAAO,mBAAmB,UAAU,IAAI;AAC5C,MAAI,MAAM,SAAS,kBAAkB;AACnC,UAAM,UAAU,KAAK,KAAK;AAAA,MACxB,CAAC,cAAmB,UAAU,SAAS;AAAA,IACzC;AACA,UAAM,iBAAiB,KAAK,KAAK;AAAA,MAC/B,CAAC,cACC,CAAC;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,EAAE,SAAS,UAAU,IAAI;AAAA,IAC7B;AACA,QAAI,QAAQ,WAAW,KAAK,eAAgB,QAAO;AACnD,WAAO,mBAAmB,QAAQ,CAAC,EAAE,QAAQ;AAAA,EAC/C;AACA,SAAO,MAAM,SAAS,eAAe,EAAE,MAAM,KAAK,IAAI;AACxD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../assets/parser.ts"],"sourcesContent":["/**\n * Static parser for `defineAsset` declarations (specs/asset-libraries.md §3).\n *\n * Mirrors the construction of canvas/parser.ts: oxc-parser `parseSync`, an\n * import map that only trusts `defineAsset` imported from \"tempo-sdk/assets\"\n * (or a local path ending \"/tempo-sdk/assets\"), and a manual walk over\n * module-top-level statements. Never executes user code — the whole pipeline\n * is text → AST → data.\n *\n * Alongside `parseAssetFile`, this module exports the program-level analysis\n * helpers (`parseAssetProgram`, `readAssetImports`, `collectTopLevelScope`,\n * `hasTopLevelDefineAssetCallFor`, `collectIdentifierNames`) that the\n * colocated span-based editor (./editor.ts) shares, so import-trust rules and\n * binding resolution cannot drift between the two.\n */\nimport { parseSync } from \"oxc-parser\";\n\nimport {\n UNRESOLVED_VALUE,\n isUnresolvedValue,\n type AssetExportKind,\n type AssetParseError,\n type AssetSourceSpan,\n type AssetSpans,\n type ParsedAssetDeclaration,\n type ParsedAssetFile,\n type ParsedAssetReference,\n type ParsedAssetVariant,\n type StaticValue,\n} from \"./types\";\n\nexport * from \"./types\";\n\n/** The one module specifier `defineAsset` may be imported from. */\nexport const ASSET_SDK_IMPORT_SOURCE = \"tempo-sdk/assets\";\n\nexport function parseAssetFile(\n filePath: string,\n source: string,\n parsed = parseAssetProgram(filePath, source),\n): ParsedAssetFile {\n // Program results can be shared with controls discovery and cached by hosts.\n // Declaration diagnostics must not mutate the cached parser diagnostics.\n const { program } = parsed;\n const errors = [...parsed.errors];\n if (!program) {\n return { filePath, declarations: [], errors };\n }\n\n const imports = readAssetImports(program);\n for (const misimport of imports.misimports) {\n errors.push({\n code: \"misimported_define_asset\",\n severity: \"structural\",\n message: `defineAsset must be imported from \"${ASSET_SDK_IMPORT_SOURCE}\" — found import from \"${misimport.source}\"`,\n span: misimport.span,\n });\n }\n\n const constants = new Map<string, any>();\n for (const statement of program.body) {\n const declaration =\n statement.type === \"ExportNamedDeclaration\"\n ? statement.declaration\n : statement;\n if (\n declaration?.type !== \"VariableDeclaration\" ||\n declaration.kind !== \"const\"\n )\n continue;\n for (const binding of declaration.declarations)\n if (binding.id.type === \"Identifier\" && binding.init)\n constants.set(binding.id.name, binding.init);\n }\n const resolveConstants = (\n node: any,\n seen = new Set<string>(),\n depth = 0,\n ): any => {\n if (!node || depth > 16) return node;\n if (\n node.type === \"Identifier\" &&\n constants.has(node.name) &&\n !seen.has(node.name)\n )\n return resolveConstants(\n constants.get(node.name),\n new Set(seen).add(node.name),\n depth + 1,\n );\n if (node.type === \"JSXElement\" || node.type === \"JSXFragment\") {\n const element = node.openingElement;\n const tag =\n element?.name?.type === \"JSXIdentifier\" ? element.name.name : \"\";\n if (element && !tag) return node;\n const reference =\n tag && /^[A-Z]/.test(tag)\n ? imports.referenceableImports.get(tag)\n : undefined;\n if (tag && /^[A-Z]/.test(tag) && !reference) return node;\n const props: Record<string, StaticValue> = {};\n for (const attribute of element?.attributes ?? []) {\n if (\n attribute.type !== \"JSXAttribute\" ||\n attribute.name.type !== \"JSXIdentifier\"\n )\n return node;\n props[attribute.name.name] = !attribute.value\n ? true\n : readStaticValue(\n resolveConstants(\n attribute.value.type === \"JSXExpressionContainer\"\n ? attribute.value.expression\n : attribute.value,\n seen,\n depth + 1,\n ),\n );\n }\n const children: StaticValue[] = [];\n for (const child of node.children) {\n if (child.type === \"JSXText\") {\n const lines = child.value.replace(/\\t/g, \" \").split(/\\r\\n|\\n|\\r/);\n const text = lines\n .map((line: string, i: number) =>\n (i ? line.trimStart() : line).replace(\n i < lines.length - 1 ? / +$/ : /$^/,\n \"\",\n ),\n )\n .filter(Boolean)\n .join(\" \");\n if (text) children.push(text);\n } else if (\n child.type === \"JSXExpressionContainer\" &&\n child.expression.type === \"JSXEmptyExpression\"\n )\n continue;\n else\n children.push(\n readStaticValue(\n resolveConstants(\n child.type === \"JSXExpressionContainer\"\n ? child.expression\n : child,\n seen,\n depth + 1,\n ),\n ),\n );\n }\n if (children.length)\n props.children = children.length === 1 ? children[0]! : children;\n let source = reference?.importSpecifier;\n if (source?.startsWith(\".\")) {\n const parts = filePath.replace(/\\\\/g, \"/\").split(\"/\").slice(0, -1);\n for (const part of source.split(\"/\")) {\n if (part === \"..\") parts.pop();\n else if (part !== \".\") parts.push(part);\n }\n source = parts.join(\"/\");\n } else if (source) source = `pkg:${source}`;\n return {\n type: \"TempoJsxValue\",\n value: {\n $jsx: {\n tag,\n ...(reference\n ? { reference: { source, importedName: reference.importedName } }\n : {}),\n props,\n },\n },\n };\n }\n // Only expression-bodied, parameterless arrows are render templates.\n // Preserve the function shape so readVariant can reject every other form.\n if (\n node.type === \"ArrowFunctionExpression\" &&\n !node.async &&\n node.params.length === 0\n )\n return { ...node, body: resolveConstants(node.body, seen, depth + 1) };\n if (node.type === \"ObjectExpression\")\n return {\n ...node,\n properties: node.properties.map((property: any) =>\n property.type === \"Property\"\n ? {\n ...property,\n value: resolveConstants(property.value, seen, depth + 1),\n shorthand: false,\n }\n : property,\n ),\n };\n if (node.type === \"ArrayExpression\")\n return {\n ...node,\n elements: node.elements.map((item: any) =>\n resolveConstants(item, seen, depth + 1),\n ),\n };\n if (\n [\n \"TSAsExpression\",\n \"TSSatisfiesExpression\",\n \"ParenthesizedExpression\",\n ].includes(node.type)\n )\n return {\n ...node,\n expression: resolveConstants(node.expression, seen, depth + 1),\n };\n return node;\n };\n const scope = collectTopLevelScope(program);\n const declarations: ParsedAssetDeclaration[] = [];\n const declaredBindings = new Set<string>();\n const topLevelCalls = new Set<any>();\n\n for (const statement of program.body ?? []) {\n const call = readTopLevelTrustedCall(\n statement,\n imports.trustedDefineAssetNames,\n );\n if (!call) continue;\n topLevelCalls.add(call);\n const declaration = readAssetDeclaration({\n statement,\n call: {\n ...call,\n arguments: call.arguments.map((argument: any, index: number) =>\n index === 1 && argument.type === \"ObjectExpression\"\n ? {\n ...argument,\n properties: argument.properties.map((property: any) =>\n property.type === \"Property\" &&\n [\"controls\", \"variants\"].includes(\n property.key.name ?? property.key.value,\n )\n ? { ...property, value: resolveConstants(property.value) }\n : property,\n ),\n }\n : argument,\n ),\n },\n scope,\n imports,\n program,\n source,\n errors,\n declaredBindings,\n });\n if (declaration) declarations.push(declaration);\n }\n\n // A trusted defineAsset call anywhere but a module-top-level statement\n // (inside a function, wrapped in another expression, …) has no stable\n // identity — report it rather than silently ignoring it (§3.4).\n walk(program, (node) => {\n if (\n node.type === \"CallExpression\" &&\n node.callee?.type === \"Identifier\" &&\n imports.trustedDefineAssetNames.has(node.callee.name) &&\n !topLevelCalls.has(node)\n ) {\n errors.push({\n code: \"non_top_level_call\",\n severity: \"structural\",\n message:\n \"defineAsset must be called as a top-level statement — in the file that defines the component, or in a canvas file that imports it\",\n span: toSourceSpan(node),\n });\n }\n });\n\n for (const declaration of declarations) {\n const duplicate = errors.find(\n (error) =>\n error.code === \"duplicate_declaration\" &&\n error.message.includes(`\"${declaration.bindingName}\"`),\n );\n if (duplicate)\n declaration.warnings.push({\n ...duplicate,\n code: \"duplicate_asset_declaration\",\n });\n }\n return { filePath, declarations, errors };\n}\n\n/**\n * Editor-support: parse and return the raw oxc program. A file with syntax\n * errors returns `program: null` plus structural `unparseable_source` errors\n * — a recovered AST has untrustworthy spans, so both parser and editor fail\n * closed on it.\n */\nexport function parseAssetProgram(\n filePath: string,\n source: string,\n): { program: any | null; errors: AssetParseError[] } {\n try {\n const result = parseSync(filePath, source) as any;\n const errors: AssetParseError[] = (result.errors ?? []).map(\n (error: any) => ({\n code: \"unparseable_source\" as const,\n severity: \"structural\" as const,\n message: error?.message ?? \"Unable to parse asset source\",\n span: toSourceSpan(error) ?? toSourceSpan(error?.labels?.[0]),\n }),\n );\n if (errors.length > 0) return { program: null, errors };\n return { program: result.program, errors: [] };\n } catch (error) {\n return {\n program: null,\n errors: [\n {\n code: \"unparseable_source\",\n severity: \"structural\",\n message:\n error instanceof Error\n ? error.message\n : \"Unable to parse asset source\",\n },\n ],\n };\n }\n}\n\n/** One comment's text (delimiters stripped) and source span. */\nexport type SourceComment = {\n value: string;\n span: AssetSourceSpan;\n};\n\n/**\n * Every comment (line and block) in a source file, for consumers that\n * validate documentation conventions (e.g. the asset index's canvas-pointer\n * check). Returns `null` when the file does not parse — comments recovered\n * from a broken AST are untrustworthy, so callers must treat the file as\n * uninspectable rather than comment-free.\n */\nexport function readSourceComments(\n filePath: string,\n source: string,\n): SourceComment[] | null {\n try {\n const result = parseSync(filePath, source) as any;\n if ((result.errors ?? []).length > 0) return null;\n return (result.comments ?? []).flatMap((comment: any) =>\n typeof comment?.value === \"string\"\n ? [\n {\n value: comment.value,\n span: toSourceSpan(comment) ?? { start: 0, end: 0 },\n },\n ]\n : [],\n );\n } catch {\n return null;\n }\n}\n\nexport type AssetImportInfo = {\n /** Added after the original public parser contract; optional so existing\n * callers can continue constructing `AssetImportInfo` object literals. */\n trustedDefineControlsNames?: Set<string>;\n /** Local names bound to `defineAsset` imported from tempo-sdk/assets. */\n trustedDefineAssetNames: Set<string>;\n /** Every value-import local name → its module specifier. */\n importedBindings: Map<string, string>;\n /** Named/default value imports a reference declaration may target: local\n * name → specifier + imported name (\"default\" for default imports).\n * Namespace imports are excluded — they cannot name one component. */\n referenceableImports: Map<string, ParsedAssetReference>;\n /** Span of every import declaration, in source order (editor placement). */\n importDeclarationSpans: AssetSourceSpan[];\n /** `defineAsset` imports using a wrong tempo-sdk-family specifier. The span\n * covers the source string literal, quotes included. */\n misimports: { source: string; span: AssetSourceSpan }[];\n};\n\nexport function readAssetImports(program: any): AssetImportInfo {\n const info: AssetImportInfo = {\n trustedDefineControlsNames: new Set(),\n trustedDefineAssetNames: new Set(),\n importedBindings: new Map(),\n referenceableImports: new Map(),\n importDeclarationSpans: [],\n misimports: [],\n };\n\n for (const statement of program?.body ?? []) {\n if (\n statement?.type !== \"ImportDeclaration\" ||\n typeof statement.source?.value !== \"string\"\n ) {\n continue;\n }\n const declarationSpan = toSourceSpan(statement);\n if (declarationSpan) info.importDeclarationSpans.push(declarationSpan);\n if (statement.importKind === \"type\") continue;\n\n const source = statement.source.value;\n const trusted = isTrustedAssetImportSource(source);\n\n for (const specifier of statement.specifiers ?? []) {\n if (specifier?.importKind === \"type\") continue;\n const localName = specifier?.local?.name;\n if (typeof localName !== \"string\") continue;\n info.importedBindings.set(localName, source);\n\n if (specifier.type === \"ImportDefaultSpecifier\") {\n info.referenceableImports.set(localName, {\n importSpecifier: source,\n importedName: \"default\",\n });\n continue;\n }\n if (specifier.type !== \"ImportSpecifier\") continue;\n const importedName =\n specifier.imported?.name ?? specifier.imported?.value ?? localName;\n info.referenceableImports.set(localName, {\n importSpecifier: source,\n importedName,\n });\n if (trusted && importedName === \"defineControls\")\n info.trustedDefineControlsNames!.add(localName);\n if (importedName !== \"defineAsset\") continue;\n\n if (trusted) {\n info.trustedDefineAssetNames.add(localName);\n } else if (isMisimportedAssetSdkSource(source)) {\n info.misimports.push({\n source,\n span: toSourceSpan(statement.source) ??\n declarationSpan ?? { start: 0, end: 0 },\n });\n }\n }\n }\n\n return info;\n}\n\n/** Discover control owners without evaluating their config or requiring an asset. */\nexport function parseControlsFile(\n filePath: string,\n source: string,\n parsed = parseAssetProgram(filePath, source),\n): {\n bindingName: string;\n reference?: ParsedAssetReference;\n exportKind: AssetExportKind;\n start: number;\n end: number;\n}[] {\n const { program } = parsed;\n const imports = readAssetImports(program);\n const scope = program ? collectTopLevelScope(program) : null;\n return (program?.body ?? []).flatMap((statement: any) => {\n const call =\n statement.type === \"ExpressionStatement\" ? statement.expression : null;\n if (\n call?.type !== \"CallExpression\" ||\n call.callee.type !== \"Identifier\" ||\n !imports.trustedDefineControlsNames?.has(call.callee.name) ||\n call.arguments.length !== 2 ||\n call.arguments[0]?.type !== \"Identifier\"\n )\n return [];\n const bindingName = call.arguments[0].name as string;\n const reference = imports.referenceableImports.get(bindingName);\n const binding = scope?.bindings.get(bindingName);\n if (!reference && !binding) return [];\n return [\n {\n bindingName,\n reference,\n exportKind:\n reference?.importedName === \"default\"\n ? (\"default\" as const)\n : (binding?.exportKind ?? (\"named\" as const)),\n start: call.start as number,\n end: call.end as number,\n },\n ];\n });\n}\n\nfunction isTrustedAssetImportSource(source: string): boolean {\n return (\n source === ASSET_SDK_IMPORT_SOURCE ||\n source.endsWith(`/${ASSET_SDK_IMPORT_SOURCE}`)\n );\n}\n\nfunction isMisimportedAssetSdkSource(source: string): boolean {\n return (\n (source === \"tempo-sdk\" || source.startsWith(\"tempo-sdk/\")) &&\n !isTrustedAssetImportSource(source)\n );\n}\n\nexport type AssetTopLevelBinding = {\n name: string;\n /** Whole top-level statement declaring the binding, export keyword\n * included — the editor inserts defineAsset statements after it. */\n statementSpan: AssetSourceSpan;\n exportKind: AssetExportKind;\n};\n\nexport type AssetTopLevelScope = {\n /** Plain top-level bindings defineAsset may target: function/class\n * declarations and initialized `const`/`let`/`var` declarators. */\n bindings: Map<string, AssetTopLevelBinding>;\n /** Top-level names bound only via destructuring patterns or uninitialized\n * declarators — they exist, but defineAsset cannot target them; kept so\n * error messages can say why. */\n nonSimpleNames: Set<string>;\n};\n\nexport function collectTopLevelScope(program: any): AssetTopLevelScope {\n const bindings = new Map<string, AssetTopLevelBinding>();\n const nonSimpleNames = new Set<string>();\n const namedExports = new Set<string>();\n const defaultExports = new Set<string>();\n\n const register = (\n declaration: any,\n statementSpan: AssetSourceSpan,\n exported: \"named\" | \"default\" | null,\n ) => {\n const markExported = (name: string) => {\n if (exported === \"named\") namedExports.add(name);\n if (exported === \"default\") defaultExports.add(name);\n };\n\n if (\n declaration?.type === \"FunctionDeclaration\" ||\n declaration?.type === \"ClassDeclaration\"\n ) {\n const name = declaration.id?.name;\n if (typeof name === \"string\") {\n bindings.set(name, { name, statementSpan, exportKind: \"none\" });\n markExported(name);\n }\n return;\n }\n\n if (declaration?.type === \"VariableDeclaration\") {\n for (const declarator of declaration.declarations ?? []) {\n if (declarator?.id?.type === \"Identifier\") {\n const name = declarator.id.name;\n if (declarator.init) {\n bindings.set(name, { name, statementSpan, exportKind: \"none\" });\n markExported(name);\n } else {\n nonSimpleNames.add(name);\n }\n } else {\n collectPatternNames(declarator?.id, nonSimpleNames);\n }\n }\n }\n };\n\n for (const statement of program?.body ?? []) {\n const statementSpan = toSourceSpan(statement) ?? { start: 0, end: 0 };\n\n if (statement?.type === \"ExportNamedDeclaration\") {\n if (statement.declaration) {\n register(statement.declaration, statementSpan, \"named\");\n }\n // `export { X } from \"./y\"` re-exports another module's binding, not a\n // local one — only sourceless specifier lists mark local bindings.\n if (!statement.source) {\n for (const specifier of statement.specifiers ?? []) {\n if (specifier?.type !== \"ExportSpecifier\") continue;\n const localName = specifier.local?.name;\n if (typeof localName !== \"string\") continue;\n const exportedName =\n specifier.exported?.name ?? specifier.exported?.value;\n (exportedName === \"default\" ? defaultExports : namedExports).add(\n localName,\n );\n }\n }\n continue;\n }\n\n if (statement?.type === \"ExportDefaultDeclaration\") {\n const declaration = statement.declaration;\n if (\n declaration?.type === \"FunctionDeclaration\" ||\n declaration?.type === \"ClassDeclaration\"\n ) {\n register(declaration, statementSpan, \"default\");\n } else {\n const expression = unwrapTsExpression(declaration);\n if (expression?.type === \"Identifier\") {\n defaultExports.add(expression.name);\n }\n }\n continue;\n }\n\n register(statement, statementSpan, null);\n }\n\n // A binding exported both ways reports \"default\" — the module's primary\n // export identity wins over the incidental named alias.\n for (const binding of bindings.values()) {\n binding.exportKind = defaultExports.has(binding.name)\n ? \"default\"\n : namedExports.has(binding.name)\n ? \"named\"\n : \"none\";\n }\n\n return { bindings, nonSimpleNames };\n}\n\nfunction collectPatternNames(pattern: any, names: Set<string>): void {\n if (!pattern || typeof pattern !== \"object\") return;\n if (pattern.type === \"Identifier\" && typeof pattern.name === \"string\") {\n names.add(pattern.name);\n return;\n }\n if (pattern.type === \"ObjectPattern\") {\n for (const property of pattern.properties ?? []) {\n collectPatternNames(property?.value ?? property?.argument, names);\n }\n return;\n }\n if (pattern.type === \"ArrayPattern\") {\n for (const element of pattern.elements ?? []) {\n collectPatternNames(element, names);\n }\n return;\n }\n if (pattern.type === \"AssignmentPattern\") {\n collectPatternNames(pattern.left, names);\n return;\n }\n if (pattern.type === \"RestElement\") {\n collectPatternNames(pattern.argument, names);\n }\n}\n\n/**\n * Editor-support: true when any module-top-level trusted defineAsset call\n * targets `bindingName`, regardless of whether the call parses cleanly —\n * the editor must not insert a second declaration next to a broken one.\n */\nexport function hasTopLevelDefineAssetCallFor(\n program: any,\n trustedNames: Set<string>,\n bindingName: string,\n): boolean {\n for (const statement of program?.body ?? []) {\n const call = readTopLevelTrustedCall(statement, trustedNames);\n if (!call) continue;\n const componentArg = unwrapTsExpression(call.arguments?.[0]);\n if (\n componentArg?.type === \"Identifier\" &&\n componentArg.name === bindingName\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Editor-support: every Identifier/JSXIdentifier name appearing anywhere in\n * the program — used to deconflict generated binding names. */\nexport function collectIdentifierNames(program: any): Set<string> {\n const names = new Set<string>();\n walk(program, (node) => {\n if (\n (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") &&\n typeof node.name === \"string\"\n ) {\n names.add(node.name);\n }\n });\n return names;\n}\n\nfunction readTopLevelTrustedCall(\n statement: any,\n trustedNames: Set<string>,\n): any | null {\n if (statement?.type !== \"ExpressionStatement\") return null;\n const expression = unwrapTsExpression(statement.expression);\n if (\n expression?.type === \"CallExpression\" &&\n expression.callee?.type === \"Identifier\" &&\n trustedNames.has(expression.callee.name)\n ) {\n return expression;\n }\n return null;\n}\n\nfunction readAssetDeclaration(input: {\n statement: any;\n call: any;\n scope: AssetTopLevelScope;\n imports: AssetImportInfo;\n program: any;\n source: string;\n errors: AssetParseError[];\n declaredBindings: Set<string>;\n}): ParsedAssetDeclaration | null {\n const { statement, call, scope, imports, program, source, errors } = input;\n const callSpan = statementSpanWithSemicolon(source, statement);\n const args = call.arguments ?? [];\n\n if (args.length !== 2) {\n errors.push({\n code: \"invalid_call_arguments\",\n severity: \"structural\",\n message: `defineAsset takes exactly two arguments (component, config) — found ${args.length}`,\n span: callSpan,\n });\n return null;\n }\n\n const componentArg = unwrapTsExpression(args[0]);\n if (componentArg?.type !== \"Identifier\") {\n errors.push({\n code: \"non_identifier_component\",\n severity: \"structural\",\n message:\n \"defineAsset's first argument must be an identifier naming a component defined in this file\",\n span: toSourceSpan(args[0]) ?? callSpan,\n });\n return null;\n }\n\n const bindingName = componentArg.name;\n const binding = scope.bindings.get(bindingName);\n // A named/default import target makes this a reference declaration: the\n // asset's identity is the import itself, resolved downstream where\n // workspace context exists (§2.7).\n const reference = binding\n ? undefined\n : imports.referenceableImports.get(bindingName);\n if (!binding && !reference) {\n errors.push(\n classifyMissingBinding(\n bindingName,\n scope,\n imports,\n program,\n toSourceSpan(componentArg) ?? callSpan,\n ),\n );\n return null;\n }\n\n const configArg = unwrapTsExpression(args[1]);\n if (configArg?.type !== \"ObjectExpression\") {\n errors.push({\n code: \"config_not_object_literal\",\n severity: \"structural\",\n message:\n \"defineAsset's config must be an inline object literal — the span-based editor needs literal spans to mutate\",\n span: toSourceSpan(args[1]) ?? callSpan,\n });\n return null;\n }\n\n if (input.declaredBindings.has(bindingName)) {\n errors.push({\n code: \"duplicate_declaration\",\n severity: \"structural\",\n message: `duplicate defineAsset call for \"${bindingName}\" — keep one asset declaration`,\n span: callSpan,\n });\n return null;\n }\n input.declaredBindings.add(bindingName);\n\n const warnings: AssetParseError[] = [];\n const spans: AssetSpans = {\n call: callSpan,\n config: toSourceSpan(configArg) ?? callSpan,\n libraryItems: [],\n };\n\n const usageInstructions = readUsageInstructions(configArg);\n const libraries = readLibraries(configArg, spans, warnings);\n const variants = readVariants(configArg, warnings);\n if (getObjectProperty(configArg, \"controls\")) {\n errors.push({\n code: \"invalid_control\",\n severity: \"structural\",\n message:\n \"Move controls to defineControls(Component, controls) in the component file or tempo/controls.ts.\",\n });\n return null;\n }\n const structural = warnings.filter(\n (warning) => warning.severity === \"structural\",\n );\n if (structural.length) {\n errors.push(...structural);\n return null;\n }\n\n // Reference declarations skip the not_exported warning — the target lives\n // in another module, and the import form already proves it is importable.\n if (binding && binding.exportKind === \"none\") {\n warnings.push({\n code: \"not_exported\",\n severity: \"degraded\",\n message: `\"${bindingName}\" is not exported — other files cannot import this asset`,\n span: callSpan,\n });\n }\n\n return {\n bindingName,\n exportKind: binding\n ? binding.exportKind\n : referenceExportKind(reference as ParsedAssetReference),\n libraries,\n ...(usageInstructions === undefined ? {} : { usageInstructions }),\n variants,\n ...(reference ? { reference } : {}),\n spans,\n warnings,\n };\n}\n\n/** How the target is exported from its module, read straight off the import\n * form — a default import can only bind a default export, a named import a\n * named one. */\nfunction referenceExportKind(reference: ParsedAssetReference): AssetExportKind {\n return reference.importedName === \"default\" ? \"default\" : \"named\";\n}\n\nfunction classifyMissingBinding(\n name: string,\n scope: AssetTopLevelScope,\n imports: AssetImportInfo,\n program: any,\n span: AssetSourceSpan,\n): AssetParseError {\n // Named/default imports parse as reference declarations before reaching\n // here, so an import landing in this branch is a namespace import.\n const importSource = imports.importedBindings.get(name);\n if (importSource !== undefined) {\n return {\n code: \"imported_binding\",\n severity: \"structural\",\n message: `\"${name}\" is a namespace import from \"${importSource}\" — declare the asset on a named or default import of the component instead`,\n span,\n };\n }\n if (scope.nonSimpleNames.has(name)) {\n return {\n code: \"unknown_binding\",\n severity: \"structural\",\n message: `\"${name}\" is not a plain initialized top-level binding — destructured and uninitialized declarations are not supported`,\n span,\n };\n }\n if (hasNestedBinding(program, name)) {\n return {\n code: \"non_top_level_binding\",\n severity: \"structural\",\n message: `\"${name}\" is not declared at the top level of the module`,\n span,\n };\n }\n return {\n code: \"unknown_binding\",\n severity: \"structural\",\n message: `no top-level declaration of \"${name}\" found in this file`,\n span,\n };\n}\n\nfunction hasNestedBinding(program: any, name: string): boolean {\n let found = false;\n walk(program, (node) => {\n if (found) return;\n if (\n (node.type === \"VariableDeclarator\" ||\n node.type === \"FunctionDeclaration\" ||\n node.type === \"ClassDeclaration\") &&\n node.id?.type === \"Identifier\" &&\n node.id.name === name\n ) {\n found = true;\n }\n });\n return found;\n}\n\nfunction readUsageInstructions(configNode: any): string | undefined {\n return readStaticStringProperty(configNode, \"usageInstructions\");\n}\n\nfunction readStaticStringProperty(\n configNode: any,\n name: string,\n): string | undefined {\n const property = getObjectProperty(configNode, name);\n if (!property) return undefined;\n const value = readStaticValue(property.value);\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction readLibraries(\n configNode: any,\n spans: AssetSpans,\n warnings: AssetParseError[],\n): string[] {\n const property = getObjectProperty(configNode, \"libraries\");\n if (!property) return [];\n spans.librariesProperty = toSourceSpan(property);\n\n const value = unwrapTsExpression(property.value);\n if (value?.type !== \"ArrayExpression\") {\n warnings.push({\n code: \"non_literal_library\",\n severity: \"degraded\",\n message:\n \"libraries must be an inline array literal of string literals — its entries were dropped\",\n span: toSourceSpan(property.value) ?? spans.librariesProperty,\n });\n return [];\n }\n spans.libraries = toSourceSpan(value);\n\n const names: string[] = [];\n for (const element of value.elements ?? []) {\n const elementSpan = toSourceSpan(element) ?? spans.libraries;\n const name = readStaticString(element);\n if (name === null) {\n warnings.push({\n code: \"non_literal_library\",\n severity: \"degraded\",\n message:\n \"libraries entries must be string literals — dropped a non-literal entry\",\n span: elementSpan,\n });\n continue;\n }\n if (name === \"\") {\n warnings.push({\n code: \"empty_library_name\",\n severity: \"degraded\",\n message: \"libraries entries must be non-empty — dropped an empty entry\",\n span: elementSpan,\n });\n continue;\n }\n if (names.includes(name)) {\n warnings.push({\n code: \"duplicate_library\",\n severity: \"degraded\",\n message: `duplicate library name \"${name}\" — deduplicated`,\n span: elementSpan,\n });\n continue;\n }\n names.push(name);\n if (elementSpan) spans.libraryItems.push(elementSpan);\n }\n return names;\n}\n\nfunction readVariants(\n configNode: any,\n warnings: AssetParseError[],\n): ParsedAssetVariant[] {\n const property = getObjectProperty(configNode, \"variants\");\n if (!property) return [];\n\n const value = unwrapTsExpression(property.value);\n if (value?.type !== \"ObjectExpression\") {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message:\n \"variants is not an inline object literal — variant props are not statically readable\",\n span: toSourceSpan(property.value) ?? toSourceSpan(property),\n });\n return [];\n }\n\n const properties = value.properties ?? [];\n if (properties.length === 0) {\n warnings.push({\n code: \"empty_variants\",\n severity: \"degraded\",\n message: \"variants is present but empty\",\n span: toSourceSpan(value),\n });\n return [];\n }\n\n const variants: ParsedAssetVariant[] = [];\n for (const entry of properties) {\n const name =\n entry?.type === \"Property\" && !entry.computed\n ? readPropertyKeyName(entry.key)\n : null;\n if (name === null) {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message:\n \"variant names must be identifier or string keys — skipped an entry that is not statically readable\",\n span: toSourceSpan(entry) ?? toSourceSpan(value),\n });\n continue;\n }\n variants.push(readVariant(name, entry, warnings));\n }\n return variants;\n}\n\nfunction readVariant(\n name: string,\n entry: any,\n warnings: AssetParseError[],\n): ParsedAssetVariant {\n const value = unwrapTsExpression(entry.value);\n for (const property of value?.type === \"ObjectExpression\"\n ? value.properties\n : []) {\n if (\n property.type !== \"Property\" ||\n property.computed ||\n ![\"props\", \"render\"].includes(readPropertyKeyName(property.key) ?? \"\")\n ) {\n warnings.push({\n code: \"invalid_variant_config\",\n severity: \"structural\",\n message: `Variant \"${name}\" accepts either props or render, with explicit keys and no spreads or inheritance`,\n span: toSourceSpan(property),\n });\n }\n }\n const renderProperty =\n value?.type === \"ObjectExpression\"\n ? getObjectProperty(value, \"render\")\n : null;\n const propsProperty =\n value?.type === \"ObjectExpression\"\n ? getObjectProperty(value, \"props\")\n : null;\n const fn = unwrapTsExpression(renderProperty?.value);\n const body = unwrapTsExpression(fn?.body);\n const jsx =\n body?.type === \"TempoJsxValue\" ? readStaticValue(body) : UNRESOLVED_VALUE;\n const validRender =\n fn?.type === \"ArrowFunctionExpression\" &&\n !fn.async &&\n fn.params.length === 0 &&\n !propsProperty &&\n !containsUnresolvedValue(jsx);\n if (renderProperty && !validRender)\n warnings.push({\n code: \"invalid_variant_config\",\n severity: \"structural\",\n message: `Variant \"${name}\" render must be a parameterless arrow returning static JSX, without props, statements, hooks, callbacks, or computed expressions. Move logic into an imported component.`,\n span: toSourceSpan(renderProperty),\n });\n const render = renderProperty && validRender ? { jsx } : undefined;\n const propsValue = propsProperty\n ? readStaticValue(propsProperty.value)\n : render\n ? {}\n : UNRESOLVED_VALUE;\n const props = isPlainRecord(propsValue) ? propsValue : {};\n const hasUnresolvedValues =\n !isPlainRecord(propsValue) || containsUnresolvedValue(propsValue);\n\n if (hasUnresolvedValues) {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message: `variant \"${name}\" has prop values that are not statically readable`,\n span: toSourceSpan(entry),\n });\n }\n\n return { name, props, hasUnresolvedValues, ...(render ? { render } : {}) };\n}\n\n/** Static value model (§3.2): literals, interpolation-free templates, unary\n * minus on numbers, array/object literals; anything else degrades to the\n * UNRESOLVED sentinel in place, preserving the surrounding structure. */\nfunction readStaticValue(node: any): StaticValue {\n const expression = unwrapTsExpression(node);\n if (!expression) return UNRESOLVED_VALUE;\n\n switch (expression.type) {\n case \"TempoJsxValue\":\n return expression.value;\n case \"Literal\": {\n if (expression.regex || expression.bigint) return UNRESOLVED_VALUE;\n const { value } = expression;\n return value === null ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ? value\n : UNRESOLVED_VALUE;\n }\n case \"TemplateLiteral\": {\n if ((expression.expressions ?? []).length > 0) return UNRESOLVED_VALUE;\n const cooked = expression.quasis?.[0]?.value?.cooked;\n return typeof cooked === \"string\" ? cooked : UNRESOLVED_VALUE;\n }\n case \"UnaryExpression\": {\n if (expression.operator !== \"-\") return UNRESOLVED_VALUE;\n const argument = unwrapTsExpression(expression.argument);\n return argument?.type === \"Literal\" &&\n typeof argument.value === \"number\" &&\n Number.isFinite(argument.value)\n ? -argument.value\n : UNRESOLVED_VALUE;\n }\n case \"ArrayExpression\":\n return (expression.elements ?? []).map((element: any) =>\n element == null || element.type === \"SpreadElement\"\n ? UNRESOLVED_VALUE\n : readStaticValue(element),\n );\n case \"ObjectExpression\": {\n const record: Record<string, StaticValue> = {};\n for (const property of expression.properties ?? []) {\n // A spread or computed key makes the object's final shape unknowable\n // statically, so the whole object degrades to UNRESOLVED rather than\n // presenting a misleading partial record.\n if (property?.type !== \"Property\" || property.computed) {\n return UNRESOLVED_VALUE;\n }\n const key = readPropertyKeyName(property.key);\n if (key === null) return UNRESOLVED_VALUE;\n Object.defineProperty(record, key, {\n value: readStaticValue(property.value),\n enumerable: true,\n configurable: true,\n });\n }\n return record;\n }\n default:\n return UNRESOLVED_VALUE;\n }\n}\n\nfunction readStaticString(node: any): string | null {\n const value = node == null ? UNRESOLVED_VALUE : readStaticValue(node);\n return typeof value === \"string\" ? value : null;\n}\n\nfunction isPlainRecord(\n value: StaticValue,\n): value is Record<string, StaticValue> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n !isUnresolvedValue(value)\n );\n}\n\nfunction containsUnresolvedValue(value: StaticValue): boolean {\n if (isUnresolvedValue(value)) return true;\n if (Array.isArray(value)) return value.some(containsUnresolvedValue);\n if (typeof value === \"object\" && value !== null) {\n return Object.values(value).some(containsUnresolvedValue);\n }\n return false;\n}\n\n/** ExpressionStatement spans normally include the terminating semicolon, but\n * a semicolon separated by inline whitespace still belongs to the call. */\nfunction statementSpanWithSemicolon(\n source: string,\n statement: any,\n): AssetSourceSpan {\n const span = toSourceSpan(statement) ?? { start: 0, end: 0 };\n if (source[span.end - 1] === \";\") return span;\n let end = span.end;\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n return source[end] === \";\" ? { start: span.start, end: end + 1 } : span;\n}\n\nexport function unwrapTsExpression(node: any): any {\n let current = node;\n while (\n current?.type === \"TSSatisfiesExpression\" ||\n current?.type === \"TSAsExpression\" ||\n current?.type === \"TSNonNullExpression\" ||\n current?.type === \"ParenthesizedExpression\"\n ) {\n current = current.expression;\n }\n return current;\n}\n\nfunction readPropertyKeyName(key: any): string | null {\n if (key?.type === \"Identifier\") return key.name;\n if (key?.type === \"Literal\") {\n if (typeof key.value === \"string\") return key.value;\n if (typeof key.value === \"number\") return String(key.value);\n }\n return null;\n}\n\nfunction getObjectProperty(objectExpression: any, name: string): any | null {\n if (objectExpression?.type !== \"ObjectExpression\") return null;\n for (const property of objectExpression.properties ?? []) {\n if (property?.type !== \"Property\" || property.computed) continue;\n if (readPropertyKeyName(property.key) === name) return property;\n }\n return null;\n}\n\nexport function toSourceSpan(node: any): AssetSourceSpan | undefined {\n return typeof node?.start === \"number\" &&\n Number.isFinite(node.start) &&\n typeof node?.end === \"number\" &&\n Number.isFinite(node.end)\n ? { start: node.start, end: node.end }\n : undefined;\n}\n\nfunction walk(\n node: any,\n visitor: (node: any) => void,\n seen = new Set<any>(),\n): void {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n if (typeof node.type === \"string\") visitor(node);\n\n for (const value of Object.values(node)) {\n if (!value || typeof value !== \"object\") continue;\n if (Array.isArray(value)) {\n for (const item of value) walk(item, visitor, seen);\n } else {\n walk(value, visitor, seen);\n }\n }\n}\n"],"mappings":";;;;;;AAeA,SAAS,iBAAiB;AAmBnB,IAAM,0BAA0B;AAEhC,SAAS,eACd,UACA,QACA,SAAS,kBAAkB,UAAU,MAAM,GAC1B;AAGjB,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,SAAS,CAAC,GAAG,OAAO,MAAM;AAChC,MAAI,CAAC,SAAS;AACZ,WAAO,EAAE,UAAU,cAAc,CAAC,GAAG,OAAO;AAAA,EAC9C;AAEA,QAAM,UAAU,iBAAiB,OAAO;AACxC,aAAW,aAAa,QAAQ,YAAY;AAC1C,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,sCAAsC,uBAAuB,+BAA0B,UAAU,MAAM;AAAA,MAChH,MAAM,UAAU;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,oBAAI,IAAiB;AACvC,aAAW,aAAa,QAAQ,MAAM;AACpC,UAAM,cACJ,UAAU,SAAS,2BACf,UAAU,cACV;AACN,QACE,aAAa,SAAS,yBACtB,YAAY,SAAS;AAErB;AACF,eAAW,WAAW,YAAY;AAChC,UAAI,QAAQ,GAAG,SAAS,gBAAgB,QAAQ;AAC9C,kBAAU,IAAI,QAAQ,GAAG,MAAM,QAAQ,IAAI;AAAA,EACjD;AACA,QAAM,mBAAmB,CACvB,MACA,OAAO,oBAAI,IAAY,GACvB,QAAQ,MACA;AACR,QAAI,CAAC,QAAQ,QAAQ,GAAI,QAAO;AAChC,QACE,KAAK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