@valbuild/tanstack 0.148.1 → 0.148.3

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 (26) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +53 -0
  3. package/client/dist/valbuild-tanstack-client.cjs.dev.js +12 -4
  4. package/client/dist/valbuild-tanstack-client.cjs.prod.js +12 -4
  5. package/client/dist/valbuild-tanstack-client.esm.js +12 -4
  6. package/dist/{ValOverlayContext-510328ec.cjs.dev.js → ValOverlayContext-198b4bd1.cjs.dev.js} +4 -1
  7. package/dist/{ValOverlayContext-6278320b.esm.js → ValOverlayContext-6411bbe3.esm.js} +4 -1
  8. package/dist/{ValOverlayContext-d3acd157.cjs.prod.js → ValOverlayContext-d9b22d1a.cjs.prod.js} +4 -1
  9. package/dist/declarations/src/ValAnalytics.d.ts +23 -0
  10. package/dist/declarations/src/ValApp.d.ts +6 -1
  11. package/dist/declarations/src/ValProvider.d.ts +1 -0
  12. package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +3 -0
  13. package/dist/declarations/src/server/index.d.ts +1 -0
  14. package/dist/{routeFromVal-0ea4586f.cjs.dev.js → routeFromVal-2f65a4fc.cjs.dev.js} +11 -11
  15. package/dist/{routeFromVal-9f1f8725.esm.js → routeFromVal-40cd8a5b.esm.js} +11 -11
  16. package/dist/{routeFromVal-97a52f43.cjs.prod.js → routeFromVal-a13ac8a3.cjs.prod.js} +11 -11
  17. package/dist/valbuild-tanstack.cjs.dev.js +115 -28
  18. package/dist/valbuild-tanstack.cjs.prod.js +115 -28
  19. package/dist/valbuild-tanstack.esm.js +115 -28
  20. package/dist/{version-684beca4.cjs.prod.js → version-4353b65f.cjs.prod.js} +1 -1
  21. package/dist/{version-a77659ce.esm.js → version-79ab0f75.esm.js} +1 -1
  22. package/dist/{version-fd860c4b.cjs.dev.js → version-f0497731.cjs.dev.js} +1 -1
  23. package/package.json +8 -8
  24. package/server/dist/valbuild-tanstack-server.cjs.dev.js +10 -10
  25. package/server/dist/valbuild-tanstack-server.cjs.prod.js +10 -10
  26. package/server/dist/valbuild-tanstack-server.esm.js +10 -10
@@ -5,12 +5,12 @@ 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-a77659ce.esm.js';
8
+ import { r as readValEnableCookie, _ as _toConsumableArray, V as VERSION$1 } from './version-79ab0f75.esm.js';
9
9
  export { ValRichText } from '@valbuild/react/internal';
10
10
  import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID, VAL_APP_ID } from '@valbuild/ui';
11
11
  import { useRouter, useRouterState } from '@tanstack/react-router';
12
12
  import React, { useEffect, useRef, useState } from 'react';
13
- import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-6278320b.esm.js';
13
+ import { V as ValExternalStore, a as ValOverlayProvider } from './ValOverlayContext-6411bbe3.esm.js';
14
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';
15
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
16
  import { D as DEMO_CLAIM_MESSAGE, a as DEMO_SERVICE_WORKER_PATH, b as DEMO_RELAY_MESSAGE } from './demoServiceWorker-56fd96cf.esm.js';
@@ -927,7 +927,7 @@ var DRAFT_HANDSHAKE_POLL_MS = 100;
927
927
  */
928
928
  var DRAFT_HANDSHAKE_TIMEOUT_MS = 10000;
