@valbuild/tanstack 0.146.4 → 0.148.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/client/dist/valbuild-tanstack-client.cjs.dev.js +6 -6
  3. package/client/dist/valbuild-tanstack-client.cjs.prod.js +6 -6
  4. package/client/dist/valbuild-tanstack-client.esm.js +4 -4
  5. package/demo/dist/valbuild-tanstack-demo.cjs.d.ts +2 -0
  6. package/demo/dist/valbuild-tanstack-demo.cjs.dev.js +105 -0
  7. package/demo/dist/valbuild-tanstack-demo.cjs.js +7 -0
  8. package/demo/dist/valbuild-tanstack-demo.cjs.prod.js +105 -0
  9. package/demo/dist/valbuild-tanstack-demo.esm.js +101 -0
  10. package/demo/package.json +4 -0
  11. package/dist/{ValOverlayContext-3f080cce.cjs.dev.js → ValOverlayContext-510328ec.cjs.dev.js} +17 -17
  12. package/dist/{ValOverlayContext-59a0b19f.esm.js → ValOverlayContext-6278320b.esm.js} +1 -1
  13. package/dist/{ValOverlayContext-3e2c48a6.cjs.prod.js → ValOverlayContext-d3acd157.cjs.prod.js} +17 -17
  14. package/dist/{version-4da65f4f.esm.js → asyncToGenerator-500f022f.esm.js} +1 -149
  15. package/dist/{version-2cbea560.cjs.prod.js → asyncToGenerator-8e5c36c8.cjs.prod.js} +0 -151
  16. package/dist/{version-1f65da50.cjs.dev.js → asyncToGenerator-c3823d62.cjs.dev.js} +0 -151
  17. package/dist/declarations/src/ValApp.d.ts +15 -1
  18. package/dist/declarations/src/ValProvider.d.ts +1 -0
  19. package/dist/declarations/src/demo/index.d.ts +7 -0
  20. package/dist/declarations/src/demo/initValDemoServer.d.ts +27 -0
  21. package/dist/demoServiceWorker-382e1b63.cjs.dev.js +60 -0
  22. package/dist/demoServiceWorker-56fd96cf.esm.js +55 -0
  23. package/dist/demoServiceWorker-994710f7.cjs.prod.js +60 -0
  24. package/dist/{routeFromVal-385ee69c.cjs.dev.js → routeFromVal-0ea4586f.cjs.dev.js} +17 -24
  25. package/dist/{routeFromVal-ffa948ef.cjs.prod.js → routeFromVal-97a52f43.cjs.prod.js} +17 -24
  26. package/dist/{routeFromVal-ae54a17e.esm.js → routeFromVal-9f1f8725.esm.js} +7 -13
  27. package/dist/{createForOfIteratorHelper-93a62170.esm.js → typeof-66e2d869.esm.js} +11 -1
  28. package/dist/{createForOfIteratorHelper-9afd7d2d.cjs.prod.js → typeof-8998e126.cjs.prod.js} +11 -0
  29. package/dist/{createForOfIteratorHelper-4497beef.cjs.dev.js → typeof-dd0246a1.cjs.dev.js} +11 -0
  30. package/dist/valbuild-tanstack.cjs.dev.js +371 -42
  31. package/dist/valbuild-tanstack.cjs.prod.js +371 -42
  32. package/dist/valbuild-tanstack.esm.js +337 -8
  33. package/dist/version-32d982ef.cjs.prod.js +179 -0
  34. package/dist/version-c2d4fa07.esm.js +174 -0
  35. package/dist/version-e7d79f54.cjs.dev.js +179 -0
  36. package/package.json +16 -10
  37. package/server/dist/valbuild-tanstack-server.cjs.dev.js +60 -75
  38. package/server/dist/valbuild-tanstack-server.cjs.prod.js +60 -75
  39. package/server/dist/valbuild-tanstack-server.esm.js +4 -19
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createForOfIteratorHelper = require('./createForOfIteratorHelper-9afd7d2d.cjs.prod.js');
3
+ var _typeof = require('./typeof-8998e126.cjs.prod.js');
4
4
  var patch = require('@valbuild/core/patch');
