MCPcopy Create free account
hub / github.com/BCsabaEngine/svelteesp32 / genManifest

Function genManifest

src/cppCode.ts:164–182  ·  view source on GitHub ↗
(d: TemplateData)

Source from the content-addressed store, hash-verified

162};
163
164export 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
184export 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) {}`;

Callers 3

genPsychicCppFunction · 0.90
genAsyncCppFunction · 0.90
genWebserverCppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected