@payloadcms/tanstack-start 4.0.0-internal.3ccc86e → 4.0.0-internal.41055b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
  2. package/dist/elements/RouterAdapter/index.js +2 -18
  3. package/dist/elements/RouterAdapter/index.js.map +1 -1
  4. package/dist/exports/vite.d.ts +2 -2
  5. package/dist/exports/vite.d.ts.map +1 -1
  6. package/dist/exports/vite.js +1 -1
  7. package/dist/exports/vite.js.map +1 -1
  8. package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
  9. package/dist/node/cssLoader.d.mts +2 -24
  10. package/dist/node/cssLoader.d.mts.map +1 -1
  11. package/dist/routes/adminRoutes.d.ts.map +1 -1
  12. package/dist/routes/layoutRoute.d.ts.map +1 -1
  13. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
  14. package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
  15. package/dist/vite/constants.d.ts +42 -0
  16. package/dist/vite/constants.d.ts.map +1 -0
  17. package/dist/vite/{config/optimizeDeps.js → constants.js} +63 -9
  18. package/dist/vite/constants.js.map +1 -0
  19. package/dist/vite/plugin.d.ts +38 -0
  20. package/dist/vite/plugin.d.ts.map +1 -0
  21. package/dist/vite/plugin.js +177 -0
  22. package/dist/vite/plugin.js.map +1 -0
  23. package/dist/vite/plugins/clientModuleResolution.d.ts.map +1 -0
  24. package/dist/vite/plugins/clientModuleResolution.js.map +1 -0
  25. package/dist/vite/plugins/devTransforms.d.ts.map +1 -0
  26. package/dist/vite/{workarounds → plugins}/devTransforms.js +0 -5
  27. package/dist/vite/plugins/devTransforms.js.map +1 -0
  28. package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +1 -0
  29. package/dist/vite/plugins/reactDomServerInRsc.js.map +1 -0
  30. package/dist/vite/plugins/stripDistStyleImports.d.ts.map +1 -0
  31. package/dist/vite/plugins/stripDistStyleImports.js.map +1 -0
  32. package/dist/vite/plugins/wrapCjsForClient.d.ts.map +1 -0
  33. package/dist/vite/plugins/wrapCjsForClient.js.map +1 -0
  34. package/package.json +5 -10
  35. package/dist/vite/config/external.d.ts +0 -11
  36. package/dist/vite/config/external.d.ts.map +0 -1
  37. package/dist/vite/config/external.js +0 -48
  38. package/dist/vite/config/external.js.map +0 -1
  39. package/dist/vite/config/optimizeDeps.d.ts +0 -25
  40. package/dist/vite/config/optimizeDeps.d.ts.map +0 -1
  41. package/dist/vite/config/optimizeDeps.js.map +0 -1
  42. package/dist/vite/config/scss.d.ts +0 -14
  43. package/dist/vite/config/scss.d.ts.map +0 -1
  44. package/dist/vite/config/scss.js +0 -28
  45. package/dist/vite/config/scss.js.map +0 -1
  46. package/dist/vite/index.d.ts +0 -99
  47. package/dist/vite/index.d.ts.map +0 -1
  48. package/dist/vite/index.js +0 -258
  49. package/dist/vite/index.js.map +0 -1
  50. package/dist/vite/workarounds/clientModuleResolution.d.ts.map +0 -1
  51. package/dist/vite/workarounds/clientModuleResolution.js.map +0 -1
  52. package/dist/vite/workarounds/devTransforms.d.ts.map +0 -1
  53. package/dist/vite/workarounds/devTransforms.js.map +0 -1
  54. package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +0 -1
  55. package/dist/vite/workarounds/reactDomServerInRsc.js.map +0 -1
  56. package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +0 -1
  57. package/dist/vite/workarounds/stripDistStyleImports.js.map +0 -1
  58. package/dist/vite/workarounds/stubPrettierInClient.d.ts +0 -13
  59. package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +0 -1
  60. package/dist/vite/workarounds/stubPrettierInClient.js +0 -32
  61. package/dist/vite/workarounds/stubPrettierInClient.js.map +0 -1
  62. package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +0 -1
  63. package/dist/vite/workarounds/wrapCjsForClient.js.map +0 -1
  64. /package/dist/vite/{workarounds → plugins}/clientModuleResolution.d.ts +0 -0
  65. /package/dist/vite/{workarounds → plugins}/clientModuleResolution.js +0 -0
  66. /package/dist/vite/{workarounds → plugins}/devTransforms.d.ts +0 -0
  67. /package/dist/vite/{workarounds → plugins}/reactDomServerInRsc.d.ts +0 -0
  68. /package/dist/vite/{workarounds → plugins}/reactDomServerInRsc.js +0 -0
  69. /package/dist/vite/{workarounds → plugins}/stripDistStyleImports.d.ts +0 -0
  70. /package/dist/vite/{workarounds → plugins}/stripDistStyleImports.js +0 -0
  71. /package/dist/vite/{workarounds → plugins}/wrapCjsForClient.d.ts +0 -0
  72. /package/dist/vite/{workarounds → plugins}/wrapCjsForClient.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RouterAdapter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAuDvE,eAAO,MAAM,qBAAqB,EAAE,sBAyGnC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RouterAdapter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAuDvE,eAAO,MAAM,qBAAqB,EAAE,sBA+EnC,CAAA"}
