@timber-js/app 0.2.0-alpha.71 → 0.2.0-alpha.72

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 (248) hide show
  1. package/dist/_chunks/actions-Dg-ANYHb.js +421 -0
  2. package/dist/_chunks/actions-Dg-ANYHb.js.map +1 -0
  3. package/dist/_chunks/{als-registry-BJARkOcu.js → als-registry-HS0LGUl2.js} +1 -1
  4. package/dist/_chunks/als-registry-HS0LGUl2.js.map +1 -0
  5. package/dist/_chunks/{define-Dz1bqwaS.js → define-C77ScO0m.js} +14 -14
  6. package/dist/_chunks/define-C77ScO0m.js.map +1 -0
  7. package/dist/_chunks/{define-CGuYoRHU.js → define-CZqDwhSu.js} +15 -15
  8. package/dist/_chunks/define-CZqDwhSu.js.map +1 -0
  9. package/dist/_chunks/{define-cookie-B5mewxwM.js → define-cookie-C2IkoFGN.js} +9 -8
  10. package/dist/_chunks/{define-cookie-B5mewxwM.js.map → define-cookie-C2IkoFGN.js.map} +1 -1
  11. package/dist/_chunks/{format-Rn922VH2.js → dev-warnings-DpGRGoDi.js} +4 -26
  12. package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +1 -0
  13. package/dist/_chunks/format-CYBGxKtc.js +14 -0
  14. package/dist/_chunks/format-CYBGxKtc.js.map +1 -0
  15. package/dist/_chunks/{interception-CEdHHviP.js → interception-Dpn_UfAD.js} +2 -2
  16. package/dist/_chunks/{interception-CEdHHviP.js.map → interception-Dpn_UfAD.js.map} +1 -1
  17. package/dist/_chunks/{segment-context-hzuJ048X.js → merge-search-params-Cm_KIWDX.js} +2 -33
  18. package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +1 -0
  19. package/dist/_chunks/{request-context-CywiO4jV.js → request-context-qMsWgy9C.js} +72 -36
  20. package/dist/_chunks/request-context-qMsWgy9C.js.map +1 -0
  21. package/dist/_chunks/{schema-bridge-C4SwjCQD.js → schema-bridge-C3xl_vfb.js} +1 -1
  22. package/dist/_chunks/{schema-bridge-C4SwjCQD.js.map → schema-bridge-C3xl_vfb.js.map} +1 -1
  23. package/dist/_chunks/segment-context-fHFLF1PE.js +34 -0
  24. package/dist/_chunks/segment-context-fHFLF1PE.js.map +1 -0
  25. package/dist/_chunks/ssr-data-DzuI0bIV.js +88 -0
  26. package/dist/_chunks/ssr-data-DzuI0bIV.js.map +1 -0
  27. package/dist/_chunks/{stale-reload-BLUC_Pl_.js → stale-reload-C2plcNtG.js} +1 -1
  28. package/dist/_chunks/{stale-reload-BLUC_Pl_.js.map → stale-reload-C2plcNtG.js.map} +1 -1
  29. package/dist/_chunks/{handler-store-BVePM7hp.js → tracing-CCYbKn5n.js} +60 -60
  30. package/dist/_chunks/tracing-CCYbKn5n.js.map +1 -0
  31. package/dist/_chunks/use-params-B1AuhI1p.js +307 -0
  32. package/dist/_chunks/use-params-B1AuhI1p.js.map +1 -0
  33. package/dist/_chunks/{use-query-states-DAhgj8Gx.js → use-query-states-Lo_s_pw2.js} +4 -4
  34. package/dist/_chunks/use-query-states-Lo_s_pw2.js.map +1 -0
  35. package/dist/_chunks/{wrappers-LZbghvn0.js → wrappers-_DTmImGt.js} +1 -1
  36. package/dist/_chunks/{wrappers-LZbghvn0.js.map → wrappers-_DTmImGt.js.map} +1 -1
  37. package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
  38. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  39. package/dist/adapters/cloudflare-kv-cache.js +95 -0
  40. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  41. package/dist/cache/index.d.ts +18 -4
  42. package/dist/cache/index.d.ts.map +1 -1
  43. package/dist/cache/index.js +78 -12
  44. package/dist/cache/index.js.map +1 -1
  45. package/dist/cache/sizeof.d.ts +22 -0
  46. package/dist/cache/sizeof.d.ts.map +1 -0
  47. package/dist/cli.d.ts +6 -1
  48. package/dist/cli.d.ts.map +1 -1
  49. package/dist/cli.js +6 -1
  50. package/dist/cli.js.map +1 -1
  51. package/dist/client/browser-dev.d.ts +27 -1
  52. package/dist/client/browser-dev.d.ts.map +1 -1
  53. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  54. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  55. package/dist/client/browser-entry/hmr.d.ts +21 -0
  56. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  57. package/dist/client/browser-entry/hydrate.d.ts +46 -0
  58. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  59. package/dist/client/browser-entry/index.d.ts +30 -0
  60. package/dist/client/browser-entry/index.d.ts.map +1 -0
  61. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  62. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  63. package/dist/client/browser-entry/router-init.d.ts +23 -0
  64. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  65. package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
  66. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  67. package/dist/client/browser-entry/scroll.d.ts +19 -0
  68. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  69. package/dist/client/error-boundary.js +131 -1
  70. package/dist/client/error-boundary.js.map +1 -0
  71. package/dist/client/index.d.ts +4 -19
  72. package/dist/client/index.d.ts.map +1 -1
  73. package/dist/client/index.js +14 -1191
  74. package/dist/client/index.js.map +1 -1
  75. package/dist/client/internal.d.ts +18 -0
  76. package/dist/client/internal.d.ts.map +1 -0
  77. package/dist/client/internal.js +890 -0
  78. package/dist/client/internal.js.map +1 -0
  79. package/dist/client/navigation-context.d.ts.map +1 -1
  80. package/dist/client/router-ref.d.ts +1 -1
  81. package/dist/client/top-loader.d.ts +2 -2
  82. package/dist/client/use-link-status.d.ts +1 -1
  83. package/dist/client/{use-navigation-pending.d.ts → use-pending-navigation.d.ts} +4 -4
  84. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  85. package/dist/client/use-router.d.ts +1 -1
  86. package/dist/codec.d.ts +10 -0
  87. package/dist/codec.d.ts.map +1 -1
  88. package/dist/codec.js +1 -1
  89. package/dist/config-types.d.ts +210 -0
  90. package/dist/config-types.d.ts.map +1 -0
  91. package/dist/content/index.d.ts +1 -10
  92. package/dist/content/index.d.ts.map +1 -1
  93. package/dist/content/index.js +0 -2
  94. package/dist/cookies/define-cookie.d.ts.map +1 -1
  95. package/dist/cookies/index.d.ts +0 -2
  96. package/dist/cookies/index.d.ts.map +1 -1
  97. package/dist/cookies/index.js +2 -3
  98. package/dist/index.d.ts +25 -288
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +261 -43
  101. package/dist/index.js.map +1 -1
  102. package/dist/plugin-context.d.ts +84 -0
  103. package/dist/plugin-context.d.ts.map +1 -0
  104. package/dist/plugins/adapter-build.d.ts +1 -1
  105. package/dist/plugins/adapter-build.d.ts.map +1 -1
  106. package/dist/plugins/build-manifest.d.ts +1 -1
  107. package/dist/plugins/build-manifest.d.ts.map +1 -1
  108. package/dist/plugins/build-report.d.ts +1 -1
  109. package/dist/plugins/build-report.d.ts.map +1 -1
  110. package/dist/plugins/content.d.ts +1 -1
  111. package/dist/plugins/content.d.ts.map +1 -1
  112. package/dist/plugins/dev-browser-logs.d.ts +1 -1
  113. package/dist/plugins/dev-browser-logs.d.ts.map +1 -1
  114. package/dist/plugins/dev-logs.d.ts +1 -1
  115. package/dist/plugins/dev-logs.d.ts.map +1 -1
  116. package/dist/plugins/dev-server.d.ts +1 -1
  117. package/dist/plugins/dev-server.d.ts.map +1 -1
  118. package/dist/plugins/entries.d.ts +1 -1
  119. package/dist/plugins/entries.d.ts.map +1 -1
  120. package/dist/plugins/fonts.d.ts +1 -1
  121. package/dist/plugins/fonts.d.ts.map +1 -1
  122. package/dist/plugins/mdx.d.ts +1 -1
  123. package/dist/plugins/mdx.d.ts.map +1 -1
  124. package/dist/plugins/routing.d.ts +1 -1
  125. package/dist/plugins/routing.d.ts.map +1 -1
  126. package/dist/plugins/shims.d.ts +1 -1
  127. package/dist/plugins/shims.d.ts.map +1 -1
  128. package/dist/plugins/static-build.d.ts +4 -4
  129. package/dist/plugins/static-build.d.ts.map +1 -1
  130. package/dist/routing/index.js +1 -1
  131. package/dist/search-params/define.d.ts +6 -6
  132. package/dist/search-params/define.d.ts.map +1 -1
  133. package/dist/search-params/index.d.ts +1 -2
  134. package/dist/search-params/index.d.ts.map +1 -1
  135. package/dist/search-params/index.js +4 -4
  136. package/dist/search-params/registry.d.ts +1 -1
  137. package/dist/search-params/registry.d.ts.map +1 -1
  138. package/dist/segment-params/define.d.ts +6 -6
  139. package/dist/segment-params/define.d.ts.map +1 -1
  140. package/dist/segment-params/index.d.ts +0 -1
  141. package/dist/segment-params/index.d.ts.map +1 -1
  142. package/dist/segment-params/index.js +3 -3
  143. package/dist/server/als-registry.d.ts +1 -1
  144. package/dist/server/dev-holding-server.d.ts +52 -0
  145. package/dist/server/dev-holding-server.d.ts.map +1 -0
  146. package/dist/server/dev-warnings.d.ts +1 -7
  147. package/dist/server/dev-warnings.d.ts.map +1 -1
  148. package/dist/server/index.d.ts +6 -45
  149. package/dist/server/index.d.ts.map +1 -1
  150. package/dist/server/index.js +7 -3272
  151. package/dist/server/index.js.map +1 -1
  152. package/dist/server/internal.d.ts +46 -0
  153. package/dist/server/internal.d.ts.map +1 -0
  154. package/dist/server/internal.js +2865 -0
  155. package/dist/server/internal.js.map +1 -0
  156. package/dist/server/pipeline.d.ts.map +1 -1
  157. package/dist/server/primitives.d.ts +41 -17
  158. package/dist/server/primitives.d.ts.map +1 -1
  159. package/dist/server/request-context.d.ts +45 -15
  160. package/dist/server/request-context.d.ts.map +1 -1
  161. package/dist/server/tracing.d.ts +4 -4
  162. package/dist/server/tracing.d.ts.map +1 -1
  163. package/dist/shims/headers.d.ts +2 -1
  164. package/dist/shims/headers.d.ts.map +1 -1
  165. package/dist/shims/navigation.d.ts +2 -1
  166. package/dist/shims/navigation.d.ts.map +1 -1
  167. package/package.json +19 -13
  168. package/src/adapters/cloudflare-kv-cache.ts +142 -0
  169. package/src/cache/handler-store.ts +2 -2
  170. package/src/cache/index.ts +74 -15
  171. package/src/cache/sizeof.ts +31 -0
  172. package/src/cli.ts +6 -1
  173. package/src/client/browser-dev.ts +128 -1
  174. package/src/client/browser-entry/action-dispatch.ts +116 -0
  175. package/src/client/browser-entry/hmr.ts +81 -0
  176. package/src/client/browser-entry/hydrate.ts +145 -0
  177. package/src/client/browser-entry/index.ts +138 -0
  178. package/src/client/browser-entry/post-hydration.ts +119 -0
  179. package/src/client/browser-entry/router-init.ts +184 -0
  180. package/src/client/browser-entry/rsc-stream.ts +157 -0
  181. package/src/client/browser-entry/scroll.ts +27 -0
  182. package/src/client/index.ts +10 -38
  183. package/src/client/internal.ts +57 -0
  184. package/src/client/navigation-context.ts +6 -2
  185. package/src/client/navigation-root.tsx +1 -1
  186. package/src/client/router-ref.ts +1 -1
  187. package/src/client/top-loader.tsx +2 -2
  188. package/src/client/use-link-status.ts +1 -1
  189. package/src/client/{use-navigation-pending.ts → use-pending-navigation.ts} +5 -5
  190. package/src/client/use-query-states.ts +2 -2
  191. package/src/client/use-router.ts +1 -1
  192. package/src/codec.ts +15 -0
  193. package/src/config-types.ts +208 -0
  194. package/src/content/index.ts +5 -13
  195. package/src/cookies/define-cookie.ts +9 -7
  196. package/src/cookies/index.ts +6 -5
  197. package/src/index.ts +84 -416
  198. package/src/plugin-context.ts +200 -0
  199. package/src/plugins/adapter-build.ts +1 -1
  200. package/src/plugins/build-manifest.ts +1 -1
  201. package/src/plugins/build-report.ts +1 -1
  202. package/src/plugins/content.ts +1 -1
  203. package/src/plugins/dev-browser-logs.ts +1 -1
  204. package/src/plugins/dev-logs.ts +1 -1
  205. package/src/plugins/dev-server.ts +16 -1
  206. package/src/plugins/entries.ts +2 -2
  207. package/src/plugins/fonts.ts +4 -3
  208. package/src/plugins/mdx.ts +1 -1
  209. package/src/plugins/routing.ts +1 -1
  210. package/src/plugins/shims.ts +53 -5
  211. package/src/plugins/static-build.ts +8 -6
  212. package/src/search-params/define.ts +22 -22
  213. package/src/search-params/index.ts +3 -3
  214. package/src/search-params/registry.ts +1 -1
  215. package/src/segment-params/define.ts +18 -18
  216. package/src/segment-params/index.ts +2 -1
  217. package/src/server/action-handler.ts +1 -1
  218. package/src/server/als-registry.ts +3 -3
  219. package/src/server/dev-holding-server.ts +185 -0
  220. package/src/server/dev-warnings.ts +2 -21
  221. package/src/server/html-injectors.ts +3 -3
  222. package/src/server/index.ts +25 -180
  223. package/src/server/internal.ts +169 -0
  224. package/src/server/pipeline.ts +12 -7
  225. package/src/server/primitives.ts +71 -30
  226. package/src/server/request-context.ts +77 -39
  227. package/src/server/route-element-builder.ts +1 -1
  228. package/src/server/rsc-entry/index.ts +2 -2
  229. package/src/server/rsc-entry/ssr-renderer.ts +1 -1
  230. package/src/server/slot-resolver.ts +1 -1
  231. package/src/server/tracing.ts +6 -6
  232. package/src/server/tree-builder.ts +1 -1
  233. package/src/shims/headers.ts +5 -1
  234. package/src/shims/navigation.ts +5 -1
  235. package/dist/_chunks/als-registry-BJARkOcu.js.map +0 -1
  236. package/dist/_chunks/define-CGuYoRHU.js.map +0 -1
  237. package/dist/_chunks/define-Dz1bqwaS.js.map +0 -1
  238. package/dist/_chunks/error-boundary-D9hzsveV.js +0 -216
  239. package/dist/_chunks/error-boundary-D9hzsveV.js.map +0 -1
  240. package/dist/_chunks/format-Rn922VH2.js.map +0 -1
  241. package/dist/_chunks/handler-store-BVePM7hp.js.map +0 -1
  242. package/dist/_chunks/request-context-CywiO4jV.js.map +0 -1
  243. package/dist/_chunks/segment-context-hzuJ048X.js.map +0 -1
  244. package/dist/_chunks/use-query-states-DAhgj8Gx.js.map +0 -1
  245. package/dist/client/browser-entry.d.ts +0 -21
  246. package/dist/client/browser-entry.d.ts.map +0 -1
  247. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  248. package/src/client/browser-entry.ts +0 -846
