@soloworks/smking-next 0.21.4 → 0.21.5
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/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/src/lib/path.ts +16 -0
- package/src/lib/proxy.ts +6 -0
- package/src/lib/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @soloworks/smking-next
|
|
2
2
|
|
|
3
|
+
## 0.21.5 — 2026-07-20
|
|
4
|
+
|
|
5
|
+
**AEO path discovery now works on Vercel without replacing host proxy responses.**
|
|
6
|
+
|
|
7
|
+
- The Page Zero proxy forwards the concrete request URL and pathname to App
|
|
8
|
+
Router Server Components before continuing the customer's existing proxy.
|
|
9
|
+
- `<SmkingAEO />` now looks up the requested route instead of falling back to
|
|
10
|
+
`/` when Vercel omits pathname headers.
|
|
11
|
+
- Customer redirects, rewrites, cookies, and response headers remain owned by
|
|
12
|
+
the customer's proxy.
|
|
13
|
+
|
|
3
14
|
## 0.21.4 — 2026-07-20
|
|
4
15
|
|
|
5
16
|
**Doctor checks now validate the actual App Router root and the public API contract.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soloworks/smking-next",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.5",
|
|
4
4
|
"description": "AI-native SEO (AEO) for Next.js — auto-inject JSON-LD, FAQ, AI summary, and SEO metadata so AI crawlers (ChatGPT, Perplexity, Google AI) can cite your pages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sillyleo/smking/tree/main/packages/smking-next",
|
package/src/lib/path.ts
CHANGED
|
@@ -39,6 +39,22 @@ export async function resolveRequestPath(): Promise<{
|
|
|
39
39
|
return { path, url };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Add the concrete request URL to the headers consumed by Server Components.
|
|
44
|
+
*
|
|
45
|
+
* Next.js does not expose the current pathname from `headers()` by default on
|
|
46
|
+
* Vercel. The Page Zero proxy runs before the App Router, so it records the
|
|
47
|
+
* verified `NextRequest.nextUrl` on the same request before the host proxy
|
|
48
|
+
* continues. Existing host proxy responses remain untouched.
|
|
49
|
+
*/
|
|
50
|
+
export function setRequestPathHeaders(
|
|
51
|
+
requestHeaders: Headers,
|
|
52
|
+
requestUrl: URL,
|
|
53
|
+
): void {
|
|
54
|
+
requestHeaders.set("x-url", requestUrl.toString());
|
|
55
|
+
requestHeaders.set("x-pathname", requestUrl.pathname);
|
|
56
|
+
}
|
|
57
|
+
|
|
42
58
|
/**
|
|
43
59
|
* Normalize a path so cache tags align across hand-written and
|
|
44
60
|
* auto-resolved callers. `<SmkingAEO path="products/abc" />` and
|
package/src/lib/proxy.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NextResponse, type NextRequest, after } from "next/server";
|
|
2
2
|
import { classifyAiHit } from "./crawlers";
|
|
3
|
+
import { setRequestPathHeaders } from "./path";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* SmKing AI traffic ingestion proxy (v0.12+, Next.js 16 `proxy.ts`).
|
|
@@ -68,6 +69,11 @@ const INGEST_TIMEOUT_MS = 2000;
|
|
|
68
69
|
*/
|
|
69
70
|
export function smkingProxy(config: SmkingProxyConfig = {}): ProxyMiddleware {
|
|
70
71
|
return (request: NextRequest) => {
|
|
72
|
+
// Server Components cannot read the current pathname from `headers()` on
|
|
73
|
+
// Vercel unless middleware forwards it. Mutating this request keeps the
|
|
74
|
+
// host proxy's redirect, rewrite, cookie, and response behavior intact.
|
|
75
|
+
setRequestPathHeaders(request.headers, request.nextUrl);
|
|
76
|
+
|
|
71
77
|
const apiKey = config.apiKey ?? process.env.SMKING_API_KEY;
|
|
72
78
|
const baseUrl = (config.baseUrl ?? process.env.SMKING_BASE_URL)?.replace(
|
|
73
79
|
/\/$/,
|
package/src/lib/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.21.
|
|
1
|
+
export const SDK_VERSION = "0.21.5";
|