@teyik0/furin 0.9.0-alpha.4 → 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.
- package/dist/adapter/runtime-build.d.ts +1 -0
- package/dist/build/index.js +65 -25
- package/dist/build/route-metadata.d.ts +1 -1
- package/dist/cli/index.js +65 -25
- package/dist/client/chunks/{client-rdxyrw11.js → client-hjqd5m3b.js} +1 -1
- package/dist/client/chunks/{client-p0jqzfvc.js → client-whph3y67.js} +1 -1
- package/dist/client/chunks/{client-a7spxfnn.js → client-xf7r768c.js} +13 -1
- package/dist/client/define-route.d.ts +12 -0
- package/dist/client/internal/runtime-types.d.ts +7 -0
- package/dist/client/link.js +200 -40
- package/dist/client/route-element.d.ts +5 -0
- package/dist/client/router/history.d.ts +6 -0
- package/dist/client/router/link-utils.d.ts +7 -0
- package/dist/client/router/navigation-controller.d.ts +20 -2
- package/dist/client/router/pending.d.ts +17 -0
- package/dist/client/router/search/index.d.ts +2 -0
- package/dist/client/router/search/index.js +7 -3
- package/dist/client/router/types.d.ts +21 -1
- package/dist/client.js +19 -4
- package/dist/define-route.d.ts +37 -10
- package/dist/furin.js +88 -29
- package/dist/plugin/client-plugin.d.ts +1 -1
- package/dist/plugin/index.js +36 -17
- package/dist/plugin/route-manifest.d.ts +2 -1
- package/dist/plugin/strip-server-stages.d.ts +1 -1
- package/dist/server/internal.d.ts +1 -0
- package/dist/server/internal.js +42 -15
- package/dist/server/router/defined-route.d.ts +3 -0
- package/dist/server/router/types.d.ts +7 -1
- package/dist/server/static-export.js +45 -15
- package/dist/shared/pending.d.ts +13 -0
- package/dist/shared/search-params.d.ts +1 -0
- package/package.json +1 -1
- package/src/adapter/runtime-build.ts +4 -0
- package/src/build/hydrate.ts +11 -2
- package/src/build/preload-manifest.ts +3 -1
- package/src/build/route-metadata.ts +3 -2
- package/src/client/define-route.ts +23 -3
- package/src/client/internal/runtime-types.ts +7 -0
- package/src/client/link.tsx +26 -4
- package/src/client/route-element.tsx +41 -15
- package/src/client/router/context.ts +29 -8
- package/src/client/router/history.ts +10 -0
- package/src/client/router/link-utils.ts +23 -0
- package/src/client/router/navigation-controller.ts +239 -19
- package/src/client/router/pending.ts +58 -0
- package/src/client/router/provider.tsx +5 -2
- package/src/client/router/search/index.ts +7 -2
- package/src/client/router/types.ts +29 -3
- package/src/define-route.ts +74 -26
- package/src/plugin/client-plugin.ts +5 -4
- package/src/plugin/route-config.ts +9 -2
- package/src/plugin/route-manifest.ts +11 -3
- package/src/plugin/route-tree.ts +2 -2
- package/src/plugin/strip-server-stages.ts +60 -35
- package/src/server/internal.ts +1 -0
- package/src/server/router/defined-route.ts +6 -0
- package/src/server/router/discovery.ts +5 -2
- package/src/server/router/types.ts +7 -1
- package/src/shared/pending.ts +16 -0
- package/src/shared/search-params.ts +1 -1
|
@@ -5,6 +5,7 @@ import type { RouteContractOf } from "../../define-route.ts";
|
|
|
5
5
|
import type { ElysiaRouteLeaf, ElysiaRouteParams, ElysiaRouteQuery } from "../../shared/elysia-contract.ts";
|
|
6
6
|
import type { ErrorComponent } from "../../shared/error.ts";
|
|
7
7
|
import type { NotFoundComponent } from "../../shared/not-found.ts";
|
|
8
|
+
import type { RoutePending } from "../../shared/pending.ts";
|
|
8
9
|
import type { SearchParamsInput, SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
9
10
|
import type { RuntimeData, RuntimeRoute } from "../internal/runtime-types.ts";
|
|
10
11
|
import type { FurinServerErrorPayload } from "../server-error.ts";
|
|
@@ -146,6 +147,8 @@ export interface LinkBaseProps<To extends RouteTo> extends Omit<React.AnchorHTML
|
|
|
146
147
|
resetScroll?: boolean;
|
|
147
148
|
/** Typed search params for this route. Auto-completed from the route's query schema. */
|
|
148
149
|
search?: RouteSearch<To>;
|
|
150
|
+
/** See `TargetNavigationOptions.shallow`. */
|
|
151
|
+
shallow?: boolean;
|
|
149
152
|
to: To;
|
|
150
153
|
}
|
|
151
154
|
export type LinkProps<To extends RouteTo = RouteTo> = LinkBaseProps<To> & LinkParams<To> & SearchProp<RouteSearch<To>> & RouteToCheck<To>;
|
|
@@ -180,7 +183,18 @@ export interface NavigationOptions {
|
|
|
180
183
|
replace?: boolean;
|
|
181
184
|
resetScroll?: boolean;
|
|
182
185
|
}
|
|
183
|
-
|
|
186
|
+
/** Options of navigations that name their destination's `search` (not raw hrefs). */
|
|
187
|
+
export interface TargetNavigationOptions extends NavigationOptions {
|
|
188
|
+
/**
|
|
189
|
+
* Same route and params: commit the new URL and search in place, without
|
|
190
|
+
* running loaders or setting `isNavigating`. Another destination navigates
|
|
191
|
+
* normally. Back/forward still load the page unless the route's
|
|
192
|
+
* `loaderDeps` exclude the changed params; reloads always do. Keeps the scroll
|
|
193
|
+
* position unless `resetScroll` is set.
|
|
194
|
+
*/
|
|
195
|
+
shallow?: boolean;
|
|
196
|
+
}
|
|
197
|
+
export type NavigateInput<To extends NavigationTo> = RouteTarget<To> & TargetNavigationOptions;
|
|
184
198
|
export type Navigate = <To extends NavigationTo>(next: NavigateInput<To>) => Promise<void>;
|
|
185
199
|
/** An href string validated like a structured destination (see `CheckedRouteTo`). */
|
|
186
200
|
type CheckedHref<Href extends string> = Href & RouteToCheck<NoInfer<Href>>;
|
|
@@ -224,11 +238,15 @@ export interface RouterContextValue {
|
|
|
224
238
|
*/
|
|
225
239
|
invalidatePrefetch: (path: string, type: "page" | "layout") => void;
|
|
226
240
|
isNavigating: boolean;
|
|
241
|
+
/** `search`: the destination's validated search, when the caller knows it (enables `loaderDeps` and `shallow`). */
|
|
227
242
|
navigate: (href: string, opts?: {
|
|
228
243
|
replace?: boolean;
|
|
229
244
|
resetScroll?: boolean;
|
|
245
|
+
search?: SearchParamsInput;
|
|
246
|
+
shallow?: boolean;
|
|
230
247
|
}) => Promise<void>;
|
|
231
248
|
prefetch: (href: string, opts?: {
|
|
249
|
+
search?: SearchParamsInput;
|
|
232
250
|
staleTime?: number;
|
|
233
251
|
}) => void;
|
|
234
252
|
/**
|
|
@@ -269,6 +287,8 @@ export interface ClientSegmentBoundary {
|
|
|
269
287
|
/** False when a pathless directory shares index 0 but does not own the root fallback. */
|
|
270
288
|
isRoot?: boolean;
|
|
271
289
|
notFound?: NotFoundComponent;
|
|
290
|
+
/** Shown inside the layout at `depth` while a navigation into this route loads. */
|
|
291
|
+
pending?: RoutePending;
|
|
272
292
|
}
|
|
273
293
|
export interface ClientRoute {
|
|
274
294
|
component?: React.ComponentType<RuntimeData>;
|
package/dist/client.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useInfiniteQuery2,
|
|
13
13
|
getRouteApi2,
|
|
14
14
|
createSyncCatchUp
|
|
15
|
-
} from "./client/chunks/client-
|
|
15
|
+
} from "./client/chunks/client-whph3y67.js";
|
|
16
16
|
|
|
17
17
|
// src/client/client-module.ts
|
|
18
18
|
import { preloadModule } from "react-dom";
|
|
@@ -39,10 +39,14 @@ function preloadClientModule(mod) {
|
|
|
39
39
|
}
|
|
40
40
|
// src/client/define-route.ts
|
|
41
41
|
function createRouteBuilder(state) {
|
|
42
|
-
const { errorComponent, notFoundComponent, remountDeps } = state;
|
|
42
|
+
const { errorComponent, loaderDeps, notFoundComponent, pending, remountDeps } = state;
|
|
43
43
|
return {
|
|
44
44
|
config(options) {
|
|
45
|
-
return createRouteBuilder({
|
|
45
|
+
return createRouteBuilder({
|
|
46
|
+
...state,
|
|
47
|
+
loaderDeps: options.loaderDeps,
|
|
48
|
+
remountDeps: options.remountDeps
|
|
49
|
+
});
|
|
46
50
|
},
|
|
47
51
|
error(component) {
|
|
48
52
|
return createRouteBuilder({ ...state, errorComponent: component });
|
|
@@ -54,20 +58,29 @@ function createRouteBuilder(state) {
|
|
|
54
58
|
component: runtimeComponent,
|
|
55
59
|
errorComponent,
|
|
56
60
|
layout: runtimeComponent,
|
|
57
|
-
notFoundComponent
|
|
61
|
+
notFoundComponent,
|
|
62
|
+
pending
|
|
58
63
|
};
|
|
59
64
|
},
|
|
60
65
|
notFound(component) {
|
|
61
66
|
return createRouteBuilder({ ...state, notFoundComponent: component });
|
|
62
67
|
},
|
|
68
|
+
pending(component, options) {
|
|
69
|
+
return createRouteBuilder({
|
|
70
|
+
...state,
|
|
71
|
+
pending: { component, minMs: options?.minMs, ms: options?.ms }
|
|
72
|
+
});
|
|
73
|
+
},
|
|
63
74
|
page(component) {
|
|
64
75
|
const runtimeComponent = component;
|
|
65
76
|
return {
|
|
66
77
|
__type: "FURIN_ROUTE",
|
|
67
78
|
component: runtimeComponent,
|
|
68
79
|
errorComponent,
|
|
80
|
+
loaderDeps,
|
|
69
81
|
notFoundComponent,
|
|
70
82
|
page: runtimeComponent,
|
|
83
|
+
pending,
|
|
71
84
|
remountDeps
|
|
72
85
|
};
|
|
73
86
|
}
|
|
@@ -75,7 +88,9 @@ function createRouteBuilder(state) {
|
|
|
75
88
|
}
|
|
76
89
|
var EMPTY_BUILDER = {
|
|
77
90
|
errorComponent: undefined,
|
|
91
|
+
loaderDeps: undefined,
|
|
78
92
|
notFoundComponent: undefined,
|
|
93
|
+
pending: undefined,
|
|
79
94
|
remountDeps: undefined
|
|
80
95
|
};
|
|
81
96
|
function defineRoute(_id) {
|
package/dist/define-route.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { FurinSchema, FurinUnwrap, FurinUnwrapInput } from "./shared/elysia
|
|
|
6
6
|
import type { ErrorComponent } from "./shared/error.ts";
|
|
7
7
|
import type { NotFoundComponent } from "./shared/not-found.ts";
|
|
8
8
|
import type { RemountDependency, RemountDeps } from "./shared/page-key.ts";
|
|
9
|
+
import type { PendingComponent, PendingOptions, RoutePending } from "./shared/pending.ts";
|
|
9
10
|
type NoFields = NonNullable<unknown>;
|
|
10
11
|
type Awaitable<T> = Promise<T> | T;
|
|
11
12
|
export declare const FURIN_RENDER_DECORATOR = "$furinRender";
|
|
@@ -119,7 +120,18 @@ type RenderingConfig = SharedRouteConfig & ({
|
|
|
119
120
|
mode: "isr";
|
|
120
121
|
revalidate: number;
|
|
121
122
|
});
|
|
123
|
+
/** Synchronous: a promise would compare equal to any other promise. */
|
|
124
|
+
type LoaderDependencies = object & {
|
|
125
|
+
readonly then?: never;
|
|
126
|
+
};
|
|
122
127
|
export type DefineRouteConfig<Params = NoFields, Query = NoFields> = RenderingConfig & {
|
|
128
|
+
/**
|
|
129
|
+
* Page routes: the part of the validated query the loaders read. A client
|
|
130
|
+
* navigation that keeps the path and these deps (compared deeply) reuses
|
|
131
|
+
* the loaded page and only updates the URL and `query`. Loaders still
|
|
132
|
+
* receive the full query and always run on the server for documents.
|
|
133
|
+
*/
|
|
134
|
+
loaderDeps?: (query: Query) => LoaderDependencies;
|
|
123
135
|
remountDeps?: RemountDeps<Params, Query>;
|
|
124
136
|
};
|
|
125
137
|
type ConfigFor<Params, Query> = DefineRouteConfig<Params, Query>;
|
|
@@ -133,6 +145,7 @@ interface ErasedStaticParamsContext {
|
|
|
133
145
|
[key: string]: unknown;
|
|
134
146
|
}
|
|
135
147
|
type RouteMetadata = RenderingConfig & {
|
|
148
|
+
loaderDeps?: (query: never) => LoaderDependencies;
|
|
136
149
|
remountDeps?: (context: never) => readonly RemountDependency[];
|
|
137
150
|
staticParams?: (context: ErasedStaticParamsContext) => Awaitable<readonly unknown[]>;
|
|
138
151
|
};
|
|
@@ -325,6 +338,11 @@ interface FileRouteContract<Entry> {
|
|
|
325
338
|
search: ContractOf<FileRouteParent<Entry>>["search"];
|
|
326
339
|
}
|
|
327
340
|
type FileConfiguredRoute<Entry, ParamsSchema extends FurinSchema | undefined, QuerySchema extends FurinSchema | undefined, Schemas extends RouteSchemas | undefined, Mode extends RenderingMode> = ConfiguredStage<InitialState<MergeSchemaValues<FileRouteContract<Entry>["params"], ParamsOf<ParamsSchema>>, MergeSchemaValues<FileRouteContract<Entry>["query"], ParamsOf<QuerySchema>>, MergeSchemaValues<FileRouteContract<Entry>["search"], SearchInputOf<QuerySchema>>, Schemas, DataOfRoute<FileRouteParent<Entry>>, ContractOf<FileRouteParent<Entry>>["params"], Mode, FileRouteKind<Entry>>>;
|
|
341
|
+
/** `loaderDeps` describes a page response: layout configs cannot declare it. */
|
|
342
|
+
interface NoLoaderDepsOption {
|
|
343
|
+
loaderDeps?: FurinTypeError<"loaderDeps belongs to page routes: declare it on the page config">;
|
|
344
|
+
}
|
|
345
|
+
type KindConfigOption<Kind extends RouteKind> = [Kind] extends ["layout"] ? NoLoaderDepsOption : unknown;
|
|
328
346
|
/** Keyed routes take their parent layout from the pages tree. */
|
|
329
347
|
interface NoLayoutOption {
|
|
330
348
|
layout?: FurinTypeError<"defineRoute(id) reads the parent layout from the pages tree: remove layout">;
|
|
@@ -338,14 +356,16 @@ interface ChainRuntime {
|
|
|
338
356
|
metadata: RouteMetadata;
|
|
339
357
|
notFoundComponent: NotFoundComponent | undefined;
|
|
340
358
|
paramsSchema: FurinSchema | undefined;
|
|
359
|
+
pending: RoutePending | undefined;
|
|
341
360
|
querySchema: FurinSchema | undefined;
|
|
342
361
|
requestLoader: unknown;
|
|
343
362
|
}
|
|
344
|
-
/** `.error()` / `.notFound()` keep the stage they are called on. */
|
|
345
|
-
type BoundaryMethods = "error" | "notFound";
|
|
363
|
+
/** `.error()` / `.notFound()` / `.pending()` keep the stage they are called on. */
|
|
364
|
+
type BoundaryMethods = "error" | "notFound" | "pending";
|
|
346
365
|
interface BoundaryStage<Stage> {
|
|
347
366
|
error: (component: ErrorComponent) => Stage;
|
|
348
367
|
notFound: (component: NotFoundComponent) => Stage;
|
|
368
|
+
pending: (component: PendingComponent, options?: PendingOptions) => Stage;
|
|
349
369
|
}
|
|
350
370
|
/** SSR routes render per request: `staticParams()` needs mode `ssg` or `isr`. */
|
|
351
371
|
interface SsrRouteStage<State extends ChainState> extends Omit<RouteChain<State>, "staticParams" | BoundaryMethods>, BoundaryStage<SsrRouteStage<State>> {
|
|
@@ -370,6 +390,7 @@ type RouteTerminal<State extends ChainState> = {
|
|
|
370
390
|
__type: "FURIN_ROUTE";
|
|
371
391
|
errorComponent: ErrorComponent | undefined;
|
|
372
392
|
notFoundComponent: NotFoundComponent | undefined;
|
|
393
|
+
pending: RoutePending | undefined;
|
|
373
394
|
head: Head<State["params"], State["query"], State["parentData"], State["data"], State["mode"]> | undefined;
|
|
374
395
|
mode: State["mode"];
|
|
375
396
|
readonly [inheritedDataBrand]?: State["parentData"];
|
|
@@ -379,6 +400,7 @@ type RouteTerminal<State extends ChainState> = {
|
|
|
379
400
|
query: State["query"];
|
|
380
401
|
search: State["search"];
|
|
381
402
|
};
|
|
403
|
+
loaderDeps: RouteMetadata["loaderDeps"];
|
|
382
404
|
remountDeps: RouteMetadata["remountDeps"];
|
|
383
405
|
requestLoader: RequestLoader<State["params"], State["query"], State["requestData"]> | undefined;
|
|
384
406
|
revalidate: number | undefined;
|
|
@@ -411,6 +433,11 @@ declare class RouteChain<State extends ChainState> {
|
|
|
411
433
|
error(component: ErrorComponent): this;
|
|
412
434
|
/** TanStack style: renders when this route or one below it calls `notFound()`. */
|
|
413
435
|
notFound(component: NotFoundComponent): this;
|
|
436
|
+
/**
|
|
437
|
+
* TanStack style: renders in place of this route (in its parent's outlet)
|
|
438
|
+
* while a client navigation into it outlasts `options.ms`, as `pendingComponent` does.
|
|
439
|
+
*/
|
|
440
|
+
pending(component: PendingComponent, options?: PendingOptions): this;
|
|
414
441
|
requestLoader<Data extends RequestLoaderData>(requestLoader: RequestLoader<State["params"], State["query"], Data>): StaticParamsClosedStage<WithState<State, {
|
|
415
442
|
requestData: Data;
|
|
416
443
|
}>>;
|
|
@@ -429,14 +456,14 @@ declare class RouteChain<State extends ChainState> {
|
|
|
429
456
|
* `config()` requires only `mode` (the TanStack `createRootRoute` analogue).
|
|
430
457
|
*/
|
|
431
458
|
declare class UnconfiguredRootRoute {
|
|
432
|
-
config<QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, undefined, QuerySchema> & {
|
|
459
|
+
config<QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, undefined, QuerySchema> & NoLoaderDepsOption & {
|
|
433
460
|
mode: Mode;
|
|
434
461
|
params?: undefined;
|
|
435
462
|
query: QuerySchema;
|
|
436
463
|
}): ConfiguredRoute<EmptyContract, NoFields, undefined, QuerySchema, {
|
|
437
464
|
query: QuerySchema;
|
|
438
465
|
}, Mode>;
|
|
439
|
-
config<ParamsSchema extends FurinSchema, QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, ParamsSchema, QuerySchema> & {
|
|
466
|
+
config<ParamsSchema extends FurinSchema, QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, ParamsSchema, QuerySchema> & NoLoaderDepsOption & {
|
|
440
467
|
mode: Mode;
|
|
441
468
|
params: ParamsSchema;
|
|
442
469
|
query: QuerySchema;
|
|
@@ -444,7 +471,7 @@ declare class UnconfiguredRootRoute {
|
|
|
444
471
|
params: ParamsSchema;
|
|
445
472
|
query: QuerySchema;
|
|
446
473
|
}, Mode>;
|
|
447
|
-
config<ParamsSchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, ParamsSchema, undefined> & {
|
|
474
|
+
config<ParamsSchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, ParamsSchema, undefined> & NoLoaderDepsOption & {
|
|
448
475
|
mode: Mode;
|
|
449
476
|
params: ParamsSchema;
|
|
450
477
|
query?: undefined;
|
|
@@ -452,7 +479,7 @@ declare class UnconfiguredRootRoute {
|
|
|
452
479
|
params: ParamsSchema;
|
|
453
480
|
query: undefined;
|
|
454
481
|
}, Mode>;
|
|
455
|
-
config<Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, undefined, undefined> & {
|
|
482
|
+
config<Mode extends RenderingMode>(options: ResolvedConfig<EmptyContract, undefined, undefined> & NoLoaderDepsOption & {
|
|
456
483
|
mode: Mode;
|
|
457
484
|
params?: undefined;
|
|
458
485
|
query?: undefined;
|
|
@@ -466,14 +493,14 @@ declare class UnconfiguredRootRoute {
|
|
|
466
493
|
* `params` only refines the path params.
|
|
467
494
|
*/
|
|
468
495
|
declare class UnconfiguredFileRoute<Entry> {
|
|
469
|
-
config<QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, undefined, QuerySchema> & NoLayoutOption & {
|
|
496
|
+
config<QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, undefined, QuerySchema> & NoLayoutOption & KindConfigOption<FileRouteKind<Entry>> & {
|
|
470
497
|
mode: Mode;
|
|
471
498
|
params?: undefined;
|
|
472
499
|
query: QuerySchema;
|
|
473
500
|
}): FileConfiguredRoute<Entry, undefined, QuerySchema, {
|
|
474
501
|
query: QuerySchema;
|
|
475
502
|
}, Mode>;
|
|
476
|
-
config<ParamsSchema extends FurinSchema, QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, ParamsSchema, QuerySchema> & NoLayoutOption & {
|
|
503
|
+
config<ParamsSchema extends FurinSchema, QuerySchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, ParamsSchema, QuerySchema> & NoLayoutOption & KindConfigOption<FileRouteKind<Entry>> & {
|
|
477
504
|
mode: Mode;
|
|
478
505
|
params: ParamsSchema;
|
|
479
506
|
query: QuerySchema;
|
|
@@ -481,7 +508,7 @@ declare class UnconfiguredFileRoute<Entry> {
|
|
|
481
508
|
params: ParamsSchema;
|
|
482
509
|
query: QuerySchema;
|
|
483
510
|
}, Mode>;
|
|
484
|
-
config<ParamsSchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, ParamsSchema, undefined> & NoLayoutOption & {
|
|
511
|
+
config<ParamsSchema extends FurinSchema, Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, ParamsSchema, undefined> & NoLayoutOption & KindConfigOption<FileRouteKind<Entry>> & {
|
|
485
512
|
mode: Mode;
|
|
486
513
|
params: ParamsSchema;
|
|
487
514
|
query?: undefined;
|
|
@@ -489,7 +516,7 @@ declare class UnconfiguredFileRoute<Entry> {
|
|
|
489
516
|
params: ParamsSchema;
|
|
490
517
|
query: undefined;
|
|
491
518
|
}, Mode>;
|
|
492
|
-
config<Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, undefined, undefined> & NoLayoutOption & {
|
|
519
|
+
config<Mode extends RenderingMode>(options: ResolvedConfig<FileRouteContract<Entry>, undefined, undefined> & NoLayoutOption & KindConfigOption<FileRouteKind<Entry>> & {
|
|
493
520
|
mode: Mode;
|
|
494
521
|
params?: undefined;
|
|
495
522
|
query?: undefined;
|
package/dist/furin.js
CHANGED
|
@@ -717,6 +717,7 @@ function terminalFields(runtime) {
|
|
|
717
717
|
metadata,
|
|
718
718
|
notFoundComponent,
|
|
719
719
|
paramsSchema,
|
|
720
|
+
pending,
|
|
720
721
|
querySchema,
|
|
721
722
|
requestLoader
|
|
722
723
|
} = runtime;
|
|
@@ -724,8 +725,10 @@ function terminalFields(runtime) {
|
|
|
724
725
|
__type: "FURIN_ROUTE",
|
|
725
726
|
errorComponent,
|
|
726
727
|
notFoundComponent,
|
|
728
|
+
pending,
|
|
727
729
|
mode: metadata.mode,
|
|
728
730
|
revalidate: metadata.revalidate,
|
|
731
|
+
loaderDeps: metadata.loaderDeps,
|
|
729
732
|
remountDeps: metadata.remountDeps,
|
|
730
733
|
staticParams: metadata.staticParams,
|
|
731
734
|
tags: metadata.tags,
|
|
@@ -747,6 +750,12 @@ class RouteChain {
|
|
|
747
750
|
notFound(component) {
|
|
748
751
|
return new RouteChain({ ...this.runtime, notFoundComponent: component });
|
|
749
752
|
}
|
|
753
|
+
pending(component, options) {
|
|
754
|
+
return new RouteChain({
|
|
755
|
+
...this.runtime,
|
|
756
|
+
pending: { component, minMs: options?.minMs, ms: options?.ms }
|
|
757
|
+
});
|
|
758
|
+
}
|
|
750
759
|
requestLoader(requestLoader) {
|
|
751
760
|
return new RouteChain({
|
|
752
761
|
...this.runtime,
|
|
@@ -800,6 +809,7 @@ function configure(options) {
|
|
|
800
809
|
metadata: options,
|
|
801
810
|
notFoundComponent: undefined,
|
|
802
811
|
paramsSchema: options.params,
|
|
812
|
+
pending: undefined,
|
|
803
813
|
querySchema: options.query,
|
|
804
814
|
requestLoader: undefined
|
|
805
815
|
});
|
|
@@ -4902,6 +4912,18 @@ function applyLinkParams(to, params) {
|
|
|
4902
4912
|
}
|
|
4903
4913
|
return url;
|
|
4904
4914
|
}
|
|
4915
|
+
function resolveTargetSearch(path, search, routes) {
|
|
4916
|
+
if (path.includes("?")) {
|
|
4917
|
+
return;
|
|
4918
|
+
}
|
|
4919
|
+
const resolved = { ...findSearchDefaultsForRouteTarget(path, routes) };
|
|
4920
|
+
for (const [key, value] of Object.entries(search ?? {})) {
|
|
4921
|
+
if (value !== null && value !== undefined) {
|
|
4922
|
+
resolved[key] = value;
|
|
4923
|
+
}
|
|
4924
|
+
}
|
|
4925
|
+
return resolved;
|
|
4926
|
+
}
|
|
4905
4927
|
function buildHref(to, search, hash, searchDefaults) {
|
|
4906
4928
|
let url = to;
|
|
4907
4929
|
if (search && Object.keys(search).length > 0) {
|
|
@@ -10508,7 +10530,14 @@ var init_search_store = __esm(() => {
|
|
|
10508
10530
|
var init_router = () => {};
|
|
10509
10531
|
|
|
10510
10532
|
// src/client/link.tsx
|
|
10511
|
-
import {
|
|
10533
|
+
import {
|
|
10534
|
+
createElement as createElement4,
|
|
10535
|
+
useCallback as useCallback3,
|
|
10536
|
+
useEffect as useEffect2,
|
|
10537
|
+
useMemo as useMemo2,
|
|
10538
|
+
useRef,
|
|
10539
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
10540
|
+
} from "react";
|
|
10512
10541
|
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
10513
10542
|
function resolveLinkHref({ to, params, search, hash }, router2) {
|
|
10514
10543
|
const resolvedTo = applyLinkParams(to, params);
|
|
@@ -10547,6 +10576,7 @@ function LinkInteractive({
|
|
|
10547
10576
|
replace,
|
|
10548
10577
|
disabled,
|
|
10549
10578
|
resetScroll,
|
|
10579
|
+
shallow,
|
|
10550
10580
|
activeProps,
|
|
10551
10581
|
inactiveProps,
|
|
10552
10582
|
onClick,
|
|
@@ -10562,6 +10592,7 @@ function LinkInteractive({
|
|
|
10562
10592
|
const anchorRef = useRef(null);
|
|
10563
10593
|
const intentTimerRef = useRef(null);
|
|
10564
10594
|
const { activeHref, logicalHref, href } = resolveLinkHref({ hash, params, search, to }, router2);
|
|
10595
|
+
const targetSearch = useMemo2(() => resolveTargetSearch(applyLinkParams(to, params), search, router2.searchRoutes), [logicalHref, router2.searchRoutes]);
|
|
10565
10596
|
const isActive = useSyncExternalStore2(store.subscribe, () => activeHref !== undefined && store.getCurrentHref() === activeHref, () => activeHref !== undefined && store.getCurrentHref() === activeHref);
|
|
10566
10597
|
const { resolvedChildren, extraProps } = resolveLinkState({ activeProps, children, inactiveProps }, isActive);
|
|
10567
10598
|
const effectivePreload = preload ?? router2.defaultPreload;
|
|
@@ -10575,9 +10606,9 @@ function LinkInteractive({
|
|
|
10575
10606
|
}
|
|
10576
10607
|
const target = shouldInterceptClick(anchor, { altKey: false, ctrlKey: false, metaKey: false, shiftKey: false }, router2.basePath, window.location.origin, window.location.pathname);
|
|
10577
10608
|
if (target !== null) {
|
|
10578
|
-
prefetch(target, { staleTime: effectiveStaleTime });
|
|
10609
|
+
prefetch(target, { search: targetSearch, staleTime: effectiveStaleTime });
|
|
10579
10610
|
}
|
|
10580
|
-
}, [prefetch, effectiveStaleTime, router2.basePath]);
|
|
10611
|
+
}, [prefetch, effectiveStaleTime, router2.basePath, targetSearch]);
|
|
10581
10612
|
useEffect2(() => {
|
|
10582
10613
|
if (effectivePreload === "render") {
|
|
10583
10614
|
triggerPrefetch();
|
|
@@ -10627,7 +10658,7 @@ function LinkInteractive({
|
|
|
10627
10658
|
window.location.assign(href);
|
|
10628
10659
|
return;
|
|
10629
10660
|
}
|
|
10630
|
-
router2.navigate(target, { replace, resetScroll:
|
|
10661
|
+
router2.navigate(target, { replace, resetScroll, search: targetSearch, shallow });
|
|
10631
10662
|
};
|
|
10632
10663
|
const handleMouseEnter = (e) => {
|
|
10633
10664
|
onMouseEnter?.(e);
|
|
@@ -10681,6 +10712,7 @@ function renderLinkElement(props, router2) {
|
|
|
10681
10712
|
preloadStaleTime: _ps,
|
|
10682
10713
|
replace: _r,
|
|
10683
10714
|
resetScroll: _rs,
|
|
10715
|
+
shallow: _sh,
|
|
10684
10716
|
onClick: _oc,
|
|
10685
10717
|
onMouseEnter: _ome,
|
|
10686
10718
|
onMouseLeave: _oml,
|
|
@@ -11170,6 +11202,18 @@ function selectRouteBoundary(boundaries, rootBoundary, index, kind) {
|
|
|
11170
11202
|
function wrapLayout(route, props, element) {
|
|
11171
11203
|
return route?.layout ? createElement6(route.layout, props, element) : element;
|
|
11172
11204
|
}
|
|
11205
|
+
function wrapSegments(input, depth, props, fallbackProps, element) {
|
|
11206
|
+
let wrapped = element;
|
|
11207
|
+
for (let layout = depth;layout >= 0; layout -= 1) {
|
|
11208
|
+
for (const boundary of input.boundaries.toReversed()) {
|
|
11209
|
+
if (boundary.depth === layout) {
|
|
11210
|
+
wrapped = wrapSegmentBoundaries(wrapped, boundary, input.boundaryOptions);
|
|
11211
|
+
}
|
|
11212
|
+
}
|
|
11213
|
+
wrapped = wrapLayout(input.chain[layout], props[layout] ?? fallbackProps, wrapped);
|
|
11214
|
+
}
|
|
11215
|
+
return wrapped;
|
|
11216
|
+
}
|
|
11173
11217
|
function failureElement(failure, component, reset) {
|
|
11174
11218
|
if (failure.status === "error") {
|
|
11175
11219
|
return createElement6(component ?? DefaultErrorFallback, {
|
|
@@ -11194,9 +11238,10 @@ function resolveRouteElement(input) {
|
|
|
11194
11238
|
inherited = { ...inherited, ...match.loaderData };
|
|
11195
11239
|
props.push({ ...inherited, ...context });
|
|
11196
11240
|
}
|
|
11241
|
+
const { pending } = input;
|
|
11197
11242
|
const index = matches.findIndex((match) => match.status !== "success");
|
|
11198
11243
|
const failure = matches[index];
|
|
11199
|
-
if (failure && failure.status !== "success") {
|
|
11244
|
+
if (failure && failure.status !== "success" && !pending) {
|
|
11200
11245
|
const { component, depth } = selectRouteBoundary(boundaries, input.rootBoundary, index, failure.status);
|
|
11201
11246
|
let element = failureElement(failure, component, input.reset);
|
|
11202
11247
|
for (let layout = depth;layout >= 0; layout -= 1) {
|
|
@@ -11208,18 +11253,10 @@ function resolveRouteElement(input) {
|
|
|
11208
11253
|
throw new Error("[furin] internal invariant: a successful route render requires a page.");
|
|
11209
11254
|
}
|
|
11210
11255
|
const pageProps = Object.fromEntries(Object.entries(data).filter(([key]) => !key.startsWith("__furin")));
|
|
11211
|
-
|
|
11256
|
+
const element = pending ? wrapSegments(input, pending.depth, props, pageProps, createElement6(pending.component)) : wrapSegments(input, chain.length - 1, props, pageProps, createElement6(page.component, {
|
|
11212
11257
|
...pageProps,
|
|
11213
11258
|
key: pageKey(page.pattern, pageProps, chain.at(-1)?.remountDeps)
|
|
11214
|
-
});
|
|
11215
|
-
for (let layout = chain.length - 1;layout >= 0; layout -= 1) {
|
|
11216
|
-
for (const boundary of boundaries.toReversed()) {
|
|
11217
|
-
if (boundary.depth === layout) {
|
|
11218
|
-
element = wrapSegmentBoundaries(element, boundary, input.boundaryOptions);
|
|
11219
|
-
}
|
|
11220
|
-
}
|
|
11221
|
-
element = wrapLayout(chain[layout], props[layout] ?? pageProps, element);
|
|
11222
|
-
}
|
|
11259
|
+
}));
|
|
11223
11260
|
return withRouteSnapshot(element, page.pattern, pageProps);
|
|
11224
11261
|
}
|
|
11225
11262
|
var init_route_element = __esm(() => {
|
|
@@ -15242,6 +15279,8 @@ function addNextFile(state, base, segments, sourcePath) {
|
|
|
15242
15279
|
state.boundary.errorPath ??= sourcePath;
|
|
15243
15280
|
} else if (base === "not-found") {
|
|
15244
15281
|
state.boundary.notFoundPath ??= sourcePath;
|
|
15282
|
+
} else if (base === "loading") {
|
|
15283
|
+
state.boundary.pendingPath ??= sourcePath;
|
|
15245
15284
|
}
|
|
15246
15285
|
}
|
|
15247
15286
|
function scanNext(pagesDir) {
|
|
@@ -15249,7 +15288,12 @@ function scanNext(pagesDir) {
|
|
|
15249
15288
|
const boundaries = [];
|
|
15250
15289
|
let rootPath;
|
|
15251
15290
|
const walk = (directory, segments) => {
|
|
15252
|
-
const boundary = {
|
|
15291
|
+
const boundary = {
|
|
15292
|
+
directory,
|
|
15293
|
+
errorPath: undefined,
|
|
15294
|
+
notFoundPath: undefined,
|
|
15295
|
+
pendingPath: undefined
|
|
15296
|
+
};
|
|
15253
15297
|
const state = { boundary, candidates, rootPath };
|
|
15254
15298
|
for (const entry of sortedEntries(directory)) {
|
|
15255
15299
|
const sourcePath = child(directory, entry.name);
|
|
@@ -15260,7 +15304,7 @@ function scanNext(pagesDir) {
|
|
|
15260
15304
|
}
|
|
15261
15305
|
}
|
|
15262
15306
|
rootPath ??= state.rootPath;
|
|
15263
|
-
if (boundary.errorPath || boundary.notFoundPath) {
|
|
15307
|
+
if (boundary.errorPath || boundary.notFoundPath || boundary.pendingPath) {
|
|
15264
15308
|
boundaries.push(boundary);
|
|
15265
15309
|
}
|
|
15266
15310
|
};
|
|
@@ -15395,6 +15439,7 @@ function adaptDefinedLayout(route, parent, sourcePath) {
|
|
|
15395
15439
|
notFoundComponent: route.notFoundComponent,
|
|
15396
15440
|
params: route.schemas?.params,
|
|
15397
15441
|
...parent ? { parent } : {},
|
|
15442
|
+
pending: route.pending,
|
|
15398
15443
|
query: route.schemas?.query,
|
|
15399
15444
|
requestLoader: route.requestLoader,
|
|
15400
15445
|
revalidate: route.revalidate,
|
|
@@ -15412,6 +15457,7 @@ function adaptDefinedPage(route, parent) {
|
|
|
15412
15457
|
__type: "FURIN_ROUTE",
|
|
15413
15458
|
params: route.schemas?.params,
|
|
15414
15459
|
parent,
|
|
15460
|
+
loaderDeps: route.loaderDeps,
|
|
15415
15461
|
query: route.schemas?.query,
|
|
15416
15462
|
remountDeps: route.remountDeps,
|
|
15417
15463
|
requestLoader: route.requestLoader
|
|
@@ -15422,6 +15468,7 @@ function adaptDefinedPage(route, parent) {
|
|
|
15422
15468
|
loader: route.loader,
|
|
15423
15469
|
mode: route.mode,
|
|
15424
15470
|
notFoundComponent: route.notFoundComponent,
|
|
15471
|
+
pending: route.pending,
|
|
15425
15472
|
revalidate: route.revalidate,
|
|
15426
15473
|
staticParams: route.staticParams,
|
|
15427
15474
|
tags: copyTags(route.tags)
|
|
@@ -15661,8 +15708,8 @@ function routeDefinedBoundaries(root, routeChain, page, pagePath) {
|
|
|
15661
15708
|
];
|
|
15662
15709
|
const pagesDir = root.path.slice(0, root.path.lastIndexOf("/"));
|
|
15663
15710
|
return entries.flatMap(({ depth, path, route }) => {
|
|
15664
|
-
const { errorComponent, notFoundComponent } = route;
|
|
15665
|
-
if (path === undefined || !(errorComponent || notFoundComponent)) {
|
|
15711
|
+
const { errorComponent, notFoundComponent, pending } = route;
|
|
15712
|
+
if (path === undefined || !(errorComponent || notFoundComponent || pending)) {
|
|
15666
15713
|
return [];
|
|
15667
15714
|
}
|
|
15668
15715
|
return [
|
|
@@ -15673,7 +15720,8 @@ function routeDefinedBoundaries(root, routeChain, page, pagePath) {
|
|
|
15673
15720
|
fromRoute: true,
|
|
15674
15721
|
notFound: notFoundComponent,
|
|
15675
15722
|
notFoundPath: notFoundComponent ? path : undefined,
|
|
15676
|
-
path: path === root.path ? pagesDir : path
|
|
15723
|
+
path: path === root.path ? pagesDir : path,
|
|
15724
|
+
pendingPath: pending ? path : undefined
|
|
15677
15725
|
}
|
|
15678
15726
|
];
|
|
15679
15727
|
});
|
|
@@ -15729,7 +15777,8 @@ async function collectSegmentBoundaries(pageAbsolutePath, boundaries, cache) {
|
|
|
15729
15777
|
errorPath: errorEntry?.path,
|
|
15730
15778
|
notFound: notFoundEntry?.component,
|
|
15731
15779
|
notFoundPath: notFoundEntry?.path,
|
|
15732
|
-
path: boundary.directory
|
|
15780
|
+
path: boundary.directory,
|
|
15781
|
+
pendingPath: boundary.pendingPath
|
|
15733
15782
|
}));
|
|
15734
15783
|
cache.set(boundary.directory, loaded);
|
|
15735
15784
|
return loaded;
|
|
@@ -21740,7 +21789,7 @@ function routeSnapshotSourcePaths(instance) {
|
|
|
21740
21789
|
return [
|
|
21741
21790
|
...existsSync9(rootPath) ? [rootPath] : [],
|
|
21742
21791
|
...routes.map(({ sourcePath }) => sourcePath),
|
|
21743
|
-
...boundaries.flatMap(({ errorPath, notFoundPath }) => [errorPath, notFoundPath].filter((path) => path !== undefined))
|
|
21792
|
+
...boundaries.flatMap(({ errorPath, notFoundPath, pendingPath }) => [errorPath, notFoundPath, pendingPath].filter((path) => path !== undefined))
|
|
21744
21793
|
].map((path) => resolve8(path)).toSorted((left, right) => left.localeCompare(right));
|
|
21745
21794
|
}
|
|
21746
21795
|
var init_route_tree = __esm(() => {
|
|
@@ -22277,11 +22326,11 @@ function checkParams(file, route, parsed) {
|
|
|
22277
22326
|
${paramsSchema(missing)}`);
|
|
22278
22327
|
}
|
|
22279
22328
|
function checkBoundaryMethods(file, instance, parsed) {
|
|
22280
|
-
const method =
|
|
22329
|
+
const method = BOUNDARY_METHODS.find((name) => parsed.route.methods.has(name));
|
|
22281
22330
|
if (instance.style !== "nextjs" || method === undefined) {
|
|
22282
22331
|
return;
|
|
22283
22332
|
}
|
|
22284
|
-
const convention = method
|
|
22333
|
+
const convention = BOUNDARY_CONVENTIONS[method];
|
|
22285
22334
|
return issueAt(file, parsed, parsed.route.head, `.${method}() is the TanStack style. In the nextjs style, default-export the component from ${convention} next to this route.`);
|
|
22286
22335
|
}
|
|
22287
22336
|
function checkRoute(file, instance, route, parsed) {
|
|
@@ -22373,7 +22422,7 @@ function scaffoldEmptyRoutes(spec) {
|
|
|
22373
22422
|
}
|
|
22374
22423
|
return written;
|
|
22375
22424
|
}
|
|
22376
|
-
var IDENTIFIER_RE, ROUTE_CONFIG_DIAGNOSTIC = "route config", ROOT_TEMPLATE = `import { defineRootRoute, HeadContent, Scripts } from "@teyik0/furin";
|
|
22425
|
+
var IDENTIFIER_RE, BOUNDARY_CONVENTIONS, BOUNDARY_METHODS, ROUTE_CONFIG_DIAGNOSTIC = "route config", ROOT_TEMPLATE = `import { defineRootRoute, HeadContent, Scripts } from "@teyik0/furin";
|
|
22377
22426
|
|
|
22378
22427
|
export const route = defineRootRoute()
|
|
22379
22428
|
.config({ mode: "ssr" })
|
|
@@ -22395,6 +22444,12 @@ var init_route_config = __esm(() => {
|
|
|
22395
22444
|
init_route_chains();
|
|
22396
22445
|
init_route_manifest();
|
|
22397
22446
|
IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
|
|
22447
|
+
BOUNDARY_CONVENTIONS = {
|
|
22448
|
+
error: "an error.tsx",
|
|
22449
|
+
notFound: "a not-found.tsx",
|
|
22450
|
+
pending: "a loading.tsx"
|
|
22451
|
+
};
|
|
22452
|
+
BOUNDARY_METHODS = ["error", "notFound", "pending"];
|
|
22398
22453
|
});
|
|
22399
22454
|
|
|
22400
22455
|
// src/build/route-metadata.ts
|
|
@@ -22603,7 +22658,8 @@ function hydrateEntry(routes, rootLayout, basePath, clientLogging, modulePathKey
|
|
|
22603
22658
|
for (const seg of route.segmentBoundaries ?? []) {
|
|
22604
22659
|
const errorIdent = getBoundaryIdent(boundaryIdents, seg.errorPath);
|
|
22605
22660
|
const notFoundIdent = getBoundaryIdent(boundaryIdents, seg.notFoundPath);
|
|
22606
|
-
|
|
22661
|
+
const pendingIdent = getBoundaryIdent(boundaryIdents, seg.pendingPath);
|
|
22662
|
+
if (!(errorIdent || notFoundIdent || pendingIdent)) {
|
|
22607
22663
|
continue;
|
|
22608
22664
|
}
|
|
22609
22665
|
const parts = [`depth: ${seg.depth}`];
|
|
@@ -22615,6 +22671,9 @@ function hydrateEntry(routes, rootLayout, basePath, clientLogging, modulePathKey
|
|
|
22615
22671
|
if (notFoundIdent) {
|
|
22616
22672
|
parts.push(`notFound: ${notFoundIdent}.${notFoundExport}`);
|
|
22617
22673
|
}
|
|
22674
|
+
if (pendingIdent) {
|
|
22675
|
+
parts.push(seg.fromRoute ? `pending: ${pendingIdent}.route.pending` : `pending: { component: ${pendingIdent}.default, minMs: ${pendingIdent}.pendingMinMs, ms: ${pendingIdent}.pendingMs }`);
|
|
22676
|
+
}
|
|
22618
22677
|
if (seg.depth === 0 && seg.path.replaceAll("\\", "/") !== rootDirectory) {
|
|
22619
22678
|
parts.push("isRoot: false");
|
|
22620
22679
|
}
|
|
@@ -22633,7 +22692,7 @@ function hydrateEntry(routes, rootLayout, basePath, clientLogging, modulePathKey
|
|
|
22633
22692
|
}).join(" ");
|
|
22634
22693
|
const boundaryResult = boundaryLiterals.length > 0 ? `, segmentBoundaries: [${boundaryLiterals.join(", ")}]` : "";
|
|
22635
22694
|
const pageComponentKey = JSON.stringify(`page:${modulePathKey(resolvedPage)}`);
|
|
22636
|
-
const loadBody = `Promise.all([${lazyImports.join(", ")}]).then(([${importIdents.join(", ")}]) => { const __furin_page_route = __furin_page.route; let __furin_parent = root; ${layoutAssignments} return { default: { __type: "FURIN_PAGE", _route: { __type: "FURIN_ROUTE", parent: __furin_parent, remountDeps: __furin_page_route.remountDeps }, component: hotComponent(${pageComponentKey}, __furin_page_route.component) }${boundaryResult} }; })`;
|
|
22695
|
+
const loadBody = `Promise.all([${lazyImports.join(", ")}]).then(([${importIdents.join(", ")}]) => { const __furin_page_route = __furin_page.route; let __furin_parent = root; ${layoutAssignments} return { default: { __type: "FURIN_PAGE", _route: { __type: "FURIN_ROUTE", parent: __furin_parent, loaderDeps: __furin_page_route.loaderDeps, remountDeps: __furin_page_route.remountDeps }, component: hotComponent(${pageComponentKey}, __furin_page_route.component) }${boundaryResult} }; })`;
|
|
22637
22696
|
const searchDefaultsEntry = searchDefaults ? `, searchDefaults: ${JSON.stringify(searchDefaults)}` : "";
|
|
22638
22697
|
routeEntries.push(` { pattern: ${JSON.stringify(route.pattern)}, regex: new RegExp(${JSON.stringify(regexPattern)}), load: () => ${loadBody}${searchDefaultsEntry} }`);
|
|
22639
22698
|
}
|
|
@@ -25522,7 +25581,7 @@ function createLocalSyncClient(options) {
|
|
|
25522
25581
|
var furinSync2 = furinSync;
|
|
25523
25582
|
var invalidateSync2 = invalidateSync;
|
|
25524
25583
|
// src/shared/await.tsx
|
|
25525
|
-
import { Component as Component2, createContext as createContext8, createElement as createElement11, use as use3, useMemo as
|
|
25584
|
+
import { Component as Component2, createContext as createContext8, createElement as createElement11, use as use3, useMemo as useMemo3 } from "react";
|
|
25526
25585
|
var AsyncErrorContext = createContext8(undefined);
|
|
25527
25586
|
function useAsyncError() {
|
|
25528
25587
|
return use3(AsyncErrorContext);
|
|
@@ -25574,7 +25633,7 @@ class AsyncErrorBoundary extends Component2 {
|
|
|
25574
25633
|
}
|
|
25575
25634
|
}
|
|
25576
25635
|
function Await({ resolve, errorElement, children }) {
|
|
25577
|
-
const guardedResolve =
|
|
25636
|
+
const guardedResolve = useMemo3(() => silenceAbortError(resolve), [resolve]);
|
|
25578
25637
|
return createElement11(AsyncErrorBoundary, { errorElement, resolve: guardedResolve }, createElement11(AwaitInner, { children, resolve: guardedResolve }));
|
|
25579
25638
|
}
|
|
25580
25639
|
function AwaitInner({ resolve, children }) {
|
|
@@ -9,7 +9,7 @@ interface ClientStripPluginOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Furin's browser-graph plugin, shared by the dev server (bunfig
|
|
11
11
|
* `[serve.static] plugins`) and the production client build:
|
|
12
|
-
* 1. Stubs `elysia` for the browser with its schema builder only.
|
|
12
|
+
* 1. Stubs `elysia` for the browser with its schema builder and errors only.
|
|
13
13
|
* 2. Stubs `bun:*` builtins with an empty module (safety net — DCE removes
|
|
14
14
|
* loader imports before they reach the browser bundle in practice).
|
|
15
15
|
* 3. Strips server-only code (loader, query, params) from page files before
|