@bleedingdev/modern-js-renderer-solid 3.9.3-ultramodern.1 → 3.9.3-ultramodern.10
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/esm/actions.js +3 -4
- package/dist/esm/application-router.js +7 -2
- package/dist/esm/entry-client.js +1 -0
- package/dist/esm/federation-ssr.js +17 -9
- package/dist/esm/federation.js +8 -4
- package/dist/esm/i18n/LocalizedLink.js +28 -50
- package/dist/esm/i18n/index.js +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/manifest.js +1 -1
- package/dist/esm/route-completion.js +2 -1
- package/dist/esm/router-binding/Asset.js +3 -2
- package/dist/esm/router-binding/Matches.js +19 -12
- package/dist/esm/router-binding/PROVENANCE.json +3 -3
- package/dist/esm/router-binding/RouterProvider.js +2 -1
- package/dist/esm/router-binding/Transitioner.js +10 -4
- package/dist/esm/router-binding/fileRoute.js +1 -1
- package/dist/esm/router-binding/headContentUtils.js +9 -3
- package/dist/esm/router-binding/index.js +1 -1
- package/dist/esm/router-binding/link.js +3 -5
- package/dist/esm/router-binding/registryTransfer.js +16 -3
- package/dist/esm/router-binding/router.js +2 -1
- package/dist/esm/router-binding/routerOptions.js +0 -0
- package/dist/esm/router-binding/useLoaderData.js +1 -2
- package/dist/esm/router-binding/useNavigate.js +8 -2
- package/dist/esm/router-binding/useParams.js +1 -3
- package/dist/esm/router-binding/useSearch.js +1 -3
- package/dist/esm-node/actions.js +2 -2
- package/dist/esm-node/application-router.js +7 -2
- package/dist/esm-node/entry-client.js +1 -0
- package/dist/esm-node/federation-ssr.js +17 -9
- package/dist/esm-node/federation.js +8 -4
- package/dist/esm-node/i18n/LocalizedLink.js +43 -97
- package/dist/esm-node/i18n/index.js +1 -1
- package/dist/esm-node/index.js +5 -5
- package/dist/esm-node/manifest.js +1 -1
- package/dist/esm-node/plugin/create.js +22 -21
- package/dist/esm-node/plugin/index.js +1 -4
- package/dist/esm-node/plugin/profile.js +10 -11
- package/dist/esm-node/route-completion.js +2 -1
- package/dist/esm-node/router-binding/Asset.js +3 -2
- package/dist/esm-node/router-binding/CatchBoundary.js +3 -3
- package/dist/esm-node/router-binding/Matches.js +30 -30
- package/dist/esm-node/router-binding/PROVENANCE.json +3 -3
- package/dist/esm-node/router-binding/RouterProvider.js +2 -1
- package/dist/esm-node/router-binding/Transitioner.js +10 -4
- package/dist/esm-node/router-binding/fileRoute.js +1 -1
- package/dist/esm-node/router-binding/headContentUtils.js +9 -3
- package/dist/esm-node/router-binding/index.js +1 -1
- package/dist/esm-node/router-binding/link.js +2 -2
- package/dist/esm-node/router-binding/registryTransfer.js +16 -3
- package/dist/esm-node/router-binding/router.js +2 -1
- package/dist/esm-node/router-binding/routerOptions.js +1 -0
- package/dist/esm-node/router-binding/useLoaderData.js +1 -2
- package/dist/esm-node/router-binding/useNavigate.js +8 -2
- package/dist/esm-node/router-binding/useParams.js +1 -3
- package/dist/esm-node/router-binding/useSearch.js +1 -3
- package/dist/types/federation-ssr.d.ts +3 -5
- package/dist/types/i18n/LocalizedLink.d.ts +5 -33
- package/dist/types/i18n/index.d.ts +1 -1
- package/dist/types/index.d.ts +5 -5
- package/dist/types/manifest.d.ts +1 -1
- package/dist/types/router-binding/RouterProvider.d.ts +2 -1
- package/dist/types/router-binding/index.d.ts +3 -2
- package/dist/types/router-binding/registryTransfer.d.ts +2 -0
- package/dist/types/router-binding/routerOptions.d.ts +6 -0
- package/dist/types/router.d.ts +3 -3
- package/package.json +29 -22
- package/src/actions.tsx +5 -1
- package/src/application-router.tsx +9 -3
- package/src/entry-client.tsx +1 -0
- package/src/federation-ssr.ts +32 -13
- package/src/federation.tsx +9 -5
- package/src/i18n/LocalizedLink.tsx +44 -83
- package/src/i18n/index.ts +1 -5
- package/src/index.ts +5 -5
- package/src/manifest.ts +1 -1
- package/src/plugin/create.ts +22 -21
- package/src/plugin/index.ts +0 -3
- package/src/plugin/preserve-import-loader.cjs +1 -1
- package/src/plugin/profile.ts +10 -10
- package/src/route-completion.tsx +5 -1
- package/src/router-binding/Asset.tsx +10 -9
- package/src/router-binding/Matches.tsx +10 -10
- package/src/router-binding/PROVENANCE.json +3 -3
- package/src/router-binding/RouterProvider.tsx +4 -5
- package/src/router-binding/Transitioner.tsx +6 -1
- package/src/router-binding/fileRoute.ts +1 -1
- package/src/router-binding/headContentUtils.tsx +5 -3
- package/src/router-binding/index.tsx +1 -4
- package/src/router-binding/link.tsx +2 -2
- package/src/router-binding/registryTransfer.ts +23 -6
- package/src/router-binding/route.tsx +1 -1
- package/src/router-binding/router.ts +2 -0
- package/src/router-binding/routerOptions.ts +26 -0
- package/src/router-binding/useLoaderData.tsx +4 -3
- package/src/router-binding/useNavigate.tsx +5 -3
- package/src/router-binding/useParams.tsx +1 -3
- package/src/router-binding/useSearch.tsx +1 -3
- package/src/router.ts +3 -3
|
@@ -505,9 +505,9 @@ export function useLinkProps<
|
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
const defineGetters = (getters: Record<string, () => any>) => {
|
|
508
|
-
for (const key of Object.
|
|
508
|
+
for (const [key, get] of Object.entries(getters)) {
|
|
509
509
|
Object.defineProperty(linkProps, key, {
|
|
510
|
-
get
|
|
510
|
+
get,
|
|
511
511
|
enumerable: true,
|
|
512
512
|
configurable: true,
|
|
513
513
|
});
|
|
@@ -78,8 +78,21 @@ export function registerPublicRouteDataOwner(
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/** Managed match transfer uses the immutable public-data contract, not custom adapters. */
|
|
82
|
+
export function assertNativeSerializationOptions(options: object): void {
|
|
83
|
+
if ('serializationAdapters' in options) {
|
|
84
|
+
const error = new DataProtocolError(
|
|
85
|
+
'Solid serializationAdapters are unsupported by the immutable public-data profile; return public records, arrays and scalars instead',
|
|
86
|
+
);
|
|
87
|
+
const owner: RequestSession | undefined = getRequestEvent()?.locals.session;
|
|
88
|
+
owner?.fail(error);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
/** Framework SSR accepts only routers that passed its public-data factory boundary. */
|
|
82
94
|
export function requireManagedPublicRouter(router: AnyRouter): void {
|
|
95
|
+
assertNativeSerializationOptions(router.options);
|
|
83
96
|
const owner: RequestSession | undefined = getRequestEvent()?.locals.session;
|
|
84
97
|
if (
|
|
85
98
|
!owner ||
|
|
@@ -268,6 +281,11 @@ export function primeRouterFromRegistry(router: AnyRouter): boolean {
|
|
|
268
281
|
try {
|
|
269
282
|
for (const [index, match] of matches.entries()) {
|
|
270
283
|
const entry = entries[index]!;
|
|
284
|
+
const beforeLoadContext = preparePublicContextData(
|
|
285
|
+
entry.beforeLoadContext,
|
|
286
|
+
owner,
|
|
287
|
+
privateContexts,
|
|
288
|
+
) as Record<string, unknown> | undefined;
|
|
271
289
|
const checked: TransferredMatch = {
|
|
272
290
|
...entry,
|
|
273
291
|
loaderData: prepareHydratedLoaderData(
|
|
@@ -275,11 +293,7 @@ export function primeRouterFromRegistry(router: AnyRouter): boolean {
|
|
|
275
293
|
owner,
|
|
276
294
|
privateContexts,
|
|
277
295
|
),
|
|
278
|
-
beforeLoadContext:
|
|
279
|
-
entry.beforeLoadContext,
|
|
280
|
-
owner,
|
|
281
|
-
privateContexts,
|
|
282
|
-
) as Record<string, unknown> | undefined,
|
|
296
|
+
...(beforeLoadContext !== undefined ? { beforeLoadContext } : {}),
|
|
283
297
|
error: preparePublicContextData(entry.error, owner, privateContexts),
|
|
284
298
|
};
|
|
285
299
|
entries[index] = checked;
|
|
@@ -356,7 +370,10 @@ function applyTransferredMatch(
|
|
|
356
370
|
__beforeLoadContext: entry.beforeLoadContext,
|
|
357
371
|
} as AnyRouteMatch;
|
|
358
372
|
if ('loaderData' in entry) next.loaderData = entry.loaderData;
|
|
359
|
-
if ('ssr' in entry)
|
|
373
|
+
if ('ssr' in entry) {
|
|
374
|
+
if (entry.ssr === undefined) delete next.ssr;
|
|
375
|
+
else next.ssr = entry.ssr;
|
|
376
|
+
}
|
|
360
377
|
return next;
|
|
361
378
|
}
|
|
362
379
|
|
|
@@ -133,7 +133,7 @@ export class RouteApi<
|
|
|
133
133
|
return useNavigate({ from: router.routesById[this.id as string].fullPath });
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
notFound = (opts?: NotFoundError) => {
|
|
136
|
+
override notFound = (opts?: NotFoundError) => {
|
|
137
137
|
return notFound({ routeId: this.id as string, ...opts });
|
|
138
138
|
};
|
|
139
139
|
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
import { RouterCore } from '@tanstack/router-core';
|
|
10
10
|
import { isServer } from '@tanstack/router-core/isServer';
|
|
11
11
|
import {
|
|
12
|
+
assertNativeSerializationOptions,
|
|
12
13
|
installPublicContextPublication,
|
|
13
14
|
primeRouterFromRegistry,
|
|
14
15
|
} from './registryTransfer';
|
|
@@ -104,6 +105,7 @@ export class Router<
|
|
|
104
105
|
TDehydrated
|
|
105
106
|
>,
|
|
106
107
|
) {
|
|
108
|
+
assertNativeSerializationOptions(options);
|
|
107
109
|
super(options, getStoreFactory);
|
|
108
110
|
installPublicContextPublication(this);
|
|
109
111
|
// The hydration-claiming boot (see registryTransfer). Router creation is
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RouterHistory } from '@tanstack/history';
|
|
2
|
+
import type {
|
|
3
|
+
AnyRoute,
|
|
4
|
+
RouterOptions as CoreRouterOptions,
|
|
5
|
+
TrailingSlashOption,
|
|
6
|
+
} from '@tanstack/router-core';
|
|
7
|
+
|
|
8
|
+
/** Native managed hydration transfers immutable public data only. */
|
|
9
|
+
export type RouterOptions<
|
|
10
|
+
TRouteTree extends AnyRoute,
|
|
11
|
+
TTrailingSlashOption extends TrailingSlashOption,
|
|
12
|
+
TDefaultStructuralSharingOption extends boolean = false,
|
|
13
|
+
TRouterHistory extends RouterHistory = RouterHistory,
|
|
14
|
+
TDehydrated = undefined,
|
|
15
|
+
> = Omit<
|
|
16
|
+
CoreRouterOptions<
|
|
17
|
+
TRouteTree,
|
|
18
|
+
TTrailingSlashOption,
|
|
19
|
+
TDefaultStructuralSharingOption,
|
|
20
|
+
TRouterHistory,
|
|
21
|
+
TDehydrated
|
|
22
|
+
>,
|
|
23
|
+
'serializationAdapters'
|
|
24
|
+
> & {
|
|
25
|
+
serializationAdapters?: never;
|
|
26
|
+
};
|
|
@@ -41,10 +41,11 @@ export function useLoaderData<
|
|
|
41
41
|
opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected>,
|
|
42
42
|
): Accessor<UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>> {
|
|
43
43
|
return useMatch({
|
|
44
|
-
|
|
45
|
-
strict: opts.strict,
|
|
44
|
+
...opts,
|
|
46
45
|
select: match => {
|
|
47
|
-
|
|
46
|
+
// The hook reads the rendered match; router-core also types pending
|
|
47
|
+
// matches, where loaderData is optional, in this shared match shape.
|
|
48
|
+
return opts.select ? opts.select(match.loaderData!) : match.loaderData;
|
|
48
49
|
},
|
|
49
50
|
}) as any;
|
|
50
51
|
}
|
|
@@ -16,12 +16,14 @@ export function useNavigate<
|
|
|
16
16
|
}): UseNavigateResult<TDefaultFrom> {
|
|
17
17
|
const router = useRouter();
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const navigate: UseNavigateResult<TDefaultFrom> = options => {
|
|
20
|
+
const from = options.from ?? _defaultOpts?.from;
|
|
20
21
|
return router.navigate({
|
|
21
22
|
...options,
|
|
22
|
-
from:
|
|
23
|
+
...(from === undefined ? {} : { from }),
|
|
23
24
|
});
|
|
24
|
-
}
|
|
25
|
+
};
|
|
26
|
+
return navigate;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export function Navigate<
|
|
@@ -61,9 +61,7 @@ export function useParams<
|
|
|
61
61
|
ThrowOrOptional<UseParamsResult<TRouter, TFrom, TStrict, TSelected>, TThrow>
|
|
62
62
|
> {
|
|
63
63
|
return useMatch({
|
|
64
|
-
|
|
65
|
-
strict: opts.strict,
|
|
66
|
-
shouldThrow: opts.shouldThrow,
|
|
64
|
+
...opts,
|
|
67
65
|
select: match => {
|
|
68
66
|
const params = opts.strict === false ? match.params : match._strictParams;
|
|
69
67
|
return opts.select ? opts.select(params) : params;
|
|
@@ -61,9 +61,7 @@ export function useSearch<
|
|
|
61
61
|
ThrowOrOptional<UseSearchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>
|
|
62
62
|
> {
|
|
63
63
|
return useMatch({
|
|
64
|
-
|
|
65
|
-
strict: opts.strict,
|
|
66
|
-
shouldThrow: opts.shouldThrow,
|
|
64
|
+
...opts,
|
|
67
65
|
select: match => {
|
|
68
66
|
const search = match.search;
|
|
69
67
|
return opts.select ? opts.select(search) : search;
|
package/src/router.ts
CHANGED
|
@@ -77,11 +77,11 @@ export interface FileSystemRouteModule {
|
|
|
77
77
|
pendingComponent?: RouteComponent;
|
|
78
78
|
errorComponent?: ErrorRouteComponent;
|
|
79
79
|
notFoundComponent?: NotFoundRouteComponent;
|
|
80
|
-
head?: AnyRoute['options']['head']
|
|
80
|
+
head?: NonNullable<AnyRoute['options']['head']>;
|
|
81
81
|
/** Explicit returned context becomes immutable public native route context. */
|
|
82
|
-
beforeLoad?: AnyRoute['options']['beforeLoad']
|
|
82
|
+
beforeLoad?: NonNullable<AnyRoute['options']['beforeLoad']>;
|
|
83
83
|
/** Native synchronous context contributions are checked before composition. */
|
|
84
|
-
context?: AnyRoute['options']['context']
|
|
84
|
+
context?: NonNullable<AnyRoute['options']['context']>;
|
|
85
85
|
validateSearch?: (search: Record<string, unknown>) => Record<string, unknown>;
|
|
86
86
|
}
|
|
87
87
|
|