package/dist/index.d.ts CHANGED
@@ -1,296 +1,17 @@
1
- import type { PluginOption } from 'vite';
2
- import type { RouteTree } from './routing/types';
3
- import type { BuildManifest } from './server/build-manifest';
4
- import type { StartupTimer } from './utils/startup-timer';
5
- /** Configuration for client-side JavaScript output. */
6
- export interface ClientJavascriptConfig {
7
- /** When true, no client JS bundles are emitted or referenced in HTML. */
8
- disabled: boolean;
9
- /**
10
- * When `disabled` is true, still inject the Vite HMR client in dev mode
11
- * so hot reloading works during development. Default: true.
12
- */
13
- enableHMRInDev?: boolean;
14
- }
15
- /** Fully resolved client JavaScript configuration (no optionals). */
16
- export interface ResolvedClientJavascript {
17
- disabled: boolean;
18
- enableHMRInDev: boolean;
19
- }
20
- export interface TimberUserConfig {
21
- output?: 'server' | 'static';
22
- /**
23
- * Enable timber debug logging in production builds.
24
- *
25
- * When `true`, timber's own diagnostics (dev warnings, verbose logging)
26
- * are active even in production mode. React stays in production mode —
27
- * only timber's logs are affected.
28
- *
29
- * Can also be enabled at runtime via the `TIMBER_DEBUG` environment variable.
30
- *
31
- * Default: `false`.
32
- */
33
- debug?: boolean;
34
- /**
35
- * Control client-side JavaScript output.
36
- *
37
- * Boolean shorthand:
38
- * `clientJavascript: false` disables all client JS (equivalent to `{ disabled: true }`).
39
- * `clientJavascript: true` enables client JS (the default).
40
- *
41
- * Object form:
42
- * `clientJavascript: { disabled: true, enableHMRInDev: true }` disables client JS
43
- * in production but preserves Vite HMR in dev mode.
44
- *
45
- * When `disabled` is true, `enableHMRInDev` defaults to `true`.
46
- * Server-side JS still runs — this only affects what is sent to the browser.
47
- */
48
- clientJavascript?: boolean | ClientJavascriptConfig;
49
- adapter?: unknown;
50
- cacheHandler?: unknown;
51
- allowedOrigins?: string[];
52
- csrf?: boolean;
53
- limits?: {
54
- actionBodySize?: string;
55
- uploadBodySize?: string;
56
- maxFields?: number;
57
- };
58
- pageExtensions?: string[];
59
- /**
60
- * Slow request threshold in milliseconds. Requests exceeding this emit
61
- * a warning via the logger. Set to 0 to disable. Default: 3000.
62
- *
63
- * See design/17-logging.md §"slowRequestMs".
64
- */
65
- slowRequestMs?: number;
66
- /**
67
- * Render timeout in milliseconds. If an SSR render or RSC stream read
68
- * does not complete within this duration, the render is aborted and
69
- * the connection is closed. Protects against hung fetches and Suspense
70
- * components that never resolve.
71
- *
72
- * Set to 0 to disable (not recommended in production).
73
- * Default: 30000 (30 seconds).
74
- *
75
- * See design/02-rendering-pipeline.md §"Streaming Constraints".
76
- */
77
- renderTimeoutMs?: number;
78
- /**
79
- * Forward browser console output to the server terminal in dev mode.
80
- *
81
- * Sets the minimum log level to forward:
82
- * - `'error'` — only `console.error`
83
- * - `'warn'` — `console.error` + `console.warn` (default)
84
- * - `'info'` — `console.error` + `console.warn` + `console.info`
85
- * - `'none'` — disabled
86
- *
87
- * Does not intercept `console.log` or `console.debug` (too noisy).
88
- * No effect in production builds.
89
- *
90
- * See TIM-513.
91
- */
92
- devBrowserLogs?: 'error' | 'warn' | 'info' | 'none';
93
- /** Dev-mode options. These have no effect in production builds. */
94
- dev?: {
95
- /** Threshold in ms to highlight slow phases in dev logging output. Default: 200. */
96
- slowPhaseMs?: number;
97
- };
98
- /**
99
- * Control Server-Timing header output.
100
- *
101
- * - `'detailed'` — per-phase breakdown (proxy, middleware, render). Useful
102
- * for APM / network monitoring. Exposes phase names to clients.
103
- * - `'total'` — single `total;dur=N` entry. Safe to expose, gives
104
- * browser DevTools useful timing without internal details.
105
- * - `false` — no Server-Timing header at all.
106
- *
107
- * Default: `'detailed'` in dev, `'total'` in production.
108
- *
109
- * This is separate from `debug` / `TIMBER_DEBUG` — it's an intentional
110
- * decision to expose timing data to clients, not a side effect of debug
111
- * logging.
112
- */
113
- serverTiming?: 'detailed' | 'total' | false;
114
- /**
115
- * Override the app directory location. By default, timber auto-detects
116
- * `app/` at the project root, falling back to `src/app/`.
117
- *
118
- * Set this to a relative path from the project root (e.g. `'src/app'`)
119
- * to use a custom location.
120
- */
121
- appDir?: string;
122
- /** MDX compilation options passed to @mdx-js/rollup. See design/20-content-collections.md. */
123
- mdx?: {
124
- remarkPlugins?: unknown[];
125
- rehypePlugins?: unknown[];
126
- recmaPlugins?: unknown[];
127
- remarkRehypeOptions?: Record<string, unknown>;
128
- };
129
- /**
130
- * Built-in top-loader progress bar for client navigations.
131
- * Shows an animated bar at the top of the viewport during RSC navigations.
132
- * Enabled by default — set `enabled: false` to opt out.
133
- *
134
- * Users who want a fully custom progress indicator should disable this
135
- * and use `useNavigationPending()` directly.
136
- *
137
- * See LOCAL-336 for design decisions.
138
- */
139
- /**
140
- * Server action bound args encryption configuration.
141
- *
142
- * The RSC plugin encrypts closure variables captured by 'use server' functions
143
- * using AES-256-GCM so they are opaque and tamper-proof in the Flight payload.
144
- * Encryption is always enabled in production.
145
- *
146
- * The encryption key is auto-generated at build time and embedded in the server bundle,
147
- * so all instances running the same build share the same key automatically.
148
- * For rolling/blue-green deployments where multiple builds coexist, set
149
- * `TIMBER_ACTIONS_ENCRYPTION_KEY` env var to share a key across builds.
150
- *
151
- * See design/08-forms-and-actions.md §"Security"
152
- */
153
- actionEncryption?: {
154
- /**
155
- * Disable encryption in dev mode for easier debugging of bound args.
156
- * Has no effect in production — encryption is always enabled.
157
- * Default: false (encryption is on in dev too).
158
- */
159
- disableInDev?: boolean;
160
- };
161
- /**
162
- * Enable the React Compiler (babel-plugin-react-compiler) for automatic
163
- * memoization of components and hooks at build time.
164
- *
165
- * - `true` — enable with default options
166
- * - `{ compilationMode, target }` — enable with custom options
167
- * - `compilationMode: 'annotation'` — only compile files with `'use memo'`
168
- * - `target: '18'` — target React 18 (uses react-compiler-runtime package)
169
- * - `false` or omitted — disabled (default)
170
- *
171
- * Uses `@vitejs/plugin-react`'s built-in `reactCompilerPreset`, which:
172
- * - Applies Babel only for the compiler pass (OXC handles JSX)
173
- * - Automatically scopes to client environment only
174
- * - Uses `react/compiler-runtime` built into React 19
175
- *
176
- * Requires `babel-plugin-react-compiler` as a peer dependency.
177
- */
178
- reactCompiler?: boolean | {
179
- compilationMode?: string;
180
- target?: string;
181
- };
182
- /**
183
- * Auto-generate sitemap.xml from the route tree.
184
- *
185
- * When enabled, timber walks the file-system route tree and produces a sitemap
186
- * for all discoverable pages. Dynamic routes with `generateStaticParams()` are
187
- * enumerated. Routes protected by `access.ts` are excluded by default.
188
- *
189
- * If a user-authored `sitemap.ts` or `sitemap.xml` exists at the app root,
190
- * auto-generation is disabled — the user takes full control.
191
- *
192
- * Supports automatic pagination (sitemap index) for sites with > 50,000 URLs.
193
- *
194
- * See design/16-metadata.md §"Auto-generated Sitemap"
195
- */
196
- sitemap?: {
197
- /** Must be explicitly `true` to enable auto-generation. Default: false. */
198
- enabled?: boolean;
199
- /** Base URL for absolute URLs in the sitemap. Required when enabled. e.g., 'https://example.com' */
200
- baseUrl?: string;
201
- /** Default `<changefreq>` for all entries. Optional. */
202
- defaultChangeFrequency?: string;
203
- /** Default `<priority>` for all entries (0.0–1.0). Optional. */
204
- defaultPriority?: number;
205
- /** Include routes protected by `access.ts`. Default: false. */
206
- includeProtected?: boolean;
207
- };
208
- topLoader?: {
209
- /** Whether the top-loader is enabled. Default: true. */
210
- enabled?: boolean;
211
- /** Bar color. Default: '#2299DD'. */
212
- color?: string;
213
- /** Bar height in pixels. Default: 3. */
214
- height?: number;
215
- /** Show subtle glow/shadow effect. Default: true. */
216
- shadow?: boolean;
217
- /** Delay in ms before showing the bar (avoids flash on fast navs). Default: 0. */
218
- delay?: number;
219
- /** CSS z-index. Default: 1600. */
220
- zIndex?: number;
221
- };
222
- }
223
- /**
224
- * Resolve `clientJavascript` into a fully resolved config.
225
- */
226
- export declare function resolveClientJavascript(config: TimberUserConfig): ResolvedClientJavascript;
227
1
  /**
228
- * Shared context object passed to all sub-plugins via closure.
2
+ * @timber-js/app Root entry point (public API).
229
3
  *
230
- * Sub-plugins communicate through this context — not through Vite's
231
- * plugin API or global state.
232
- * See design/18-build-system.md §"Shared Plugin Context".
233
- */
234
- export interface PluginContext {
235
- config: TimberUserConfig;
236
- /** Resolved client JavaScript configuration */
237
- clientJavascript: ResolvedClientJavascript;
238
- /** The scanned route tree (populated by timber-routing, consumed by timber-entries) */
239
- routeTree: RouteTree | null;
240
- /** Absolute path to the app/ directory */
241
- appDir: string;
242
- /** Absolute path to the project root */
243
- root: string;
244
- /** Whether the dev server is running (set by timber-root-sync in configResolved) */
245
- dev: boolean;
246
- /** CSS build manifest (populated by adapter after client build, null in dev) */
247
- buildManifest: BuildManifest | null;
248
- /** Per-build deployment ID for version skew detection (null in dev) */
249
- deploymentId: string | null;
250
- /** Startup timer for profiling cold start phases (active in dev, no-op in prod) */
251
- timer: StartupTimer;
252
- }
253
- /**
254
- * Resolve the app directory. Checks (in order):
255
- * 1. Explicit `configAppDir` from timber.config.ts
256
- * 2. `<root>/app`
257
- * 3. `<root>/src/app`
258
- *
259
- * Throws if none exist.
260
- */
261
- export declare function resolveAppDir(root: string, configAppDir?: string): string;
262
- /**
263
- * Load timber.config.ts (or .js, .mjs) from the project root.
264
- * Returns the config object or null if no config file is found.
4
+ * User-facing exports: timber(), defineConfig(), TimberUserConfig, Routes.
265
5
  *
266
- * Uses require() which works for ESM modules on Node 22.12+.
267
- * This keeps timber() synchronous no async config loading needed.
268
- */
269
- export declare function loadTimberConfigFile(root: string): TimberUserConfig | null;
270
- /**
271
- * Detect config keys set in both inline (vite.config.ts) and file (timber.config.ts)
272
- * and warn the user. The `output` key is excluded because it defaults to 'server'
273
- * in createPluginContext and would always appear as an inline key.
6
+ * Internal helpers (PluginContext, resolveAppDir, loadTimberConfigFile,
7
+ * warnConfigConflicts, resolveClientJavascript) live in plugin-context.ts
8
+ * and are NOT re-exported here. Sub-plugins import them via relative paths.
274
9
  *
275
- * Returns the list of conflicting key names (for testing).
10
+ * Design doc: 18-build-system.md §"Plugin Architecture"
276
11
  */
