hazo_blog 2.27.0 → 2.27.3

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.
package/CHANGE_LOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes are documented here. This project follows
4
4
  [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## 2.27.3 — 2026-11-23
7
+
8
+ **Bug fix: blog post pages crash when MDX content contains unknown JSX components.** `BlogContentClient`'s MDX renderer threw `"Expected component 'X' to be defined"` at render time when the compiled MDX contained JSX tags (e.g. `<Tip>`, `<Note>`) not registered in the `mdxComponents` map. Because the error fired inside React's render cycle (outside the existing `useMemo` try/catch that only guarded Function construction), it escaped into the RSC stream as `E{"digest":"…"}`, triggering the host's error boundary — "Something went wrong" on the entire page.
9
+
10
+ - **Fix (Proxy)**: `mdxComponents` is now a `Proxy` that returns the lowercase string tag name for any unknown component lookup, so `<Tip>` renders as `<tip>` (a valid HTML element) instead of crashing.
11
+ - **Fix (error boundary)**: `<Content>` render is wrapped in a new `MdxErrorBoundary` class component that catches any remaining render errors and shows "Content could not be rendered." instead of crashing the page.
12
+
13
+ Bumps 2.27.2 -> 2.27.3 (patch — bug fix, no DDL, no breaking API change).
14
+
15
+ ## 2.27.1 — 2026-11-23
16
+
17
+ **Bug fix: blog post pages crash with RSC serialization error on production builds.** `BlogContent` (the server component that renders MDX post bodies) used `MDXRemote` from `next-mdx-remote/rsc`, which compiled MDX and returned live React elements that had to pass through RSC serialization. On some production builds — where the bundled MDX compiler and its unified/remark ecosystem are resolved differently — these elements couldn't be serialized, producing `E{"digest":"…"}` in the RSC payload. The initial SSR HTML rendered fine (server saw the elements directly), but the client error boundary fired as soon as hydration read the broken RSC stream, replacing the content with "Something went wrong."
18
+
19
+ - **Fix**: `BlogContent` now compiles MDX to a `function-body` string via `@mdx-js/mdx`'s `compile()` (server side), passes that plain string to a new `BlogContentClient` ("use client") component, which evaluates it at hydration time using the `react/jsx-runtime` and renders with the standard `mdxComponents` map (`BlogImage`, `YouTube`, `Callout`, `CodeBlock`, `InlineCode`). The compiled MDX is a plain string — trivially RSC-serializable.
20
+ - **New file**: `src/next/blog-content-client.tsx` — minimal "use client" MDX renderer. No dependency on `next-mdx-remote`'s client bundle (avoids a dual-React SSR issue) — evaluates the compiled function-body directly with `Reflect.construct(Function, ...)` + `react/jsx-runtime`.
21
+ - **Admin preview for draft posts**: `PostPreview` button now shows for any post with a slug (was gated on `status === "published"`). Preview URL appends `?preview=true` for non-published posts. `createBlogPostPage`'s `Page` and `generateMetadata` functions accept `searchParams` and pass `includeUnpublished: true` when `preview=true`. Preview is **auth-gated**: the page calls `config.authorize()` (the host's admin guard) with a synthetic `Request` built from `next/headers` — unauthenticated visitors adding `?preview=true` get the same 404 as without it.
22
+ - **New shim**: `next/headers` added to `src/next-shims.d.ts` for standalone type-checking.
23
+
24
+ Bumps 2.27.0 -> 2.27.1 (patch — bug fix + preview UX improvement, no DDL, no breaking API change).
25
+
6
26
  ## 2.27.0 — 2026-11-21
7
27
 
8
28
  **Theme duplicate + export (Phase 2 ticket 23, D59).** No DDL — both features are built entirely on top of ticket 06's existing theme storage/validation pipeline and ticket 22's export surface; no new table or column. Two new `ThemeService` methods plus one new guard on an existing one:
