@teyik0/furin 0.9.0-alpha.3 → 0.9.0-alpha.5

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 (75) hide show
  1. package/dist/adapter/runtime-build.d.ts +1 -0
  2. package/dist/build/index.js +65 -25
  3. package/dist/build/route-metadata.d.ts +1 -1
  4. package/dist/cli/index.js +65 -25
  5. package/dist/client/chunks/{client-rdxyrw11.js → client-hjqd5m3b.js} +1 -1
  6. package/dist/client/chunks/{client-d9v49jwz.js → client-whph3y67.js} +66 -3
  7. package/dist/client/chunks/{client-a7spxfnn.js → client-xf7r768c.js} +13 -1
  8. package/dist/client/define-route.d.ts +12 -0
  9. package/dist/client/internal/runtime-types.d.ts +7 -0
  10. package/dist/client/link.js +200 -40
  11. package/dist/client/query.d.ts +13 -0
  12. package/dist/client/route-element.d.ts +5 -0
  13. package/dist/client/router/history.d.ts +6 -0
  14. package/dist/client/router/link-utils.d.ts +7 -0
  15. package/dist/client/router/navigation-controller.d.ts +20 -2
  16. package/dist/client/router/pending.d.ts +17 -0
  17. package/dist/client/router/search/index.d.ts +2 -0
  18. package/dist/client/router/search/index.js +7 -3
  19. package/dist/client/router/types.d.ts +21 -1
  20. package/dist/client.d.ts +1 -1
  21. package/dist/client.js +21 -4
  22. package/dist/define-route.d.ts +37 -10
  23. package/dist/furin.js +92 -43
  24. package/dist/plugin/client-plugin.d.ts +1 -1
  25. package/dist/plugin/index.js +36 -17
  26. package/dist/plugin/route-manifest.d.ts +2 -1
  27. package/dist/plugin/strip-server-stages.d.ts +1 -1
  28. package/dist/server/dev/graph.d.ts +0 -1
  29. package/dist/server/internal.d.ts +1 -0
  30. package/dist/server/internal.js +46 -22
  31. package/dist/server/router/defined-route.d.ts +3 -0
  32. package/dist/server/router/hmr.d.ts +0 -1
  33. package/dist/server/router/source-version.d.ts +0 -1
  34. package/dist/server/router/types.d.ts +7 -1
  35. package/dist/server/static-export.js +49 -22
  36. package/dist/server/sync/index.js +1 -1
  37. package/dist/shared/pending.d.ts +13 -0
  38. package/dist/shared/search-params.d.ts +1 -0
  39. package/dist/sync-client.js +1 -1
  40. package/package.json +1 -1
  41. package/src/adapter/runtime-build.ts +4 -0
  42. package/src/build/hydrate.ts +11 -2
  43. package/src/build/preload-manifest.ts +3 -1
  44. package/src/build/route-metadata.ts +3 -2
  45. package/src/client/define-route.ts +23 -3
  46. package/src/client/internal/runtime-types.ts +7 -0
  47. package/src/client/link.tsx +26 -4
  48. package/src/client/query-store.ts +2 -1
  49. package/src/client/query.tsx +87 -0
  50. package/src/client/route-element.tsx +41 -15
  51. package/src/client/router/context.ts +29 -8
  52. package/src/client/router/history.ts +10 -0
  53. package/src/client/router/link-utils.ts +23 -0
  54. package/src/client/router/navigation-controller.ts +239 -19
  55. package/src/client/router/pending.ts +58 -0
  56. package/src/client/router/provider.tsx +5 -2
  57. package/src/client/router/search/index.ts +7 -2
  58. package/src/client/router/types.ts +29 -3
  59. package/src/client.ts +1 -1
  60. package/src/define-route.ts +74 -26
  61. package/src/plugin/client-plugin.ts +5 -4
  62. package/src/plugin/route-config.ts +9 -2
  63. package/src/plugin/route-manifest.ts +11 -3
  64. package/src/plugin/route-tree.ts +2 -2
  65. package/src/plugin/strip-server-stages.ts +60 -35
  66. package/src/server/dev/graph.ts +2 -7
  67. package/src/server/dev/runtime.ts +1 -2
  68. package/src/server/internal.ts +1 -0
  69. package/src/server/router/defined-route.ts +6 -0
  70. package/src/server/router/discovery.ts +5 -2
  71. package/src/server/router/hmr.ts +1 -5
  72. package/src/server/router/source-version.ts +3 -6
  73. package/src/server/router/types.ts +7 -1
  74. package/src/shared/pending.ts +16 -0
  75. package/src/shared/search-params.ts +1 -1
