| 35 | } |
| 36 | |
| 37 | async function importTsModule(tsFilePath) { |
| 38 | if (!fs.existsSync(tsFilePath)) { |
| 39 | throw new Error(`TS module not found: ${tsFilePath}`); |
| 40 | } |
| 41 | const sourceText = fs.readFileSync(tsFilePath, 'utf8'); |
| 42 | const result = ts.transpileModule(sourceText, { |
| 43 | fileName: tsFilePath, |
| 44 | compilerOptions: { |
| 45 | target: ts.ScriptTarget.ES2022, |
| 46 | module: ts.ModuleKind.ESNext, |
| 47 | esModuleInterop: true |
| 48 | } |
| 49 | }); |
| 50 | const url = `data:text/javascript;base64,${Buffer.from(result.outputText, 'utf8').toString('base64')}`; |
| 51 | return import(url); |
| 52 | } |
| 53 | |
| 54 | function buildIconNames() { |
| 55 | if (!fs.existsSync(ICONS_DIR)) { |