@teyik0/furin 0.1.0-alpha.8 → 0.2.0-alpha.1

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 (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -0
  3. package/dist/adapter/bun.d.ts +2 -2
  4. package/dist/adapter/static.d.ts +1 -1
  5. package/dist/build/client.d.ts +2 -2
  6. package/dist/build/compile-entry.d.ts +2 -16
  7. package/dist/build/compile-entry.ts +109 -0
  8. package/dist/build/entry-template.d.ts +24 -0
  9. package/dist/build/entry-template.ts +156 -0
  10. package/dist/build/hydrate.d.ts +3 -3
  11. package/dist/build/index.d.ts +1 -0
  12. package/dist/build/index.js +4734 -548
  13. package/dist/build/route-types.d.ts +1 -1
  14. package/dist/build/server-routes-entry.d.ts +2 -12
  15. package/dist/build/server-routes-entry.ts +36 -0
  16. package/dist/build/shared.d.ts +1 -1
  17. package/dist/build/ssg-cache.d.ts +4 -0
  18. package/dist/build/types.d.ts +5 -1
  19. package/dist/cli/index.js +4713 -549
  20. package/dist/client/boundaries.d.ts +117 -0
  21. package/dist/client/default-screens.d.ts +17 -0
  22. package/dist/client/link.d.ts +22 -0
  23. package/dist/client/link.js +3450 -0
  24. package/dist/client/router/boundary-tree.d.ts +26 -0
  25. package/dist/client/router/context.d.ts +8 -0
  26. package/dist/client/router/history.d.ts +9 -0
  27. package/dist/client/router/index.d.ts +7 -0
  28. package/dist/client/router/link-utils.d.ts +51 -0
  29. package/dist/client/router/provider.d.ts +4 -0
  30. package/dist/client/router/spa-response.d.ts +58 -0
  31. package/dist/{link.d.ts → client/router/types.d.ts} +114 -80
  32. package/dist/client/server-error.d.ts +12 -0
  33. package/dist/client.d.ts +54 -4
  34. package/dist/client.js +77 -1
  35. package/dist/config.d.ts +12 -2
  36. package/dist/config.js +1 -0
  37. package/dist/env.d.ts +50 -0
  38. package/dist/furin.d.ts +37 -2
  39. package/dist/furin.js +5288 -601
  40. package/dist/plugin/index.js +140 -48
  41. package/dist/plugin/transform-client.d.ts +2 -1
  42. package/dist/server/auto-invalidate/index.d.ts +4 -0
  43. package/dist/server/auto-invalidate/plugin.d.ts +38 -0
  44. package/dist/server/auto-invalidate/registry.d.ts +9 -0
  45. package/dist/server/auto-invalidate/runtime.d.ts +9 -0
  46. package/dist/server/auto-invalidate/types.d.ts +12 -0
  47. package/dist/server/cache/dev-loader.d.ts +28 -0
  48. package/dist/server/cache/index.d.ts +10 -0
  49. package/dist/server/cache/invalidation.d.ts +12 -0
  50. package/dist/server/cache/isr-ssg.d.ts +26 -0
  51. package/dist/server/cache/isr.d.ts +6 -0
  52. package/dist/server/cache/registry.d.ts +5 -0
  53. package/dist/server/cache/route-cache.d.ts +26 -0
  54. package/dist/server/cache/ssg.d.ts +5 -0
  55. package/dist/server/context-logger.d.ts +28 -0
  56. package/dist/server/dev-inspector.d.ts +89 -0
  57. package/dist/{internal.d.ts → server/internal.d.ts} +16 -0
  58. package/dist/server/internal.js +17 -0
  59. package/dist/server/lang-detect.d.ts +5 -0
  60. package/dist/server/render/assemble.d.ts +47 -0
  61. package/dist/server/render/element.d.ts +24 -0
  62. package/dist/server/render/index.d.ts +7 -0
  63. package/dist/server/render/index.ts +22 -0
  64. package/dist/server/render/isr.d.ts +3 -0
  65. package/dist/server/render/loaders.d.ts +64 -0
  66. package/dist/server/render/not-found.d.ts +6 -0
  67. package/dist/{render → server/render}/shell.d.ts +17 -4
  68. package/{src → dist/server}/render/shell.ts +31 -9
  69. package/dist/server/render/ssg.d.ts +8 -0
  70. package/dist/server/render/ssr.d.ts +107 -0
  71. package/dist/server/router/discovery.d.ts +16 -0
  72. package/dist/server/router/hmr.d.ts +64 -0
  73. package/dist/server/router/index.d.ts +6 -0
  74. package/dist/server/router/index.js +28 -0
  75. package/dist/server/router/index.ts +29 -0
  76. package/dist/server/router/patterns.d.ts +40 -0
  77. package/dist/server/router/plugin.d.ts +20 -0
  78. package/dist/server/router/schemas.d.ts +51 -0
  79. package/dist/server/router/types.d.ts +60 -0
  80. package/dist/server/runtime-env.js +10 -0
  81. package/dist/shared/await.d.ts +67 -0
  82. package/dist/shared/deferred-ndjson.d.ts +32 -0
  83. package/dist/shared/digest.d.ts +16 -0
  84. package/dist/shared/error.d.ts +37 -0
  85. package/dist/shared/not-found.d.ts +19 -0
  86. package/dist/shared/utils/ast-walk.d.ts +18 -0
  87. package/dist/shared/utils/index.d.ts +13 -0
  88. package/package.json +56 -25
  89. package/src/adapter/bun.ts +90 -41
  90. package/src/adapter/static.ts +83 -36
  91. package/src/build/client.ts +8 -12
  92. package/src/build/compile-entry.ts +20 -14
  93. package/src/build/entry-template.ts +90 -8
  94. package/src/build/hydrate.ts +213 -36
  95. package/src/build/index.ts +10 -9
  96. package/src/build/route-types.ts +30 -4
  97. package/src/build/scan-server.ts +52 -67
  98. package/src/build/server-routes-entry.ts +7 -11
  99. package/src/build/shared.ts +1 -1
  100. package/src/build/ssg-cache.ts +31 -0
  101. package/src/build/types.ts +5 -1
  102. package/src/cli/index.ts +1 -0
  103. package/src/client/boundaries.tsx +259 -0
  104. package/src/client/default-screens.tsx +304 -0
  105. package/src/client/link.tsx +338 -0
  106. package/src/client/router/boundary-tree.tsx +116 -0
  107. package/src/client/router/context.ts +38 -0
  108. package/src/client/router/history.ts +41 -0
  109. package/src/client/router/index.ts +47 -0
  110. package/src/client/router/link-utils.ts +180 -0
  111. package/src/client/router/provider.tsx +723 -0
  112. package/src/client/router/spa-response.ts +143 -0
  113. package/src/client/router/types.ts +263 -0
  114. package/src/client/server-error.ts +47 -0
  115. package/src/client.ts +83 -3
  116. package/src/config.ts +11 -3
  117. package/src/env.d.ts +1 -0
  118. package/src/furin.ts +104 -26
  119. package/src/plugin/index.ts +7 -8
  120. package/src/plugin/transform-client.ts +146 -120
  121. package/src/server/auto-invalidate/index.ts +10 -0
  122. package/src/server/auto-invalidate/plugin.ts +25 -0
  123. package/src/server/auto-invalidate/registry.ts +60 -0
  124. package/src/server/auto-invalidate/runtime.ts +133 -0
  125. package/src/server/auto-invalidate/types.ts +16 -0
  126. package/src/server/cache/dev-loader.ts +211 -0
  127. package/src/server/cache/index.ts +34 -0
  128. package/src/server/cache/invalidation.ts +111 -0
  129. package/src/server/cache/isr-ssg.ts +41 -0
  130. package/src/server/cache/isr.ts +17 -0
  131. package/src/server/cache/registry.ts +35 -0
  132. package/src/server/cache/route-cache.ts +124 -0
  133. package/src/server/cache/ssg.ts +15 -0
  134. package/src/server/context-logger.ts +76 -0
  135. package/src/server/dev-inspector.ts +60 -0
  136. package/src/{dev-page-plugin.ts → server/dev-page-plugin.ts} +15 -0
  137. package/src/{internal.ts → server/internal.ts} +17 -0
  138. package/src/server/lang-detect.ts +46 -0
  139. package/src/server/render/assemble.ts +133 -0
  140. package/src/server/render/element.tsx +113 -0
  141. package/src/server/render/index.ts +22 -0
  142. package/src/server/render/isr.ts +295 -0
  143. package/src/server/render/loaders.ts +328 -0
  144. package/src/server/render/not-found.ts +96 -0
  145. package/src/server/render/shell.ts +202 -0
  146. package/src/server/render/ssg.ts +137 -0
  147. package/src/server/render/ssr.ts +545 -0
  148. package/src/server/router/discovery.ts +474 -0
  149. package/src/server/router/hmr.ts +372 -0
  150. package/src/server/router/index.ts +29 -0
  151. package/src/server/router/patterns.ts +214 -0
  152. package/src/server/router/plugin.ts +401 -0
  153. package/src/server/router/schemas.ts +163 -0
  154. package/src/server/router/types.ts +59 -0
  155. package/src/shared/await.tsx +192 -0
  156. package/src/shared/deferred-ndjson.ts +244 -0
  157. package/src/shared/digest.ts +71 -0
  158. package/src/shared/error.ts +49 -0
  159. package/src/shared/not-found.ts +40 -0
  160. package/src/shared/utils/ast-walk.ts +51 -0
  161. package/src/{utils.ts → shared/utils/index.ts} +32 -1
  162. package/dist/link.js +0 -1173
  163. package/dist/render/assemble.d.ts +0 -13
  164. package/dist/render/cache.d.ts +0 -95
  165. package/dist/render/element.d.ts +0 -4
  166. package/dist/render/index.d.ts +0 -27
  167. package/dist/render/loaders.d.ts +0 -12
  168. package/dist/router.d.ts +0 -34
  169. package/dist/router.js +0 -830
  170. package/dist/utils.d.ts +0 -6
  171. package/src/link.tsx +0 -1035
  172. package/src/render/assemble.ts +0 -64
  173. package/src/render/cache.ts +0 -241
  174. package/src/render/element.tsx +0 -28
  175. package/src/render/index.ts +0 -479
  176. package/src/render/loaders.ts +0 -113
  177. package/src/router.ts +0 -400
  178. /package/dist/{dev-page-plugin.d.ts → server/dev-page-plugin.d.ts} +0 -0
  179. /package/dist/{render → server/render}/template.d.ts +0 -0
  180. /package/dist/{runtime-env.d.ts → server/runtime-env.d.ts} +0 -0
  181. /package/src/{render → server/render}/template.ts +0 -0
  182. /package/src/{runtime-env.ts → server/runtime-env.ts} +0 -0
@@ -0,0 +1,51 @@
1
+ import type { Context } from "elysia";
2
+ import type { AnySchema } from "elysia/types";
3
+ import type { RuntimeRoute } from "../../client.ts";
4
+ /**
5
+ * Detects whether a validator filled in default query values that the original
6
+ * URL did not carry, and returns the canonical `pathname + search` to redirect
7
+ * to — or `undefined` when the URL already reflects the resolved query.
8
+ *
9
+ * Pure helper extracted from `queryDefaultRedirectHook` so the `/_furin/data`
10
+ * NDJSON endpoint can detect the same condition without going through
11
+ * Elysia's `status()` shim (which only emits HTTP 302s, unparseable by the
12
+ * SPA client).
13
+ *
14
+ * @internal Exported for unit testing.
15
+ */
16
+ export declare function detectQueryDefaultRedirect(request: Request, resolvedQuery: Record<string, unknown>): string | undefined;
17
+ /**
18
+ * Parses the `?path=` argument of `/_furin/data`, rejecting absolute /
19
+ * protocol-relative inputs that would let a caller smuggle a foreign origin
20
+ * into the synthetic loader request.
21
+ *
22
+ * Returns `{ url, pathname }` on success, or `undefined` when the input is
23
+ * unsafe (the caller should reply 400). `new URL(rawPath, base)` ignores the
24
+ * base when `rawPath` is itself absolute, so without these prefix and origin
25
+ * checks a value like `https://evil.com/foo` would propagate to
26
+ * `syntheticRequest.url`.
27
+ *
28
+ * @internal Exported for unit testing.
29
+ */
30
+ export declare function parseDataEndpointPath(rawPath: string): {
31
+ url: URL;
32
+ pathname: string;
33
+ } | undefined;
34
+ /** @internal Exported for unit testing. */
35
+ export declare function queryDefaultRedirectHook({ request, query, status, set }: Context): import("elysia").ElysiaCustomStatusResponse<"Found", "Found", 302> | undefined;
36
+ /**
37
+ * Merges TObject schemas from all routeChain entries for a given key.
38
+ * Properties are spread left-to-right (leaf wins on key conflict).
39
+ * Object-level options (additionalProperties, $id, description, …) are also
40
+ * merged with the same leaf-wins semantics so they are not silently dropped.
41
+ * Returns undefined when no entry in the chain defines the key.
42
+ *
43
+ * @internal Exported for unit testing.
44
+ */
45
+ export declare function mergeRouteSchemas(routeChain: RuntimeRoute[], key: "params" | "query"): AnySchema | undefined;
46
+ /**
47
+ * Applies top-level `default` values from a TypeBox TObject schema to a
48
+ * values record. Used in the `/_furin/data` endpoint so loaders see the same
49
+ * defaulted query objects that the SSR path produces via Elysia's guard.
50
+ */
51
+ export declare function applySchemaDefaults(schema: Record<string, unknown> | undefined, values: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,60 @@
1
+ import type { RuntimePage, RuntimeRoute } from "../../client.ts";
2
+ import type { ErrorComponent } from "../../shared/error.ts";
3
+ import type { NotFoundComponent } from "../../shared/not-found.ts";
4
+ /**
5
+ * A single directory-scoped boundary declaration.
6
+ *
7
+ * Each entry represents ONE directory on the path from `pagesDir` to the page
8
+ * file. `error` / `notFound` hold the components defined IN THAT DIRECTORY
9
+ * only — never inherited from a parent. This 1:1 tie between directory and
10
+ * entry is what lets the render layer insert React error boundaries at the
11
+ * exact nesting level where the user authored them (Next.js app-router model).
12
+ */
13
+ export interface SegmentBoundary {
14
+ /** 0 = `pagesDir`; increments with each nested subdirectory. */
15
+ depth: number;
16
+ error?: ErrorComponent;
17
+ /**
18
+ * Absolute path to the `error.tsx` module, when present. Carried alongside
19
+ * the component so the client hydrate entry can emit a static `import`
20
+ * statement for each unique convention file — a component reference alone
21
+ * can't survive the server→client boundary.
22
+ */
23
+ errorPath?: string;
24
+ notFound?: NotFoundComponent;
25
+ /** Absolute path to the `not-found.tsx` module, when present. */
26
+ notFoundPath?: string;
27
+ /** Absolute directory path. */
28
+ path: string;
29
+ }
30
+ export interface ResolvedRoute {
31
+ error?: ErrorComponent;
32
+ isrCache?: {
33
+ html: string;
34
+ generatedAt: number;
35
+ revalidate: number;
36
+ };
37
+ mode: "ssr" | "ssg" | "isr";
38
+ notFound?: NotFoundComponent;
39
+ page: RuntimePage;
40
+ path: string;
41
+ pattern: string;
42
+ routeChain: RuntimeRoute[];
43
+ /**
44
+ * Per-directory boundary chain, ordered shallow → deep. Only directories
45
+ * that DECLARE at least one of `error.tsx` / `not-found.tsx` are included;
46
+ * directories without conventions are skipped. Empty when no conventions
47
+ * exist anywhere in the path.
48
+ */
49
+ segmentBoundaries: SegmentBoundary[];
50
+ ssgHtml?: string;
51
+ tags?: string[];
52
+ }
53
+ export interface RootLayout {
54
+ error?: ErrorComponent;
55
+ errorPath?: string;
56
+ notFound?: NotFoundComponent;
57
+ notFoundPath?: string;
58
+ path: string;
59
+ route: RuntimeRoute;
60
+ }
@@ -0,0 +1,10 @@
1
+ // @bun
2
+ // src/server/runtime-env.ts
3
+ var IS_DEV = true;
4
+ function __setDevMode(val) {
5
+ IS_DEV = val;
6
+ }
7
+ export {
8
+ __setDevMode,
9
+ IS_DEV
10
+ };
@@ -0,0 +1,67 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Context used to pass the caught error from `AsyncErrorBoundary` down to
4
+ * `errorElement` children so they can read it via `useAsyncError()`.
5
+ */
6
+ export declare const AsyncErrorContext: import("react").Context<unknown>;
7
+ /**
8
+ * Inside an `<Await errorElement={...}>`, returns the error that caused the
9
+ * deferred Promise to reject. Throws outside of an error-boundary subtree.
10
+ */
11
+ export declare function useAsyncError(): unknown;
12
+ /**
13
+ * Inside a resolved `<Await>`, returns the resolved value via React 19's
14
+ * `use()`. Can be used as an alternative to the render-prop children API.
15
+ *
16
+ * Must be used inside a component that is rendered as children of `<Await>`.
17
+ */
18
+ export declare function useAsyncValue<T>(): T;
19
+ export interface AwaitProps<T> {
20
+ /**
21
+ * Render-prop children: called with the resolved value once the Promise
22
+ * settles. The returned `ReactNode` is rendered inside a Suspense boundary.
23
+ *
24
+ * Marked optional here so `createElement(Await, props, renderFn)` is
25
+ * accepted by TypeScript — the 3rd argument to `createElement` becomes
26
+ * `children` at runtime and is always required for correct behaviour.
27
+ */
28
+ children?: (value: T) => ReactNode;
29
+ /**
30
+ * Rendered when the Promise rejects. Inside this subtree, `useAsyncError()`
31
+ * returns the rejection reason. When omitted the error propagates up to the
32
+ * next React error boundary.
33
+ */
34
+ errorElement?: ReactNode;
35
+ /**
36
+ * The deferred Promise to await. Passed as a prop so React's `use()` can
37
+ * suspend the boundary until it resolves. This is the same Promise object
38
+ * that the loader returned inside `defer()`.
39
+ */
40
+ resolve: Promise<T>;
41
+ }
42
+ /**
43
+ * Deferred-data boundary component. Uses React 19's `use()` to suspend the
44
+ * render until `resolve` settles, then calls the render-prop `children` with
45
+ * the resolved value.
46
+ *
47
+ * Wrap with `<Suspense fallback={…}>` to show a loading indicator while the
48
+ * Promise is pending.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * export default route.page({
53
+ * loader: () => defer({ board: "x", stats: fetchStats() }),
54
+ * component: ({ board, stats }) => (
55
+ * <div>
56
+ * <h1>{board}</h1>
57
+ * <Suspense fallback={<Spinner />}>
58
+ * <Await resolve={stats}>
59
+ * {(s) => <StatsBar stats={s} />}
60
+ * </Await>
61
+ * </Suspense>
62
+ * </div>
63
+ * ),
64
+ * });
65
+ * ```
66
+ */
67
+ export declare function Await<T>({ resolve, errorElement, children }: AwaitProps<T>): ReactNode;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Result returned by `parseDeferredNdjson`.
3
+ */
4
+ export interface DeferredNdjsonResult {
5
+ /**
6
+ * Deferred promises keyed by their field name. Each Promise resolves (or
7
+ * rejects) once the corresponding data is available. In the SSR case the
8
+ * promises are already settled (serialised by `toCrossJSONAsync`). For
9
+ * streaming endpoints they will settle as the server flushes resolution
10
+ * chunks.
11
+ */
12
+ deferredPromises: Record<string, Promise<unknown>>;
13
+ /** Scalar/sync values from the loader — available immediately. */
14
+ syncData: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * Parses an NDJSON stream produced by `/_furin/data`.
18
+ *
19
+ * Protocol (v1 — single-line, all-resolved):
20
+ * Line 0 — `JSON.stringify(await toCrossJSONAsync(loaderData))`
21
+ *
22
+ * The CrossJSON node is deserialised with `fromCrossJSON`. Values that are
23
+ * Promises (seroval type 12) land in `deferredPromises`; everything else
24
+ * lands in `syncData`.
25
+ *
26
+ * @param stream - A `ReadableStream<Uint8Array>` from `fetch().body`.
27
+ * @param signal - AbortSignal that, when aborted, cancels the reader and
28
+ * rejects every still-pending deferred promise with an
29
+ * `AbortError`. Pass `undefined` to opt out (no implicit
30
+ * default — see CLAUDE.md).
31
+ */
32
+ export declare function parseDeferredNdjson(stream: ReadableStream<Uint8Array>, signal: AbortSignal | undefined): Promise<DeferredNdjsonResult>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Computes a deterministic, opaque 10-hex-character digest for an error.
3
+ *
4
+ * Purpose: render this digest in client-facing error UIs (e.g. `Error ID:
5
+ * a3f2b9c1d8`) and log the same digest alongside the full stack on the server,
6
+ * so support can correlate user reports with server logs without leaking stack
7
+ * traces or sensitive message content to the browser.
8
+ *
9
+ * Deterministic: identical error message + stack ⇒ identical digest across
10
+ * restarts, processes, and environments (server + client).
11
+ *
12
+ * Uses a pure-JS 53-bit hash so the function works identically in Bun and in
13
+ * the browser — `computeErrorDigest` is called from `FurinErrorBoundary`, which
14
+ * runs on both sides.
15
+ */
16
+ export declare function computeErrorDigest(err: unknown): string;
@@ -0,0 +1,37 @@
1
+ import type { FC } from "react";
2
+ export interface ErrorProps {
3
+ error: {
4
+ /** Safe user-facing message. */
5
+ message: string;
6
+ /**
7
+ * Opaque 10-hex-char hash of the original error. The same digest appears
8
+ * in the server logs next to the full stack trace, so support can
9
+ * correlate a user-reported error ID with server-side diagnostics
10
+ * without leaking stack traces to the browser.
11
+ */
12
+ digest: string;
13
+ /**
14
+ * HTTP status associated with the error.
15
+ * - For thrown `Response` objects with a 4xx/5xx status: the response's
16
+ * status (e.g. 401, 403, 404, 500).
17
+ * - For all other errors (thrown `Error`, non-Error throws, shell-render
18
+ * crashes): always `500`.
19
+ *
20
+ * Always present so consumers never need a `?? 500` fallback. Note that
21
+ * `prepared.status` is honoured ONLY for loader-time errors. If a Suspense
22
+ * boundary throws AFTER the SSR shell has flushed (i.e. during streaming),
23
+ * the HTTP status cannot be changed and the user-visible status here may
24
+ * differ from the actual response code.
25
+ */
26
+ status: number;
27
+ };
28
+ /**
29
+ * Clears the nearest FurinErrorBoundary's error state, remounting its
30
+ * children. On the client this re-runs the route's loader; on the server
31
+ * it's a no-op (the request has already produced output by the time
32
+ * `reset` could run).
33
+ */
34
+ reset: () => void;
35
+ }
36
+ export type ErrorComponent = FC<ErrorProps>;
37
+ export declare function getPublicErrorMessage(error: Error | unknown): string;
@@ -0,0 +1,19 @@
1
+ import type { FC } from "react";
2
+ export interface NotFoundOptions {
3
+ data?: unknown;
4
+ message?: string;
5
+ }
6
+ export interface NotFoundProps {
7
+ error: {
8
+ message?: string;
9
+ data?: unknown;
10
+ };
11
+ }
12
+ export type NotFoundComponent = FC<NotFoundProps>;
13
+ export declare class FurinNotFoundError extends Error {
14
+ readonly __furinBrand: "FURIN_NOT_FOUND";
15
+ readonly data: unknown;
16
+ constructor(options: NotFoundOptions | undefined);
17
+ }
18
+ export declare function notFound(options: NotFoundOptions | undefined): never;
19
+ export declare function isNotFoundError(err: unknown): err is FurinNotFoundError;
@@ -0,0 +1,18 @@
1
+ import type { BaseNode, Node as YukuNode } from "yuku-parser";
2
+ /**
3
+ * Minimal ESTree node interface used by AST-walking utilities across the
4
+ * framework (build scanning, client transform, etc.).
5
+ */
6
+ export interface AstNode extends BaseNode {
7
+ body?: AstNode[];
8
+ type: YukuNode["type"] | string;
9
+ [key: string]: unknown;
10
+ }
11
+ /**
12
+ * Walks an ESTree-compatible AST node recursively, calling `visitor` for every
13
+ * node that has a `type` property.
14
+ *
15
+ * Arrays are traversed element-by-element. The keys `type`, `start` and `end`
16
+ * are skipped so that the visitor is only invoked on genuine child nodes.
17
+ */
18
+ export declare function walkAST(node: unknown, visitor: (n: AstNode) => void): void;
@@ -0,0 +1,13 @@
1
+ import type { RuntimePage, RuntimeRoute } from "../../client";
2
+ export declare function isFurinPage(value: unknown): value is RuntimePage;
3
+ export declare function isFurinRoute(value: unknown): value is RuntimeRoute;
4
+ export declare function collectRouteChainFromRoute(route: RuntimeRoute): RuntimeRoute[];
5
+ export declare function hasCycle(route: RuntimeRoute): boolean;
6
+ /**
7
+ * Maps over `items` with a bounded worker pool, preserving input order.
8
+ * Use whenever an `await Promise.all(items.map(...))` would open as many
9
+ * concurrent async operations as there are items — unbounded fan-out can
10
+ * exhaust file descriptors, sockets, or memory on large inputs.
11
+ */
12
+ export declare function mapWithConcurrency<T, R>(items: readonly T[], concurrency: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
13
+ export declare function validateRouteChain(chain: RuntimeRoute[], root: RuntimeRoute, pagePath?: string): void;
package/package.json CHANGED
@@ -1,77 +1,108 @@
1
1
  {
2
2
  "name": "@teyik0/furin",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "0.2.0-alpha.1",
4
+ "description": "React meta-framework powered by Elysia and Bun with file-based routing, SSR, SSG, and ISR.",
5
+ "license": "MIT",
6
+ "author": "teyik0",
7
+ "sideEffects": false,
4
8
  "type": "module",
9
+ "engines": {
10
+ "bun": ">=1.3.0"
11
+ },
12
+ "keywords": [
13
+ "react",
14
+ "furin",
15
+ "framework",
16
+ "elysia",
17
+ "bun",
18
+ "ssr",
19
+ "ssg",
20
+ "routing",
21
+ "file-based-routing"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/teyik0/furin.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/teyik0/furin/issues"
29
+ },
30
+ "homepage": "https://github.com/teyik0/furin#readme",
5
31
  "files": [
6
32
  "dist",
7
- "src"
33
+ "src",
34
+ "LICENSE",
35
+ "README.md"
8
36
  ],
9
37
  "main": "./dist/furin.js",
10
38
  "module": "./dist/furin.js",
11
- "types": "./src/furin.ts",
39
+ "types": "./dist/furin.d.ts",
12
40
  "bin": {
13
41
  "furin": "./src/cli/index.ts"
14
42
  },
15
43
  "exports": {
16
44
  ".": {
17
- "types": "./src/furin.ts",
45
+ "types": "./dist/furin.d.ts",
18
46
  "bun": "./src/furin.ts",
19
47
  "import": "./dist/furin.js"
20
48
  },
21
49
  "./client": {
22
- "types": "./src/client.ts",
50
+ "types": "./dist/client.d.ts",
23
51
  "bun": "./src/client.ts",
24
52
  "import": "./dist/client.js"
25
53
  },
26
54
  "./build": {
27
- "types": "./src/build/index.ts",
55
+ "types": "./dist/build/index.d.ts",
28
56
  "bun": "./src/build/index.ts",
29
57
  "import": "./dist/build/index.js"
30
58
  },
31
59
  "./config": {
32
- "types": "./src/config.ts",
60
+ "types": "./dist/config.d.ts",
33
61
  "bun": "./src/config.ts",
34
62
  "import": "./dist/config.js"
35
63
  },
36
64
  "./router": {
37
- "types": "./src/router.ts",
38
- "bun": "./src/router.ts",
39
- "import": "./dist/router.js"
65
+ "types": "./dist/server/router/index.d.ts",
66
+ "bun": "./src/server/router/index.ts",
67
+ "import": "./dist/server/router/index.js"
40
68
  },
41
69
  "./strip-plugin": {
42
- "types": "./src/plugin/index.ts",
70
+ "types": "./dist/plugin/index.d.ts",
43
71
  "bun": "./src/plugin/index.ts",
44
72
  "import": "./dist/plugin/index.js"
45
73
  },
46
74
  "./link": {
47
- "types": "./src/link.tsx",
48
- "bun": "./src/link.tsx",
49
- "import": "./dist/link.js"
75
+ "types": "./dist/client/link.d.ts",
76
+ "bun": "./src/client/link.tsx",
77
+ "import": "./dist/client/link.js"
50
78
  },
51
79
  "./env": {
52
- "types": "./src/env.d.ts"
80
+ "types": "./dist/env.d.ts",
81
+ "bun": "./src/env.d.ts"
53
82
  }
54
83
  },
55
84
  "scripts": {
56
- "test": "bun test",
57
- "test:types": "tsc --noEmit",
58
- "build": "bun run build.ts",
59
- "fix": "ultracite fix"
85
+ "fix": "ultracite fix",
86
+ "test": "bun test --parallel --isolate --bail --preload ../../tests/setup.ts",
87
+ "test:dev": "bun test --changed --parallel --isolate --bail --preload ../../tests/setup.ts",
88
+ "tscheck": "tsc --noEmit",
89
+ "build": "bun run build.ts"
60
90
  },
61
91
  "dependencies": {
62
- "@elysiajs/static": "^1.4.9",
92
+ "@elysiajs/static": "^1.4.10",
63
93
  "magic-string": "^0.30.21",
64
- "oxc-parser": "^0.126.0"
94
+ "seroval": "^1.5.4",
95
+ "yuku-parser": "^0.5.31"
65
96
  },
66
97
  "devDependencies": {
67
- "@types/react": "^19.2.14",
98
+ "@types/react": "^19.2.17",
68
99
  "@types/react-dom": "^19.2.3",
69
100
  "expect-type": "^1.3.0"
70
101
  },
71
102
  "peerDependencies": {
72
103
  "elysia": "^1.4.28",
73
- "evlog": "^2.13.0",
74
- "react": "^19.2.5",
75
- "react-dom": "^19.2.5"
104
+ "evlog": "^2.18.1",
105
+ "react": "^19.2.7",
106
+ "react-dom": "^19.2.7"
76
107
  }
77
108
  }