zitejs 0.10.0-start.17 → 0.10.0-start.18

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.
@@ -736,7 +736,7 @@ function sourceProblems(sources, { internal = false } = {}) {
736
736
  }
737
737
  }
738
738
  if (node.type === "MemberExpression" && nameOf(node.property) === "inputValidator" && !node.computed) {
739
- report("input-validator", "warning", path, node, "inputValidator is deprecated, renamed validator; call .validator(…)");
739
+ report("input-validator", "error", path, node, "inputValidator was removed in TanStack Start 1.0; call .validator(…)");
740
740
  }
741
741
  if (node.type === "CallExpression" && nameOf(node.callee) === "createEndpoint") {
742
742
  report("classic-construct", "error", path, node, "createEndpoint is classic's; in a Start app, server code is a signedInFn/publicFn server function");
@@ -733,7 +733,7 @@ export function sourceProblems(sources, { internal = false } = {}) {
733
733
  }
734
734
  }
735
735
  if (node.type === "MemberExpression" && nameOf(node.property) === "inputValidator" && !node.computed) {
736
- report("input-validator", "warning", path, node, "inputValidator is deprecated, renamed validator; call .validator(…)");
736
+ report("input-validator", "error", path, node, "inputValidator was removed in TanStack Start 1.0; call .validator(…)");
737
737
  }
