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:
4
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.d.ts
generated
vendored
Normal file
4
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { Options as SWCOptions } from '@swc/core';
|
||||
export declare function registerHook(swcOptions: SWCOptions): void;
|
||||
export declare function deregisterHook(): void;
|
||||
export declare function requireFromString(code: string, filename: string): any;
|
||||
85
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.js
generated
vendored
Normal file
85
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
deregisterHook: null,
|
||||
registerHook: null,
|
||||
requireFromString: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
deregisterHook: function() {
|
||||
return deregisterHook;
|
||||
},
|
||||
registerHook: function() {
|
||||
return registerHook;
|
||||
},
|
||||
requireFromString: function() {
|
||||
return requireFromString;
|
||||
}
|
||||
});
|
||||
const _nodemodule = /*#__PURE__*/ _interop_require_default(require("node:module"));
|
||||
const _nodefs = require("node:fs");
|
||||
const _nodepath = require("node:path");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const oldJSHook = require.extensions['.js'];
|
||||
const extensions = [
|
||||
'.ts',
|
||||
'.cts',
|
||||
'.mts',
|
||||
'.cjs',
|
||||
'.mjs'
|
||||
];
|
||||
function registerHook(swcOptions) {
|
||||
// lazy require swc since it loads React before even setting NODE_ENV
|
||||
// resulting loading Development React on Production
|
||||
const { transformSync } = require('../swc');
|
||||
require.extensions['.js'] = function(mod, oldFilename) {
|
||||
try {
|
||||
return oldJSHook(mod, oldFilename);
|
||||
} catch (error) {
|
||||
if (error.code !== 'ERR_REQUIRE_ESM') {
|
||||
throw error;
|
||||
}
|
||||
// calling oldJSHook throws ERR_REQUIRE_ESM, so run _compile manually
|
||||
// TODO: investigate if we can remove readFileSync
|
||||
const content = (0, _nodefs.readFileSync)(oldFilename, 'utf8');
|
||||
const { code } = transformSync(content, swcOptions);
|
||||
mod._compile(code, oldFilename);
|
||||
}
|
||||
};
|
||||
for (const ext of extensions){
|
||||
const oldHook = require.extensions[ext] ?? oldJSHook;
|
||||
require.extensions[ext] = function(mod, oldFilename) {
|
||||
const _compile = mod._compile;
|
||||
mod._compile = function(code, filename) {
|
||||
const swc = transformSync(code, swcOptions);
|
||||
return _compile.call(this, swc.code, filename);
|
||||
};
|
||||
return oldHook(mod, oldFilename);
|
||||
};
|
||||
}
|
||||
}
|
||||
function deregisterHook() {
|
||||
require.extensions['.js'] = oldJSHook;
|
||||
extensions.forEach((ext)=>delete require.extensions[ext]);
|
||||
}
|
||||
function requireFromString(code, filename) {
|
||||
const paths = _nodemodule.default._nodeModulePaths((0, _nodepath.dirname)(filename));
|
||||
const m = new _nodemodule.default(filename, module.parent);
|
||||
m.paths = paths;
|
||||
m._compile(code, filename);
|
||||
return m.exports;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=require-hook.js.map
|
||||
1
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/build/next-config-ts/require-hook.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/build/next-config-ts/require-hook.ts"],"sourcesContent":["import type { Options as SWCOptions } from '@swc/core'\nimport Module from 'node:module'\nimport { readFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\n\nconst oldJSHook = require.extensions['.js']\nconst extensions = ['.ts', '.cts', '.mts', '.cjs', '.mjs']\n\nexport function registerHook(swcOptions: SWCOptions) {\n // lazy require swc since it loads React before even setting NODE_ENV\n // resulting loading Development React on Production\n const { transformSync } = require('../swc') as typeof import('../swc')\n\n require.extensions['.js'] = function (mod: any, oldFilename) {\n try {\n return oldJSHook(mod, oldFilename)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ERR_REQUIRE_ESM') {\n throw error\n }\n\n // calling oldJSHook throws ERR_REQUIRE_ESM, so run _compile manually\n // TODO: investigate if we can remove readFileSync\n const content = readFileSync(oldFilename, 'utf8')\n const { code } = transformSync(content, swcOptions)\n mod._compile(code, oldFilename)\n }\n }\n\n for (const ext of extensions) {\n const oldHook = require.extensions[ext] ?? oldJSHook\n require.extensions[ext] = function (mod: any, oldFilename) {\n const _compile = mod._compile\n\n mod._compile = function (code: string, filename: string) {\n const swc = transformSync(code, swcOptions)\n return _compile.call(this, swc.code, filename)\n }\n\n return oldHook(mod, oldFilename)\n }\n }\n}\n\nexport function deregisterHook() {\n require.extensions['.js'] = oldJSHook\n extensions.forEach((ext) => delete require.extensions[ext])\n}\n\nexport function requireFromString(code: string, filename: string) {\n const paths = (Module as any)._nodeModulePaths(dirname(filename))\n const m = new Module(filename, module.parent!) as any\n m.paths = paths\n m._compile(code, filename)\n return m.exports\n}\n"],"names":["deregisterHook","registerHook","requireFromString","oldJSHook","require","extensions","swcOptions","transformSync","mod","oldFilename","error","code","content","readFileSync","_compile","ext","oldHook","filename","swc","call","forEach","paths","Module","_nodeModulePaths","dirname","m","module","parent","exports"],"mappings":";;;;;;;;;;;;;;;;IA4CgBA,cAAc;eAAdA;;IApCAC,YAAY;eAAZA;;IAyCAC,iBAAiB;eAAjBA;;;mEAhDG;wBACU;0BACL;;;;;;AAExB,MAAMC,YAAYC,QAAQC,UAAU,CAAC,MAAM;AAC3C,MAA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IAC5CF,EAAEJ,KAAK,GAAGA;IACVI,EAAEX,QAAQ,CAACH,MAAMM;IACjB,OAAOQ,EAAEG,OAAO;AAClB","ignoreList":[0]}
|
||||
5
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.d.ts
generated
vendored
Normal file
5
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare function transpileConfig({ nextConfigPath, configFileName, cwd, }: {
|
||||
nextConfigPath: string;
|
||||
configFileName: string;
|
||||
cwd: string;
|
||||
}): Promise<any>;
|
||||
172
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.js
generated
vendored
Normal file
172
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "transpileConfig", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return transpileConfig;
|
||||
}
|
||||
});
|
||||
const _nodepath = require("node:path");
|
||||
const _promises = require("node:fs/promises");
|
||||
const _nodeurl = require("node:url");
|
||||
const _requirehook = require("./require-hook");
|
||||
const _log = require("../output/log");
|
||||
const _installdependencies = require("../../lib/install-dependencies");
|
||||
const _utils = require("../../server/lib/utils");
|
||||
function resolveSWCOptions(cwd, compilerOptions) {
|
||||
var _process_versions, _process;
|
||||
return {
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript'
|
||||
},
|
||||
...compilerOptions.paths ? {
|
||||
paths: compilerOptions.paths
|
||||
} : {},
|
||||
...compilerOptions.baseUrl ? {
|
||||
baseUrl: (0, _nodepath.resolve)(cwd, compilerOptions.baseUrl)
|
||||
} : compilerOptions.paths ? {
|
||||
baseUrl: cwd
|
||||
} : {}
|
||||
},
|
||||
module: {
|
||||
type: 'commonjs'
|
||||
},
|
||||
isModule: 'unknown',
|
||||
env: {
|
||||
targets: {
|
||||
// Setting the Node.js version can reduce unnecessary code generation.
|
||||
node: ((_process = process) == null ? void 0 : (_process_versions = _process.versions) == null ? void 0 : _process_versions.node) ?? '20.19.0'
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
// Ported from next/src/lib/verify-typescript-setup.ts
|
||||
// Although this overlaps with the later `verifyTypeScriptSetup`,
|
||||
// it is acceptable since the time difference in the worst case is trivial,
|
||||
// as we are only preparing to install the dependencies once more.
|
||||
async function verifyTypeScriptSetup(cwd, configFileName) {
|
||||
try {
|
||||
// Quick module check.
|
||||
require.resolve('typescript', {
|
||||
paths: [
|
||||
cwd
|
||||
]
|
||||
});
|
||||
} catch (error) {
|
||||
if (error && typeof error === 'object' && 'code' in error && error.code === 'MODULE_NOT_FOUND') {
|
||||
(0, _log.warn)(`Installing TypeScript as it was not found while loading "${configFileName}".`);
|
||||
await (0, _installdependencies.installDependencies)(cwd, [
|
||||
{
|
||||
pkg: 'typescript'
|
||||
}
|
||||
], true).catch((err)=>{
|
||||
if (err && typeof err === 'object' && 'command' in err) {
|
||||
console.error(`Failed to install TypeScript, please install it manually to continue:\n` + err.command + '\n');
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function getTsConfig(cwd) {
|
||||
const ts = require(require.resolve('typescript', {
|
||||
paths: [
|
||||
cwd
|
||||
]
|
||||
}));
|
||||
// NOTE: This doesn't fully cover the edge case for setting
|
||||
// "typescript.tsconfigPath" in next config which is currently
|
||||
// a restriction.
|
||||
const tsConfigPath = ts.findConfigFile(cwd, ts.sys.fileExists, 'tsconfig.json');
|
||||
if (!tsConfigPath) {
|
||||
// It is ok to not return ts.getDefaultCompilerOptions() because
|
||||
// we are only looking for paths and baseUrl from tsConfig.
|
||||
return {};
|
||||
}
|
||||
const configFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
|
||||
const parsedCommandLine = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);
|
||||
return parsedCommandLine.options;
|
||||
}
|
||||
async function transpileConfig({ nextConfigPath, configFileName, cwd }) {
|
||||
try {
|
||||
// envs are passed to the workers and preserve the flag
|
||||
if (process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED === 'true') {
|
||||
try {
|
||||
// Node.js v22.10.0+
|
||||
// Value is 'strip' or 'transform' based on how the feature is enabled.
|
||||
// https://nodejs.org/api/process.html#processfeaturestypescript
|
||||
// TODO: Remove `as any` once we bump @types/node to v22.10.0+
|
||||
if (process.features.typescript) {
|
||||
// Run import() here to catch errors and fallback to legacy resolution.
|
||||
return (await import((0, _nodeurl.pathToFileURL)(nextConfigPath).href)).default;
|
||||
}
|
||||
if ((0, _utils.getNodeOptionsArgs)().includes('--no-experimental-strip-types') || process.execArgv.includes('--no-experimental-strip-types')) {
|
||||
(0, _log.warnOnce)(`Skipped resolving "${configFileName}" using Node.js native TypeScript resolution because it was disabled by the "--no-experimental-strip-types" flag.` + ' Falling back to legacy resolution.' + ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts');
|
||||
}
|
||||
// Feature is not enabled, fallback to legacy resolution for current session.
|
||||
process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false';
|
||||
} catch (cause) {
|
||||
(0, _log.warnOnce)(`Failed to import "${configFileName}" using Node.js native TypeScript resolution.` + ' Falling back to legacy resolution.' + ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts', {
|
||||
cause
|
||||
});
|
||||
// Once failed, fallback to legacy resolution for current session.
|
||||
process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false';
|
||||
}
|
||||
}
|
||||
// Ensure TypeScript is installed to use the API.
|
||||
await verifyTypeScriptSetup(cwd, configFileName);
|
||||
const compilerOptions = await getTsConfig(cwd);
|
||||
return handleCJS({
|
||||
cwd,
|
||||
nextConfigPath,
|
||||
compilerOptions
|
||||
});
|
||||
} catch (cause) {
|
||||
throw Object.defineProperty(new Error(`Failed to transpile "${configFileName}".`, {
|
||||
cause
|
||||
}), "__NEXT_ERROR_CODE", {
|
||||
value: "E797",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
async function handleCJS({ cwd, nextConfigPath, compilerOptions }) {
|
||||
const swcOptions = resolveSWCOptions(cwd, compilerOptions);
|
||||
let hasRequire = false;
|
||||
try {
|
||||
var _config_experimental;
|
||||
const nextConfigString = await (0, _promises.readFile)(nextConfigPath, 'utf8');
|
||||
// lazy require swc since it loads React before even setting NODE_ENV
|
||||
// resulting loading Development React on Production
|
||||
const { loadBindings } = require('../swc');
|
||||
const bindings = await loadBindings();
|
||||
const { code } = await bindings.transform(nextConfigString, swcOptions);
|
||||
// register require hook only if require exists
|
||||
if (code.includes('require(')) {
|
||||
(0, _requirehook.registerHook)(swcOptions);
|
||||
hasRequire = true;
|
||||
}
|
||||
// filename & extension don't matter here
|
||||
const config = (0, _requirehook.requireFromString)(code, (0, _nodepath.resolve)(cwd, 'next.config.compiled.js'));
|
||||
// At this point we have already loaded the bindings without this configuration setting due to the `transform` call above.
|
||||
// Possibly we fell back to wasm in which case, it all works out but if not we need to warn
|
||||
// that the configuration was ignored.
|
||||
if ((config == null ? void 0 : (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useWasmBinary) && !bindings.isWasm) {
|
||||
(0, _log.warn)('Using a next.config.ts file is incompatible with `experimental.useWasmBinary` unless ' + '`--experimental-next-config-strip-types` is also passed.\nSetting `useWasmBinary` to `false');
|
||||
config.experimental.useWasmBinary = false;
|
||||
}
|
||||
return config;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally{
|
||||
if (hasRequire) {
|
||||
(0, _requirehook.deregisterHook)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=transpile-config.js.map
|
||||
1
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/build/next-config-ts/transpile-config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user