@timber-js/app 0.2.0-alpha.120 → 0.2.0-alpha.121

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 (94) hide show
  1. package/dist/_chunks/{actions-Cw-7NfJJ.js → actions-Dy8vOjFt.js} +6 -6
  2. package/dist/_chunks/{actions-Cw-7NfJJ.js.map → actions-Dy8vOjFt.js.map} +1 -1
  3. package/dist/_chunks/{build-output-helper-DhxiT18k.js → build-output-helper-B1n0sUqj.js} +1 -1
  4. package/dist/_chunks/{build-output-helper-DhxiT18k.js.map → build-output-helper-B1n0sUqj.js.map} +1 -1
  5. package/dist/_chunks/cli-schema-sync-ByZPGGmS.js +724 -0
  6. package/dist/_chunks/cli-schema-sync-ByZPGGmS.js.map +1 -0
  7. package/dist/_chunks/cli-schema-sync-DHQLjFu3.js +2 -0
  8. package/dist/_chunks/{codec-registry-V7ARyeLN.js → codec-registry-G9hD5LOq.js} +1 -1
  9. package/dist/_chunks/{codec-registry-V7ARyeLN.js.map → codec-registry-G9hD5LOq.js.map} +1 -1
  10. package/dist/_chunks/{define-zQX6e1tN.js → define-CPVQaWbx.js} +3 -3
  11. package/dist/_chunks/{define-zQX6e1tN.js.map → define-CPVQaWbx.js.map} +1 -1
  12. package/dist/_chunks/{define-8zQ8Vm7x.js → define-jeHDXZGq.js} +3 -3
  13. package/dist/_chunks/{define-8zQ8Vm7x.js.map → define-jeHDXZGq.js.map} +1 -1
  14. package/dist/_chunks/{format-CR6v1pWE.js → format-BjN9HLu9.js} +1 -1
  15. package/dist/_chunks/{format-CR6v1pWE.js.map → format-BjN9HLu9.js.map} +1 -1
  16. package/dist/_chunks/{handler-store-iqnt2ghN.js → handler-store-CcwNX-gk.js} +1 -1
  17. package/dist/_chunks/{handler-store-iqnt2ghN.js.map → handler-store-CcwNX-gk.js.map} +1 -1
  18. package/dist/_chunks/{merge-search-params-CwxJzBLS.js → merge-search-params-az6ZiBeU.js} +1 -1
  19. package/dist/_chunks/{merge-search-params-CwxJzBLS.js.map → merge-search-params-az6ZiBeU.js.map} +1 -1
  20. package/dist/_chunks/{navigation-root-DKsJ5Di7.js → navigation-root-DoRTeBm5.js} +2 -2
  21. package/dist/_chunks/{navigation-root-DKsJ5Di7.js.map → navigation-root-DoRTeBm5.js.map} +1 -1
  22. package/dist/_chunks/{registry-Dp_hJL4s.js → registry-BI9cgCt7.js} +1 -1
  23. package/dist/_chunks/{registry-Dp_hJL4s.js.map → registry-BI9cgCt7.js.map} +1 -1
  24. package/dist/_chunks/{resolve-schema-23Mc8aLi.js → resolve-schema-Bf8eC6q6.js} +11 -3
  25. package/dist/_chunks/resolve-schema-Bf8eC6q6.js.map +1 -0
  26. package/dist/_chunks/{router-ref-sektkr-t.js → router-ref-CpvjBqdu.js} +2 -2
  27. package/dist/_chunks/{router-ref-sektkr-t.js.map → router-ref-CpvjBqdu.js.map} +1 -1
  28. package/dist/_chunks/{schema-bridge-eL5vQDSA.js → schema-bridge-o0SwFtXW.js} +1 -1
  29. package/dist/_chunks/{schema-bridge-eL5vQDSA.js.map → schema-bridge-o0SwFtXW.js.map} +1 -1
  30. package/dist/_chunks/{segment-context-Bg0pFbLT.js → segment-context-EsfQpS--.js} +1 -1
  31. package/dist/_chunks/{segment-context-Bg0pFbLT.js.map → segment-context-EsfQpS--.js.map} +1 -1
  32. package/dist/_chunks/{ssr-data-BO5OvEvg.js → ssr-data-m9-cNEIw.js} +1 -1
  33. package/dist/_chunks/{ssr-data-BO5OvEvg.js.map → ssr-data-m9-cNEIw.js.map} +1 -1
  34. package/dist/_chunks/{stale-reload-BCPRG0Cv.js → stale-reload-BN2kcE06.js} +1 -1
  35. package/dist/_chunks/{stale-reload-BCPRG0Cv.js.map → stale-reload-BN2kcE06.js.map} +1 -1
  36. package/dist/_chunks/{use-query-states-D9SBlAfp.js → use-query-states-C9G6LP0F.js} +2 -2
  37. package/dist/_chunks/{use-query-states-D9SBlAfp.js.map → use-query-states-C9G6LP0F.js.map} +1 -1
  38. package/dist/_chunks/{use-segment-params-CskiK-59.js → use-segment-params-CtIAjqK0.js} +2 -2
  39. package/dist/_chunks/{use-segment-params-CskiK-59.js.map → use-segment-params-CtIAjqK0.js.map} +1 -1
  40. package/dist/_chunks/{validation-Bm3Je-09.js → validation-BMU5MPzP.js} +1 -1
  41. package/dist/_chunks/{validation-Bm3Je-09.js.map → validation-BMU5MPzP.js.map} +1 -1
  42. package/dist/_chunks/{walkers-DgOXkTts.js → walkers-DNp9tHyV.js} +116 -6
  43. package/dist/_chunks/walkers-DNp9tHyV.js.map +1 -0
  44. package/dist/adapters/cloudflare.js +1 -1
  45. package/dist/adapters/nitro.js +1 -1
  46. package/dist/cache/index.js +1 -1
  47. package/dist/cli.js +1 -1
  48. package/dist/client/error-boundary.js +2 -2
  49. package/dist/client/index.js +9 -9
  50. package/dist/client/internal.js +7 -7
  51. package/dist/codec.d.ts +18 -0
  52. package/dist/codec.d.ts.map +1 -1
  53. package/dist/codec.js +30 -1
  54. package/dist/codec.js.map +1 -1
  55. package/dist/cookies/index.js +3 -3
  56. package/dist/index.js +30 -21
  57. package/dist/index.js.map +1 -1
  58. package/dist/params/define-schema.d.ts +32 -4
  59. package/dist/params/define-schema.d.ts.map +1 -1
  60. package/dist/params/index.d.ts +1 -1
  61. package/dist/params/index.d.ts.map +1 -1
  62. package/dist/params/index.js +2 -2
  63. package/dist/params/index.js.map +1 -1
  64. package/dist/params/resolve-schema.d.ts.map +1 -1
  65. package/dist/plugins/routing.d.ts.map +1 -1
  66. package/dist/routing/index.d.ts +2 -0
  67. package/dist/routing/index.d.ts.map +1 -1
  68. package/dist/routing/index.js +3 -3
  69. package/dist/routing/scanner.d.ts.map +1 -1
  70. package/dist/routing/schema-validation.d.ts +35 -0
  71. package/dist/routing/schema-validation.d.ts.map +1 -0
  72. package/dist/search-params/index.js +3 -3
  73. package/dist/segment-params/index.js +1 -1
  74. package/dist/server/index.js +2 -2
  75. package/dist/server/internal.js +3 -3
  76. package/package.json +7 -6
  77. package/src/cli.ts +0 -0
  78. package/src/codec.ts +51 -1
  79. package/src/params/define-schema.ts +46 -5
  80. package/src/params/index.ts +7 -1
  81. package/src/params/resolve-schema.ts +13 -0
  82. package/src/plugins/routing.ts +30 -33
  83. package/src/routing/codegen.ts +54 -5
  84. package/src/routing/index.ts +5 -0
  85. package/src/routing/scanner.ts +58 -0
  86. package/src/routing/schema-validation.ts +149 -0
  87. package/LICENSE +0 -8
  88. package/dist/_chunks/cli-schema-sync-XV0I47Gj.js +0 -2
  89. package/dist/_chunks/cli-schema-sync-q2wB0DyJ.js +0 -358
  90. package/dist/_chunks/cli-schema-sync-q2wB0DyJ.js.map +0 -1
  91. package/dist/_chunks/resolve-schema-23Mc8aLi.js.map +0 -1
  92. package/dist/_chunks/scanner-DmfoB7iK.js +0 -336
  93. package/dist/_chunks/scanner-DmfoB7iK.js.map +0 -1
  94. package/dist/_chunks/walkers-DgOXkTts.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { n as setViteServer } from "./_chunks/warnings-B30wpfaS.js";
