@timber-js/app 0.2.0-alpha.51 → 0.2.0-alpha.52

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":"AA8DA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAiCtB;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,mBAAmB,EAAE,KAAK,IAAI,GACtF,IAAI,CAEN;AA+bD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;8BAhS3C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;AAkShD,wBAAiE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA4DA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAiCtB;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,mBAAmB,EAAE,KAAK,IAAI,GACtF,IAAI,CAEN;AAscD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;8BAvS3C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;AAyShD,wBAAiE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.51",
3
+ "version": "0.2.0-alpha.52",
4
4
  "description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -85,18 +85,13 @@ export function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildMan
85
85
  * via injectHead() before </head>.
86
86
  */
87
87
  export function buildCssLinkTags(cssUrls: string[]): string {
88
- // Emit both preload hints and stylesheet links. The preload hints
89
- // ensure the browser starts fetching CSS early (before it parses
90
- // the full <head>). The `as="style"` attribute is required by the
91
- // spec without it browsers emit a console warning.
92
- //
93
- // React's Float system (via @vitejs/plugin-rsc preinit) also emits
94
- // stylesheet links with data-precedence. React deduplicates, so the
95
- // explicit <link rel="stylesheet"> may be dropped. The preload hint
96
- // survives regardless and suppresses the browser warning.
97
- const preloads = cssUrls.map((url) => `<link rel="preload" href="${url}" as="style">`).join('');
98
- const stylesheets = cssUrls.map((url) => `<link rel="stylesheet" href="${url}">`).join('');
99
- return preloads + stylesheets;
88
+ // Emit <link rel="stylesheet"> tags as a fallback for platforms where
89
+ // React's Float system (via @vitejs/plugin-rsc preinit with
90
+ // data-precedence) doesn't handle CSS injection. In practice, Float
91
+ // deduplicates and these may be dropped. No preload hints — Float
92
+ // already starts the fetch via preinit(), and redundant preloads
93
+ // cause "ignored due to unknown as/type" browser warnings.
94
+ return cssUrls.map((url) => `<link rel="stylesheet" href="${url}">`).join('');
100
95
  }
101
96
 
102
97
  /**
@@ -29,10 +29,8 @@ import { handleActionRequest, isActionRequest } from '#/server/action-handler.js
29
29
  import type { BodyLimitsConfig } from '#/server/body-limits.js';
30
30
  import type { BuildManifest } from '#/server/build-manifest.js';
31
31
  import {
32
- buildCssLinkTags,
33
32
  buildFontPreloadTags,
34
33
  buildModulepreloadTags,
35
- collectRouteCss,
36
34
  collectRouteFonts,
37
35
  collectRouteModulepreloads,
38
36
  } from '#/server/build-manifest.js';
@@ -427,10 +425,17 @@ async function renderRoute(
427
425
  const typedManifest = buildManifest as BuildManifest;
428
426
  let headHtml = '';
429
427
 
430
- const cssUrls = collectRouteCss(segments, typedManifest);
431
- if (cssUrls.length > 0) {
432
- headHtml += buildCssLinkTags(cssUrls);
433
- }
428
+ // CSS is handled by the RSC plugin via ReactDOM.preinit() with
429
+ // data-precedence attributes. This injects <link rel="stylesheet">
430
+ // tags during the RSC render phase — before our headHtml injection.
431
+ // We do NOT emit additional <link rel="stylesheet"> tags here because:
432
+ // 1. React's Float system deduplicates them, making ours redundant
433
+ // 2. The duplicate reference confuses React's client-side preload
434
+ // deduplication, causing "preload ignored" browser warnings
435
+ //
436
+ // CSS URLs are still collected for Early Hints (Link headers) in
437
+ // buildEarlyHintsHeaders() — those are HTTP headers, not DOM elements,
438
+ // so they don't conflict with Float.
434
439
 
435
440
  // Inline font CSS as a <style> tag — @font-face rules and scoped classes.
436
441
  // The font CSS is set on globalThis by the transformed font file's