* Capture the undo-history `before` baseline for timing/GSAP persists: the exact * on-disk bytes when a reader is available (so undo restores them verbatim), * falling back to the SDK's pre-edit serialization when it isn't. Never throws — * a failed read degrades to the serialized fallback rather
( deps: CutoverDeps, targetPath: string, serializedFallback: string, )
| 64 | * a failed read degrades to the serialized fallback rather than aborting the edit. |
| 65 | */ |
| 66 | async function captureOnDiskBefore( |
| 67 | deps: CutoverDeps, |
| 68 | targetPath: string, |
| 69 | serializedFallback: string, |
| 70 | ): Promise<string> { |
| 71 | if (!deps.readProjectFile) return serializedFallback; |
| 72 | try { |
| 73 | return await deps.readProjectFile(targetPath); |
| 74 | } catch { |
| 75 | return serializedFallback; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /** True when targetPath isn't the composition the SDK session models. */ |
| 80 | function wrongCompositionFile(deps: CutoverDeps, targetPath: string): boolean { |
no outgoing calls
no test coverage detected