929
929
  var ValTanStackProvider = function ValTanStackProvider(props) {
930
- var _props$draft, _draftModeReady$curre2;
930
+ var _props$draft, _props$analytics, _draftModeReady$curre2;
931
931
  // TODO: use config:
932
932
  var route = "/api/val";
933
933
  /**
@@ -982,6 +982,14 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
982
982
  * not a draft: it must not turn draft mode on or say the draft is synced.
983
983
  */
984
984
  var hasDraft = initialDraft !== null && initialDraft.draftMode !== false;
985
+ /*
986
+ * As the page was rendered. A ref, not the prop, for the reason
987
+ * `initialDraft` is one: a later render's prop is a client navigation's
988
+ * loader, which reads nothing.
989
+ */
990
+ var analyticsSetting = React.useRef((_props$analytics = props.analytics) !== null && _props$analytics !== void 0 ? _props$analytics : null).current;
991
+ var analytics = (analyticsSetting === null || analyticsSetting === void 0 ? void 0 : analyticsSetting.enabled) === true;
992
+ var contentVersion = analyticsSetting === null || analyticsSetting === void 0 ? void 0 : analyticsSetting.contentVersion;
985
993
  var snapshot = initialDraft === null || initialDraft === void 0 ? void 0 : initialDraft.snapshot;
986
994
  /*
987
995
  * The base the Studio's overlay must start from, where it is not the
@@ -1133,7 +1141,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1133
1141
  useConsoleLogEnableVal(mountOverlay);
1134
1142
  React.useEffect(function () {
1135
1143
  if (location.search === "?message_onready=true") {
1136
- console.warn("Val is verifying draft mode...");
1144
+ Internal$1.log.debug("verifying draft mode...");
1137
1145
  return;
1138
1146
  }
1139
1147
  if (isValStudioPath(location.pathname)) {
@@ -1153,6 +1161,54 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1153
1161
  setIsCanvas(isValCanvasFrame(location.search, readParentPathname()));
1154
1162
  setMountOverlay(hasValEnableCookie(document.cookie));
1155
1163
  }, []);
1164
+
1165
+ /**
1166
+ * The analytics script, for a visitor and nobody else.
1167
+ *
1168
+ * `mountOverlay === false` is "known not to be an editor": no Val enable
1169
+ * cookie, so no draft mode and no canvas. A page the server rendered from a
1170
+ * draft is an editor's too, whatever the enable cookie says -- the draft
1171
+ * mode cookie can outlive it. So is one at a proposal's address, which
1172
+ * comes with a snapshot: its content is not published, and counting it
1173
+ * would credit the live site with it. The Studio's own pages count nothing
1174
+ * either. Loaded with a dynamic import after hydration, so a site
1175
+ * with analytics off never downloads it, and one with it on downloads it
1176
+ * off the critical path. It imports nothing from core, shared or zod.
1177
+ */
1178
+ React.useEffect(function () {
1179
+ if (!analytics || mountOverlay !== false || hasDraft || snapshot !== undefined || isCanvas || isValStudioPath(location.pathname)) {
1180
+ return;
1181
+ }
1182
+ // Where the page was hydrated, read now: the script loads later, and the
1183
+ // visitor may have moved on by then. See `landingPath`.
1184
+ var landingPath = location.pathname;
1185
+ var cancelled = false;
1186
+ var tracker = null;
1187
+ import('@valbuild/react/analytics').then(function (_ref2) {
1188
+ var startValAnalytics = _ref2.startValAnalytics;
1189
+ if (!cancelled) {
1190
+ tracker = startValAnalytics({
1191
+ endpoint: "".concat(route, "/analytics"),
1192
+ landingPath: landingPath,
1193
+ contentVersion: contentVersion,
1194
+ // The route's pattern (`/posts/$postId`), never the pathname,
1195
+ // which can hold something about one visitor. A pathname no
1196
+ // route matches is not a page of the site.
1197
+ routeFor: function routeFor(pathname) {
1198
+ var _router$getMatchedRou, _router$getMatchedRou2;
1199
+ return (_router$getMatchedRou = (_router$getMatchedRou2 = router.getMatchedRoutes(pathname)[2]) === null || _router$getMatchedRou2 === void 0 ? void 0 : _router$getMatchedRou2.fullPath) !== null && _router$getMatchedRou !== void 0 ? _router$getMatchedRou : "(not found)";
1200
+ }
1201
+ });
1202
+ }
1203
+ })["catch"](function (error) {
1204
+ Internal$1.log.warn("could not load analytics", error);
1205
+ });
1206
+ return function () {
1207
+ var _tracker;
1208
+ cancelled = true;
1209
+ (_tracker = tracker) === null || _tracker === void 0 || _tracker.stop();
1210
+ };
1211
+ }, [analytics, contentVersion, mountOverlay, hasDraft, snapshot, isCanvas, route, router]);
1156
1212
  React.useEffect(function () {
1157
1213
  // Activate the Suspense gate after hydration. Inside a transition so
1158
1214
  // already-visible (static) content stays on screen while useValStega
@@ -1300,7 +1356,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1300
1356
  var valProviderOverlayListener = function valProviderOverlayListener(event) {
1301
1357
  if (event instanceof CustomEvent) {
1302
1358
  if (!(event !== null && event !== void 0 && event.detail.type)) {
1303
- console.error("Val: invalid event detail (val-overlay-provider)", event);
1359
+ Internal$1.log.error("invalid event detail (val-overlay-provider)", event);
1304
1360
  }
1305
1361
  if (event.detail.type === "spa-ready") {
1306
1362
  setSpaReady(true);
@@ -1322,10 +1378,10 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1322
1378
  });
1323
1379
  }
1324
1380
  } else {
1325
- console.error("Val: invalid event detail (val-overlay-provider)", event.detail);
1381
+ Internal$1.log.error("invalid event detail (val-overlay-provider)", event.detail);
1326
1382
  }
1327
1383
  } else {
1328
- console.error("Val: invalid event (val-overlay-provider)", event);
1384
+ Internal$1.log.error("invalid event (val-overlay-provider)", event);
1329
1385
  }
1330
1386
  };
