@teyik0/furin 0.9.0-alpha.0 → 0.9.0-alpha.2

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 (100) hide show
  1. package/README.md +1 -1
  2. package/dist/adapter/runtime-build.d.ts +7 -3
  3. package/dist/adapter/vercel.js +31 -6
  4. package/dist/build/client.d.ts +1 -1
  5. package/dist/build/entry-template.d.ts +3 -12
  6. package/dist/build/entry-template.ts +3 -15
  7. package/dist/build/hydrate.d.ts +6 -1
  8. package/dist/build/index.d.ts +1 -1
  9. package/dist/build/index.js +565 -401
  10. package/dist/build/route-metadata.d.ts +2 -2
  11. package/dist/build/route-types.d.ts +1 -1
  12. package/dist/build/types.d.ts +10 -4
  13. package/dist/cli/dev-worker.ts +10 -4
  14. package/dist/cli/index.js +624 -445
  15. package/dist/client/chunks/{client-xy6g38kx.js → client-a7spxfnn.js} +24 -5
  16. package/dist/client/chunks/{client-rjhxgt64.js → client-d9v49jwz.js} +1 -1
  17. package/dist/client/chunks/{client-k29262a4.js → client-rdxyrw11.js} +1 -1
  18. package/dist/client/define-route.d.ts +14 -0
  19. package/dist/client/internal/runtime-types.d.ts +8 -0
  20. package/dist/client/link.js +20 -17
  21. package/dist/client/router/link-utils.d.ts +3 -2
  22. package/dist/client/router/search/index.js +2 -2
  23. package/dist/client/router/types.d.ts +9 -3
  24. package/dist/client.js +22 -6
  25. package/dist/config.d.ts +4 -0
  26. package/dist/config.js +4 -1
  27. package/dist/define-route.d.ts +53 -12
  28. package/dist/furin.d.ts +13 -3
  29. package/dist/furin.js +815 -661
  30. package/dist/plugin/route-config.d.ts +3 -3
  31. package/dist/plugin/route-manifest.d.ts +46 -0
  32. package/dist/plugin/route-tree.d.ts +13 -29
  33. package/dist/routes.d.ts +2 -2
  34. package/dist/server/dev/runtime.d.ts +2 -1
  35. package/dist/server/internal.d.ts +6 -0
  36. package/dist/server/internal.js +97 -114
  37. package/dist/server/registrations.d.ts +4 -2
  38. package/dist/server/render/index.d.ts +0 -1
  39. package/dist/server/render/index.ts +0 -1
  40. package/dist/server/render/shell.d.ts +1 -13
  41. package/dist/server/render/shell.ts +1 -90
  42. package/dist/server/router/defined-route.d.ts +4 -0
  43. package/dist/server/router/discovery.d.ts +14 -4
  44. package/dist/server/router/hmr.d.ts +12 -12
  45. package/dist/server/router/patterns.d.ts +4 -12
  46. package/dist/server/router/types.d.ts +16 -1
  47. package/dist/server/static-export.js +128 -158
  48. package/dist/server/sync/drizzle/index.d.ts +8 -10
  49. package/dist/shared/not-found.d.ts +1 -1
  50. package/dist/shared/route-specificity.d.ts +10 -1
  51. package/package.json +8 -11
  52. package/src/adapter/package.ts +11 -37
  53. package/src/adapter/runtime-build.ts +5 -4
  54. package/src/adapter/static.ts +1 -1
  55. package/src/adapter/vercel.ts +2 -1
  56. package/src/build/client.ts +3 -3
  57. package/src/build/discover-pages-process.ts +1 -1
  58. package/src/build/elysia-aot.ts +2 -2
  59. package/src/build/entry-template.ts +3 -15
  60. package/src/build/hydrate.ts +12 -6
  61. package/src/build/index.ts +19 -9
  62. package/src/build/route-metadata.ts +15 -8
  63. package/src/build/route-types.ts +18 -43
  64. package/src/build/types.ts +12 -5
  65. package/src/cli/config.ts +6 -0
  66. package/src/cli/dev-worker.ts +10 -4
  67. package/src/cli/dev.ts +41 -26
  68. package/src/cli/index.ts +30 -14
  69. package/src/client/define-route.ts +29 -4
  70. package/src/client/internal/runtime-types.ts +8 -0
  71. package/src/client/link.tsx +21 -22
  72. package/src/client/router/context.ts +8 -7
  73. package/src/client/router/link-utils.ts +16 -8
  74. package/src/client/router/provider.tsx +5 -0
  75. package/src/client/router/types.ts +40 -14
  76. package/src/config.ts +5 -0
  77. package/src/define-route.ts +85 -16
  78. package/src/furin.ts +31 -7
  79. package/src/plugin/dev-routes.ts +8 -17
  80. package/src/plugin/route-config.ts +77 -62
  81. package/src/plugin/route-manifest.ts +437 -0
  82. package/src/plugin/route-modules.ts +6 -1
  83. package/src/plugin/route-registry.ts +7 -21
  84. package/src/plugin/route-tree.ts +71 -181
  85. package/src/routes.ts +2 -2
  86. package/src/server/dev/runtime.ts +16 -22
  87. package/src/server/internal.ts +4 -1
  88. package/src/server/registrations.ts +5 -2
  89. package/src/server/render/index.ts +0 -1
  90. package/src/server/render/shell.ts +1 -90
  91. package/src/server/render/static-params.ts +2 -10
  92. package/src/server/router/defined-route.ts +8 -0
  93. package/src/server/router/discovery.ts +237 -196
  94. package/src/server/router/hmr.ts +45 -63
  95. package/src/server/router/patterns.ts +41 -117
  96. package/src/server/router/types.ts +17 -1
  97. package/src/server/sync/drizzle/index.ts +18 -19
  98. package/src/shared/not-found.ts +1 -1
  99. package/src/shared/route-specificity.ts +34 -2
  100. package/src/shared/utils/index.ts +1 -1
