@timber-js/app 0.2.0-alpha.125 → 0.2.0-alpha.127

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.
Files changed (42) hide show
  1. package/dist/_chunks/{actions-418ygYKC.js → actions-DX2gkoOZ.js} +2 -2
  2. package/dist/_chunks/{actions-418ygYKC.js.map → actions-DX2gkoOZ.js.map} +1 -1
  3. package/dist/_chunks/{codec-registry-G9hD5LOq.js → codec-registry-DqkeAydt.js} +1 -1
  4. package/dist/_chunks/{codec-registry-G9hD5LOq.js.map → codec-registry-DqkeAydt.js.map} +1 -1
  5. package/dist/_chunks/{define-BJMwm0c4.js → define-DMq-Yjp7.js} +2 -2
  6. package/dist/_chunks/{define-BJMwm0c4.js.map → define-DMq-Yjp7.js.map} +1 -1
  7. package/dist/_chunks/{navigation-root-CeNTCxzS.js → navigation-root-B5-RmsPi.js} +35 -28
  8. package/dist/_chunks/navigation-root-B5-RmsPi.js.map +1 -0
  9. package/dist/_chunks/{use-segment-params-ByGqwUuO.js → use-segment-params-CIeinIx2.js} +2 -32
  10. package/dist/_chunks/{use-segment-params-ByGqwUuO.js.map → use-segment-params-CIeinIx2.js.map} +1 -1
  11. package/dist/_chunks/{walkers-DMSGZeCk.js → walkers-E5ss0qES.js} +7 -5
  12. package/dist/_chunks/walkers-E5ss0qES.js.map +1 -0
  13. package/dist/client/index.js +35 -79
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/client/internal.js +2 -2
  16. package/dist/client/link.d.ts.map +1 -1
  17. package/dist/client/nav-link-store.d.ts +3 -12
  18. package/dist/client/nav-link-store.d.ts.map +1 -1
  19. package/dist/client/navigation-root.d.ts.map +1 -1
  20. package/dist/client/top-loader.d.ts.map +1 -1
  21. package/dist/client/use-pending-navigation.d.ts +3 -6
  22. package/dist/client/use-pending-navigation.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/params/index.js +1 -1
  25. package/dist/routing/codegen-shared.d.ts +5 -2
  26. package/dist/routing/codegen-shared.d.ts.map +1 -1
  27. package/dist/routing/index.js +1 -1
  28. package/dist/segment-params/index.js +1 -1
  29. package/dist/server/index.js +1 -1
  30. package/dist/server/internal.js +18 -3
  31. package/dist/server/internal.js.map +1 -1
  32. package/dist/server/pipeline-outcome.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/client/link.tsx +29 -84
  35. package/src/client/nav-link-store.ts +3 -13
  36. package/src/client/navigation-root.tsx +5 -22
  37. package/src/client/top-loader.tsx +5 -15
  38. package/src/client/use-pending-navigation.ts +18 -16
  39. package/src/routing/codegen-shared.ts +6 -3
  40. package/src/server/pipeline-outcome.ts +23 -2
  41. package/dist/_chunks/navigation-root-CeNTCxzS.js.map +0 -1
  42. package/dist/_chunks/walkers-DMSGZeCk.js.map +0 -1
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { n as setViteServer } from "./_chunks/warnings-B30wpfaS.js";
2
2
  import { a as isDynamicMetadataExtension, o as isMetadataRouteServePath } from "./_chunks/metadata-routes-DESG8uk5.js";
3
3
  import { h as swallow } from "./_chunks/logger-DDmK5skc.js";
4
4
  import { c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as scanRoutes, o as DEFAULT_BUILD_DIR, p as createNoopTimer, s as createPluginContext, u as resolveAppDir } from "./_chunks/cli-schema-sync-DFHBj6yZ.js";
