@payloadcms/tanstack-start 4.0.0-canary.8

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 (216) hide show
  1. package/LICENSE.md +22 -0
  2. package/dist/auth/login.d.ts +17 -0
  3. package/dist/auth/login.d.ts.map +1 -0
  4. package/dist/auth/login.js +50 -0
  5. package/dist/auth/login.js.map +1 -0
  6. package/dist/auth/logout.d.ts +9 -0
  7. package/dist/auth/logout.d.ts.map +1 -0
  8. package/dist/auth/logout.js +51 -0
  9. package/dist/auth/logout.js.map +1 -0
  10. package/dist/auth/refresh.d.ts +8 -0
  11. package/dist/auth/refresh.d.ts.map +1 -0
  12. package/dist/auth/refresh.js +53 -0
  13. package/dist/auth/refresh.js.map +1 -0
  14. package/dist/elements/DocumentHeaderClient/index.d.ts +16 -0
  15. package/dist/elements/DocumentHeaderClient/index.d.ts.map +1 -0
  16. package/dist/elements/DocumentHeaderClient/index.js +116 -0
  17. package/dist/elements/DocumentHeaderClient/index.js.map +1 -0
  18. package/dist/elements/RenderComponent/index.d.ts +10 -0
  19. package/dist/elements/RenderComponent/index.d.ts.map +1 -0
  20. package/dist/elements/RenderComponent/index.js +12 -0
  21. package/dist/elements/RenderComponent/index.js.map +1 -0
  22. package/dist/elements/RouterAdapter/index.d.ts +3 -0
  23. package/dist/elements/RouterAdapter/index.d.ts.map +1 -0
  24. package/dist/elements/RouterAdapter/index.js +141 -0
  25. package/dist/elements/RouterAdapter/index.js.map +1 -0
  26. package/dist/exports/client.d.ts +8 -0
  27. package/dist/exports/client.d.ts.map +1 -0
  28. package/dist/exports/client.js +10 -0
  29. package/dist/exports/client.js.map +1 -0
  30. package/dist/exports/layouts.d.ts +6 -0
  31. package/dist/exports/layouts.d.ts.map +1 -0
  32. package/dist/exports/layouts.js +5 -0
  33. package/dist/exports/layouts.js.map +1 -0
  34. package/dist/exports/rsc.browser.d.ts +12 -0
  35. package/dist/exports/rsc.browser.d.ts.map +1 -0
  36. package/dist/exports/rsc.browser.js +12 -0
  37. package/dist/exports/rsc.browser.js.map +1 -0
  38. package/dist/exports/rsc.d.ts +5 -0
  39. package/dist/exports/rsc.d.ts.map +1 -0
  40. package/dist/exports/rsc.js +6 -0
  41. package/dist/exports/rsc.js.map +1 -0
  42. package/dist/exports/server.d.ts +17 -0
  43. package/dist/exports/server.d.ts.map +1 -0
  44. package/dist/exports/server.js +18 -0
  45. package/dist/exports/server.js.map +1 -0
  46. package/dist/exports/vite.d.ts +3 -0
  47. package/dist/exports/vite.d.ts.map +1 -0
  48. package/dist/exports/vite.js +3 -0
  49. package/dist/exports/vite.js.map +1 -0
  50. package/dist/index.d.ts +6 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +7 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/layouts/Root/getLayoutData.d.ts +12 -0
  55. package/dist/layouts/Root/getLayoutData.d.ts.map +1 -0
  56. package/dist/layouts/Root/getLayoutData.js +91 -0
  57. package/dist/layouts/Root/getLayoutData.js.map +1 -0
  58. package/dist/layouts/Root/index.d.ts +32 -0
  59. package/dist/layouts/Root/index.d.ts.map +1 -0
  60. package/dist/layouts/Root/index.js +51 -0
  61. package/dist/layouts/Root/index.js.map +1 -0
  62. package/dist/layouts/Root/withPayloadRoot.d.ts +65 -0
  63. package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -0
  64. package/dist/layouts/Root/withPayloadRoot.js +92 -0
  65. package/dist/layouts/Root/withPayloadRoot.js.map +1 -0
  66. package/dist/node/cssLoader.d.mts +3 -0
  67. package/dist/node/cssLoader.d.mts.map +1 -0
  68. package/dist/node/cssLoader.js +70 -0
  69. package/dist/node/cssLoader.js.map +1 -0
  70. package/dist/node/cssLoader.mjs +75 -0
  71. package/dist/node/registerCssLoader.d.mts +2 -0
  72. package/dist/node/registerCssLoader.d.mts.map +1 -0
  73. package/dist/node/registerCssLoader.js +10 -0
  74. package/dist/node/registerCssLoader.js.map +1 -0
  75. package/dist/node/registerCssLoader.mjs +10 -0
  76. package/dist/routes/adminRoutes.d.ts +111 -0
  77. package/dist/routes/adminRoutes.d.ts.map +1 -0
  78. package/dist/routes/adminRoutes.js +108 -0
  79. package/dist/routes/adminRoutes.js.map +1 -0
  80. package/dist/routes/apiRoute.d.ts +29 -0
  81. package/dist/routes/apiRoute.d.ts.map +1 -0
  82. package/dist/routes/apiRoute.js +38 -0
  83. package/dist/routes/apiRoute.js.map +1 -0
  84. package/dist/routes/layoutRoute.d.ts +26 -0
  85. package/dist/routes/layoutRoute.d.ts.map +1 -0
  86. package/dist/routes/layoutRoute.js +57 -0
  87. package/dist/routes/layoutRoute.js.map +1 -0
  88. package/dist/rsc/CollectionCards.d.ts +4 -0
  89. package/dist/rsc/CollectionCards.d.ts.map +1 -0
  90. package/dist/rsc/CollectionCards.js +12 -0
  91. package/dist/rsc/CollectionCards.js.map +1 -0
  92. package/dist/rsc/HierarchyTypeFieldServer.d.ts +9 -0
  93. package/dist/rsc/HierarchyTypeFieldServer.d.ts.map +1 -0
  94. package/dist/rsc/HierarchyTypeFieldServer.js +35 -0
  95. package/dist/rsc/HierarchyTypeFieldServer.js.map +1 -0
  96. package/dist/rsc/renderOnDemand.d.ts +15 -0
  97. package/dist/rsc/renderOnDemand.d.ts.map +1 -0
  98. package/dist/rsc/renderOnDemand.js +25 -0
  99. package/dist/rsc/renderOnDemand.js.map +1 -0
  100. package/dist/rsc/renderPayloadRSC.d.ts +6 -0
  101. package/dist/rsc/renderPayloadRSC.d.ts.map +1 -0
  102. package/dist/rsc/renderPayloadRSC.js +6 -0
  103. package/dist/rsc/renderPayloadRSC.js.map +1 -0
  104. package/dist/utilities/devReloadStrategy.d.ts +10 -0
  105. package/dist/utilities/devReloadStrategy.d.ts.map +1 -0
  106. package/dist/utilities/devReloadStrategy.js +27 -0
  107. package/dist/utilities/devReloadStrategy.js.map +1 -0
  108. package/dist/utilities/getExistingAuthToken.d.ts +7 -0
  109. package/dist/utilities/getExistingAuthToken.d.ts.map +1 -0
  110. package/dist/utilities/getExistingAuthToken.js +18 -0
  111. package/dist/utilities/getExistingAuthToken.js.map +1 -0
  112. package/dist/utilities/getPreferences.d.ts +10 -0
  113. package/dist/utilities/getPreferences.d.ts.map +1 -0
  114. package/dist/utilities/getPreferences.js +33 -0
  115. package/dist/utilities/getPreferences.js.map +1 -0
  116. package/dist/utilities/getRequestI18n.server.d.ts +12 -0
  117. package/dist/utilities/getRequestI18n.server.d.ts.map +1 -0
  118. package/dist/utilities/getRequestI18n.server.js +25 -0
  119. package/dist/utilities/getRequestI18n.server.js.map +1 -0
  120. package/dist/utilities/getRequestLocale.d.ts +7 -0
  121. package/dist/utilities/getRequestLocale.d.ts.map +1 -0
  122. package/dist/utilities/getRequestLocale.js +20 -0
  123. package/dist/utilities/getRequestLocale.js.map +1 -0
  124. package/dist/utilities/getRequestTheme.d.ts +10 -0
  125. package/dist/utilities/getRequestTheme.d.ts.map +1 -0
  126. package/dist/utilities/getRequestTheme.js +25 -0
  127. package/dist/utilities/getRequestTheme.js.map +1 -0
  128. package/dist/utilities/graphqlHandler.server.d.ts +12 -0
  129. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -0
  130. package/dist/utilities/graphqlHandler.server.js +129 -0
  131. package/dist/utilities/graphqlHandler.server.js.map +1 -0
  132. package/dist/utilities/handleAPIRoute.d.ts +11 -0
  133. package/dist/utilities/handleAPIRoute.d.ts.map +1 -0
  134. package/dist/utilities/handleAPIRoute.js +17 -0
  135. package/dist/utilities/handleAPIRoute.js.map +1 -0
  136. package/dist/utilities/handleServerFunctions.d.ts +20 -0
  137. package/dist/utilities/handleServerFunctions.d.ts.map +1 -0
  138. package/dist/utilities/handleServerFunctions.js +60 -0
  139. package/dist/utilities/handleServerFunctions.js.map +1 -0
  140. package/dist/utilities/importMap.server.d.ts +8 -0
  141. package/dist/utilities/importMap.server.d.ts.map +1 -0
  142. package/dist/utilities/importMap.server.js +11 -0
  143. package/dist/utilities/importMap.server.js.map +1 -0
  144. package/dist/utilities/initReq.server.d.ts +19 -0
  145. package/dist/utilities/initReq.server.d.ts.map +1 -0
  146. package/dist/utilities/initReq.server.js +87 -0
  147. package/dist/utilities/initReq.server.js.map +1 -0
  148. package/dist/utilities/loadAdminPage.d.ts +54 -0
  149. package/dist/utilities/loadAdminPage.d.ts.map +1 -0
  150. package/dist/utilities/loadAdminPage.js +230 -0
  151. package/dist/utilities/loadAdminPage.js.map +1 -0
  152. package/dist/utilities/loadLayoutData.d.ts +15 -0
  153. package/dist/utilities/loadLayoutData.d.ts.map +1 -0
  154. package/dist/utilities/loadLayoutData.js +23 -0
  155. package/dist/utilities/loadLayoutData.js.map +1 -0
  156. package/dist/utilities/meta.d.ts +70 -0
  157. package/dist/utilities/meta.d.ts.map +1 -0
  158. package/dist/utilities/meta.js +142 -0
  159. package/dist/utilities/meta.js.map +1 -0
  160. package/dist/utilities/serializeForRsc.d.ts +26 -0
  161. package/dist/utilities/serializeForRsc.d.ts.map +1 -0
  162. package/dist/utilities/serializeForRsc.js +122 -0
  163. package/dist/utilities/serializeForRsc.js.map +1 -0
  164. package/dist/utilities/serverAdapter.server.d.ts +36 -0
  165. package/dist/utilities/serverAdapter.server.d.ts.map +1 -0
  166. package/dist/utilities/serverAdapter.server.js +130 -0
  167. package/dist/utilities/serverAdapter.server.js.map +1 -0
  168. package/dist/utilities/serverFunctionClient.d.ts +29 -0
  169. package/dist/utilities/serverFunctionClient.d.ts.map +1 -0
  170. package/dist/utilities/serverFunctionClient.js +109 -0
  171. package/dist/utilities/serverFunctionClient.js.map +1 -0
  172. package/dist/utilities/serverFunctionHandlers.d.ts +18 -0
  173. package/dist/utilities/serverFunctionHandlers.d.ts.map +1 -0
  174. package/dist/utilities/serverFunctionHandlers.js +17 -0
  175. package/dist/utilities/serverFunctionHandlers.js.map +1 -0
  176. package/dist/utilities/setPayloadAuthCookie.d.ts +9 -0
  177. package/dist/utilities/setPayloadAuthCookie.d.ts.map +1 -0
  178. package/dist/utilities/setPayloadAuthCookie.js +31 -0
  179. package/dist/utilities/setPayloadAuthCookie.js.map +1 -0
  180. package/dist/utilities/toSerializable.d.ts +2 -0
  181. package/dist/utilities/toSerializable.d.ts.map +1 -0
  182. package/dist/utilities/toSerializable.js +111 -0
  183. package/dist/utilities/toSerializable.js.map +1 -0
  184. package/dist/vite/constants.d.ts +42 -0
  185. package/dist/vite/constants.d.ts.map +1 -0
  186. package/dist/vite/constants.js +177 -0
  187. package/dist/vite/constants.js.map +1 -0
  188. package/dist/vite/importProtection.d.ts +14 -0
  189. package/dist/vite/importProtection.d.ts.map +1 -0
  190. package/dist/vite/importProtection.js +54 -0
  191. package/dist/vite/importProtection.js.map +1 -0
  192. package/dist/vite/plugin.d.ts +38 -0
  193. package/dist/vite/plugin.d.ts.map +1 -0
  194. package/dist/vite/plugin.js +177 -0
  195. package/dist/vite/plugin.js.map +1 -0
  196. package/dist/vite/plugins/clientModuleResolution.d.ts +14 -0
  197. package/dist/vite/plugins/clientModuleResolution.d.ts.map +1 -0
  198. package/dist/vite/plugins/clientModuleResolution.js +98 -0
  199. package/dist/vite/plugins/clientModuleResolution.js.map +1 -0
  200. package/dist/vite/plugins/devTransforms.d.ts +19 -0
  201. package/dist/vite/plugins/devTransforms.d.ts.map +1 -0
  202. package/dist/vite/plugins/devTransforms.js +67 -0
  203. package/dist/vite/plugins/devTransforms.js.map +1 -0
  204. package/dist/vite/plugins/reactDomServerInRsc.d.ts +27 -0
  205. package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +1 -0
  206. package/dist/vite/plugins/reactDomServerInRsc.js +90 -0
  207. package/dist/vite/plugins/reactDomServerInRsc.js.map +1 -0
  208. package/dist/vite/plugins/stripDistStyleImports.d.ts +21 -0
  209. package/dist/vite/plugins/stripDistStyleImports.d.ts.map +1 -0
  210. package/dist/vite/plugins/stripDistStyleImports.js +140 -0
  211. package/dist/vite/plugins/stripDistStyleImports.js.map +1 -0
  212. package/dist/vite/plugins/wrapCjsForClient.d.ts +15 -0
  213. package/dist/vite/plugins/wrapCjsForClient.d.ts.map +1 -0
  214. package/dist/vite/plugins/wrapCjsForClient.js +106 -0
  215. package/dist/vite/plugins/wrapCjsForClient.js.map +1 -0
  216. package/package.json +106 -0