package/dist/furin.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type AnyElysia, Elysia } from "elysia";
2
2
  import type { RequestLogger } from "evlog";
3
+ import type { RouteStyle } from "./plugin/route-manifest.ts";
3
4
  import type { PageCacheAdapter } from "./server/cache/page-cache.ts";
4
5
  import { type CachePurger } from "./server/cache/purger.ts";
5
6
  import { type FurinLoggerOptions } from "./server/logging/ingest-plugin.ts";
@@ -56,6 +57,7 @@ export interface FurinOptions {
56
57
  * process-local cache.
57
58
  */
58
59
  pageCache?: PageCacheAdapter;
60
+ /** Defaults to `src/app` in the `nextjs` style and `src/routes` in the `tanstack` style. */
59
61
  pagesDir?: string;
60
62
  /**
61
63
  * Full physical mount path of this app, e.g. `"/admin"`. All pages,
@@ -68,6 +70,13 @@ export interface FurinOptions {
68
70
  * two prefixes, throws.
69
71
  */
70
72
  prefix?: string;
73
+ /**
74
+ * File-routing convention of `pagesDir`: `"nextjs"` (App Router: `layout.tsx`,
75
+ * `page.tsx`, `[id]`, `error.tsx`) or `"tanstack"` (TanStack Start:
76
+ * `__root.tsx`, `route.tsx`, `$id`, flat `a.$b.tsx`). Both key
77
+ * `defineRoute(id)` with TanStack Start ids.
78
+ */
79
+ style: RouteStyle;
71
80
  /**
72
81
  * Configures Furin's sync event stream with the required adapter. The
73
82
  * optional `path` defaults to `/_furin/sync`. Omit this option or pass
@@ -87,14 +96,15 @@ export interface FurinOptions {
87
96
  *
88
97
  * ```ts
89
98
  * new Elysia()
90
- * .use(await furin({ pagesDir: "./src/pages" }))
91
- * .use(await furin({ pagesDir: "./src/admin", prefix: "/admin" }))
99
+ * .use(await furin({ style: "tanstack" }))
100
+ * .use(await furin({ pagesDir: "./src/admin", prefix: "/admin", style: "nextjs" }))
92
101
  * .listen(3000)
93
102
  * ```
94
103
  */
95
- export declare function furin(options?: FurinOptions): Promise<<ParentApp extends AnyElysia>(parentApp: ParentApp) => FurinApplication<ParentApp>>;
104
+ export declare function furin(options: FurinOptions): Promise<<ParentApp extends AnyElysia>(parentApp: ParentApp) => FurinApplication<ParentApp>>;
96
105
  export { FurinErrorBoundary, FurinNotFoundBoundary } from "./client/boundaries.tsx";
97
106
  export { HeadContent, Scripts } from "./client/document.tsx";
107
+ export type { RouteStyle } from "./plugin/route-manifest.ts";
98
108
  export type { Register } from "./routes.ts";
99
109
  export type { InvalidationInput, InvalidationRule } from "./server/auto-invalidate/index.ts";
100
110
  export { furinInvalidate, revalidateTag } from "./server/auto-invalidate/index.ts";