@teyik0/furin 0.3.0-alpha.1 → 0.4.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.
- package/dist/adapter/bun.d.ts +1 -1
- package/dist/build/client.d.ts +2 -2
- package/dist/build/entry-template.d.ts +4 -0
- package/dist/build/entry-template.ts +17 -3
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +8288 -6629
- package/dist/build/route-types.d.ts +2 -22
- package/dist/build/shared.d.ts +1 -1
- package/dist/build/ssg-cache.d.ts +1 -1
- package/dist/build/types.d.ts +1 -1
- package/dist/cli/index.js +7862 -6168
- package/dist/client/boundaries.d.ts +2 -0
- package/dist/client/define-route.d.ts +35 -0
- package/dist/client/document.d.ts +26 -0
- package/dist/client/hmr.d.ts +10 -0
- package/dist/client/internal/runtime-types.d.ts +3 -1
- package/dist/client/link.js +1177 -894
- package/dist/client/router/index.d.ts +1 -1
- package/dist/client/router/link-utils.d.ts +9 -0
- package/dist/client/router/search/index.d.ts +3 -7
- package/dist/client/router/types.d.ts +32 -24
- package/dist/client.d.ts +4 -159
- package/dist/client.js +183 -21
- package/dist/config.d.ts +8 -8
- package/dist/config.js +8 -8
- package/dist/define-route.d.ts +1355 -0
- package/dist/furin.d.ts +17 -33
- package/dist/furin.js +13444 -10301
- package/dist/plugin/index.js +953 -244
- package/dist/plugin/route-config-autofix.d.ts +31 -0
- package/dist/plugin/routes.d.ts +27 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +1 -0
- package/dist/rsc/build/index.d.ts +1 -1
- package/dist/rsc.js +3 -3
- package/dist/server/dev-page-plugin.d.ts +7 -5
- package/dist/server/devtools/instrumentation.d.ts +2 -2
- package/dist/server/devtools/instrumentation.production.d.ts +2 -2
- package/dist/server/devtools/plugin.d.ts +2 -2
- package/dist/server/internal.d.ts +3 -0
- package/dist/server/logger.d.ts +4 -0
- package/dist/server/render/assemble.d.ts +0 -9
- package/dist/server/render/document.d.ts +4 -0
- package/dist/server/render/element.d.ts +2 -1
- package/dist/server/render/index.d.ts +1 -1
- package/dist/server/render/index.ts +0 -1
- package/dist/server/render/isr.d.ts +1 -1
- package/dist/server/render/loaders.d.ts +1 -1
- package/dist/server/render/not-found.d.ts +1 -1
- package/dist/server/render/ppr-route.d.ts +1 -1
- package/dist/server/render/ssg.d.ts +1 -1
- package/dist/server/render/ssr.d.ts +7 -6
- package/dist/server/render/template.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +24 -0
- package/dist/server/router/hmr.d.ts +16 -8
- package/dist/server/router/patterns.d.ts +6 -0
- package/dist/server/router/plugin.d.ts +4 -3
- package/dist/server/router/schema-merge.d.ts +2 -2
- package/dist/server/router/schemas.d.ts +5 -5
- package/dist/server/router/source-version.d.ts +2 -0
- package/dist/server/router/types.d.ts +1 -0
- package/dist/server/sync/index.js +961 -806
- package/dist/server/sync/postgres/migrate.js +3 -2
- package/dist/shared/await.d.ts +6 -7
- package/dist/shared/elysia-contract.d.ts +41 -0
- package/dist/shared/route-map.d.ts +5 -0
- package/dist/shared/utils/index.d.ts +1 -3
- package/package.json +44 -41
- package/src/adapter/bun.ts +42 -22
- package/src/adapter/package.ts +20 -14
- package/src/adapter/static.ts +4 -3
- package/src/build/client.ts +20 -3
- package/src/build/entry-template.ts +17 -3
- package/src/build/hydrate.ts +98 -28
- package/src/build/index.ts +2 -2
- package/src/build/route-types.ts +19 -114
- package/src/build/shared.ts +1 -1
- package/src/build/ssg-cache.ts +2 -5
- package/src/build/types.ts +1 -1
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +7 -7
- package/src/client/boundaries.tsx +9 -1
- package/src/client/define-route.ts +48 -0
- package/src/client/document.tsx +165 -0
- package/src/client/hmr.ts +40 -0
- package/src/client/internal/runtime-types.ts +3 -1
- package/src/client/link.tsx +21 -6
- package/src/client/router/index.ts +1 -0
- package/src/client/router/link-utils.ts +26 -0
- package/src/client/router/provider.tsx +25 -2
- package/src/client/router/search/index.ts +4 -12
- package/src/client/router/types.ts +50 -24
- package/src/client.ts +14 -316
- package/src/config.ts +10 -10
- package/src/define-route.ts +959 -0
- package/src/devtools/devtools-element.js +11 -10
- package/src/furin.ts +303 -53
- package/src/plugin/route-config-autofix.ts +1140 -0
- package/src/plugin/routes.ts +891 -0
- package/src/plugin/transform-client.ts +132 -266
- package/src/plugin/transform-isomorphic.ts +1 -1
- package/src/routes.ts +6 -0
- package/src/rsc/build/index.ts +1 -1
- package/src/server/auto-invalidate/registry.ts +2 -2
- package/src/server/dev-page-plugin.ts +31 -12
- package/src/server/devtools/instrumentation.production.ts +2 -2
- package/src/server/devtools/instrumentation.ts +2 -2
- package/src/server/devtools/plugin.ts +5 -3
- package/src/server/instance.ts +3 -3
- package/src/server/internal.ts +3 -0
- package/src/server/logger.ts +21 -0
- package/src/server/render/assemble.ts +0 -41
- package/src/server/render/document.tsx +25 -0
- package/src/server/render/element.tsx +13 -1
- package/src/server/render/index.ts +0 -1
- package/src/server/render/isr.ts +31 -10
- package/src/server/render/loaders.ts +31 -6
- package/src/server/render/not-found.ts +51 -27
- package/src/server/render/ppr-route.ts +1 -1
- package/src/server/render/ssg.ts +1 -1
- package/src/server/render/ssr.ts +271 -113
- package/src/server/render/template.ts +91 -1
- package/src/server/router/defined-route.ts +110 -0
- package/src/server/router/discovery.ts +129 -29
- package/src/server/router/hmr.ts +111 -40
- package/src/server/router/patterns.ts +40 -12
- package/src/server/router/plugin.ts +63 -46
- package/src/server/router/schema-merge.ts +4 -14
- package/src/server/router/schemas.ts +11 -8
- package/src/server/router/source-version.ts +16 -0
- package/src/server/router/types.ts +2 -0
- package/src/server/sync/postgres/migrate.ts +3 -2
- package/src/server/sync/response.ts +14 -10
- package/src/shared/await.tsx +6 -7
- package/src/shared/elysia-contract.ts +63 -0
- package/src/shared/route-map.ts +37 -0
- package/src/shared/utils/index.ts +2 -20
- package/dist/build/server-routes-entry.d.ts +0 -13
- package/dist/build/server-routes-entry.ts +0 -30
- package/dist/server/router/index.d.ts +0 -7
- package/dist/server/router/index.js +0 -27
- package/dist/server/router/index.ts +0 -28
- package/src/build/server-routes-entry.ts +0 -30
- package/src/server/router/index.ts +0 -28
|
@@ -8,4 +8,4 @@ export { RouterProvider } from "./provider.tsx";
|
|
|
8
8
|
export type { SearchStore, SearchStoreSnapshot } from "./search-store.ts";
|
|
9
9
|
export { createSearchStore, FALLBACK_SEARCH_STORE, SearchStoreContext, searchSnapshotFromRouterContext, } from "./search-store.ts";
|
|
10
10
|
export { buildDataEndpoint, buildNotFoundPageElement, classifySpaResponse, detectStaticMode, parsePageResponse, pickDeepestNotFound, } from "./spa-response.ts";
|
|
11
|
-
export type { CacheEntry, ClientRoute, ClientSegmentBoundary, LinkProps, LoadedClientRoute, PreloadStrategy, RootBoundaryOptions, RouteManifest, RouterContextValue, RouterProviderProps, RouterState, RouteSearch, RouteTo, SpaResponseKind, } from "./types.ts";
|
|
11
|
+
export type { CacheEntry, ClientRoute, ClientSegmentBoundary, LinkProps, LoadedClientRoute, PreloadStrategy, RootBoundaryOptions, RouteManifest, RouteParamsOf, RouterContextValue, RouterProviderProps, RouterState, RouteSearch, RouteTo, SpaResponseKind, } from "./types.ts";
|
|
@@ -6,6 +6,15 @@ export type NavigationHrefPolicy = "blocked" | "external" | "internal";
|
|
|
6
6
|
export declare function navigationHrefPolicy(href: string, currentOrigin: string | undefined): NavigationHrefPolicy;
|
|
7
7
|
export declare function decodeHashFragment(fragment: string): string;
|
|
8
8
|
export declare function isSameOriginFetchResult(input: RequestInfo | URL, responseUrl: string, currentOrigin: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Substitutes typed path params into a route pattern: `/board/:boardId` with
|
|
11
|
+
* `{ boardId: 42 }` → `/board/42`. The `*` wildcard segment (catch-all) is
|
|
12
|
+
* replaced from `params["*"]`. Unknown segments are left untouched so
|
|
13
|
+
* partially-applied patterns stay visible.
|
|
14
|
+
*
|
|
15
|
+
* @internal Exported for unit testing only.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyLinkParams(to: string, params: Record<string, string | number> | null | undefined): string;
|
|
9
18
|
/**
|
|
10
19
|
* Builds a full href string from a pathname, optional search params, and optional hash.
|
|
11
20
|
* Null/undefined search values are omitted.
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { RouteManifest
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export type SearchRouteTo = keyof LinkRouteManifest extends never ? RouteTo : (string & {}) | keyof LinkRouteManifest;
|
|
5
|
-
type SearchRouteSearch<To extends SearchRouteTo> = keyof LinkRouteManifest extends never ? RouteSearch<To & RouteTo> : To extends keyof LinkRouteManifest ? LinkRouteManifest[To] extends {
|
|
6
|
-
search?: infer S;
|
|
7
|
-
} ? S : undefined : undefined;
|
|
1
|
+
import type { RouteManifest, RouteSearch, RouteTo } from "@teyik0/furin/link";
|
|
2
|
+
export type SearchRouteTo = keyof RouteManifest extends never ? RouteTo : (string & {}) | keyof RouteManifest;
|
|
3
|
+
type SearchRouteSearch<To extends SearchRouteTo> = RouteSearch<To & RouteTo>;
|
|
8
4
|
export type EmptyRouteSearch = Record<PropertyKey, never>;
|
|
9
5
|
export type ResolvedRouteSearch<To extends SearchRouteTo> = SearchRouteSearch<To> extends never | undefined ? EmptyRouteSearch : NonNullable<SearchRouteSearch<To>>;
|
|
10
6
|
export type SetSearchInput<To extends SearchRouteTo> = Partial<ResolvedRouteSearch<To>> | ((prev: ResolvedRouteSearch<To>) => Partial<ResolvedRouteSearch<To>>);
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
+
import type { RouteMap } from "@teyik0/furin/routes";
|
|
1
2
|
import type React from "react";
|
|
3
|
+
import type { HeadOptions } from "../../client.ts";
|
|
4
|
+
import type { ElysiaRouteLeaf, ElysiaRouteParams, ElysiaRouteQuery } from "../../shared/elysia-contract.ts";
|
|
2
5
|
import type { ErrorComponent } from "../../shared/error.ts";
|
|
3
6
|
import type { NotFoundComponent } from "../../shared/not-found.ts";
|
|
4
7
|
import type { SearchParamsInput, SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
5
8
|
import type { RuntimeRoute } from "../internal/runtime-types.ts";
|
|
9
|
+
/** Exact public projection of the generated Elysia route map. */
|
|
10
|
+
export type RouteManifest = RouteMap;
|
|
11
|
+
type RouteSearchInput<Route> = Route extends {
|
|
12
|
+
elysia: infer App;
|
|
13
|
+
} ? unknown extends ElysiaRouteQuery<ElysiaRouteLeaf<App>> ? undefined : ElysiaRouteQuery<ElysiaRouteLeaf<App>> : undefined;
|
|
14
|
+
type RouteParamInput<Value> = Value extends number ? string | number : Value;
|
|
6
15
|
/**
|
|
7
|
-
*
|
|
8
|
-
* to get type-safe `to` autocompletion and per-route `search` types on <Link>.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // furin-env.d.ts (auto-generated by Furin at project root)
|
|
12
|
-
* import "@teyik0/furin/link";
|
|
13
|
-
* declare module "@teyik0/furin/link" {
|
|
14
|
-
* interface RouteManifest {
|
|
15
|
-
* "/blog": { search?: { page?: number; tag?: string } };
|
|
16
|
-
* "/": { search?: never };
|
|
17
|
-
* [key: `/blog/${string}`]: { search?: never };
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
*/
|
|
21
|
-
export interface RouteManifest {
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The valid `to` pathname union derived from the augmented RouteManifest.
|
|
16
|
+
* The valid `to` pathname union derived from the generated RouteMap.
|
|
25
17
|
* Falls back to `string` when furin-env.d.ts has not been generated yet.
|
|
26
18
|
* When augmented, also includes `https://` and `http://` for external links.
|
|
27
19
|
*/
|
|
28
20
|
export type RouteTo = keyof RouteManifest extends never ? string : (string & {}) | keyof RouteManifest | `https://${string}` | `http://${string}`;
|
|
29
21
|
/**
|
|
30
22
|
* The typed search params for a given `to` pathname.
|
|
31
|
-
* Falls back to a permissive record
|
|
23
|
+
* Falls back to a permissive record before RouteMap generation.
|
|
32
24
|
*/
|
|
33
|
-
export type RouteSearch<To extends RouteTo> = keyof RouteManifest extends never ? SearchParamsInput : To extends keyof RouteManifest ? RouteManifest[To]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
export type RouteSearch<To extends RouteTo> = keyof RouteManifest extends never ? SearchParamsInput : To extends keyof RouteManifest ? RouteSearchInput<RouteManifest[To]> : undefined;
|
|
26
|
+
/**
|
|
27
|
+
* URL values for a route's path params: schema numbers accept both `42` and
|
|
28
|
+
* `"42"` (the URL always carries strings), everything else stays as declared.
|
|
29
|
+
* Falls back to a permissive record before RouteMap generation.
|
|
30
|
+
*/
|
|
31
|
+
export type RouteParamsOf<To extends RouteTo> = keyof RouteManifest extends never ? Record<string, string | number> : To extends keyof RouteManifest ? RouteManifest[To] extends {
|
|
32
|
+
elysia: infer App;
|
|
33
|
+
} ? unknown extends ElysiaRouteParams<ElysiaRouteLeaf<App>> ? undefined : keyof ElysiaRouteParams<ElysiaRouteLeaf<App>> extends never ? undefined : {
|
|
34
|
+
[Key in keyof ElysiaRouteParams<ElysiaRouteLeaf<App>>]: RouteParamInput<ElysiaRouteParams<ElysiaRouteLeaf<App>>[Key]>;
|
|
35
|
+
} : undefined : undefined;
|
|
38
36
|
export type PreloadStrategy = false | "intent" | "viewport" | "render";
|
|
39
37
|
export interface LinkProps<To extends RouteTo = RouteTo> extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children"> {
|
|
40
38
|
/**
|
|
@@ -58,6 +56,12 @@ export interface LinkProps<To extends RouteTo = RouteTo> extends Omit<React.Anch
|
|
|
58
56
|
* Styles and classNames from `inactiveProps` win over the static props.
|
|
59
57
|
*/
|
|
60
58
|
inactiveProps?: () => React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
59
|
+
/**
|
|
60
|
+
* Typed path params for this route pattern: `/board/:boardId` with
|
|
61
|
+
* `{ boardId: 42 }` renders `/board/42`. Auto-completed from the route's
|
|
62
|
+
* params schema; schema numbers accept both `42` and `"42"`.
|
|
63
|
+
*/
|
|
64
|
+
params?: RouteParamsOf<To>;
|
|
61
65
|
/** Preload strategy. Default: "intent" (preload on hover/focus). */
|
|
62
66
|
preload?: PreloadStrategy;
|
|
63
67
|
/** Delay in ms before intent preload triggers. Default: 50. */
|
|
@@ -224,6 +228,7 @@ export interface RouterState {
|
|
|
224
228
|
};
|
|
225
229
|
/** The canonical href after server-side redirects (e.g. query-default redirect). */
|
|
226
230
|
finalHref?: string;
|
|
231
|
+
head?: HeadOptions;
|
|
227
232
|
/**
|
|
228
233
|
* The currently rendered route.
|
|
229
234
|
*
|
|
@@ -287,6 +292,9 @@ export interface RootBoundaryOptions {
|
|
|
287
292
|
* Server-logged error id propagated from `__FURIN_DATA__.__furinError.digest`.
|
|
288
293
|
*/
|
|
289
294
|
digest?: string;
|
|
295
|
+
/** @internal Render the root fallback as a complete document. */
|
|
296
|
+
document?: boolean;
|
|
290
297
|
onReset?: () => void;
|
|
291
298
|
resetKey?: string | number;
|
|
292
299
|
}
|
|
300
|
+
export {};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,99 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { defineRootRoute, defineRoute } from "./client/define-route.ts";
|
|
2
|
+
export { type DocumentAssets, DocumentProvider, type DocumentState, HeadContent, Scripts, } from "./client/document.tsx";
|
|
3
|
+
export { type HotComponentRegistry, reconcileHotComponentRegistry, updateHotComponent, } from "./client/hmr.ts";
|
|
4
4
|
export { type SyncMutation, type SyncMutationContext, type SyncMutationErrorContext, type SyncMutationHeaders, type SyncMutationOptions, type SyncMutationRunner, type SyncMutationSuccessContext, type UseSyncOptions, useSync, } from "./client/sync.ts";
|
|
5
5
|
export { Await, useAsyncError, useAsyncValue } from "./shared/await.tsx";
|
|
6
6
|
export type RenderingMode = "ssr" | "ssg" | "isr";
|
|
7
7
|
declare const DEFERRED_BRAND: unique symbol;
|
|
8
|
-
declare const ROUTE_TYPES: unique symbol;
|
|
9
|
-
type NoFields = NonNullable<unknown>;
|
|
10
|
-
type Awaitable<T> = Promise<T> | T;
|
|
11
|
-
type StaticParams<TParams> = () => Awaitable<readonly TParams[]>;
|
|
12
|
-
type StripDeferred<T> = Omit<T, typeof DEFERRED_BRAND>;
|
|
13
|
-
type ResolvedSchema<T> = T extends AnySchema ? UnwrapSchema<T> : NoFields;
|
|
14
|
-
type RequestDataProp<T extends object> = keyof T extends never ? NoFields : {
|
|
15
|
-
requestData: Promise<T>;
|
|
16
|
-
};
|
|
17
|
-
interface RouteTypeInfo<TData extends object = object, TParams = unknown, TQuery = unknown, TRequestData extends object = NoFields> {
|
|
18
|
-
data: TData;
|
|
19
|
-
params: TParams;
|
|
20
|
-
query: TQuery;
|
|
21
|
-
requestData: TRequestData;
|
|
22
|
-
}
|
|
23
|
-
interface RouteCarrier {
|
|
24
|
-
readonly __type: "FURIN_ROUTE";
|
|
25
|
-
readonly [ROUTE_TYPES]: RouteTypeInfo;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Transforms each key of a parent-data record into an individual `Promise<T>`.
|
|
29
|
-
* This is what child loaders see for inherited fields — direct values from
|
|
30
|
-
* `RouteContext` (request, params, set, …) remain unchanged.
|
|
31
|
-
*
|
|
32
|
-
* `Awaited<T[K]>` mirrors the JS Promise-chaining auto-flatten used by
|
|
33
|
-
* `createLoaderCtx`: when an ancestor wrapped a field with `defer()` (so the
|
|
34
|
-
* raw value is itself a `Promise<U>`), the type collapses to `Promise<U>`
|
|
35
|
-
* instead of `Promise<Promise<U>>`. Otherwise TypeScript would force a
|
|
36
|
-
* redundant `await await ctx.field` dance.
|
|
37
|
-
*/
|
|
38
|
-
type PromisifyData<T extends object> = {
|
|
39
|
-
[K in keyof T]: Promise<Awaited<T[K]>>;
|
|
40
|
-
};
|
|
41
|
-
export interface RouteContext<TParams = NoFields, TQuery = NoFields> {
|
|
42
|
-
cookie: Record<string, Cookie<unknown>>;
|
|
43
|
-
headers: Record<string, string | undefined>;
|
|
44
|
-
/** Request-scoped logger. Call `log.set({})` to attach fields to the wide event for this render. */
|
|
45
|
-
log: RequestLogger;
|
|
46
|
-
params: TParams;
|
|
47
|
-
path: string;
|
|
48
|
-
query: TQuery;
|
|
49
|
-
redirect: (url: string, status?: 301 | 302 | 303 | 307 | 308) => Response;
|
|
50
|
-
request: Request;
|
|
51
|
-
set: {
|
|
52
|
-
headers: HTTPHeaders;
|
|
53
|
-
status?: number | keyof StatusMap;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export interface RequestCookies {
|
|
57
|
-
get: (name: string) => unknown;
|
|
58
|
-
}
|
|
59
|
-
export interface RequestHeaders {
|
|
60
|
-
entries: () => IterableIterator<[string, string]>;
|
|
61
|
-
get: (name: string) => string | null;
|
|
62
|
-
has: (name: string) => boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface RequestLoaderContext<TParams = NoFields, TQuery = NoFields> {
|
|
65
|
-
readonly cookies: RequestCookies;
|
|
66
|
-
readonly headers: RequestHeaders;
|
|
67
|
-
readonly log: RequestLogger;
|
|
68
|
-
readonly params: TParams;
|
|
69
|
-
readonly path: string;
|
|
70
|
-
readonly query: TQuery;
|
|
71
|
-
readonly request: Request;
|
|
72
|
-
}
|
|
73
|
-
export interface ComponentProps<TParams = NoFields, TQuery = NoFields> {
|
|
74
|
-
params: TParams;
|
|
75
|
-
path: string;
|
|
76
|
-
query: TQuery;
|
|
77
|
-
}
|
|
78
|
-
type ResolveParent<T> = T extends {
|
|
79
|
-
readonly [ROUTE_TYPES]: RouteTypeInfo<infer D, infer P, infer Q, infer R>;
|
|
80
|
-
} ? {
|
|
81
|
-
data: D;
|
|
82
|
-
params: P;
|
|
83
|
-
query: Q;
|
|
84
|
-
requestData: R;
|
|
85
|
-
} : {
|
|
86
|
-
data: NoFields;
|
|
87
|
-
params: NoFields;
|
|
88
|
-
query: NoFields;
|
|
89
|
-
requestData: NoFields;
|
|
90
|
-
};
|
|
91
|
-
interface Resolved<TParentRoute, TLoaderData, TParamsSchema = undefined, TQuerySchema = undefined, TRequestLoaderData extends object = NoFields> {
|
|
92
|
-
data: ResolveParent<TParentRoute>["data"] & StripDeferred<TLoaderData>;
|
|
93
|
-
params: ResolveParent<TParentRoute>["params"] & ResolvedSchema<TParamsSchema>;
|
|
94
|
-
query: ResolveParent<TParentRoute>["query"] & ResolvedSchema<TQuerySchema>;
|
|
95
|
-
requestData: ResolveParent<TParentRoute>["requestData"] & TRequestLoaderData;
|
|
96
|
-
}
|
|
97
8
|
export type MetaDescriptor = {
|
|
98
9
|
charSet: "utf-8";
|
|
99
10
|
} | {
|
|
@@ -143,71 +54,6 @@ export interface HeadOptions {
|
|
|
143
54
|
children: string;
|
|
144
55
|
}>;
|
|
145
56
|
}
|
|
146
|
-
type ExtractLoaderReturn<TLoader> = TLoader extends (...args: never[]) => unknown ? Awaited<ReturnType<TLoader>> extends object ? StripDeferred<Awaited<ReturnType<TLoader>>> : NoFields : NoFields;
|
|
147
|
-
interface PageResult<TData extends object, TParams, TQuery, TPageLoaderData extends object, TRequestData extends object> {
|
|
148
|
-
__type: "FURIN_PAGE";
|
|
149
|
-
_route: Route<TData, TParams, TQuery, TRequestData>;
|
|
150
|
-
component: React.FC<TData & TPageLoaderData & RequestDataProp<TRequestData> & ComponentProps<TParams, TQuery>>;
|
|
151
|
-
head?: (ctx: ComponentProps<TParams, TQuery> & TData & TPageLoaderData) => HeadOptions;
|
|
152
|
-
loader?: (ctx: RouteContext<TParams, TQuery> & PromisifyData<TData>) => Awaitable<TPageLoaderData>;
|
|
153
|
-
mode?: RenderingMode;
|
|
154
|
-
revalidate?: number;
|
|
155
|
-
staticParams?: StaticParams<TParams>;
|
|
156
|
-
tags?: readonly string[];
|
|
157
|
-
}
|
|
158
|
-
export interface Route<TParentData extends object, TParams, TQuery, TRequestData extends object = NoFields> {
|
|
159
|
-
__type: "FURIN_ROUTE";
|
|
160
|
-
layout?: React.FC<TParentData & RequestDataProp<TRequestData> & {
|
|
161
|
-
children: React.ReactNode;
|
|
162
|
-
} & ComponentProps<TParams, TQuery>>;
|
|
163
|
-
loader?: (ctx: RouteContext<TParams, TQuery> & PromisifyData<TParentData>) => Awaitable<TParentData>;
|
|
164
|
-
mode?: RenderingMode;
|
|
165
|
-
page: {
|
|
166
|
-
<TLoader extends (ctx: RouteContext<TParams, TQuery> & PromisifyData<TParentData>) => unknown, TPageLoaderData extends object = ExtractLoaderReturn<TLoader>>(config: {
|
|
167
|
-
loader: TLoader;
|
|
168
|
-
mode?: RenderingMode;
|
|
169
|
-
revalidate?: number;
|
|
170
|
-
staticParams?: StaticParams<TParams>;
|
|
171
|
-
tags?: readonly string[];
|
|
172
|
-
component: React.FC<NoInfer<TParentData & TPageLoaderData & RequestDataProp<TRequestData> & ComponentProps<TParams, TQuery>>>;
|
|
173
|
-
head?: (ctx: NoInfer<ComponentProps<TParams, TQuery> & TParentData & TPageLoaderData>) => HeadOptions;
|
|
174
|
-
}): PageResult<TParentData, TParams, TQuery, TPageLoaderData, TRequestData>;
|
|
175
|
-
(config: {
|
|
176
|
-
mode?: RenderingMode;
|
|
177
|
-
revalidate?: number;
|
|
178
|
-
staticParams?: StaticParams<TParams>;
|
|
179
|
-
tags?: readonly string[];
|
|
180
|
-
component: React.FC<TParentData & RequestDataProp<TRequestData> & ComponentProps<TParams, TQuery>>;
|
|
181
|
-
head?: (ctx: ComponentProps<TParams, TQuery> & TParentData) => HeadOptions;
|
|
182
|
-
}): PageResult<TParentData, TParams, TQuery, NoFields, TRequestData>;
|
|
183
|
-
};
|
|
184
|
-
params?: unknown;
|
|
185
|
-
parent?: RouteCarrier;
|
|
186
|
-
query?: unknown;
|
|
187
|
-
requestLoader?: (ctx: RequestLoaderContext<TParams, TQuery>) => Awaitable<TRequestData>;
|
|
188
|
-
revalidate?: number;
|
|
189
|
-
tags?: readonly string[];
|
|
190
|
-
readonly [ROUTE_TYPES]: RouteTypeInfo<TParentData, TParams, TQuery, TRequestData>;
|
|
191
|
-
}
|
|
192
|
-
export declare function createRoute<TParentRoute extends RouteCarrier | undefined = undefined, TParamsSchema extends AnySchema | undefined = undefined, TQuerySchema extends AnySchema | undefined = undefined, TLoaderData extends object = NoFields, TRequestLoaderData extends object = NoFields>(config?: {
|
|
193
|
-
parent?: TParentRoute;
|
|
194
|
-
mode?: RenderingMode;
|
|
195
|
-
revalidate?: number;
|
|
196
|
-
params?: TParamsSchema;
|
|
197
|
-
query?: TQuerySchema;
|
|
198
|
-
tags?: readonly string[];
|
|
199
|
-
loader?: (ctx: RouteContext<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema>["params"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema>["query"]> & PromisifyData<ResolveParent<TParentRoute>["data"]>) => Awaitable<TLoaderData>;
|
|
200
|
-
requestLoader?: (ctx: RequestLoaderContext<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["params"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["query"]>) => Awaitable<TRequestLoaderData>;
|
|
201
|
-
layout?: React.FC<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["data"] & RequestDataProp<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["requestData"]> & {
|
|
202
|
-
children: React.ReactNode;
|
|
203
|
-
} & ComponentProps<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["params"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["query"]>>;
|
|
204
|
-
}): Route<Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["data"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["params"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["query"], Resolved<TParentRoute, TLoaderData, TParamsSchema, TQuerySchema, TRequestLoaderData>["requestData"]>;
|
|
205
|
-
export type InferProps<T> = T extends {
|
|
206
|
-
__type: "FURIN_PAGE";
|
|
207
|
-
component: React.FC<infer P>;
|
|
208
|
-
} ? P : T extends Route<infer D, infer P, infer Q, infer R> ? D & RequestDataProp<R> & {
|
|
209
|
-
children: React.ReactNode;
|
|
210
|
-
} & ComponentProps<P, Q> : never;
|
|
211
57
|
/**
|
|
212
58
|
* A loader return value that contains a mix of synchronous scalar fields and
|
|
213
59
|
* lazy `Promise<T>` fields. Scalar fields are serialised into the initial HTML
|
|
@@ -226,8 +72,7 @@ export type DeferredData<T extends object> = T & {
|
|
|
226
72
|
* Wraps loader data so that Promise-valued fields are streamed lazily while
|
|
227
73
|
* scalar fields are embedded in the initial HTML shell immediately.
|
|
228
74
|
*
|
|
229
|
-
* Use in any
|
|
230
|
-
* (`createRoute({ loader })`). Promise-valued fields are streamed lazily;
|
|
75
|
+
* Use in any `defineRoute().loader()`. Promise-valued fields are streamed lazily;
|
|
231
76
|
* scalar fields are embedded in the initial HTML shell.
|
|
232
77
|
*/
|
|
233
78
|
export declare function defer<T extends object>(data: T & {
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,174 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// src/client/define-route.ts
|
|
3
|
+
function toRenderContext(props) {
|
|
4
|
+
const { children, params = {}, path = "", query = {}, requestData, ...data } = props;
|
|
5
|
+
return { children, data, params, path, query, requestData };
|
|
6
|
+
}
|
|
7
|
+
function render(component, props) {
|
|
8
|
+
return component(toRenderContext(props));
|
|
9
|
+
}
|
|
10
|
+
function defineRoute() {
|
|
11
|
+
return {
|
|
12
|
+
layout(component) {
|
|
13
|
+
const clientComponent = (props) => render(component, props);
|
|
14
|
+
return {
|
|
15
|
+
__type: "FURIN_ROUTE",
|
|
16
|
+
component: clientComponent,
|
|
17
|
+
layout: clientComponent
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
page(component) {
|
|
21
|
+
const clientComponent = (props) => render(component, props);
|
|
22
|
+
return {
|
|
23
|
+
__type: "FURIN_ROUTE",
|
|
24
|
+
component: clientComponent,
|
|
25
|
+
page: clientComponent
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function defineRootRoute() {
|
|
31
|
+
return defineRoute();
|
|
32
|
+
}
|
|
33
|
+
// src/client/document.tsx
|
|
34
|
+
import { createContext, createElement, useContext } from "react";
|
|
35
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
36
|
+
var DocumentContext = createContext(null);
|
|
37
|
+
function serializeJson(value) {
|
|
38
|
+
return JSON.stringify(value).replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
39
|
+
}
|
|
40
|
+
function DocumentProvider({
|
|
41
|
+
children,
|
|
42
|
+
value
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxDEV(DocumentContext.Provider, {
|
|
45
|
+
value,
|
|
46
|
+
children
|
|
47
|
+
}, undefined, false, undefined, this);
|
|
48
|
+
}
|
|
49
|
+
function renderMeta(meta, index) {
|
|
50
|
+
if ("title" in meta) {
|
|
51
|
+
return /* @__PURE__ */ jsxDEV("title", {
|
|
52
|
+
children: meta.title
|
|
53
|
+
}, `title:${index}`, false, undefined, this);
|
|
54
|
+
}
|
|
55
|
+
if ("script:ld+json" in meta) {
|
|
56
|
+
return /* @__PURE__ */ jsxDEV("script", {
|
|
57
|
+
dangerouslySetInnerHTML: { __html: serializeJson(meta["script:ld+json"]) },
|
|
58
|
+
type: "application/ld+json"
|
|
59
|
+
}, `json-ld:${index}`, false, undefined, this);
|
|
60
|
+
}
|
|
61
|
+
if ("tagName" in meta) {
|
|
62
|
+
const { tagName, ...attributes } = meta;
|
|
63
|
+
return createElement(tagName, { ...attributes, key: `${tagName}:${index}` });
|
|
64
|
+
}
|
|
65
|
+
return createElement("meta", { ...meta, key: `meta:${index}` });
|
|
66
|
+
}
|
|
67
|
+
function HeadContent() {
|
|
68
|
+
const state = useContext(DocumentContext);
|
|
69
|
+
if (state === null) {
|
|
70
|
+
throw new Error("[furin] <HeadContent /> must be rendered inside the root layout.");
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsxDEV(Fragment, {
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
75
|
+
charSet: "utf-8",
|
|
76
|
+
"data-furin-head": ""
|
|
77
|
+
}, undefined, false, undefined, this),
|
|
78
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
79
|
+
content: "width=device-width, initial-scale=1.0",
|
|
80
|
+
name: "viewport"
|
|
81
|
+
}, undefined, false, undefined, this),
|
|
82
|
+
/* @__PURE__ */ jsxDEV("script", {
|
|
83
|
+
dangerouslySetInnerHTML: {
|
|
84
|
+
__html: 'try{var __t=localStorage.getItem("furin-theme");document.documentElement.classList.add(__t==="light"?"light":"dark")}catch(e){document.documentElement.classList.add("dark")}'
|
|
85
|
+
}
|
|
86
|
+
}, undefined, false, undefined, this),
|
|
87
|
+
state.assets.buildId ? /* @__PURE__ */ jsxDEV("meta", {
|
|
88
|
+
content: state.assets.buildId,
|
|
89
|
+
name: "furin-build-id"
|
|
90
|
+
}, undefined, false, undefined, this) : null,
|
|
91
|
+
state.assets.staticMode ? /* @__PURE__ */ jsxDEV("meta", {
|
|
92
|
+
content: "static",
|
|
93
|
+
name: "furin-mode"
|
|
94
|
+
}, undefined, false, undefined, this) : null,
|
|
95
|
+
state.assets.faviconHref ? /* @__PURE__ */ jsxDEV("link", {
|
|
96
|
+
href: state.assets.faviconHref,
|
|
97
|
+
rel: "icon"
|
|
98
|
+
}, undefined, false, undefined, this) : null,
|
|
99
|
+
state.assets.stylesheets.map((href) => /* @__PURE__ */ jsxDEV("link", {
|
|
100
|
+
crossOrigin: "",
|
|
101
|
+
href,
|
|
102
|
+
rel: "stylesheet"
|
|
103
|
+
}, href, false, undefined, this)),
|
|
104
|
+
state.head?.meta?.map(renderMeta),
|
|
105
|
+
state.head?.links?.map((link, index) => /* @__PURE__ */ jsxDEV("link", {
|
|
106
|
+
...link
|
|
107
|
+
}, `${link.rel}:${link.href}:${index}`, false, undefined, this)),
|
|
108
|
+
state.head?.scripts?.map(({ children, ...attributes }, index) => /* @__PURE__ */ jsxDEV("script", {
|
|
109
|
+
...attributes,
|
|
110
|
+
dangerouslySetInnerHTML: children === undefined ? undefined : { __html: children }
|
|
111
|
+
}, `script:${index}`, false, undefined, this)),
|
|
112
|
+
state.head?.styles?.map(({ children, type }, index) => /* @__PURE__ */ jsxDEV("style", {
|
|
113
|
+
dangerouslySetInnerHTML: { __html: children },
|
|
114
|
+
type
|
|
115
|
+
}, `style:${index}`, false, undefined, this))
|
|
116
|
+
]
|
|
117
|
+
}, undefined, true, undefined, this);
|
|
118
|
+
}
|
|
119
|
+
function Scripts() {
|
|
120
|
+
const state = useContext(DocumentContext);
|
|
121
|
+
if (state === null) {
|
|
122
|
+
throw new Error("[furin] <Scripts /> must be rendered inside the root layout.");
|
|
123
|
+
}
|
|
124
|
+
return /* @__PURE__ */ jsxDEV(Fragment, {
|
|
125
|
+
children: [
|
|
126
|
+
state.syncJson === undefined ? null : /* @__PURE__ */ jsxDEV("script", {
|
|
127
|
+
dangerouslySetInnerHTML: { __html: state.syncJson },
|
|
128
|
+
id: "__FURIN_SYNC__",
|
|
129
|
+
type: "application/json"
|
|
130
|
+
}, undefined, false, undefined, this),
|
|
131
|
+
state.dataJson === undefined ? null : /* @__PURE__ */ jsxDEV("script", {
|
|
132
|
+
dangerouslySetInnerHTML: { __html: state.dataJson },
|
|
133
|
+
id: "__FURIN_DATA__",
|
|
134
|
+
type: "application/json"
|
|
135
|
+
}, undefined, false, undefined, this),
|
|
136
|
+
/* @__PURE__ */ jsxDEV("script", {
|
|
137
|
+
dangerouslySetInnerHTML: { __html: serializeJson(state.head ?? {}) },
|
|
138
|
+
"data-furin-scripts": "",
|
|
139
|
+
id: "__FURIN_HEAD__",
|
|
140
|
+
type: "application/json"
|
|
141
|
+
}, undefined, false, undefined, this),
|
|
142
|
+
state.assets.entryModule === undefined ? null : /* @__PURE__ */ jsxDEV("script", {
|
|
143
|
+
crossOrigin: "",
|
|
144
|
+
"data-furin-entry": "",
|
|
145
|
+
src: state.assets.entryModule,
|
|
146
|
+
type: "module"
|
|
147
|
+
}, undefined, false, undefined, this)
|
|
148
|
+
]
|
|
149
|
+
}, undefined, true, undefined, this);
|
|
150
|
+
}
|
|
151
|
+
// src/client/hmr.ts
|
|
152
|
+
function reconcileHotComponentRegistry(registry, activeKeys) {
|
|
153
|
+
for (const key of registry.keys()) {
|
|
154
|
+
if (!activeKeys.has(key)) {
|
|
155
|
+
registry.delete(key);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function updateHotComponent(registry, key, component) {
|
|
160
|
+
const existing = registry.get(key);
|
|
161
|
+
if (existing) {
|
|
162
|
+
existing.current = component;
|
|
163
|
+
return existing.stable;
|
|
164
|
+
}
|
|
165
|
+
const slot = {
|
|
166
|
+
current: component,
|
|
167
|
+
stable: (props) => slot.current(props)
|
|
168
|
+
};
|
|
169
|
+
registry.set(key, slot);
|
|
170
|
+
return slot.stable;
|
|
171
|
+
}
|
|
2
172
|
// src/client/sync.ts
|
|
3
173
|
import { useCallback } from "react";
|
|
4
174
|
function createIdempotencyKey() {
|
|
@@ -43,8 +213,8 @@ function useSync(mutation, options) {
|
|
|
43
213
|
return run;
|
|
44
214
|
}
|
|
45
215
|
// src/shared/await.tsx
|
|
46
|
-
import { Component, createContext, createElement, use, useMemo } from "react";
|
|
47
|
-
var AsyncErrorContext =
|
|
216
|
+
import { Component, createContext as createContext2, createElement as createElement2, use, useMemo } from "react";
|
|
217
|
+
var AsyncErrorContext = createContext2(undefined);
|
|
48
218
|
function useAsyncError() {
|
|
49
219
|
return use(AsyncErrorContext);
|
|
50
220
|
}
|
|
@@ -55,7 +225,7 @@ function useAsyncValue() {
|
|
|
55
225
|
}
|
|
56
226
|
return use(ctx.promise);
|
|
57
227
|
}
|
|
58
|
-
var AwaitValueContext =
|
|
228
|
+
var AwaitValueContext = createContext2(undefined);
|
|
59
229
|
function isAbortError(error) {
|
|
60
230
|
return error instanceof Error && error.name === "AbortError";
|
|
61
231
|
}
|
|
@@ -89,36 +259,22 @@ class AsyncErrorBoundary extends Component {
|
|
|
89
259
|
if (errorElement === undefined) {
|
|
90
260
|
throw error;
|
|
91
261
|
}
|
|
92
|
-
return
|
|
262
|
+
return createElement2(AsyncErrorContext.Provider, { value: error }, errorElement);
|
|
93
263
|
}
|
|
94
264
|
return children;
|
|
95
265
|
}
|
|
96
266
|
}
|
|
97
267
|
function Await({ resolve, errorElement, children }) {
|
|
98
268
|
const guardedResolve = useMemo(() => silenceAbortError(resolve), [resolve]);
|
|
99
|
-
return
|
|
269
|
+
return createElement2(AsyncErrorBoundary, { errorElement, resolve: guardedResolve }, createElement2(AwaitInner, { children, resolve: guardedResolve }));
|
|
100
270
|
}
|
|
101
271
|
function AwaitInner({ resolve, children }) {
|
|
102
272
|
const value = use(resolve);
|
|
103
|
-
return
|
|
273
|
+
return createElement2(AwaitValueContext.Provider, { value: { promise: resolve } }, children ? children(value) : null);
|
|
104
274
|
}
|
|
105
275
|
|
|
106
276
|
// src/client.ts
|
|
107
277
|
var DEFERRED_BRAND = Symbol.for("@teyik0/furin/deferred");
|
|
108
|
-
function createRoute(config) {
|
|
109
|
-
const route = {
|
|
110
|
-
...config,
|
|
111
|
-
__type: "FURIN_ROUTE",
|
|
112
|
-
page(pageConfig) {
|
|
113
|
-
return {
|
|
114
|
-
...pageConfig,
|
|
115
|
-
__type: "FURIN_PAGE",
|
|
116
|
-
_route: route
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return route;
|
|
121
|
-
}
|
|
122
278
|
function defer(data) {
|
|
123
279
|
if (Object.hasOwn(data, DEFERRED_BRAND)) {
|
|
124
280
|
throw new Error("[furin] defer() received data that is already deferred.");
|
|
@@ -130,9 +286,15 @@ function isDeferred(value) {
|
|
|
130
286
|
}
|
|
131
287
|
export {
|
|
132
288
|
Await,
|
|
133
|
-
|
|
289
|
+
DocumentProvider,
|
|
290
|
+
HeadContent,
|
|
291
|
+
Scripts,
|
|
134
292
|
defer,
|
|
293
|
+
defineRootRoute,
|
|
294
|
+
defineRoute,
|
|
135
295
|
isDeferred,
|
|
296
|
+
reconcileHotComponentRegistry,
|
|
297
|
+
updateHotComponent,
|
|
136
298
|
useAsyncError,
|
|
137
299
|
useAsyncValue,
|
|
138
300
|
useSync
|
package/dist/config.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ export interface StaticExportConfig {
|
|
|
27
27
|
outDir?: string;
|
|
28
28
|
}
|
|
29
29
|
export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
30
|
-
rootDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
31
|
-
pagesDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
30
|
/**
|
|
33
31
|
* Multi-instance builds: one entry per mounted furin app. Overrides
|
|
34
32
|
* `pagesDir` and server-entry auto-detection. `prefix` must match the
|
|
@@ -38,7 +36,9 @@ export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
|
38
36
|
pagesDir: import("@sinclair/typebox").TString;
|
|
39
37
|
prefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
40
38
|
}>>>;
|
|
41
|
-
|
|
39
|
+
bun: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
40
|
+
compile: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"server">, import("@sinclair/typebox").TLiteral<"embed">]>>;
|
|
41
|
+
}>>;
|
|
42
42
|
/**
|
|
43
43
|
* Initialize the browser HTTP log drain in the hydration entry. Off by
|
|
44
44
|
* default — enabling it adds `evlog/http` drain setup and points browser
|
|
@@ -46,15 +46,15 @@ export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
|
46
46
|
* via the `furin({ logger })` plugin option).
|
|
47
47
|
*/
|
|
48
48
|
clientLogging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}>>;
|
|
49
|
+
pagesDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
50
|
+
rootDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
51
|
+
serverEntry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
53
52
|
static: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
54
53
|
basePath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
55
|
-
outDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
56
54
|
onSSR: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"error">, import("@sinclair/typebox").TLiteral<"skip">]>>;
|
|
55
|
+
outDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
57
56
|
}>>;
|
|
57
|
+
targets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"bun" | "cloudflare" | "node" | "package" | "static" | "vercel">[]>>>;
|
|
58
58
|
}>;
|
|
59
59
|
export type FurinPlugin = BunPlugin & {
|
|
60
60
|
buildOnly?: boolean;
|
package/dist/config.js
CHANGED
|
@@ -5,23 +5,23 @@ var BUILD_TARGETS = ["bun", "node", "vercel", "cloudflare", "static", "package"]
|
|
|
5
5
|
var buildTargetSchema = t.Union(BUILD_TARGETS.map((v) => t.Literal(v)));
|
|
6
6
|
var compileTargetSchema = t.Union([t.Literal("server"), t.Literal("embed")]);
|
|
7
7
|
var configSchema = t.Object({
|
|
8
|
-
rootDir: t.Optional(t.String()),
|
|
9
|
-
pagesDir: t.Optional(t.String()),
|
|
10
8
|
apps: t.Optional(t.Array(t.Object({
|
|
11
9
|
pagesDir: t.String(),
|
|
12
10
|
prefix: t.Optional(t.String())
|
|
13
11
|
}))),
|
|
14
|
-
serverEntry: t.Optional(t.String()),
|
|
15
|
-
clientLogging: t.Optional(t.Boolean()),
|
|
16
|
-
targets: t.Optional(t.Array(buildTargetSchema)),
|
|
17
12
|
bun: t.Optional(t.Object({
|
|
18
13
|
compile: t.Optional(compileTargetSchema)
|
|
19
14
|
})),
|
|
15
|
+
clientLogging: t.Optional(t.Boolean()),
|
|
16
|
+
pagesDir: t.Optional(t.String()),
|
|
17
|
+
rootDir: t.Optional(t.String()),
|
|
18
|
+
serverEntry: t.Optional(t.String()),
|
|
20
19
|
static: t.Optional(t.Object({
|
|
21
20
|
basePath: t.Optional(t.String()),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}))
|
|
21
|
+
onSSR: t.Optional(t.Union([t.Literal("error"), t.Literal("skip")])),
|
|
22
|
+
outDir: t.Optional(t.String())
|
|
23
|
+
})),
|
|
24
|
+
targets: t.Optional(t.Array(buildTargetSchema))
|
|
25
25
|
});
|
|
26
26
|
function defineConfig(config) {
|
|
27
27
|
return config;
|