@valbuild/tanstack 0.150.23 → 0.152.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/CHANGELOG.md +199 -0
- package/README.md +11 -11
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +100 -293
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +100 -293
- package/client/dist/valbuild-tanstack-client.esm.js +99 -292
- package/dist/ValOverlayContext-1e50a557.cjs.prod.js +47 -0
- package/dist/ValOverlayContext-6826b4d9.esm.js +40 -0
- package/dist/ValOverlayContext-b18c2f18.cjs.dev.js +47 -0
- package/dist/declarations/src/ValDraft.d.ts +6 -50
- package/dist/declarations/src/ValModulesClient.d.ts +1 -3
- package/dist/declarations/src/ValProvider.d.ts +1 -1
- package/dist/declarations/src/client/initValClient.d.ts +25 -3
- package/dist/declarations/src/server/initValContent.d.ts +55 -169
- package/dist/{routeFromVal-06590f50.esm.js → routeFromVal-124235a5.esm.js} +3 -153
- package/dist/{routeFromVal-3c3915e2.cjs.dev.js → routeFromVal-2e834397.cjs.prod.js} +1 -156
- package/dist/{routeFromVal-b31a9e00.cjs.prod.js → routeFromVal-3d4d7c30.cjs.dev.js} +1 -156
- package/dist/{typeof-66e2d869.esm.js → typeof-3e1a1d11.esm.js} +1 -1
- package/dist/{typeof-8998e126.cjs.prod.js → typeof-56656438.cjs.prod.js} +0 -2
- package/dist/{typeof-dd0246a1.cjs.dev.js → typeof-bd6ec82c.cjs.dev.js} +0 -2
- package/dist/valbuild-tanstack.cjs.dev.js +162 -282
- package/dist/valbuild-tanstack.cjs.prod.js +162 -282
- package/dist/valbuild-tanstack.esm.js +162 -281
- package/dist/{version-30535975.cjs.prod.js → version-96339a5a.cjs.prod.js} +1 -19
- package/dist/{version-278a8d18.cjs.dev.js → version-c27a565d.cjs.dev.js} +1 -19
- package/dist/{version-3d755ee7.esm.js → version-f05a8296.esm.js} +2 -19
- package/package.json +8 -8
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +278 -1140
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +278 -1140
- package/server/dist/valbuild-tanstack-server.esm.js +279 -1141
- package/dist/ValOverlayContext-198b4bd1.cjs.dev.js +0 -301
- package/dist/ValOverlayContext-6411bbe3.esm.js +0 -293
- package/dist/ValOverlayContext-d9b22d1a.cjs.prod.js +0 -301
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,204 @@
|
|
|
1
1
|
# @valbuild/tanstack
|
|
2
2
|
|
|
3
|
+
## 0.152.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`f4e0660`](https://github.com/valbuild/val/commit/f4e06601495dbee680a4b9000344f84cd3af717f), [`3bb76d7`](https://github.com/valbuild/val/commit/3bb76d74d82b499aa15023838d63018a70fd7ce7), [`08a3977`](https://github.com/valbuild/val/commit/08a39779dbe43702a72ae57cbf8cf29b14e64672)]:
|
|
8
|
+
- @valbuild/ui@0.152.0
|
|
9
|
+
- @valbuild/server@0.152.0
|
|
10
|
+
- @valbuild/shared@0.152.0
|
|
11
|
+
- @valbuild/mcp@0.152.0
|
|
12
|
+
- @valbuild/react@0.152.0
|
|
13
|
+
- @valbuild/language-server@0.152.0
|
|
14
|
+
|
|
15
|
+
## 0.151.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`a325152`](https://github.com/valbuild/val/commit/a325152856a881faec84c112fcf226828739f563) Thanks [@freekh](https://github.com/freekh)! - **A draft page shows the right `.jsonValues()` entries, whichever reader reads them.**
|
|
20
|
+
|
|
21
|
+
- **Pending edits to an entry.** In draft mode, `fetchVal` of a whole
|
|
22
|
+
`.jsonValues()` record now shows the unpublished edits to its entries. It
|
|
23
|
+
used to show the published content of every entry, even one an editor had
|
|
24
|
+
just changed, while `fetchValKey` and `fetchValRoute` of the same entry
|
|
25
|
+
showed the edit. The entries a pending change touches are read from Val's
|
|
26
|
+
server; the others are loaded from your build, as before.
|
|
27
|
+
- **Entries published without a rebuild.** On a host that does not rebuild
|
|
28
|
+
the site after a publish, a draft page now shows the published entries
|
|
29
|
+
straight away -- in `fetchVal`, and in `useVal`, `useValKey` and
|
|
30
|
+
`useValRoute` alike. They used to show those entries as they were before
|
|
31
|
+
the publish, from the site's build, until it was rebuilt (and on TanStack
|
|
32
|
+
Start the server render showed the new content, then the page switched
|
|
33
|
+
back to the old). Val's server marks each entry a publish wrote, and the
|
|
34
|
+
readers and the Studio load a marked entry from the server.
|
|
35
|
+
|
|
36
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`346e6fd`](https://github.com/valbuild/val/commit/346e6fdc8e242bf826ab66a729eacd9f8d4be1a6) Thanks [@freekh](https://github.com/freekh)! - **Draft pages read what was edited, not the whole site.** A page in draft
|
|
37
|
+
mode used to make Val's server read every module, apply every pending
|
|
38
|
+
change, and preview and validate the whole project on every request -- and
|
|
39
|
+
then ask again for each `.jsonValues()` entry it showed. Now there is one
|
|
40
|
+
copy of the draft per process, made once per change and shared by every
|
|
41
|
+
editor and every request:
|
|
42
|
+
|
|
43
|
+
- A module nobody edited costs nothing: the page reads its own build, as a
|
|
44
|
+
visitor's does.
|
|
45
|
+
- A request asks one cheap question -- has anything changed? -- once, and
|
|
46
|
+
the draft is only re-read when it has. An edit is applied once, to the
|
|
47
|
+
version before it, however many pages read it afterwards.
|
|
48
|
+
- `fetchVal`, `fetchValKey`, `fetchValRoute`, `fetchValRouteUrl` and
|
|
49
|
+
`fetchValDraft` (Next.js and TanStack Start alike) and Val's API routes
|
|
50
|
+
read that one copy, so a save through the API is seen by every reader at
|
|
51
|
+
once. Before, each kept its own, and a publish moved only the copy of the
|
|
52
|
+
server that handled it: in a host that keeps its content in memory, a
|
|
53
|
+
draft page read through `fetchValKey` or `fetchValRoute` went on showing
|
|
54
|
+
the content from before the publish.
|
|
55
|
+
- The MCP tools (`initValMcp`) read the same copy in local development and
|
|
56
|
+
on Val's hosting, where Val's options come from your config and the
|
|
57
|
+
environment. `initValMcp` takes no patch store or source files of its
|
|
58
|
+
own, so in a host that keeps its content in memory it keeps a copy of its
|
|
59
|
+
own, as before.
|
|
60
|
+
- If `initValServer` and `initValContent` (or `initValRsc`) are given
|
|
61
|
+
different options for the same `val.modules` (a different patch store,
|
|
62
|
+
say), they keep separate copies, and Val logs a warning saying which
|
|
63
|
+
options differ.
|
|
64
|
+
|
|
65
|
+
On a site of 20 MB of content a draft read went from about half a second per
|
|
66
|
+
request to well under a millisecond once the draft is in memory, and the
|
|
67
|
+
memory it holds grows with what was edited rather than with the size of the
|
|
68
|
+
site. Hosted sites in proxy mode ask the content service one small question
|
|
69
|
+
per request instead of reading every pending change; with a content service
|
|
70
|
+
that predates it, Val reads the pending changes as before.
|
|
71
|
+
|
|
72
|
+
`ValDraft` (what `fetchValDraft` returns and `<ValProvider draft>` takes)
|
|
73
|
+
has a new optional `versions` field, filled in by the server: the page uses
|
|
74
|
+
it to tell that what the Studio sends is what it already shows, without
|
|
75
|
+
comparing the content. Nothing to change in your app.
|
|
76
|
+
|
|
77
|
+
**Changed:** `PUT /api/val/sources/~` no longer computes previews or
|
|
78
|
+
validates the content (the Studio does both itself, and `/api/val/validate`
|
|
79
|
+
checks a module on request); its `validate_sources` and
|
|
80
|
+
`validate_binary_files` flags are accepted and ignored.
|
|
81
|
+
|
|
82
|
+
**Deprecated, and removed in the next release.** These stay for one release
|
|
83
|
+
only so that a Studio, a page or a server of the previous release keeps
|
|
84
|
+
working while a deploy rolls out. Nothing in this release uses them; if
|
|
85
|
+
your own code calls any of them, move off it now:
|
|
86
|
+
|
|
87
|
+
- `PUT /api/val/sources/~`, the whole route. This release's Studio reads
|
|
88
|
+
`GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and the draft
|
|
89
|
+
readers and MCP read in-process.
|
|
90
|
+
- The `source` field of the overlay's `source-update` event and the canvas's
|
|
91
|
+
`sourceUpdate` message, and a page's support for an event that carries
|
|
92
|
+
only `source` (this release sends `read` beside it).
|
|
93
|
+
- `ValDraft.base`: not sent and not read; the type stays one release so
|
|
94
|
+
code written against the previous one still compiles.
|
|
95
|
+
- `/api/val/stat`'s `sourcesSha` and `schemaSha`: the next release's Studio
|
|
96
|
+
stops depending on them, and the release after it stops sending them.
|
|
97
|
+
|
|
98
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`b0ad7f4`](https://github.com/valbuild/val/commit/b0ad7f496f2dc0384b8df847b1d77becf617b7bf) Thanks [@freekh](https://github.com/freekh)! - A draft page now catches up with an edit as soon as the server has it, instead
|
|
99
|
+
of on a timer.
|
|
100
|
+
|
|
101
|
+
- **The page settles faster, and without the 10 second fallback.** Content your
|
|
102
|
+
page reads on the server (a TanStack Start loader, a Next.js server component)
|
|
103
|
+
is refreshed when the editor's change has been saved, once per saved change.
|
|
104
|
+
It used to be refreshed the moment you typed — before the change was saved,
|
|
105
|
+
so the refresh often came back without it — and then again every 10 seconds
|
|
106
|
+
for half a minute in case it had. That safety refresh is gone, and so are the
|
|
107
|
+
extra requests it made while you edited. Another editor's change refreshes
|
|
108
|
+
the page too, once the server has it. While a deploy rolls out, a Studio of
|
|
109
|
+
the previous release (which never says it has saved) still refreshes the
|
|
110
|
+
page as each change arrives, as before.
|
|
111
|
+
- **Next.js: `ValProvider` takes an optional `draft` prop**, as
|
|
112
|
+
`@valbuild/tanstack`'s does: the editor's draft, read on the server for the
|
|
113
|
+
request. With it, the server renders the draft and the browser hydrates the
|
|
114
|
+
same thing, so a draft page no longer shows the published text first, and a
|
|
115
|
+
page that exists only as an unpublished change is found on the first render
|
|
116
|
+
instead of answering 404. Without it, nothing changes. See "The `draft` prop"
|
|
117
|
+
in the `@valbuild/next` README.
|
|
118
|
+
- **Next.js: `initValRsc` returns `fetchValDraft`**, which reads that draft:
|
|
119
|
+
pass `draft={await fetchValDraft()}` to `ValProvider` in your root layout. It
|
|
120
|
+
returns `null` unless the request is in draft mode, after one `draftMode()`
|
|
121
|
+
lookup and no other work, so visitors pay nothing and a static page stays
|
|
122
|
+
static. It reads the draft the way `@valbuild/tanstack/server`'s
|
|
123
|
+
`fetchValDraft` does and returns the same type, `ValDraft | null`, which
|
|
124
|
+
is now exported from `@valbuild/next` and `@valbuild/next/rsc` too.
|
|
125
|
+
- **`suspend` waits for the editor's changes properly.** With `suspend` on
|
|
126
|
+
`ValProvider`, a page could be told it had everything before the editor had
|
|
127
|
+
sent the pending change it needed, and render the published content first —
|
|
128
|
+
for a page that exists only as an unpublished change, a 404. It now waits
|
|
129
|
+
until the change is there.
|
|
130
|
+
- A draft page whose draft was discarded or published before the editor's
|
|
131
|
+
overlay or canvas connected now shows what the editor has, instead of keeping
|
|
132
|
+
the draft it was rendered with -- an edit inside a `.jsonValues()` entry
|
|
133
|
+
included.
|
|
134
|
+
- Turning draft mode on or off refreshes the page once. In development (React's
|
|
135
|
+
`StrictMode`) it could refresh twice, and Next.js could log "Cannot call
|
|
136
|
+
startTransition while rendering" while the page refreshed.
|
|
137
|
+
|
|
138
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`809873c`](https://github.com/valbuild/val/commit/809873cd7dd2c17e261b7e92716397a6bb4d6e56) Thanks [@freekh](https://github.com/freekh)! - Every content reader in `@valbuild/next` and `@valbuild/tanstack` — `fetchVal`,
|
|
139
|
+
`useVal`, the key and route readers, on the server and in the browser — now
|
|
140
|
+
loads content the same way, so they can no longer disagree about which content
|
|
141
|
+
wins. Nothing you call changes. What you may notice:
|
|
142
|
+
|
|
143
|
+
- `useValRoute` on a `.jsonValues()` router loads only the entry for the
|
|
144
|
+
current route. It used to load every entry of the record first.
|
|
145
|
+
`useValRouteUrl` and `fetchValRouteUrl` load none at all: a URL does not need
|
|
146
|
+
them.
|
|
147
|
+
- In development, an edited `*.val.json` entry shows its new content after a
|
|
148
|
+
hot reload. The hooks kept the entry they had loaded before it.
|
|
149
|
+
- Next.js: `useValKey` no longer shows the published entry of a nullable
|
|
150
|
+
`.jsonValues()` record that a draft has set to `null`, nor anything for an
|
|
151
|
+
entry named like a built-in object property (such as `toString`) that the
|
|
152
|
+
draft does not have.
|
|
153
|
+
- With `suspend` on `ValProvider`, `useValKey` now waits for draft mode and the
|
|
154
|
+
editor's changes too, as `useVal` and `useValRoute` already did.
|
|
155
|
+
- When one entry of a `.jsonValues()` record cannot be loaded, `useVal` logs
|
|
156
|
+
the error and renders the others, as `fetchVal` already did, instead of
|
|
157
|
+
failing the whole component.
|
|
158
|
+
|
|
159
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`be276e7`](https://github.com/valbuild/val/commit/be276e76f5849fcc421398abdb7e114f3de4d3e8) Thanks [@freekh](https://github.com/freekh)! - In a proposal in code mode, an edit to a field the assistant has just added is
|
|
160
|
+
saved with the assistant's next change, without waiting for the proposal to be
|
|
161
|
+
built.
|
|
162
|
+
|
|
163
|
+
The Studio already let you type into a field that only the assistant's staged
|
|
164
|
+
code has. But the save that runs before the assistant's next change applied
|
|
165
|
+
your edit to the content as the proposal's last build had it -- without the new
|
|
166
|
+
field -- so it failed, and the assistant's next change was refused ("the
|
|
167
|
+
changes waiting to be saved could not be saved first") until someone pressed
|
|
168
|
+
Build.
|
|
169
|
+
|
|
170
|
+
Val's server at the proposal's address now learns which staged code the build
|
|
171
|
+
it runs was made of (the platform hands it over beside the build), and saves a
|
|
172
|
+
module whose code was staged after that build from the staged `.val.ts` itself.
|
|
173
|
+
A page at the address keeps reading such a module as its build has it until a
|
|
174
|
+
build of the new code serves it, so it never shows content made for code it
|
|
175
|
+
does not have.
|
|
176
|
+
|
|
177
|
+
When the server cannot read a staged module's content without running it --
|
|
178
|
+
its content is built by code, or it is a `.jsonValues()` record -- the edit is
|
|
179
|
+
kept, and the assistant's change is refused saying the proposal has to be built
|
|
180
|
+
first, rather than failing with no reason.
|
|
181
|
+
|
|
182
|
+
`@valbuild/tanstack-build` rewrites the proposal block of a `val.server.ts`
|
|
183
|
+
generated before this, so a site picks it up at its next build.
|
|
184
|
+
|
|
185
|
+
- [#1006](https://github.com/valbuild/val/pull/1006) [`4dc1481`](https://github.com/valbuild/val/commit/4dc1481cfb7cad4072bdbeaeb51b2b2ad43a9f5d) Thanks [@freekh](https://github.com/freekh)! - The Studio now shows each module as your server has it, by version, with only your own unsaved edits on top.
|
|
186
|
+
|
|
187
|
+
- **Publishing is faster.** After a publish, or when your site serves content published without a build, the Studio used to download every module's content before it showed anything new. It now reads only the modules that changed, one at a time: in our measurements with a 1,000-entry `.jsonValues()` record, the Studio was ready again after a publish in about 35 ms instead of 300–800 ms.
|
|
188
|
+
- **No flicker of old content on a draft page.** For up to a minute after a deploy, a request can still reach the build before it; that build now says it has been replaced (when Val's content service can tell it), and the Studio asks again rather than taking its content for the current one. In local development the same holds after you change a `.val.ts`: an answer from the code before the change is no longer taken for the new code's, so a page in draft mode no longer shows the new text, then the old, then the new again.
|
|
189
|
+
- **Another editor's change appears as your server has it.** The Studio no longer replays other people's changes on top of the content it loaded with, so a change made against a newer deployment can no longer show up twice or out of order.
|
|
190
|
+
- **Less sent with every draft page.** A page in draft mode no longer embeds the whole published content of a site served without a rebuild for the Studio to start from; `ValDraft.base` is deprecated and no longer filled in.
|
|
191
|
+
- **When the editor opens on a page that already shows your changes,** the Studio no longer sends them to the page again.
|
|
192
|
+
|
|
193
|
+
- Updated dependencies [[`33c8b80`](https://github.com/valbuild/val/commit/33c8b80f877f1c3bec3cb61ef41dea9d2efcf908), [`213d635`](https://github.com/valbuild/val/commit/213d6359a1ec09cba1596ef03f415d3b5c0f2710), [`59faf33`](https://github.com/valbuild/val/commit/59faf332418af836617e09150fb89007e468394e), [`abf6148`](https://github.com/valbuild/val/commit/abf6148a255abe795620fede66006462bccb8322), [`04ed1f1`](https://github.com/valbuild/val/commit/04ed1f10b597a52822d32017597692f0e1062b7b), [`01772a5`](https://github.com/valbuild/val/commit/01772a5b36549d71f6b438ff17803dfcb64ce645), [`1f08b65`](https://github.com/valbuild/val/commit/1f08b6517adeac27fd9e43c7bf726976daefee3b), [`a325152`](https://github.com/valbuild/val/commit/a325152856a881faec84c112fcf226828739f563), [`b682509`](https://github.com/valbuild/val/commit/b682509b91dcd6e6aa2e1dfcedab0f259634c73e), [`f5110c9`](https://github.com/valbuild/val/commit/f5110c9aa2a0a6ff0586e9f0f2a29eb1baef557d), [`a806f7d`](https://github.com/valbuild/val/commit/a806f7de0c605145163c7f0babf389a5b5bf3ef3), [`04bae7e`](https://github.com/valbuild/val/commit/04bae7e54e6b191fc70f45e6f10bbce820b6069c), [`4fd35f3`](https://github.com/valbuild/val/commit/4fd35f321fe510cfb5b9b679ca14ce2b9e852d40), [`346e6fd`](https://github.com/valbuild/val/commit/346e6fdc8e242bf826ab66a729eacd9f8d4be1a6), [`b0ad7f4`](https://github.com/valbuild/val/commit/b0ad7f496f2dc0384b8df847b1d77becf617b7bf), [`3aff85e`](https://github.com/valbuild/val/commit/3aff85e9a40cb0879285b86fd41fa8167db1bb5e), [`809873c`](https://github.com/valbuild/val/commit/809873cd7dd2c17e261b7e92716397a6bb4d6e56), [`b41da31`](https://github.com/valbuild/val/commit/b41da31a26b3236ccd55c02108c56422d8d91f5e), [`560abd9`](https://github.com/valbuild/val/commit/560abd9df36e52e63b6592b03a8040396320df00), [`be276e7`](https://github.com/valbuild/val/commit/be276e76f5849fcc421398abdb7e114f3de4d3e8), [`e30da7d`](https://github.com/valbuild/val/commit/e30da7d9bca5d5773aa287e8b4c16a01e757ff9a), [`66d487f`](https://github.com/valbuild/val/commit/66d487f3662164a9a167ec660afc6d12b441aa22), [`4dc1481`](https://github.com/valbuild/val/commit/4dc1481cfb7cad4072bdbeaeb51b2b2ad43a9f5d), [`4edd384`](https://github.com/valbuild/val/commit/4edd384cf04a25836df77aae6d88378f8750a761)]:
|
|
194
|
+
- @valbuild/ui@0.151.0
|
|
195
|
+
- @valbuild/server@0.151.0
|
|
196
|
+
- @valbuild/shared@0.151.0
|
|
197
|
+
- @valbuild/core@0.151.0
|
|
198
|
+
- @valbuild/react@0.151.0
|
|
199
|
+
- @valbuild/mcp@0.151.0
|
|
200
|
+
- @valbuild/language-server@0.151.0
|
|
201
|
+
|
|
3
202
|
## 0.150.23
|
|
4
203
|
|
|
5
204
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -509,17 +509,17 @@ SDK of your choice. See [`@valbuild/mcp`](https://www.npmjs.com/package/@valbuil
|
|
|
509
509
|
|
|
510
510
|
## Differences from `@valbuild/next`
|
|
511
511
|
|
|
512
|
-
| Next
|
|
513
|
-
|
|
|
514
|
-
| `nextAppRouter`
|
|
515
|
-
| `app/blogs/[blog]/page.val.ts`
|
|
516
|
-
| `initValRsc` (`@valbuild/next/rsc`)
|
|
517
|
-
| `draftMode()` from `next/headers`
|
|
518
|
-
| `valNextAppRouter`
|
|
519
|
-
| `ValImage` wraps `next/image`
|
|
520
|
-
| `fetchVal` in a Server Component
|
|
521
|
-
|
|
|
522
|
-
| no content analytics yet
|
|
512
|
+
| Next | TanStack Start |
|
|
513
|
+
| -------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
514
|
+
| `nextAppRouter` | `tanstackRouter` |
|
|
515
|
+
| `app/blogs/[blog]/page.val.ts` | `src/routes/blogs.$blog.val.ts` |
|
|
516
|
+
| `initValRsc` (`@valbuild/next/rsc`) | `initValContent` (`@valbuild/tanstack/server`) |
|
|
517
|
+
| `draftMode()` from `next/headers` | `valDraftMode()` (a cookie this package owns) |
|
|
518
|
+
| `valNextAppRouter` | `valApiHandler` — a `Request` in, a `Response` out |
|
|
519
|
+
| `ValImage` wraps `next/image` | `ValImage` is an `<img>` |
|
|
520
|
+
| `fetchVal` in a Server Component | hooks in components; `createServerFn` for loaders |
|
|
521
|
+
| `ValProvider draft={await fetchValDraft()}` in the root layout | `fetchValDraft` in a `createServerFn` the layout's loader calls |
|
|
522
|
+
| no content analytics yet | `ValProvider analytics` |
|
|
523
523
|
|
|
524
524
|
## Schema reference
|
|
525
525
|
|