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,5 @@
import type { LoadedEnvFiles } from '@next/env';
export declare function createEnvDefinitions({ distDir, loadedEnvFiles, }: {
distDir: string;
loadedEnvFiles: LoadedEnvFiles;
}): Promise<string | undefined>;

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createEnvDefinitions", {
enumerable: true,
get: function() {
return createEnvDefinitions;
}
});
const _nodepath = require("node:path");
const _promises = require("node:fs/promises");
async function createEnvDefinitions({ distDir, loadedEnvFiles }) {
const envLines = [];
const seenKeys = new Set();
// env files are in order of priority
for (const { path, env } of loadedEnvFiles){
for(const key in env){
if (!seenKeys.has(key)) {
envLines.push(` /** Loaded from \`${path}\` */`);
envLines.push(` ${key}?: string`);
seenKeys.add(key);
}
}
}
const envStr = envLines.join('\n');
const definitionStr = `// Type definitions for Next.js environment variables
declare global {
namespace NodeJS {
interface ProcessEnv {
${envStr}
}
}
}
export {}`;
if (process.env.NODE_ENV === 'test') {
return definitionStr;
}
try {
// we expect the types directory to already exist
const envDtsPath = (0, _nodepath.join)(distDir, 'types', 'env.d.ts');
await (0, _promises.writeFile)(envDtsPath, definitionStr, 'utf-8');
} catch (e) {
console.error('Failed to write env.d.ts:', e);
}
}
//# sourceMappingURL=create-env-definitions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/lib/experimental/create-env-definitions.ts"],"sourcesContent":["import type { LoadedEnvFiles } from '@next/env'\nimport { join } from 'node:path'\nimport { writeFile } from 'node:fs/promises'\n\nexport async function createEnvDefinitions({\n distDir,\n loadedEnvFiles,\n}: {\n distDir: string\n loadedEnvFiles: LoadedEnvFiles\n}) {\n const envLines = []\n const seenKeys = new Set()\n // env files are in order of priority\n for (const { path, env } of loadedEnvFiles) {\n for (const key in env) {\n if (!seenKeys.has(key)) {\n envLines.push(` /** Loaded from \\`${path}\\` */`)\n envLines.push(` ${key}?: string`)\n seenKeys.add(key)\n }\n }\n }\n const envStr = envLines.join('\\n')\n\n const definitionStr = `// Type definitions for Next.js environment variables\ndeclare global {\n namespace NodeJS {\n interface ProcessEnv {\n${envStr}\n }\n }\n}\nexport {}`\n\n if (process.env.NODE_ENV === 'test') {\n return definitionStr\n }\n\n try {\n // we expect the types directory to already exist\n const envDtsPath = join(distDir, 'types', 'env.d.ts')\n await writeFile(envDtsPath, definitionStr, 'utf-8')\n } catch (e) {\n console.error('Failed to write env.d.ts:', e)\n }\n}\n"],"names":["createEnvDefinitions","distDir","loadedEnvFiles","envLines","seenKeys","Set","path","env","key","has","push","add","envStr","join","definitionStr","process","NODE_ENV","envDtsPath","writeFile","e","console","error"],"mappings":";;;;+BAIsBA;;;eAAAA;;;0BAHD;0BACK;AAEnB,eAAeA,qBAAqB,EACzCC,OAAO,EACPC,cAAc,EAIf;IACC,MAAMC,WAAW,EAAE;IACnB,MAAMC,WAAW,IAAIC;IACrB,qCAAqC;IACrC,KAAK,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAE,IAAIL,eAAgB;QAC1C,IAAK,MAAMM,OAAOD,IAAK;YACrB,IAAI,CAACH,SAASK,GAAG,CAACD,MAAM;gBACtBL,SAASO,IAAI,CAAC,CAAC,wBAAwB,EAAEJ,KAAK,KAAK,CAAC;gBACpDH,SAASO,IAAI,CAAC,CAAC,MAAM,EAAEF,IAAI,SAAS,CAAC;gBACrCJ,SAASO,GAAG,CAACH;YACf;QACF;IACF;IACA,MAAMI,SAAST,SAASU,IAAI,CAAC;IAE7B,MAAMC,gBAAgB,CAAC;;;;AAIzB,EAAEF,OAAO;;;;SAIA,CAAC;IAER,IAAIG,QAAQR,GAAG,CAACS,QAAQ,KAAK,QAAQ;QACnC,OAAOF;IACT;IAEA,IAAI;QACF,iDAAiD;QACjD,MAAMG,aAAaJ,IAAAA,cAAI,EAACZ,SAAS,SAAS;QAC1C,MAAMiB,IAAAA,mBAAS,EAACD,YAAYH,eAAe;IAC7C,EAAE,OAAOK,GAAG;QACVC,QAAQC,KAAK,CAAC,6BAA6BF;IAC7C;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,25 @@
/**
* If set to `incremental`, only those leaf pages that export
* `experimental_ppr = true` will have partial prerendering enabled. If any
* page exports this value as `false` or does not export it at all will not
* have partial prerendering enabled. If set to a boolean, the options for
* `experimental_ppr` will be ignored.
*/
export type ExperimentalPPRConfig = boolean | 'incremental';
/**
* Returns true if partial prerendering is enabled for the application. It does
* not tell you if a given route has PPR enabled, as that requires analysis of
* the route's configuration.
*
* @see {@link checkIsRoutePPREnabled} - for checking if a specific route has PPR enabled.
*/
export declare function checkIsAppPPREnabled(config: ExperimentalPPRConfig | undefined): boolean;
/**
* Returns true if partial prerendering is supported for the current page with
* the provided app configuration. If the application doesn't have partial
* prerendering enabled, this function will always return false. If you want to
* check if the application has partial prerendering enabled
*
* @see {@link checkIsAppPPREnabled} for checking if the application has PPR enabled.
*/
export declare function checkIsRoutePPREnabled(config: ExperimentalPPRConfig | undefined): boolean;

