@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,17 +1,19 @@
1
- import { _ as _asyncToGenerator, a as _regenerator, r as readValEnableCookie, V as VERSION$1 } from './version-4da65f4f.esm.js';
2
- import { _ as _objectSpread2, a as _slicedToArray, b as _createForOfIteratorHelper } from './createForOfIteratorHelper-93a62170.esm.js';
1
+ import { _ as _asyncToGenerator, a as _regenerator } from './asyncToGenerator-500f022f.esm.js';
2
+ import { _ as _objectSpread2, a as _slicedToArray, b as _createForOfIteratorHelper, c as _typeof } from './typeof-66e2d869.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';
5
5
  export { core as expr };
6
6
  export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
7
7
  import { stegaEncode, stegaDecodeStrings, attrs, raw, SET_AUTO_TAG_JSX_ENABLED, autoTagJSX } from '@valbuild/react/stega';
8
+ import { r as readValEnableCookie, _ as _toConsumableArray, V as VERSION$1 } from './version-c2d4fa07.esm.js';
8
9
  export { ValRichText } from '@valbuild/react/internal';
9
10
  import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
10
11
  import { useRouter, useRouterState } from '@tanstack/react-router';
11
12
  import React, { useEffect, useRef, useState } from 'react';
12
- import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-59a0b19f.esm.js';
13
+ import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-6278320b.esm.js';
13
14
  import { VAL_CONFIG_SESSION_STORAGE_KEY, VAL_THEME_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, DEFAULT_CANVAS_SELECTION, DEFAULT_CANVAS_SELECTION_SOFT, isValCanvasStudioMessage, isValCanvasFrame } from '@valbuild/shared/client';
14
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
+ import { D as DEMO_CLAIM_MESSAGE, a as DEMO_SERVICE_WORKER_PATH, b as DEMO_RELAY_MESSAGE } from './demoServiceWorker-56fd96cf.esm.js';
15
17
  import '@valbuild/core/patch';
16
18
 
17
19
  function getUnpatchedUnencodedVal(selector) {
@@ -1138,6 +1140,16 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1138
1140
  setMountOverlay(false);
1139
1141
  return;
1140
1142
  }
1143
+ if (props.demo) {
1144
+ // Only the canvas, and always as the draft: see `demo`.
1145
+ var canvas = isValCanvasFrame(location.search, readParentPathname());
1146
+ setIsCanvas(canvas);
1147
+ setMountOverlay(canvas);
1148
+ if (canvas) {
1149
+ setDraftMode(true);
1150
+ }
1151
+ return;
1152
+ }
1141
1153
  setIsCanvas(isValCanvasFrame(location.search, readParentPathname()));
1142
1154
  setMountOverlay(hasValEnableCookie(document.cookie));
1143
1155
  }, []);
@@ -1185,7 +1197,9 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1185
1197
  * there are any.
1186
1198
  */
