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:
10
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.d.ts
generated
vendored
Normal file
10
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* This is the default "use cache" handler it defaults to an in-memory store.
|
||||
* In-memory caches are fragile and should not use stale-while-revalidate
|
||||
* semantics on the caches because it's not worth warming up an entry that's
|
||||
* likely going to get evicted before we get to use it anyway. However, we also
|
||||
* don't want to reuse a stale entry for too long so stale entries should be
|
||||
* considered expired/missing in such cache handlers.
|
||||
*/
|
||||
import type { CacheHandler } from './types';
|
||||
export declare function createDefaultCacheHandler(maxSize: number): CacheHandler;
|
||||
7
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.d.ts
generated
vendored
Normal file
7
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Used for edge runtime compatibility.
|
||||
*
|
||||
* @deprecated Use createDefaultCacheHandler instead.
|
||||
*/
|
||||
declare const _default: import("./types").CacheHandler;
|
||||
export default _default;
|
||||
18
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.js
generated
vendored
Normal file
18
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, /**
|
||||
* Used for edge runtime compatibility.
|
||||
*
|
||||
* @deprecated Use createDefaultCacheHandler instead.
|
||||
*/ "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _default1;
|
||||
}
|
||||
});
|
||||
const _default = require("./default");
|
||||
const _default1 = (0, _default.createDefaultCacheHandler)(50 * 1024 * 1024);
|
||||
|
||||
//# sourceMappingURL=default.external.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.external.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/lib/cache-handlers/default.external.ts"],"sourcesContent":["import { createDefaultCacheHandler } from './default'\n\n/**\n * Used for edge runtime compatibility.\n *\n * @deprecated Use createDefaultCacheHandler instead.\n */\nexport default createDefaultCacheHandler(50 * 1024 * 1024)\n"],"names":["createDefaultCacheHandler"],"mappings":";;;;+BAEA;;;;CAIC,GACD;;;eAAA;;;yBAP0C;MAO1C,YAAeA,IAAAA,kCAAyB,EAAC,KAAK,OAAO","ignoreList":[0]}
|
||||
160
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.js
generated
vendored
Normal file
160
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* This is the default "use cache" handler it defaults to an in-memory store.
|
||||
* In-memory caches are fragile and should not use stale-while-revalidate
|
||||
* semantics on the caches because it's not worth warming up an entry that's
|
||||
* likely going to get evicted before we get to use it anyway. However, we also
|
||||
* don't want to reuse a stale entry for too long so stale entries should be
|
||||
* considered expired/missing in such cache handlers.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createDefaultCacheHandler", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createDefaultCacheHandler;
|
||||
}
|
||||
});
|
||||
const _lrucache = require("../lru-cache");
|
||||
const _tagsmanifestexternal = require("../incremental-cache/tags-manifest.external");
|
||||
function createDefaultCacheHandler(maxSize) {
|
||||
// If the max size is 0, return a cache handler that doesn't cache anything,
|
||||
// this avoids an unnecessary LRUCache instance and potential memory
|
||||
// allocation.
|
||||
if (maxSize === 0) {
|
||||
return {
|
||||
get: ()=>Promise.resolve(undefined),
|
||||
set: ()=>Promise.resolve(),
|
||||
refreshTags: ()=>Promise.resolve(),
|
||||
getExpiration: ()=>Promise.resolve(0),
|
||||
updateTags: ()=>Promise.resolve()
|
||||
};
|
||||
}
|
||||
const memoryCache = new _lrucache.LRUCache(maxSize, (entry)=>entry.size);
|
||||
const pendingSets = new Map();
|
||||
const debug = process.env.NEXT_PRIVATE_DEBUG_CACHE ? console.debug.bind(console, 'DefaultCacheHandler:') : undefined;
|
||||
return {
|
||||
async get (cacheKey) {
|
||||
const pendingPromise = pendingSets.get(cacheKey);
|
||||
if (pendingPromise) {
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'pending');
|
||||
await pendingPromise;
|
||||
}
|
||||
const privateEntry = memoryCache.get(cacheKey);
|
||||
if (!privateEntry) {
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'not found');
|
||||
return undefined;
|
||||
}
|
||||
const entry = privateEntry.entry;
|
||||
if (performance.timeOrigin + performance.now() > entry.timestamp + entry.revalidate * 1000) {
|
||||
// In-memory caches should expire after revalidate time because it is
|
||||
// unlikely that a new entry will be able to be used before it is dropped
|
||||
// from the cache.
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'expired');
|
||||
return undefined;
|
||||
}
|
||||
let revalidate = entry.revalidate;
|
||||
if ((0, _tagsmanifestexternal.areTagsExpired)(entry.tags, entry.timestamp)) {
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'had expired tag');
|
||||
return undefined;
|
||||
}
|
||||
if ((0, _tagsmanifestexternal.areTagsStale)(entry.tags, entry.timestamp)) {
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'had stale tag');
|
||||
revalidate = -1;
|
||||
}
|
||||
const [returnStream, newSaved] = entry.value.tee();
|
||||
entry.value = newSaved;
|
||||
debug == null ? void 0 : debug('get', cacheKey, 'found', {
|
||||
tags: entry.tags,
|
||||
timestamp: entry.timestamp,
|
||||
expire: entry.expire,
|
||||
revalidate
|
||||
});
|
||||
return {
|
||||
...entry,
|
||||
revalidate,
|
||||
value: returnStream
|
||||
};
|
||||
},
|
||||
async set (cacheKey, pendingEntry) {
|
||||
debug == null ? void 0 : debug('set', cacheKey, 'start');
|
||||
let resolvePending = ()=>{};
|
||||
const pendingPromise = new Promise((resolve)=>{
|
||||
resolvePending = resolve;
|
||||
});
|
||||
pendingSets.set(cacheKey, pendingPromise);
|
||||
const entry = await pendingEntry;
|
||||
let size = 0;
|
||||
try {
|
||||
const [value, clonedValue] = entry.value.tee();
|
||||
entry.value = value;
|
||||
const reader = clonedValue.getReader();
|
||||
for(let chunk; !(chunk = await reader.read()).done;){
|
||||
size += Buffer.from(chunk.value).byteLength;
|
||||
}
|
||||
memoryCache.set(cacheKey, {
|
||||
entry,
|
||||
isErrored: false,
|
||||
errorRetryCount: 0,
|
||||
size
|
||||
});
|
||||
debug == null ? void 0 : debug('set', cacheKey, 'done');
|
||||
} catch (err) {
|
||||
// TODO: store partial buffer with error after we retry 3 times
|
||||
debug == null ? void 0 : debug('set', cacheKey, 'failed', err);
|
||||
} finally{
|
||||
resolvePending();
|
||||
pendingSets.delete(cacheKey);
|
||||
}
|
||||
},
|
||||
async refreshTags () {
|
||||
// Nothing to do for an in-memory cache handler.
|
||||
},
|
||||
async getExpiration (tags) {
|
||||
const expirations = tags.map((tag)=>{
|
||||
const entry = _tagsmanifestexternal.tagsManifest.get(tag);
|
||||
if (!entry) return 0;
|
||||
// Return the most recent timestamp (either expired or stale)
|
||||
return entry.expired || 0;
|
||||
});
|
||||
const expiration = Math.max(...expirations, 0);
|
||||
debug == null ? void 0 : debug('getExpiration', {
|
||||
tags,
|
||||
expiration
|
||||
});
|
||||
return expiration;
|
||||
},
|
||||
async updateTags (tags, durations) {
|
||||
const now = Math.round(performance.timeOrigin + performance.now());
|
||||
debug == null ? void 0 : debug('updateTags', {
|
||||
tags,
|
||||
timestamp: now
|
||||
});
|
||||
for (const tag of tags){
|
||||
// TODO: update file-system-cache?
|
||||
const existingEntry = _tagsmanifestexternal.tagsManifest.get(tag) || {};
|
||||
if (durations) {
|
||||
// Use provided durations directly
|
||||
const updates = {
|
||||
...existingEntry
|
||||
};
|
||||
// mark as stale immediately
|
||||
updates.stale = now;
|
||||
if (durations.expire !== undefined) {
|
||||
updates.expired = now + durations.expire * 1000 // Convert seconds to ms
|
||||
;
|
||||
}
|
||||
_tagsmanifestexternal.tagsManifest.set(tag, updates);
|
||||
} else {
|
||||
// Update expired field for immediate expiration (default behavior when no durations provided)
|
||||
_tagsmanifestexternal.tagsManifest.set(tag, {
|
||||
...existingEntry,
|
||||
expired: now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=default.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/default.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
71
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.d.ts
generated
vendored
Normal file
71
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* A timestamp in milliseconds elapsed since the epoch
|
||||
*/
|
||||
export type Timestamp = number;
|
||||
export interface CacheEntry {
|
||||
/**
|
||||
* The ReadableStream can error and only have partial data so any cache
|
||||
* handlers need to handle this case and decide to keep the partial cache
|
||||
* around or not.
|
||||
*/
|
||||
value: ReadableStream<Uint8Array>;
|
||||
/**
|
||||
* The tags configured for the entry excluding soft tags
|
||||
*/
|
||||
tags: string[];
|
||||
/**
|
||||
* This is for the client, not used to calculate cache entry expiration
|
||||
* [duration in seconds]
|
||||
*/
|
||||
stale: number;
|
||||
/**
|
||||
* When the cache entry was created [timestamp in milliseconds]
|
||||
*/
|
||||
timestamp: Timestamp;
|
||||
/**
|
||||
* How long the entry is allowed to be used (should be longer than revalidate)
|
||||
* [duration in seconds]
|
||||
*/
|
||||
expire: number;
|
||||
/**
|
||||
* How long until the entry should be revalidated [duration in seconds]
|
||||
*/
|
||||
revalidate: number;
|
||||
}
|
||||
export interface CacheHandler {
|
||||
/**
|
||||
* Retrieve a cache entry for the given cache key, if available. Will return
|
||||
* undefined if there's no valid entry, or if the given soft tags are stale.
|
||||
*/
|
||||
get(cacheKey: string, softTags: string[]): Promise<undefined | CacheEntry>;
|
||||
/**
|
||||
* Store a cache entry for the given cache key. When this is called, the entry
|
||||
* may still be pending, i.e. its value stream may still be written to. So it
|
||||
* needs to be awaited first. If a `get` for the same cache key is called,
|
||||
* before the pending entry is complete, the cache handler must wait for the
|
||||
* `set` operation to finish, before returning the entry, instead of returning
|
||||
* undefined.
|
||||
*/
|
||||
set(cacheKey: string, pendingEntry: Promise<CacheEntry>): Promise<void>;
|
||||
/**
|
||||
* This function may be called periodically, but always before starting a new
|
||||
* request. If applicable, it should communicate with the tags service to
|
||||
* refresh the local tags manifest accordingly.
|
||||
*/
|
||||
refreshTags(): Promise<void>;
|
||||
/**
|
||||
* This function is called for each set of soft tags that are relevant at the
|
||||
* start of a request. The result is the maximum timestamp of a revalidate
|
||||
* event for the tags. Returns `0` if none of the tags were ever revalidated.
|
||||
* Returns `Infinity` if the soft tags are supposed to be passed into the
|
||||
* `get` method instead to be checked for expiration.
|
||||
*/
|
||||
getExpiration(tags: string[]): Promise<Timestamp>;
|
||||
/**
|
||||
* This function is called when tags are revalidated/expired. If applicable,
|
||||
* it should update the tags manifest accordingly.
|
||||
*/
|
||||
updateTags(tags: string[], durations?: {
|
||||
expire?: number;
|
||||
}): Promise<void>;
|
||||
}
|
||||
8
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.js
generated
vendored
Normal file
8
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* A timestamp in milliseconds elapsed since the epoch
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/lib/cache-handlers/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/lib/cache-handlers/types.ts"],"sourcesContent":["/**\n * A timestamp in milliseconds elapsed since the epoch\n */\nexport type Timestamp = number\n\nexport interface CacheEntry {\n /**\n * The ReadableStream can error and only have partial data so any cache\n * handlers need to handle this case and decide to keep the partial cache\n * around or not.\n */\n value: ReadableStream<Uint8Array>\n\n /**\n * The tags configured for the entry excluding soft tags\n */\n tags: string[]\n\n /**\n * This is for the client, not used to calculate cache entry expiration\n * [duration in seconds]\n */\n stale: number\n\n /**\n * When the cache entry was created [timestamp in milliseconds]\n */\n timestamp: Timestamp\n\n /**\n * How long the entry is allowed to be used (should be longer than revalidate)\n * [duration in seconds]\n */\n expire: number\n\n /**\n * How long until the entry should be revalidated [duration in seconds]\n */\n revalidate: number\n}\n\nexport interface CacheHandler {\n /**\n * Retrieve a cache entry for the given cache key, if available. Will return\n * undefined if there's no valid entry, or if the given soft tags are stale.\n */\n get(cacheKey: string, softTags: string[]): Promise<undefined | CacheEntry>\n\n /**\n * Store a cache entry for the given cache key. When this is called, the entry\n * may still be pending, i.e. its value stream may still be written to. So it\n * needs to be awaited first. If a `get` for the same cache key is called,\n * before the pending entry is complete, the cache handler must wait for the\n * `set` operation to finish, before returning the entry, instead of returning\n * undefined.\n */\n set(cacheKey: string, pendingEntry: Promise<CacheEntry>): Promise<void>\n\n /**\n * This function may be called periodically, but always before starting a new\n * request. If applicable, it should communicate with the tags service to\n * refresh the local tags manifest accordingly.\n */\n refreshTags(): Promise<void>\n\n /**\n * This function is called for each set of soft tags that are relevant at the\n * start of a request. The result is the maximum timestamp of a revalidate\n * event for the tags. Returns `0` if none of the tags were ever revalidated.\n * Returns `Infinity` if the soft tags are supposed to be passed into the\n * `get` method instead to be checked for expiration.\n */\n getExpiration(tags: string[]): Promise<Timestamp>\n\n /**\n * This function is called when tags are revalidated/expired. If applicable,\n * it should update the tags manifest accordingly.\n */\n updateTags(tags: string[], durations?: { expire?: number }): Promise<void>\n}\n"],"names":[],"mappings":"AAAA;;CAEC","ignoreList":[0]}
|
||||
Reference in New Issue
Block a user