@timber-js/app 0.2.0-alpha.17 → 0.2.0-alpha.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA0FA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAE/F;AA6ZD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;8BA/Q3C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;AAiRhD,wBAAiE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA0FA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAE/F;AAoZD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;8BAtQ3C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;AAwQhD,wBAAiE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA6BH;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,iCAA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AgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,EACtC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,OAAO,GACvB,QAAQ,CASV"}
1
+ {"version":3,"file":"ssr-render.d.ts","sourceRoot":"","sources":["../../src/server/ssr-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAmBvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,SAAS,EAClB,OAAO,CAAC,EAAE;IAAE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GAC7F,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAuDrC;AAED;;;;;;;;;;;;GAYG;AACH,2CAA2C;AAC3C,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,UAAU,CAAC,CAkC5B;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,EACtC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,OAAO,GACvB,QAAQ,CASV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.17",
3
+ "version": "0.2.0-alpha.18",
4
4
  "description": "Vite-native React framework for Cloudflare Workers — correct HTTP semantics, real status codes, pages that work without JavaScript",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -325,7 +325,6 @@ async function renderRoute(
325
325
  // Build the React element tree — loads modules, runs access checks,
326
326
  // resolves metadata. DenySignal/RedirectSignal propagate for HTTP handling.
327
327
  let routeResult;
328
- const _t0 = performance.now();
329
328
  try {
330
329
  routeResult = await buildRouteElement(_req, match, interception, clientStateTree);
331
330
  } catch (error) {
@@ -368,7 +367,6 @@ async function renderRoute(
368
367
  const { element, headElements, layoutComponents, deferSuspenseFor, skippedSegments } =
369
368
  routeResult;
370
369
 
371
- const _t1 = performance.now();
372
370
  // Build head HTML for injection into the SSR output.
373
371
  // Collects CSS, fonts, and modulepreload from the build manifest for matched segments.
374
372
  // In dev mode the manifest is empty — Vite HMR handles CSS/JS.
@@ -418,9 +416,7 @@ async function renderRoute(
418
416
  }
419
417
 
420
418
  // Render to RSC Flight stream with signal tracking.
421
- const _t2 = performance.now();
422
419
  const { rscStream, signals } = renderRscStream(element, _req);
423
- const _t3 = performance.now();
424
420
 
425
421
  // Synchronous redirect — redirect() in access.ts or a non-async component
426
422
  // throws during renderToReadableStream creation. Return HTTP redirect.
@@ -487,8 +483,7 @@ async function renderRoute(
487
483
  }
488
484
 
489
485
  // Pipe through SSR for HTML rendering with streaming Suspense support.
490
- const _t4 = performance.now();
491
- const _ssrResult = await renderSsrResponse({
486
+ return renderSsrResponse({
492
487
  req: _req,
493
488
  rscStream: rscStream!,
494
489
  signals,
@@ -501,10 +496,6 @@ async function renderRoute(
501
496
  headHtml,
502
497
  deferSuspenseFor,
503
498
  });
504
- const _t5 = performance.now();
505
- // eslint-disable-next-line no-console
506
- console.log(`[perf] build=${(_t1 - _t0).toFixed(1)}ms head=${(_t2 - _t1).toFixed(1)}ms rsc=${(_t3 - _t2).toFixed(1)}ms setup=${(_t4 - _t3).toFixed(1)}ms ssr=${(_t5 - _t4).toFixed(1)}ms total=${(_t5 - _t0).toFixed(1)}ms`);
507
- return _ssrResult;
508
499
  }
509
500
 
510
501
  // Re-export for generated entry points (e.g., Nitro node-server/bun) to wrap
@@ -137,7 +137,9 @@ export async function handleSsr(
137
137
  // createFromReadableStream resolves client component references
138
138
  // (from "use client" modules) using the SSR environment's module
139
139
  // map, importing the actual components for server-side rendering.
140
+ const _s0 = performance.now();
140
141
  const element = createFromReadableStream(rscStream) as React.ReactNode;
142
+ const _s1 = performance.now();
141
143
 
142
144
  // Wrap with a server-safe nuqs adapter so that 'use client' components
143
145
  // that call nuqs hooks (useQueryStates, useQueryState) can SSR correctly.
@@ -145,6 +147,7 @@ export async function handleSsr(
145
147
  // over after hydration. This provider supplies the request's search params
146
148
  // as a static snapshot so nuqs renders the right initial values on the server.
147
149
  const wrappedElement = withNuqsSsrAdapter(navContext.searchParams, element);
150
+ const _s2 = performance.now();
148
151
 
149
152
  // Render to HTML stream (waits for onShellReady).
150
153
  // Pass bootstrapScriptContent so React injects a non-deferred <script>
@@ -174,10 +177,15 @@ export async function handleSsr(
174
177
  );
175
178
  }
176
179
 
180
+ const _s3 = performance.now();
177
181
  // Inject metadata into <head>, then interleave RSC payload chunks
178
182
  // into the body as they arrive from the tee'd RSC stream.
179
183
  let outputStream = injectHead(htmlStream, navContext.headHtml);
180
184
  outputStream = injectRscPayload(outputStream, navContext.rscStream);
185
+ const _s4 = performance.now();
186
+
187
+ // eslint-disable-next-line no-console
188
+ console.log(`[ssr] decode=${(_s1 - _s0).toFixed(1)}ms nuqs=${(_s2 - _s1).toFixed(1)}ms renderToStream=${(_s3 - _s2).toFixed(1)}ms transforms=${(_s4 - _s3).toFixed(1)}ms total=${(_s4 - _s0).toFixed(1)}ms`);
181
189
 
182
190
  // Build and return the Response.
183
191
  return buildSsrResponse(outputStream, navContext.statusCode, navContext.responseHeaders);
@@ -56,6 +56,7 @@ export async function renderSsrStream(
56
56
  options?: { bootstrapScriptContent?: string; deferSuspenseFor?: number; signal?: AbortSignal }
57
57
  ): Promise<ReadableStream<Uint8Array>> {
58
58
  const signal = options?.signal;
59
+ const _r0 = performance.now();
59
60
  const stream = await renderToReadableStream(element, {
60
61
  bootstrapScriptContent: options?.bootstrapScriptContent || undefined,
61
62
  signal,
@@ -66,6 +67,9 @@ export async function renderSsrStream(
66
67
  console.error('[timber] SSR render error:', formatSsrError(error));
67
68
  },
68
69
  });
70
+ const _r1 = performance.now();
71
+ // eslint-disable-next-line no-console
72
+ console.log(`[ssr-render] renderToReadableStream onShellReady=${(_r1 - _r0).toFixed(1)}ms`);
69
73
 
70
74
  // Prevent unhandled promise rejection from streaming-phase errors.
71
75
  // React DOM Server exposes `allReady` — a promise that resolves when