@rangojs/router 0.0.0-experimental.106 → 0.0.0-experimental.107
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
|
@@ -2040,7 +2040,7 @@ import { resolve } from "node:path";
|
|
|
2040
2040
|
// package.json
|
|
2041
2041
|
var package_default = {
|
|
2042
2042
|
name: "@rangojs/router",
|
|
2043
|
-
version: "0.0.0-experimental.
|
|
2043
|
+
version: "0.0.0-experimental.107",
|
|
2044
2044
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
2045
2045
|
keywords: [
|
|
2046
2046
|
"react",
|
package/package.json
CHANGED
|
@@ -28,6 +28,24 @@ update, and `revalidate()` never reads, writes, or expires a cached value. If yo
|
|
|
28
28
|
know React Router, `revalidate()` is `shouldRevalidate`, not `Cache-Control`. See
|
|
29
29
|
`/rango` → "Coming from another framework" for the cross-framework mapping.
|
|
30
30
|
|
|
31
|
+
## Fast choice
|
|
32
|
+
|
|
33
|
+
Read this first; use the rest of the page when the choice has edge cases.
|
|
34
|
+
|
|
35
|
+
1. Do you want to cache an entire route or group of routes?
|
|
36
|
+
**Yes** -> `cache()`
|
|
37
|
+
2. Do you need runtime conditions, such as skip for authed users or key by
|
|
38
|
+
locale?
|
|
39
|
+
**Yes** -> `cache()` with `condition` / `key`
|
|
40
|
+
3. Do you want to cache a data fetch or helper shared across routes?
|
|
41
|
+
**Yes** -> `"use cache"`
|
|
42
|
+
4. Do you need different cache entries for different function arguments?
|
|
43
|
+
**Yes** -> `"use cache"` (keyed by args)
|
|
44
|
+
5. Is the expensive part rendering a subtree?
|
|
45
|
+
**Yes** -> `cache()` (caches rendered segments)
|
|
46
|
+
6. Is the expensive part one query inside a larger live handler?
|
|
47
|
+
**Yes** -> `"use cache"` on the query function
|
|
48
|
+
|
|
31
49
|
## Correctness & invalidation
|
|
32
50
|
|
|
33
51
|
rango's caches are built so a hit can't serve wrong or stale-shaped data. These
|
|
@@ -35,6 +53,18 @@ guarantees are mostly automatic — worth knowing so you don't reimplement
|
|
|
35
53
|
protection the framework already gives you (or assume one it deliberately
|
|
36
54
|
doesn't).
|
|
37
55
|
|
|
56
|
+
There are two guard models to keep separate. Both block response side effects
|
|
57
|
+
(`ctx.header()`, cookie writes) that would be lost on a hit; they differ in what
|
|
58
|
+
else they allow:
|
|
59
|
+
|
|
60
|
+
- **`cache()` boundary guard** (route-level) — fires while the handler runs on a
|
|
61
|
+
miss. `ctx.get(nonCacheableVar)` throws (a tainted value would be baked into the
|
|
62
|
+
cached segment) and response side effects (`ctx.header()`, `ctx.setCookie()`,
|
|
63
|
+
`ctx.setStatus()`, `ctx.onResponse()`) throw. `ctx.set()` of a cacheable var is
|
|
64
|
+
**allowed** — children are cached too and can read it.
|
|
65
|
+
- **`"use cache"` exec-guard** (function-level) — stricter: inside the cached
|
|
66
|
+
function `cookies()`, `headers()`, `ctx.set()`, and `ctx.header()` all throw.
|
|
67
|
+
|
|
38
68
|
### Cross-deploy safety: version-segmented store keys
|
|
39
69
|
|
|
40
70
|
`CFCacheStore` prefixes every **physical** store key (the CF Cache API URL and
|
|
@@ -436,21 +466,6 @@ data is cached independently from the route's segment cache. Loader caching
|
|
|
436
466
|
supports custom keys, tags, SWR, conditional bypass, and per-loader store
|
|
437
467
|
overrides — see `/loader` for the full reference.
|
|
438
468
|
|
|
439
|
-
## Decision Flowchart
|
|
440
|
-
|
|
441
|
-
1. Do you want to cache an entire route or group of routes?
|
|
442
|
-
**Yes** -> `cache()`
|
|
443
|
-
2. Do you need runtime conditions (skip for auth users, key by locale)?
|
|
444
|
-
**Yes** -> `cache()` with `condition` / `key`
|
|
445
|
-
3. Do you want to cache a data fetch shared across routes?
|
|
446
|
-
**Yes** -> `"use cache"`
|
|
447
|
-
4. Do you need different cache entries for different arguments?
|
|
448
|
-
**Yes** -> `"use cache"` (keyed by args)
|
|
449
|
-
5. Is the expensive part rendering, not data fetching?
|
|
450
|
-
**Yes** -> `cache()` (caches rendered segments)
|
|
451
|
-
6. Is the expensive part a single query inside a larger handler?
|
|
452
|
-
**Yes** -> `"use cache"` on the query function
|
|
453
|
-
|
|
454
469
|
## See Also
|
|
455
470
|
|
|
456
471
|
- `/caching` — cache() DSL setup, stores, nested boundaries
|
|
@@ -17,7 +17,9 @@ Rango exposes two complementary observability surfaces:
|
|
|
17
17
|
2. **Structured telemetry** (`telemetry`) — lifecycle events sent to a pluggable
|
|
18
18
|
sink for production monitoring, OpenTelemetry, or custom metrics.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
The essentials are below. The exported `TelemetryEvent` union type
|
|
21
|
+
(`import type { TelemetryEvent } from "@rangojs/router"`) is the full event
|
|
22
|
+
contract — every event kind and its fields are typed there.
|
|
21
23
|
|
|
22
24
|
## Performance timeline
|
|
23
25
|
|