(source: string)
| 185 | * boolean objects that older Open CoDesign bundled templates used. |
| 186 | */ |
| 187 | export function normalizeLegacyEditmodeBlock(source: string): string | null { |
| 188 | const block = findMarkerBlock(source, 'EDITMODE'); |
| 189 | if (block === null) return null; |
| 190 | const raw = block.inner.trim(); |
| 191 | if (raw.length === 0) return null; |
| 192 | try { |
| 193 | JSON.parse(raw); |
| 194 | return null; |
| 195 | } catch { |
| 196 | // Fall through to the legacy flat-object parser. |
| 197 | } |
| 198 | const tokens = parseLegacyEditmodeObject(raw); |
| 199 | if (tokens === null) return null; |
| 200 | return replaceMarkerBlock(source, 'EDITMODE', JSON.stringify(tokens, null, 2)); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Kept for older runtime call sites. v0.2 no longer repairs missing EDITMODE |
no test coverage detected