feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell

- Introduced blog routing using Next.js App Router
- Implemented dynamic [slug] pages for blog posts
- Added MDX-based content loading via lib/posts
- Integrated shared TopBar layout with navigation
- Established clear content, lib and component separation
This commit is contained in:
PascalSchattenburg
2026-01-22 14:14:15 +01:00
parent b717952234
commit d147843c76
10412 changed files with 2475583 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,2 @@
import type { ServerResponse, IncomingMessage } from 'http';
export declare function getDevOverlayFontMiddleware(): (req: IncomingMessage, res: ServerResponse, next: () => void) => Promise<void>;

View File

@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getDevOverlayFontMiddleware", {
enumerable: true,
get: function() {
return getDevOverlayFontMiddleware;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _path = /*#__PURE__*/ _interop_require_default._(require("path"));
const _promises = /*#__PURE__*/ _interop_require_wildcard._(require("fs/promises"));
const _fs = require("fs");
const _log = /*#__PURE__*/ _interop_require_wildcard._(require("../../../build/output/log"));
const _middlewareresponse = require("../middleware-response");
const FONT_PREFIX = '/__nextjs_font/';
const VALID_FONTS = [
'geist-latin-ext.woff2',
'geist-mono-latin-ext.woff2',
'geist-latin.woff2',
'geist-mono-latin.woff2'
];
const FONT_HEADERS = {
'Content-Type': 'font/woff2',
'Cache-Control': 'public, max-age=31536000, immutable'
};
function getDevOverlayFontMiddleware() {
return async function devOverlayFontMiddleware(req, res, next) {
try {
const { pathname } = new URL(`http://n${req.url}`);
if (!pathname.startsWith(FONT_PREFIX)) {
return next();
}
const fontFile = pathname.replace(FONT_PREFIX, '');
if (!VALID_FONTS.includes(fontFile)) {
return _middlewareresponse.middlewareResponse.notFound(res);
}
const fontPath = _path.default.resolve(__dirname, fontFile);
const fileExists = await checkFileExists(fontPath);
if (!fileExists) {
return _middlewareresponse.middlewareResponse.notFound(res);
}
const fontData = await _promises.readFile(fontPath);
Object.entries(FONT_HEADERS).forEach(([key, value])=>{
res.setHeader(key, value);
});
res.end(fontData);
} catch (err) {
_log.error('Failed to serve font:', err instanceof Error ? err.message : err);
return _middlewareresponse.middlewareResponse.internalServerError(res);
}
};
}
async function checkFileExists(filePath) {
try {
await _promises.access(filePath, _fs.constants.F_OK);
return true;
} catch {
return false;
}
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=get-dev-overlay-font-middleware.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/next-devtools/server/font/get-dev-overlay-font-middleware.ts"],"sourcesContent":["import type { ServerResponse, IncomingMessage } from 'http'\nimport path from 'path'\nimport * as fs from 'fs/promises'\nimport { constants } from 'fs'\nimport * as Log from '../../../build/output/log'\nimport { middlewareResponse } from '../middleware-response'\n\nconst FONT_PREFIX = '/__nextjs_font/'\n\nconst VALID_FONTS = [\n 'geist-latin-ext.woff2',\n 'geist-mono-latin-ext.woff2',\n 'geist-latin.woff2',\n 'geist-mono-latin.woff2',\n]\n\nconst FONT_HEADERS = {\n 'Content-Type': 'font/woff2',\n 'Cache-Control': 'public, max-age=31536000, immutable',\n} as const\n\nexport function getDevOverlayFontMiddleware() {\n return async function devOverlayFontMiddleware(\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n try {\n const { pathname } = new URL(`http://n${req.url}`)\n\n if (!pathname.startsWith(FONT_PREFIX)) {\n return next()\n }\n\n const fontFile = pathname.replace(FONT_PREFIX, '')\n if (!VALID_FONTS.includes(fontFile)) {\n return middlewareResponse.notFound(res)\n }\n\n const fontPath = path.resolve(__dirname, fontFile)\n const fileExists = await checkFileExists(fontPath)\n\n if (!fileExists) {\n return middlewareResponse.notFound(res)\n }\n\n const fontData = await fs.readFile(fontPath)\n Object.entries(FONT_HEADERS).forEach(([key, value]) => {\n res.setHeader(key, value)\n })\n res.end(fontData)\n } catch (err) {\n Log.error(\n 'Failed to serve font:',\n err instanceof Error ? err.message : err\n )\n return middlewareResponse.internalServerError(res)\n }\n }\n}\n\nasync function checkFileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath, constants.F_OK)\n return true\n } catch {\n return false\n }\n}\n"],"names":["getDevOverlayFontMiddleware","FONT_PREFIX","VALID_FONTS","FONT_HEADERS","devOverlayFontMiddleware","req","res","next","pathname","URL","url","startsWith","fontFile","replace","includes","middlewareResponse","notFound","fontPath","path","resolve","__dirname","fileExists","checkFileExists","fontData","fs","readFile","Object","entries","forEach","key","value","setHeader","end","err","Log","error","Error","message","internalServerError","filePath","access","constants","F_OK"],"mappings":";;;;+BAqBgBA;;;eAAAA;;;;;+DApBC;oEACG;oBACM;+DACL;oCACc;AAEnC,MAAMC,cAAc;AAEpB,MAAMC,cAAc;IAClB;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAe;IACnB,gBAAgB;IAChB,iBAAiB;AACnB;AAEO,SAASH;IACd,OAAO,eAAeI,yBACpBC,GAAoB,EACpBC,GAAmB,EACnBC,IAAgB;QAEhB,IAAI;YACF,MAAM,EAAEC,QAAQ,EAAE,GAAG,IAAIC,IAAI,CAAC,QAAQ,EAAEJ,IAAIK,GAAG,EAAE;YAEjD,IAAI,CAACF,SAASG,UAAU,CAACV,cAAc;gBACrC,OAAOM;YACT;YAEA,MAAMK,WAAWJ,SAASK,OAAO,CAACZ,aAAa;YAC/C,IAAI,CAACC,YAAYY,QAAQ,CAACF,WAAW;gBACnC,OAAOG,sCAAkB,CAACC,QAAQ,CAACV;YACrC;YAEA,MAAMW,WAAWC,aAAI,CAACC,OAAO,CAACC,WAAWR;YACzC,MAAMS,aAAa,MAAMC,gBAAgBL;YAEzC,IAAI,CAACI,YAAY;gBACf,OAAON,sCAAkB,CAACC,QAAQ,CAACV;YACrC;YA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