@timber-js/app 0.2.0-alpha.137 → 0.2.0-alpha.139

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 (108) hide show
  1. package/dist/_chunks/{actions-CHFblsdT.js → actions-DzFMnUAR.js} +7 -7
  2. package/dist/_chunks/{actions-CHFblsdT.js.map → actions-DzFMnUAR.js.map} +1 -1
  3. package/dist/_chunks/{build-output-helper-CfBfOU9m.js → build-output-helper-B20ZuTSA.js} +1 -1
  4. package/dist/_chunks/{build-output-helper-CfBfOU9m.js.map → build-output-helper-B20ZuTSA.js.map} +1 -1
  5. package/dist/_chunks/{cli-schema-sync-q-Ce6-iG.js → cli-schema-sync-D2IpXicg.js} +5 -5
  6. package/dist/_chunks/cli-schema-sync-D2IpXicg.js.map +1 -0
  7. package/dist/_chunks/{cli-schema-sync-CObqjGWF.js → cli-schema-sync-DH-M8Poy.js} +1 -1
  8. package/dist/_chunks/{codec-registry-G9hD5LOq.js → codec-registry-oOUxugz3.js} +1 -1
  9. package/dist/_chunks/{codec-registry-G9hD5LOq.js.map → codec-registry-oOUxugz3.js.map} +1 -1
  10. package/dist/_chunks/{define-DXWUJb-K.js → define-C3RvHQPK.js} +3 -3
  11. package/dist/_chunks/{define-DXWUJb-K.js.map → define-C3RvHQPK.js.map} +1 -1
  12. package/dist/_chunks/{define-Dp-qu3ql.js → define-DMVhsipD.js} +3 -3
  13. package/dist/_chunks/{define-Dp-qu3ql.js.map → define-DMVhsipD.js.map} +1 -1
  14. package/dist/_chunks/{fast-hash-DXZ7S2D5.js → fast-hash-D6hIVt1Y.js} +1 -1
  15. package/dist/_chunks/{fast-hash-DXZ7S2D5.js.map → fast-hash-D6hIVt1Y.js.map} +1 -1
  16. package/dist/_chunks/{format-CR6v1pWE.js → format-CfwjgPz9.js} +1 -1
  17. package/dist/_chunks/{format-CR6v1pWE.js.map → format-CfwjgPz9.js.map} +1 -1
  18. package/dist/_chunks/{handler-store-aQMpqPe7.js → handler-store-DjISKYEB.js} +1 -1
  19. package/dist/_chunks/{handler-store-aQMpqPe7.js.map → handler-store-DjISKYEB.js.map} +1 -1
  20. package/dist/_chunks/{href-validation-2G-HZaQ8.js → href-validation-EZktELp8.js} +1 -1
  21. package/dist/_chunks/{href-validation-2G-HZaQ8.js.map → href-validation-EZktELp8.js.map} +1 -1
  22. package/dist/_chunks/{logger-CMd9P1xQ.js → logger-Dt-jQaBO.js} +2 -2
  23. package/dist/_chunks/{logger-CMd9P1xQ.js.map → logger-Dt-jQaBO.js.map} +1 -1
  24. package/dist/_chunks/{metadata-routes-DESG8uk5.js → metadata-routes-BjepjefT.js} +1 -1
  25. package/dist/_chunks/{metadata-routes-DESG8uk5.js.map → metadata-routes-BjepjefT.js.map} +1 -1
  26. package/dist/_chunks/{navigation-root-BQqFQI-n.js → navigation-root-DLc4s4ZC.js} +3 -3
  27. package/dist/_chunks/{navigation-root-BQqFQI-n.js.map → navigation-root-DLc4s4ZC.js.map} +1 -1
  28. package/dist/_chunks/{registry-Dp_hJL4s.js → registry-DbJPKoBp.js} +1 -1
  29. package/dist/_chunks/{registry-Dp_hJL4s.js.map → registry-DbJPKoBp.js.map} +1 -1
  30. package/dist/_chunks/{resolve-schema-D3CbcdCW.js → resolve-schema-Dj8tQloi.js} +2 -2
  31. package/dist/_chunks/{resolve-schema-D3CbcdCW.js.map → resolve-schema-Dj8tQloi.js.map} +1 -1
  32. package/dist/_chunks/{router-ref-B50j42zB.js → router-ref-CtmF-aPv.js} +2 -2
  33. package/dist/_chunks/{router-ref-B50j42zB.js.map → router-ref-CtmF-aPv.js.map} +1 -1
  34. package/dist/_chunks/{schema-bridge-Cuy8BaYu.js → schema-bridge-DK_89h8O.js} +1 -1
  35. package/dist/_chunks/{schema-bridge-Cuy8BaYu.js.map → schema-bridge-DK_89h8O.js.map} +1 -1
  36. package/dist/_chunks/{segment-classify-BjfuctV2.js → segment-classify-CDDRVKs7.js} +1 -1
  37. package/dist/_chunks/{segment-classify-BjfuctV2.js.map → segment-classify-CDDRVKs7.js.map} +1 -1
  38. package/dist/_chunks/{segment-context-BnxoPSFQ.js → segment-context-ZDnXDkbz.js} +1 -1
  39. package/dist/_chunks/{segment-context-BnxoPSFQ.js.map → segment-context-ZDnXDkbz.js.map} +1 -1
  40. package/dist/_chunks/{ssr-data-DxXyoRrz.js → ssr-data-BOWsq18U.js} +1 -1
  41. package/dist/_chunks/{ssr-data-DxXyoRrz.js.map → ssr-data-BOWsq18U.js.map} +1 -1
  42. package/dist/_chunks/{tracing-DP5djRq5.js → tracing-M_zKubhk.js} +1 -1
  43. package/dist/_chunks/{tracing-DP5djRq5.js.map → tracing-M_zKubhk.js.map} +1 -1
  44. package/dist/_chunks/{use-query-states-D9SBlAfp.js → use-query-states-CbeQmext.js} +2 -2
  45. package/dist/_chunks/{use-query-states-D9SBlAfp.js.map → use-query-states-CbeQmext.js.map} +1 -1
  46. package/dist/_chunks/{use-segment-params-x2poKmk8.js → use-segment-params-D1CzlgBo.js} +2 -2
  47. package/dist/_chunks/{use-segment-params-x2poKmk8.js.map → use-segment-params-D1CzlgBo.js.map} +1 -1
  48. package/dist/_chunks/{validation-BoWM_qI1.js → validation-taUkvA4Q.js} +1 -1
  49. package/dist/_chunks/{validation-BoWM_qI1.js.map → validation-taUkvA4Q.js.map} +1 -1
  50. package/dist/_chunks/{walkers-BbEu2_Pp.js → walkers-7FBPM-hX.js} +3 -3
  51. package/dist/_chunks/{walkers-BbEu2_Pp.js.map → walkers-7FBPM-hX.js.map} +1 -1
  52. package/dist/_chunks/{warnings-CAzunaGo.js → warnings-CNPXaypM.js} +2 -2
  53. package/dist/_chunks/{warnings-CAzunaGo.js.map → warnings-CNPXaypM.js.map} +1 -1
  54. package/dist/adapters/cloudflare-dev.js.map +1 -1
  55. package/dist/adapters/cloudflare-kv-cache.js.map +1 -1
  56. package/dist/adapters/cloudflare.js +1 -1
  57. package/dist/adapters/cloudflare.js.map +1 -1
  58. package/dist/adapters/nitro.js +1 -1
  59. package/dist/adapters/nitro.js.map +1 -1
  60. package/dist/cache/index.js +4 -4
  61. package/dist/cache/index.js.map +1 -1
  62. package/dist/cli.js +1 -1
  63. package/dist/cli.js.map +1 -1
  64. package/dist/client/error-boundary.js +2 -2
  65. package/dist/client/error-boundary.js.map +1 -1
  66. package/dist/client/index.js +9 -9
  67. package/dist/client/index.js.map +1 -1
  68. package/dist/client/internal.js +88 -8
  69. package/dist/client/internal.js.map +1 -1
  70. package/dist/client/navigation-api.d.ts.map +1 -1
  71. package/dist/codec.js +1 -1
  72. package/dist/codec.js.map +1 -1
  73. package/dist/cookies/index.js +3 -3
  74. package/dist/cookies/index.js.map +1 -1
  75. package/dist/index.js +110 -13
  76. package/dist/index.js.map +1 -1
  77. package/dist/params/index.js +2 -2
  78. package/dist/params/index.js.map +1 -1
  79. package/dist/plugin-context.d.ts +7 -0
  80. package/dist/plugin-context.d.ts.map +1 -1
  81. package/dist/plugins/adapter-build.d.ts +19 -0
  82. package/dist/plugins/adapter-build.d.ts.map +1 -1
  83. package/dist/plugins/build-manifest.d.ts +5 -1
  84. package/dist/plugins/build-manifest.d.ts.map +1 -1
  85. package/dist/routing/index.js +3 -3
  86. package/dist/search-params/index.js +3 -3
  87. package/dist/search-params/index.js.map +1 -1
  88. package/dist/segment-params/index.js +1 -1
  89. package/dist/server/early-hints.d.ts +0 -6
  90. package/dist/server/early-hints.d.ts.map +1 -1
  91. package/dist/server/index.js +3 -3
  92. package/dist/server/index.js.map +1 -1
  93. package/dist/server/internal.js +8 -19
  94. package/dist/server/internal.js.map +1 -1
  95. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  96. package/dist/shims/font-google.js.map +1 -1
  97. package/dist/shims/font-local.js.map +1 -1
  98. package/dist/shims/image.d.ts +1 -1
  99. package/package.json +3 -3
  100. package/src/client/navigation-api.ts +6 -0
  101. package/src/plugin-context.ts +7 -0
  102. package/src/plugins/adapter-build.ts +86 -0
  103. package/src/plugins/build-manifest.ts +99 -17
  104. package/src/server/early-hints.ts +0 -13
  105. package/src/server/rsc-entry/render-route.ts +12 -12
  106. package/dist/_chunks/cli-schema-sync-q-Ce6-iG.js.map +0 -1
  107. package/dist/_chunks/stale-reload-DIIIVGh_.js +0 -84
  108. package/dist/_chunks/stale-reload-DIIIVGh_.js.map +0 -1
