@valbuild/tanstack 0.152.2 → 0.153.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @valbuild/tanstack
2
2
 
3
+ ## 0.153.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1031](https://github.com/valbuild/val/pull/1031) [`6ec1a5d`](https://github.com/valbuild/val/commit/6ec1a5d244f0d6e064eca4135f167dfa79744f9a) Thanks [@freekh](https://github.com/freekh)! - A page no longer shows content made for code it does not have yet. When the Studio is ahead of the page (it picked up a code change first, or the browser is still running the previous build), the page keeps showing its own content for the modules whose schema changed, and says "The code changed" with a **Reload** button — in the overlay on your site, and above the page in the Studio. In local development the page usually catches up a moment later by itself, and the notice goes away without a reload.
8
+ - Updated dependencies [[`6ec1a5d`](https://github.com/valbuild/val/commit/6ec1a5d244f0d6e064eca4135f167dfa79744f9a), [`f1048d9`](https://github.com/valbuild/val/commit/f1048d93a76138d031b30d059c444a8f754b484d), [`b14870b`](https://github.com/valbuild/val/commit/b14870bebdc128234bb16e4ea06a0151d18c4771)]:
9
+ - @valbuild/react@0.153.1
10
+ - @valbuild/shared@0.153.1
11
+ - @valbuild/ui@0.153.1
12
+ - @valbuild/server@0.153.1
13
+ - @valbuild/language-server@0.153.1
14
+ - @valbuild/mcp@0.153.1
15
+
16
+ ## 0.153.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Editing content in a proposal whose code changed, before the proposal is built again:
21
+
22
+ - **A module the proposal adds** can be edited and saved right away. Its content is read from the new file and saved. Before, those edits were dropped. If the module's content is made by code (not written out in the file), the save waits and says to build the proposal first.
23
+ - **A module whose schema moved because a file it imports changed** (for example a shared `src/schemas/*.ts`) is no longer read with the old schema. Pages keep showing the content as built until the proposal is built again.
24
+ - **Edits that no longer fit the schema** can be handed to the assistant. The banner that lists them has a **Have the assistant move it** button for each one. You still discard the held edit yourself afterwards.
25
+
26
+ For this, `@valbuild/tanstack-build` records which files each Val module imports, and the `val.server.ts` it generates passes that to Val as the new optional `moduleDependencies` option of `initValServer` and `initValContent`. You do not need to set it yourself. A site built before this has no `moduleDependencies` and works as before.
27
+
28
+ - [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Removed what 0.151.0 kept only so that a Studio, a page and a server from the release before could still talk to each other during a deploy:
29
+
30
+ - **`PUT /api/val/sources/~`** is gone. Nothing in 0.151.0 asked it: the Studio reads modules through `GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and `fetchVal`, `useVal` and the MCP tools read the server's content in-process. If a script or test of yours read content through it, read one module with `GET /api/val/modules/~<path>` instead. Its answer has the module's `source` and `version`, and an `entries` map holding the `.jsonValues()` entries pending changes touched.
31
+ - **`ValDraft.base`** is gone from the type. It has not been sent or read since 0.151.0, so a `draft` you pass to `ValProvider` is not affected.
32
+ - **A page no longer accepts edits relayed by a Studio from before 0.151.0.** Such a Studio sent each module as a bare `source`. After the upgrade, the Studio and your pages come from the same deploy, so this only matters while an older Studio is still open in a tab during a rollout. Reloading that tab fixes it.
33
+ - **`/api/val/stat`** no longer needs `sourcesSha` and `schemaSha`. The Studio now tells your local server which version it last saw, and the server still sends both fields for a Studio of 0.151.0. They stop being sent in the next release.
34
+
35
+ ### Patch Changes
36
+
37
+ - [#1030](https://github.com/valbuild/val/pull/1030) [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c) Thanks [@freekh](https://github.com/freekh)! - **Point the assistant at something on the page.** With the preview open, the assistant has a **Select** in its header: press it, click a field on the page, and what you picked shows above the message box and goes with your next message, so "make this shorter" means that field. In code mode it can pick any element, outlined in the proposal's colour. Press the × on it to take it off.
38
+
39
+ - Selecting a field to edit has moved from the preview's toolbar to the top of the editor column, beside **Structure | On page**. Esc turns it off, from the Studio or from the page.
40
+ - On a desktop the assistant now sits beside the preview instead of over it, so it never covers what you point it at.
41
+ - The assistant can read the page in the preview, and take a picture of it, to see what you see.
42
+
43
+ - Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`56ab7d5`](https://github.com/valbuild/val/commit/56ab7d5818772a9e310a561ebdb798b27ee704c9)]:
44
+ - @valbuild/ui@0.153.0
45
+ - @valbuild/core@0.153.0
46
+ - @valbuild/server@0.153.0
47
+ - @valbuild/shared@0.153.0
48
+ - @valbuild/react@0.153.0
49
+ - @valbuild/language-server@0.153.0
50
+ - @valbuild/mcp@0.153.0
51
+
3
52
  ## 0.152.2
4
53
 
5
54
  ### Patch Changes
@@ -2,13 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _typeof = require('../../dist/typeof-bd6ec82c.cjs.dev.js');
5
6
  var core = require('@valbuild/core');
6
7
  var internal = require('@valbuild/react/internal');
8
+ var internal$1 = require('@valbuild/shared/internal');
7
9
  var React = require('react');
8
- var ValOverlayContext = require('../../dist/ValOverlayContext-b18c2f18.cjs.dev.js');
10
+ var ValOverlayContext = require('../../dist/ValOverlayContext-81efbc82.cjs.dev.js');
9
11
  var routeFromVal = require('../../dist/routeFromVal-3d4d7c30.cjs.dev.js');
10
12
  require('react/jsx-runtime');
11
- require('../../dist/typeof-bd6ec82c.cjs.dev.js');
12
13
  require('@valbuild/shared/client');
13
14
 
14
15
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -80,15 +81,23 @@ function useEncodesEditTags(context) {
80
81
  */
81
82
  function pageReadEnv(state, encode) {
82
83
  var _state$draftSourcesSy;
83
- return {
84
+ return _typeof._objectSpread2({
84
85
  sources: [internal.overlaySource(state.store, {
85
86
  draftMode: state.draftMode,
86
87
  suspend: state.suspend,
87
88
  draftModeReady: state.draftModeReady,
88
89
  synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
89
90
  }), internal.snapshotSource(state.snapshot)],
90
- encode: encode
91
- };
91
+ encode: encode,
92
+ // The rule the server readers apply: a module the Studio relays made with
93
+ // another schema than this page's code has is not read with it. A Studio
94
+ // ahead of this build (hot reload first, or staged code it evaluated)
95
+ // sends content for code this page does not run; the page keeps its
96
+ // bundle's, and says the code changed (`schemaChecked`).
97
+ schemaVersionOf: internal$1.readerSchemaVersion
98
+ }, state.schemaChecked !== undefined ? {
99
+ schemaChecked: state.schemaChecked
100
+ } : {});
92
101
  }
93
102
 
94
103
  /**
@@ -102,7 +111,8 @@ function useReadEnv() {
102
111
  draftMode = context.draftMode,
103
112
  suspend = context.suspend,
104
113
  draftModeReady = context.draftModeReady,
105
- draftSourcesSynced = context.draftSourcesSynced;
114
+ draftSourcesSynced = context.draftSourcesSynced,
115
+ schemaChecked = context.schemaChecked;
106
116
  var snapshot = context.snapshot;
107
117
  return React__default["default"].useMemo(function () {
108
118
  return pageReadEnv({
@@ -111,9 +121,10 @@ function useReadEnv() {
111
121
  suspend: suspend,
112
122
  draftModeReady: draftModeReady,
113
123
  draftSourcesSynced: draftSourcesSynced,
124
+ schemaChecked: schemaChecked,
114
125
  snapshot: snapshot
115
126
  }, encode);
116
- }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, snapshot, encode]);
127
+ }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, snapshot, encode]);
117
128
  }
118
129
 
119
130
  /** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
@@ -2,13 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _typeof = require('../../dist/typeof-56656438.cjs.prod.js');
5
6
  var core = require('@valbuild/core');
6
7
  var internal = require('@valbuild/react/internal');
8
+ var internal$1 = require('@valbuild/shared/internal');
7
9
  var React = require('react');
8
- var ValOverlayContext = require('../../dist/ValOverlayContext-1e50a557.cjs.prod.js');
10
+ var ValOverlayContext = require('../../dist/ValOverlayContext-dec6d4bd.cjs.prod.js');
9
11
  var routeFromVal = require('../../dist/routeFromVal-2e834397.cjs.prod.js');
10
12
  require('react/jsx-runtime');
11
- require('../../dist/typeof-56656438.cjs.prod.js');
12
13
  require('@valbuild/shared/client');
13
14
 
14
15
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -80,15 +81,23 @@ function useEncodesEditTags(context) {
80
81
  */
81
82
  function pageReadEnv(state, encode) {
82
83
  var _state$draftSourcesSy;
83
- return {
84
+ return _typeof._objectSpread2({
84
85
  sources: [internal.overlaySource(state.store, {
85
86
  draftMode: state.draftMode,
86
87
  suspend: state.suspend,
87
88
  draftModeReady: state.draftModeReady,
88
89
  synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
89
90
  }), internal.snapshotSource(state.snapshot)],
90
- encode: encode
91
- };
91
+ encode: encode,
92
+ // The rule the server readers apply: a module the Studio relays made with
93
+ // another schema than this page's code has is not read with it. A Studio
94
+ // ahead of this build (hot reload first, or staged code it evaluated)
95
+ // sends content for code this page does not run; the page keeps its
96
+ // bundle's, and says the code changed (`schemaChecked`).
97
+ schemaVersionOf: internal$1.readerSchemaVersion
98
+ }, state.schemaChecked !== undefined ? {
99
+ schemaChecked: state.schemaChecked
100
+ } : {});
92
101
  }
93
102
 
94
103
  /**
@@ -102,7 +111,8 @@ function useReadEnv() {
102
111
  draftMode = context.draftMode,
103
112
  suspend = context.suspend,
104
113
  draftModeReady = context.draftModeReady,
105
- draftSourcesSynced = context.draftSourcesSynced;
114
+ draftSourcesSynced = context.draftSourcesSynced,
115
+ schemaChecked = context.schemaChecked;
106
116
  var snapshot = context.snapshot;
107
117
  return React__default["default"].useMemo(function () {
108
118
  return pageReadEnv({
@@ -111,9 +121,10 @@ function useReadEnv() {
111
121
  suspend: suspend,
112
122
  draftModeReady: draftModeReady,
113
123
  draftSourcesSynced: draftSourcesSynced,
124
+ schemaChecked: schemaChecked,
114
125
  snapshot: snapshot
115
126
  }, encode);
116
- }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, snapshot, encode]);
127
+ }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, snapshot, encode]);
117
128
  }
118
129
 
119
130
  /** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
@@ -1,10 +1,11 @@
1
+ import { _ as _objectSpread2 } from '../../dist/typeof-3e1a1d11.esm.js';
1
2
  import { Internal } from '@valbuild/core';
2
3
  import { useResolvedVal, useResolvedEntry, useResolved, isJsonValuesRecordSchema, mapResolution, resolveModuleEntry, resolveVal, overlaySource, snapshotSource } from '@valbuild/react/internal';
4
+ import { readerSchemaVersion } from '@valbuild/shared/internal';
3
5
  import React from 'react';
4
- import { u as useValOverlayContext } from '../../dist/ValOverlayContext-6826b4d9.esm.js';
6
+ import { u as useValOverlayContext } from '../../dist/ValOverlayContext-bd2f453c.esm.js';
5
7
  import { g as getValRouteUrlFromVal, i as initValRouteFromVal } from '../../dist/routeFromVal-124235a5.esm.js';
6
8
  import 'react/jsx-runtime';
7
- import '../../dist/typeof-3e1a1d11.esm.js';
8
9
  import '@valbuild/shared/client';
9
10
 
10
11
  var subscribeNever = function subscribeNever() {
@@ -72,15 +73,23 @@ function useEncodesEditTags(context) {
72
73
  */
73
74
  function pageReadEnv(state, encode) {
74
75
  var _state$draftSourcesSy;
75
- return {
76
+ return _objectSpread2({
76
77
  sources: [overlaySource(state.store, {
77
78
  draftMode: state.draftMode,
78
79
  suspend: state.suspend,
79
80
  draftModeReady: state.draftModeReady,
80
81
  synced: (_state$draftSourcesSy = state.draftSourcesSynced) !== null && _state$draftSourcesSy !== void 0 ? _state$draftSourcesSy : false
81
82
  }), snapshotSource(state.snapshot)],
82
- encode: encode
83
- };
83
+ encode: encode,
84
+ // The rule the server readers apply: a module the Studio relays made with
85
+ // another schema than this page's code has is not read with it. A Studio
86
+ // ahead of this build (hot reload first, or staged code it evaluated)
87
+ // sends content for code this page does not run; the page keeps its
88
+ // bundle's, and says the code changed (`schemaChecked`).
89
+ schemaVersionOf: readerSchemaVersion
90
+ }, state.schemaChecked !== undefined ? {
91
+ schemaChecked: state.schemaChecked
92
+ } : {});
84
93
  }
85
94
 
86
95
  /**
@@ -94,7 +103,8 @@ function useReadEnv() {
94
103
  draftMode = context.draftMode,
95
104
  suspend = context.suspend,
96
105
  draftModeReady = context.draftModeReady,
97
- draftSourcesSynced = context.draftSourcesSynced;
106
+ draftSourcesSynced = context.draftSourcesSynced,
107
+ schemaChecked = context.schemaChecked;
98
108
  var snapshot = context.snapshot;
99
109
  return React.useMemo(function () {
100
110
  return pageReadEnv({
@@ -103,9 +113,10 @@ function useReadEnv() {
103
113
  suspend: suspend,
104
114
  draftModeReady: draftModeReady,
105
115
  draftSourcesSynced: draftSourcesSynced,
116
+ schemaChecked: schemaChecked,
106
117
  snapshot: snapshot
107
118
  }, encode);
108
- }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, snapshot, encode]);
119
+ }, [store, draftMode, suspend, draftModeReady, draftSourcesSynced, schemaChecked, snapshot, encode]);
109
120
  }
110
121
 
111
122
  /** What `useVal` gives back — see `ResolvedVal` in `@valbuild/react/stega`. */
@@ -17,6 +17,7 @@ var ValOverlayContext = /*#__PURE__*/React__default["default"].createContext({
17
17
  });
18
18
  function ValOverlayProvider(_ref) {
19
19
  var store = _ref.store,
20
+ schemaChecked = _ref.schemaChecked,
20
21
  draftMode = _ref.draftMode,
21
22
  suspend = _ref.suspend,
22
23
  draftModeReady = _ref.draftModeReady,
@@ -28,6 +29,7 @@ function ValOverlayProvider(_ref) {
28
29
  return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
29
30
  value: {
30
31
  store: store,
32
+ schemaChecked: schemaChecked,
31
33
  draftMode: draftMode,
32
34
  suspend: suspend,
33
35
  draftModeReady: draftModeReady,
@@ -11,6 +11,7 @@ var ValOverlayContext = /*#__PURE__*/React.createContext({
11
11
  });
12
12
  function ValOverlayProvider(_ref) {
13
13
  var store = _ref.store,
14
+ schemaChecked = _ref.schemaChecked,
14
15
  draftMode = _ref.draftMode,
15
16
  suspend = _ref.suspend,
16
17
  draftModeReady = _ref.draftModeReady,
@@ -22,6 +23,7 @@ function ValOverlayProvider(_ref) {
22
23
  return /*#__PURE__*/jsx(ValOverlayContext.Provider, {
23
24
  value: {
24
25
  store: store,
26
+ schemaChecked: schemaChecked,
25
27
  draftMode: draftMode,
26
28
  suspend: suspend,
27
29
  draftModeReady: draftModeReady,
@@ -17,6 +17,7 @@ var ValOverlayContext = /*#__PURE__*/React__default["default"].createContext({
17
17
  });
18
18
  function ValOverlayProvider(_ref) {
19
19
  var store = _ref.store,
20
+ schemaChecked = _ref.schemaChecked,
20
21
  draftMode = _ref.draftMode,
21
22
  suspend = _ref.suspend,
22
23
  draftModeReady = _ref.draftModeReady,
@@ -28,6 +29,7 @@ function ValOverlayProvider(_ref) {
28
29
  return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
29
30
  value: {
30
31
  store: store,
32
+ schemaChecked: schemaChecked,
31
33
  draftMode: draftMode,
32
34
  suspend: suspend,
33
35
  draftModeReady: draftModeReady,
@@ -1,6 +1,6 @@
1
1
  import { type Json, type ModuleFilePath, type ResolvableModule, SelectorSource, type ValModule } from "@valbuild/core";
2
2
  import { type JsonEntryContentOf, type Resolvable, type ResolvedVal, type RouteValueOf } from "@valbuild/react/stega";
3
- import { type ReadEnv, type Resolution, type ValExternalStore } from "@valbuild/react/internal";
3
+ import { type ReadEnv, type SchemaRule, type Resolution, type ValExternalStore } from "@valbuild/react/internal";
4
4
  import { ValConfig } from "@valbuild/core";
5
5
  /** What the provider tells the hooks: `ValOverlayContext`'s value. */
6
6
  export type PageReadState = {
@@ -9,6 +9,11 @@ export type PageReadState = {
9
9
  suspend: boolean;
10
10
  draftModeReady?: Promise<void>;
11
11
  draftSourcesSynced?: boolean;
12
+ /**
13
+ * Told whether each module the Studio relayed was made with this page's
14
+ * schema, so the provider can say when it was not (`codeChangedReporter`).
15
+ */
16
+ schemaChecked?: SchemaRule["schemaChecked"];
12
17
  snapshot?: Record<ModuleFilePath, Json>;
13
18
  };
14
19
  /**
@@ -36,7 +36,7 @@ type Snapshot = Record<ModuleFilePath, Json>;
36
36
  * content version the site serves (`layeredSnapshot` in @valbuild/server),
37
37
  * either alone, or nothing.
38
38
  */
39
- export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource"> | undefined): Snapshot | undefined;
39
+ export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource" | "moduleDependencies"> | undefined): Snapshot | undefined;
40
40
  /**
41
41
  * Where an isolate says which content version it applied, for the platform
42
42
  * serving it to read back after a render (valbuild/home: the loader answers it
@@ -58,6 +58,16 @@ export type ValHttpMode = {
58
58
  * `.val.ts` at all.
59
59
  */
60
60
  projectSource?: Record<string, string>;
61
+ /**
62
+ * For each of this build's module files, every project file it depends on
63
+ * as the build resolved its imports (by path with no leading slash,
64
+ * transitive): what tells a proposal's address that a module whose own
65
+ * file is not staged is of code the build was not made of, through a file
66
+ * it imports. A host that builds the project itself hands it over, beside
67
+ * {@link projectSource}; the build platform does, as
68
+ * `platform:val-module-dependencies`. Nothing else should set it.
69
+ */
70
+ moduleDependencies?: Record<string, string[]>;
61
71
  /**
62
72
  * The publish job this build was made for, when a Studio built it in a
63
73
  * tab: how a build with no commit says where it sits in the content