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

View File

@@ -0,0 +1,6 @@
/**
* A drop-in replacement for `fs.rename` that:
* - allows to move across multiple disks
* - attempts to retry the operation for certain error codes on Windows
*/
export declare function renameSync(source: string, target: string, windowsRetryTimeout?: number | false): void;

View File

@@ -0,0 +1,87 @@
/*
MIT License
Copyright (c) 2015 - present Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/ // This file is based on https://github.com/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts
// See the LICENSE at the top of the file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renameSync", {
enumerable: true,
get: function() {
return renameSync;
}
});
const _nodefs = require("node:fs");
function renameSync(source, target, windowsRetryTimeout = 60000 /* matches graceful-fs */ ) {
if (source === target) {
return; // simulate node.js behaviour here and do a no-op if paths match
}
if (process.platform === 'win32' && typeof windowsRetryTimeout === 'number') {
// On Windows, a rename can fail when either source or target
// is locked by AV software. We do leverage graceful-fs to iron
// out these issues, however in case the target file exists,
// graceful-fs will immediately return without retry for fs.rename().
renameSyncWithRetry(source, target, Date.now(), windowsRetryTimeout);
} else {
(0, _nodefs.renameSync)(source, target);
}
}
function renameSyncWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
try {
return (0, _nodefs.renameSync)(source, target);
} catch (error) {
if (error.code !== 'EACCES' && error.code !== 'EPERM' && error.code !== 'EBUSY') {
throw error // only for errors we think are temporary
;
}
if (Date.now() - startTime >= retryTimeout) {
console.error(`Node.js fs rename failed after ${attempt} retries with error: ${error}`);
throw error // give up after configurable timeout
;
}
if (attempt > 100) {
console.error(`Node.js fs rename failed after ${attempt} retries with error ${error}`);
throw error;
}
if (attempt === 0) {
let abortRetry = false;
try {
const statTarget = (0, _nodefs.statSync)(target);
if (!statTarget.isFile()) {
abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry
;
}
} catch (e) {
// Ignore
}
if (abortRetry) {
throw error;
}
}
// Attempt again
return renameSyncWithRetry(source, target, startTime, retryTimeout, attempt + 1);
}
}
//# sourceMappingURL=rename.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare function writeFileAtomic(filePath: string, content: string): void;

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "writeFileAtomic", {
enumerable: true,
get: function() {
return writeFileAtomic;
}
});
const _fs = require("fs");
const _rename = require("./rename");
function writeFileAtomic(filePath, content) {
const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2);
try {
(0, _fs.writeFileSync)(tempPath, content, 'utf-8');
(0, _rename.renameSync)(tempPath, filePath);
} catch (e) {
try {
(0, _fs.unlinkSync)(tempPath);
} catch {
// ignore
}
throw e;
}
}
//# sourceMappingURL=write-atomic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/fs/write-atomic.ts"],"sourcesContent":["import { unlinkSync, writeFileSync } from 'fs'\nimport { renameSync } from './rename'\n\nexport function writeFileAtomic(filePath: string, content: string): void {\n const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2)\n try {\n writeFileSync(tempPath, content, 'utf-8')\n renameSync(tempPath, filePath)\n } catch (e) {\n try {\n unlinkSync(tempPath)\n } catch {\n // ignore\n }\n throw e\n }\n}\n"],"names":["writeFileAtomic","filePath","content","tempPath","Math","random","toString","slice","writeFileSync","renameSync","e","unlinkSync"],"mappings":";;;;+BAGgBA;;;eAAAA;;;oBAH0B;wBACf;AAEpB,SAASA,gBAAgBC,QAAgB,EAAEC,OAAe;IAC/D,MAAMC,WAAWF,WAAW,UAAUG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;IACvE,IAAI;QACFC,IAAAA,iBAAa,EAACL,UAAUD,SAAS;QACjCO,IAAAA,kBAAU,EAACN,UAAUF;IACvB,EAAE,OAAOS,GAAG;QACV,IAAI;YACFC,IAAAA,cAAU,EAACR;QACb,EAAE,OAAM;QACN,SAAS;QACX;QACA,MAAMO;IACR;AACF","ignoreList":[0]}