@unbase-app/pages 0.4.0 → 0.5.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/README.md CHANGED
@@ -54,8 +54,9 @@ build is untouched.
54
54
  ## What a production build does with a draft
55
55
 
56
56
  - **Its page is not built.** Astro: the page file compiles to an empty page, so nothing it imports
57
- is bundled, and its HTML is removed. React Router: its `<Route />` leaves the router and its
58
- module becomes empty, so the address falls to the app's own Not Found.
57
+ is bundled, and its HTML is removed. React Router: its `<Route />`, or its route object in a
58
+ `createBrowserRouter([...])` (since 0.5.0), leaves the router and its module becomes empty, so the
59
+ address falls to the app's own Not Found.
59
60
  - **Its address leaves every page list:** sitemaps, comment-modus's `pages.json` and content map,
60
61
  and the entries the page owns in Astro's content store.
61
62
  - **The output is checked for its text.** If a sentence only the draft has is still in a served
@@ -120,6 +121,7 @@ remove the package, its line in the config, and `unbase.pages.json`.
120
121
  | `@unbase-app/pages/astro` | The Astro integration (default export, and `unbasePages`) |
121
122
  | `@unbase-app/pages/vite` | The Vite plugin (`unbasePages`) |
122
123
  | `@unbase-app/pages` | The core: discovering a site's pages, checking a draft, and planning a page action (`planPage`, `pageActions`, `redirectsFor`), as pure functions on the app's files |
124
+ | `@unbase-app/pages/binding` | The binding contract's checks, as pure functions on files, collections and rendered HTML: which files read a collection (`reads`, `readerFunctions`, `readersOf`), an item's values copied into code (`noCopiedContent`), a content change with code in it (`contentKeptCode`), a design change that changed content or lost a binding (`designKeptContent`), each element that shows a collection's value bound to its item and field or a reason (`binds`), whether a new item shows on every page that reads it (`newItemShows`, with a render you give it), the fields a file uses (`fieldUse`), the components a change wrote on a collection (`componentsOn`), and Build's gate for them, all of it at once (`componentGate`). Framework adapters: `ASTRO`, `NEXT` |
123
125
 
124
126
  Node 18.17 or newer. MIT licence.
125
127
 
@@ -130,9 +132,11 @@ discovery and the draft check; Unbase's backend and the Vite and Next.js package
130
132
  (`supabase/functions/_shared/pages-core.mjs` in Unbase's repository, `vite/pages/core.mjs` and
131
133
  `next/core.mjs` in the kit; tests fail when they differ): after changing it, `cp kit/pages/core.mjs
132
134
  supabase/functions/_shared/pages-core.mjs`, `node vite/scripts/sync-pages.mjs` and `cp
133
- pages/core.mjs next/core.mjs`.
135
+ pages/core.mjs next/core.mjs`. `binding.mjs` has one copy, `supabase/functions/_shared/binding.mjs`: after
136
+ changing it, `cp kit/pages/binding.mjs supabase/functions/_shared/binding.mjs` and `node
137
+ kit/cli/scripts/readers.mjs` (doctor runs it from there).
134
138
 
135
- - `node --test test/*.test.mjs`: the core (`core.test.mjs`), the page actions (`actions.test.mjs`) and the redirects in Astro and Vite (`redirects.test.mjs`).
139
+ - `node --test test/*.test.mjs`: the core (`core.test.mjs`), the page actions (`actions.test.mjs`), the redirects in Astro and Vite (`redirects.test.mjs`) and the binding contract (`binding.test.mjs`, with the `test/fixtures/binding-next` and `test/fixtures/gate-next` shops).
136
140
  - A11, the acceptance test, on lab sites only: `node test/a11.mjs vibe` (the Lovable-shaped
137
141
  fixture in `test/fixtures/lab-vibe`) and `node test/a11.mjs astro --dir <lab copy>` (a git
138
142
  repository without a remote). It needs `playwright-core` (`PLAYWRIGHT_CORE=<path>`) and Chrome
package/astro.d.mts CHANGED
@@ -9,6 +9,13 @@ declare function unbasePages(): AstroIntegration;
9
9
  export default unbasePages;
10
10
  export { unbasePages };
11
11
 
12
+ /**
13
+ * Where a host's adapter copies the build output and serves it from, relative to the project
14
+ * (`.vercel/output/static`): the kit cleans drafts there too, and @unbase-app/astro copies comment
15
+ * mode's build files into them.
16
+ */
17
+ export declare const HOST_COPIES: readonly string[];
18
+
12
19
  /** Astro's content store without the entries the drafts own (used by the integration; exported for its tests). */
13
20
  export declare function withoutDraftEntries(
14
21
  code: string,
package/astro.mjs CHANGED
@@ -37,9 +37,10 @@ const clean = (id) => id.replace(/\?.*$/, "");
37
37
  * Where a host's adapter copies the client output and serves it from. The Vercel adapter (11, with
38
38
  * Astro 7) copies dist/client to .vercel/output/static in its own astro:build:done, which can run
39
39
  * before this integration's: a draft removed from dist/client only would still be served (found
40
- * on a copy of a real site, 10-11-2026). So the copy is cleaned and checked as well.
40
+ * on a copy of a real site, 10-11-2026). So the copy is cleaned and checked as well. The one list:
41
+ * @unbase-app/astro copies comment mode's build files into the same folders (17-11-2026).
41
42
  */
42
- const HOST_COPIES = [".vercel/output/static"];
43
+ export const HOST_COPIES = Object.freeze([".vercel/output/static"]);
43
44
  /** Astro's content store as one module: every collection's entries, also in the server's bundle. */
44
45
  const DATA_STORE = "\0astro:data-layer-content";
45
46