@vexcms/next 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (52) hide show
  1. package/README.md +59 -48
  2. package/dist/NextAdminLayout.d.ts +14 -23
  3. package/dist/NextAdminLayout.d.ts.map +1 -1
  4. package/dist/NextAdminLayout.js +3 -20
  5. package/dist/NextAdminLayout.js.map +1 -1
  6. package/dist/NextAdminLayoutClient.d.ts +9 -10
  7. package/dist/NextAdminLayoutClient.d.ts.map +1 -1
  8. package/dist/NextAdminLayoutClient.js +0 -1
  9. package/dist/NextAdminLayoutClient.js.map +1 -1
  10. package/dist/NextAdminPage.d.ts +7 -5
  11. package/dist/NextAdminPage.d.ts.map +1 -1
  12. package/dist/NextAdminPage.js +2 -137
  13. package/dist/NextAdminPage.js.map +1 -1
  14. package/dist/cache/createVexRevalidateRoute.d.ts +88 -0
  15. package/dist/cache/createVexRevalidateRoute.d.ts.map +1 -0
  16. package/dist/cache/createVexServerClient.d.ts +31 -0
  17. package/dist/cache/createVexServerClient.d.ts.map +1 -0
  18. package/dist/cache/index.d.ts +5 -0
  19. package/dist/cache/index.d.ts.map +1 -0
  20. package/dist/cache/index.js +9 -0
  21. package/dist/cache/index.js.map +1 -0
  22. package/dist/cache/types.d.ts +36 -0
  23. package/dist/cache/types.d.ts.map +1 -0
  24. package/dist/chunk-3J7LCKFC.js +129 -0
  25. package/dist/chunk-3J7LCKFC.js.map +1 -0
  26. package/dist/chunk-K4AAS5B5.js +22 -0
  27. package/dist/chunk-K4AAS5B5.js.map +1 -0
  28. package/dist/chunk-KIRSFMPI.js +78 -0
  29. package/dist/chunk-KIRSFMPI.js.map +1 -0
  30. package/dist/chunk-LHJAXWLB.js +127 -0
  31. package/dist/chunk-LHJAXWLB.js.map +1 -0
  32. package/dist/index.d.ts +10 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +48 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/seo/createVexRobots.d.ts +22 -0
  37. package/dist/seo/createVexRobots.d.ts.map +1 -0
  38. package/dist/seo/createVexSitemap.d.ts +41 -0
  39. package/dist/seo/createVexSitemap.d.ts.map +1 -0
  40. package/dist/seo/index.d.ts +5 -0
  41. package/dist/seo/index.d.ts.map +1 -0
  42. package/dist/seo/index.js +13 -0
  43. package/dist/seo/index.js.map +1 -0
  44. package/dist/seo/vexMetadata.d.ts +30 -0
  45. package/dist/seo/vexMetadata.d.ts.map +1 -0
  46. package/dist/seo/vexStaticParams.d.ts +25 -0
  47. package/dist/seo/vexStaticParams.d.ts.map +1 -0
  48. package/dist/testing/index.d.ts +2 -0
  49. package/dist/testing/index.d.ts.map +1 -0
  50. package/dist/testing/index.js +3 -0
  51. package/dist/testing/index.js.map +1 -0
  52. package/package.json +24 -4