738
738
  if (node.type === "CallExpression" && nameOf(node.callee) === "createEndpoint") {
739
739
  report("classic-construct", "error", path, node, "createEndpoint is classic's; in a Start app, server code is a signedInFn/publicFn server function");
@@ -44,20 +44,19 @@ const SERVER_ONLY = "server-only: nothing in the browser calls it, and a server
44
44
  "Move the shared logic into a *.server.ts helper and call that.";
45
45
  export async function describeFunction(id, request) {
46
46
  const problems = [];
47
- const seen = [];
47
+ let own;
48
48
  probe = { reached: false };
49
- // Before running a chain, TanStack asks this set about every middleware in it.
50
- // Recording the questions gives the exact chain it would have run.
51
- const executedRequestMiddlewares = {
52
- has: (middleware) => {
53
- seen.push(middleware);
54
- return false;
49
+ // TanStack appends the function's own chain to the global middleware with
50
+ // `concat`. Recording what it appends gives the exact chain it would have run.
51
+ const functionMiddleware = Object.assign([describeProbe], {
52
+ concat: (chain) => {
53
+ own = chain;
54
+ return [describeProbe, ...chain];
55
55
  },
56
- };
56
+ });
57
57
  const startContext = {
58
58
  request,
59
- startOptions: { functionMiddleware: [describeProbe] },
60
- executedRequestMiddlewares,
59
+ startOptions: { functionMiddleware },
61
60
  contextAfterGlobalMiddlewares: {},
62
61
  handlerType: "serverFn",
63
62
  getRouter: () => {
@@ -79,11 +78,11 @@ export async function describeFunction(id, request) {
79
78
  }
80
79
  const state = probe;
81
80
  probe = null;
82
- // Fails closed: if TanStack stops asking, or stops running globals first, every
81
+ // Fails closed: if TanStack stops appending, or the probe never runs, every
83
82
  // function reports a problem and the build stops.
84
- if (!state.reached || seen[0] !== describeProbe)
83
+ if (!state.reached || own === undefined)
85
84
  problems.push("probe-not-first: chain could not be read");
86
- const chain = seen.filter((m) => m !== describeProbe);
85
+ const chain = flattenMiddlewares((own ?? [])).filter((m) => m !== describeProbe);
87
86
  if (!chain.some((m) => ziteMiddlewareKind(m)?.kind === "factory")) {
88
87
  problems.push("raw-server-fn: define it with signedInFn or publicFn from zitejs/start");
89
88
  }
@@ -1,5 +1,5 @@
1
1
  // For the generated server entry only. Apps never import this.
2
- import { requestHandler } from "@tanstack/react-start/server";
2
+ import { createServerEntry } from "@tanstack/react-start/server";
3
3
  import { createSsrRpc } from "@tanstack/react-start/ssr-rpc";
4
4
  import { runWithStartContext } from "@tanstack/start-storage-context";
5
5
  import { asZiteError, isZiteErrorCode, ZiteError, ZITE_ERROR_STATUS } from "./errors.js";
@@ -232,17 +232,19 @@ async function invokeFunction(request, options) {
232
232
  handlerType: "serverFn",
233
233
  };
234
234
  // In TanStack's request event too, which the function's own status setting reads.
235
- return requestHandler(async () => {
236
- try {
237
- const answer = (await runWithStartContext(startContext, () => createSsrRpc(id)({ data: input, context: {} })));
238
- if (answer.error !== undefined)
239
- throw answer.error;
240
- return Response.json({ ok: true, output: answer.result ?? null });
241
- }
242
- catch (error) {
243
- return Response.json({ ok: false, error: errorOf(error) }, { status: 500 });
244
- }
245
- })(request, undefined);
235
+ return createServerEntry({
236
+ fetch: async () => {
237
+ try {
238
+ const answer = (await runWithStartContext(startContext, () => createSsrRpc(id)({ data: input, context: {} })));
239
+ if ("error" in answer)
240
+ throw answer.error;
241
+ return Response.json({ ok: true, output: answer.result ?? null });
242
+ }
243
+ catch (error) {
244
+ return Response.json({ ok: false, error: errorOf(error) }, { status: 500 });
245
+ }
246
+ },
247
+ }).fetch(request, undefined);
246
248
  }
247
249
  // The host sends `{ op, input }`: `subscribe` with the platform's notification
248
250
  // URL and secret, or `unsubscribe` with what `subscribe` returned.
@@ -1 +1 @@
1
- export declare const ZITEJS_VERSION = "0.10.0-start.17";
1
+ export declare const ZITEJS_VERSION = "0.10.0-start.18";
@@ -1,2 +1,2 @@
1
1
  // Written by scripts/write-version.mjs from package.json.
2
- export const ZITEJS_VERSION = "0.10.0-start.17";
2
+ export const ZITEJS_VERSION = "0.10.0-start.18";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.10.0-start.17",
3
+ "version": "0.10.0-start.18",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -181,10 +181,10 @@
181
181
  "peerDependencies": {
182
182
  "@cloudflare/vite-plugin": ">=1",
183
183
  "@tanstack/react-query": ">=5.102.0",
184
- "@tanstack/react-router": "1.170.41",
184
+ "@tanstack/react-router": "1.170.45",
185
185
  "@tanstack/react-router-ssr-query": "1.167.3",
186
- "@tanstack/react-start": "1.168.60",
187
- "@tanstack/start-storage-context": "1.167.36",
186
+ "@tanstack/react-start": "1.169.3",
187
+ "@tanstack/start-storage-context": "1.167.40",
188
188
  "@vitejs/plugin-react": ">=5",
189
189
  "react": ">=18",
190
190
  "vite": ">=5"
@@ -221,17 +221,17 @@
221
221
  "devDependencies": {
222
222
  "@tanstack/query-core": "5.104.0",
223
223
  "@tanstack/react-query": "5.104.0",
224
- "@tanstack/react-router": "1.170.41",
224
+ "@tanstack/react-router": "1.170.45",
225
225
  "@tanstack/react-router-ssr-query": "1.167.3",
226
- "@tanstack/react-start": "1.168.60",
227
- "@tanstack/start-storage-context": "1.167.36",
226
+ "@tanstack/react-start": "1.169.3",
227
+ "@tanstack/start-storage-context": "1.167.40",
228
228
  "@types/node": "^25.9.1",
229
229
  "@types/react": "^19.0.0",
230
230
  "@vitejs/plugin-react": "^5.2.0",
231
231
  "react": "^19.0.0",
232
232
  "typescript": "^5.4.0",
233
- "vite": "^7.3.7",
234
- "vitest": "^3.0.0"
233
+ "vite": "^8.3.4",
234
+ "vitest": "^4.1.12"
235
235
  },
236
236
  "keywords": [
237
237
  "zite",