@payloadcms/tanstack-start 4.0.0-internal.183b315
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/LICENSE.md +22 -0
- package/dist/@types/assets.d.js +2 -0
- package/dist/@types/assets.d.js.map +1 -0
- package/dist/auth/login.d.ts +17 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +50 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/logout.d.ts +9 -0
- package/dist/auth/logout.d.ts.map +1 -0
- package/dist/auth/logout.js +51 -0
- package/dist/auth/logout.js.map +1 -0
- package/dist/auth/refresh.d.ts +8 -0
- package/dist/auth/refresh.d.ts.map +1 -0
- package/dist/auth/refresh.js +53 -0
- package/dist/auth/refresh.js.map +1 -0
- package/dist/auth/switchLanguage.d.ts +6 -0
- package/dist/auth/switchLanguage.d.ts.map +1 -0
- package/dist/auth/switchLanguage.js +11 -0
- package/dist/auth/switchLanguage.js.map +1 -0
- package/dist/elements/DocumentHeaderClient/index.d.ts +16 -0
- package/dist/elements/DocumentHeaderClient/index.d.ts.map +1 -0
- package/dist/elements/DocumentHeaderClient/index.js +116 -0
- package/dist/elements/DocumentHeaderClient/index.js.map +1 -0
- package/dist/elements/RenderComponent/index.d.ts +10 -0
- package/dist/elements/RenderComponent/index.d.ts.map +1 -0
- package/dist/elements/RenderComponent/index.js +12 -0
- package/dist/elements/RenderComponent/index.js.map +1 -0
- package/dist/elements/RouterAdapter/index.d.ts +3 -0
- package/dist/elements/RouterAdapter/index.d.ts.map +1 -0
- package/dist/elements/RouterAdapter/index.js +118 -0
- package/dist/elements/RouterAdapter/index.js.map +1 -0
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +6 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/layouts.d.ts +5 -0
- package/dist/exports/layouts.d.ts.map +1 -0
- package/dist/exports/layouts.js +4 -0
- package/dist/exports/layouts.js.map +1 -0
- package/dist/exports/rsc.browser.d.ts +12 -0
- package/dist/exports/rsc.browser.d.ts.map +1 -0
- package/dist/exports/rsc.browser.js +12 -0
- package/dist/exports/rsc.browser.js.map +1 -0
- package/dist/exports/rsc.d.ts +5 -0
- package/dist/exports/rsc.d.ts.map +1 -0
- package/dist/exports/rsc.js +6 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/exports/server.d.ts +16 -0
- package/dist/exports/server.d.ts.map +1 -0
- package/dist/exports/server.js +17 -0
- package/dist/exports/server.js.map +1 -0
- package/dist/exports/vite.d.ts +3 -0
- package/dist/exports/vite.d.ts.map +1 -0
- package/dist/exports/vite.js +3 -0
- package/dist/exports/vite.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/Root/getLayoutData.d.ts +12 -0
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -0
- package/dist/layouts/Root/getLayoutData.js +55 -0
- package/dist/layouts/Root/getLayoutData.js.map +1 -0
- package/dist/layouts/Root/index.d.ts +25 -0
- package/dist/layouts/Root/index.d.ts.map +1 -0
- package/dist/layouts/Root/index.js +51 -0
- package/dist/layouts/Root/index.js.map +1 -0
- package/dist/node/cssLoader.d.mts +3 -0
- package/dist/node/cssLoader.d.mts.map +1 -0
- package/dist/node/cssLoader.js +70 -0
- package/dist/node/cssLoader.js.map +1 -0
- package/dist/node/cssLoader.mjs +75 -0
- package/dist/node/registerCssLoader.d.mts +2 -0
- package/dist/node/registerCssLoader.d.mts.map +1 -0
- package/dist/node/registerCssLoader.js +10 -0
- package/dist/node/registerCssLoader.js.map +1 -0
- package/dist/node/registerCssLoader.mjs +10 -0
- package/dist/rsc/CollectionCards.d.ts +4 -0
- package/dist/rsc/CollectionCards.d.ts.map +1 -0
- package/dist/rsc/CollectionCards.js +12 -0
- package/dist/rsc/CollectionCards.js.map +1 -0
- package/dist/rsc/HierarchyTypeFieldServer.d.ts +9 -0
- package/dist/rsc/HierarchyTypeFieldServer.d.ts.map +1 -0
- package/dist/rsc/HierarchyTypeFieldServer.js +35 -0
- package/dist/rsc/HierarchyTypeFieldServer.js.map +1 -0
- package/dist/rsc/renderOnDemand.d.ts +15 -0
- package/dist/rsc/renderOnDemand.d.ts.map +1 -0
- package/dist/rsc/renderOnDemand.js +25 -0
- package/dist/rsc/renderOnDemand.js.map +1 -0
- package/dist/rsc/renderPayloadRSC.d.ts +6 -0
- package/dist/rsc/renderPayloadRSC.d.ts.map +1 -0
- package/dist/rsc/renderPayloadRSC.js +6 -0
- package/dist/rsc/renderPayloadRSC.js.map +1 -0
- package/dist/utilities/devReloadStrategy.d.ts +10 -0
- package/dist/utilities/devReloadStrategy.d.ts.map +1 -0
- package/dist/utilities/devReloadStrategy.js +27 -0
- package/dist/utilities/devReloadStrategy.js.map +1 -0
- package/dist/utilities/getExistingAuthToken.d.ts +7 -0
- package/dist/utilities/getExistingAuthToken.d.ts.map +1 -0
- package/dist/utilities/getExistingAuthToken.js +18 -0
- package/dist/utilities/getExistingAuthToken.js.map +1 -0
- package/dist/utilities/getPreferences.d.ts +10 -0
- package/dist/utilities/getPreferences.d.ts.map +1 -0
- package/dist/utilities/getPreferences.js +33 -0
- package/dist/utilities/getPreferences.js.map +1 -0
- package/dist/utilities/getRequestI18n.server.d.ts +12 -0
- package/dist/utilities/getRequestI18n.server.d.ts.map +1 -0
- package/dist/utilities/getRequestI18n.server.js +25 -0
- package/dist/utilities/getRequestI18n.server.js.map +1 -0
- package/dist/utilities/getRequestLocale.d.ts +7 -0
- package/dist/utilities/getRequestLocale.d.ts.map +1 -0
- package/dist/utilities/getRequestLocale.js +20 -0
- package/dist/utilities/getRequestLocale.js.map +1 -0
- package/dist/utilities/getRequestTheme.d.ts +10 -0
- package/dist/utilities/getRequestTheme.d.ts.map +1 -0
- package/dist/utilities/getRequestTheme.js +25 -0
- package/dist/utilities/getRequestTheme.js.map +1 -0
- package/dist/utilities/graphqlHandler.server.d.ts +12 -0
- package/dist/utilities/graphqlHandler.server.d.ts.map +1 -0
- package/dist/utilities/graphqlHandler.server.js +129 -0
- package/dist/utilities/graphqlHandler.server.js.map +1 -0
- package/dist/utilities/handleServerFunctions.d.ts +20 -0
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -0
- package/dist/utilities/handleServerFunctions.js +60 -0
- package/dist/utilities/handleServerFunctions.js.map +1 -0
- package/dist/utilities/importMap.server.d.ts +9 -0
- package/dist/utilities/importMap.server.d.ts.map +1 -0
- package/dist/utilities/importMap.server.js +12 -0
- package/dist/utilities/importMap.server.js.map +1 -0
- package/dist/utilities/initReq.server.d.ts +19 -0
- package/dist/utilities/initReq.server.d.ts.map +1 -0
- package/dist/utilities/initReq.server.js +87 -0
- package/dist/utilities/initReq.server.js.map +1 -0
- package/dist/utilities/meta.d.ts +70 -0
- package/dist/utilities/meta.d.ts.map +1 -0
- package/dist/utilities/meta.js +142 -0
- package/dist/utilities/meta.js.map +1 -0
- package/dist/utilities/serializeForRsc.d.ts +26 -0
- package/dist/utilities/serializeForRsc.d.ts.map +1 -0
- package/dist/utilities/serializeForRsc.js +105 -0
- package/dist/utilities/serializeForRsc.js.map +1 -0
- package/dist/utilities/serverAdapter.server.d.ts +36 -0
- package/dist/utilities/serverAdapter.server.d.ts.map +1 -0
- package/dist/utilities/serverAdapter.server.js +130 -0
- package/dist/utilities/serverAdapter.server.js.map +1 -0
- package/dist/utilities/serverFunctionHandlers.d.ts +18 -0
- package/dist/utilities/serverFunctionHandlers.d.ts.map +1 -0
- package/dist/utilities/serverFunctionHandlers.js +17 -0
- package/dist/utilities/serverFunctionHandlers.js.map +1 -0
- package/dist/utilities/setPayloadAuthCookie.d.ts +9 -0
- package/dist/utilities/setPayloadAuthCookie.d.ts.map +1 -0
- package/dist/utilities/setPayloadAuthCookie.js +31 -0
- package/dist/utilities/setPayloadAuthCookie.js.map +1 -0
- package/dist/utilities/toSerializable.d.ts +2 -0
- package/dist/utilities/toSerializable.d.ts.map +1 -0
- package/dist/utilities/toSerializable.js +111 -0
- package/dist/utilities/toSerializable.js.map +1 -0
- package/dist/vite/constants.d.ts +37 -0
- package/dist/vite/constants.d.ts.map +1 -0
- package/dist/vite/constants.js +129 -0
- package/dist/vite/constants.js.map +1 -0
- package/dist/vite/importProtection.d.ts +14 -0
- package/dist/vite/importProtection.d.ts.map +1 -0
- package/dist/vite/importProtection.js +54 -0
- package/dist/vite/importProtection.js.map +1 -0
- package/dist/vite/plugin.d.ts +38 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +182 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/plugins/clientModuleResolution.d.ts +14 -0
- package/dist/vite/plugins/clientModuleResolution.d.ts.map +1 -0
- package/dist/vite/plugins/clientModuleResolution.js +98 -0
- package/dist/vite/plugins/clientModuleResolution.js.map +1 -0
- package/dist/vite/plugins/devTransforms.d.ts +8 -0
- package/dist/vite/plugins/devTransforms.d.ts.map +1 -0
- package/dist/vite/plugins/devTransforms.js +56 -0
- package/dist/vite/plugins/devTransforms.js.map +1 -0
- package/dist/vite/plugins/reactDomServerInRsc.d.ts +27 -0
- package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +1 -0
- package/dist/vite/plugins/reactDomServerInRsc.js +90 -0
- package/dist/vite/plugins/reactDomServerInRsc.js.map +1 -0
- package/dist/vite/plugins/stripDistStyleImports.d.ts +21 -0
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +1 -0
- package/dist/vite/plugins/stripDistStyleImports.js +89 -0
- package/dist/vite/plugins/stripDistStyleImports.js.map +1 -0
- package/dist/vite/plugins/wrapCjsForClient.d.ts +15 -0
- package/dist/vite/plugins/wrapCjsForClient.d.ts.map +1 -0
- package/dist/vite/plugins/wrapCjsForClient.js +106 -0
- package/dist/vite/plugins/wrapCjsForClient.js.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GAAI,KAAK,aAAa,KAAG,aAgBjE,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { notFound, redirect } from '@tanstack/react-router';
|
|
2
|
+
import { getRequest, setResponseHeader } from '@tanstack/react-start/server';
|
|
3
|
+
import { parseCookies } from 'payload';
|
|
4
|
+
function buildCookieStore(headers) {
|
|
5
|
+
const cookies = parseCookies(headers);
|
|
6
|
+
return {
|
|
7
|
+
get: (name)=>{
|
|
8
|
+
const value = cookies.get(name);
|
|
9
|
+
return value !== undefined ? {
|
|
10
|
+
name,
|
|
11
|
+
value
|
|
12
|
+
} : undefined;
|
|
13
|
+
},
|
|
14
|
+
getAll: ()=>{
|
|
15
|
+
return Array.from(cookies.entries()).map(([name, value])=>({
|
|
16
|
+
name,
|
|
17
|
+
value
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function serializeCookie(name, value, options) {
|
|
23
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
24
|
+
if (options?.path) {
|
|
25
|
+
cookie += `; Path=${options.path}`;
|
|
26
|
+
}
|
|
27
|
+
if (options?.domain) {
|
|
28
|
+
cookie += `; Domain=${options.domain}`;
|
|
29
|
+
}
|
|
30
|
+
if (options?.maxAge !== undefined) {
|
|
31
|
+
cookie += `; Max-Age=${options.maxAge}`;
|
|
32
|
+
}
|
|
33
|
+
if (options?.expires) {
|
|
34
|
+
cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
35
|
+
}
|
|
36
|
+
if (options?.httpOnly) {
|
|
37
|
+
cookie += '; HttpOnly';
|
|
38
|
+
}
|
|
39
|
+
if (options?.secure) {
|
|
40
|
+
cookie += '; Secure';
|
|
41
|
+
}
|
|
42
|
+
if (options?.sameSite) {
|
|
43
|
+
cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
|
|
44
|
+
}
|
|
45
|
+
return cookie;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Server-side adapter for TanStack Start.
|
|
49
|
+
* Uses `@tanstack/react-start/server` utilities for request/response handling.
|
|
50
|
+
*/ export const tanstackServerAdapter = {
|
|
51
|
+
getCookies: ()=>{
|
|
52
|
+
const request = getRequest();
|
|
53
|
+
const headers = new Headers(request.headers);
|
|
54
|
+
return buildCookieStore(headers);
|
|
55
|
+
},
|
|
56
|
+
getHeaders: ()=>{
|
|
57
|
+
const request = getRequest();
|
|
58
|
+
return new Headers(request.headers);
|
|
59
|
+
},
|
|
60
|
+
notFound: ()=>{
|
|
61
|
+
// TanStack Router requires throwing the notFound() result directly
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
63
|
+
throw notFound();
|
|
64
|
+
},
|
|
65
|
+
redirect: (path)=>{
|
|
66
|
+
// TanStack Router requires throwing the redirect() result directly
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
68
|
+
throw redirect({
|
|
69
|
+
to: path
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
permanentRedirect: (path)=>{
|
|
73
|
+
// TanStack Router does not have a separate permanent redirect primitive;
|
|
74
|
+
// fall back to a regular redirect so existing behavior is preserved.
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
76
|
+
throw redirect({
|
|
77
|
+
to: path
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
forbidden: ()=>{
|
|
81
|
+
// TanStack Router does not have a dedicated forbidden() helper; surface
|
|
82
|
+
// a generic error so the request boundary still terminates the request.
|
|
83
|
+
throw new Error('Forbidden');
|
|
84
|
+
},
|
|
85
|
+
unauthorized: ()=>{
|
|
86
|
+
// TanStack Router does not have a dedicated unauthorized() helper; surface
|
|
87
|
+
// a generic error so the request boundary still terminates the request.
|
|
88
|
+
throw new Error('Unauthorized');
|
|
89
|
+
},
|
|
90
|
+
setCookie: (name, value, options)=>{
|
|
91
|
+
setResponseHeader('Set-Cookie', serializeCookie(name, value, options));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Builds the `ServerAdapter` for the admin page render (`renderRoot`). Like
|
|
96
|
+
* `tanstackServerAdapter` for cookies/headers, but navigation **records the
|
|
97
|
+
* intent on `nav` and throws** the framework-agnostic string error-contract
|
|
98
|
+
* (`Error('not-found')` / `Error('redirect:<url>')`) instead of TanStack's
|
|
99
|
+
* native `notFound`/`redirect`.
|
|
100
|
+
*
|
|
101
|
+
* `renderRoot` navigates via `req.server.*` in two places:
|
|
102
|
+
* - during orchestration (e.g. the unauthenticated login redirect) — the throw
|
|
103
|
+
* propagates out of `renderRoot` and is caught by the loader's try/catch;
|
|
104
|
+
* - deep inside streamed view components (e.g. `DocumentView` access checks,
|
|
105
|
+
* `LoginView` already-authenticated) — here the throw happens during
|
|
106
|
+
* `renderServerComponent` and is swallowed into the RSC stream, so it never
|
|
107
|
+
* rejects the render promise.
|
|
108
|
+
*
|
|
109
|
+
* Recording the intent on `nav` lets the loader honor the second case by
|
|
110
|
+
* inspecting `nav` after the render resolves, then re-throwing native TanStack
|
|
111
|
+
* nav at the loader boundary.
|
|
112
|
+
*/ export const createPageRenderServerAdapter = (nav)=>({
|
|
113
|
+
...tanstackServerAdapter,
|
|
114
|
+
notFound: ()=>{
|
|
115
|
+
nav.type = 'notFound';
|
|
116
|
+
throw new Error('not-found');
|
|
117
|
+
},
|
|
118
|
+
permanentRedirect: (path)=>{
|
|
119
|
+
nav.type = 'redirect';
|
|
120
|
+
nav.url = path;
|
|
121
|
+
throw new Error(`redirect:${path}`);
|
|
122
|
+
},
|
|
123
|
+
redirect: (path)=>{
|
|
124
|
+
nav.type = 'redirect';
|
|
125
|
+
nav.url = path;
|
|
126
|
+
throw new Error(`redirect:${path}`);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=serverAdapter.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/serverAdapter.server.ts"],"sourcesContent":["import type { CookieOptions, CookieStore, ServerAdapter } from 'payload'\n\nimport { notFound, redirect } from '@tanstack/react-router'\nimport { getRequest, setResponseHeader } from '@tanstack/react-start/server'\nimport { parseCookies } from 'payload'\n\nfunction buildCookieStore(headers: Headers): CookieStore {\n const cookies = parseCookies(headers)\n\n return {\n get: (name: string) => {\n const value = cookies.get(name)\n return value !== undefined ? { name, value } : undefined\n },\n getAll: () => {\n return Array.from(cookies.entries()).map(([name, value]) => ({ name, value }))\n },\n }\n}\n\nfunction serializeCookie(name: string, value: string, options?: CookieOptions): string {\n let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`\n\n if (options?.path) {\n cookie += `; Path=${options.path}`\n }\n\n if (options?.domain) {\n cookie += `; Domain=${options.domain}`\n }\n\n if (options?.maxAge !== undefined) {\n cookie += `; Max-Age=${options.maxAge}`\n }\n\n if (options?.expires) {\n cookie += `; Expires=${options.expires.toUTCString()}`\n }\n\n if (options?.httpOnly) {\n cookie += '; HttpOnly'\n }\n\n if (options?.secure) {\n cookie += '; Secure'\n }\n\n if (options?.sameSite) {\n cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`\n }\n\n return cookie\n}\n\n/**\n * Server-side adapter for TanStack Start.\n * Uses `@tanstack/react-start/server` utilities for request/response handling.\n */\nexport const tanstackServerAdapter: ServerAdapter = {\n getCookies: () => {\n const request = getRequest()\n const headers = new Headers(request.headers)\n return buildCookieStore(headers)\n },\n\n getHeaders: () => {\n const request = getRequest()\n return new Headers(request.headers)\n },\n\n notFound: () => {\n // TanStack Router requires throwing the notFound() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw notFound()\n },\n\n redirect: (path: string) => {\n // TanStack Router requires throwing the redirect() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n permanentRedirect: (path: string) => {\n // TanStack Router does not have a separate permanent redirect primitive;\n // fall back to a regular redirect so existing behavior is preserved.\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n forbidden: () => {\n // TanStack Router does not have a dedicated forbidden() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Forbidden')\n },\n\n unauthorized: () => {\n // TanStack Router does not have a dedicated unauthorized() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Unauthorized')\n },\n\n setCookie: (name: string, value: string, options?: CookieOptions) => {\n setResponseHeader('Set-Cookie', serializeCookie(name, value, options))\n },\n}\n\n/**\n * Navigation requested during an admin page render, recorded by\n * `createPageRenderServerAdapter`. The admin-page server function reads this\n * after `renderServerComponent` resolves.\n */\nexport type PageNavIntent = {\n type?: 'notFound' | 'redirect'\n url?: string\n}\n\n/**\n * Builds the `ServerAdapter` for the admin page render (`renderRoot`). Like\n * `tanstackServerAdapter` for cookies/headers, but navigation **records the\n * intent on `nav` and throws** the framework-agnostic string error-contract\n * (`Error('not-found')` / `Error('redirect:<url>')`) instead of TanStack's\n * native `notFound`/`redirect`.\n *\n * `renderRoot` navigates via `req.server.*` in two places:\n * - during orchestration (e.g. the unauthenticated login redirect) — the throw\n * propagates out of `renderRoot` and is caught by the loader's try/catch;\n * - deep inside streamed view components (e.g. `DocumentView` access checks,\n * `LoginView` already-authenticated) — here the throw happens during\n * `renderServerComponent` and is swallowed into the RSC stream, so it never\n * rejects the render promise.\n *\n * Recording the intent on `nav` lets the loader honor the second case by\n * inspecting `nav` after the render resolves, then re-throwing native TanStack\n * nav at the loader boundary.\n */\nexport const createPageRenderServerAdapter = (nav: PageNavIntent): ServerAdapter => ({\n ...tanstackServerAdapter,\n notFound: () => {\n nav.type = 'notFound'\n throw new Error('not-found')\n },\n permanentRedirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n redirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n})\n"],"names":["notFound","redirect","getRequest","setResponseHeader","parseCookies","buildCookieStore","headers","cookies","get","name","value","undefined","getAll","Array","from","entries","map","serializeCookie","options","cookie","encodeURIComponent","path","domain","maxAge","expires","toUTCString","httpOnly","secure","sameSite","charAt","toUpperCase","slice","tanstackServerAdapter","getCookies","request","Headers","getHeaders","to","permanentRedirect","forbidden","Error","unauthorized","setCookie","createPageRenderServerAdapter","nav","type","url"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,QAAQ,QAAQ,yBAAwB;AAC3D,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,+BAA8B;AAC5E,SAASC,YAAY,QAAQ,UAAS;AAEtC,SAASC,iBAAiBC,OAAgB;IACxC,MAAMC,UAAUH,aAAaE;IAE7B,OAAO;QACLE,KAAK,CAACC;YACJ,MAAMC,QAAQH,QAAQC,GAAG,CAACC;YAC1B,OAAOC,UAAUC,YAAY;gBAAEF;gBAAMC;YAAM,IAAIC;QACjD;QACAC,QAAQ;YACN,OAAOC,MAAMC,IAAI,CAACP,QAAQQ,OAAO,IAAIC,GAAG,CAAC,CAAC,CAACP,MAAMC,MAAM,GAAM,CAAA;oBAAED;oBAAMC;gBAAM,CAAA;QAC7E;IACF;AACF;AAEA,SAASO,gBAAgBR,IAAY,EAAEC,KAAa,EAAEQ,OAAuB;IAC3E,IAAIC,SAAS,GAAGC,mBAAmBX,MAAM,CAAC,EAAEW,mBAAmBV,QAAQ;IAEvE,IAAIQ,SAASG,MAAM;QACjBF,UAAU,CAAC,OAAO,EAAED,QAAQG,IAAI,EAAE;IACpC;IAEA,IAAIH,SAASI,QAAQ;QACnBH,UAAU,CAAC,SAAS,EAAED,QAAQI,MAAM,EAAE;IACxC;IAEA,IAAIJ,SAASK,WAAWZ,WAAW;QACjCQ,UAAU,CAAC,UAAU,EAAED,QAAQK,MAAM,EAAE;IACzC;IAEA,IAAIL,SAASM,SAAS;QACpBL,UAAU,CAAC,UAAU,EAAED,QAAQM,OAAO,CAACC,WAAW,IAAI;IACxD;IAEA,IAAIP,SAASQ,UAAU;QACrBP,UAAU;IACZ;IAEA,IAAID,SAASS,QAAQ;QACnBR,UAAU;IACZ;IAEA,IAAID,SAASU,UAAU;QACrBT,UAAU,CAAC,WAAW,EAAED,QAAQU,QAAQ,CAACC,MAAM,CAAC,GAAGC,WAAW,KAAKZ,QAAQU,QAAQ,CAACG,KAAK,CAAC,IAAI;IAChG;IAEA,OAAOZ;AACT;AAEA;;;CAGC,GACD,OAAO,MAAMa,wBAAuC;IAClDC,YAAY;QACV,MAAMC,UAAUhC;QAChB,MAAMI,UAAU,IAAI6B,QAAQD,QAAQ5B,OAAO;QAC3C,OAAOD,iBAAiBC;IAC1B;IAEA8B,YAAY;QACV,MAAMF,UAAUhC;QAChB,OAAO,IAAIiC,QAAQD,QAAQ5B,OAAO;IACpC;IAEAN,UAAU;QACR,mEAAmE;QACnE,+DAA+D;QAC/D,MAAMA;IACR;IAEAC,UAAU,CAACoB;QACT,mEAAmE;QACnE,+DAA+D;QAC/D,MAAMpB,SAAS;YAAEoC,IAAIhB;QAAK;IAC5B;IAEAiB,mBAAmB,CAACjB;QAClB,yEAAyE;QACzE,qEAAqE;QACrE,+DAA+D;QAC/D,MAAMpB,SAAS;YAAEoC,IAAIhB;QAAK;IAC5B;IAEAkB,WAAW;QACT,wEAAwE;QACxE,wEAAwE;QACxE,MAAM,IAAIC,MAAM;IAClB;IAEAC,cAAc;QACZ,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,IAAID,MAAM;IAClB;IAEAE,WAAW,CAACjC,MAAcC,OAAeQ;QACvCf,kBAAkB,cAAcc,gBAAgBR,MAAMC,OAAOQ;IAC/D;AACF,EAAC;AAYD;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAMyB,gCAAgC,CAACC,MAAuC,CAAA;QACnF,GAAGZ,qBAAqB;QACxBhC,UAAU;YACR4C,IAAIC,IAAI,GAAG;YACX,MAAM,IAAIL,MAAM;QAClB;QACAF,mBAAmB,CAACjB;YAClBuB,IAAIC,IAAI,GAAG;YACXD,IAAIE,GAAG,GAAGzB;YACV,MAAM,IAAImB,MAAM,CAAC,SAAS,EAAEnB,MAAM;QACpC;QACApB,UAAU,CAACoB;YACTuB,IAAIC,IAAI,GAAG;YACXD,IAAIE,GAAG,GAAGzB;YACV,MAAM,IAAImB,MAAM,CAAC,SAAS,EAAEnB,MAAM;QACpC;IACF,CAAA,EAAE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toSerializable.d.ts","sourceRoot":"","sources":["../../src/utilities/toSerializable.ts"],"names":[],"mappings":"AA6HA,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE7C"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively strip values that seroval cannot serialize (React elements,
|
|
3
|
+
* functions, Symbols) while preserving Maps, Sets, Dates, typed arrays, etc.
|
|
4
|
+
*
|
|
5
|
+
* TanStack Start uses seroval to transfer server function return values to
|
|
6
|
+
* the client. Payload's `getClientConfig` / `getLayoutData` may include
|
|
7
|
+
* callback functions or RegExp instances that seroval chokes on. Running
|
|
8
|
+
* the data through this function before returning from a `createServerFn`
|
|
9
|
+
* handler keeps the transfer safe.
|
|
10
|
+
*
|
|
11
|
+
* For server functions whose payloads contain React elements (e.g. the
|
|
12
|
+
* shared `form-state` / `render-list` / `render-document` handlers), use
|
|
13
|
+
* `serializeForRsc` instead — it converts elements into RSC handles rather
|
|
14
|
+
* than stripping them.
|
|
15
|
+
*
|
|
16
|
+
* Uses a WeakMap cache so that shared object references (e.g. the same array
|
|
17
|
+
* referenced by both `doc.hasMany` and `formState.hasMany.value`) are
|
|
18
|
+
* returned correctly instead of being dropped as "already seen".
|
|
19
|
+
*
|
|
20
|
+
* A separate `ancestors` WeakSet tracks objects currently being recursed into.
|
|
21
|
+
* If an object is encountered while it is still on the recursion stack, the
|
|
22
|
+
* reference is circular and is replaced with `undefined` to keep the output
|
|
23
|
+
* JSON-safe. Once recursion completes the object is removed from `ancestors`,
|
|
24
|
+
* so sibling/cousin references to the same (fully-processed) object still
|
|
25
|
+
* resolve to the cached clone.
|
|
26
|
+
*/ function stripUnserializable(value, cache = new WeakMap(), ancestors = new WeakSet()) {
|
|
27
|
+
if (value === null || value === undefined) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
const t = typeof value;
|
|
31
|
+
if (t === 'function' || t === 'symbol') {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (t !== 'object') {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
const obj = value;
|
|
38
|
+
if (typeof obj.$$typeof === 'symbol') {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if (ancestors.has(obj)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (cache.has(obj)) {
|
|
45
|
+
return cache.get(obj);
|
|
46
|
+
}
|
|
47
|
+
if (obj instanceof Date) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
// RegExp: seroval's SSR bootstrap emits regex literals with broken escape
|
|
51
|
+
// sequences (e.g. `/!\\[.../` instead of `/!\[.../`), crashing the client
|
|
52
|
+
// script that populates `window.$_TSR` and preventing hydration. Rich-text
|
|
53
|
+
// feature transformer regexes aren't needed on the client (they drive
|
|
54
|
+
// server-side markdown import/export), so strip them here.
|
|
55
|
+
if (obj instanceof RegExp) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
ancestors.add(obj);
|
|
59
|
+
if (obj instanceof Map) {
|
|
60
|
+
const cleaned = new Map();
|
|
61
|
+
cache.set(obj, cleaned);
|
|
62
|
+
for (const [k, v] of obj){
|
|
63
|
+
const cv = stripUnserializable(v, cache, ancestors);
|
|
64
|
+
if (cv !== undefined) {
|
|
65
|
+
cleaned.set(k, cv);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
ancestors.delete(obj);
|
|
69
|
+
return cleaned;
|
|
70
|
+
}
|
|
71
|
+
if (obj instanceof Set) {
|
|
72
|
+
const cleaned = new Set();
|
|
73
|
+
cache.set(obj, cleaned);
|
|
74
|
+
for (const v of obj){
|
|
75
|
+
const cv = stripUnserializable(v, cache, ancestors);
|
|
76
|
+
if (cv !== undefined) {
|
|
77
|
+
cleaned.add(cv);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
ancestors.delete(obj);
|
|
81
|
+
return cleaned;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(obj)) {
|
|
84
|
+
const arr = [];
|
|
85
|
+
cache.set(obj, arr);
|
|
86
|
+
for (const item of obj){
|
|
87
|
+
arr.push(stripUnserializable(item, cache, ancestors));
|
|
88
|
+
}
|
|
89
|
+
ancestors.delete(obj);
|
|
90
|
+
return arr;
|
|
91
|
+
}
|
|
92
|
+
if (ArrayBuffer.isView(obj)) {
|
|
93
|
+
ancestors.delete(obj);
|
|
94
|
+
return obj;
|
|
95
|
+
}
|
|
96
|
+
const result = {};
|
|
97
|
+
cache.set(obj, result);
|
|
98
|
+
for (const key of Object.keys(obj)){
|
|
99
|
+
const v = stripUnserializable(obj[key], cache, ancestors);
|
|
100
|
+
if (v !== undefined) {
|
|
101
|
+
result[key] = v;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
ancestors.delete(obj);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
export function toSerializable(value) {
|
|
108
|
+
return stripUnserializable(value);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=toSerializable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/toSerializable.ts"],"sourcesContent":["/**\n * Recursively strip values that seroval cannot serialize (React elements,\n * functions, Symbols) while preserving Maps, Sets, Dates, typed arrays, etc.\n *\n * TanStack Start uses seroval to transfer server function return values to\n * the client. Payload's `getClientConfig` / `getLayoutData` may include\n * callback functions or RegExp instances that seroval chokes on. Running\n * the data through this function before returning from a `createServerFn`\n * handler keeps the transfer safe.\n *\n * For server functions whose payloads contain React elements (e.g. the\n * shared `form-state` / `render-list` / `render-document` handlers), use\n * `serializeForRsc` instead — it converts elements into RSC handles rather\n * than stripping them.\n *\n * Uses a WeakMap cache so that shared object references (e.g. the same array\n * referenced by both `doc.hasMany` and `formState.hasMany.value`) are\n * returned correctly instead of being dropped as \"already seen\".\n *\n * A separate `ancestors` WeakSet tracks objects currently being recursed into.\n * If an object is encountered while it is still on the recursion stack, the\n * reference is circular and is replaced with `undefined` to keep the output\n * JSON-safe. Once recursion completes the object is removed from `ancestors`,\n * so sibling/cousin references to the same (fully-processed) object still\n * resolve to the cached clone.\n */\nfunction stripUnserializable(\n value: unknown,\n cache = new WeakMap<object, unknown>(),\n ancestors = new WeakSet<object>(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n // RegExp: seroval's SSR bootstrap emits regex literals with broken escape\n // sequences (e.g. `/!\\\\[.../` instead of `/!\\[.../`), crashing the client\n // script that populates `window.$_TSR` and preventing hydration. Rich-text\n // feature transformer regexes aren't needed on the client (they drive\n // server-side markdown import/export), so strip them here.\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n\nexport function toSerializable<T>(value: T): T {\n return stripUnserializable(value) as T\n}\n"],"names":["stripUnserializable","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys","toSerializable"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,SAASA,oBACPC,KAAc,EACdC,QAAQ,IAAIC,SAA0B,EACtCC,YAAY,IAAIC,SAAiB;IAEjC,IAAIJ,UAAU,QAAQA,UAAUK,WAAW;QACzC,OAAOL;IACT;IAEA,MAAMM,IAAI,OAAON;IACjB,IAAIM,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAON;IACT;IAEA,MAAMO,MAAMP;IAEZ,IAAI,OAAOO,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAOH;IACT;IAEA,IAAIF,UAAUM,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIJ,MAAMQ,GAAG,CAACF,MAAM;QAClB,OAAON,MAAMS,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,OAAOJ;IACT;IAEA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,sEAAsE;IACtE,2DAA2D;IAC3D,IAAIA,eAAeK,QAAQ;QACzB,OAAOP;IACT;IAEAF,UAAUU,GAAG,CAACN;IAEd,IAAIA,eAAeO,KAAK;QACtB,MAAMC,UAAU,IAAID;QACpBb,MAAMe,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAM,CAACE,GAAGC,EAAE,IAAIX,IAAK;YACxB,MAAMY,KAAKpB,oBAAoBmB,GAAGjB,OAAOE;YACzC,IAAIgB,OAAOd,WAAW;gBACpBU,QAAQC,GAAG,CAACC,GAAGE;YACjB;QACF;QACAhB,UAAUiB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIR,eAAec,KAAK;QACtB,MAAMN,UAAU,IAAIM;QACpBpB,MAAMe,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAMG,KAAKX,IAAK;YACnB,MAAMY,KAAKpB,oBAAoBmB,GAAGjB,OAAOE;YACzC,IAAIgB,OAAOd,WAAW;gBACpBU,QAAQF,GAAG,CAACM;YACd;QACF;QACAhB,UAAUiB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIO,MAAMC,OAAO,CAAChB,MAAM;QACtB,MAAMiB,MAAiB,EAAE;QACzBvB,MAAMe,GAAG,CAACT,KAAKiB;QACf,KAAK,MAAMC,QAAQlB,IAAK;YACtBiB,IAAIE,IAAI,CAAC3B,oBAAoB0B,MAAMxB,OAAOE;QAC5C;QACAA,UAAUiB,MAAM,CAACb;QACjB,OAAOiB;IACT;IAEA,IAAIG,YAAYC,MAAM,CAACrB,MAAM;QAC3BJ,UAAUiB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAMsB,SAAkC,CAAC;IACzC5B,MAAMe,GAAG,CAACT,KAAKsB;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAACzB,KAAM;QAClC,MAAMW,IAAInB,oBAAoBQ,GAAG,CAACuB,IAAI,EAAE7B,OAAOE;QAC/C,IAAIe,MAAMb,WAAW;YACnBwB,MAAM,CAACC,IAAI,GAAGZ;QAChB;IACF;IACAf,UAAUiB,MAAM,CAACb;IACjB,OAAOsB;AACT;AAEA,OAAO,SAASI,eAAkBjC,KAAQ;IACxC,OAAOD,oBAAoBC;AAC7B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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. The RSC graph is narrower — plugins and storage adapters
|
|
20
|
+
* don't run in RSC, only the admin UI surface does.
|
|
21
|
+
*/
|
|
22
|
+
export declare const payloadRscNoExternalPatterns: Array<RegExp | string>;
|
|
23
|
+
/**
|
|
24
|
+
* Packages we know contain Node-only code or top-level side effects requiring
|
|
25
|
+
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
26
|
+
* walking into their main entries and trying to bundle server-only imports
|
|
27
|
+
* for the browser.
|
|
28
|
+
*/
|
|
29
|
+
export declare const optimizeDepsExcludeDefaults: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
32
|
+
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
33
|
+
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
34
|
+
* list them explicitly using the `parent > child` syntax.
|
|
35
|
+
*/
|
|
36
|
+
export declare const optimizeDepsIncludeDefaults: string[];
|
|
37
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAK/D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAqC/C,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite-level configuration constants used by `payloadPlugin`. Kept separate so
|
|
3
|
+
* `plugin.ts` stays focused on wiring.
|
|
4
|
+
*/ /**
|
|
5
|
+
* Server-only packages (Node-only or only ever used by the server bundle).
|
|
6
|
+
* These are the Vite equivalent of Next.js's `serverExternalPackages`.
|
|
7
|
+
*/ export const ssrExternalPackages = [
|
|
8
|
+
'ajv',
|
|
9
|
+
'fast-uri',
|
|
10
|
+
'drizzle-kit',
|
|
11
|
+
'drizzle-kit/api',
|
|
12
|
+
'drizzle-orm',
|
|
13
|
+
'sharp',
|
|
14
|
+
'libsql',
|
|
15
|
+
'require-in-the-middle',
|
|
16
|
+
'json-schema-to-typescript',
|
|
17
|
+
'pino',
|
|
18
|
+
'pino-pretty',
|
|
19
|
+
'graphql',
|
|
20
|
+
'mongodb',
|
|
21
|
+
'mongoose',
|
|
22
|
+
'better-sqlite3',
|
|
23
|
+
'pg',
|
|
24
|
+
'pg-native',
|
|
25
|
+
'nodemailer',
|
|
26
|
+
'aws4',
|
|
27
|
+
'pluralize',
|
|
28
|
+
'console-table-printer',
|
|
29
|
+
'@azure/storage-blob',
|
|
30
|
+
'@aws-sdk/client-s3',
|
|
31
|
+
'@aws-sdk/s3-request-presigner',
|
|
32
|
+
'@google-cloud/storage'
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Payload packages whose source must be processed by Vite even on the server
|
|
36
|
+
* (because they are workspace `.ts` files in dev). Server-only adapters
|
|
37
|
+
* (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
|
|
38
|
+
* intentionally not included — those should stay external on the SSR side.
|
|
39
|
+
*/ export const payloadNoExternalPatterns = [
|
|
40
|
+
'@payloadcms/ui',
|
|
41
|
+
'@payloadcms/translations',
|
|
42
|
+
'@payloadcms/tanstack-start',
|
|
43
|
+
/^@payloadcms\/richtext-lexical/,
|
|
44
|
+
/^@payloadcms\/plugin-/,
|
|
45
|
+
/^@payloadcms\/storage-/
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* The subset of `payloadNoExternalPatterns` that needs to participate in the
|
|
49
|
+
* RSC environment. The RSC graph is narrower — plugins and storage adapters
|
|
50
|
+
* don't run in RSC, only the admin UI surface does.
|
|
51
|
+
*/ export const payloadRscNoExternalPatterns = [
|
|
52
|
+
'@payloadcms/ui',
|
|
53
|
+
'@payloadcms/translations',
|
|
54
|
+
'@payloadcms/tanstack-start',
|
|
55
|
+
/^@payloadcms\/richtext-lexical/
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Packages we know contain Node-only code or top-level side effects requiring
|
|
59
|
+
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
60
|
+
* walking into their main entries and trying to bundle server-only imports
|
|
61
|
+
* for the browser.
|
|
62
|
+
*/ export const optimizeDepsExcludeDefaults = [
|
|
63
|
+
'sharp',
|
|
64
|
+
'@payloadcms/ui',
|
|
65
|
+
'@payloadcms/tanstack-start',
|
|
66
|
+
'payload',
|
|
67
|
+
'pino',
|
|
68
|
+
'pino-pretty',
|
|
69
|
+
'busboy',
|
|
70
|
+
'get-tsconfig',
|
|
71
|
+
'ws',
|
|
72
|
+
'croner',
|
|
73
|
+
'prompts',
|
|
74
|
+
'file-type',
|
|
75
|
+
// Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite
|
|
76
|
+
// sometimes walks these from the main package entry while scanning
|
|
77
|
+
// workspace deps, and the browser sub-bundles do not expose the
|
|
78
|
+
// server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
|
|
79
|
+
// server with a `MISSING_EXPORT` error before any test runs.
|
|
80
|
+
'@azure/storage-blob',
|
|
81
|
+
'@aws-sdk/client-s3',
|
|
82
|
+
'@aws-sdk/s3-request-presigner',
|
|
83
|
+
'@google-cloud/storage'
|
|
84
|
+
];
|
|
85
|
+
/**
|
|
86
|
+
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
87
|
+
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
88
|
+
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
89
|
+
* list them explicitly using the `parent > child` syntax.
|
|
90
|
+
*/ export const optimizeDepsIncludeDefaults = [
|
|
91
|
+
'@payloadcms/ui > sonner',
|
|
92
|
+
'@payloadcms/ui > @faceless-ui/modal',
|
|
93
|
+
'@payloadcms/ui > @faceless-ui/window-info',
|
|
94
|
+
'@payloadcms/ui > @faceless-ui/scroll-info',
|
|
95
|
+
'@payloadcms/ui > @dnd-kit/core',
|
|
96
|
+
'@payloadcms/ui > @dnd-kit/sortable',
|
|
97
|
+
'@payloadcms/ui > @dnd-kit/utilities',
|
|
98
|
+
'@payloadcms/ui > react-datepicker',
|
|
99
|
+
'@payloadcms/ui > react-select',
|
|
100
|
+
'@payloadcms/ui > react-select/creatable',
|
|
101
|
+
'@payloadcms/ui > react-image-crop',
|
|
102
|
+
'@payloadcms/ui > @monaco-editor/react',
|
|
103
|
+
'@payloadcms/ui > date-fns',
|
|
104
|
+
'@payloadcms/ui > date-fns/transpose',
|
|
105
|
+
'@payloadcms/ui > @date-fns/tz/date/mini',
|
|
106
|
+
'@payloadcms/ui > uuid',
|
|
107
|
+
'@payloadcms/ui > use-context-selector',
|
|
108
|
+
'@payloadcms/ui > bson-objectid',
|
|
109
|
+
'@payloadcms/ui > dequal',
|
|
110
|
+
'@payloadcms/ui > object-to-formdata',
|
|
111
|
+
'@payloadcms/ui > md5',
|
|
112
|
+
'payload > deepmerge',
|
|
113
|
+
'payload > pluralize',
|
|
114
|
+
'scheduler',
|
|
115
|
+
// Transitive deps that Vite otherwise discovers *after* the initial crawl
|
|
116
|
+
// (react-select pulls in @floating-ui at runtime; react-is is reached via
|
|
117
|
+
// react-transition-group/prop-types; the default date-fns locale is loaded
|
|
118
|
+
// through a dynamic `date-fns/locale/${key}` import). A late discovery forces
|
|
119
|
+
// a full dep re-optimization mid-session, which 404s every in-flight
|
|
120
|
+
// `.vite/deps/*` chunk ("Pre-transform error: file does not exist in the
|
|
121
|
+
// optimize deps directory") and breaks the admin UI in CI cold starts.
|
|
122
|
+
// Pre-bundling them keeps the first optimization pass complete.
|
|
123
|
+
'@payloadcms/ui > react-select > @floating-ui/dom',
|
|
124
|
+
'@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',
|
|
125
|
+
'@payloadcms/ui > react-select > prop-types > react-is',
|
|
126
|
+
'@payloadcms/ui > date-fns/locale/en-US'
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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. The RSC graph is narrower — plugins and storage adapters\n * don't run in RSC, only the admin UI surface does.\n */\nexport const payloadRscNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\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',\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]\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;;;;CAIC,GACD,OAAO,MAAMC,+BAAuD;IAClE;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;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;CACD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifiers that must never appear in the client module graph. These are the
|
|
3
|
+
* server-only Payload entry points plus Node.js built-ins and a handful of
|
|
4
|
+
* Node-only npm packages that Payload pulls in transitively.
|
|
5
|
+
*/
|
|
6
|
+
export declare const serverOnlyClientSpecifiers: Array<RegExp | string>;
|
|
7
|
+
/**
|
|
8
|
+
* Allowlist callback for the `tanstackStart` plugin's import-protection. These
|
|
9
|
+
* are the legitimate cross-environment imports in our monorepo that we want
|
|
10
|
+
* to permit even when they appear to cross a server/client boundary.
|
|
11
|
+
*/
|
|
12
|
+
export declare function onImportProtectionViolation(violation: unknown): boolean | void;
|
|
13
|
+
export declare const defaultImportProtectionIgnoreImporters: RegExp[];
|
|
14
|
+
//# sourceMappingURL=importProtection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|