@pirateandfox/pagestack 0.1.0-beta.19 → 0.1.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-beta.20 — 2026-11-27
4
+
5
+ - **`@pirateandfox/pagestack/live` has TypeScript types.** `live.d.mts` declares `liveEntries()` and a `LiveEntry` type, so `astro check` no longer reports the import as untyped. Hosts that added their own `declare module '@pirateandfox/pagestack/live'` can delete it. No runtime change.
6
+
3
7
  ## 0.1.0-beta.19 — 2026-11-26
4
8
 
5
9
  - **A new item's date is the editor's time, not the server's.** The first date field started as the server's UTC time, hours out, and in the evening tomorrow; when it was required nobody was asked to correct it. `POST /api/editor/collection/<id>` takes an optional `now` (local time, `"2026-11-24T18:49:35"`).
package/live.d.mts ADDED
@@ -0,0 +1,24 @@
1
+ // Types for live.mjs (`@pirateandfox/pagestack/live`). Keep in step with its JSDoc.
2
+
3
+ /** A collection entry as the editor has stored it. */
4
+ export interface LiveEntry {
5
+ id: string;
6
+ collection: string;
7
+ /** The frontmatter, parsed by `schema` when one is given. */
8
+ data: any;
9
+ body: string;
10
+ filePath: string;
11
+ }
12
+
13
+ /**
14
+ * On the editor's server, for `liveRoutes` pages and the editor's previews: the collection's entries
15
+ * as stored now. Everywhere else, including the public build: `null`, so fall back to `getCollection`.
16
+ *
17
+ * @param collection The editor's collection id (normally the Astro collection name).
18
+ * @param schema The collection's zod schema, so dates and defaults come out as they do at build time.
19
+ * Without one, `data` is the raw frontmatter. Entries the schema rejects are left out.
20
+ */
21
+ export function liveEntries(
22
+ collection: string,
23
+ schema?: { parse(data: unknown): any },
24
+ ): Promise<LiveEntry[] | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirateandfox/pagestack",
3
- "version": "0.1.0-beta.19",
3
+ "version": "0.1.0-beta.20",
4
4
  "description": "A block editor for Astro sites. Content stays in your repo, saves are git commits, the public site stays static, sign-in is passkeys.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,11 +11,15 @@
11
11
  ".": "./index.mjs",
12
12
  "./runtime": "./src/runtime.ts",
13
13
  "./core/*": "./src/core/*.ts",
14
- "./live": "./live.mjs"
14
+ "./live": {
15
+ "types": "./live.d.mts",
16
+ "default": "./live.mjs"
17
+ }
15
18
  },
16
19
  "files": [
17
20
  "index.mjs",
18
21
  "live.mjs",
22
+ "live.d.mts",
19
23
  "bin",
20
24
  "src",
21
25
  "CHANGELOG.md"