@@ -0,0 +1,22 @@
1
+ import type { MetadataRoute } from "next";
2
+ /**
3
+ * Creates a Next.js `robots.ts` default export that allows crawlers across the
4
+ * site and points them at the generated sitemap.
5
+ *
6
+ * @param props - Robots configuration.
7
+ * @returns A `robots()` function suitable as `app/robots.ts`'s default export.
8
+ */
9
+ export declare function createVexRobots(props: {
10
+ /**
11
+ * Paths to disallow. Every vexcms template passes `["/admin", "/api"]` — the
12
+ * admin panel is authenticated and neither belongs in an index. Omitted
13
+ * entirely when absent or empty, rather than emitted as an empty array.
14
+ */
15
+ disallow?: string[];
16
+ /**
17
+ * The site's absolute origin, no trailing slash (e.g. `https://example.com`).
18
+ * The sitemap URL is derived as `${siteUrl}/sitemap.xml`.
19
+ */
20
+ siteUrl: string;
21
+ }): () => MetadataRoute.Robots;
22
+ //# sourceMappingURL=createVexRobots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVexRobots.d.ts","sourceRoot":"","sources":["../../src/seo/createVexRobots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,aAAa,CAAC,MAAM,CAY7B"}
@@ -0,0 +1,41 @@
1
+ import type { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
2
+ import type { MetadataRoute } from "next";
3
+ import type { VexServerClient } from "../cache/types";
4
+ type ArrayItem<T> = T extends (infer Item)[] ? Item : never;
5
+ /**
6
+ * Creates a Next.js `sitemap.ts` default export from a Convex published-slugs
7
+ * query (`packages/core/src/api/publishedSlugs/server.ts`).
8
+ *
9
+ * Tolerates an unreachable Convex deployment (P-020): a read failure returns
10
+ * `[]` — an empty sitemap — rather than failing the build.
11
+ *
12
+ * @param props - Sitemap configuration.
13
+ * @returns A `sitemap()` function suitable as `app/sitemap.ts`'s default export.
14
+ */
15
+ export declare function createVexSitemap<Query extends FunctionReference<"query">>(props: {
16
+ args?: OptionalRestArgs<Query>[0];
17
+ client: VexServerClient;
18
+ getSlug: (item: ArrayItem<FunctionReturnType<Query>>) => string;
19
+ /**
20
+ * Optional last-modified extractor. Omit it when the collection carries no
21
+ * modification timestamp — Convex's `_creationTime` is set at insert and
22
+ * never moves, so reporting it as `lastModified` would be a lie.
23
+ * `lastModified` is optional in the sitemap protocol; an absent value is
24
+ * correct, a wrong one costs crawl budget.
25
+ *
26
+ * May return `undefined` for an individual item, and that is the common
27
+ * case: `defineCollection` injects `updatedAt` on every content collection,
28
+ * but only a write through `create`/`update` populates it — a seeded or
29
+ * imported row has none. Those entries are emitted with no `lastModified`
30
+ * rather than an `Invalid Date`.
31
+ */
32
+ getUpdatedAt?: (item: ArrayItem<FunctionReturnType<Query>>) => number | undefined;
33
+ /**
34
+ * Maps one item's slug to its absolute public URL — the route mapper, so URL
35
+ * shape (e.g. `/blog/[slug]` vs `/[slug]`) is the caller's choice.
36
+ */
37
+ toUrl: (slug: string) => string;
38
+ query: Query;
39
+ }): () => Promise<MetadataRoute.Sitemap>;
40
+ export {};
41
+ //# sourceMappingURL=createVexSitemap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVexSitemap.d.ts","sourceRoot":"","sources":["../../src/seo/createVexSitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,IAAI,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE;IAChF,IAAI,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC;IAChE;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IAClF;;;OAGG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CA6BvC"}
@@ -0,0 +1,5 @@
1
+ export { createVexRobots } from "./createVexRobots";
2
+ export { createVexSitemap } from "./createVexSitemap";
3
+ export { vexMetadata } from "./vexMetadata";
4
+ export { vexStaticParams } from "./vexStaticParams";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import {
2
+ createVexRobots,
3
+ createVexSitemap,
4
+ vexMetadata,
5
+ vexStaticParams
6
+ } from "../chunk-KIRSFMPI.js";
7
+ export {
8
+ createVexRobots,
9
+ createVexSitemap,
10
+ vexMetadata,
11
+ vexStaticParams
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,30 @@
1
+ import type { Metadata } from "next";
2
+ /**
3
+ * Builds a Next.js `Metadata` object with unconditional title/description, a
4
+ * conditional OG image, `metadataBase`, and a canonical link.
5
+ *
6
+ * Generalizes what Step 1 fixed by hand in `apps/www/src/lib/metadata.ts`:
7
+ * title and description are set regardless of whether an OG image resolved —
8
+ * only the `openGraph.images` entry is conditional on `props.imageUrl`. The
9
+ * original gated the whole `openGraph` block on the image, so a page without
10
+ * one published no OG title or description at all.
11
+ *
12
+ * This FORMATS metadata; it does not read Convex. Resolving which title and
13
+ * description win is the caller's job, because only the caller knows the
14
+ * page/site precedence rules.
15
+ *
16
+ * @param props - Metadata inputs.
17
+ * @returns A `Metadata` object for a page's `generateMetadata` or static
18
+ * `metadata` export.
19
+ */
20
+ export declare function vexMetadata(props: {
21
+ description?: string;
22
+ /** Absolute OG image URL. Omit to emit `openGraph` without an image. */
23
+ imageUrl?: string;
24
+ /** The page's path (e.g. `/about`), used for the canonical link. */
25
+ path: string;
26
+ /** The site's absolute origin, used for `metadataBase`. */
27
+ siteUrl: string;
28
+ title: string;
29
+ }): Metadata;
30
+ //# sourceMappingURL=vexMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vexMetadata.d.ts","sourceRoot":"","sources":["../../src/seo/vexMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,QAAQ,CAkBX"}
@@ -0,0 +1,25 @@
1
+ import type { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
2
+ import type { VexServerClient } from "../cache/types";
3
+ type ArrayItem<T> = T extends (infer Item)[] ? Item : never;
4
+ /**
5
+ * Builds Next.js `generateStaticParams` output for a slug-driven route from a
6
+ * Convex query.
7
+ *
8
+ * Returns `[]` when the read fails — including an unreachable Convex
9
+ * deployment, which every CI build hits because it supplies placeholder env
10
+ * rather than skipping validation (P-020). A route with no static params still
11
+ * renders correctly on demand; it is simply not prerendered until the next
12
+ * build.
13
+ *
14
+ * @param props - Static params configuration.
15
+ * @returns `{ [paramName]: string }[]`, or `[]` if the read fails.
16
+ */
17
+ export declare function vexStaticParams<Query extends FunctionReference<"query">>(props: {
18
+ args?: OptionalRestArgs<Query>[0];
19
+ client: VexServerClient;
20
+ getSlug: (item: ArrayItem<FunctionReturnType<Query>>) => string;
21
+ paramName: string;
22
+ query: Query;
23
+ }): Promise<Record<string, string>[]>;
24
+ export {};
25
+ //# sourceMappingURL=vexStaticParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vexStaticParams.d.ts","sourceRoot":"","sources":["../../src/seo/vexStaticParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,IAAI,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE;IACrF,IAAI,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAiBpC"}
@@ -0,0 +1,2 @@
1
+ export * from "@vexcms/react/testing";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAKA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ // src/testing/index.ts
2
+ export * from "@vexcms/react/testing";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/index.ts"],"sourcesContent":["// Re-exports the full public surface of `@vexcms/react/testing` so Next.js\n// consumers can import the entire VexCMS test kit from `@vexcms/next`\n// without also depending on `@vexcms/react` directly. A wildcard re-export\n// (rather than an enumerated list) keeps this file in sync automatically as\n// `@vexcms/react/testing`'s own surface grows.\nexport * from \"@vexcms/react/testing\";\n"],"mappings":";AAKA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexcms/next",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.20",
4
4
  "description": "Next.js adapter and admin routes for VexCMS",
5
5
  "keywords": [
6
6
  "cms",
@@ -43,6 +43,21 @@
43
43
  "import": "./dist/NextAdminLayout.js",
44
44
  "types": "./dist/NextAdminLayout.d.ts"
45
45
  },
46
+ "./cache": {
47
+ "source": "./src/cache/index.ts",
48
+ "import": "./dist/cache/index.js",
49
+ "types": "./dist/cache/index.d.ts"
50
+ },
51
+ "./seo": {
52
+ "source": "./src/seo/index.ts",
53
+ "import": "./dist/seo/index.js",
54
+ "types": "./dist/seo/index.d.ts"
55
+ },
56
+ "./testing": {
57
+ "source": "./src/testing/index.ts",
58
+ "import": "./dist/testing/index.js",
59
+ "types": "./dist/testing/index.d.ts"
60
+ },
46
61
  "./styles": "./styles.css"
47
62
  },
48
63
  "publishConfig": {
@@ -51,8 +66,8 @@
51
66
  },
52
67
  "dependencies": {
53
68
  "lucide-react": "0.577.0",
54
- "@vexcms/core": "0.1.0-alpha.2",
55
- "@vexcms/react": "0.1.0-alpha.2"
69
+ "@vexcms/core": "0.1.0-alpha.20",
70
+ "@vexcms/react": "0.1.0-alpha.20"
56
71
  },
57
72
  "devDependencies": {
58
73
  "@convex-dev/react-query": "0.1.0",
@@ -62,6 +77,7 @@
62
77
  "@types/node": "20.19.43",
63
78
  "@types/react": "19.2.17",
64
79
  "@types/react-dom": "19.2.3",
80
+ "@vitest/coverage-v8": "4.1.10",
65
81
  "convex": "1.44.0",
66
82
  "next": "16.3.3",
67
83
  "nuqs": "2.9.0",
@@ -70,6 +86,7 @@
70
86
  "tailwindcss": "4.3.2",
71
87
  "tsup": "8.5.1",
72
88
  "typescript": "6.0.3",
89
+ "vitest": "4.1.10",
73
90
  "zod": "4.4.3",
74
91
  "@vexcms/tsconfig": "0.0.0"
75
92
  },
@@ -89,6 +106,9 @@
89
106
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
90
107
  "dev": "tsup --watch --no-clean",
91
108
  "clean": "rm -rf dist",
92
- "typecheck": "tsc --noEmit -p tsconfig.check.json"
109
+ "typecheck": "tsc --noEmit -p tsconfig.check.json",
110
+ "test": "vitest run",
111
+ "coverage": "vitest run --coverage",
112
+ "test:watch": "vitest"
93
113
  }
94
114
  }