(d: TemplateData)
| 92 | }; |
| 93 | |
| 94 | export const genCommonHeader = (d: TemplateData): string => { |
| 95 | const lines: string[] = []; |
| 96 | const etagWarn = sw(d.etag, { |
| 97 | always: [ |
| 98 | `#ifdef ${d.definePrefix}_ENABLE_ETAG`, |
| 99 | `#warning ${d.definePrefix}_ENABLE_ETAG has no effect because it is permanently switched ON`, |
| 100 | '#endif' |
| 101 | ].join('\n'), |
| 102 | never: [ |
| 103 | `#ifdef ${d.definePrefix}_ENABLE_ETAG`, |
| 104 | `#warning ${d.definePrefix}_ENABLE_ETAG has no effect because it is permanently switched OFF`, |
| 105 | '#endif' |
| 106 | ].join('\n') |
| 107 | }); |
| 108 | if (etagWarn) lines.push(etagWarn); |
| 109 | const gzipWarn = sw(d.gzip, { |
| 110 | always: [ |
| 111 | `#ifdef ${d.definePrefix}_ENABLE_GZIP`, |
| 112 | `#warning ${d.definePrefix}_ENABLE_GZIP has no effect because it is permanently switched ON`, |
| 113 | '#endif' |
| 114 | ].join('\n'), |
| 115 | never: [ |
| 116 | `#ifdef ${d.definePrefix}_ENABLE_GZIP`, |
| 117 | `#warning ${d.definePrefix}_ENABLE_GZIP has no effect because it is permanently switched OFF`, |
| 118 | '#endif' |
| 119 | ].join('\n') |
| 120 | }); |
| 121 | if (gzipWarn) lines.push(gzipWarn); |
| 122 | lines.push('//'); |
| 123 | if (d.version) lines.push(`#define ${d.definePrefix}_VERSION "${d.version}"`); |
| 124 | lines.push( |
| 125 | `#define ${d.definePrefix}_COUNT ${d.fileCount}`, |
| 126 | `#define ${d.definePrefix}_SIZE ${d.fileSize}`, |
| 127 | `#define ${d.definePrefix}_SIZE_GZIP ${d.fileGzipSize}` |
| 128 | ); |
| 129 | if (d.isPsychic) |
| 130 | lines.push( |
| 131 | `#define ${d.definePrefix}_URI_HANDLERS ${d.uriHandlers}`, |
| 132 | `#define ${d.definePrefix}_MAX_URI_HANDLERS ${d.maxUriHandlers}` |
| 133 | ); |
| 134 | lines.push('//'); |
| 135 | for (const s of d.sources) lines.push(`#define ${d.definePrefix}_FILE_${s.datanameUpperCase}`); |
| 136 | lines.push('//'); |
| 137 | for (const g of d.filesByExtension) lines.push(`#define ${d.definePrefix}_${g.extension}_FILES ${g.count}`); |
| 138 | return lines.join('\n'); |
| 139 | }; |
| 140 | |
| 141 | export const genDataArrays = (d: TemplateData, isProgmem: boolean): string => { |
| 142 | const mem = isProgmem ? ' PROGMEM' : ''; |
no test coverage detected