@teyik0/furin 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (42) hide show
  1. package/dist/adapter/static.d.ts +3 -0
  2. package/dist/build/client.d.ts +3 -3
  3. package/dist/build/compile-entry.d.ts +4 -4
  4. package/dist/build/entry-template.d.ts +2 -2
  5. package/dist/build/hydrate.d.ts +6 -2
  6. package/dist/build/index.d.ts +1 -1
  7. package/dist/build/index.js +668 -90
  8. package/dist/build/types.d.ts +26 -3
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/index.js +704 -103
  11. package/dist/client.d.ts +22 -15
  12. package/dist/config.d.ts +33 -2
  13. package/dist/config.js +6 -1
  14. package/dist/dev-page-plugin.d.ts +77 -0
  15. package/dist/furin.js +771 -81
  16. package/dist/link.d.ts +31 -3
  17. package/dist/link.js +511 -62
  18. package/dist/render/index.d.ts +1 -1
  19. package/dist/render/loaders.d.ts +1 -1
  20. package/dist/router.js +84 -24
  21. package/package.json +9 -10
  22. package/src/adapter/bun.ts +31 -7
  23. package/src/adapter/static.ts +337 -0
  24. package/src/build/client.ts +28 -11
  25. package/src/build/compile-entry.ts +5 -3
  26. package/src/build/entry-template.ts +9 -5
  27. package/src/build/hydrate.ts +40 -10
  28. package/src/build/index.ts +56 -21
  29. package/src/build/scan-server.ts +43 -21
  30. package/src/build/shared.ts +7 -3
  31. package/src/build/types.ts +28 -3
  32. package/src/cli/index.ts +14 -5
  33. package/src/client.ts +26 -31
  34. package/src/config.ts +35 -1
  35. package/src/dev-page-plugin.ts +339 -4
  36. package/src/furin.ts +6 -2
  37. package/src/link.tsx +268 -62
  38. package/src/plugin/index.ts +2 -2
  39. package/src/render/index.ts +64 -24
  40. package/src/render/loaders.ts +77 -36
  41. package/src/render/shell.ts +2 -2
  42. package/src/router.ts +11 -1
package/dist/link.d.ts CHANGED
@@ -109,7 +109,13 @@ export declare function shouldAutoRefreshPath(currentPath: string, invalidations
109
109
  type: "page" | "layout";
110
110
  }>): boolean;
111
111
  export interface RouterContextValue {
112
- /** Current pathname + search (no hash). Used by Link for active-state detection. */
112
+ /**
113
+ * Sub-path prefix for static deployments (e.g. "/furin").
114
+ * Empty string when the site is served from root.
115
+ * Used by `Link` to build correct physical hrefs for the `<a>` element.
116
+ */
117
+ basePath: string;
118
+ /** Current **logical** pathname + search (basePath stripped). Used by Link for active-state detection. */
113
119
  currentHref: string;
114
120
  defaultPreload: PreloadStrategy;
115
121
  defaultPreloadDelay: number;
@@ -185,6 +191,17 @@ export interface RouterProviderProps {
185
191
  * Set to `false` to opt out and call `router.refresh()` manually instead.
186
192
  */
187
193
  autoRefresh?: boolean;
194
+ /**
195
+ * Sub-path prefix for static deployments (e.g. "/furin").
196
+ * Must start with "/" and have no trailing slash.
197
+ * Default: "" (site served from root).
198
+ *
199
+ * When set:
200
+ * - `currentHref` stores **logical** paths (prefix stripped) for correct active-state detection.
201
+ * - `navigate(logicalHref)` pushes `basePath + logicalHref` to browser history.
202
+ * - `fetch` calls use the physical path `basePath + logicalHref`.
203
+ */
204
+ basePath?: string;
188
205
  defaultPreload?: PreloadStrategy;
189
206
  defaultPreloadDelay?: number;
190
207
  defaultPreloadStaleTime?: number;
@@ -212,6 +229,17 @@ export interface CacheEntry {
212
229
  export declare function shouldRefetch(entry: CacheEntry): boolean;
213
230
  /** @internal Exported for unit testing only. */
214
231
  export declare function buildPageElement(match: LoadedClientRoute, root: RuntimeRoute | null, data: Record<string, unknown>): React.ReactNode;
215
- export declare function RouterProvider({ routes, root, initialMatch, initialData, autoRefresh, defaultPreload, defaultPreloadDelay, defaultPreloadStaleTime, prefetchCacheSize, }: RouterProviderProps): React.ReactElement;
216
- export declare function Link<To extends RouteTo>({ to, search, hash, preload, preloadDelay, preloadStaleTime, replace, disabled, resetScroll, activeProps, inactiveProps, onClick, onMouseEnter, onMouseLeave, onFocus, children, ...anchorProps }: LinkProps<To>): React.ReactElement;
232
+ export declare function RouterProvider({ routes, root, initialMatch, initialData, autoRefresh, basePath, defaultPreload, defaultPreloadDelay, defaultPreloadStaleTime, prefetchCacheSize, }: RouterProviderProps): React.ReactElement;
233
+ /**
234
+ * SSR-aware Link component.
235
+ *
236
+ * - **Server (SSR):** uses `RouterContext.Consumer` (a render-prop, not a hook)
237
+ * to read basePath / currentHref from any enclosing RouterProvider, then
238
+ * falls back to `SSR_FALLBACK_ROUTER` when no provider is present.
239
+ * `Context.Consumer` bypasses `ReactCurrentDispatcher` entirely, so it is
240
+ * safe even when two React instances coexist in the module graph (Bun HMR).
241
+ * - **Client:** delegates to `LinkInteractive` which adds preloading, SPA
242
+ * navigation, active-state tracking and all other interactive features.
243
+ */
244
+ export declare function Link<To extends RouteTo>(props: LinkProps<To>): React.ReactElement;
217
245
  export {};