- 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
78 lines
2.6 KiB
JavaScript
78 lines
2.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
0 && (module.exports = {
|
|
default: null,
|
|
getProperError: null
|
|
});
|
|
function _export(target, all) {
|
|
for(var name in all)Object.defineProperty(target, name, {
|
|
enumerable: true,
|
|
get: all[name]
|
|
});
|
|
}
|
|
_export(exports, {
|
|
/**
|
|
* Checks whether the given value is a NextError.
|
|
* This can be used to print a more detailed error message with properties like `code` & `digest`.
|
|
*/ default: function() {
|
|
return isError;
|
|
},
|
|
getProperError: function() {
|
|
return getProperError;
|
|
}
|
|
});
|
|
const _isplainobject = require("../shared/lib/is-plain-object");
|
|
/**
|
|
* This is a safe stringify function that handles circular references.
|
|
* We're using a simpler version here to avoid introducing
|
|
* the dependency `safe-stable-stringify` into production bundle.
|
|
*
|
|
* This helper is used both in development and production.
|
|
*/ function safeStringifyLite(obj) {
|
|
const seen = new WeakSet();
|
|
return JSON.stringify(obj, (_key, value)=>{
|
|
// If value is an object and already seen, replace with "[Circular]"
|
|
if (typeof value === 'object' && value !== null) {
|
|
if (seen.has(value)) {
|
|
return '[Circular]';
|
|
}
|
|
seen.add(value);
|
|
}
|
|
return value;
|
|
});
|
|
}
|
|
function isError(err) {
|
|
return typeof err === 'object' && err !== null && 'name' in err && 'message' in err;
|
|
}
|
|
function getProperError(err) {
|
|
if (isError(err)) {
|
|
return err;
|
|
}
|
|
if (process.env.NODE_ENV === 'development') {
|
|
// provide better error for case where `throw undefined`
|
|
// is called in development
|
|
if (typeof err === 'undefined') {
|
|
return Object.defineProperty(new Error('An undefined error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
|
|
value: "E98",
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
}
|
|
if (err === null) {
|
|
return Object.defineProperty(new Error('A null error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
|
|
value: "E336",
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
return Object.defineProperty(new Error((0, _isplainobject.isPlainObject)(err) ? safeStringifyLite(err) : err + ''), "__NEXT_ERROR_CODE", {
|
|
value: "E394",
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
}
|
|
|
|
//# sourceMappingURL=is-error.js.map
|