@payloadcms/tanstack-start 4.0.0-internal.43ccea7 → 4.0.0-internal.44ac9c8
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/auth/login.d.ts +3 -16
- package/dist/auth/login.d.ts.map +1 -1
- package/dist/auth/login.js +6 -46
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.d.ts +2 -5
- package/dist/auth/logout.d.ts.map +1 -1
- package/dist/auth/logout.js +6 -47
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.d.ts +2 -4
- package/dist/auth/refresh.d.ts.map +1 -1
- package/dist/auth/refresh.js +6 -49
- package/dist/auth/refresh.js.map +1 -1
- package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
- package/dist/elements/RouterAdapter/index.js +18 -3
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -3
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -3
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +2 -4
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +0 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/rsc.browser.d.ts +4 -1
- package/dist/exports/rsc.browser.d.ts.map +1 -1
- package/dist/exports/rsc.browser.js +4 -1
- package/dist/exports/rsc.browser.js.map +1 -1
- package/dist/exports/rsc.d.ts +0 -1
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +0 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/server.d.ts +4 -6
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +3 -5
- package/dist/exports/server.js.map +1 -1
- package/dist/exports/shared.d.ts +2 -0
- package/dist/exports/shared.d.ts.map +1 -0
- package/dist/exports/shared.js +3 -0
- package/dist/exports/shared.js.map +1 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts +24 -2
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +12 -6
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +7 -31
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.js +33 -34
- package/dist/layouts/Root/withPayloadRoot.js.map +1 -1
- package/dist/node/cssLoader.d.mts +24 -2
- package/dist/node/cssLoader.d.mts.map +1 -1
- package/dist/routes/adminRoutes.d.ts +10 -13
- package/dist/routes/adminRoutes.d.ts.map +1 -1
- package/dist/routes/adminRoutes.js +53 -45
- package/dist/routes/adminRoutes.js.map +1 -1
- package/dist/routes/apiRoute.d.ts +5 -0
- package/dist/routes/apiRoute.d.ts.map +1 -1
- package/dist/routes/apiRoute.js +6 -1
- package/dist/routes/apiRoute.js.map +1 -1
- package/dist/routes/layoutRoute.d.ts +5 -4
- package/dist/routes/layoutRoute.d.ts.map +1 -1
- package/dist/routes/layoutRoute.js +3 -1
- package/dist/routes/layoutRoute.js.map +1 -1
- package/dist/utilities/devConfigReload.server.d.ts +2 -0
- package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
- package/dist/utilities/devConfigReload.server.js +38 -0
- package/dist/utilities/devConfigReload.server.js.map +1 -0
- package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
- package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
- package/dist/utilities/devConfigReloadEvent.js +9 -0
- package/dist/utilities/devConfigReloadEvent.js.map +1 -0
- package/dist/utilities/getRequestI18n.server.d.ts +1 -1
- package/dist/utilities/getRequestI18n.server.js +1 -1
- package/dist/utilities/getRequestI18n.server.js.map +1 -1
- package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
- package/dist/utilities/graphqlHandler.server.js +2 -2
- package/dist/utilities/graphqlHandler.server.js.map +1 -1
- package/dist/utilities/{handleAPIRoute.d.ts → handleAPIRoute.server.d.ts} +1 -1
- package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
- package/dist/utilities/{handleAPIRoute.js → handleAPIRoute.server.js} +1 -1
- package/dist/utilities/handleAPIRoute.server.js.map +1 -0
- package/dist/utilities/handleServerFunctions.d.ts +1 -19
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +6 -57
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/initAdminContext.server.d.ts +9 -0
- package/dist/utilities/initAdminContext.server.d.ts.map +1 -0
- package/dist/utilities/initAdminContext.server.js +13 -0
- package/dist/utilities/initAdminContext.server.js.map +1 -0
- package/dist/utilities/loadAdminPage.d.ts +7 -4
- package/dist/utilities/loadAdminPage.d.ts.map +1 -1
- package/dist/utilities/loadAdminPage.js +19 -22
- package/dist/utilities/loadAdminPage.js.map +1 -1
- package/dist/utilities/loadLayoutData.d.ts +3 -1
- package/dist/utilities/loadLayoutData.d.ts.map +1 -1
- package/dist/utilities/loadLayoutData.js +2 -3
- package/dist/utilities/loadLayoutData.js.map +1 -1
- package/dist/utilities/meta.d.ts +1 -0
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +2 -1
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/routerSearch.d.ts +40 -0
- package/dist/utilities/routerSearch.d.ts.map +1 -0
- package/dist/utilities/routerSearch.js +45 -0
- package/dist/utilities/routerSearch.js.map +1 -0
- package/dist/utilities/serializeForRsc.d.ts.map +1 -1
- package/dist/utilities/serializeForRsc.js +6 -1
- package/dist/utilities/serializeForRsc.js.map +1 -1
- package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
- package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
- package/dist/utilities/serverFunctionClient.js +6 -1
- package/dist/utilities/serverFunctionClient.js.map +1 -1
- package/dist/utilities/toSerializable.d.ts +9 -0
- package/dist/utilities/toSerializable.d.ts.map +1 -1
- package/dist/utilities/toSerializable.js +19 -3
- package/dist/utilities/toSerializable.js.map +1 -1
- package/dist/withPayload/config/external.d.ts +44 -0
- package/dist/withPayload/config/external.d.ts.map +1 -0
- package/dist/withPayload/config/external.js +96 -0
- package/dist/withPayload/config/external.js.map +1 -0
- package/dist/withPayload/config/optimizeDeps.d.ts +25 -0
- package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
- package/dist/{vite/constants.js → withPayload/config/optimizeDeps.js} +36 -70
- package/dist/withPayload/config/optimizeDeps.js.map +1 -0
- package/dist/withPayload/config/scss.d.ts +14 -0
- package/dist/withPayload/config/scss.d.ts.map +1 -0
- package/dist/withPayload/config/scss.js +28 -0
- package/dist/withPayload/config/scss.js.map +1 -0
- package/dist/withPayload/devConfigReload.d.ts +14 -0
- package/dist/withPayload/devConfigReload.d.ts.map +1 -0
- package/dist/withPayload/devConfigReload.js +84 -0
- package/dist/withPayload/devConfigReload.js.map +1 -0
- package/dist/withPayload/importProtection.d.ts.map +1 -0
- package/dist/{vite → withPayload}/importProtection.js +2 -2
- package/dist/withPayload/importProtection.js.map +1 -0
- package/dist/withPayload/index.d.ts +118 -0
- package/dist/withPayload/index.d.ts.map +1 -0
- package/dist/withPayload/index.js +308 -0
- package/dist/withPayload/index.js.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
- package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.js +5 -0
- package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
- package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.js +1 -1
- package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
- package/package.json +20 -14
- package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
- package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
- package/dist/elements/DocumentHeaderClient/index.js +0 -116
- package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
- package/dist/elements/RenderComponent/index.d.ts +0 -10
- package/dist/elements/RenderComponent/index.d.ts.map +0 -1
- package/dist/elements/RenderComponent/index.js +0 -12
- package/dist/elements/RenderComponent/index.js.map +0 -1
- package/dist/exports/vite.d.ts +0 -3
- package/dist/exports/vite.d.ts.map +0 -1
- package/dist/exports/vite.js +0 -3
- package/dist/exports/vite.js.map +0 -1
- package/dist/layouts/Root/index.d.ts +0 -32
- package/dist/layouts/Root/index.d.ts.map +0 -1
- package/dist/layouts/Root/index.js +0 -51
- package/dist/layouts/Root/index.js.map +0 -1
- package/dist/rsc/renderPayloadRSC.d.ts +0 -6
- package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
- package/dist/rsc/renderPayloadRSC.js +0 -6
- package/dist/rsc/renderPayloadRSC.js.map +0 -1
- package/dist/utilities/devReloadStrategy.d.ts +0 -10
- package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
- package/dist/utilities/devReloadStrategy.js +0 -27
- package/dist/utilities/devReloadStrategy.js.map +0 -1
- package/dist/utilities/getExistingAuthToken.d.ts +0 -7
- package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
- package/dist/utilities/getExistingAuthToken.js +0 -18
- package/dist/utilities/getExistingAuthToken.js.map +0 -1
- package/dist/utilities/getPreferences.d.ts +0 -10
- package/dist/utilities/getPreferences.d.ts.map +0 -1
- package/dist/utilities/getPreferences.js +0 -33
- package/dist/utilities/getPreferences.js.map +0 -1
- package/dist/utilities/getRequestLocale.d.ts +0 -7
- package/dist/utilities/getRequestLocale.d.ts.map +0 -1
- package/dist/utilities/getRequestLocale.js +0 -20
- package/dist/utilities/getRequestLocale.js.map +0 -1
- package/dist/utilities/getRequestTheme.d.ts +0 -10
- package/dist/utilities/getRequestTheme.d.ts.map +0 -1
- package/dist/utilities/getRequestTheme.js +0 -25
- package/dist/utilities/getRequestTheme.js.map +0 -1
- package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
- package/dist/utilities/handleAPIRoute.js.map +0 -1
- package/dist/utilities/importMap.server.d.ts +0 -8
- package/dist/utilities/importMap.server.d.ts.map +0 -1
- package/dist/utilities/importMap.server.js +0 -11
- package/dist/utilities/importMap.server.js.map +0 -1
- package/dist/utilities/initReq.server.d.ts +0 -19
- package/dist/utilities/initReq.server.d.ts.map +0 -1
- package/dist/utilities/initReq.server.js +0 -87
- package/dist/utilities/initReq.server.js.map +0 -1
- package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
- package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
- package/dist/utilities/serverFunctionHandlers.js +0 -17
- package/dist/utilities/serverFunctionHandlers.js.map +0 -1
- package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
- package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
- package/dist/utilities/setPayloadAuthCookie.js +0 -31
- package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
- package/dist/vite/constants.d.ts +0 -42
- package/dist/vite/constants.d.ts.map +0 -1
- package/dist/vite/constants.js.map +0 -1
- package/dist/vite/importProtection.d.ts.map +0 -1
- package/dist/vite/importProtection.js.map +0 -1
- package/dist/vite/plugin.d.ts +0 -38
- package/dist/vite/plugin.d.ts.map +0 -1
- package/dist/vite/plugin.js +0 -177
- package/dist/vite/plugin.js.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
- package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
- package/dist/vite/plugins/devTransforms.js.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
- /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.js +0 -0
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Import `RenderServerComponent` from `@payloadcms/ui/elements/RenderServerComponent` directly.
|
|
3
|
-
* This re-export will be removed in a future major version.
|
|
4
|
-
*/ export { RenderServerComponent as RenderRSCComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=renderPayloadRSC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rsc/renderPayloadRSC.tsx"],"sourcesContent":["/**\n * @deprecated Import `RenderServerComponent` from `@payloadcms/ui/elements/RenderServerComponent` directly.\n * This re-export will be removed in a future major version.\n */\nexport { RenderServerComponent as RenderRSCComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n"],"names":["RenderServerComponent","RenderRSCComponent"],"mappings":"AAAA;;;CAGC,GACD,SAASA,yBAAyBC,kBAAkB,QAAQ,gDAA+C"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DevReloadStrategy } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Dev reload strategy for Vite (used by TanStack Start).
|
|
4
|
-
*
|
|
5
|
-
* Connects to Vite's HMR WebSocket and triggers a callback on full reloads.
|
|
6
|
-
* In development, Vite sends HMR updates over a WebSocket connection at
|
|
7
|
-
* the configured HMR path (defaults to root).
|
|
8
|
-
*/
|
|
9
|
-
export declare const viteDevReloadStrategy: DevReloadStrategy;
|
|
10
|
-
//# sourceMappingURL=devReloadStrategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devReloadStrategy.d.ts","sourceRoot":"","sources":["../../src/utilities/devReloadStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAuBnC,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev reload strategy for Vite (used by TanStack Start).
|
|
3
|
-
*
|
|
4
|
-
* Connects to Vite's HMR WebSocket and triggers a callback on full reloads.
|
|
5
|
-
* In development, Vite sends HMR updates over a WebSocket connection at
|
|
6
|
-
* the configured HMR path (defaults to root).
|
|
7
|
-
*/ export const viteDevReloadStrategy = {
|
|
8
|
-
connect: (onReload)=>{
|
|
9
|
-
if (typeof window === 'undefined') {
|
|
10
|
-
return ()=>{};
|
|
11
|
-
}
|
|
12
|
-
// Vite injects import.meta.hot in development builds
|
|
13
|
-
const hot = import.meta.hot;
|
|
14
|
-
if (!hot) {
|
|
15
|
-
return ()=>{};
|
|
16
|
-
}
|
|
17
|
-
const handleUpdate = ()=>{
|
|
18
|
-
onReload();
|
|
19
|
-
};
|
|
20
|
-
hot.on('vite:beforeFullReload', handleUpdate);
|
|
21
|
-
return ()=>{
|
|
22
|
-
hot.off('vite:beforeFullReload', handleUpdate);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=devReloadStrategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/devReloadStrategy.ts"],"sourcesContent":["import type { DevReloadStrategy } from 'payload'\n\n/**\n * Dev reload strategy for Vite (used by TanStack Start).\n *\n * Connects to Vite's HMR WebSocket and triggers a callback on full reloads.\n * In development, Vite sends HMR updates over a WebSocket connection at\n * the configured HMR path (defaults to root).\n */\nexport const viteDevReloadStrategy: DevReloadStrategy = {\n connect: (onReload) => {\n if (typeof window === 'undefined') {\n return () => {}\n }\n\n // Vite injects import.meta.hot in development builds\n const hot = (import.meta as unknown as { hot?: ViteHotContext }).hot\n\n if (!hot) {\n return () => {}\n }\n\n const handleUpdate = () => {\n onReload()\n }\n\n hot.on('vite:beforeFullReload', handleUpdate)\n\n return () => {\n hot.off('vite:beforeFullReload', handleUpdate)\n }\n },\n}\n\ntype ViteHotContext = {\n off: (event: string, cb: () => void) => void\n on: (event: string, cb: () => void) => void\n}\n"],"names":["viteDevReloadStrategy","connect","onReload","window","hot","handleUpdate","on","off"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,MAAMA,wBAA2C;IACtDC,SAAS,CAACC;QACR,IAAI,OAAOC,WAAW,aAAa;YACjC,OAAO,KAAO;QAChB;QAEA,qDAAqD;QACrD,MAAMC,MAAM,AAAC,YAAoDA,GAAG;QAEpE,IAAI,CAACA,KAAK;YACR,OAAO,KAAO;QAChB;QAEA,MAAMC,eAAe;YACnBH;QACF;QAEAE,IAAIE,EAAE,CAAC,yBAAyBD;QAEhC,OAAO;YACLD,IAAIG,GAAG,CAAC,yBAAyBF;QACnC;IACF;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getExistingAuthToken.d.ts","sourceRoot":"","sources":["../../src/utilities/getExistingAuthToken.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY7E"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getRequest } from '@tanstack/react-start/server';
|
|
2
|
-
import { parseCookies } from 'payload';
|
|
3
|
-
export function getExistingAuthToken(cookiePrefix) {
|
|
4
|
-
const request = getRequest();
|
|
5
|
-
const headers = new Headers(request.headers);
|
|
6
|
-
const cookies = parseCookies(headers);
|
|
7
|
-
for (const [name, value] of cookies.entries()){
|
|
8
|
-
if (name.startsWith(cookiePrefix)) {
|
|
9
|
-
return {
|
|
10
|
-
name,
|
|
11
|
-
value
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=getExistingAuthToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getExistingAuthToken.ts"],"sourcesContent":["import { getRequest } from '@tanstack/react-start/server'\nimport { parseCookies } from 'payload'\n\ntype Cookie = {\n name: string\n value: string\n}\n\nexport function getExistingAuthToken(cookiePrefix: string): Cookie | undefined {\n const request = getRequest()\n const headers = new Headers(request.headers)\n const cookies = parseCookies(headers)\n\n for (const [name, value] of cookies.entries()) {\n if (name.startsWith(cookiePrefix)) {\n return { name, value }\n }\n }\n\n return undefined\n}\n"],"names":["getRequest","parseCookies","getExistingAuthToken","cookiePrefix","request","headers","Headers","cookies","name","value","entries","startsWith","undefined"],"mappings":"AAAA,SAASA,UAAU,QAAQ,+BAA8B;AACzD,SAASC,YAAY,QAAQ,UAAS;AAOtC,OAAO,SAASC,qBAAqBC,YAAoB;IACvD,MAAMC,UAAUJ;IAChB,MAAMK,UAAU,IAAIC,QAAQF,QAAQC,OAAO;IAC3C,MAAME,UAAUN,aAAaI;IAE7B,KAAK,MAAM,CAACG,MAAMC,MAAM,IAAIF,QAAQG,OAAO,GAAI;QAC7C,IAAIF,KAAKG,UAAU,CAACR,eAAe;YACjC,OAAO;gBAAEK;gBAAMC;YAAM;QACvB;IACF;IAEA,OAAOG;AACT"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DefaultDocumentIDType, Payload } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches a user's preference by key. Unlike the Next.js version, this does not
|
|
4
|
-
* use `React.cache()` since TanStack Start has no RSC request-level memoization.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getPreferences<T>(key: string, payload: Payload, userID: DefaultDocumentIDType, userSlug: string): Promise<{
|
|
7
|
-
id: DefaultDocumentIDType;
|
|
8
|
-
value: T;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=getPreferences.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPreferences.d.ts","sourceRoot":"","sources":["../../src/utilities/getPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE7D;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,EAAE,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CA8BlD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches a user's preference by key. Unlike the Next.js version, this does not
|
|
3
|
-
* use `React.cache()` since TanStack Start has no RSC request-level memoization.
|
|
4
|
-
*/ export async function getPreferences(key, payload, userID, userSlug) {
|
|
5
|
-
const result = await payload.find({
|
|
6
|
-
collection: 'payload-preferences',
|
|
7
|
-
depth: 0,
|
|
8
|
-
limit: 1,
|
|
9
|
-
pagination: false,
|
|
10
|
-
where: {
|
|
11
|
-
and: [
|
|
12
|
-
{
|
|
13
|
-
key: {
|
|
14
|
-
equals: key
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
'user.relationTo': {
|
|
19
|
-
equals: userSlug
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
'user.value': {
|
|
24
|
-
equals: userID
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}).then((res)=>res.docs?.[0]);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=getPreferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getPreferences.ts"],"sourcesContent":["import type { DefaultDocumentIDType, Payload } from 'payload'\n\n/**\n * Fetches a user's preference by key. Unlike the Next.js version, this does not\n * use `React.cache()` since TanStack Start has no RSC request-level memoization.\n */\nexport async function getPreferences<T>(\n key: string,\n payload: Payload,\n userID: DefaultDocumentIDType,\n userSlug: string,\n): Promise<{ id: DefaultDocumentIDType; value: T }> {\n const result = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n pagination: false,\n where: {\n and: [\n {\n key: {\n equals: key,\n },\n },\n {\n 'user.relationTo': {\n equals: userSlug,\n },\n },\n {\n 'user.value': {\n equals: userID,\n },\n },\n ],\n },\n })\n .then((res) => res.docs?.[0])) as { id: DefaultDocumentIDType; value: T }\n\n return result\n}\n"],"names":["getPreferences","key","payload","userID","userSlug","result","find","collection","depth","limit","pagination","where","and","equals","then","res","docs"],"mappings":"AAEA;;;CAGC,GACD,OAAO,eAAeA,eACpBC,GAAW,EACXC,OAAgB,EAChBC,MAA6B,EAC7BC,QAAgB;IAEhB,MAAMC,SAAU,MAAMH,QACnBI,IAAI,CAAC;QACJC,YAAY;QACZC,OAAO;QACPC,OAAO;QACPC,YAAY;QACZC,OAAO;YACLC,KAAK;gBACH;oBACEX,KAAK;wBACHY,QAAQZ;oBACV;gBACF;gBACA;oBACE,mBAAmB;wBACjBY,QAAQT;oBACV;gBACF;gBACA;oBACE,cAAc;wBACZS,QAAQV;oBACV;gBACF;aACD;QACH;IACF,GACCW,IAAI,CAAC,CAACC,MAAQA,IAAIC,IAAI,EAAE,CAAC,EAAE;IAE9B,OAAOX;AACT"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Locale, PayloadRequest } from 'payload';
|
|
2
|
-
type GetRequestLocaleArgs = {
|
|
3
|
-
req: PayloadRequest;
|
|
4
|
-
};
|
|
5
|
-
export declare function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=getRequestLocale.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestLocale.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAOrD,KAAK,oBAAoB,GAAG;IAC1B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,wBAAsB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkCjG"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { upsertPreferences } from '@payloadcms/ui/rsc';
|
|
2
|
-
import { findLocaleFromCode } from '@payloadcms/ui/shared';
|
|
3
|
-
import { getPreferences } from './getPreferences.js';
|
|
4
|
-
export async function getRequestLocale({ req }) {
|
|
5
|
-
if (req.payload.config.localization) {
|
|
6
|
-
const localeFromParams = req.query.locale;
|
|
7
|
-
if (req.user && localeFromParams) {
|
|
8
|
-
await upsertPreferences({
|
|
9
|
-
key: 'locale',
|
|
10
|
-
req,
|
|
11
|
-
value: localeFromParams
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
const userLocale = req.user && findLocaleFromCode(req.payload.config.localization, localeFromParams || (await getPreferences('locale', req.payload, req.user.id, req.user.collection))?.value);
|
|
15
|
-
return userLocale ?? findLocaleFromCode(req.payload.config.localization, req.payload.config.localization.defaultLocale || 'en') ?? undefined;
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=getRequestLocale.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getRequestLocale.ts"],"sourcesContent":["import type { Locale, PayloadRequest } from 'payload'\n\nimport { upsertPreferences } from '@payloadcms/ui/rsc'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\n\nimport { getPreferences } from './getPreferences.js'\n\ntype GetRequestLocaleArgs = {\n req: PayloadRequest\n}\n\nexport async function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined> {\n if (req.payload.config.localization) {\n const localeFromParams = req.query.locale as string | undefined\n\n if (req.user && localeFromParams) {\n await upsertPreferences<Locale['code']>({ key: 'locale', req, value: localeFromParams })\n }\n\n const userLocale =\n req.user &&\n findLocaleFromCode(\n req.payload.config.localization,\n localeFromParams ||\n (\n await getPreferences<Locale['code']>(\n 'locale',\n req.payload,\n req.user.id,\n req.user.collection,\n )\n )?.value,\n )\n\n return (\n userLocale ??\n findLocaleFromCode(\n req.payload.config.localization,\n req.payload.config.localization.defaultLocale || 'en',\n ) ??\n undefined\n )\n }\n\n return undefined\n}\n"],"names":["upsertPreferences","findLocaleFromCode","getPreferences","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","user","key","value","userLocale","id","collection","defaultLocale","undefined"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,qBAAoB;AACtD,SAASC,kBAAkB,QAAQ,wBAAuB;AAE1D,SAASC,cAAc,QAAQ,sBAAqB;AAMpD,OAAO,eAAeC,iBAAiB,EAAEC,GAAG,EAAwB;IAClE,IAAIA,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACnC,MAAMC,mBAAmBJ,IAAIK,KAAK,CAACC,MAAM;QAEzC,IAAIN,IAAIO,IAAI,IAAIH,kBAAkB;YAChC,MAAMR,kBAAkC;gBAAEY,KAAK;gBAAUR;gBAAKS,OAAOL;YAAiB;QACxF;QAEA,MAAMM,aACJV,IAAIO,IAAI,IACRV,mBACEG,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BC,oBAEI,CAAA,MAAMN,eACJ,UACAE,IAAIC,OAAO,EACXD,IAAIO,IAAI,CAACI,EAAE,EACXX,IAAIO,IAAI,CAACK,UAAU,CACrB,GACCH;QAGT,OACEC,cACAb,mBACEG,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BH,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,CAACU,aAAa,IAAI,SAEnDC;IAEJ;IAEA,OAAOA;AACT"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '@payloadcms/ui';
|
|
2
|
-
import type { SanitizedConfig } from 'payload';
|
|
3
|
-
type GetRequestThemeArgs = {
|
|
4
|
-
config: SanitizedConfig;
|
|
5
|
-
cookies: Map<string, string>;
|
|
6
|
-
headers: Headers;
|
|
7
|
-
};
|
|
8
|
-
export declare function getRequestTheme({ config, cookies, headers }: GetRequestThemeArgs): Theme;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getRequestTheme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestTheme.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAUD,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAkBxF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`
|
|
2
|
-
// barrel) because its value exports resolve to non-serializable client
|
|
3
|
-
// references in this adapter's RSC server context. `Theme` is a type-only
|
|
4
|
-
// import and is safely erased at runtime.
|
|
5
|
-
const defaultTheme = 'light';
|
|
6
|
-
const acceptedThemes = [
|
|
7
|
-
'dark',
|
|
8
|
-
'light'
|
|
9
|
-
];
|
|
10
|
-
export function getRequestTheme({ config, cookies, headers }) {
|
|
11
|
-
if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {
|
|
12
|
-
return config.admin.theme;
|
|
13
|
-
}
|
|
14
|
-
const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`);
|
|
15
|
-
if (themeCookie && acceptedThemes.includes(themeCookie)) {
|
|
16
|
-
return themeCookie;
|
|
17
|
-
}
|
|
18
|
-
const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme');
|
|
19
|
-
if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {
|
|
20
|
-
return themeFromHeader;
|
|
21
|
-
}
|
|
22
|
-
return defaultTheme;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=getRequestTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getRequestTheme.ts"],"sourcesContent":["import type { Theme } from '@payloadcms/ui'\nimport type { SanitizedConfig } from 'payload'\n\ntype GetRequestThemeArgs = {\n config: SanitizedConfig\n cookies: Map<string, string>\n headers: Headers\n}\n\n// Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`\n// barrel) because its value exports resolve to non-serializable client\n// references in this adapter's RSC server context. `Theme` is a type-only\n// import and is safely erased at runtime.\nconst defaultTheme: Theme = 'light'\n\nconst acceptedThemes: Theme[] = ['dark', 'light']\n\nexport function getRequestTheme({ config, cookies, headers }: GetRequestThemeArgs): Theme {\n if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {\n return config.admin.theme\n }\n\n const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`)\n\n if (themeCookie && acceptedThemes.includes(themeCookie as Theme)) {\n return themeCookie as Theme\n }\n\n const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme') as Theme\n\n if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {\n return themeFromHeader\n }\n\n return defaultTheme\n}\n"],"names":["defaultTheme","acceptedThemes","getRequestTheme","config","cookies","headers","admin","theme","includes","themeCookie","get","cookiePrefix","themeFromHeader"],"mappings":"AASA,+EAA+E;AAC/E,uEAAuE;AACvE,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAMA,eAAsB;AAE5B,MAAMC,iBAA0B;IAAC;IAAQ;CAAQ;AAEjD,OAAO,SAASC,gBAAgB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAuB;IAC/E,IAAIF,OAAOG,KAAK,CAACC,KAAK,KAAK,SAASN,eAAeO,QAAQ,CAACL,OAAOG,KAAK,CAACC,KAAK,GAAG;QAC/E,OAAOJ,OAAOG,KAAK,CAACC,KAAK;IAC3B;IAEA,MAAME,cAAcL,QAAQM,GAAG,CAAC,GAAGP,OAAOQ,YAAY,IAAI,UAAU,MAAM,CAAC;IAE3E,IAAIF,eAAeR,eAAeO,QAAQ,CAACC,cAAuB;QAChE,OAAOA;IACT;IAEA,MAAMG,kBAAkBP,QAAQK,GAAG,CAAC;IAEpC,IAAIE,mBAAmBX,eAAeO,QAAQ,CAACI,kBAAkB;QAC/D,OAAOA;IACT;IAEA,OAAOZ;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleAPIRoute.d.ts","sourceRoot":"","sources":["../../src/utilities/handleAPIRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAapB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/handleAPIRoute.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { handleEndpoints } from 'payload'\n\n/**\n * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL\n * endpoint handler. The framework adapter wires this into the `/api/$` route's\n * server handlers, supplying the app's resolved `config`.\n */\nexport async function handleAPIRoute({\n config,\n request,\n}: {\n config: SanitizedConfig\n request: Request\n}): Promise<Response> {\n const url = new URL(request.url)\n const slugParts = url.pathname\n .replace(/^\\/api\\/?/, '')\n .split('/')\n .filter(Boolean)\n const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api'\n\n return handleEndpoints({\n config,\n path,\n request,\n })\n}\n"],"names":["handleEndpoints","handleAPIRoute","config","request","url","URL","slugParts","pathname","replace","split","filter","Boolean","path","length","join"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAEzC;;;;CAIC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,OAAO,EAIR;IACC,MAAMC,MAAM,IAAIC,IAAIF,QAAQC,GAAG;IAC/B,MAAME,YAAYF,IAAIG,QAAQ,CAC3BC,OAAO,CAAC,aAAa,IACrBC,KAAK,CAAC,KACNC,MAAM,CAACC;IACV,MAAMC,OAAON,UAAUO,MAAM,GAAG,CAAC,KAAK,EAAEP,UAAUQ,IAAI,CAAC,MAAM,GAAG;IAEhE,OAAOd,gBAAgB;QACrBE;QACAU;QACAT;IACF;AACF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the default output path for the generated import map file in a
|
|
3
|
-
* TanStack Start project. Matches the `app/_payload/` convention that Payload's
|
|
4
|
-
* import map auto-discovery probes, so the file is found without a custom
|
|
5
|
-
* `admin.importMap.importMapFile` override.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getImportMapOutputPath(rootDir?: string): string;
|
|
8
|
-
//# sourceMappingURL=importMap.server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importMap.server.d.ts","sourceRoot":"","sources":["../../src/utilities/importMap.server.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the default output path for the generated import map file in a
|
|
4
|
-
* TanStack Start project. Matches the `app/_payload/` convention that Payload's
|
|
5
|
-
* import map auto-discovery probes, so the file is found without a custom
|
|
6
|
-
* `admin.importMap.importMapFile` override.
|
|
7
|
-
*/ export function getImportMapOutputPath(rootDir) {
|
|
8
|
-
return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=importMap.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/importMap.server.ts"],"sourcesContent":["import path from 'node:path'\n\n/**\n * Returns the default output path for the generated import map file in a\n * TanStack Start project. Matches the `app/_payload/` convention that Payload's\n * import map auto-discovery probes, so the file is found without a custom\n * `admin.importMap.importMapFile` override.\n */\nexport function getImportMapOutputPath(rootDir?: string): string {\n return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js')\n}\n"],"names":["path","getImportMapOutputPath","rootDir","resolve","process","cwd"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B;;;;;CAKC,GACD,OAAO,SAASC,uBAAuBC,OAAgB;IACrD,OAAOF,KAAKG,OAAO,CAACD,WAAWE,QAAQC,GAAG,IAAI,OAAO,YAAY;AACnE"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ImportMap, InitReqResult, SanitizedConfig, ServerAdapter } from 'payload';
|
|
2
|
-
import { createLocalReq } from 'payload';
|
|
3
|
-
/**
|
|
4
|
-
* Initializes a Payload request object from the current TanStack Start server context.
|
|
5
|
-
* Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.
|
|
6
|
-
*/
|
|
7
|
-
export declare function initReq({ configPromise, importMap, overrides, serverAdapter, }: {
|
|
8
|
-
configPromise: Promise<SanitizedConfig> | SanitizedConfig;
|
|
9
|
-
importMap: ImportMap;
|
|
10
|
-
overrides?: Parameters<typeof createLocalReq>[0];
|
|
11
|
-
/**
|
|
12
|
-
* `ServerAdapter` attached to `req.server`. Defaults to the native
|
|
13
|
-
* `tanstackServerAdapter` (throws TanStack `redirect`/`notFound`). The admin
|
|
14
|
-
* page render passes an error-contract adapter so navigation thrown mid-render
|
|
15
|
-
* is caught at the loader boundary and re-thrown as native TanStack nav.
|
|
16
|
-
*/
|
|
17
|
-
serverAdapter?: ServerAdapter;
|
|
18
|
-
}): Promise<InitReqResult>;
|
|
19
|
-
//# sourceMappingURL=initReq.server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initReq.server.d.ts","sourceRoot":"","sources":["../../src/utilities/initReq.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAIvF,OAAO,EACL,cAAc,EAMf,MAAM,SAAS,CAAA;AAMhB;;;GAGG;AACH,wBAAsB,OAAO,CAAC,EAC5B,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAqC,GACtC,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,OAAO,CAAC,aAAa,CAAC,CAkFzB"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { initI18n } from '@payloadcms/translations';
|
|
2
|
-
import { getRequest } from '@tanstack/react-start/server';
|
|
3
|
-
import { createLocalReq, executeAuthStrategies, getAccessResults, getPayload, getRequestLanguage, parseCookies } from 'payload';
|
|
4
|
-
import * as qs from 'qs-esm';
|
|
5
|
-
import { getRequestLocale } from './getRequestLocale.js';
|
|
6
|
-
import { tanstackServerAdapter } from './serverAdapter.server.js';
|
|
7
|
-
/**
|
|
8
|
-
* Initializes a Payload request object from the current TanStack Start server context.
|
|
9
|
-
* Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.
|
|
10
|
-
*/ export async function initReq({ configPromise, importMap, overrides, serverAdapter = tanstackServerAdapter }) {
|
|
11
|
-
const webRequest = getRequest();
|
|
12
|
-
const headers = new Headers(webRequest.headers);
|
|
13
|
-
const cookies = parseCookies(headers);
|
|
14
|
-
const config = await configPromise;
|
|
15
|
-
const payload = await getPayload({
|
|
16
|
-
config,
|
|
17
|
-
importMap
|
|
18
|
-
});
|
|
19
|
-
const languageCode = getRequestLanguage({
|
|
20
|
-
config,
|
|
21
|
-
cookies,
|
|
22
|
-
headers
|
|
23
|
-
});
|
|
24
|
-
const i18n = await initI18n({
|
|
25
|
-
config: config.i18n,
|
|
26
|
-
context: 'client',
|
|
27
|
-
language: languageCode
|
|
28
|
-
});
|
|
29
|
-
const { responseHeaders, user } = await executeAuthStrategies({
|
|
30
|
-
headers,
|
|
31
|
-
payload
|
|
32
|
-
});
|
|
33
|
-
const { req: reqOverrides, ...optionsOverrides } = overrides || {};
|
|
34
|
-
// Parse the active URL's query string so that `req.query` (and thus
|
|
35
|
-
// `getRequestLocale`, access checks, etc.) reflect things like `?locale=es`
|
|
36
|
-
// even when the caller (e.g. the root layout loader) hasn't explicitly
|
|
37
|
-
// forwarded `searchParams` via overrides. `createLocalReq` only defaults
|
|
38
|
-
// `req.query` to `{}` and never reads the request URL itself.
|
|
39
|
-
let queryFromUrl;
|
|
40
|
-
try {
|
|
41
|
-
const urlObject = new URL(webRequest.url);
|
|
42
|
-
if (urlObject.search) {
|
|
43
|
-
queryFromUrl = qs.parse(urlObject.search, {
|
|
44
|
-
depth: 10,
|
|
45
|
-
ignoreQueryPrefix: true
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
} catch {
|
|
49
|
-
queryFromUrl = undefined;
|
|
50
|
-
}
|
|
51
|
-
const req = await createLocalReq({
|
|
52
|
-
req: {
|
|
53
|
-
headers,
|
|
54
|
-
host: headers.get('host') ?? undefined,
|
|
55
|
-
i18n: i18n,
|
|
56
|
-
query: queryFromUrl,
|
|
57
|
-
responseHeaders,
|
|
58
|
-
// Expose the `ServerAdapter` so framework-agnostic server functions can
|
|
59
|
-
// set cookies / redirect via `req.server` (mirrors the Next.js adapter,
|
|
60
|
-
// which passes `nextServerAdapter`). Required by handlers like
|
|
61
|
-
// `switch-language`. Defaults to the native adapter; the page render
|
|
62
|
-
// overrides it with the error-contract adapter.
|
|
63
|
-
server: serverAdapter,
|
|
64
|
-
url: webRequest.url,
|
|
65
|
-
user,
|
|
66
|
-
...reqOverrides || {}
|
|
67
|
-
},
|
|
68
|
-
...optionsOverrides || {}
|
|
69
|
-
}, payload);
|
|
70
|
-
const locale = await getRequestLocale({
|
|
71
|
-
req
|
|
72
|
-
});
|
|
73
|
-
req.locale = locale?.code;
|
|
74
|
-
const permissions = await getAccessResults({
|
|
75
|
-
req
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
cookies,
|
|
79
|
-
headers,
|
|
80
|
-
languageCode,
|
|
81
|
-
locale,
|
|
82
|
-
permissions,
|
|
83
|
-
req
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=initReq.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/initReq.server.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { ImportMap, InitReqResult, SanitizedConfig, ServerAdapter } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { getRequest } from '@tanstack/react-start/server'\nimport {\n createLocalReq,\n executeAuthStrategies,\n getAccessResults,\n getPayload,\n getRequestLanguage,\n parseCookies,\n} from 'payload'\nimport * as qs from 'qs-esm'\n\nimport { getRequestLocale } from './getRequestLocale.js'\nimport { tanstackServerAdapter } from './serverAdapter.server.js'\n\n/**\n * Initializes a Payload request object from the current TanStack Start server context.\n * Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.\n */\nexport async function initReq({\n configPromise,\n importMap,\n overrides,\n serverAdapter = tanstackServerAdapter,\n}: {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n overrides?: Parameters<typeof createLocalReq>[0]\n /**\n * `ServerAdapter` attached to `req.server`. Defaults to the native\n * `tanstackServerAdapter` (throws TanStack `redirect`/`notFound`). The admin\n * page render passes an error-contract adapter so navigation thrown mid-render\n * is caught at the loader boundary and re-thrown as native TanStack nav.\n */\n serverAdapter?: ServerAdapter\n}): Promise<InitReqResult> {\n const webRequest = getRequest()\n const headers = new Headers(webRequest.headers)\n const cookies = parseCookies(headers)\n\n const config = await configPromise\n const payload = await getPayload({ config, importMap })\n\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const i18n: I18nClient = await initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n\n const { responseHeaders, user } = await executeAuthStrategies({\n headers,\n payload,\n })\n\n const { req: reqOverrides, ...optionsOverrides } = overrides || {}\n\n // Parse the active URL's query string so that `req.query` (and thus\n // `getRequestLocale`, access checks, etc.) reflect things like `?locale=es`\n // even when the caller (e.g. the root layout loader) hasn't explicitly\n // forwarded `searchParams` via overrides. `createLocalReq` only defaults\n // `req.query` to `{}` and never reads the request URL itself.\n let queryFromUrl: Record<string, unknown> | undefined\n try {\n const urlObject = new URL(webRequest.url)\n if (urlObject.search) {\n queryFromUrl = qs.parse(urlObject.search, {\n depth: 10,\n ignoreQueryPrefix: true,\n }) as Record<string, unknown>\n }\n } catch {\n queryFromUrl = undefined\n }\n\n const req = await createLocalReq(\n {\n req: {\n headers,\n host: headers.get('host') ?? undefined,\n i18n: i18n as I18n,\n query: queryFromUrl,\n responseHeaders,\n // Expose the `ServerAdapter` so framework-agnostic server functions can\n // set cookies / redirect via `req.server` (mirrors the Next.js adapter,\n // which passes `nextServerAdapter`). Required by handlers like\n // `switch-language`. Defaults to the native adapter; the page render\n // overrides it with the error-contract adapter.\n server: serverAdapter,\n url: webRequest.url,\n user,\n ...(reqOverrides || {}),\n },\n ...(optionsOverrides || {}),\n },\n payload,\n )\n\n const locale = await getRequestLocale({ req })\n\n req.locale = locale?.code\n\n const permissions = await getAccessResults({ req })\n\n return {\n cookies,\n headers,\n languageCode,\n locale,\n permissions,\n req,\n }\n}\n"],"names":["initI18n","getRequest","createLocalReq","executeAuthStrategies","getAccessResults","getPayload","getRequestLanguage","parseCookies","qs","getRequestLocale","tanstackServerAdapter","initReq","configPromise","importMap","overrides","serverAdapter","webRequest","headers","Headers","cookies","config","payload","languageCode","i18n","context","language","responseHeaders","user","req","reqOverrides","optionsOverrides","queryFromUrl","urlObject","URL","url","search","parse","depth","ignoreQueryPrefix","undefined","host","get","query","server","locale","code","permissions"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,UAAU,QAAQ,+BAA8B;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,EAChBC,UAAU,EACVC,kBAAkB,EAClBC,YAAY,QACP,UAAS;AAChB,YAAYC,QAAQ,SAAQ;AAE5B,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,qBAAqB,QAAQ,4BAA2B;AAEjE;;;CAGC,GACD,OAAO,eAAeC,QAAQ,EAC5BC,aAAa,EACbC,SAAS,EACTC,SAAS,EACTC,gBAAgBL,qBAAqB,EAYtC;IACC,MAAMM,aAAaf;IACnB,MAAMgB,UAAU,IAAIC,QAAQF,WAAWC,OAAO;IAC9C,MAAME,UAAUZ,aAAaU;IAE7B,MAAMG,SAAS,MAAMR;IACrB,MAAMS,UAAU,MAAMhB,WAAW;QAAEe;QAAQP;IAAU;IAErD,MAAMS,eAAehB,mBAAmB;QACtCc;QACAD;QACAF;IACF;IAEA,MAAMM,OAAmB,MAAMvB,SAAS;QACtCoB,QAAQA,OAAOG,IAAI;QACnBC,SAAS;QACTC,UAAUH;IACZ;IAEA,MAAM,EAAEI,eAAe,EAAEC,IAAI,EAAE,GAAG,MAAMxB,sBAAsB;QAC5Dc;QACAI;IACF;IAEA,MAAM,EAAEO,KAAKC,YAAY,EAAE,GAAGC,kBAAkB,GAAGhB,aAAa,CAAC;IAEjE,oEAAoE;IACpE,4EAA4E;IAC5E,uEAAuE;IACvE,yEAAyE;IACzE,8DAA8D;IAC9D,IAAIiB;IACJ,IAAI;QACF,MAAMC,YAAY,IAAIC,IAAIjB,WAAWkB,GAAG;QACxC,IAAIF,UAAUG,MAAM,EAAE;YACpBJ,eAAevB,GAAG4B,KAAK,CAACJ,UAAUG,MAAM,EAAE;gBACxCE,OAAO;gBACPC,mBAAmB;YACrB;QACF;IACF,EAAE,OAAM;QACNP,eAAeQ;IACjB;IAEA,MAAMX,MAAM,MAAM1B,eAChB;QACE0B,KAAK;YACHX;YACAuB,MAAMvB,QAAQwB,GAAG,CAAC,WAAWF;YAC7BhB,MAAMA;YACNmB,OAAOX;YACPL;YACA,wEAAwE;YACxE,wEAAwE;YACxE,+DAA+D;YAC/D,qEAAqE;YACrE,gDAAgD;YAChDiB,QAAQ5B;YACRmB,KAAKlB,WAAWkB,GAAG;YACnBP;YACA,GAAIE,gBAAgB,CAAC,CAAC;QACxB;QACA,GAAIC,oBAAoB,CAAC,CAAC;IAC5B,GACAT;IAGF,MAAMuB,SAAS,MAAMnC,iBAAiB;QAAEmB;IAAI;IAE5CA,IAAIgB,MAAM,GAAGA,QAAQC;IAErB,MAAMC,cAAc,MAAM1C,iBAAiB;QAAEwB;IAAI;IAEjD,OAAO;QACLT;QACAF;QACAK;QACAsB;QACAE;QACAlB;IACF;AACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ServerFunction } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Framework-agnostic server-function handlers the TanStack Start dispatcher
|
|
4
|
-
* registers to reach parity with the Next.js adapter
|
|
5
|
-
* (`packages/next/src/utilities/handleServerFunctions.ts`).
|
|
6
|
-
*/
|
|
7
|
-
type SwitchLanguageArgs = {
|
|
8
|
-
lang: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
12
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
13
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
14
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
15
|
-
*/
|
|
16
|
-
export declare const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>>;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=serverFunctionHandlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverFunctionHandlers.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AAEH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAcnF,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
3
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
4
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
5
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
6
|
-
*/ export const switchLanguageHandler = async ({ lang, req })=>{
|
|
7
|
-
if (!req.server) {
|
|
8
|
-
throw new Error('switch-language requires a ServerAdapter on the request');
|
|
9
|
-
}
|
|
10
|
-
const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`;
|
|
11
|
-
await req.server.setCookie(cookieName, lang, {
|
|
12
|
-
maxAge: 60 * 60 * 24 * 365,
|
|
13
|
-
path: '/'
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=serverFunctionHandlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/serverFunctionHandlers.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\n\n/**\n * Framework-agnostic server-function handlers the TanStack Start dispatcher\n * registers to reach parity with the Next.js adapter\n * (`packages/next/src/utilities/handleServerFunctions.ts`).\n */\n\ntype SwitchLanguageArgs = {\n lang: string\n}\n\n/**\n * Dispatched from `TranslationProvider` when the user switches the admin\n * language. Writes the `<cookiePrefix>-lng` cookie via the request's\n * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by\n * the provider's `router.refresh()` — reads the new language.\n */\nexport const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>> = async ({\n lang,\n req,\n}) => {\n if (!req.server) {\n throw new Error('switch-language requires a ServerAdapter on the request')\n }\n\n const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`\n\n await req.server.setCookie(cookieName, lang, {\n maxAge: 60 * 60 * 24 * 365,\n path: '/',\n })\n}\n"],"names":["switchLanguageHandler","lang","req","server","Error","cookieName","payload","config","cookiePrefix","setCookie","maxAge","path"],"mappings":"AAYA;;;;;CAKC,GACD,OAAO,MAAMA,wBAA2E,OAAO,EAC7FC,IAAI,EACJC,GAAG,EACJ;IACC,IAAI,CAACA,IAAIC,MAAM,EAAE;QACf,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,aAAa,GAAGH,IAAII,OAAO,CAACC,MAAM,CAACC,YAAY,IAAI,UAAU,IAAI,CAAC;IAExE,MAAMN,IAAIC,MAAM,CAACM,SAAS,CAACJ,YAAYJ,MAAM;QAC3CS,QAAQ,KAAK,KAAK,KAAK;QACvBC,MAAM;IACR;AACF,EAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Auth } from 'payload';
|
|
2
|
-
type SetPayloadAuthCookieArgs = {
|
|
3
|
-
authConfig: Auth;
|
|
4
|
-
cookiePrefix: string;
|
|
5
|
-
token: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function setPayloadAuthCookie({ authConfig, cookiePrefix, token, }: SetPayloadAuthCookieArgs): void;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=setPayloadAuthCookie.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setPayloadAuthCookie.d.ts","sourceRoot":"","sources":["../../src/utilities/setPayloadAuthCookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAKnC,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,YAAY,EACZ,KAAK,GACN,EAAE,wBAAwB,GAAG,IAAI,CAoCjC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { setResponseHeader } from '@tanstack/react-start/server';
|
|
2
|
-
import { generatePayloadCookie } from 'payload';
|
|
3
|
-
export function setPayloadAuthCookie({ authConfig, cookiePrefix, token }) {
|
|
4
|
-
const cookieExpiration = authConfig.tokenExpiration ? new Date(Date.now() + authConfig.tokenExpiration) : undefined;
|
|
5
|
-
const payloadCookie = generatePayloadCookie({
|
|
6
|
-
collectionAuthConfig: authConfig,
|
|
7
|
-
cookiePrefix,
|
|
8
|
-
expires: cookieExpiration,
|
|
9
|
-
returnCookieAsObject: true,
|
|
10
|
-
token
|
|
11
|
-
});
|
|
12
|
-
if (payloadCookie.value) {
|
|
13
|
-
const sameSite = typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax';
|
|
14
|
-
let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`;
|
|
15
|
-
cookie += '; HttpOnly';
|
|
16
|
-
cookie += `; SameSite=${sameSite}`;
|
|
17
|
-
cookie += '; Path=/';
|
|
18
|
-
if (authConfig.cookies.secure) {
|
|
19
|
-
cookie += '; Secure';
|
|
20
|
-
}
|
|
21
|
-
if (authConfig.cookies.domain) {
|
|
22
|
-
cookie += `; Domain=${authConfig.cookies.domain}`;
|
|
23
|
-
}
|
|
24
|
-
if (payloadCookie.expires) {
|
|
25
|
-
cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`;
|
|
26
|
-
}
|
|
27
|
-
setResponseHeader('Set-Cookie', cookie);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=setPayloadAuthCookie.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/setPayloadAuthCookie.ts"],"sourcesContent":["import type { Auth } from 'payload'\n\nimport { setResponseHeader } from '@tanstack/react-start/server'\nimport { generatePayloadCookie } from 'payload'\n\ntype SetPayloadAuthCookieArgs = {\n authConfig: Auth\n cookiePrefix: string\n token: string\n}\n\nexport function setPayloadAuthCookie({\n authConfig,\n cookiePrefix,\n token,\n}: SetPayloadAuthCookieArgs): void {\n const cookieExpiration = authConfig.tokenExpiration\n ? new Date(Date.now() + authConfig.tokenExpiration)\n : undefined\n\n const payloadCookie = generatePayloadCookie({\n collectionAuthConfig: authConfig,\n cookiePrefix,\n expires: cookieExpiration,\n returnCookieAsObject: true,\n token,\n })\n\n if (payloadCookie.value) {\n const sameSite =\n typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax'\n\n let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`\n cookie += '; HttpOnly'\n cookie += `; SameSite=${sameSite}`\n cookie += '; Path=/'\n\n if (authConfig.cookies.secure) {\n cookie += '; Secure'\n }\n\n if (authConfig.cookies.domain) {\n cookie += `; Domain=${authConfig.cookies.domain}`\n }\n\n if (payloadCookie.expires) {\n cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`\n }\n\n setResponseHeader('Set-Cookie', cookie)\n }\n}\n"],"names":["setResponseHeader","generatePayloadCookie","setPayloadAuthCookie","authConfig","cookiePrefix","token","cookieExpiration","tokenExpiration","Date","now","undefined","payloadCookie","collectionAuthConfig","expires","returnCookieAsObject","value","sameSite","cookies","cookie","encodeURIComponent","name","secure","domain","toUTCString"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,qBAAqB,QAAQ,UAAS;AAQ/C,OAAO,SAASC,qBAAqB,EACnCC,UAAU,EACVC,YAAY,EACZC,KAAK,EACoB;IACzB,MAAMC,mBAAmBH,WAAWI,eAAe,GAC/C,IAAIC,KAAKA,KAAKC,GAAG,KAAKN,WAAWI,eAAe,IAChDG;IAEJ,MAAMC,gBAAgBV,sBAAsB;QAC1CW,sBAAsBT;QACtBC;QACAS,SAASP;QACTQ,sBAAsB;QACtBT;IACF;IAEA,IAAIM,cAAcI,KAAK,EAAE;QACvB,MAAMC,WACJ,OAAOb,WAAWc,OAAO,CAACD,QAAQ,KAAK,WAAWb,WAAWc,OAAO,CAACD,QAAQ,GAAG;QAElF,IAAIE,SAAS,GAAGC,mBAAmBR,cAAcS,IAAI,EAAE,CAAC,EAAED,mBAAmBR,cAAcI,KAAK,GAAG;QACnGG,UAAU;QACVA,UAAU,CAAC,WAAW,EAAEF,UAAU;QAClCE,UAAU;QAEV,IAAIf,WAAWc,OAAO,CAACI,MAAM,EAAE;YAC7BH,UAAU;QACZ;QAEA,IAAIf,WAAWc,OAAO,CAACK,MAAM,EAAE;YAC7BJ,UAAU,CAAC,SAAS,EAAEf,WAAWc,OAAO,CAACK,MAAM,EAAE;QACnD;QAEA,IAAIX,cAAcE,OAAO,EAAE;YACzBK,UAAU,CAAC,UAAU,EAAE,IAAIV,KAAKG,cAAcE,OAAO,EAAEU,WAAW,IAAI;QACxE;QAEAvB,kBAAkB,cAAckB;IAClC;AACF"}
|
package/dist/vite/constants.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite-level configuration constants used by `payloadPlugin`. Kept separate so
|
|
3
|
-
* `plugin.ts` stays focused on wiring.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Server-only packages (Node-only or only ever used by the server bundle).
|
|
7
|
-
* These are the Vite equivalent of Next.js's `serverExternalPackages`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const ssrExternalPackages: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Payload packages whose source must be processed by Vite even on the server
|
|
12
|
-
* (because they are workspace `.ts` files in dev). Server-only adapters
|
|
13
|
-
* (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
|
|
14
|
-
* intentionally not included — those should stay external on the SSR side.
|
|
15
|
-
*/
|
|
16
|
-
export declare const payloadNoExternalPatterns: Array<RegExp | string>;
|
|
17
|
-
/**
|
|
18
|
-
* The subset of `payloadNoExternalPatterns` that needs to participate in the
|
|
19
|
-
* RSC environment. Plugins and storage adapters must be included: they register
|
|
20
|
-
* custom providers/components (e.g. `plugin-multi-tenant`'s `'use client'`
|
|
21
|
-
* `TenantSelectionProvider`) that render in the RSC graph via
|
|
22
|
-
* `RenderServerComponent`. If the package stays external to RSC, `plugin-rsc`
|
|
23
|
-
* never transforms its `'use client'` modules into client references, so the
|
|
24
|
-
* component executes server-side and crashes on the first hook
|
|
25
|
-
* (`Cannot read properties of null (reading 'useState')`).
|
|
26
|
-
*/
|
|
27
|
-
export declare const payloadRscNoExternalPatterns: Array<RegExp | string>;
|
|
28
|
-
/**
|
|
29
|
-
* Packages we know contain Node-only code or top-level side effects requiring
|
|
30
|
-
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
31
|
-
* walking into their main entries and trying to bundle server-only imports
|
|
32
|
-
* for the browser.
|
|
33
|
-
*/
|
|
34
|
-
export declare const optimizeDepsExcludeDefaults: string[];
|
|
35
|
-
/**
|
|
36
|
-
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
37
|
-
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
38
|
-
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
39
|
-
* list them explicitly using the `parent > child` syntax.
|
|
40
|
-
*/
|
|
41
|
-
export declare const optimizeDepsIncludeDefaults: string[];
|
|
42
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA0BvC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO/D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA8E/C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/constants.ts"],"sourcesContent":["/**\n * Vite-level configuration constants used by `payloadPlugin`. Kept separate so\n * `plugin.ts` stays focused on wiring.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'mongodb',\n 'mongoose',\n 'better-sqlite3',\n 'pg',\n 'pg-native',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Payload packages whose source must be processed by Vite even on the server\n * (because they are workspace `.ts` files in dev). Server-only adapters\n * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are\n * intentionally not included — those should stay external on the SSR side.\n */\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * The subset of `payloadNoExternalPatterns` that needs to participate in the\n * RSC environment. Plugins and storage adapters must be included: they register\n * custom providers/components (e.g. `plugin-multi-tenant`'s `'use client'`\n * `TenantSelectionProvider`) that render in the RSC graph via\n * `RenderServerComponent`. If the package stays external to RSC, `plugin-rsc`\n * never transforms its `'use client'` modules into client references, so the\n * component executes server-side and crashes on the first hook\n * (`Cannot read properties of null (reading 'useState')`).\n */\nexport const payloadRscNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * Packages we know contain Node-only code or top-level side effects requiring\n * Node APIs. Excluding them from the client optimizer prevents Vite from\n * walking into their main entries and trying to bundle server-only imports\n * for the browser.\n */\nexport const optimizeDepsExcludeDefaults: string[] = [\n 'sharp',\n '@payloadcms/ui',\n '@payloadcms/tanstack-start',\n 'payload',\n 'pino',\n 'pino-pretty',\n 'busboy',\n 'get-tsconfig',\n 'ws',\n 'croner',\n 'prompts',\n 'file-type',\n // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite\n // sometimes walks these from the main package entry while scanning\n // workspace deps, and the browser sub-bundles do not expose the\n // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev\n // server with a `MISSING_EXPORT` error before any test runs.\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be\n * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick\n * these up because their parent packages are in `optimizeDeps.exclude`, so we\n * list them explicitly using the `parent > child` syntax.\n */\nexport const optimizeDepsIncludeDefaults: string[] = [\n '@payloadcms/ui > sonner',\n '@payloadcms/ui > @faceless-ui/modal',\n '@payloadcms/ui > @faceless-ui/window-info',\n '@payloadcms/ui > @faceless-ui/scroll-info',\n '@payloadcms/ui > @dnd-kit/core',\n '@payloadcms/ui > @dnd-kit/sortable',\n '@payloadcms/ui > @dnd-kit/utilities',\n '@payloadcms/ui > react-datepicker',\n '@payloadcms/ui > react-select',\n '@payloadcms/ui > react-select/creatable',\n '@payloadcms/ui > react-image-crop',\n '@payloadcms/ui > @monaco-editor/react',\n '@payloadcms/ui > date-fns',\n '@payloadcms/ui > date-fns/transpose',\n '@payloadcms/ui > @date-fns/tz/date/mini',\n '@payloadcms/ui > uuid',\n '@payloadcms/ui > use-context-selector',\n '@payloadcms/ui > bson-objectid',\n '@payloadcms/ui > dequal',\n '@payloadcms/ui > object-to-formdata',\n '@payloadcms/ui > md5',\n 'payload > deepmerge',\n 'payload > pluralize',\n // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of\n // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated\n // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where\n // it isn't hoisted to the top level. Path it through `react-dom` so the\n // optimizer resolves the exact copy the runtime loads.\n 'react-dom > scheduler',\n // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the\n // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.\n // Because its parent is excluded, the optimizer never crawls in to discover\n // this entry, so Vite serves `react/compiler-runtime` raw. That file is\n // CommonJS (`module.exports = require(...)`), so the named `c` export can't be\n // statically extracted and every client component throws \"does not provide an\n // export named 'c'\". Pre-bundling it lets esbuild synthesize the named export.\n 'react/compiler-runtime',\n // Transitive deps that Vite otherwise discovers *after* the initial crawl\n // (react-select pulls in @floating-ui at runtime; react-is is reached via\n // react-transition-group/prop-types; the default date-fns locale is loaded\n // through a dynamic `date-fns/locale/${key}` import). A late discovery forces\n // a full dep re-optimization mid-session, which 404s every in-flight\n // `.vite/deps/*` chunk (\"Pre-transform error: file does not exist in the\n // optimize deps directory\") and breaks the admin UI in CI cold starts.\n // Pre-bundling them keeps the first optimization pass complete.\n '@payloadcms/ui > react-select > @floating-ui/dom',\n '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',\n '@payloadcms/ui > react-select > prop-types > react-is',\n '@payloadcms/ui > date-fns/locale/en-US',\n // Further late discoveries observed re-optimizing mid-run in CI cold starts\n // (see CI logs: \"✨ new dependencies optimized: @dnd-kit/modifiers / ajv /\n // dequal/lite\"). The modular dashboard pulls in `@dnd-kit/modifiers` on first\n // render; form-state diffing reaches `dequal/lite` (a distinct entry point\n // from the already-listed `dequal`); client-side field validation reaches\n // `ajv` *through `payload`* — it is `ssrExternal` server-side but still\n // bundled into the client, and must be pathed via `payload` so the optimizer\n // pre-bundles the exact copy the runtime loads.\n '@payloadcms/ui > @dnd-kit/modifiers',\n '@payloadcms/ui > dequal/lite',\n 'payload > ajv',\n // The storage client-upload suites (esp. vercel-blob) crawl part of the\n // `payload` server runtime into the client bundle and discover these late,\n // triggering several \"optimized dependencies changed. reloading\" waves that\n // reload the page mid-test (the bulk-upload drawer's Create New button /\n // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the\n // whole observed set so the first pass is complete.\n 'payload > undici',\n 'payload > jose',\n 'payload > dataloader',\n 'payload > path-to-regexp',\n 'payload > console-table-printer',\n 'payload > ci-info',\n 'payload > image-size',\n 'payload > image-size/fromFile',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n]\n"],"names":["ssrExternalPackages","payloadNoExternalPatterns","payloadRscNoExternalPatterns","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;CASC,GACD,OAAO,MAAMC,+BAAuD;IAClE;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,6EAA6E;IAC7E,+EAA+E;IAC/E,8EAA8E;IAC9E,wEAAwE;IACxE,uDAAuD;IACvD;IACA,8EAA8E;IAC9E,0EAA0E;IAC1E,4EAA4E;IAC5E,wEAAwE;IACxE,+EAA+E;IAC/E,8EAA8E;IAC9E,+EAA+E;IAC/E;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;IACA,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,6EAA6E;IAC7E,gDAAgD;IAChD;IACA;IACA;IACA,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,oDAAoD;IACpD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importProtection.d.ts","sourceRoot":"","sources":["../../src/vite/importProtection.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAoB7D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAoC9E;AAED,eAAO,MAAM,sCAAsC,EAAE,MAAM,EAAsC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/importProtection.ts"],"sourcesContent":["import { builtinModules } from 'node:module'\n\n/**\n * Specifiers that must never appear in the client module graph. These are the\n * server-only Payload entry points plus Node.js built-ins and a handful of\n * Node-only npm packages that Payload pulls in transitively.\n */\nexport const serverOnlyClientSpecifiers: Array<RegExp | string> = [\n /^node:/,\n new RegExp(`^(${builtinModules.join('|')})(\\\\/|$)`),\n '@payload-config',\n /^@payloadcms\\/next\\/rsc/,\n /^@payloadcms\\/richtext-lexical\\/rsc/,\n /^@payloadcms\\/richtext-slate\\/rsc/,\n '@payloadcms/ui/server',\n /^@payloadcms\\/tanstack-start\\/(layouts|rsc|server|views\\/server)/,\n 'sharp',\n 'busboy',\n 'croner',\n 'pino',\n 'pino-pretty',\n 'prompts',\n 'ws',\n 'undici',\n 'get-tsconfig',\n /^file-type/,\n /^react-dom\\/server/,\n]\n\n/**\n * Allowlist callback for the `tanstackStart` plugin's import-protection. These\n * are the legitimate cross-environment imports in our monorepo that we want\n * to permit even when they appear to cross a server/client boundary.\n */\nexport function onImportProtectionViolation(violation: unknown): boolean | void {\n const info = violation as {\n envType: 'client' | 'server'\n importer: string\n resolved?: string\n }\n\n const allowedClientFileImporters =\n /\\/richtext-lexical\\/.*\\/exports\\/client\\/|\\/tanstack-start\\/.*\\/views\\/AdminView|\\/ui\\//\n\n if (\n info.envType === 'server' &&\n info.resolved?.includes('.client.') &&\n allowedClientFileImporters.test(info.importer)\n ) {\n return false\n }\n\n if (info.importer.includes('/richtext-lexical/') && info.importer.includes('/field/Diff/')) {\n return false\n }\n\n if (info.importer.includes('/packages/payload/') || info.importer.includes('/payload/dist/')) {\n return false\n }\n\n if (\n info.importer.includes('@payloadcms/ui') &&\n (info.importer.includes('/exports/rsc/') || info.importer.includes('/rsc/index'))\n ) {\n return false\n }\n\n if (info.envType === 'server' && info.importer.includes('vite-rsc/client-references')) {\n return false\n }\n}\n\nexport const defaultImportProtectionIgnoreImporters: RegExp[] = [/^src\\/importMap\\.js(?:\\?.*)?$/]\n"],"names":["builtinModules","serverOnlyClientSpecifiers","RegExp","join","onImportProtectionViolation","violation","info","allowedClientFileImporters","envType","resolved","includes","test","importer","defaultImportProtectionIgnoreImporters"],"mappings":"AAAA,SAASA,cAAc,QAAQ,cAAa;AAE5C;;;;CAIC,GACD,OAAO,MAAMC,6BAAqD;IAChE;IACA,IAAIC,OAAO,CAAC,EAAE,EAAEF,eAAeG,IAAI,CAAC,KAAK,QAAQ,CAAC;IAClD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,SAASC,4BAA4BC,SAAkB;IAC5D,MAAMC,OAAOD;IAMb,MAAME,6BACJ;IAEF,IACED,KAAKE,OAAO,KAAK,YACjBF,KAAKG,QAAQ,EAAEC,SAAS,eACxBH,2BAA2BI,IAAI,CAACL,KAAKM,QAAQ,GAC7C;QACA,OAAO;IACT;IAEA,IAAIN,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,iBAAiB;QAC1F,OAAO;IACT;IAEA,IAAIJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,mBAAmB;QAC5F,OAAO;IACT;IAEA,IACEJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,qBACtBJ,CAAAA,KAAKM,QAAQ,CAACF,QAAQ,CAAC,oBAAoBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,aAAY,GAC/E;QACA,OAAO;IACT;IAEA,IAAIJ,KAAKE,OAAO,KAAK,YAAYF,KAAKM,QAAQ,CAACF,QAAQ,CAAC,+BAA+B;QACrF,OAAO;IACT;AACF;AAEA,OAAO,MAAMG,yCAAmD;IAAC;CAAgC,CAAA"}
|