277
- export declare function warnConfigConflicts(inline: TimberUserConfig, fileConfig: TimberUserConfig): string[];
278
- /**
279
- * Create the timber Vite plugin array.
280
- *
281
- * Loads timber.config.ts and all dependencies synchronously before
282
- * constructing the plugin array. This ensures ALL plugins — including
283
- * the RSC plugin and React Compiler — see the fully merged config
284
- * (inline + file-based). No async, no deferred config, no stale reads.
285
- *
286
- * Requires Node >= 22.12 for synchronous require() of ESM modules
287
- * (@vitejs/plugin-rsc is ESM-only).
288
- *
289
- * Previous versions used async loading and deferred config merging,
290
- * causing file-based config for reactCompiler, actionEncryption, and
291
- * output mode to be silently ignored. See TIM-451.
292
- */
293
- export declare function timber(config?: TimberUserConfig): PluginOption[];
12
+ import type { PluginOption } from 'vite';
13
+ import type { TimberUserConfig } from './config-types.js';
14
+ export type { TimberUserConfig } from './config-types.js';
294
15
  /**
295
16
  * Route map interface — augmented by the generated timber-routes.d.ts.
296
17
  *
@@ -322,5 +43,21 @@ export interface Routes {
322
43
  * ```
323
44
  */
324
45
  export declare function defineConfig(config: TimberUserConfig): TimberUserConfig;
46
+ /**
47
+ * Create the timber Vite plugin array.
48
+ *
49
+ * Loads timber.config.ts and all dependencies synchronously before
50
+ * constructing the plugin array. This ensures ALL plugins — including
51
+ * the RSC plugin and React Compiler — see the fully merged config
52
+ * (inline + file-based). No async, no deferred config, no stale reads.
53
+ *
54
+ * Requires Node >= 22.12 for synchronous require() of ESM modules
55
+ * (@vitejs/plugin-rsc is ESM-only).
56
+ *
57
+ * Previous versions used async loading and deferred config merging,
58
+ * causing file-based config for reactCompiler, actionEncryption, and
59
+ * output mode to be silently ignored. See TIM-451.
60
+ */
61
+ export declare function timber(config?: TimberUserConfig): PluginOption[];
325
62
  export default timber;
326
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,MAAM,CAAC;AAuBjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,uD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