@tanstack-router-testing/react-start-testing 0.0.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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/index.d.mts +399 -0
- package/dist/index.mjs +337 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shim-DR16QaLL.mjs +486 -0
- package/dist/shim-DR16QaLL.mjs.map +1 -0
- package/dist/shim.d.mts +19 -0
- package/dist/shim.mjs +3 -0
- package/dist/vite.d.mts +40 -0
- package/dist/vite.mjs +61 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { getEnv, getMiddlewareEntry, getServerFnEntry, registerMiddleware, registerServerFn, runInEnv } from "@tanstack-router-testing/router-testing-core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { getStartContext } from "@tanstack/start-storage-context";
|
|
4
|
+
import { isRedirect, useRouter } from "@tanstack/react-router";
|
|
5
|
+
import { TSS_SERVER_FUNCTION, createNullProtoObject, execValidator, flattenMiddlewares, safeObjectMerge } from "@tanstack/start-client-core";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.16/node_modules/@tanstack/router-core/dist/esm/redirect.js
|
|
7
|
+
/**
|
|
8
|
+
* Create a redirect Response understood by TanStack Router.
|
|
9
|
+
*
|
|
10
|
+
* Use from route `loader`/`beforeLoad` or server functions to trigger a
|
|
11
|
+
* navigation. If `throw: true` is set, the redirect is thrown instead of
|
|
12
|
+
* returned. When an absolute `href` is supplied and `reloadDocument` is not
|
|
13
|
+
* set, a full-document navigation is inferred.
|
|
14
|
+
*
|
|
15
|
+
* @param opts Options for the redirect. Common fields:
|
|
16
|
+
* - `href`: absolute URL for external redirects; infers `reloadDocument`.
|
|
17
|
+
* - `statusCode`: HTTP status code to use (defaults to 307).
|
|
18
|
+
* - `headers`: additional headers to include on the Response.
|
|
19
|
+
* - Standard navigation options like `to`, `params`, `search`, `replace`,
|
|
20
|
+
* and `reloadDocument` for internal redirects.
|
|
21
|
+
* @returns A Response augmented with router navigation options.
|
|
22
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
|
|
23
|
+
*/
|
|
24
|
+
function redirect(opts) {
|
|
25
|
+
opts.statusCode = opts.statusCode || opts.code || 307;
|
|
26
|
+
if (!opts._builtLocation && !opts.reloadDocument && typeof opts.href === "string") try {
|
|
27
|
+
new URL(opts.href);
|
|
28
|
+
opts.reloadDocument = true;
|
|
29
|
+
} catch {}
|
|
30
|
+
const headers = new Headers(opts.headers);
|
|
31
|
+
if (opts.href && headers.get("Location") === null) headers.set("Location", opts.href);
|
|
32
|
+
const response = new Response(null, {
|
|
33
|
+
status: opts.statusCode,
|
|
34
|
+
headers
|
|
35
|
+
});
|
|
36
|
+
response.options = opts;
|
|
37
|
+
if (opts.throw) throw response;
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
/** Parse a serialized redirect object back into a redirect Response. */
|
|
41
|
+
/** Parse a serialized redirect object back into a redirect Response. */
|
|
42
|
+
function parseRedirect(obj) {
|
|
43
|
+
if (obj !== null && typeof obj === "object" && obj.isSerializedRedirect) return redirect(obj);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../../node_modules/.pnpm/cookie-es@3.1.1/node_modules/cookie-es/dist/index.mjs
|
|
47
|
+
function splitSetCookieString(cookiesString) {
|
|
48
|
+
if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));
|
|
49
|
+
if (typeof cookiesString !== "string") return [];
|
|
50
|
+
const cookiesStrings = [];
|
|
51
|
+
let pos = 0;
|
|
52
|
+
let start;
|
|
53
|
+
let ch;
|
|
54
|
+
let lastComma;
|
|
55
|
+
let nextStart;
|
|
56
|
+
let cookiesSeparatorFound;
|
|
57
|
+
const skipWhitespace = () => {
|
|
58
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
|
|
59
|
+
return pos < cookiesString.length;
|
|
60
|
+
};
|
|
61
|
+
const notSpecialChar = () => {
|
|
62
|
+
ch = cookiesString.charAt(pos);
|
|
63
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
64
|
+
};
|
|
65
|
+
while (pos < cookiesString.length) {
|
|
66
|
+
start = pos;
|
|
67
|
+
cookiesSeparatorFound = false;
|
|
68
|
+
while (skipWhitespace()) {
|
|
69
|
+
ch = cookiesString.charAt(pos);
|
|
70
|
+
if (ch === ",") {
|
|
71
|
+
lastComma = pos;
|
|
72
|
+
pos += 1;
|
|
73
|
+
skipWhitespace();
|
|
74
|
+
nextStart = pos;
|
|
75
|
+
while (pos < cookiesString.length && notSpecialChar()) pos += 1;
|
|
76
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
77
|
+
cookiesSeparatorFound = true;
|
|
78
|
+
pos = nextStart;
|
|
79
|
+
cookiesStrings.push(cookiesString.slice(start, lastComma));
|
|
80
|
+
start = pos;
|
|
81
|
+
} else pos = lastComma + 1;
|
|
82
|
+
} else pos += 1;
|
|
83
|
+
}
|
|
84
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
|
|
85
|
+
}
|
|
86
|
+
return cookiesStrings;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.16/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js
|
|
90
|
+
function toHeadersInstance(init) {
|
|
91
|
+
if (init instanceof Headers) return init;
|
|
92
|
+
else if (Array.isArray(init)) return new Headers(init);
|
|
93
|
+
else if (typeof init === "object") return new Headers(init);
|
|
94
|
+
else return null;
|
|
95
|
+
}
|
|
96
|
+
function mergeHeaders(...headers) {
|
|
97
|
+
return headers.reduce((acc, header) => {
|
|
98
|
+
const headersInstance = toHeadersInstance(header);
|
|
99
|
+
if (!headersInstance) return acc;
|
|
100
|
+
for (const [key, value] of headersInstance.entries()) if (key === "set-cookie") splitSetCookieString(value).forEach((cookie) => acc.append("set-cookie", cookie));
|
|
101
|
+
else acc.set(key, value);
|
|
102
|
+
return acc;
|
|
103
|
+
}, new Headers());
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/shim.ts
|
|
107
|
+
let serverFnId = 0;
|
|
108
|
+
const TSS_SERVER_FUNCTION_FACTORY = Symbol.for("TSS_SERVER_FUNCTION_FACTORY");
|
|
109
|
+
const currentEnv = () => {
|
|
110
|
+
const env = getEnv();
|
|
111
|
+
if (env) return env;
|
|
112
|
+
return globalThis.window === void 0 ? "server" : "client";
|
|
113
|
+
};
|
|
114
|
+
const setStartOptions = (options) => {
|
|
115
|
+
const global = globalThis;
|
|
116
|
+
global.__TSS_START_OPTIONS__ = options;
|
|
117
|
+
if (global.window) global.window.__TSS_START_OPTIONS__ = options;
|
|
118
|
+
};
|
|
119
|
+
const getStartOptions = () => {
|
|
120
|
+
const startContext = getStartContext({ throwIfNotFound: false });
|
|
121
|
+
if (startContext?.startOptions) return startContext.startOptions;
|
|
122
|
+
const global = globalThis;
|
|
123
|
+
return global.window?.__TSS_START_OPTIONS__ ?? global.__TSS_START_OPTIONS__;
|
|
124
|
+
};
|
|
125
|
+
const __setStartOptionsForTesting = (options) => {
|
|
126
|
+
setStartOptions(options);
|
|
127
|
+
};
|
|
128
|
+
const toPromise = async (value) => value;
|
|
129
|
+
const executeMiddleware = async (middlewares, env, opts) => {
|
|
130
|
+
let flattenedMiddlewares = flattenMiddlewares([...getStartOptions()?.functionMiddleware ?? [], ...middlewares]);
|
|
131
|
+
if (env === "server") {
|
|
132
|
+
const startContext = getStartContext({ throwIfNotFound: false });
|
|
133
|
+
if (startContext?.executedRequestMiddlewares) flattenedMiddlewares = flattenedMiddlewares.filter((middleware) => !startContext.executedRequestMiddlewares.has(middleware));
|
|
134
|
+
}
|
|
135
|
+
const callNextMiddleware = async (ctx) => {
|
|
136
|
+
const nextMiddleware = flattenedMiddlewares.shift();
|
|
137
|
+
if (!nextMiddleware) return ctx;
|
|
138
|
+
try {
|
|
139
|
+
const middlewareOptions = nextMiddleware.options;
|
|
140
|
+
if (env === "server" && middlewareOptions.type === "request") {
|
|
141
|
+
const requestMiddleware = middlewareOptions.server;
|
|
142
|
+
if (!requestMiddleware) return await callNextMiddleware(ctx);
|
|
143
|
+
const request = getRequestFromContext(ctx);
|
|
144
|
+
const pathname = getPathnameFromRequest(request);
|
|
145
|
+
getStartContext({ throwIfNotFound: false })?.executedRequestMiddlewares.add(nextMiddleware);
|
|
146
|
+
const requestNext = async (userCtx = {}) => {
|
|
147
|
+
const result = await callNextMiddleware({
|
|
148
|
+
...ctx,
|
|
149
|
+
request,
|
|
150
|
+
pathname,
|
|
151
|
+
context: safeObjectMerge(toOptionalRecord(ctx.context), toOptionalRecord(userCtx.context))
|
|
152
|
+
});
|
|
153
|
+
if (result.error) throw result.error;
|
|
154
|
+
return {
|
|
155
|
+
request,
|
|
156
|
+
pathname,
|
|
157
|
+
context: result.context,
|
|
158
|
+
response: result.result instanceof Response ? result.result : new Response(null)
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const result = await requestMiddleware({
|
|
162
|
+
request,
|
|
163
|
+
pathname,
|
|
164
|
+
context: ctx.context,
|
|
165
|
+
serverFnMeta: ctx.serverFnMeta,
|
|
166
|
+
next: requestNext
|
|
167
|
+
});
|
|
168
|
+
if (result instanceof Response) return {
|
|
169
|
+
...ctx,
|
|
170
|
+
result
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
...ctx,
|
|
174
|
+
request,
|
|
175
|
+
pathname,
|
|
176
|
+
context: safeObjectMerge(toOptionalRecord(ctx.context), toOptionalRecord(result?.context)),
|
|
177
|
+
result: result?.response ?? ctx.result
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if ("inputValidator" in nextMiddleware.options && nextMiddleware.options.inputValidator && env === "server") ctx.data = await execValidator(nextMiddleware.options.inputValidator, ctx.data);
|
|
181
|
+
let middlewareFn;
|
|
182
|
+
if (env === "client" && "client" in nextMiddleware.options) middlewareFn = nextMiddleware.options.client;
|
|
183
|
+
else if (env === "server" && "server" in nextMiddleware.options) middlewareFn = nextMiddleware.options.server;
|
|
184
|
+
if (!middlewareFn) return await callNextMiddleware(ctx);
|
|
185
|
+
const userNext = async (userCtx = {}) => {
|
|
186
|
+
const callCtx = ctx;
|
|
187
|
+
const result = await callNextMiddleware({
|
|
188
|
+
...ctx,
|
|
189
|
+
...userCtx,
|
|
190
|
+
context: safeObjectMerge(ctx.context, userCtx.context),
|
|
191
|
+
sendContext: safeObjectMerge(ctx.sendContext, userCtx.sendContext),
|
|
192
|
+
headers: mergeHeaders(ctx.headers, userCtx.headers),
|
|
193
|
+
_callSiteFetch: callCtx._callSiteFetch,
|
|
194
|
+
fetch: callCtx._callSiteFetch ?? userCtx.fetch ?? ctx.fetch,
|
|
195
|
+
result: userCtx.result !== void 0 ? userCtx.result : userCtx instanceof Response ? userCtx : ctx.result,
|
|
196
|
+
error: userCtx.error ?? ctx.error
|
|
197
|
+
});
|
|
198
|
+
if (result.error) throw result.error;
|
|
199
|
+
return result;
|
|
200
|
+
};
|
|
201
|
+
const result = await middlewareFn({
|
|
202
|
+
...ctx,
|
|
203
|
+
next: userNext
|
|
204
|
+
});
|
|
205
|
+
if (isRedirect(result)) return {
|
|
206
|
+
...ctx,
|
|
207
|
+
error: result
|
|
208
|
+
};
|
|
209
|
+
if (result instanceof Response) return {
|
|
210
|
+
...ctx,
|
|
211
|
+
result
|
|
212
|
+
};
|
|
213
|
+
if (!result) throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");
|
|
214
|
+
return result;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
return {
|
|
217
|
+
...ctx,
|
|
218
|
+
error
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return callNextMiddleware({
|
|
223
|
+
...opts,
|
|
224
|
+
headers: opts.headers ?? {},
|
|
225
|
+
sendContext: opts.sendContext ?? {},
|
|
226
|
+
context: opts.context ?? createNullProtoObject(),
|
|
227
|
+
_callSiteFetch: opts.fetch
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const getRequestFromContext = (ctx) => {
|
|
231
|
+
const existing = ctx.request;
|
|
232
|
+
if (existing) return existing;
|
|
233
|
+
return getStartContext({ throwIfNotFound: false })?.request ?? new Request("http://tanstack-router-testing.test/");
|
|
234
|
+
};
|
|
235
|
+
const getPathnameFromRequest = (request) => new URL(request.url).pathname;
|
|
236
|
+
const toOptionalRecord = (value) => {
|
|
237
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
238
|
+
return value;
|
|
239
|
+
};
|
|
240
|
+
const createServerFnMiddleware = (options, getFetcher) => ({
|
|
241
|
+
"~types": void 0,
|
|
242
|
+
options: {
|
|
243
|
+
inputValidator: options.inputValidator,
|
|
244
|
+
client: async ({ next, sendContext, fetch, ...ctx }) => {
|
|
245
|
+
const payload = {
|
|
246
|
+
...ctx,
|
|
247
|
+
context: sendContext,
|
|
248
|
+
fetch
|
|
249
|
+
};
|
|
250
|
+
return next(await options.extractedFn?.(payload));
|
|
251
|
+
},
|
|
252
|
+
server: async ({ next, ...ctx }) => {
|
|
253
|
+
const entry = getServerFnEntry(getFetcher());
|
|
254
|
+
const result = await (entry?.mock ?? entry?.original ?? options.serverFn)?.(ctx);
|
|
255
|
+
return next({
|
|
256
|
+
...ctx,
|
|
257
|
+
result
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
const createServerMeta = () => {
|
|
263
|
+
serverFnId += 1;
|
|
264
|
+
const id = `tanstack-router-testing:${serverFnId}`;
|
|
265
|
+
return {
|
|
266
|
+
id,
|
|
267
|
+
name: id,
|
|
268
|
+
filename: "tanstack-router-testing://server-fn"
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
const normalizeDataOptions = (opts) => opts ?? {};
|
|
272
|
+
const createServerFn$1 = ((options, __opts) => {
|
|
273
|
+
const resolvedOptions = { ...__opts ?? options };
|
|
274
|
+
resolvedOptions.method ??= "GET";
|
|
275
|
+
const makeBuilder = (nextOptions) => {
|
|
276
|
+
const builder = ((newOptions) => createServerFn$1(void 0, {
|
|
277
|
+
...nextOptions,
|
|
278
|
+
...newOptions
|
|
279
|
+
}));
|
|
280
|
+
Object.assign(builder, {
|
|
281
|
+
"~types": void 0,
|
|
282
|
+
[TSS_SERVER_FUNCTION_FACTORY]: true,
|
|
283
|
+
options: nextOptions,
|
|
284
|
+
middleware: (middlewares) => {
|
|
285
|
+
const newMiddleware = [...nextOptions.middleware || []];
|
|
286
|
+
for (const middleware of middlewares) if (middleware && TSS_SERVER_FUNCTION_FACTORY in middleware && middleware.options.middleware) newMiddleware.push(...middleware.options.middleware);
|
|
287
|
+
else newMiddleware.push(middleware);
|
|
288
|
+
const res = createServerFn$1(void 0, {
|
|
289
|
+
...nextOptions,
|
|
290
|
+
middleware: newMiddleware
|
|
291
|
+
});
|
|
292
|
+
res[TSS_SERVER_FUNCTION_FACTORY] = true;
|
|
293
|
+
return res;
|
|
294
|
+
},
|
|
295
|
+
inputValidator: (inputValidator) => createServerFn$1(void 0, {
|
|
296
|
+
...nextOptions,
|
|
297
|
+
inputValidator
|
|
298
|
+
}),
|
|
299
|
+
handler: (...args) => {
|
|
300
|
+
const extractedFromTransform = args.length > 1 ? args[0] : void 0;
|
|
301
|
+
const serverFn = args.length > 1 ? args[1] : args[0];
|
|
302
|
+
const serverFnMeta = createServerMeta();
|
|
303
|
+
const clientMeta = { id: serverFnMeta.id };
|
|
304
|
+
let fetcher;
|
|
305
|
+
let resolvedMiddleware = [];
|
|
306
|
+
const executeServer = async (opts) => {
|
|
307
|
+
const callOpts = normalizeDataOptions(opts);
|
|
308
|
+
const startContext = getStartContext({ throwIfNotFound: false });
|
|
309
|
+
const request = callOpts.request ?? startContext?.request ?? new Request("http://tanstack-router-testing.test/_serverFn");
|
|
310
|
+
const result = await runInEnv("server", () => executeMiddleware(resolvedMiddleware, "server", {
|
|
311
|
+
...callOpts,
|
|
312
|
+
data: callOpts.data,
|
|
313
|
+
method: nextOptions.method,
|
|
314
|
+
serverFnMeta,
|
|
315
|
+
signal: callOpts.signal ?? new AbortController().signal,
|
|
316
|
+
context: safeObjectMerge(callOpts.context ?? createNullProtoObject(), startContext?.contextAfterGlobalMiddlewares),
|
|
317
|
+
request,
|
|
318
|
+
pathname: getPathnameFromRequest(request)
|
|
319
|
+
}));
|
|
320
|
+
return {
|
|
321
|
+
result: result.result,
|
|
322
|
+
error: result.error,
|
|
323
|
+
context: result.sendContext
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
const extractedFn = Object.assign(async (opts) => {
|
|
327
|
+
if (extractedFromTransform) return await extractedFromTransform(opts);
|
|
328
|
+
return await executeServer(opts);
|
|
329
|
+
}, {
|
|
330
|
+
url: `/_serverFn/${serverFnMeta.id}`,
|
|
331
|
+
serverFnMeta
|
|
332
|
+
});
|
|
333
|
+
const handlerOptions = {
|
|
334
|
+
...nextOptions,
|
|
335
|
+
extractedFn,
|
|
336
|
+
serverFn
|
|
337
|
+
};
|
|
338
|
+
resolvedMiddleware = [...handlerOptions.middleware ?? [], createServerFnMiddleware(handlerOptions, () => fetcher)];
|
|
339
|
+
fetcher = Object.assign(async (opts) => {
|
|
340
|
+
const callOpts = normalizeDataOptions(opts);
|
|
341
|
+
if (currentEnv() === "server") {
|
|
342
|
+
const result = await executeServer(callOpts);
|
|
343
|
+
const redirect = parseRedirect(result.error);
|
|
344
|
+
if (redirect) throw redirect;
|
|
345
|
+
if (result.error) throw result.error;
|
|
346
|
+
return result.result;
|
|
347
|
+
}
|
|
348
|
+
const result = await runInEnv("client", () => executeMiddleware(resolvedMiddleware, "client", {
|
|
349
|
+
...extractedFn,
|
|
350
|
+
...handlerOptions,
|
|
351
|
+
data: callOpts.data,
|
|
352
|
+
headers: callOpts.headers,
|
|
353
|
+
signal: callOpts.signal ?? new AbortController().signal,
|
|
354
|
+
fetch: callOpts.fetch ?? getStartOptions()?.serverFns?.fetch,
|
|
355
|
+
context: createNullProtoObject(),
|
|
356
|
+
serverFnMeta: clientMeta
|
|
357
|
+
}));
|
|
358
|
+
const redirect = parseRedirect(result.error);
|
|
359
|
+
if (redirect) throw redirect;
|
|
360
|
+
if (result.error) throw result.error;
|
|
361
|
+
return result.result;
|
|
362
|
+
}, {
|
|
363
|
+
...extractedFn,
|
|
364
|
+
[TSS_SERVER_FUNCTION]: true,
|
|
365
|
+
method: nextOptions.method,
|
|
366
|
+
__executeServer: executeServer
|
|
367
|
+
});
|
|
368
|
+
registerServerFn(fetcher, serverFn);
|
|
369
|
+
return fetcher;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return builder;
|
|
373
|
+
};
|
|
374
|
+
return makeBuilder(resolvedOptions);
|
|
375
|
+
});
|
|
376
|
+
const createPhaseWrapper = (mw, phase) => async (ctx) => {
|
|
377
|
+
const entry = getMiddlewareEntry(mw);
|
|
378
|
+
const impl = phase === "client" ? entry?.mockClient ?? entry?.originalClient : entry?.mockServer ?? entry?.originalServer;
|
|
379
|
+
if (!impl) return ctx.next?.();
|
|
380
|
+
return impl(ctx);
|
|
381
|
+
};
|
|
382
|
+
const createMiddleware$1 = ((options, __opts) => {
|
|
383
|
+
const makeBuilder = (resolvedOptions) => {
|
|
384
|
+
const mw = {};
|
|
385
|
+
const originalClient = resolvedOptions.client;
|
|
386
|
+
const originalServer = resolvedOptions.server;
|
|
387
|
+
const optionsWithWrappedPhases = {
|
|
388
|
+
...resolvedOptions,
|
|
389
|
+
...originalClient ? { client: createPhaseWrapper(mw, "client") } : {},
|
|
390
|
+
...originalServer ? { server: createPhaseWrapper(mw, "server") } : {}
|
|
391
|
+
};
|
|
392
|
+
Object.assign(mw, {
|
|
393
|
+
"~types": void 0,
|
|
394
|
+
options: optionsWithWrappedPhases,
|
|
395
|
+
middleware: (middlewares) => createMiddleware$1({}, {
|
|
396
|
+
...resolvedOptions,
|
|
397
|
+
middleware: middlewares
|
|
398
|
+
}),
|
|
399
|
+
inputValidator: (inputValidator) => createMiddleware$1({}, {
|
|
400
|
+
...resolvedOptions,
|
|
401
|
+
inputValidator
|
|
402
|
+
}),
|
|
403
|
+
client: (client) => createMiddleware$1({}, {
|
|
404
|
+
...resolvedOptions,
|
|
405
|
+
client
|
|
406
|
+
}),
|
|
407
|
+
server: (server) => createMiddleware$1({}, {
|
|
408
|
+
...resolvedOptions,
|
|
409
|
+
server
|
|
410
|
+
})
|
|
411
|
+
});
|
|
412
|
+
registerMiddleware(mw, {
|
|
413
|
+
...originalClient ? { client: originalClient } : {},
|
|
414
|
+
...originalServer ? { server: originalServer } : {}
|
|
415
|
+
});
|
|
416
|
+
return mw;
|
|
417
|
+
};
|
|
418
|
+
return makeBuilder({
|
|
419
|
+
type: "request",
|
|
420
|
+
...__opts ?? options
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
const createIsomorphicFn = () => {
|
|
424
|
+
const makeCallable = (serverImpl, clientImpl) => {
|
|
425
|
+
const fn = ((...args) => {
|
|
426
|
+
if (currentEnv() === "server") return serverImpl?.(...args);
|
|
427
|
+
return clientImpl?.(...args);
|
|
428
|
+
});
|
|
429
|
+
return fn;
|
|
430
|
+
};
|
|
431
|
+
const base = (() => {});
|
|
432
|
+
return Object.assign(base, {
|
|
433
|
+
server: (serverImpl) => {
|
|
434
|
+
const serverOnly = makeCallable(serverImpl);
|
|
435
|
+
return Object.assign(serverOnly, { client: (clientImpl) => makeCallable(serverImpl, clientImpl) });
|
|
436
|
+
},
|
|
437
|
+
client: (clientImpl) => {
|
|
438
|
+
const clientOnly = makeCallable(void 0, clientImpl);
|
|
439
|
+
return Object.assign(clientOnly, { server: (serverImpl) => makeCallable(serverImpl, clientImpl) });
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
const createServerOnlyFn = (fn) => ((...args) => {
|
|
444
|
+
if (currentEnv() === "client") throw new Error("[tanstack-router-testing] createServerOnlyFn: attempted to call a server-only function in the client test environment.");
|
|
445
|
+
return fn(...args);
|
|
446
|
+
});
|
|
447
|
+
const createClientOnlyFn = (fn) => ((...args) => {
|
|
448
|
+
if (currentEnv() === "server") throw new Error("[tanstack-router-testing] createClientOnlyFn: attempted to call a client-only function in the server test environment.");
|
|
449
|
+
return fn(...args);
|
|
450
|
+
});
|
|
451
|
+
const createStart$1 = ((getOptions) => {
|
|
452
|
+
const getAndStoreOptions = async () => {
|
|
453
|
+
const options = await toPromise(getOptions());
|
|
454
|
+
setStartOptions(options);
|
|
455
|
+
return options;
|
|
456
|
+
};
|
|
457
|
+
const initialOptions = getOptions();
|
|
458
|
+
if (initialOptions instanceof Promise) initialOptions.then((options) => {
|
|
459
|
+
setStartOptions(options);
|
|
460
|
+
});
|
|
461
|
+
else setStartOptions(initialOptions);
|
|
462
|
+
return {
|
|
463
|
+
getOptions: getAndStoreOptions,
|
|
464
|
+
createMiddleware: createMiddleware$1
|
|
465
|
+
};
|
|
466
|
+
});
|
|
467
|
+
function useServerFn(serverFn) {
|
|
468
|
+
const router = useRouter();
|
|
469
|
+
return React.useCallback(async (...args) => {
|
|
470
|
+
try {
|
|
471
|
+
const res = await serverFn(...args);
|
|
472
|
+
if (isRedirect(res)) throw res;
|
|
473
|
+
return res;
|
|
474
|
+
} catch (error) {
|
|
475
|
+
if (isRedirect(error)) {
|
|
476
|
+
error.options._fromLocation = router.stores.location.get();
|
|
477
|
+
return router.navigate(router.resolveRedirect(error).options);
|
|
478
|
+
}
|
|
479
|
+
throw error;
|
|
480
|
+
}
|
|
481
|
+
}, [router, serverFn]);
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
export { createServerFn$1 as a, useServerFn as c, createMiddleware$1 as i, createClientOnlyFn as n, createServerOnlyFn as o, createIsomorphicFn as r, createStart$1 as s, __setStartOptionsForTesting as t };
|
|
485
|
+
|
|
486
|
+
//# sourceMappingURL=shim-DR16QaLL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-DR16QaLL.mjs","names":["createServerFn","createMiddleware","createStart"],"sources":["../../../node_modules/.pnpm/@tanstack+router-core@1.168.16/node_modules/@tanstack/router-core/dist/esm/redirect.js","../../../node_modules/.pnpm/cookie-es@3.1.1/node_modules/cookie-es/dist/index.mjs","../../../node_modules/.pnpm/@tanstack+router-core@1.168.16/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js","../src/shim.ts"],"sourcesContent":["//#region src/redirect.ts\n/**\n* Create a redirect Response understood by TanStack Router.\n*\n* Use from route `loader`/`beforeLoad` or server functions to trigger a\n* navigation. If `throw: true` is set, the redirect is thrown instead of\n* returned. When an absolute `href` is supplied and `reloadDocument` is not\n* set, a full-document navigation is inferred.\n*\n* @param opts Options for the redirect. Common fields:\n* - `href`: absolute URL for external redirects; infers `reloadDocument`.\n* - `statusCode`: HTTP status code to use (defaults to 307).\n* - `headers`: additional headers to include on the Response.\n* - Standard navigation options like `to`, `params`, `search`, `replace`,\n* and `reloadDocument` for internal redirects.\n* @returns A Response augmented with router navigation options.\n* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction\n*/\nfunction redirect(opts) {\n\topts.statusCode = opts.statusCode || opts.code || 307;\n\tif (!opts._builtLocation && !opts.reloadDocument && typeof opts.href === \"string\") try {\n\t\tnew URL(opts.href);\n\t\topts.reloadDocument = true;\n\t} catch {}\n\tconst headers = new Headers(opts.headers);\n\tif (opts.href && headers.get(\"Location\") === null) headers.set(\"Location\", opts.href);\n\tconst response = new Response(null, {\n\t\tstatus: opts.statusCode,\n\t\theaders\n\t});\n\tresponse.options = opts;\n\tif (opts.throw) throw response;\n\treturn response;\n}\n/** Check whether a value is a TanStack Router redirect Response. */\n/** Check whether a value is a TanStack Router redirect Response. */\nfunction isRedirect(obj) {\n\treturn obj instanceof Response && !!obj.options;\n}\n/** True if value is a redirect with a resolved `href` location. */\n/** True if value is a redirect with a resolved `href` location. */\nfunction isResolvedRedirect(obj) {\n\treturn isRedirect(obj) && !!obj.options.href;\n}\n/** Parse a serialized redirect object back into a redirect Response. */\n/** Parse a serialized redirect object back into a redirect Response. */\nfunction parseRedirect(obj) {\n\tif (obj !== null && typeof obj === \"object\" && obj.isSerializedRedirect) return redirect(obj);\n}\n//#endregion\nexport { isRedirect, isResolvedRedirect, parseRedirect, redirect };\n\n//# sourceMappingURL=redirect.js.map","const COOKIE_MAX_AGE_LIMIT = 3456e4;\nfunction endIndex(str, min, len) {\n\tconst index = str.indexOf(\";\", min);\n\treturn index === -1 ? len : index;\n}\nfunction eqIndex(str, min, max) {\n\tconst index = str.indexOf(\"=\", min);\n\treturn index < max ? index : -1;\n}\nfunction valueSlice(str, min, max) {\n\tif (min === max) return \"\";\n\tlet start = min;\n\tlet end = max;\n\tdo {\n\t\tconst code = str.charCodeAt(start);\n\t\tif (code !== 32 && code !== 9) break;\n\t} while (++start < end);\n\twhile (end > start) {\n\t\tconst code = str.charCodeAt(end - 1);\n\t\tif (code !== 32 && code !== 9) break;\n\t\tend--;\n\t}\n\treturn str.slice(start, end);\n}\nconst NullObject = /* @__PURE__ */ (() => {\n\tconst C = function() {};\n\tC.prototype = Object.create(null);\n\treturn C;\n})();\nfunction parse(str, options) {\n\tconst obj = new NullObject();\n\tconst len = str.length;\n\tif (len < 2) return obj;\n\tconst dec = options?.decode || decode;\n\tconst allowMultiple = options?.allowMultiple || false;\n\tlet index = 0;\n\tdo {\n\t\tconst eqIdx = eqIndex(str, index, len);\n\t\tif (eqIdx === -1) break;\n\t\tconst endIdx = endIndex(str, index, len);\n\t\tif (eqIdx > endIdx) {\n\t\t\tindex = str.lastIndexOf(\";\", eqIdx - 1) + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst key = valueSlice(str, index, eqIdx);\n\t\tif (options?.filter && !options.filter(key)) {\n\t\t\tindex = endIdx + 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst val = dec(valueSlice(str, eqIdx + 1, endIdx));\n\t\tif (allowMultiple) {\n\t\t\tconst existing = obj[key];\n\t\t\tif (existing === void 0) obj[key] = val;\n\t\t\telse if (Array.isArray(existing)) existing.push(val);\n\t\t\telse obj[key] = [existing, val];\n\t\t} else if (obj[key] === void 0) obj[key] = val;\n\t\tindex = endIdx + 1;\n\t} while (index < len);\n\treturn obj;\n}\nfunction decode(str) {\n\tif (!str.includes(\"%\")) return str;\n\ttry {\n\t\treturn decodeURIComponent(str);\n\t} catch {\n\t\treturn str;\n\t}\n}\nconst cookieNameRegExp = /^[\\u0021-\\u003A\\u003C\\u003E-\\u007E]+$/;\nconst cookieValueRegExp = /^[\\u0021-\\u003A\\u003C-\\u007E]*$/;\nconst domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;\nconst pathValueRegExp = /^[\\u0020-\\u003A\\u003C-\\u007E]*$/;\nconst __toString = Object.prototype.toString;\nfunction stringifyCookie(cookie, options) {\n\tconst enc = options?.encode || encodeURIComponent;\n\tconst keys = Object.keys(cookie);\n\tlet str = \"\";\n\tfor (const [i, name] of keys.entries()) {\n\t\tconst val = cookie[name];\n\t\tif (val === void 0) continue;\n\t\tif (!cookieNameRegExp.test(name)) throw new TypeError(`cookie name is invalid: ${name}`);\n\t\tconst value = enc(val);\n\t\tif (!cookieValueRegExp.test(value)) throw new TypeError(`cookie val is invalid: ${val}`);\n\t\tif (i > 0) str += \"; \";\n\t\tstr += name + \"=\" + value;\n\t}\n\treturn str;\n}\nfunction serialize(_a0, _a1, _a2) {\n\tconst isObj = typeof _a0 === \"object\" && _a0 !== null;\n\tconst options = isObj ? _a1 : _a2;\n\tconst stringify = options?.stringify || JSON.stringify;\n\tconst cookie = isObj ? _a0 : {\n\t\t..._a2,\n\t\tname: _a0,\n\t\tvalue: _a1 == void 0 ? \"\" : typeof _a1 === \"string\" ? _a1 : stringify(_a1)\n\t};\n\tconst enc = options?.encode || encodeURIComponent;\n\tif (!cookieNameRegExp.test(cookie.name)) throw new TypeError(`argument name is invalid: ${cookie.name}`);\n\tconst value = cookie.value ? enc(cookie.value) : \"\";\n\tif (!cookieValueRegExp.test(value)) throw new TypeError(`argument val is invalid: ${cookie.value}`);\n\tif (!cookie.secure) {\n\t\tif (cookie.partitioned) throw new TypeError(`Partitioned cookies must have the Secure attribute`);\n\t\tif (cookie.sameSite && String(cookie.sameSite).toLowerCase() === \"none\") throw new TypeError(`SameSite=None cookies must have the Secure attribute`);\n\t\tif (cookie.name.length > 9 && cookie.name.charCodeAt(0) === 95 && cookie.name.charCodeAt(1) === 95) {\n\t\t\tconst nameLower = cookie.name.toLowerCase();\n\t\t\tif (nameLower.startsWith(\"__secure-\") || nameLower.startsWith(\"__host-\")) throw new TypeError(`${cookie.name} cookies must have the Secure attribute`);\n\t\t}\n\t}\n\tif (cookie.name.length > 7 && cookie.name.charCodeAt(0) === 95 && cookie.name.charCodeAt(1) === 95 && cookie.name.toLowerCase().startsWith(\"__host-\")) {\n\t\tif (cookie.path !== \"/\") throw new TypeError(`__Host- cookies must have Path=/`);\n\t\tif (cookie.domain) throw new TypeError(`__Host- cookies must not have a Domain attribute`);\n\t}\n\tlet str = cookie.name + \"=\" + value;\n\tif (cookie.maxAge !== void 0) {\n\t\tif (!Number.isInteger(cookie.maxAge)) throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);\n\t\tstr += \"; Max-Age=\" + Math.max(0, Math.min(cookie.maxAge, COOKIE_MAX_AGE_LIMIT));\n\t}\n\tif (cookie.domain) {\n\t\tif (!domainValueRegExp.test(cookie.domain)) throw new TypeError(`option domain is invalid: ${cookie.domain}`);\n\t\tstr += \"; Domain=\" + cookie.domain;\n\t}\n\tif (cookie.path) {\n\t\tif (!pathValueRegExp.test(cookie.path)) throw new TypeError(`option path is invalid: ${cookie.path}`);\n\t\tstr += \"; Path=\" + cookie.path;\n\t}\n\tif (cookie.expires) {\n\t\tif (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) throw new TypeError(`option expires is invalid: ${cookie.expires}`);\n\t\tstr += \"; Expires=\" + cookie.expires.toUTCString();\n\t}\n\tif (cookie.httpOnly) str += \"; HttpOnly\";\n\tif (cookie.secure) str += \"; Secure\";\n\tif (cookie.partitioned) str += \"; Partitioned\";\n\tif (cookie.priority) switch (typeof cookie.priority === \"string\" ? cookie.priority.toLowerCase() : void 0) {\n\t\tcase \"low\":\n\t\t\tstr += \"; Priority=Low\";\n\t\t\tbreak;\n\t\tcase \"medium\":\n\t\t\tstr += \"; Priority=Medium\";\n\t\t\tbreak;\n\t\tcase \"high\":\n\t\t\tstr += \"; Priority=High\";\n\t\t\tbreak;\n\t\tdefault: throw new TypeError(`option priority is invalid: ${cookie.priority}`);\n\t}\n\tif (cookie.sameSite) switch (typeof cookie.sameSite === \"string\" ? cookie.sameSite.toLowerCase() : cookie.sameSite) {\n\t\tcase true:\n\t\tcase \"strict\":\n\t\t\tstr += \"; SameSite=Strict\";\n\t\t\tbreak;\n\t\tcase \"lax\":\n\t\t\tstr += \"; SameSite=Lax\";\n\t\t\tbreak;\n\t\tcase \"none\":\n\t\t\tstr += \"; SameSite=None\";\n\t\t\tbreak;\n\t\tdefault: throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);\n\t}\n\treturn str;\n}\nfunction isDate(val) {\n\treturn __toString.call(val) === \"[object Date]\";\n}\nconst maxAgeRegExp = /^-?\\d+$/;\nconst _nullProto = /* @__PURE__ */ Object.getPrototypeOf({});\nfunction parseSetCookie(str, options) {\n\tconst len = str.length;\n\tlet _endIdx = len;\n\tlet eqIdx = -1;\n\tfor (let i = 0; i < len; i++) {\n\t\tconst c = str.charCodeAt(i);\n\t\tif (c === 59) {\n\t\t\t_endIdx = i;\n\t\t\tbreak;\n\t\t}\n\t\tif (c === 61 && eqIdx === -1) eqIdx = i;\n\t}\n\tif (eqIdx >= _endIdx) eqIdx = -1;\n\tconst name = eqIdx === -1 ? \"\" : _trim(str, 0, eqIdx);\n\tif (name && name in _nullProto) return void 0;\n\tlet value = eqIdx === -1 ? _trim(str, 0, _endIdx) : _trim(str, eqIdx + 1, _endIdx);\n\tif (!name && !value) return void 0;\n\tif (name.length + value.length > 4096) return void 0;\n\tif (options?.decode !== false) value = _decode(value, options?.decode);\n\tconst setCookie = {\n\t\tname,\n\t\tvalue\n\t};\n\tlet index = _endIdx + 1;\n\twhile (index < len) {\n\t\tlet endIdx = len;\n\t\tlet attrEqIdx = -1;\n\t\tfor (let i = index; i < len; i++) {\n\t\t\tconst c = str.charCodeAt(i);\n\t\t\tif (c === 59) {\n\t\t\t\tendIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (c === 61 && attrEqIdx === -1) attrEqIdx = i;\n\t\t}\n\t\tif (attrEqIdx >= endIdx) attrEqIdx = -1;\n\t\tconst attr = attrEqIdx === -1 ? _trim(str, index, endIdx) : _trim(str, index, attrEqIdx);\n\t\tconst val = attrEqIdx === -1 ? void 0 : _trim(str, attrEqIdx + 1, endIdx);\n\t\tif (val === void 0 || val.length <= 1024) switch (attr.toLowerCase()) {\n\t\t\tcase \"httponly\":\n\t\t\t\tsetCookie.httpOnly = true;\n\t\t\t\tbreak;\n\t\t\tcase \"secure\":\n\t\t\t\tsetCookie.secure = true;\n\t\t\t\tbreak;\n\t\t\tcase \"partitioned\":\n\t\t\t\tsetCookie.partitioned = true;\n\t\t\t\tbreak;\n\t\t\tcase \"domain\":\n\t\t\t\tif (val) setCookie.domain = (val.charCodeAt(0) === 46 ? val.slice(1) : val).toLowerCase();\n\t\t\t\tbreak;\n\t\t\tcase \"path\":\n\t\t\t\tsetCookie.path = val;\n\t\t\t\tbreak;\n\t\t\tcase \"max-age\":\n\t\t\t\tif (val && maxAgeRegExp.test(val)) setCookie.maxAge = Math.min(Number(val), COOKIE_MAX_AGE_LIMIT);\n\t\t\t\tbreak;\n\t\t\tcase \"expires\": {\n\t\t\t\tif (!val) break;\n\t\t\t\tconst date = new Date(val);\n\t\t\t\tif (Number.isFinite(date.valueOf())) {\n\t\t\t\t\tconst maxDate = new Date(Date.now() + COOKIE_MAX_AGE_LIMIT * 1e3);\n\t\t\t\t\tsetCookie.expires = date > maxDate ? maxDate : date;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"priority\": {\n\t\t\t\tif (!val) break;\n\t\t\t\tconst priority = val.toLowerCase();\n\t\t\t\tif (priority === \"low\" || priority === \"medium\" || priority === \"high\") setCookie.priority = priority;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"samesite\": {\n\t\t\t\tif (!val) break;\n\t\t\t\tconst sameSite = val.toLowerCase();\n\t\t\t\tif (sameSite === \"lax\" || sameSite === \"strict\" || sameSite === \"none\") setCookie.sameSite = sameSite;\n\t\t\t\telse setCookie.sameSite = \"lax\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst attrLower = attr.toLowerCase();\n\t\t\t\tif (attrLower && !(attrLower in _nullProto)) setCookie[attrLower] = val;\n\t\t\t}\n\t\t}\n\t\tindex = endIdx + 1;\n\t}\n\treturn setCookie;\n}\nfunction _trim(str, start, end) {\n\tif (start === end) return \"\";\n\tlet s = start;\n\tlet e = end;\n\twhile (s < e && (str.charCodeAt(s) === 32 || str.charCodeAt(s) === 9)) s++;\n\twhile (e > s && (str.charCodeAt(e - 1) === 32 || str.charCodeAt(e - 1) === 9)) e--;\n\treturn str.slice(s, e);\n}\nfunction _decode(value, decode) {\n\tif (!decode && !value.includes(\"%\")) return value;\n\ttry {\n\t\treturn (decode || decodeURIComponent)(value);\n\t} catch {\n\t\treturn value;\n\t}\n}\nfunction splitSetCookieString(cookiesString) {\n\tif (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));\n\tif (typeof cookiesString !== \"string\") return [];\n\tconst cookiesStrings = [];\n\tlet pos = 0;\n\tlet start;\n\tlet ch;\n\tlet lastComma;\n\tlet nextStart;\n\tlet cookiesSeparatorFound;\n\tconst skipWhitespace = () => {\n\t\twhile (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) pos += 1;\n\t\treturn pos < cookiesString.length;\n\t};\n\tconst notSpecialChar = () => {\n\t\tch = cookiesString.charAt(pos);\n\t\treturn ch !== \"=\" && ch !== \";\" && ch !== \",\";\n\t};\n\twhile (pos < cookiesString.length) {\n\t\tstart = pos;\n\t\tcookiesSeparatorFound = false;\n\t\twhile (skipWhitespace()) {\n\t\t\tch = cookiesString.charAt(pos);\n\t\t\tif (ch === \",\") {\n\t\t\t\tlastComma = pos;\n\t\t\t\tpos += 1;\n\t\t\t\tskipWhitespace();\n\t\t\t\tnextStart = pos;\n\t\t\t\twhile (pos < cookiesString.length && notSpecialChar()) pos += 1;\n\t\t\t\tif (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n\t\t\t\t\tcookiesSeparatorFound = true;\n\t\t\t\t\tpos = nextStart;\n\t\t\t\t\tcookiesStrings.push(cookiesString.slice(start, lastComma));\n\t\t\t\t\tstart = pos;\n\t\t\t\t} else pos = lastComma + 1;\n\t\t\t} else pos += 1;\n\t\t}\n\t\tif (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));\n\t}\n\treturn cookiesStrings;\n}\nexport { parse, parse as parseCookie, parseSetCookie, serialize, serialize as serializeCookie, splitSetCookieString, stringifyCookie };\n","import { splitSetCookieString } from \"cookie-es\";\n//#region src/ssr/headers.ts\nfunction toHeadersInstance(init) {\n\tif (init instanceof Headers) return init;\n\telse if (Array.isArray(init)) return new Headers(init);\n\telse if (typeof init === \"object\") return new Headers(init);\n\telse return null;\n}\nfunction mergeHeaders(...headers) {\n\treturn headers.reduce((acc, header) => {\n\t\tconst headersInstance = toHeadersInstance(header);\n\t\tif (!headersInstance) return acc;\n\t\tfor (const [key, value] of headersInstance.entries()) if (key === \"set-cookie\") splitSetCookieString(value).forEach((cookie) => acc.append(\"set-cookie\", cookie));\n\t\telse acc.set(key, value);\n\t\treturn acc;\n\t}, new Headers());\n}\n//#endregion\nexport { mergeHeaders };\n\n//# sourceMappingURL=headers.js.map","import type {\n AnyFunctionMiddleware,\n AnyRequestMiddleware,\n AnyStartInstanceOptions,\n CompiledFetcherFnOptions,\n CustomFetch,\n FunctionMiddlewareServerFnResult,\n Method,\n MiddlewareFn,\n NextFn,\n ServerFn,\n ServerFnBaseOptions,\n ServerFnBuilder,\n ServerFnMiddlewareOptions,\n ServerFnMiddlewareResult,\n createMiddleware as upstreamCreateMiddleware,\n createServerFn as upstreamCreateServerFn,\n createStart as upstreamCreateStart,\n} from '@tanstack/start-client-core';\nimport type { ClientFnMeta, ServerFnMeta } from '@tanstack/start-client-core';\nimport type { ClientOnlyFn, IsomorphicFn, IsomorphicFnBase, ServerOnlyFn } from '@tanstack/start-fn-stubs';\n\nimport { getEnv, getMiddlewareEntry, getServerFnEntry, registerMiddleware, registerServerFn, runInEnv } from '@tanstack-router-testing/router-testing-core';\nimport { isRedirect, useRouter } from '@tanstack/react-router';\nimport { parseRedirect } from '@tanstack/router-core';\nimport { mergeHeaders } from '@tanstack/router-core/ssr/client';\nimport { TSS_SERVER_FUNCTION, createNullProtoObject, execValidator, flattenMiddlewares, safeObjectMerge } from '@tanstack/start-client-core';\nimport { getStartContext } from '@tanstack/start-storage-context';\nimport * as React from 'react';\n\nexport * from '@tanstack/start-client-core';\n\ntype AnyFn = (...args: any[]) => any;\ntype MiddlewareType = 'request' | 'function';\ntype CreateServerFnShim = typeof upstreamCreateServerFn;\ntype CreateMiddlewareShim = typeof upstreamCreateMiddleware;\ninterface ServerExecutionResult {\n result?: unknown;\n error?: unknown;\n context?: unknown;\n}\ntype TestServerFnMiddlewareResult = ServerFnMiddlewareResult & {\n _callSiteFetch?: CustomFetch;\n};\ntype GlobalWithStartOptions = typeof globalThis & {\n __TSS_START_OPTIONS__?: AnyStartInstanceOptions | undefined;\n window?: Window & {\n __TSS_START_OPTIONS__?: AnyStartInstanceOptions | undefined;\n };\n};\n\nlet serverFnId = 0;\nconst TSS_SERVER_FUNCTION_FACTORY = Symbol.for('TSS_SERVER_FUNCTION_FACTORY');\n\nconst currentEnv = (): 'client' | 'server' => {\n const env = getEnv();\n if (env) return env;\n return globalThis.window === undefined ? 'server' : 'client';\n};\n\nconst setStartOptions = (options: AnyStartInstanceOptions): void => {\n const global = globalThis as GlobalWithStartOptions;\n global.__TSS_START_OPTIONS__ = options;\n if (global.window) {\n global.window.__TSS_START_OPTIONS__ = options;\n }\n};\n\nconst getStartOptions = (): AnyStartInstanceOptions | undefined => {\n const startContext = getStartContext({ throwIfNotFound: false });\n if (startContext?.startOptions) return startContext.startOptions as AnyStartInstanceOptions;\n\n const global = globalThis as GlobalWithStartOptions;\n return global.window?.__TSS_START_OPTIONS__ ?? global.__TSS_START_OPTIONS__;\n};\n\nexport const __setStartOptionsForTesting = (options: AnyStartInstanceOptions): void => {\n setStartOptions(options);\n};\n\nconst toPromise = async <T>(value: T | Promise<T>): Promise<T> => value;\n\nconst executeMiddleware = async (\n middlewares: (AnyFunctionMiddleware | AnyRequestMiddleware)[],\n env: 'client' | 'server',\n opts: ServerFnMiddlewareOptions,\n): Promise<ServerFnMiddlewareResult> => {\n const globalMiddlewares = (getStartOptions()?.functionMiddleware ?? []) as (AnyFunctionMiddleware | AnyRequestMiddleware)[];\n let flattenedMiddlewares = flattenMiddlewares([...globalMiddlewares, ...middlewares]);\n\n if (env === 'server') {\n const startContext = getStartContext({ throwIfNotFound: false });\n if (startContext?.executedRequestMiddlewares) {\n flattenedMiddlewares = flattenedMiddlewares.filter(middleware => !startContext.executedRequestMiddlewares.has(middleware));\n }\n }\n\n const callNextMiddleware: NextFn = async ctx => {\n const nextMiddleware = flattenedMiddlewares.shift();\n if (!nextMiddleware) return ctx;\n\n try {\n const middlewareOptions = nextMiddleware.options as { readonly type?: MiddlewareType; readonly server?: unknown };\n\n if (env === 'server' && middlewareOptions.type === 'request') {\n const requestMiddleware = middlewareOptions.server as AnyFn | undefined;\n if (!requestMiddleware) {\n return await callNextMiddleware(ctx);\n }\n\n const request = getRequestFromContext(ctx);\n const pathname = getPathnameFromRequest(request);\n const startContext = getStartContext({ throwIfNotFound: false });\n startContext?.executedRequestMiddlewares.add(nextMiddleware);\n\n const requestNext = async (userCtx: { readonly context?: unknown } | undefined = {}) => {\n const nextCtx = {\n ...ctx,\n request,\n pathname,\n context: safeObjectMerge(toOptionalRecord(ctx.context), toOptionalRecord(userCtx.context)),\n };\n const result = await callNextMiddleware(nextCtx as ServerFnMiddlewareResult);\n if (result.error) throw result.error;\n\n return {\n request,\n pathname,\n context: result.context,\n response: result.result instanceof Response ? result.result : new Response(null),\n };\n };\n\n const result = await requestMiddleware({\n request,\n pathname,\n context: ctx.context,\n serverFnMeta: ctx.serverFnMeta,\n next: requestNext,\n });\n\n if (result instanceof Response) {\n return { ...ctx, result };\n }\n\n return {\n ...ctx,\n request,\n pathname,\n context: safeObjectMerge(toOptionalRecord(ctx.context), toOptionalRecord((result as { readonly context?: unknown } | undefined)?.context)),\n result: (result as { readonly response?: Response } | undefined)?.response ?? ctx.result,\n };\n }\n\n if ('inputValidator' in nextMiddleware.options && nextMiddleware.options.inputValidator && env === 'server') {\n ctx.data = await execValidator(nextMiddleware.options.inputValidator, ctx.data);\n }\n\n let middlewareFn: MiddlewareFn | undefined;\n if (env === 'client' && 'client' in nextMiddleware.options) {\n middlewareFn = nextMiddleware.options.client as unknown as MiddlewareFn | undefined;\n } else if (env === 'server' && 'server' in nextMiddleware.options) {\n middlewareFn = nextMiddleware.options.server as unknown as MiddlewareFn | undefined;\n }\n\n if (!middlewareFn) {\n return await callNextMiddleware(ctx);\n }\n\n const userNext = async (userCtx: TestServerFnMiddlewareResult | undefined = {} as TestServerFnMiddlewareResult) => {\n const callCtx = ctx as TestServerFnMiddlewareResult;\n const nextCtx = {\n ...ctx,\n ...userCtx,\n context: safeObjectMerge(ctx.context, userCtx.context),\n sendContext: safeObjectMerge(ctx.sendContext, userCtx.sendContext),\n headers: mergeHeaders(ctx.headers, userCtx.headers),\n _callSiteFetch: callCtx._callSiteFetch,\n fetch: callCtx._callSiteFetch ?? userCtx.fetch ?? ctx.fetch,\n result: userCtx.result !== undefined ? userCtx.result : userCtx instanceof Response ? userCtx : ctx.result,\n error: userCtx.error ?? ctx.error,\n };\n\n const result = await callNextMiddleware(nextCtx as ServerFnMiddlewareResult);\n if (result.error) throw result.error;\n return result;\n };\n\n const result = await middlewareFn({\n ...ctx,\n next: userNext,\n });\n\n if (isRedirect(result)) {\n return { ...ctx, error: result };\n }\n\n if (result instanceof Response) {\n return { ...ctx, result };\n }\n\n if (!result) {\n throw new Error('User middleware returned undefined. You must call next() or return a result in your middlewares.');\n }\n\n return result;\n } catch (error) {\n return { ...ctx, error };\n }\n };\n\n return callNextMiddleware({\n ...opts,\n headers: opts.headers ?? {},\n sendContext: opts.sendContext ?? {},\n context: opts.context ?? createNullProtoObject(),\n _callSiteFetch: opts.fetch,\n } as ServerFnMiddlewareResult);\n};\n\nconst getRequestFromContext = (ctx: ServerFnMiddlewareOptions): Request => {\n const existing = (ctx as ServerFnMiddlewareOptions & { readonly request?: Request }).request;\n if (existing) return existing;\n\n const startContext = getStartContext({ throwIfNotFound: false });\n return startContext?.request ?? new Request('http://tanstack-router-testing.test/');\n};\n\nconst getPathnameFromRequest = (request: Request): string => new URL(request.url).pathname;\n\nconst toOptionalRecord = (value: unknown): Record<string, unknown> | undefined => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return undefined;\n return value as Record<string, unknown>;\n};\n\nconst createServerFnMiddleware = (options: ServerFnBaseOptions<any, any, any, any, any>, getFetcher: () => AnyFn): AnyFunctionMiddleware =>\n ({\n '~types': undefined,\n options: {\n inputValidator: options.inputValidator,\n client: async ({ next, sendContext, fetch, ...ctx }: ServerFnMiddlewareOptions & { next: NextFn }) => {\n const payload = {\n ...ctx,\n context: sendContext,\n fetch,\n };\n const res = await options.extractedFn?.(payload as CompiledFetcherFnOptions & ServerFnBaseOptions<any, Method>);\n return next(res as ServerFnMiddlewareResult);\n },\n server: async ({ next, ...ctx }: ServerFnMiddlewareOptions & { next: NextFn }) => {\n const fetcher = getFetcher();\n const entry = getServerFnEntry(fetcher);\n const impl = (entry?.mock ?? entry?.original ?? options.serverFn) as ServerFn<any, any, any, any, any> | undefined;\n const result = await impl?.(ctx as never);\n\n return next({\n ...ctx,\n result,\n } as ServerFnMiddlewareResult) as unknown as FunctionMiddlewareServerFnResult<any, any, any, any, any>;\n },\n },\n }) as unknown as AnyFunctionMiddleware;\n\nconst createServerMeta = (): ServerFnMeta => {\n serverFnId += 1;\n const id = `tanstack-router-testing:${serverFnId}`;\n return {\n id,\n name: id,\n filename: 'tanstack-router-testing://server-fn',\n };\n};\n\nconst normalizeDataOptions = (opts?: Partial<CompiledFetcherFnOptions>): Partial<CompiledFetcherFnOptions> => opts ?? {};\n\nexport const createServerFn: CreateServerFnShim = ((\n options: { method?: Method } | undefined,\n __opts: ServerFnBaseOptions<any, Method, any, any, any> | undefined,\n) => {\n const resolvedOptions = { ...(__opts ?? options) } as ServerFnBaseOptions<any, Method, any, any, any>;\n resolvedOptions.method ??= 'GET';\n\n const makeBuilder = (nextOptions: ServerFnBaseOptions<any, Method, any, any, any>): ServerFnBuilder<any, Method> => {\n const builder = ((newOptions?: { method?: Method }) =>\n createServerFn(undefined, {\n ...nextOptions,\n ...newOptions,\n })) as ServerFnBuilder<any, Method> & ((newOptions?: { method?: Method }) => ServerFnBuilder<any, Method>);\n\n Object.assign(builder, {\n '~types': undefined,\n [TSS_SERVER_FUNCTION_FACTORY]: true,\n options: nextOptions,\n middleware: (middlewares: readonly (AnyFunctionMiddleware | AnyRequestMiddleware | ServerFnBuilder<any, Method>)[]) => {\n const newMiddleware = [...((nextOptions.middleware as (AnyFunctionMiddleware | AnyRequestMiddleware)[]) || [])];\n for (const middleware of middlewares) {\n if (middleware && TSS_SERVER_FUNCTION_FACTORY in middleware && middleware.options.middleware) {\n newMiddleware.push(...(middleware.options.middleware as (AnyFunctionMiddleware | AnyRequestMiddleware)[]));\n } else {\n newMiddleware.push(middleware as AnyFunctionMiddleware | AnyRequestMiddleware);\n }\n }\n const res = createServerFn(undefined, {\n ...nextOptions,\n middleware: newMiddleware,\n }) as ServerFnBuilder<any, Method>;\n (res as unknown as Record<symbol, unknown>)[TSS_SERVER_FUNCTION_FACTORY] = true;\n return res;\n },\n inputValidator: (inputValidator: unknown) =>\n createServerFn(undefined, {\n ...nextOptions,\n inputValidator,\n }),\n handler: (...args: unknown[]) => {\n const extractedFromTransform = args.length > 1 ? (args[0] as AnyFn) : undefined;\n const serverFn = (args.length > 1 ? args[1] : args[0]) as ServerFn<any, Method, any, any, any>;\n const serverFnMeta = createServerMeta();\n const clientMeta: ClientFnMeta = { id: serverFnMeta.id };\n let fetcher: AnyFn;\n let resolvedMiddleware: (AnyFunctionMiddleware | AnyRequestMiddleware)[] = [];\n\n const executeServer = async (opts?: Partial<CompiledFetcherFnOptions> & { request?: Request }): Promise<ServerExecutionResult> => {\n const callOpts = normalizeDataOptions(opts) as Partial<CompiledFetcherFnOptions> & { request?: Request };\n const startContext = getStartContext({ throwIfNotFound: false });\n const request = callOpts.request ?? startContext?.request ?? new Request('http://tanstack-router-testing.test/_serverFn');\n const result: ServerFnMiddlewareResult = await runInEnv('server', () =>\n executeMiddleware(resolvedMiddleware, 'server', {\n ...callOpts,\n data: callOpts.data,\n method: nextOptions.method,\n serverFnMeta,\n signal: callOpts.signal ?? new AbortController().signal,\n context: safeObjectMerge(callOpts.context ?? createNullProtoObject(), startContext?.contextAfterGlobalMiddlewares),\n request,\n pathname: getPathnameFromRequest(request),\n } as ServerFnMiddlewareOptions),\n );\n\n return {\n result: result.result,\n error: result.error,\n context: result.sendContext,\n };\n };\n\n const extractedFn = Object.assign(\n async (opts?: CompiledFetcherFnOptions & ServerFnBaseOptions<any, Method>): Promise<unknown> => {\n if (extractedFromTransform) {\n return await extractedFromTransform(opts);\n }\n return await executeServer(opts);\n },\n {\n url: `/_serverFn/${serverFnMeta.id}`,\n serverFnMeta,\n },\n );\n\n const handlerOptions = {\n ...nextOptions,\n extractedFn,\n serverFn,\n };\n resolvedMiddleware = [\n ...((handlerOptions.middleware ?? []) as (AnyFunctionMiddleware | AnyRequestMiddleware)[]),\n createServerFnMiddleware(handlerOptions, () => fetcher),\n ];\n\n fetcher = Object.assign(\n async (opts?: Partial<CompiledFetcherFnOptions>): Promise<unknown> => {\n const callOpts = normalizeDataOptions(opts);\n if (currentEnv() === 'server') {\n const result = await executeServer(callOpts);\n const redirect = parseRedirect(result.error);\n if (redirect) throw redirect;\n if (result.error) throw result.error;\n return result.result;\n }\n\n const result = await runInEnv('client', () =>\n executeMiddleware(resolvedMiddleware, 'client', {\n ...extractedFn,\n ...handlerOptions,\n data: callOpts.data,\n headers: callOpts.headers,\n signal: callOpts.signal ?? new AbortController().signal,\n fetch: callOpts.fetch ?? getStartOptions()?.serverFns?.fetch,\n context: createNullProtoObject(),\n serverFnMeta: clientMeta,\n } as ServerFnMiddlewareOptions),\n );\n\n const redirect = parseRedirect(result.error);\n if (redirect) throw redirect;\n if (result.error) throw result.error;\n return result.result;\n },\n {\n ...extractedFn,\n [TSS_SERVER_FUNCTION]: true,\n method: nextOptions.method,\n __executeServer: executeServer,\n },\n );\n\n registerServerFn(fetcher, serverFn as unknown as AnyFn);\n return fetcher;\n },\n });\n\n return builder;\n };\n\n return makeBuilder(resolvedOptions);\n}) as CreateServerFnShim;\n\nconst createPhaseWrapper =\n (mw: object, phase: 'client' | 'server'): AnyFn =>\n async (ctx: unknown) => {\n const entry = getMiddlewareEntry(mw);\n const impl = phase === 'client' ? (entry?.mockClient ?? entry?.originalClient) : (entry?.mockServer ?? entry?.originalServer);\n if (!impl) return (ctx as { next?: AnyFn }).next?.();\n return impl(ctx as never);\n };\n\nexport const createMiddleware: CreateMiddlewareShim = ((options: { type?: MiddlewareType } | undefined, __opts: Record<string, unknown> | undefined) => {\n const makeBuilder = (resolvedOptions: Record<string, unknown>) => {\n const mw: Record<string, unknown> = {};\n const originalClient = resolvedOptions.client as AnyFn | undefined;\n const originalServer = resolvedOptions.server as AnyFn | undefined;\n const optionsWithWrappedPhases = {\n ...resolvedOptions,\n ...(originalClient ? { client: createPhaseWrapper(mw, 'client') } : {}),\n ...(originalServer ? { server: createPhaseWrapper(mw, 'server') } : {}),\n };\n\n Object.assign(mw, {\n '~types': undefined,\n options: optionsWithWrappedPhases,\n middleware: (middlewares: unknown) =>\n createMiddleware(\n {} as never,\n {\n ...resolvedOptions,\n middleware: middlewares,\n } as never,\n ),\n inputValidator: (inputValidator: unknown) =>\n createMiddleware(\n {} as never,\n {\n ...resolvedOptions,\n inputValidator,\n } as never,\n ),\n client: (client: AnyFn) =>\n createMiddleware(\n {} as never,\n {\n ...resolvedOptions,\n client,\n } as never,\n ),\n server: (server: AnyFn) =>\n createMiddleware(\n {} as never,\n {\n ...resolvedOptions,\n server,\n } as never,\n ),\n });\n\n registerMiddleware(mw, {\n ...(originalClient ? { client: originalClient } : {}),\n ...(originalServer ? { server: originalServer } : {}),\n });\n\n return mw;\n };\n\n return makeBuilder({\n type: 'request' satisfies MiddlewareType,\n ...(__opts ?? options),\n }) as never;\n}) as CreateMiddlewareShim;\n\nexport const createIsomorphicFn = (): IsomorphicFnBase => {\n const makeCallable = <TArgs extends any[], TServer, TClient>(\n serverImpl: ((...args: TArgs) => TServer) | undefined,\n clientImpl?: (...args: TArgs) => TClient,\n ): IsomorphicFn<TArgs, TServer, TClient> => {\n const fn = ((...args: TArgs) => {\n if (currentEnv() === 'server') return serverImpl?.(...args);\n return clientImpl?.(...args);\n }) as IsomorphicFn<TArgs, TServer, TClient>;\n return fn;\n };\n\n const base = (() => {}) as unknown as IsomorphicFnBase;\n return Object.assign(base, {\n server: <TArgs extends any[], TServer>(serverImpl: (...args: TArgs) => TServer): ServerOnlyFn<TArgs, TServer> => {\n const serverOnly = makeCallable<TArgs, TServer, undefined>(serverImpl) as ServerOnlyFn<TArgs, TServer>;\n return Object.assign(serverOnly, {\n client: <TClient>(clientImpl: (...args: TArgs) => TClient) => makeCallable(serverImpl, clientImpl),\n });\n },\n client: <TArgs extends any[], TClient>(clientImpl: (...args: TArgs) => TClient): ClientOnlyFn<TArgs, TClient> => {\n const clientOnly = makeCallable<TArgs, undefined, TClient>(undefined, clientImpl) as ClientOnlyFn<TArgs, TClient>;\n return Object.assign(clientOnly, {\n server: <TServer>(serverImpl: (...args: TArgs) => TServer) => makeCallable(serverImpl, clientImpl),\n });\n },\n });\n};\n\nexport const createServerOnlyFn = <TFn extends AnyFn>(fn: TFn): TFn =>\n ((...args: Parameters<TFn>) => {\n if (currentEnv() === 'client') {\n throw new Error('[tanstack-router-testing] createServerOnlyFn: attempted to call a server-only function in the client test environment.');\n }\n return fn(...args);\n }) as TFn;\n\nexport const createClientOnlyFn = <TFn extends AnyFn>(fn: TFn): TFn =>\n ((...args: Parameters<TFn>) => {\n if (currentEnv() === 'server') {\n throw new Error('[tanstack-router-testing] createClientOnlyFn: attempted to call a client-only function in the server test environment.');\n }\n return fn(...args);\n }) as TFn;\n\nexport const createStart = ((getOptions: () => Promise<Omit<AnyStartInstanceOptions, '~types'>> | Omit<AnyStartInstanceOptions, '~types'>) => {\n const getAndStoreOptions = async () => {\n const options = await toPromise(getOptions());\n setStartOptions(options as AnyStartInstanceOptions);\n return options;\n };\n\n const initialOptions = getOptions();\n if (initialOptions instanceof Promise) {\n void initialOptions.then(options => {\n setStartOptions(options as AnyStartInstanceOptions);\n });\n } else {\n setStartOptions(initialOptions as AnyStartInstanceOptions);\n }\n\n return {\n getOptions: getAndStoreOptions,\n createMiddleware,\n };\n}) as typeof upstreamCreateStart;\n\nexport function useServerFn<T extends (...deps: any[]) => Promise<any>>(serverFn: T): (...args: Parameters<T>) => ReturnType<T> {\n const router = useRouter();\n\n return React.useCallback(\n async (...args: any[]) => {\n try {\n const res = await serverFn(...args);\n\n if (isRedirect(res)) {\n throw res;\n }\n\n return res;\n } catch (error) {\n if (isRedirect(error)) {\n error.options._fromLocation = router.stores.location.get();\n return router.navigate(router.resolveRedirect(error).options);\n }\n\n throw error;\n }\n },\n [router, serverFn],\n ) as any;\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,SAAS,MAAM;AACvB,MAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAClD,KAAI,CAAC,KAAK,kBAAkB,CAAC,KAAK,kBAAkB,OAAO,KAAK,SAAS,SAAU,KAAI;AACtF,MAAI,IAAI,KAAK,KAAK;AAClB,OAAK,iBAAiB;SACf;CACR,MAAM,UAAU,IAAI,QAAQ,KAAK,QAAQ;AACzC,KAAI,KAAK,QAAQ,QAAQ,IAAI,WAAW,KAAK,KAAM,SAAQ,IAAI,YAAY,KAAK,KAAK;CACrF,MAAM,WAAW,IAAI,SAAS,MAAM;EACnC,QAAQ,KAAK;EACb;EACA,CAAC;AACF,UAAS,UAAU;AACnB,KAAI,KAAK,MAAO,OAAM;AACtB,QAAO;;;;AAcR,SAAS,cAAc,KAAK;AAC3B,KAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAY,IAAI,qBAAsB,QAAO,SAAS,IAAI;;;;AC8N9F,SAAS,qBAAqB,eAAe;AAC5C,KAAI,MAAM,QAAQ,cAAc,CAAE,QAAO,cAAc,SAAS,MAAM,qBAAqB,EAAE,CAAC;AAC9F,KAAI,OAAO,kBAAkB,SAAU,QAAO,EAAE;CAChD,MAAM,iBAAiB,EAAE;CACzB,IAAI,MAAM;CACV,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,uBAAuB;AAC5B,SAAO,MAAM,cAAc,UAAU,KAAK,KAAK,cAAc,OAAO,IAAI,CAAC,CAAE,QAAO;AAClF,SAAO,MAAM,cAAc;;CAE5B,MAAM,uBAAuB;AAC5B,OAAK,cAAc,OAAO,IAAI;AAC9B,SAAO,O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AG5D,QAAO;EACL,YAAY;EACZ,kBAAA;EACD;;AAGH,SAAgB,YAAwD,UAAwD;CAC9H,MAAM,SAAS,WAAW;AAE1B,QAAO,MAAM,YACX,OAAO,GAAG,SAAgB;AACxB,MAAI;GACF,MAAM,MAAM,MAAM,SAAS,GAAG,KAAK;AAEnC,OAAI,WAAW,IAAI,CACjB,OAAM;AAGR,UAAO;WACA,OAAO;AACd,OAAI,WAAW,MAAM,EAAE;AACrB,UAAM,QAAQ,gBAAgB,OAAO,OAAO,SAAS,KAAK;AAC1D,WAAO,OAAO,SAAS,OAAO,gBAAgB,MAAM,CAAC,QAAQ;;AAG/D,SAAM;;IAGV,CAAC,QAAQ,SAAS,CACnB"}
|
package/dist/shim.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnyStartInstanceOptions, createMiddleware as createMiddleware$1, createServerFn as createServerFn$1, createStart as createStart$1 } from "@tanstack/start-client-core";
|
|
2
|
+
import { IsomorphicFnBase } from "@tanstack/start-fn-stubs";
|
|
3
|
+
export * from "@tanstack/start-client-core";
|
|
4
|
+
|
|
5
|
+
//#region src/shim.d.ts
|
|
6
|
+
type AnyFn = (...args: any[]) => any;
|
|
7
|
+
type CreateServerFnShim = typeof createServerFn$1;
|
|
8
|
+
type CreateMiddlewareShim = typeof createMiddleware$1;
|
|
9
|
+
declare const __setStartOptionsForTesting: (options: AnyStartInstanceOptions) => void;
|
|
10
|
+
declare const createServerFn: CreateServerFnShim;
|
|
11
|
+
declare const createMiddleware: CreateMiddlewareShim;
|
|
12
|
+
declare const createIsomorphicFn: () => IsomorphicFnBase;
|
|
13
|
+
declare const createServerOnlyFn: <TFn extends AnyFn>(fn: TFn) => TFn;
|
|
14
|
+
declare const createClientOnlyFn: <TFn extends AnyFn>(fn: TFn) => TFn;
|
|
15
|
+
declare const createStart: typeof createStart$1;
|
|
16
|
+
declare function useServerFn<T extends (...deps: any[]) => Promise<any>>(serverFn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __setStartOptionsForTesting, createClientOnlyFn, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, createStart, useServerFn };
|
|
19
|
+
//# sourceMappingURL=shim.d.mts.map
|
package/dist/shim.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as createServerFn, c as useServerFn, i as createMiddleware, n as createClientOnlyFn, o as createServerOnlyFn, r as createIsomorphicFn, s as createStart, t as __setStartOptionsForTesting } from "./shim-DR16QaLL.mjs";
|
|
2
|
+
export * from "@tanstack/start-client-core";
|
|
3
|
+
export { __setStartOptionsForTesting, createClientOnlyFn, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, createStart, useServerFn };
|
package/dist/vite.d.mts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/vite.d.ts
|
|
4
|
+
interface TanstackStartTestingOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Directory holding file-based routes, relative to the Vite root.
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue `'src/routes'`
|
|
9
|
+
*/
|
|
10
|
+
readonly routesDirectory?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Output path for the generated route tree, relative to the Vite root.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue `'src/routeTree.gen.ts'`
|
|
15
|
+
*/
|
|
16
|
+
readonly generatedRouteTree?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to alias `@tanstack/react-start` to the test runtime shim.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue `true`
|
|
21
|
+
*/
|
|
22
|
+
readonly aliasReactStart?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Install a small test runtime module for TanStack Start RSC imports that
|
|
25
|
+
* need `virtual:tanstack-rsc-runtime` under Vitest.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `false`
|
|
28
|
+
*/
|
|
29
|
+
readonly rsc?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Vite/Vitest plugins for TanStack Start tests.
|
|
33
|
+
*
|
|
34
|
+
* This keeps route-tree generation on the real TanStack router plugin path
|
|
35
|
+
* while swapping the Start runtime to the in-process testing shim.
|
|
36
|
+
*/
|
|
37
|
+
declare const tanstackStartTesting: (options?: TanstackStartTestingOptions) => readonly Plugin[];
|
|
38
|
+
//#endregion
|
|
39
|
+
export { TanstackStartTestingOptions, tanstackStartTesting };
|
|
40
|
+
//# sourceMappingURL=vite.d.mts.map
|