@payloadcms/tanstack-start 4.0.0-internal.a0ef1b8 → 4.0.0-internal.a2d053c
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 +3 -0
- package/dist/adapters/handleServerFunctions.d.ts.map +1 -0
- package/dist/adapters/handleServerFunctions.js +17 -0
- package/dist/adapters/handleServerFunctions.js.map +1 -0
- package/dist/adapters/layout/RootProviders/index.d.ts +9 -0
- package/dist/adapters/layout/RootProviders/index.d.ts.map +1 -0
- package/dist/adapters/layout/RootProviders/index.js +21 -0
- package/dist/adapters/layout/RootProviders/index.js.map +1 -0
- package/dist/adapters/layout/index.d.ts +69 -0
- package/dist/adapters/layout/index.d.ts.map +1 -0
- package/dist/adapters/layout/index.js +107 -0
- package/dist/adapters/layout/index.js.map +1 -0
- package/dist/adapters/layout/lazy.d.ts +7 -0
- package/dist/adapters/layout/lazy.d.ts.map +1 -0
- package/dist/adapters/layout/lazy.js +17 -0
- package/dist/adapters/layout/lazy.js.map +1 -0
- package/dist/adapters/layout/outlet.d.ts +4 -0
- package/dist/adapters/layout/outlet.d.ts.map +1 -0
- package/dist/adapters/layout/outlet.js +9 -0
- package/dist/adapters/layout/outlet.js.map +1 -0
- package/dist/adapters/layout/server.d.ts +23 -0
- package/dist/adapters/layout/server.d.ts.map +1 -0
- package/dist/adapters/layout/server.js +65 -0
- package/dist/adapters/layout/server.js.map +1 -0
- package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +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/adapters/router.js +183 -0
- 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 -30
- package/dist/adapters/server.js.map +1 -0
- package/dist/adapters/views/index.d.ts +107 -0
- package/dist/adapters/views/index.d.ts.map +1 -0
- package/dist/adapters/views/index.js +101 -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 +44 -0
- package/dist/adapters/views/lazy.js.map +1 -0
- package/dist/adapters/views/server.d.ts +60 -0
- package/dist/adapters/views/server.d.ts.map +1 -0
- package/dist/adapters/views/server.js +178 -0
- 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/layout.d.ts +2 -0
- package/dist/exports/client/layout.d.ts.map +1 -0
- package/dist/exports/client/layout.js +4 -0
- package/dist/exports/client/layout.js.map +1 -0
- package/dist/exports/client.d.ts +3 -3
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +3 -3
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +2 -4
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -2
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.d.ts +2 -0
- package/dist/exports/routes.d.ts.map +1 -0
- package/dist/exports/routes.js +3 -0
- package/dist/exports/routes.js.map +1 -0
- 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 +7 -11
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +7 -11
- 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 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- 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/routes/rest/handler.server.d.ts +11 -0
- package/dist/routes/rest/handler.server.d.ts.map +1 -0
- package/dist/routes/rest/handler.server.js +14 -0
- package/dist/routes/rest/handler.server.js.map +1 -0
- package/dist/routes/rest/index.d.ts +35 -0
- package/dist/routes/rest/index.d.ts.map +1 -0
- package/dist/routes/rest/index.js +44 -0
- 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 +61 -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/serverFunctionClient.d.ts +8 -0
- package/dist/utilities/serverFunctionClient.d.ts.map +1 -0
- package/dist/utilities/serverFunctionClient.js +20 -0
- package/dist/utilities/serverFunctionClient.js.map +1 -0
- package/dist/withPayload/config/external.d.ts +34 -0
- package/dist/withPayload/config/external.d.ts.map +1 -0
- package/dist/withPayload/config/external.js +88 -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/withPayload/config/optimizeDeps.js +160 -0
- 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 +112 -0
- package/dist/withPayload/index.d.ts.map +1 -0
- package/dist/withPayload/index.js +308 -0
- package/dist/withPayload/index.js.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
- package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
- package/dist/withPayload/workarounds/devTransforms.d.ts +19 -0
- package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
- package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.js +18 -2
- 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/withPayload/workarounds/stripDistStyleImports.js +140 -0
- 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 +45 -34
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/auth/switchLanguage.d.ts +0 -6
- package/dist/auth/switchLanguage.d.ts.map +0 -1
- package/dist/auth/switchLanguage.js +0 -11
- package/dist/auth/switchLanguage.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 +0 -118
- 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 -55
- package/dist/layouts/Root/getLayoutData.js.map +0 -1
- package/dist/layouts/Root/index.d.ts +0 -25
- 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/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/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/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 -9
- package/dist/utilities/importMap.server.d.ts.map +0 -1
- package/dist/utilities/importMap.server.js +0 -12
- 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/meta.d.ts.map +0 -1
- package/dist/utilities/meta.js.map +0 -1
- package/dist/utilities/serializeForRsc.d.ts +0 -26
- package/dist/utilities/serializeForRsc.d.ts.map +0 -1
- package/dist/utilities/serializeForRsc.js +0 -105
- package/dist/utilities/serializeForRsc.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/utilities/toSerializable.d.ts +0 -2
- package/dist/utilities/toSerializable.d.ts.map +0 -1
- package/dist/utilities/toSerializable.js +0 -111
- package/dist/utilities/toSerializable.js.map +0 -1
- package/dist/vite/constants.d.ts +0 -37
- package/dist/vite/constants.d.ts.map +0 -1
- package/dist/vite/constants.js +0 -129
- 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 -182
- 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 +0 -8
- 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 +0 -89
- 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}/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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as qs from 'qs-esm';
|
|
2
|
+
/**
|
|
3
|
+
* `parseSearch` for TanStack Router's `createRouter`, required for Payload's
|
|
4
|
+
* admin UI. Pair with {@link payloadStringifySearch}.
|
|
5
|
+
*
|
|
6
|
+
* Payload serializes query state (notably the list-view `where` filter) with
|
|
7
|
+
* `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
|
|
8
|
+
* Router's default serializer treats each bracketed string as a flat key and
|
|
9
|
+
* JSON-encodes values, so it never round-trips Payload's nested query: every
|
|
10
|
+
* navigation re-encodes the already-encoded value, exponentially nesting it
|
|
11
|
+
* (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
|
|
12
|
+
* stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
|
|
13
|
+
* the URL idempotent and the nested `where` intact across navigations.
|
|
14
|
+
*
|
|
15
|
+
* This is a router-global serializer: it applies to every route, not just
|
|
16
|
+
* `/admin`. On your own routes, search values arrive as strings (qs does no
|
|
17
|
+
* JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
|
|
18
|
+
* you need numbers or booleans.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createRouter } from '@tanstack/react-router'
|
|
23
|
+
* import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'
|
|
24
|
+
*
|
|
25
|
+
* export function getRouter() {
|
|
26
|
+
* return createRouter({
|
|
27
|
+
* parseSearch: payloadParseSearch,
|
|
28
|
+
* routeTree,
|
|
29
|
+
* stringifySearch: payloadStringifySearch,
|
|
30
|
+
* })
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const payloadParseSearch: (searchStr: string) => qs.ParsedQs;
|
|
35
|
+
/**
|
|
36
|
+
* `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
|
|
37
|
+
* admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
|
|
38
|
+
*/
|
|
39
|
+
export declare const payloadStringifySearch: (search: Record<string, unknown>) => string;
|
|
40
|
+
//# sourceMappingURL=routerSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerSearch.d.ts","sourceRoot":"","sources":["../../src/utilities/routerSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,cAAe,MAAM,gBACS,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAGrE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as qs from 'qs-esm';
|
|
2
|
+
/**
|
|
3
|
+
* `parseSearch` for TanStack Router's `createRouter`, required for Payload's
|
|
4
|
+
* admin UI. Pair with {@link payloadStringifySearch}.
|
|
5
|
+
*
|
|
6
|
+
* Payload serializes query state (notably the list-view `where` filter) with
|
|
7
|
+
* `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
|
|
8
|
+
* Router's default serializer treats each bracketed string as a flat key and
|
|
9
|
+
* JSON-encodes values, so it never round-trips Payload's nested query: every
|
|
10
|
+
* navigation re-encodes the already-encoded value, exponentially nesting it
|
|
11
|
+
* (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
|
|
12
|
+
* stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
|
|
13
|
+
* the URL idempotent and the nested `where` intact across navigations.
|
|
14
|
+
*
|
|
15
|
+
* This is a router-global serializer: it applies to every route, not just
|
|
16
|
+
* `/admin`. On your own routes, search values arrive as strings (qs does no
|
|
17
|
+
* JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
|
|
18
|
+
* you need numbers or booleans.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createRouter } from '@tanstack/react-router'
|
|
23
|
+
* import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'
|
|
24
|
+
*
|
|
25
|
+
* export function getRouter() {
|
|
26
|
+
* return createRouter({
|
|
27
|
+
* parseSearch: payloadParseSearch,
|
|
28
|
+
* routeTree,
|
|
29
|
+
* stringifySearch: payloadStringifySearch,
|
|
30
|
+
* })
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/ export const payloadParseSearch = (searchStr)=>qs.parse(searchStr, {
|
|
34
|
+
depth: 10,
|
|
35
|
+
ignoreQueryPrefix: true
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
|
|
39
|
+
* admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
|
|
40
|
+
*/ export const payloadStringifySearch = (search)=>{
|
|
41
|
+
const searchStr = qs.stringify(search);
|
|
42
|
+
return searchStr ? `?${searchStr}` : '';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=routerSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/routerSearch.ts"],"sourcesContent":["import * as qs from 'qs-esm'\n\n/**\n * `parseSearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadStringifySearch}.\n *\n * Payload serializes query state (notably the list-view `where` filter) with\n * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack\n * Router's default serializer treats each bracketed string as a flat key and\n * JSON-encodes values, so it never round-trips Payload's nested query: every\n * navigation re-encodes the already-encoded value, exponentially nesting it\n * (`[true,\"[true,\\\"[true…\"]`) until the filter is unusable. Parsing and\n * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps\n * the URL idempotent and the nested `where` intact across navigations.\n *\n * This is a router-global serializer: it applies to every route, not just\n * `/admin`. On your own routes, search values arrive as strings (qs does no\n * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where\n * you need numbers or booleans.\n *\n * @example\n * ```ts\n * import { createRouter } from '@tanstack/react-router'\n * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'\n *\n * export function getRouter() {\n * return createRouter({\n * parseSearch: payloadParseSearch,\n * routeTree,\n * stringifySearch: payloadStringifySearch,\n * })\n * }\n * ```\n */\nexport const payloadParseSearch = (searchStr: string) =>\n qs.parse(searchStr, { depth: 10, ignoreQueryPrefix: true })\n\n/**\n * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.\n */\nexport const payloadStringifySearch = (search: Record<string, unknown>) => {\n const searchStr = qs.stringify(search)\n return searchStr ? `?${searchStr}` : ''\n}\n"],"names":["qs","payloadParseSearch","searchStr","parse","depth","ignoreQueryPrefix","payloadStringifySearch","search","stringify"],"mappings":"AAAA,YAAYA,QAAQ,SAAQ;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,qBAAqB,CAACC,YACjCF,GAAGG,KAAK,CAACD,WAAW;QAAEE,OAAO;QAAIC,mBAAmB;IAAK,GAAE;AAE7D;;;CAGC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAML,YAAYF,GAAGQ,SAAS,CAACD;IAC/B,OAAOL,YAAY,CAAC,CAAC,EAAEA,WAAW,GAAG;AACvC,EAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload';
|
|
2
|
+
/** Builds the admin dispatcher with native Flight response decoding. */
|
|
3
|
+
export declare function createServerFunctionClient({ runServerFn, }: {
|
|
4
|
+
runServerFn: (input: {
|
|
5
|
+
data: ServerFunctionClientArgs;
|
|
6
|
+
}) => Promise<Response>;
|
|
7
|
+
}): ServerFunctionClient;
|
|
8
|
+
//# sourceMappingURL=serverFunctionClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverFunctionClient.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAE7E,wEAAwE;AACxE,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAA;KAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC9E,GAAG,oBAAoB,CAoBvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Builds the admin dispatcher with native Flight response decoding. */ export function createServerFunctionClient({ runServerFn }) {
|
|
2
|
+
return async (args)=>{
|
|
3
|
+
const response = await runServerFn({
|
|
4
|
+
data: args
|
|
5
|
+
});
|
|
6
|
+
if (!response.ok) {
|
|
7
|
+
throw new Error(`Payload server function failed with status ${response.status}`);
|
|
8
|
+
}
|
|
9
|
+
if (response.headers.get('content-type')?.split(';')[0]?.trim() !== 'text/x-component') {
|
|
10
|
+
throw new Error('Expected a React Flight response from the Payload server function');
|
|
11
|
+
}
|
|
12
|
+
if (!response.body) {
|
|
13
|
+
throw new Error('The Payload server function returned an empty Flight response');
|
|
14
|
+
}
|
|
15
|
+
const { createFromReadableStream } = await import('@tanstack/react-start/rsc');
|
|
16
|
+
return await createFromReadableStream(response.body);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=serverFunctionClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/serverFunctionClient.ts"],"sourcesContent":["import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload'\n\n/** Builds the admin dispatcher with native Flight response decoding. */\nexport function createServerFunctionClient({\n runServerFn,\n}: {\n runServerFn: (input: { data: ServerFunctionClientArgs }) => Promise<Response>\n}): ServerFunctionClient {\n return (async (args: ServerFunctionClientArgs) => {\n const response = await runServerFn({ data: args })\n\n if (!response.ok) {\n throw new Error(`Payload server function failed with status ${response.status}`)\n }\n\n if (response.headers.get('content-type')?.split(';')[0]?.trim() !== 'text/x-component') {\n throw new Error('Expected a React Flight response from the Payload server function')\n }\n\n if (!response.body) {\n throw new Error('The Payload server function returned an empty Flight response')\n }\n\n const { createFromReadableStream } = await import('@tanstack/react-start/rsc')\n\n return await createFromReadableStream(response.body)\n }) as ServerFunctionClient\n}\n"],"names":["createServerFunctionClient","runServerFn","args","response","data","ok","Error","status","headers","get","split","trim","body","createFromReadableStream"],"mappings":"AAEA,sEAAsE,GACtE,OAAO,SAASA,2BAA2B,EACzCC,WAAW,EAGZ;IACC,OAAQ,OAAOC;QACb,MAAMC,WAAW,MAAMF,YAAY;YAAEG,MAAMF;QAAK;QAEhD,IAAI,CAACC,SAASE,EAAE,EAAE;YAChB,MAAM,IAAIC,MAAM,CAAC,2CAA2C,EAAEH,SAASI,MAAM,EAAE;QACjF;QAEA,IAAIJ,SAASK,OAAO,CAACC,GAAG,CAAC,iBAAiBC,MAAM,IAAI,CAAC,EAAE,EAAEC,WAAW,oBAAoB;YACtF,MAAM,IAAIL,MAAM;QAClB;QAEA,IAAI,CAACH,SAASS,IAAI,EAAE;YAClB,MAAM,IAAIN,MAAM;QAClB;QAEA,MAAM,EAAEO,wBAAwB,EAAE,GAAG,MAAM,MAAM,CAAC;QAElD,OAAO,MAAMA,yBAAyBV,SAASS,IAAI;IACrD;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packages externalized during dev serve (`ssr.external`). Node's loader resolves
|
|
3
|
+
* their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
|
|
4
|
+
* fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
|
|
5
|
+
* throws when transformed rather than required).
|
|
6
|
+
*
|
|
7
|
+
* Safe here whoever declared the entry: Node resolves from the importing package,
|
|
8
|
+
* so pnpm's isolated layout never applies. The build is stricter — see
|
|
9
|
+
* {@link buildBundledPackages}.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ssrExternalPackages: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Entries of {@link ssrExternalPackages} that must bundle in the production build.
|
|
14
|
+
*
|
|
15
|
+
* Externalizing only works for specifiers resolvable from the project root. These
|
|
16
|
+
* are leaf deps of Payload packages, so under pnpm they live in `.pnpm/…` and a bare
|
|
17
|
+
* specifier in a root-resolved chunk is invisible — `ERR_MODULE_NOT_FOUND` at
|
|
18
|
+
* runtime, or a build-time resolve failure under Nitro's re-bundle pass.
|
|
19
|
+
*
|
|
20
|
+
* `pluralize` also needs forcing back via `noExternal` (see `withPayload`); the
|
|
21
|
+
* storage leaves don't, since their adapters are already `noExternal`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildBundledPackages: string[];
|
|
24
|
+
/** Server-only package boundaries loaded directly by Node in development and production. */
|
|
25
|
+
export declare const serverExternalPackages: string[];
|
|
26
|
+
/** Additional installed packages that can bypass Vite's development server transforms. */
|
|
27
|
+
export declare const devExternalPackages: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Externalizes package boundaries so packages resolve their own transitive dependencies under pnpm.
|
|
30
|
+
* Leaves that must bundle in production are excluded; see {@link buildBundledPackages}.
|
|
31
|
+
*/
|
|
32
|
+
export declare const buildExternalPackages: string[];
|
|
33
|
+
export declare const payloadNoExternalPatterns: Array<RegExp | string>;
|
|
34
|
+
//# sourceMappingURL=external.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/withPayload/config/external.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAwBvC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAOxC,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAS1C,CAAA;AAED,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAOvC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAGzC,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { devServerExternalPackages as devServerExternalPayloadPackages, serverExternalPackages as serverExternalPayloadPackages } from 'payload/build-config';
|
|
2
|
+
/**
|
|
3
|
+
* Packages externalized during dev serve (`ssr.external`). Node's loader resolves
|
|
4
|
+
* their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
|
|
5
|
+
* fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
|
|
6
|
+
* throws when transformed rather than required).
|
|
7
|
+
*
|
|
8
|
+
* Safe here whoever declared the entry: Node resolves from the importing package,
|
|
9
|
+
* so pnpm's isolated layout never applies. The build is stricter — see
|
|
10
|
+
* {@link buildBundledPackages}.
|
|
11
|
+
*/ export const ssrExternalPackages = [
|
|
12
|
+
'zod',
|
|
13
|
+
'fast-uri',
|
|
14
|
+
...serverExternalPayloadPackages,
|
|
15
|
+
'drizzle-orm',
|
|
16
|
+
'pino-pretty',
|
|
17
|
+
'nodemailer',
|
|
18
|
+
'aws4',
|
|
19
|
+
'pluralize',
|
|
20
|
+
'console-table-printer',
|
|
21
|
+
'@azure/storage-blob',
|
|
22
|
+
'@aws-sdk/client-s3',
|
|
23
|
+
'@aws-sdk/s3-request-presigner',
|
|
24
|
+
'@google-cloud/storage',
|
|
25
|
+
// Database drivers + their lazily-required companions, one group per adapter.
|
|
26
|
+
// Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)
|
|
27
|
+
'pg',
|
|
28
|
+
'pg-native',
|
|
29
|
+
'pg-cloudflare',
|
|
30
|
+
// SQLite (`@payloadcms/db-sqlite`)
|
|
31
|
+
'better-sqlite3',
|
|
32
|
+
// Mongo (`@payloadcms/db-mongodb`)
|
|
33
|
+
'mongodb',
|
|
34
|
+
'mongoose'
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Entries of {@link ssrExternalPackages} that must bundle in the production build.
|
|
38
|
+
*
|
|
39
|
+
* Externalizing only works for specifiers resolvable from the project root. These
|
|
40
|
+
* are leaf deps of Payload packages, so under pnpm they live in `.pnpm/…` and a bare
|
|
41
|
+
* specifier in a root-resolved chunk is invisible — `ERR_MODULE_NOT_FOUND` at
|
|
42
|
+
* runtime, or a build-time resolve failure under Nitro's re-bundle pass.
|
|
43
|
+
*
|
|
44
|
+
* `pluralize` also needs forcing back via `noExternal` (see `withPayload`); the
|
|
45
|
+
* storage leaves don't, since their adapters are already `noExternal`.
|
|
46
|
+
*/ export const buildBundledPackages = [
|
|
47
|
+
'pluralize',
|
|
48
|
+
// Leaf deps of the `@payloadcms/storage-*` adapters.
|
|
49
|
+
'@aws-sdk/client-s3',
|
|
50
|
+
'@aws-sdk/s3-request-presigner',
|
|
51
|
+
'@azure/storage-blob',
|
|
52
|
+
'@google-cloud/storage'
|
|
53
|
+
];
|
|
54
|
+
/** Server-only package boundaries loaded directly by Node in development and production. */ export const serverExternalPackages = [
|
|
55
|
+
'payload',
|
|
56
|
+
'payload/node',
|
|
57
|
+
'@payloadcms/drizzle',
|
|
58
|
+
'@payloadcms/db-mongodb',
|
|
59
|
+
'@payloadcms/db-postgres',
|
|
60
|
+
'@payloadcms/db-vercel-postgres',
|
|
61
|
+
'@payloadcms/db-sqlite',
|
|
62
|
+
'@payloadcms/db-d1-sqlite'
|
|
63
|
+
];
|
|
64
|
+
/** Additional installed packages that can bypass Vite's development server transforms. */ export const devExternalPackages = [
|
|
65
|
+
...new Set([
|
|
66
|
+
// Vite otherwise transforms date-fns' full module graph during SSR.
|
|
67
|
+
'date-fns',
|
|
68
|
+
...devServerExternalPayloadPackages,
|
|
69
|
+
...serverExternalPackages
|
|
70
|
+
])
|
|
71
|
+
];
|
|
72
|
+
/**
|
|
73
|
+
* Externalizes package boundaries so packages resolve their own transitive dependencies under pnpm.
|
|
74
|
+
* Leaves that must bundle in production are excluded; see {@link buildBundledPackages}.
|
|
75
|
+
*/ export const buildExternalPackages = [
|
|
76
|
+
...serverExternalPackages,
|
|
77
|
+
...ssrExternalPackages.filter((pkg)=>!buildBundledPackages.includes(pkg))
|
|
78
|
+
];
|
|
79
|
+
export const payloadNoExternalPatterns = [
|
|
80
|
+
'@payloadcms/ui',
|
|
81
|
+
'@payloadcms/translations',
|
|
82
|
+
'@payloadcms/tanstack-start',
|
|
83
|
+
/^@payloadcms\/richtext-lexical/,
|
|
84
|
+
/^@payloadcms\/plugin-/,
|
|
85
|
+
/^@payloadcms\/storage-/
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=external.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/withPayload/config/external.ts"],"sourcesContent":["import {\n devServerExternalPackages as devServerExternalPayloadPackages,\n serverExternalPackages as serverExternalPayloadPackages,\n} from 'payload/build-config'\n\n/**\n * Packages externalized during dev serve (`ssr.external`). Node's loader resolves\n * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break\n * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment\n * throws when transformed rather than required).\n *\n * Safe here whoever declared the entry: Node resolves from the importing package,\n * so pnpm's isolated layout never applies. The build is stricter — see\n * {@link buildBundledPackages}.\n */\nexport const ssrExternalPackages: string[] = [\n 'zod',\n 'fast-uri',\n ...serverExternalPayloadPackages,\n 'drizzle-orm',\n 'pino-pretty',\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 // Database drivers + their lazily-required companions, one group per adapter.\n // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)\n 'pg',\n 'pg-native',\n 'pg-cloudflare',\n // SQLite (`@payloadcms/db-sqlite`)\n 'better-sqlite3',\n // Mongo (`@payloadcms/db-mongodb`)\n 'mongodb',\n 'mongoose',\n]\n\n/**\n * Entries of {@link ssrExternalPackages} that must bundle in the production build.\n *\n * Externalizing only works for specifiers resolvable from the project root. These\n * are leaf deps of Payload packages, so under pnpm they live in `.pnpm/…` and a bare\n * specifier in a root-resolved chunk is invisible — `ERR_MODULE_NOT_FOUND` at\n * runtime, or a build-time resolve failure under Nitro's re-bundle pass.\n *\n * `pluralize` also needs forcing back via `noExternal` (see `withPayload`); the\n * storage leaves don't, since their adapters are already `noExternal`.\n */\nexport const buildBundledPackages: string[] = [\n 'pluralize',\n // Leaf deps of the `@payloadcms/storage-*` adapters.\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@azure/storage-blob',\n '@google-cloud/storage',\n]\n\n/** Server-only package boundaries loaded directly by Node in development and production. */\nexport const serverExternalPackages: string[] = [\n 'payload',\n 'payload/node',\n '@payloadcms/drizzle',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-d1-sqlite',\n]\n\n/** Additional installed packages that can bypass Vite's development server transforms. */\nexport const devExternalPackages: string[] = [\n ...new Set([\n // Vite otherwise transforms date-fns' full module graph during SSR.\n 'date-fns',\n ...devServerExternalPayloadPackages,\n ...serverExternalPackages,\n ]),\n]\n\n/**\n * Externalizes package boundaries so packages resolve their own transitive dependencies under pnpm.\n * Leaves that must bundle in production are excluded; see {@link buildBundledPackages}.\n */\nexport const buildExternalPackages: string[] = [\n ...serverExternalPackages,\n ...ssrExternalPackages.filter((pkg) => !buildBundledPackages.includes(pkg)),\n]\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"],"names":["devServerExternalPackages","devServerExternalPayloadPackages","serverExternalPackages","serverExternalPayloadPackages","ssrExternalPackages","buildBundledPackages","devExternalPackages","Set","buildExternalPackages","filter","pkg","includes","payloadNoExternalPatterns"],"mappings":"AAAA,SACEA,6BAA6BC,gCAAgC,EAC7DC,0BAA0BC,6BAA6B,QAClD,uBAAsB;AAE7B;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAgC;IAC3C;IACA;OACGD;IACH;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,8EAA8E;IAC9E,yEAAyE;IACzE;IACA;IACA;IACA,mCAAmC;IACnC;IACA,mCAAmC;IACnC;IACA;CACD,CAAA;AAED;;;;;;;;;;CAUC,GACD,OAAO,MAAME,uBAAiC;IAC5C;IACA,qDAAqD;IACrD;IACA;IACA;IACA;CACD,CAAA;AAED,0FAA0F,GAC1F,OAAO,MAAMH,yBAAmC;IAC9C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,wFAAwF,GACxF,OAAO,MAAMI,sBAAgC;OACxC,IAAIC,IAAI;QACT,oEAAoE;QACpE;WACGN;WACAC;KACJ;CACF,CAAA;AAED;;;CAGC,GACD,OAAO,MAAMM,wBAAkC;OAC1CN;OACAE,oBAAoBK,MAAM,CAAC,CAACC,MAAQ,CAACL,qBAAqBM,QAAQ,CAACD;CACvE,CAAA;AAED,OAAO,MAAME,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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[];
|
|
25
|
+
//# sourceMappingURL=optimizeDeps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizeDeps.d.ts","sourceRoot":"","sources":["../../../src/withPayload/config/optimizeDeps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA0D/C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA+E/C,CAAA"}
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
* Packages we know contain Node-only code or top-level side effects requiring
|
|
6
|
+
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
7
|
+
* walking into their main entries and trying to bundle server-only imports
|
|
8
|
+
* for the browser.
|
|
9
|
+
*/ export const optimizeDepsExcludeDefaults = [
|
|
10
|
+
'sharp',
|
|
11
|
+
'@payloadcms/ui',
|
|
12
|
+
'@payloadcms/tanstack-start',
|
|
13
|
+
'payload',
|
|
14
|
+
'pino',
|
|
15
|
+
'pino-pretty',
|
|
16
|
+
'busboy',
|
|
17
|
+
'get-tsconfig',
|
|
18
|
+
'ws',
|
|
19
|
+
'croner',
|
|
20
|
+
'prompts',
|
|
21
|
+
'file-type',
|
|
22
|
+
// Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite
|
|
23
|
+
// sometimes walks these from the main package entry while scanning
|
|
24
|
+
// workspace deps, and the browser sub-bundles do not expose the
|
|
25
|
+
// server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
|
|
26
|
+
// server with a `MISSING_EXPORT` error before any test runs.
|
|
27
|
+
'@azure/storage-blob',
|
|
28
|
+
// Preserve RSC client boundaries on storage admin upload handlers.
|
|
29
|
+
'@payloadcms/storage-azure',
|
|
30
|
+
'@payloadcms/storage-r2',
|
|
31
|
+
'@payloadcms/storage-vercel-blob',
|
|
32
|
+
'@aws-sdk/client-s3',
|
|
33
|
+
'@aws-sdk/s3-request-presigner',
|
|
34
|
+
'@google-cloud/storage',
|
|
35
|
+
// Packages whose admin component barrel re-exports `'use client'` modules
|
|
36
|
+
// without carrying the directive itself. Pre-bundling one puts those modules
|
|
37
|
+
// in the optimized dep chunk *and* in the `rsc` environment as client
|
|
38
|
+
// references, which `@vitejs/plugin-rsc` warns about ("client component
|
|
39
|
+
// dependency is inconsistently optimized") once per component. Barrels that
|
|
40
|
+
// start with `'use client'` (e.g. `richtext-lexical`, `plugin-stripe`) don't
|
|
41
|
+
// warn and stay pre-bundled. Only shows up in published installs; workspace
|
|
42
|
+
// source is never pre-bundled.
|
|
43
|
+
'@payloadcms/plugin-cloud-storage',
|
|
44
|
+
'@payloadcms/plugin-ecommerce',
|
|
45
|
+
'@payloadcms/plugin-form-builder',
|
|
46
|
+
'@payloadcms/plugin-import-export',
|
|
47
|
+
'@payloadcms/plugin-multi-tenant',
|
|
48
|
+
'@payloadcms/plugin-search',
|
|
49
|
+
'@payloadcms/plugin-sentry',
|
|
50
|
+
'@payloadcms/plugin-seo',
|
|
51
|
+
// Database adapters and their drivers. The client scan reaches them through the
|
|
52
|
+
// Payload config (it follows server functions' `import('@payload-config')`
|
|
53
|
+
// without TanStack's server-fn stripping), so Vite would pre-bundle the whole
|
|
54
|
+
// driver for a browser that never loads it. Mongoose 9 has no browser build, so
|
|
55
|
+
// that bundles `mongodb`, whose optional `@aws-sdk/credential-providers` peer —
|
|
56
|
+
// when linked, as in the monorepo via `@payloadcms/payload-cloud` — fails the
|
|
57
|
+
// same `MISSING_EXPORT` way. Published installs reach the adapter packages;
|
|
58
|
+
// the monorepo, which resolves them to source, reaches the drivers.
|
|
59
|
+
'@payloadcms/db-d1-sqlite',
|
|
60
|
+
'@payloadcms/db-mongodb',
|
|
61
|
+
'@payloadcms/db-postgres',
|
|
62
|
+
'@payloadcms/db-sqlite',
|
|
63
|
+
'@payloadcms/db-vercel-postgres',
|
|
64
|
+
'@payloadcms/drizzle',
|
|
65
|
+
'mongodb',
|
|
66
|
+
'mongoose'
|
|
67
|
+
];
|
|
68
|
+
/**
|
|
69
|
+
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
70
|
+
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
71
|
+
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
72
|
+
* list them explicitly using the `parent > child` syntax.
|
|
73
|
+
*
|
|
74
|
+
* Each entry below fixes a specific late-discovery re-optimization: without it,
|
|
75
|
+
* Vite discovers the dep *after* its initial crawl, forcing a full dep
|
|
76
|
+
* re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
|
|
77
|
+
* remounts the admin (dropping client state). This is why the list can't simply
|
|
78
|
+
* be deleted — it is the "complete first pass" for the admin's dep graph.
|
|
79
|
+
*/ export const optimizeDepsIncludeDefaults = [
|
|
80
|
+
'@payloadcms/ui > sonner',
|
|
81
|
+
'@payloadcms/ui > @faceless-ui/modal',
|
|
82
|
+
'@payloadcms/ui > @faceless-ui/window-info',
|
|
83
|
+
'@payloadcms/ui > @faceless-ui/scroll-info',
|
|
84
|
+
'@payloadcms/ui > @dnd-kit/core',
|
|
85
|
+
'@payloadcms/ui > @dnd-kit/sortable',
|
|
86
|
+
'@payloadcms/ui > @dnd-kit/utilities',
|
|
87
|
+
'@payloadcms/ui > react-datepicker',
|
|
88
|
+
'@payloadcms/ui > react-select',
|
|
89
|
+
'@payloadcms/ui > react-select/creatable',
|
|
90
|
+
'@payloadcms/ui > react-image-crop',
|
|
91
|
+
'@payloadcms/ui > @monaco-editor/react',
|
|
92
|
+
'@payloadcms/ui > date-fns',
|
|
93
|
+
'@payloadcms/ui > date-fns/transpose',
|
|
94
|
+
'@payloadcms/ui > @date-fns/tz/date/mini',
|
|
95
|
+
'@payloadcms/ui > uuid',
|
|
96
|
+
'@payloadcms/ui > use-context-selector',
|
|
97
|
+
'@payloadcms/ui > bson-objectid',
|
|
98
|
+
'@payloadcms/ui > dequal',
|
|
99
|
+
'@payloadcms/ui > object-to-formdata',
|
|
100
|
+
'@payloadcms/ui > md5',
|
|
101
|
+
'payload > deepmerge',
|
|
102
|
+
'payload > pluralize',
|
|
103
|
+
// `scheduler` is a transitive dep of `react-dom`, not a direct dependency of
|
|
104
|
+
// the app, so a bare `'scheduler'` specifier fails to resolve from an isolated
|
|
105
|
+
// install (`test/node_modules` built with `pnpm i --ignore-workspace`), where
|
|
106
|
+
// it isn't hoisted to the top level. Path it through `react-dom` so the
|
|
107
|
+
// optimizer resolves the exact copy the runtime loads.
|
|
108
|
+
'react-dom > scheduler',
|
|
109
|
+
// `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the
|
|
110
|
+
// React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.
|
|
111
|
+
// Because its parent is excluded, the optimizer never crawls in to discover
|
|
112
|
+
// this entry, so Vite serves `react/compiler-runtime` raw. That file is
|
|
113
|
+
// CommonJS (`module.exports = require(...)`), so the named `c` export can't be
|
|
114
|
+
// statically extracted and every client component throws "does not provide an
|
|
115
|
+
// export named 'c'". Pre-bundling it lets esbuild synthesize the named export.
|
|
116
|
+
'react/compiler-runtime',
|
|
117
|
+
// Transitive deps that Vite otherwise discovers *after* the initial crawl
|
|
118
|
+
// (react-select pulls in @floating-ui at runtime; react-is is reached via
|
|
119
|
+
// react-transition-group/prop-types; the default date-fns locale is loaded
|
|
120
|
+
// through a dynamic `date-fns/locale/${key}` import). A late discovery forces
|
|
121
|
+
// a full dep re-optimization mid-session, which 404s every in-flight
|
|
122
|
+
// `.vite/deps/*` chunk ("Pre-transform error: file does not exist in the
|
|
123
|
+
// optimize deps directory") and breaks the admin UI in CI cold starts.
|
|
124
|
+
// Pre-bundling them keeps the first optimization pass complete.
|
|
125
|
+
'@payloadcms/ui > react-select > @floating-ui/dom',
|
|
126
|
+
'@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',
|
|
127
|
+
'@payloadcms/ui > react-select > prop-types > react-is',
|
|
128
|
+
'@payloadcms/ui > date-fns/locale/en-US',
|
|
129
|
+
// Further late discoveries observed re-optimizing mid-run in CI cold starts
|
|
130
|
+
// (see CI logs: "✨ new dependencies optimized: @dnd-kit/modifiers / zod /
|
|
131
|
+
// dequal/lite"). The modular dashboard pulls in `@dnd-kit/modifiers` on first
|
|
132
|
+
// render; form-state diffing reaches `dequal/lite` (a distinct entry point
|
|
133
|
+
// from the already-listed `dequal`); client-side field validation reaches
|
|
134
|
+
// `zod` *through `payload`* — it is `ssrExternal` server-side but still
|
|
135
|
+
// bundled into the client, and must be pathed via `payload` so the optimizer
|
|
136
|
+
// pre-bundles the exact copy the runtime loads.
|
|
137
|
+
'@payloadcms/ui > @dnd-kit/modifiers',
|
|
138
|
+
'@payloadcms/ui > dequal/lite',
|
|
139
|
+
'payload > zod',
|
|
140
|
+
// The storage client-upload suites (esp. vercel-blob) crawl part of the
|
|
141
|
+
// `payload` server runtime into the client bundle and discover these late,
|
|
142
|
+
// triggering several "optimized dependencies changed. reloading" waves that
|
|
143
|
+
// reload the page mid-test (the bulk-upload drawer's Create New button /
|
|
144
|
+
// dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the
|
|
145
|
+
// whole observed set so the first pass is complete.
|
|
146
|
+
'payload > undici',
|
|
147
|
+
'payload > jose',
|
|
148
|
+
'payload > dataloader',
|
|
149
|
+
'payload > path-to-regexp',
|
|
150
|
+
'payload > console-table-printer',
|
|
151
|
+
'payload > ci-info',
|
|
152
|
+
'payload > image-dimensions',
|
|
153
|
+
'payload > ipaddr.js',
|
|
154
|
+
'payload > range-parser',
|
|
155
|
+
'payload > sanitize-filename',
|
|
156
|
+
// `@azure/storage-blob` is excluded, so pre-bundle its CommonJS browser dependency explicitly.
|
|
157
|
+
'@azure/storage-blob > events'
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=optimizeDeps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/withPayload/config/optimizeDeps.ts"],"sourcesContent":["/**\n * Client dep-optimizer config used by `withPayload`. Kept separate from the\n * SSR/RSC externalization config (`./external.ts`) so each concern stays small.\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 // Preserve RSC client boundaries on storage admin upload handlers.\n '@payloadcms/storage-azure',\n '@payloadcms/storage-r2',\n '@payloadcms/storage-vercel-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n // Packages whose admin component barrel re-exports `'use client'` modules\n // without carrying the directive itself. Pre-bundling one puts those modules\n // in the optimized dep chunk *and* in the `rsc` environment as client\n // references, which `@vitejs/plugin-rsc` warns about (\"client component\n // dependency is inconsistently optimized\") once per component. Barrels that\n // start with `'use client'` (e.g. `richtext-lexical`, `plugin-stripe`) don't\n // warn and stay pre-bundled. Only shows up in published installs; workspace\n // source is never pre-bundled.\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-ecommerce',\n '@payloadcms/plugin-form-builder',\n '@payloadcms/plugin-import-export',\n '@payloadcms/plugin-multi-tenant',\n '@payloadcms/plugin-search',\n '@payloadcms/plugin-sentry',\n '@payloadcms/plugin-seo',\n // Database adapters and their drivers. The client scan reaches them through the\n // Payload config (it follows server functions' `import('@payload-config')`\n // without TanStack's server-fn stripping), so Vite would pre-bundle the whole\n // driver for a browser that never loads it. Mongoose 9 has no browser build, so\n // that bundles `mongodb`, whose optional `@aws-sdk/credential-providers` peer —\n // when linked, as in the monorepo via `@payloadcms/payload-cloud` — fails the\n // same `MISSING_EXPORT` way. Published installs reach the adapter packages;\n // the monorepo, which resolves them to source, reaches the drivers.\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n 'mongodb',\n 'mongoose',\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 *\n * Each entry below fixes a specific late-discovery re-optimization: without it,\n * Vite discovers the dep *after* its initial crawl, forcing a full dep\n * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and\n * remounts the admin (dropping client state). This is why the list can't simply\n * be deleted — it is the \"complete first pass\" for the admin's dep graph.\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 / zod /\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 // `zod` *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 > zod',\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-dimensions',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n // `@azure/storage-blob` is excluded, so pre-bundle its CommonJS browser dependency explicitly.\n '@azure/storage-blob > events',\n]\n"],"names":["optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;;;CAKC,GACD,OAAO,MAAMA,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,mEAAmE;IACnE;IACA;IACA;IACA;IACA;IACA;IACA,0EAA0E;IAC1E,6EAA6E;IAC7E,sEAAsE;IACtE,wEAAwE;IACxE,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,+BAA+B;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gFAAgF;IAChF,2EAA2E;IAC3E,8EAA8E;IAC9E,gFAAgF;IAChF,gFAAgF;IAChF,8EAA8E;IAC9E,4EAA4E;IAC5E,oEAAoE;IACpE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;;;CAWC,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,+FAA+F;IAC/F;CACD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}[];
|
|
14
|
+
//# sourceMappingURL=scss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../../src/withPayload/config/scss.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;qBAEZ,MAAM,GAAG,IAAI,GAAG,GAAG;GAWvC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
/**
|
|
5
|
+
* SCSS `@import`/`@use` importers applied for every Payload consumer.
|
|
6
|
+
*
|
|
7
|
+
* Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by
|
|
8
|
+
* first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the
|
|
9
|
+
* installed package via Node resolution. Because it goes through the package's
|
|
10
|
+
* `exports` map, it picks the workspace `src` scss in the monorepo and the
|
|
11
|
+
* published `dist` scss in a consumer install automatically — no per-app
|
|
12
|
+
* `findFileUrl` shim needed.
|
|
13
|
+
*/ export const payloadScssImporters = [
|
|
14
|
+
{
|
|
15
|
+
findFileUrl (url) {
|
|
16
|
+
if (!url.startsWith('~@payloadcms/')) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return pathToFileURL(require.resolve(url.slice(1)));
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/withPayload/config/scss.ts"],"sourcesContent":["import { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * SCSS `@import`/`@use` importers applied for every Payload consumer.\n *\n * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by\n * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the\n * installed package via Node resolution. Because it goes through the package's\n * `exports` map, it picks the workspace `src` scss in the monorepo and the\n * published `dist` scss in a consumer install automatically — no per-app\n * `findFileUrl` shim needed.\n */\nexport const payloadScssImporters = [\n {\n findFileUrl(url: string): null | URL {\n if (!url.startsWith('~@payloadcms/')) {\n return null\n }\n try {\n return pathToFileURL(require.resolve(url.slice(1)))\n } catch {\n return null\n }\n },\n },\n]\n"],"names":["createRequire","pathToFileURL","require","url","payloadScssImporters","findFileUrl","startsWith","resolve","slice"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAa;AAC3C,SAASC,aAAa,QAAQ,WAAU;AAExC,MAAMC,UAAUF,cAAc,YAAYG,GAAG;AAE7C;;;;;;;;;CASC,GACD,OAAO,MAAMC,uBAAuB;IAClC;QACEC,aAAYF,GAAW;YACrB,IAAI,CAACA,IAAIG,UAAU,CAAC,kBAAkB;gBACpC,OAAO;YACT;YACA,IAAI;gBACF,OAAOL,cAAcC,QAAQK,OAAO,CAACJ,IAAIK,KAAK,CAAC;YACjD,EAAE,OAAM;gBACN,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginOption } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Reloads Payload when `payload.config.ts`, or anything it imports, changes.
|
|
4
|
+
*
|
|
5
|
+
* Vite re-evaluates the config module on its own, but `getPayload` keeps
|
|
6
|
+
* serving its cached instance until a `DevReloadStrategy` marks it stale. This
|
|
7
|
+
* plugin only broadcasts the change; `devConfigReload.server.ts` subscribes
|
|
8
|
+
* from inside the server runtime and marks the instance, which `getPayload`
|
|
9
|
+
* then reloads on its next call.
|
|
10
|
+
*/
|
|
11
|
+
export declare function payloadDevConfigReload({ payloadConfigPath, }: {
|
|
12
|
+
payloadConfigPath: string;
|
|
13
|
+
}): PluginOption;
|
|
14
|
+
//# sourceMappingURL=devConfigReload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devConfigReload.d.ts","sourceRoot":"","sources":["../../src/withPayload/devConfigReload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,YAAY,EAAiB,MAAM,MAAM,CAAA;AAO9E;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,MAAM,CAAA;CAC1B,GAAG,YAAY,CA+Cf"}
|