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:
59
apps/public-web/node_modules/next/dist/esm/client/app-link-gc.js
generated
vendored
Normal file
59
apps/public-web/node_modules/next/dist/esm/client/app-link-gc.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
export function linkGc() {
|
||||
// TODO-APP: Remove this logic when Float has GC built-in in development.
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const callback = (mutationList)=>{
|
||||
for (const mutation of mutationList){
|
||||
if (mutation.type === 'childList') {
|
||||
for (const node of mutation.addedNodes){
|
||||
if ('tagName' in node && node.tagName === 'LINK') {
|
||||
const link = node;
|
||||
if (link.dataset.precedence?.startsWith('next')) {
|
||||
const href = link.getAttribute('href');
|
||||
if (href) {
|
||||
const [resource, version] = href.split('?v=', 2);
|
||||
if (version) {
|
||||
const currentOrigin = window.location.origin;
|
||||
const allLinks = [
|
||||
...document.querySelectorAll('link[href^="' + resource + '"]'),
|
||||
// It's possible that the resource is a full URL or only pathname,
|
||||
// so we need to remove the alternative href as well.
|
||||
...document.querySelectorAll('link[href^="' + (resource.startsWith(currentOrigin) ? resource.slice(currentOrigin.length) : currentOrigin + resource) + '"]')
|
||||
];
|
||||
for (const otherLink of allLinks){
|
||||
if (otherLink.dataset.precedence?.startsWith('next')) {
|
||||
const otherHref = otherLink.getAttribute('href');
|
||||
if (otherHref) {
|
||||
const [, otherVersion] = otherHref.split('?v=', 2);
|
||||
if (!otherVersion || +otherVersion < +version) {
|
||||
// Delay the removal of the stylesheet to avoid FOUC
|
||||
// caused by `@font-face` rules, as they seem to be
|
||||
// a couple of ticks delayed between the old and new
|
||||
// styles being swapped even if the font is cached.
|
||||
setTimeout(()=>{
|
||||
otherLink.remove();
|
||||
}, 5);
|
||||
const preloadLink = document.querySelector(`link[rel="preload"][as="style"][href="${otherHref}"]`);
|
||||
if (preloadLink) {
|
||||
preloadLink.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// Create an observer instance linked to the callback function
|
||||
const observer = new MutationObserver(callback);
|
||||
observer.observe(document.head, {
|
||||
childList: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-link-gc.js.map
|
||||
Reference in New Issue
Block a user