@@ -3,8 +3,9 @@ import { defaultInstanceBucket, scopedInstance } from "../instance.ts";
3
3
 
4
4
  export function routeModuleSourceVersion(path: string): string {
5
5
  // Bun's runtime plugin loads modules outside any runtime scope. Use the
6
- // graphs whose routes depend on this source (or that have no snapshot yet)
7
- // so an unrelated app's refresh cannot change its virtual identity.
6
+ // graphs whose routes depend on this source (or that have no snapshot yet).
7
+ // A version only advances when the source or a recorded dependency changes,
8
+ // so an unchanged module keeps one ESM identity for every importer.
8
9
  const current = devGraph(scopedInstance() ?? defaultInstanceBucket());
9
10
  const relevant = developmentGraphs().filter((graph) => {
10
11
  const { snapshot } = graph;
@@ -22,7 +23,3 @@ export function routeModuleSourceVersion(path: string): string {
22
23
  )
23
24
  );
24
25
  }
25
-
26
- export function invalidateRouteModuleSourceVersions(): void {
27
- devGraph(undefined).invalidateModules();
28
- }
@@ -35,6 +35,11 @@ export interface SegmentBoundary {
35
35
  * except the root's, which is the pages directory.
36
36
  */
37
37
  path: string;
38
+ /**
39
+ * Module declaring the pending screen: a `loading.tsx`, or the route file
40
+ * of a `fromRoute` boundary. Only the client renders it.
41
+ */
42
+ pendingPath?: string;
38
43
  }
39
44
 
40
45
  /** A layout wrapping a page, from the route manifest. */
@@ -58,7 +63,8 @@ export interface ResolvedRoute {
58
63
  routeChain: RuntimeRoute[];
59
64
  /**
60
65
  * Per-directory boundary chain, ordered shallow → deep. Only directories
61
- * that DECLARE at least one of `error.tsx` / `not-found.tsx` are included;
66
+ * that DECLARE at least one of `error.tsx` / `not-found.tsx` / `loading.tsx`
67
+ * (or routes with `.error()` / `.notFound()` / `.pending()`) are included;
62
68
  * directories without conventions are skipped. Empty when no conventions
63
69
  * exist anywhere in the path.
64
70
  */
@@ -0,0 +1,16 @@
1
+ import type { FC } from "react";
2
+
3
+ export type PendingComponent = FC;
4
+
5
+ /** When a navigation shows a route's pending screen (TanStack `pendingMs` / `pendingMinMs`). */
6
+ export interface PendingOptions {
7
+ /** Minimum time the screen stays once shown, so it never blinks. Default: 500. */
8
+ minMs?: number;
9
+ /** Delay before the screen shows, so fast navigations never flash it. Default: 1000. */
10
+ ms?: number;
11
+ }
12
+
13
+ /** A route's `.pending()` (TanStack style) or a directory's `loading.tsx` (Next.js style). */
14
+ export interface RoutePending extends PendingOptions {
15
+ component: PendingComponent;
16
+ }
@@ -48,7 +48,7 @@ function objectsDeepEqual(a: { [key: string]: unknown }, b: { [key: string]: unk
48
48
  return true;
49
49
  }
50
50
 
51
- function deepEqual(a: unknown, b: unknown): boolean {
51
+ export function deepEqual(a: unknown, b: unknown): boolean {
52
52
  if (Object.is(a, b)) {
53
53
  return true;
54
54
  }