(node: AstNode, scope: ScopeBindings)
| 343 | } |
| 344 | |
| 345 | function objectExpressionToRecord(node: AstNode, scope: ScopeBindings): Record<string, unknown> { |
| 346 | const result: Record<string, unknown> = {}; |
| 347 | if (node?.type !== "ObjectExpression") return result; |
| 348 | for (const prop of node.properties ?? []) { |
| 349 | if (prop.type !== "ObjectProperty" && prop.type !== "Property") continue; |
| 350 | const key = prop.key?.name ?? prop.key?.value; |
| 351 | if (!key) continue; |
| 352 | const resolved = resolveNode(prop.value, scope); |
| 353 | if (resolved !== undefined) { |
| 354 | result[key] = resolved; |
| 355 | } else { |
| 356 | // Preserve unresolvable values as raw source text so they survive round-trips |
| 357 | result[key] = `__raw:${recast.print(prop.value).code}`; |
| 358 | } |
| 359 | } |
| 360 | return result; |
| 361 | } |
| 362 | |
| 363 | // ── Timeline Variable Detection ───────────────────────────────────────────── |
| 364 |
no test coverage detected