chore: sync local workspace changes

This commit is contained in:
2026-05-07 11:03:47 +09:00
parent 2df0ba30cb
commit 82c0d8a197
217 changed files with 44873 additions and 1678 deletions

View File

@@ -23,6 +23,20 @@ const mimeTypes = {
'.woff2': 'font/woff2',
};
function resolveCacheControl(resolvedPath, extension) {
const normalizedPath = resolvedPath.replace(/\\/g, '/');
if (extension === '.html') {
return 'no-cache';
}
if (normalizedPath.endsWith('/sw.js') || extension === '.webmanifest') {
return 'no-store, no-cache, max-age=0, must-revalidate';
}
return 'public, max-age=31536000, immutable';
}
function looksLikeStaticAsset(requestedPath) {
const normalizedPath = requestedPath.split('?')[0] ?? requestedPath;
const extension = extname(normalizedPath);
@@ -135,7 +149,7 @@ const server = createServer(async (request, response) => {
response.writeHead(200, {
'Content-Type': contentType,
'Cache-Control': extension === '.html' ? 'no-cache' : 'public, max-age=31536000, immutable',
'Cache-Control': resolveCacheControl(resolvedPath, extension),
});
createReadStream(resolvedPath).pipe(response);