@rangojs/router 0.0.0-experimental.33 → 0.0.0-experimental.35
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/dist/vite/index.js
CHANGED
|
@@ -1745,7 +1745,7 @@ import { resolve } from "node:path";
|
|
|
1745
1745
|
// package.json
|
|
1746
1746
|
var package_default = {
|
|
1747
1747
|
name: "@rangojs/router",
|
|
1748
|
-
version: "0.0.0-experimental.
|
|
1748
|
+
version: "0.0.0-experimental.35",
|
|
1749
1749
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
1750
1750
|
keywords: [
|
|
1751
1751
|
"react",
|
package/package.json
CHANGED
|
@@ -214,14 +214,17 @@ export function createHandlerContext<TEnv>(
|
|
|
214
214
|
requestContext?.res ?? new Response(null, { status: 200 });
|
|
215
215
|
|
|
216
216
|
// Guard mutating Headers methods so they throw inside "use cache" functions.
|
|
217
|
+
// Uses lazy `ctx` reference (assigned below) — only the specific handler ctx
|
|
218
|
+
// is stamped by cache-runtime, not the shared request context.
|
|
217
219
|
const MUTATING_HEADERS_METHODS = new Set(["set", "append", "delete"]);
|
|
220
|
+
let ctx: InternalHandlerContext<any, TEnv>;
|
|
218
221
|
const guardedHeaders = new Proxy(stubResponse.headers, {
|
|
219
222
|
get(target, prop, receiver) {
|
|
220
223
|
const value = Reflect.get(target, prop, receiver);
|
|
221
224
|
if (typeof value === "function") {
|
|
222
225
|
if (MUTATING_HEADERS_METHODS.has(prop as string)) {
|
|
223
226
|
return (...args: any[]) => {
|
|
224
|
-
assertNotInsideCacheExec(
|
|
227
|
+
assertNotInsideCacheExec(ctx, "headers");
|
|
225
228
|
return value.apply(target, args);
|
|
226
229
|
};
|
|
227
230
|
}
|
|
@@ -231,7 +234,7 @@ export function createHandlerContext<TEnv>(
|
|
|
231
234
|
},
|
|
232
235
|
});
|
|
233
236
|
|
|
234
|
-
|
|
237
|
+
ctx = {
|
|
235
238
|
params,
|
|
236
239
|
build: false,
|
|
237
240
|
request,
|
|
@@ -247,7 +250,7 @@ export function createHandlerContext<TEnv>(
|
|
|
247
250
|
TEnv
|
|
248
251
|
>["get"],
|
|
249
252
|
set: ((keyOrVar: any, value: any) => {
|
|
250
|
-
assertNotInsideCacheExec(
|
|
253
|
+
assertNotInsideCacheExec(ctx, "set");
|
|
251
254
|
contextSet(variables, keyOrVar, value);
|
|
252
255
|
}) as HandlerContext<any, TEnv>["set"],
|
|
253
256
|
res: stubResponse, // Stub response for setting headers
|
|
@@ -1213,9 +1213,7 @@ export async function resolveAllSegmentsWithRevalidation<TEnv>(
|
|
|
1213
1213
|
),
|
|
1214
1214
|
(seg) => ({ segments: [seg], matchedIds: [seg.id] }),
|
|
1215
1215
|
deps,
|
|
1216
|
-
telemetry
|
|
1217
|
-
? { request, url: context.url, routeKey, isPartial: true, telemetry }
|
|
1218
|
-
: undefined,
|
|
1216
|
+
{ request, url: context.url, routeKey, isPartial: true, telemetry },
|
|
1219
1217
|
pathname,
|
|
1220
1218
|
);
|
|
1221
1219
|
doneEntry();
|
package/src/rsc/rsc-rendering.ts
CHANGED
|
@@ -83,6 +83,7 @@ export async function handleRscRendering<TEnv>(
|
|
|
83
83
|
slots: result.slots,
|
|
84
84
|
handles: handleStore.stream(),
|
|
85
85
|
version: ctx.version,
|
|
86
|
+
prefetchCacheTTL: ctx.router.prefetchCacheTTL,
|
|
86
87
|
},
|
|
87
88
|
};
|
|
88
89
|
}
|
|
@@ -143,6 +144,7 @@ export async function handleRscRendering<TEnv>(
|
|
|
143
144
|
rootLayout: ctx.router.rootLayout,
|
|
144
145
|
handles: handleStore.stream(),
|
|
145
146
|
version: ctx.version,
|
|
147
|
+
prefetchCacheTTL: ctx.router.prefetchCacheTTL,
|
|
146
148
|
themeConfig: ctx.router.themeConfig,
|
|
147
149
|
initialTheme: reqCtx.theme,
|
|
148
150
|
},
|