5
5
  var React = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -16,7 +16,7 @@ function _classCallCheck(a, n) {
16
16
  function _defineProperties(e, r) {
17
17
  for (var t = 0; t < r.length; t++) {
18
18
  var o = r[t];
19
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, createForOfIteratorHelper._toPropertyKey(o.key), o);
19
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _typeof._toPropertyKey(o.key), o);
20
20
  }
21
21
  }
22
22
  function _createClass(e, r, t) {
@@ -30,20 +30,20 @@ var ValExternalStore = /*#__PURE__*/function () {
30
30
  function ValExternalStore() {
31
31
  var _this = this;
32
32
  _classCallCheck(this, ValExternalStore);
33
- createForOfIteratorHelper._defineProperty(this, "listeners", void 0);
34
- createForOfIteratorHelper._defineProperty(this, "loadPromises", void 0);
33
+ _typeof._defineProperty(this, "listeners", void 0);
34
+ _typeof._defineProperty(this, "loadPromises", void 0);
35
35
  // Path-keyed cache of every source seen via update(). The single source of
36
36
  // truth: load state and snapshots are both derived from this, so data can be
37
37
  // queried for any combination of paths even before a subscriber registers.
38
- createForOfIteratorHelper._defineProperty(this, "loadedSources", void 0);
38
+ _typeof._defineProperty(this, "loadedSources", void 0);
39
39
  // Reference-stable per-subscriberId snapshot cache for useSyncExternalStore.
40
40
  // Built lazily from loadedSources in get() and invalidated in update().
41
- createForOfIteratorHelper._defineProperty(this, "snapshots", void 0);
41
+ _typeof._defineProperty(this, "snapshots", void 0);
42
42
  // One-shot listeners used solely by waitForLoad. Kept separate from the
43
43
  // useSyncExternalStore listeners so waitForLoad never has to register (and
44
44
  // leak) a subscriberId.
45
- createForOfIteratorHelper._defineProperty(this, "loadListeners", void 0);
46
- createForOfIteratorHelper._defineProperty(this, "subscribe", function (paths) {
45
+ _typeof._defineProperty(this, "loadListeners", void 0);
46
+ _typeof._defineProperty(this, "subscribe", function (paths) {
47
47
  return function (listener) {
48
48
  var subscriberId = createSubscriberId(paths);
49
49
  var existing = _this.listeners.get(subscriberId);
@@ -61,17 +61,17 @@ var ValExternalStore = /*#__PURE__*/function () {
61
61
  };
62
62
  };
63
63
  });
64
- createForOfIteratorHelper._defineProperty(this, "getSnapshot", function (paths) {
64
+ _typeof._defineProperty(this, "getSnapshot", function (paths) {
65
65
  return function () {
66
66
  return _this.get(paths);
67
67
  };
68
68
  });
69
- createForOfIteratorHelper._defineProperty(this, "getServerSnapshot", function (paths) {
69
+ _typeof._defineProperty(this, "getServerSnapshot", function (paths) {
70
70
  return function () {
71
71
  return _this.get(paths);
72
72
  };
73
73
  });
74
- createForOfIteratorHelper._defineProperty(this, "get", function (paths) {
74
+ _typeof._defineProperty(this, "get", function (paths) {
75
75
  var subscriberId = createSubscriberId(paths);
76
76
  if (_this.snapshots.has(subscriberId)) {
77
77
  return _this.snapshots.get(subscriberId);
@@ -80,7 +80,7 @@ var ValExternalStore = /*#__PURE__*/function () {
80
80
  // before this subscriber registered is still returned. Cache it for a
81
81
  // reference-stable result (required by useSyncExternalStore).
82
82
  var record;
83
- var _iterator = createForOfIteratorHelper._createForOfIteratorHelper(paths),
83
+ var _iterator = _typeof._createForOfIteratorHelper(paths),
84
84
  _step;
85
85
  try {
86
86
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -102,8 +102,8 @@ var ValExternalStore = /*#__PURE__*/function () {
102
102
  _this.snapshots.set(subscriberId, record);
103
103
  return record;
104
104
  });
105
- createForOfIteratorHelper._defineProperty(this, "hasAllLoaded", function (paths) {
106
- var _iterator2 = createForOfIteratorHelper._createForOfIteratorHelper(paths),
105
+ _typeof._defineProperty(this, "hasAllLoaded", function (paths) {
106
+ var _iterator2 = _typeof._createForOfIteratorHelper(paths),
107
107
  _step2;
108
108
  try {
109
109
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -131,7 +131,7 @@ var ValExternalStore = /*#__PURE__*/function () {
131
131
  * hang it resolves anyway after `LOAD_TIMEOUT_MS`, logging an error so the
132
132
  * failure is diagnosable while the page still renders with partial data.
133
133
  */
134
- createForOfIteratorHelper._defineProperty(this, "waitForLoad", function (paths) {
134
+ _typeof._defineProperty(this, "waitForLoad", function (paths) {
135
135
  if (_this.hasAllLoaded(paths)) {
136
136
  return Promise.resolve();
137
137
  }
@@ -218,7 +218,7 @@ var ValExternalStore = /*#__PURE__*/function () {
218
218
  this.snapshots["delete"](subscriberId);
219
219
  }
220
220
  }
221
- var _iterator3 = createForOfIteratorHelper._createForOfIteratorHelper(this.listeners.keys()),
221
+ var _iterator3 = _typeof._createForOfIteratorHelper(this.listeners.keys()),
222
222
  _step3;
223
223
  try {
224
224
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -242,7 +242,7 @@ var ValExternalStore = /*#__PURE__*/function () {
242
242
  key: "emitChange",
243
243
  value: function emitChange(subscriberId) {
244
244
  var _this$listeners$get;
245
- var _iterator4 = createForOfIteratorHelper._createForOfIteratorHelper((_this$listeners$get = this.listeners.get(subscriberId)) !== null && _this$listeners$get !== void 0 ? _this$listeners$get : []),
245
+ var _iterator4 = _typeof._createForOfIteratorHelper((_this$listeners$get = this.listeners.get(subscriberId)) !== null && _this$listeners$get !== void 0 ? _this$listeners$get : []),
246
246
  _step4;
247
247
  try {
248
248
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -134,152 +134,4 @@ function _asyncToGenerator(n) {
134
134
  };
135
135
  }
136
136
 
137
- /**
138
- * How `initVal().isValEnabled()` reaches the server without importing it.
139
- *
140
- * EXPERIMENTAL — see VAL_PROMPT.md.
141
- *
142
- * The cookie can only be read through `@tanstack/react-start/server`, and that
143
- * module is reachable from this package's ROOT entry, which every client
144
- * component imports. `initVal.ts` used `await import()` for exactly that reason,
145
- * and under Vite the dynamic form does keep it out of the client bundle.
146
- *
147
- * It does not everywhere. A host that bundles this package ahead of time and
148
- * audits what each chunk imports sees a dynamically imported chunk as a chunk
149
- * like any other, and this one reaches TanStack's SSR path and lands on
150
- * `node:stream/web`. That is why `@valbuild/tanstack` could not be built for a
151
- * Cloudflare Worker at all.
152
- *
153
- * So the edge is inverted. The root entry holds a slot; `@valbuild/tanstack/server`
154
- * fills it on import with the implementation that was already there,
155
- * `hasValEnableCookieOnServer`. Nothing about the behaviour changes for an app
156
- * that imports `/server` — which every app with a Val API does — and the root
157
- * entry no longer names TanStack's server module at all.
158
- *
159
- * Ordering: the slot is filled when `/server` is first imported. An
160
- * `isValEnabled()` call that somehow happens before that returns false, which
161
- * is what the old implementation's `catch` returned in the same situation.
162
- */
163
-
164
- var reader = null;
165
- function setValEnableCookieReader(read) {
166
- reader = read;
167
- }
168
- function readValEnableCookie() {
169
- return _readValEnableCookie.apply(this, arguments);
170
- }
171
- function _readValEnableCookie() {
172
- _readValEnableCookie = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
173
- return _regenerator().w(function (_context) {
174
- while (1) switch (_context.p = _context.n) {
175
- case 0:
176
- if (reader) {
177
- _context.n = 1;
178
- break;
179
- }
180
- return _context.a(2, false);
181
- case 1:
182
- _context.p = 1;
183
- _context.n = 2;
184
- return reader();
185
- case 2:
186
- return _context.a(2, _context.v);
187
- case 3:
188
- _context.p = 3;
189
- _context.v;
190
- return _context.a(2, false);
191
- }
192
- }, _callee, null, [[1, 3]]);
193
- }));
194
- return _readValEnableCookie.apply(this, arguments);
195
- }
196
-
197
- var packageJson = {
198
- name: "@valbuild/tanstack",
199
- description: "Val for TanStack Start: hard-coded content - super-charged",
200
- "private": false,
201
- repository: {
202
- type: "git",
203
- url: "git+https://github.com/valbuild/val.git"
204
- },
205
- sideEffects: true,
206
- keywords: [
207
- "CMS",
208
- "tanstack",
209
- "tanstack-start",
210
- "tanstack-router",
211
- "react"
212
- ],
213
- version: "0.146.4",
214
- scripts: {
215
- typecheck: "tsc --noEmit",
216
- test: "jest"
217
- },
218
- main: "dist/valbuild-tanstack.cjs.js",
219
- module: "dist/valbuild-tanstack.esm.js",
220
- exports: {
221
- ".": {
222
- module: "./dist/valbuild-tanstack.esm.js",
223
- "default": "./dist/valbuild-tanstack.cjs.js"
224
- },
225
- "./client": {
226
- module: "./client/dist/valbuild-tanstack-client.esm.js",
227
- "default": "./client/dist/valbuild-tanstack-client.cjs.js"
228
- },
229
- "./server": {
230
- module: "./server/dist/valbuild-tanstack-server.esm.js",
231
- "default": "./server/dist/valbuild-tanstack-server.cjs.js"
232
- },
233
- "./package.json": "./package.json"
234
- },
235
- types: "dist/valbuild-tanstack.cjs.d.ts",
236
- preconstruct: {
237
- entrypoints: [
238
- "./index.ts",
239
- "./server/index.ts",
240
- "./client/index.ts"
241
- ],
242
- exports: true
243
- },
244
- dependencies: {
245
- "@valbuild/core": "workspace:*",
246
- "@valbuild/language-server": "workspace:*",
247
- "@valbuild/mcp": "workspace:*",
248
- "@valbuild/react": "workspace:*",
249
- "@valbuild/server": "workspace:*",
250
- "@valbuild/shared": "workspace:*",
251
- "@valbuild/ui": "workspace:*"
252
- },
253
- devDependencies: {
254
- "@tanstack/react-router": "^1.170.41",
255
- "@tanstack/react-start": "^1.168.60",
256
- "@testing-library/react": "^16.3.3",
257
- "@types/react": "^19.2.18",
258
- "@types/react-dom": "^19.2.5",
259
- "jest-environment-jsdom": "^30.5.0",
260
- react: "^19.2.8",
261
- "react-dom": "^19.2.8",
262
- typescript: "^6.0.3"
263
- },
264
- peerDependencies: {
265
- "@tanstack/react-router": ">=1.130.0",
266
- "@tanstack/react-start": ">=1.130.0",
267
- react: ">=19.0.0",
268
- "react-dom": ">=19.0.0"
269
- },
270
- externals: [
271
- "@tanstack/react-router",
272
- "@tanstack/react-start"
273
- ],
274
- files: [
275
- "CHANGELOG.md",
276
- "dist",
277
- "client",
278
- "server"
279
- ]
280
- };
281
-
282
- var _packageJson$version;
283
- var VERSION = (_packageJson$version = packageJson.version) !== null && _packageJson$version !== void 0 ? _packageJson$version : null;
284
-
285
- export { VERSION as V, _asyncToGenerator as _, _regenerator as a, readValEnableCookie as r, setValEnableCookieReader as s };
137
+ export { _asyncToGenerator as _, _regenerator as a };
@@ -136,156 +136,5 @@ function _asyncToGenerator(n) {
136
136
  };
137
137
  }
138
138
 
139
- /**
140
- * How `initVal().isValEnabled()` reaches the server without importing it.
141
- *
142
- * EXPERIMENTAL — see VAL_PROMPT.md.
143
- *
144
- * The cookie can only be read through `@tanstack/react-start/server`, and that
145
- * module is reachable from this package's ROOT entry, which every client
146
- * component imports. `initVal.ts` used `await import()` for exactly that reason,
147
- * and under Vite the dynamic form does keep it out of the client bundle.
148
- *
149
- * It does not everywhere. A host that bundles this package ahead of time and
150
- * audits what each chunk imports sees a dynamically imported chunk as a chunk
151
- * like any other, and this one reaches TanStack's SSR path and lands on
152
- * `node:stream/web`. That is why `@valbuild/tanstack` could not be built for a
153
- * Cloudflare Worker at all.
154
- *
155
- * So the edge is inverted. The root entry holds a slot; `@valbuild/tanstack/server`
156
- * fills it on import with the implementation that was already there,
157
- * `hasValEnableCookieOnServer`. Nothing about the behaviour changes for an app
158
- * that imports `/server` — which every app with a Val API does — and the root
159
- * entry no longer names TanStack's server module at all.
160
- *
161
- * Ordering: the slot is filled when `/server` is first imported. An
162
- * `isValEnabled()` call that somehow happens before that returns false, which
163
- * is what the old implementation's `catch` returned in the same situation.
164
- */
165
-
166
- var reader = null;
167
- function setValEnableCookieReader(read) {
168
- reader = read;
169
- }
170
- function readValEnableCookie() {
171
- return _readValEnableCookie.apply(this, arguments);
172
- }
173
- function _readValEnableCookie() {
174
- _readValEnableCookie = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
175
- return _regenerator().w(function (_context) {
176
- while (1) switch (_context.p = _context.n) {
177
- case 0:
178
- if (reader) {
179
- _context.n = 1;
180
- break;
181
- }
182
- return _context.a(2, false);
183
- case 1:
184
- _context.p = 1;
185
- _context.n = 2;
186
- return reader();
187
- case 2:
188
- return _context.a(2, _context.v);
189
- case 3:
190
- _context.p = 3;
191
- _context.v;
192
- return _context.a(2, false);
193
- }
194
- }, _callee, null, [[1, 3]]);
195
- }));
196
- return _readValEnableCookie.apply(this, arguments);
197
- }
198
-
199
- var packageJson = {
200
- name: "@valbuild/tanstack",
201
- description: "Val for TanStack Start: hard-coded content - super-charged",
202
- "private": false,
203
- repository: {
204
- type: "git",
205
- url: "git+https://github.com/valbuild/val.git"
206
- },
207
- sideEffects: true,
208
- keywords: [
209
- "CMS",
210
- "tanstack",
211
- "tanstack-start",
212
- "tanstack-router",
213
- "react"
214
- ],
215
- version: "0.146.4",
216
- scripts: {
217
- typecheck: "tsc --noEmit",
218
- test: "jest"
219
- },
220
- main: "dist/valbuild-tanstack.cjs.js",
221
- module: "dist/valbuild-tanstack.esm.js",
222
- exports: {
223
- ".": {
224
- module: "./dist/valbuild-tanstack.esm.js",
225
- "default": "./dist/valbuild-tanstack.cjs.js"
226
- },
227
- "./client": {
228
- module: "./client/dist/valbuild-tanstack-client.esm.js",
229
- "default": "./client/dist/valbuild-tanstack-client.cjs.js"
230
- },
231
- "./server": {
232
- module: "./server/dist/valbuild-tanstack-server.esm.js",
233
- "default": "./server/dist/valbuild-tanstack-server.cjs.js"
234
- },
235
- "./package.json": "./package.json"
236
- },
237
- types: "dist/valbuild-tanstack.cjs.d.ts",
238
- preconstruct: {
239
- entrypoints: [
240
- "./index.ts",
241
- "./server/index.ts",
242
- "./client/index.ts"
243
- ],
244
- exports: true
245
- },
246
- dependencies: {
247
- "@valbuild/core": "workspace:*",
248
- "@valbuild/language-server": "workspace:*",
249
- "@valbuild/mcp": "workspace:*",
250
- "@valbuild/react": "workspace:*",
251
- "@valbuild/server": "workspace:*",
252
- "@valbuild/shared": "workspace:*",
253
- "@valbuild/ui": "workspace:*"
254
- },
255
- devDependencies: {
256
- "@tanstack/react-router": "^1.170.41",
257
- "@tanstack/react-start": "^1.168.60",
258
- "@testing-library/react": "^16.3.3",
259
- "@types/react": "^19.2.18",
260
- "@types/react-dom": "^19.2.5",
261
- "jest-environment-jsdom": "^30.5.0",
262
- react: "^19.2.8",
263
- "react-dom": "^19.2.8",
264
- typescript: "^6.0.3"
265
- },
266
- peerDependencies: {
267
- "@tanstack/react-router": ">=1.130.0",
268
- "@tanstack/react-start": ">=1.130.0",
269
- react: ">=19.0.0",
270
- "react-dom": ">=19.0.0"
271
- },
272
- externals: [
273
- "@tanstack/react-router",
274
- "@tanstack/react-start"
275
- ],
276
- files: [
277
- "CHANGELOG.md",
278
- "dist",
279
- "client",
280
- "server"
281
- ]
282
- };
283
-
284
- var _packageJson$version;
285
- var VERSION = (_packageJson$version = packageJson.version) !== null && _packageJson$version !== void 0 ? _packageJson$version : null;
286
-
287
- exports.VERSION = VERSION;
288
139
  exports._asyncToGenerator = _asyncToGenerator;
289
140
  exports._regenerator = _regenerator;
290
- exports.readValEnableCookie = readValEnableCookie;
291
- exports.setValEnableCookieReader = setValEnableCookieReader;
@@ -136,156 +136,5 @@ function _asyncToGenerator(n) {
136
136
  };
137
137
  }
138
138
 
139
- /**
140
- * How `initVal().isValEnabled()` reaches the server without importing it.
141
- *
142
- * EXPERIMENTAL — see VAL_PROMPT.md.
143
- *
144
- * The cookie can only be read through `@tanstack/react-start/server`, and that
145
- * module is reachable from this package's ROOT entry, which every client
146
- * component imports. `initVal.ts` used `await import()` for exactly that reason,
147
- * and under Vite the dynamic form does keep it out of the client bundle.
148
- *
149
- * It does not everywhere. A host that bundles this package ahead of time and
150
- * audits what each chunk imports sees a dynamically imported chunk as a chunk
151
- * like any other, and this one reaches TanStack's SSR path and lands on
152
- * `node:stream/web`. That is why `@valbuild/tanstack` could not be built for a
153
- * Cloudflare Worker at all.
154
- *
155
- * So the edge is inverted. The root entry holds a slot; `@valbuild/tanstack/server`
156
- * fills it on import with the implementation that was already there,
157
- * `hasValEnableCookieOnServer`. Nothing about the behaviour changes for an app
158
- * that imports `/server` — which every app with a Val API does — and the root
159
- * entry no longer names TanStack's server module at all.
160
- *
161
- * Ordering: the slot is filled when `/server` is first imported. An
162
- * `isValEnabled()` call that somehow happens before that returns false, which
163
- * is what the old implementation's `catch` returned in the same situation.
164
- */
165
-
166
- var reader = null;
167
- function setValEnableCookieReader(read) {
168
- reader = read;
169
- }
170
- function readValEnableCookie() {
171
- return _readValEnableCookie.apply(this, arguments);
172
- }
173
- function _readValEnableCookie() {
174
- _readValEnableCookie = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
175
- return _regenerator().w(function (_context) {
176
- while (1) switch (_context.p = _context.n) {
177
- case 0:
178
- if (reader) {
179
- _context.n = 1;
180
- break;
181
- }
182
- return _context.a(2, false);
183
- case 1:
184
- _context.p = 1;
185
- _context.n = 2;
186
- return reader();
187
- case 2:
188
- return _context.a(2, _context.v);
189
- case 3:
190
- _context.p = 3;
191
- _context.v;
192
- return _context.a(2, false);
193
- }
194
- }, _callee, null, [[1, 3]]);
195
- }));
196
- return _readValEnableCookie.apply(this, arguments);
197
- }
198
-
199
- var packageJson = {
200
- name: "@valbuild/tanstack",
201
- description: "Val for TanStack Start: hard-coded content - super-charged",
202
- "private": false,
203
- repository: {
204
- type: "git",
205
- url: "git+https://github.com/valbuild/val.git"
206
- },
207
- sideEffects: true,
208
- keywords: [
209
- "CMS",
210
- "tanstack",
211
- "tanstack-start",
212
- "tanstack-router",
213
- "react"
214
- ],
215
- version: "0.146.4",
216
- scripts: {
217
- typecheck: "tsc --noEmit",
218
- test: "jest"
219
- },
220
- main: "dist/valbuild-tanstack.cjs.js",
221
- module: "dist/valbuild-tanstack.esm.js",
222
- exports: {
223
- ".": {
224
- module: "./dist/valbuild-tanstack.esm.js",
225
- "default": "./dist/valbuild-tanstack.cjs.js"
226
- },
227
- "./client": {
228
- module: "./client/dist/valbuild-tanstack-client.esm.js",
229
- "default": "./client/dist/valbuild-tanstack-client.cjs.js"
230
- },
231
- "./server": {
232
- module: "./server/dist/valbuild-tanstack-server.esm.js",
233
- "default": "./server/dist/valbuild-tanstack-server.cjs.js"
234
- },
235
- "./package.json": "./package.json"
236
- },
237
- types: "dist/valbuild-tanstack.cjs.d.ts",
238
- preconstruct: {
239
- entrypoints: [
240
- "./index.ts",
241
- "./server/index.ts",
242
- "./client/index.ts"
243
- ],
244
- exports: true
245
- },
246
- dependencies: {
247
- "@valbuild/core": "workspace:*",
248
- "@valbuild/language-server": "workspace:*",
249
- "@valbuild/mcp": "workspace:*",
250
- "@valbuild/react": "workspace:*",
251
- "@valbuild/server": "workspace:*",
252
- "@valbuild/shared": "workspace:*",
253
- "@valbuild/ui": "workspace:*"
254
- },
255
- devDependencies: {
256
- "@tanstack/react-router": "^1.170.41",
257
- "@tanstack/react-start": "^1.168.60",
258
- "@testing-library/react": "^16.3.3",
259
- "@types/react": "^19.2.18",
260
- "@types/react-dom": "^19.2.5",
261
- "jest-environment-jsdom": "^30.5.0",
262
- react: "^19.2.8",
263
- "react-dom": "^19.2.8",
264
- typescript: "^6.0.3"
265
- },
266
- peerDependencies: {
267
- "@tanstack/react-router": ">=1.130.0",
268
- "@tanstack/react-start": ">=1.130.0",
269
- react: ">=19.0.0",
270
- "react-dom": ">=19.0.0"
271
- },
272
- externals: [
273
- "@tanstack/react-router",
274
- "@tanstack/react-start"
275
- ],
276
- files: [
277
- "CHANGELOG.md",
278
- "dist",
279
- "client",
280
- "server"
281
- ]
282
- };
283
-
284
- var _packageJson$version;
285
- var VERSION = (_packageJson$version = packageJson.version) !== null && _packageJson$version !== void 0 ? _packageJson$version : null;
286
-
287
- exports.VERSION = VERSION;
288
139
  exports._asyncToGenerator = _asyncToGenerator;
289
140
  exports._regenerator = _regenerator;
290
- exports.readValEnableCookie = readValEnableCookie;
291
- exports.setValEnableCookieReader = setValEnableCookieReader;
@@ -1,6 +1,20 @@
1
1
  import { ValConfig } from "@valbuild/core";
2
2
  import { type ReactNode } from "react";
3
- export declare const ValApp: ({ config, children, }: {
3
+ export declare const ValApp: ({ config, children, demo, }: {
4
4
  config: ValConfig;
5
5
  children?: ReactNode;
6
+ /**
7
+ * Run the Studio as a demo: no sign-in, and no request leaves the tab.
8
+ *
9
+ * Val's own server is started here, in the browser, in memory mode, and the
10
+ * Studio's requests go to it instead of to `/api/val`. Edits live in memory:
11
+ * they last as long as this page does, and a reload starts over. Pair it
12
+ * with `initValDemoServer` on the API route, which serves the Studio's files
13
+ * and nothing else, and with `<ValProvider demo>` on the site so the canvas
14
+ * shows the edits.
15
+ *
16
+ * Set it from the build -- `demo={import.meta.env.VITE_VAL_DEMO === "true"}`
17
+ * -- never from anything a visitor controls.
18
+ */
19
+ demo?: boolean;
6
20
  }) => import("react").JSX.Element;
@@ -4,4 +4,5 @@ export declare const ValProvider: (props: {
4
4
  disableRefresh?: boolean;
5
5
  suspend?: boolean;
6
6
  draft?: import("./ValDraft.js").ValDraft | null;
7
+ demo?: boolean;
7
8
  }) => import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@valbuild/tanstack/demo`: the server half of a Val demo.
3
+ *
4
+ * Its own entry so a demo's server imports nothing of Val's: see
5
+ * `initValDemoServer`.
6
+ */
7
+ export { initValDemoServer } from "./initValDemoServer.js";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The server half of a Val demo: the Studio's own files and the demo's service
3
+ * worker, and nothing else.
4
+ *
5
+ * In a demo the Studio runs Val's API in the visitor's tab
6
+ * (`@valbuild/server/browser`, started by `<ValApp demo>`), so the app has no
7
+ * content or patch endpoint at all -- nothing to authenticate, nothing to
8
+ * abuse. What it still serves is the Studio's scripts and styles, which the
9
+ * page loads from `/api/val/static/...`.
10
+ *
11
+ * Its own entry, `@valbuild/tanstack/demo`, rather than beside
12
+ * `initValServer`: importing Val's server loads all of it -- the TypeScript
13
+ * compiler included -- and a demo's server needs none of it.
14
+ *
15
+ * Mount it where `initValServer`'s handler would go:
16
+ *
17
+ * @example
18
+ * // src/routes/api/val.$.ts
19
+ * import { initValDemoServer } from "@valbuild/tanstack/demo";
20
+ * const { valApiHandler } = initValDemoServer();
21
+ * export const Route = createFileRoute("/api/val/$")({
22
+ * server: { handlers: { GET: ({ request }) => valApiHandler(request) } },
23
+ * });
24
+ */
25
+ export declare function initValDemoServer(): {
26
+ valApiHandler: (req: Request) => Promise<Response>;
27
+ };