View File

@@ -0,0 +1,47 @@
/**
* If set to `incremental`, only those leaf pages that export
* `experimental_ppr = true` will have partial prerendering enabled. If any
* page exports this value as `false` or does not export it at all will not
* have partial prerendering enabled. If set to a boolean, the options for
* `experimental_ppr` will be ignored.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
checkIsAppPPREnabled: null,
checkIsRoutePPREnabled: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
checkIsAppPPREnabled: function() {
return checkIsAppPPREnabled;
},
checkIsRoutePPREnabled: function() {
return checkIsRoutePPREnabled;
}
});
function checkIsAppPPREnabled(config) {
// If the config is undefined, partial prerendering is disabled.
if (typeof config === 'undefined') return false;
// If the config is a boolean, use it directly.
if (typeof config === 'boolean') return config;
// If the config is a string, it must be 'incremental' to enable partial
// prerendering.
if (config === 'incremental') return true;
return false;
}
function checkIsRoutePPREnabled(config) {
// If the config is undefined, partial prerendering is disabled.
if (typeof config === 'undefined') return false;
// If the config is a boolean, use it directly.
if (typeof config === 'boolean') return config;
return false;
}
//# sourceMappingURL=ppr.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/lib/experimental/ppr.ts"],"sourcesContent":["/**\n * If set to `incremental`, only those leaf pages that export\n * `experimental_ppr = true` will have partial prerendering enabled. If any\n * page exports this value as `false` or does not export it at all will not\n * have partial prerendering enabled. If set to a boolean, the options for\n * `experimental_ppr` will be ignored.\n */\n\nexport type ExperimentalPPRConfig = boolean | 'incremental'\n\n/**\n * Returns true if partial prerendering is enabled for the application. It does\n * not tell you if a given route has PPR enabled, as that requires analysis of\n * the route's configuration.\n *\n * @see {@link checkIsRoutePPREnabled} - for checking if a specific route has PPR enabled.\n */\nexport function checkIsAppPPREnabled(\n config: ExperimentalPPRConfig | undefined\n): boolean {\n // If the config is undefined, partial prerendering is disabled.\n if (typeof config === 'undefined') return false\n\n // If the config is a boolean, use it directly.\n if (typeof config === 'boolean') return config\n\n // If the config is a string, it must be 'incremental' to enable partial\n // prerendering.\n if (config === 'incremental') return true\n\n return false\n}\n\n/**\n * Returns true if partial prerendering is supported for the current page with\n * the provided app configuration. If the application doesn't have partial\n * prerendering enabled, this function will always return false. If you want to\n * check if the application has partial prerendering enabled\n *\n * @see {@link checkIsAppPPREnabled} for checking if the application has PPR enabled.\n */\nexport function checkIsRoutePPREnabled(\n config: ExperimentalPPRConfig | undefined\n): boolean {\n // If the config is undefined, partial prerendering is disabled.\n if (typeof config === 'undefined') return false\n\n // If the config is a boolean, use it directly.\n if (typeof config === 'boolean') return config\n\n return false\n}\n"],"names":["checkIsAppPPREnabled","checkIsRoutePPREnabled","config"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;;;;;IAWeA,oBAAoB;eAApBA;;IAwBAC,sBAAsB;eAAtBA;;;AAxBT,SAASD,qBACdE,MAAyC;IAEzC,gEAAgE;IAChE,IAAI,OAAOA,WAAW,aAAa,OAAO;IAE1C,+CAA+C;IAC/C,IAAI,OAAOA,WAAW,WAAW,OAAOA;IAExC,wEAAwE;IACxE,gBAAgB;IAChB,IAAIA,WAAW,eAAe,OAAO;IAErC,OAAO;AACT;AAUO,SAASD,uBACdC,MAAyC;IAEzC,gEAAgE;IAChE,IAAI,OAAOA,WAAW,aAAa,OAAO;IAE1C,+CAA+C;IAC/C,IAAI,OAAOA,WAAW,WAAW,OAAOA;IAExC,OAAO;AACT","ignoreList":[0]}