payload-react-router 0.0.0-stage → 0.1.0

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.
Files changed (93) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +263 -2
  3. package/dist/client/PayloadRootProviders.d.ts +22 -0
  4. package/dist/client/PayloadRootProviders.js +29 -0
  5. package/dist/client/PayloadRootProviders.js.map +1 -0
  6. package/dist/client/RouterAdapter.d.ts +14 -0
  7. package/dist/client/RouterAdapter.js +64 -0
  8. package/dist/client/RouterAdapter.js.map +1 -0
  9. package/dist/client/navigation.d.ts +11 -0
  10. package/dist/client/navigation.js +31 -0
  11. package/dist/client/navigation.js.map +1 -0
  12. package/dist/exports/client.d.ts +2 -0
  13. package/dist/exports/client.js +3 -0
  14. package/dist/exports/client.js.map +1 -0
  15. package/dist/exports/server.d.ts +10 -0
  16. package/dist/exports/server.js +11 -0
  17. package/dist/exports/server.js.map +1 -0
  18. package/dist/exports/vite.d.ts +1 -0
  19. package/dist/exports/vite.js +2 -0
  20. package/dist/exports/vite.js.map +1 -0
  21. package/dist/server/adminPage.d.ts +50 -0
  22. package/dist/server/adminPage.js +136 -0
  23. package/dist/server/adminPage.js.map +1 -0
  24. package/dist/server/auth.d.ts +16 -0
  25. package/dist/server/auth.js +17 -0
  26. package/dist/server/auth.js.map +1 -0
  27. package/dist/server/cookies.d.ts +3 -0
  28. package/dist/server/cookies.js +27 -0
  29. package/dist/server/cookies.js.map +1 -0
  30. package/dist/server/graphql.d.ts +9 -0
  31. package/dist/server/graphql.js +114 -0
  32. package/dist/server/graphql.js.map +1 -0
  33. package/dist/server/initAdminContext.d.ts +17 -0
  34. package/dist/server/initAdminContext.js +39 -0
  35. package/dist/server/initAdminContext.js.map +1 -0
  36. package/dist/server/layout.d.ts +28 -0
  37. package/dist/server/layout.js +37 -0
  38. package/dist/server/layout.js.map +1 -0
  39. package/dist/server/middleware.d.ts +16 -0
  40. package/dist/server/middleware.js +35 -0
  41. package/dist/server/middleware.js.map +1 -0
  42. package/dist/server/requestStore.d.ts +29 -0
  43. package/dist/server/requestStore.js +54 -0
  44. package/dist/server/requestStore.js.map +1 -0
  45. package/dist/server/rest.d.ts +34 -0
  46. package/dist/server/rest.js +54 -0
  47. package/dist/server/rest.js.map +1 -0
  48. package/dist/server/searchParams.d.ts +6 -0
  49. package/dist/server/searchParams.js +13 -0
  50. package/dist/server/searchParams.js.map +1 -0
  51. package/dist/server/serverAdapter.d.ts +28 -0
  52. package/dist/server/serverAdapter.js +79 -0
  53. package/dist/server/serverAdapter.js.map +1 -0
  54. package/dist/server/serverFunctions.d.ts +21 -0
  55. package/dist/server/serverFunctions.js +25 -0
  56. package/dist/server/serverFunctions.js.map +1 -0
  57. package/dist/vite/config/external.d.ts +43 -0
  58. package/dist/vite/config/external.js +102 -0
  59. package/dist/vite/config/external.js.map +1 -0
  60. package/dist/vite/config/optimizeDeps.d.ts +24 -0
  61. package/dist/vite/config/optimizeDeps.js +162 -0
  62. package/dist/vite/config/optimizeDeps.js.map +1 -0
  63. package/dist/vite/config/scss.d.ts +13 -0
  64. package/dist/vite/config/scss.js +29 -0
  65. package/dist/vite/config/scss.js.map +1 -0
  66. package/dist/vite/devConfigReload.d.ts +13 -0
  67. package/dist/vite/devConfigReload.js +74 -0
  68. package/dist/vite/devConfigReload.js.map +1 -0
  69. package/dist/vite/devConfigReload.server.d.ts +1 -0
  70. package/dist/vite/devConfigReload.server.js +62 -0
  71. package/dist/vite/devConfigReload.server.js.map +1 -0
  72. package/dist/vite/devConfigReloadEvent.d.ts +8 -0
  73. package/dist/vite/devConfigReloadEvent.js +9 -0
  74. package/dist/vite/devConfigReloadEvent.js.map +1 -0
  75. package/dist/vite/index.d.ts +31 -0
  76. package/dist/vite/index.js +148 -0
  77. package/dist/vite/index.js.map +1 -0
  78. package/dist/vite/workarounds/clientModuleResolution.d.ts +13 -0
  79. package/dist/vite/workarounds/clientModuleResolution.js +80 -0
  80. package/dist/vite/workarounds/clientModuleResolution.js.map +1 -0
  81. package/dist/vite/workarounds/reactDomServerInRsc.d.ts +26 -0
  82. package/dist/vite/workarounds/reactDomServerInRsc.js +84 -0
  83. package/dist/vite/workarounds/reactDomServerInRsc.js.map +1 -0
  84. package/dist/vite/workarounds/stripDistStyleImports.d.ts +20 -0
  85. package/dist/vite/workarounds/stripDistStyleImports.js +140 -0
  86. package/dist/vite/workarounds/stripDistStyleImports.js.map +1 -0
  87. package/dist/vite/workarounds/stubPrettierInClient.d.ts +12 -0
  88. package/dist/vite/workarounds/stubPrettierInClient.js +32 -0
  89. package/dist/vite/workarounds/stubPrettierInClient.js.map +1 -0
  90. package/dist/vite/workarounds/wrapCjsForClient.d.ts +14 -0
  91. package/dist/vite/workarounds/wrapCjsForClient.js +104 -0
  92. package/dist/vite/workarounds/wrapCjsForClient.js.map +1 -0
  93. package/package.json +79 -4
