@unbase-app/pages 0.4.0 → 0.4.1

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 (4) hide show
  1. package/README.md +5 -2
  2. package/binding.mjs +1687 -0
  3. package/core.mjs +499 -56
  4. package/package.json +3 -2
package/README.md CHANGED
@@ -120,6 +120,7 @@ remove the package, its line in the config, and `unbase.pages.json`.
120
120
  | `@unbase-app/pages/astro` | The Astro integration (default export, and `unbasePages`) |
121
121
  | `@unbase-app/pages/vite` | The Vite plugin (`unbasePages`) |
122
122
  | `@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 |
123
+ | `@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
124
 
124
125
  Node 18.17 or newer. MIT licence.
125
126
 
@@ -130,9 +131,11 @@ discovery and the draft check; Unbase's backend and the Vite and Next.js package
130
131
  (`supabase/functions/_shared/pages-core.mjs` in Unbase's repository, `vite/pages/core.mjs` and
131
132
  `next/core.mjs` in the kit; tests fail when they differ): after changing it, `cp kit/pages/core.mjs
132
133
  supabase/functions/_shared/pages-core.mjs`, `node vite/scripts/sync-pages.mjs` and `cp
133
- pages/core.mjs next/core.mjs`.
134
+ pages/core.mjs next/core.mjs`. `binding.mjs` has one copy, `supabase/functions/_shared/binding.mjs`: after
135
+ changing it, `cp kit/pages/binding.mjs supabase/functions/_shared/binding.mjs` and `node
136
+ kit/cli/scripts/readers.mjs` (doctor runs it from there).
134
137
 
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`).
138
+ - `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
139
  - A11, the acceptance test, on lab sites only: `node test/a11.mjs vibe` (the Lovable-shaped
137
140
  fixture in `test/fixtures/lab-vibe`) and `node test/a11.mjs astro --dir <lab copy>` (a git
138
141
  repository without a remote). It needs `playwright-core` (`PLAYWRIGHT_CORE=<path>`) and Chrome