1187
1199
  React.useEffect(function () {
1188
- if (!mountOverlay || props.disableRefresh) {
1200
+ // A demo's loaders read a server that never sees the tab's edits, so
1201
+ // re-running them would only fetch the published content again.
1202
+ if (!mountOverlay || props.disableRefresh || props.demo) {
1189
1203
  return;
1190
1204
  }
1191
1205
  var timer = null;
@@ -1275,7 +1289,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1275
1289
  clearInterval(safety);
1276
1290
  if (timer !== null) clearTimeout(timer);
1277
1291
  };
1278
- }, [mountOverlay, props.disableRefresh]);
1292
+ }, [mountOverlay, props.disableRefresh, props.demo]);
1279
1293
  React.useEffect(function () {
1280
1294
  if (!mountOverlay) {
1281
1295
  return;
@@ -1325,7 +1339,9 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1325
1339
 
1326
1340
  var timeout;
1327
1341
  function pollCurrentDraftMode() {
1328
- if (!mountOverlay) {
1342
+ // A demo has no server to ask: draft mode is on in its canvas, and
1343
+ // nothing is mounted anywhere else.
1344
+ if (!mountOverlay || props.demo) {
1329
1345
  return;
1330
1346
  }
1331
1347
  window.dispatchEvent(new CustomEvent("val-overlay-spa", {
@@ -1402,7 +1418,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1402
1418
  return function () {
1403
1419
  clearTimeout(timeout);
1404
1420
  };
1405
- }, [mountOverlay, iframeSrc]);
1421
+ }, [mountOverlay, iframeSrc, props.demo]);
1406
1422
  React.useEffect(function () {
1407
1423
  if (!mountOverlay) {
1408
1424
  return;
@@ -1997,6 +2013,154 @@ function ValVideo(props) {
1997
2013
  }));
1998
2014
  }
1999
2015
 
2016
+ /** A request the demo's service worker hands this tab. */
2017
+
2018
+ function isHeaderList(value) {
2019
+ return Array.isArray(value) && value.every(function (entry) {
2020
+ return Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && typeof entry[1] === "string";
2021
+ });
2022
+ }
2023
+ function isRelayRequest(value) {
2024
+ return _typeof(value) === "object" && value !== null && "type" in value && value.type === DEMO_RELAY_MESSAGE && "url" in value && typeof value.url === "string" && "method" in value && typeof value.method === "string" && "headers" in value && isHeaderList(value.headers) && "body" in value && (value.body === null || value.body instanceof ArrayBuffer);
2025
+ }
2026
+
2027
+ /** Statuses a `Response` may not be given a body with. */
2028
+ var NO_BODY = new Set([101, 204, 205, 304]);
2029
+ function answer(_x, _x2) {
2030
+ return _answer.apply(this, arguments);
2031
+ }
2032
+ /**
2033
+ * Make this tab the server for the demo's uploads and unpublished files.
2034
+ *
2035
+ * Registers the demo's service worker (see `DEMO_SERVICE_WORKER_SOURCE`) and
2036
+ * answers what it relays with the same in-tab server the Studio's client
2037
+ * uses. Resolves once the worker controls this page -- the Studio must not
2038
+ * start before, or the first images it asks for go past it to a server that
2039
+ * has none of them.
2040
+ *
2041
+ * Resolves `false` where a service worker cannot run: an insecure context
2042
+ * (plain http on anything but localhost), or a browser without them. Uploads
2043
+ * are then off, and the Studio says why.
2044
+ */
2045
+ function _answer() {
2046
+ _answer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch, request) {
2047
+ var res, body, _t;
2048
+ return _regenerator().w(function (_context) {
2049
+ while (1) switch (_context.n) {
2050
+ case 0:
2051
+ _context.n = 1;
2052
+ return fetch(request.url, {
2053
+ method: request.method,
2054
+ headers: request.headers,
2055
+ body: request.body
2056
+ });
2057
+ case 1:
2058
+ res = _context.v;
2059
+ if (!NO_BODY.has(res.status)) {
2060
+ _context.n = 2;
2061
+ break;
2062
+ }
2063
+ _t = null;
2064
+ _context.n = 4;
2065
+ break;
2066
+ case 2:
2067
+ _context.n = 3;
2068
+ return res.arrayBuffer();
2069
+ case 3:
2070
+ _t = _context.v;
2071
+ case 4:
2072
+ body = _t;
2073
+ return _context.a(2, {
2074
+ status: res.status,
2075
+ headers: _toConsumableArray(res.headers),
2076
+ body: body
2077
+ });
2078
+ }
2079
+ }, _callee);
2080
+ }));
2081
+ return _answer.apply(this, arguments);
2082
+ }
2083
+ function startDemoRelay(_x3) {
2084
+ return _startDemoRelay.apply(this, arguments);
2085
+ }
2086
+ function _startDemoRelay() {
2087
+ _startDemoRelay = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(fetch) {
2088
+ var container, registration, _registration$active, controlled, _t2;
2089
+ return _regenerator().w(function (_context2) {
2090
+ while (1) switch (_context2.p = _context2.n) {
2091
+ case 0:
2092
+ if (!(typeof navigator === "undefined" || !("serviceWorker" in navigator) || !window.isSecureContext)) {
2093
+ _context2.n = 1;
2094
+ break;
2095
+ }
2096
+ return _context2.a(2, false);
2097
+ case 1:
2098
+ container = navigator.serviceWorker;
2099
+ container.addEventListener("message", function (event) {
2100
+ var port = event.ports[0];
2101
+ if (!isRelayRequest(event.data) || !port) return;
2102
+ answer(fetch, event.data).then(function (res) {
2103
+ return port.postMessage(res, res.body ? [res.body] : []);
2104
+ })["catch"](function (err) {
2105
+ console.error("Val: the demo could not answer a relayed request", err);
2106
+ port.postMessage({
2107
+ status: 500,
2108
+ headers: [["Content-Type", "application/json"]],
2109
+ body: new TextEncoder().encode(JSON.stringify({
2110
+ message: "The demo's server failed to answer."
2111
+ })).buffer
2112
+ });
2113
+ });
2114
+ });
2115
+ // Messages are queued until this is called, when the listener is added with
2116
+ // `addEventListener` rather than assigned to `onmessage`.
2117
+ container.startMessages();
2118
+ _context2.p = 2;
2119
+ _context2.n = 3;
2120
+ return container.register("/api/val".concat(DEMO_SERVICE_WORKER_PATH), {
2121
+ scope: "/"
2122
+ });
2123
+ case 3:
2124
+ _context2.n = 4;
2125
+ return container.ready;
2126
+ case 4:
2127
+ registration = _context2.v;
2128
+ if (container.controller) {
2129
+ _context2.n = 5;
2130
+ break;
2131
+ }
2132
+ // Not controlled yet. On a first visit the worker claims this page when
2133
+ // it activates. After a hard reload (Shift+Reload) it has activated
2134
+ // already and a browser deliberately leaves the page uncontrolled, so
2135
+ // the page asks it to claim -- or this would wait out the timeout and
2136
+ // start with uploads off.
2137
+ controlled = new Promise(function (resolve) {
2138
+ var timer = setTimeout(resolve, 10000);
2139
+ container.addEventListener("controllerchange", function () {
2140
+ clearTimeout(timer);
2141
+ resolve();
2142
+ }, {
2143
+ once: true
2144
+ });
2145
+ });
2146
+ (_registration$active = registration.active) === null || _registration$active === void 0 || _registration$active.postMessage({
2147
+ type: DEMO_CLAIM_MESSAGE
2148
+ });
2149
+ _context2.n = 5;
2150
+ return controlled;
2151
+ case 5:
2152
+ return _context2.a(2, container.controller !== null);
2153
+ case 6:
2154
+ _context2.p = 6;
2155
+ _t2 = _context2.v;
2156
+ console.error("Val: the demo's service worker did not start", _t2);
2157
+ return _context2.a(2, false);
2158
+ }
2159
+ }, _callee2, null, [[2, 6]]);
2160
+ }));
2161
+ return _startDemoRelay.apply(this, arguments);
2162
+ }
2163
+
2000
2164
  var VAL_READY_PING_MS = 100;