@@ -0,0 +1,34 @@
1
+ import type { SanitizedConfig } from 'payload';
2
+ type ConfigInput = Promise<SanitizedConfig> | SanitizedConfig;
3
+ /**
4
+ * Routes an `/api/*` request to Payload: `POST {api}{graphQL}` to the GraphQL
5
+ * handler, everything else to the REST endpoint handler. Plain Web `Request` →
6
+ * `Response`; nothing React Router specific.
7
+ */
8
+ export declare function handleAPIRoute({ config, request, }: {
9
+ config: ConfigInput;
10
+ request: Request;
11
+ }): Promise<Response>;
12
+ type RouteArgs = {
13
+ request: Request;
14
+ };
15
+ /**
16
+ * Builds the exports of the `/api/*` resource route:
17
+ *
18
+ * ```ts
19
+ * // app/routes/payload/api.ts
20
+ * export const { action, loader, middleware } = createAPIRoute({ config })
21
+ * ```
22
+ *
23
+ * `loader` answers GET; `action` answers POST / PUT / PATCH / DELETE.
24
+ * React Router calls neither for OPTIONS (CORS preflight), so a route
25
+ * middleware answers it.
26
+ */
27
+ export declare function createAPIRoute({ config }: {
28
+ config: ConfigInput;
29
+ }): {
30
+ action: ({ request }: RouteArgs) => Promise<Response>;
31
+ loader: ({ request }: RouteArgs) => Promise<Response>;
32
+ middleware: (({ request }: RouteArgs, next: () => Promise<Response>) => Promise<Response>)[];
33
+ };
34
+ export {};
@@ -0,0 +1,54 @@
1
+ import { handleEndpoints } from 'payload';
2
+ import { handleGraphQL } from "./graphql.js";
3
+ /**
4
+ * Routes an `/api/*` request to Payload: `POST {api}{graphQL}` to the GraphQL
5
+ * handler, everything else to the REST endpoint handler. Plain Web `Request` →
6
+ * `Response`; nothing React Router specific.
7
+ */
8
+ export async function handleAPIRoute({ config, request, }) {
9
+ const resolvedConfig = await config;
10
+ const apiRoute = resolvedConfig.routes.api;
11
+ const { pathname } = new URL(request.url);
12
+ const slug = pathname.startsWith(apiRoute) ? pathname.slice(apiRoute.length) : pathname;
13
+ const segments = slug.split('/').filter(Boolean);
14
+ const path = segments.length > 0 ? `${apiRoute}/${segments.join('/')}` : apiRoute;
15
+ const graphQLRoute = `${apiRoute}${resolvedConfig.routes.graphQL}`;
16
+ if (request.method === 'POST' && path === graphQLRoute) {
17
+ return handleGraphQL({ config: resolvedConfig, request });
18
+ }
19
+ return handleEndpoints({ config: resolvedConfig, path, request });
20
+ }
21
+ /**
22
+ * Builds the exports of the `/api/*` resource route:
23
+ *
24
+ * ```ts
25
+ * // app/routes/payload/api.ts
26
+ * export const { action, loader, middleware } = createAPIRoute({ config })
27
+ * ```
28
+ *
29
+ * `loader` answers GET; `action` answers POST / PUT / PATCH / DELETE.
30
+ * React Router calls neither for OPTIONS (CORS preflight), so a route
31
+ * middleware answers it.
32
+ */
33
+ export function createAPIRoute({ config }) {
34
+ const handle = ({ request }) => handleAPIRoute({ config, request });
35
+ const answerPreflight = async ({ request }, next) => {
36
+ if (request.method !== 'OPTIONS') {
37
+ return next();
38
+ }
39
+ const response = await handle({ request });
40
+ // In RSC mode, a response produced by a resource route's middleware is not
41
+ // tagged as a resource response (react-router 8.4 `generateResourceResponse`
42
+ // only tags handler output), so the HTML renderer would try to decode it as
43
+ // an RSC stream. Tag it here. See NOTES.md, P10.
44
+ const headers = new Headers(response.headers);
45
+ headers.set('React-Router-Resource', 'true');
46
+ return new Response(response.body, { headers, status: response.status, statusText: response.statusText });
47
+ };
48
+ return {
49
+ action: handle,
50
+ loader: handle,
51
+ middleware: [answerPreflight],
52
+ };
53
+ }
54
+ //# sourceMappingURL=rest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/server/rest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAI5C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GAIR;IACC,MAAM,cAAc,GAAG,MAAM,MAAM,CAAA;IACnC,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,CAAA;IAC1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;IACvF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAA;IAEjF,MAAM,YAAY,GAAG,GAAG,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IAClE,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QACv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 * a repeated key becomes an array, a single one stays a string.
5
+ */
6
+ export declare function toSearchParams(url: URL): SearchParams;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `URL.searchParams` in the shape Payload views expect (Next's `searchParams`):
3
+ * a repeated key becomes an array, a single one stays a string.
4
+ */
5
+ export function toSearchParams(url) {
6
+ const result = {};
7
+ for (const key of new Set(url.searchParams.keys())) {
8
+ const values = url.searchParams.getAll(key);
9
+ result[key] = values.length > 1 ? values : values[0];
10
+ }
11
+ return result;
12
+ }
13
+ //# sourceMappingURL=searchParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchParams.js","sourceRoot":"","sources":["../../src/server/searchParams.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,MAAM,MAAM,GAAiB,EAAE,CAAA;IAC/B,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAA;IACvD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { ServerAdapter } from 'payload';
2
+ /**
3
+ * `ServerAdapter` for React Router, used everywhere except while rendering an
4
+ * admin page (see {@link createPageRenderServerAdapter}).
5
+ *
6
+ * Navigation throws a `Response`, which React Router honours from loaders,
7
+ * actions, resource routes and server functions alike. Unlike the TanStack
8
+ * adapter, `forbidden` / `unauthorized` / `permanentRedirect` keep their real
9
+ * HTTP status (403 / 401 / 308).
10
+ */
11
+ export declare const reactRouterServerAdapter: ServerAdapter;
12
+ /** Navigation requested while an admin page was rendering. */
13
+ export type PageNavIntent = {
14
+ type?: 'notFound' | 'redirect';
15
+ url?: string;
16
+ };
17
+ /**
18
+ * `ServerAdapter` for the admin page render (`renderRoot`).
19
+ *
20
+ * Views call `req.server.redirect()` / `.notFound()` deep inside async server
21
+ * components. A throw there happens while the tree is being serialized and can
22
+ * no longer change the HTTP response, so — like the TanStack adapter — the intent
23
+ * is recorded on `nav` and the framework-neutral string errors are thrown:
24
+ * `Error('redirect:<url>')` and `Error('not-found')`. `DocumentView` already
25
+ * recognises both (`@payloadcms/ui/views/Document`), so no shared code changes.
26
+ * `loadAdminPage` renders the tree to completion, then honours `nav`.
27
+ */
28
+ export declare const createPageRenderServerAdapter: (nav: PageNavIntent) => ServerAdapter;
@@ -0,0 +1,79 @@
1
+ import { parseCookies } from 'payload';
2
+ import { redirect } from 'react-router';
3
+ import { serializeCookie } from "./cookies.js";
4
+ import { getRequest, getRequestStore } from "./requestStore.js";
5
+ function buildCookieStore(headers) {
6
+ const cookies = parseCookies(headers);
7
+ return {
8
+ get: (name) => {
9
+ const value = cookies.get(name);
10
+ return value !== undefined ? { name, value } : undefined;
11
+ },
12
+ getAll: () => Array.from(cookies.entries()).map(([name, value]) => ({ name, value })),
13
+ };
14
+ }
15
+ /**
16
+ * `ServerAdapter` for React Router, used everywhere except while rendering an
17
+ * admin page (see {@link createPageRenderServerAdapter}).
18
+ *
19
+ * Navigation throws a `Response`, which React Router honours from loaders,
20
+ * actions, resource routes and server functions alike. Unlike the TanStack
21
+ * adapter, `forbidden` / `unauthorized` / `permanentRedirect` keep their real
22
+ * HTTP status (403 / 401 / 308).
23
+ */
24
+ export const reactRouterServerAdapter = {
25
+ forbidden: () => {
26
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- React Router control flow
27
+ throw new Response('Forbidden', { status: 403 });
28
+ },
29
+ getCookies: () => buildCookieStore(getRequest().headers),
30
+ getHeaders: () => new Headers(getRequest().headers),
31
+ notFound: () => {
32
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- React Router control flow
33
+ throw new Response('Not Found', { status: 404 });
34
+ },
35
+ permanentRedirect: (path) => {
36
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- React Router control flow
37
+ throw redirect(path, 308);
38
+ },
39
+ redirect: (path) => {
40
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- React Router control flow
41
+ throw redirect(path);
42
+ },
43
+ setCookie: (name, value, options) => {
44
+ getRequestStore().setCookies.push(serializeCookie(name, value, options));
45
+ },
46
+ unauthorized: () => {
47
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- React Router control flow
48
+ throw new Response('Unauthorized', { status: 401 });
49
+ },
50
+ };
51
+ /**
52
+ * `ServerAdapter` for the admin page render (`renderRoot`).
53
+ *
54
+ * Views call `req.server.redirect()` / `.notFound()` deep inside async server
55
+ * components. A throw there happens while the tree is being serialized and can
56
+ * no longer change the HTTP response, so — like the TanStack adapter — the intent
57
+ * is recorded on `nav` and the framework-neutral string errors are thrown:
58
+ * `Error('redirect:<url>')` and `Error('not-found')`. `DocumentView` already
59
+ * recognises both (`@payloadcms/ui/views/Document`), so no shared code changes.
60
+ * `loadAdminPage` renders the tree to completion, then honours `nav`.
61
+ */
62
+ export const createPageRenderServerAdapter = (nav) => ({
63
+ ...reactRouterServerAdapter,
64
+ notFound: () => {
65
+ nav.type = 'notFound';
66
+ throw new Error('not-found');
67
+ },
68
+ permanentRedirect: (path) => {
69
+ nav.type = 'redirect';
70
+ nav.url = path;
71
+ throw new Error(`redirect:${path}`);
72
+ },
73
+ redirect: (path) => {
74
+ nav.type = 'redirect';
75
+ nav.url = path;
76
+ throw new Error(`redirect:${path}`);
77
+ },
78
+ });
79
+ //# sourceMappingURL=serverAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverAdapter.js","sourceRoot":"","sources":["../../src/server/serverAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,QAA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 -0,0 +1,21 @@
1
+ import type { ServerFunctionHandler } from 'payload';
2
+ /**
3
+ * Payload's server-function dispatcher bound to React Router's request.
4
+ *
5
+ * In React Router's RSC mode, server functions are real React Server Functions
6
+ * (`'use server'`), so their results — including the `ReactNode`s returned by
7
+ * `render-document`, `render-list` or `form-state` — travel over the Flight
8
+ * protocol natively, as under Next.js. No `transformResult` is needed (TanStack
9
+ * needs `serializeForRsc` because its server functions use seroval).
10
+ *
11
+ * Call it from an app-owned `'use server'` module that binds `config` and the
12
+ * generated `importMap`:
13
+ *
14
+ * ```ts
15
+ * 'use server'
16
+ * export async function serverFunction(args, _options) {
17
+ * return handleServerFunctions({ ...args, config, importMap })
18
+ * }
19
+ * ```
20
+ */
21
+ export declare const handleServerFunctions: ServerFunctionHandler;
@@ -0,0 +1,25 @@
1
+ import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions';
2
+ import { initAdminContext } from "./initAdminContext.js";
3
+ /**
4
+ * Payload's server-function dispatcher bound to React Router's request.
5
+ *
6
+ * In React Router's RSC mode, server functions are real React Server Functions
7
+ * (`'use server'`), so their results — including the `ReactNode`s returned by
8
+ * `render-document`, `render-list` or `form-state` — travel over the Flight
9
+ * protocol natively, as under Next.js. No `transformResult` is needed (TanStack
10
+ * needs `serializeForRsc` because its server functions use seroval).
11
+ *
12
+ * Call it from an app-owned `'use server'` module that binds `config` and the
13
+ * generated `importMap`:
14
+ *
15
+ * ```ts
16
+ * 'use server'
17
+ * export async function serverFunction(args, _options) {
18
+ * return handleServerFunctions({ ...args, config, importMap })
19
+ * }
20
+ * ```
21
+ */
22
+ export const handleServerFunctions = createServerFunctionHandler({
23
+ initAdminContext: ({ configPromise, importMap }) => initAdminContext({ configPromise, importMap, key: 'RootLayout' }),
24
+ });
25
+ //# sourceMappingURL=serverFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverFunctions.js","sourceRoot":"","sources":["../../src/server/serverFunctions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,2BAA2B,CAAC;IACtF,gBAAgB,EAAE,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,CACjD,gBAAgB,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;CACpE,CAAC,CAAA"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
+ * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Packages externalized during dev serve (`ssr.external`). Node's loader resolves
7
+ * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
8
+ * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
9
+ * throws when transformed rather than required).
10
+ *
11
+ * Safe here whoever declared the entry: Node resolves from the importing package,
12
+ * so pnpm's isolated layout never applies. The build is stricter — see
13
+ * {@link buildBundledPackages}.
14
+ */
15
+ export declare const ssrExternalPackages: string[];
16
+ /**
17
+ * Entries of {@link ssrExternalPackages} that must bundle in the production build.
18
+ *
19
+ * Externalizing only works for specifiers resolvable from the project root. These
20
+ * are leaf deps of Payload packages, so under pnpm they live in `.pnpm/…` and a bare
21
+ * specifier in a root-resolved chunk is invisible — `ERR_MODULE_NOT_FOUND` at
22
+ * runtime, or a build-time resolve failure under Nitro's re-bundle pass.
23
+ *
24
+ * `pluralize` also needs forcing back via `noExternal` (see `withPayload`); the
25
+ * storage leaves don't, since their adapters are already `noExternal`.
26
+ */
27
+ export declare const buildBundledPackages: string[];
28
+ /**
29
+ * External packages for the production `vite build` only (not dev serve).
30
+ *
31
+ * Externalizes the `@payloadcms/*` package boundaries — plus `payload` — so each
32
+ * resolves its own transitive Node deps (`pino`, `drizzle-orm`, `libsql`, …) from
33
+ * its own `node_modules` at runtime. Externalizing only the leaf deps breaks under
34
+ * pnpm: a leaf imported by bundled code becomes an unresolvable bare specifier from
35
+ * `dist/`, since pnpm does not hoist it; see {@link buildBundledPackages}.
36
+ *
37
+ * Kept out of dev's `ssr.external` on purpose: the monorepo resolves these to
38
+ * TypeScript source (`.ts` imported via `.js` specifiers), which only Vite's
39
+ * transform can resolve — an externalized copy would hit Node's raw resolver and
40
+ * fail on the `.js`→`.ts` mismatch.
41
+ */
42
+ export declare const buildExternalPackages: string[];
43
+ export declare const payloadNoExternalPatterns: Array<RegExp | string>;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
+ * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Packages externalized during dev serve (`ssr.external`). Node's loader resolves
7
+ * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
8
+ * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
9
+ * throws when transformed rather than required).
10
+ *
11
+ * Safe here whoever declared the entry: Node resolves from the importing package,
12
+ * so pnpm's isolated layout never applies. The build is stricter — see
13
+ * {@link buildBundledPackages}.
14
+ */
15
+ export const ssrExternalPackages = [
16
+ 'zod',
17
+ 'fast-uri',
18
+ 'drizzle-kit',
19
+ 'drizzle-kit/api',
20
+ 'drizzle-orm',
21
+ 'sharp',
22
+ 'require-in-the-middle',
23
+ 'json-schema-to-typescript',
24
+ 'pino',
25
+ 'pino-pretty',
26
+ 'graphql',
27
+ 'nodemailer',
28
+ 'aws4',
29
+ 'pluralize',
30
+ 'console-table-printer',
31
+ '@azure/storage-blob',
32
+ '@aws-sdk/client-s3',
33
+ '@aws-sdk/s3-request-presigner',
34
+ '@google-cloud/storage',
35
+ // Database drivers + their lazily-required companions, one group per adapter.
36
+ // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)
37
+ 'pg',
38
+ 'pg-native',
39
+ 'pg-cloudflare',
40
+ // SQLite (`@payloadcms/db-sqlite`)
41
+ 'better-sqlite3',
42
+ 'libsql',
43
+ // Mongo (`@payloadcms/db-mongodb`)
44
+ 'mongodb',
45
+ 'mongoose',
46
+ ];
47
+ /**
48
+ * Entries of {@link ssrExternalPackages} that must bundle in the production build.
49
+ *
50
+ * Externalizing only works for specifiers resolvable from the project root. These
51
+ * are leaf deps of Payload packages, so under pnpm they live in `.pnpm/…` and a bare
52
+ * specifier in a root-resolved chunk is invisible — `ERR_MODULE_NOT_FOUND` at
53
+ * runtime, or a build-time resolve failure under Nitro's re-bundle pass.
54
+ *
55
+ * `pluralize` also needs forcing back via `noExternal` (see `withPayload`); the
56
+ * storage leaves don't, since their adapters are already `noExternal`.
57
+ */
58
+ export const buildBundledPackages = [
59
+ 'pluralize',
60
+ // Leaf deps of the `@payloadcms/storage-*` adapters.
61
+ '@aws-sdk/client-s3',
62
+ '@aws-sdk/s3-request-presigner',
63
+ '@azure/storage-blob',
64
+ '@google-cloud/storage',
65
+ ];
66
+ /**
67
+ * External packages for the production `vite build` only (not dev serve).
68
+ *
69
+ * Externalizes the `@payloadcms/*` package boundaries — plus `payload` — so each
70
+ * resolves its own transitive Node deps (`pino`, `drizzle-orm`, `libsql`, …) from
71
+ * its own `node_modules` at runtime. Externalizing only the leaf deps breaks under
72
+ * pnpm: a leaf imported by bundled code becomes an unresolvable bare specifier from
73
+ * `dist/`, since pnpm does not hoist it; see {@link buildBundledPackages}.
74
+ *
75
+ * Kept out of dev's `ssr.external` on purpose: the monorepo resolves these to
76
+ * TypeScript source (`.ts` imported via `.js` specifiers), which only Vite's
77
+ * transform can resolve — an externalized copy would hit Node's raw resolver and
78
+ * fail on the `.js`→`.ts` mismatch.
79
+ */
80
+ export const buildExternalPackages = [
81
+ 'payload',
82
+ 'payload/node',
83
+ '@payloadcms/drizzle',
84
+ '@payloadcms/db-mongodb',
85
+ '@payloadcms/db-postgres',
86
+ '@payloadcms/db-vercel-postgres',
87
+ '@payloadcms/db-sqlite',
88
+ '@payloadcms/db-d1-sqlite',
89
+ ...ssrExternalPackages.filter((pkg) => !buildBundledPackages.includes(pkg)),
90
+ ];
91
+ export const payloadNoExternalPatterns = [
92
+ '@payloadcms/ui',
93
+ '@payloadcms/translations',
94
+ 'payload-react-router',
95
+ // Imported by the adapter's GraphQL handler; bundled so the server build does
96
+ // not need it next to the app's own dependencies.
97
+ 'graphql-http',
98
+ /^@payloadcms\/richtext-lexical/,
99
+ /^@payloadcms\/plugin-/,
100
+ /^@payloadcms\/storage-/,
101
+ ];
102
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/vite/config/external.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAa;IAC3C,KAAK;IACL,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,aAAa;IACb,OAAO;IACP,uBAAuB;IACvB,2BAA2B;IAC3B,MAAM;IACN,aAAa;IACb,SAAS;IACT,YAAY;IACZ,MAAM;IACN,WAAW;IACX,uBAAuB;IACvB,qBAAqB;IACrB,oBAAoB;IACpB,+BAA+B;IAC/B,uBAAuB;IACvB,8EAA8E;IAC9E,yEAAyE;IACzE,IAAI;IACJ,WAAW;IACX,eAAe;IACf,mCAAmC;IACnC,gBAAgB;IAChB,QAAQ;IACR,mCAAmC;IACnC,SAAS;IACT,UAAU;CACX,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC5C,WAAW;IACX,qDAAqD;IACrD,oBAAoB;IACpB,+BAA+B;IAC/B,qBAAqB;IACrB,uBAAuB;CACxB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC7C,SAAS;IACT,cAAc;IACd,qBAAqB;IACrB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,uBAAuB;IACvB,0BAA0B;IAC1B,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;CAC5E,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAA2B;IAC/D,gBAAgB;IAChB,0BAA0B;IAC1B,sBAAsB;IACtB,8EAA8E;IAC9E,kDAAkD;IAClD,cAAc;IACd,gCAAgC;IAChC,uBAAuB;IACvB,wBAAwB;CACzB,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Client dep-optimizer config used by `withPayload`. Kept separate from the
3
+ * SSR/RSC externalization config (`./external.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Packages we know contain Node-only code or top-level side effects requiring
7
+ * Node APIs. Excluding them from the client optimizer prevents Vite from
8
+ * walking into their main entries and trying to bundle server-only imports
9
+ * for the browser.
10
+ */
11
+ export declare const optimizeDepsExcludeDefaults: string[];
12
+ /**
13
+ * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
14
+ * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
15
+ * these up because their parent packages are in `optimizeDeps.exclude`, so we
16
+ * list them explicitly using the `parent > child` syntax.
17
+ *
18
+ * Each entry below fixes a specific late-discovery re-optimization: without it,
19
+ * Vite discovers the dep *after* its initial crawl, forcing a full dep
20
+ * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
21
+ * remounts the admin (dropping client state). This is why the list can't simply
22
+ * be deleted — it is the "complete first pass" for the admin's dep graph.
23
+ */
24
+ export declare const optimizeDepsIncludeDefaults: string[];
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Client dep-optimizer config used by `withPayload`. Kept separate from the
3
+ * SSR/RSC externalization config (`./external.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Packages we know contain Node-only code or top-level side effects requiring
7
+ * Node APIs. Excluding them from the client optimizer prevents Vite from
8
+ * walking into their main entries and trying to bundle server-only imports
9
+ * for the browser.
10
+ */
11
+ export const optimizeDepsExcludeDefaults = [
12
+ 'sharp',
13
+ '@payloadcms/ui',
14
+ 'payload-react-router',
15
+ 'payload',
16
+ 'pino',
17
+ 'pino-pretty',
18
+ 'busboy',
19
+ 'get-tsconfig',
20
+ 'ws',
21
+ 'croner',
22
+ 'prompts',
23
+ 'file-type',
24
+ // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite
25
+ // sometimes walks these from the main package entry while scanning
26
+ // workspace deps, and the browser sub-bundles do not expose the
27
+ // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
28
+ // server with a `MISSING_EXPORT` error before any test runs.
29
+ '@azure/storage-blob',
30
+ // Preserve RSC client boundaries on storage admin upload handlers.
31
+ '@payloadcms/storage-azure',
32
+ '@payloadcms/storage-r2',
33
+ '@payloadcms/storage-vercel-blob',
34
+ '@aws-sdk/client-s3',
35
+ '@aws-sdk/s3-request-presigner',
36
+ '@google-cloud/storage',
37
+ // Packages whose admin component barrel re-exports `'use client'` modules
38
+ // without carrying the directive itself. Pre-bundling one puts those modules
39
+ // in the optimized dep chunk *and* in the `rsc` environment as client
40
+ // references, which `@vitejs/plugin-rsc` warns about ("client component
41
+ // dependency is inconsistently optimized") once per component. Barrels that
42
+ // start with `'use client'` (e.g. `richtext-lexical`, `plugin-stripe`) don't
43
+ // warn and stay pre-bundled. Only shows up in published installs; workspace
44
+ // source is never pre-bundled.
45
+ '@payloadcms/plugin-cloud-storage',
46
+ '@payloadcms/plugin-ecommerce',
47
+ '@payloadcms/plugin-form-builder',
48
+ '@payloadcms/plugin-import-export',
49
+ '@payloadcms/plugin-multi-tenant',
50
+ '@payloadcms/plugin-search',
51
+ '@payloadcms/plugin-sentry',
52
+ '@payloadcms/plugin-seo',
53
+ // Database adapters and their drivers. The client scan reaches them through the
54
+ // Payload config (it follows server functions' `import('@payload-config')`
55
+ // without TanStack's server-fn stripping), so Vite would pre-bundle the whole
56
+ // driver for a browser that never loads it. Mongoose 9 has no browser build, so
57
+ // that bundles `mongodb`, whose optional `@aws-sdk/credential-providers` peer —
58
+ // when linked, as in the monorepo via `@payloadcms/payload-cloud` — fails the
59
+ // same `MISSING_EXPORT` way. Published installs reach the adapter packages;
60
+ // the monorepo, which resolves them to source, reaches the drivers.
61
+ '@payloadcms/db-d1-sqlite',
62
+ '@payloadcms/db-mongodb',
63
+ '@payloadcms/db-postgres',
64
+ '@payloadcms/db-sqlite',
65
+ '@payloadcms/db-vercel-postgres',
66
+ '@payloadcms/drizzle',
67
+ 'mongodb',
68
+ 'mongoose',
69
+ ];
70
+ /**
71
+ * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
72
+ * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
73
+ * these up because their parent packages are in `optimizeDeps.exclude`, so we
74
+ * list them explicitly using the `parent > child` syntax.
75
+ *
76
+ * Each entry below fixes a specific late-discovery re-optimization: without it,
77
+ * Vite discovers the dep *after* its initial crawl, forcing a full dep
78
+ * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
79
+ * remounts the admin (dropping client state). This is why the list can't simply
80
+ * be deleted — it is the "complete first pass" for the admin's dep graph.
81
+ */
82
+ export const optimizeDepsIncludeDefaults = [
83
+ '@payloadcms/ui > sonner',
84
+ '@payloadcms/ui > @faceless-ui/modal',
85
+ '@payloadcms/ui > @faceless-ui/window-info',
86
+ '@payloadcms/ui > @faceless-ui/scroll-info',
87
+ '@payloadcms/ui > @dnd-kit/core',
88
+ '@payloadcms/ui > @dnd-kit/sortable',
89
+ '@payloadcms/ui > @dnd-kit/utilities',
90
+ '@payloadcms/ui > react-datepicker',
91
+ '@payloadcms/ui > react-select',
92
+ '@payloadcms/ui > react-select/creatable',
93
+ '@payloadcms/ui > react-image-crop',
94
+ '@payloadcms/ui > @monaco-editor/react',
95
+ '@payloadcms/ui > date-fns',
96
+ '@payloadcms/ui > date-fns/transpose',
97
+ '@payloadcms/ui > @date-fns/tz/date/mini',
98
+ '@payloadcms/ui > uuid',
99
+ '@payloadcms/ui > use-context-selector',
100
+ '@payloadcms/ui > bson-objectid',
101
+ '@payloadcms/ui > dequal',
102
+ '@payloadcms/ui > object-to-formdata',
103
+ '@payloadcms/ui > md5',
104
+ 'payload > deepmerge',
105
+ 'payload > pluralize',
106
+ // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of
107
+ // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated
108
+ // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where
109
+ // it isn't hoisted to the top level. Path it through `react-dom` so the
110
+ // optimizer resolves the exact copy the runtime loads.
111
+ 'react-dom > scheduler',
112
+ // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the
113
+ // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.
114
+ // Because its parent is excluded, the optimizer never crawls in to discover
115
+ // this entry, so Vite serves `react/compiler-runtime` raw. That file is
116
+ // CommonJS (`module.exports = require(...)`), so the named `c` export can't be
117
+ // statically extracted and every client component throws "does not provide an
118
+ // export named 'c'". Pre-bundling it lets esbuild synthesize the named export.
119
+ 'react/compiler-runtime',
120
+ // Transitive deps that Vite otherwise discovers *after* the initial crawl
121
+ // (react-select pulls in @floating-ui at runtime; react-is is reached via
122
+ // react-transition-group/prop-types; the default date-fns locale is loaded
123
+ // through a dynamic `date-fns/locale/${key}` import). A late discovery forces
124
+ // a full dep re-optimization mid-session, which 404s every in-flight
125
+ // `.vite/deps/*` chunk ("Pre-transform error: file does not exist in the
126
+ // optimize deps directory") and breaks the admin UI in CI cold starts.
127
+ // Pre-bundling them keeps the first optimization pass complete.
128
+ '@payloadcms/ui > react-select > @floating-ui/dom',
129
+ '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',
130
+ '@payloadcms/ui > react-select > prop-types > react-is',
131
+ '@payloadcms/ui > date-fns/locale/en-US',
132
+ // Further late discoveries observed re-optimizing mid-run in CI cold starts
133
+ // (see CI logs: "✨ new dependencies optimized: @dnd-kit/modifiers / zod /
134
+ // dequal/lite"). The modular dashboard pulls in `@dnd-kit/modifiers` on first
135
+ // render; form-state diffing reaches `dequal/lite` (a distinct entry point
136
+ // from the already-listed `dequal`); client-side field validation reaches
137
+ // `zod` *through `payload`* — it is `ssrExternal` server-side but still
138
+ // bundled into the client, and must be pathed via `payload` so the optimizer
139
+ // pre-bundles the exact copy the runtime loads.
140
+ '@payloadcms/ui > @dnd-kit/modifiers',
141
+ '@payloadcms/ui > dequal/lite',
142
+ 'payload > zod',
143
+ // The storage client-upload suites (esp. vercel-blob) crawl part of the
144
+ // `payload` server runtime into the client bundle and discover these late,
145
+ // triggering several "optimized dependencies changed. reloading" waves that
146
+ // reload the page mid-test (the bulk-upload drawer's Create New button /
147
+ // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the
148
+ // whole observed set so the first pass is complete.
149
+ 'payload > undici',
150
+ 'payload > jose',
151
+ 'payload > dataloader',
152
+ 'payload > path-to-regexp',
153
+ 'payload > console-table-printer',
154
+ 'payload > ci-info',
155
+ 'payload > image-dimensions',
156
+ 'payload > ipaddr.js',
157
+ 'payload > range-parser',
158
+ 'payload > sanitize-filename',
159
+ // `@azure/storage-blob` is excluded, so pre-bundle its CommonJS browser dependency explicitly.
160
+ '@azure/storage-blob > events',
161
+ ];
162
+ //# sourceMappingURL=optimizeDeps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizeDeps.js","sourceRoot":"","sources":["../../../src/vite/config/optimizeDeps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAa;IACnD,OAAO;IACP,gBAAgB;IAChB,sBAAsB;IACtB,SAAS;IACT,MAAM;IACN,aAAa;IACb,QAAQ;IACR,cAAc;IACd,IAAI;IACJ,QAAQ;IACR,SAAS;IACT,WAAW;IACX,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D,qB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;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE,kDAAkD;IAClD,sEAAsE;IACtE,uDAAuD;IACvD,wCAAwC;IACxC,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,6EAA6E;IAC7E,gDAAgD;IAChD,qCAAqC;IACrC,8BAA8B;IAC9B,eAAe;IACf,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,oDAAoD;IACpD,kBAAkB;IAClB,gBAAgB;IAChB,sBAAsB;IACtB,0BAA0B;IAC1B,iCAAiC;IACjC,mBAAmB;IACnB,4BAA4B;IAC5B,qBAAqB;IACrB,wBAAwB;IACxB,6BAA6B;IAC7B,+FAA+F;IAC/F,8BAA8B;CAC/B,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SCSS `@import`/`@use` importers applied for every Payload consumer.
3
+ *
4
+ * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by
5
+ * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the
6
+ * installed package via Node resolution. Because it goes through the package's
7
+ * `exports` map, it picks the workspace `src` scss in the monorepo and the
8
+ * published `dist` scss in a consumer install automatically — no per-app
9
+ * `findFileUrl` shim needed.
10
+ */
11
+ export declare const payloadScssImporters: {
12
+ findFileUrl(url: string): null | URL;
13
+ }[];