| 16 | } |
| 17 | |
| 18 | compile() { |
| 19 | const workingDir = process.cwd() |
| 20 | |
| 21 | const templatePath = path.resolve(workingDir, this.template) |
| 22 | const template = fs.readFileSync(templatePath, 'utf8') |
| 23 | const processedContent = this.processIncludes(template, workingDir) |
| 24 | |
| 25 | if (this.build) { |
| 26 | const outputPath = path.resolve(workingDir, this.build) |
| 27 | fs.writeFileSync(outputPath, processedContent, 'utf8') |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | private processIncludes(template: string, baseDir: string): string { |
| 32 | const includeRegex = /#include\s+"([^"]+)"/g |