1331
1387
  window.addEventListener("val-overlay-provider", valProviderOverlayListener);
@@ -1370,7 +1426,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1370
1426
  return;
1371
1427
  }
1372
1428
  if (res.status !== 200) {
1373
- console.error("Val: could not get draft mode status", res);
1429
+ Internal$1.log.error("could not get draft mode status", res);
1374
1430
  return;
1375
1431
  }
1376
1432
  setDraftMode(function (prev) {
@@ -1382,7 +1438,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1382
1438
  return prev;
1383
1439
  });
1384
1440
  })["catch"](function (err) {
1385
- console.error("Val: could not get draft mode status", err);
1441
+ Internal$1.log.error("could not get draft mode status", err);
1386
1442
  })["finally"](function () {
1387
1443
  if (pollDraftStatIdRef.current !== pollDraftStatId) {
1388
1444
  return;
@@ -1399,7 +1455,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1399
1455
  * unrecoverable, because the ONLY other thing that clears it is the
1400
1456
  * `val-ready` message the frame never sent.
1401
1457
  */
1402
- console.warn("Val: draft mode did not confirm in time. Falling back to the " + "idle poll — try toggling preview again.");
1458
+ Internal$1.log.warn("draft mode did not confirm in time. Falling back to the " + "idle poll — try toggling preview again.");
1403
1459
  setIframeSrc(null);
1404
1460
  return;
1405
1461
  }
@@ -1432,8 +1488,14 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1432
1488
  }, [mountOverlay, draftMode, spaReady]);
1433
1489
  React.useEffect(function () {
1434
1490
  if (!mountOverlay) {
1435
- SET_AUTO_TAG_JSX_ENABLED(false);
1491
+ // A visitor: only analytics tags content, and only after hydration
1492
+ // (`useEncodesEditTags`), so this cannot reach a component still
1493
+ // hydrating either.
1494
+ SET_AUTO_TAG_JSX_ENABLED(analytics);
1436
1495
  } else {
1496
+ if (analytics) {
1497
+ SET_AUTO_TAG_JSX_ENABLED(true);
1498
+ }
1437
1499
  if (draftMode) {
1438
1500
  // Safe for a page rendered from a server draft too: what a component
1439
1501
  // renders while it hydrates has no edit tags to turn into attributes
@@ -1472,13 +1534,13 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1472
1534
  window.dispatchEvent(new Event(VAL_EDIT_LANDED));
1473
1535
  }
1474
1536
  } else {
1475
- console.error("Val: invalid event detail", event.detail);
1537
+ Internal$1.log.error("invalid event detail", event.detail);
1476
1538
  }
1477
1539
  } else {
1478
- console.error("Val: invalid custom event details (val-event)", event.detail);
1540
+ Internal$1.log.error("invalid custom event details (val-event)", event.detail);
1479
1541
  }
1480
1542
  } else {
1481
- console.error("Val: invalid custom event (val-event)", event);
1543
+ Internal$1.log.error("invalid custom event (val-event)", event);
1482
1544
  }
