@timber-js/app 0.2.0-alpha.57 → 0.2.0-alpha.59

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 (188) hide show
  1. package/dist/_chunks/als-registry-Ba7URUIn.js.map +1 -1
  2. package/dist/_chunks/define-D5STJpIr.js +121 -0
  3. package/dist/_chunks/define-D5STJpIr.js.map +1 -0
  4. package/dist/_chunks/define-TK8C1M3x.js.map +1 -1
  5. package/dist/_chunks/{define-cookie-k9btcEfI.js → define-cookie-DtAavax4.js} +4 -4
  6. package/dist/_chunks/define-cookie-DtAavax4.js.map +1 -0
  7. package/dist/_chunks/{error-boundary-B9vT_YK_.js → error-boundary-DpZJBCqh.js} +1 -1
  8. package/dist/_chunks/{error-boundary-B9vT_YK_.js.map → error-boundary-DpZJBCqh.js.map} +1 -1
  9. package/dist/_chunks/interception-Cey5DCGr.js.map +1 -1
  10. package/dist/_chunks/{request-context-0h-6Voad.js → request-context-0wfZsnhh.js} +3 -1
  11. package/dist/_chunks/request-context-0wfZsnhh.js.map +1 -0
  12. package/dist/_chunks/{segment-context-Bmugn-ao.js → segment-context-CyaM1mrD.js} +1 -1
  13. package/dist/_chunks/{segment-context-Bmugn-ao.js.map → segment-context-CyaM1mrD.js.map} +1 -1
  14. package/dist/_chunks/{stale-reload-Db4wqE46.js → stale-reload-DKN3aXxR.js} +1 -1
  15. package/dist/_chunks/{stale-reload-Db4wqE46.js.map → stale-reload-DKN3aXxR.js.map} +1 -1
  16. package/dist/_chunks/{tracing-JI4cYUdz.js → tracing-VYETCQsg.js} +1 -1
  17. package/dist/_chunks/{tracing-JI4cYUdz.js.map → tracing-VYETCQsg.js.map} +1 -1
  18. package/dist/_chunks/use-query-states-wEXY2JQB.js.map +1 -1
  19. package/dist/_chunks/{wrappers-C9XPg7-U.js → wrappers-BaG1bnM3.js} +1 -1
  20. package/dist/_chunks/{wrappers-C9XPg7-U.js.map → wrappers-BaG1bnM3.js.map} +1 -1
  21. package/dist/cache/index.js +1 -1
  22. package/dist/cache/index.js.map +1 -1
  23. package/dist/client/error-boundary.js +1 -1
  24. package/dist/client/error-reconstituter.d.ts +54 -0
  25. package/dist/client/error-reconstituter.d.ts.map +1 -0
  26. package/dist/client/form.d.ts +2 -2
  27. package/dist/client/form.d.ts.map +1 -1
  28. package/dist/client/index.d.ts +1 -1
  29. package/dist/client/index.d.ts.map +1 -1
  30. package/dist/client/index.js +4 -4
  31. package/dist/client/index.js.map +1 -1
  32. package/dist/client/link.d.ts +1 -1
  33. package/dist/client/link.d.ts.map +1 -1
  34. package/dist/client/segment-outlet.d.ts +63 -0
  35. package/dist/client/segment-outlet.d.ts.map +1 -0
  36. package/dist/client/use-params.d.ts +1 -1
  37. package/dist/client/use-params.d.ts.map +1 -1
  38. package/dist/client/use-query-states.d.ts +1 -1
  39. package/dist/client/use-query-states.d.ts.map +1 -1
  40. package/dist/cookies/define-cookie.d.ts +3 -3
  41. package/dist/cookies/define-cookie.d.ts.map +1 -1
  42. package/dist/cookies/index.js +1 -1
  43. package/dist/index.d.ts +15 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +173 -6
  46. package/dist/index.js.map +1 -1
  47. package/dist/params/define.d.ts +25 -1
  48. package/dist/params/define.d.ts.map +1 -1
  49. package/dist/params/index.d.ts +5 -5
  50. package/dist/params/index.d.ts.map +1 -1
  51. package/dist/params/index.js +2 -103
  52. package/dist/plugins/adapter-build.d.ts +1 -1
  53. package/dist/plugins/adapter-build.d.ts.map +1 -1
  54. package/dist/plugins/build-manifest.d.ts +2 -2
  55. package/dist/plugins/build-manifest.d.ts.map +1 -1
  56. package/dist/plugins/build-report.d.ts +3 -3
  57. package/dist/plugins/build-report.d.ts.map +1 -1
  58. package/dist/plugins/content.d.ts +1 -1
  59. package/dist/plugins/content.d.ts.map +1 -1
  60. package/dist/plugins/dev-browser-logs.d.ts +84 -0
  61. package/dist/plugins/dev-browser-logs.d.ts.map +1 -0
  62. package/dist/plugins/dev-logs.d.ts +1 -1
  63. package/dist/plugins/dev-logs.d.ts.map +1 -1
  64. package/dist/plugins/dev-server.d.ts +1 -1
  65. package/dist/plugins/dev-server.d.ts.map +1 -1
  66. package/dist/plugins/entries.d.ts +1 -1
  67. package/dist/plugins/entries.d.ts.map +1 -1
  68. package/dist/plugins/fonts.d.ts +2 -2
  69. package/dist/plugins/fonts.d.ts.map +1 -1
  70. package/dist/plugins/mdx.d.ts +1 -1
  71. package/dist/plugins/mdx.d.ts.map +1 -1
  72. package/dist/plugins/routing.d.ts +1 -1
  73. package/dist/plugins/routing.d.ts.map +1 -1
  74. package/dist/plugins/shims.d.ts +8 -5
  75. package/dist/plugins/shims.d.ts.map +1 -1
  76. package/dist/plugins/static-build.d.ts +1 -1
  77. package/dist/plugins/static-build.d.ts.map +1 -1
  78. package/dist/search-params/define.d.ts +1 -1
  79. package/dist/search-params/define.d.ts.map +1 -1
  80. package/dist/search-params/index.d.ts +1 -1
  81. package/dist/search-params/index.d.ts.map +1 -1
  82. package/dist/search-params/index.js +1 -1
  83. package/dist/server/actions.d.ts +1 -1
  84. package/dist/server/actions.d.ts.map +1 -1
  85. package/dist/server/als-registry.d.ts +7 -0
  86. package/dist/server/als-registry.d.ts.map +1 -1
  87. package/dist/server/deny-renderer.d.ts.map +1 -1
  88. package/dist/server/fallback-error.d.ts +3 -3
  89. package/dist/server/fallback-error.d.ts.map +1 -1
  90. package/dist/server/index.js +4 -4
  91. package/dist/server/index.js.map +1 -1
  92. package/dist/server/pipeline-interception.d.ts +1 -1
  93. package/dist/server/pipeline-interception.d.ts.map +1 -1
  94. package/dist/server/pipeline.d.ts +2 -2
  95. package/dist/server/pipeline.d.ts.map +1 -1
  96. package/dist/server/request-context.d.ts.map +1 -1
  97. package/dist/server/rsc-entry/api-handler.d.ts +2 -2
  98. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  99. package/dist/server/rsc-entry/error-renderer.d.ts +13 -13
  100. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  101. package/dist/server/rsc-entry/helpers.d.ts +2 -2
  102. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  103. package/dist/server/rsc-entry/index.d.ts +2 -2
  104. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  105. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  106. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  107. package/dist/server/rsc-entry/rsc-stream.d.ts +1 -1
  108. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  109. package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
  110. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  111. package/dist/server/rsc-entry/ssr-renderer.d.ts +4 -4
  112. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  113. package/dist/server/status-code-resolver.d.ts +1 -1
  114. package/dist/server/status-code-resolver.d.ts.map +1 -1
  115. package/dist/server/stream-utils.d.ts +36 -0
  116. package/dist/server/stream-utils.d.ts.map +1 -0
  117. package/dist/server/tree-builder.d.ts +1 -1
  118. package/dist/server/tree-builder.d.ts.map +1 -1
  119. package/dist/shims/font-google.d.ts +1 -1
  120. package/dist/shims/font-google.d.ts.map +1 -1
  121. package/package.json +1 -4
  122. package/src/cache/timber-cache.ts +1 -1
  123. package/src/client/browser-entry.ts +7 -8
  124. package/src/client/error-reconstituter.tsx +65 -0
  125. package/src/client/form.tsx +2 -2
  126. package/src/client/index.ts +2 -2
  127. package/src/client/link.tsx +2 -2
  128. package/src/client/segment-outlet.tsx +86 -0
  129. package/src/client/use-params.ts +1 -1
  130. package/src/client/use-query-states.ts +2 -2
  131. package/src/cookies/define-cookie.ts +9 -9
  132. package/src/index.ts +17 -0
  133. package/src/params/define.ts +61 -1
  134. package/src/params/index.ts +5 -5
  135. package/src/plugins/adapter-build.ts +2 -2
  136. package/src/plugins/build-manifest.ts +2 -2
  137. package/src/plugins/build-report.ts +3 -3
  138. package/src/plugins/cache-transform.ts +1 -1
  139. package/src/plugins/content.ts +1 -1
  140. package/src/plugins/dev-browser-logs.ts +274 -0
  141. package/src/plugins/dev-logs.ts +1 -1
  142. package/src/plugins/dev-server.ts +3 -3
  143. package/src/plugins/entries.ts +1 -1
  144. package/src/plugins/fonts.ts +9 -9
  145. package/src/plugins/mdx.ts +1 -1
  146. package/src/plugins/routing.ts +6 -6
  147. package/src/plugins/server-action-exports.ts +1 -1
  148. package/src/plugins/shims.ts +19 -39
  149. package/src/plugins/static-build.ts +2 -2
  150. package/src/routing/scanner.ts +1 -1
  151. package/src/routing/status-file-lint.ts +1 -1
  152. package/src/search-params/define.ts +2 -2
  153. package/src/search-params/index.ts +1 -1
  154. package/src/server/action-client.ts +1 -1
  155. package/src/server/action-handler.ts +1 -1
  156. package/src/server/actions.ts +1 -1
  157. package/src/server/als-registry.ts +7 -0
  158. package/src/server/deny-renderer.ts +3 -2
  159. package/src/server/error-boundary-wrapper.ts +1 -1
  160. package/src/server/fallback-error.ts +6 -6
  161. package/src/server/pipeline-interception.ts +1 -1
  162. package/src/server/pipeline.ts +2 -2
  163. package/src/server/primitives.ts +1 -1
  164. package/src/server/request-context.ts +7 -1
  165. package/src/server/route-element-builder.ts +1 -1
  166. package/src/server/rsc-entry/api-handler.ts +8 -8
  167. package/src/server/rsc-entry/error-renderer.ts +120 -185
  168. package/src/server/rsc-entry/helpers.ts +2 -2
  169. package/src/server/rsc-entry/index.ts +42 -38
  170. package/src/server/rsc-entry/rsc-payload.ts +6 -6
  171. package/src/server/rsc-entry/rsc-stream.ts +6 -6
  172. package/src/server/rsc-entry/ssr-bridge.ts +2 -2
  173. package/src/server/rsc-entry/ssr-renderer.ts +16 -12
  174. package/src/server/slot-resolver.ts +2 -2
  175. package/src/server/ssr-entry.ts +3 -3
  176. package/src/server/status-code-resolver.ts +1 -1
  177. package/src/server/stream-utils.ts +209 -0
  178. package/src/server/tree-builder.ts +1 -1
  179. package/src/shims/font-google.ts +1 -1
  180. package/dist/_chunks/define-cookie-k9btcEfI.js.map +0 -1
  181. package/dist/_chunks/request-context-0h-6Voad.js.map +0 -1
  182. package/dist/params/index.js.map +0 -1
  183. package/dist/server/rsc-entry/ssr-error-bridge.d.ts +0 -12
  184. package/dist/server/rsc-entry/ssr-error-bridge.d.ts.map +0 -1
  185. package/dist/server/ssr-error-entry.d.ts +0 -65
  186. package/dist/server/ssr-error-entry.d.ts.map +0 -1
  187. package/src/server/rsc-entry/ssr-error-bridge.ts +0 -20
  188. package/src/server/ssr-error-entry.ts +0 -237
