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:
63
apps/public-web/node_modules/next/dist/shared/lib/side-effect.js
generated
vendored
Normal file
63
apps/public-web/node_modules/next/dist/shared/lib/side-effect.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return SideEffect;
|
||||
}
|
||||
});
|
||||
const _react = require("react");
|
||||
const isServer = typeof window === 'undefined';
|
||||
const useClientOnlyLayoutEffect = isServer ? ()=>{} : _react.useLayoutEffect;
|
||||
const useClientOnlyEffect = isServer ? ()=>{} : _react.useEffect;
|
||||
function SideEffect(props) {
|
||||
const { headManager, reduceComponentsToState } = props;
|
||||
function emitChange() {
|
||||
if (headManager && headManager.mountedInstances) {
|
||||
const headElements = _react.Children.toArray(Array.from(headManager.mountedInstances).filter(Boolean));
|
||||
headManager.updateHead(reduceComponentsToState(headElements));
|
||||
}
|
||||
}
|
||||
if (isServer) {
|
||||
headManager?.mountedInstances?.add(props.children);
|
||||
emitChange();
|
||||
}
|
||||
useClientOnlyLayoutEffect(()=>{
|
||||
headManager?.mountedInstances?.add(props.children);
|
||||
return ()=>{
|
||||
headManager?.mountedInstances?.delete(props.children);
|
||||
};
|
||||
});
|
||||
// We need to call `updateHead` method whenever the `SideEffect` is trigger in all
|
||||
// life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s
|
||||
// being rendered, we only trigger the method from the last one.
|
||||
// This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate`
|
||||
// singleton in the layout effect pass, and actually trigger it in the effect pass.
|
||||
useClientOnlyLayoutEffect(()=>{
|
||||
if (headManager) {
|
||||
headManager._pendingUpdate = emitChange;
|
||||
}
|
||||
return ()=>{
|
||||
if (headManager) {
|
||||
headManager._pendingUpdate = emitChange;
|
||||
}
|
||||
};
|
||||
});
|
||||
useClientOnlyEffect(()=>{
|
||||
if (headManager && headManager._pendingUpdate) {
|
||||
headManager._pendingUpdate();
|
||||
headManager._pendingUpdate = null;
|
||||
}
|
||||
return ()=>{
|
||||
if (headManager && headManager._pendingUpdate) {
|
||||
headManager._pendingUpdate();
|
||||
headManager._pendingUpdate = null;
|
||||
}
|
||||
};
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=side-effect.js.map
|
||||
Reference in New Issue
Block a user