2001
2165
 
2002
2166
  /**
@@ -2014,8 +2178,10 @@ var studioStylesLoaded = false;
2014
2178
  var LOADING_SCREEN_MAX_MS = 15000;
2015
2179
  var ValApp = function ValApp(_ref) {
2016
2180
  var config = _ref.config,
2017
- children = _ref.children;
2181
+ children = _ref.children,
2182
+ demo = _ref.demo;
2018
2183
  var route = "/api/val"; // TODO: make configurable
2184
+ var demoStart = useDemoServer(demo === true, config);
2019
2185
  var _useState = useState(),
2020
2186
  _useState2 = _slicedToArray(_useState, 2),
2021
2187
  inMessageMode = _useState2[0],
@@ -2168,6 +2334,21 @@ var ValApp = function ValApp(_ref) {
2168
2334
  children: "Val Studio is disabled: in message mode"
2169
2335
  });
2170
2336
  }
2337
+ if (demo && demoStart.status === "failed") {
2338
+ return /*#__PURE__*/jsxs(Fragment, {
2339
+ children: [/*#__PURE__*/jsx(DemoStartFailed, {
2340
+ failure: demoStart
2341
+ }), children]
2342
+ });
2343
+ }
2344
+ if (demo && demoStart.status !== "ready") {
2345
+ // The Studio reads `window.__VAL_DEMO__` when its script starts, so the
2346
+ // server it talks to has to be there first. The modules are registered
2347
+ // by a child (`ValModulesClient`), whose effect has run by then.
2348
+ return /*#__PURE__*/jsx(Fragment, {
2349
+ children: children
2350
+ });
2351
+ }
2171
2352
  return /*#__PURE__*/jsxs(Fragment, {
2172
2353
  children: [loadingScreen, /*#__PURE__*/jsx(ValScript, {
2173
2354
  src: "".concat(route, "/static").concat(VERSION ? "/".concat(VERSION) : "").concat(VAL_APP_PATH)
@@ -2178,6 +2359,154 @@ var ValApp = function ValApp(_ref) {
2178
2359
  });
2179
2360
  };
2180
2361
 
2362
+ /**
2363
+ * Starts Val's server in this tab, and hands it to the Studio.
2364
+ *
2365
+ * Loaded on demand: `@valbuild/server/browser` is the whole request-handling
2366
+ * half of the server, and only a demo should download it.
2367
+ */
2368
+
2369
+ function useDemoServer(demo, config) {
2370
+ var _useState7 = useState({
2371
+ status: "starting"
2372
+ }),
2373
+ _useState8 = _slicedToArray(_useState7, 2),
2374
+ start = _useState8[0],
2375
+ setStart = _useState8[1];
2376
+ useEffect(function () {
2377
+ if (!demo) return;
2378
+ var cancelled = false;
2379
+ var run = /*#__PURE__*/function () {
2380
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2381
+ var _yield$import, createInTabValFetch, modules, fetch, uploads, runtime;
2382
+ return _regenerator().w(function (_context) {
2383
+ while (1) switch (_context.n) {
2384
+ case 0:
2385
+ _context.n = 1;
2386
+ return import('@valbuild/server/browser');
2387
+ case 1:
2388
+ _yield$import = _context.v;
2389
+ createInTabValFetch = _yield$import.createInTabValFetch;
2390
+ modules = window.__VAL_MODULES__;
2391
+ if (modules) {
2392
+ _context.n = 2;
2393
+ break;
2394
+ }
2395
+ return _context.a(2, {
2396
+ status: "failed",
2397
+ message: "This demo was built without its content. Render <ValModulesClient modules={valModules} /> inside <ValApp demo>.",
2398
+ details: null,
2399
+ retryable: false
2400
+ });
2401
+ case 2:
2402
+ fetch = createInTabValFetch(modules, {
2403
+ config: config
2404
+ });
2405
+ _context.n = 3;
2406
+ return startDemoRelay(fetch);
2407
+ case 3:
2408
+ uploads = _context.v;
2409
+ runtime = {
2410
+ fetch: fetch,
2411
+ uploads: uploads
2412
+ };
2413
+ window.__VAL_DEMO__ = runtime;
2414
+ return _context.a(2, {
2415
+ status: "ready"
2416
+ });
2417
+ }
2418
+ }, _callee);
2419
+ }));
2420
+ return function run() {
2421
+ return _ref2.apply(this, arguments);
2422
+ };
2423
+ }();
2424
+ run()["catch"](function (err) {
2425
+ console.error("Val: the demo could not start", err);
2426
+ return {
2427
+ status: "failed",
2428
+ // Most often the server's code did not download: the page is fine,
2429
+ // and loading it again fetches it again.
2430
+ message: "The demo could not start: part of it did not load.",
2431
+ details: err instanceof Error ? err.message : String(err),
2432
+ retryable: true
2433
+ };
2434
+ }).then(function (result) {
2435
+ if (!cancelled) setStart(result);
2436
+ });
2437
+ return function () {
2438
+ cancelled = true;
2439
+ };
2440
+ }, [demo, config]);
2441
+ return start;
2442
+ }
2443
+
2444
+ /**
2445
+ * Said on the page, not only in the console: without it a demo that failed
2446
+ * to start is a site with no Studio and no reason given. Plain styles, since
2447
+ * the Studio's stylesheet is exactly what has not loaded.
2448
+ */
2449
+ function DemoStartFailed(_ref3) {
2450
+ var failure = _ref3.failure;
2451
+ return /*#__PURE__*/jsxs("div", {
2452
+ role: "alert",
2453
+ style: {
2454
+ position: "fixed",
2455
+ left: "1rem",
2456
+ right: "1rem",
2457
+ bottom: "1rem",
2458
+ maxWidth: "28rem",
2459
+ margin: "0 auto",
2460
+ padding: "1rem",
2461
+ borderRadius: "0.75rem",
2462
+ background: "white",
2463
+ color: "black",
2464
+ boxShadow: "0 8px 30px rgba(0, 0, 0, 0.2)",
2465
+ fontFamily: "system-ui, sans-serif",
2466
+ fontSize: "0.875rem",
2467
+ lineHeight: 1.4,
2468
+ zIndex: 2147483647
2469
+ },
2470
+ children: [/*#__PURE__*/jsx("p", {
2471
+ style: {
2472
+ margin: 0
2473
+ },
2474
+ children: failure.message
2475
+ }), failure.retryable && /*#__PURE__*/jsx("button", {
2476
+ type: "button",
2477
+ onClick: function onClick() {
2478
+ return window.location.reload();
2479
+ },
2480
+ style: {
2481
+ marginTop: "0.75rem",
2482
+ padding: "0.375rem 0.75rem",
2483
+ borderRadius: "0.375rem",
2484
+ border: "1px solid #ccc",
2485
+ background: "#f4f4f4",
2486
+ font: "inherit",
2487
+ cursor: "pointer"
2488
+ },
2489
+ children: "Try again"
2490
+ }), failure.details !== null && /*#__PURE__*/jsxs("details", {
2491
+ style: {
2492
+ marginTop: "0.75rem",
2493
+ color: "#555"
2494
+ },
2495
+ children: [/*#__PURE__*/jsx("summary", {
2496
+ style: {
2497
+ cursor: "pointer"
2498
+ },
2499
+ children: "Details"
2500
+ }), /*#__PURE__*/jsx("code", {
2501
+ style: {
2502
+ wordBreak: "break-word"
2503
+ },
2504
+ children: failure.details
2505
+ })]
2506
+ })]
2507
+ });
2508
+ }
2509
+
2181
2510
  // Keep in sync with VAL_MODULES_UPDATED_EVENT in @valbuild/ui (useValModules.ts).