@@ -0,0 +1,70 @@
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
+ */ const STYLE_EXTENSION_RE = /\.(?:s?css|less)(?:\?[^#]*)?(?:#.*)?$/i;
23
+ const ASSET_EXTENSION_RE = /\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\?[^#]*)?(?:#.*)?$/i;
24
+ const isStylesheet = (s)=>STYLE_EXTENSION_RE.test(s);
25
+ const isStaticAsset = (s)=>ASSET_EXTENSION_RE.test(s);
26
+ const stubSource = (specifier)=>{
27
+ if (isStylesheet(specifier)) {
28
+ // Stylesheet imports usually have no JS-visible exports, so an empty
29
+ // module is fine and matches Vite's `?inline` / extracted-css behaviour.
30
+ return '';
31
+ }
32
+ // Treat every other static asset like Vite's default asset pipeline:
33
+ // expose the (escaped) specifier as both a default export and a `src`
34
+ // property. This lets code like
35
+ // import logo from './logo.svg' -> uses the default export
36
+ // import { src } from './logo.png' -> Next.js `StaticImageData` shim
37
+ // logo === '/logo.svg' -> truthy, sufficient for tests
38
+ // continue to work without crashing during SSR.
39
+ const value = JSON.stringify(specifier);
40
+ return `const __asset = ${value};
41
+ export default __asset;
42
+ export const src = __asset;
43
+ export const height = 0;
44
+ export const width = 0;
45
+ export const blurWidth = 0;
46
+ export const blurHeight = 0;
47
+ `;
48
+ };
49
+ export async function resolve(specifier, context, nextResolve) {
50
+ if (isStylesheet(specifier) || isStaticAsset(specifier)) {
51
+ return {
52
+ format: 'module',
53
+ shortCircuit: true,
54
+ url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`
55
+ };
56
+ }
57
+ return nextResolve(specifier, context);
58
+ }
59
+ export async function load(url, context, nextLoad) {
60
+ if (isStylesheet(url) || isStaticAsset(url)) {
61
+ return {
62
+ format: 'module',
63
+ shortCircuit: true,
64
+ source: stubSource(url)
65
+ };
66
+ }
67
+ return nextLoad(url, context);
68
+ }
69
+
70
+ //# sourceMappingURL=cssLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/node/cssLoader.mjs"],"sourcesContent":["/**\n * Node ESM loader hook that swallows static asset imports (CSS/SCSS/LESS,\n * images, fonts, audio, video, etc.) encountered while running the dev\n * server.\n *\n * Vite is supposed to intercept asset imports during SSR/RSC by treating\n * the package as `noExternal`, but that resolution path silently breaks down\n * when a dependency is installed from a packed tarball under\n * `node_modules/.pnpm/<pkg>@file+packed+...`. In that scenario Vite hands the\n * import to Node's native ESM loader, which has no opinion about `.css` /\n * `.svg` / `.png` files and throws `ERR_UNKNOWN_FILE_EXTENSION`. That single\n * throw cascades into every admin route showing \"Something went wrong!\"\n * because the SSR tree dies inside `<MatchInnerImpl>`.\n *\n * Registering this loader (with `--import` or `register()`) makes Node treat\n * any asset specifier as an empty ES module, which is exactly what we\n * already do client-side for SSR.\n *\n * The loader is intentionally minimal and side-effect free; it only kicks in\n * for asset specifiers and falls through to the default loader for\n * everything else.\n */\n\nconst STYLE_EXTENSION_RE = /\\.(?:s?css|less)(?:\\?[^#]*)?(?:#.*)?$/i\nconst ASSET_EXTENSION_RE =\n /\\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\\?[^#]*)?(?:#.*)?$/i\n\nconst isStylesheet = (s) => STYLE_EXTENSION_RE.test(s)\nconst isStaticAsset = (s) => ASSET_EXTENSION_RE.test(s)\n\nconst stubSource = (specifier) => {\n if (isStylesheet(specifier)) {\n // Stylesheet imports usually have no JS-visible exports, so an empty\n // module is fine and matches Vite's `?inline` / extracted-css behaviour.\n return ''\n }\n // Treat every other static asset like Vite's default asset pipeline:\n // expose the (escaped) specifier as both a default export and a `src`\n // property. This lets code like\n // import logo from './logo.svg' -> uses the default export\n // import { src } from './logo.png' -> Next.js `StaticImageData` shim\n // logo === '/logo.svg' -> truthy, sufficient for tests\n // continue to work without crashing during SSR.\n const value = JSON.stringify(specifier)\n return `const __asset = ${value};\nexport default __asset;\nexport const src = __asset;\nexport const height = 0;\nexport const width = 0;\nexport const blurWidth = 0;\nexport const blurHeight = 0;\n`\n}\n\nexport async function resolve(specifier, context, nextResolve) {\n if (isStylesheet(specifier) || isStaticAsset(specifier)) {\n return {\n format: 'module',\n shortCircuit: true,\n url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`,\n }\n }\n return nextResolve(specifier, context)\n}\n\nexport async function load(url, context, nextLoad) {\n if (isStylesheet(url) || isStaticAsset(url)) {\n return {\n format: 'module',\n shortCircuit: true,\n source: stubSource(url),\n }\n }\n return nextLoad(url, context)\n}\n"],"names":["STYLE_EXTENSION_RE","ASSET_EXTENSION_RE","isStylesheet","s","test","isStaticAsset","stubSource","specifier","value","JSON","stringify","resolve","context","nextResolve","format","shortCircuit","url","Buffer","from","toString","load","nextLoad","source"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED,MAAMA,qBAAqB;AAC3B,MAAMC,qBACJ;AAEF,MAAMC,eAAe,CAACC,IAAMH,mBAAmBI,IAAI,CAACD;AACpD,MAAME,gBAAgB,CAACF,IAAMF,mBAAmBG,IAAI,CAACD;AAErD,MAAMG,aAAa,CAACC;IAClB,IAAIL,aAAaK,YAAY;QAC3B,qEAAqE;QACrE,yEAAyE;QACzE,OAAO;IACT;IACA,qEAAqE;IACrE,sEAAsE;IACtE,gCAAgC;IAChC,oEAAoE;IACpE,2EAA2E;IAC3E,yEAAyE;IACzE,gDAAgD;IAChD,MAAMC,QAAQC,KAAKC,SAAS,CAACH;IAC7B,OAAO,CAAC,gBAAgB,EAAEC,MAAM;;;;;;;AAOlC,CAAC;AACD;AAEA,OAAO,eAAeG,QAAQJ,SAAS,EAAEK,OAAO,EAAEC,WAAW;IAC3D,IAAIX,aAAaK,cAAcF,cAAcE,YAAY;QACvD,OAAO;YACLO,QAAQ;YACRC,cAAc;YACdC,KAAK,CAAC,4BAA4B,EAAEC,OAAOC,IAAI,CAACZ,WAAWC,YAAYY,QAAQ,CAAC,WAAW;QAC7F;IACF;IACA,OAAON,YAAYN,WAAWK;AAChC;AAEA,OAAO,eAAeQ,KAAKJ,GAAG,EAAEJ,OAAO,EAAES,QAAQ;IAC/C,IAAInB,aAAac,QAAQX,cAAcW,MAAM;QAC3C,OAAO;YACLF,QAAQ;YACRC,cAAc;YACdO,QAAQhB,WAAWU;QACrB;IACF;IACA,OAAOK,SAASL,KAAKJ;AACvB"}
@@ -0,0 +1,75 @@
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
+
24
+ const STYLE_EXTENSION_RE = /\.(?:s?css|less)(?:\?[^#]*)?(?:#.*)?$/i
25
+ const ASSET_EXTENSION_RE =
26
+ /\.(?:svg|png|jpe?g|gif|webp|avif|ico|bmp|tiff?|woff2?|ttf|otf|eot|mp[34]|webm|ogg|oga|wav|flac|m4a|m4v|mov|pdf)(?:\?[^#]*)?(?:#.*)?$/i
27
+
28
+ const isStylesheet = (s) => STYLE_EXTENSION_RE.test(s)
29
+ const isStaticAsset = (s) => ASSET_EXTENSION_RE.test(s)
30
+
31
+ const stubSource = (specifier) => {
32
+ if (isStylesheet(specifier)) {
33
+ // Stylesheet imports usually have no JS-visible exports, so an empty
34
+ // module is fine and matches Vite's `?inline` / extracted-css behaviour.
35
+ return ''
36
+ }
37
+ // Treat every other static asset like Vite's default asset pipeline:
38
+ // expose the (escaped) specifier as both a default export and a `src`
39
+ // property. This lets code like
40
+ // import logo from './logo.svg' -> uses the default export
41
+ // import { src } from './logo.png' -> Next.js `StaticImageData` shim
42
+ // logo === '/logo.svg' -> truthy, sufficient for tests
43
+ // continue to work without crashing during SSR.
44
+ const value = JSON.stringify(specifier)
45
+ return `const __asset = ${value};
46
+ export default __asset;
47
+ export const src = __asset;
48
+ export const height = 0;
49
+ export const width = 0;
50
+ export const blurWidth = 0;
51
+ export const blurHeight = 0;
52
+ `
53
+ }
54
+
55
+ export async function resolve(specifier, context, nextResolve) {
56
+ if (isStylesheet(specifier) || isStaticAsset(specifier)) {
57
+ return {
58
+ format: 'module',
59
+ shortCircuit: true,
60
+ url: `data:text/javascript;base64,${Buffer.from(stubSource(specifier)).toString('base64')}`,
61
+ }
62
+ }
63
+ return nextResolve(specifier, context)
64
+ }
65
+
66
+ export async function load(url, context, nextLoad) {
67
+ if (isStylesheet(url) || isStaticAsset(url)) {
68
+ return {
69
+ format: 'module',
70
+ shortCircuit: true,
71
+ source: stubSource(url),
72
+ }
73
+ }
74
+ return nextLoad(url, context)
75
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=registerCssLoader.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerCssLoader.d.mts","sourceRoot":"","sources":["../../src/node/registerCssLoader.mjs"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.
3
+ *
4
+ * Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`
5
+ * so the spawned Vite process can swallow stylesheet imports it would
6
+ * otherwise hand to Node's native ESM loader (which throws on `.css`).
7
+ */ import { register } from 'node:module';
8
+ register('./cssLoader.mjs', import.meta.url);
9
+
10
+ //# sourceMappingURL=registerCssLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/node/registerCssLoader.mjs"],"sourcesContent":["/**\n * Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.\n *\n * Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`\n * so the spawned Vite process can swallow stylesheet imports it would\n * otherwise hand to Node's native ESM loader (which throws on `.css`).\n */\nimport { register } from 'node:module'\n\nregister('./cssLoader.mjs', import.meta.url)\n"],"names":["register","url"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,QAAQ,QAAQ,cAAa;AAEtCA,SAAS,mBAAmB,YAAYC,GAAG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tiny shim that registers `./cssLoader.mjs` as a Node ESM loader hook.
3
+ *
4
+ * Used by the test dev-server runner via `node --import ./registerCssLoader.mjs`
5
+ * so the spawned Vite process can swallow stylesheet imports it would
6
+ * otherwise hand to Node's native ESM loader (which throws on `.css`).
7
+ */
8
+ import { register } from 'node:module'
9
+
10
+ register('./cssLoader.mjs', import.meta.url)
@@ -0,0 +1,111 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Loader supplied by the app — a TanStack Start `createServerFn` that delegates
4
+ * to `loadAdminPage`. Typed loosely because the server-fn's call signature is
5
+ * generated by the Start compiler.
6
+ */
7
+ export type AdminLoad = (opts: {
8
+ data: {
9
+ _splat: string;
10
+ search: Record<string, string | string[]>;
11
+ };
12
+ }) => Promise<any>;
13
+ declare function AdminPage(): import("react").JSX.Element;
14
+ declare function AdminNotFound(props: {
15
+ data?: {
16
+ routeKey?: string;
17
+ rscPayload?: ReactNode;
18
+ };
19
+ }): import("react").JSX.Element;
20
+ /**
21
+ * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's
22
+ * server-built NotFound page (shipped via the `notFound()` error's
23
+ * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare
24
+ * client view.
25
+ */
26
+ export declare function payloadAdminSplatRoute({ load }: {
27
+ load: AdminLoad;
28
+ }): {
29
+ component: typeof AdminPage;
30
+ head: ({ loaderData }: {
31
+ loaderData?: any;
32
+ }) => {
33
+ links: {
34
+ href: string;
35
+ media?: string;
36
+ rel: string;
37
+ sizes?: string;
38
+ type?: string;
39
+ }[];
40
+ meta: ({
41
+ charSet: string;
42
+ } | {
43
+ content: string;
44
+ name: string;
45
+ } | {
46
+ content: string;
47
+ property: string;
48
+ } | {
49
+ title: string;
50
+ })[];
51
+ };
52
+ loader: {
53
+ handler: ({ location, params }: {
54
+ location: any;
55
+ params: any;
56
+ }) => Promise<any>;
57
+ staleReloadMode: string;
58
+ };
59
+ loaderDeps: ({ search }: {
60
+ search: Record<string, unknown>;
61
+ }) => {
62
+ searchKey: string;
63
+ };
64
+ notFoundComponent: typeof AdminNotFound;
65
+ validateSearch: (search: Record<string, unknown>) => Record<string, unknown>;
66
+ };
67
+ /**
68
+ * Route options for the admin index route (`/_payload/admin/`). Same loader as the
69
+ * splat route but throws a bare `notFound()` (no rscPayload) on miss.
70
+ */
71
+ export declare function payloadAdminIndexRoute({ load }: {
72
+ load: AdminLoad;
73
+ }): {
74
+ component: typeof AdminPage;
75
+ head: ({ loaderData }: {
76
+ loaderData?: any;
77
+ }) => {
78
+ links: {
79
+ href: string;
80
+ media?: string;
81
+ rel: string;
82
+ sizes?: string;
83
+ type?: string;
84
+ }[];
85
+ meta: ({
86
+ charSet: string;
87
+ } | {
88
+ content: string;
89
+ name: string;
90
+ } | {
91
+ content: string;
92
+ property: string;
93
+ } | {
94
+ title: string;
95
+ })[];
96
+ };
97
+ loader: {
98
+ handler: ({ location }: {
99
+ location: any;
100
+ }) => Promise<any>;
101
+ staleReloadMode: string;
102
+ };
103
+ loaderDeps: ({ search }: {
104
+ search: Record<string, unknown>;
105
+ }) => {
106
+ searchKey: string;
107
+ };
108
+ validateSearch: (search: Record<string, unknown>) => Record<string, unknown>;
109
+ };
110
+ export {};
111
+ //# sourceMappingURL=adminRoutes.d.ts.map
@@ -0,0 +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;;2BAGzC;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;wCAOH;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;;;6BAW7C;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;;;;6BAInC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAEnD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BAGzC;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;gCAEX;YAAE,QAAQ,EAAE,GAAG,CAAA;SAAE;;;6BAUxB;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;;;6BAGnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAEnD"}
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { NotFoundClient } from '@payloadcms/ui';
4
+ import { notFound, redirect, useLoaderData } from '@tanstack/react-router';
5
+ import { Fragment } from 'react';
6
+ import { getAdminMeta } from '../utilities/meta.js';
7
+ const searchToRecord = (searchStr)=>Object.fromEntries(new URLSearchParams(searchStr));
8
+ const runLoader = async (load, splat, searchStr)=>{
9
+ const data = await load({
10
+ data: {
11
+ _splat: splat,
12
+ search: searchToRecord(searchStr)
13
+ }
14
+ });
15
+ if (data?._redirect) {
16
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects
17
+ throw redirect({
18
+ to: data._redirect
19
+ });
20
+ }
21
+ return data;
22
+ };
23
+ function AdminPage() {
24
+ // RSC Flight payload — render directly. Key by the loader-derived `routeKey`
25
+ // (not `location.pathname`, which updates before `useLoaderData` during a
26
+ // transition and would remount with the previous payload) so navigating to a
27
+ // different admin page remounts the view, mirroring Next route-segment
28
+ // semantics. Search params are excluded so search-only changes reconcile in place.
29
+ const data = useLoaderData({
30
+ strict: false
31
+ });
32
+ return /*#__PURE__*/ _jsx(Fragment, {
33
+ children: data?.rscPayload
34
+ }, data?.routeKey);
35
+ }
36
+ function AdminNotFound(props) {
37
+ const rscPayload = props?.data?.rscPayload;
38
+ if (!rscPayload) {
39
+ return /*#__PURE__*/ _jsx(NotFoundClient, {});
40
+ }
41
+ return /*#__PURE__*/ _jsx(Fragment, {
42
+ children: rscPayload
43
+ }, props?.data?.routeKey);
44
+ }
45
+ /**
46
+ * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's
47
+ * server-built NotFound page (shipped via the `notFound()` error's
48
+ * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare
49
+ * client view.
50
+ */ export function payloadAdminSplatRoute({ load }) {
51
+ return {
52
+ component: AdminPage,
53
+ head: ({ loaderData })=>getAdminMeta(loaderData?.metadata),
54
+ // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a
55
+ // sibling route option — router-core only reads it off a non-function loader)
56
+ // makes stale-match revalidation await the fresh loader before committing,
57
+ // instead of the default background SWR that flashes the pre-navigation list
58
+ // (e.g. a just-created doc missing) until the reload lands.
59
+ loader: {
60
+ handler: async ({ location, params })=>{
61
+ const data = await runLoader(load, params._splat ?? '', location.searchStr);
62
+ if (data?._notFound) {
63
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects
64
+ throw notFound({
65
+ data: {
66
+ routeKey: data.routeKey,
67
+ rscPayload: data.rscPayload
68
+ }
69
+ });
70
+ }
71
+ return data;
72
+ },
73
+ staleReloadMode: 'blocking'
74
+ },
75
+ // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.
76
+ loaderDeps: ({ search })=>({
77
+ searchKey: JSON.stringify(search)
78
+ }),
79
+ notFoundComponent: AdminNotFound,
80
+ validateSearch: (search)=>search
81
+ };
82
+ }
83
+ /**
84
+ * Route options for the admin index route (`/_payload/admin/`). Same loader as the
85
+ * splat route but throws a bare `notFound()` (no rscPayload) on miss.
86
+ */ export function payloadAdminIndexRoute({ load }) {
87
+ return {
88
+ component: AdminPage,
89
+ head: ({ loaderData })=>getAdminMeta(loaderData?.metadata),
90
+ loader: {
91
+ handler: async ({ location })=>{
92
+ const data = await runLoader(load, '', location.searchStr);
93
+ if (data?._notFound) {
94
+ // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects
95
+ throw notFound();
96
+ }
97
+ return data;
98
+ },
99
+ staleReloadMode: 'blocking'
100
+ },
101
+ loaderDeps: ({ search })=>({
102
+ searchKey: JSON.stringify(search)
103
+ }),
104
+ validateSearch: (search)=>search
105
+ };
106
+ }
107
+
108
+ //# sourceMappingURL=adminRoutes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport { NotFoundClient } from '@payloadcms/ui'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async (load: AdminLoad, splat: string, searchStr: string) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) } })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\nfunction AdminPage() {\n // RSC Flight payload — render directly. Key by the loader-derived `routeKey`\n // (not `location.pathname`, which updates before `useLoaderData` during a\n // transition and would remount with the previous payload) so navigating to a\n // different admin page remounts the view, mirroring Next route-segment\n // semantics. Search params are excluded so search-only changes reconcile in place.\n const data = useLoaderData({ strict: false })\n return <Fragment key={data?.routeKey}>{data?.rscPayload}</Fragment>\n}\n\nfunction AdminNotFound(props: { data?: { routeKey?: string; rscPayload?: ReactNode } }) {\n const rscPayload = props?.data?.rscPayload\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={props?.data?.routeKey}>{rscPayload}</Fragment>\n}\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return {\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({ location, params }: { location: any; params: any }) => {\n const data = await runLoader(load, params._splat ?? '', location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound({ data: { routeKey: data.routeKey, rscPayload: data.rscPayload } })\n }\n return data\n },\n staleReloadMode: 'blocking',\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n notFoundComponent: AdminNotFound,\n validateSearch: (search: Record<string, unknown>) => search,\n }\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Same loader as the\n * splat route but throws a bare `notFound()` (no rscPayload) on miss.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return {\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n loader: {\n handler: async ({ location }: { location: any }) => {\n const data = await runLoader(load, '', location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound()\n }\n return data\n },\n staleReloadMode: 'blocking',\n },\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n }\n}\n"],"names":["NotFoundClient","notFound","redirect","useLoaderData","Fragment","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","routeKey","AdminNotFound","props","payloadAdminSplatRoute","component","head","loaderData","metadata","loader","handler","location","params","_notFound","staleReloadMode","loaderDeps","searchKey","JSON","stringify","notFoundComponent","validateSearch","payloadAdminIndexRoute"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB;AAC1E,SAASC,QAAQ,QAAwB,QAAO;AAEhD,SAASC,YAAY,QAAQ,uBAAsB;AAWnD,MAAMC,iBAAiB,CAACC,YACtBC,OAAOC,WAAW,CAAC,IAAIC,gBAAgBH;AAEzC,MAAMI,YAAY,OAAOC,MAAiBC,OAAeN;IACvD,MAAMO,OAAO,MAAMF,KAAK;QAAEE,MAAM;YAAEC,QAAQF;YAAOG,QAAQV,eAAeC;QAAW;IAAE;IACrF,IAAIO,MAAMG,WAAW;QACnB,qHAAqH;QACrH,MAAMf,SAAS;YAAEgB,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,SAASK;IACP,6EAA6E;IAC7E,0EAA0E;IAC1E,6EAA6E;IAC7E,uEAAuE;IACvE,mFAAmF;IACnF,MAAML,OAAOX,cAAc;QAAEiB,QAAQ;IAAM;IAC3C,qBAAO,KAAChB;kBAA+BU,MAAMO;OAAvBP,MAAMQ;AAC9B;AAEA,SAASC,cAAcC,KAA+D;IACpF,MAAMH,aAAaG,OAAOV,MAAMO;IAChC,IAAI,CAACA,YAAY;QACf,qBAAO,KAACrB;IACV;IACA,qBAAO,KAACI;kBAAsCiB;OAAxBG,OAAOV,MAAMQ;AACrC;AAEA;;;;;CAKC,GACD,OAAO,SAASG,uBAAuB,EAAEb,IAAI,EAAuB;IAClE,OAAO;QACLc,WAAWP;QACXQ,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKvB,aAAauB,YAAYC;QACzE,0EAA0E;QAC1E,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,4DAA4D;QAC5DC,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAEC,MAAM,EAAkC;gBAClE,MAAMnB,OAAO,MAAMH,UAAUC,MAAMqB,OAAOlB,MAAM,IAAI,IAAIiB,SAASzB,SAAS;gBAC1E,IAAIO,MAAMoB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMjC,SAAS;wBAAEa,MAAM;4BAAEQ,UAAUR,KAAKQ,QAAQ;4BAAED,YAAYP,KAAKO,UAAU;wBAAC;oBAAE;gBAClF;gBACA,OAAOP;YACT;YACAqB,iBAAiB;QACnB;QACA,2EAA2E;QAC3EC,YAAY,CAAC,EAAEpB,MAAM,EAAuC,GAAM,CAAA;gBAChEqB,WAAWC,KAAKC,SAAS,CAACvB;YAC5B,CAAA;QACAwB,mBAAmBjB;QACnBkB,gBAAgB,CAACzB,SAAoCA;IACvD;AACF;AAEA;;;CAGC,GACD,OAAO,SAAS0B,uBAAuB,EAAE9B,IAAI,EAAuB;IAClE,OAAO;QACLc,WAAWP;QACXQ,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKvB,aAAauB,YAAYC;QACzEC,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAqB;gBAC7C,MAAMlB,OAAO,MAAMH,UAAUC,MAAM,IAAIoB,SAASzB,SAAS;gBACzD,IAAIO,MAAMoB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMjC;gBACR;gBACA,OAAOa;YACT;YACAqB,iBAAiB;QACnB;QACAC,YAAY,CAAC,EAAEpB,MAAM,EAAuC,GAAM,CAAA;gBAChEqB,WAAWC,KAAKC,SAAS,CAACvB;YAC5B,CAAA;QACAyB,gBAAgB,CAACzB,SAAoCA;IACvD;AACF"}
@@ -0,0 +1,29 @@
1
+ import type { SanitizedConfig } from 'payload';
2
+ type ApiRouteHandler = (ctx: {
3
+ request: Request;
4
+ }) => Promise<Response>;
5
+ /**
6
+ * Builds the method handlers for the Payload REST/GraphQL catch-all
7
+ * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`
8
+ * import) since the package cannot resolve the consumer's config.
9
+ *
10
+ * Spread the result into a literal `server.handlers` key so TanStack Start's
11
+ * client compiler can statically see — and prune — the server-only route:
12
+ *
13
+ * ```ts
14
+ * export const Route = createFileRoute('/_payload/api/$')({
15
+ * server: {
16
+ * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),
17
+ * },
18
+ * })
19
+ * ```
20
+ *
21
+ * The compiler only strips a literal `server:` key from a route-options object
22
+ * expression; wrapping the whole options object in a factory call hides the
23
+ * key, leaking the config graph into the client bundle.
24
+ */
25
+ export declare function payloadApiHandlers({ getConfig, }: {
26
+ getConfig: () => Promise<SanitizedConfig>;
27
+ }): Record<'DELETE' | 'GET' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT', ApiRouteHandler>;
28
+ export {};
29
+ //# sourceMappingURL=apiRoute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiRoute.d.ts","sourceRoot":"","sources":["../../src/routes/apiRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAA;CAC1C,GAAG,MAAM,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,CAcnF"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Builds the method handlers for the Payload REST/GraphQL catch-all
3
+ * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`
4
+ * import) since the package cannot resolve the consumer's config.
5
+ *
6
+ * Spread the result into a literal `server.handlers` key so TanStack Start's
7
+ * client compiler can statically see — and prune — the server-only route:
8
+ *
9
+ * ```ts
10
+ * export const Route = createFileRoute('/_payload/api/$')({
11
+ * server: {
12
+ * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),
13
+ * },
14
+ * })
15
+ * ```
16
+ *
17
+ * The compiler only strips a literal `server:` key from a route-options object
18
+ * expression; wrapping the whole options object in a factory call hides the
19
+ * key, leaking the config graph into the client bundle.
20
+ */ export function payloadApiHandlers({ getConfig }) {
21
+ const handler = async ({ request })=>{
22
+ const { handleAPIRoute } = await import('../utilities/handleAPIRoute.js');
23
+ return handleAPIRoute({
24
+ config: await getConfig(),
25
+ request
26
+ });
27
+ };
28
+ return {
29
+ DELETE: handler,
30
+ GET: handler,
31
+ OPTIONS: handler,
32
+ PATCH: handler,
33
+ POST: handler,
34
+ PUT: handler
35
+ };
36
+ }
37
+
38
+ //# sourceMappingURL=apiRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/routes/apiRoute.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\ntype ApiRouteHandler = (ctx: { request: Request }) => Promise<Response>\n\n/**\n * Builds the method handlers for the Payload REST/GraphQL catch-all\n * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`\n * import) since the package cannot resolve the consumer's config.\n *\n * Spread the result into a literal `server.handlers` key so TanStack Start's\n * client compiler can statically see — and prune — the server-only route:\n *\n * ```ts\n * export const Route = createFileRoute('/_payload/api/$')({\n * server: {\n * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),\n * },\n * })\n * ```\n *\n * The compiler only strips a literal `server:` key from a route-options object\n * expression; wrapping the whole options object in a factory call hides the\n * key, leaking the config graph into the client bundle.\n */\nexport function payloadApiHandlers({\n getConfig,\n}: {\n getConfig: () => Promise<SanitizedConfig>\n}): Record<'DELETE' | 'GET' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT', ApiRouteHandler> {\n const handler: ApiRouteHandler = async ({ request }) => {\n const { handleAPIRoute } = await import('../utilities/handleAPIRoute.js')\n return handleAPIRoute({ config: await getConfig(), request })\n }\n\n return {\n DELETE: handler,\n GET: handler,\n OPTIONS: handler,\n PATCH: handler,\n POST: handler,\n PUT: handler,\n }\n}\n"],"names":["payloadApiHandlers","getConfig","handler","request","handleAPIRoute","config","DELETE","GET","OPTIONS","PATCH","POST","PUT"],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASA,mBAAmB,EACjCC,SAAS,EAGV;IACC,MAAMC,UAA2B,OAAO,EAAEC,OAAO,EAAE;QACjD,MAAM,EAAEC,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC;QACxC,OAAOA,eAAe;YAAEC,QAAQ,MAAMJ;YAAaE;QAAQ;IAC7D;IAEA,OAAO;QACLG,QAAQJ;QACRK,KAAKL;QACLM,SAASN;QACTO,OAAOP;QACPQ,MAAMR;QACNS,KAAKT;IACP;AACF"}
@@ -0,0 +1,26 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { RootProvider } from '@payloadcms/ui';
3
+ /**
4
+ * Loader supplied by the app — a TanStack Start `createServerFn` that delegates
5
+ * to `loadLayoutData`. Typed loosely because the server-fn's call signature is
6
+ * generated by the Start compiler.
7
+ */
8
+ export type LayoutLoad = () => Promise<Record<string, unknown>>;
9
+ /**
10
+ * Route options for the Payload admin layout (`/_payload`). Maps the layout
11
+ * loader data onto `RootProvider` and renders the admin chrome (progress bar,
12
+ * custom-provider tree or router `<Outlet />`, portal mount). The app supplies
13
+ * `load` (the layout-data server fn) and `serverFunction` (the server-function
14
+ * client wired into `RootProvider`); everything else is adapter-owned.
15
+ */
16
+ export declare function payloadLayoutRoute({ load, serverFunction, }: {
17
+ load: LayoutLoad;
18
+ serverFunction: ComponentProps<typeof RootProvider>['serverFunction'];
19
+ }): {
20
+ component: () => import("react").JSX.Element;
21
+ loader: {
22
+ handler: () => Promise<Record<string, unknown>>;
23
+ staleReloadMode: string;
24
+ };
25
+ };
26
+ //# sourceMappingURL=layoutRoute.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,57 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { ProgressBar, RootProvider } from '@payloadcms/ui';
4
+ import { Outlet, useLoaderData } from '@tanstack/react-router';
5
+ import { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
6
+ /**
7
+ * Route options for the Payload admin layout (`/_payload`). Maps the layout
8
+ * loader data onto `RootProvider` and renders the admin chrome (progress bar,
9
+ * custom-provider tree or router `<Outlet />`, portal mount). The app supplies
10
+ * `load` (the layout-data server fn) and `serverFunction` (the server-function
11
+ * client wired into `RootProvider`); everything else is adapter-owned.
12
+ */ export function payloadLayoutRoute({ load, serverFunction }) {
13
+ function PayloadLayout() {
14
+ const data = useLoaderData({
15
+ strict: false
16
+ });
17
+ return /*#__PURE__*/ _jsxs(_Fragment, {
18
+ children: [
19
+ /*#__PURE__*/ _jsxs(RootProvider, {
20
+ config: data.clientConfig,
21
+ dateFNSKey: data.dateFNSKey,
22
+ fallbackLang: data.fallbackLang,
23
+ highContrastMode: false,
24
+ isNavOpen: data.isNavOpen,
25
+ languageCode: data.languageCode,
26
+ languageOptions: data.languageOptions,
27
+ locale: data.locale,
28
+ permissions: data.user ? data.permissions : null,
29
+ RouterAdapter: TanStackRouterAdapter,
30
+ serverFunction: serverFunction,
31
+ theme: data.theme,
32
+ translations: data.translations,
33
+ user: data.user,
34
+ children: [
35
+ /*#__PURE__*/ _jsx(ProgressBar, {}),
36
+ data.providers ?? /*#__PURE__*/ _jsx(Outlet, {})
37
+ ]
38
+ }),
39
+ /*#__PURE__*/ _jsx("div", {
40
+ id: "portal"
41
+ })
42
+ ]
43
+ });
44
+ }
45
+ // `staleReloadMode` lives on the loader *object* — router-core only reads it
46
+ // off a non-function loader — so stale-match revalidation blocks on the fresh
47
+ // loader instead of flashing stale layout data via the default background SWR.
48
+ return {
49
+ component: PayloadLayout,
50
+ loader: {
51
+ handler: ()=>load(),
52
+ staleReloadMode: 'blocking'
53
+ }
54
+ };
55
+ }
56
+
57
+ //# sourceMappingURL=layoutRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/routes/layoutRoute.tsx"],"sourcesContent":["'use client'\n\nimport type { ComponentProps } from 'react'\n\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport { Outlet, useLoaderData } from '@tanstack/react-router'\n\nimport { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadLayoutData`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type LayoutLoad = () => Promise<Record<string, unknown>>\n\n/**\n * Route options for the Payload admin layout (`/_payload`). Maps the layout\n * loader data onto `RootProvider` and renders the admin chrome (progress bar,\n * custom-provider tree or router `<Outlet />`, portal mount). The app supplies\n * `load` (the layout-data server fn) and `serverFunction` (the server-function\n * client wired into `RootProvider`); everything else is adapter-owned.\n */\nexport function payloadLayoutRoute({\n load,\n serverFunction,\n}: {\n load: LayoutLoad\n serverFunction: ComponentProps<typeof RootProvider>['serverFunction']\n}) {\n function PayloadLayout() {\n const data = useLoaderData({ strict: false })\n\n return (\n <>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n fallbackLang={data.fallbackLang}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={data.user ? data.permissions : null}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {/* `data.providers` is the custom-provider tree (config.admin.components.providers)\n already wrapping the router <Outlet />; falls back to a bare <Outlet /> when\n no custom providers are configured. */}\n {data.providers ?? <Outlet />}\n </RootProvider>\n <div id=\"portal\" />\n </>\n )\n }\n\n // `staleReloadMode` lives on the loader *object* — router-core only reads it\n // off a non-function loader — so stale-match revalidation blocks on the fresh\n // loader instead of flashing stale layout data via the default background SWR.\n return {\n component: PayloadLayout,\n loader: { handler: () => load(), staleReloadMode: 'blocking' },\n }\n}\n"],"names":["ProgressBar","RootProvider","Outlet","useLoaderData","TanStackRouterAdapter","payloadLayoutRoute","load","serverFunction","PayloadLayout","data","strict","config","clientConfig","dateFNSKey","fallbackLang","highContrastMode","isNavOpen","languageCode","languageOptions","locale","permissions","user","RouterAdapter","theme","translations","providers","div","id","component","loader","handler","staleReloadMode"],"mappings":"AAAA;;AAIA,SAASA,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,SAASC,MAAM,EAAEC,aAAa,QAAQ,yBAAwB;AAE9D,SAASC,qBAAqB,QAAQ,qCAAoC;AAS1E;;;;;;CAMC,GACD,OAAO,SAASC,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EAIf;IACC,SAASC;QACP,MAAMC,OAAON,cAAc;YAAEO,QAAQ;QAAM;QAE3C,qBACE;;8BACE,MAACT;oBACCU,QAAQF,KAAKG,YAAY;oBACzBC,YAAYJ,KAAKI,UAAU;oBAC3BC,cAAcL,KAAKK,YAAY;oBAC/BC,kBAAkB;oBAClBC,WAAWP,KAAKO,SAAS;oBACzBC,cAAcR,KAAKQ,YAAY;oBAC/BC,iBAAiBT,KAAKS,eAAe;oBACrCC,QAAQV,KAAKU,MAAM;oBACnBC,aAAaX,KAAKY,IAAI,GAAGZ,KAAKW,WAAW,GAAG;oBAC5CE,eAAelB;oBACfG,gBAAgBA;oBAChBgB,OAAOd,KAAKc,KAAK;oBACjBC,cAAcf,KAAKe,YAAY;oBAC/BH,MAAMZ,KAAKY,IAAI;;sCAEf,KAACrB;wBAIAS,KAAKgB,SAAS,kBAAI,KAACvB;;;8BAEtB,KAACwB;oBAAIC,IAAG;;;;IAGd;IAEA,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWpB;QACXqB,QAAQ;YAAEC,SAAS,IAAMxB;YAAQyB,iBAAiB;QAAW;IAC/D;AACF"}
@@ -0,0 +1,4 @@
1
+ import type { WidgetServerProps } from 'payload';
2
+ import React from 'react';
3
+ export declare function CollectionCards(props: WidgetServerProps): Promise<React.JSX.Element>;
4
+ //# sourceMappingURL=CollectionCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionCards.d.ts","sourceRoot":"","sources":["../../src/rsc/CollectionCards.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAIhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,wBAAsB,eAAe,CAAC,KAAK,EAAE,iBAAiB,8BAI7D"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getCollectionCardsData } from '@payloadcms/ui/server';
3
+ import { CollectionCardsClient } from '@payloadcms/ui/widgets/CollectionCards/index.client';
4
+ import React from 'react';
5
+ export async function CollectionCards(props) {
6
+ const data = await getCollectionCardsData(props.req);
7
+ return /*#__PURE__*/ _jsx(CollectionCardsClient, {
8
+ ...data
9
+ });
10
+ }
11
+
12
+ //# sourceMappingURL=CollectionCards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rsc/CollectionCards.tsx"],"sourcesContent":["import type { WidgetServerProps } from 'payload'\n\nimport { getCollectionCardsData } from '@payloadcms/ui/server'\nimport { CollectionCardsClient } from '@payloadcms/ui/widgets/CollectionCards/index.client'\nimport React from 'react'\n\nexport async function CollectionCards(props: WidgetServerProps) {\n const data = await getCollectionCardsData(props.req)\n\n return <CollectionCardsClient {...data} />\n}\n"],"names":["getCollectionCardsData","CollectionCardsClient","React","CollectionCards","props","data","req"],"mappings":";AAEA,SAASA,sBAAsB,QAAQ,wBAAuB;AAC9D,SAASC,qBAAqB,QAAQ,sDAAqD;AAC3F,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAeC,gBAAgBC,KAAwB;IAC5D,MAAMC,OAAO,MAAML,uBAAuBI,MAAME,GAAG;IAEnD,qBAAO,KAACL;QAAuB,GAAGI,IAAI;;AACxC"}