@valbuild/tanstack-build 0.144.4 → 0.145.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @valbuild/tanstack-build
2
2
 
3
+ ## 0.145.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#860](https://github.com/valbuild/val/pull/860) [`a45f595`](https://github.com/valbuild/val/commit/a45f595a5e20b009d4110bbef8ebdc08b2d731d7) Thanks [@freekh](https://github.com/freekh)! - `val publish` now refuses to build a site whose installed TanStack disagrees with the platform's. A project's CI builds its dependency layer from its own `node_modules`, and a lockfile two patches away from the platform's `@tanstack/*` used to publish fine and then fail on the first request that reached the mismatched code — typically signing in — with "does not provide an export named …". The build now stops with a message naming the package, the version the project resolved and the version the platform carries, and the fix is to pin the package to that version (with `pnpm.overrides` for a transitive one) and reinstall.
8
+
9
+ The same build also checks every import a dependency takes from the platform's React and TanStack against what the platform says those modules export, which until now ran only in the platform's own checkout.
10
+
11
+ Both checks use what the platform reports about itself, so they run once the platform does; until then `val publish` builds as before and says in its output that the check was skipped. They run in the `@valbuild/tanstack-build` the project has installed, so upgrade it alongside `@valbuild/cli`.
12
+
13
+ - [#860](https://github.com/valbuild/val/pull/860) [`a45f595`](https://github.com/valbuild/val/commit/a45f595a5e20b009d4110bbef8ebdc08b2d731d7) Thanks [@freekh](https://github.com/freekh)! - A server function's validator no longer ships to the browser. TanStack Start removes `createServerFn().validator(...)` and `.inputValidator(...)` from client code, because a validator only ever runs on the server; the Val build replaced the handler but left the validator in, so its code — and anything it imported — reached every visitor's bundle. Both spellings are handled: TanStack Start 1.169 removed `.inputValidator()`, and 1.168 has both.
14
+
3
15
  ## 0.144.4
4
16
 
5
17
  ### Patch Changes
@@ -83,6 +83,42 @@ export interface BuildTarget {
83
83
  modules: Record<string, string>;
84
84
  /** The same, for the react-server layer. Empty when RSC is not served. */
85
85
  rscModules: Record<string, string>;
86
+ /**
87
+ * Package -> the exact version this base layer was built from: every
88
+ * package a base specifier belongs to, and every `@tanstack/*` the
89
+ * platform carries.
90
+ *
91
+ * A layer build that bundles one of these at another version refuses,
92
+ * naming both. A project's own copy of a base package is never used for a
93
+ * base specifier, so a lockfile that disagrees here is either harmless or
94
+ * the skew PINS.md records -- and a build that is not running in the
95
+ * platform's own checkout cannot pin to the platform's copy, so it has to
96
+ * be told which is which.
97
+ *
98
+ * These are a property of the base SET, which is why they travel with
99
+ * `rev` rather than beside it: when a project chooses its base set, the
100
+ * answer for that set carries that set's versions, and nothing that reads
101
+ * this has to change.
102
+ *
103
+ * Absent from a loader that predates it. A build then skips the check
104
+ * rather than failing, and says so.
105
+ */
106
+ pins?: Record<string, string>;
107
+ /**
108
+ * Base chunk name -> the names it exports, per target: what a project
109
+ * chunk may import from `${baseFrom}${chunk}.js`.
110
+ *
111
+ * The export audit's facts for a build that has no built base layer on
112
+ * disk, which is every build but the platform's own. A chunk that is not
113
+ * listed is not checked -- the same "cannot be determined" a chunk ending
114
+ * in `export *` gets -- rather than refused.
115
+ *
116
+ * Absent from a loader that predates it, and the audit then skips.
117
+ */
118
+ exports?: {
119
+ worker: Record<string, Array<string>>;
120
+ browser: Record<string, Array<string>>;
121
+ };
86
122
  /** Where the chunks live, as seen from each kind of importer. */
87
123
  paths: {
88
124
  /** The base layer, from a project-layer chunk. */
@@ -11,7 +11,7 @@
11
11
  * Nothing in here is reachable from the package root. See
12
12
  * `noNodeFromBrowser.test.ts`.
13
13
  */
14
- export { BASE_PROVIDED, auditableImports, auditableSpecifiers, buildVendorLayer, chunkNameFor, collectDependencyCss, cssSpecifiersOf, layerDepsOf, packageOf, type VendorLayer, type VendorPlatform, } from "./vendorLayer.js";
14
+ export { BASE_PROVIDED, auditableImports, auditableSpecifiers, buildVendorLayer, chunkNameFor, collectDependencyCss, cssSpecifiersOf, layerDepsOf, packageOf, PinSkewError, type PinSkew, type VendorLayer, type VendorPlatform, } from "./vendorLayer.js";
15
15
  export { nodeShims, nodeShimSources, NODE_SHIMS, REEXPORT, SHIM_PREFIX, } from "./nodeShims.js";
16
16
  export { cssModuleLoader } from "./cssModules.js";
17
17
  export { routeSplitter } from "./routeSplitter.js";
@@ -48,11 +48,35 @@ export interface VendorPlatform {
48
48
  * not built them.
49
49
  *
50
50
  * Only the export audit reads it, and only to check a named import against
51
- * the chunk it will link to. Null means that check is skipped, which is the
52
- * honest answer rather than a refusal -- see `baseChunkExports`.
51
+ * the chunk it will link to. Null means the audit reads what the platform
52
+ * said instead (`base.exports`), and skips a chunk the platform said nothing
53
+ * about, which is the honest answer rather than a refusal -- see
54
+ * `baseChunkExports`.
53
55
  */
54
56
  baseLayerDir: string | null;
55
57
  }
58
+ /** A pinned package, bundled into the layer at a version the base set is not. */
59
+ export interface PinSkew {
60
+ name: string;
61
+ /** What the base set was built from: `BuildTarget.base.pins`. */
62
+ pinned: string;
63
+ /** What the project's own install resolved, and the layer would carry. */
64
+ found: string;
65
+ }
66
+ /**
67
+ * A layer that would carry a pinned package at another version.
68
+ *
69
+ * Its own class because it is the one failure `buildVendorLayer` must NOT
70
+ * absorb. Every other build error drops the dependency that caused it and
71
+ * carries on (see `skipped`), which is right for a Vite plugin nobody imports
72
+ * and wrong here: dropping `@valbuild/tanstack` because its TanStack disagrees
73
+ * with the platform's turns "your lockfile is out of step" into "this import
74
+ * is not available", which names the wrong thing to fix.
75
+ */
76
+ export declare class PinSkewError extends Error {
77
+ readonly skew: Array<PinSkew>;
78
+ constructor(skew: Array<PinSkew>, baseRev: string);
79
+ }
56
80
  export interface VendorLayer {
57
81
  rev: string;
58
82
  /**
@@ -429,6 +429,16 @@ var assetModule = function assetModule(url) {
429
429
  return "export default ".concat(JSON.stringify(url), "\n");
430
430
  };
431
431
 
432
+ function _typeof(o) {
433
+ "@babel/helpers - typeof";
434
+
435
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
436
+ return typeof o;
437
+ } : function (o) {
438
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
439
+ }, _typeof(o);
440
+ }
441
+
432
442
  function _regeneratorValues(e) {
433
443
  if (null != e) {
434
444
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -447,4 +457,4 @@ function _regeneratorValues(e) {
447
457
  throw new TypeError(typeof e + " is not iterable");
448
458
  }
449
459
 
450
- export { ASSET_BASE as A, INLINE_LIMIT as I, _createForOfIteratorHelper as _, _asyncToGenerator as a, _regenerator as b, _toConsumableArray as c, _slicedToArray as d, _objectSpread2 as e, _defineProperty as f, _regeneratorValues as g, assetModule as h, isAsset as i, base64Bytes as j, resolveAsset as r, sha256Hex as s };
460
+ export { ASSET_BASE as A, INLINE_LIMIT as I, _createForOfIteratorHelper as _, _asyncToGenerator as a, _regenerator as b, _toConsumableArray as c, _slicedToArray as d, _typeof as e, _objectSpread2 as f, _defineProperty as g, _regeneratorValues as h, assetModule as i, isAsset as j, base64Bytes as k, _toPropertyKey as l, resolveAsset as r, sha256Hex as s };
@@ -431,6 +431,16 @@ var assetModule = function assetModule(url) {
431
431
  return "export default ".concat(JSON.stringify(url), "\n");
432
432
  };
433
433
 
434
+ function _typeof(o) {
435
+ "@babel/helpers - typeof";
436
+
437
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
438
+ return typeof o;
439
+ } : function (o) {
440
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
441
+ }, _typeof(o);
442
+ }
443
+
434
444
  function _regeneratorValues(e) {
435
445
  if (null != e) {
436
446
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -459,6 +469,8 @@ exports._regenerator = _regenerator;
459
469
  exports._regeneratorValues = _regeneratorValues;
460
470
  exports._slicedToArray = _slicedToArray;
461
471
  exports._toConsumableArray = _toConsumableArray;
472
+ exports._toPropertyKey = _toPropertyKey;
473
+ exports._typeof = _typeof;
462
474
  exports.assetModule = assetModule;
463
475
  exports.base64Bytes = base64Bytes;
464
476
  exports.isAsset = isAsset;
@@ -431,6 +431,16 @@ var assetModule = function assetModule(url) {
431
431
  return "export default ".concat(JSON.stringify(url), "\n");
432
432
  };
433
433
 
434
+ function _typeof(o) {
435
+ "@babel/helpers - typeof";
436
+
437
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
438
+ return typeof o;
439
+ } : function (o) {
440
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
441
+ }, _typeof(o);
442
+ }
443
+
434
444
  function _regeneratorValues(e) {
435
445
  if (null != e) {
436
446
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -459,6 +469,8 @@ exports._regenerator = _regenerator;
459
469
  exports._regeneratorValues = _regeneratorValues;
460
470
  exports._slicedToArray = _slicedToArray;
461
471
  exports._toConsumableArray = _toConsumableArray;
472
+ exports._toPropertyKey = _toPropertyKey;
473
+ exports._typeof = _typeof;
462
474
  exports.assetModule = assetModule;
463
475
  exports.base64Bytes = base64Bytes;
464
476
  exports.isAsset = isAsset;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var regeneratorValues = require('./regeneratorValues-5b6a1f70.cjs.dev.js');
5
+ var regeneratorValues = require('./regeneratorValues-f5d7ce8a.cjs.dev.js');
6
6
  var browser = require('@rolldown/browser');
7
7
  var projectPaths = require('./projectPaths-f222255a.cjs.dev.js');
8
8
  var parseAst = require('@rolldown/browser/parseAst');
@@ -201,6 +201,47 @@ function rscEntrySource(files) {
201
201
  var REGISTRY_REEXPORT = "\nexport { __serverFns } from ".concat(JSON.stringify(REGISTRY_ID), "\n");
202
202
  var SERVER_RPC = "@tanstack/react-start/server-rpc";
203
203
  var CLIENT_RPC = "@tanstack/react-start/client-rpc";
204
+ /**
205
+ * Both spellings, because both are supported while a supported version set
206
+ * has each: Start 1.169 removed `inputValidator` from its runtime, and 1.168
207
+ * has both. See `version-sets/` in valbuild/home.
208
+ */
209
+ var VALIDATOR_METHODS = new Set(["validator", "inputValidator"]);
210
+
211
+ /**
212
+ * The validator calls in a `createServerFn()` chain, which the CLIENT build
213
+ * drops as Start's `handleCreateServerFn` does (`stripMethodCall`).
214
+ *
215
+ * A validator is server code: it runs before the handler, on the server, and
216
+ * nothing in the browser calls it. Left in, it ships to every visitor along
217
+ * with whatever it imports -- the schema library at best, and a server-only
218
+ * module at worst. Only the handler used to be replaced, so for a long time
219
+ * this went to the browser unnoticed; `patterns-test.ts` in valbuild/home now
220
+ * asserts the validator's body is absent from the client bundle.
221
+ */
222
+ function validatorsOf(chain, moduleId) {
223
+ var found = [];
224
+ var current = chain;
225
+ while (current && current.type === "CallExpression") {
226
+ var _callee$property;
227
+ var callee = current.callee;
228
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") break;
229
+ var name = (_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name;
230
+ if (typeof name === "string" && VALIDATOR_METHODS.has(name)) {
231
+ var _current$arguments;
232
+ if (!((_current$arguments = current.arguments) !== null && _current$arguments !== void 0 && _current$arguments[0])) {
233
+ throw new Error("".concat(moduleId, ": createServerFn().").concat(name, "() must be called with a validator."));
234
+ }
235
+ found.push({
236
+ start: callee.object.end,
237
+ end: current.end
238
+ });
239
+ }
240
+ current = callee.object;
241
+ }
242
+ return found;
243
+ }
244
+
204
245
  /**
205
246
  * Ids must be identical across the two passes, since one produces the registry
206
247
  * key and the other the URL that looks it up. Derived from the module id and
@@ -241,11 +282,11 @@ function findSites(ast, moduleId, code, seen) {
241
282
  var sites = [];
242
283
  var names = new Set();
243
284
  walk(ast, function (node, stack) {
244
- var _callee$property, _node$arguments, _declarator$id;
285
+ var _callee$property2, _node$arguments, _declarator$id;
245
286
  if (node.type !== "CallExpression") return;
246
287
  var callee = node.callee;
247
288
  if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") return;
248
- if (((_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name) !== "handler") return;
289
+ if (((_callee$property2 = callee.property) === null || _callee$property2 === void 0 ? void 0 : _callee$property2.name) !== "handler") return;
249
290
  if (!isCreateServerFnChain(callee.object)) return;
250
291
  var arg = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
251
292
  if (!arg) {
@@ -283,7 +324,8 @@ function findSites(ast, moduleId, code, seen) {
283
324
  argStart: arg.start,
284
325
  argEnd: arg.end,
285
326
  declStart: statement.start,
286
- declEnd: statement.end
327
+ declEnd: statement.end,
328
+ validators: validatorsOf(callee.object, moduleId)
287
329
  });
288
330
  });
289
331
  return sites;
@@ -297,7 +339,7 @@ function transformServerFns(_x, _x2, _x3, _x4) {
297
339
  }
298
340
  function _transformServerFns() {
299
341
  _transformServerFns = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(moduleId, code, target, seen) {
300
- var ast, sites, edits, _iterator, _step, site, meta, out, prelude;
342
+ var ast, sites, edits, _iterator, _step, site, meta, _iterator2, _step2, validator, out, prelude;
301
343
  return regeneratorValues._regenerator().w(function (_context) {
302
344
  while (1) switch (_context.n) {
303
345
  case 0:
@@ -353,6 +395,21 @@ function _transformServerFns() {
353
395
  end: site.argEnd,
354
396
  text: "__platformClientRpc(".concat(JSON.stringify(site.id), ")")
355
397
  });
398
+ _iterator2 = regeneratorValues._createForOfIteratorHelper(site.validators);
399
+ try {
400
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
401
+ validator = _step2.value;
402
+ edits.push({
403
+ start: validator.start,
404
+ end: validator.end,
405
+ text: ""
406
+ });
407
+ }
408
+ } catch (err) {
409
+ _iterator2.e(err);
410
+ } finally {
411
+ _iterator2.f();
412
+ }
356
413
  }
357
414
  }
358
415
  } catch (err) {
@@ -1035,16 +1092,6 @@ function _objectWithoutProperties(e, t) {
1035
1092
  return i;
1036
1093
  }
1037
1094
 
1038
- function _typeof(o) {
1039
- "@babel/helpers - typeof";
1040
-
1041
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
1042
- return typeof o;
1043
- } : function (o) {
1044
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1045
- }, _typeof(o);
1046
- }
1047
-
1048
1095
  var packageJson = {
1049
1096
  name: "@valbuild/tanstack-build",
1050
1097
  "private": false,
@@ -1054,7 +1101,7 @@ var packageJson = {
1054
1101
  url: "git+https://github.com/valbuild/val.git"
1055
1102
  },
1056
1103
  license: "MIT",
1057
- version: "0.144.4",
1104
+ version: "0.145.1",
1058
1105
  sideEffects: false,
1059
1106
  main: "dist/valbuild-tanstack-build.cjs.js",
1060
1107
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1399,7 +1446,7 @@ function bakedGit(files) {
1399
1446
  if (!(match !== null && match !== void 0 && match[1]) || match[1] === "null") return undefined;
1400
1447
  try {
1401
1448
  var parsed = JSON.parse(match[1]);
1402
- if (_typeof(parsed) !== "object" || parsed === null) return undefined;
1449
+ if (regeneratorValues._typeof(parsed) !== "object" || parsed === null) return undefined;
1403
1450
  var _ref2 = parsed,
1404
1451
  commit = _ref2.commit,
1405
1452
  branch = _ref2.branch;
@@ -1704,7 +1751,7 @@ function _digests() {
1704
1751
  }
1705
1752
  function canonicalJson(value) {
1706
1753
  if (Array.isArray(value)) return "[".concat(value.map(canonicalJson).join(","), "]");
1707
- if (value !== null && _typeof(value) === "object") {
1754
+ if (value !== null && regeneratorValues._typeof(value) === "object") {
1708
1755
  var entries = Object.entries(value).filter(function (_ref) {
1709
1756
  var _ref2 = regeneratorValues._slicedToArray(_ref, 2),
1710
1757
  item = _ref2[1];
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var regeneratorValues = require('./regeneratorValues-295cad22.cjs.prod.js');
5
+ var regeneratorValues = require('./regeneratorValues-eb61e1b2.cjs.prod.js');
6
6
  var browser = require('@rolldown/browser');
7
7
  var projectPaths = require('./projectPaths-9cbecebf.cjs.prod.js');
8
8
  var parseAst = require('@rolldown/browser/parseAst');
@@ -201,6 +201,47 @@ function rscEntrySource(files) {
201
201
  var REGISTRY_REEXPORT = "\nexport { __serverFns } from ".concat(JSON.stringify(REGISTRY_ID), "\n");
202
202
  var SERVER_RPC = "@tanstack/react-start/server-rpc";
203
203
  var CLIENT_RPC = "@tanstack/react-start/client-rpc";
204
+ /**
205
+ * Both spellings, because both are supported while a supported version set
206
+ * has each: Start 1.169 removed `inputValidator` from its runtime, and 1.168
207
+ * has both. See `version-sets/` in valbuild/home.
208
+ */
209
+ var VALIDATOR_METHODS = new Set(["validator", "inputValidator"]);
210
+
211
+ /**
212
+ * The validator calls in a `createServerFn()` chain, which the CLIENT build
213
+ * drops as Start's `handleCreateServerFn` does (`stripMethodCall`).
214
+ *
215
+ * A validator is server code: it runs before the handler, on the server, and
216
+ * nothing in the browser calls it. Left in, it ships to every visitor along
217
+ * with whatever it imports -- the schema library at best, and a server-only
218
+ * module at worst. Only the handler used to be replaced, so for a long time
219
+ * this went to the browser unnoticed; `patterns-test.ts` in valbuild/home now
220
+ * asserts the validator's body is absent from the client bundle.
221
+ */
222
+ function validatorsOf(chain, moduleId) {
223
+ var found = [];
224
+ var current = chain;
225
+ while (current && current.type === "CallExpression") {
226
+ var _callee$property;
227
+ var callee = current.callee;
228
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") break;
229
+ var name = (_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name;
230
+ if (typeof name === "string" && VALIDATOR_METHODS.has(name)) {
231
+ var _current$arguments;
232
+ if (!((_current$arguments = current.arguments) !== null && _current$arguments !== void 0 && _current$arguments[0])) {
233
+ throw new Error("".concat(moduleId, ": createServerFn().").concat(name, "() must be called with a validator."));
234
+ }
235
+ found.push({
236
+ start: callee.object.end,
237
+ end: current.end
238
+ });
239
+ }
240
+ current = callee.object;
241
+ }
242
+ return found;
243
+ }
244
+
204
245
  /**
205
246
  * Ids must be identical across the two passes, since one produces the registry
206
247
  * key and the other the URL that looks it up. Derived from the module id and
@@ -241,11 +282,11 @@ function findSites(ast, moduleId, code, seen) {
241
282
  var sites = [];
242
283
  var names = new Set();
243
284
  walk(ast, function (node, stack) {
244
- var _callee$property, _node$arguments, _declarator$id;
285
+ var _callee$property2, _node$arguments, _declarator$id;
245
286
  if (node.type !== "CallExpression") return;
246
287
  var callee = node.callee;
247
288
  if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") return;
248
- if (((_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name) !== "handler") return;
289
+ if (((_callee$property2 = callee.property) === null || _callee$property2 === void 0 ? void 0 : _callee$property2.name) !== "handler") return;
249
290
  if (!isCreateServerFnChain(callee.object)) return;
250
291
  var arg = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
251
292
  if (!arg) {
@@ -283,7 +324,8 @@ function findSites(ast, moduleId, code, seen) {
283
324
  argStart: arg.start,
284
325
  argEnd: arg.end,
285
326
  declStart: statement.start,
286
- declEnd: statement.end
327
+ declEnd: statement.end,
328
+ validators: validatorsOf(callee.object, moduleId)
287
329
  });
288
330
  });
289
331
  return sites;
@@ -297,7 +339,7 @@ function transformServerFns(_x, _x2, _x3, _x4) {
297
339
  }
298
340
  function _transformServerFns() {
299
341
  _transformServerFns = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(moduleId, code, target, seen) {
300
- var ast, sites, edits, _iterator, _step, site, meta, out, prelude;
342
+ var ast, sites, edits, _iterator, _step, site, meta, _iterator2, _step2, validator, out, prelude;
301
343
  return regeneratorValues._regenerator().w(function (_context) {
302
344
  while (1) switch (_context.n) {
303
345
  case 0:
@@ -353,6 +395,21 @@ function _transformServerFns() {
353
395
  end: site.argEnd,
354
396
  text: "__platformClientRpc(".concat(JSON.stringify(site.id), ")")
355
397
  });
398
+ _iterator2 = regeneratorValues._createForOfIteratorHelper(site.validators);
399
+ try {
400
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
401
+ validator = _step2.value;
402
+ edits.push({
403
+ start: validator.start,
404
+ end: validator.end,
405
+ text: ""
406
+ });
407
+ }
408
+ } catch (err) {
409
+ _iterator2.e(err);
410
+ } finally {
411
+ _iterator2.f();
412
+ }
356
413
  }
357
414
  }
358
415
  } catch (err) {
@@ -1035,16 +1092,6 @@ function _objectWithoutProperties(e, t) {
1035
1092
  return i;
1036
1093
  }
1037
1094
 
1038
- function _typeof(o) {
1039
- "@babel/helpers - typeof";
1040
-
1041
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
1042
- return typeof o;
1043
- } : function (o) {
1044
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1045
- }, _typeof(o);
1046
- }
1047
-
1048
1095
  var packageJson = {
1049
1096
  name: "@valbuild/tanstack-build",
1050
1097
  "private": false,
@@ -1054,7 +1101,7 @@ var packageJson = {
1054
1101
  url: "git+https://github.com/valbuild/val.git"
1055
1102
  },
1056
1103
  license: "MIT",
1057
- version: "0.144.4",
1104
+ version: "0.145.1",
1058
1105
  sideEffects: false,
1059
1106
  main: "dist/valbuild-tanstack-build.cjs.js",
1060
1107
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1399,7 +1446,7 @@ function bakedGit(files) {
1399
1446
  if (!(match !== null && match !== void 0 && match[1]) || match[1] === "null") return undefined;
1400
1447
  try {
1401
1448
  var parsed = JSON.parse(match[1]);
1402
- if (_typeof(parsed) !== "object" || parsed === null) return undefined;
1449
+ if (regeneratorValues._typeof(parsed) !== "object" || parsed === null) return undefined;
1403
1450
  var _ref2 = parsed,
1404
1451
  commit = _ref2.commit,
1405
1452
  branch = _ref2.branch;
@@ -1704,7 +1751,7 @@ function _digests() {
1704
1751
  }
1705
1752
  function canonicalJson(value) {
1706
1753
  if (Array.isArray(value)) return "[".concat(value.map(canonicalJson).join(","), "]");
1707
- if (value !== null && _typeof(value) === "object") {
1754
+ if (value !== null && regeneratorValues._typeof(value) === "object") {
1708
1755
  var entries = Object.entries(value).filter(function (_ref) {
1709
1756
  var _ref2 = regeneratorValues._slicedToArray(_ref, 2),
1710
1757
  item = _ref2[1];
@@ -1,5 +1,5 @@
1
- import { _ as _createForOfIteratorHelper, a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, d as _slicedToArray, s as sha256Hex, e as _objectSpread2, f as _defineProperty, g as _regeneratorValues, r as resolveAsset, h as assetModule, i as isAsset } from './regeneratorValues-4fe49970.esm.js';
2
- export { I as INLINE_LIMIT, j as base64Bytes, i as isAsset } from './regeneratorValues-4fe49970.esm.js';
1
+ import { _ as _createForOfIteratorHelper, a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, d as _slicedToArray, s as sha256Hex, e as _typeof, f as _objectSpread2, g as _defineProperty, h as _regeneratorValues, r as resolveAsset, i as assetModule, j as isAsset } from './regeneratorValues-77cb8c45.esm.js';
2
+ export { I as INLINE_LIMIT, k as base64Bytes, j as isAsset } from './regeneratorValues-77cb8c45.esm.js';
3
3
  import { build } from '@rolldown/browser';
4
4
  import { T as TREE, E as ENTRY } from './projectPaths-5e4defea.esm.js';
5
5
  export { E as ENTRY, R as ROUTES_DIR, T as TREE } from './projectPaths-5e4defea.esm.js';
@@ -200,6 +200,47 @@ function rscEntrySource(files) {
200
200
  var REGISTRY_REEXPORT = "\nexport { __serverFns } from ".concat(JSON.stringify(REGISTRY_ID), "\n");
201
201
  var SERVER_RPC = "@tanstack/react-start/server-rpc";
202
202
  var CLIENT_RPC = "@tanstack/react-start/client-rpc";
203
+ /**
204
+ * Both spellings, because both are supported while a supported version set
205
+ * has each: Start 1.169 removed `inputValidator` from its runtime, and 1.168
206
+ * has both. See `version-sets/` in valbuild/home.
207
+ */
208
+ var VALIDATOR_METHODS = new Set(["validator", "inputValidator"]);
209
+
210
+ /**
211
+ * The validator calls in a `createServerFn()` chain, which the CLIENT build
212
+ * drops as Start's `handleCreateServerFn` does (`stripMethodCall`).
213
+ *
214
+ * A validator is server code: it runs before the handler, on the server, and
215
+ * nothing in the browser calls it. Left in, it ships to every visitor along
216
+ * with whatever it imports -- the schema library at best, and a server-only
217
+ * module at worst. Only the handler used to be replaced, so for a long time
218
+ * this went to the browser unnoticed; `patterns-test.ts` in valbuild/home now
219
+ * asserts the validator's body is absent from the client bundle.
220
+ */
221
+ function validatorsOf(chain, moduleId) {
222
+ var found = [];
223
+ var current = chain;
224
+ while (current && current.type === "CallExpression") {
225
+ var _callee$property;
226
+ var callee = current.callee;
227
+ if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") break;
228
+ var name = (_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name;
229
+ if (typeof name === "string" && VALIDATOR_METHODS.has(name)) {
230
+ var _current$arguments;
231
+ if (!((_current$arguments = current.arguments) !== null && _current$arguments !== void 0 && _current$arguments[0])) {
232
+ throw new Error("".concat(moduleId, ": createServerFn().").concat(name, "() must be called with a validator."));
233
+ }
234
+ found.push({
235
+ start: callee.object.end,
236
+ end: current.end
237
+ });
238
+ }
239
+ current = callee.object;
240
+ }
241
+ return found;
242
+ }
243
+
203
244
  /**
204
245
  * Ids must be identical across the two passes, since one produces the registry
205
246
  * key and the other the URL that looks it up. Derived from the module id and
@@ -240,11 +281,11 @@ function findSites(ast, moduleId, code, seen) {
240
281
  var sites = [];
241
282
  var names = new Set();
242
283
  walk(ast, function (node, stack) {
243
- var _callee$property, _node$arguments, _declarator$id;
284
+ var _callee$property2, _node$arguments, _declarator$id;
244
285
  if (node.type !== "CallExpression") return;
245
286
  var callee = node.callee;
246
287
  if ((callee === null || callee === void 0 ? void 0 : callee.type) !== "MemberExpression") return;
247
- if (((_callee$property = callee.property) === null || _callee$property === void 0 ? void 0 : _callee$property.name) !== "handler") return;
288
+ if (((_callee$property2 = callee.property) === null || _callee$property2 === void 0 ? void 0 : _callee$property2.name) !== "handler") return;
248
289
  if (!isCreateServerFnChain(callee.object)) return;
249
290
  var arg = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments[0];
250
291
  if (!arg) {
@@ -282,7 +323,8 @@ function findSites(ast, moduleId, code, seen) {
282
323
  argStart: arg.start,
283
324
  argEnd: arg.end,
284
325
  declStart: statement.start,
285
- declEnd: statement.end
326
+ declEnd: statement.end,
327
+ validators: validatorsOf(callee.object, moduleId)
286
328
  });
287
329
  });
288
330
  return sites;
@@ -296,7 +338,7 @@ function transformServerFns(_x, _x2, _x3, _x4) {
296
338
  }
297
339
  function _transformServerFns() {
298
340
  _transformServerFns = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(moduleId, code, target, seen) {
299
- var ast, sites, edits, _iterator, _step, site, meta, out, prelude;
341
+ var ast, sites, edits, _iterator, _step, site, meta, _iterator2, _step2, validator, out, prelude;
300
342
  return _regenerator().w(function (_context) {
301
343
  while (1) switch (_context.n) {
302
344
  case 0:
@@ -352,6 +394,21 @@ function _transformServerFns() {
352
394
  end: site.argEnd,
353
395
  text: "__platformClientRpc(".concat(JSON.stringify(site.id), ")")
354
396
  });
397
+ _iterator2 = _createForOfIteratorHelper(site.validators);
398
+ try {
399
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
400
+ validator = _step2.value;
401
+ edits.push({
402
+ start: validator.start,
403
+ end: validator.end,
404
+ text: ""
405
+ });
406
+ }
407
+ } catch (err) {
408
+ _iterator2.e(err);
409
+ } finally {
410
+ _iterator2.f();
411
+ }
355
412
  }
356
413
  }
357
414
  } catch (err) {
@@ -1034,16 +1091,6 @@ function _objectWithoutProperties(e, t) {
1034
1091
  return i;
1035
1092
  }
1036
1093
 
1037
- function _typeof(o) {
1038
- "@babel/helpers - typeof";
1039
-
1040
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
1041
- return typeof o;
1042
- } : function (o) {
1043
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1044
- }, _typeof(o);
1045
- }
1046
-
1047
1094
  var packageJson = {
1048
1095
  name: "@valbuild/tanstack-build",
1049
1096
  "private": false,
@@ -1053,7 +1100,7 @@ var packageJson = {
1053
1100
  url: "git+https://github.com/valbuild/val.git"
1054
1101
  },
1055
1102
  license: "MIT",
1056
- version: "0.144.4",
1103
+ version: "0.145.1",
1057
1104
  sideEffects: false,
1058
1105
  main: "dist/valbuild-tanstack-build.cjs.js",
1059
1106
  module: "dist/valbuild-tanstack-build.esm.js",