@pylonsync/sdk 0.3.263 → 0.3.265

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +29 -3
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.263",
6
+ "version": "0.3.265",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -374,7 +374,7 @@ export interface RouteDefinition {
374
374
  * POST/PUT/PATCH/DELETE) — matched on its `path` for non-GET requests only,
375
375
  * never rendered as a page.
376
376
  */
377
- kind?: "page" | "not-found" | "error" | "route";
377
+ kind?: "page" | "not-found" | "error" | "route" | "sitemap" | "robots";
378
378
  }
379
379
 
380
380
  export function defineRoute(route: RouteDefinition): RouteDefinition {
@@ -572,7 +572,7 @@ export interface ManifestRoute {
572
572
  component?: string;
573
573
  layouts?: string[];
574
574
  /** "not-found" / "error" boundaries, or "route" form handlers; omitted for normal pages. */
575
- kind?: "page" | "not-found" | "error" | "route";
575
+ kind?: "page" | "not-found" | "error" | "route" | "sitemap" | "robots";
576
576
  }
577
577
 
578
578
  export interface ManifestInputField {
@@ -933,7 +933,33 @@ export async function discoverAppRoutes(opts?: {
933
933
  kind: "route" as const,
934
934
  }));
935
935
 
936
- return [...pageRoutes, ...boundaryRoutes, ...routeRoutes];
936
+ // Root-level data conventions (Next-style): `app/sitemap.{ts,tsx,js,jsx}`
937
+ // `/sitemap.xml`, `app/robots.{...}` → `/robots.txt`. Each exports a default
938
+ // (optionally async) function returning sitemap entries / a robots object;
939
+ // the SSR runtime detects these by component basename, calls the export, and
940
+ // serializes the return to XML / plain text (no React render). Root-level
941
+ // only for now (no route-group nesting / `generateSitemaps` id sharding).
942
+ const dataRoutes: RouteDefinition[] = [];
943
+ const sitemapMod = findModule(appDir, "sitemap");
944
+ if (sitemapMod) {
945
+ dataRoutes.push({
946
+ path: "/sitemap.xml",
947
+ mode: "ssr",
948
+ component: sitemapMod,
949
+ kind: "sitemap",
950
+ });
951
+ }
952
+ const robotsMod = findModule(appDir, "robots");
953
+ if (robotsMod) {
954
+ dataRoutes.push({
955
+ path: "/robots.txt",
956
+ mode: "ssr",
957
+ component: robotsMod,
958
+ kind: "robots",
959
+ });
960
+ }
961
+
962
+ return [...pageRoutes, ...boundaryRoutes, ...routeRoutes, ...dataRoutes];
937
963
  }
938
964
 
939
965
  export function queriesToManifest(queries: QueryDefinition[]): ManifestQuery[] {