2
2
  import { h as swallow } from "./_chunks/logger-DDmK5skc.js";
3
- import { t as scanRoutes } from "./_chunks/scanner-DmfoB7iK.js";
4
- import { n as collectInterceptionRewrites, r as generateRouteMap, t as collectLeafRoutes } from "./_chunks/walkers-DgOXkTts.js";
5
- import { a as DEFAULT_BUILD_DIR, c as mergeFileConfig, d as resolveClientJavascript, f as createNoopTimer, l as resolveAppDir, n as findSchemaFile, o as createPluginContext, r as parseExistingSchemaKeys, s as loadTimberConfigFile, t as collectDynamicSegments, u as resolveBuildDir } from "./_chunks/cli-schema-sync-q2wB0DyJ.js";
6
- import { t as formatSize } from "./_chunks/format-CR6v1pWE.js";
3
+ import { a as DEFAULT_BUILD_DIR, c as mergeFileConfig, d as resolveClientJavascript, f as createNoopTimer, l as resolveAppDir, o as createPluginContext, p as scanRoutes, s as loadTimberConfigFile, u as resolveBuildDir } from "./_chunks/cli-schema-sync-ByZPGGmS.js";
4
+ import { a as generateRouteMap, i as collectInterceptionRewrites, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-DNp9tHyV.js";
5
+ import { t as formatSize } from "./_chunks/format-BjN9HLu9.js";
7
6
  import { dirname, extname, join, normalize, resolve } from "node:path";
8
7
  import { createRequire } from "node:module";
9
8
  import react, { reactCompilerPreset } from "@vitejs/plugin-react";
@@ -2349,7 +2348,7 @@ function timberRouting(ctx) {
2349
2348
  ctx.timer.end("route-scan");
2350
2349
  dirToRoute = buildDirToRouteMap(ctx.routeTree, ctx.appDir);
2351
2350
  writeCodegen(ctx);
2352
- warnUnregisteredSegments(ctx);
2351
+ warnSchemaValidation(ctx);
2353
2352
  const newConventionWarnings = lintConventions(ctx.routeTree, ctx.appDir).filter((w) => !warnedFiles.has(w.id));
2354
2353
  if (newConventionWarnings.length > 0) {
2355
2354
  for (const w of newConventionWarnings) warnedFiles.add(w.id);
@@ -2443,22 +2442,32 @@ function timberRouting(ctx) {
2443
2442
  * When the route tree changes, any environment that has imported the manifest
2444
2443
  * needs to be invalidated so the next request/transform picks up the new tree.
2445
2444
  */
2446
- /** Set of segments we've already warned about — avoid repeating on every rescan. */
2447
- var _warnedSegments = /* @__PURE__ */ new Set();
2448
- /**
2449
- * Warn about dynamic segments not registered in app/schema.ts.
2450
- * Only fires when a schema file exists. Logs once per segment per session.
2451
- */
2452
- function warnUnregisteredSegments(ctx) {
2453
- const schemaPath = findSchemaFile(ctx.appDir);
2454
- if (!schemaPath) return;
2455
- const filesystemSegments = collectDynamicSegments(ctx.appDir);
2456
- if (filesystemSegments.length === 0) return;
2457
- const existingKeys = parseExistingSchemaKeys(readFileSync(schemaPath, "utf-8"));
2458
- const missing = filesystemSegments.filter((seg) => !existingKeys.includes(seg) && !_warnedSegments.has(seg));
2459
- if (missing.length === 0) return;
2460
- for (const seg of missing) _warnedSegments.add(seg);
2461
- console.warn(`[timber] New segment${missing.length > 1 ? "s" : ""} not in schema: ${missing.join(", ")}\n Run: timber schema sync`);
2445
+ /** Set of warning keys we've already emitted — avoid repeating on every rescan. */
2446
+ var _warnedKeys = /* @__PURE__ */ new Set();
2447
+ /**
2448
+ * Validate schema keys against the filesystem route tree.
2449
+ * Warns on stale keys, bracket form mismatches, and missing keys.
2450
+ * Uses the already-scanned route tree instead of re-scanning.
2451
+ */
2452
+ function warnSchemaValidation(ctx) {
2453
+ if (!ctx.routeTree) return;
2454
+ const warnings = validateSchemaAgainstRoutes(ctx.routeTree, ctx.appDir);
2455
+ for (const w of warnings) {
2456
+ const warnKey = `${w.type}:${w.key}`;
2457
+ if (_warnedKeys.has(warnKey)) continue;
2458
+ _warnedKeys.add(warnKey);
2459
+ switch (w.type) {
2460
+ case "stale-key":
2461
+ console.warn(`[timber] ${w.message}`);
2462
+ break;
2463
+ case "bracket-mismatch":
2464
+ console.warn(`[timber] ${w.message}`);
2465
+ break;
2466
+ case "missing-key":
2467
+ console.warn(`[timber] ${w.message}`);
2468
+ break;
2469
+ }
2470
+ }
2462
2471
  }
2463
2472
  function invalidateManifest(server) {
2464
2473
  for (const envName of Object.keys(server.environments)) {