@payloadcms/tanstack-start 4.0.0-internal.cd47d20 → 4.0.0-internal.ce66a41
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/adapters/handleServerFunctions.d.ts.map +1 -0
- package/dist/{utilities → adapters}/handleServerFunctions.js +2 -2
- package/dist/adapters/handleServerFunctions.js.map +1 -0
- package/dist/{layouts/Root/withPayloadRoot.d.ts → adapters/layout/index.d.ts} +29 -4
- package/dist/adapters/layout/index.d.ts.map +1 -0
- package/dist/adapters/layout/index.js +105 -0
- package/dist/adapters/layout/index.js.map +1 -0
- package/dist/adapters/layout/lazy.d.ts +11 -0
- package/dist/adapters/layout/lazy.d.ts.map +1 -0
- package/dist/adapters/layout/lazy.js +23 -0
- package/dist/adapters/layout/lazy.js.map +1 -0
- package/dist/adapters/layout/server.d.ts +29 -0
- package/dist/adapters/layout/server.d.ts.map +1 -0
- package/dist/adapters/layout/server.js +65 -0
- package/dist/adapters/layout/server.js.map +1 -0
- package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +10 -1
- package/dist/adapters/metadata.d.ts.map +1 -0
- package/dist/{utilities/meta.js → adapters/metadata.js} +60 -1
- package/dist/adapters/metadata.js.map +1 -0
- package/dist/{elements/RouterAdapter/index.d.ts → adapters/router.d.ts} +1 -1
- package/dist/adapters/router.d.ts.map +1 -0
- package/dist/{elements/RouterAdapter/index.js → adapters/router.js} +11 -4
- package/dist/adapters/router.js.map +1 -0
- package/dist/{utilities/serverAdapter.server.d.ts → adapters/server.d.ts} +1 -1
- package/dist/adapters/server.d.ts.map +1 -0
- package/dist/{utilities/serverAdapter.server.js → adapters/server.js} +1 -1
- package/dist/adapters/server.js.map +1 -0
- package/dist/{routes/adminRoutes.d.ts → adapters/views/index.d.ts} +5 -9
- package/dist/adapters/views/index.d.ts.map +1 -0
- package/dist/{routes/adminRoutes.js → adapters/views/index.js} +7 -43
- package/dist/adapters/views/index.js.map +1 -0
- package/dist/adapters/views/lazy.d.ts +4 -0
- package/dist/adapters/views/lazy.d.ts.map +1 -0
- package/dist/adapters/views/lazy.js +43 -0
- package/dist/adapters/views/lazy.js.map +1 -0
- package/dist/{utilities/loadAdminPage.d.ts → adapters/views/server.d.ts} +2 -2
- package/dist/adapters/views/server.d.ts.map +1 -0
- package/dist/{utilities/loadAdminPage.js → adapters/views/server.js} +5 -63
- package/dist/adapters/views/server.js.map +1 -0
- package/dist/auth/login.js +1 -1
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.js +1 -1
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.js +1 -1
- package/dist/auth/refresh.js.map +1 -1
- package/dist/exports/client.d.ts +2 -4
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +2 -4
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +2 -3
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -2
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/server.d.ts +7 -7
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +7 -7
- package/dist/exports/server.js.map +1 -1
- package/dist/{utilities/graphqlHandler.server.d.ts → routes/graphql/handler.server.d.ts} +1 -1
- package/dist/routes/graphql/handler.server.d.ts.map +1 -0
- package/dist/{utilities/graphqlHandler.server.js → routes/graphql/handler.server.js} +1 -1
- package/dist/routes/graphql/handler.server.js.map +1 -0
- package/dist/{utilities/handleAPIRoute.server.d.ts → routes/rest/handler.server.d.ts} +1 -1
- package/dist/routes/rest/handler.server.d.ts.map +1 -0
- package/dist/{utilities/handleAPIRoute.server.js → routes/rest/handler.server.js} +1 -1
- package/dist/routes/rest/handler.server.js.map +1 -0
- package/dist/routes/{apiRoute.d.ts → rest/index.d.ts} +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -0
- package/dist/routes/{apiRoute.js → rest/index.js} +2 -2
- package/dist/routes/rest/index.js.map +1 -0
- package/dist/rsc/CollectionCards.js +1 -1
- package/dist/rsc/CollectionCards.js.map +1 -1
- package/dist/utilities/devConfigReload.server.js +27 -2
- package/dist/utilities/devConfigReload.server.js.map +1 -1
- package/dist/utilities/initAdminContext.server.js +1 -1
- package/dist/utilities/initAdminContext.server.js.map +1 -1
- package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -1
- package/dist/withPayload/config/optimizeDeps.js +17 -0
- package/dist/withPayload/config/optimizeDeps.js.map +1 -1
- package/dist/withPayload/index.d.ts +2 -10
- package/dist/withPayload/index.d.ts.map +1 -1
- package/dist/withPayload/index.js +4 -12
- package/dist/withPayload/index.js.map +1 -1
- package/dist/withPayload/workarounds/stripDistStyleImports.js +1 -1
- package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -1
- package/package.json +10 -11
- package/dist/elements/RouterAdapter/index.d.ts.map +0 -1
- package/dist/elements/RouterAdapter/index.js.map +0 -1
- package/dist/layouts/Root/getLayoutData.d.ts +0 -34
- package/dist/layouts/Root/getLayoutData.d.ts.map +0 -1
- package/dist/layouts/Root/getLayoutData.js +0 -97
- package/dist/layouts/Root/getLayoutData.js.map +0 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +0 -1
- package/dist/layouts/Root/withPayloadRoot.js +0 -91
- package/dist/layouts/Root/withPayloadRoot.js.map +0 -1
- package/dist/node/cssLoader.d.mts +0 -25
- package/dist/node/cssLoader.d.mts.map +0 -1
- package/dist/node/cssLoader.js +0 -70
- package/dist/node/cssLoader.js.map +0 -1
- package/dist/node/cssLoader.mjs +0 -75
- package/dist/node/registerCssLoader.d.mts +0 -2
- package/dist/node/registerCssLoader.d.mts.map +0 -1
- package/dist/node/registerCssLoader.js +0 -10
- package/dist/node/registerCssLoader.js.map +0 -1
- package/dist/node/registerCssLoader.mjs +0 -10
- package/dist/routes/adminRoutes.d.ts.map +0 -1
- package/dist/routes/adminRoutes.js.map +0 -1
- package/dist/routes/apiRoute.d.ts.map +0 -1
- package/dist/routes/apiRoute.js.map +0 -1
- package/dist/routes/layoutRoute.d.ts +0 -27
- package/dist/routes/layoutRoute.d.ts.map +0 -1
- package/dist/routes/layoutRoute.js +0 -59
- package/dist/routes/layoutRoute.js.map +0 -1
- package/dist/utilities/graphqlHandler.server.d.ts.map +0 -1
- package/dist/utilities/graphqlHandler.server.js.map +0 -1
- package/dist/utilities/handleAPIRoute.server.d.ts.map +0 -1
- package/dist/utilities/handleAPIRoute.server.js.map +0 -1
- package/dist/utilities/handleServerFunctions.d.ts.map +0 -1
- package/dist/utilities/handleServerFunctions.js.map +0 -1
- package/dist/utilities/loadAdminPage.d.ts.map +0 -1
- package/dist/utilities/loadAdminPage.js.map +0 -1
- package/dist/utilities/loadLayoutData.d.ts +0 -17
- package/dist/utilities/loadLayoutData.d.ts.map +0 -1
- package/dist/utilities/loadLayoutData.js +0 -22
- package/dist/utilities/loadLayoutData.js.map +0 -1
- package/dist/utilities/meta.d.ts.map +0 -1
- package/dist/utilities/meta.js.map +0 -1
- package/dist/utilities/serverAdapter.server.d.ts.map +0 -1
- package/dist/utilities/serverAdapter.server.js.map +0 -1
- /package/dist/{utilities → adapters}/handleServerFunctions.d.ts +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
-
import type { Theme } from '@payloadcms/ui';
|
|
3
|
-
import type { ClientConfig, ImportMap, LanguageOptions, SanitizedConfig, SanitizedPermissions, User } from 'payload';
|
|
4
|
-
export type RootLayoutData = {
|
|
5
|
-
clientConfig: ClientConfig;
|
|
6
|
-
dateFNSKey: I18nClient['dateFNSKey'];
|
|
7
|
-
fallbackLang: string;
|
|
8
|
-
isEmbedded: boolean;
|
|
9
|
-
isNavOpen: boolean;
|
|
10
|
-
languageCode: string;
|
|
11
|
-
languageOptions: LanguageOptions;
|
|
12
|
-
locale?: string;
|
|
13
|
-
permissions: SanitizedPermissions;
|
|
14
|
-
/**
|
|
15
|
-
* Custom admin provider tree (`config.admin.components.providers`) nested
|
|
16
|
-
* around the router `<Outlet />`. Built unrendered by `getLayoutData`; the
|
|
17
|
-
* layout server function renders it to an RSC payload before it reaches the
|
|
18
|
-
* client. `undefined` when no custom providers are configured.
|
|
19
|
-
*/
|
|
20
|
-
providers?: React.ReactNode;
|
|
21
|
-
theme: Theme;
|
|
22
|
-
translations: I18nClient['translations'];
|
|
23
|
-
user: null | User;
|
|
24
|
-
};
|
|
25
|
-
export type GetLayoutDataArgs = {
|
|
26
|
-
configPromise: Promise<SanitizedConfig> | SanitizedConfig;
|
|
27
|
-
importMap: ImportMap;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Fetches all data needed by the root admin layout.
|
|
31
|
-
* Call this in your TanStack Start root route loader.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getLayoutData({ configPromise, importMap, }: GetLayoutDataArgs): Promise<RootLayoutData>;
|
|
34
|
-
//# sourceMappingURL=getLayoutData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLayoutData.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/getLayoutData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EACf,oBAAoB,EAEpB,IAAI,EACL,MAAM,SAAS,CAAA;AAahB,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,eAAe,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,EAAE,KAAK,CAAA;IACZ,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACxC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,EAClC,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAyF7C"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs';
|
|
2
|
-
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
3
|
-
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
|
-
import { getRequestEmbed } from '@payloadcms/ui/utilities/getRequestEmbed';
|
|
5
|
-
import { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme';
|
|
6
|
-
import { Outlet } from '@tanstack/react-router';
|
|
7
|
-
import { applyLocaleFiltering } from 'payload/shared';
|
|
8
|
-
import { createElement } from 'react';
|
|
9
|
-
import { initAdminContext } from '../../utilities/initAdminContext.server.js';
|
|
10
|
-
/**
|
|
11
|
-
* Fetches all data needed by the root admin layout.
|
|
12
|
-
* Call this in your TanStack Start root route loader.
|
|
13
|
-
*/ export async function getLayoutData({ configPromise, importMap }) {
|
|
14
|
-
const { cookies, headers, languageCode, permissions, req, req: { payload: { config } }, user } = await initAdminContext({
|
|
15
|
-
configPromise,
|
|
16
|
-
importMap
|
|
17
|
-
});
|
|
18
|
-
const theme = getRequestTheme({
|
|
19
|
-
config,
|
|
20
|
-
cookies,
|
|
21
|
-
headers
|
|
22
|
-
});
|
|
23
|
-
const isEmbedded = getRequestEmbed({
|
|
24
|
-
config,
|
|
25
|
-
cookies
|
|
26
|
-
});
|
|
27
|
-
const languageOptions = Object.entries(config.i18n.supportedLanguages || {}).reduce((acc, [language, languageConfig])=>{
|
|
28
|
-
if (Object.keys(config.i18n.supportedLanguages).includes(language)) {
|
|
29
|
-
acc.push({
|
|
30
|
-
label: languageConfig.translations.general.thisLanguage,
|
|
31
|
-
value: language
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return acc;
|
|
35
|
-
}, []);
|
|
36
|
-
const navPrefs = await getNavPrefs(req);
|
|
37
|
-
const clientConfig = getClientConfig({
|
|
38
|
-
config,
|
|
39
|
-
i18n: req.i18n,
|
|
40
|
-
importMap,
|
|
41
|
-
user: user ?? true
|
|
42
|
-
});
|
|
43
|
-
await applyLocaleFiltering({
|
|
44
|
-
clientConfig,
|
|
45
|
-
config,
|
|
46
|
-
req
|
|
47
|
-
});
|
|
48
|
-
// Build the custom admin provider tree (`config.admin.components.providers`)
|
|
49
|
-
// nested around the router `<Outlet />`, mirroring the Next adapter's
|
|
50
|
-
// `NestProviders`. Returned as an unrendered element; the caller's server
|
|
51
|
-
// function renders it to an RSC payload (so server-component providers run
|
|
52
|
-
// server-side and client providers wrap the live Outlet). `undefined` when
|
|
53
|
-
// no custom providers are configured — the caller falls back to `<Outlet />`.
|
|
54
|
-
const providerPaths = config.admin?.components?.providers;
|
|
55
|
-
let providers = undefined;
|
|
56
|
-
if (Array.isArray(providerPaths) && providerPaths.length > 0) {
|
|
57
|
-
const serverProps = {
|
|
58
|
-
i18n: req.i18n,
|
|
59
|
-
params: {},
|
|
60
|
-
payload: req.payload,
|
|
61
|
-
permissions,
|
|
62
|
-
searchParams: {},
|
|
63
|
-
server: req.server,
|
|
64
|
-
user: user ?? undefined
|
|
65
|
-
};
|
|
66
|
-
// Mirror the Next adapter's `NestProviders`: render each configured provider
|
|
67
|
-
// via `RenderServerComponent` so the entry's own `clientProps`/`serverProps`
|
|
68
|
-
// (e.g. plugin-multi-tenant's `userHasAccessToAllTenants`) are merged in, and
|
|
69
|
-
// server components receive `serverProps` while client components get only
|
|
70
|
-
// `clientProps`. Nested around the router `<Outlet />` instead of `children`.
|
|
71
|
-
providers = providerPaths.reduceRight((children, provider)=>RenderServerComponent({
|
|
72
|
-
clientProps: {
|
|
73
|
-
children
|
|
74
|
-
},
|
|
75
|
-
Component: provider,
|
|
76
|
-
importMap,
|
|
77
|
-
serverProps
|
|
78
|
-
}), createElement(Outlet));
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
clientConfig,
|
|
82
|
-
dateFNSKey: req.i18n.dateFNSKey,
|
|
83
|
-
fallbackLang: config.i18n.fallbackLanguage,
|
|
84
|
-
isEmbedded,
|
|
85
|
-
isNavOpen: navPrefs?.open ?? true,
|
|
86
|
-
languageCode,
|
|
87
|
-
languageOptions,
|
|
88
|
-
locale: req.locale ?? undefined,
|
|
89
|
-
permissions,
|
|
90
|
-
providers,
|
|
91
|
-
theme,
|
|
92
|
-
translations: req.i18n.translations,
|
|
93
|
-
user: user ?? null
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//# sourceMappingURL=getLayoutData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/layouts/Root/getLayoutData.ts"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type { Theme } from '@payloadcms/ui'\nimport type {\n ClientConfig,\n ImportMap,\n LanguageOptions,\n SanitizedConfig,\n SanitizedPermissions,\n ServerProps,\n User,\n} from 'payload'\n\nimport { getNavPrefs } from '@payloadcms/ui/elements/Nav/getNavPrefs'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { getRequestEmbed } from '@payloadcms/ui/utilities/getRequestEmbed'\nimport { getRequestTheme } from '@payloadcms/ui/utilities/getRequestTheme'\nimport { Outlet } from '@tanstack/react-router'\nimport { applyLocaleFiltering } from 'payload/shared'\nimport { createElement } from 'react'\n\nimport { initAdminContext } from '../../utilities/initAdminContext.server.js'\n\nexport type RootLayoutData = {\n clientConfig: ClientConfig\n dateFNSKey: I18nClient['dateFNSKey']\n fallbackLang: string\n isEmbedded: boolean\n isNavOpen: boolean\n languageCode: string\n languageOptions: LanguageOptions\n locale?: string\n permissions: SanitizedPermissions\n /**\n * Custom admin provider tree (`config.admin.components.providers`) nested\n * around the router `<Outlet />`. Built unrendered by `getLayoutData`; the\n * layout server function renders it to an RSC payload before it reaches the\n * client. `undefined` when no custom providers are configured.\n */\n providers?: React.ReactNode\n theme: Theme\n translations: I18nClient['translations']\n user: null | User\n}\n\nexport type GetLayoutDataArgs = {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n}\n\n/**\n * Fetches all data needed by the root admin layout.\n * Call this in your TanStack Start root route loader.\n */\nexport async function getLayoutData({\n configPromise,\n importMap,\n}: GetLayoutDataArgs): Promise<RootLayoutData> {\n const {\n cookies,\n headers,\n languageCode,\n permissions,\n req,\n req: {\n payload: { config },\n },\n user,\n } = await initAdminContext({ configPromise, importMap })\n\n const theme = getRequestTheme({ config, cookies, headers })\n const isEmbedded = getRequestEmbed({ config, cookies })\n\n const languageOptions: LanguageOptions = Object.entries(\n config.i18n.supportedLanguages || {},\n ).reduce((acc, [language, languageConfig]) => {\n if (Object.keys(config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language as AcceptedLanguages,\n })\n }\n return acc\n }, [] as LanguageOptions)\n\n const navPrefs = await getNavPrefs(req)\n\n const clientConfig = getClientConfig({\n config,\n i18n: req.i18n,\n importMap,\n user: user ?? true,\n })\n\n await applyLocaleFiltering({ clientConfig, config, req })\n\n // Build the custom admin provider tree (`config.admin.components.providers`)\n // nested around the router `<Outlet />`, mirroring the Next adapter's\n // `NestProviders`. Returned as an unrendered element; the caller's server\n // function renders it to an RSC payload (so server-component providers run\n // server-side and client providers wrap the live Outlet). `undefined` when\n // no custom providers are configured — the caller falls back to `<Outlet />`.\n const providerPaths = config.admin?.components?.providers\n let providers: React.ReactNode = undefined\n if (Array.isArray(providerPaths) && providerPaths.length > 0) {\n const serverProps: ServerProps = {\n i18n: req.i18n,\n params: {},\n payload: req.payload,\n permissions,\n searchParams: {},\n server: req.server!,\n user: user ?? undefined,\n }\n // Mirror the Next adapter's `NestProviders`: render each configured provider\n // via `RenderServerComponent` so the entry's own `clientProps`/`serverProps`\n // (e.g. plugin-multi-tenant's `userHasAccessToAllTenants`) are merged in, and\n // server components receive `serverProps` while client components get only\n // `clientProps`. Nested around the router `<Outlet />` instead of `children`.\n providers = providerPaths.reduceRight<React.ReactNode>(\n (children, provider) =>\n RenderServerComponent({\n clientProps: { children },\n Component: provider,\n importMap,\n serverProps,\n }),\n createElement(Outlet),\n )\n }\n\n return {\n clientConfig,\n dateFNSKey: req.i18n.dateFNSKey,\n fallbackLang: config.i18n.fallbackLanguage,\n isEmbedded,\n isNavOpen: navPrefs?.open ?? true,\n languageCode,\n languageOptions,\n locale: req.locale ?? undefined,\n permissions,\n providers,\n theme,\n translations: req.i18n.translations,\n user: user ?? null,\n }\n}\n"],"names":["getNavPrefs","RenderServerComponent","getClientConfig","getRequestEmbed","getRequestTheme","Outlet","applyLocaleFiltering","createElement","initAdminContext","getLayoutData","configPromise","importMap","cookies","headers","languageCode","permissions","req","payload","config","user","theme","isEmbedded","languageOptions","Object","entries","i18n","supportedLanguages","reduce","acc","language","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","navPrefs","clientConfig","providerPaths","admin","components","providers","undefined","Array","isArray","length","serverProps","params","searchParams","server","reduceRight","children","provider","clientProps","Component","dateFNSKey","fallbackLang","fallbackLanguage","isNavOpen","open","locale"],"mappings":"AAYA,SAASA,WAAW,QAAQ,0CAAyC;AACrE,SAASC,qBAAqB,Q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AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,EAC7D,OAAO,GAAE,sBAA2B,kBAIW;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uBAc7E"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir';
|
|
4
|
-
import { HeadContent, Scripts, useRouterState } from '@tanstack/react-router';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
/**
|
|
7
|
-
* The `<html>` document shell for Payload admin routes — the TanStack Start
|
|
8
|
-
* equivalent of `@payloadcms/next`'s root layout `<html>`. Sets
|
|
9
|
-
* `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data
|
|
10
|
-
* (`getLayoutData`, exposed on the `/_payload` route loader), so the admin
|
|
11
|
-
* panel renders themed with the correct text direction on the first paint with no
|
|
12
|
-
* client bootstrap script — the same server-side path Next's `RootLayout`
|
|
13
|
-
* uses, sharing `getRequestTheme`/`getLanguageDir` from `@payloadcms/ui`.
|
|
14
|
-
*/ export function PayloadAdminShell({ children }) {
|
|
15
|
-
const htmlProps = useRouterState({
|
|
16
|
-
select: (state)=>{
|
|
17
|
-
for (const match of state.matches){
|
|
18
|
-
const data = match.loaderData;
|
|
19
|
-
if (data?.theme && data?.languageCode) {
|
|
20
|
-
return {
|
|
21
|
-
'data-theme': data.theme,
|
|
22
|
-
dir: getLanguageDir({
|
|
23
|
-
languageCode: data.languageCode
|
|
24
|
-
}),
|
|
25
|
-
lang: data.languageCode
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// No layout data yet (fresh session before the loader resolves): default
|
|
30
|
-
// to `ltr` so the `[dir='ltr']`-scoped admin layout rules (e.g. the
|
|
31
|
-
// document sidebar divider) still match, matching Next's `ltr` default.
|
|
32
|
-
return {
|
|
33
|
-
dir: 'ltr'
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return(// eslint-disable-next-line jsx-a11y/html-has-lang -- `lang` is set from server-computed layout data when available
|
|
38
|
-
/*#__PURE__*/ _jsxs("html", {
|
|
39
|
-
...htmlProps,
|
|
40
|
-
suppressHydrationWarning: true,
|
|
41
|
-
children: [
|
|
42
|
-
/*#__PURE__*/ _jsxs("head", {
|
|
43
|
-
children: [
|
|
44
|
-
/*#__PURE__*/ _jsx("style", {
|
|
45
|
-
children: `@layer payload-default, payload;`
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ _jsx(HeadContent, {})
|
|
48
|
-
]
|
|
49
|
-
}),
|
|
50
|
-
/*#__PURE__*/ _jsxs("body", {
|
|
51
|
-
children: [
|
|
52
|
-
children,
|
|
53
|
-
/*#__PURE__*/ _jsx(Scripts, {})
|
|
54
|
-
]
|
|
55
|
-
})
|
|
56
|
-
]
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Wraps your application's root document shell so Payload owns its own
|
|
61
|
-
* `<html>` chrome on admin routes while your shell renders everywhere else.
|
|
62
|
-
*
|
|
63
|
-
* Attach the result to the root route's `shellComponent`; it is the single
|
|
64
|
-
* integration touch point — no root loader and no manual data threading:
|
|
65
|
-
*
|
|
66
|
-
* ```tsx
|
|
67
|
-
* export const Route = createRootRoute({
|
|
68
|
-
* shellComponent: withPayloadRoot(MarketingRoot),
|
|
69
|
-
* })
|
|
70
|
-
* ```
|
|
71
|
-
*/ export function withPayloadRoot(RootShell, options = {}) {
|
|
72
|
-
const { adminRoute = '/admin' } = options;
|
|
73
|
-
return function PayloadRootShell({ children }) {
|
|
74
|
-
const isAdminRoute = useRouterState({
|
|
75
|
-
select: (s)=>{
|
|
76
|
-
const { pathname } = s.location;
|
|
77
|
-
return pathname === adminRoute || pathname.startsWith(`${adminRoute}/`);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
if (isAdminRoute) {
|
|
81
|
-
return /*#__PURE__*/ _jsx(PayloadAdminShell, {
|
|
82
|
-
children: children
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return /*#__PURE__*/ _jsx(RootShell, {
|
|
86
|
-
children: children
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
//# sourceMappingURL=withPayloadRoot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/layouts/Root/withPayloadRoot.tsx"],"sourcesContent":["'use client'\nimport type { Theme } from '@payloadcms/ui'\n\nimport { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir'\nimport { HeadContent, Scripts, useRouterState } from '@tanstack/react-router'\nimport React from 'react'\n\ntype AdminHTMLProps = {\n 'data-theme'?: Theme\n dir: 'ltr' | 'rtl'\n lang?: string\n}\n\nexport type PayloadAdminShellProps = {\n readonly children: React.ReactNode\n}\n\n/**\n * The `<html>` document shell for Payload admin routes — the TanStack Start\n * equivalent of `@payloadcms/next`'s root layout `<html>`. Sets\n * `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data\n * (`getLayoutData`, exposed on the `/_payload` route loader), so the admin\n * panel renders themed with the correct text direction on the first paint with no\n * client bootstrap script — the same server-side path Next's `RootLayout`\n * uses, sharing `getRequestTheme`/`getLanguageDir` from `@payloadcms/ui`.\n */\nexport function PayloadAdminShell({ children }: PayloadAdminShellProps) {\n const htmlProps = useRouterState({\n select: (state): AdminHTMLProps => {\n for (const match of state.matches) {\n const data = match.loaderData as { languageCode?: string; theme?: Theme } | undefined\n\n if (data?.theme && data?.languageCode) {\n return {\n 'data-theme': data.theme,\n dir: getLanguageDir({ languageCode: data.languageCode }),\n lang: data.languageCode,\n }\n }\n }\n\n // No layout data yet (fresh session before the loader resolves): default\n // to `ltr` so the `[dir='ltr']`-scoped admin layout rules (e.g. the\n // document sidebar divider) still match, matching Next's `ltr` default.\n return { dir: 'ltr' }\n },\n })\n\n return (\n // eslint-disable-next-line jsx-a11y/html-has-lang -- `lang` is set from server-computed layout data when available\n <html {...htmlProps} suppressHydrationWarning>\n <head>\n <style>{`@layer payload-default, payload;`}</style>\n <HeadContent />\n </head>\n <body>\n {children}\n <Scripts />\n </body>\n </html>\n )\n}\n\nexport type WithPayloadRootOptions = {\n /**\n * Path prefix that mounts the Payload admin panel (`config.routes.admin`).\n * Routes under it render the Payload admin document shell; everything else\n * renders your own shell. Defaults to `'/admin'`.\n */\n adminRoute?: string\n}\n\n/**\n * Wraps your application's root document shell so Payload owns its own\n * `<html>` chrome on admin routes while your shell renders everywhere else.\n *\n * Attach the result to the root route's `shellComponent`; it is the single\n * integration touch point — no root loader and no manual data threading:\n *\n * ```tsx\n * export const Route = createRootRoute({\n * shellComponent: withPayloadRoot(MarketingRoot),\n * })\n * ```\n */\nexport function withPayloadRoot(\n RootShell: React.ComponentType<{ children: React.ReactNode }>,\n options: WithPayloadRootOptions = {},\n) {\n const { adminRoute = '/admin' } = options\n\n return function PayloadRootShell({ children }: { children: React.ReactNode }) {\n const isAdminRoute = useRouterState({\n select: (s) => {\n const { pathname } = s.location\n return pathname === adminRoute || pathname.startsWith(`${adminRoute}/`)\n },\n })\n\n if (isAdminRoute) {\n return <PayloadAdminShell>{children}</PayloadAdminShell>\n }\n\n return <RootShell>{children}</RootShell>\n }\n}\n"],"names":["getLanguageDir","HeadContent","Scripts","useRouterState","React","PayloadAdminShell","children","htmlProps","select","state","match","matches","data","loaderData","theme","languageCode","dir","lang","html","suppressHydrationWarning","head","style","body","withPayloadRoot","RootShell","options","adminRoute","PayloadRootShell","isAdminRoute","s","pathname","location","startsWith"],"mappings":"A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sBAAWlB;;IACrB;AACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,
|
|
3
|
-
* images, fonts, audio, video, etc.) encountered while running the dev
|
|
4
|
-
* server.
|
|
5
|
-
*
|
|
6
|
-
* Vite is supposed to intercept asset imports during SSR/RSC by treating
|
|
7
|
-
* the package as `noExternal`, but that resolution path silently breaks down
|
|
8
|
-
* when a dependency is installed from a packed tarball under
|
|
9
|
-
* `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the
|
|
10
|
-
* import to Node's native ESM loader, which has no opinion about `.css` /
|
|
11
|
-
* `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single
|
|
12
|
-
* throw cascades into every admin route showing "Something went wrong!"
|
|
13
|
-
* because the SSR tree dies inside `<MatchInnerImpl>`.
|
|
14
|
-
*
|
|
15
|
-
* Registering this loader (with `--import` or `register()`) makes Node treat
|
|
16
|
-
* any asset specifier as an empty ES module, which is exactly what we
|
|
17
|
-
* already do client-side for SSR.
|
|
18
|
-
*
|
|
19
|
-
* The loader is intentionally minimal and side-effect free; it only kicks in
|
|
20
|
-
* for asset specifiers and falls through to the default loader for
|
|
21
|
-
* everything else.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolve(specifier: any, context: any, nextResolve: any): Promise<any>;
|
|
24
|
-
export declare function load(url: any, context: any, nextLoad: any): Promise<any>;
|
|
25
|
-
//# sourceMappingURL=cssLoader.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cssLoader.d.mts","sourceRoot":"","sources":["../../src/node/cssLoader.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAiCH,wBAAsB,OAAO,CAAC,SAAS,KAAA,EAAE,OAAO,KAAA,EAAE,WAAW,KAAA,gBAS5D;AAED,wBAAsB,IAAI,CAAC,GAAG,KAAA,EAAE,OAAO,KAAA,EAAE,QAAQ,KAAA,gBAShD"}
|
package/dist/node/cssLoader.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,
|
|
3
|
-
* images, fonts, audio, video, etc.) encountered while running the dev
|
|
4
|
-
* server.
|
|
5
|
-
*
|
|
6
|
-
* Vite is supposed to intercept asset imports during SSR/RSC by treating
|
|
7
|
-
* the package as `noExternal`, but that resolution path silently breaks down
|
|
8
|
-
* when a dependency is installed from a packed tarball under
|
|
9
|
-
* `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the
|
|
10
|
-
* import to Node's native ESM loader, which has no opinion about `.css` /
|
|
11
|
-
* `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single
|
|
12
|
-
* throw cascades into every admin route showing "Something went wrong!"
|
|
13
|
-
* because the SSR tree dies inside `<MatchInnerImpl>`.
|
|
14
|
-
*
|
|
15
|
-
* Registering this loader (with `--import` or `register()`) makes Node treat
|
|
16
|
-
* any asset specifier as an empty ES module, which is exactly what we
|
|
17
|
-
* already do client-side for SSR.
|
|
18
|
-
*
|
|
19
|
-
* The loader is intentionally minimal and side-effect free; it only kicks in
|
|
20
|
-
* for asset specifiers and falls through to the default loader for
|
|
21
|
-
* everything else.
|
|
22
|
-
*/ const STYLE_EXTENSION_RE = /\.(?:s?css|less)(?:\?[^#]*)?(?:#.*)?$/i;
|
|
23
|
-
const ASSET_EXTENSION_RE = /\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\?[^#]*)?(?:#.*)?$/i;
|
|
24
|
-
const isStylesheet = (s)=>STYLE_EXTENSION_RE.test(s);
|
|
25
|
-
const isStaticAsset = (s)=>ASSET_EXTENSION_RE.test(s);
|
|
26
|
-
const stubSource = (specifier)=>{
|
|
27
|
-
if (isStylesheet(specifier)) {
|
|
28
|
-
// Stylesheet imports usually have no JS-visible exports, so an empty
|
|
29
|
-
// module is fine and matches Vite's `?inline` / extracted-css behaviour.
|
|
30
|
-
return '';
|
|
31
|
-
}
|
|
32
|
-
// Treat every other static asset like Vite's default asset pipeline:
|
|
33
|
-
// expose the (escaped) specifier as both a default export and a `src`
|
|
34
|
-
// property. This lets code like
|
|
35
|
-
// import logo from './logo.svg' -> uses the default export
|
|
36
|
-
// import { src } from './logo.png' -> Next.js `StaticImageData` shim
|
|
37
|
-
// logo === '/logo.svg' -> truthy, sufficient for tests
|
|
38
|
-
// continue to work without crashing during SSR.
|
|
39
|
-
const value = JSON.stringify(specifier);
|
|
40
|
-
return `const __asset = ${value};
|
|
41
|
-
export default __asset;
|
|
42
|
-
export const src = __asset;
|
|
43
|
-
export const height = 0;
|
|
44
|
-
export const width = 0;
|
|
45
|
-
export const blurWidth = 0;
|
|
46
|
-
export const blurHeight = 0;
|
|
47
|
-
`;
|
|
48
|
-
};
|
|
49
|
-
export async function resolve(specifier, context, nextResolve) {
|
|
50
|
-
if (isStylesheet(specifier) || isStaticAsset(specifier)) {
|
|
51
|
-
return {
|
|
52
|
-
format: 'module',
|
|
53
|
-
shortCircuit: true,
|
|
54
|
-
url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return nextResolve(specifier, context);
|
|
58
|
-
}
|
|
59
|
-
export async function load(url, context, nextLoad) {
|
|
60
|
-
if (isStylesheet(url) || isStaticAsset(url)) {
|
|
61
|
-
return {
|
|
62
|
-
format: 'module',
|
|
63
|
-
shortCircuit: true,
|
|
64
|
-
source: stubSource(url)
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return nextLoad(url, context);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//# sourceMappingURL=cssLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node/cssLoader.mjs"],"sourcesContent":["/**\n * Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,\n * images, fonts, audio, video, etc.) encountered while running the dev\n * server.\n *\n * Vite is supposed to intercept asset imports during SSR/RSC by treating\n * the package as `noExternal`, but that resolution path silently breaks down\n * when a dependency is installed from a packed tarball under\n * `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the\n * import to Node's native ESM loader, which has no opinion about `.css` /\n * `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single\n * throw cascades into every admin route showing \"Something went wrong!\"\n * because the SSR tree dies inside `<MatchInnerImpl>`.\n *\n * Registering this loader (with `--import` or `register()`) makes Node treat\n * any asset specifier as an empty ES module, which is exactly what we\n * already do client-side for SSR.\n *\n * The loader is intentionally minimal and side-effect free; it only kicks in\n * for asset specifiers and falls through to the default loader for\n * everything else.\n */\n\nconst STYLE_EXTENSION_RE = /\\.(?:s?css|less)(?:\\?[^#]*)?(?:#.*)?$/i\nconst ASSET_EXTENSION_RE =\n /\\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\\?[^#]*)?(?:#.*)?$/i\n\nconst isStylesheet = (s) => STYLE_EXTENSION_RE.test(s)\nconst isStaticAsset = (s) => ASSET_EXTENSION_RE.test(s)\n\nconst stubSource = (specifier) => {\n if (isStylesheet(specifier)) {\n // Stylesheet imports usually have no JS-visible exports, so an empty\n // module is fine and matches Vite's `?inline` / extracted-css behaviour.\n return ''\n }\n // Treat every other static asset like Vite's default asset pipeline:\n // expose the (escaped) specifier as both a default export and a `src`\n // property. This lets code like\n // import logo from './logo.svg' -> uses the default export\n // import { src } from './logo.png' -> Next.js `StaticImageData` shim\n // logo === '/logo.svg' -> truthy, sufficient for tests\n // continue to work without crashing during SSR.\n const value = JSON.stringify(specifier)\n return `const __asset = ${value};\nexport default __asset;\nexport const src = __asset;\nexport const height = 0;\nexport const width = 0;\nexport const blurWidth = 0;\nexport const blurHeight = 0;\n`\n}\n\nexport async function resolve(specifier, context, nextResolve) {\n if (isStylesheet(specifier) || isStaticAsset(specifier)) {\n return {\n format: 'module',\n shortCircuit: true,\n url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`,\n }\n }\n return nextResolve(specifier, context)\n}\n\nexport async function load(url, context, nextLoad) {\n if (isStylesheet(url) || isStaticAsset(url)) {\n return {\n format: 'module',\n shortCircuit: true,\n source: stubSource(url),\n }\n }\n return nextLoad(url, context)\n}\n"],"names":["STYLE_EXTENSION_RE","ASSET_EXTENSION_RE","isStylesheet","s","test","isStaticAsset","stubSource","specifier","value","JSON","stringify","resolve","context","nextResolve","format","shortCircuit","url","Buffer","from","toString","load","nextLoad","source"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED,MAAMA,qBAAqB;AAC3B,MAAMC,qBACJ;AAEF,MAAMC,eAAe,CAACC,IAAMH,mBAAmBI,IAAI,CAACD;AACpD,MAAME,gBAAgB,CAACF,IAAMF,mBAAmBG,IAAI,CAACD;AAErD,MAAMG,aAAa,CAACC;IAClB,IAAIL,aAAaK,YAAY;QAC3B,qEAAqE;QACrE,yEAAyE;QACzE,OAAO;IACT;IACA,qEAAqE;IACrE,sEAAsE;IACtE,gCAAgC;IAChC,oEAAoE;IACpE,2EAA2E;IAC3E,yEAAyE;IACzE,gDAAgD;IAChD,MAAMC,QAAQC,KAAKC,SAAS,CAACH;IAC7B,OAAO,CAAC,gBAAgB,EAAEC,MAAM;;;;;;;AAOlC,CAAC;AACD;AAEA,OAAO,eAAeG,QAAQJ,SAAS,EAAEK,OAAO,EAAEC,WAAW;IAC3D,IAAIX,aAAaK,cAAcF,cAAcE,YAAY;QACvD,OAAO;YACLO,QAAQ;YACRC,cAAc;YACdC,KAAK,CAAC,4BAA4B,EAAEC,OAAOC,IAAI,CAACZ,WAAWC,YAAYY,QAAQ,CAAC,WAAW;QAC7F;IACF;IACA,OAAON,YAAYN,WAAWK;AAChC;AAEA,OAAO,eAAeQ,KAAKJ,GAAG,EAAEJ,OAAO,EAAES,QAAQ;IAC/C,IAAInB,aAAac,QAAQX,cAAcW,MAAM;QAC3C,OAAO;YACLF,QAAQ;YACRC,cAAc;YACdO,QAAQhB,WAAWU;QACrB;IACF;IACA,OAAOK,SAASL,KAAKJ;AACvB"}
|
package/dist/node/cssLoader.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,
|
|
3
|
-
* images, fonts, audio, video, etc.) encountered while running the dev
|
|
4
|
-
* server.
|
|
5
|
-
*
|
|
6
|
-
* Vite is supposed to intercept asset imports during SSR/RSC by treating
|
|
7
|
-
* the package as `noExternal`, but that resolution path silently breaks down
|
|
8
|
-
* when a dependency is installed from a packed tarball under
|
|
9
|
-
* `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the
|
|
10
|
-
* import to Node's native ESM loader, which has no opinion about `.css` /
|
|
11
|
-
* `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single
|
|
12
|
-
* throw cascades into every admin route showing "Something went wrong!"
|
|
13
|
-
* because the SSR tree dies inside `<MatchInnerImpl>`.
|
|
14
|
-
*
|
|
15
|
-
* Registering this loader (with `--import` or `register()`) makes Node treat
|
|
16
|
-
* any asset specifier as an empty ES module, which is exactly what we
|
|
17
|
-
* already do client-side for SSR.
|
|
18
|
-
*
|
|
19
|
-
* The loader is intentionally minimal and side-effect free; it only kicks in
|
|
20
|
-
* for asset specifiers and falls through to the default loader for
|
|
21
|
-
* everything else.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const STYLE_EXTENSION_RE = /\.(?:s?css|less)(?:\?[^#]*)?(?:#.*)?$/i
|
|
25
|
-
const ASSET_EXTENSION_RE =
|
|
26
|
-
/\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\?[^#]*)?(?:#.*)?$/i
|
|
27
|
-
|
|
28
|
-
const isStylesheet = (s) => STYLE_EXTENSION_RE.test(s)
|
|
29
|
-
const isStaticAsset = (s) => ASSET_EXTENSION_RE.test(s)
|
|
30
|
-
|
|
31
|
-
const stubSource = (specifier) => {
|
|
32
|
-
if (isStylesheet(specifier)) {
|
|
33
|
-
// Stylesheet imports usually have no JS-visible exports, so an empty
|
|
34
|
-
// module is fine and matches Vite's `?inline` / extracted-css behaviour.
|
|
35
|
-
return ''
|
|
36
|
-
}
|
|
37
|
-
// Treat every other static asset like Vite's default asset pipeline:
|
|
38
|
-
// expose the (escaped) specifier as both a default export and a `src`
|
|
39
|
-
// property. This lets code like
|
|
40
|
-
// import logo from './logo.svg' -> uses the default export
|
|
41
|
-
// import { src } from './logo.png' -> Next.js `StaticImageData` shim
|
|
42
|
-
// logo === '/logo.svg' -> truthy, sufficient for tests
|
|
43
|
-
// continue to work without crashing during SSR.
|
|
44
|
-
const value = JSON.stringify(specifier)
|
|
45
|
-
return `const __asset = ${value};
|
|
46
|
-
export default __asset;
|
|
47
|
-
export const src = __asset;
|
|
48
|
-
export const height = 0;
|
|
49
|
-
export const width = 0;
|
|
50
|
-
export const blurWidth = 0;
|
|
51
|
-
export const blurHeight = 0;
|
|
52
|
-
`
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export async function resolve(specifier, context, nextResolve) {
|
|
56
|
-
if (isStylesheet(specifier) || isStaticAsset(specifier)) {
|
|
57
|
-
return {
|
|
58
|
-
format: 'module',
|
|
59
|
-
shortCircuit: true,
|
|
60
|
-
url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`,
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return nextResolve(specifier, context)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function load(url, context, nextLoad) {
|
|
67
|
-
if (isStylesheet(url) || isStaticAsset(url)) {
|
|
68
|
-
return {
|
|
69
|
-
format: 'module',
|
|
70
|
-
shortCircuit: true,
|
|
71
|
-
source: stubSource(url),
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return nextLoad(url, context)
|
|
75
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerCssLoader.d.mts","sourceRoot":"","sources":["../../src/node/registerCssLoader.mjs"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.
|
|
3
|
-
*
|
|
4
|
-
* Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`
|
|
5
|
-
* so the spawned Vite process can swallow stylesheet imports it would
|
|
6
|
-
* otherwise hand to Node's native ESM loader (which throws on `.css`).
|
|
7
|
-
*/ import { register } from 'node:module';
|
|
8
|
-
register('./cssLoader.mjs', import.meta.url);
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=registerCssLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node/registerCssLoader.mjs"],"sourcesContent":["/**\n * Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.\n *\n * Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`\n * so the spawned Vite process can swallow stylesheet imports it would\n * otherwise hand to Node's native ESM loader (which throws on `.css`).\n */\nimport { register } from 'node:module'\n\nregister('./cssLoader.mjs', import.meta.url)\n"],"names":["register","url"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,QAAQ,QAAQ,cAAa;AAEtCA,SAAS,mBAAmB,YAAYC,GAAG"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.
|
|
3
|
-
*
|
|
4
|
-
* Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`
|
|
5
|
-
* so the spawned Vite process can swallow stylesheet imports it would
|
|
6
|
-
* otherwise hand to Node's native ESM loader (which throws on `.css`).
|
|
7
|
-
*/
|
|
8
|
-
import { register } from 'node:module'
|
|
9
|
-
|
|
10
|
-
register('./cssLoader.mjs', import.meta.url)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/adminRoutes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAShE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CACpE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAclB,iBAAS,SAAS,gCAuBjB;AAID,iBAAS,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,kBAAkB,+BAOlD;AAiDD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BArC3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;QAUzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe,EAAE,UAAU;;6BAGJ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAejD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BAjD3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;QAUzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe,EAAE,UAAU;;6BAGJ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EA2BjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nimport { useRouteTransition } from '@payloadcms/ui/providers/RouteTransition'\nimport { NotFoundClient } from '@payloadcms/ui/views/NotFound/client'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode, useDeferredValue, useEffect } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async (load: AdminLoad, splat: string, searchStr: string) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) } })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\nfunction AdminPage() {\n // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.\n // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.\n const data = useLoaderData({ strict: false })\n\n // Route state comes from an external store, so a new RSC payload that suspends\n // on code-split client references can reveal the router's null fallback.\n // Keep the current payload painted until the next one is renderable.\n const rscPayload = useDeferredValue(data?.rscPayload)\n const { holdRouteTransition } = useRouteTransition()\n const isRscPayloadDeferred = rscPayload !== data?.rscPayload\n\n useEffect(() => {\n if (!isRscPayloadDeferred) {\n return\n }\n\n const releaseRouteTransition = holdRouteTransition()\n\n return () => releaseRouteTransition()\n }, [holdRouteTransition, isRscPayloadDeferred])\n\n return <Fragment>{rscPayload}</Fragment>\n}\n\ntype AdminNotFoundData = { routeKey?: string; rscPayload?: ReactNode }\n\nfunction AdminNotFound({ data }: NotFoundRouteProps) {\n // TanStack exposes not-found data as unknown; this route only receives the shape thrown below.\n const { routeKey, rscPayload } = (data ?? {}) as AdminNotFoundData\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={routeKey}>{rscPayload}</Fragment>\n}\n\nconst adminRouteOptions = ({\n forwardNotFoundPayload,\n load,\n resolveSplat,\n}: {\n /**\n * Ships the server-rendered NotFound tree through `notFound()`'s `data` so a\n * `notFoundComponent` can render it with the full admin chrome. Routes without\n * one throw bare.\n */\n forwardNotFoundPayload: boolean\n load: AdminLoad\n /** The route's splat, i.e. the path after `/admin/`. */\n resolveSplat: (params: any) => string\n}) => ({\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // Both admin routes must use the same boundary type so index ↔ splat\n // navigation preserves the existing admin subtree.\n notFoundComponent: AdminNotFound,\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({ location, params }: { location: any; params: any }) => {\n const data = await runLoader(load, resolveSplat(params), location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound(\n forwardNotFoundPayload\n ? { data: { routeKey: data.routeKey, rscPayload: data.rscPayload } }\n : undefined,\n )\n }\n return data\n },\n staleReloadMode: 'blocking' as const,\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n})\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: true,\n load,\n resolveSplat: (params) => params._splat ?? '',\n })\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Not-found\n * results omit the RSC payload and fall back to `NotFoundClient`.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: false,\n load,\n resolveSplat: () => '',\n })\n}\n"],"names":["useRouteTransition","NotFoundClient","notFound","redirect","useLoaderData","Fragment","useDeferredValue","useEffect","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","holdRouteTransition","isRscPayloadDeferred","releaseRouteTransition","AdminNotFound","routeKey","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","notFoundComponent","loader","handler","location","params","_notFound","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","payloadAdminIndexRoute"],"mappings":"AAAA;;AAIA,SAASA,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB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;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAA;CAC1C,GAAG,MAAM,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,CAcnF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/apiRoute.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\ntype ApiRouteHandler = (ctx: { request: Request }) => Promise<Response>\n\n/**\n * Builds the method handlers for the Payload REST/GraphQL catch-all\n * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`\n * import) since the package cannot resolve the consumer's config.\n *\n * Imported from `@payloadcms/tanstack-start/server` (not the root barrel) so\n * the server-only `handleAPIRoute` graph never reaches the client bundle.\n *\n * Spread the result into a literal `server.handlers` key so TanStack Start's\n * client compiler can statically see — and prune — the server-only route:\n *\n * ```ts\n * import { payloadApiHandlers } from '@payloadcms/tanstack-start/server'\n *\n * export const Route = createFileRoute('/_payload/api/$')({\n * server: {\n * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),\n * },\n * })\n * ```\n *\n * The compiler only strips a literal `server:` key from a route-options object\n * expression; wrapping the whole options object in a factory call hides the\n * key, leaking the config graph into the client bundle.\n */\nexport function payloadApiHandlers({\n getConfig,\n}: {\n getConfig: () => Promise<SanitizedConfig>\n}): Record<'DELETE' | 'GET' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT', ApiRouteHandler> {\n const handler: ApiRouteHandler = async ({ request }) => {\n const { handleAPIRoute } = await import('../utilities/handleAPIRoute.server.js')\n return handleAPIRoute({ config: await getConfig(), request })\n }\n\n return {\n DELETE: handler,\n GET: handler,\n OPTIONS: handler,\n PATCH: handler,\n POST: handler,\n PUT: handler,\n }\n}\n"],"names":["payloadApiHandlers","getConfig","handler","request","handleAPIRoute","config","DELETE","GET","OPTIONS","PATCH","POST","PUT"],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GACD,OAAO,SAASA,mBAAmB,EACjCC,SAAS,EAGV;IACC,MAAMC,UAA2B,OAAO,EAAEC,OAAO,EAAE;QACjD,MAAM,EAAEC,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC;QACxC,OAAOA,eAAe;YAAEC,QAAQ,MAAMJ;YAAaE;QAAQ;IAC7D;IAEA,OAAO;QACLG,QAAQJ;QACRK,KAAKL;QACLM,SAASN;QACTO,OAAOP;QACPQ,MAAMR;QACNS,KAAKT;IACP;AACF"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react';
|
|
2
|
-
import { RootProvider } from '@payloadcms/ui/providers/Root';
|
|
3
|
-
import type { LoadLayoutDataResult } from '../utilities/loadLayoutData.js';
|
|
4
|
-
/**
|
|
5
|
-
* Loader supplied by the app — a TanStack Start `createServerFn` that delegates
|
|
6
|
-
* to `loadLayoutData`. Typed loosely because the server-fn's call signature is
|
|
7
|
-
* generated by the Start compiler.
|
|
8
|
-
*/
|
|
9
|
-
export type LayoutLoad = () => Promise<LoadLayoutDataResult>;
|
|
10
|
-
/**
|
|
11
|
-
* Route options for the Payload admin layout (`/_payload`). Maps the layout
|
|
12
|
-
* loader data onto `RootProvider` and renders the admin chrome (progress bar,
|
|
13
|
-
* custom-provider tree or router `<Outlet />`, portal mount). The app supplies
|
|
14
|
-
* `load` (the layout-data server fn) and `serverFunction` (the server-function
|
|
15
|
-
* client wired into `RootProvider`); everything else is adapter-owned.
|
|
16
|
-
*/
|
|
17
|
-
export declare function payloadLayoutRoute({ load, serverFunction, }: {
|
|
18
|
-
load: LayoutLoad;
|
|
19
|
-
serverFunction: ComponentProps<typeof RootProvider>['serverFunction'];
|
|
20
|
-
}): {
|
|
21
|
-
component: () => import("react").JSX.Element;
|
|
22
|
-
loader: {
|
|
23
|
-
handler: () => Promise<import("../utilities/toSerializable.js").SerializableRecord>;
|
|
24
|
-
staleReloadMode: 'blocking';
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=layoutRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layoutRoute.d.ts","sourceRoot":"","sources":["../../src/routes/layoutRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAI5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAI1E;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAE5D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,cAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACtE;IAsCG,SAAS;IACT,MAAM;QAAI,OAAO;QAAgB,eAAe,EAAE,UAAU;;EAE/D"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { RootProvider } from '@payloadcms/ui/providers/Root';
|
|
4
|
-
import { ProgressBar } from '@payloadcms/ui/providers/RouteTransition/ProgressBar';
|
|
5
|
-
import { Outlet, useLoaderData } from '@tanstack/react-router';
|
|
6
|
-
import { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
|
|
7
|
-
/**
|
|
8
|
-
* Route options for the Payload admin layout (`/_payload`). Maps the layout
|
|
9
|
-
* loader data onto `RootProvider` and renders the admin chrome (progress bar,
|
|
10
|
-
* custom-provider tree or router `<Outlet />`, portal mount). The app supplies
|
|
11
|
-
* `load` (the layout-data server fn) and `serverFunction` (the server-function
|
|
12
|
-
* client wired into `RootProvider`); everything else is adapter-owned.
|
|
13
|
-
*/ export function payloadLayoutRoute({ load, serverFunction }) {
|
|
14
|
-
function PayloadLayout() {
|
|
15
|
-
const data = useLoaderData({
|
|
16
|
-
strict: false
|
|
17
|
-
});
|
|
18
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
19
|
-
children: [
|
|
20
|
-
/*#__PURE__*/ _jsxs(RootProvider, {
|
|
21
|
-
config: data.clientConfig,
|
|
22
|
-
dateFNSKey: data.dateFNSKey,
|
|
23
|
-
embed: data.isEmbedded,
|
|
24
|
-
fallbackLang: data.fallbackLang,
|
|
25
|
-
highContrastMode: false,
|
|
26
|
-
isNavOpen: data.isNavOpen,
|
|
27
|
-
languageCode: data.languageCode,
|
|
28
|
-
languageOptions: data.languageOptions,
|
|
29
|
-
locale: data.locale,
|
|
30
|
-
permissions: data.user ? data.permissions : null,
|
|
31
|
-
RouterAdapter: TanStackRouterAdapter,
|
|
32
|
-
serverFunction: serverFunction,
|
|
33
|
-
theme: data.theme,
|
|
34
|
-
translations: data.translations,
|
|
35
|
-
user: data.user,
|
|
36
|
-
children: [
|
|
37
|
-
/*#__PURE__*/ _jsx(ProgressBar, {}),
|
|
38
|
-
data.providers ?? /*#__PURE__*/ _jsx(Outlet, {})
|
|
39
|
-
]
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ _jsx("div", {
|
|
42
|
-
id: "portal"
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
// `staleReloadMode` lives on the loader *object* — router-core only reads it
|
|
48
|
-
// off a non-function loader — so stale-match revalidation blocks on the fresh
|
|
49
|
-
// loader instead of flashing stale layout data via the default background SWR.
|
|
50
|
-
return {
|
|
51
|
-
component: PayloadLayout,
|
|
52
|
-
loader: {
|
|
53
|
-
handler: ()=>load(),
|
|
54
|
-
staleReloadMode: 'blocking'
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=layoutRoute.js.map
|