1483
1545
  };
1484
1546
  window.addEventListener("val-event", reactServerComponentRefreshListener);
@@ -1487,7 +1549,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1487
1549
  };
1488
1550
  }
1489
1551
  }
1490
- }, [mountOverlay, draftMode, props.disableRefresh]);
1552
+ }, [mountOverlay, draftMode, analytics, props.disableRefresh]);
1491
1553
  React.useEffect(function () {
1492
1554
  if (!mountOverlay) {
1493
1555
  return;
@@ -1572,6 +1634,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1572
1634
  draftModeReady: (_draftModeReady$curre2 = draftModeReady.current) === null || _draftModeReady$curre2 === void 0 ? void 0 : _draftModeReady$curre2.promise,
1573
1635
  draftSourcesSynced: draftSourcesSynced,
1574
1636
  serverDraft: hasDraft,
1637
+ analytics: analytics,
1575
1638
  snapshot: snapshot,
1576
1639
  suspend: suspendActive,
1577
1640
  store: valStore,
@@ -1647,7 +1710,7 @@ var ValTanStackProvider = function ValTanStackProvider(props) {
1647
1710
  function useConsoleLogEnableVal(showOverlay) {
1648
1711
  React.useEffect(function () {
1649
1712
  if (process.env["NODE_ENV"] === "development" && showOverlay === false && !isValStudioPath(location.pathname)) {
1650
- console.warn("\n###########\n###########\n########### @@@@\n########### @@\n########### @@ @@ @@@@@@ @ @@\n########### @@ @@ @@ @@ @@\n########### @@ @@ %@ @ @@\n#### ##### @@ @@ .@ .@ @@\n### #### @@@@ @@: @@@. @@\n#### ##### @@@@ @@@@ =@@@@@@@@@\n###########\n\nThis page is built with Val Build - the lightweight CMS where content is code.\n\nVal is currently hidden.\n\nTo show Val, go to the following URL:\n".concat(window.location.origin, "/api/val/enable?redirect_to=").concat(encodeURIComponent(window.location.href), "\n \nYou are seeing this message because you are in development mode."));
1713
+ Internal$1.log.warn("\n###########\n###########\n########### @@@@\n########### @@\n########### @@ @@ @@@@@@ @ @@\n########### @@ @@ @@ @@ @@\n########### @@ @@ %@ @ @@\n#### ##### @@ @@ .@ .@ @@\n### #### @@@@ @@: @@@. @@\n#### ##### @@@@ @@@@ =@@@@@@@@@\n###########\n\nThis page is built with Val Build - the lightweight CMS where content is code.\n\nVal is currently hidden.\n\nTo show Val, go to the following URL:\n".concat(window.location.origin, "/api/val/enable?redirect_to=").concat(encodeURIComponent(window.location.href), "\n \nYou are seeing this message because you are in development mode."));
1651
1714
  }
1652
1715
  }, [showOverlay]);
1653
1716
  }
@@ -1686,8 +1749,13 @@ function getPositionClassName(dropZone) {
1686
1749
  }
1687
1750
  return className;
1688
1751
  }
1752
+
1753
+ /**
1754
+ * The Studio is `/val` and what is below it -- not every route that starts
1755
+ * with the letters, which would leave `/values` without its overlay.
1756
+ */
1689
1757
  function isValStudioPath(pathname) {
1690
- return pathname.startsWith("/val");
1758
+ return pathname === "/val" || pathname.startsWith("/val/");
1691
1759
  }
1692
1760
 
1693
1761
  /**
@@ -1921,7 +1989,7 @@ function ValVideo(props) {
1921
1989
  }
1922
1990
  var loadHls = hlsRef.current;
1923
1991
  if (!loadHls) {
1924
- console.warn('Val: this browser cannot play HLS streams on its own. Pass `hls={() => import("hls.js")}` to ValVideo.');
1992
+ Internal$1.log.warn('this browser cannot play HLS streams on its own. Pass `hls={() => import("hls.js")}` to ValVideo.');
1925
1993
  return;
1926
1994
  }
1927
1995
  var destroyed = false;
@@ -2102,7 +2170,7 @@ function _startDemoRelay() {
2102
2170
  answer(fetch, event.data).then(function (res) {
2103
2171
  return port.postMessage(res, res.body ? [res.body] : []);
2104
2172
  })["catch"](function (err) {
2105
- console.error("Val: the demo could not answer a relayed request", err);
2173
+ Internal$1.log.error("the demo could not answer a relayed request", err);
2106
2174
  port.postMessage({
2107
2175
  status: 500,
2108
2176
  headers: [["Content-Type", "application/json"]],
@@ -2153,7 +2221,7 @@ function _startDemoRelay() {
2153
2221
  case 6:
2154
2222
  _context2.p = 6;
2155
2223
  _t2 = _context2.v;
2156
- console.error("Val: the demo's service worker did not start", _t2);
2224
+ Internal$1.log.error("the demo's service worker did not start", _t2);
2157
2225
  return _context2.a(2, false);
2158
2226
  }
2159
2227
  }, _callee2, null, [[2, 6]]);
@@ -2181,12 +2249,18 @@ var ValApp = function ValApp(_ref) {
2181
2249
  children = _ref.children,
2182
2250
  demo = _ref.demo;
2183
2251
  var route = "/api/val"; // TODO: make configurable
2184
- var demoStart = useDemoServer(demo === true, config);
2185
2252
  var _useState = useState(),
2186
2253
  _useState2 = _slicedToArray(_useState, 2),
2187
2254
  inMessageMode = _useState2[0],
2188
2255
  setInMessageMode = _useState2[1];
2189
2256
  var isClientSIde = inMessageMode === undefined;
2257
+ // Not before `children` are rendered, which is not on the first render: the
2258
+ // modules the demo's server needs are registered by one of them
2259
+ // (`ValModulesClient`), and a child's effects run before this component's
2260
+ // in the commit that mounts it. Started on the first render, the demo read
2261
+ // them whenever the server's code had loaded -- before the child was there,
2262
+ // on a page that had that code already.
2263
+ var demoStart = useDemoServer(demo !== undefined && demo !== false && inMessageMode === false, config, demo === undefined || typeof demo === "boolean" ? undefined : demo);
2190
2264
  useConfigStorageSave(config);
2191
2265
  var container = useRef(null);
2192
2266
  useEffect(function () {
@@ -2343,8 +2417,9 @@ var ValApp = function ValApp(_ref) {
2343
2417
  }
2344
2418
  if (demo && demoStart.status !== "ready") {
2345
2419
  // 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.
2420
+ // server it talks to has to be there first. The children are rendered
2421
+ // meanwhile: one of them registers the modules that server is started
2422
+ // with.
2348
2423
  return /*#__PURE__*/jsx(Fragment, {
2349
2424
  children: children
2350
2425
  });
@@ -2366,19 +2441,28 @@ var ValApp = function ValApp(_ref) {
2366
2441
  * half of the server, and only a demo should download it.
2367
2442
  */
2368
2443
 
2369
- function useDemoServer(demo, config) {
2444
+ function useDemoServer(demo, config, options) {
2370
2445
  var _useState7 = useState({
2371
2446
  status: "starting"
2372
2447
  }),
2373
2448
  _useState8 = _slicedToArray(_useState7, 2),
2374
2449
  start = _useState8[0],
2375
2450
  setStart = _useState8[1];
2451
+ /*
2452
+ * Read when the demo starts, and not a dependency of the effect: options
2453
+ * written inline (`demo={{ tour }}`) are a new object on every render, and
2454
+ * starting Val's server again for each would throw away every edit. The
2455
+ * Studio reads them once anyway, when its script starts.
2456
+ */
2457
+ var optionsRef = useRef(options);
2458
+ optionsRef.current = options;
2376
2459
  useEffect(function () {
2377
2460
  if (!demo) return;
2378
2461
  var cancelled = false;
2379
2462
  var run = /*#__PURE__*/function () {
2380
2463
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2381
- var _yield$import, createInTabValFetch, modules, fetch, uploads, runtime;
2464
+ var _optionsRef$current;
2465
+ var _yield$import, createInTabValFetch, modules, fetch, uploads, tour, runtime;
2382
2466
  return _regenerator().w(function (_context) {
2383
2467
  while (1) switch (_context.n) {
2384
2468
  case 0:
@@ -2406,10 +2490,13 @@ function useDemoServer(demo, config) {
2406
2490
  return startDemoRelay(fetch);
2407
2491
  case 3:
2408
2492
  uploads = _context.v;
2409
- runtime = {
2493
+ tour = (_optionsRef$current = optionsRef.current) === null || _optionsRef$current === void 0 ? void 0 : _optionsRef$current.tour;
2494
+ runtime = _objectSpread2({
2410
2495
  fetch: fetch,
2411
2496
  uploads: uploads
2412
- };
2497
+ }, tour ? {
2498
+ tour: tour
2499
+ } : {});
2413
2500
  window.__VAL_DEMO__ = runtime;
2414
2501
  return _context.a(2, {
2415
2502
  status: "ready"
@@ -2422,7 +2509,7 @@ function useDemoServer(demo, config) {
2422
2509
  };
2423
2510
  }();
2424
2511
  run()["catch"](function (err) {
2425
- console.error("Val: the demo could not start", err);
2512
+ Internal$1.log.error("the demo could not start", err);
2426
2513
  return {
2427
2514
  status: "failed",
2428
2515
  // Most often the server's code did not download: the page is fine,
@@ -95,7 +95,7 @@ var packageJson = {
95
95
  "tanstack-router",
96
96
  "react"
97
97
  ],
98
- version: "0.148.1",
98
+ version: "0.148.3",
99
99
  scripts: {
100
100
  typecheck: "tsc --noEmit",
101
101
  test: "jest"
@@ -93,7 +93,7 @@ var packageJson = {
93
93
  "tanstack-router",
94
94
  "react"
95
95
  ],
96
- version: "0.148.1",
96
+ version: "0.148.3",
97
97
  scripts: {
98
98
  typecheck: "tsc --noEmit",
99
99
  test: "jest"
@@ -95,7 +95,7 @@ var packageJson = {
95
95
  "tanstack-router",
96
96
  "react"
97
97
  ],
98
- version: "0.148.1",
98
+ version: "0.148.3",
99
99
  scripts: {
100
100
  typecheck: "tsc --noEmit",
101
101
  test: "jest"
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "tanstack-router",
15
15
  "react"
16
16
  ],
17
- "version": "0.148.1",
17
+ "version": "0.148.3",
18
18
  "main": "dist/valbuild-tanstack.cjs.js",
19
19
  "module": "dist/valbuild-tanstack.esm.js",
20
20
  "exports": {
@@ -47,13 +47,13 @@
47
47
  "exports": true
48
48
  },
49
49
  "dependencies": {
50
- "@valbuild/core": "0.148.0",
51
- "@valbuild/language-server": "0.148.1",
52
- "@valbuild/mcp": "0.148.1",
53
- "@valbuild/react": "0.148.1",
54
- "@valbuild/server": "0.148.1",
55
- "@valbuild/shared": "0.148.0",
56
- "@valbuild/ui": "0.148.1"
50
+ "@valbuild/mcp": "0.148.3",
51
+ "@valbuild/language-server": "0.148.3",
52
+ "@valbuild/react": "0.148.3",
53
+ "@valbuild/server": "0.148.3",
54
+ "@valbuild/shared": "0.148.3",
55
+ "@valbuild/ui": "0.148.3",
56
+ "@valbuild/core": "0.148.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@tanstack/react-router": "^1.170.41",
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-fd860c4b.cjs.dev.js');
5
+ var version = require('../../dist/version-f0497731.cjs.dev.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-c3823d62.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-dd0246a1.cjs.dev.js');
9
9
  var server = require('@valbuild/server');
10
10
  var stega = require('@valbuild/react/stega');
11
11
  var internal = require('@valbuild/shared/internal');
12
- var routeFromVal = require('../../dist/routeFromVal-0ea4586f.cjs.dev.js');
12
+ var routeFromVal = require('../../dist/routeFromVal-2f65a4fc.cjs.dev.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('@valbuild/shared/client');
15
15
 
@@ -463,7 +463,7 @@ function _loadDraftSources() {
463
463
  _context8.n = 4;
464
464
  break;
465
465
  }
466
- console.warn("Val: authentication error: ", treeRes.json.message);
466
+ core.Internal.log.debug("authentication error: ", treeRes.json.message);
467
467
  return _context8.a(2, null);
468
468
  case 4:
469
469
  throw Error(JSON.stringify(treeRes.json, null, 2));
@@ -493,7 +493,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
493
493
  case 3:
494
494
  _context2.p = 3;
495
495
  _t2 = _context2.v;
496
- console.error("Val: could not check if Val is enabled! This might be due to an error reading draft mode. fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t2);
496
+ core.Internal.log.error("could not check if Val is enabled! This might be due to an error reading draft mode. fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t2);
497
497
  case 4:
498
498
  if (!enabled) {
499
499
  _context2.n = 16;
@@ -516,7 +516,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
516
516
  case 8:
517
517
  _context2.p = 8;
518
518
  _t3 = _context2.v;
519
- console.error("Val: could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t3);
519
+ core.Internal.log.error("could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t3);
520
520
  headers = null;
521
521
  case 9:
522
522
  _context2.p = 9;
@@ -529,7 +529,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
529
529
  case 11:
530
530
  _context2.p = 11;
531
531
  _t4 = _context2.v;
532
- console.error("Val: could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t4);
532
+ core.Internal.log.error("could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t4);
533
533
  cookies = null;
534
534
  case 12:
535
535
  host = headers && getHost(headers);
@@ -605,7 +605,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
605
605
  return asyncToGenerator._regenerator().w(function (_context3) {
606
606
  while (1) switch (_context3.n) {
607
607
  case 0:
608
- console.error("Val: failed to fetch ", err);
608
+ core.Internal.log.error("failed to fetch ", err);
609
609
  _t12 = stega.stegaEncode;
610
610
  _t13 = selector;
611
611
  _context3.n = 1;
@@ -859,7 +859,7 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
859
859
  _t19 = _context4.v;
860
860
  // Published content, as before this existed: a draft page that renders
861
861
  // the site is a degraded preview, one that fails to render is an outage.
862
- console.error("Val: could not read the draft", _t19);
862
+ core.Internal.log.error("could not read the draft", _t19);
863
863
  return _context4.a(2, onlySnapshot);
864
864
  }
865
865
  }, _callee4, null, [[1, 16]]);
@@ -1404,7 +1404,7 @@ function _loadDraftJsonEntry() {
1404
1404
  _context12.n = 7;
1405
1405
  break;
1406
1406
  }
1407
- console.warn("Val: authentication error: ", res.json.message);
1407
+ core.Internal.log.debug("authentication error: ", res.json.message);
1408
1408
  return _context12.a(2, {
1409
1409
  status: "unavailable"
1410
1410
  });
@@ -1417,7 +1417,7 @@ function _loadDraftJsonEntry() {
1417
1417
  status: "absent"
1418
1418
  });
1419
1419
  case 8:
1420
- console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
1420
+ core.Internal.log.error("could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
1421
1421
  return _context12.a(2, {
1422
1422
  status: "unavailable"
1423
1423
  });
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = require('../../dist/version-684beca4.cjs.prod.js');
5
+ var version = require('../../dist/version-4353b65f.cjs.prod.js');
6
6
  var asyncToGenerator = require('../../dist/asyncToGenerator-8e5c36c8.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var _typeof = require('../../dist/typeof-8998e126.cjs.prod.js');
9
9
  var server = require('@valbuild/server');
10
10
  var stega = require('@valbuild/react/stega');
11
11
  var internal = require('@valbuild/shared/internal');
12
- var routeFromVal = require('../../dist/routeFromVal-97a52f43.cjs.prod.js');
12
+ var routeFromVal = require('../../dist/routeFromVal-a13ac8a3.cjs.prod.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('@valbuild/shared/client');
15
15
 
@@ -463,7 +463,7 @@ function _loadDraftSources() {
463
463
  _context8.n = 4;
464
464
  break;
465
465
  }
466
- console.warn("Val: authentication error: ", treeRes.json.message);
466
+ core.Internal.log.debug("authentication error: ", treeRes.json.message);
467
467
  return _context8.a(2, null);
468
468
  case 4:
469
469
  throw Error(JSON.stringify(treeRes.json, null, 2));
@@ -493,7 +493,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
493
493
  case 3:
494
494
  _context2.p = 3;
495
495
  _t2 = _context2.v;
496
- console.error("Val: could not check if Val is enabled! This might be due to an error reading draft mode. fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t2);
496
+ core.Internal.log.error("could not check if Val is enabled! This might be due to an error reading draft mode. fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t2);
497
497
  case 4:
498
498
  if (!enabled) {
499
499
  _context2.n = 16;
@@ -516,7 +516,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
516
516
  case 8:
517
517
  _context2.p = 8;
518
518
  _t3 = _context2.v;
519
- console.error("Val: could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t3);
519
+ core.Internal.log.error("could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t3);
520
520
  headers = null;
521
521
  case 9:
522
522
  _context2.p = 9;
@@ -529,7 +529,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
529
529
  case 11:
530
530
  _context2.p = 11;
531
531
  _t4 = _context2.v;
532
- console.error("Val: could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t4);
532
+ core.Internal.log.error("could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t4);
533
533
  cookies = null;
534
534
  case 12:
535
535
  host = headers && getHost(headers);
@@ -605,7 +605,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
605
605
  return asyncToGenerator._regenerator().w(function (_context3) {
606
606
  while (1) switch (_context3.n) {
607
607
  case 0:
608
- console.error("Val: failed to fetch ", err);
608
+ core.Internal.log.error("failed to fetch ", err);
609
609
  _t12 = stega.stegaEncode;
610
610
  _t13 = selector;
611
611
  _context3.n = 1;
@@ -859,7 +859,7 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
859
859
  _t19 = _context4.v;
860
860
  // Published content, as before this existed: a draft page that renders
861
861
  // the site is a degraded preview, one that fails to render is an outage.
862
- console.error("Val: could not read the draft", _t19);
862
+ core.Internal.log.error("could not read the draft", _t19);
863
863
  return _context4.a(2, onlySnapshot);
864
864
  }
865
865
  }, _callee4, null, [[1, 16]]);
@@ -1404,7 +1404,7 @@ function _loadDraftJsonEntry() {
1404
1404
  _context12.n = 7;
1405
1405
  break;
1406
1406
  }
1407
- console.warn("Val: authentication error: ", res.json.message);
1407
+ core.Internal.log.debug("authentication error: ", res.json.message);
1408
1408
  return _context12.a(2, {
1409
1409
  status: "unavailable"
1410
1410
  });
@@ -1417,7 +1417,7 @@ function _loadDraftJsonEntry() {
1417
1417
  status: "absent"
1418
1418
  });
1419
1419
  case 8:
1420
- console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
1420
+ core.Internal.log.error("could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
1421
1421
  return _context12.a(2, {
1422
1422
  status: "unavailable"
1423
1423
  });