| 66 | } |
| 67 | |
| 68 | function buildIllustrationNames() { |
| 69 | if (!fs.existsSync(ILLUSTRATIONS_DIR)) { |
| 70 | throw new Error(`Illustrations directory not found: ${ILLUSTRATIONS_DIR}`); |
| 71 | } |
| 72 | const files = fg.sync('**/*.svg', { |
| 73 | cwd: ILLUSTRATIONS_DIR, |
| 74 | absolute: false, |
| 75 | suppressErrors: true |
| 76 | }); |
| 77 | if (files.length === 0) { |
| 78 | throw new Error(`No illustration SVG files found in: ${ILLUSTRATIONS_DIR}`); |
| 79 | } |
| 80 | const ids = Array.from( |
| 81 | new Set( |
| 82 | files.map(f => { |
| 83 | const base = f.replace(/\.svg$/i, '').replace(/^S2_lin_(.*)_\d+$/, '$1'); |
| 84 | return base ? base.charAt(0).toUpperCase() + base.slice(1) : base; |
| 85 | }) |
| 86 | ) |
| 87 | ).sort((a, b) => a.localeCompare(b)); |
| 88 | return ids; |
| 89 | } |
| 90 | |
| 91 | async function loadAliases(modPath, exportName) { |
| 92 | if (!fs.existsSync(modPath)) { |