2182
2511
  var VAL_MODULES_UPDATED_EVENT = "val-modules-updated";
2183
2512
 
@@ -0,0 +1,179 @@
1
+ 'use strict';
2
+
3
+ var asyncToGenerator = require('./asyncToGenerator-8e5c36c8.cjs.prod.js');
4
+ var _typeof = require('./typeof-8998e126.cjs.prod.js');
5
+
6
+ /**
7
+ * How `initVal().isValEnabled()` reaches the server without importing it.
8
+ *
9
+ * EXPERIMENTAL — see VAL_PROMPT.md.
10
+ *
11
+ * The cookie can only be read through `@tanstack/react-start/server`, and that
12
+ * module is reachable from this package's ROOT entry, which every client
13
+ * component imports. `initVal.ts` used `await import()` for exactly that reason,
14
+ * and under Vite the dynamic form does keep it out of the client bundle.
15
+ *
16
+ * It does not everywhere. A host that bundles this package ahead of time and
17
+ * audits what each chunk imports sees a dynamically imported chunk as a chunk
18
+ * like any other, and this one reaches TanStack's SSR path and lands on
19
+ * `node:stream/web`. That is why `@valbuild/tanstack` could not be built for a
20
+ * Cloudflare Worker at all.
21
+ *
22
+ * So the edge is inverted. The root entry holds a slot; `@valbuild/tanstack/server`
23
+ * fills it on import with the implementation that was already there,
24
+ * `hasValEnableCookieOnServer`. Nothing about the behaviour changes for an app
25
+ * that imports `/server` — which every app with a Val API does — and the root
26
+ * entry no longer names TanStack's server module at all.
27
+ *
28
+ * Ordering: the slot is filled when `/server` is first imported. An
29
+ * `isValEnabled()` call that somehow happens before that returns false, which
30
+ * is what the old implementation's `catch` returned in the same situation.
31
+ */
32
+
33
+ var reader = null;
34
+ function setValEnableCookieReader(read) {
35
+ reader = read;
36
+ }
37
+ function readValEnableCookie() {
38
+ return _readValEnableCookie.apply(this, arguments);
39
+ }
40
+ function _readValEnableCookie() {
41
+ _readValEnableCookie = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
42
+ return asyncToGenerator._regenerator().w(function (_context) {
43
+ while (1) switch (_context.p = _context.n) {
44
+ case 0:
45
+ if (reader) {
46
+ _context.n = 1;
47
+ break;
48
+ }
49
+ return _context.a(2, false);
50
+ case 1:
51
+ _context.p = 1;
52
+ _context.n = 2;
53
+ return reader();
54
+ case 2:
55
+ return _context.a(2, _context.v);
56
+ case 3:
57
+ _context.p = 3;
58
+ _context.v;
59
+ return _context.a(2, false);
60
+ }
61
+ }, _callee, null, [[1, 3]]);
62
+ }));
63
+ return _readValEnableCookie.apply(this, arguments);
64
+ }
65
+
66
+ function _arrayWithoutHoles(r) {
67
+ if (Array.isArray(r)) return _typeof._arrayLikeToArray(r);
68
+ }
69
+
70
+ function _iterableToArray(r) {
71
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
72
+ }
73
+
74
+ function _nonIterableSpread() {
75
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
76
+ }
77
+
78
+ function _toConsumableArray(r) {
79
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _typeof._unsupportedIterableToArray(r) || _nonIterableSpread();
80
+ }
81
+
82
+ var packageJson = {
83
+ name: "@valbuild/tanstack",
84
+ description: "Val for TanStack Start: hard-coded content - super-charged",
85
+ "private": false,
86
+ repository: {
87
+ type: "git",
88
+ url: "git+https://github.com/valbuild/val.git"
89
+ },
90
+ sideEffects: true,
91
+ keywords: [
92
+ "CMS",
93
+ "tanstack",
94
+ "tanstack-start",
95
+ "tanstack-router",
96
+ "react"
97
+ ],
98
+ version: "0.148.0",
99
+ scripts: {
100
+ typecheck: "tsc --noEmit",
101
+ test: "jest"
102
+ },
103
+ main: "dist/valbuild-tanstack.cjs.js",
104
+ module: "dist/valbuild-tanstack.esm.js",
105
+ exports: {
106
+ ".": {
107
+ module: "./dist/valbuild-tanstack.esm.js",
108
+ "default": "./dist/valbuild-tanstack.cjs.js"
109
+ },
110
+ "./demo": {
111
+ module: "./demo/dist/valbuild-tanstack-demo.esm.js",
112
+ "default": "./demo/dist/valbuild-tanstack-demo.cjs.js"
113
+ },
114
+ "./client": {
115
+ module: "./client/dist/valbuild-tanstack-client.esm.js",
116
+ "default": "./client/dist/valbuild-tanstack-client.cjs.js"
117
+ },
118
+ "./server": {
119
+ module: "./server/dist/valbuild-tanstack-server.esm.js",
120
+ "default": "./server/dist/valbuild-tanstack-server.cjs.js"
121
+ },
122
+ "./package.json": "./package.json"
123
+ },
124
+ types: "dist/valbuild-tanstack.cjs.d.ts",
125
+ preconstruct: {
126
+ entrypoints: [
127
+ "./index.ts",
128
+ "./server/index.ts",
129
+ "./client/index.ts",
130
+ "./demo/index.ts"
131
+ ],
132
+ exports: true
133
+ },
134
+ dependencies: {
135
+ "@valbuild/core": "workspace:*",
136
+ "@valbuild/language-server": "workspace:*",
137
+ "@valbuild/mcp": "workspace:*",
138
+ "@valbuild/react": "workspace:*",
139
+ "@valbuild/server": "workspace:*",
140
+ "@valbuild/shared": "workspace:*",
141
+ "@valbuild/ui": "workspace:*"
142
+ },
143
+ devDependencies: {
144
+ "@tanstack/react-router": "^1.170.41",
145
+ "@tanstack/react-start": "^1.168.60",
146
+ "@testing-library/react": "^16.3.3",
147
+ "@types/react": "^19.2.18",
148
+ "@types/react-dom": "^19.2.5",
149
+ "jest-environment-jsdom": "^30.5.0",
150
+ react: "^19.2.8",
151
+ "react-dom": "^19.2.8",
152
+ typescript: "^6.0.3"
153
+ },
154
+ peerDependencies: {
155
+ "@tanstack/react-router": ">=1.130.0",
156
+ "@tanstack/react-start": ">=1.130.0",
157
+ react: ">=19.0.0",
158
+ "react-dom": ">=19.0.0"
159
+ },
160
+ externals: [
161
+ "@tanstack/react-router",
162
+ "@tanstack/react-start"
163
+ ],
164
+ files: [
165
+ "CHANGELOG.md",
166
+ "dist",
167
+ "client",
168
+ "server",
169
+ "demo"
170
+ ]
171
+ };
172
+
173
+ var _packageJson$version;
174
+ var VERSION = (_packageJson$version = packageJson.version) !== null && _packageJson$version !== void 0 ? _packageJson$version : null;
175
+
176
+ exports.VERSION = VERSION;
177
+ exports._toConsumableArray = _toConsumableArray;
178
+ exports.readValEnableCookie = readValEnableCookie;
179
+ exports.setValEnableCookieReader = setValEnableCookieReader;