@@ -15,7 +15,7 @@ import type { Plugin } from 'vite';
15
15
  import { resolve, dirname } from 'node:path';
16
16
  import { fileURLToPath } from 'node:url';
17
17
  import { existsSync } from 'node:fs';
18
- import type { PluginContext } from '#/index.js';
18
+ import type { PluginContext } from '../index.js';
19
19
 
20
20
  const __dirname = dirname(fileURLToPath(import.meta.url));
21
21
 
@@ -17,19 +17,19 @@
17
17
  import type { Plugin, ViteDevServer } from 'vite';
18
18
  import { readFileSync, existsSync } from 'node:fs';
19
19
  import { resolve, normalize } from 'node:path';
20
- import type { PluginContext } from '#/index.js';
21
- import type { ExtractedFont, GoogleFontConfig } from '#/fonts/types.js';
22
- import type { ManifestFontEntry } from '#/server/build-manifest.js';
23
- import { generateVariableClass, generateFontFamilyClass, generateFontFaces } from '#/fonts/css.js';
24
- import { generateFallbackCss, buildFontStack } from '#/fonts/fallbacks.js';
25
- import { processLocalFont, generateLocalFontFaces } from '#/fonts/local.js';
26
- import { inferFontFormat } from '#/fonts/local.js';
27
- import { downloadAndCacheFonts, type CachedFont } from '#/fonts/google.js';
20
+ import type { PluginContext } from '../index.js';
21
+ import type { ExtractedFont, GoogleFontConfig } from '../fonts/types.js';
22
+ import type { ManifestFontEntry } from '../server/build-manifest.js';
23
+ import { generateVariableClass, generateFontFamilyClass, generateFontFaces } from '../fonts/css.js';
24
+ import { generateFallbackCss, buildFontStack } from '../fonts/fallbacks.js';
25
+ import { processLocalFont, generateLocalFontFaces } from '../fonts/local.js';
26
+ import { inferFontFormat } from '../fonts/local.js';
27
+ import { downloadAndCacheFonts, type CachedFont } from '../fonts/google.js';
28
28
  import {
29
29
  extractFontConfigAst,
30
30
  extractLocalFontConfigAst,
31
31
  detectDynamicFontCallAst,
32
- } from '#/fonts/ast.js';
32
+ } from '../fonts/ast.js';
33
33
 
