@valbuild/tanstack 0.144.1 → 0.144.2

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,27 @@
1
1
  # @valbuild/tanstack
2
2
 
3
+ ## 0.144.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#832](https://github.com/valbuild/val/pull/832) [`ab0ea20`](https://github.com/valbuild/val/commit/ab0ea2046e3872c4955f34b363881f76d48d1b1e) Thanks [@freekh](https://github.com/freekh)! - A site served by Val's platform can now be given its content separately from its build. When the platform hands a TanStack app a content version (`VAL_CONTENT`) that differs from what the build bundles, Val renders that content, in the Studio and in draft mode too. It reads it the way it already reads a proposal's saved content.
8
+
9
+ Nothing changes for an app that is not given one, and nothing hands one over yet. This is the reading side of publishing content without rebuilding the site.
10
+
11
+ A version too large for one environment variable can name others under `refs` (`"env://VAL_CONTENT_1"`), each holding one module's Source or one file's text. Only `refs` is resolved, never a string inside your content, and only variables named `VAL_CONTENT_<n>` are read.
12
+
13
+ At a proposal's address, a proposal's saved content is shown over the content version the site serves, so modules the proposal did not change show what the site shows rather than what the build bundles.
14
+
15
+ When Val's platform puts a publish live without building the site, because it changed only content, the Studio shows it being checked and going live instead of "Building".
16
+
17
+ - Updated dependencies [[`ab0ea20`](https://github.com/valbuild/val/commit/ab0ea2046e3872c4955f34b363881f76d48d1b1e), [`44a5636`](https://github.com/valbuild/val/commit/44a5636955e005a40f2e6c8544e5cf4378fd0fdf)]:
18
+ - @valbuild/server@0.144.2
19
+ - @valbuild/shared@0.144.2
20
+ - @valbuild/ui@0.144.2
21
+ - @valbuild/language-server@0.144.2
22
+ - @valbuild/mcp@0.144.2
23
+ - @valbuild/react@0.144.2
24
+
3
25
  ## 0.144.1
4
26
 
5
27
  ### Patch Changes
@@ -63,6 +63,25 @@ export declare const initFetchValStega: (config: ValConfig, valApiEndpoints: str
63
63
  snapshot?: Snapshot) => <T extends Resolvable>(selector: T) => Promise<ResolvedVal<T>>;
64
64
  /** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
65
65
  type Snapshot = Record<ModuleFilePath, Json>;
66
+ /**
67
+ * What the readers render over the bundle: a proposal's saves over the
68
+ * content version the site serves (`layeredSnapshot` in @valbuild/server),
69
+ * either alone, or nothing.
70
+ */
71
+ export declare function snapshotForReaders(http: Pick<ValHttpMode, "proposal" | "contentVersion" | "projectSource"> | undefined): Snapshot | undefined;
72
+ /**
73
+ * Where an isolate says which content version it applied, for the platform
74
+ * serving it to read back after a render (valbuild/home: the loader answers it
75
+ * as a header). A Val that predates content versions never sets it, which is
76
+ * how the platform tells that an app cannot be served a version its build does
77
+ * not bundle -- an unknown option is otherwise ignored, silently.
78
+ */
79
+ export declare const CONTENT_APPLIED_GLOBAL = "__VAL_CONTENT_APPLIED";
80
+ /**
81
+ * Name the content version this isolate renders, when it renders one -- at a
82
+ * proposal's address too, where it is under the proposal's saves.
83
+ */
84
+ export declare function markContentApplied(http: Pick<ValHttpMode, "proposal" | "contentVersion"> | undefined): void;
66
85
  /** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
67
86
  export type DraftValServer = {
68
87
  "/sources/~": ValServer["/sources/~"];
@@ -1,5 +1,5 @@
1
1
  import { ValConfig, ValModules } from "@valbuild/core";
2
- import { type CommitContext, type CommitResult, type ValPatchStore, type ValProposal } from "@valbuild/server";
2
+ import { type CommitContext, type CommitResult, type ValPatchStore, type ValContentVersion, type ValProposal } from "@valbuild/server";
3
3
  import { type ValDraftMode } from "./valDraftMode.js";
4
4
  /**
5
5
  * What `http` mode needs, as one object.
@@ -80,6 +80,14 @@ export type ValHttpMode = {
80
80
  * should set it.
81
81
  */
82
82
  proposal?: ValProposal;
83
+ /**
84
+ * The content version the site serves, when the platform says it differs
85
+ * from the one this build bundles (`VAL_CONTENT`; read it with
86
+ * `contentFromEnv`). Its Source replaces the bundle's for what it holds, on
87
+ * every read, and its publish is this server's position. Ignored at a
88
+ * proposal's address. Nothing else should set it.
89
+ */
90
+ contentVersion?: ValContentVersion;
83
91
  };
84
92
  export declare function initValServer(valModules: ValModules, config: ValConfig & {
85
93
  disableCache?: boolean;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('./version-aa10b04d.cjs.dev.js');
5
+ var version = require('./version-c4d88129.cjs.dev.js');
6
6
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-4497beef.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('./version-664d3be8.cjs.prod.js');
5
+ var version = require('./version-277910e9.cjs.prod.js');
6
6
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
@@ -1,4 +1,4 @@
1
- import { _ as _asyncToGenerator, a as _regenerator, r as readValEnableCookie, V as VERSION$1 } from './version-62df289a.esm.js';
1
+ import { _ as _asyncToGenerator, a as _regenerator, r as readValEnableCookie, V as VERSION$1 } from './version-f6399796.esm.js';
2
2
  import { _ as _objectSpread2, a as _slicedToArray, b as _createForOfIteratorHelper } from './createForOfIteratorHelper-93a62170.esm.js';
3
3
  import { Internal as Internal$1, initVal as initVal$1, DEFAULT_CONTENT_HOST } from '@valbuild/core';
4
4
  import * as core from '@valbuild/core';
@@ -212,7 +212,7 @@ var packageJson = {
212
212
  "tanstack-router",
213
213
  "react"
214
214
  ],
215
- version: "0.144.1",
215
+ version: "0.144.2",
216
216
  scripts: {
217
217
  typecheck: "tsc --noEmit",
218
218
  test: "jest"
@@ -212,7 +212,7 @@ var packageJson = {
212
212
  "tanstack-router",
213
213
  "react"
214
214
  ],
215
- version: "0.144.1",
215
+ version: "0.144.2",
216
216
  scripts: {
217
217
  typecheck: "tsc --noEmit",
218
218
  test: "jest"
@@ -210,7 +210,7 @@ var packageJson = {
210
210
  "tanstack-router",
211
211
  "react"
212
212
  ],
213
- version: "0.144.1",
213
+ version: "0.144.2",
214
214
  scripts: {
215
215
  typecheck: "tsc --noEmit",
216
216
  test: "jest"
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "tanstack-router",
15
15
  "react"
16
16
  ],
17
- "version": "0.144.1",
17
+ "version": "0.144.2",
18
18
  "main": "dist/valbuild-tanstack.cjs.js",
19
19
  "module": "dist/valbuild-tanstack.esm.js",
20
20
  "exports": {
@@ -43,12 +43,12 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@valbuild/core": "0.144.0",
46
- "@valbuild/language-server": "0.144.1",
47
- "@valbuild/mcp": "0.144.1",
48
- "@valbuild/react": "0.144.0",
49
- "@valbuild/ui": "0.144.0",
50
- "@valbuild/shared": "0.144.0",
51
- "@valbuild/server": "0.144.1"
46
+ "@valbuild/language-server": "0.144.2",
47
+ "@valbuild/mcp": "0.144.2",
48
+ "@valbuild/react": "0.144.2",
49
+ "@valbuild/server": "0.144.2",
50
+ "@valbuild/shared": "0.144.2",
51
+ "@valbuild/ui": "0.144.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@tanstack/react-router": "^1.170.41",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-aa10b04d.cjs.dev.js');
5
+ var version = require('../../dist/version-c4d88129.cjs.dev.js');
6
6
  var core = require('@valbuild/core');
7
7
  var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-4497beef.cjs.dev.js');
8
8
  var server = require('@valbuild/server');
@@ -632,6 +632,36 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
632
632
 
633
633
  /** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
634
634
 
635
+ /**
636
+ * What the readers render over the bundle: a proposal's saves over the
637
+ * content version the site serves (`layeredSnapshot` in @valbuild/server),
638
+ * either alone, or nothing.
639
+ */
640
+ function snapshotForReaders(http) {
641
+ var source = server.layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
642
+ return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
643
+ }
644
+
645
+ /**
646
+ * Where an isolate says which content version it applied, for the platform
647
+ * serving it to read back after a render (valbuild/home: the loader answers it
648
+ * as a header). A Val that predates content versions never sets it, which is
649
+ * how the platform tells that an app cannot be served a version its build does
650
+ * not bundle -- an unknown option is otherwise ignored, silently.
651
+ */
652
+ var CONTENT_APPLIED_GLOBAL = "__VAL_CONTENT_APPLIED";
653
+
654
+ /**
655
+ * Name the content version this isolate renders, when it renders one -- at a
656
+ * proposal's address too, where it is under the proposal's saves.
657
+ */
658
+ function markContentApplied(http) {
659
+ if ((http === null || http === void 0 ? void 0 : http.contentVersion) === undefined) {
660
+ return;
661
+ }
662
+ Reflect.set(globalThis, CONTENT_APPLIED_GLOBAL, http.contentVersion.id);
663
+ }
664
+
635
665
  /** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
636
666
 
637
667
  /**
@@ -1515,7 +1545,7 @@ function _requestCookies() {
1515
1545
  return _requestCookies.apply(this, arguments);
1516
1546
  }
1517
1547
  function initValContent(config, valModules, opts) {
1518
- var _opts$http, _opts$draftMode;
1548
+ var _opts$draftMode;
1519
1549
  var coreVersion = core.Internal.VERSION.core;
1520
1550
  if (!coreVersion) {
1521
1551
  throw new Error("Could not get @valbuild/core package version");
@@ -1525,7 +1555,8 @@ function initValContent(config, valModules, opts) {
1525
1555
  throw new Error("Could not get @valbuild/tanstack package version");
1526
1556
  }
1527
1557
  var draftSourcesScope = createTanStackRequestScope();
1528
- var snapshot = (opts === null || opts === void 0 || (_opts$http = opts.http) === null || _opts$http === void 0 ? void 0 : _opts$http.proposal) !== undefined ? server.proposalSnapshotForReaders(opts.http.proposal, opts.http.projectSource) : undefined;
1558
+ var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
1559
+ markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
1529
1560
  var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
1530
1561
  var isEnabled = function isEnabled() {
1531
1562
  return draftMode.isEnabled();
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-664d3be8.cjs.prod.js');
5
+ var version = require('../../dist/version-277910e9.cjs.prod.js');
6
6
  var core = require('@valbuild/core');
7
7
  var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
8
8
  var server = require('@valbuild/server');
@@ -632,6 +632,36 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
632
632
 
633
633
  /** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
634
634
 
635
+ /**
636
+ * What the readers render over the bundle: a proposal's saves over the
637
+ * content version the site serves (`layeredSnapshot` in @valbuild/server),
638
+ * either alone, or nothing.
639
+ */
640
+ function snapshotForReaders(http) {
641
+ var source = server.layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
642
+ return source !== undefined ? server.proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
643
+ }
644
+
645
+ /**
646
+ * Where an isolate says which content version it applied, for the platform
647
+ * serving it to read back after a render (valbuild/home: the loader answers it
648
+ * as a header). A Val that predates content versions never sets it, which is
649
+ * how the platform tells that an app cannot be served a version its build does
650
+ * not bundle -- an unknown option is otherwise ignored, silently.
651
+ */
652
+ var CONTENT_APPLIED_GLOBAL = "__VAL_CONTENT_APPLIED";
653
+
654
+ /**
655
+ * Name the content version this isolate renders, when it renders one -- at a
656
+ * proposal's address too, where it is under the proposal's saves.
657
+ */
658
+ function markContentApplied(http) {
659
+ if ((http === null || http === void 0 ? void 0 : http.contentVersion) === undefined) {
660
+ return;
661
+ }
662
+ Reflect.set(globalThis, CONTENT_APPLIED_GLOBAL, http.contentVersion.id);
663
+ }
664
+
635
665
  /** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
636
666
 
637
667
  /**
@@ -1515,7 +1545,7 @@ function _requestCookies() {
1515
1545
  return _requestCookies.apply(this, arguments);
1516
1546
  }
1517
1547
  function initValContent(config, valModules, opts) {
1518
- var _opts$http, _opts$draftMode;
1548
+ var _opts$draftMode;
1519
1549
  var coreVersion = core.Internal.VERSION.core;
1520
1550
  if (!coreVersion) {
1521
1551
  throw new Error("Could not get @valbuild/core package version");
@@ -1525,7 +1555,8 @@ function initValContent(config, valModules, opts) {
1525
1555
  throw new Error("Could not get @valbuild/tanstack package version");
1526
1556
  }
1527
1557
  var draftSourcesScope = createTanStackRequestScope();
1528
- var snapshot = (opts === null || opts === void 0 || (_opts$http = opts.http) === null || _opts$http === void 0 ? void 0 : _opts$http.proposal) !== undefined ? server.proposalSnapshotForReaders(opts.http.proposal, opts.http.projectSource) : undefined;
1558
+ var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
1559
+ markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
1529
1560
  var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
1530
1561
  var isEnabled = function isEnabled() {
1531
1562
  return draftMode.isEnabled();
@@ -1,7 +1,7 @@
1
- import { _ as _asyncToGenerator, a as _regenerator, V as VERSION, s as setValEnableCookieReader } from '../../dist/version-62df289a.esm.js';
1
+ import { _ as _asyncToGenerator, a as _regenerator, V as VERSION, s as setValEnableCookieReader } from '../../dist/version-f6399796.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
3
  import { _ as _objectSpread2, a as _slicedToArray, e as _arrayLikeToArray, f as _unsupportedIterableToArray, b as _createForOfIteratorHelper, d as _defineProperty } from '../../dist/createForOfIteratorHelper-93a62170.esm.js';
4
- import { createValApiRouter, createValServer, proposalSnapshotForReaders } from '@valbuild/server';
4
+ import { createValApiRouter, createValServer, layeredSnapshot, proposalSnapshotForReaders } from '@valbuild/server';
5
5
  export { InMemoryPatchStore, createPrettierFormatter } from '@valbuild/server';
6
6
  import { _ as _typeof, b as initValRouteFromVal, g as getJsonEntryStegaRoot, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal } from '../../dist/routeFromVal-1221e70d.esm.js';
7
7
  import { stegaEncode, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
@@ -611,6 +611,36 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
611
611
 
612
612
  /** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
613
613
 
614
+ /**
615
+ * What the readers render over the bundle: a proposal's saves over the
616
+ * content version the site serves (`layeredSnapshot` in @valbuild/server),
617
+ * either alone, or nothing.
618
+ */
619
+ function snapshotForReaders(http) {
620
+ var source = layeredSnapshot(http === null || http === void 0 ? void 0 : http.proposal, http === null || http === void 0 ? void 0 : http.contentVersion);
621
+ return source !== undefined ? proposalSnapshotForReaders(source, http === null || http === void 0 ? void 0 : http.projectSource) : undefined;
622
+ }
623
+
624
+ /**
625
+ * Where an isolate says which content version it applied, for the platform
626
+ * serving it to read back after a render (valbuild/home: the loader answers it
627
+ * as a header). A Val that predates content versions never sets it, which is
628
+ * how the platform tells that an app cannot be served a version its build does
629
+ * not bundle -- an unknown option is otherwise ignored, silently.
630
+ */
631
+ var CONTENT_APPLIED_GLOBAL = "__VAL_CONTENT_APPLIED";
632
+
633
+ /**
634
+ * Name the content version this isolate renders, when it renders one -- at a
635
+ * proposal's address too, where it is under the proposal's saves.
636
+ */
637
+ function markContentApplied(http) {
638
+ if ((http === null || http === void 0 ? void 0 : http.contentVersion) === undefined) {
639
+ return;
640
+ }
641
+ Reflect.set(globalThis, CONTENT_APPLIED_GLOBAL, http.contentVersion.id);
642
+ }
643
+
614
644
  /** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
615
645
 
616
646
  /**
@@ -1494,7 +1524,7 @@ function _requestCookies() {
1494
1524
  return _requestCookies.apply(this, arguments);
1495
1525
  }
1496
1526
  function initValContent(config, valModules, opts) {
1497
- var _opts$http, _opts$draftMode;
1527
+ var _opts$draftMode;
1498
1528
  var coreVersion = Internal.VERSION.core;
1499
1529
  if (!coreVersion) {
1500
1530
  throw new Error("Could not get @valbuild/core package version");
@@ -1504,7 +1534,8 @@ function initValContent(config, valModules, opts) {
1504
1534
  throw new Error("Could not get @valbuild/tanstack package version");
1505
1535
  }
1506
1536
  var draftSourcesScope = createTanStackRequestScope();
1507
- var snapshot = (opts === null || opts === void 0 || (_opts$http = opts.http) === null || _opts$http === void 0 ? void 0 : _opts$http.proposal) !== undefined ? proposalSnapshotForReaders(opts.http.proposal, opts.http.projectSource) : undefined;
1537
+ var snapshot = snapshotForReaders(opts === null || opts === void 0 ? void 0 : opts.http);
1538
+ markContentApplied(opts === null || opts === void 0 ? void 0 : opts.http);
1508
1539
  var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
1509
1540
  var isEnabled = function isEnabled() {
1510
1541
  return draftMode.isEnabled();