@@ -102,32 +102,16 @@ export const TanStackRouterAdapter = ({ children })=>{
102
102
  router,
103
103
  toNavOptions
104
104
  ]);
105
- // Mirror Next.js' router behavior to allow syncing client state to the URL without triggering a second server load.
106
- // TanStack's browser history monkeypatches `window.history.replaceState` and notifies `router.load` on every call.
107
- // Use `_ignoreSubscribers` to suppresses that notification — the same flag TanStack uses internally when flushing history.
108
- const replaceState = useCallback((url)=>{
109
- const { history } = router;
110
- history._ignoreSubscribers = true;
111
- try {
112
- window.history.replaceState(null, '', url);
113
- } finally{
114
- history._ignoreSubscribers = false;
115
- }
116
- }, [
117
- router
118
- ]);
119
105
  const adaptedRouter = useMemo(()=>({
120
106
  back,
121
107
  push,
122
108
  refresh,
123
- replace,
124
- replaceState
109
+ replace
125
110
  }), [
126
111
  back,
127
112
  push,
128
113
  refresh,
129
- replace,
130
- replaceState
114
+ replace
131
115
  ]);
132
116
  // `location.searchStr` is the serialized query string; `location.search` is
133
117
  // the parsed object (a nested structure once the router uses `qs` for search
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/RouterAdapter/index.tsx"],"sourcesContent":["'use client'\n\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps, RouterAdapterComponent } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport { Link as TanStackLink, useLocation, useParams, useRouter } from '@tanstack/react-router'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useMemo } from 'react'\n\nconst normalizeNavigationTarget = ({\n path,\n pathname,\n search,\n}: {\n path: string\n pathname: string\n search: string\n}) => {\n if (path.startsWith('http')) {\n const url = new URL(path)\n return `${url.pathname}${url.search}${url.hash}`\n }\n\n if (path.startsWith('?')) {\n return `${pathname}${path}`\n }\n\n if (path.startsWith('#')) {\n return `${pathname}${search}${path}`\n }\n\n return path\n}\n\nconst TanStackLinkAdapter: React.FC<LinkAdapterProps> = ({\n children,\n href,\n prefetch,\n ref,\n replace,\n scroll,\n ...rest\n}) => {\n return (\n <TanStackLink\n preload={prefetch === false ? false : 'intent'}\n ref={ref}\n replace={replace}\n resetScroll={scroll}\n to={href}\n {...rest}\n >\n {children}\n </TanStackLink>\n )\n}\n\nexport const TanStackRouterAdapter: RouterAdapterComponent = ({ children }) => {\n const router = useRouter()\n const location = useLocation()\n const params = useParams({ strict: false })\n\n const adaptedParams = useMemo(() => {\n const adapted: Record<string, string | string[]> = { ...params }\n\n if ('_splat' in params && typeof params._splat === 'string') {\n adapted.segments = params._splat.split('/').filter(Boolean)\n }\n\n return adapted\n }, [params])\n\n // Split a target into `to` (pathname) + a parsed `search` object, so the\n // router serializes the query via its `stringifySearch` (qs, bracket-encoded)\n // rather than embedding the raw string in `to`. Navigating with a string `to`\n // leaves the search *unencoded* in `window.location.search`\n // (e.g. `where[or][0]…`), which then never matches Payload's `qs.stringify`\n // output (`where%5Bor%5D…`) — breaking the list-view `syncPropsToURL` guard,\n // which compares the two and would otherwise clobber optimistic query state\n // (e.g. an in-progress filter condition) on every navigation.\n const toNavOptions = useCallback((path: string) => {\n const relativePath = normalizeNavigationTarget({\n path,\n pathname: window.location.pathname,\n search: window.location.search,\n })\n\n const queryIndex = relativePath.indexOf('?')\n\n if (queryIndex === -1) {\n return { to: relativePath }\n }\n\n const searchObject = qs.parse(relativePath.slice(queryIndex + 1), {\n depth: 10,\n ignoreQueryPrefix: true,\n })\n\n // Function form replaces the search entirely (no merge with current search).\n return { search: () => searchObject, to: relativePath.slice(0, queryIndex) }\n }, [])\n\n const back = useCallback(() => router.history.back(), [router])\n\n const push = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n\n const refresh = useCallback(() => {\n void router.invalidate()\n }, [router])\n\n const replace = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), replace: true, resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n\n // Mirror Next.js' router behavior to allow syncing client state to the URL without triggering a second server load.\n // TanStack's browser history monkeypatches `window.history.replaceState` and notifies `router.load` on every call.\n // Use `_ignoreSubscribers` to suppresses that notification — the same flag TanStack uses internally when flushing history.\n const replaceState = useCallback(\n (url: string) => {\n const { history } = router\n history._ignoreSubscribers = true\n\n try {\n window.history.replaceState(null, '', url)\n } finally {\n history._ignoreSubscribers = false\n }\n },\n [router],\n )\n\n const adaptedRouter = useMemo(\n () => ({ back, push, refresh, replace, replaceState }),\n [back, push, refresh, replace, replaceState],\n )\n\n // `location.searchStr` is the serialized query string; `location.search` is\n // the parsed object (a nested structure once the router uses `qs` for search\n // serialization), which `URLSearchParams` cannot consume. Build from the\n // string so Payload's `parseSearchParams` re-parses the bracket notation.\n const searchParams = useMemo(() => new URLSearchParams(location.searchStr), [location.searchStr])\n\n const value: RouterAdapterContextValue = useMemo(\n () => ({\n Link: TanStackLinkAdapter,\n params: adaptedParams,\n pathname: location.pathname,\n router: adaptedRouter,\n searchParams,\n }),\n [adaptedParams, location.pathname, adaptedRouter, searchParams],\n )\n\n return <RouterAdapterContext value={value}>{children}</RouterAdapterContext>\n}\n"],"names":["RouterAdapterContext","Link","TanStackLink","useLocation","useParams","useRouter","qs","React","useCallback","useMemo","normalizeNavigationTarget","path","pathname","search","startsWith","url","URL","hash","TanStackLinkAdapter","children","href","prefetch","ref","replace","scroll","rest","preload","resetScroll","to","TanStackRouterAdapter","router","location","params","strict","adaptedParams","adapted","_splat","segments","split","filter","Boolean","toNavOptions","relativePath","window","queryIndex","indexOf","searchObject","parse","slice","depth","ignoreQueryPrefix","back","history","push","options","navigate","refresh","invalidate","replaceState","_ignoreSubscribers","adaptedRouter","searchParams","URLSearchParams","searchStr","value"],"mappings":"AAAA;;AAKA,SAASA,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,QAAQC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,SAAS,QAAQ,yBAAwB;AAChG,YAAYC,QAAQ,SAAQ;AAC5B,OAAOC,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAO;AAEnD,MAAMC,4BAA4B,CAAC,EACjCC,IAAI,EACJC,QAAQ,EACRC,MAAM,EAKP;IACC,IAAIF,KAAKG,UAAU,CAAC,SAAS;QAC3B,MAAMC,MAAM,IAAIC,IAAIL;QACpB,OAAO,GAAGI,IAAIH,QAAQ,GAAGG,IAAIF,MAAM,GAAGE,IAAIE,IAAI,EAAE;IAClD;IAEA,IAAIN,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWD,MAAM;IAC7B;IAEA,IAAIA,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWC,SAASF,MAAM;IACtC;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AAMiB;YACNc,QAAQE;YACRtB,UAAUmB,SAASnB,QAAQ;YAC3BkB,QAAQ8B;YACRC;QACF,CAAA,GACA;QAAC3B;QAAeH,SAASnB,QAAQ;QAAEgD;QAAeC;KAAa;IAGjE,qBAAO,KAAC7D;QAAqBgE,OAAOA;kBAAQ7C;;AAC9C,EAAC"}
1
+ {"version":3,"sources":["../../../src/elements/RouterAdapter/index.tsx"],"sourcesContent":["'use client'\n\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps, RouterAdapterComponent } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport { Link as TanStackLink, useLocation, useParams, useRouter } from '@tanstack/react-router'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useMemo } from 'react'\n\nconst normalizeNavigationTarget = ({\n path,\n pathname,\n search,\n}: {\n path: string\n pathname: string\n search: string\n}) => {\n if (path.startsWith('http')) {\n const url = new URL(path)\n return `${url.pathname}${url.search}${url.hash}`\n }\n\n if (path.startsWith('?')) {\n return `${pathname}${path}`\n }\n\n if (path.startsWith('#')) {\n return `${pathname}${search}${path}`\n }\n\n return path\n}\n\nconst TanStackLinkAdapter: React.FC<LinkAdapterProps> = ({\n children,\n href,\n prefetch,\n ref,\n replace,\n scroll,\n ...rest\n}) => {\n return (\n <TanStackLink\n preload={prefetch === false ? false : 'intent'}\n ref={ref}\n replace={replace}\n resetScroll={scroll}\n to={href}\n {...rest}\n >\n {children}\n </TanStackLink>\n )\n}\n\nexport const TanStackRouterAdapter: RouterAdapterComponent = ({ children }) => {\n const router = useRouter()\n const location = useLocation()\n const params = useParams({ strict: false })\n\n const adaptedParams = useMemo(() => {\n const adapted: Record<string, string | string[]> = { ...params }\n if ('_splat' in params && typeof params._splat === 'string') {\n adapted.segments = params._splat.split('/').filter(Boolean)\n }\n return adapted\n }, [params])\n\n // Split a target into `to` (pathname) + a parsed `search` object, so the\n // router serializes the query via its `stringifySearch` (qs, bracket-encoded)\n // rather than embedding the raw string in `to`. Navigating with a string `to`\n // leaves the search *unencoded* in `window.location.search`\n // (e.g. `where[or][0]…`), which then never matches Payload's `qs.stringify`\n // output (`where%5Bor%5D…`) — breaking the list-view `syncPropsToURL` guard,\n // which compares the two and would otherwise clobber optimistic query state\n // (e.g. an in-progress filter condition) on every navigation.\n const toNavOptions = useCallback((path: string) => {\n const relativePath = normalizeNavigationTarget({\n path,\n pathname: window.location.pathname,\n search: window.location.search,\n })\n const queryIndex = relativePath.indexOf('?')\n if (queryIndex === -1) {\n return { to: relativePath }\n }\n const searchObject = qs.parse(relativePath.slice(queryIndex + 1), {\n depth: 10,\n ignoreQueryPrefix: true,\n })\n // Function form replaces the search entirely (no merge with current search).\n return { search: () => searchObject, to: relativePath.slice(0, queryIndex) }\n }, [])\n\n const back = useCallback(() => router.history.back(), [router])\n const push = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n const refresh = useCallback(() => {\n void router.invalidate()\n }, [router])\n const replace = useCallback(\n (path: string, options?: { scroll?: boolean }) => {\n void router.navigate({ ...toNavOptions(path), replace: true, resetScroll: options?.scroll })\n },\n [router, toNavOptions],\n )\n\n const adaptedRouter = useMemo(\n () => ({ back, push, refresh, replace }),\n [back, push, refresh, replace],\n )\n\n // `location.searchStr` is the serialized query string; `location.search` is\n // the parsed object (a nested structure once the router uses `qs` for search\n // serialization), which `URLSearchParams` cannot consume. Build from the\n // string so Payload's `parseSearchParams` re-parses the bracket notation.\n const searchParams = useMemo(() => new URLSearchParams(location.searchStr), [location.searchStr])\n\n const value: RouterAdapterContextValue = useMemo(\n () => ({\n Link: TanStackLinkAdapter,\n params: adaptedParams,\n pathname: location.pathname,\n router: adaptedRouter,\n searchParams,\n }),\n [adaptedParams, location.pathname, adaptedRouter, searchParams],\n )\n\n return <RouterAdapterContext value={value}>{children}</RouterAdapterContext>\n}\n"],"names":["RouterAdapterContext","Link","TanStackLink","useLocation","useParams","useRouter","qs","React","useCallback","useMemo","normalizeNavigationTarget","path","pathname","search","startsWith","url","URL","hash","TanStackLinkAdapter","children","href","prefetch","ref","replace","scroll","rest","preload","resetScroll","to","TanStackRouterAdapter","router","location","params","strict","adaptedParams","adapted","_splat","segments","split","filter","Boolean","toNavOptions","relativePath","window","queryIndex","indexOf","searchObject","parse","slice","depth","ignoreQueryPrefix","back","history","push","options","navigate","refresh","invalidate","adaptedRouter","searchParams","URLSearchParams","searchStr","value"],"mappings":"AAAA;;AAKA,SAASA,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,QAAQC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,SAAS,QAAQ,yBAAwB;AAChG,YAAYC,QAAQ,SAAQ;AAC5B,OAAOC,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAO;AAEnD,MAAMC,4BAA4B,CAAC,EACjCC,IAAI,EACJC,QAAQ,EACRC,MAAM,EAKP;IACC,IAAIF,KAAKG,UAAU,CAAC,SAAS;QAC3B,MAAMC,MAAM,IAAIC,IAAIL;QACpB,OAAO,GAAGI,IAAIH,QAAQ,GAAGG,IAAIF,MAAM,GAAGE,IAAIE,IAAI,EAAE;IAClD;IAEA,IAAIN,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWD,MAAM;IAC7B;IAEA,IAAIA,KAAKG,UAAU,CAAC,MAAM;QACxB,OAAO,GAAGF,WAAWC,SAASF,MAAM;IACtC;IAEA,OAAOA;AACT;AAEA,MAAMO,sBAAkD,CAAC,EACvDC,QAAQ,EACRC,IAAI,EACJC,QAAQ,EACRC,GAAG,EACHC,OAAO,EACPC,MAAM,EACN,GAAGC,MACJ;IACC,qBACE,KAACvB;QACCwB,SAASL,aAAa,QAAQ,QAAQ;QACtCC,KAAKA;QACLC,SAASA;QACTI,aAAaH;QACbI,IAAIR;QACH,GAAGK,IAAI;kBAEPN;;AAGP;AAEA,OAAO,MAAMU,wBAAgD,CAAC,EAAE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QAAQW;KAAa;IAExB,MAAMe,UAAUhD,YAAY;QAC1B,KAAKsB,OAAO2B,UAAU;IACxB,GAAG;QAAC3B;KAAO;IACX,MAAMP,UAAUf,YACd,CAACG,MAAc2C;QACb,KAAKxB,OAAOyB,QAAQ,CAAC;YAAE,GAAGd,aAAa9B,KAAK;YAAEY,SAAS;YAAMI,aAAa2B,SAAS9B;QAAO;IAC5F,GACA;QAACM;QAAQW;KAAa;IAGxB,MAAMiB,gBAAgBjD,QACpB,IAAO,CAAA;YAAE0C;YAAME;YAAMG;YAASjC;QAAQ,CAAA,GACtC;QAAC4B;QAAME;QAAMG;QAASjC;KAAQ;IAGhC,4EAA4E;IAC5E,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,MAAMoC,eAAelD,QAAQ,IAAM,IAAImD,gBAAgB7B,SAAS8B,SAAS,GAAG;QAAC9B,SAAS8B,SAAS;KAAC;IAEhG,MAAMC,QAAmCrD,QACvC,IAAO,CAAA;YACLR,MAAMiB;YACNc,QAAQE;YACRtB,UAAUmB,SAASnB,QAAQ;YAC3BkB,QAAQ4B;YACRC;QACF,CAAA,GACA;QAACzB;QAAeH,SAASnB,QAAQ;QAAE8C;QAAeC;KAAa;IAGjE,qBAAO,KAAC3D;QAAqB8D,OAAOA;kBAAQ3C;;AAC9C,EAAC"}
@@ -1,3 +1,3 @@
1
- export { payloadReactOptions, payloadRscOptions, payloadTanstackStartOptions, withPayload, } from '../vite/index.js';
2
- export type { PayloadPluginOptions, PayloadTanstackStartOptionsArgs, WithPayloadBuilder, WithPayloadBuilderContext, WithPayloadOptions, } from '../vite/index.js';
1
+ export { payloadPlugin } from '../vite/plugin.js';
2
+ export type { PayloadPluginOptions } from '../vite/plugin.js';
3
3
  //# sourceMappingURL=vite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/exports/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,WAAW,GACZ,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,oBAAoB,EACpB,+BAA+B,EAC/B,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/exports/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,3 +1,3 @@
1
- export { payloadReactOptions, payloadRscOptions, payloadTanstackStartOptions, withPayload } from '../vite/index.js';
1
+ export { payloadPlugin } from '../vite/plugin.js';
2
2
 
3
3
  //# sourceMappingURL=vite.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/vite.ts"],"sourcesContent":["export {\n payloadReactOptions,\n payloadRscOptions,\n payloadTanstackStartOptions,\n withPayload,\n} from '../vite/index.js'\nexport type {\n PayloadPluginOptions,\n PayloadTanstackStartOptionsArgs,\n WithPayloadBuilder,\n WithPayloadBuilderContext,\n WithPayloadOptions,\n} from '../vite/index.js'\n"],"names":["payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","withPayload"],"mappings":"AAAA,SACEA,mBAAmB,EACnBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,WAAW,QACN,mBAAkB"}
1
+ {"version":3,"sources":["../../src/exports/vite.ts"],"sourcesContent":["export { payloadPlugin } from '../vite/plugin.js'\nexport type { PayloadPluginOptions } from '../vite/plugin.js'\n"],"names":["payloadPlugin"],"mappings":"AAAA,SAASA,aAAa,QAAQ,oBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"withPayloadRoot.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/withPayloadRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AACH,wBAAgB,oBAA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B,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,sBAAsB,qBAmBnF;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,EAC7D,OAAO,GAAE,sBAA2B,IAIH,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uBAc7E"}
@@ -1,25 +1,3 @@
1
- /**
2
- * Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,
3
- * images, fonts, audio, video, etc.) encountered while running the dev
4
- * server.
5
- *
6
- * Vite is supposed to intercept asset imports during SSR/RSC by treating
7
- * the package as `noExternal`, but that resolution path silently breaks down
8
- * when a dependency is installed from a packed tarball under
9
- * `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the
10
- * import to Node's native ESM loader, which has no opinion about `.css` /
11
- * `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single
12
- * throw cascades into every admin route showing "Something went wrong!"
13
- * because the SSR tree dies inside `<MatchInnerImpl>`.
14
- *
15
- * Registering this loader (with `--import` or `register()`) makes Node treat
16
- * any asset specifier as an empty ES module, which is exactly what we
17
- * already do client-side for SSR.
18
- *
19
- * The loader is intentionally minimal and side-effect free; it only kicks in
20
- * for asset specifiers and falls through to the default loader for
21
- * everything else.
22
- */
23
- export declare function resolve(specifier: any, context: any, nextResolve: any): Promise<any>;
24
- export declare function load(url: any, context: any, nextLoad: any): Promise<any>;
1
+ export function resolve(specifier: any, context: any, nextResolve: any): Promise<any>;
2
+ export function load(url: any, context: any, nextLoad: any): Promise<any>;
25
3
  //# sourceMappingURL=cssLoader.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cssLoader.d.mts","sourceRoot":"","sources":["../../src/node/cssLoader.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAiCH,wBAAsB,OAAO,CAAC,SAAS,KAAA,EAAE,OAAO,KAAA,EAAE,WAAW,KAAA,gBAS5D;AAED,wBAAsB,IAAI,CAAC,GAAG,KAAA,EAAE,OAAO,KAAA,EAAE,QAAQ,KAAA,gBAShD"}
1
+ {"version":3,"file":"cssLoader.d.mts","sourceRoot":"","sources":["../../src/node/cssLoader.mjs"],"names":[],"mappings":"AAsDA,sFASC;AAED,0EASC"}
@@ -1 +1 @@
1
- {"version":3,"file":"adminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/adminRoutes.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIhD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CACpE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAclB,iBAAS,SAAS,gCAQjB;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,+BAMrF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;IAEhE,SAAS;IACT,IAAI,mBAAmB;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;IAM3C,MAAM;QACJ,OAAO,yBA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cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACtE;IAqCG,SAAS;IACT,MAAM;QAAI,OAAO;QAAgB,eAAe;;EAEnD"}
1
+ {"version":3,"file":"layoutRoute.d.ts","sourceRoot":"","sources":["../../src/routes/layoutRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAK1D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAE/D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,cAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACtE;;;;;;EAwCA"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlHandler.server.d.ts","sourceRoot":"","sources":["../../src/utilities/graphqlHandler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,eAAe,EAAE,MAAM,SAAS,CAAA;AAyFvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yBAGvB;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,QAAQ,CA2DnB,CAAA"}
1
+ {"version":3,"file":"graphqlHandler.server.d.ts","sourceRoot":"","sources":["../../src/utilities/graphqlHandler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,eAAe,EAAE,MAAM,SAAS,CAAA;AAyFvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAU,sBAGjC;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,QAAQ,CA2DnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,QAAS,aAAa,KAAG,aAgBjE,CAAA"}
1
+ {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GAAI,KAAK,aAAa,KAAG,aAgBjE,CAAA"}
@@ -0,0 +1,42 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA0BvC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA;AAED;;;;;;;;;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,7 +1,67 @@
1
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.
2
+ * Vite-level configuration constants used by `payloadPlugin`. Kept separate so
3
+ * `plugin.ts` stays focused on wiring.
4
4
  */ /**
5
+ * Server-only packages (Node-only or only ever used by the server bundle).
6
+ * These are the Vite equivalent of Next.js's `serverExternalPackages`.
7
+ */ export const ssrExternalPackages = [
8
+ 'ajv',
9
+ 'fast-uri',
10
+ 'drizzle-kit',
11
+ 'drizzle-kit/api',
12
+ 'drizzle-orm',
13
+ 'sharp',
14
+ 'libsql',
15
+ 'require-in-the-middle',
16
+ 'json-schema-to-typescript',
17
+ 'pino',
18
+ 'pino-pretty',
19
+ 'graphql',
20
+ 'mongodb',
21
+ 'mongoose',
22
+ 'better-sqlite3',
23
+ 'pg',
24
+ 'pg-native',
25
+ 'nodemailer',
26
+ 'aws4',
27
+ 'pluralize',
28
+ 'console-table-printer',
29
+ '@azure/storage-blob',
30
+ '@aws-sdk/client-s3',
31
+ '@aws-sdk/s3-request-presigner',
32
+ '@google-cloud/storage'
33
+ ];
34
+ /**
35
+ * Payload packages whose source must be processed by Vite even on the server
36
+ * (because they are workspace `.ts` files in dev). Server-only adapters
37
+ * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
38
+ * intentionally not included — those should stay external on the SSR side.
39
+ */ export const payloadNoExternalPatterns = [
40
+ '@payloadcms/ui',
41
+ '@payloadcms/translations',
42
+ '@payloadcms/tanstack-start',
43
+ /^@payloadcms\/richtext-lexical/,
44
+ /^@payloadcms\/plugin-/,
45
+ /^@payloadcms\/storage-/
46
+ ];
47
+ /**
48
+ * The subset of `payloadNoExternalPatterns` that needs to participate in the
49
+ * RSC environment. Plugins and storage adapters must be included: they register
50
+ * custom providers/components (e.g. `plugin-multi-tenant`'s `'use client'`
51
+ * `TenantSelectionProvider`) that render in the RSC graph via
52
+ * `RenderServerComponent`. If the package stays external to RSC, `plugin-rsc`
53
+ * never transforms its `'use client'` modules into client references, so the
54
+ * component executes server-side and crashes on the first hook
55
+ * (`Cannot read properties of null (reading 'useState')`).
56
+ */ export const payloadRscNoExternalPatterns = [
57
+ '@payloadcms/ui',
58
+ '@payloadcms/translations',
59
+ '@payloadcms/tanstack-start',
60
+ /^@payloadcms\/richtext-lexical/,
61
+ /^@payloadcms\/plugin-/,
62
+ /^@payloadcms\/storage-/
63
+ ];
64
+ /**
5
65
  * Packages we know contain Node-only code or top-level side effects requiring
6
66
  * Node APIs. Excluding them from the client optimizer prevents Vite from
7
67
  * walking into their main entries and trying to bundle server-only imports
@@ -34,12 +94,6 @@
34
94
  * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
35
95
  * these up because their parent packages are in `optimizeDeps.exclude`, so we
36
96
  * list them explicitly using the `parent > child` syntax.
37
- *
38
- * Each entry below fixes a specific late-discovery re-optimization: without it,
39
- * Vite discovers the dep *after* its initial crawl, forcing a full dep
40
- * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
41
- * remounts the admin (dropping client state). This is why the list can't simply
42
- * be deleted — it is the "complete first pass" for the admin's dep graph.
43
97
  */ export const optimizeDepsIncludeDefaults = [
44
98
  '@payloadcms/ui > sonner',
45
99
  '@payloadcms/ui > @faceless-ui/modal',
@@ -120,4 +174,4 @@
120
174
  'payload > sanitize-filename'
121
175
  ];
122
176
 
123
- //# sourceMappingURL=optimizeDeps.js.map
177
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/vite/constants.ts"],"sourcesContent":["/**\n * Vite-level configuration constants used by `payloadPlugin`. Kept separate so\n * `plugin.ts` stays focused on wiring.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'mongodb',\n 'mongoose',\n 'better-sqlite3',\n 'pg',\n 'pg-native',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Payload packages whose source must be processed by Vite even on the server\n * (because they are workspace `.ts` files in dev). Server-only adapters\n * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are\n * intentionally not included — those should stay external on the SSR side.\n */\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * The subset of `payloadNoExternalPatterns` that needs to participate in the\n * RSC environment. 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"}
@@ -0,0 +1,38 @@
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
@@ -0,0 +1 @@
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,CA+H/E"}
@@ -0,0 +1,177 @@
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
+ return (_env)=>({
19
+ css: {
20
+ preprocessorOptions: {
21
+ scss: {
22
+ silenceDeprecations: [
23
+ 'import',
24
+ 'global-builtin'
25
+ ]
26
+ }
27
+ }
28
+ },
29
+ define: {
30
+ global: 'globalThis'
31
+ },
32
+ environments: {
33
+ rsc: {
34
+ resolve: {
35
+ noExternal: payloadRscNoExternalPatterns
36
+ }
37
+ },
38
+ ssr: {
39
+ resolve: {
40
+ noExternal: payloadNoExternalPatterns
41
+ }
42
+ }
43
+ },
44
+ optimizeDeps: {
45
+ exclude: optimizeDepsExcludeDefaults,
46
+ include: [
47
+ ...optimizeDepsIncludeDefaults,
48
+ ...additionalOptimizeDepsInclude
49
+ ]
50
+ },
51
+ plugins: [
52
+ clientModuleResolution(),
53
+ wrapCjsForClient(),
54
+ ssrStripDistStyleImports(),
55
+ reactDomServerInRsc(),
56
+ payloadDevTransforms(),
57
+ rscPlugin,
58
+ tanstackStart({
59
+ importProtection: {
60
+ client: {
61
+ excludeFiles: [],
62
+ specifiers: serverOnlyClientSpecifiers
63
+ },
64
+ ignoreImporters: [
65
+ ...defaultImportProtectionIgnoreImporters,
66
+ ...additionalIgnoreImporters
67
+ ],
68
+ include: [
69
+ '**/*'
70
+ ],
71
+ mockAccess: 'warn',
72
+ onViolation: onImportProtectionViolation,
73
+ // Disable TanStack Start's default `**/*.client.*` file-based denial in
74
+ // the SSR environment. Payload uses the `.client.tsx` filename suffix
75
+ // for React Client Components (with a `'use client'` directive) that
76
+ // MUST be server-rendered to HTML during SSR. The default rule would
77
+ // otherwise replace those files with an `import-protection mock` Proxy
78
+ // during SSR, which crashes React (TypeError: Cannot convert object to
79
+ // primitive value) the moment React tries to format a warning that
80
+ // mentions one of these components.
81
+ server: {
82
+ files: []
83
+ }
84
+ },
85
+ // Disable TanStack Router's automatic per-route code-splitting.
86
+ //
87
+ // With splitting enabled each route's `component` is fetched lazily
88
+ // via `?tsr-split=component` after the initial SSR HTML is streamed.
89
+ // Until that lazy chunk lands the rendered admin tree has no client
90
+ // React attached, so any button clicks (e.g. the
91
+ // `#toggle-list-filters` chevron in `<ListControls />`) hit a static
92
+ // DOM, the click is dropped, and once the chunk finally loads the
93
+ // component re-mounts with its initial `useState` instead of the
94
+ // toggled value. That single behaviour was the root cause of the
95
+ // "page renders but nothing is interactive" tanstack-start E2E
96
+ // failures (`#list-controls-where`, `[data-lexical-editor]`, etc.) -
97
+ // playwright traces show "Download the React DevTools" landing
98
+ // *after* the playwright click, confirming late hydration.
99
+ //
100
+ // We pass BOTH knobs because `tanstackStart`'s schema silently
101
+ // strips the user-supplied `autoCodeSplitting` (its `tsrConfig`
102
+ // does `configSchema.omit({ autoCodeSplitting: true, target: true
103
+ // })`) and then leaves the value `undefined` — which is fine for
104
+ // the conditional inside `unpluginRouterComposedFactory`, but the
105
+ // TanStack Start vite plugin *unconditionally* installs the router
106
+ // code-splitter via `tanStackRouterCodeSplitter(...)` regardless.
107
+ // The only knob that survives all of that and is honoured by the
108
+ // splitter is `router.codeSplittingOptions.defaultBehavior` — set
109
+ // to an empty array, the splitter still walks each `createFileRoute`
110
+ // file but produces no virtual `?tsr-split=...` modules, so every
111
+ // route component ships in the initial bundle and hydration starts
112
+ // immediately on first paint. We keep `autoCodeSplitting: false` as
113
+ // a belt-and-braces signal in case the start plugin ever stops
114
+ // dropping it.
115
+ //
116
+ // Eager-loading routes ships a slightly larger initial bundle but
117
+ // makes the admin actually interactive on first paint.
118
+ router: {
119
+ autoCodeSplitting: false,
120
+ codeSplittingOptions: {
121
+ defaultBehavior: []
122
+ },
123
+ // Exclude generated importMap files and colocated server-function
124
+ // modules (`*.functions.ts`). Admin form saves are dispatched via
125
+ // `runPayloadServerFn` (a TanStack Start `createServerFn`) rather than
126
+ // a hand-rolled route, so there is no longer an `api.server-function.ts`
127
+ // to special-case here. The `*.functions.ts` shims live next to the
128
+ // routes that use them (e.g. `app/_payload/*.functions.ts`); they
129
+ // define `createServerFn`s, not routes, so they must not be scanned.
130
+ routeFileIgnorePattern: 'importMap\\.(?:js|server\\.ts)$|\\.functions\\.',
131
+ routesDirectory
132
+ },
133
+ rsc: {
134
+ enabled: true
135
+ },
136
+ srcDirectory
137
+ }),
138
+ reactPlugin,
139
+ ...extraPlugins
140
+ ],
141
+ resolve: {
142
+ alias: [
143
+ {
144
+ find: '@payload-config',
145
+ replacement: path.resolve(payloadConfigPath)
146
+ },
147
+ ...additionalAliases
148
+ ],
149
+ dedupe: [
150
+ 'react',
151
+ 'react-dom',
152
+ 'scheduler',
153
+ '@payloadcms/ui',
154
+ '@payloadcms/richtext-lexical'
155
+ ],
156
+ extensions: [
157
+ '.mjs',
158
+ '.js',
159
+ '.mts',
160
+ '.ts',
161
+ '.jsx',
162
+ '.tsx',
163
+ '.json'
164
+ ],
165
+ tsconfigPaths: true
166
+ },
167
+ ssr: {
168
+ external: [
169
+ ...ssrExternalPackages,
170
+ ...additionalSsrExternal
171
+ ],
172
+ noExternal: payloadNoExternalPatterns
173
+ }
174
+ });
175
+ }
176
+
177
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
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 return (_env) => ({\n css: {\n preprocessorOptions: {\n scss: {\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\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","_env","css","preprocessorOptions","scss","silenceDeprecations","define","global","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","tsconfigP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C7FC,YAAY;oBAAC;oBAAQ;oBAAO;oBAAQ;oBAAO;oBAAQ;oBAAQ;iBAAQ;gBACnEC,eAAe;YACjB;YACAxB,KAAK;gBACHyB,UAAU;uBAAI3D;uBAAwBc;iBAAsB;gBAC5DmB,YAAYnC;YACd;QACF,CAAA;AACF"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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,UAA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