@payloadcms/tanstack-start 4.0.0-internal.4804abd → 4.0.0-internal.4c2ee12
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 +1 -1
- package/dist/adapters/handleServerFunctions.d.ts +2 -0
- package/dist/adapters/handleServerFunctions.d.ts.map +1 -0
- package/dist/adapters/handleServerFunctions.js +9 -0
- package/dist/adapters/handleServerFunctions.js.map +1 -0
- package/dist/adapters/layout/index.d.ts +66 -0
- package/dist/adapters/layout/index.d.ts.map +1 -0
- package/dist/adapters/layout/index.js +105 -0
- package/dist/adapters/layout/index.js.map +1 -0
- package/dist/adapters/layout/lazy.d.ts +11 -0
- package/dist/adapters/layout/lazy.d.ts.map +1 -0
- package/dist/adapters/layout/lazy.js +23 -0
- package/dist/adapters/layout/lazy.js.map +1 -0
- package/dist/adapters/layout/server.d.ts +29 -0
- package/dist/adapters/layout/server.d.ts.map +1 -0
- package/dist/adapters/layout/server.js +63 -0
- package/dist/adapters/layout/server.js.map +1 -0
- package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +11 -1
- package/dist/adapters/metadata.d.ts.map +1 -0
- package/dist/{utilities/meta.js → adapters/metadata.js} +62 -2
- package/dist/adapters/metadata.js.map +1 -0
- package/dist/{elements/RouterAdapter/index.d.ts → adapters/router.d.ts} +1 -1
- package/dist/adapters/router.d.ts.map +1 -0
- package/dist/{elements/RouterAdapter/index.js → adapters/router.js} +44 -6
- package/dist/adapters/router.js.map +1 -0
- package/dist/{utilities/serverAdapter.server.d.ts → adapters/server.d.ts} +1 -1
- package/dist/adapters/server.d.ts.map +1 -0
- package/dist/{utilities/serverAdapter.server.js → adapters/server.js} +3 -3
- package/dist/adapters/server.js.map +1 -0
- package/dist/{routes/adminRoutes.d.ts → adapters/views/index.d.ts} +21 -22
- package/dist/adapters/views/index.d.ts.map +1 -0
- package/dist/adapters/views/index.js +80 -0
- package/dist/adapters/views/index.js.map +1 -0
- package/dist/adapters/views/lazy.d.ts +4 -0
- package/dist/adapters/views/lazy.d.ts.map +1 -0
- package/dist/adapters/views/lazy.js +43 -0
- package/dist/adapters/views/lazy.js.map +1 -0
- package/dist/{utilities/loadAdminPage.d.ts → adapters/views/server.d.ts} +9 -6
- package/dist/adapters/views/server.d.ts.map +1 -0
- package/dist/{utilities/loadAdminPage.js → adapters/views/server.js} +23 -84
- package/dist/adapters/views/server.js.map +1 -0
- package/dist/auth/login.d.ts +3 -16
- package/dist/auth/login.d.ts.map +1 -1
- package/dist/auth/login.js +6 -46
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.d.ts +2 -5
- package/dist/auth/logout.d.ts.map +1 -1
- package/dist/auth/logout.js +6 -47
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.d.ts +2 -4
- package/dist/auth/refresh.d.ts.map +1 -1
- package/dist/auth/refresh.js +6 -49
- package/dist/auth/refresh.js.map +1 -1
- package/dist/exports/client.d.ts +2 -6
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +2 -6
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +2 -5
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -3
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/rsc.browser.d.ts +4 -1
- package/dist/exports/rsc.browser.d.ts.map +1 -1
- package/dist/exports/rsc.browser.js +4 -1
- package/dist/exports/rsc.browser.js.map +1 -1
- package/dist/exports/rsc.d.ts +0 -1
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +0 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/server.d.ts +9 -11
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +8 -10
- package/dist/exports/server.js.map +1 -1
- package/dist/exports/shared.d.ts +2 -0
- package/dist/exports/shared.d.ts.map +1 -0
- package/dist/exports/shared.js +3 -0
- package/dist/exports/shared.js.map +1 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/{utilities/graphqlHandler.server.d.ts → routes/graphql/handler.server.d.ts} +1 -3
- package/dist/routes/graphql/handler.server.d.ts.map +1 -0
- package/dist/{utilities/graphqlHandler.server.js → routes/graphql/handler.server.js} +9 -6
- package/dist/routes/graphql/handler.server.js.map +1 -0
- package/dist/{utilities/handleAPIRoute.d.ts → routes/rest/handler.server.d.ts} +1 -1
- package/dist/routes/rest/handler.server.d.ts.map +1 -0
- package/dist/{utilities/handleAPIRoute.js → routes/rest/handler.server.js} +1 -1
- package/dist/routes/rest/handler.server.js.map +1 -0
- package/dist/routes/{apiRoute.d.ts → rest/index.d.ts} +6 -1
- package/dist/routes/rest/index.d.ts.map +1 -0
- package/dist/routes/{apiRoute.js → rest/index.js} +7 -2
- package/dist/routes/rest/index.js.map +1 -0
- package/dist/rsc/CollectionCards.js +1 -1
- package/dist/rsc/CollectionCards.js.map +1 -1
- package/dist/utilities/devConfigReload.server.d.ts +2 -0
- package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
- package/dist/utilities/devConfigReload.server.js +63 -0
- package/dist/utilities/devConfigReload.server.js.map +1 -0
- package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
- package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
- package/dist/utilities/devConfigReloadEvent.js +9 -0
- package/dist/utilities/devConfigReloadEvent.js.map +1 -0
- package/dist/utilities/getRequestI18n.server.d.ts +1 -1
- package/dist/utilities/getRequestI18n.server.js +1 -1
- package/dist/utilities/getRequestI18n.server.js.map +1 -1
- package/dist/utilities/initAdminContext.server.d.ts +9 -0
- package/dist/utilities/initAdminContext.server.d.ts.map +1 -0
- package/dist/utilities/initAdminContext.server.js +13 -0
- package/dist/utilities/initAdminContext.server.js.map +1 -0
- package/dist/utilities/routerSearch.d.ts +40 -0
- package/dist/utilities/routerSearch.d.ts.map +1 -0
- package/dist/utilities/routerSearch.js +45 -0
- package/dist/utilities/routerSearch.js.map +1 -0
- package/dist/utilities/serializeForRsc.d.ts.map +1 -1
- package/dist/utilities/serializeForRsc.js +6 -1
- package/dist/utilities/serializeForRsc.js.map +1 -1
- package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
- package/dist/utilities/serverFunctionClient.js +6 -1
- package/dist/utilities/serverFunctionClient.js.map +1 -1
- package/dist/utilities/toSerializable.d.ts +9 -0
- package/dist/utilities/toSerializable.d.ts.map +1 -1
- package/dist/utilities/toSerializable.js +19 -3
- package/dist/utilities/toSerializable.js.map +1 -1
- package/dist/withPayload/config/external.d.ts +44 -0
- package/dist/withPayload/config/external.d.ts.map +1 -0
- package/dist/withPayload/config/external.js +96 -0
- package/dist/withPayload/config/external.js.map +1 -0
- package/dist/withPayload/config/optimizeDeps.d.ts +25 -0
- package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
- package/dist/{vite/constants.js → withPayload/config/optimizeDeps.js} +53 -70
- package/dist/withPayload/config/optimizeDeps.js.map +1 -0
- package/dist/withPayload/config/scss.d.ts +14 -0
- package/dist/withPayload/config/scss.d.ts.map +1 -0
- package/dist/withPayload/config/scss.js +28 -0
- package/dist/withPayload/config/scss.js.map +1 -0
- package/dist/withPayload/devConfigReload.d.ts +14 -0
- package/dist/withPayload/devConfigReload.d.ts.map +1 -0
- package/dist/withPayload/devConfigReload.js +84 -0
- package/dist/withPayload/devConfigReload.js.map +1 -0
- package/dist/withPayload/importProtection.d.ts.map +1 -0
- package/dist/{vite → withPayload}/importProtection.js +2 -2
- package/dist/withPayload/importProtection.js.map +1 -0
- package/dist/withPayload/index.d.ts +110 -0
- package/dist/withPayload/index.d.ts.map +1 -0
- package/dist/withPayload/index.js +300 -0
- package/dist/withPayload/index.js.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
- package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.js +5 -0
- package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
- package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
- package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.js +2 -2
- package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
- package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
- package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
- package/package.json +25 -17
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
- package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
- package/dist/elements/DocumentHeaderClient/index.js +0 -116
- package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
- package/dist/elements/RenderComponent/index.d.ts +0 -10
- package/dist/elements/RenderComponent/index.d.ts.map +0 -1
- package/dist/elements/RenderComponent/index.js +0 -12
- package/dist/elements/RenderComponent/index.js.map +0 -1
- package/dist/elements/RouterAdapter/index.d.ts.map +0 -1
- package/dist/elements/RouterAdapter/index.js.map +0 -1
- package/dist/exports/vite.d.ts +0 -3
- package/dist/exports/vite.d.ts.map +0 -1
- package/dist/exports/vite.js +0 -3
- package/dist/exports/vite.js.map +0 -1
- package/dist/layouts/Root/getLayoutData.d.ts +0 -12
- package/dist/layouts/Root/getLayoutData.d.ts.map +0 -1
- package/dist/layouts/Root/getLayoutData.js +0 -91
- package/dist/layouts/Root/getLayoutData.js.map +0 -1
- package/dist/layouts/Root/index.d.ts +0 -32
- package/dist/layouts/Root/index.d.ts.map +0 -1
- package/dist/layouts/Root/index.js +0 -51
- package/dist/layouts/Root/index.js.map +0 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +0 -65
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +0 -1
- package/dist/layouts/Root/withPayloadRoot.js +0 -92
- package/dist/layouts/Root/withPayloadRoot.js.map +0 -1
- package/dist/node/cssLoader.d.mts +0 -3
- package/dist/node/cssLoader.d.mts.map +0 -1
- package/dist/node/cssLoader.js +0 -70
- package/dist/node/cssLoader.js.map +0 -1
- package/dist/node/cssLoader.mjs +0 -75
- package/dist/node/registerCssLoader.d.mts +0 -2
- package/dist/node/registerCssLoader.d.mts.map +0 -1
- package/dist/node/registerCssLoader.js +0 -10
- package/dist/node/registerCssLoader.js.map +0 -1
- package/dist/node/registerCssLoader.mjs +0 -10
- package/dist/routes/adminRoutes.d.ts.map +0 -1
- package/dist/routes/adminRoutes.js +0 -97
- package/dist/routes/adminRoutes.js.map +0 -1
- package/dist/routes/apiRoute.d.ts.map +0 -1
- package/dist/routes/apiRoute.js.map +0 -1
- package/dist/routes/layoutRoute.d.ts +0 -23
- package/dist/routes/layoutRoute.d.ts.map +0 -1
- package/dist/routes/layoutRoute.js +0 -51
- package/dist/routes/layoutRoute.js.map +0 -1
- package/dist/rsc/renderPayloadRSC.d.ts +0 -6
- package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
- package/dist/rsc/renderPayloadRSC.js +0 -6
- package/dist/rsc/renderPayloadRSC.js.map +0 -1
- package/dist/utilities/devReloadStrategy.d.ts +0 -10
- package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
- package/dist/utilities/devReloadStrategy.js +0 -27
- package/dist/utilities/devReloadStrategy.js.map +0 -1
- package/dist/utilities/getExistingAuthToken.d.ts +0 -7
- package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
- package/dist/utilities/getExistingAuthToken.js +0 -18
- package/dist/utilities/getExistingAuthToken.js.map +0 -1
- package/dist/utilities/getPreferences.d.ts +0 -10
- package/dist/utilities/getPreferences.d.ts.map +0 -1
- package/dist/utilities/getPreferences.js +0 -33
- package/dist/utilities/getPreferences.js.map +0 -1
- package/dist/utilities/getRequestLocale.d.ts +0 -7
- package/dist/utilities/getRequestLocale.d.ts.map +0 -1
- package/dist/utilities/getRequestLocale.js +0 -20
- package/dist/utilities/getRequestLocale.js.map +0 -1
- package/dist/utilities/getRequestTheme.d.ts +0 -10
- package/dist/utilities/getRequestTheme.d.ts.map +0 -1
- package/dist/utilities/getRequestTheme.js +0 -25
- package/dist/utilities/getRequestTheme.js.map +0 -1
- package/dist/utilities/graphqlHandler.server.d.ts.map +0 -1
- package/dist/utilities/graphqlHandler.server.js.map +0 -1
- package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
- package/dist/utilities/handleAPIRoute.js.map +0 -1
- package/dist/utilities/handleServerFunctions.d.ts +0 -20
- package/dist/utilities/handleServerFunctions.d.ts.map +0 -1
- package/dist/utilities/handleServerFunctions.js +0 -60
- package/dist/utilities/handleServerFunctions.js.map +0 -1
- package/dist/utilities/importMap.server.d.ts +0 -8
- package/dist/utilities/importMap.server.d.ts.map +0 -1
- package/dist/utilities/importMap.server.js +0 -11
- package/dist/utilities/importMap.server.js.map +0 -1
- package/dist/utilities/initReq.server.d.ts +0 -19
- package/dist/utilities/initReq.server.d.ts.map +0 -1
- package/dist/utilities/initReq.server.js +0 -87
- package/dist/utilities/initReq.server.js.map +0 -1
- package/dist/utilities/loadAdminPage.d.ts.map +0 -1
- package/dist/utilities/loadAdminPage.js.map +0 -1
- package/dist/utilities/loadLayoutData.d.ts +0 -15
- package/dist/utilities/loadLayoutData.d.ts.map +0 -1
- package/dist/utilities/loadLayoutData.js +0 -23
- package/dist/utilities/loadLayoutData.js.map +0 -1
- package/dist/utilities/meta.d.ts.map +0 -1
- package/dist/utilities/meta.js.map +0 -1
- package/dist/utilities/serverAdapter.server.d.ts.map +0 -1
- package/dist/utilities/serverAdapter.server.js.map +0 -1
- package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
- package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
- package/dist/utilities/serverFunctionHandlers.js +0 -17
- package/dist/utilities/serverFunctionHandlers.js.map +0 -1
- package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
- package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
- package/dist/utilities/setPayloadAuthCookie.js +0 -31
- package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
- package/dist/vite/constants.d.ts +0 -42
- package/dist/vite/constants.d.ts.map +0 -1
- package/dist/vite/constants.js.map +0 -1
- package/dist/vite/importProtection.d.ts.map +0 -1
- package/dist/vite/importProtection.js.map +0 -1
- package/dist/vite/plugin.d.ts +0 -38
- package/dist/vite/plugin.d.ts.map +0 -1
- package/dist/vite/plugin.js +0 -179
- package/dist/vite/plugin.js.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
- package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
- package/dist/vite/plugins/devTransforms.js.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
- /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.js +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.d.ts +0 -0
- /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.js +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { renderServerComponent } from '@tanstack/react-start/rsc';
|
|
2
|
-
import { getLayoutData } from '../layouts/Root/getLayoutData.js';
|
|
3
|
-
import { toSerializable } from './toSerializable.js';
|
|
4
|
-
/**
|
|
5
|
-
* Resolves the admin layout data for TanStack Start and returns a serializable
|
|
6
|
-
* payload for the `/_payload` route loader. The framework adapter wraps this in
|
|
7
|
-
* a `createServerFn` that supplies the app's `config` and generated `importMap`.
|
|
8
|
-
*
|
|
9
|
-
* `toSerializable` strips React elements, so the custom-providers element tree
|
|
10
|
-
* (`config.admin.components.providers`) is rendered to an RSC payload separately
|
|
11
|
-
* and re-attached.
|
|
12
|
-
*/ export async function loadLayoutData({ config, importMap }) {
|
|
13
|
-
const { providers, ...data } = await getLayoutData({
|
|
14
|
-
configPromise: config,
|
|
15
|
-
importMap
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
...toSerializable(data),
|
|
19
|
-
providers: providers ? await renderServerComponent(providers) : undefined
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=loadLayoutData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/loadLayoutData.ts"],"sourcesContent":["import type { ImportMap, SanitizedConfig } from 'payload'\n\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\n\nimport { getLayoutData } from '../layouts/Root/getLayoutData.js'\nimport { toSerializable } from './toSerializable.js'\n\n/**\n * Resolves the admin layout data for TanStack Start and returns a serializable\n * payload for the `/_payload` route loader. The framework adapter wraps this in\n * a `createServerFn` that supplies the app's `config` and generated `importMap`.\n *\n * `toSerializable` strips React elements, so the custom-providers element tree\n * (`config.admin.components.providers`) is rendered to an RSC payload separately\n * and re-attached.\n */\nexport async function loadLayoutData({\n config,\n importMap,\n}: {\n config: SanitizedConfig\n importMap: ImportMap\n}): Promise<Record<string, unknown>> {\n const { providers, ...data } = await getLayoutData({ configPromise: config, importMap })\n\n return {\n ...(toSerializable(data) as Record<string, unknown>),\n providers: providers ? await renderServerComponent(providers as any) : undefined,\n }\n}\n"],"names":["renderServerComponent","getLayoutData","toSerializable","loadLayoutData","config","importMap","providers","data","configPromise","undefined"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,4BAA2B;AAEjE,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,sBAAqB;AAEpD;;;;;;;;CAQC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,SAAS,EAIV;IACC,MAAM,EAAEC,SAAS,EAAE,GAAGC,MAAM,GAAG,MAAMN,cAAc;QAAEO,eAAeJ;QAAQC;IAAU;IAEtF,OAAO;QACL,GAAIH,eAAeK,KAAK;QACxBD,WAAWA,YAAY,MAAMN,sBAAsBM,aAAoBG;IACzE;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/utilities/meta.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GACV;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErB,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,EAAE,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE;QACV,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAA;QAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG;IAC1D,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,IAAI,EAAE,SAAS,EAAE,CAAA;CAClB,CA0EA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/meta.ts"],"sourcesContent":["type MetaEntry =\n | { charSet: string }\n | { content: string; name: string }\n | { content: string; property: string }\n | { title: string }\n\ntype LinkEntry = {\n href: string\n media?: string\n rel: string\n sizes?: string\n type?: string\n}\n\ntype AdminPageIcon = {\n media?: string\n rel?: string\n sizes?: string\n type?: string\n url: string\n}\n\ntype AdminPageOGImage = {\n alt?: string\n height?: number\n url: string\n width?: number\n}\n\n/**\n * Resolved admin-page metadata produced by the admin-page server function.\n *\n * The server function resolves the framework-agnostic `MetaConfig` (via the\n * shared `generatePageMetadata` in `@payloadcms/ui`) down to plain serializable\n * values, so the route loader can ship it across the wire and feed it to\n * `getAdminMeta` in `head()`.\n */\nexport type AdminPageMetadata = {\n description?: string\n icons?: AdminPageIcon[]\n keywords?: string\n openGraph?: {\n description?: string\n images?: AdminPageOGImage[]\n siteName?: string\n title?: string\n }\n robots?: string\n title?: string\n}\n\n/**\n * Builds TanStack Router `head()` `meta` + `links` entries for an admin page\n * from the resolved `AdminPageMetadata`, mirroring the tags Next.js renders\n * natively from the same `MetaConfig` (title, description, robots, keywords,\n * OpenGraph, Twitter — derived from OpenGraph — and icon links).\n *\n * ```ts\n * export const Route = createFileRoute('/admin/$')({\n * head: ({ loaderData }) => getAdminMeta(loaderData?.metadata),\n * })\n * ```\n */\nexport function getAdminMeta(metadata?: AdminPageMetadata): {\n links: LinkEntry[]\n meta: MetaEntry[]\n} {\n const meta: MetaEntry[] = [\n { charSet: 'utf-8' },\n { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n ]\n const links: LinkEntry[] = []\n\n if (!metadata) {\n return { links, meta }\n }\n\n if (metadata.title) {\n meta.push({ title: metadata.title })\n }\n if (metadata.description) {\n meta.push({ name: 'description', content: metadata.description })\n }\n if (metadata.keywords) {\n meta.push({ name: 'keywords', content: metadata.keywords })\n }\n if (metadata.robots) {\n meta.push({ name: 'robots', content: metadata.robots })\n }\n\n const og = metadata.openGraph\n if (og) {\n if (og.title) {\n meta.push({ content: og.title, property: 'og:title' })\n }\n if (og.description) {\n meta.push({ content: og.description, property: 'og:description' })\n }\n if (og.siteName) {\n meta.push({ content: og.siteName, property: 'og:site_name' })\n }\n\n for (const image of og.images ?? []) {\n meta.push({ content: image.url, property: 'og:image' })\n if (image.width) {\n meta.push({ content: String(image.width), property: 'og:image:width' })\n }\n if (image.height) {\n meta.push({ content: String(image.height), property: 'og:image:height' })\n }\n if (image.alt) {\n meta.push({ content: image.alt, property: 'og:image:alt' })\n }\n }\n\n // Twitter card is inherited from OpenGraph (matches Next.js metadata resolution).\n const firstImage = og.images?.[0]\n if (firstImage) {\n meta.push({ name: 'twitter:card', content: 'summary_large_image' })\n meta.push({ name: 'twitter:image', content: firstImage.url })\n }\n if (og.title) {\n meta.push({ name: 'twitter:title', content: og.title })\n }\n if (og.description) {\n meta.push({ name: 'twitter:description', content: og.description })\n }\n }\n\n for (const icon of metadata.icons ?? []) {\n links.push({\n href: icon.url,\n rel: icon.rel ?? 'icon',\n ...(icon.media ? { media: icon.media } : {}),\n ...(icon.sizes ? { sizes: icon.sizes } : {}),\n ...(icon.type ? { type: icon.type } : {}),\n })\n }\n\n return { links, meta }\n}\n"],"names":["getAdminMeta","metadata","meta","charSet","name","content","links","title","push","description","keywords","robots","og","openGraph","property","siteName","image","images","url","width","String","height","alt","firstImage","icon","icons","href","rel","media","sizes","type"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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":"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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ServerFunction } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Framework-agnostic server-function handlers the TanStack Start dispatcher
|
|
4
|
-
* registers to reach parity with the Next.js adapter
|
|
5
|
-
* (`packages/next/src/utilities/handleServerFunctions.ts`).
|
|
6
|
-
*/
|
|
7
|
-
type SwitchLanguageArgs = {
|
|
8
|
-
lang: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
12
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
13
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
14
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
15
|
-
*/
|
|
16
|
-
export declare const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>>;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=serverFunctionHandlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverFunctionHandlers.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AAEH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAcnF,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
3
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
4
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
5
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
6
|
-
*/ export const switchLanguageHandler = async ({ lang, req })=>{
|
|
7
|
-
if (!req.server) {
|
|
8
|
-
throw new Error('switch-language requires a ServerAdapter on the request');
|
|
9
|
-
}
|
|
10
|
-
const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`;
|
|
11
|
-
await req.server.setCookie(cookieName, lang, {
|
|
12
|
-
maxAge: 60 * 60 * 24 * 365,
|
|
13
|
-
path: '/'
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=serverFunctionHandlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/serverFunctionHandlers.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\n\n/**\n * Framework-agnostic server-function handlers the TanStack Start dispatcher\n * registers to reach parity with the Next.js adapter\n * (`packages/next/src/utilities/handleServerFunctions.ts`).\n */\n\ntype SwitchLanguageArgs = {\n lang: string\n}\n\n/**\n * Dispatched from `TranslationProvider` when the user switches the admin\n * language. Writes the `<cookiePrefix>-lng` cookie via the request's\n * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by\n * the provider's `router.refresh()` — reads the new language.\n */\nexport const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>> = async ({\n lang,\n req,\n}) => {\n if (!req.server) {\n throw new Error('switch-language requires a ServerAdapter on the request')\n }\n\n const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`\n\n await req.server.setCookie(cookieName, lang, {\n maxAge: 60 * 60 * 24 * 365,\n path: '/',\n })\n}\n"],"names":["switchLanguageHandler","lang","req","server","Error","cookieName","payload","config","cookiePrefix","setCookie","maxAge","path"],"mappings":"AAYA;;;;;CAKC,GACD,OAAO,MAAMA,wBAA2E,OAAO,EAC7FC,IAAI,EACJC,GAAG,EACJ;IACC,IAAI,CAACA,IAAIC,MAAM,EAAE;QACf,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,aAAa,GAAGH,IAAII,OAAO,CAACC,MAAM,CAACC,YAAY,IAAI,UAAU,IAAI,CAAC;IAExE,MAAMN,IAAIC,MAAM,CAACM,SAAS,CAACJ,YAAYJ,MAAM;QAC3CS,QAAQ,KAAK,KAAK,KAAK;QACvBC,MAAM;IACR;AACF,EAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Auth } from 'payload';
|
|
2
|
-
type SetPayloadAuthCookieArgs = {
|
|
3
|
-
authConfig: Auth;
|
|
4
|
-
cookiePrefix: string;
|
|
5
|
-
token: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function setPayloadAuthCookie({ authConfig, cookiePrefix, token, }: SetPayloadAuthCookieArgs): void;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=setPayloadAuthCookie.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setPayloadAuthCookie.d.ts","sourceRoot":"","sources":["../../src/utilities/setPayloadAuthCookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAKnC,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,YAAY,EACZ,KAAK,GACN,EAAE,wBAAwB,GAAG,IAAI,CAoCjC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { setResponseHeader } from '@tanstack/react-start/server';
|
|
2
|
-
import { generatePayloadCookie } from 'payload';
|
|
3
|
-
export function setPayloadAuthCookie({ authConfig, cookiePrefix, token }) {
|
|
4
|
-
const cookieExpiration = authConfig.tokenExpiration ? new Date(Date.now() + authConfig.tokenExpiration) : undefined;
|
|
5
|
-
const payloadCookie = generatePayloadCookie({
|
|
6
|
-
collectionAuthConfig: authConfig,
|
|
7
|
-
cookiePrefix,
|
|
8
|
-
expires: cookieExpiration,
|
|
9
|
-
returnCookieAsObject: true,
|
|
10
|
-
token
|
|
11
|
-
});
|
|
12
|
-
if (payloadCookie.value) {
|
|
13
|
-
const sameSite = typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax';
|
|
14
|
-
let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`;
|
|
15
|
-
cookie += '; HttpOnly';
|
|
16
|
-
cookie += `; SameSite=${sameSite}`;
|
|
17
|
-
cookie += '; Path=/';
|
|
18
|
-
if (authConfig.cookies.secure) {
|
|
19
|
-
cookie += '; Secure';
|
|
20
|
-
}
|
|
21
|
-
if (authConfig.cookies.domain) {
|
|
22
|
-
cookie += `; Domain=${authConfig.cookies.domain}`;
|
|
23
|
-
}
|
|
24
|
-
if (payloadCookie.expires) {
|
|
25
|
-
cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`;
|
|
26
|
-
}
|
|
27
|
-
setResponseHeader('Set-Cookie', cookie);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=setPayloadAuthCookie.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/setPayloadAuthCookie.ts"],"sourcesContent":["import type { Auth } from 'payload'\n\nimport { setResponseHeader } from '@tanstack/react-start/server'\nimport { generatePayloadCookie } from 'payload'\n\ntype SetPayloadAuthCookieArgs = {\n authConfig: Auth\n cookiePrefix: string\n token: string\n}\n\nexport function setPayloadAuthCookie({\n authConfig,\n cookiePrefix,\n token,\n}: SetPayloadAuthCookieArgs): void {\n const cookieExpiration = authConfig.tokenExpiration\n ? new Date(Date.now() + authConfig.tokenExpiration)\n : undefined\n\n const payloadCookie = generatePayloadCookie({\n collectionAuthConfig: authConfig,\n cookiePrefix,\n expires: cookieExpiration,\n returnCookieAsObject: true,\n token,\n })\n\n if (payloadCookie.value) {\n const sameSite =\n typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax'\n\n let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`\n cookie += '; HttpOnly'\n cookie += `; SameSite=${sameSite}`\n cookie += '; Path=/'\n\n if (authConfig.cookies.secure) {\n cookie += '; Secure'\n }\n\n if (authConfig.cookies.domain) {\n cookie += `; Domain=${authConfig.cookies.domain}`\n }\n\n if (payloadCookie.expires) {\n cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`\n }\n\n setResponseHeader('Set-Cookie', cookie)\n }\n}\n"],"names":["setResponseHeader","generatePayloadCookie","setPayloadAuthCookie","authConfig","cookiePrefix","token","cookieExpiration","tokenExpiration","Date","now","undefined","payloadCookie","collectionAuthConfig","expires","returnCookieAsObject","value","sameSite","cookies","cookie","encodeURIComponent","name","secure","domain","toUTCString"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,qBAAqB,QAAQ,UAAS;AAQ/C,OAAO,SAASC,qBAAqB,EACnCC,UAAU,EACVC,YAAY,EACZC,KAAK,EACoB;IACzB,MAAMC,mBAAmBH,WAAWI,eAAe,GAC/C,IAAIC,KAAKA,KAAKC,GAAG,KAAKN,WAAWI,eAAe,IAChDG;IAEJ,MAAMC,gBAAgBV,sBAAsB;QAC1CW,sBAAsBT;QACtBC;QACAS,SAASP;QACTQ,sBAAsB;QACtBT;IACF;IAEA,IAAIM,cAAcI,KAAK,EAAE;QACvB,MAAMC,WACJ,OAAOb,WAAWc,OAAO,CAACD,QAAQ,KAAK,WAAWb,WAAWc,OAAO,CAACD,QAAQ,GAAG;QAElF,IAAIE,SAAS,GAAGC,mBAAmBR,cAAcS,IAAI,EAAE,CAAC,EAAED,mBAAmBR,cAAcI,KAAK,GAAG;QACnGG,UAAU;QACVA,UAAU,CAAC,WAAW,EAAEF,UAAU;QAClCE,UAAU;QAEV,IAAIf,WAAWc,OAAO,CAACI,MAAM,EAAE;YAC7BH,UAAU;QACZ;QAEA,IAAIf,WAAWc,OAAO,CAACK,MAAM,EAAE;YAC7BJ,UAAU,CAAC,SAAS,EAAEf,WAAWc,OAAO,CAACK,MAAM,EAAE;QACnD;QAEA,IAAIX,cAAcE,OAAO,EAAE;YACzBK,UAAU,CAAC,UAAU,EAAE,IAAIV,KAAKG,cAAcE,OAAO,EAAEU,WAAW,IAAI;QACxE;QAEAvB,kBAAkB,cAAckB;IAClC;AACF"}
|
package/dist/vite/constants.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite-level configuration constants used by `payloadPlugin`. Kept separate so
|
|
3
|
-
* `plugin.ts` stays focused on wiring.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Server-only packages (Node-only or only ever used by the server bundle).
|
|
7
|
-
* These are the Vite equivalent of Next.js's `serverExternalPackages`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const ssrExternalPackages: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Payload packages whose source must be processed by Vite even on the server
|
|
12
|
-
* (because they are workspace `.ts` files in dev). Server-only adapters
|
|
13
|
-
* (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
|
|
14
|
-
* intentionally not included — those should stay external on the SSR side.
|
|
15
|
-
*/
|
|
16
|
-
export declare const payloadNoExternalPatterns: Array<RegExp | string>;
|
|
17
|
-
/**
|
|
18
|
-
* The subset of `payloadNoExternalPatterns` that needs to participate in the
|
|
19
|
-
* RSC environment. Plugins and storage adapters must be included: they register
|
|
20
|
-
* custom providers/components (e.g. `plugin-multi-tenant`'s `'use client'`
|
|
21
|
-
* `TenantSelectionProvider`) that render in the RSC graph via
|
|
22
|
-
* `RenderServerComponent`. If the package stays external to RSC, `plugin-rsc`
|
|
23
|
-
* never transforms its `'use client'` modules into client references, so the
|
|
24
|
-
* component executes server-side and crashes on the first hook
|
|
25
|
-
* (`Cannot read properties of null (reading 'useState')`).
|
|
26
|
-
*/
|
|
27
|
-
export declare const payloadRscNoExternalPatterns: Array<RegExp | string>;
|
|
28
|
-
/**
|
|
29
|
-
* Packages we know contain Node-only code or top-level side effects requiring
|
|
30
|
-
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
31
|
-
* walking into their main entries and trying to bundle server-only imports
|
|
32
|
-
* for the browser.
|
|
33
|
-
*/
|
|
34
|
-
export declare const optimizeDepsExcludeDefaults: string[];
|
|
35
|
-
/**
|
|
36
|
-
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
37
|
-
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
38
|
-
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
39
|
-
* list them explicitly using the `parent > child` syntax.
|
|
40
|
-
*/
|
|
41
|
-
export declare const optimizeDepsIncludeDefaults: string[];
|
|
42
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA0BvC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO/D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA8E/C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/constants.ts"],"sourcesContent":["/**\n * Vite-level configuration constants used by `payloadPlugin`. Kept separate so\n * `plugin.ts` stays focused on wiring.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'mongodb',\n 'mongoose',\n 'better-sqlite3',\n 'pg',\n 'pg-native',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Payload packages whose source must be processed by Vite even on the server\n * (because they are workspace `.ts` files in dev). Server-only adapters\n * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are\n * intentionally not included — those should stay external on the SSR side.\n */\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * The subset of `payloadNoExternalPatterns` that needs to participate in the\n * RSC environment. Plugins and storage adapters must be included: they register\n * custom providers/components (e.g. `plugin-multi-tenant`'s `'use client'`\n * `TenantSelectionProvider`) that render in the RSC graph via\n * `RenderServerComponent`. If the package stays external to RSC, `plugin-rsc`\n * never transforms its `'use client'` modules into client references, so the\n * component executes server-side and crashes on the first hook\n * (`Cannot read properties of null (reading 'useState')`).\n */\nexport const payloadRscNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * Packages we know contain Node-only code or top-level side effects requiring\n * Node APIs. Excluding them from the client optimizer prevents Vite from\n * walking into their main entries and trying to bundle server-only imports\n * for the browser.\n */\nexport const optimizeDepsExcludeDefaults: string[] = [\n 'sharp',\n '@payloadcms/ui',\n '@payloadcms/tanstack-start',\n 'payload',\n 'pino',\n 'pino-pretty',\n 'busboy',\n 'get-tsconfig',\n 'ws',\n 'croner',\n 'prompts',\n 'file-type',\n // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite\n // sometimes walks these from the main package entry while scanning\n // workspace deps, and the browser sub-bundles do not expose the\n // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev\n // server with a `MISSING_EXPORT` error before any test runs.\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be\n * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick\n * these up because their parent packages are in `optimizeDeps.exclude`, so we\n * list them explicitly using the `parent > child` syntax.\n */\nexport const optimizeDepsIncludeDefaults: string[] = [\n '@payloadcms/ui > sonner',\n '@payloadcms/ui > @faceless-ui/modal',\n '@payloadcms/ui > @faceless-ui/window-info',\n '@payloadcms/ui > @faceless-ui/scroll-info',\n '@payloadcms/ui > @dnd-kit/core',\n '@payloadcms/ui > @dnd-kit/sortable',\n '@payloadcms/ui > @dnd-kit/utilities',\n '@payloadcms/ui > react-datepicker',\n '@payloadcms/ui > react-select',\n '@payloadcms/ui > react-select/creatable',\n '@payloadcms/ui > react-image-crop',\n '@payloadcms/ui > @monaco-editor/react',\n '@payloadcms/ui > date-fns',\n '@payloadcms/ui > date-fns/transpose',\n '@payloadcms/ui > @date-fns/tz/date/mini',\n '@payloadcms/ui > uuid',\n '@payloadcms/ui > use-context-selector',\n '@payloadcms/ui > bson-objectid',\n '@payloadcms/ui > dequal',\n '@payloadcms/ui > object-to-formdata',\n '@payloadcms/ui > md5',\n 'payload > deepmerge',\n 'payload > pluralize',\n // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of\n // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated\n // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where\n // it isn't hoisted to the top level. Path it through `react-dom` so the\n // optimizer resolves the exact copy the runtime loads.\n 'react-dom > scheduler',\n // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the\n // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.\n // Because its parent is excluded, the optimizer never crawls in to discover\n // this entry, so Vite serves `react/compiler-runtime` raw. That file is\n // CommonJS (`module.exports = require(...)`), so the named `c` export can't be\n // statically extracted and every client component throws \"does not provide an\n // export named 'c'\". Pre-bundling it lets esbuild synthesize the named export.\n 'react/compiler-runtime',\n // Transitive deps that Vite otherwise discovers *after* the initial crawl\n // (react-select pulls in @floating-ui at runtime; react-is is reached via\n // react-transition-group/prop-types; the default date-fns locale is loaded\n // through a dynamic `date-fns/locale/${key}` import). A late discovery forces\n // a full dep re-optimization mid-session, which 404s every in-flight\n // `.vite/deps/*` chunk (\"Pre-transform error: file does not exist in the\n // optimize deps directory\") and breaks the admin UI in CI cold starts.\n // Pre-bundling them keeps the first optimization pass complete.\n '@payloadcms/ui > react-select > @floating-ui/dom',\n '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',\n '@payloadcms/ui > react-select > prop-types > react-is',\n '@payloadcms/ui > date-fns/locale/en-US',\n // Further late discoveries observed re-optimizing mid-run in CI cold starts\n // (see CI logs: \"✨ new dependencies optimized: @dnd-kit/modifiers / ajv /\n // dequal/lite\"). The modular dashboard pulls in `@dnd-kit/modifiers` on first\n // render; form-state diffing reaches `dequal/lite` (a distinct entry point\n // from the already-listed `dequal`); client-side field validation reaches\n // `ajv` *through `payload`* — it is `ssrExternal` server-side but still\n // bundled into the client, and must be pathed via `payload` so the optimizer\n // pre-bundles the exact copy the runtime loads.\n '@payloadcms/ui > @dnd-kit/modifiers',\n '@payloadcms/ui > dequal/lite',\n 'payload > ajv',\n // The storage client-upload suites (esp. vercel-blob) crawl part of the\n // `payload` server runtime into the client bundle and discover these late,\n // triggering several \"optimized dependencies changed. reloading\" waves that\n // reload the page mid-test (the bulk-upload drawer's Create New button /\n // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the\n // whole observed set so the first pass is complete.\n 'payload > undici',\n 'payload > jose',\n 'payload > dataloader',\n 'payload > path-to-regexp',\n 'payload > console-table-printer',\n 'payload > ci-info',\n 'payload > image-size',\n 'payload > image-size/fromFile',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n]\n"],"names":["ssrExternalPackages","payloadNoExternalPatterns","payloadRscNoExternalPatterns","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;CASC,GACD,OAAO,MAAMC,+BAAuD;IAClE;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,6EAA6E;IAC7E,+EAA+E;IAC/E,8EAA8E;IAC9E,wEAAwE;IACxE,uDAAuD;IACvD;IACA,8EAA8E;IAC9E,0EAA0E;IAC1E,4EAA4E;IAC5E,wEAAwE;IACxE,+EAA+E;IAC/E,8EAA8E;IAC9E,+EAA+E;IAC/E;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;IACA,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,6EAA6E;IAC7E,gDAAgD;IAChD;IACA;IACA;IACA,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,oDAAoD;IACpD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importProtection.d.ts","sourceRoot":"","sources":["../../src/vite/importProtection.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAoB7D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAoC9E;AAED,eAAO,MAAM,sCAAsC,EAAE,MAAM,EAAsC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/importProtection.ts"],"sourcesContent":["import { builtinModules } from 'node:module'\n\n/**\n * Specifiers that must never appear in the client module graph. These are the\n * server-only Payload entry points plus Node.js built-ins and a handful of\n * Node-only npm packages that Payload pulls in transitively.\n */\nexport const serverOnlyClientSpecifiers: Array<RegExp | string> = [\n /^node:/,\n new RegExp(`^(${builtinModules.join('|')})(\\\\/|$)`),\n '@payload-config',\n /^@payloadcms\\/next\\/rsc/,\n /^@payloadcms\\/richtext-lexical\\/rsc/,\n /^@payloadcms\\/richtext-slate\\/rsc/,\n '@payloadcms/ui/server',\n /^@payloadcms\\/tanstack-start\\/(layouts|rsc|server|views\\/server)/,\n 'sharp',\n 'busboy',\n 'croner',\n 'pino',\n 'pino-pretty',\n 'prompts',\n 'ws',\n 'undici',\n 'get-tsconfig',\n /^file-type/,\n /^react-dom\\/server/,\n]\n\n/**\n * Allowlist callback for the `tanstackStart` plugin's import-protection. These\n * are the legitimate cross-environment imports in our monorepo that we want\n * to permit even when they appear to cross a server/client boundary.\n */\nexport function onImportProtectionViolation(violation: unknown): boolean | void {\n const info = violation as {\n envType: 'client' | 'server'\n importer: string\n resolved?: string\n }\n\n const allowedClientFileImporters =\n /\\/richtext-lexical\\/.*\\/exports\\/client\\/|\\/tanstack-start\\/.*\\/views\\/AdminView|\\/ui\\//\n\n if (\n info.envType === 'server' &&\n info.resolved?.includes('.client.') &&\n allowedClientFileImporters.test(info.importer)\n ) {\n return false\n }\n\n if (info.importer.includes('/richtext-lexical/') && info.importer.includes('/field/Diff/')) {\n return false\n }\n\n if (info.importer.includes('/packages/payload/') || info.importer.includes('/payload/dist/')) {\n return false\n }\n\n if (\n info.importer.includes('@payloadcms/ui') &&\n (info.importer.includes('/exports/rsc/') || info.importer.includes('/rsc/index'))\n ) {\n return false\n }\n\n if (info.envType === 'server' && info.importer.includes('vite-rsc/client-references')) {\n return false\n }\n}\n\nexport const defaultImportProtectionIgnoreImporters: RegExp[] = [/^src\\/importMap\\.js(?:\\?.*)?$/]\n"],"names":["builtinModules","serverOnlyClientSpecifiers","RegExp","join","onImportProtectionViolation","violation","info","allowedClientFileImporters","envType","resolved","includes","test","importer","defaultImportProtectionIgnoreImporters"],"mappings":"AAAA,SAASA,cAAc,QAAQ,cAAa;AAE5C;;;;CAIC,GACD,OAAO,MAAMC,6BAAqD;IAChE;IACA,IAAIC,OAAO,CAAC,EAAE,EAAEF,eAAeG,IAAI,CAAC,KAAK,QAAQ,CAAC;IAClD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,SAASC,4BAA4BC,SAAkB;IAC5D,MAAMC,OAAOD;IAMb,MAAME,6BACJ;IAEF,IACED,KAAKE,OAAO,KAAK,YACjBF,KAAKG,QAAQ,EAAEC,SAAS,eACxBH,2BAA2BI,IAAI,CAACL,KAAKM,QAAQ,GAC7C;QACA,OAAO;IACT;IAEA,IAAIN,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,iBAAiB;QAC1F,OAAO;IACT;IAEA,IAAIJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,mBAAmB;QAC5F,OAAO;IACT;IAEA,IACEJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,qBACtBJ,CAAAA,KAAKM,QAAQ,CAACF,QAAQ,CAAC,oBAAoBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,aAAY,GAC/E;QACA,OAAO;IACT;IAEA,IAAIJ,KAAKE,OAAO,KAAK,YAAYF,KAAKM,QAAQ,CAACF,QAAQ,CAAC,+BAA+B;QACrF,OAAO;IACT;AACF;AAEA,OAAO,MAAMG,yCAAmD;IAAC;CAAgC,CAAA"}
|
package/dist/vite/plugin.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { PluginOption, UserConfigFnObject } from 'vite';
|
|
2
|
-
export interface PayloadPluginOptions {
|
|
3
|
-
/** Additional resolve aliases */
|
|
4
|
-
additionalAliases?: Array<{
|
|
5
|
-
find: RegExp | string;
|
|
6
|
-
replacement: string;
|
|
7
|
-
}>;
|
|
8
|
-
/** Additional import protection ignoreImporters patterns */
|
|
9
|
-
additionalIgnoreImporters?: RegExp[];
|
|
10
|
-
/** Extra optimizeDeps.include entries */
|
|
11
|
-
additionalOptimizeDepsInclude?: string[];
|
|
12
|
-
/** Extra ssr.external entries */
|
|
13
|
-
additionalSsrExternal?: string[];
|
|
14
|
-
/** Path to the user's payload.config.ts (required) */
|
|
15
|
-
payloadConfigPath: string;
|
|
16
|
-
/** Extra Vite plugins to include */
|
|
17
|
-
plugins?: PluginOption[];
|
|
18
|
-
/** @vitejs/plugin-react instance — must be passed by consumer to ensure correct resolution */
|
|
19
|
-
reactPlugin: PluginOption;
|
|
20
|
-
/** TanStack router routes directory relative to srcDirectory. Defaults to 'app' */
|
|
21
|
-
routesDirectory?: string;
|
|
22
|
-
/** @vitejs/plugin-rsc instance — required for RSC support, must be passed by consumer */
|
|
23
|
-
rscPlugin: PluginOption;
|
|
24
|
-
/** TanStack source directory. Defaults to 'src' */
|
|
25
|
-
srcDirectory?: string;
|
|
26
|
-
/** tanstackStart from '@tanstack/react-start/plugin/vite' — must be passed by consumer to ensure correct resolution */
|
|
27
|
-
tanstackStart: typeof import('@tanstack/react-start/plugin/vite').tanstackStart;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Vite plugin for Payload + TanStack Start. The Vite-side counterpart to
|
|
31
|
-
* `withPayload` for Next.js: it configures the Vite environment so the Payload
|
|
32
|
-
* admin can run, then composes the TanStack Start plugin with two small
|
|
33
|
-
* Payload-specific workarounds (dev HMR injection, SSR style stripping). Each
|
|
34
|
-
* remaining workaround lives in its own file under `./plugins/` so it can be
|
|
35
|
-
* deleted individually once the corresponding upstream fix lands.
|
|
36
|
-
*/
|
|
37
|
-
export declare function payloadPlugin(options: PayloadPluginOptions): UserConfigFnObject;
|
|
38
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAsB5D,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzE,4DAA4D;IAC5D,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC,yCAAyC;IACzC,6BAA6B,CAAC,EAAE,MAAM,EAAE,CAAA;IACxC,iCAAiC;IACjC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAA;IACzB,oCAAoC;IACpC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,8FAA8F;IAC9F,WAAW,EAAE,YAAY,CAAA;IACzB,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yFAAyF;IACzF,SAAS,EAAE,YAAY,CAAA;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uHAAuH;IACvH,aAAa,EAAE,cAAc,mCAAmC,EAAE,aAAa,CAAA;CAChF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAkI/E"}
|
package/dist/vite/plugin.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults, payloadNoExternalPatterns, payloadRscNoExternalPatterns, ssrExternalPackages } from './constants.js';
|
|
3
|
-
import { defaultImportProtectionIgnoreImporters, onImportProtectionViolation, serverOnlyClientSpecifiers } from './importProtection.js';
|
|
4
|
-
import { clientModuleResolution } from './plugins/clientModuleResolution.js';
|
|
5
|
-
import { payloadDevTransforms } from './plugins/devTransforms.js';
|
|
6
|
-
import { reactDomServerInRsc } from './plugins/reactDomServerInRsc.js';
|
|
7
|
-
import { ssrStripDistStyleImports } from './plugins/stripDistStyleImports.js';
|
|
8
|
-
import { wrapCjsForClient } from './plugins/wrapCjsForClient.js';
|
|
9
|
-
/**
|
|
10
|
-
* Vite plugin for Payload + TanStack Start. The Vite-side counterpart to
|
|
11
|
-
* `withPayload` for Next.js: it configures the Vite environment so the Payload
|
|
12
|
-
* admin can run, then composes the TanStack Start plugin with two small
|
|
13
|
-
* Payload-specific workarounds (dev HMR injection, SSR style stripping). Each
|
|
14
|
-
* remaining workaround lives in its own file under `./plugins/` so it can be
|
|
15
|
-
* deleted individually once the corresponding upstream fix lands.
|
|
16
|
-
*/ export function payloadPlugin(options) {
|
|
17
|
-
const { additionalAliases = [], additionalIgnoreImporters = [], additionalOptimizeDepsInclude = [], additionalSsrExternal = [], payloadConfigPath, plugins: extraPlugins = [], reactPlugin, routesDirectory = 'app', rscPlugin, srcDirectory = 'src', tanstackStart } = options;
|
|
18
|
-
process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED = 'true';
|
|
19
|
-
return (_env)=>({
|
|
20
|
-
css: {
|
|
21
|
-
preprocessorOptions: {
|
|
22
|
-
scss: {
|
|
23
|
-
silenceDeprecations: [
|
|
24
|
-
'import',
|
|
25
|
-
'global-builtin'
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
define: {
|
|
31
|
-
global: 'globalThis',
|
|
32
|
-
'process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED': JSON.stringify('true')
|
|
33
|
-
},
|
|
34
|
-
environments: {
|
|
35
|
-
rsc: {
|
|
36
|
-
resolve: {
|
|
37
|
-
noExternal: payloadRscNoExternalPatterns
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
ssr: {
|
|
41
|
-
resolve: {
|
|
42
|
-
noExternal: payloadNoExternalPatterns
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
optimizeDeps: {
|
|
47
|
-
exclude: optimizeDepsExcludeDefaults,
|
|
48
|
-
include: [
|
|
49
|
-
...optimizeDepsIncludeDefaults,
|
|
50
|
-
...additionalOptimizeDepsInclude
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
plugins: [
|
|
54
|
-
clientModuleResolution(),
|
|
55
|
-
wrapCjsForClient(),
|
|
56
|
-
ssrStripDistStyleImports(),
|
|
57
|
-
reactDomServerInRsc(),
|
|
58
|
-
payloadDevTransforms(),
|
|
59
|
-
rscPlugin,
|
|
60
|
-
tanstackStart({
|
|
61
|
-
importProtection: {
|
|
62
|
-
client: {
|
|
63
|
-
excludeFiles: [],
|
|
64
|
-
specifiers: serverOnlyClientSpecifiers
|
|
65
|
-
},
|
|
66
|
-
ignoreImporters: [
|
|
67
|
-
...defaultImportProtectionIgnoreImporters,
|
|
68
|
-
...additionalIgnoreImporters
|
|
69
|
-
],
|
|
70
|
-
include: [
|
|
71
|
-
'**/*'
|
|
72
|
-
],
|
|
73
|
-
mockAccess: 'warn',
|
|
74
|
-
onViolation: onImportProtectionViolation,
|
|
75
|
-
// Disable TanStack Start's default `**/*.client.*` file-based denial in
|
|
76
|
-
// the SSR environment. Payload uses the `.client.tsx` filename suffix
|
|
77
|
-
// for React Client Components (with a `'use client'` directive) that
|
|
78
|
-
// MUST be server-rendered to HTML during SSR. The default rule would
|
|
79
|
-
// otherwise replace those files with an `import-protection mock` Proxy
|
|
80
|
-
// during SSR, which crashes React (TypeError: Cannot convert object to
|
|
81
|
-
// primitive value) the moment React tries to format a warning that
|
|
82
|
-
// mentions one of these components.
|
|
83
|
-
server: {
|
|
84
|
-
files: []
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
// Disable TanStack Router's automatic per-route code-splitting.
|
|
88
|
-
//
|
|
89
|
-
// With splitting enabled each route's `component` is fetched lazily
|
|
90
|
-
// via `?tsr-split=component` after the initial SSR HTML is streamed.
|
|
91
|
-
// Until that lazy chunk lands the rendered admin tree has no client
|
|
92
|
-
// React attached, so any button clicks (e.g. the
|
|
93
|
-
// `#toggle-list-filters` chevron in `<ListControls />`) hit a static
|
|
94
|
-
// DOM, the click is dropped, and once the chunk finally loads the
|
|
95
|
-
// component re-mounts with its initial `useState` instead of the
|
|
96
|
-
// toggled value. That single behaviour was the root cause of the
|
|
97
|
-
// "page renders but nothing is interactive" tanstack-start E2E
|
|
98
|
-
// failures (`#list-controls-where`, `[data-lexical-editor]`, etc.) -
|
|
99
|
-
// playwright traces show "Download the React DevTools" landing
|
|
100
|
-
// *after* the playwright click, confirming late hydration.
|
|
101
|
-
//
|
|
102
|
-
// We pass BOTH knobs because `tanstackStart`'s schema silently
|
|
103
|
-
// strips the user-supplied `autoCodeSplitting` (its `tsrConfig`
|
|
104
|
-
// does `configSchema.omit({ autoCodeSplitting: true, target: true
|
|
105
|
-
// })`) and then leaves the value `undefined` — which is fine for
|
|
106
|
-
// the conditional inside `unpluginRouterComposedFactory`, but the
|
|
107
|
-
// TanStack Start vite plugin *unconditionally* installs the router
|
|
108
|
-
// code-splitter via `tanStackRouterCodeSplitter(...)` regardless.
|
|
109
|
-
// The only knob that survives all of that and is honoured by the
|
|
110
|
-
// splitter is `router.codeSplittingOptions.defaultBehavior` — set
|
|
111
|
-
// to an empty array, the splitter still walks each `createFileRoute`
|
|
112
|
-
// file but produces no virtual `?tsr-split=...` modules, so every
|
|
113
|
-
// route component ships in the initial bundle and hydration starts
|
|
114
|
-
// immediately on first paint. We keep `autoCodeSplitting: false` as
|
|
115
|
-
// a belt-and-braces signal in case the start plugin ever stops
|
|
116
|
-
// dropping it.
|
|
117
|
-
//
|
|
118
|
-
// Eager-loading routes ships a slightly larger initial bundle but
|
|
119
|
-
// makes the admin actually interactive on first paint.
|
|
120
|
-
router: {
|
|
121
|
-
autoCodeSplitting: false,
|
|
122
|
-
codeSplittingOptions: {
|
|
123
|
-
defaultBehavior: []
|
|
124
|
-
},
|
|
125
|
-
// Exclude generated importMap files and colocated server-function
|
|
126
|
-
// modules (`*.functions.ts`). Admin form saves are dispatched via
|
|
127
|
-
// `runPayloadServerFn` (a TanStack Start `createServerFn`) rather than
|
|
128
|
-
// a hand-rolled route, so there is no longer an `api.server-function.ts`
|
|
129
|
-
// to special-case here. The `*.functions.ts` shims live next to the
|
|
130
|
-
// routes that use them (e.g. `app/_payload/*.functions.ts`); they
|
|
131
|
-
// define `createServerFn`s, not routes, so they must not be scanned.
|
|
132
|
-
routeFileIgnorePattern: 'importMap\\.(?:js|server\\.ts)$|\\.functions\\.',
|
|
133
|
-
routesDirectory
|
|
134
|
-
},
|
|
135
|
-
rsc: {
|
|
136
|
-
enabled: true
|
|
137
|
-
},
|
|
138
|
-
srcDirectory
|
|
139
|
-
}),
|
|
140
|
-
reactPlugin,
|
|
141
|
-
...extraPlugins
|
|
142
|
-
],
|
|
143
|
-
resolve: {
|
|
144
|
-
alias: [
|
|
145
|
-
{
|
|
146
|
-
find: '@payload-config',
|
|
147
|
-
replacement: path.resolve(payloadConfigPath)
|
|
148
|
-
},
|
|
149
|
-
...additionalAliases
|
|
150
|
-
],
|
|
151
|
-
dedupe: [
|
|
152
|
-
'react',
|
|
153
|
-
'react-dom',
|
|
154
|
-
'scheduler',
|
|
155
|
-
'@payloadcms/ui',
|
|
156
|
-
'@payloadcms/richtext-lexical'
|
|
157
|
-
],
|
|
158
|
-
extensions: [
|
|
159
|
-
'.mjs',
|
|
160
|
-
'.js',
|
|
161
|
-
'.mts',
|
|
162
|
-
'.ts',
|
|
163
|
-
'.jsx',
|
|
164
|
-
'.tsx',
|
|
165
|
-
'.json'
|
|
166
|
-
],
|
|
167
|
-
tsconfigPaths: true
|
|
168
|
-
},
|
|
169
|
-
ssr: {
|
|
170
|
-
external: [
|
|
171
|
-
...ssrExternalPackages,
|
|
172
|
-
...additionalSsrExternal
|
|
173
|
-
],
|
|
174
|
-
noExternal: payloadNoExternalPatterns
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
//# sourceMappingURL=plugin.js.map
|
package/dist/vite/plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/plugin.ts"],"sourcesContent":["import type { PluginOption, UserConfigFnObject } from 'vite'\n\nimport path from 'node:path'\n\nimport {\n optimizeDepsExcludeDefaults,\n optimizeDepsIncludeDefaults,\n payloadNoExternalPatterns,\n payloadRscNoExternalPatterns,\n ssrExternalPackages,\n} from './constants.js'\nimport {\n defaultImportProtectionIgnoreImporters,\n onImportProtectionViolation,\n serverOnlyClientSpecifiers,\n} from './importProtection.js'\nimport { clientModuleResolution } from './plugins/clientModuleResolution.js'\nimport { payloadDevTransforms } from './plugins/devTransforms.js'\nimport { reactDomServerInRsc } from './plugins/reactDomServerInRsc.js'\nimport { ssrStripDistStyleImports } from './plugins/stripDistStyleImports.js'\nimport { wrapCjsForClient } from './plugins/wrapCjsForClient.js'\n\nexport interface PayloadPluginOptions {\n /** Additional resolve aliases */\n additionalAliases?: Array<{ find: RegExp | string; replacement: string }>\n /** Additional import protection ignoreImporters patterns */\n additionalIgnoreImporters?: RegExp[]\n /** Extra optimizeDeps.include entries */\n additionalOptimizeDepsInclude?: string[]\n /** Extra ssr.external entries */\n additionalSsrExternal?: string[]\n /** Path to the user's payload.config.ts (required) */\n payloadConfigPath: string\n /** Extra Vite plugins to include */\n plugins?: PluginOption[]\n /** @vitejs/plugin-react instance — must be passed by consumer to ensure correct resolution */\n reactPlugin: PluginOption\n /** TanStack router routes directory relative to srcDirectory. Defaults to 'app' */\n routesDirectory?: string\n /** @vitejs/plugin-rsc instance — required for RSC support, must be passed by consumer */\n rscPlugin: PluginOption\n /** TanStack source directory. Defaults to 'src' */\n srcDirectory?: string\n /** tanstackStart from '@tanstack/react-start/plugin/vite' — must be passed by consumer to ensure correct resolution */\n tanstackStart: typeof import('@tanstack/react-start/plugin/vite').tanstackStart\n}\n\n/**\n * Vite plugin for Payload + TanStack Start. The Vite-side counterpart to\n * `withPayload` for Next.js: it configures the Vite environment so the Payload\n * admin can run, then composes the TanStack Start plugin with two small\n * Payload-specific workarounds (dev HMR injection, SSR style stripping). Each\n * remaining workaround lives in its own file under `./plugins/` so it can be\n * deleted individually once the corresponding upstream fix lands.\n */\nexport function payloadPlugin(options: PayloadPluginOptions): UserConfigFnObject {\n const {\n additionalAliases = [],\n additionalIgnoreImporters = [],\n additionalOptimizeDepsInclude = [],\n additionalSsrExternal = [],\n payloadConfigPath,\n plugins: extraPlugins = [],\n reactPlugin,\n routesDirectory = 'app',\n rscPlugin,\n srcDirectory = 'src',\n tanstackStart,\n } = options\n\n process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED = 'true'\n\n return (_env) => ({\n css: {\n preprocessorOptions: {\n scss: {\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\n 'process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED': JSON.stringify('true'),\n },\n environments: {\n rsc: { resolve: { noExternal: payloadRscNoExternalPatterns } },\n ssr: { resolve: { noExternal: payloadNoExternalPatterns } },\n } as any,\n optimizeDeps: {\n exclude: optimizeDepsExcludeDefaults,\n include: [...optimizeDepsIncludeDefaults, ...additionalOptimizeDepsInclude],\n },\n plugins: [\n clientModuleResolution(),\n wrapCjsForClient(),\n ssrStripDistStyleImports(),\n reactDomServerInRsc(),\n payloadDevTransforms(),\n rscPlugin,\n tanstackStart({\n importProtection: {\n client: { excludeFiles: [], specifiers: serverOnlyClientSpecifiers },\n ignoreImporters: [\n ...defaultImportProtectionIgnoreImporters,\n ...additionalIgnoreImporters,\n ],\n include: ['**/*'],\n mockAccess: 'warn',\n onViolation: onImportProtectionViolation,\n // Disable TanStack Start's default `**/*.client.*` file-based denial in\n // the SSR environment. Payload uses the `.client.tsx` filename suffix\n // for React Client Components (with a `'use client'` directive) that\n // MUST be server-rendered to HTML during SSR. The default rule would\n // otherwise replace those files with an `import-protection mock` Proxy\n // during SSR, which crashes React (TypeError: Cannot convert object to\n // primitive value) the moment React tries to format a warning that\n // mentions one of these components.\n server: { files: [] },\n },\n // Disable TanStack Router's automatic per-route code-splitting.\n //\n // With splitting enabled each route's `component` is fetched lazily\n // via `?tsr-split=component` after the initial SSR HTML is streamed.\n // Until that lazy chunk lands the rendered admin tree has no client\n // React attached, so any button clicks (e.g. the\n // `#toggle-list-filters` chevron in `<ListControls />`) hit a static\n // DOM, the click is dropped, and once the chunk finally loads the\n // component re-mounts with its initial `useState` instead of the\n // toggled value. That single behaviour was the root cause of the\n // \"page renders but nothing is interactive\" tanstack-start E2E\n // failures (`#list-controls-where`, `[data-lexical-editor]`, etc.) -\n // playwright traces show \"Download the React DevTools\" landing\n // *after* the playwright click, confirming late hydration.\n //\n // We pass BOTH knobs because `tanstackStart`'s schema silently\n // strips the user-supplied `autoCodeSplitting` (its `tsrConfig`\n // does `configSchema.omit({ autoCodeSplitting: true, target: true\n // })`) and then leaves the value `undefined` — which is fine for\n // the conditional inside `unpluginRouterComposedFactory`, but the\n // TanStack Start vite plugin *unconditionally* installs the router\n // code-splitter via `tanStackRouterCodeSplitter(...)` regardless.\n // The only knob that survives all of that and is honoured by the\n // splitter is `router.codeSplittingOptions.defaultBehavior` — set\n // to an empty array, the splitter still walks each `createFileRoute`\n // file but produces no virtual `?tsr-split=...` modules, so every\n // route component ships in the initial bundle and hydration starts\n // immediately on first paint. We keep `autoCodeSplitting: false` as\n // a belt-and-braces signal in case the start plugin ever stops\n // dropping it.\n //\n // Eager-loading routes ships a slightly larger initial bundle but\n // makes the admin actually interactive on first paint.\n router: {\n autoCodeSplitting: false,\n codeSplittingOptions: { defaultBehavior: [] },\n // Exclude generated importMap files and colocated server-function\n // modules (`*.functions.ts`). Admin form saves are dispatched via\n // `runPayloadServerFn` (a TanStack Start `createServerFn`) rather than\n // a hand-rolled route, so there is no longer an `api.server-function.ts`\n // to special-case here. The `*.functions.ts` shims live next to the\n // routes that use them (e.g. `app/_payload/*.functions.ts`); they\n // define `createServerFn`s, not routes, so they must not be scanned.\n routeFileIgnorePattern: 'importMap\\\\.(?:js|server\\\\.ts)$|\\\\.functions\\\\.',\n routesDirectory,\n } as any,\n rsc: { enabled: true },\n srcDirectory,\n }),\n reactPlugin,\n ...extraPlugins,\n ],\n resolve: {\n alias: [\n { find: '@payload-config', replacement: path.resolve(payloadConfigPath) },\n ...additionalAliases,\n ],\n dedupe: ['react', 'react-dom', 'scheduler', '@payloadcms/ui', '@payloadcms/richtext-lexical'],\n extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],\n tsconfigPaths: true,\n } as any,\n ssr: {\n external: [...ssrExternalPackages, ...additionalSsrExternal],\n noExternal: payloadNoExternalPatterns,\n },\n })\n}\n"],"names":["path","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults","payloadNoExternalPatterns","payloadRscNoExternalPatterns","ssrExternalPackages","defaultImportProtectionIgnoreImporters","onImportProtectionViolation","serverOnlyClientSpecifiers","clientModuleResolution","payloadDevTransforms","reactDomServerInRsc","ssrStripDistStyleImports","wrapCjsForClient","payloadPlugin","options","additionalAliases","additionalIgnoreImporters","additionalOptimizeDepsInclude","additionalSsrExternal","payloadConfigPath","plugins","extraPlugins","reactPlugin","routesDirectory","rscPlugin","srcDirectory","tanstackStart","process","env","PAYLOAD_FRAMEWORK_RSC_ENABLED","_env","css","preprocessorOptions","scss","silenceDeprecations","define","global","JSON","stringify","environments","rsc","resolve","noExternal","ssr","optimizeDeps","exclude","include","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","files","router","autoCodeSplitting","codeSplittingOptions","defaultBehavior","routeFileIgnorePattern","enabled","alias","find","replacement","dedupe","extensions","tsconfigPaths","external"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientModuleResolution.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/clientModuleResolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CA+ErD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/plugins/clientModuleResolution.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Client-side module resolution:\n * 1. Stubs RSC modules (`@payloadcms/.../rsc`) with no-op components so the\n * Vite optimizer never tries to bundle their server implementations.\n * 2. Redirects bare `payload` imports made from user code (outside of\n * `node_modules` and our own packages) to `payload/shared`. The main\n * `payload` entry has top-level side effects requiring Node.js APIs.\n * 3. Resolves `/client` subpath exports for `@payloadcms/plugin-*` and\n * `@payloadcms/storage-*` packages when normal Vite resolution fails in\n * monorepo dev (no `dist/` built yet).\n */\nexport function clientModuleResolution(): PluginOption {\n const stubPrefix = '\\0payload:server-stub:'\n\n const serverOnlyPatterns: RegExp[] = [\n /^@payloadcms\\/richtext-lexical\\/rsc$/,\n /^@payloadcms\\/richtext-slate\\/rsc$/,\n /^@payloadcms\\/next\\/rsc$/,\n /^@payloadcms\\/tanstack-start\\/rsc$/,\n ]\n\n const serverOnlyExports: Record<string, string[]> = {\n '@payloadcms/next/rsc': ['CollectionCards', 'HierarchyTypeFieldServer'],\n '@payloadcms/richtext-lexical/rsc': [\n 'RscEntryLexicalCell',\n 'RscEntryLexicalField',\n 'LexicalDiffComponent',\n ],\n '@payloadcms/tanstack-start/rsc': [\n 'CollectionCards',\n 'HierarchyTypeFieldServer',\n 'renderPayloadComponentOnServer',\n ],\n }\n\n return {\n name: 'payload:client-module-resolution',\n enforce: 'pre',\n load(id) {\n if (!id.startsWith(stubPrefix)) {\n return\n }\n const specifier = id.slice(stubPrefix.length)\n const exports = serverOnlyExports[specifier]\n if (exports) {\n return exports.map((name) => `export const ${name} = () => null;`).join('\\n')\n }\n return `export default null;`\n },\n async resolveId(id, importer, options) {\n if (options?.ssr) {\n return\n }\n\n if (serverOnlyPatterns.some((p) => p.test(id))) {\n return stubPrefix + id\n }\n\n if (id === 'payload' && importer && !importer.includes('/node_modules/')) {\n const isPayloadPackage = /\\/packages\\/(?:payload|ui|richtext-|tanstack-start|next)\\//.test(\n importer,\n )\n if (!isPayloadPackage) {\n return this.resolve('payload/shared', importer, { ...options, skipSelf: true })\n }\n }\n\n if (/^@payloadcms\\/(?:plugin|storage)-[^/]+\\/client$/.test(id)) {\n const resolved = await this.resolve(id, importer, { ...options, skipSelf: true })\n if (resolved) {\n return resolved\n }\n const pkgName = id.replace(/\\/client$/, '')\n const pkgResolved = await this.resolve(pkgName, importer, { ...options, skipSelf: true })\n if (pkgResolved) {\n const pkgDir = path.dirname(pkgResolved.id)\n const candidates = [\n path.resolve(pkgDir, 'src', 'exports', 'client.ts'),\n path.resolve(pkgDir, 'src', 'exports', 'client.js'),\n path.resolve(pkgDir, 'dist', 'exports', 'client.js'),\n ]\n for (const candidate of candidates) {\n if (fs.existsSync(candidate)) {\n return candidate\n }\n }\n }\n }\n },\n }\n}\n"],"names":["fs","path","clientModuleResolution","stubPrefix","serverOnlyPatterns","serverOnlyExports","name","enforce","load","id","startsWith","specifier","slice","length","exports","map","join","resolveId","importer","options","ssr","some","p","test","includes","isPayloadPackage","resolve","skipSelf","resolved","pkgName","replace","pkgResolved","pkgDir","dirname","candidates","candidate","existsSync"],"mappings":"AAEA,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAE5B;;;;;;;;;;CAUC,GACD,OAAO,SAASC;IACd,MAAMC,aAAa;IAEnB,MAAMC,qBAA+B;QACnC;QACA;QACA;QACA;KACD;IAED,MAAMC,oBAA8C;QAClD,wBAAwB;YAAC;YAAmB;SAA2B;QACvE,oCAAoC;YAClC;YACA;YACA;SACD;QACD,kCAAkC;YAChC;YACA;YACA;SACD;IACH;IAEA,OAAO;QACLC,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAI,CAACA,GAAGC,UAAU,CAACP,aAAa;gBAC9B;YACF;YACA,MAAMQ,YAAYF,GAAGG,KAAK,CAACT,WAAWU,MAAM;YAC5C,MAAMC,UAAUT,iBAAiB,CAACM,UAAU;YAC5C,IAAIG,SAAS;gBACX,OAAOA,QAAQC,GAAG,CAAC,CAACT,OAAS,CAAC,aAAa,EAAEA,KAAK,cAAc,CAAC,EAAEU,IAAI,CAAC;YAC1E;YACA,OAAO,CAAC,oBAAoB,CAAC;QAC/B;QACA,MAAMC,WAAUR,EAAE,EAAES,QAAQ,EAAEC,OAAO;YACnC,IAAIA,SAASC,KAAK;gBAChB;YACF;YAEA,IAAIhB,mBAAmBiB,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,CAACd,MAAM;gBAC9C,OAAON,aAAaM;YACtB;YAEA,IAAIA,OAAO,aAAaS,YAAY,CAACA,SAASM,QAAQ,CAAC,mBAAmB;gBACxE,MAAMC,mBAAmB,6DAA6DF,IAAI,CACxFL;gBAEF,IAAI,CAACO,kBAAkB;oBACrB,OAAO,IAAI,CAACC,OAAO,CAAC,kBAAkBR,UAAU;wBAAE,GAAGC,OAAO;wBAAEQ,UAAU;oBAAK;gBAC/E;YACF;YAEA,IAAI,kDAAkDJ,IAAI,CAACd,KAAK;gBAC9D,MAAMmB,WAAW,MAAM,IAAI,CAACF,OAAO,CAACjB,IAAIS,UAAU;oBAAE,GAAGC,OAAO;oBAAEQ,UAAU;gBAAK;gBAC/E,IAAIC,UAAU;oBACZ,OAAOA;gBACT;gBACA,MAAMC,UAAUpB,GAAGqB,OAAO,CAAC,aAAa;gBACxC,MAAMC,cAAc,MAAM,IAAI,CAACL,OAAO,CAACG,SAASX,UAAU;oBAAE,GAAGC,OAAO;oBAAEQ,UAAU;gBAAK;gBACvF,IAAII,aAAa;oBACf,MAAMC,SAAS/B,KAAKgC,OAAO,CAACF,YAAYtB,EAAE;oBAC1C,MAAMyB,aAAa;wBACjBjC,KAAKyB,OAAO,CAACM,QAAQ,OAAO,WAAW;wBACvC/B,KAAKyB,OAAO,CAACM,QAAQ,OAAO,WAAW;wBACvC/B,KAAKyB,OAAO,CAACM,QAAQ,QAAQ,WAAW;qBACzC;oBACD,KAAK,MAAMG,aAAaD,WAAY;wBAClC,IAAIlC,GAAGoC,UAAU,CAACD,YAAY;4BAC5B,OAAOA;wBACT;oBACF;gBACF;YACF;QACF;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devTransforms.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/devTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CA2DnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/plugins/devTransforms.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Dev-time transforms:\n * - Replaces `process.cwd()` with `\"/\"` in client code (non-SSR, non-prebundled)\n * - Injects Vite HMR + React Refresh preamble into SSR-rendered HTML (dev only)\n *\n * The preamble is injected just before `</head>`, *after* everything React\n * renders into the head. React 19 treats `<meta>`/`<link>`/`<style>`/`<title>`\n * as hoistable resources it matches by key (position-tolerant), but a\n * non-hoistable inline `<script type=\"module\">` placed *before* React's first\n * rendered head node makes hydration position-match that script against a\n * `<style>`/`<meta>` and throw — discarding the whole tree client-side, which\n * aborts in-flight server-function fetches and intermittently breaks drawers,\n * forms, and navigation. Appending after React's head content keeps the\n * preamble out of that positional comparison while still running before the\n * body's app-entry module.\n */\nexport function payloadDevTransforms(): PluginOption {\n const devScripts = `<script type=\"module\" src=\"/@vite/client\"></script>\n<script type=\"module\">\nimport RefreshRuntime from \"/@react-refresh\"\nRefreshRuntime.injectIntoGlobalHook(window)\nwindow.$RefreshReg$ = () => {}\nwindow.$RefreshSig$ = () => (type) => type\nwindow.__vite_plugin_react_preamble_installed__ = true\n</script>`\n\n return {\n name: 'payload:dev-transforms',\n configureServer(server) {\n server.middlewares.use((_req, res, next) => {\n let injected = false\n const origWrite = res.write\n const origEnd = res.end\n\n function tryInject(chunk: any): any {\n if (injected || chunk == null) {\n return chunk\n }\n const ct = res.getHeader('content-type')\n if (typeof ct !== 'string' || !ct.includes('text/html')) {\n return chunk\n }\n const str =\n typeof chunk === 'string'\n ? chunk\n : Buffer.isBuffer(chunk)\n ? chunk.toString()\n : chunk instanceof Uint8Array\n ? Buffer.from(chunk).toString()\n : null\n if (str && str.includes('</head>')) {\n injected = true\n return str.replace('</head>', `${devScripts}</head>`)\n }\n return chunk\n }\n\n res.write = function (this: any, chunk: any, encodingOrCb?: any, cb?: any) {\n return origWrite.call(this, tryInject(chunk), encodingOrCb, cb)\n } as typeof res.write\n res.end = function (this: any, chunk?: any, encodingOrCb?: any, cb?: any) {\n return origEnd.call(this, tryInject(chunk), encodingOrCb, cb)\n } as typeof res.end\n next()\n })\n },\n transform(code, id, options) {\n if (options?.ssr) {\n return\n }\n if (code.includes('process.cwd') && !id.includes('node_modules/.vite')) {\n return code.replace(/process\\.cwd\\(\\)/g, '\"/\"')\n }\n },\n }\n}\n"],"names":["payloadDevTransforms","devScripts","name","configureServer","server","middlewares","use","_req","res","next","injected","origWrite","write","origEnd","end","tryInject","chunk","ct","getHeader","includes","str","Buffer","isBuffer","toString","Uint8Array","from","replace","encodingOrCb","cb","call","transform","code","id","options","ssr"],"mappings":"AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASA;IACd,MAAMC,aAAa,CAAC;;;;;;;SAOb,CAAC;IAER,OAAO;QACLC,MAAM;QACNC,iBAAgBC,MAAM;YACpBA,OAAOC,WAAW,CAACC,GAAG,CAAC,CAACC,MAAMC,KAAKC;gBACjC,IAAIC,WAAW;gBACf,MAAMC,YAAYH,IAAII,KAAK;gBAC3B,MAAMC,UAAUL,IAAIM,GAAG;gBAEvB,SAASC,UAAUC,KAAU;oBAC3B,IAAIN,YAAYM,SAAS,MAAM;wBAC7B,OAAOA;oBACT;oBACA,MAAMC,KAAKT,IAAIU,SAAS,CAAC;oBACzB,IAAI,OAAOD,OAAO,YAAY,CAACA,GAAGE,QAAQ,CAAC,cAAc;wBACvD,OAAOH;oBACT;oBACA,MAAMI,MACJ,OAAOJ,UAAU,WACbA,QACAK,OAAOC,QAAQ,CAACN,SACdA,MAAMO,QAAQ,KACdP,iBAAiBQ,aACfH,OAAOI,IAAI,CAACT,OAAOO,QAAQ,KAC3B;oBACV,IAAIH,OAAOA,IAAID,QAAQ,CAAC,YAAY;wBAClCT,WAAW;wBACX,OAAOU,IAAIM,OAAO,CAAC,WAAW,GAAGzB,WAAW,OAAO,CAAC;oBACtD;oBACA,OAAOe;gBACT;gBAEAR,IAAII,KAAK,GAAG,SAAqBI,KAAU,EAAEW,YAAkB,EAAEC,EAAQ;oBACvE,OAAOjB,UAAUkB,IAAI,CAAC,IAAI,EAAEd,UAAUC,QAAQW,cAAcC;gBAC9D;gBACApB,IAAIM,GAAG,GAAG,SAAqBE,KAAW,EAAEW,YAAkB,EAAEC,EAAQ;oBACtE,OAAOf,QAAQgB,IAAI,CAAC,IAAI,EAAEd,UAAUC,QAAQW,cAAcC;gBAC5D;gBACAnB;YACF;QACF;QACAqB,WAAUC,IAAI,EAAEC,EAAE,EAAEC,OAAO;YACzB,IAAIA,SAASC,KAAK;gBAChB;YACF;YACA,IAAIH,KAAKZ,QAAQ,CAAC,kBAAkB,CAACa,GAAGb,QAAQ,CAAC,uBAAuB;gBACtE,OAAOY,KAAKL,OAAO,CAAC,qBAAqB;YAC3C;QACF;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactDomServerInRsc.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/reactDomServerInRsc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAQxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAyDlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/plugins/reactDomServerInRsc.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\nimport { createRequire } from 'node:module'\n\nconst require = createRequire(import.meta.url)\n\nconst REACT_DOM_SERVER_RE = /^react-dom\\/server(?:\\.(?:edge|node|browser))?$/\n\n/**\n * Provides a working `react-dom/server` inside the RSC environment.\n *\n * Payload's version-diff converters (`@payloadcms/richtext-lexical`'s\n * `field/Diff/converters/*` and `@payloadcms/ui`'s `Version/RenderFieldsToDiff`)\n * call `renderToStaticMarkup` while rendering a Server Component. In the RSC\n * environment Vite activates the `react-server` export condition, under which\n * every `react-dom/server*` subpath resolves to `server.react-server.js` — a\n * stub that throws `react-dom/server is not supported in React Server\n * Components`. Force-resolving past the condition isn't enough either: the\n * static renderer reads the *client* React internals\n * (`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`), which\n * the `react-server` build of `react` doesn't expose.\n *\n * So we pre-bundle a self-contained `react-dom/server` with client React\n * inlined (esbuild, deliberately WITHOUT the `react-server` condition) and\n * redirect `react-dom/server` to it in the RSC graph only. The bundle is fully\n * self-contained, so the RSC environment's `react-server` condition can't\n * reach into it. JSX elements created by the RSC-graph React stay renderable\n * because React identifies elements via a process-global `Symbol.for(...)`.\n *\n * Delete this once `react-dom/server` (or an equivalent static renderer) is\n * usable from the `react-server` condition without a separate bundle.\n */\nexport function reactDomServerInRsc(): PluginOption {\n const RESOLVED_ID = '\\0payload:react-dom-server-rsc'\n let bundledCode: string | undefined\n\n const buildBundle = (): string => {\n if (bundledCode !== undefined) {\n return bundledCode\n }\n // esbuild is always present as a Vite dependency. Typed loosely because it\n // isn't a direct dependency of this package.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const esbuild: any = require('esbuild')\n const result = esbuild.buildSync({\n banner: {\n // The bundled CJS React DOM server build does `require('util')` etc.\n // esbuild's ESM output otherwise emits a stub that throws \"Dynamic\n // require of ... is not supported\" inside Vite's module runner, so wire\n // up a real `require` for Node built-ins.\n js: \"import { createRequire as __pl_cr } from 'node:module';const require = __pl_cr(import.meta.url);\",\n },\n bundle: true,\n // Resolve react/react-dom to their CLIENT builds — NOT the `react-server`\n // condition the RSC environment would otherwise apply.\n conditions: ['node', 'import', 'default'],\n define: { 'process.env.NODE_ENV': JSON.stringify('production') },\n format: 'esm',\n platform: 'node',\n stdin: {\n contents: [\n \"import * as ReactDOMServer from 'react-dom/server'\",\n \"export * from 'react-dom/server'\",\n 'export default ReactDOMServer',\n ].join('\\n'),\n loader: 'js',\n resolveDir: process.cwd(),\n },\n write: false,\n })\n const code = result.outputFiles[0].text as string\n bundledCode = code\n return code\n }\n\n return {\n name: 'payload:react-dom-server-in-rsc',\n enforce: 'pre',\n load(id) {\n if (id === RESOLVED_ID) {\n return buildBundle()\n }\n },\n resolveId(id) {\n if ((this as any).environment?.name === 'rsc' && REACT_DOM_SERVER_RE.test(id)) {\n return RESOLVED_ID\n }\n },\n }\n}\n"],"names":["createRequire","require","url","REACT_DOM_SERVER_RE","reactDomServerInRsc","RESOLVED_ID","bundledCode","buildBundle","undefined","esbuild","result","buildSync","banner","js","bundle","conditions","define","JSON","stringify","format","platform","stdin","contents","join","loader","resolveDir","process","cwd","write","code","outputFiles","text","name","enforce","load","id","resolveId","environment","test"],"mappings":"AAEA,SAASA,aAAa,QAAQ,cAAa;AAE3C,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAE7C,MAAMC,sBAAsB;AAE5B;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC;IACd,MAAMC,cAAc;IACpB,IAAIC;IAEJ,MAAMC,cAAc;QAClB,IAAID,gBAAgBE,WAAW;YAC7B,OAAOF;QACT;QACA,2EAA2E;QAC3E,6CAA6C;QAC7C,8DAA8D;QAC9D,MAAMG,UAAeR,QAAQ;QAC7B,MAAMS,SAASD,QAAQE,SAAS,CAAC;YAC/BC,QAAQ;gBACN,qEAAqE;gBACrE,mEAAmE;gBACnE,wEAAwE;gBACxE,0CAA0C;gBAC1CC,IAAI;YACN;YACAC,QAAQ;YACR,0EAA0E;YAC1E,uDAAuD;YACvDC,YAAY;gBAAC;gBAAQ;gBAAU;aAAU;YACzCC,QAAQ;gBAAE,wBAAwBC,KAAKC,SAAS,CAAC;YAAc;YAC/DC,QAAQ;YACRC,UAAU;YACVC,OAAO;gBACLC,UAAU;oBACR;oBACA;oBACA;iBACD,CAACC,IAAI,CAAC;gBACPC,QAAQ;gBACRC,YAAYC,QAAQC,GAAG;YACzB;YACAC,OAAO;QACT;QACA,MAAMC,OAAOnB,OAAOoB,WAAW,CAAC,EAAE,CAACC,IAAI;QACvCzB,cAAcuB;QACd,OAAOA;IACT;IAEA,OAAO;QACLG,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAIA,OAAO9B,aAAa;gBACtB,OAAOE;YACT;QACF;QACA6B,WAAUD,EAAE;YACV,IAAI,AAAC,IAAI,CAASE,WAAW,EAAEL,SAAS,SAAS7B,oBAAoBmC,IAAI,CAACH,KAAK;gBAC7E,OAAO9B;YACT;QACF;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripDistStyleImports.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/stripDistStyleImports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAsDxC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,IAAI,YAAY,CAyEvD"}
|