@@ -0,0 +1,6 @@
1
+ import * as runtime from "react/jsx-runtime";
2
+ export interface BlogContentClientProps {
3
+ compiledSource: string;
4
+ }
5
+ export declare function BlogContentClient({ compiledSource }: BlogContentClientProps): runtime.JSX.Element;
6
+ //# sourceMappingURL=blog-content-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog-content-client.d.ts","sourceRoot":"","sources":["../../src/next/blog-content-client.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAwB7C,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,MAAM,CAAC;CACxB;AAoBD,wBAAgB,iBAAiB,CAAC,EAAE,cAAc,EAAE,EAAE,sBAAsB,uBA+B3E"}
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Component, useMemo } from "react";
4
+ import * as runtime from "react/jsx-runtime";
5
+ import { BlogImage } from "../components/mdx/blog-image.js";
6
+ import { YouTube } from "../components/mdx/youtube.js";
7
+ import { Callout } from "../components/mdx/callout.js";
8
+ import { CodeBlock, InlineCode } from "../components/mdx/code-block.js";
9
+ const knownComponents = {
10
+ BlogImage,
11
+ YouTube,
12
+ Callout,
13
+ pre: CodeBlock,
14
+ code: InlineCode,
15
+ };
16
+ // Proxy returns a passthrough <div> for any JSX tag not in knownComponents,
17
+ // preventing the "Expected component `X` to be defined" MDX runtime error.
18
+ const mdxComponents = new Proxy(knownComponents, {
19
+ get(target, prop) {
20
+ if (typeof prop === "string" && prop in target)
21
+ return target[prop];
22
+ if (typeof prop === "string")
23
+ return prop;
24
+ return undefined;
25
+ },
26
+ });
27
+ class MdxErrorBoundary extends Component {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.state = { hasError: false };
31
+ }
32
+ static getDerivedStateFromError() {
33
+ return { hasError: true };
34
+ }
35
+ render() {
36
+ if (this.state.hasError) {
37
+ return (_jsx("p", { className: "text-muted-foreground", children: "Content could not be rendered." }));
38
+ }
39
+ return this.props.children;
40
+ }
41
+ }
42
+ export function BlogContentClient({ compiledSource }) {
43
+ const Content = useMemo(() => {
44
+ const scope = { opts: runtime };
45
+ const keys = Object.keys(scope);
46
+ const values = Object.values(scope);
47
+ try {
48
+ const hydrateFn = Reflect.construct(Function, keys.concat(compiledSource));
49
+ return hydrateFn.apply(hydrateFn, values).default;
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }, [compiledSource]);
55
+ if (!Content) {
56
+ return (_jsx("div", { className: "prose prose-zinc max-w-none dark:prose-invert", children: _jsx("p", { className: "text-muted-foreground", children: "Content could not be rendered." }) }));
57
+ }
58
+ return (_jsx("div", { className: "prose prose-zinc max-w-none dark:prose-invert", children: _jsx(MdxErrorBoundary, { children: _jsx(Content, { components: mdxComponents }) }) }));
59
+ }
@@ -1,7 +1,7 @@
1
1
  import type { ResolvedBlogConfig } from "../types/index.js";
2
2
  export interface BlogContentProps {
3
3
  source: string;
4
- config: ResolvedBlogConfig;
4
+ config?: ResolvedBlogConfig;
5
5
  }
6
- export declare function BlogContent({ source, config }: BlogContentProps): Promise<import("react/jsx-runtime").JSX.Element>;
6
+ export declare function BlogContent({ source }: BlogContentProps): Promise<import("react/jsx-runtime").JSX.Element>;
7
7
  //# sourceMappingURL=blog-content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blog-content.d.ts","sourceRoot":"","sources":["../../src/next/blog-content.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAa5D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,wBAAsB,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,gBAAgB,oDAiBrE"}
1
+ {"version":3,"file":"blog-content.d.ts","sourceRoot":"","sources":["../../src/next/blog-content.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAM5D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,wBAAsB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,oDAe7D"}
@@ -1,29 +1,26 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- // Server component that renders raw MDX to HTML at build/ISR time via
3
- // next-mdx-remote/rsc, merging the default embed registry with host overrides.
4
- // Calls MDXRemote as an async function so compilation errors are caught server-
5
- // side with try/catch before they can fail the SSG build for the whole page.
6
- import { MDXRemote } from "next-mdx-remote/rsc";
2
+ // Server component that compiles MDX to a function-body string, then hands it
3
+ // to a client component for hydration.
4
+ //
5
+ // The previous version used next-mdx-remote/rsc's MDXRemote which returned
6
+ // live React elements that had to pass through RSC serialization — this broke
7
+ // on some production builds where the bundled MDX compiler produced elements
8
+ // the RSC stream couldn't serialize (E{"digest":"…"} in the RSC payload).
9
+ // Compiling to a plain string avoids that: strings serialize trivially.
10
+ import { compile } from "@mdx-js/mdx";
7
11
  import remarkGfm from "remark-gfm";
8
- import { defaultMdxComponents } from "../components/mdx/index.js";
9
12
  import { sanitizeMdx } from "../lib/text.js";
13
+ import { BlogContentClient } from "./blog-content-client.js";
10
14
  import en from "../locales/en.json" with { type: "json" };
11
15
  import { createPackageT } from "hazo_core/i18n";
12
16
  const t = createPackageT("hazo_blog", en);
13
- // MDXRemote is an async RSC but TypeScript surfaces it as ComponentType via
14
- // React 18 JSX types. Cast to the actual async-function signature so we can
15
- // call it with await + try/catch to prevent one broken post from failing the
16
- // entire SSG build.
17
- const renderMDX = MDXRemote;
18
- export async function BlogContent({ source, config }) {
19
- const components = { ...defaultMdxComponents, ...(config.mdxComponents ?? {}) };
17
+ export async function BlogContent({ source }) {
20
18
  try {
21
- const content = await renderMDX({
22
- source: sanitizeMdx(source),
23
- components,
24
- options: { mdxOptions: { remarkPlugins: [remarkGfm] } },
19
+ const compiled = await compile(sanitizeMdx(source), {
20
+ outputFormat: "function-body",
21
+ remarkPlugins: [remarkGfm],
25
22
  });
26
- return _jsx("div", { className: "prose prose-zinc max-w-none dark:prose-invert", children: content });
23
+ return _jsx(BlogContentClient, { compiledSource: String(compiled) });
27
24
  }
28
25
  catch (error) {
29
26
  console.error("[hazo_blog] MDX compile failed:", error);
@@ -2,7 +2,7 @@ import type { BlogConfig } from "../types/index.js";
2
2
  type Metadata = Record<string, unknown>;
3
3
  /** Sealed post page: /blog/[slug] */
4
4
  export declare function createBlogPostPage(rawConfig: BlogConfig): {
5
- default: ({ params, }: {
5
+ default: ({ params, searchParams, }: {
6
6
  params: Promise<{
7
7
  slug: string;
8
8
  locale?: string;
@@ -10,8 +10,9 @@ export declare function createBlogPostPage(rawConfig: BlogConfig): {
10
10
  slug: string;
11
11
  locale?: string;
12
12
  };
13
+ searchParams?: Promise<Record<string, string>> | Record<string, string>;
13
14
  }) => Promise<import("react/jsx-runtime").JSX.Element>;
14
- generateMetadata: ({ params, }: {
15
+ generateMetadata: ({ params, searchParams, }: {
15
16
  params: Promise<{
16
17
  slug: string;
17
18
  locale?: string;
@@ -19,6 +20,7 @@ export declare function createBlogPostPage(rawConfig: BlogConfig): {
19
20
  slug: string;
20
21
  locale?: string;
21
22
  };
23
+ searchParams?: Promise<Record<string, string>> | Record<string, string>;
22
24
  }) => Promise<Metadata>;
23
25
  generateStaticParams: () => Promise<{
24
26
  slug: string;
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/next/pages.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AAI3E,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAexC,qCAAqC;AACrC,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,UAAU;2BAyDnD;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,GAAG;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACxF;oCAzCE;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,GAAG;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACxF,KAAG,OAAO,CAAC,QAAQ,CAAC;;;;;;;EAyEtB;AAED,+BAA+B;AAC/B,w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C;KACpD,KAAG,OAAO,CAAC,QAAQ,CAAC;;EAStB;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,UAAU;;EA0E5D;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,UAAU;;EAqB3D;AAED,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,UAAU;2BAOxD;QACD,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,GAAG;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACtD;EAwBF"}
@@ -10,6 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  // export const { default, generateMetadata, generateStaticParams,
11
11
  // revalidate, dynamicParams } = createBlogPostPage(blogConfig);
12
12
  import { notFound } from "next/navigation";
13
+ import { headers } from "next/headers";
13
14
  import Link from "next/link";
14
15
  import { createBlogService, resolveConfig } from "../service/index.js";
15
16
  import { AdminFormClient } from "./admin-client.js";
@@ -52,9 +53,30 @@ export function createBlogPostPage(rawConfig) {
52
53
  const slugs = await service.getAllSlugs(false);
53
54
  return slugs.map((s) => ({ slug: s.slug, locale: s.locale ?? defaultLocale }));
54
55
  }
55
- async function generateMetadata({ params, }) {
56
+ async function canPreview(sp) {
57
+ if (sp.preview !== "true")
58
+ return false;
59
+ try {
60
+ const h = await headers();
61
+ const req = new Request("http://localhost/preview", { headers: h });
62
+ return !!(await config.authorize(req));
63
+ }
64
+ catch {
65
+ return false;
66
+ }
67
+ }
68
+ async function generateMetadata({ params, searchParams, }) {
56
69
  const { slug, locale } = params instanceof Promise ? await params : params;
57
- const post = await service.getPost(slug, locale ? { locale } : undefined);
70
+ const sp = searchParams
71
+ ? searchParams instanceof Promise
72
+ ? await searchParams
73
+ : searchParams
74
+ : {};
75
+ const isPreview = await canPreview(sp);
76
+ const post = await service.getPost(slug, {
77
+ ...(locale ? { locale } : {}),
78
+ ...(isPreview ? { includeUnpublished: true } : {}),
79
+ });
58
80
  if (!post)
59
81
  return { title: t("post_page.not_found_title") };
60
82
  const canonical = canonicalFor(config, post);
@@ -87,9 +109,18 @@ export function createBlogPostPage(rawConfig) {
87
109
  twitter: { card: "summary_large_image", title: post.title, images: [image] },
88
110
  };
89
111
  }
90
- async function Page({ params, }) {
112
+ async function Page({ params, searchParams, }) {
91
113
  const { slug, locale } = params instanceof Promise ? await params : params;
92
- const post = await service.getPost(slug, locale ? { locale } : undefined);
114
+ const sp = searchParams
115
+ ? searchParams instanceof Promise
116
+ ? await searchParams
117
+ : searchParams
118
+ : {};
119
+ const isPreview = await canPreview(sp);
120
+ const post = await service.getPost(slug, {
121
+ ...(locale ? { locale } : {}),
122
+ ...(isPreview ? { includeUnpublished: true } : {}),
123
+ });
93
124
  if (!post)
94
125
  notFound();
95
126
  const author = await service.resolveAuthor(post);
@@ -69,9 +69,9 @@ export function BlogAdminPanel({ fetchFn, basePath, blogBasePath = "/blog", sett
69
69
  admin.setLocale(next === admin.availableLocales[0] ? null : next);
70
70
  }, className: "rounded-md border border-zinc-200 bg-white px-2 py-1 text-sm text-zinc-900 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100", children: admin.availableLocales.map((l) => (_jsx("option", { value: l, children: l }, l))) })] })), _jsx("button", { type: "button", onClick: openCreate, className: "rounded-lg bg-zinc-900 px-4 py-2 text-sm font-medium text-white hover:opacity-90 dark:bg-zinc-100 dark:text-zinc-900", children: t("blog_admin_panel.new_post_button") })] })] }), admin.postsError && (_jsx("p", { className: "text-sm text-red-600 dark:text-red-400", children: t("blog_admin_panel.error_prefix", { message: admin.postsError }) })), admin.postsLoading && admin.posts.length === 0 ? (_jsx("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: t("blog_admin_panel.loading_posts") })) : (_jsx(PostListTable, { posts: admin.posts, blogBasePath: blogBasePath, onEdit: openEdit, onDelete: handleDelete, availableLocales: admin.availableLocales, onTranslate: handleTranslate }))] }), _jsxs("section", { children: [_jsx("h2", { className: "mb-3 text-lg font-semibold", children: t("blog_admin_panel.index_layout_heading") }), admin.settingsError && (_jsx("p", { className: "mb-2 text-sm text-red-600 dark:text-red-400", children: t("blog_admin_panel.error_prefix", { message: admin.settingsError }) })), admin.settingsState && (_jsx(LayoutSelector, { value: admin.settingsState.settings.indexLayout, persisted: admin.settingsState.persisted, onSelect: (next) => admin.updateSettings({ indexLayout: next }) }))] }), _jsx(PanelDialog, { open: dialogOpen, onClose: closeDialog, title: dialogTarget
71
71
  ? t("blog_admin_panel.edit_post_title")
72
- : t("blog_admin_panel.new_post_title"), headerActions: dialogTarget?.status === "published" ? (_jsx("button", { type: "button", onClick: () => setShowPreview((p) => !p), className: `rounded-md border px-3 py-1 text-xs font-medium transition-colors ${showPreview
72
+ : t("blog_admin_panel.new_post_title"), headerActions: dialogTarget?.slug ? (_jsx("button", { type: "button", onClick: () => setShowPreview((p) => !p), className: `rounded-md border px-3 py-1 text-xs font-medium transition-colors ${showPreview
73
73
  ? "border-zinc-900 bg-zinc-900 text-white dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-900"
74
- : "border-zinc-200 text-zinc-600 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800"}`, children: showPreview ? t("blog_admin_panel.hide_preview") : t("blog_admin_panel.preview") })) : undefined, sideContent: showPreview && dialogTarget?.slug ? (_jsx(PostPreview, { url: `${blogBasePath.replace(/\/$/, "")}/${dialogTarget.slug}` })) : undefined, children: _jsx(PostForm, { post: dialogTarget ?? null, categories: admin.categories, endpoint: basePath, imageUploadEndpoint: resolvedImageUploadPath, fetchFn: fetchFn, onCancel: closeDialog, onSaved: () => {
74
+ : "border-zinc-200 text-zinc-600 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800"}`, children: showPreview ? t("blog_admin_panel.hide_preview") : t("blog_admin_panel.preview") })) : undefined, sideContent: showPreview && dialogTarget?.slug ? (_jsx(PostPreview, { url: `${blogBasePath.replace(/\/$/, "")}/${dialogTarget.slug}${dialogTarget.status !== "published" ? "?preview=true" : ""}` })) : undefined, children: _jsx(PostForm, { post: dialogTarget ?? null, categories: admin.categories, endpoint: basePath, imageUploadEndpoint: resolvedImageUploadPath, fetchFn: fetchFn, onCancel: closeDialog, onSaved: () => {
75
75
  closeDialog();
76
76
  void admin.refetchPosts();
77
77
  } }) })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_blog",
3
- "version": "2.27.0",
3
+ "version": "2.27.3",
4
4
  "description": "SEO-optimized blogging package: posts, categories, tags, MDX content, and GA4/GSC/Bing-ready SEO.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -110,11 +110,11 @@
110
110
  "@types/node": "^22.10.0",
111
111
  "@types/react": "^19.0.0",
112
112
  "@types/react-dom": "^19.0.0",
113
- "hazo_api": "^2.10.0",
114
- "hazo_connect": "^4.3.5",
113
+ "hazo_api": "^2.12.0",
114
+ "hazo_connect": "^4.6.1",
115
115
  "hazo_core": "^2.5.0",
116
116
  "hazo_files": "^3.7.0",
117
- "hazo_ui": "^6.21.0",
117
+ "hazo_ui": "^6.24.0",
118
118
  "jest": "^30.2.0",
119
119
  "jest-environment-node": "^30.2.0",
120
120
  "next": "^16.0.10",