@mohasinac/appkit 3.0.2 → 3.0.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.
@@ -1,3 +1,4 @@
1
+ import "server-only";
1
2
  import type { JsonValue } from "@mohasinac/appkit";
2
3
  type SendEmailOptions = Record<string, JsonValue> & {
3
4
  to: string | string[];
@@ -1,5 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { renderToStaticMarkup } from "react-dom/server";
2
+ import "server-only";
3
+ // Lazy-load `renderToStaticMarkup` via `require()` to avoid Next.js's
4
+ // Server-Component static-trace error. Even with the `server-only`
5
+ // directive above, a top-level `import { renderToStaticMarkup } from
6
+ // "react-dom/server"` is flagged by Next.js when any module in the
7
+ // re-export chain is reachable from a Server Component (e.g. layout.tsx
8
+ // → providers.config.ts → @mohasinac/appkit/server → ... → email.tsx).
9
+ // `require()` is opaque to Next's static analyser so the chain stops here.
10
+ function renderToStaticMarkup(el) {
11
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
12
+ const m = require("react-dom/server");
13
+ return m.renderToStaticMarkup(el);
14
+ }
3
15
  import { normalizeError } from "../../errors/normalize";
4
16
  import { getProviders } from "../../contracts";
5
17
  import { serverLogger } from "../../monitoring";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"