@publish.os/nextjs 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +7 -0
  2. package/dist/cache/tags.cjs +76 -0
  3. package/dist/cache/tags.d.cts +12 -0
  4. package/dist/cache/tags.d.ts +12 -0
  5. package/dist/cache/tags.js +51 -0
  6. package/dist/components/color-palette.cjs +408 -0
  7. package/dist/components/color-palette.d.cts +5 -0
  8. package/dist/components/color-palette.d.ts +5 -0
  9. package/dist/components/color-palette.js +388 -0
  10. package/dist/components/nav-breadcrumb.cjs +141 -0
  11. package/dist/components/nav-breadcrumb.d.cts +9 -0
  12. package/dist/components/nav-breadcrumb.d.ts +9 -0
  13. package/dist/components/nav-breadcrumb.js +107 -0
  14. package/dist/components/page-list.cjs +68 -0
  15. package/dist/components/page-list.d.cts +11 -0
  16. package/dist/components/page-list.d.ts +11 -0
  17. package/dist/components/page-list.js +33 -0
  18. package/dist/components/providers.cjs +44 -0
  19. package/dist/components/providers.d.cts +8 -0
  20. package/dist/components/providers.d.ts +8 -0
  21. package/dist/components/providers.js +20 -0
  22. package/dist/components/site-header.cjs +302 -0
  23. package/dist/components/site-header.d.cts +12 -0
  24. package/dist/components/site-header.d.ts +12 -0
  25. package/dist/components/site-header.js +268 -0
  26. package/dist/components/theme-toggle.cjs +147 -0
  27. package/dist/components/theme-toggle.d.cts +5 -0
  28. package/dist/components/theme-toggle.d.ts +5 -0
  29. package/dist/components/theme-toggle.js +123 -0
  30. package/dist/config/createNextConfig.cjs +52 -0
  31. package/dist/config/createNextConfig.d.cts +8 -0
  32. package/dist/config/createNextConfig.d.ts +8 -0
  33. package/dist/config/createNextConfig.js +27 -0
  34. package/dist/index.cjs +347 -0
  35. package/dist/index.d.cts +14 -0
  36. package/dist/index.d.ts +14 -0
  37. package/dist/index.js +299 -0
  38. package/dist/layouts/group.cjs +157 -0
  39. package/dist/layouts/group.d.cts +15 -0
  40. package/dist/layouts/group.d.ts +15 -0
  41. package/dist/layouts/group.js +132 -0
  42. package/dist/mdx/error-boundary.cjs +94 -0
  43. package/dist/mdx/error-boundary.d.cts +13 -0
  44. package/dist/mdx/error-boundary.d.ts +13 -0
  45. package/dist/mdx/error-boundary.js +70 -0
  46. package/dist/mdx/error-fallback.cjs +58 -0
  47. package/dist/mdx/error-fallback.d.cts +9 -0
  48. package/dist/mdx/error-fallback.d.ts +9 -0
  49. package/dist/mdx/error-fallback.js +33 -0
  50. package/dist/mdx/mdx.cjs +182 -0
  51. package/dist/mdx/mdx.d.cts +10 -0
  52. package/dist/mdx/mdx.d.ts +10 -0
  53. package/dist/mdx/mdx.js +147 -0
  54. package/dist/pages/group.cjs +162 -0
  55. package/dist/pages/group.d.cts +15 -0
  56. package/dist/pages/group.d.ts +15 -0
  57. package/dist/pages/group.js +136 -0
  58. package/dist/pages/leaf.cjs +203 -0
  59. package/dist/pages/leaf.d.cts +23 -0
  60. package/dist/pages/leaf.d.ts +23 -0
  61. package/dist/pages/leaf.js +176 -0
  62. package/dist/pages/root.cjs +127 -0
  63. package/dist/pages/root.d.cts +14 -0
  64. package/dist/pages/root.d.ts +14 -0
  65. package/dist/pages/root.js +101 -0
  66. package/dist/resolvers/manifest-resolver.cjs +107 -0
  67. package/dist/resolvers/manifest-resolver.d.cts +13 -0
  68. package/dist/resolvers/manifest-resolver.d.ts +13 -0
  69. package/dist/resolvers/manifest-resolver.js +79 -0
  70. package/dist/routes/llms.cjs +101 -0
  71. package/dist/routes/llms.d.cts +7 -0
  72. package/dist/routes/llms.d.ts +7 -0
  73. package/dist/routes/llms.js +76 -0
  74. package/dist/routes/robots.cjs +94 -0
  75. package/dist/routes/robots.d.cts +5 -0
  76. package/dist/routes/robots.d.ts +5 -0
  77. package/dist/routes/robots.js +69 -0
  78. package/dist/routes/sitemap.cjs +108 -0
  79. package/dist/routes/sitemap.d.cts +5 -0
  80. package/dist/routes/sitemap.d.ts +5 -0
  81. package/dist/routes/sitemap.js +83 -0
  82. package/dist/types.cjs +18 -0
  83. package/dist/types.d.cts +144 -0
  84. package/dist/types.d.ts +144 -0
  85. package/dist/types.js +0 -0
  86. package/dist/utils/cn.cjs +49 -0
  87. package/dist/utils/cn.d.cts +15 -0
  88. package/dist/utils/cn.d.ts +15 -0
  89. package/dist/utils/cn.js +24 -0
  90. package/dist/utils/pretty-date.cjs +55 -0
  91. package/dist/utils/pretty-date.d.cts +6 -0
  92. package/dist/utils/pretty-date.d.ts +6 -0
  93. package/dist/utils/pretty-date.js +30 -0
  94. package/package.json +100 -0
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/layouts/group.tsx
21
+ var group_exports = {};
22
+ __export(group_exports, {
23
+ createGroupLayout: () => createGroupLayout
24
+ });
25
+ module.exports = __toCommonJS(group_exports);
26
+ var import_cache = require("next/cache");
27
+ var import_navigation = require("next/navigation");
28
+
29
+ // src/cache/tags.ts
30
+ var import_node_crypto = require("crypto");
31
+ var MAX_TAG_LEN = 256;
32
+ var MAX_SEGMENT_LEN = 80;
33
+ var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
34
+ function sha256(value) {
35
+ return (0, import_node_crypto.createHash)("sha256").update(value).digest("hex").slice(0, 16);
36
+ }
37
+ function safeSegment(value) {
38
+ const raw = value.trim().toLowerCase() || "root";
39
+ const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
40
+ const segment = normalized || "root";
41
+ if (segment.length <= MAX_SEGMENT_LEN) return segment;
42
+ return `${segment.slice(0, 48)}.${sha256(segment)}`;
43
+ }
44
+ function assertTag(tag) {
45
+ if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
46
+ return `tag:${sha256(tag)}`;
47
+ }
48
+ return tag;
49
+ }
50
+ var tags = {
51
+ site() {
52
+ return "site";
53
+ },
54
+ pages() {
55
+ return "pages";
56
+ },
57
+ group(group) {
58
+ return assertTag(`group:${safeSegment(group)}`);
59
+ },
60
+ page(group, slug) {
61
+ const path = Array.isArray(slug) ? slug.join("/") : slug;
62
+ return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
63
+ },
64
+ manifest(contentHash) {
65
+ return assertTag(`manifest:${safeSegment(contentHash)}`);
66
+ },
67
+ sitemap() {
68
+ return "sitemap";
69
+ },
70
+ robots() {
71
+ return "robots";
72
+ },
73
+ llms(scope = "root") {
74
+ return assertTag(`llms:${safeSegment(scope)}`);
75
+ }
76
+ };
77
+
78
+ // src/internal/utils/logger.ts
79
+ var isDev = process.env.NODE_ENV !== "production";
80
+ var log = {
81
+ debug(...args) {
82
+ if (isDev) console.debug("[publish.os:debug]", ...args);
83
+ },
84
+ info(...args) {
85
+ console.log("[publish.os]", ...args);
86
+ },
87
+ warn(...args) {
88
+ console.warn("[publish.os:warn]", ...args);
89
+ },
90
+ error(...args) {
91
+ console.error("[publish.os:error]", ...args);
92
+ }
93
+ };
94
+
95
+ // src/resolvers/manifest-resolver.ts
96
+ function groupNode(group) {
97
+ return {
98
+ type: "section",
99
+ id: group.key,
100
+ title: group.title,
101
+ path: group.path,
102
+ group: group.key,
103
+ children: group.tree
104
+ };
105
+ }
106
+ function resolveGroup(manifest, group) {
107
+ const groupData = manifest.groups[group];
108
+ if (!groupData) return null;
109
+ return {
110
+ site: manifest.site,
111
+ tree: groupData.tree,
112
+ node: groupNode(groupData),
113
+ currentPath: groupData.path,
114
+ group
115
+ };
116
+ }
117
+ function resolveGroupLayout(manifest, group, children) {
118
+ const resolved = resolveGroup(manifest, group);
119
+ if (!resolved) return null;
120
+ return { ...resolved, children };
121
+ }
122
+
123
+ // src/layouts/group.tsx
124
+ var import_jsx_runtime = require("react/jsx-runtime");
125
+ var manifests = /* @__PURE__ */ new Map();
126
+ var layouts = /* @__PURE__ */ new Map();
127
+ async function CachedGroupLayoutData({ group }) {
128
+ "use cache";
129
+ (0, import_cache.cacheLife)("page");
130
+ (0, import_cache.cacheTag)(tags.site(), tags.group(group));
131
+ const manifest = manifests.get(group);
132
+ if (!manifest) (0, import_navigation.notFound)();
133
+ (0, import_cache.cacheTag)(tags.manifest(manifest.contentHash));
134
+ log.debug("[cache]", `${group}/layout`);
135
+ const resolved = resolveGroupLayout(manifest, group, null);
136
+ if (!resolved) (0, import_navigation.notFound)();
137
+ return resolved;
138
+ }
139
+ function createGroupLayout({
140
+ group,
141
+ manifest,
142
+ Layout
143
+ }) {
144
+ manifests.set(group, manifest);
145
+ layouts.set(group, Layout);
146
+ return async function GroupLayout({ children }) {
147
+ log.debug("[render]", `${group}/layout`);
148
+ const Layout2 = layouts.get(group);
149
+ if (!Layout2) (0, import_navigation.notFound)();
150
+ const resolved = await CachedGroupLayoutData({ group });
151
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layout2, { ...resolved, children });
152
+ };
153
+ }
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ createGroupLayout
157
+ });
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { ManifestLike, LayoutProps } from '../types.cjs';
4
+
5
+ type LayoutComponent = (props: LayoutProps) => ReactElement | Promise<ReactElement>;
6
+ type GroupLayoutConfig = {
7
+ group: string;
8
+ manifest: ManifestLike;
9
+ Layout: LayoutComponent;
10
+ };
11
+ declare function createGroupLayout({ group, manifest, Layout, }: GroupLayoutConfig): ({ children }: {
12
+ children: ReactNode;
13
+ }) => Promise<react_jsx_runtime.JSX.Element>;
14
+
15
+ export { type GroupLayoutConfig, type LayoutComponent, createGroupLayout };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { ManifestLike, LayoutProps } from '../types.js';
4
+
5
+ type LayoutComponent = (props: LayoutProps) => ReactElement | Promise<ReactElement>;
6
+ type GroupLayoutConfig = {
7
+ group: string;
8
+ manifest: ManifestLike;
9
+ Layout: LayoutComponent;
10
+ };
11
+ declare function createGroupLayout({ group, manifest, Layout, }: GroupLayoutConfig): ({ children }: {
12
+ children: ReactNode;
13
+ }) => Promise<react_jsx_runtime.JSX.Element>;
14
+
15
+ export { type GroupLayoutConfig, type LayoutComponent, createGroupLayout };
@@ -0,0 +1,132 @@
1
+ // src/layouts/group.tsx
2
+ import { cacheLife, cacheTag } from "next/cache";
3
+ import { notFound } from "next/navigation";
4
+
5
+ // src/cache/tags.ts
6
+ import { createHash } from "crypto";
7
+ var MAX_TAG_LEN = 256;
8
+ var MAX_SEGMENT_LEN = 80;
9
+ var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
10
+ function sha256(value) {
11
+ return createHash("sha256").update(value).digest("hex").slice(0, 16);
12
+ }
13
+ function safeSegment(value) {
14
+ const raw = value.trim().toLowerCase() || "root";
15
+ const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
16
+ const segment = normalized || "root";
17
+ if (segment.length <= MAX_SEGMENT_LEN) return segment;
18
+ return `${segment.slice(0, 48)}.${sha256(segment)}`;
19
+ }
20
+ function assertTag(tag) {
21
+ if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
22
+ return `tag:${sha256(tag)}`;
23
+ }
24
+ return tag;
25
+ }
26
+ var tags = {
27
+ site() {
28
+ return "site";
29
+ },
30
+ pages() {
31
+ return "pages";
32
+ },
33
+ group(group) {
34
+ return assertTag(`group:${safeSegment(group)}`);
35
+ },
36
+ page(group, slug) {
37
+ const path = Array.isArray(slug) ? slug.join("/") : slug;
38
+ return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
39
+ },
40
+ manifest(contentHash) {
41
+ return assertTag(`manifest:${safeSegment(contentHash)}`);
42
+ },
43
+ sitemap() {
44
+ return "sitemap";
45
+ },
46
+ robots() {
47
+ return "robots";
48
+ },
49
+ llms(scope = "root") {
50
+ return assertTag(`llms:${safeSegment(scope)}`);
51
+ }
52
+ };
53
+
54
+ // src/internal/utils/logger.ts
55
+ var isDev = process.env.NODE_ENV !== "production";
56
+ var log = {
57
+ debug(...args) {
58
+ if (isDev) console.debug("[publish.os:debug]", ...args);
59
+ },
60
+ info(...args) {
61
+ console.log("[publish.os]", ...args);
62
+ },
63
+ warn(...args) {
64
+ console.warn("[publish.os:warn]", ...args);
65
+ },
66
+ error(...args) {
67
+ console.error("[publish.os:error]", ...args);
68
+ }
69
+ };
70
+
71
+ // src/resolvers/manifest-resolver.ts
72
+ function groupNode(group) {
73
+ return {
74
+ type: "section",
75
+ id: group.key,
76
+ title: group.title,
77
+ path: group.path,
78
+ group: group.key,
79
+ children: group.tree
80
+ };
81
+ }
82
+ function resolveGroup(manifest, group) {
83
+ const groupData = manifest.groups[group];
84
+ if (!groupData) return null;
85
+ return {
86
+ site: manifest.site,
87
+ tree: groupData.tree,
88
+ node: groupNode(groupData),
89
+ currentPath: groupData.path,
90
+ group
91
+ };
92
+ }
93
+ function resolveGroupLayout(manifest, group, children) {
94
+ const resolved = resolveGroup(manifest, group);
95
+ if (!resolved) return null;
96
+ return { ...resolved, children };
97
+ }
98
+
99
+ // src/layouts/group.tsx
100
+ import { jsx } from "react/jsx-runtime";
101
+ var manifests = /* @__PURE__ */ new Map();
102
+ var layouts = /* @__PURE__ */ new Map();
103
+ async function CachedGroupLayoutData({ group }) {
104
+ "use cache";
105
+ cacheLife("page");
106
+ cacheTag(tags.site(), tags.group(group));
107
+ const manifest = manifests.get(group);
108
+ if (!manifest) notFound();
109
+ cacheTag(tags.manifest(manifest.contentHash));
110
+ log.debug("[cache]", `${group}/layout`);
111
+ const resolved = resolveGroupLayout(manifest, group, null);
112
+ if (!resolved) notFound();
113
+ return resolved;
114
+ }
115
+ function createGroupLayout({
116
+ group,
117
+ manifest,
118
+ Layout
119
+ }) {
120
+ manifests.set(group, manifest);
121
+ layouts.set(group, Layout);
122
+ return async function GroupLayout({ children }) {
123
+ log.debug("[render]", `${group}/layout`);
124
+ const Layout2 = layouts.get(group);
125
+ if (!Layout2) notFound();
126
+ const resolved = await CachedGroupLayoutData({ group });
127
+ return /* @__PURE__ */ jsx(Layout2, { ...resolved, children });
128
+ };
129
+ }
130
+ export {
131
+ createGroupLayout
132
+ };
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/mdx/error-boundary.tsx
22
+ var error_boundary_exports = {};
23
+ __export(error_boundary_exports, {
24
+ MDXErrorBoundary: () => MDXErrorBoundary
25
+ });
26
+ module.exports = __toCommonJS(error_boundary_exports);
27
+ var import_error = require("next/error");
28
+
29
+ // src/mdx/error-fallback.tsx
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function MDXErrorFallback({
32
+ errorMessage = "An error occurred while rendering the content",
33
+ pageId,
34
+ slug
35
+ }) {
36
+ const isMdxError = errorMessage.includes("[next-mdx-remote]");
37
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-lg border border-red-500/25 bg-red-500/10 p-6 text-red-800", children: [
39
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold", children: "Content Error" }),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2 text-sm", children: isMdxError ? "There is an issue with the MDX content formatting." : errorMessage }),
41
+ isMdxError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "mt-3 max-h-40 overflow-auto rounded bg-red-500/10 p-3 text-xs", children: errorMessage }),
42
+ (pageId || slug) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "mt-3 text-xs opacity-80", children: [
43
+ "Page: ",
44
+ pageId ?? "unknown",
45
+ " \xB7 Slug: ",
46
+ slug ?? "unknown"
47
+ ] }),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-3 text-sm", children: "If you are the owner of this site, update your page to fix the error." })
49
+ ] }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-6 flex flex-col gap-2 opacity-60", children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4" }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4 w-3/5" }),
53
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-1/3 rounded bg-foreground-4 mb-4" }),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4" }),
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-2/3 rounded bg-foreground-4" })
56
+ ] })
57
+ ] });
58
+ }
59
+
60
+ // src/mdx/error-boundary.tsx
61
+ var import_jsx_runtime2 = require("react/jsx-runtime");
62
+ function MDXRenderErrorFallback(props, { error }) {
63
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
64
+ MDXErrorFallback,
65
+ {
66
+ errorMessage: props.errorMessage ?? error.message,
67
+ pageId: props.pageId,
68
+ slug: props.slug
69
+ }
70
+ );
71
+ }
72
+ var MDXRenderErrorBoundary = (0, import_error.unstable_catchError)(MDXRenderErrorFallback);
73
+ function MDXErrorBoundary({
74
+ errorMessage,
75
+ pageId,
76
+ slug,
77
+ children
78
+ }) {
79
+ if (errorMessage) {
80
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
81
+ MDXErrorFallback,
82
+ {
83
+ errorMessage,
84
+ pageId,
85
+ slug
86
+ }
87
+ );
88
+ }
89
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MDXRenderErrorBoundary, { pageId, slug, children });
90
+ }
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ MDXErrorBoundary
94
+ });
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type MdxErrorBoundaryProps = {
5
+ errorMessage?: string;
6
+ pageId?: string;
7
+ slug?: string;
8
+ children: ReactNode;
9
+ };
10
+
11
+ declare function MDXErrorBoundary({ errorMessage, pageId, slug, children, }: MdxErrorBoundaryProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { MDXErrorBoundary };
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type MdxErrorBoundaryProps = {
5
+ errorMessage?: string;
6
+ pageId?: string;
7
+ slug?: string;
8
+ children: ReactNode;
9
+ };
10
+
11
+ declare function MDXErrorBoundary({ errorMessage, pageId, slug, children, }: MdxErrorBoundaryProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { MDXErrorBoundary };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+
3
+ // src/mdx/error-boundary.tsx
4
+ import { unstable_catchError as catchError } from "next/error";
5
+
6
+ // src/mdx/error-fallback.tsx
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ function MDXErrorFallback({
9
+ errorMessage = "An error occurred while rendering the content",
10
+ pageId,
11
+ slug
12
+ }) {
13
+ const isMdxError = errorMessage.includes("[next-mdx-remote]");
14
+ return /* @__PURE__ */ jsxs("div", { children: [
15
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-red-500/25 bg-red-500/10 p-6 text-red-800", children: [
16
+ /* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Content Error" }),
17
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm", children: isMdxError ? "There is an issue with the MDX content formatting." : errorMessage }),
18
+ isMdxError && /* @__PURE__ */ jsx("pre", { className: "mt-3 max-h-40 overflow-auto rounded bg-red-500/10 p-3 text-xs", children: errorMessage }),
19
+ (pageId || slug) && /* @__PURE__ */ jsxs("p", { className: "mt-3 text-xs opacity-80", children: [
20
+ "Page: ",
21
+ pageId ?? "unknown",
22
+ " \xB7 Slug: ",
23
+ slug ?? "unknown"
24
+ ] }),
25
+ /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm", children: "If you are the owner of this site, update your page to fix the error." })
26
+ ] }),
27
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex flex-col gap-2 opacity-60", children: [
28
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4" }),
29
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4 w-3/5" }),
30
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-1/3 rounded bg-foreground-4 mb-4" }),
31
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4" }),
32
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-2/3 rounded bg-foreground-4" })
33
+ ] })
34
+ ] });
35
+ }
36
+
37
+ // src/mdx/error-boundary.tsx
38
+ import { jsx as jsx2 } from "react/jsx-runtime";
39
+ function MDXRenderErrorFallback(props, { error }) {
40
+ return /* @__PURE__ */ jsx2(
41
+ MDXErrorFallback,
42
+ {
43
+ errorMessage: props.errorMessage ?? error.message,
44
+ pageId: props.pageId,
45
+ slug: props.slug
46
+ }
47
+ );
48
+ }
49
+ var MDXRenderErrorBoundary = catchError(MDXRenderErrorFallback);
50
+ function MDXErrorBoundary({
51
+ errorMessage,
52
+ pageId,
53
+ slug,
54
+ children
55
+ }) {
56
+ if (errorMessage) {
57
+ return /* @__PURE__ */ jsx2(
58
+ MDXErrorFallback,
59
+ {
60
+ errorMessage,
61
+ pageId,
62
+ slug
63
+ }
64
+ );
65
+ }
66
+ return /* @__PURE__ */ jsx2(MDXRenderErrorBoundary, { pageId, slug, children });
67
+ }
68
+ export {
69
+ MDXErrorBoundary
70
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/mdx/error-fallback.tsx
21
+ var error_fallback_exports = {};
22
+ __export(error_fallback_exports, {
23
+ MDXErrorFallback: () => MDXErrorFallback
24
+ });
25
+ module.exports = __toCommonJS(error_fallback_exports);
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ function MDXErrorFallback({
28
+ errorMessage = "An error occurred while rendering the content",
29
+ pageId,
30
+ slug
31
+ }) {
32
+ const isMdxError = errorMessage.includes("[next-mdx-remote]");
33
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-lg border border-red-500/25 bg-red-500/10 p-6 text-red-800", children: [
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold", children: "Content Error" }),
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2 text-sm", children: isMdxError ? "There is an issue with the MDX content formatting." : errorMessage }),
37
+ isMdxError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "mt-3 max-h-40 overflow-auto rounded bg-red-500/10 p-3 text-xs", children: errorMessage }),
38
+ (pageId || slug) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "mt-3 text-xs opacity-80", children: [
39
+ "Page: ",
40
+ pageId ?? "unknown",
41
+ " \xB7 Slug: ",
42
+ slug ?? "unknown"
43
+ ] }),
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-3 text-sm", children: "If you are the owner of this site, update your page to fix the error." })
45
+ ] }),
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-6 flex flex-col gap-2 opacity-60", children: [
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4" }),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4 w-3/5" }),
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-1/3 rounded bg-foreground-4 mb-4" }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 rounded bg-foreground-4" }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-2/3 rounded bg-foreground-4" })
52
+ ] })
53
+ ] });
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ MDXErrorFallback
58
+ });
@@ -0,0 +1,9 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function MDXErrorFallback({ errorMessage, pageId, slug, }: {
4
+ errorMessage?: string;
5
+ pageId?: string;
6
+ slug?: string;
7
+ }): react_jsx_runtime.JSX.Element;
8
+
9
+ export { MDXErrorFallback };
@@ -0,0 +1,9 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function MDXErrorFallback({ errorMessage, pageId, slug, }: {
4
+ errorMessage?: string;
5
+ pageId?: string;
6
+ slug?: string;
7
+ }): react_jsx_runtime.JSX.Element;
8
+
9
+ export { MDXErrorFallback };
@@ -0,0 +1,33 @@
1
+ // src/mdx/error-fallback.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ function MDXErrorFallback({
4
+ errorMessage = "An error occurred while rendering the content",
5
+ pageId,
6
+ slug
7
+ }) {
8
+ const isMdxError = errorMessage.includes("[next-mdx-remote]");
9
+ return /* @__PURE__ */ jsxs("div", { children: [
10
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-red-500/25 bg-red-500/10 p-6 text-red-800", children: [
11
+ /* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Content Error" }),
12
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm", children: isMdxError ? "There is an issue with the MDX content formatting." : errorMessage }),
13
+ isMdxError && /* @__PURE__ */ jsx("pre", { className: "mt-3 max-h-40 overflow-auto rounded bg-red-500/10 p-3 text-xs", children: errorMessage }),
14
+ (pageId || slug) && /* @__PURE__ */ jsxs("p", { className: "mt-3 text-xs opacity-80", children: [
15
+ "Page: ",
16
+ pageId ?? "unknown",
17
+ " \xB7 Slug: ",
18
+ slug ?? "unknown"
19
+ ] }),
20
+ /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm", children: "If you are the owner of this site, update your page to fix the error." })
21
+ ] }),
22
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex flex-col gap-2 opacity-60", children: [
23
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4" }),
24
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4 w-3/5" }),
25
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-1/3 rounded bg-foreground-4 mb-4" }),
26
+ /* @__PURE__ */ jsx("div", { className: "h-4 rounded bg-foreground-4" }),
27
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-2/3 rounded bg-foreground-4" })
28
+ ] })
29
+ ] });
30
+ }
31
+ export {
32
+ MDXErrorFallback
33
+ };