@timber-js/app 0.2.0-alpha.249 → 0.2.0-alpha.250
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/_chunks/{actions-C7_xl9iA.js → actions-DH_TCxJb.js} +2 -2
- package/dist/_chunks/{actions-C7_xl9iA.js.map → actions-DH_TCxJb.js.map} +1 -1
- package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -1
- package/dist/_chunks/{dist-GyaJm4GA.js → dist-ob734WH3.js} +20 -19
- package/dist/_chunks/dist-ob734WH3.js.map +1 -0
- package/dist/_chunks/{error-boundary-wuNvAJ4n.js → error-boundary-BR21tTQc.js} +3 -3
- package/dist/_chunks/{error-boundary-wuNvAJ4n.js.map → error-boundary-BR21tTQc.js.map} +1 -1
- package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
- package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
- package/dist/_chunks/{navigation-root-Cvb7P1ud.js → navigation-root-AuCD35Sv.js} +42 -47
- package/dist/_chunks/navigation-root-AuCD35Sv.js.map +1 -0
- package/dist/_chunks/ssr-data-BfsCqCLl.js +47 -0
- package/dist/_chunks/ssr-data-BfsCqCLl.js.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +2 -2
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
- package/dist/client/browser-entry/scroll.d.ts +11 -8
- package/dist/client/browser-entry/scroll.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/index.js +12 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +0 -2
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +6 -6
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/ssr-data.d.ts +35 -38
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/state.d.ts +1 -8
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/cookies/index.js +3 -3
- package/dist/cookies/index.js.map +1 -1
- package/dist/native/rsc/client/global-context.js +20 -0
- package/dist/native/rsc/client/global-context.js.map +1 -0
- package/dist/native/rsc/client/ssr-data.js +9 -4
- package/dist/native/rsc/client/ssr-data.js.map +1 -1
- package/dist/native/rsc/client/use-cookie.js +4 -4
- package/dist/native/rsc/client/use-cookie.js.map +1 -1
- package/dist/native/rsc/manifest.json +1 -1
- package/dist/native/rsc/server/build-manifest.js +1 -4
- package/dist/native/rsc/server/build-manifest.js.map +1 -1
- package/dist/native/rsc/server/html-injectors.js +6 -7
- package/dist/native/rsc/server/html-injectors.js.map +1 -1
- package/dist/native/rsc/server/react-cache-bridge.js +2 -2
- package/dist/native/rsc/server/react-cache-bridge.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +3 -5
- package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +3 -2
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
- package/dist/native/ssr/client/link.js +10 -8
- package/dist/native/ssr/client/link.js.map +1 -1
- package/dist/native/ssr/client/ssr-data.js +10 -6
- package/dist/native/ssr/client/ssr-data.js.map +1 -1
- package/dist/native/ssr/client/state.js +1 -5
- package/dist/native/ssr/client/state.js.map +1 -1
- package/dist/native/ssr/client/use-cookie.js +2 -2
- package/dist/native/ssr/client/use-cookie.js.map +1 -1
- package/dist/native/ssr/client/use-search-params.js +3 -2
- package/dist/native/ssr/client/use-search-params.js.map +1 -1
- package/dist/native/ssr/server/ssr-wrappers.js +11 -4
- package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
- package/dist/server/build-manifest.d.ts +0 -7
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/html-injectors.d.ts +5 -4
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/internal.js +1 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +2 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +6 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +14 -9
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client/browser-entry/post-hydration.ts +27 -22
- package/src/client/browser-entry/scroll.ts +12 -9
- package/src/client/internal.ts +0 -4
- package/src/client/link.tsx +14 -13
- package/src/client/ssr-data.ts +50 -57
- package/src/client/state.ts +1 -14
- package/src/client/use-cookie.ts +4 -3
- package/src/client/use-search-params.ts +5 -4
- package/src/server/build-manifest.ts +0 -10
- package/src/server/html-injectors.ts +11 -13
- package/src/server/rsc-entry/render-route.ts +9 -8
- package/src/server/rsc-entry/ssr-renderer.ts +4 -1
- package/src/server/ssr-bridge-types.ts +6 -0
- package/src/server/ssr-entry.ts +180 -207
- package/src/server/ssr-wrappers.tsx +52 -14
- package/dist/_chunks/dist-GyaJm4GA.js.map +0 -1
- package/dist/_chunks/navigation-root-Cvb7P1ud.js.map +0 -1
- package/dist/_chunks/ssr-data-9hPtcNOr.js +0 -48
- package/dist/_chunks/ssr-data-9hPtcNOr.js.map +0 -1
- package/dist/_chunks/state-B-EBjeER.js +0 -49
- package/dist/_chunks/state-B-EBjeER.js.map +0 -1
- package/dist/native/rsc/client/state.js +0 -14
- package/dist/native/rsc/client/state.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-span-0aG7Q_Ph.js","names":[],"sources":["../../src/server/build-manifest.ts","../../src/shared/dev-span.ts"],"sourcesContent":["/**\n * Build manifest types and utilities for CSS and JS asset tracking.\n *\n * The build manifest maps route segment file paths to their output\n * chunks from Vite's client build. This enables:\n * - 103 Early Hints / Link preloads for per-route CSS (the <link rel=\"stylesheet\">\n * tags themselves come from React Float, never from this manifest)\n * - <script type=\"module\"> with hashed URLs in production\n * - <link rel=\"modulepreload\"> for client chunk dependencies\n * - Link preload headers for Early Hints (103)\n *\n * In dev mode, Vite's HMR client handles CSS/JS injection, so the build\n * manifest is empty. In production, it's populated from Vite's\n * .vite/manifest.json after the client build.\n *\n * Design docs: 18-build-system.md §\"Build Manifest\", 02-rendering-pipeline.md §\"Early Hints\"\n */\n\n/** A font asset entry in the build manifest. */\nexport interface ManifestFontEntry {\n /** URL path to the font file (e.g. `/_timber/fonts/inter-latin-400-abc123.woff2`). */\n href: string;\n /** Font format (e.g. `woff2`). */\n format: string;\n /** Crossorigin attribute — always `anonymous` for fonts. */\n crossOrigin: string;\n}\n\n/** Build manifest mapping input file paths to output asset URLs. */\nexport interface BuildManifest {\n /** Map from input file path (relative to project root) to output CSS URLs. */\n css: Record<string, string[]>;\n /** Map from input file path to output JS chunk URL (hashed filename). */\n js: Record<string, string>;\n /** Map from input file path to transitive JS dependency URLs for modulepreload. */\n modulepreload: Record<string, string[]>;\n /** Map from input file path to font assets used by that module. */\n fonts: Record<string, ManifestFontEntry[]>;\n /**\n * Cache-busting hashes for metadata route files (opengraph-image, etc.).\n * Map from file path (relative to project root) to short content hash.\n * In dev mode this is empty — a startup nonce is used instead.\n */\n metadataRouteHashes?: Record<string, string>;\n}\n\n/**\n * Empty build manifest used in dev mode, and the single source of truth for\n * what an empty manifest contains.\n *\n * `virtual:timber-build-manifest` serializes this constant into its generated\n * source rather than restating it — one literal for the dev module, one for the\n * production module's `globalThis.__TIMBER_BUILD_MANIFEST__ ?? …` fallback.\n * They were three hand-written objects that had already drifted (TIM-1300).\n * A field added here now reaches every copy.\n */\nexport const EMPTY_BUILD_MANIFEST: BuildManifest = {\n css: {},\n js: {},\n modulepreload: {},\n fonts: {},\n metadataRouteHashes: {},\n};\n\n/** Segment shape expected by collectRouteCss (matches ManifestSegmentNode). */\ninterface SegmentWithFiles {\n layout?: { filePath: string };\n page?: { filePath: string };\n}\n\n/**\n * Collect all CSS files needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting CSS for each layout and page.\n * Deduplicates while preserving order (root layout CSS first).\n */\nexport function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildManifest): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const cssFiles = manifest.css[file.filePath];\n if (!cssFiles) continue;\n for (const url of cssFiles) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n// ─── Font utilities ──────────────────────────────────────────────────────\n\n/**\n * Collect all font entries needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting fonts for each layout and page.\n * Deduplicates by href while preserving order.\n */\nexport function collectRouteFonts(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): ManifestFontEntry[] {\n const seen = new Set<string>();\n const result: ManifestFontEntry[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const fonts = manifest.fonts[file.filePath];\n if (!fonts) continue;\n for (const entry of fonts) {\n if (!seen.has(entry.href)) {\n seen.add(entry.href);\n result.push(entry);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"preload\"> tags for font assets.\n *\n * Font preloads use `as=font` and always include `crossorigin` (required\n * for font preloads even for same-origin resources per the spec).\n */\nexport function buildFontPreloadTags(fonts: ManifestFontEntry[]): string {\n return fonts\n .map(\n (f) =>\n `<link rel=\"preload\" href=\"${f.href}\" as=\"font\" type=\"font/${f.format}\" crossorigin=\"${f.crossOrigin}\">`\n )\n .join('');\n}\n\n// ─── JS chunk utilities ──────────────────────────────────────────────────\n\n/**\n * Collect modulepreload URLs for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting transitive JS dependencies\n * for each layout and page. Deduplicates across segments.\n */\nexport function collectRouteModulepreloads(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const preloads = manifest.modulepreload[file.filePath];\n if (!preloads) continue;\n for (const url of preloads) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"modulepreload\"> tags for JS dependency URLs.\n *\n * Modulepreload hints tell the browser to fetch and parse JS modules\n * before they're needed, reducing waterfall latency for dynamic imports.\n */\nexport function buildModulepreloadTags(urls: string[]): string {\n return urls.map((url) => `<link rel=\"modulepreload\" href=\"${url}\">`).join('');\n}\n","/**\n * The wire contract between the dev server's span sink and the dev request\n * pill in the browser. Dev-only; see design/50-dev-request-pill.md.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/**\n * HMR event that carries finished spans to the browser: a\n * `DevSpanPayload[]` of one trace, in the order the spans ended.\n */\nexport const DEV_SPAN_EVENT = 'timber:span';\n\n/** HMR event a tab sends to ask for a trace's spans that ended before it connected. */\nexport const DEV_SPAN_REPLAY_EVENT = 'timber:span-replay';\n\n/**\n * `globalThis` key holding the span sink. The dev server plugin installs it\n * and `DevSpanProcessor` (RSC module graph, same process, separate module\n * instances) reads it, so the hand-off is a `Symbol.for` global.\n */\nexport const DEV_SPAN_SINK_KEY = Symbol.for('timber.dev.span-sink');\n\n/** The `Server-Timing` metric whose `desc` is the response's trace ID. */\nexport const TRACE_TIMING_NAME = 'timber-trace';\n\n/**\n * `globalThis` key holding the dev await wrapper. The dev await transform\n * (`plugins/dev-await.ts`) rewrites `await x` in app server code to call\n * it, looked up at call time; dev tracing installs it. With nothing\n * installed the call is a plain await. See design/50-dev-request-pill.md\n * §\"Phase 2\".\n */\nexport const DEV_AWAIT_KEY = Symbol.for('timber.dev.await');\n\n/** Span name for one awaited call in app server code. */\nexport const AWAIT_SPAN_NAME = 'timber.await';\n\n/**\n * Set on an await span that waited on work started elsewhere: a promise\n * another await already took (React's `cache()`), or one made before the\n * await began (`const p = load(); … await p`). The work's own spans nest\n * where it started, so the wait adds no new information when they exist.\n */\nexport const AWAIT_WAIT_ATTRIBUTE = 'timber.await_wait';\n\n/**\n * Await spans shorter than this are dropped before they reach the terminal\n * tree or the pill: `await params` and other awaits of settled values would\n * otherwise drown the I/O the spans exist to show.\n */\nexport const AWAIT_SPAN_MIN_MS = 1;\n\n/** Span name for one dev-instrumented `fetch()`, ended when headers arrive. */\nexport const FETCH_SPAN_NAME = 'timber.fetch';\n\n/**\n * Span name for reading a fetched response's body (`.text()`, `.json()`,\n * …), a child of the fetch span. The fetch span ends at headers, so without\n * it a slow body read showed only as the `await res.text()` that waited on it.\n */\nexport const FETCH_BODY_SPAN_NAME = 'timber.fetch.body';\n\n/** Root span of every pipeline request. */\nexport const ROOT_SPAN_NAME = 'http.server.request';\n\n/**\n * The span attributes that may reach the browser — the ones the pill reads,\n * and nothing else. An allowlist of keys, not of prefixes: a prefix let\n * through `timber.fetch_error` (an error message that can quote a full URL)\n * and user attributes such as `url.full` or\n * `http.request.header.authorization`. Typing the payload with this list\n * means the pill cannot read an attribute that isn't on it.\n */\nexport const DEV_SPAN_ATTRIBUTES = [\n 'http.request.method',\n 'http.response.status_code',\n /** Query and fragment stripped. */\n 'http.url',\n /** Query and fragment stripped. */\n 'url.path',\n 'timber.route',\n 'timber.segment',\n 'timber.slot',\n 'timber.action_name',\n 'timber.cache_status',\n /** The awaited expression's source text, whitespace collapsed, truncated. */\n 'timber.await_label',\n /** `path/relative/to/root.ts:line` of the await. */\n 'timber.await_location',\n /** See `AWAIT_WAIT_ATTRIBUTE`. */\n 'timber.await_wait',\n] as const;\n\nexport type DevSpanAttribute = (typeof DEV_SPAN_ATTRIBUTES)[number];\n\n/** Attributes that hold a URL; sent without query or fragment. */\nexport const DEV_SPAN_URL_ATTRIBUTES: ReadonlySet<DevSpanAttribute> = new Set([\n 'http.url',\n 'url.path',\n]);\n\nexport type DevSpanSink = (span: DevSpanPayload) => void;\n\n/** One finished span, projected for the browser. */\nexport interface DevSpanPayload {\n traceId: string;\n spanId: string;\n /** Absent for the root span. */\n parentSpanId?: string;\n name: string;\n /** Epoch milliseconds. */\n startMs: number;\n /** Epoch milliseconds. */\n endMs: number;\n error: boolean;\n /** Only `DEV_SPAN_ATTRIBUTES`; URLs without query or fragment. */\n attributes: Partial<Record<DevSpanAttribute, string | number | boolean>>;\n /** Names of `timber.*` span events, e.g. `timber.cache.hit`. */\n events: string[];\n}\n\n/**\n * Read the trace ID from `Server-Timing` metrics, either a raw header value\n * or the `serverTiming` entries of a `PerformanceResourceTiming`.\n */\nexport function traceIdFromServerTiming(\n timing: string | null | readonly { name: string; description: string }[]\n): string | null {\n if (timing == null) return null;\n if (typeof timing !== 'string') {\n return timing.find((t) => t.name === TRACE_TIMING_NAME)?.description || null;\n }\n // `timber-trace;desc=\"<32 hex>\"` — the ID is hex, so no escaping to undo.\n const match = new RegExp(`(?:^|,)\\\\s*${TRACE_TIMING_NAME}\\\\s*;\\\\s*desc=\"?([0-9a-f]+)\"?`).exec(\n timing\n );\n return match?.[1] ?? null;\n}\n\n/** The `Server-Timing` entry that carries a trace ID. */\nexport function traceTimingEntry(traceId: string): string {\n return `${TRACE_TIMING_NAME};desc=\"${traceId}\"`;\n}\n\n// ─── Labels ─────────────────────────────────────────────────────────────────\n\n/** Span attributes as either side holds them (OTEL also allows arrays). */\ntype SpanAttributes = Readonly<Record<string, unknown>>;\n\n/** `@slot ` for a span from a parallel slot, so it reads apart from the main route. */\nfunction slotPrefix(attrs: SpanAttributes): string {\n const slot = attrs['timber.slot'];\n return slot ? `${String(slot)} ` : '';\n}\n\n/**\n * A fetch URL as the terminal tree and the pill show it: without its scheme,\n * which is `https://` for nearly every fetch and only makes the line longer\n * (TIM-1631).\n */\nexport function fetchDisplayUrl(url: string): string {\n return url.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, '');\n}\n\n/**\n * Map a span to its display label and environment tag. One mapping for the\n * terminal tree and the dev request pill, so the two never name a span\n * differently.\n */\nexport function devSpanLabel(name: string, attrs: SpanAttributes): { label: string; env: string } {\n switch (name) {\n case ROOT_SPAN_NAME: {\n const method = attrs['http.request.method'] ?? 'GET';\n const path = attrs['url.path'] ?? '/';\n return { label: `${String(method)} ${String(path)}`, env: 'rsc' };\n }\n case 'timber.proxy':\n return { label: 'proxy.ts', env: 'proxy' };\n case 'timber.middleware':\n return { label: 'middleware.ts', env: 'rsc' };\n case 'timber.render':\n return { label: 'render', env: 'rsc' };\n case 'timber.access': {\n const seg = attrs['timber.segment'] ?? 'segment';\n return { label: `AccessGate (${String(seg)})`, env: 'rsc' };\n }\n case 'timber.ssr':\n return { label: 'hydration render', env: 'ssr' };\n case 'timber.action': {\n const actionName = attrs['timber.action_name'] ?? 'action';\n return { label: String(actionName), env: 'rsc' };\n }\n case 'timber.metadata':\n return { label: 'metadata()', env: 'rsc' };\n case 'timber.layout': {\n const seg = attrs['timber.segment'] ?? '/';\n return { label: `layout ${slotPrefix(attrs)}${String(seg)}`, env: 'rsc' };\n }\n case 'timber.page': {\n const route = attrs['timber.route'] ?? '/';\n return { label: `page ${slotPrefix(attrs)}${String(route)}`, env: 'rsc' };\n }\n case AWAIT_SPAN_NAME:\n // A wait on work started elsewhere — no new work under it.\n return {\n label: `await ${String(attrs['timber.await_label'] ?? '')}${attrs[AWAIT_WAIT_ATTRIBUTE] === true ? ' (wait)' : ''}`,\n env: 'await',\n };\n case FETCH_BODY_SPAN_NAME:\n return { label: 'response body', env: 'fetch' };\n case FETCH_SPAN_NAME: {\n const fetchMethod = attrs['http.request.method'] ?? 'GET';\n const fetchUrl = attrs['http.url'] ?? '';\n return {\n label: `fetch ${String(fetchMethod)} ${fetchDisplayUrl(String(fetchUrl))}`,\n env: 'fetch',\n };\n }\n default:\n return { label: name, env: 'rsc' };\n }\n}\n"],"mappings":";;;;;;;;;;;AAwDA,IAAa,uBAAsC;CACjD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AAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;;;;;;ACnKA,IAAa,iBAAiB;;AAG9B,IAAa,wBAAwB;;;;;;AAOrC,IAAa,oBAAoB,OAAO,IAAI,sBAAsB;;AAGlE,IAAa,oBAAoB;;AAqHjC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,GAAG,kBAAkB,SAAS,QAAQ;AAC/C"}
|
|
1
|
+
{"version":3,"file":"dev-span-0aG7Q_Ph.js","names":[],"sources":["../../src/server/build-manifest.ts","../../src/shared/dev-span.ts"],"sourcesContent":["/**\n * Build manifest types and utilities for CSS and JS asset tracking.\n *\n * The build manifest maps route segment file paths to their output\n * chunks from Vite's client build. This enables:\n * - 103 Early Hints / Link preloads for per-route CSS (the <link rel=\"stylesheet\">\n * tags themselves come from React Float, never from this manifest)\n * - <script type=\"module\"> with hashed URLs in production\n * - <link rel=\"modulepreload\"> for client chunk dependencies\n * - Link preload headers for Early Hints (103)\n *\n * In dev mode, Vite's HMR client handles CSS/JS injection, so the build\n * manifest is empty. In production, it's populated from Vite's\n * .vite/manifest.json after the client build.\n *\n * Design docs: 18-build-system.md §\"Build Manifest\", 02-rendering-pipeline.md §\"Early Hints\"\n */\n\n/** A font asset entry in the build manifest. */\nexport interface ManifestFontEntry {\n /** URL path to the font file (e.g. `/_timber/fonts/inter-latin-400-abc123.woff2`). */\n href: string;\n /** Font format (e.g. `woff2`). */\n format: string;\n /** Crossorigin attribute — always `anonymous` for fonts. */\n crossOrigin: string;\n}\n\n/** Build manifest mapping input file paths to output asset URLs. */\nexport interface BuildManifest {\n /** Map from input file path (relative to project root) to output CSS URLs. */\n css: Record<string, string[]>;\n /** Map from input file path to output JS chunk URL (hashed filename). */\n js: Record<string, string>;\n /** Map from input file path to transitive JS dependency URLs for modulepreload. */\n modulepreload: Record<string, string[]>;\n /** Map from input file path to font assets used by that module. */\n fonts: Record<string, ManifestFontEntry[]>;\n /**\n * Cache-busting hashes for metadata route files (opengraph-image, etc.).\n * Map from file path (relative to project root) to short content hash.\n * In dev mode this is empty — a startup nonce is used instead.\n */\n metadataRouteHashes?: Record<string, string>;\n}\n\n/**\n * Empty build manifest used in dev mode, and the single source of truth for\n * what an empty manifest contains.\n *\n * `virtual:timber-build-manifest` serializes this constant into its generated\n * source rather than restating it — one literal for the dev module, one for the\n * production module's `globalThis.__TIMBER_BUILD_MANIFEST__ ?? …` fallback.\n * They were three hand-written objects that had already drifted (TIM-1300).\n * A field added here now reaches every copy.\n */\nexport const EMPTY_BUILD_MANIFEST: BuildManifest = {\n css: {},\n js: {},\n modulepreload: {},\n fonts: {},\n metadataRouteHashes: {},\n};\n\n/** Segment shape expected by collectRouteCss (matches ManifestSegmentNode). */\ninterface SegmentWithFiles {\n layout?: { filePath: string };\n page?: { filePath: string };\n}\n\n/**\n * Collect all CSS files needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting CSS for each layout and page.\n * Deduplicates while preserving order (root layout CSS first).\n */\nexport function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildManifest): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const cssFiles = manifest.css[file.filePath];\n if (!cssFiles) continue;\n for (const url of cssFiles) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n// ─── Font utilities ──────────────────────────────────────────────────────\n\n/**\n * Collect all font entries needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting fonts for each layout and page.\n * Deduplicates by href while preserving order.\n */\nexport function collectRouteFonts(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): ManifestFontEntry[] {\n const seen = new Set<string>();\n const result: ManifestFontEntry[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const fonts = manifest.fonts[file.filePath];\n if (!fonts) continue;\n for (const entry of fonts) {\n if (!seen.has(entry.href)) {\n seen.add(entry.href);\n result.push(entry);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"preload\"> tags for font assets.\n *\n * Font preloads use `as=font` and always include `crossorigin` (required\n * for font preloads even for same-origin resources per the spec).\n */\nexport function buildFontPreloadTags(fonts: ManifestFontEntry[]): string {\n return fonts\n .map(\n (f) =>\n `<link rel=\"preload\" href=\"${f.href}\" as=\"font\" type=\"font/${f.format}\" crossorigin=\"${f.crossOrigin}\">`\n )\n .join('');\n}\n\n// ─── JS chunk utilities ──────────────────────────────────────────────────\n\n/**\n * Collect modulepreload URLs for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting transitive JS dependencies\n * for each layout and page. Deduplicates across segments.\n */\nexport function collectRouteModulepreloads(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const preloads = manifest.modulepreload[file.filePath];\n if (!preloads) continue;\n for (const url of preloads) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n","/**\n * The wire contract between the dev server's span sink and the dev request\n * pill in the browser. Dev-only; see design/50-dev-request-pill.md.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/**\n * HMR event that carries finished spans to the browser: a\n * `DevSpanPayload[]` of one trace, in the order the spans ended.\n */\nexport const DEV_SPAN_EVENT = 'timber:span';\n\n/** HMR event a tab sends to ask for a trace's spans that ended before it connected. */\nexport const DEV_SPAN_REPLAY_EVENT = 'timber:span-replay';\n\n/**\n * `globalThis` key holding the span sink. The dev server plugin installs it\n * and `DevSpanProcessor` (RSC module graph, same process, separate module\n * instances) reads it, so the hand-off is a `Symbol.for` global.\n */\nexport const DEV_SPAN_SINK_KEY = Symbol.for('timber.dev.span-sink');\n\n/** The `Server-Timing` metric whose `desc` is the response's trace ID. */\nexport const TRACE_TIMING_NAME = 'timber-trace';\n\n/**\n * `globalThis` key holding the dev await wrapper. The dev await transform\n * (`plugins/dev-await.ts`) rewrites `await x` in app server code to call\n * it, looked up at call time; dev tracing installs it. With nothing\n * installed the call is a plain await. See design/50-dev-request-pill.md\n * §\"Phase 2\".\n */\nexport const DEV_AWAIT_KEY = Symbol.for('timber.dev.await');\n\n/** Span name for one awaited call in app server code. */\nexport const AWAIT_SPAN_NAME = 'timber.await';\n\n/**\n * Set on an await span that waited on work started elsewhere: a promise\n * another await already took (React's `cache()`), or one made before the\n * await began (`const p = load(); … await p`). The work's own spans nest\n * where it started, so the wait adds no new information when they exist.\n */\nexport const AWAIT_WAIT_ATTRIBUTE = 'timber.await_wait';\n\n/**\n * Await spans shorter than this are dropped before they reach the terminal\n * tree or the pill: `await params` and other awaits of settled values would\n * otherwise drown the I/O the spans exist to show.\n */\nexport const AWAIT_SPAN_MIN_MS = 1;\n\n/** Span name for one dev-instrumented `fetch()`, ended when headers arrive. */\nexport const FETCH_SPAN_NAME = 'timber.fetch';\n\n/**\n * Span name for reading a fetched response's body (`.text()`, `.json()`,\n * …), a child of the fetch span. The fetch span ends at headers, so without\n * it a slow body read showed only as the `await res.text()` that waited on it.\n */\nexport const FETCH_BODY_SPAN_NAME = 'timber.fetch.body';\n\n/** Root span of every pipeline request. */\nexport const ROOT_SPAN_NAME = 'http.server.request';\n\n/**\n * The span attributes that may reach the browser — the ones the pill reads,\n * and nothing else. An allowlist of keys, not of prefixes: a prefix let\n * through `timber.fetch_error` (an error message that can quote a full URL)\n * and user attributes such as `url.full` or\n * `http.request.header.authorization`. Typing the payload with this list\n * means the pill cannot read an attribute that isn't on it.\n */\nexport const DEV_SPAN_ATTRIBUTES = [\n 'http.request.method',\n 'http.response.status_code',\n /** Query and fragment stripped. */\n 'http.url',\n /** Query and fragment stripped. */\n 'url.path',\n 'timber.route',\n 'timber.segment',\n 'timber.slot',\n 'timber.action_name',\n 'timber.cache_status',\n /** The awaited expression's source text, whitespace collapsed, truncated. */\n 'timber.await_label',\n /** `path/relative/to/root.ts:line` of the await. */\n 'timber.await_location',\n /** See `AWAIT_WAIT_ATTRIBUTE`. */\n 'timber.await_wait',\n] as const;\n\nexport type DevSpanAttribute = (typeof DEV_SPAN_ATTRIBUTES)[number];\n\n/** Attributes that hold a URL; sent without query or fragment. */\nexport const DEV_SPAN_URL_ATTRIBUTES: ReadonlySet<DevSpanAttribute> = new Set([\n 'http.url',\n 'url.path',\n]);\n\nexport type DevSpanSink = (span: DevSpanPayload) => void;\n\n/** One finished span, projected for the browser. */\nexport interface DevSpanPayload {\n traceId: string;\n spanId: string;\n /** Absent for the root span. */\n parentSpanId?: string;\n name: string;\n /** Epoch milliseconds. */\n startMs: number;\n /** Epoch milliseconds. */\n endMs: number;\n error: boolean;\n /** Only `DEV_SPAN_ATTRIBUTES`; URLs without query or fragment. */\n attributes: Partial<Record<DevSpanAttribute, string | number | boolean>>;\n /** Names of `timber.*` span events, e.g. `timber.cache.hit`. */\n events: string[];\n}\n\n/**\n * Read the trace ID from `Server-Timing` metrics, either a raw header value\n * or the `serverTiming` entries of a `PerformanceResourceTiming`.\n */\nexport function traceIdFromServerTiming(\n timing: string | null | readonly { name: string; description: string }[]\n): string | null {\n if (timing == null) return null;\n if (typeof timing !== 'string') {\n return timing.find((t) => t.name === TRACE_TIMING_NAME)?.description || null;\n }\n // `timber-trace;desc=\"<32 hex>\"` — the ID is hex, so no escaping to undo.\n const match = new RegExp(`(?:^|,)\\\\s*${TRACE_TIMING_NAME}\\\\s*;\\\\s*desc=\"?([0-9a-f]+)\"?`).exec(\n timing\n );\n return match?.[1] ?? null;\n}\n\n/** The `Server-Timing` entry that carries a trace ID. */\nexport function traceTimingEntry(traceId: string): string {\n return `${TRACE_TIMING_NAME};desc=\"${traceId}\"`;\n}\n\n// ─── Labels ─────────────────────────────────────────────────────────────────\n\n/** Span attributes as either side holds them (OTEL also allows arrays). */\ntype SpanAttributes = Readonly<Record<string, unknown>>;\n\n/** `@slot ` for a span from a parallel slot, so it reads apart from the main route. */\nfunction slotPrefix(attrs: SpanAttributes): string {\n const slot = attrs['timber.slot'];\n return slot ? `${String(slot)} ` : '';\n}\n\n/**\n * A fetch URL as the terminal tree and the pill show it: without its scheme,\n * which is `https://` for nearly every fetch and only makes the line longer\n * (TIM-1631).\n */\nexport function fetchDisplayUrl(url: string): string {\n return url.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, '');\n}\n\n/**\n * Map a span to its display label and environment tag. One mapping for the\n * terminal tree and the dev request pill, so the two never name a span\n * differently.\n */\nexport function devSpanLabel(name: string, attrs: SpanAttributes): { label: string; env: string } {\n switch (name) {\n case ROOT_SPAN_NAME: {\n const method = attrs['http.request.method'] ?? 'GET';\n const path = attrs['url.path'] ?? '/';\n return { label: `${String(method)} ${String(path)}`, env: 'rsc' };\n }\n case 'timber.proxy':\n return { label: 'proxy.ts', env: 'proxy' };\n case 'timber.middleware':\n return { label: 'middleware.ts', env: 'rsc' };\n case 'timber.render':\n return { label: 'render', env: 'rsc' };\n case 'timber.access': {\n const seg = attrs['timber.segment'] ?? 'segment';\n return { label: `AccessGate (${String(seg)})`, env: 'rsc' };\n }\n case 'timber.ssr':\n return { label: 'hydration render', env: 'ssr' };\n case 'timber.action': {\n const actionName = attrs['timber.action_name'] ?? 'action';\n return { label: String(actionName), env: 'rsc' };\n }\n case 'timber.metadata':\n return { label: 'metadata()', env: 'rsc' };\n case 'timber.layout': {\n const seg = attrs['timber.segment'] ?? '/';\n return { label: `layout ${slotPrefix(attrs)}${String(seg)}`, env: 'rsc' };\n }\n case 'timber.page': {\n const route = attrs['timber.route'] ?? '/';\n return { label: `page ${slotPrefix(attrs)}${String(route)}`, env: 'rsc' };\n }\n case AWAIT_SPAN_NAME:\n // A wait on work started elsewhere — no new work under it.\n return {\n label: `await ${String(attrs['timber.await_label'] ?? '')}${attrs[AWAIT_WAIT_ATTRIBUTE] === true ? ' (wait)' : ''}`,\n env: 'await',\n };\n case FETCH_BODY_SPAN_NAME:\n return { label: 'response body', env: 'fetch' };\n case FETCH_SPAN_NAME: {\n const fetchMethod = attrs['http.request.method'] ?? 'GET';\n const fetchUrl = attrs['http.url'] ?? '';\n return {\n label: `fetch ${String(fetchMethod)} ${fetchDisplayUrl(String(fetchUrl))}`,\n env: 'fetch',\n };\n }\n default:\n return { label: name, env: 'rsc' };\n }\n}\n"],"mappings":";;;;;;;;;;;AAwDA,IAAa,uBAAsC;CACjD,KAAK,CAAC;CACN,IAAI,CAAC;CACL,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,qBAAqB,CAAC;AACxB;;;;;;;AAcA,SAAgB,gBAAgB,UAA8B,UAAmC;CAC/F,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,IAAI,KAAK;EACnC,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;AAUA,SAAgB,kBACd,UACA,UACqB;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,QAAQ,SAAS,MAAM,KAAK;EAClC,IAAI,CAAC,OAAO;EACZ,KAAK,MAAM,SAAS,OAClB,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,GAAG;GACzB,KAAK,IAAI,MAAM,IAAI;GACnB,OAAO,KAAK,KAAK;EACnB;CAEJ;CAGF,OAAO;AACT;;;;;;;AAyBA,SAAgB,2BACd,UACA,UACU;CACV,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,cAAc,KAAK;EAC7C,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;;;;;;ACnKA,IAAa,iBAAiB;;AAG9B,IAAa,wBAAwB;;;;;;AAOrC,IAAa,oBAAoB,OAAO,IAAI,sBAAsB;;AAGlE,IAAa,oBAAoB;;AAqHjC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,GAAG,kBAAkB,SAAS,QAAQ;AAC/C"}
|
|
@@ -123,7 +123,7 @@ function assertValidCookieValue(name, value) {
|
|
|
123
123
|
const end = wrapped ? value.length - 1 : value.length;
|
|
124
124
|
for (let i = start; i < end; i++) if (!isCookieOctet(value.charCodeAt(i))) throw new Error(`[timber] cookie ${JSON.stringify(name)}: invalid cookie value — disallowed character ${describeChar(value, i)} at index ${i}. Cookie values must contain only RFC 6265 §4.1.1 cookie-octet bytes (US-ASCII printable, excluding whitespace, \`"\`, \`,\`, \`;\`, and \`\\\`), optionally enclosed in a single DQUOTE pair. Encode the value (e.g. encodeURIComponent or jsonCookieCodec) before storing it.`);
|
|
125
125
|
}
|
|
126
|
-
// ../../node_modules/.pnpm/cookie@2.0.
|
|
126
|
+
// ../../node_modules/.pnpm/cookie@2.0.2/node_modules/cookie/dist/index.js
|
|
127
127
|
/**
|
|
128
128
|
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
129
129
|
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
@@ -153,6 +153,10 @@ var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
|
153
153
|
*/
|
|
154
154
|
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
155
155
|
/**
|
|
156
|
+
* RegExp to match invalid cookie values to be encoded, including `%` for roundtrip safety.
|
|
157
|
+
*/
|
|
158
|
+
var cookieOctetInvalidRegExp = /[\u0000-\u0020\u007F-\uFFFF",;\\%]/;
|
|
159
|
+
/**
|
|
156
160
|
* RegExp to match domain-value in RFC 6265 sec 4.1.1
|
|
157
161
|
*
|
|
158
162
|
* domain-value = <subdomain>
|
|
@@ -188,10 +192,6 @@ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
|
188
192
|
* RegExp to match max-age-value in RFC 6265 sec 5.6.2
|
|
189
193
|
*/
|
|
190
194
|
var maxAgeRegExp = /^-?\d+$/;
|
|
191
|
-
/**
|
|
192
|
-
* RegExp to match RFC 6265 cookie-octet values (without % to preserve roundtrip) that need no URL encoding.
|
|
193
|
-
*/
|
|
194
|
-
var cookieOctetRegExp = /^[!#$&'()*+\-.\/0-9:<=>?@A-Z[\]\^_`a-z{|}~]*$/;
|
|
195
195
|
var NullObject = /* @__PURE__ */ (() => {
|
|
196
196
|
const C = function() {};
|
|
197
197
|
C.prototype = Object.create(null);
|
|
@@ -207,7 +207,7 @@ function parseCookie(str, options) {
|
|
|
207
207
|
const obj = new NullObject();
|
|
208
208
|
const len = str.length;
|
|
209
209
|
if (len < 2) return obj;
|
|
210
|
-
const dec = options?.decode
|
|
210
|
+
const dec = options?.decode ?? defaultDecode;
|
|
211
211
|
let index = 0;
|
|
212
212
|
do {
|
|
213
213
|
const eqIdx = eqIndex(str, index, len);
|
|
@@ -233,25 +233,26 @@ function parseCookie(str, options) {
|
|
|
233
233
|
* => "foo=bar; HttpOnly"
|
|
234
234
|
*/
|
|
235
235
|
function stringifySetCookie(cookie, options) {
|
|
236
|
-
const enc = options?.encode
|
|
237
|
-
if (!cookieNameRegExp.test(cookie.name)) throw new TypeError(`
|
|
236
|
+
const enc = options?.encode ?? defaultEncode;
|
|
237
|
+
if (!cookieNameRegExp.test(cookie.name)) throw new TypeError(`cookie name is invalid: ${cookie.name}`);
|
|
238
238
|
const value = cookie.value == null ? "" : enc(cookie.value);
|
|
239
|
-
if (!cookieValueRegExp.test(value)) throw new TypeError(`
|
|
239
|
+
if (enc !== defaultEncode && !cookieValueRegExp.test(value)) throw new TypeError(`cookie value is invalid: ${cookie.value}`);
|
|
240
240
|
let str = cookie.name + "=" + value;
|
|
241
241
|
if (cookie.maxAge !== void 0) {
|
|
242
|
-
if (!Number.
|
|
242
|
+
if (!Number.isSafeInteger(cookie.maxAge)) throw new TypeError(`cookie maxAge is invalid: ${cookie.maxAge}`);
|
|
243
243
|
str += "; Max-Age=" + cookie.maxAge;
|
|
244
244
|
}
|
|
245
245
|
if (cookie.domain) {
|
|
246
|
-
if (!domainValueRegExp.test(cookie.domain)) throw new TypeError(`
|
|
246
|
+
if (!domainValueRegExp.test(cookie.domain)) throw new TypeError(`cookie domain is invalid: ${cookie.domain}`);
|
|
247
247
|
str += "; Domain=" + cookie.domain;
|
|
248
248
|
}
|
|
249
249
|
if (cookie.path) {
|
|
250
|
-
if (!pathValueRegExp.test(cookie.path)) throw new TypeError(`
|
|
250
|
+
if (!pathValueRegExp.test(cookie.path)) throw new TypeError(`cookie path is invalid: ${cookie.path}`);
|
|
251
251
|
str += "; Path=" + cookie.path;
|
|
252
252
|
}
|
|
253
253
|
if (cookie.expires) {
|
|
254
|
-
|
|
254
|
+
const year = cookie.expires.getUTCFullYear();
|
|
255
|
+
if (!(year >= 1601 && year <= 9999)) throw new TypeError(`cookie expires is invalid: ${cookie.expires}`);
|
|
255
256
|
str += "; Expires=" + cookie.expires.toUTCString();
|
|
256
257
|
}
|
|
257
258
|
if (cookie.httpOnly) str += "; HttpOnly";
|
|
@@ -267,7 +268,7 @@ function stringifySetCookie(cookie, options) {
|
|
|
267
268
|
case "high":
|
|
268
269
|
str += "; Priority=High";
|
|
269
270
|
break;
|
|
270
|
-
default: throw new TypeError(`
|
|
271
|
+
default: throw new TypeError(`cookie priority is invalid: ${cookie.priority}`);
|
|
271
272
|
}
|
|
272
273
|
if (cookie.sameSite) switch (typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite) {
|
|
273
274
|
case true:
|
|
@@ -280,7 +281,7 @@ function stringifySetCookie(cookie, options) {
|
|
|
280
281
|
case "none":
|
|
281
282
|
str += "; SameSite=None";
|
|
282
283
|
break;
|
|
283
|
-
default: throw new TypeError(`
|
|
284
|
+
default: throw new TypeError(`cookie sameSite is invalid: ${cookie.sameSite}`);
|
|
284
285
|
}
|
|
285
286
|
return str;
|
|
286
287
|
}
|
|
@@ -291,7 +292,7 @@ function stringifySetCookie(cookie, options) {
|
|
|
291
292
|
* => { name: 'foo', value: 'bar', httpOnly: true }
|
|
292
293
|
*/
|
|
293
294
|
function parseSetCookie(str, options) {
|
|
294
|
-
const dec = options?.decode
|
|
295
|
+
const dec = options?.decode ?? defaultDecode;
|
|
295
296
|
const len = str.length;
|
|
296
297
|
const endIdx = endIndex(str, 0, len);
|
|
297
298
|
let eqIdx = eqIndex(str, 0, len);
|
|
@@ -381,7 +382,7 @@ function valueSlice(str, min, max) {
|
|
|
381
382
|
/**
|
|
382
383
|
* URL-decode string value. Optimized to skip native call when no %.
|
|
383
384
|
*/
|
|
384
|
-
function
|
|
385
|
+
function defaultDecode(str) {
|
|
385
386
|
if (str.indexOf("%") === -1) return str;
|
|
386
387
|
try {
|
|
387
388
|
return decodeURIComponent(str);
|
|
@@ -393,8 +394,8 @@ function decode(str) {
|
|
|
393
394
|
* URL-encode string value. Optimized to skip native call for roundtrip-safe cookie-octet values.
|
|
394
395
|
*/
|
|
395
396
|
function defaultEncode(str) {
|
|
396
|
-
return
|
|
397
|
+
return cookieOctetInvalidRegExp.test(str) ? encodeURIComponent(str) : str;
|
|
397
398
|
}
|
|
398
399
|
export { assertValidCookieOptions as a, assertValidCookieName as i, parseSetCookie as n, assertValidCookieValue as o, stringifySetCookie as r, COOKIE_READ_THROUGH as s, parseCookie as t };
|
|
399
400
|
|
|
400
|
-
//# sourceMappingURL=dist-
|
|
401
|
+
//# sourceMappingURL=dist-ob734WH3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-ob734WH3.js","names":[],"sources":["../../src/shared/cookie-read-through.ts","../../src/cookies/validation.ts","../../../../node_modules/.pnpm/cookie@2.0.2/node_modules/cookie/dist/index.js"],"sourcesContent":["/**\n * How a typed cookie definition reads its raw value on the server: through\n * the cookie jar, naming the codec it parses with.\n *\n * A `'document'` segment's key holds a cookie's *parsed* value\n * (design/53-segment-lifetime.md §\"Segment keys\"), so the read rule allows a\n * keyed cookie only when it is read through the key's own definition. A raw\n * read sees differences the codec hides: `theme=purple` and `theme=light` key\n * the same, but a raw read shows them apart, so it would freeze. The jar's\n * public `get()` is that raw read; `defineCookie().get()` uses this method.\n *\n * A symbol, so it is not part of the jar's public surface. Isomorphic: no\n * server or client imports (cookies/define-cookie.ts runs in both).\n */\nexport const COOKIE_READ_THROUGH = Symbol.for('timber.cookie-read-through');\n\n/** Read a cookie's raw value for a definition that parses it with `codec`. */\nexport type CookieReadThrough = (name: string, codec: unknown) => string | undefined;\n","/**\n * Cookie name and value validation per RFC 6265 §4.1.1.\n *\n * This module is pure — no server or client imports — so it can be loaded\n * by both `server/request-context.ts` (which guards `getCookies().set()`)\n * and `client/use-cookie.ts` (which guards `useCookie()`'s setter). The\n * shared validator gives both sides identical encoding contracts:\n * **the framework never silently encodes — callers emit `cookie-octet`\n * bytes or get a developer-facing error.**\n *\n * Why this matters: see ONGOING_SECURITY.md H-3 (TIM-868) and\n * design/29-cookies.md §\"Cookie Name and Value Validation\".\n */\n\n// ─── RFC 6265 cookie-octet ────────────────────────────────────────────────\n//\n// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n//\n// Equivalently: US-ASCII printable bytes excluding whitespace, `\"` (0x22),\n// `,` (0x2C), `;` (0x3B), `\\` (0x5C), and DEL (0x7F).\n\n/**\n * RFC 7230 §3.2.6 token characters used as the cookie-name production in\n * RFC 6265 §4.1.1. Anchored, non-empty match.\n *\n * Allowed: US-ASCII letters, digits, and `!#$%&'*+-.^_` `` ` `` `|~`.\n * Disallowed: whitespace, controls, delimiters\n * (`(` `)` `<` `>` `@` `,` `;` `:` `\\` `\"` `/` `[` `]` `?` `=` `{` `}`).\n */\nconst COOKIE_NAME_RE = /^[!#$%&'*+\\-.0-9A-Z^_`a-z|~]+$/;\n\n/**\n * Format a single byte for a clear error message — escape control bytes\n * and non-ASCII as `0x..` and quote printables.\n */\nfunction describeChar(value: string, index: number): string {\n const code = value.charCodeAt(index);\n if (code < 0x20 || code === 0x7f || code > 0x7e) {\n return `0x${code.toString(16).padStart(2, '0')}`;\n }\n return JSON.stringify(value[index]);\n}\n\n/**\n * Validate a cookie name against RFC 6265 §4.1.1 / RFC 7230 token rules.\n * Throws a developer-facing error naming the offending byte and its index.\n */\nexport function assertValidCookieName(name: string): void {\n if (typeof name !== 'string' || name.length === 0) {\n throw new Error('[timber] cookie name must be a non-empty string.');\n }\n if (!COOKIE_NAME_RE.test(name)) {\n for (let i = 0; i < name.length; i++) {\n if (!COOKIE_NAME_RE.test(name[i])) {\n throw new Error(\n `[timber] invalid cookie name ${JSON.stringify(name)} — ` +\n `disallowed character ${describeChar(name, i)} at index ${i}. ` +\n `Cookie names must match the RFC 6265 §4.1.1 token grammar (US-ASCII letters, digits, ` +\n `and \\`!#$%&'*+-.^_\\`|~\\`; no whitespace, controls, or delimiters).`\n );\n }\n }\n throw new Error(\n `[timber] invalid cookie name ${JSON.stringify(name)} — ` +\n `must match RFC 6265 §4.1.1 token grammar.`\n );\n }\n}\n\n/** Single-byte test for RFC 6265 §4.1.1 cookie-octet. */\nfunction isCookieOctet(code: number): boolean {\n return (\n code === 0x21 ||\n (code >= 0x23 && code <= 0x2b) ||\n (code >= 0x2d && code <= 0x3a) ||\n (code >= 0x3c && code <= 0x5b) ||\n (code >= 0x5d && code <= 0x7e)\n );\n}\n\n/**\n * Validate a cookie value against the RFC 6265 §4.1.1 `cookie-value`\n * production:\n *\n * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )\n * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n *\n * Both the bare `*cookie-octet` form and the DQUOTE-wrapped form are\n * valid. The wrapped form is common in upstream `Set-Cookie` headers\n * (e.g. `sid=\"abc\"; Path=/`) and must be forwardable through\n * `setFromHeaders` verbatim — stripping or rejecting the surrounding\n * quotes would corrupt the on-the-wire bytes and break value semantics\n * for the upstream service.\n *\n * Excluded bytes (in either form): CTL, whitespace (CR/LF/TAB/SP),\n * interior DQUOTE, comma, semicolon, backslash, DEL, and anything\n * non-ASCII. The smuggling primitive (`;`) is rejected regardless of\n * wrapping.\n *\n * Throws a developer-facing error naming the offending byte and its\n * index. Callers passing user-controlled data through the default\n * `set()` path don't need to call this — `set()` auto-encodes via\n * `encodeURIComponent`, whose output is always valid cookie-octet.\n * This validator is for the `{ raw: true }` opt-out and for\n * `setFromHeaders` forwarding.\n */\n// ─── Cookie attribute validation ──────────────────────────────────────────\n\n/**\n * Characters that must not appear in path or domain cookie attributes.\n * Semicolons delimit cookie attributes on the wire, so allowing `;` in\n * path or domain would inject extra attributes. CR/LF enable HTTP header\n * injection.\n */\nconst ATTR_INJECTION_RE = /[;\\r\\n]/;\n\nconst VALID_SAME_SITE = new Set(['strict', 'lax', 'none']);\n\n/**\n * Validate cookie option attributes at runtime to prevent Set-Cookie\n * header injection through unsanitized option values.\n *\n * TypeScript types enforce correct shapes at compile time, but at runtime\n * (e.g. from untyped libraries or user-controlled config) invalid values\n * could inject additional Set-Cookie attributes.\n */\nexport function assertValidCookieOptions(options: {\n sameSite?: string;\n path?: string;\n domain?: string;\n maxAge?: number;\n}): void {\n if (options.sameSite !== undefined) {\n const lower = options.sameSite.toLowerCase();\n if (!VALID_SAME_SITE.has(lower)) {\n throw new Error(\n `[timber] invalid cookie sameSite value ${JSON.stringify(options.sameSite)} — ` +\n `must be 'strict', 'lax', or 'none'.`\n );\n }\n }\n if (options.path !== undefined && ATTR_INJECTION_RE.test(options.path)) {\n throw new Error(\n `[timber] invalid cookie path ${JSON.stringify(options.path)} — ` +\n `path must not contain ';', CR, or LF (Set-Cookie header injection).`\n );\n }\n if (options.domain !== undefined && ATTR_INJECTION_RE.test(options.domain)) {\n throw new Error(\n `[timber] invalid cookie domain ${JSON.stringify(options.domain)} — ` +\n `domain must not contain ';', CR, or LF (Set-Cookie header injection).`\n );\n }\n if (\n options.maxAge !== undefined &&\n (typeof options.maxAge !== 'number' || !Number.isFinite(options.maxAge))\n ) {\n throw new Error(\n `[timber] invalid cookie maxAge ${JSON.stringify(options.maxAge)} — ` +\n `maxAge must be a finite number.`\n );\n }\n}\n\nexport function assertValidCookieValue(name: string, value: string): void {\n if (typeof value !== 'string') {\n throw new Error(`[timber] cookie ${JSON.stringify(name)}: cookie value must be a string.`);\n }\n // Detect the DQUOTE-wrapped form: at least two characters and both\n // endpoints are `\"`. The interior must be pure cookie-octet (no\n // interior DQUOTEs allowed — the grammar says *cookie-octet, and\n // cookie-octet excludes 0x22).\n const wrapped =\n value.length >= 2 &&\n value.charCodeAt(0) === 0x22 &&\n value.charCodeAt(value.length - 1) === 0x22;\n const start = wrapped ? 1 : 0;\n const end = wrapped ? value.length - 1 : value.length;\n for (let i = start; i < end; i++) {\n const code = value.charCodeAt(i);\n if (!isCookieOctet(code)) {\n throw new Error(\n `[timber] cookie ${JSON.stringify(name)}: invalid cookie value — ` +\n `disallowed character ${describeChar(value, i)} at index ${i}. ` +\n `Cookie values must contain only RFC 6265 §4.1.1 cookie-octet bytes ` +\n `(US-ASCII printable, excluding whitespace, \\`\"\\`, \\`,\\`, \\`;\\`, and \\`\\\\\\`), ` +\n `optionally enclosed in a single DQUOTE pair. ` +\n `Encode the value (e.g. encodeURIComponent or jsonCookieCodec) before storing it.`\n );\n }\n }\n}\n","/**\n * RegExp to match cookie-name in RFC 6265 sec 4.1.1\n * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2\n * which has been replaced by the token definition in RFC 7230 appendix B.\n *\n * cookie-name = token\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" /\n * \"*\" / \"+\" / \"-\" / \".\" / \"^\" / \"_\" /\n * \"`\" / \"|\" / \"~\" / DIGIT / ALPHA\n *\n * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191\n * Allow same range as cookie value, except `=`, which delimits end of name.\n */\nconst cookieNameRegExp = /^[\\u0021-\\u003A\\u003C\\u003E-\\u007E]+$/;\n/**\n * RegExp to match cookie-value in RFC 6265 sec 4.1.1\n *\n * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )\n * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n * ; US-ASCII characters excluding CTLs,\n * ; whitespace DQUOTE, comma, semicolon,\n * ; and backslash\n *\n * Allowing more characters: https://github.com/jshttp/cookie/issues/191\n * Comma, backslash, and DQUOTE are not part of the parsing algorithm.\n */\nconst cookieValueRegExp = /^[\\u0021-\\u003A\\u003C-\\u007E]*$/;\n/**\n * RegExp to match invalid cookie values to be encoded, including `%` for roundtrip safety.\n */\nconst cookieOctetInvalidRegExp = /[\\u0000-\\u0020\\u007F-\\uFFFF\",;\\\\%]/;\n/**\n * RegExp to match domain-value in RFC 6265 sec 4.1.1\n *\n * domain-value = <subdomain>\n * ; defined in [RFC1034], Section 3.5, as\n * ; enhanced by [RFC1123], Section 2.1\n * <subdomain> = <label> | <subdomain> \".\" <label>\n * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]\n * Labels must be 63 characters or less.\n * 'let-dig' not 'letter' in the first char, per RFC1123\n * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>\n * <let-dig-hyp> = <let-dig> | \"-\"\n * <let-dig> = <letter> | <digit>\n * <letter> = any one of the 52 alphabetic characters A through Z in\n * upper case and a through z in lower case\n * <digit> = any one of the ten digits 0 through 9\n *\n * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173\n *\n * > (Note that a leading %x2E (\".\"), if present, is ignored even though that\n * character is not permitted, but a trailing %x2E (\".\"), if present, will\n * cause the user agent to ignore the attribute.)\n */\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;\n/**\n * RegExp to match path-value in RFC 6265 sec 4.1.1\n *\n * path-value = <any CHAR except CTLs or \";\">\n * CHAR = %x01-7F\n * ; defined in RFC 5234 appendix B.1\n */\nconst pathValueRegExp = /^[\\u0020-\\u003A\\u003D-\\u007E]*$/;\n/**\n * RegExp to match max-age-value in RFC 6265 sec 5.6.2\n */\nconst maxAgeRegExp = /^-?\\d+$/;\nconst NullObject = /* @__PURE__ */ (() => {\n const C = function () { };\n C.prototype = Object.create(null);\n return C;\n})();\n/**\n * Parse a `Cookie` header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n */\nexport function parseCookie(str, options) {\n const obj = new NullObject();\n const len = str.length;\n // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.\n if (len < 2)\n return obj;\n const dec = options?.decode ?? defaultDecode;\n let index = 0;\n do {\n const eqIdx = eqIndex(str, index, len);\n if (eqIdx === len)\n break; // No more cookie pairs.\n const endIdx = endIndex(str, index, len);\n if (eqIdx > endIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(\";\", eqIdx - 1) + 1;\n continue;\n }\n const key = valueSlice(str, index, eqIdx);\n // only assign once\n if (obj[key] === undefined) {\n obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));\n }\n index = endIdx + 1;\n } while (index < len);\n return obj;\n}\n/**\n * Stringifies an object into an HTTP `Cookie` header.\n */\nexport function stringifyCookie(cookie, options) {\n const enc = options?.encode ?? defaultEncode;\n const keys = Object.keys(cookie);\n let str = \"\";\n for (let i = 0; i < keys.length; i++) {\n const name = keys[i];\n const val = cookie[name];\n if (val === undefined)\n continue;\n if (!cookieNameRegExp.test(name)) {\n throw new TypeError(`cookie name is invalid: ${name}`);\n }\n const value = enc(val);\n if (enc !== defaultEncode && !cookieValueRegExp.test(value)) {\n throw new TypeError(`cookie value is invalid: ${val}`);\n }\n if (str)\n str += \"; \";\n str += name + \"=\" + value;\n }\n return str;\n}\n/**\n * Serialize data into a cookie header.\n *\n * Serialize a name value pair into a cookie string suitable for\n * http headers. An optional options object specifies cookie parameters.\n *\n * stringifySetCookie({ name: 'foo', value: 'bar', httpOnly: true })\n * => \"foo=bar; HttpOnly\"\n */\nexport function stringifySetCookie(cookie, options) {\n const enc = options?.encode ?? defaultEncode;\n if (!cookieNameRegExp.test(cookie.name)) {\n throw new TypeError(`cookie name is invalid: ${cookie.name}`);\n }\n const value = cookie.value == null ? \"\" : enc(cookie.value);\n if (enc !== defaultEncode && !cookieValueRegExp.test(value)) {\n throw new TypeError(`cookie value is invalid: ${cookie.value}`);\n }\n let str = cookie.name + \"=\" + value;\n if (cookie.maxAge !== undefined) {\n if (!Number.isSafeInteger(cookie.maxAge)) {\n throw new TypeError(`cookie maxAge is invalid: ${cookie.maxAge}`);\n }\n str += \"; Max-Age=\" + cookie.maxAge;\n }\n if (cookie.domain) {\n if (!domainValueRegExp.test(cookie.domain)) {\n throw new TypeError(`cookie domain is invalid: ${cookie.domain}`);\n }\n str += \"; Domain=\" + cookie.domain;\n }\n if (cookie.path) {\n if (!pathValueRegExp.test(cookie.path)) {\n throw new TypeError(`cookie path is invalid: ${cookie.path}`);\n }\n str += \"; Path=\" + cookie.path;\n }\n if (cookie.expires) {\n const year = cookie.expires.getUTCFullYear();\n if (!(year >= 1601 && year <= 9999)) {\n throw new TypeError(`cookie expires is invalid: ${cookie.expires}`);\n }\n str += \"; Expires=\" + cookie.expires.toUTCString();\n }\n if (cookie.httpOnly) {\n str += \"; HttpOnly\";\n }\n if (cookie.secure) {\n str += \"; Secure\";\n }\n if (cookie.partitioned) {\n str += \"; Partitioned\";\n }\n if (cookie.priority) {\n const priority = typeof cookie.priority === \"string\"\n ? cookie.priority.toLowerCase()\n : undefined;\n switch (priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n default:\n throw new TypeError(`cookie priority is invalid: ${cookie.priority}`);\n }\n }\n if (cookie.sameSite) {\n const sameSite = typeof cookie.sameSite === \"string\"\n ? cookie.sameSite.toLowerCase()\n : cookie.sameSite;\n switch (sameSite) {\n case true:\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n default:\n throw new TypeError(`cookie sameSite is invalid: ${cookie.sameSite}`);\n }\n }\n return str;\n}\n/**\n * Deserialize a `Set-Cookie` header into an object.\n *\n * parseSetCookie('foo=bar; HttpOnly')\n * => { name: 'foo', value: 'bar', httpOnly: true }\n */\nexport function parseSetCookie(str, options) {\n const dec = options?.decode ?? defaultDecode;\n const len = str.length;\n const endIdx = endIndex(str, 0, len);\n let eqIdx = eqIndex(str, 0, len);\n const setCookie = eqIdx < endIdx\n ? {\n name: valueSlice(str, 0, eqIdx),\n value: dec(valueSlice(str, eqIdx + 1, endIdx)),\n }\n : { name: \"\", value: dec(valueSlice(str, 0, endIdx)) };\n let index = endIdx + 1;\n while (index < len) {\n const endIdx = endIndex(str, index, len);\n if (eqIdx < index)\n eqIdx = eqIndex(str, index, len);\n const attr = eqIdx < endIdx\n ? valueSlice(str, index, eqIdx)\n : valueSlice(str, index, endIdx);\n const val = eqIdx < endIdx ? valueSlice(str, eqIdx + 1, endIdx) : undefined;\n switch (attr.toLowerCase()) {\n case \"httponly\":\n setCookie.httpOnly = true;\n break;\n case \"secure\":\n setCookie.secure = true;\n break;\n case \"partitioned\":\n setCookie.partitioned = true;\n break;\n case \"domain\":\n setCookie.domain = val;\n break;\n case \"path\":\n setCookie.path = val;\n break;\n case \"max-age\":\n if (val && maxAgeRegExp.test(val))\n setCookie.maxAge = Number(val);\n break;\n case \"expires\":\n if (!val)\n break;\n const date = new Date(val);\n if (Number.isFinite(date.valueOf()))\n setCookie.expires = date;\n break;\n case \"priority\":\n if (!val)\n break;\n const priority = val.toLowerCase();\n if (priority === \"low\" ||\n priority === \"medium\" ||\n priority === \"high\") {\n setCookie.priority = priority;\n }\n break;\n case \"samesite\":\n if (!val)\n break;\n const sameSite = val.toLowerCase();\n if (sameSite === \"lax\" ||\n sameSite === \"strict\" ||\n sameSite === \"none\") {\n setCookie.sameSite = sameSite;\n }\n break;\n }\n index = endIdx + 1;\n }\n return setCookie;\n}\n/**\n * Find the next `;` character, or return `len`.\n */\nfunction endIndex(str, min, len) {\n const index = str.indexOf(\";\", min);\n return index === -1 ? len : index;\n}\n/**\n * Find the next `=` character, or return `len`.\n */\nfunction eqIndex(str, min, len) {\n const index = str.indexOf(\"=\", min);\n return index === -1 ? len : index;\n}\n/**\n * Slice out a value between startPod to max.\n */\nfunction valueSlice(str, min, max) {\n if (min === max)\n return \"\";\n let start = min;\n let end = max;\n do {\n const code = str.charCodeAt(start);\n if (code !== 32 /* */ && code !== 9 /* \\t */)\n break;\n } while (++start < end);\n while (end > start) {\n const code = str.charCodeAt(end - 1);\n if (code !== 32 /* */ && code !== 9 /* \\t */)\n break;\n end--;\n }\n return str.slice(start, end);\n}\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n */\nfunction defaultDecode(str) {\n if (str.indexOf(\"%\") === -1)\n return str;\n try {\n return decodeURIComponent(str);\n }\n catch (e) {\n return str;\n }\n}\n/**\n * URL-encode string value. Optimized to skip native call for roundtrip-safe c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AAa,SACb,aAAa,YACb,aAAa,QACb,UAAU,WAAW;EAGjC;EACA,QAAQ,SAAS;CACrB;CACA,OAAO;AACX;;;;AAIA,SAAS,SAAS,KAAK,KAAK,KAAK;CAC7B,MAAM,QAAQ,IAAI,QAAQ,KAAK,GAAG;CAClC,OAAO,UAAU,KAAK,MAAM;AAChC;;;;AAIA,SAAS,QAAQ,KAAK,KAAK,KAAK;CAC5B,MAAM,QAAQ,IAAI,QAAQ,KAAK,GAAG;CAClC,OAAO,UAAU,KAAK,MAAM;AAChC;;;;AAIA,SAAS,WAAW,KAAK,KAAK,KAAK;CAC/B,IAAI,QAAQ,KACR,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,MAAM;CACV,GAAG;EACC,MAAM,OAAO,IAAI,WAAW,KAAK;EACjC,IAAI,SAAS,MAAc,SAAS,GAChC;CACR,SAAS,EAAE,QAAQ;CACnB,OAAO,MAAM,OAAO;EAChB,MAAM,OAAO,IAAI,WAAW,MAAM,CAAC;EACnC,IAAI,SAAS,MAAc,SAAS,GAChC;EACJ;CACJ;CACA,OAAO,IAAI,MAAM,OAAO,GAAG;AAC/B;;;;AAIA,SAAS,cAAc,KAAK;CACxB,IAAI,IAAI,QAAQ,GAAG,MAAM,IACrB,OAAO;CACX,IAAI;EACA,OAAO,mBAAmB,GAAG;CACjC,SACO,GAAG;EACN,OAAO;CACX;AACJ;;;;AAIA,SAAS,cAAc,KAAK;CACxB,OAAO,yBAAyB,KAAK,GAAG,IAAI,mBAAmB,GAAG,IAAI;AAC1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as createGlobalContext } from "./global-context-DbxNWeBP.js";
|
|
2
|
+
import { _ as statusPageRendered, c as getRouterOrNull, d as _setOnStatusPageRendered, f as _setStatusPageRendered, g as onStatusPageRendered, p as _setUnloading, r as parseRouterUrl, t as setHardNavigating, v as unloading } from "./navigation-root-AuCD35Sv.js";
|
|
3
3
|
import { a as randomRscCacheKey, n as RSC_KEY_PARAM, o as recordLookup, s as rscCacheKey } from "./rsc-cache-key-BGvUtMtN.js";
|
|
4
4
|
import { i as withBasePath, r as stripBasePath } from "./base-path-DDIx0FXe.js";
|
|
5
5
|
import { n as rscPayloadPath } from "./rsc-payload-path-EphpDB-J.js";
|
|
@@ -1281,4 +1281,4 @@ function statusMatches(boundaryStatus, errorStatus) {
|
|
|
1281
1281
|
}
|
|
1282
1282
|
export { createSpaExits as a, createRenderOwner as c, fetchRscPayload as d, createNavigationCommitter as f, createScrollEffects as i, isClientStale as l, readPublishedParams as m, TimberErrorBoundary as n, runAsHandle as o, readPayloadTree as p, createNavigationRecovery as r, recordSkew as s, DenyAncestryContext as t, NonRscResponse as u };
|
|
1283
1283
|
|
|
1284
|
-
//# sourceMappingURL=error-boundary-
|
|
1284
|
+
//# sourceMappingURL=error-boundary-BR21tTQc.js.map
|