(path: string)
| 33 | // Derive a human-readable key from the file path, e.g.: |
| 34 | // "./previews/modal-about.preview.tsx" → "modal-about" |
| 35 | function pathToKey(path: string): string { |
| 36 | return path.replace(/^\.\/previews\//, "").replace(/\.preview\.tsx$/, ""); |
| 37 | } |
| 38 | |
| 39 | // Build a map of key → lazy React component. |
| 40 | // Each preview file is expected to have a default export that is the preview component. |