@decocms/start 0.40.0 → 0.41.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/start",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "type": "module",
5
5
  "description": "Deco framework for TanStack Start - CMS bridge, admin protocol, hooks, schema generation",
6
6
  "main": "./src/index.ts",
@@ -444,10 +444,13 @@ function buildHead(
444
444
  meta.push({ name: "description", content: description });
445
445
  }
446
446
 
447
- // Robots
448
- if (noIndex) {
449
- meta.push({ name: "robots", content: "noindex, nofollow" });
450
- }
447
+ // Robots — always emit a directive so crawlers see an explicit signal
448
+ meta.push({
449
+ name: "robots",
450
+ content: noIndex
451
+ ? "noindex, nofollow"
452
+ : "index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1",
453
+ });
451
454
 
452
455
  // Open Graph
453
456
  meta.push({ property: "og:title", content: title });
@@ -37,6 +37,9 @@ import { cleanPathForCacheKey } from "./urlUtils";
37
37
  import { isMobileUA } from "./useDevice";
38
38
  import { getRenderShellConfig } from "../admin/setup";
39
39
  import { RequestContext } from "./requestContext";
40
+ import type { MatcherContext } from "../cms/resolve";
41
+ import { resolveDecoPage } from "../cms/resolve";
42
+ import { runSectionLoaders } from "../cms/sectionLoaders";
40
43
 
41
44
  /**
42
45
  * Append Link preload headers for CSS and fonts so the browser starts
@@ -669,6 +672,40 @@ export function createDecoWorkerEntry(
669
672
  return handlePurge(request, env);
670
673
  }
671
674
 
675
+ // ?asJson — return resolved page data as JSON (legacy deco compat)
676
+ if (url.searchParams.has("asJson") && request.method === "GET") {
677
+ const basePath = url.pathname;
678
+ const cookies: Record<string, string> = {};
679
+ for (const pair of (request.headers.get("cookie") ?? "").split(";")) {
680
+ const [k, ...v] = pair.split("=");
681
+ if (k?.trim()) cookies[k.trim()] = v.join("=").trim();
682
+ }
683
+ const matcherCtx: MatcherContext = {
684
+ userAgent: request.headers.get("user-agent") ?? "",
685
+ url: url.toString(),
686
+ path: basePath,
687
+ cookies,
688
+ request,
689
+ };
690
+ const page = await resolveDecoPage(basePath, matcherCtx);
691
+ if (!page) {
692
+ return Response.json(null, { status: 404, headers: { "Access-Control-Allow-Origin": "*" } });
693
+ }
694
+ const enrichedSections = await runSectionLoaders(page.resolvedSections, request);
695
+ const { seoSection: _seo, ...pageData } = page;
696
+ const result = {
697
+ ...pageData,
698
+ resolvedSections: enrichedSections,
699
+ };
700
+ return Response.json(result, {
701
+ headers: {
702
+ "Access-Control-Allow-Origin": "*",
703
+ "Access-Control-Allow-Headers": "Content-Type, Authorization",
704
+ "Access-Control-Allow-Methods": "GET, OPTIONS",
705
+ },
706
+ });
707
+ }
708
+
672
709
  // Commerce proxy (checkout, account, API, etc.)
673
710
  if (options.proxyHandler) {
674
711
  const proxyResponse = await options.proxyHandler(request, url);