tempo-sdk 0.0.99 → 0.0.102
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/README.md +3 -403
- package/dist/assets/editor.d.ts +43 -65
- package/dist/assets/editor.js +1 -573
- package/dist/assets/index.d.ts +11 -61
- package/dist/assets/index.js +1 -338
- package/dist/assets/parser.d.ts +68 -78
- package/dist/assets/parser.js +1 -33
- package/dist/astro/asset-preview-client.d.ts +3 -2
- package/dist/astro/asset-preview-client.js +1 -93
- package/dist/astro/controls.d.ts +1 -3
- package/dist/astro/controls.js +1 -7
- package/dist/astro/document-client.d.ts +5 -6
- package/dist/astro/document-client.js +1 -78
- package/dist/astro/runtime.d.ts +23 -11
- package/dist/astro/runtime.js +1 -86
- package/dist/astro.d.ts +19 -13
- package/dist/astro.js +1 -818
- package/dist/canvas/astro-contract.d.ts +0 -3
- package/dist/canvas/astro-contract.js +1 -9
- package/dist/canvas/astro.d.ts +3 -4
- package/dist/canvas/astro.js +1 -42
- package/dist/canvas/editor.d.ts +187 -183
- package/dist/canvas/editor.js +1 -1094
- package/dist/canvas/flutter-preview.d.ts +0 -1
- package/dist/canvas/flutter-preview.js +1 -9
- package/dist/canvas/index.d.ts +46 -100
- package/dist/canvas/index.js +1 -3926
- package/dist/canvas/interact-projection.d.ts +7 -5
- package/dist/canvas/interact-projection.js +1 -12
- package/dist/canvas/parser.d.ts +10 -303
- package/dist/canvas/parser.js +1 -30
- package/dist/canvas/svelte.d.ts +6 -7
- package/dist/canvas/svelte.js +1 -91
- package/dist/canvas/vue.d.ts +9 -49
- package/dist/canvas/vue.js +1 -264
- package/dist/chunk-CXCUJCXD.js +1 -0
- package/dist/chunk-FH6TMWFA.js +1 -0
- package/dist/chunk-FL7FSJSL.js +1 -0
- package/dist/chunk-GQIOB5SV.js +1 -0
- package/dist/chunk-HBQ7FFH7.js +1 -0
- package/dist/chunk-JRJOWLCN.js +1 -0
- package/dist/chunk-LJCBFTMP.js +1 -0
- package/dist/chunk-M3GN2KUH.js +1 -0
- package/dist/chunk-MPIHFFML.js +1 -0
- package/dist/chunk-T5TY3U2H.js +1 -0
- package/dist/chunk-XO2BSHWM.js +1 -0
- package/dist/chunk-XUSV3KOD.js +1 -0
- package/dist/chunk-ZXBMP6RV.js +1 -0
- package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
- package/dist/expo/plugin.cjs +1 -1928
- package/dist/expo/plugin.js +1 -8
- package/dist/expo-babel-plugin.cjs +1 -1928
- package/dist/expo-babel-plugin.d.cts +46 -40
- package/dist/expo-babel-plugin.d.ts +46 -40
- package/dist/expo-babel-plugin.js +1 -8
- package/dist/flutter-preview-path.d.ts +23 -7
- package/dist/flutter-preview-path.js +1 -16
- package/dist/index.d.ts +33 -45
- package/dist/index.js +1 -20
- package/dist/nextjs/plugin.cjs +1 -413
- package/dist/nextjs/plugin.js +1 -7
- package/dist/nextjs-loader.cjs +1 -2277
- package/dist/nextjs.cjs +1 -484
- package/dist/nextjs.d.cts +2 -58
- package/dist/nextjs.d.ts +2 -58
- package/dist/nextjs.js +1 -17
- package/dist/nuxt/runtime/identity.d.ts +2 -4
- package/dist/nuxt/runtime/identity.js +1 -18
- package/dist/nuxt.d.ts +31 -92
- package/dist/nuxt.js +1 -5854
- package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
- package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
- package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
- package/dist/svelte.d.ts +8 -18
- package/dist/svelte.js +1 -917
- package/dist/types-CfUgM2w4.d.ts +57 -0
- package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
- package/dist/vue.d.ts +17 -58
- package/dist/vue.js +1 -1501
- package/package.json +12 -62
- package/dist/assets/editor.js.map +0 -1
- package/dist/assets/index.js.map +0 -1
- package/dist/assets/parser.js.map +0 -1
- package/dist/astro/asset-preview-client.js.map +0 -1
- package/dist/astro/controls.js.map +0 -1
- package/dist/astro/document-client.js.map +0 -1
- package/dist/astro/runtime.js.map +0 -1
- package/dist/astro.js.map +0 -1
- package/dist/canvas/astro-contract.js.map +0 -1
- package/dist/canvas/astro.js.map +0 -1
- package/dist/canvas/editor.js.map +0 -1
- package/dist/canvas/flutter-preview.js.map +0 -1
- package/dist/canvas/index.js.map +0 -1
- package/dist/canvas/interact-projection.js.map +0 -1
- package/dist/canvas/parser.js.map +0 -1
- package/dist/canvas/svelte.js.map +0 -1
- package/dist/canvas/vue.js.map +0 -1
- package/dist/chunk-27WT3XUG.js +0 -455
- package/dist/chunk-27WT3XUG.js.map +0 -1
- package/dist/chunk-5HIIF354.js +0 -67
- package/dist/chunk-5HIIF354.js.map +0 -1
- package/dist/chunk-65B52AR7.js +0 -11
- package/dist/chunk-65B52AR7.js.map +0 -1
- package/dist/chunk-6HYKKP5N.js +0 -2658
- package/dist/chunk-6HYKKP5N.js.map +0 -1
- package/dist/chunk-6SOP4XU6.js +0 -1891
- package/dist/chunk-6SOP4XU6.js.map +0 -1
- package/dist/chunk-AFXE462X.js +0 -1253
- package/dist/chunk-AFXE462X.js.map +0 -1
- package/dist/chunk-BQPKOVI5.js +0 -115
- package/dist/chunk-BQPKOVI5.js.map +0 -1
- package/dist/chunk-CYDF4LYJ.js +0 -342
- package/dist/chunk-CYDF4LYJ.js.map +0 -1
- package/dist/chunk-CYQE3TLC.js +0 -37
- package/dist/chunk-CYQE3TLC.js.map +0 -1
- package/dist/chunk-DI2ZFAWL.js +0 -14
- package/dist/chunk-DI2ZFAWL.js.map +0 -1
- package/dist/chunk-EGRHWZRV.js +0 -1
- package/dist/chunk-EGRHWZRV.js.map +0 -1
- package/dist/chunk-FGWGY3G3.js +0 -157
- package/dist/chunk-FGWGY3G3.js.map +0 -1
- package/dist/chunk-HOBTDB6G.js +0 -112
- package/dist/chunk-HOBTDB6G.js.map +0 -1
- package/dist/chunk-I7VF4ZOV.js +0 -630
- package/dist/chunk-I7VF4ZOV.js.map +0 -1
- package/dist/chunk-JVVHU3A7.js +0 -1077
- package/dist/chunk-JVVHU3A7.js.map +0 -1
- package/dist/chunk-MIXQVPDH.js +0 -8606
- package/dist/chunk-MIXQVPDH.js.map +0 -1
- package/dist/chunk-MU7S7NU7.js +0 -183
- package/dist/chunk-MU7S7NU7.js.map +0 -1
- package/dist/chunk-OX2YKYSL.js +0 -13
- package/dist/chunk-OX2YKYSL.js.map +0 -1
- package/dist/chunk-PYAJHLXO.js +0 -903
- package/dist/chunk-PYAJHLXO.js.map +0 -1
- package/dist/chunk-SGN7BDRE.js +0 -16
- package/dist/chunk-SGN7BDRE.js.map +0 -1
- package/dist/chunk-SGTGDLOX.js +0 -285
- package/dist/chunk-SGTGDLOX.js.map +0 -1
- package/dist/chunk-T364NBR3.js +0 -1440
- package/dist/chunk-T364NBR3.js.map +0 -1
- package/dist/chunk-U66QI3EN.js +0 -1524
- package/dist/chunk-U66QI3EN.js.map +0 -1
- package/dist/chunk-WTXOWQ7N.js +0 -47
- package/dist/chunk-WTXOWQ7N.js.map +0 -1
- package/dist/chunk-X5DJKVBT.js +0 -1308
- package/dist/chunk-X5DJKVBT.js.map +0 -1
- package/dist/chunk-ZT7HJ6YU.js +0 -38
- package/dist/chunk-ZT7HJ6YU.js.map +0 -1
- package/dist/chunk-ZW26VZHX.js +0 -3169
- package/dist/chunk-ZW26VZHX.js.map +0 -1
- package/dist/controls-reader-5MFHYBZZ.js +0 -192
- package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
- package/dist/expo/plugin.cjs.map +0 -1
- package/dist/expo/plugin.js.map +0 -1
- package/dist/expo-babel-plugin.cjs.map +0 -1
- package/dist/expo-babel-plugin.js.map +0 -1
- package/dist/flutter-preview-path.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/nextjs/plugin.cjs.map +0 -1
- package/dist/nextjs/plugin.js.map +0 -1
- package/dist/nextjs-loader.cjs.map +0 -1
- package/dist/nextjs.cjs.map +0 -1
- package/dist/nextjs.js.map +0 -1
- package/dist/nuxt/runtime/identity.js.map +0 -1
- package/dist/nuxt.js.map +0 -1
- package/dist/svelte.js.map +0 -1
- package/dist/types-C8OIU-kc.d.ts +0 -106
- package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
- package/dist/vue.js.map +0 -1
|
@@ -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\";\nimport { createRequire } from \"node:module\";\n\n// Optional native compiler is loaded only when an Astro file is inspected.\n// React/Svelte consumers must still work with optional dependencies omitted.\nfunction parseAstroAssetSource(source: string): any {\n const result = createRequire(import.meta.url)(\"@astrojs/compiler-rs\").parse(\n source,\n );\n const errors = result.diagnostics.filter(\n (diagnostic: any) => diagnostic.severity === \"error\",\n );\n if (errors.length)\n throw new Error(errors.map((error: any) => error.text).join(\"\\n\"));\n return result.ast;\n}\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 if (filePath.endsWith(\".astro\")) {\n const root = parseAstroAssetSource(source);\n return {\n program: root.frontmatter?.program ?? { type: \"Program\", body: [] },\n errors: [],\n };\n }\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 if (filePath.endsWith(\".astro\")) {\n const root = parseAstroAssetSource(source);\n const comments = [...root.comments];\n const visit = (node: any) => {\n if (!node || typeof node !== \"object\") return;\n if (node.type === \"AstroComment\") comments.push(node);\n for (const [key, value] of Object.entries(node)) {\n if (key === \"comments\") continue;\n if (Array.isArray(value)) value.forEach(visit);\n else if (value && typeof value === \"object\") visit(value);\n }\n };\n visit(root);\n return comments.map((comment: any) => ({\n value: comment.value,\n span: { start: comment.start, end: comment.end },\n }));\n }\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 const astroNames = new Set<string>();\n if (filePath.endsWith(\".astro\"))\n for (const statement of program?.body ?? []) {\n if (\n statement.type !== \"ImportDeclaration\" ||\n statement.source.value !== \"tempo-sdk/astro/controls\" ||\n statement.importKind === \"type\"\n )\n continue;\n for (const specifier of statement.specifiers)\n if (\n specifier.type === \"ImportSpecifier\" &&\n specifier.importKind !== \"type\" &&\n (specifier.imported.name ?? specifier.imported.value) ===\n \"defineAstroControls\"\n )\n astroNames.add(specifier.local.name);\n }\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 astroNames.has(call.callee.name) &&\n call.arguments.length === 1\n )\n return [\n {\n bindingName: \"default\",\n exportKind: \"default\" as const,\n start: call.start,\n end: call.end,\n },\n ];\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;AAC1B,SAAS,qBAAqB;AAI9B,SAAS,sBAAsB,QAAqB;AAClD,QAAM,SAAS,cAAc,YAAY,GAAG,EAAE,sBAAsB,EAAE;AAAA,IACpE;AAAA,EACF;AACA,QAAM,SAAS,OAAO,YAAY;AAAA,IAChC,CAAC,eAAoB,WAAW,aAAa;AAAA,EAC/C;AACA,MAAI,OAAO;AACT,UAAM,IAAI,MAAM,OAAO,IAAI,CAAC,UAAe,MAAM,IAAI,EAAE,KAAK,IAAI,CAAC;AACnE,SAAO,OAAO;AAChB;AAmBO,IAAM,0BAA0B;AAEhC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AAS,KACP,MACA,SACA,OAAO,oBAAI,IAAS,GACd;AACN,MAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,IAAI,IAAI,EAAG;AACzD,OAAK,IAAI,IAAI;AACb,MAAI,OAAO,KAAK,SAAS,SAAU,SAAQ,IAAI;AAE/C,aAAW,SAAS,OAAO,OAAO,IAAI,GAAG;AACvC,QAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,iBAAW,QAAQ,MAAO,MAAK,MAAM,SAAS,IAAI;AAAA,IACpD,OAAO;AACL,WAAK,OAAO,SAAS,IAAI;AAAA,IAC3B;AAAA,EACF;AACF;","names":["source"]}
|
package/dist/chunk-SGN7BDRE.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// ../../modules/vue-editor/records.ts
|
|
2
|
-
var TEMPO_VUE_SOURCE_REGISTRY_GLOBAL = "__TEMPO_VUE_SOURCE_REGISTRY__";
|
|
3
|
-
var TEMPO_VUE_INVOCATION_MARKER_PREFIX = "__tempo_c";
|
|
4
|
-
function readTempoVueInvocationMarker(functionName) {
|
|
5
|
-
const match = /^__tempo_c(\d+)$/.exec(functionName);
|
|
6
|
-
if (!match) return null;
|
|
7
|
-
const offset = Number(match[1]);
|
|
8
|
-
return Number.isSafeInteger(offset) ? offset : null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
TEMPO_VUE_SOURCE_REGISTRY_GLOBAL,
|
|
13
|
-
TEMPO_VUE_INVOCATION_MARKER_PREFIX,
|
|
14
|
-
readTempoVueInvocationMarker
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-SGN7BDRE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../modules/vue-editor/records.ts"],"sourcesContent":["/**\n * The source registry contract between `tempoVuePlugin`, which writes one\n * record per annotated `.vue` file, and the projection's Vue reader, which\n * joins them against the runtime. Dependency-free (types, constants and pure\n * helpers only) so the browser-side projection producer can import it.\n */\n\nimport type { VueJsonValue } from \"./types\";\n\n/**\n * Where a component's non-prop attributes (`class`, `style`, anything not\n * declared) land when it is invoked:\n * - `single-element`: on its one root element.\n * - `single-component`: on its one root component, which decides in turn.\n * - `multi-root`: nowhere automatically (several roots, or a `v-for` root).\n * - `inherit-attrs-false`: nowhere automatically (`inheritAttrs: false`).\n * - `explicit-attrs`: wherever the template binds `$attrs`.\n * - `unknown`: the file does not say literally (a computed `inheritAttrs`,\n * mixins, a slot, built-in or dynamic root, no template).\n */\nexport type VueRootFallthrough =\n | \"single-element\"\n | \"single-component\"\n | \"multi-root\"\n | \"inherit-attrs-false\"\n | \"explicit-attrs\"\n | \"unknown\";\n\n/** The page global the annotated modules register their records under,\n * keyed by `filepath`. */\nexport const TEMPO_VUE_SOURCE_REGISTRY_GLOBAL = \"__TEMPO_VUE_SOURCE_REGISTRY__\";\n\n/** A component invocation's marker is a vnode hook named\n * `__tempo_c<offset>`, where `<offset>` is the UTF-16 offset of the\n * invocation's `<` in the file that wrote it. */\nexport const TEMPO_VUE_INVOCATION_MARKER_PREFIX = \"__tempo_c\";\n\n/** The invocation offset a marker function's name carries, or null when the\n * name is not a Tempo marker. */\nexport function readTempoVueInvocationMarker(\n functionName: string,\n): number | null {\n const match = /^__tempo_c(\\d+)$/.exec(functionName);\n if (!match) return null;\n const offset = Number(match[1]);\n return Number.isSafeInteger(offset) ? offset : null;\n}\n\nexport interface TempoVueComponentSourceRecord {\n readonly kind: \"component\";\n /** The tag as written: `Card`, `ui-button`, `component`. */\n readonly name: string;\n /** Exact UTF-16 offset of the invocation's `<` in the authored source. */\n readonly position: number;\n readonly className?: string;\n readonly style?: string;\n /** Literal author metadata on a component invocation, even when the\n * component does not forward it to a DOM host. */\n readonly locked?: boolean;\n /** Props written as expressions, space separated as the canvas names them\n * (`:class` is `className`), directives in their own spelling\n * (`v-model`, `@click`), and `#slot` when the tag's slot is dynamic; the\n * Vue form of the JSX `data-tempo-expr` stamp, which an invocation has no\n * element to carry. Empty when an object bind is the only one, absent\n * when there is none. */\n readonly expressions?: string;\n /** Each prop the invocation passes as a JSON literal (`label=\"Hi\"`,\n * `:count=\"3\"`), by the name the component declares, as the props panel\n * reads it. The layer publishes them as `data-tempo-component-prop-*`,\n * so the history of a prop edit can check what the file holds after a\n * reload. Absent when it passes none. */\n readonly literalProps?: Readonly<Record<string, VueJsonValue>>;\n /** The invocation itself passes a literal `class` (or none) with nothing\n * that can override it. Whether it reaches the DOM also depends on the\n * invoked file's `rootFallthrough`, which the reader joins. */\n readonly supportsClassName: boolean;\n readonly supportsStyle: boolean;\n}\n\n/** A native element's record. Its expression facts live only in the\n * element's own `data-tempo-expr` stamp, which the reader takes from the\n * DOM, so the record does not repeat them. */\nexport interface TempoVueHostSourceRecord {\n readonly kind: \"host\";\n readonly name: string;\n readonly position: number;\n readonly className?: string;\n readonly style?: string;\n readonly supportsClassName: boolean;\n readonly supportsStyle: boolean;\n}\n\nexport interface TempoVueSourceRegistryRecord {\n /** Absolute path, as @vitejs/plugin-vue's dev build sets `type.__file`. */\n readonly filename: string;\n /** Equals the hosts' `data-tempo-filepath`. */\n readonly filepath: string;\n readonly modifiedTs: number;\n readonly sourceVersion: string;\n /** One per marked invocation, in source order. */\n readonly components: readonly TempoVueComponentSourceRecord[];\n /** One per stamped native element, in source order. */\n readonly hosts: readonly TempoVueHostSourceRecord[];\n readonly rootFallthrough: VueRootFallthrough;\n}\n"],"mappings":";AA8BO,IAAM,mCAAmC;AAKzC,IAAM,qCAAqC;AAI3C,SAAS,6BACd,cACe;AACf,QAAM,QAAQ,mBAAmB,KAAK,YAAY;AAClD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,SAAS,OAAO,MAAM,CAAC,CAAC;AAC9B,SAAO,OAAO,cAAc,MAAM,IAAI,SAAS;AACjD;","names":[]}
|
package/dist/chunk-SGTGDLOX.js
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
// host-identity.ts
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
|
|
5
|
-
// package.json
|
|
6
|
-
var package_default = {
|
|
7
|
-
name: "tempo-sdk",
|
|
8
|
-
version: "0.0.99",
|
|
9
|
-
publishConfig: {
|
|
10
|
-
tag: "sdk-v2-latest"
|
|
11
|
-
},
|
|
12
|
-
type: "module",
|
|
13
|
-
description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
|
|
14
|
-
repository: {
|
|
15
|
-
type: "git",
|
|
16
|
-
url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
|
|
17
|
-
directory: "tempo-modules/tempo-sdk"
|
|
18
|
-
},
|
|
19
|
-
exports: {
|
|
20
|
-
"./astro/controls": {
|
|
21
|
-
types: "./dist/astro/controls.d.ts",
|
|
22
|
-
import: "./dist/astro/controls.js",
|
|
23
|
-
default: "./dist/astro/controls.js"
|
|
24
|
-
},
|
|
25
|
-
"./astro": {
|
|
26
|
-
types: "./dist/astro.d.ts",
|
|
27
|
-
import: "./dist/astro.js"
|
|
28
|
-
},
|
|
29
|
-
"./astro/client": {
|
|
30
|
-
types: "./astro/client.d.ts"
|
|
31
|
-
},
|
|
32
|
-
"./canvas/astro": {
|
|
33
|
-
types: "./dist/canvas/astro.d.ts",
|
|
34
|
-
import: "./dist/canvas/astro.js"
|
|
35
|
-
},
|
|
36
|
-
"./canvas/astro-contract": {
|
|
37
|
-
types: "./dist/canvas/astro-contract.d.ts",
|
|
38
|
-
import: "./dist/canvas/astro-contract.js"
|
|
39
|
-
},
|
|
40
|
-
".": {
|
|
41
|
-
types: "./dist/index.d.ts",
|
|
42
|
-
import: "./dist/index.js"
|
|
43
|
-
},
|
|
44
|
-
"./canvas": {
|
|
45
|
-
types: "./dist/canvas/index.d.ts",
|
|
46
|
-
import: "./dist/canvas/index.js"
|
|
47
|
-
},
|
|
48
|
-
"./canvas/svelte": {
|
|
49
|
-
types: "./dist/canvas/svelte.d.ts",
|
|
50
|
-
import: "./dist/canvas/svelte.js"
|
|
51
|
-
},
|
|
52
|
-
"./canvas/vue": {
|
|
53
|
-
types: "./dist/canvas/vue.d.ts",
|
|
54
|
-
import: "./dist/canvas/vue.js"
|
|
55
|
-
},
|
|
56
|
-
"./canvas/interact-projection": {
|
|
57
|
-
types: "./dist/canvas/interact-projection.d.ts",
|
|
58
|
-
import: "./dist/canvas/interact-projection.js"
|
|
59
|
-
},
|
|
60
|
-
"./canvas/parser": {
|
|
61
|
-
types: "./dist/canvas/parser.d.ts",
|
|
62
|
-
import: "./dist/canvas/parser.js"
|
|
63
|
-
},
|
|
64
|
-
"./canvas/editor": {
|
|
65
|
-
types: "./dist/canvas/editor.d.ts",
|
|
66
|
-
import: "./dist/canvas/editor.js"
|
|
67
|
-
},
|
|
68
|
-
"./assets": {
|
|
69
|
-
types: "./dist/assets/index.d.ts",
|
|
70
|
-
import: "./dist/assets/index.js"
|
|
71
|
-
},
|
|
72
|
-
"./assets/parser": {
|
|
73
|
-
types: "./dist/assets/parser.d.ts",
|
|
74
|
-
import: "./dist/assets/parser.js"
|
|
75
|
-
},
|
|
76
|
-
"./assets/editor": {
|
|
77
|
-
types: "./dist/assets/editor.d.ts",
|
|
78
|
-
import: "./dist/assets/editor.js"
|
|
79
|
-
},
|
|
80
|
-
"./nextjs": {
|
|
81
|
-
types: "./dist/nextjs.d.ts",
|
|
82
|
-
import: "./dist/nextjs.js",
|
|
83
|
-
require: "./dist/nextjs.cjs"
|
|
84
|
-
},
|
|
85
|
-
"./nextjs/plugin": {
|
|
86
|
-
types: "./dist/nextjs/plugin.d.ts",
|
|
87
|
-
import: "./dist/nextjs/plugin.js"
|
|
88
|
-
},
|
|
89
|
-
"./nuxt": {
|
|
90
|
-
types: "./dist/nuxt.d.ts",
|
|
91
|
-
import: "./dist/nuxt.js"
|
|
92
|
-
},
|
|
93
|
-
"./expo": {
|
|
94
|
-
types: "./dist/expo-babel-plugin.d.ts",
|
|
95
|
-
import: "./dist/expo-babel-plugin.js",
|
|
96
|
-
require: "./dist/expo-babel-plugin.cjs"
|
|
97
|
-
},
|
|
98
|
-
"./expo/plugin": {
|
|
99
|
-
types: "./dist/expo/plugin.d.ts",
|
|
100
|
-
import: "./dist/expo/plugin.js",
|
|
101
|
-
require: "./dist/expo/plugin.cjs"
|
|
102
|
-
},
|
|
103
|
-
"./svelte": {
|
|
104
|
-
types: "./dist/svelte.d.ts",
|
|
105
|
-
import: "./dist/svelte.js"
|
|
106
|
-
},
|
|
107
|
-
"./vue": {
|
|
108
|
-
types: "./dist/vue.d.ts",
|
|
109
|
-
import: "./dist/vue.js"
|
|
110
|
-
},
|
|
111
|
-
"./astro/asset-preview-client": {
|
|
112
|
-
types: "./dist/astro/asset-preview-client.d.ts",
|
|
113
|
-
import: "./dist/astro/asset-preview-client.js"
|
|
114
|
-
},
|
|
115
|
-
"./flutter-preview-path": {
|
|
116
|
-
types: "./dist/flutter-preview-path.d.ts",
|
|
117
|
-
import: "./dist/flutter-preview-path.js"
|
|
118
|
-
},
|
|
119
|
-
"./canvas/flutter-preview": {
|
|
120
|
-
types: "./dist/canvas/flutter-preview.d.ts",
|
|
121
|
-
import: "./dist/canvas/flutter-preview.js"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
files: [
|
|
125
|
-
"dist",
|
|
126
|
-
"astro/client.d.ts"
|
|
127
|
-
],
|
|
128
|
-
scripts: {
|
|
129
|
-
clean: "rm -rf dist",
|
|
130
|
-
build: "pnpm run clean && tsup",
|
|
131
|
-
"build:if-missing": "test -f dist/index.js || pnpm run build",
|
|
132
|
-
prepare: "pnpm run build",
|
|
133
|
-
prepublishOnly: "pnpm build",
|
|
134
|
-
demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
|
|
135
|
-
"demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
|
|
136
|
-
"demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
|
|
137
|
-
test: "vitest run",
|
|
138
|
-
"test:browser": "vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts",
|
|
139
|
-
"test:watch": "vitest",
|
|
140
|
-
"test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
|
|
141
|
-
"test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
|
|
142
|
-
"test:nextjs:production": "vitest run nextjs-production.test.ts",
|
|
143
|
-
"test:nextjs": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts"
|
|
144
|
-
},
|
|
145
|
-
dependencies: {
|
|
146
|
-
"@rollup/pluginutils": "^5.1.0",
|
|
147
|
-
"oxc-parser": "^0.110.0"
|
|
148
|
-
},
|
|
149
|
-
optionalDependencies: {
|
|
150
|
-
"@astrojs/compiler-rs": "0.5.1"
|
|
151
|
-
},
|
|
152
|
-
peerDependencies: {
|
|
153
|
-
astro: "^7.0.0",
|
|
154
|
-
"@babel/core": "^7.0.0",
|
|
155
|
-
h3: "^1.12.0",
|
|
156
|
-
next: "^13 || ^14 || ^15 || ^16",
|
|
157
|
-
nuxt: "^3.18.0 || ^4.0.0",
|
|
158
|
-
react: "^18 || ^19",
|
|
159
|
-
svelte: "^5.0.0",
|
|
160
|
-
vite: "^5 || ^6 || ^7 || ^8",
|
|
161
|
-
vue: "^3.3.0"
|
|
162
|
-
},
|
|
163
|
-
peerDependenciesMeta: {
|
|
164
|
-
astro: {
|
|
165
|
-
optional: true
|
|
166
|
-
},
|
|
167
|
-
react: {
|
|
168
|
-
optional: true
|
|
169
|
-
},
|
|
170
|
-
"@babel/core": {
|
|
171
|
-
optional: true
|
|
172
|
-
},
|
|
173
|
-
h3: {
|
|
174
|
-
optional: true
|
|
175
|
-
},
|
|
176
|
-
next: {
|
|
177
|
-
optional: true
|
|
178
|
-
},
|
|
179
|
-
nuxt: {
|
|
180
|
-
optional: true
|
|
181
|
-
},
|
|
182
|
-
svelte: {
|
|
183
|
-
optional: true
|
|
184
|
-
},
|
|
185
|
-
vite: {
|
|
186
|
-
optional: true
|
|
187
|
-
},
|
|
188
|
-
vue: {
|
|
189
|
-
optional: true
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
devDependencies: {
|
|
193
|
-
"@astrojs/react": "7.0.1",
|
|
194
|
-
"@babel/core": "^7.29.0",
|
|
195
|
-
"@babel/types": "^7.29.0",
|
|
196
|
-
"@modules/annotation": "workspace:*",
|
|
197
|
-
"@modules/astro-editor": "workspace:*",
|
|
198
|
-
"@modules/file-parser": "workspace:*",
|
|
199
|
-
"@modules/frame-pool": "workspace:*",
|
|
200
|
-
"@modules/iframe-projection": "workspace:*",
|
|
201
|
-
"@modules/svelte-editor": "workspace:*",
|
|
202
|
-
"@modules/vue-editor": "workspace:*",
|
|
203
|
-
"@nuxt/kit": "^4.6.2",
|
|
204
|
-
"@types/babel__core": "^7.20.5",
|
|
205
|
-
"@types/node": "^25.0.8",
|
|
206
|
-
"@types/react": "catalog:",
|
|
207
|
-
"@types/react-dom": "catalog:",
|
|
208
|
-
"@vitejs/plugin-react": "catalog:",
|
|
209
|
-
"@vitejs/plugin-vue": "6.0.10",
|
|
210
|
-
astro: "7.3.8",
|
|
211
|
-
h3: "^1.15.11",
|
|
212
|
-
"magic-string": "^0.30.21",
|
|
213
|
-
nuxt: "^4.6.2",
|
|
214
|
-
playwright: "^1.58.2",
|
|
215
|
-
"react-dom": "catalog:",
|
|
216
|
-
"react-dom18": "npm:react-dom@18.3.1",
|
|
217
|
-
react18: "npm:react@18.3.1",
|
|
218
|
-
svelte: "5.56.9",
|
|
219
|
-
tsup: "^8.5.1",
|
|
220
|
-
typescript: "catalog:",
|
|
221
|
-
vite: "catalog:",
|
|
222
|
-
vitest: "catalog:",
|
|
223
|
-
vue: "3.5.44"
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
// release-channel.ts
|
|
228
|
-
var TEMPO_SDK_CHANNEL = package_default.publishConfig.tag;
|
|
229
|
-
function sdkChannelGeneration(channel) {
|
|
230
|
-
if (typeof channel !== "string") return null;
|
|
231
|
-
const match = /^sdk-v([1-9]\d*)-latest$/.exec(channel);
|
|
232
|
-
return match ? Number(match[1]) : null;
|
|
233
|
-
}
|
|
234
|
-
if (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {
|
|
235
|
-
throw new Error("tempo-sdk publishConfig.tag must be sdk-v<N>-latest");
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// host-identity.ts
|
|
239
|
-
var TEMPO_HOST_IDENTITY_ENDPOINT = "/__tempo/identity";
|
|
240
|
-
var TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = "x-tempo-host-identity";
|
|
241
|
-
var TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;
|
|
242
|
-
var TEMPO_WORKSPACE_NONCE_ENV = "TEMPO_WORKSPACE_NONCE";
|
|
243
|
-
var TEMPO_WORKSPACE_NONCE_META_NAME = "tempo-workspace-nonce";
|
|
244
|
-
var WORKSPACE_NONCE_RELATIVE_PATH = ".tempo/workspace-nonce";
|
|
245
|
-
var MAX_WORKSPACE_NONCE_LENGTH = 128;
|
|
246
|
-
var TEMPO_VUE_ANNOTATION_PLUGIN_NAME = "tempo-vue-source-annotation";
|
|
247
|
-
function normalizeWorkspaceNonce(value) {
|
|
248
|
-
const nonce = value?.trim() ?? "";
|
|
249
|
-
return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH ? nonce : "";
|
|
250
|
-
}
|
|
251
|
-
function readTempoWorkspaceNonce(root = process.cwd()) {
|
|
252
|
-
const fromEnvironment = normalizeWorkspaceNonce(
|
|
253
|
-
process.env[TEMPO_WORKSPACE_NONCE_ENV]
|
|
254
|
-
);
|
|
255
|
-
if (fromEnvironment) return fromEnvironment;
|
|
256
|
-
try {
|
|
257
|
-
return normalizeWorkspaceNonce(
|
|
258
|
-
readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), "utf-8")
|
|
259
|
-
);
|
|
260
|
-
} catch {
|
|
261
|
-
return "";
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function createTempoHostIdentity(framework, options = {}) {
|
|
265
|
-
return {
|
|
266
|
-
tempoHost: true,
|
|
267
|
-
contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,
|
|
268
|
-
workspaceNonce: readTempoWorkspaceNonce(options.root),
|
|
269
|
-
sdkVersion: package_default.version,
|
|
270
|
-
sdkChannel: TEMPO_SDK_CHANNEL,
|
|
271
|
-
pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),
|
|
272
|
-
framework,
|
|
273
|
-
...options.capabilities ? { capabilities: options.capabilities } : {}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export {
|
|
278
|
-
TEMPO_HOST_IDENTITY_ENDPOINT,
|
|
279
|
-
TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
|
|
280
|
-
TEMPO_WORKSPACE_NONCE_META_NAME,
|
|
281
|
-
TEMPO_VUE_ANNOTATION_PLUGIN_NAME,
|
|
282
|
-
readTempoWorkspaceNonce,
|
|
283
|
-
createTempoHostIdentity
|
|
284
|
-
};
|
|
285
|
-
//# sourceMappingURL=chunk-SGTGDLOX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.99\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n"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