(d: TemplateData)
| 162 | }; |
| 163 | |
| 164 | export const genManifest = (d: TemplateData): string => |
| 165 | [ |
| 166 | `// File manifest struct`, |
| 167 | `struct ${d.definePrefix}_FileInfo {`, |
| 168 | ` const char* path;`, |
| 169 | ` uint32_t size;`, |
| 170 | ` uint32_t gzipSize;`, |
| 171 | ` const char* etag;`, |
| 172 | ` const char* contentType;`, |
| 173 | `};`, |
| 174 | `// File manifest array`, |
| 175 | `static const ${d.definePrefix}_FileInfo ${d.definePrefix}_FILES[] = {`, |
| 176 | ...d.sources.map( |
| 177 | (s) => |
| 178 | ` { "${d.basePath}/${s.filename}", ${s.length}, ${s.gzipSizeForManifest}, ${s.etagForManifest}, "${s.mime}" },` |
| 179 | ), |
| 180 | `};`, |
| 181 | `static const size_t ${d.definePrefix}_FILE_COUNT = sizeof(${d.definePrefix}_FILES) / sizeof(${d.definePrefix}_FILES[0]);` |
| 182 | ].join('\n'); |
| 183 | |
| 184 | export const genHook = (d: TemplateData): string => |
| 185 | `// File served hook - override with your own implementation\nextern "C" void __attribute__((weak)) ${d.definePrefix}_onFileServed(const char* path, int statusCode) {}`; |
no outgoing calls
no test coverage detected