(prefetches: Record<string, FileFsRef>)
| 4723 | // to avoid any conflict with route matching/resolving, we prefix all prefetches (ie, __index.prefetch.rsc) |
| 4724 | // this is to ensure that prefetches are never matched for things like a greedy match on `index.{ext}` |
| 4725 | export function normalizePrefetches(prefetches: Record<string, FileFsRef>) { |
| 4726 | const updatedPrefetches: Record<string, FileFsRef> = {}; |
| 4727 | |
| 4728 | for (const key in prefetches) { |
| 4729 | if (key === 'index.prefetch.rsc') { |
| 4730 | const newKey = key.replace(/([^/]+\.prefetch\.rsc)$/, '__$1'); |
| 4731 | updatedPrefetches[newKey] = prefetches[key]; |
| 4732 | } else { |
| 4733 | updatedPrefetches[key] = prefetches[key]; |
| 4734 | } |
| 4735 | } |
| 4736 | |
| 4737 | return updatedPrefetches; |
| 4738 | } |
| 4739 | |
| 4740 | /** |
| 4741 | * Get the postponed state for a route. |
no test coverage detected