tempo-sdk 0.0.16 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/assets/editor.d.ts +79 -0
  2. package/dist/assets/editor.js +571 -0
  3. package/dist/assets/editor.js.map +1 -0
  4. package/dist/assets/index.d.ts +83 -0
  5. package/dist/assets/index.js +26 -0
  6. package/dist/assets/index.js.map +1 -0
  7. package/dist/assets/parser.d.ts +78 -0
  8. package/dist/assets/parser.js +29 -0
  9. package/dist/assets/parser.js.map +1 -0
  10. package/dist/canvas/editor.d.ts +44 -9
  11. package/dist/canvas/editor.js +116 -416
  12. package/dist/canvas/editor.js.map +1 -1
  13. package/dist/canvas/index.d.ts +1 -0
  14. package/dist/canvas/index.js +237 -56
  15. package/dist/canvas/index.js.map +1 -1
  16. package/dist/canvas/parser.d.ts +25 -2
  17. package/dist/canvas/parser.js +3 -3
  18. package/dist/{chunk-77BNMPBS.js → chunk-CB5NJJJT.js} +31 -5
  19. package/dist/chunk-CB5NJJJT.js.map +1 -0
  20. package/dist/chunk-IWULHYPW.js +650 -0
  21. package/dist/chunk-IWULHYPW.js.map +1 -0
  22. package/dist/{chunk-ICP7LCPJ.js → chunk-P277UVZE.js} +279 -40
  23. package/dist/chunk-P277UVZE.js.map +1 -0
  24. package/dist/expo/plugin.cjs +30 -4
  25. package/dist/expo/plugin.cjs.map +1 -1
  26. package/dist/expo/plugin.js +1 -1
  27. package/dist/expo-babel-plugin.cjs +30 -4
  28. package/dist/expo-babel-plugin.cjs.map +1 -1
  29. package/dist/expo-babel-plugin.d.cts +1 -1
  30. package/dist/expo-babel-plugin.d.ts +1 -1
  31. package/dist/expo-babel-plugin.js +1 -1
  32. package/dist/index.js +26 -6
  33. package/dist/index.js.map +1 -1
  34. package/dist/nextjs-loader.cjs +29 -4
  35. package/dist/nextjs-loader.cjs.map +1 -1
  36. package/dist/types-B-dRoF2T.d.ts +102 -0
  37. package/package.json +16 -3
  38. package/dist/annotation-strategy-DCJHc--2.d.cts +0 -13
  39. package/dist/annotation-strategy-DCJHc--2.d.ts +0 -13
  40. package/dist/chunk-2LP5G6CD.js +0 -748
  41. package/dist/chunk-2LP5G6CD.js.map +0 -1
  42. package/dist/chunk-77BNMPBS.js.map +0 -1
  43. package/dist/chunk-B3PHU7XX.js +0 -571
  44. package/dist/chunk-B3PHU7XX.js.map +0 -1
  45. package/dist/chunk-EJBWZCEE.js +0 -434
  46. package/dist/chunk-EJBWZCEE.js.map +0 -1
  47. package/dist/chunk-F64WRL4H.js +0 -884
  48. package/dist/chunk-F64WRL4H.js.map +0 -1
  49. package/dist/chunk-G7M57ARC.js +0 -902
  50. package/dist/chunk-G7M57ARC.js.map +0 -1
  51. package/dist/chunk-GHPL4LGE.js +0 -205
  52. package/dist/chunk-GHPL4LGE.js.map +0 -1
  53. package/dist/chunk-ICP7LCPJ.js.map +0 -1
  54. package/dist/chunk-IG3JZVZI.js +0 -846
  55. package/dist/chunk-IG3JZVZI.js.map +0 -1
  56. package/dist/chunk-MBTLXFNP.js +0 -605
  57. package/dist/chunk-MBTLXFNP.js.map +0 -1
  58. package/dist/chunk-MD3HJ7L3.js +0 -457
  59. package/dist/chunk-MD3HJ7L3.js.map +0 -1
  60. package/dist/chunk-O3HYJ6BU.js +0 -433
  61. package/dist/chunk-O3HYJ6BU.js.map +0 -1
  62. package/dist/chunk-WGGLHHC5.js +0 -337
  63. package/dist/chunk-WGGLHHC5.js.map +0 -1
  64. package/dist/chunk-X3K7Z2BH.js +0 -900
  65. package/dist/chunk-X3K7Z2BH.js.map +0 -1
  66. package/dist/chunk-ZHORRCQG.js +0 -756
  67. package/dist/chunk-ZHORRCQG.js.map +0 -1
  68. package/dist/index.cjs +0 -1170
  69. package/dist/index.cjs.map +0 -1
  70. package/dist/index.d.cts +0 -99
  71. package/dist/page-BokkL6FZ.d.ts +0 -35
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../assets/parser.ts","../assets/types.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): ParsedAssetFile {\n const { program, errors } = parseAssetProgram(filePath, source);\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 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 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 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 /** 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 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 (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\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}\" — the first declaration stays authoritative`,\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\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 const propsProperty =\n value?.type === \"ObjectExpression\" ? getObjectProperty(value, \"props\") : null;\n const propsValue = propsProperty\n ? readStaticValue(propsProperty.value)\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 };\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 \"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 record[key] = readStaticValue(property.value);\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","/**\n * Shared data-model types for the asset system's static pipeline: the parser\n * (`tempo-sdk/assets/parser`), the source editor (`tempo-sdk/assets/editor`),\n * and downstream consumers (`@tempo-modules/asset-libraries` index + MCP\n * tools). Everything here must stay JSON-serializable — parse results cross\n * IPC and MCP boundaries verbatim.\n *\n * See specs/asset-libraries.md §3 for the full parsing contract.\n */\n\nexport type AssetSourceSpan = { start: number; end: number };\n\n/** Stable machine-readable identifiers for every parse/edit problem. */\nexport type AssetParseErrorCode =\n // structural — the declaration's identity cannot be trusted; excluded from the index\n | \"misimported_define_asset\"\n | \"non_identifier_component\"\n | \"unknown_binding\"\n | \"imported_binding\"\n | \"non_top_level_binding\"\n | \"config_not_object_literal\"\n | \"invalid_call_arguments\"\n | \"duplicate_declaration\"\n | \"non_top_level_call\"\n | \"unparseable_source\"\n // structural — emitted by the workspace index builder (@tempo-modules/\n // asset-libraries), never by the per-file parser: these need workspace\n // context (canvas-dir location, cross-file identity) the parser lacks\n | \"component_declaration_outside_canvas\"\n | \"duplicate_asset_declaration\"\n // degraded/info — canvas-pointer docstring validation, emitted by the\n // workspace index builder for canvas-declared components: the component's\n // defining file must carry a comment naming the declaring canvas's path\n | \"missing_canvas_pointer\"\n | \"stale_canvas_pointer\"\n | \"canvas_pointer_unverified\"\n // degraded — emitted by the workspace index builder: a canvas self-\n // registration is redundant when files in the same canvas folder also\n // declare component references (those already link the canvas via\n // canvasPath — self-registration is strictly for component-less\n // foundations pages)\n | \"redundant_canvas_declaration\"\n // degraded — the declaration is indexed; the issue is carried as a warning\n | \"non_literal_library\"\n | \"empty_library_name\"\n | \"duplicate_library\"\n | \"empty_variants\"\n | \"variants_on_canvas\"\n | \"unresolved_prop_value\"\n | \"not_exported\";\n\nexport type AssetParseError = {\n code: AssetParseErrorCode;\n message: string;\n /** \"structural\": the declaration is excluded from the index — readers must\n * fail closed. \"degraded\": the declaration is indexed; this is a warning\n * carried on the entry. \"info\": advisory note carried on the entry —\n * best-effort validation that could not run to a verdict; never a\n * failure. Mirrors CanvasParseError's severity split. */\n severity: \"structural\" | \"degraded\" | \"info\";\n span?: AssetSourceSpan;\n};\n\n/**\n * A config value the parser could not resolve statically (identifier\n * reference, call result, JSX, spread, …). The `$unresolved` shape is the\n * wire format everywhere (index, IPC, MCP) — no translation layers.\n * A user literally writing `{ $unresolved: true }` as a prop value is\n * indistinguishable from this marker; that collision is accepted.\n */\nexport type UnresolvedValue = { $unresolved: true };\n\nexport const UNRESOLVED_VALUE: UnresolvedValue = Object.freeze({\n $unresolved: true,\n});\n\nexport function isUnresolvedValue(value: unknown): value is UnresolvedValue {\n return (\n typeof value === \"object\" &&\n value !== null &&\n ($unresolvedKey in value) &&\n (value as UnresolvedValue).$unresolved === true\n );\n}\n\nconst $unresolvedKey = \"$unresolved\" satisfies keyof UnresolvedValue;\n\n/** Statically-readable config value: JSON literals plus the UNRESOLVED marker. */\nexport type StaticValue =\n | string\n | number\n | boolean\n | null\n | UnresolvedValue\n | StaticValue[]\n | { [key: string]: StaticValue };\n\nexport type ParsedAssetVariant = {\n name: string;\n /** One dynamic value does not discard the variant — it parses to UNRESOLVED. */\n props: Record<string, StaticValue>;\n hasUnresolvedValues: boolean;\n};\n\nexport type AssetExportKind = \"named\" | \"default\" | \"none\";\n\n/** Source spans that power the surgical editor (specs/asset-libraries.md §4). */\nexport type AssetSpans = {\n /** The whole `defineAsset(...)` expression statement, semicolon included. */\n call: AssetSourceSpan;\n /** The config ObjectExpression (second argument). */\n config: AssetSourceSpan;\n /** The `libraries` array expression, only when the value is an array\n * literal. A `librariesProperty` without `libraries` means the property\n * exists but its value is dynamic — the editor must refuse to touch it. */\n libraries?: AssetSourceSpan;\n /** The whole `libraries: <value>` property, whenever the key is present.\n * Lets the editor remove the property outright when its array empties. */\n librariesProperty?: AssetSourceSpan;\n /** One span per statically-known `libraries` entry, in source order,\n * index-aligned with ParsedAssetDeclaration.libraries. */\n libraryItems: AssetSourceSpan[];\n};\n\n/** Reference-declaration target: defineAsset's first argument is an imported\n * binding, and the asset's identity is the import itself. Purely syntactic —\n * the parser records the import statement's module specifier plus the name\n * imported from it (\"default\" for default imports); resolution to a\n * workspace identity happens in @tempo-modules/asset-libraries. */\nexport type ParsedAssetReference = {\n importSpecifier: string;\n importedName: string;\n};\n\nexport type ParsedAssetDeclaration = {\n /** The identifier passed as defineAsset's first argument. */\n bindingName: string;\n exportKind: AssetExportKind;\n /** Deduplicated, statically-known entries only. */\n libraries: string[];\n /** What this asset is and when to reach for it (and when not). */\n usageInstructions?: string;\n variants: ParsedAssetVariant[];\n /** Present iff the declaration targets an imported binding. */\n reference?: ParsedAssetReference;\n spans: AssetSpans;\n /** Degraded-severity notes scoped to this declaration. */\n warnings: AssetParseError[];\n};\n\nexport type ParsedAssetFile = {\n filePath: string;\n /** Declarations whose identity parsed cleanly (may carry warnings). */\n declarations: ParsedAssetDeclaration[];\n /** Structural errors: file-level problems and rejected declarations. */\n errors: AssetParseError[];\n};\n\n/** Typed failures shared by the editor operations (§4.1) and the MCP write\n * tools that surface them (§7.3). */\nexport type AssetEditFailureCode =\n | \"asset_not_found\"\n | \"config_not_editable\"\n | \"export_not_found\"\n | \"already_defined\"\n | \"not_definable\";\n"],"mappings":";AAeA,SAAS,iBAAiB;;;ACyDnB,IAAM,mBAAoC,OAAO,OAAO;AAAA,EAC7D,aAAa;AACf,CAAC;AAEM,SAAS,kBAAkB,OAA0C;AAC1E,SACE,OAAO,UAAU,YACjB,UAAU,QACT,kBAAkB,SAClB,MAA0B,gBAAgB;AAE/C;AAEA,IAAM,iBAAiB;;;ADnDhB,IAAM,0BAA0B;AAEhC,SAAS,eACd,UACA,QACiB;AACjB,QAAM,EAAE,SAAS,OAAO,IAAI,kBAAkB,UAAU,MAAM;AAC9D,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,QA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"getCanvasStoryboardRenderId",
15
+ "CanvasHost",
16
+ "buildRenderContentFiberSelector",
17
+ "buildRenderContentSelector",
18
+ "buildRenderSelector",
19
+ "captureStoryboardCombined",
20
+ "captureStoryboardHtml",
21
+ "captureStoryboardImage",
22
+ "captureStoryboardStaticHtml",
23
+ "stripRenderContentWrapperAttributes",
24
+ "stripRenderContentWrapperFromCombinedCapture",
25
+ "watchStoryboardCombined",
26
+ "watchStoryboardHtml",
27
+ "getCanvasHostRuntime",
28
+ "getOptionalCanvasHostRuntime",
29
+ "useActiveState",
30
+ "HtmlStoryboard",
31
+ "LegacyStoryboardV1",
32
+ "RouteStoryboard",
33
+ "Storyboard",
34
+ "StoryboardSlot"
35
+ ]);
11
36
  var DEFAULT_LAYOUT = {
12
37
  x: 0,
13
38
  y: 0,
@@ -23,7 +48,8 @@ function parseCanvasFile(filePath, source) {
23
48
  for (const error of result.errors ?? []) {
24
49
  errors.push({
25
50
  message: error.message ?? "Unable to parse canvas source",
26
- span: toSpan(error) ?? toSpan(error?.labels?.[0])
51
+ span: toSpan(error) ?? toSpan(error?.labels?.[0]),
52
+ kind: "structural"
27
53
  });
28
54
  }
29
55
  } catch (error) {
@@ -31,33 +57,86 @@ function parseCanvasFile(filePath, source) {
31
57
  filePath,
32
58
  pageName: fallbackPageName(filePath),
33
59
  imports: [],
60
+ misimportedSdkCanvasImports: [],
34
61
  storyboards: [],
35
62
  errors: [
36
63
  {
37
- message: error instanceof Error ? error.message : "Unable to parse canvas source"
64
+ message: error instanceof Error ? error.message : "Unable to parse canvas source",
65
+ kind: "structural"
38
66
  }
39
67
  ]
40
68
  };
41
69
  }
42
70
  const imports = readImports(program);
43
- const { legacyObjects, stringBindings: objectStringBindings } = readObjectExpressionBindings(program);
44
- const storyboards = [];
71
+ const misimportedSdkCanvasImports = readMisimportedSdkCanvasImports(program);
72
+ const { legacyObjects, stringBindings: objectStringBindings } = readObjectExpressionBindings(program, imports, source);
45
73
  let canvasElement = null;
74
+ const allStoryboardElements = [];
46
75
  walk(program, (node) => {
47
76
  if (node.type !== "JSXElement") return;
48
77
  const component = resolveSdkComponent(node.openingElement?.name, imports);
49
- if (component === "Canvas" && !canvasElement) {
50
- canvasElement = node;
78
+ const namespaceMisimport = resolveMisimportedNamespaceSdkComponent(
79
+ node.openingElement?.name,
80
+ imports,
81
+ misimportedSdkCanvasImports
82
+ );
83
+ if (namespaceMisimport) {
84
+ misimportedSdkCanvasImports.add(namespaceMisimport);
85
+ }
86
+ if (component === "Canvas") {
87
+ if (!canvasElement) {
88
+ canvasElement = node;
89
+ } else {
90
+ errors.push({
91
+ message: "Canvas file must declare exactly one <Canvas> element",
92
+ span: toSpan(node),
93
+ kind: "structural"
94
+ });
95
+ }
51
96
  return;
52
97
  }
53
- if (component === "Storyboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard") {
54
- storyboards.push(
55
- readStoryboard(node, component, imports, legacyObjects, source, errors)
56
- );
98
+ if (isStoryboardSdkComponent(component)) {
99
+ allStoryboardElements.push({ element: node, component });
57
100
  }
58
101
  });
102
+ const directStoryboardElements = canvasElement ? readDirectCanvasStoryboardElements(canvasElement, imports) : [];
103
+ const directStoryboardElementSet = new Set(
104
+ directStoryboardElements.map((item) => item.element)
105
+ );
106
+ const storyboards = directStoryboardElements.map(
107
+ (item) => readStoryboard(
108
+ item.element,
109
+ item.component,
110
+ imports,
111
+ legacyObjects,
112
+ source,
113
+ errors
114
+ )
115
+ );
116
+ for (const item of allStoryboardElements) {
117
+ if (directStoryboardElementSet.has(item.element)) continue;
118
+ errors.push({
119
+ message: `<${item.component}> declarations must be direct children of the <Canvas> element`,
120
+ span: toSpan(item.element),
121
+ kind: "structural"
122
+ });
123
+ }
124
+ reportDuplicateStoryboardIds(storyboards, errors);
59
125
  if (!canvasElement) {
60
- errors.push({ message: "No <Canvas> declaration found in canvas file" });
126
+ if (misimportedSdkCanvasImports.all.length > 0) {
127
+ for (const entry of misimportedSdkCanvasImports.all) {
128
+ errors.push({
129
+ message: misimportedSdkCanvasImportMessage(entry),
130
+ span: entry.sourceSpan,
131
+ kind: "structural"
132
+ });
133
+ }
134
+ } else {
135
+ errors.push({
136
+ message: "No <Canvas> declaration found in canvas file",
137
+ kind: "structural"
138
+ });
139
+ }
61
140
  } else {
62
141
  errors.push(...validateCanvasChildren(canvasElement, imports));
63
142
  }
@@ -72,11 +151,16 @@ function parseCanvasFile(filePath, source) {
72
151
  openingElement,
73
152
  "backgroundColor",
74
153
  objectStringBindings
75
- ) ?? readResolvableStringAttribute(openingElement, "background", objectStringBindings);
154
+ ) ?? readResolvableStringAttribute(
155
+ openingElement,
156
+ "background",
157
+ objectStringBindings
158
+ );
76
159
  if (openingElement && !name) {
77
160
  errors.push({
78
161
  message: '<Canvas> must include a literal "name" prop',
79
- span: toSpan(openingElement)
162
+ span: toSpan(openingElement),
163
+ kind: "degraded"
80
164
  });
81
165
  }
82
166
  return {
@@ -94,11 +178,59 @@ function parseCanvasFile(filePath, source) {
94
178
  backgroundColorSpan: backgroundColor?.valueSpan,
95
179
  backgroundColorAttributeSpan: backgroundColor?.attributeSpan,
96
180
  imports: imports.all,
181
+ misimportedSdkCanvasImports: misimportedSdkCanvasImports.all,
97
182
  storyboards,
98
183
  errors
99
184
  };
100
185
  }
101
- var parseCanvasSource = parseCanvasFile;
186
+ function misimportedSdkCanvasImportMessage(entry) {
187
+ return `Tempo canvas components must be imported from "tempo-sdk/canvas" \u2014 found import of ${entry.importedNames.join(", ")} from "${entry.source}"`;
188
+ }
189
+ function readMisimportedSdkCanvasImports(program) {
190
+ const all = [];
191
+ const byDeclarationKey = /* @__PURE__ */ new Map();
192
+ const namespaceCandidatesByLocalName = /* @__PURE__ */ new Map();
193
+ const add = (entry) => {
194
+ const key = spanKey(entry.sourceSpan);
195
+ if (byDeclarationKey.has(key)) return;
196
+ byDeclarationKey.set(key, entry);
197
+ all.push(entry);
198
+ };
199
+ for (const statement of program?.body ?? []) {
200
+ if (statement?.type !== "ImportDeclaration" || typeof statement.source?.value !== "string" || !isWrongTempoSdkCanvasImportSource(statement.source.value) || statement.importKind === "type") {
201
+ continue;
202
+ }
203
+ const source = statement.source.value;
204
+ const sourceSpan = toSpan(statement.source);
205
+ if (!sourceSpan) continue;
206
+ const valueSpecifiers = (statement.specifiers ?? []).filter(
207
+ (specifier) => specifier?.importKind !== "type"
208
+ );
209
+ const importedNames = valueSpecifiers.map(readImportedName);
210
+ const entry = {
211
+ source,
212
+ sourceSpan,
213
+ importedNames,
214
+ rewritable: valueSpecifiers.length > 0 && valueSpecifiers.every(
215
+ (specifier) => specifier?.type === "ImportSpecifier" && SDK_CANVAS_VALUE_EXPORTS.has(readImportedName(specifier))
216
+ )
217
+ };
218
+ const hasMisimportedNamedSdkComponent = valueSpecifiers.some(
219
+ (specifier) => specifier?.type === "ImportSpecifier" && SDK_COMPONENTS.has(readImportedName(specifier))
220
+ );
221
+ if (hasMisimportedNamedSdkComponent) {
222
+ add(entry);
223
+ }
224
+ for (const specifier of valueSpecifiers) {
225
+ if (specifier?.type !== "ImportNamespaceSpecifier") continue;
226
+ const localName = specifier.local?.name;
227
+ if (typeof localName === "string") {
228
+ namespaceCandidatesByLocalName.set(localName, entry);
229
+ }
230
+ }
231
+ }
232
+ return { all, byDeclarationKey, namespaceCandidatesByLocalName, add };
233
+ }
102
234
  function readImports(program) {
103
235
  const all = [];
104
236
  const byLocalName = /* @__PURE__ */ new Map();
@@ -147,28 +279,42 @@ function readImports(program) {
147
279
  }
148
280
  return { all, byLocalName, sdkLocalNames, sdkNamespaces };
149
281
  }
150
- function readObjectExpressionBindings(program) {
282
+ function readObjectExpressionBindings(program, imports, source) {
151
283
  const legacyObjects = /* @__PURE__ */ new Map();
152
284
  const stringBindings = /* @__PURE__ */ new Map();
153
- walk(program, (node) => {
154
- if (node?.type !== "VariableDeclarator" || node.id?.type !== "Identifier") {
155
- return;
285
+ for (const node of readTopLevelVariableDeclarators(program)) {
286
+ if (node.id?.type !== "Identifier") {
287
+ continue;
156
288
  }
157
289
  const objectExpression = unwrapTsExpression(node.init);
158
- if (objectExpression?.type !== "ObjectExpression") return;
290
+ if (objectExpression?.type !== "ObjectExpression") continue;
159
291
  const bindingName = node.id.name;
160
292
  legacyObjects.set(
161
293
  bindingName,
162
- readLegacyStoryboardObject(bindingName, objectExpression)
294
+ readLegacyStoryboardObject(
295
+ bindingName,
296
+ objectExpression,
297
+ imports,
298
+ source
299
+ )
163
300
  );
164
301
  const stringProperties = readObjectStringProperties(objectExpression);
165
302
  if (stringProperties.size > 0) {
166
303
  stringBindings.set(bindingName, stringProperties);
167
304
  }
168
- });
305
+ }
169
306
  return { legacyObjects, stringBindings };
170
307
  }
171
- function readLegacyStoryboardObject(bindingName, objectExpression) {
308
+ function readTopLevelVariableDeclarators(program) {
309
+ const declarators = [];
310
+ for (const statement of program?.body ?? []) {
311
+ const declaration = statement?.type === "VariableDeclaration" ? statement : statement?.type === "ExportNamedDeclaration" && statement.declaration?.type === "VariableDeclaration" ? statement.declaration : null;
312
+ if (!declaration) continue;
313
+ declarators.push(...declaration.declarations ?? []);
314
+ }
315
+ return declarators;
316
+ }
317
+ function readLegacyStoryboardObject(bindingName, objectExpression, imports, source) {
172
318
  const errors = [];
173
319
  const nameProperty = getObjectProperty(objectExpression, "name");
174
320
  const name = nameProperty ? readStringLiteralValue(nameProperty.value) : null;
@@ -178,20 +324,29 @@ function readLegacyStoryboardObject(bindingName, objectExpression) {
178
324
  errors: [
179
325
  {
180
326
  message: '<LegacyStoryboardV1> storyboard object must include a literal "layout" object',
181
- span: toSpan(objectExpression)
327
+ span: toSpan(objectExpression),
328
+ kind: "degraded"
182
329
  }
183
330
  ]
184
331
  };
332
+ const renderProperty = getObjectProperty(objectExpression, "render");
333
+ const component = readRenderComponentReference(
334
+ renderProperty?.value,
335
+ imports,
336
+ source
337
+ );
185
338
  if (nameProperty && !name) {
186
339
  errors.push({
187
340
  message: "<LegacyStoryboardV1> storyboard.name must be a string literal when set",
188
- span: toSpan(nameProperty)
341
+ span: toSpan(nameProperty),
342
+ kind: "degraded"
189
343
  });
190
344
  }
191
345
  errors.push(...layout.errors);
192
346
  return {
193
347
  bindingName,
194
348
  displayName: name?.value,
349
+ component: component ?? void 0,
195
350
  objectSpan: toSpan(objectExpression),
196
351
  objectClose: readLayoutClose(objectExpression),
197
352
  nameSpan: name?.span,
@@ -227,12 +382,14 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
227
382
  errors: legacyObject?.errors ?? (legacyReference ? [
228
383
  {
229
384
  message: "<LegacyStoryboardV1> storyboard prop must reference a same-file object literal",
230
- span: legacyReference.span
385
+ span: legacyReference.span,
386
+ kind: "degraded"
231
387
  }
232
388
  ] : [
233
389
  {
234
390
  message: '<LegacyStoryboardV1> must include a "storyboard" expression prop',
235
- span: toSpan(openingElement)
391
+ span: toSpan(openingElement),
392
+ kind: "degraded"
236
393
  }
237
394
  ])
238
395
  } : readLayout(openingElement, component);
@@ -240,7 +397,8 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
240
397
  if (!id) {
241
398
  errors.push({
242
399
  message: `<${component}> must include a literal "id" prop`,
243
- span: toSpan(openingElement)
400
+ span: toSpan(openingElement),
401
+ kind: "structural"
244
402
  });
245
403
  }
246
404
  if (layout.errors.length > 0) {
@@ -261,6 +419,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
261
419
  layoutAttributeSpan: layout.attributeSpan,
262
420
  layoutSpans: layout.spans,
263
421
  props: readExpressionReference(openingElement, "props", source),
422
+ component: legacyObject?.component,
264
423
  legacyV1: legacyReference ? {
265
424
  storyboard: legacyReference,
266
425
  objectName: legacyObject?.bindingName,
@@ -282,7 +441,8 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
282
441
  } else {
283
442
  errors.push({
284
443
  message: '<Storyboard> must include a "component" expression prop',
285
- span: toSpan(openingElement)
444
+ span: toSpan(openingElement),
445
+ kind: "degraded"
286
446
  });
287
447
  }
288
448
  }
@@ -295,7 +455,8 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
295
455
  } else {
296
456
  errors.push({
297
457
  message: '<RouteStoryboard> must include a literal "route" prop',
298
- span: toSpan(openingElement)
458
+ span: toSpan(openingElement),
459
+ kind: "degraded"
299
460
  });
300
461
  }
301
462
  }
@@ -311,13 +472,45 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
311
472
  if (!filepath && !src) {
312
473
  errors.push({
313
474
  message: '<HtmlStoryboard> must include a literal "filepath" or "src" prop',
314
- span: toSpan(openingElement)
475
+ span: toSpan(openingElement),
476
+ kind: "degraded"
315
477
  });
316
478
  }
317
479
  }
318
480
  globalErrors.push(...errors);
319
481
  return storyboard;
320
482
  }
483
+ function readDirectCanvasStoryboardElements(canvasElement, imports) {
484
+ const elements = [];
485
+ for (const child of canvasElement.children ?? []) {
486
+ if (child?.type !== "JSXElement") continue;
487
+ const component = resolveSdkComponent(child.openingElement?.name, imports);
488
+ if (isStoryboardSdkComponent(component)) {
489
+ elements.push({ element: child, component });
490
+ }
491
+ }
492
+ return elements;
493
+ }
494
+ function reportDuplicateStoryboardIds(storyboards, errors) {
495
+ const byId = /* @__PURE__ */ new Map();
496
+ for (const storyboard of storyboards) {
497
+ if (!storyboard.storyboardKey) continue;
498
+ const matching = byId.get(storyboard.storyboardKey);
499
+ if (matching) {
500
+ matching.push(storyboard);
501
+ } else {
502
+ byId.set(storyboard.storyboardKey, [storyboard]);
503
+ }
504
+ }
505
+ for (const [storyboardKey, matching] of byId) {
506
+ if (matching.length < 2) continue;
507
+ errors.push({
508
+ message: `Duplicate storyboard id "${storyboardKey}" (${matching.length} declarations) \u2014 storyboard ids must be unique`,
509
+ span: matching[1]?.jsxElementSpan,
510
+ kind: "structural"
511
+ });
512
+ }
513
+ }
321
514
  function validateCanvasChildren(canvasElement, imports) {
322
515
  const errors = [];
323
516
  for (const child of canvasElement.children ?? []) {
@@ -333,19 +526,24 @@ function validateCanvasChildren(canvasElement, imports) {
333
526
  }
334
527
  errors.push({
335
528
  message: "<Canvas> children must be static storyboard declarations, not expressions",
336
- span: toSpan(child)
529
+ span: toSpan(child),
530
+ kind: "structural"
337
531
  });
338
532
  continue;
339
533
  }
340
534
  if (child.type === "JSXElement") {
341
- const component = resolveSdkComponent(child.openingElement?.name, imports);
535
+ const component = resolveSdkComponent(
536
+ child.openingElement?.name,
537
+ imports
538
+ );
342
539
  if (component === "Storyboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard") {
343
540
  continue;
344
541
  }
345
542
  }
346
543
  errors.push({
347
544
  message: "<Canvas> children must be <Storyboard>, <RouteStoryboard>, <HtmlStoryboard>, or <LegacyStoryboardV1> declarations",
348
- span: toSpan(child)
545
+ span: toSpan(child),
546
+ kind: "structural"
349
547
  });
350
548
  }
351
549
  return errors;
@@ -364,6 +562,21 @@ function readComponentReference(openingElement, imports, source) {
364
562
  import: localName ? imports.byLocalName.get(localName) : void 0
365
563
  };
366
564
  }
565
+ function readRenderComponentReference(renderValue, imports, source) {
566
+ if (renderValue?.type !== "ArrowFunctionExpression") return null;
567
+ const body = unwrapTsExpression(renderValue.body);
568
+ if (body?.type !== "JSXElement") return null;
569
+ const name = body.openingElement?.name;
570
+ if (name?.type !== "JSXIdentifier") return null;
571
+ const span = toSpan(name);
572
+ if (!span || typeof name.name !== "string") return null;
573
+ return {
574
+ expression: source.slice(span.start, span.end),
575
+ span,
576
+ localName: name.name,
577
+ import: imports.byLocalName.get(name.name)
578
+ };
579
+ }
367
580
  function readExpressionReference(openingElement, name, source) {
368
581
  const attribute = getAttribute(openingElement, name);
369
582
  const expression = unwrapAttributeExpression(attribute?.value);
@@ -389,7 +602,8 @@ function readLayout(openingElement, componentName) {
389
602
  errors: [
390
603
  {
391
604
  message: `<${componentName}> must include a literal "layout" object prop`,
392
- span: toSpan(openingElement)
605
+ span: toSpan(openingElement),
606
+ kind: "degraded"
393
607
  }
394
608
  ]
395
609
  };
@@ -409,7 +623,8 @@ function readLayoutExpression(expression, componentName) {
409
623
  errors: [
410
624
  {
411
625
  message: `<${componentName}> layout must be an object literal`,
412
- span: toSpan(expression)
626
+ span: toSpan(expression),
627
+ kind: "degraded"
413
628
  }
414
629
  ]
415
630
  };
@@ -427,7 +642,8 @@ function readLayoutExpression(expression, componentName) {
427
642
  } else {
428
643
  errors.push({
429
644
  message: `<${componentName}> layout.${key} must be a number literal`,
430
- span: toSpan(property ?? expression)
645
+ span: toSpan(property ?? expression),
646
+ kind: "degraded"
431
647
  });
432
648
  }
433
649
  }
@@ -440,7 +656,8 @@ function readLayoutExpression(expression, componentName) {
440
656
  } else {
441
657
  errors.push({
442
658
  message: `<${componentName}> layout.zIndex must be a number literal`,
443
- span: toSpan(zIndex)
659
+ span: toSpan(zIndex),
660
+ kind: "degraded"
444
661
  });
445
662
  }
446
663
  }