34
34
  const VIRTUAL_GOOGLE = '@timber/fonts/google';
35
35
  const VIRTUAL_LOCAL = '@timber/fonts/local';
@@ -11,7 +11,7 @@
11
11
  import type { Plugin } from 'vite';
12
12
  import { existsSync } from 'node:fs';
13
13
  import { join } from 'node:path';
14
- import type { PluginContext } from '#/index.js';
14
+ import type { PluginContext } from '../index.js';
15
15
 
16
16
  const MDX_EXTENSIONS = ['mdx', 'md'];
17
17
 
@@ -11,15 +11,15 @@
11
11
  import type { Plugin, ViteDevServer } from 'vite';
12
12
  import { writeFile, mkdir } from 'node:fs/promises';
13
13
  import { join } from 'node:path';
14
- import { scanRoutes } from '#/routing/scanner.js';
15
- import { generateRouteMap } from '#/routing/codegen.js';
16
- import { collectInterceptionRewrites } from '#/routing/interception.js';
14
+ import { scanRoutes } from '../routing/scanner.js';
15
+ import { generateRouteMap } from '../routing/codegen.js';
16
+ import { collectInterceptionRewrites } from '../routing/interception.js';
17
17
  import {
18
18
  lintStatusFileDirectives,
19
19
  formatStatusFileLintWarnings,
20
- } from '#/routing/status-file-lint.js';
21
- import type { RouteTree, SegmentNode, RouteFile } from '#/routing/types.js';
22
- import type { PluginContext } from '#/index.js';
20
+ } from '../routing/status-file-lint.js';
21
+ import type { RouteTree, SegmentNode, RouteFile } from '../routing/types.js';
22
+ import type { PluginContext } from '../index.js';
23
23
 
