(template: string, baseDir: string)
| 29 | } |
| 30 | |
| 31 | private processIncludes(template: string, baseDir: string): string { |
| 32 | const includeRegex = /#include\s+"([^"]+)"/g |
| 33 | |
| 34 | return template.replace(includeRegex, (match, includePath) => { |
| 35 | try { |
| 36 | const fullPath = path.resolve(baseDir, includePath) |
| 37 | const includeContent = fs.readFileSync(fullPath, 'utf8') |
| 38 | return this.processIncludes(includeContent, baseDir) |
| 39 | } catch (error) { |
| 40 | console.warn(`Warning: Could not include file ${includePath}: ${error}`) |
| 41 | return match |
| 42 | } |
| 43 | }) |
| 44 | } |
| 45 | } |