@@ -1,84 +0,0 @@
1
- import { t as __exportAll } from "../index.js";
2
- //#region src/client/stale-reload.ts
3
- var stale_reload_exports = /* @__PURE__ */ __exportAll({
4
- isStaleClientReference: () => isStaleClientReference,
5
- triggerStaleReload: () => triggerStaleReload
6
- });
7
- /**
8
- * Stale Client Reference Reload
9
- *
10
- * When a new deployment ships updated bundles, clients running stale
11
- * JavaScript may encounter "Could not find the module" errors during
12
- * RSC Flight stream decoding. This happens because the RSC payload
13
- * references module IDs from the new bundle that don't exist in the
14
- * old client bundle.
15
- *
16
- * This module detects these specific errors and triggers a full page
17
- * reload so the browser fetches the new bundle. A sessionStorage flag
18
- * guards against infinite reload loops.
19
- *
20
- * See: LOCAL-332
21
- */
22
- var RELOAD_FLAG_KEY = "__timber_stale_reload";
23
- /**
24
- * In-memory fallback counter for environments where sessionStorage is
25
- * unavailable (private browsing, storage full, extension interference).
26
- * Incremented each time triggerStaleReload() falls into the catch path.
27
- * If the counter exceeds 0 on a subsequent call, the reload is suppressed
28
- * to prevent an infinite loop. Resets naturally on page load (module
29
- * re-evaluates) and can be manually reset via clearStaleReloadFlag().
30
- */
31
- var memoryReloadCount = 0;
32
- /**
33
- * Check if an error is a stale client reference error from React's
34
- * Flight client. These errors have the message pattern:
35
- * "Could not find the module \"<id>\""
36
- *
37
- * This is thrown by react-server-dom-webpack's client when the RSC
38
- * payload references a module ID that doesn't exist in the client's
39
- * module map — typically because the server has been redeployed with
40
- * new bundle hashes while the client is still running old JavaScript.
41
- */
42
- function isStaleClientReference(error) {
43
- if (!(error instanceof Error)) return false;
44
- const msg = error.message;
45
- return msg.includes("Could not find the module") || msg.includes("client reference not found");
46
- }
47
- /**
48
- * Trigger a full page reload to pick up new bundles.
49
- *
50
- * Sets a sessionStorage flag before reloading. If the flag is already
51
- * set (meaning we already reloaded once for this reason), we don't
52
- * reload again — this prevents infinite reload loops if the error
53
- * persists after reload (e.g., a genuine bug rather than a stale bundle).
54
- *
55
- * @returns true if a reload was triggered, false if suppressed (loop guard)
56
- */
57
- function triggerStaleReload() {
58
- try {
59
- if (sessionStorage.getItem(RELOAD_FLAG_KEY)) {
60
- console.warn("[timber] Stale client reference detected again after reload. Not reloading to prevent infinite loop. This may indicate a deployment issue — try a hard refresh.");
61
- return false;
62
- }
63
- sessionStorage.setItem(RELOAD_FLAG_KEY, "1");
64
- console.warn("[timber] Stale client reference detected — the server has been redeployed with new bundles. Reloading to pick up the new version.");
65
- window.location.reload();
66
- return true;
67
- } catch {
68
- if (document.cookie.includes(RELOAD_FLAG_KEY + "=1") || memoryReloadCount > 0) {
69
- console.warn("[timber] Stale client reference detected again after reload. Not reloading to prevent infinite loop. This may indicate a deployment issue — try a hard refresh.");
70
- return false;
71
- }
72
- memoryReloadCount++;
73
- try {
74
- document.cookie = `${RELOAD_FLAG_KEY}=1; max-age=60; path=/; SameSite=Lax`;
75
- } catch {}
76
- console.warn("[timber] Stale client reference detected — the server has been redeployed with new bundles. Reloading to pick up the new version.");
77
- window.location.reload();
78
- return true;
79
- }
80
- }
81
- //#endregion
82
- export { stale_reload_exports as n, triggerStaleReload as r, isStaleClientReference as t };
83
-
84
- //# sourceMappingURL=stale-reload-DIIIVGh_.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stale-reload-DIIIVGh_.js","names":[],"sources":["../../src/client/stale-reload.ts"],"sourcesContent":["/**\n * Stale Client Reference Reload\n *\n * When a new deployment ships updated bundles, clients running stale\n * JavaScript may encounter \"Could not find the module\" errors during\n * RSC Flight stream decoding. This happens because the RSC payload\n * references module IDs from the new bundle that don't exist in the\n * old client bundle.\n *\n * This module detects these specific errors and triggers a full page\n * reload so the browser fetches the new bundle. A sessionStorage flag\n * guards against infinite reload loops.\n *\n * See: LOCAL-332\n */\n\nconst RELOAD_FLAG_KEY = '__timber_stale_reload';\n\n/**\n * In-memory fallback counter for environments where sessionStorage is\n * unavailable (private browsing, storage full, extension interference).\n * Incremented each time triggerStaleReload() falls into the catch path.\n * If the counter exceeds 0 on a subsequent call, the reload is suppressed\n * to prevent an infinite loop. Resets naturally on page load (module\n * re-evaluates) and can be manually reset via clearStaleReloadFlag().\n */\nlet memoryReloadCount = 0;\n\n/**\n * Check if an error is a stale client reference error from React's\n * Flight client. These errors have the message pattern:\n * \"Could not find the module \\\"<id>\\\"\"\n *\n * This is thrown by react-server-dom-webpack's client when the RSC\n * payload references a module ID that doesn't exist in the client's\n * module map — typically because the server has been redeployed with\n * new bundle hashes while the client is still running old JavaScript.\n */\nexport function isStaleClientReference(error: unknown): boolean {\n if (!(error instanceof Error)) return false;\n const msg = error.message;\n return msg.includes('Could not find the module') || msg.includes('client reference not found');\n}\n\n/**\n * Check if an error is a chunk load failure from a dynamic import.\n *\n * After a deployment, old chunk filenames no longer exist. When the client\n * tries to dynamically import a chunk that's been replaced, the browser\n * throws one of these errors:\n *\n * - Chromium: \"Failed to fetch dynamically imported module: <url>\"\n * - Firefox: \"error loading dynamically imported module: <url>\"\n * - Safari: \"Importing a module script failed.\"\n * - Vite/Rollup: \"Unable to preload CSS for <url>\"\n *\n * See TIM-446\n */\nexport function isChunkLoadError(error: unknown): boolean {\n if (!(error instanceof Error)) return false;\n const msg = error.message.toLowerCase();\n return (\n msg.includes('failed to fetch dynamically imported module') ||\n msg.includes('error loading dynamically imported module') ||\n msg.includes('importing a module script failed') ||\n msg.includes('unable to preload css') ||\n // Webpack-style chunk load errors (unlikely in Vite but defensive)\n msg.includes('loading chunk') ||\n msg.includes('loading css chunk')\n );\n}\n\n/**\n * Trigger a full page reload to pick up new bundles.\n *\n * Sets a sessionStorage flag before reloading. If the flag is already\n * set (meaning we already reloaded once for this reason), we don't\n * reload again — this prevents infinite reload loops if the error\n * persists after reload (e.g., a genuine bug rather than a stale bundle).\n *\n * @returns true if a reload was triggered, false if suppressed (loop guard)\n */\nexport function triggerStaleReload(): boolean {\n try {\n // Check if we already reloaded — prevent infinite loop\n if (sessionStorage.getItem(RELOAD_FLAG_KEY)) {\n console.warn(\n '[timber] Stale client reference detected again after reload. ' +\n 'Not reloading to prevent infinite loop. ' +\n 'This may indicate a deployment issue — try a hard refresh.'\n );\n return false;\n }\n\n // Set the flag before reloading\n sessionStorage.setItem(RELOAD_FLAG_KEY, '1');\n\n console.warn(\n '[timber] Stale client reference detected — the server has been ' +\n 'redeployed with new bundles. Reloading to pick up the new version.'\n );\n\n window.location.reload();\n return true;\n } catch {\n // sessionStorage unavailable (private browsing, storage full, etc.)\n // Use document.cookie as a reload-persistent fallback loop guard.\n // Module-level memoryReloadCount resets on every reload, so it can't\n // detect cross-reload loops. Cookies persist across reloads and are\n // available even when sessionStorage is blocked (TIM-576).\n const cookieFlag = document.cookie.includes(RELOAD_FLAG_KEY + '=1');\n if (cookieFlag || memoryReloadCount > 0) {\n console.warn(\n '[timber] Stale client reference detected again after reload. ' +\n 'Not reloading to prevent infinite loop. ' +\n 'This may indicate a deployment issue — try a hard refresh.'\n );\n return false;\n }\n\n memoryReloadCount++;\n // Set a short-lived cookie (60s) as the persistent loop guard.\n // It auto-expires so it won't block future legitimate reloads.\n try {\n document.cookie = `${RELOAD_FLAG_KEY}=1; max-age=60; path=/; SameSite=Lax`;\n } catch {\n // Cookie API unavailable — proceed anyway, memoryReloadCount guards same-page loops\n }\n console.warn(\n '[timber] Stale client reference detected — the server has been ' +\n 'redeployed with new bundles. Reloading to pick up the new version.'\n );\n window.location.reload();\n return true;\n }\n}\n\n/**\n * Clear the stale reload flag. Called on successful bootstrap to reset\n * the loop guard — if the page loaded successfully, the next stale\n * reference error should trigger a fresh reload attempt.\n */\nexport function clearStaleReloadFlag(): void {\n memoryReloadCount = 0;\n try {\n sessionStorage.removeItem(RELOAD_FLAG_KEY);\n } catch {\n // sessionStorage unavailable — nothing to clear\n }\n // Also clear the cookie fallback\n try {\n document.cookie = `${RELOAD_FLAG_KEY}=; max-age=0; path=/; SameSite=Lax`;\n } catch {\n // Cookie API unavailable\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,kBAAkB;;;;;;;;;AAUxB,IAAI,oBAAoB;;;;;;;;;;;AAYxB,SAAgB,uBAAuB,OAAyB;CAC9D,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,MAAM,MAAM,MAAM;CAClB,OAAO,IAAI,SAAS,4BAA4B,IAAI,IAAI,SAAS,6BAA6B;;;;;;;;;;;;AAyChG,SAAgB,qBAA8B;CAC5C,IAAI;EAEF,IAAI,eAAe,QAAQ,gBAAgB,EAAE;GAC3C,QAAQ,KACN,kKAGD;GACD,OAAO;;EAIT,eAAe,QAAQ,iBAAiB,IAAI;EAE5C,QAAQ,KACN,oIAED;EAED,OAAO,SAAS,QAAQ;EACxB,OAAO;SACD;EAON,IADmB,SAAS,OAAO,SAAS,kBAAkB,KAC1D,IAAc,oBAAoB,GAAG;GACvC,QAAQ,KACN,kKAGD;GACD,OAAO;;EAGT;EAGA,IAAI;GACF,SAAS,SAAS,GAAG,gBAAgB;UAC/B;EAGR,QAAQ,KACN,oIAED;EACD,OAAO,SAAS,QAAQ;EACxB,OAAO"}