@@ -452,7 +669,8 @@ function readLayoutExpression(expression, componentName) {
452
669
  } else {
453
670
  errors.push({
454
671
  message: `<${componentName}> layout.intrinsicSizing must be "root-element" when set`,
455
- span: toSpan(intrinsicSizing)
672
+ span: toSpan(intrinsicSizing),
673
+ kind: "degraded"
456
674
  });
457
675
  }
458
676
  }
@@ -563,6 +781,21 @@ function resolveSdkComponent(nameNode, imports) {
563
781
  }
564
782
  return null;
565
783
  }
784
+ function resolveMisimportedNamespaceSdkComponent(nameNode, imports, misimportedSdkCanvasImports) {
785
+ if (nameNode?.type !== "JSXMemberExpression" || nameNode.object?.type !== "JSXIdentifier" || nameNode.property?.type !== "JSXIdentifier" || !SDK_COMPONENTS.has(nameNode.property.name)) {
786
+ return null;
787
+ }
788
+ const imported = imports.byLocalName.get(nameNode.object.name);
789
+ if (imported?.kind !== "namespace" || !isWrongTempoSdkCanvasImportSource(imported.source)) {
790
+ return null;
791
+ }
792
+ return misimportedSdkCanvasImports.namespaceCandidatesByLocalName.get(
793
+ nameNode.object.name
794
+ ) ?? null;
795
+ }
796
+ function isStoryboardSdkComponent(component) {
797
+ return component === "Storyboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard";
798
+ }
566
799
  function readImportedName(specifier) {
567
800
  if (specifier.type === "ImportDefaultSpecifier") return "default";
568
801
  if (specifier.type === "ImportNamespaceSpecifier") return "*";
@@ -576,6 +809,12 @@ function readImportKind(specifier) {
576
809
  function isSdkImportSource(source) {
577
810
  return SDK_IMPORT_SOURCES.has(source) || source.endsWith("/tempo-sdk/canvas");
578
811
  }
812
+ function isWrongTempoSdkCanvasImportSource(source) {
813
+ return (source === "tempo-sdk" || source.startsWith("tempo-sdk/")) && !isSdkImportSource(source);
814
+ }
815
+ function spanKey(span) {
816
+ return `${span.start}:${span.end}`;
817
+ }
579
818
  function readLayoutClose(node) {
580
819
  return typeof node?.end === "number" && Number.isFinite(node.end) ? node.end - 1 : void 0;
581
820
  }
@@ -608,8 +847,8 @@ function walk(node, visitor, seen = /* @__PURE__ */ new Set()) {
608
847
 
609
848
  export {
610
849
  parseCanvasFile,
611
- parseCanvasSource,
850
+ misimportedSdkCanvasImportMessage,
612
851
  unwrapTsExpression,
613
852
  fallbackPageName
614
853
  };
615
- //# sourceMappingURL=chunk-ICP7LCPJ.js.map
854
+ //# sourceMappingURL=chunk-P277UVZE.js.map