24
24
  const VIRTUAL_MODULE_ID = 'virtual:timber-route-manifest';
25
25
  const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_MODULE_ID}`;
@@ -1,7 +1,7 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import { Parser } from 'acorn';
3
3
  import acornJsx from 'acorn-jsx';
4
- import { detectFileDirective } from '#/utils/directive-parser.js';
4
+ import { detectFileDirective } from '../utils/directive-parser.js';
5
5
 
6
6
  const jsxParser = Parser.extend(acornJsx());
7
7
 
@@ -5,10 +5,13 @@
5
5
  * shim implementations. This enables Next.js-compatible libraries
6
6
  * (nuqs, next-intl, etc.) to work unmodified.
7
7
  *
8
- * NOTE: This plugin does NOT resolve @timber-js/app/* subpath imports.
9
- * Those are handled by Vite's native package.json `exports` resolution,
10
- * which maps them to dist/ files. This ensures a single module instance
11
- * for shared modules like request-context (ALS singleton).
8
+ * NOTE: This plugin does NOT remap @timber-js/app/* subpath imports to
9
+ * src/. All subpath imports resolve to dist/ via Vite's native
10
+ * package.json `exports` resolution, ensuring a single module instance
11
+ * for shared code. The only exception is @timber-js/app/server in the
12
+ * client environment, which returns a virtual stub to prevent server
13
+ * code in browser bundles. See TIM-568 for why src/ remapping was
14
+ * removed.
12
15
  *
13
16
  * Design doc: 18-build-system.md §"Shim Map"
14
17
  */
@@ -16,7 +19,7 @@
16
19
  import type { Plugin } from 'vite';
17
20
  import { resolve, dirname } from 'node:path';
18
21
  import { fileURLToPath } from 'node:url';
19
- import type { PluginContext } from '#/index.js';
22
+ import type { PluginContext } from '../index.js';
20
23
 
21
24
  const __dirname = dirname(fileURLToPath(import.meta.url));
22
25
  // Detect whether we're running from source (src/plugins/) or dist (dist/).
@@ -88,14 +91,14 @@ export function timberShims(_ctx: PluginContext): Plugin {
88
91
  * 3. Check next/* shim map
89
92
  * 4. Return null (pass through) for everything else
90
93
  *
91
- * @timber-js/app/server is resolved to src/ so it shares the same module
92
- * instance as framework internals (which import via #/). This ensures
93
- * a single requestContextAls and _getRscFallback variable.
94
+ * All @timber-js/app/* subpath imports resolve to dist/ via package.json
95
+ * exports in all environments. This ensures a single module instance
96
+ * for each module the dist/ chunks share code via rollup's code
97
+ * splitting. No src/ remapping is needed (see TIM-568).
94
98
  *
95
- * @timber-js/app/client is resolved to src/ in the SSR environment so
96
- * client hooks share the same module instance as ssr-entry.ts internals.
97
- * In RSC it resolves to dist/ (via package.json exports) where 'use client'
98
- * is preserved on the entry for client boundary detection.
99
+ * The only exception is @timber-js/app/server in the client (browser)
100
+ * environment, which returns a virtual stub server code must never
101
+ * be bundled into the browser.
99
102
  */
100
103
  resolveId(id: string) {
101
104
  // Poison pill packages — resolve to virtual modules handled by load()
@@ -117,38 +120,15 @@ export function timberShims(_ctx: PluginContext): Plugin {
117
120
  return SHIM_MAP[cleanId];
118
121
  }
119
122
 
120
- // @timber-js/app/server src/ in server environments so user code
121
- // shares the same module instance as framework internals (single ALS).
122
- // In the client environment, return a virtual empty module server
123
- // code must never be bundled into the browser.
123
+ // @timber-js/app/server in the client environment virtual stub.
124
+ // Server code must never be bundled into the browser.
125
+ // In server environments (RSC, SSR), let Vite resolve to dist/ via
126
+ // package.json exports no src/ remap needed.
124
127
  if (cleanId === '@timber-js/app/server') {
125
128
  const envName = (this as unknown as { environment?: { name?: string } }).environment?.name;
126
129
  if (envName === 'client') {
127
130
  return '\0timber:server-empty';
128
131
  }
129
- return resolve(PKG_ROOT, 'src', 'server', 'index.ts');
130
- }
131
-
132
- // @timber-js/app/client → src/ in the SSR environment so client hooks
133
- // (useParams, usePathname, etc.) share the same module instance as
134
- // ssr-entry.ts's internal imports (via #/client/...).
135
- //
136
- // Without this remap, @timber-js/app/client resolves to dist/ (via
137
- // package.json exports), creating a module instance split: ssr-entry.ts
138
- // registers the ALS-backed SSR data provider on the src/ instance of
139
- // ssr-data.ts, but client component hooks read getSsrData() from the
140
- // dist/ instance — which has no provider. Result: hooks like useSegmentParams()
141
- // return empty defaults during SSR.
142
- //
143
- // This remap is SSR-only. The RSC environment still resolves to dist/
144
- // where 'use client' is preserved on the entry (needed for client
145
- // boundary detection). The client (browser) environment uses dist/
146
- // for bundling.
147
- if (cleanId === '@timber-js/app/client') {
148
- const envName = (this as unknown as { environment?: { name?: string } }).environment?.name;
149
- if (envName === 'ssr') {
150
- return resolve(PKG_ROOT, 'src', 'client', 'index.ts');
151
- }
152
132
  }
153
133
 
154
134
  return null;
@@ -10,8 +10,8 @@
10
10
  */
11
11
 
12
12
  import type { Plugin } from 'vite';
13
- import type { PluginContext } from '#/index.js';
14
- import { detectFileDirective } from '#/utils/directive-parser.js';
13
+ import type { PluginContext } from '../index.js';
14
+ import { detectFileDirective } from '../utils/directive-parser.js';
15
15
 
16
16
  // ---------------------------------------------------------------------------
17
17
  // Types
@@ -19,7 +19,7 @@ import type {
19
19
  InterceptionMarker,
20
20
  } from './types.js';
21
21
  import { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS } from './types.js';
22
- import { classifyMetadataRoute, isDynamicMetadataExtension } from '#/server/metadata-routes.js';
22
+ import { classifyMetadataRoute, isDynamicMetadataExtension } from '../server/metadata-routes.js';
23
23
 
24
24
  /**
25
25
  * Pattern matching encoded path delimiters that must be rejected during route discovery.
@@ -15,7 +15,7 @@
15
15
 
16
16
  import { readFileSync } from 'node:fs';
17
17
  import type { RouteTree, SegmentNode } from './types.js';
18
- import { detectFileDirective } from '#/utils/directive-parser.js';
18
+ import { detectFileDirective } from '../utils/directive-parser.js';
19
19
 
20
20
  /** Extensions that require 'use client' (component files, not MDX/JSON). */
21
21
  const CLIENT_REQUIRED_EXTENSIONS = new Set(['tsx', 'jsx', 'ts', 'js']);
@@ -10,9 +10,9 @@
10
10
  * Design doc: design/23-search-params.md §"defineSearchParams — The Factory"
11
11
  */
12
12
 
13
- import { useQueryStates as clientUseQueryStates } from '#/client/use-query-states.js';
13
+ import { useQueryStates as clientUseQueryStates } from '../client/use-query-states.js';
14
14
  import { fromSchema } from './codecs.js';
15
- import type { Codec } from '#/codec.js';
15
+ import type { Codec } from '../codec.js';
16
16
 
17
17
  // Server-only reference for .load() — avoids pulling server ALS into client bundles.
18
18
  // In client environments, .load() throws before reaching this code path.
@@ -1,7 +1,7 @@
1
1
  // @timber-js/app/search-params — Typed search params
2
2
 
3
3
  // Shared codec protocol
4
- export type { Codec } from '#/codec.js';
4
+ export type { Codec } from '../codec.js';
5
5
 
6
6
  // Core types and factory
7
7
  export type {
@@ -183,7 +183,7 @@ async function runActionMiddleware<TCtx>(
183
183
 
184
184
  // Re-export parseFormData for use throughout the framework
185
185
  import { parseFormData } from './form-data.js';
186
- import { formatSize } from '#/utils/format.js';
186
+ import { formatSize } from '../utils/format.js';
187
187
  import { isDebug, isDevMode } from './debug.js';
188
188
 
189
189
  /**
@@ -18,7 +18,7 @@ import {
18
18
  decodeReply,
19
19
  decodeAction,
20
20
  renderToReadableStream,
21
- } from '#/rsc-runtime/rsc.js';
21
+ } from '../rsc-runtime/rsc.js';
22
22
 
23
23
  import { validateCsrf, type CsrfConfig } from './csrf.js';
24
24
  import { executeAction, type RevalidateRenderer } from './actions.js';
@@ -14,7 +14,7 @@
14
14
  * See design/08-forms-and-actions.md
15
15
  */
16
16
 
17
- import type { CacheHandler } from '#/cache/index';
17
+ import type { CacheHandler } from '../cache/index';
18
18
  import { RedirectSignal } from './primitives';
19
19
  import { withSpan } from './tracing';
20
20
  import { revalidationAls, type RevalidationState } from './als-registry.js';
@@ -21,6 +21,7 @@
21
21
  */
22
22
 
23
23
  import { AsyncLocalStorage } from 'node:async_hooks';
24
+ import type { DebugComponentEntry } from './rsc-entry/helpers.js';
24
25
 
25
26
  // ─── Request Context ──────────────────────────────────────────────────────
26
27
  // Used by: request-context.ts (headers(), cookies(), searchParams())
@@ -64,6 +65,12 @@ export interface RequestContextStore {
64
65
  flushed: boolean;
65
66
  /** Whether the current context allows cookie mutation. */
66
67
  mutableContext: boolean;
68
+ /**
69
+ * Dev-only: getter for the current request's RSC debug components.
70
+ * Set by renderRoute() so onPipelineError can include component tree
71
+ * context for render-phase errors without module-level shared state.
72
+ */
73
+ debugComponentsGetter?: () => DebugComponentEntry[];
67
74
  }
68
75
 
69
76
  /** A single outgoing cookie entry in the cookie jar. */
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import { createElement } from 'react';
19
- import { renderToReadableStream } from '#/rsc-runtime/rsc.js';
19
+ import { renderToReadableStream } from '../rsc-runtime/rsc.js';
20
20
 
21
21
  import { DenySignal } from './primitives.js';
22
22
  import { logRenderError } from './logger.js';
@@ -29,6 +29,7 @@ import type { NavContext } from './ssr-entry.js';
29
29
  import { flightInitScript } from './flight-scripts.js';
30
30
  import type { ClientBootstrapConfig } from './html-injectors.js';
31
31
  import type { Metadata } from './types.js';
32
+ import { teeWithErrorPropagation } from './stream-utils.js';
32
33
 
33
34
  /** RSC content type for client navigation payload requests. */
34
35
  const RSC_CONTENT_TYPE = 'text/x-component';
@@ -171,7 +172,7 @@ export async function renderDenyPage(
171
172
  debugChannel: createDebugChannelSink(),
172
173
  });
173
174
 
174
- const [ssrStream, inlineStream] = rscStream.tee();
175
+ const [ssrStream, inlineStream] = teeWithErrorPropagation(rscStream);
175
176
 
176
177
  const navContext: NavContext = {
177
178
  pathname: new URL(req.url).pathname,
@@ -5,7 +5,7 @@
5
5
  * See design/10-error-handling.md.
6
6
  */
7
7
 
8
- import { TimberErrorBoundary } from '#/client/error-boundary.js';
8
+ import { TimberErrorBoundary } from '../client/error-boundary.js';
9
9
  import type { ManifestSegmentNode } from './route-matcher.js';
10
10
 
11
11
  /** MDX/markdown extensions — server components that cannot be passed as function props. */
@@ -10,11 +10,11 @@
10
10
  * exposed to the client (design/13-security.md principle 4).
11
11
  */
12
12
 
13
- import type { RouteMatch } from '#/server/pipeline.js';
14
- import type { ManifestSegmentNode } from '#/server/route-matcher.js';
15
- import type { ClientBootstrapConfig } from '#/server/html-injectors.js';
16
- import type { LayoutEntry } from '#/server/deny-renderer.js';
17
- import type { GlobalErrorFile } from '#/server/rsc-entry/error-renderer.js';
13
+ import type { RouteMatch } from './pipeline.js';
14
+ import type { ManifestSegmentNode } from './route-matcher.js';
15
+ import type { ClientBootstrapConfig } from './html-injectors.js';
16
+ import type { LayoutEntry } from './deny-renderer.js';
17
+ import type { GlobalErrorFile } from './rsc-entry/error-renderer.js';
18
18
 
19
19
  /**
20
20
  * Render a fallback error page when the render pipeline throws.
@@ -35,7 +35,7 @@ export async function renderFallbackError(
35
35
  return renderDevErrorPage(error);
36
36
  }
37
37
  // Lazy import to avoid loading error-renderer in the pipeline module
38
- const { renderErrorPage } = await import('#/server/rsc-entry/error-renderer.js');
38
+ const { renderErrorPage } = await import('./rsc-entry/error-renderer.js');
39
39
  const segments = [rootSegment];
40
40
  const layoutComponents: LayoutEntry[] = [];
41
41
  if (rootSegment.layout) {
@@ -26,7 +26,7 @@ export interface InterceptionMatchResult {
26
26
  export function findInterceptionMatch(
27
27
  targetPathname: string,
28
28
  sourceUrl: string,
29
- rewrites: import('#/routing/interception.js').InterceptionRewrite[]
29
+ rewrites: import('../routing/interception.js').InterceptionRewrite[]
30
30
  ): InterceptionMatchResult | null {
31
31
  for (const rewrite of rewrites) {
32
32
  // Check if the source URL starts with the intercepting prefix
@@ -48,7 +48,7 @@ import { checkVersionSkew, applyReloadHeaders } from './version-skew.js';
48
48
  import { serveStaticMetadataFile, serializeSitemap } from './pipeline-metadata.js';
49
49
  import { findInterceptionMatch } from './pipeline-interception.js';
50
50
  import type { MiddlewareContext } from './types.js';
51
- import type { SegmentNode } from '#/routing/types.js';
51
+ import type { SegmentNode } from '../routing/types.js';
52
52
 
53
53
  // ─── Route Match Result ────────────────────────────────────────────────────
54
54
 
@@ -118,7 +118,7 @@ export interface PipelineConfig {
118
118
  * Generated at build time from intercepting route directories.
119
119
  * See design/07-routing.md §"Intercepting Routes"
120
120
  */
121
- interceptionRewrites?: import('#/routing/interception.js').InterceptionRewrite[];
121
+ interceptionRewrites?: import('../routing/interception.js').InterceptionRewrite[];
122
122
  /**
123
123
  * Control Server-Timing header output.
124
124
  *
@@ -7,7 +7,7 @@ import type { JsonSerializable } from './types.js';
7
7
  import { getWaitUntil as _getWaitUntil } from './waituntil-bridge.js';
8
8
  import { isDebug } from './debug.js';
9
9
  import { getRequestSearchString } from './request-context.js';
10
- import { mergePreservedSearchParams } from '#/shared/merge-search-params.js';
10
+ import { mergePreservedSearchParams } from '../shared/merge-search-params.js';
11
11
 
12
12
  // ─── Dev-mode validation ────────────────────────────────────────────────────
13
13
 
@@ -12,7 +12,8 @@
12
12
 
13
13
  import { requestContextAls, type RequestContextStore, type CookieEntry } from './als-registry.js';
14
14
  import { isDebug } from './debug.js';
15
- import { _setRawSearchParamsFn } from '#/search-params/define.js';
15
+ import { _setRawSearchParamsFn } from '../search-params/define.js';
16
+ import { _setRawSegmentParamsFn } from '../params/define.js';
16
17
 
17
18
  // Re-export the ALS for framework-internal consumers that need direct access.
18
19
  export { requestContextAls };
@@ -185,6 +186,11 @@ export function rawSearchParams(): Promise<URLSearchParams> {
185
186
  // breaking rawSearchParams() in parallel slot pages. See TIM-523.
186
187
  _setRawSearchParamsFn(rawSearchParams);
187
188
 
189
+ // Eagerly register rawSegmentParams with the params module so
190
+ // segmentParams.load() can call it synchronously without a dynamic import.
191
+ // Same pattern as search params — dynamic imports lose ALS context. See TIM-523.
192
+ _setRawSegmentParamsFn(rawSegmentParams);
193
+
188
194
  /**
189
195
  * Returns a Promise resolving to the current request's coerced segment params.
190
196
  *
@@ -27,7 +27,7 @@ import { METADATA_ROUTE_CONVENTIONS, getMetadataRouteAutoLink } from './metadata
27
27
  import { DenySignal, RedirectSignal } from './primitives.js';
28
28
  import { AccessGate } from './access-gate.js';
29
29
  import { resolveSlotElement } from './slot-resolver.js';
30
- import { SegmentProvider } from '#/client/segment-context.js';
30
+ import { SegmentProvider } from '../client/segment-context.js';
31
31
 
32
32
  import { wrapSegmentWithErrorBoundaries } from './error-boundary-wrapper.js';
33
33
  import type { InterceptionContext } from './pipeline.js';
@@ -6,13 +6,13 @@
6
6
  * See design/04-authorization.md §"Auth in API Routes".
7
7
  */
8
8
 
9
- import { withSpan, setSpanAttribute } from '#/server/tracing.js';
10
- import type { ManifestSegmentNode } from '#/server/route-matcher.js';
11
- import type { RouteMatch } from '#/server/pipeline.js';
12
- import { DenySignal, RedirectSignal } from '#/server/primitives.js';
13
- import { handleRouteRequest } from '#/server/route-handler.js';
14
- import type { RouteModule } from '#/server/route-handler.js';
15
- import type { RouteContext } from '#/server/types.js';
9
+ import { withSpan, setSpanAttribute } from '../tracing.js';
10
+ import type { ManifestSegmentNode } from '../route-matcher.js';
11
+ import type { RouteMatch } from '../pipeline.js';
12
+ import { DenySignal, RedirectSignal } from '../primitives.js';
13
+ import { handleRouteRequest } from '../route-handler.js';
14
+ import type { RouteModule } from '../route-handler.js';
15
+ import type { RouteContext } from '../types.js';
16
16
 
17
17
  export async function handleApiRoute(
18
18
  req: Request,
@@ -90,7 +90,7 @@ async function renderApiDeny(
90
90
  segments: ManifestSegmentNode[],
91
91
  responseHeaders: Headers
92
92
  ): Promise<Response> {
93
- const { resolveManifestStatusFile } = await import('#/server/manifest-status-resolver.js');
93
+ const { resolveManifestStatusFile } = await import('../manifest-status-resolver.js');
94
94
 
95
95
  const resolution = resolveManifestStatusFile(deny.status, segments, 'json');
96
96
  if (resolution) {