tempo-sdk 0.0.45 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/editor.d.ts +1 -1
- package/dist/assets/editor.js +4 -2
- package/dist/assets/editor.js.map +1 -1
- package/dist/assets/index.d.ts +112 -24
- package/dist/assets/index.js +309 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/parser.d.ts +21 -4
- package/dist/assets/parser.js +7 -3
- package/dist/canvas/index.d.ts +6 -6
- package/dist/canvas/index.js +3 -2
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +2 -1
- package/dist/canvas/svelte.d.ts +3 -4
- package/dist/canvas/svelte.js +1 -1
- package/dist/{chunk-7AJVPFFG.js → chunk-7Y7XNHUM.js} +3 -3
- package/dist/{chunk-7AJVPFFG.js.map → chunk-7Y7XNHUM.js.map} +1 -1
- package/dist/chunk-DI2ZFAWL.js +14 -0
- package/dist/chunk-DI2ZFAWL.js.map +1 -0
- package/dist/chunk-DX6XAXCK.js +827 -0
- package/dist/chunk-DX6XAXCK.js.map +1 -0
- package/dist/{chunk-7O6DPEMF.js → chunk-PULSTDX2.js} +9 -3
- package/dist/chunk-PULSTDX2.js.map +1 -0
- package/dist/{chunk-IWULHYPW.js → chunk-XLEKCOB7.js} +219 -21
- package/dist/chunk-XLEKCOB7.js.map +1 -0
- package/dist/{chunk-FIIU52RN.js → chunk-ZZYNOX24.js} +22 -810
- package/dist/chunk-ZZYNOX24.js.map +1 -0
- package/dist/index.js +86 -13
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +2 -2
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/{storyboard-xVaRTJAu.d.ts → storyboard-DbtzTPvI.d.ts} +8 -7
- package/dist/{types-B-dRoF2T.d.ts → types-C8OIU-kc.d.ts} +6 -2
- package/package.json +2 -2
- package/dist/chunk-7O6DPEMF.js.map +0 -1
- package/dist/chunk-FIIU52RN.js.map +0 -1
- package/dist/chunk-IWULHYPW.js.map +0 -1
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var UNRESOLVED_VALUE = Object.freeze({
|
|
6
|
-
$unresolved: true
|
|
7
|
-
});
|
|
8
|
-
function isUnresolvedValue(value) {
|
|
9
|
-
return typeof value === "object" && value !== null && $unresolvedKey in value && value.$unresolved === true;
|
|
10
|
-
}
|
|
11
|
-
var $unresolvedKey = "$unresolved";
|
|
1
|
+
import {
|
|
2
|
+
UNRESOLVED_VALUE,
|
|
3
|
+
isUnresolvedValue
|
|
4
|
+
} from "./chunk-DI2ZFAWL.js";
|
|
12
5
|
|
|
13
6
|
// assets/parser.ts
|
|
7
|
+
import { parseSync } from "oxc-parser";
|
|
14
8
|
var ASSET_SDK_IMPORT_SOURCE = "tempo-sdk/assets";
|
|
15
|
-
function parseAssetFile(filePath, source) {
|
|
16
|
-
const { program
|
|
9
|
+
function parseAssetFile(filePath, source, parsed = parseAssetProgram(filePath, source)) {
|
|
10
|
+
const { program } = parsed;
|
|
11
|
+
const errors = [...parsed.errors];
|
|
17
12
|
if (!program) {
|
|
18
13
|
return { filePath, declarations: [], errors };
|
|
19
14
|
}
|
|
@@ -26,6 +21,118 @@ function parseAssetFile(filePath, source) {
|
|
|
26
21
|
span: misimport.span
|
|
27
22
|
});
|
|
28
23
|
}
|
|
24
|
+
const constants = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const statement of program.body) {
|
|
26
|
+
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
27
|
+
if (declaration?.type !== "VariableDeclaration" || declaration.kind !== "const")
|
|
28
|
+
continue;
|
|
29
|
+
for (const binding of declaration.declarations)
|
|
30
|
+
if (binding.id.type === "Identifier" && binding.init)
|
|
31
|
+
constants.set(binding.id.name, binding.init);
|
|
32
|
+
}
|
|
33
|
+
const resolveConstants = (node, seen = /* @__PURE__ */ new Set(), depth = 0) => {
|
|
34
|
+
if (!node || depth > 16) return node;
|
|
35
|
+
if (node.type === "Identifier" && constants.has(node.name) && !seen.has(node.name))
|
|
36
|
+
return resolveConstants(
|
|
37
|
+
constants.get(node.name),
|
|
38
|
+
new Set(seen).add(node.name),
|
|
39
|
+
depth + 1
|
|
40
|
+
);
|
|
41
|
+
if (node.type === "JSXElement" || node.type === "JSXFragment") {
|
|
42
|
+
const element = node.openingElement;
|
|
43
|
+
const tag = element?.name?.type === "JSXIdentifier" ? element.name.name : "";
|
|
44
|
+
if (element && !tag) return node;
|
|
45
|
+
const reference = tag && /^[A-Z]/.test(tag) ? imports.referenceableImports.get(tag) : void 0;
|
|
46
|
+
if (tag && /^[A-Z]/.test(tag) && !reference) return node;
|
|
47
|
+
const props = {};
|
|
48
|
+
for (const attribute of element?.attributes ?? []) {
|
|
49
|
+
if (attribute.type !== "JSXAttribute" || attribute.name.type !== "JSXIdentifier")
|
|
50
|
+
return node;
|
|
51
|
+
props[attribute.name.name] = !attribute.value ? true : readStaticValue(
|
|
52
|
+
resolveConstants(
|
|
53
|
+
attribute.value.type === "JSXExpressionContainer" ? attribute.value.expression : attribute.value,
|
|
54
|
+
seen,
|
|
55
|
+
depth + 1
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const children = [];
|
|
60
|
+
for (const child of node.children) {
|
|
61
|
+
if (child.type === "JSXText") {
|
|
62
|
+
const lines = child.value.replace(/\t/g, " ").split(/\r\n|\n|\r/);
|
|
63
|
+
const text = lines.map(
|
|
64
|
+
(line, i) => (i ? line.trimStart() : line).replace(
|
|
65
|
+
i < lines.length - 1 ? / +$/ : /$^/,
|
|
66
|
+
""
|
|
67
|
+
)
|
|
68
|
+
).filter(Boolean).join(" ");
|
|
69
|
+
if (text) children.push(text);
|
|
70
|
+
} else if (child.type === "JSXExpressionContainer" && child.expression.type === "JSXEmptyExpression")
|
|
71
|
+
continue;
|
|
72
|
+
else
|
|
73
|
+
children.push(
|
|
74
|
+
readStaticValue(
|
|
75
|
+
resolveConstants(
|
|
76
|
+
child.type === "JSXExpressionContainer" ? child.expression : child,
|
|
77
|
+
seen,
|
|
78
|
+
depth + 1
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
if (children.length)
|
|
84
|
+
props.children = children.length === 1 ? children[0] : children;
|
|
85
|
+
let source2 = reference?.importSpecifier;
|
|
86
|
+
if (source2?.startsWith(".")) {
|
|
87
|
+
const parts = filePath.replace(/\\/g, "/").split("/").slice(0, -1);
|
|
88
|
+
for (const part of source2.split("/")) {
|
|
89
|
+
if (part === "..") parts.pop();
|
|
90
|
+
else if (part !== ".") parts.push(part);
|
|
91
|
+
}
|
|
92
|
+
source2 = parts.join("/");
|
|
93
|
+
} else if (source2) source2 = `pkg:${source2}`;
|
|
94
|
+
return {
|
|
95
|
+
type: "TempoJsxValue",
|
|
96
|
+
value: {
|
|
97
|
+
$jsx: {
|
|
98
|
+
tag,
|
|
99
|
+
...reference ? { reference: { source: source2, importedName: reference.importedName } } : {},
|
|
100
|
+
props
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (node.type === "ArrowFunctionExpression" && !node.async && node.params.length === 0)
|
|
106
|
+
return { ...node, body: resolveConstants(node.body, seen, depth + 1) };
|
|
107
|
+
if (node.type === "ObjectExpression")
|
|
108
|
+
return {
|
|
109
|
+
...node,
|
|
110
|
+
properties: node.properties.map(
|
|
111
|
+
(property) => property.type === "Property" ? {
|
|
112
|
+
...property,
|
|
113
|
+
value: resolveConstants(property.value, seen, depth + 1),
|
|
114
|
+
shorthand: false
|
|
115
|
+
} : property
|
|
116
|
+
)
|
|
117
|
+
};
|
|
118
|
+
if (node.type === "ArrayExpression")
|
|
119
|
+
return {
|
|
120
|
+
...node,
|
|
121
|
+
elements: node.elements.map(
|
|
122
|
+
(item) => resolveConstants(item, seen, depth + 1)
|
|
123
|
+
)
|
|
124
|
+
};
|
|
125
|
+
if ([
|
|
126
|
+
"TSAsExpression",
|
|
127
|
+
"TSSatisfiesExpression",
|
|
128
|
+
"ParenthesizedExpression"
|
|
129
|
+
].includes(node.type))
|
|
130
|
+
return {
|
|
131
|
+
...node,
|
|
132
|
+
expression: resolveConstants(node.expression, seen, depth + 1)
|
|
133
|
+
};
|
|
134
|
+
return node;
|
|
135
|
+
};
|
|
29
136
|
const scope = collectTopLevelScope(program);
|
|
30
137
|
const declarations = [];
|
|
31
138
|
const declaredBindings = /* @__PURE__ */ new Set();
|
|
@@ -39,7 +146,19 @@ function parseAssetFile(filePath, source) {
|
|
|
39
146
|
topLevelCalls.add(call);
|
|
40
147
|
const declaration = readAssetDeclaration({
|
|
41
148
|
statement,
|
|
42
|
-
call
|
|
149
|
+
call: {
|
|
150
|
+
...call,
|
|
151
|
+
arguments: call.arguments.map(
|
|
152
|
+
(argument, index) => index === 1 && argument.type === "ObjectExpression" ? {
|
|
153
|
+
...argument,
|
|
154
|
+
properties: argument.properties.map(
|
|
155
|
+
(property) => property.type === "Property" && ["controls", "variants"].includes(
|
|
156
|
+
property.key.name ?? property.key.value
|
|
157
|
+
) ? { ...property, value: resolveConstants(property.value) } : property
|
|
158
|
+
)
|
|
159
|
+
} : argument
|
|
160
|
+
)
|
|
161
|
+
},
|
|
43
162
|
scope,
|
|
44
163
|
imports,
|
|
45
164
|
program,
|
|
@@ -59,6 +178,16 @@ function parseAssetFile(filePath, source) {
|
|
|
59
178
|
});
|
|
60
179
|
}
|
|
61
180
|
});
|
|
181
|
+
for (const declaration of declarations) {
|
|
182
|
+
const duplicate = errors.find(
|
|
183
|
+
(error) => error.code === "duplicate_declaration" && error.message.includes(`"${declaration.bindingName}"`)
|
|
184
|
+
);
|
|
185
|
+
if (duplicate)
|
|
186
|
+
declaration.warnings.push({
|
|
187
|
+
...duplicate,
|
|
188
|
+
code: "duplicate_asset_declaration"
|
|
189
|
+
});
|
|
190
|
+
}
|
|
62
191
|
return { filePath, declarations, errors };
|
|
63
192
|
}
|
|
64
193
|
function parseAssetProgram(filePath, source) {
|
|
@@ -105,6 +234,7 @@ function readSourceComments(filePath, source) {
|
|
|
105
234
|
}
|
|
106
235
|
function readAssetImports(program) {
|
|
107
236
|
const info = {
|
|
237
|
+
trustedDefineControlsNames: /* @__PURE__ */ new Set(),
|
|
108
238
|
trustedDefineAssetNames: /* @__PURE__ */ new Set(),
|
|
109
239
|
importedBindings: /* @__PURE__ */ new Map(),
|
|
110
240
|
referenceableImports: /* @__PURE__ */ new Map(),
|
|
@@ -138,6 +268,8 @@ function readAssetImports(program) {
|
|
|
138
268
|
importSpecifier: source,
|
|
139
269
|
importedName
|
|
140
270
|
});
|
|
271
|
+
if (trusted && importedName === "defineControls")
|
|
272
|
+
info.trustedDefineControlsNames.add(localName);
|
|
141
273
|
if (importedName !== "defineAsset") continue;
|
|
142
274
|
if (trusted) {
|
|
143
275
|
info.trustedDefineAssetNames.add(localName);
|
|
@@ -151,6 +283,29 @@ function readAssetImports(program) {
|
|
|
151
283
|
}
|
|
152
284
|
return info;
|
|
153
285
|
}
|
|
286
|
+
function parseControlsFile(filePath, source, parsed = parseAssetProgram(filePath, source)) {
|
|
287
|
+
const { program } = parsed;
|
|
288
|
+
const imports = readAssetImports(program);
|
|
289
|
+
const scope = program ? collectTopLevelScope(program) : null;
|
|
290
|
+
return (program?.body ?? []).flatMap((statement) => {
|
|
291
|
+
const call = statement.type === "ExpressionStatement" ? statement.expression : null;
|
|
292
|
+
if (call?.type !== "CallExpression" || call.callee.type !== "Identifier" || !imports.trustedDefineControlsNames?.has(call.callee.name) || call.arguments.length !== 2 || call.arguments[0]?.type !== "Identifier")
|
|
293
|
+
return [];
|
|
294
|
+
const bindingName = call.arguments[0].name;
|
|
295
|
+
const reference = imports.referenceableImports.get(bindingName);
|
|
296
|
+
const binding = scope?.bindings.get(bindingName);
|
|
297
|
+
if (!reference && !binding) return [];
|
|
298
|
+
return [
|
|
299
|
+
{
|
|
300
|
+
bindingName,
|
|
301
|
+
reference,
|
|
302
|
+
exportKind: reference?.importedName === "default" ? "default" : binding?.exportKind ?? "named",
|
|
303
|
+
start: call.start,
|
|
304
|
+
end: call.end
|
|
305
|
+
}
|
|
306
|
+
];
|
|
307
|
+
});
|
|
308
|
+
}
|
|
154
309
|
function isTrustedAssetImportSource(source) {
|
|
155
310
|
return source === ASSET_SDK_IMPORT_SOURCE || source.endsWith(`/${ASSET_SDK_IMPORT_SOURCE}`);
|
|
156
311
|
}
|
|
@@ -335,7 +490,7 @@ function readAssetDeclaration(input) {
|
|
|
335
490
|
errors.push({
|
|
336
491
|
code: "duplicate_declaration",
|
|
337
492
|
severity: "structural",
|
|
338
|
-
message: `duplicate defineAsset call for "${bindingName}" \u2014
|
|
493
|
+
message: `duplicate defineAsset call for "${bindingName}" \u2014 keep one asset declaration`,
|
|
339
494
|
span: callSpan
|
|
340
495
|
});
|
|
341
496
|
return null;
|
|
@@ -350,6 +505,21 @@ function readAssetDeclaration(input) {
|
|
|
350
505
|
const usageInstructions = readUsageInstructions(configArg);
|
|
351
506
|
const libraries = readLibraries(configArg, spans, warnings);
|
|
352
507
|
const variants = readVariants(configArg, warnings);
|
|
508
|
+
if (getObjectProperty(configArg, "controls")) {
|
|
509
|
+
errors.push({
|
|
510
|
+
code: "invalid_control",
|
|
511
|
+
severity: "structural",
|
|
512
|
+
message: "Move controls to defineControls(Component, controls) in the component file or tempo/controls.ts."
|
|
513
|
+
});
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
const structural = warnings.filter(
|
|
517
|
+
(warning) => warning.severity === "structural"
|
|
518
|
+
);
|
|
519
|
+
if (structural.length) {
|
|
520
|
+
errors.push(...structural);
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
353
523
|
if (binding && binding.exportKind === "none") {
|
|
354
524
|
warnings.push({
|
|
355
525
|
code: "not_exported",
|
|
@@ -516,8 +686,31 @@ function readVariants(configNode, warnings) {
|
|
|
516
686
|
}
|
|
517
687
|
function readVariant(name, entry, warnings) {
|
|
518
688
|
const value = unwrapTsExpression(entry.value);
|
|
689
|
+
for (const property of value?.type === "ObjectExpression" ? value.properties : []) {
|
|
690
|
+
if (property.type !== "Property" || property.computed || !["props", "render"].includes(readPropertyKeyName(property.key) ?? "")) {
|
|
691
|
+
warnings.push({
|
|
692
|
+
code: "invalid_variant_config",
|
|
693
|
+
severity: "structural",
|
|
694
|
+
message: `Variant "${name}" accepts either props or render, with explicit keys and no spreads or inheritance`,
|
|
695
|
+
span: toSourceSpan(property)
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
const renderProperty = value?.type === "ObjectExpression" ? getObjectProperty(value, "render") : null;
|
|
519
700
|
const propsProperty = value?.type === "ObjectExpression" ? getObjectProperty(value, "props") : null;
|
|
520
|
-
const
|
|
701
|
+
const fn = unwrapTsExpression(renderProperty?.value);
|
|
702
|
+
const body = unwrapTsExpression(fn?.body);
|
|
703
|
+
const jsx = body?.type === "TempoJsxValue" ? readStaticValue(body) : UNRESOLVED_VALUE;
|
|
704
|
+
const validRender = fn?.type === "ArrowFunctionExpression" && !fn.async && fn.params.length === 0 && !propsProperty && !containsUnresolvedValue(jsx);
|
|
705
|
+
if (renderProperty && !validRender)
|
|
706
|
+
warnings.push({
|
|
707
|
+
code: "invalid_variant_config",
|
|
708
|
+
severity: "structural",
|
|
709
|
+
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.`,
|
|
710
|
+
span: toSourceSpan(renderProperty)
|
|
711
|
+
});
|
|
712
|
+
const render = renderProperty && validRender ? { jsx } : void 0;
|
|
713
|
+
const propsValue = propsProperty ? readStaticValue(propsProperty.value) : render ? {} : UNRESOLVED_VALUE;
|
|
521
714
|
const props = isPlainRecord(propsValue) ? propsValue : {};
|
|
522
715
|
const hasUnresolvedValues = !isPlainRecord(propsValue) || containsUnresolvedValue(propsValue);
|
|
523
716
|
if (hasUnresolvedValues) {
|
|
@@ -528,12 +721,14 @@ function readVariant(name, entry, warnings) {
|
|
|
528
721
|
span: toSourceSpan(entry)
|
|
529
722
|
});
|
|
530
723
|
}
|
|
531
|
-
return { name, props, hasUnresolvedValues };
|
|
724
|
+
return { name, props, hasUnresolvedValues, ...render ? { render } : {} };
|
|
532
725
|
}
|
|
533
726
|
function readStaticValue(node) {
|
|
534
727
|
const expression = unwrapTsExpression(node);
|
|
535
728
|
if (!expression) return UNRESOLVED_VALUE;
|
|
536
729
|
switch (expression.type) {
|
|
730
|
+
case "TempoJsxValue":
|
|
731
|
+
return expression.value;
|
|
537
732
|
case "Literal": {
|
|
538
733
|
if (expression.regex || expression.bigint) return UNRESOLVED_VALUE;
|
|
539
734
|
const { value } = expression;
|
|
@@ -561,7 +756,11 @@ function readStaticValue(node) {
|
|
|
561
756
|
}
|
|
562
757
|
const key = readPropertyKeyName(property.key);
|
|
563
758
|
if (key === null) return UNRESOLVED_VALUE;
|
|
564
|
-
record
|
|
759
|
+
Object.defineProperty(record, key, {
|
|
760
|
+
value: readStaticValue(property.value),
|
|
761
|
+
enumerable: true,
|
|
762
|
+
configurable: true
|
|
763
|
+
});
|
|
565
764
|
}
|
|
566
765
|
return record;
|
|
567
766
|
}
|
|
@@ -634,17 +833,16 @@ function walk(node, visitor, seen = /* @__PURE__ */ new Set()) {
|
|
|
634
833
|
}
|
|
635
834
|
|
|
636
835
|
export {
|
|
637
|
-
UNRESOLVED_VALUE,
|
|
638
|
-
isUnresolvedValue,
|
|
639
836
|
ASSET_SDK_IMPORT_SOURCE,
|
|
640
837
|
parseAssetFile,
|
|
641
838
|
parseAssetProgram,
|
|
642
839
|
readSourceComments,
|
|
643
840
|
readAssetImports,
|
|
841
|
+
parseControlsFile,
|
|
644
842
|
collectTopLevelScope,
|
|
645
843
|
hasTopLevelDefineAssetCallFor,
|
|
646
844
|
collectIdentifierNames,
|
|
647
845
|
unwrapTsExpression,
|
|
648
846
|
toSourceSpan
|
|
649
847
|
};
|
|
650
|
-
//# sourceMappingURL=chunk-
|
|
848
|
+
//# sourceMappingURL=chunk-XLEKCOB7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../assets/parser.ts"],"sourcesContent":["/**\n * Static parser for `defineAsset` declarations (specs/asset-libraries.md §3).\n *\n * Mirrors the construction of canvas/parser.ts: oxc-parser `parseSync`, an\n * import map that only trusts `defineAsset` imported from \"tempo-sdk/assets\"\n * (or a local path ending \"/tempo-sdk/assets\"), and a manual walk over\n * module-top-level statements. Never executes user code — the whole pipeline\n * is text → AST → data.\n *\n * Alongside `parseAssetFile`, this module exports the program-level analysis\n * helpers (`parseAssetProgram`, `readAssetImports`, `collectTopLevelScope`,\n * `hasTopLevelDefineAssetCallFor`, `collectIdentifierNames`) that the\n * colocated span-based editor (./editor.ts) shares, so import-trust rules and\n * binding resolution cannot drift between the two.\n */\nimport { parseSync } from \"oxc-parser\";\n\nimport {\n UNRESOLVED_VALUE,\n isUnresolvedValue,\n type AssetExportKind,\n type AssetParseError,\n type AssetSourceSpan,\n type AssetSpans,\n type ParsedAssetDeclaration,\n type ParsedAssetFile,\n type ParsedAssetReference,\n type ParsedAssetVariant,\n type StaticValue,\n} from \"./types\";\n\nexport * from \"./types\";\n\n/** The one module specifier `defineAsset` may be imported from. */\nexport const ASSET_SDK_IMPORT_SOURCE = \"tempo-sdk/assets\";\n\nexport function parseAssetFile(\n filePath: string,\n source: string,\n parsed = parseAssetProgram(filePath, source),\n): ParsedAssetFile {\n // Program results can be shared with controls discovery and cached by hosts.\n // Declaration diagnostics must not mutate the cached parser diagnostics.\n const { program } = parsed;\n const errors = [...parsed.errors];\n if (!program) {\n return { filePath, declarations: [], errors };\n }\n\n const imports = readAssetImports(program);\n for (const misimport of imports.misimports) {\n errors.push({\n code: \"misimported_define_asset\",\n severity: \"structural\",\n message: `defineAsset must be imported from \"${ASSET_SDK_IMPORT_SOURCE}\" — found import from \"${misimport.source}\"`,\n span: misimport.span,\n });\n }\n\n const constants = new Map<string, any>();\n for (const statement of program.body) {\n const declaration =\n statement.type === \"ExportNamedDeclaration\"\n ? statement.declaration\n : statement;\n if (\n declaration?.type !== \"VariableDeclaration\" ||\n declaration.kind !== \"const\"\n )\n continue;\n for (const binding of declaration.declarations)\n if (binding.id.type === \"Identifier\" && binding.init)\n constants.set(binding.id.name, binding.init);\n }\n const resolveConstants = (\n node: any,\n seen = new Set<string>(),\n depth = 0,\n ): any => {\n if (!node || depth > 16) return node;\n if (\n node.type === \"Identifier\" &&\n constants.has(node.name) &&\n !seen.has(node.name)\n )\n return resolveConstants(\n constants.get(node.name),\n new Set(seen).add(node.name),\n depth + 1,\n );\n if (node.type === \"JSXElement\" || node.type === \"JSXFragment\") {\n const element = node.openingElement;\n const tag =\n element?.name?.type === \"JSXIdentifier\" ? element.name.name : \"\";\n if (element && !tag) return node;\n const reference =\n tag && /^[A-Z]/.test(tag)\n ? imports.referenceableImports.get(tag)\n : undefined;\n if (tag && /^[A-Z]/.test(tag) && !reference) return node;\n const props: Record<string, StaticValue> = {};\n for (const attribute of element?.attributes ?? []) {\n if (\n attribute.type !== \"JSXAttribute\" ||\n attribute.name.type !== \"JSXIdentifier\"\n )\n return node;\n props[attribute.name.name] = !attribute.value\n ? true\n : readStaticValue(\n resolveConstants(\n attribute.value.type === \"JSXExpressionContainer\"\n ? attribute.value.expression\n : attribute.value,\n seen,\n depth + 1,\n ),\n );\n }\n const children: StaticValue[] = [];\n for (const child of node.children) {\n if (child.type === \"JSXText\") {\n const lines = child.value.replace(/\\t/g, \" \").split(/\\r\\n|\\n|\\r/);\n const text = lines\n .map((line: string, i: number) =>\n (i ? line.trimStart() : line).replace(\n i < lines.length - 1 ? / +$/ : /$^/,\n \"\",\n ),\n )\n .filter(Boolean)\n .join(\" \");\n if (text) children.push(text);\n } else if (\n child.type === \"JSXExpressionContainer\" &&\n child.expression.type === \"JSXEmptyExpression\"\n )\n continue;\n else\n children.push(\n readStaticValue(\n resolveConstants(\n child.type === \"JSXExpressionContainer\"\n ? child.expression\n : child,\n seen,\n depth + 1,\n ),\n ),\n );\n }\n if (children.length)\n props.children = children.length === 1 ? children[0]! : children;\n let source = reference?.importSpecifier;\n if (source?.startsWith(\".\")) {\n const parts = filePath.replace(/\\\\/g, \"/\").split(\"/\").slice(0, -1);\n for (const part of source.split(\"/\")) {\n if (part === \"..\") parts.pop();\n else if (part !== \".\") parts.push(part);\n }\n source = parts.join(\"/\");\n } else if (source) source = `pkg:${source}`;\n return {\n type: \"TempoJsxValue\",\n value: {\n $jsx: {\n tag,\n ...(reference\n ? { reference: { source, importedName: reference.importedName } }\n : {}),\n props,\n },\n },\n };\n }\n // Only expression-bodied, parameterless arrows are render templates.\n // Preserve the function shape so readVariant can reject every other form.\n if (\n node.type === \"ArrowFunctionExpression\" &&\n !node.async &&\n node.params.length === 0\n )\n return { ...node, body: resolveConstants(node.body, seen, depth + 1) };\n if (node.type === \"ObjectExpression\")\n return {\n ...node,\n properties: node.properties.map((property: any) =>\n property.type === \"Property\"\n ? {\n ...property,\n value: resolveConstants(property.value, seen, depth + 1),\n shorthand: false,\n }\n : property,\n ),\n };\n if (node.type === \"ArrayExpression\")\n return {\n ...node,\n elements: node.elements.map((item: any) =>\n resolveConstants(item, seen, depth + 1),\n ),\n };\n if (\n [\n \"TSAsExpression\",\n \"TSSatisfiesExpression\",\n \"ParenthesizedExpression\",\n ].includes(node.type)\n )\n return {\n ...node,\n expression: resolveConstants(node.expression, seen, depth + 1),\n };\n return node;\n };\n const scope = collectTopLevelScope(program);\n const declarations: ParsedAssetDeclaration[] = [];\n const declaredBindings = new Set<string>();\n const topLevelCalls = new Set<any>();\n\n for (const statement of program.body ?? []) {\n const call = readTopLevelTrustedCall(\n statement,\n imports.trustedDefineAssetNames,\n );\n if (!call) continue;\n topLevelCalls.add(call);\n const declaration = readAssetDeclaration({\n statement,\n call: {\n ...call,\n arguments: call.arguments.map((argument: any, index: number) =>\n index === 1 && argument.type === \"ObjectExpression\"\n ? {\n ...argument,\n properties: argument.properties.map((property: any) =>\n property.type === \"Property\" &&\n [\"controls\", \"variants\"].includes(\n property.key.name ?? property.key.value,\n )\n ? { ...property, value: resolveConstants(property.value) }\n : property,\n ),\n }\n : argument,\n ),\n },\n scope,\n imports,\n program,\n source,\n errors,\n declaredBindings,\n });\n if (declaration) declarations.push(declaration);\n }\n\n // A trusted defineAsset call anywhere but a module-top-level statement\n // (inside a function, wrapped in another expression, …) has no stable\n // identity — report it rather than silently ignoring it (§3.4).\n walk(program, (node) => {\n if (\n node.type === \"CallExpression\" &&\n node.callee?.type === \"Identifier\" &&\n imports.trustedDefineAssetNames.has(node.callee.name) &&\n !topLevelCalls.has(node)\n ) {\n errors.push({\n code: \"non_top_level_call\",\n severity: \"structural\",\n message:\n \"defineAsset must be called as a top-level statement — in the file that defines the component, or in a canvas file that imports it\",\n span: toSourceSpan(node),\n });\n }\n });\n\n for (const declaration of declarations) {\n const duplicate = errors.find(\n (error) =>\n error.code === \"duplicate_declaration\" &&\n error.message.includes(`\"${declaration.bindingName}\"`),\n );\n if (duplicate)\n declaration.warnings.push({\n ...duplicate,\n code: \"duplicate_asset_declaration\",\n });\n }\n return { filePath, declarations, errors };\n}\n\n/**\n * Editor-support: parse and return the raw oxc program. A file with syntax\n * errors returns `program: null` plus structural `unparseable_source` errors\n * — a recovered AST has untrustworthy spans, so both parser and editor fail\n * closed on it.\n */\nexport function parseAssetProgram(\n filePath: string,\n source: string,\n): { program: any | null; errors: AssetParseError[] } {\n try {\n const result = parseSync(filePath, source) as any;\n const errors: AssetParseError[] = (result.errors ?? []).map(\n (error: any) => ({\n code: \"unparseable_source\" as const,\n severity: \"structural\" as const,\n message: error?.message ?? \"Unable to parse asset source\",\n span: toSourceSpan(error) ?? toSourceSpan(error?.labels?.[0]),\n }),\n );\n if (errors.length > 0) return { program: null, errors };\n return { program: result.program, errors: [] };\n } catch (error) {\n return {\n program: null,\n errors: [\n {\n code: \"unparseable_source\",\n severity: \"structural\",\n message:\n error instanceof Error\n ? error.message\n : \"Unable to parse asset source\",\n },\n ],\n };\n }\n}\n\n/** One comment's text (delimiters stripped) and source span. */\nexport type SourceComment = {\n value: string;\n span: AssetSourceSpan;\n};\n\n/**\n * Every comment (line and block) in a source file, for consumers that\n * validate documentation conventions (e.g. the asset index's canvas-pointer\n * check). Returns `null` when the file does not parse — comments recovered\n * from a broken AST are untrustworthy, so callers must treat the file as\n * uninspectable rather than comment-free.\n */\nexport function readSourceComments(\n filePath: string,\n source: string,\n): SourceComment[] | null {\n try {\n const result = parseSync(filePath, source) as any;\n if ((result.errors ?? []).length > 0) return null;\n return (result.comments ?? []).flatMap((comment: any) =>\n typeof comment?.value === \"string\"\n ? [\n {\n value: comment.value,\n span: toSourceSpan(comment) ?? { start: 0, end: 0 },\n },\n ]\n : [],\n );\n } catch {\n return null;\n }\n}\n\nexport type AssetImportInfo = {\n /** Added after the original public parser contract; optional so existing\n * callers can continue constructing `AssetImportInfo` object literals. */\n trustedDefineControlsNames?: Set<string>;\n /** Local names bound to `defineAsset` imported from tempo-sdk/assets. */\n trustedDefineAssetNames: Set<string>;\n /** Every value-import local name → its module specifier. */\n importedBindings: Map<string, string>;\n /** Named/default value imports a reference declaration may target: local\n * name → specifier + imported name (\"default\" for default imports).\n * Namespace imports are excluded — they cannot name one component. */\n referenceableImports: Map<string, ParsedAssetReference>;\n /** Span of every import declaration, in source order (editor placement). */\n importDeclarationSpans: AssetSourceSpan[];\n /** `defineAsset` imports using a wrong tempo-sdk-family specifier. The span\n * covers the source string literal, quotes included. */\n misimports: { source: string; span: AssetSourceSpan }[];\n};\n\nexport function readAssetImports(program: any): AssetImportInfo {\n const info: AssetImportInfo = {\n trustedDefineControlsNames: new Set(),\n trustedDefineAssetNames: new Set(),\n importedBindings: new Map(),\n referenceableImports: new Map(),\n importDeclarationSpans: [],\n misimports: [],\n };\n\n for (const statement of program?.body ?? []) {\n if (\n statement?.type !== \"ImportDeclaration\" ||\n typeof statement.source?.value !== \"string\"\n ) {\n continue;\n }\n const declarationSpan = toSourceSpan(statement);\n if (declarationSpan) info.importDeclarationSpans.push(declarationSpan);\n if (statement.importKind === \"type\") continue;\n\n const source = statement.source.value;\n const trusted = isTrustedAssetImportSource(source);\n\n for (const specifier of statement.specifiers ?? []) {\n if (specifier?.importKind === \"type\") continue;\n const localName = specifier?.local?.name;\n if (typeof localName !== \"string\") continue;\n info.importedBindings.set(localName, source);\n\n if (specifier.type === \"ImportDefaultSpecifier\") {\n info.referenceableImports.set(localName, {\n importSpecifier: source,\n importedName: \"default\",\n });\n continue;\n }\n if (specifier.type !== \"ImportSpecifier\") continue;\n const importedName =\n specifier.imported?.name ?? specifier.imported?.value ?? localName;\n info.referenceableImports.set(localName, {\n importSpecifier: source,\n importedName,\n });\n if (trusted && importedName === \"defineControls\")\n info.trustedDefineControlsNames!.add(localName);\n if (importedName !== \"defineAsset\") continue;\n\n if (trusted) {\n info.trustedDefineAssetNames.add(localName);\n } else if (isMisimportedAssetSdkSource(source)) {\n info.misimports.push({\n source,\n span: toSourceSpan(statement.source) ??\n declarationSpan ?? { start: 0, end: 0 },\n });\n }\n }\n }\n\n return info;\n}\n\n/** Discover control owners without evaluating their config or requiring an asset. */\nexport function parseControlsFile(\n filePath: string,\n source: string,\n parsed = parseAssetProgram(filePath, source),\n): {\n bindingName: string;\n reference?: ParsedAssetReference;\n exportKind: AssetExportKind;\n start: number;\n end: number;\n}[] {\n const { program } = parsed;\n const imports = readAssetImports(program);\n const scope = program ? collectTopLevelScope(program) : null;\n return (program?.body ?? []).flatMap((statement: any) => {\n const call =\n statement.type === \"ExpressionStatement\" ? statement.expression : null;\n if (\n call?.type !== \"CallExpression\" ||\n call.callee.type !== \"Identifier\" ||\n !imports.trustedDefineControlsNames?.has(call.callee.name) ||\n call.arguments.length !== 2 ||\n call.arguments[0]?.type !== \"Identifier\"\n )\n return [];\n const bindingName = call.arguments[0].name as string;\n const reference = imports.referenceableImports.get(bindingName);\n const binding = scope?.bindings.get(bindingName);\n if (!reference && !binding) return [];\n return [\n {\n bindingName,\n reference,\n exportKind:\n reference?.importedName === \"default\"\n ? (\"default\" as const)\n : (binding?.exportKind ?? (\"named\" as const)),\n start: call.start as number,\n end: call.end as number,\n },\n ];\n });\n}\n\nfunction isTrustedAssetImportSource(source: string): boolean {\n return (\n source === ASSET_SDK_IMPORT_SOURCE ||\n source.endsWith(`/${ASSET_SDK_IMPORT_SOURCE}`)\n );\n}\n\nfunction isMisimportedAssetSdkSource(source: string): boolean {\n return (\n (source === \"tempo-sdk\" || source.startsWith(\"tempo-sdk/\")) &&\n !isTrustedAssetImportSource(source)\n );\n}\n\nexport type AssetTopLevelBinding = {\n name: string;\n /** Whole top-level statement declaring the binding, export keyword\n * included — the editor inserts defineAsset statements after it. */\n statementSpan: AssetSourceSpan;\n exportKind: AssetExportKind;\n};\n\nexport type AssetTopLevelScope = {\n /** Plain top-level bindings defineAsset may target: function/class\n * declarations and initialized `const`/`let`/`var` declarators. */\n bindings: Map<string, AssetTopLevelBinding>;\n /** Top-level names bound only via destructuring patterns or uninitialized\n * declarators — they exist, but defineAsset cannot target them; kept so\n * error messages can say why. */\n nonSimpleNames: Set<string>;\n};\n\nexport function collectTopLevelScope(program: any): AssetTopLevelScope {\n const bindings = new Map<string, AssetTopLevelBinding>();\n const nonSimpleNames = new Set<string>();\n const namedExports = new Set<string>();\n const defaultExports = new Set<string>();\n\n const register = (\n declaration: any,\n statementSpan: AssetSourceSpan,\n exported: \"named\" | \"default\" | null,\n ) => {\n const markExported = (name: string) => {\n if (exported === \"named\") namedExports.add(name);\n if (exported === \"default\") defaultExports.add(name);\n };\n\n if (\n declaration?.type === \"FunctionDeclaration\" ||\n declaration?.type === \"ClassDeclaration\"\n ) {\n const name = declaration.id?.name;\n if (typeof name === \"string\") {\n bindings.set(name, { name, statementSpan, exportKind: \"none\" });\n markExported(name);\n }\n return;\n }\n\n if (declaration?.type === \"VariableDeclaration\") {\n for (const declarator of declaration.declarations ?? []) {\n if (declarator?.id?.type === \"Identifier\") {\n const name = declarator.id.name;\n if (declarator.init) {\n bindings.set(name, { name, statementSpan, exportKind: \"none\" });\n markExported(name);\n } else {\n nonSimpleNames.add(name);\n }\n } else {\n collectPatternNames(declarator?.id, nonSimpleNames);\n }\n }\n }\n };\n\n for (const statement of program?.body ?? []) {\n const statementSpan = toSourceSpan(statement) ?? { start: 0, end: 0 };\n\n if (statement?.type === \"ExportNamedDeclaration\") {\n if (statement.declaration) {\n register(statement.declaration, statementSpan, \"named\");\n }\n // `export { X } from \"./y\"` re-exports another module's binding, not a\n // local one — only sourceless specifier lists mark local bindings.\n if (!statement.source) {\n for (const specifier of statement.specifiers ?? []) {\n if (specifier?.type !== \"ExportSpecifier\") continue;\n const localName = specifier.local?.name;\n if (typeof localName !== \"string\") continue;\n const exportedName =\n specifier.exported?.name ?? specifier.exported?.value;\n (exportedName === \"default\" ? defaultExports : namedExports).add(\n localName,\n );\n }\n }\n continue;\n }\n\n if (statement?.type === \"ExportDefaultDeclaration\") {\n const declaration = statement.declaration;\n if (\n declaration?.type === \"FunctionDeclaration\" ||\n declaration?.type === \"ClassDeclaration\"\n ) {\n register(declaration, statementSpan, \"default\");\n } else {\n const expression = unwrapTsExpression(declaration);\n if (expression?.type === \"Identifier\") {\n defaultExports.add(expression.name);\n }\n }\n continue;\n }\n\n register(statement, statementSpan, null);\n }\n\n // A binding exported both ways reports \"default\" — the module's primary\n // export identity wins over the incidental named alias.\n for (const binding of bindings.values()) {\n binding.exportKind = defaultExports.has(binding.name)\n ? \"default\"\n : namedExports.has(binding.name)\n ? \"named\"\n : \"none\";\n }\n\n return { bindings, nonSimpleNames };\n}\n\nfunction collectPatternNames(pattern: any, names: Set<string>): void {\n if (!pattern || typeof pattern !== \"object\") return;\n if (pattern.type === \"Identifier\" && typeof pattern.name === \"string\") {\n names.add(pattern.name);\n return;\n }\n if (pattern.type === \"ObjectPattern\") {\n for (const property of pattern.properties ?? []) {\n collectPatternNames(property?.value ?? property?.argument, names);\n }\n return;\n }\n if (pattern.type === \"ArrayPattern\") {\n for (const element of pattern.elements ?? []) {\n collectPatternNames(element, names);\n }\n return;\n }\n if (pattern.type === \"AssignmentPattern\") {\n collectPatternNames(pattern.left, names);\n return;\n }\n if (pattern.type === \"RestElement\") {\n collectPatternNames(pattern.argument, names);\n }\n}\n\n/**\n * Editor-support: true when any module-top-level trusted defineAsset call\n * targets `bindingName`, regardless of whether the call parses cleanly —\n * the editor must not insert a second declaration next to a broken one.\n */\nexport function hasTopLevelDefineAssetCallFor(\n program: any,\n trustedNames: Set<string>,\n bindingName: string,\n): boolean {\n for (const statement of program?.body ?? []) {\n const call = readTopLevelTrustedCall(statement, trustedNames);\n if (!call) continue;\n const componentArg = unwrapTsExpression(call.arguments?.[0]);\n if (\n componentArg?.type === \"Identifier\" &&\n componentArg.name === bindingName\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Editor-support: every Identifier/JSXIdentifier name appearing anywhere in\n * the program — used to deconflict generated binding names. */\nexport function collectIdentifierNames(program: any): Set<string> {\n const names = new Set<string>();\n walk(program, (node) => {\n if (\n (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") &&\n typeof node.name === \"string\"\n ) {\n names.add(node.name);\n }\n });\n return names;\n}\n\nfunction readTopLevelTrustedCall(\n statement: any,\n trustedNames: Set<string>,\n): any | null {\n if (statement?.type !== \"ExpressionStatement\") return null;\n const expression = unwrapTsExpression(statement.expression);\n if (\n expression?.type === \"CallExpression\" &&\n expression.callee?.type === \"Identifier\" &&\n trustedNames.has(expression.callee.name)\n ) {\n return expression;\n }\n return null;\n}\n\nfunction readAssetDeclaration(input: {\n statement: any;\n call: any;\n scope: AssetTopLevelScope;\n imports: AssetImportInfo;\n program: any;\n source: string;\n errors: AssetParseError[];\n declaredBindings: Set<string>;\n}): ParsedAssetDeclaration | null {\n const { statement, call, scope, imports, program, source, errors } = input;\n const callSpan = statementSpanWithSemicolon(source, statement);\n const args = call.arguments ?? [];\n\n if (args.length !== 2) {\n errors.push({\n code: \"invalid_call_arguments\",\n severity: \"structural\",\n message: `defineAsset takes exactly two arguments (component, config) — found ${args.length}`,\n span: callSpan,\n });\n return null;\n }\n\n const componentArg = unwrapTsExpression(args[0]);\n if (componentArg?.type !== \"Identifier\") {\n errors.push({\n code: \"non_identifier_component\",\n severity: \"structural\",\n message:\n \"defineAsset's first argument must be an identifier naming a component defined in this file\",\n span: toSourceSpan(args[0]) ?? callSpan,\n });\n return null;\n }\n\n const bindingName = componentArg.name;\n const binding = scope.bindings.get(bindingName);\n // A named/default import target makes this a reference declaration: the\n // asset's identity is the import itself, resolved downstream where\n // workspace context exists (§2.7).\n const reference = binding\n ? undefined\n : imports.referenceableImports.get(bindingName);\n if (!binding && !reference) {\n errors.push(\n classifyMissingBinding(\n bindingName,\n scope,\n imports,\n program,\n toSourceSpan(componentArg) ?? callSpan,\n ),\n );\n return null;\n }\n\n const configArg = unwrapTsExpression(args[1]);\n if (configArg?.type !== \"ObjectExpression\") {\n errors.push({\n code: \"config_not_object_literal\",\n severity: \"structural\",\n message:\n \"defineAsset's config must be an inline object literal — the span-based editor needs literal spans to mutate\",\n span: toSourceSpan(args[1]) ?? callSpan,\n });\n return null;\n }\n\n if (input.declaredBindings.has(bindingName)) {\n errors.push({\n code: \"duplicate_declaration\",\n severity: \"structural\",\n message: `duplicate defineAsset call for \"${bindingName}\" — keep one asset declaration`,\n span: callSpan,\n });\n return null;\n }\n input.declaredBindings.add(bindingName);\n\n const warnings: AssetParseError[] = [];\n const spans: AssetSpans = {\n call: callSpan,\n config: toSourceSpan(configArg) ?? callSpan,\n libraryItems: [],\n };\n\n const usageInstructions = readUsageInstructions(configArg);\n const libraries = readLibraries(configArg, spans, warnings);\n const variants = readVariants(configArg, warnings);\n if (getObjectProperty(configArg, \"controls\")) {\n errors.push({\n code: \"invalid_control\",\n severity: \"structural\",\n message:\n \"Move controls to defineControls(Component, controls) in the component file or tempo/controls.ts.\",\n });\n return null;\n }\n const structural = warnings.filter(\n (warning) => warning.severity === \"structural\",\n );\n if (structural.length) {\n errors.push(...structural);\n return null;\n }\n\n // Reference declarations skip the not_exported warning — the target lives\n // in another module, and the import form already proves it is importable.\n if (binding && binding.exportKind === \"none\") {\n warnings.push({\n code: \"not_exported\",\n severity: \"degraded\",\n message: `\"${bindingName}\" is not exported — other files cannot import this asset`,\n span: callSpan,\n });\n }\n\n return {\n bindingName,\n exportKind: binding\n ? binding.exportKind\n : referenceExportKind(reference as ParsedAssetReference),\n libraries,\n ...(usageInstructions === undefined ? {} : { usageInstructions }),\n variants,\n ...(reference ? { reference } : {}),\n spans,\n warnings,\n };\n}\n\n/** How the target is exported from its module, read straight off the import\n * form — a default import can only bind a default export, a named import a\n * named one. */\nfunction referenceExportKind(reference: ParsedAssetReference): AssetExportKind {\n return reference.importedName === \"default\" ? \"default\" : \"named\";\n}\n\nfunction classifyMissingBinding(\n name: string,\n scope: AssetTopLevelScope,\n imports: AssetImportInfo,\n program: any,\n span: AssetSourceSpan,\n): AssetParseError {\n // Named/default imports parse as reference declarations before reaching\n // here, so an import landing in this branch is a namespace import.\n const importSource = imports.importedBindings.get(name);\n if (importSource !== undefined) {\n return {\n code: \"imported_binding\",\n severity: \"structural\",\n message: `\"${name}\" is a namespace import from \"${importSource}\" — declare the asset on a named or default import of the component instead`,\n span,\n };\n }\n if (scope.nonSimpleNames.has(name)) {\n return {\n code: \"unknown_binding\",\n severity: \"structural\",\n message: `\"${name}\" is not a plain initialized top-level binding — destructured and uninitialized declarations are not supported`,\n span,\n };\n }\n if (hasNestedBinding(program, name)) {\n return {\n code: \"non_top_level_binding\",\n severity: \"structural\",\n message: `\"${name}\" is not declared at the top level of the module`,\n span,\n };\n }\n return {\n code: \"unknown_binding\",\n severity: \"structural\",\n message: `no top-level declaration of \"${name}\" found in this file`,\n span,\n };\n}\n\nfunction hasNestedBinding(program: any, name: string): boolean {\n let found = false;\n walk(program, (node) => {\n if (found) return;\n if (\n (node.type === \"VariableDeclarator\" ||\n node.type === \"FunctionDeclaration\" ||\n node.type === \"ClassDeclaration\") &&\n node.id?.type === \"Identifier\" &&\n node.id.name === name\n ) {\n found = true;\n }\n });\n return found;\n}\n\nfunction readUsageInstructions(configNode: any): string | undefined {\n return readStaticStringProperty(configNode, \"usageInstructions\");\n}\n\nfunction readStaticStringProperty(\n configNode: any,\n name: string,\n): string | undefined {\n const property = getObjectProperty(configNode, name);\n if (!property) return undefined;\n const value = readStaticValue(property.value);\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction readLibraries(\n configNode: any,\n spans: AssetSpans,\n warnings: AssetParseError[],\n): string[] {\n const property = getObjectProperty(configNode, \"libraries\");\n if (!property) return [];\n spans.librariesProperty = toSourceSpan(property);\n\n const value = unwrapTsExpression(property.value);\n if (value?.type !== \"ArrayExpression\") {\n warnings.push({\n code: \"non_literal_library\",\n severity: \"degraded\",\n message:\n \"libraries must be an inline array literal of string literals — its entries were dropped\",\n span: toSourceSpan(property.value) ?? spans.librariesProperty,\n });\n return [];\n }\n spans.libraries = toSourceSpan(value);\n\n const names: string[] = [];\n for (const element of value.elements ?? []) {\n const elementSpan = toSourceSpan(element) ?? spans.libraries;\n const name = readStaticString(element);\n if (name === null) {\n warnings.push({\n code: \"non_literal_library\",\n severity: \"degraded\",\n message:\n \"libraries entries must be string literals — dropped a non-literal entry\",\n span: elementSpan,\n });\n continue;\n }\n if (name === \"\") {\n warnings.push({\n code: \"empty_library_name\",\n severity: \"degraded\",\n message: \"libraries entries must be non-empty — dropped an empty entry\",\n span: elementSpan,\n });\n continue;\n }\n if (names.includes(name)) {\n warnings.push({\n code: \"duplicate_library\",\n severity: \"degraded\",\n message: `duplicate library name \"${name}\" — deduplicated`,\n span: elementSpan,\n });\n continue;\n }\n names.push(name);\n if (elementSpan) spans.libraryItems.push(elementSpan);\n }\n return names;\n}\n\nfunction readVariants(\n configNode: any,\n warnings: AssetParseError[],\n): ParsedAssetVariant[] {\n const property = getObjectProperty(configNode, \"variants\");\n if (!property) return [];\n\n const value = unwrapTsExpression(property.value);\n if (value?.type !== \"ObjectExpression\") {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message:\n \"variants is not an inline object literal — variant props are not statically readable\",\n span: toSourceSpan(property.value) ?? toSourceSpan(property),\n });\n return [];\n }\n\n const properties = value.properties ?? [];\n if (properties.length === 0) {\n warnings.push({\n code: \"empty_variants\",\n severity: \"degraded\",\n message: \"variants is present but empty\",\n span: toSourceSpan(value),\n });\n return [];\n }\n\n const variants: ParsedAssetVariant[] = [];\n for (const entry of properties) {\n const name =\n entry?.type === \"Property\" && !entry.computed\n ? readPropertyKeyName(entry.key)\n : null;\n if (name === null) {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message:\n \"variant names must be identifier or string keys — skipped an entry that is not statically readable\",\n span: toSourceSpan(entry) ?? toSourceSpan(value),\n });\n continue;\n }\n variants.push(readVariant(name, entry, warnings));\n }\n return variants;\n}\n\nfunction readVariant(\n name: string,\n entry: any,\n warnings: AssetParseError[],\n): ParsedAssetVariant {\n const value = unwrapTsExpression(entry.value);\n for (const property of value?.type === \"ObjectExpression\"\n ? value.properties\n : []) {\n if (\n property.type !== \"Property\" ||\n property.computed ||\n ![\"props\", \"render\"].includes(readPropertyKeyName(property.key) ?? \"\")\n ) {\n warnings.push({\n code: \"invalid_variant_config\",\n severity: \"structural\",\n message: `Variant \"${name}\" accepts either props or render, with explicit keys and no spreads or inheritance`,\n span: toSourceSpan(property),\n });\n }\n }\n const renderProperty =\n value?.type === \"ObjectExpression\"\n ? getObjectProperty(value, \"render\")\n : null;\n const propsProperty =\n value?.type === \"ObjectExpression\"\n ? getObjectProperty(value, \"props\")\n : null;\n const fn = unwrapTsExpression(renderProperty?.value);\n const body = unwrapTsExpression(fn?.body);\n const jsx =\n body?.type === \"TempoJsxValue\" ? readStaticValue(body) : UNRESOLVED_VALUE;\n const validRender =\n fn?.type === \"ArrowFunctionExpression\" &&\n !fn.async &&\n fn.params.length === 0 &&\n !propsProperty &&\n !containsUnresolvedValue(jsx);\n if (renderProperty && !validRender)\n warnings.push({\n code: \"invalid_variant_config\",\n severity: \"structural\",\n message: `Variant \"${name}\" render must be a parameterless arrow returning static JSX, without props, statements, hooks, callbacks, or computed expressions. Move logic into an imported component.`,\n span: toSourceSpan(renderProperty),\n });\n const render = renderProperty && validRender ? { jsx } : undefined;\n const propsValue = propsProperty\n ? readStaticValue(propsProperty.value)\n : render\n ? {}\n : UNRESOLVED_VALUE;\n const props = isPlainRecord(propsValue) ? propsValue : {};\n const hasUnresolvedValues =\n !isPlainRecord(propsValue) || containsUnresolvedValue(propsValue);\n\n if (hasUnresolvedValues) {\n warnings.push({\n code: \"unresolved_prop_value\",\n severity: \"degraded\",\n message: `variant \"${name}\" has prop values that are not statically readable`,\n span: toSourceSpan(entry),\n });\n }\n\n return { name, props, hasUnresolvedValues, ...(render ? { render } : {}) };\n}\n\n/** Static value model (§3.2): literals, interpolation-free templates, unary\n * minus on numbers, array/object literals; anything else degrades to the\n * UNRESOLVED sentinel in place, preserving the surrounding structure. */\nfunction readStaticValue(node: any): StaticValue {\n const expression = unwrapTsExpression(node);\n if (!expression) return UNRESOLVED_VALUE;\n\n switch (expression.type) {\n case \"TempoJsxValue\":\n return expression.value;\n case \"Literal\": {\n if (expression.regex || expression.bigint) return UNRESOLVED_VALUE;\n const { value } = expression;\n return value === null ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ? value\n : UNRESOLVED_VALUE;\n }\n case \"TemplateLiteral\": {\n if ((expression.expressions ?? []).length > 0) return UNRESOLVED_VALUE;\n const cooked = expression.quasis?.[0]?.value?.cooked;\n return typeof cooked === \"string\" ? cooked : UNRESOLVED_VALUE;\n }\n case \"UnaryExpression\": {\n if (expression.operator !== \"-\") return UNRESOLVED_VALUE;\n const argument = unwrapTsExpression(expression.argument);\n return argument?.type === \"Literal\" &&\n typeof argument.value === \"number\" &&\n Number.isFinite(argument.value)\n ? -argument.value\n : UNRESOLVED_VALUE;\n }\n case \"ArrayExpression\":\n return (expression.elements ?? []).map((element: any) =>\n element == null || element.type === \"SpreadElement\"\n ? UNRESOLVED_VALUE\n : readStaticValue(element),\n );\n case \"ObjectExpression\": {\n const record: Record<string, StaticValue> = {};\n for (const property of expression.properties ?? []) {\n // A spread or computed key makes the object's final shape unknowable\n // statically, so the whole object degrades to UNRESOLVED rather than\n // presenting a misleading partial record.\n if (property?.type !== \"Property\" || property.computed) {\n return UNRESOLVED_VALUE;\n }\n const key = readPropertyKeyName(property.key);\n if (key === null) return UNRESOLVED_VALUE;\n Object.defineProperty(record, key, {\n value: readStaticValue(property.value),\n enumerable: true,\n configurable: true,\n });\n }\n return record;\n }\n default:\n return UNRESOLVED_VALUE;\n }\n}\n\nfunction readStaticString(node: any): string | null {\n const value = node == null ? UNRESOLVED_VALUE : readStaticValue(node);\n return typeof value === \"string\" ? value : null;\n}\n\nfunction isPlainRecord(\n value: StaticValue,\n): value is Record<string, StaticValue> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n !isUnresolvedValue(value)\n );\n}\n\nfunction containsUnresolvedValue(value: StaticValue): boolean {\n if (isUnresolvedValue(value)) return true;\n if (Array.isArray(value)) return value.some(containsUnresolvedValue);\n if (typeof value === \"object\" && value !== null) {\n return Object.values(value).some(containsUnresolvedValue);\n }\n return false;\n}\n\n/** ExpressionStatement spans normally include the terminating semicolon, but\n * a semicolon separated by inline whitespace still belongs to the call. */\nfunction statementSpanWithSemicolon(\n source: string,\n statement: any,\n): AssetSourceSpan {\n const span = toSourceSpan(statement) ?? { start: 0, end: 0 };\n if (source[span.end - 1] === \";\") return span;\n let end = span.end;\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n return source[end] === \";\" ? { start: span.start, end: end + 1 } : span;\n}\n\nexport function unwrapTsExpression(node: any): any {\n let current = node;\n while (\n current?.type === \"TSSatisfiesExpression\" ||\n current?.type === \"TSAsExpression\" ||\n current?.type === \"TSNonNullExpression\" ||\n current?.type === \"ParenthesizedExpression\"\n ) {\n current = current.expression;\n }\n return current;\n}\n\nfunction readPropertyKeyName(key: any): string | null {\n if (key?.type === \"Identifier\") return key.name;\n if (key?.type === \"Literal\") {\n if (typeof key.value === \"string\") return key.value;\n if (typeof key.value === \"number\") return String(key.value);\n }\n return null;\n}\n\nfunction getObjectProperty(objectExpression: any, name: string): any | null {\n if (objectExpression?.type !== \"ObjectExpression\") return null;\n for (const property of objectExpression.properties ?? []) {\n if (property?.type !== \"Property\" || property.computed) continue;\n if (readPropertyKeyName(property.key) === name) return property;\n }\n return null;\n}\n\nexport function toSourceSpan(node: any): AssetSourceSpan | undefined {\n return typeof node?.start === \"number\" &&\n Number.isFinite(node.start) &&\n typeof node?.end === \"number\" &&\n Number.isFinite(node.end)\n ? { start: node.start, end: node.end }\n : undefined;\n}\n\nfunction walk(\n node: any,\n visitor: (node: any) => void,\n seen = new Set<any>(),\n): void {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n if (typeof node.type === \"string\") visitor(node);\n\n for (const value of Object.values(node)) {\n if (!value || typeof value !== \"object\") continue;\n if (Array.isArray(value)) {\n for (const item of value) walk(item, visitor, seen);\n } else {\n walk(value, visitor, seen);\n }\n }\n}\n"],"mappings":";;;;;;AAeA,SAAS,iBAAiB;AAmBnB,IAAM,0BAA0B;AAEhC,SAAS,eACd,UACA,QACA,SAAS,kBAAkB,UAAU,MAAM,GAC1B;AAGjB,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,SAAS,CAAC,GAAG,OAAO,MAAM;AAChC,MAAI,CAAC,SAAS;AACZ,WAAO,EAAE,UAAU,cAAc,CAAC,GAAG,OAAO;AAAA,EAC9C;AAEA,QAAM,UAAU,iBAAiB,OAAO;AACxC,aAAW,aAAa,QAAQ,YAAY;AAC1C,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS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