5
- import { a as generateRouteMap, i as collectInterceptionRewrites, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-DMSGZeCk.js";
5
+ import { a as generateRouteMap, i as collectInterceptionRewrites, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-E5ss0qES.js";
6
6
  import { t as formatSize } from "./_chunks/format-BjN9HLu9.js";
7
7
  import { basename, dirname, extname, join, normalize, resolve } from "node:path";
8
8
  import { createRequire } from "node:module";
@@ -1,5 +1,5 @@
1
1
  import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-DU2nbVOi.js";
2
- import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-G9hD5LOq.js";
2
+ import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-DqkeAydt.js";
3
3
  //#region src/params/define-schema.ts
4
4
  /**
5
5
  * Define the global segment param schema.
@@ -48,8 +48,11 @@ export declare function buildCodecChainType(p: ParamEntry, importBase: string |
48
48
  * schema's InferCodecType. Falls back to the param's base type when
49
49
  * schema doesn't declare this param (schemas are opt-in per key).
50
50
  *
51
- * Generates a conditional that checks key existence:
52
- * `[bracketName] extends keyof typeof schema.segmentParams ? InferCodecType<...> : fallback`
51
+ * Uses `infer` to extract the codec value rather than direct indexing
52
+ * because TypeScript doesn't narrow index validity inside a conditional
53
+ * type's true branch — `typeof schema.segmentParams[K]` produces TS2538
54
+ * even when the condition proves K is a valid key. In .d.ts files that
55
+ * error is suppressed and the type silently becomes `any`.
53
56
  */
54
57
  export declare function buildSchemaParamType(p: ParamEntry, fallback?: string): string;
55
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"codegen-shared.d.ts","sourceRoot":"","sources":["../../src/routing/codegen-shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM7F;AAED,sEAAsE;AACtE,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAOtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,UAAU,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,GACf,MAAM,CAaR;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI7E;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAOrF"}
1
+ {"version":3,"file":"codegen-shared.d.ts","sourceRoot":"","sources":["../../src/routing/codegen-shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM7F;AAED,sEAAsE;AACtE,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAOtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,UAAU,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,GACf,MAAM,CAaR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAI7E;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAOrF"}
@@ -1,4 +1,4 @@
1
1
  import { i as INTERCEPTION_MARKERS, n as classifyUrlSegment, r as DEFAULT_PAGE_EXTENSIONS, t as classifySegment } from "../_chunks/segment-classify-BjfuctV2.js";
2
2
  import { m as scanRoutes } from "../_chunks/cli-schema-sync-DFHBj6yZ.js";
3
- import { a as generateRouteMap, i as collectInterceptionRewrites, n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-DMSGZeCk.js";
3
+ import { a as generateRouteMap, i as collectInterceptionRewrites, n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-E5ss0qES.js";
4
4
  export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };
@@ -1,2 +1,2 @@
1
- import { n as defineSegmentParams } from "../_chunks/define-BJMwm0c4.js";
1
+ import { n as defineSegmentParams } from "../_chunks/define-DMq-Yjp7.js";
2
2
  export { defineSegmentParams };
@@ -1,6 +1,6 @@
1
1
  import { a as getSpanId, d as withSpan, o as getTraceId, p as formFlashAls, t as addSpanEvent, v as isDebug, y as isDevMode } from "../_chunks/tracing-DvKLzCFa.js";
2
2
  import { t as formatSize } from "../_chunks/format-BjN9HLu9.js";
3
- import { D as getCookieJar, a as revalidateTag, b as getSegmentParams, c as DenySignal, f as deny, h as waitUntil, i as revalidatePath, l as RedirectSignal, m as redirectExternal, o as coerce, p as redirect, s as parseFormData, u as RedirectType, v as getHeaders } from "../_chunks/actions-418ygYKC.js";
3
+ import { D as getCookieJar, a as revalidateTag, b as getSegmentParams, c as DenySignal, f as deny, h as waitUntil, i as revalidatePath, l as RedirectSignal, m as redirectExternal, o as coerce, p as redirect, s as parseFormData, u as RedirectType, v as getHeaders } from "../_chunks/actions-DX2gkoOZ.js";
4
4
  //#region src/server/sensitive-fields.ts
5
5
  /**
6
6
  * Sensitive field stripping — removes password/token/CVV-style fields
@@ -3,7 +3,7 @@ import { a as warnRedirectInSuspense, c as warnSuspenseWrappingChildren, i as wa
3
3
  import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-DESG8uk5.js";
4
4
  import { n as classifyUrlSegment } from "../_chunks/segment-classify-BjfuctV2.js";
5
5
  import { a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, f as logWaitUntilRejected, h as swallow, i as logMiddlewareShortCircuit, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest } from "../_chunks/logger-DDmK5skc.js";
6
- import { C as setMatchedSegmentPath, E as getCookie, O as getSetCookieHeaders, S as runWithRequestContext, T as setSegmentParams, _ as getHeader, b as getSegmentParams, c as DenySignal, d as RenderError, g as applyRequestHeaderOverlay, l as RedirectSignal, n as executeAction, o as coerce, r as isRscActionRequest, t as buildNoJsResponse, w as setMutableCookieContext, x as markResponseFlushed, y as getSearchParams } from "../_chunks/actions-418ygYKC.js";
6
+ import { C as setMatchedSegmentPath, E as getCookie, O as getSetCookieHeaders, S as runWithRequestContext, T as setSegmentParams, _ as getHeader, b as getSegmentParams, c as DenySignal, d as RenderError, g as applyRequestHeaderOverlay, l as RedirectSignal, n as executeAction, o as coerce, r as isRscActionRequest, t as buildNoJsResponse, w as setMutableCookieContext, x as markResponseFlushed, y as getSearchParams } from "../_chunks/actions-DX2gkoOZ.js";
7
7
  import "../client/error-boundary.js";
8
8
  import { n as toBracketKey } from "../_chunks/resolve-schema-DU2nbVOi.js";
9
9
  import "../_chunks/segment-context-Bg0pFbLT.js";
@@ -1669,6 +1669,19 @@ function pathnameMatchesPattern(pathname, pattern) {
1669
1669
  *
1670
1670
  * See design/07-routing.md §"Request Lifecycle".
1671
1671
  */
1672
+ function rscErrorResponse(isRsc, status, headers) {
1673
+ if (!isRsc) return new Response(null, { status });
1674
+ const h = headers ?? new Headers();
1675
+ h.set("X-Timber-Error", "1");
1676
+ h.set("content-type", "application/json; charset=utf-8");
1677
+ return new Response(JSON.stringify({
1678
+ error: true,
1679
+ status
1680
+ }), {
1681
+ status,
1682
+ headers: h
1683
+ });
1684
+ }
1672
1685
  /**
1673
1686
  * Terminal outcome handler — converts a `PhaseOutcome` into a final
1674
1687
  * `Response`, applying cookies, building redirects, rendering deny pages
@@ -1721,11 +1734,12 @@ async function outcomeToResponse(config, outcome, ctx) {
1721
1734
  });
1722
1735
  }
1723
1736
  case "error": {
1737
+ const isRsc = (ctx.req.headers.get("Accept") ?? "").includes("text/x-component");
1724
1738
  if (outcome.phase === "proxy") {
1725
1739
  logProxyError({ error: outcome.error });
1726
1740
  await fireOnRequestError(outcome.error, ctx.req, "proxy");
1727
1741
  if (config.onPipelineError && outcome.error instanceof Error) config.onPipelineError(outcome.error, "proxy");
1728
- return new Response(null, { status: 500 });
1742
+ return rscErrorResponse(isRsc, 500);
1729
1743
  }
1730
1744
  if (outcome.phase === "middleware") {
1731
1745
  logMiddlewareError({
@@ -1735,7 +1749,7 @@ async function outcomeToResponse(config, outcome, ctx) {
1735
1749
  });
1736
1750
  await fireOnRequestError(outcome.error, ctx.req, "handler");
1737
1751
  if (config.onPipelineError && outcome.error instanceof Error) config.onPipelineError(outcome.error, "middleware");
1738
- return new Response(null, { status: 500 });
1752
+ return rscErrorResponse(isRsc, 500);
1739
1753
  }
1740
1754
  const headers = ctx.responseHeaders ?? new Headers();
1741
1755
  applyCookieJar(headers);
@@ -1746,6 +1760,7 @@ async function outcomeToResponse(config, outcome, ctx) {
1746
1760
  });
1747
1761
  await fireOnRequestError(outcome.error, ctx.req, "render");
1748
1762
  if (config.onPipelineError && outcome.error instanceof Error) config.onPipelineError(outcome.error, "render");
1763
+ if (isRsc) return rscErrorResponse(true, 500, headers);
1749
1764
  if (config.renderFallbackError) try {
1750
1765
  return cloneWithMutableHeaders(await config.renderFallbackError(outcome.error, ctx.req, headers));
1751
1766
  } catch (fallbackRenderError) {