@valbuild/tanstack-build 0.144.2 → 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,23 @@
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
+
15
+ ## 0.144.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#835](https://github.com/valbuild/val/pull/835) [`e70a261`](https://github.com/valbuild/val/commit/e70a261ed8c0938b635214721fc4e445704b1f1f) Thanks [@freekh](https://github.com/freekh)! - A build is now named by what it was built from rather than by what it produced, so publishing the same project files again reuses the build the site already has. When that build is still held, the Studio skips building and uploading it.
20
+
3
21
  ## 0.144.2
4
22
 
5
23
  ### Patch Changes
@@ -122,6 +122,13 @@ export interface BuildInput {
122
122
  * load unless the project actually renders server components.
123
123
  */
124
124
  rsc?: boolean;
125
+ /**
126
+ * What the caller adds to the output after the build, by name, each with a
127
+ * value that changes when it does: part of the build's id
128
+ * (`buildInputId`), since the build never sees it. The Studio's carried
129
+ * live stylesheet is one.
130
+ */
131
+ extraInputs?: Record<string, string>;
125
132
  }
126
133
  export interface BuildOutput {
127
134
  /** ESM module for the Dynamic Worker module map, at key `app.js`. */
@@ -176,7 +183,18 @@ export interface BuildOutput {
176
183
  * builds coexist in one map without either knowing about the other.
177
184
  */
178
185
  rscCode?: string;
186
+ /**
187
+ * The build's name: a hash of its INPUTS (`buildInputId`), so the same
188
+ * inputs are the same build and the platform builds it once.
189
+ */
179
190
  hash: string;
191
+ /**
192
+ * A hash of what came out: every emitted byte, and the base and layer revs.
193
+ * The build's name until it was named by its inputs; kept to tell two
194
+ * builds of one name apart, should a builder ever emit different bytes from
195
+ * the same inputs.
196
+ */
197
+ outputHash: string;
180
198
  vendorRev: string;
181
199
  /** Wall-clock milliseconds per phase; the number the whole design lives on. */
182
200
  timings: {
@@ -30,7 +30,7 @@ export interface UserAppModule {
30
30
  /** What the studio uploads and the loader Worker stores per publish. */
31
31
  export interface PublishManifest {
32
32
  projectId: string;
33
- /** sha256 of serverCode + clientCode; used as the LOADER.get() cache id. */
33
+ /** The build's name, a hash of its inputs (`buildInputId`); the loader's isolate cache id. */
34
34
  hash: string;
35
35
  /** Vendor artifact revision the app was built against. */
36
36
  vendorRev: string;
@@ -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. */
@@ -25,6 +25,7 @@
25
25
  * is what keeps that true.
26
26
  */
27
27
  export * from "./build.js";
28
+ export { buildInputId } from "./inputId.js";
28
29
  export { aliasMap, type AliasMap } from "./tsconfigPaths.js";
29
30
  export { resolveInFiles } from "./paths.js";
30
31
  export { scanCandidates, usesTailwind } from "./tailwind.js";
@@ -0,0 +1,23 @@
1
+ import type { BuildInput } from "./build.js";
2
+ /**
3
+ * A BUILD'S NAME: a hash of what it is built from, not of what came out.
4
+ *
5
+ * So the same inputs are the same build, which the platform builds once and
6
+ * then only refers to (valbuild/home `docs/hosted-publishing.md`, step 3).
7
+ * Everything that can change a byte of the output is in it:
8
+ *
9
+ * - this builder's version;
10
+ * - the target, but not the shell revisions, which the loader picks when it
11
+ * serves and which no byte of the build depends on;
12
+ * - every file and the embedded source record (`projectSource`), each by
13
+ * sha256, content included -- the bundle holds it -- and the publish job
14
+ * baked into `val.server.ts` taken out (`withoutBakedJob`), or no two
15
+ * builds would ever be the same;
16
+ * - env, public files, assets, and which options are on;
17
+ * - `extraInputs`: what a caller adds to the output after the build, by
18
+ * name, each value digested here (the Studio's carried public files, and
19
+ * the live stylesheet it ships in place of an empty one).
20
+ *
21
+ * 32 hex characters, as the output hash it replaces.
22
+ */
23
+ export declare function buildInputId(input: BuildInput): Promise<string>;
@@ -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
  /**
@@ -63,6 +63,14 @@ export declare const VAL_SERVER_PATH = "src/val/val.server.ts";
63
63
  * would be a bug that only shows up on the second publish.
64
64
  */
65
65
  export declare function wiredValServer(options: WireOptions): string;
66
+ /**
67
+ * The source with no publish job baked in: what a build's id is taken over
68
+ * (`buildInputId`), so builds of the same inputs for different jobs are the
69
+ * same build. The job only says where a commitless build sits in the content
70
+ * service's chain, and a content version the platform hands the server names
71
+ * its own job, which wins (`ValOpsHttp`).
72
+ */
73
+ export declare function withoutBakedJob(text: string): string;
66
74
  /** The publish job a record is wired for: see `BUILT_FOR_JOB` in the template. */
67
75
  export declare function bakedJob(files: Record<string, string>): string | undefined;
68
76
  export declare function bakedGit(files: Record<string, string>): {
@@ -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, _regeneratorValues as e, _objectSpread2 as f, assetModule as g, _defineProperty 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;