@payloadcms/tanstack-start 4.0.0-internal.164164a → 4.0.0-internal.16f218d

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 (195) hide show
  1. package/dist/adapters/handleServerFunctions.d.ts +3 -0
  2. package/dist/adapters/handleServerFunctions.d.ts.map +1 -0
  3. package/dist/adapters/handleServerFunctions.js +17 -0
  4. package/dist/adapters/handleServerFunctions.js.map +1 -0
  5. package/dist/adapters/layout/RootProviders/index.d.ts +9 -0
  6. package/dist/adapters/layout/RootProviders/index.d.ts.map +1 -0
  7. package/dist/adapters/layout/RootProviders/index.js +21 -0
  8. package/dist/adapters/layout/RootProviders/index.js.map +1 -0
  9. package/dist/{layouts/Root/withPayloadRoot.d.ts → adapters/layout/index.d.ts} +32 -4
  10. package/dist/adapters/layout/index.d.ts.map +1 -0
  11. package/dist/adapters/layout/index.js +107 -0
  12. package/dist/adapters/layout/index.js.map +1 -0
  13. package/dist/adapters/layout/lazy.d.ts +7 -0
  14. package/dist/adapters/layout/lazy.d.ts.map +1 -0
  15. package/dist/adapters/layout/lazy.js +17 -0
  16. package/dist/adapters/layout/lazy.js.map +1 -0
  17. package/dist/adapters/layout/outlet.d.ts +4 -0
  18. package/dist/adapters/layout/outlet.d.ts.map +1 -0
  19. package/dist/adapters/layout/outlet.js +9 -0
  20. package/dist/adapters/layout/outlet.js.map +1 -0
  21. package/dist/adapters/layout/server.d.ts +23 -0
  22. package/dist/adapters/layout/server.d.ts.map +1 -0
  23. package/dist/adapters/layout/server.js +65 -0
  24. package/dist/adapters/layout/server.js.map +1 -0
  25. package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +10 -1
  26. package/dist/adapters/metadata.d.ts.map +1 -0
  27. package/dist/{utilities/meta.js → adapters/metadata.js} +60 -1
  28. package/dist/adapters/metadata.js.map +1 -0
  29. package/dist/{elements/RouterAdapter/index.d.ts → adapters/router.d.ts} +1 -1
  30. package/dist/adapters/router.d.ts.map +1 -0
  31. package/dist/{elements/RouterAdapter/index.js → adapters/router.js} +43 -17
  32. package/dist/adapters/router.js.map +1 -0
  33. package/dist/{utilities/serverAdapter.server.d.ts → adapters/server.d.ts} +1 -1
  34. package/dist/adapters/server.d.ts.map +1 -0
  35. package/dist/{utilities/serverAdapter.server.js → adapters/server.js} +3 -30
  36. package/dist/adapters/server.js.map +1 -0
  37. package/dist/{routes/adminRoutes.d.ts → adapters/views/index.d.ts} +14 -28
  38. package/dist/adapters/views/index.d.ts.map +1 -0
  39. package/dist/adapters/views/index.js +101 -0
  40. package/dist/adapters/views/index.js.map +1 -0
  41. package/dist/adapters/views/lazy.d.ts +4 -0
  42. package/dist/adapters/views/lazy.d.ts.map +1 -0
  43. package/dist/adapters/views/lazy.js +44 -0
  44. package/dist/adapters/views/lazy.js.map +1 -0
  45. package/dist/{utilities/loadAdminPage.d.ts → adapters/views/server.d.ts} +12 -6
  46. package/dist/adapters/views/server.d.ts.map +1 -0
  47. package/dist/{utilities/loadAdminPage.js → adapters/views/server.js} +25 -78
  48. package/dist/adapters/views/server.js.map +1 -0
  49. package/dist/auth/login.js +1 -1
  50. package/dist/auth/login.js.map +1 -1
  51. package/dist/auth/logout.js +1 -1
  52. package/dist/auth/logout.js.map +1 -1
  53. package/dist/auth/refresh.js +1 -1
  54. package/dist/auth/refresh.js.map +1 -1
  55. package/dist/exports/client/layout.d.ts +2 -0
  56. package/dist/exports/client/layout.d.ts.map +1 -0
  57. package/dist/exports/client/layout.js +4 -0
  58. package/dist/exports/client/layout.js.map +1 -0
  59. package/dist/exports/client.d.ts +3 -6
  60. package/dist/exports/client.d.ts.map +1 -1
  61. package/dist/exports/client.js +3 -6
  62. package/dist/exports/client.js.map +1 -1
  63. package/dist/exports/layouts.d.ts +2 -3
  64. package/dist/exports/layouts.d.ts.map +1 -1
  65. package/dist/exports/layouts.js +1 -2
  66. package/dist/exports/layouts.js.map +1 -1
  67. package/dist/exports/routes.d.ts +2 -0
  68. package/dist/exports/routes.d.ts.map +1 -0
  69. package/dist/exports/routes.js +3 -0
  70. package/dist/exports/routes.js.map +1 -0
  71. package/dist/exports/server.d.ts +6 -11
  72. package/dist/exports/server.d.ts.map +1 -1
  73. package/dist/exports/server.js +6 -11
  74. package/dist/exports/server.js.map +1 -1
  75. package/dist/{utilities/graphqlHandler.server.d.ts → routes/graphql/handler.server.d.ts} +1 -3
  76. package/dist/routes/graphql/handler.server.d.ts.map +1 -0
  77. package/dist/{utilities/graphqlHandler.server.js → routes/graphql/handler.server.js} +9 -6
  78. package/dist/routes/graphql/handler.server.js.map +1 -0
  79. package/dist/routes/rest/handler.server.d.ts +11 -0
  80. package/dist/routes/rest/handler.server.d.ts.map +1 -0
  81. package/dist/routes/rest/handler.server.js +14 -0
  82. package/dist/routes/rest/handler.server.js.map +1 -0
  83. package/dist/routes/{apiRoute.d.ts → rest/index.d.ts} +5 -4
  84. package/dist/routes/rest/index.d.ts.map +1 -0
  85. package/dist/routes/{apiRoute.js → rest/index.js} +6 -5
  86. package/dist/routes/rest/index.js.map +1 -0
  87. package/dist/rsc/CollectionCards.js +1 -1
  88. package/dist/rsc/CollectionCards.js.map +1 -1
  89. package/dist/utilities/devConfigReload.server.d.ts +2 -0
  90. package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
  91. package/dist/utilities/devConfigReload.server.js +61 -0
  92. package/dist/utilities/devConfigReload.server.js.map +1 -0
  93. package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
  94. package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
  95. package/dist/utilities/devConfigReloadEvent.js +9 -0
  96. package/dist/utilities/devConfigReloadEvent.js.map +1 -0
  97. package/dist/utilities/getRequestI18n.server.d.ts +1 -1
  98. package/dist/utilities/getRequestI18n.server.js +1 -1
  99. package/dist/utilities/getRequestI18n.server.js.map +1 -1
  100. package/dist/utilities/initAdminContext.server.d.ts +9 -0
  101. package/dist/utilities/initAdminContext.server.d.ts.map +1 -0
  102. package/dist/utilities/initAdminContext.server.js +13 -0
  103. package/dist/utilities/initAdminContext.server.js.map +1 -0
  104. package/dist/utilities/serverFunctionClient.d.ts +2 -23
  105. package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
  106. package/dist/utilities/serverFunctionClient.js +12 -101
  107. package/dist/utilities/serverFunctionClient.js.map +1 -1
  108. package/dist/withPayload/config/external.d.ts +19 -21
  109. package/dist/withPayload/config/external.d.ts.map +1 -1
  110. package/dist/withPayload/config/external.js +38 -32
  111. package/dist/withPayload/config/external.js.map +1 -1
  112. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -1
  113. package/dist/withPayload/config/optimizeDeps.js +44 -7
  114. package/dist/withPayload/config/optimizeDeps.js.map +1 -1
  115. package/dist/withPayload/devConfigReload.d.ts +14 -0
  116. package/dist/withPayload/devConfigReload.d.ts.map +1 -0
  117. package/dist/withPayload/devConfigReload.js +84 -0
  118. package/dist/withPayload/devConfigReload.js.map +1 -0
  119. package/dist/withPayload/importProtection.js +1 -1
  120. package/dist/withPayload/importProtection.js.map +1 -1
  121. package/dist/withPayload/index.d.ts +24 -11
  122. package/dist/withPayload/index.d.ts.map +1 -1
  123. package/dist/withPayload/index.js +50 -19
  124. package/dist/withPayload/index.js.map +1 -1
  125. package/dist/withPayload/workarounds/stripDistStyleImports.js +1 -1
  126. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -1
  127. package/package.json +35 -29
  128. package/dist/elements/RouterAdapter/index.d.ts.map +0 -1
  129. package/dist/elements/RouterAdapter/index.js.map +0 -1
  130. package/dist/layouts/Root/getLayoutData.d.ts +0 -34
  131. package/dist/layouts/Root/getLayoutData.d.ts.map +0 -1
  132. package/dist/layouts/Root/getLayoutData.js +0 -97
  133. package/dist/layouts/Root/getLayoutData.js.map +0 -1
  134. package/dist/layouts/Root/withPayloadRoot.d.ts.map +0 -1
  135. package/dist/layouts/Root/withPayloadRoot.js +0 -91
  136. package/dist/layouts/Root/withPayloadRoot.js.map +0 -1
  137. package/dist/node/cssLoader.d.mts +0 -25
  138. package/dist/node/cssLoader.d.mts.map +0 -1
  139. package/dist/node/cssLoader.js +0 -70
  140. package/dist/node/cssLoader.js.map +0 -1
  141. package/dist/node/cssLoader.mjs +0 -75
  142. package/dist/node/registerCssLoader.d.mts +0 -2
  143. package/dist/node/registerCssLoader.d.mts.map +0 -1
  144. package/dist/node/registerCssLoader.js +0 -10
  145. package/dist/node/registerCssLoader.js.map +0 -1
  146. package/dist/node/registerCssLoader.mjs +0 -10
  147. package/dist/routes/adminRoutes.d.ts.map +0 -1
  148. package/dist/routes/adminRoutes.js +0 -116
  149. package/dist/routes/adminRoutes.js.map +0 -1
  150. package/dist/routes/apiRoute.d.ts.map +0 -1
  151. package/dist/routes/apiRoute.js.map +0 -1
  152. package/dist/routes/layoutRoute.d.ts +0 -26
  153. package/dist/routes/layoutRoute.d.ts.map +0 -1
  154. package/dist/routes/layoutRoute.js +0 -58
  155. package/dist/routes/layoutRoute.js.map +0 -1
  156. package/dist/utilities/devReloadStrategy.d.ts +0 -10
  157. package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
  158. package/dist/utilities/devReloadStrategy.js +0 -27
  159. package/dist/utilities/devReloadStrategy.js.map +0 -1
  160. package/dist/utilities/getRequestLocale.d.ts +0 -7
  161. package/dist/utilities/getRequestLocale.d.ts.map +0 -1
  162. package/dist/utilities/getRequestLocale.js +0 -19
  163. package/dist/utilities/getRequestLocale.js.map +0 -1
  164. package/dist/utilities/graphqlHandler.server.d.ts.map +0 -1
  165. package/dist/utilities/graphqlHandler.server.js.map +0 -1
  166. package/dist/utilities/handleAPIRoute.server.d.ts +0 -11
  167. package/dist/utilities/handleAPIRoute.server.d.ts.map +0 -1
  168. package/dist/utilities/handleAPIRoute.server.js +0 -17
  169. package/dist/utilities/handleAPIRoute.server.js.map +0 -1
  170. package/dist/utilities/handleServerFunctions.d.ts +0 -2
  171. package/dist/utilities/handleServerFunctions.d.ts.map +0 -1
  172. package/dist/utilities/handleServerFunctions.js +0 -12
  173. package/dist/utilities/handleServerFunctions.js.map +0 -1
  174. package/dist/utilities/initReq.server.d.ts +0 -19
  175. package/dist/utilities/initReq.server.d.ts.map +0 -1
  176. package/dist/utilities/initReq.server.js +0 -87
  177. package/dist/utilities/initReq.server.js.map +0 -1
  178. package/dist/utilities/loadAdminPage.d.ts.map +0 -1
  179. package/dist/utilities/loadAdminPage.js.map +0 -1
  180. package/dist/utilities/loadLayoutData.d.ts +0 -15
  181. package/dist/utilities/loadLayoutData.d.ts.map +0 -1
  182. package/dist/utilities/loadLayoutData.js +0 -23
  183. package/dist/utilities/loadLayoutData.js.map +0 -1
  184. package/dist/utilities/meta.d.ts.map +0 -1
  185. package/dist/utilities/meta.js.map +0 -1
  186. package/dist/utilities/serializeForRsc.d.ts +0 -26
  187. package/dist/utilities/serializeForRsc.d.ts.map +0 -1
  188. package/dist/utilities/serializeForRsc.js +0 -122
  189. package/dist/utilities/serializeForRsc.js.map +0 -1
  190. package/dist/utilities/serverAdapter.server.d.ts.map +0 -1
  191. package/dist/utilities/serverAdapter.server.js.map +0 -1
  192. package/dist/utilities/toSerializable.d.ts +0 -2
  193. package/dist/utilities/toSerializable.d.ts.map +0 -1
  194. package/dist/utilities/toSerializable.js +0 -111
  195. package/dist/utilities/toSerializable.js.map +0 -1
@@ -1,70 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,75 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=registerCssLoader.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerCssLoader.d.mts","sourceRoot":"","sources":["../../src/node/registerCssLoader.mjs"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,10 +0,0 @@
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)
@@ -1 +0,0 @@
1
- {"version":3,"file":"adminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/adminRoutes.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAA;AAIlE;;;;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,gCAcjB;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;AA8CD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BAlC3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;QAOzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe;;6BAGQ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAkBjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BAzD3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;QAOzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe;;6BAGQ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAyCjD"}
@@ -1,116 +0,0 @@
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, useDeferredValue } 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
- // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.
25
- // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.
26
- const data = useLoaderData({
27
- strict: false
28
- });
29
- // The loader resolves as soon as the RSC wire data lands, but rendering the payload then
30
- // suspends while its client references are imported — code-split chunks in a production build.
31
- // Router state lives in an external store, so the transition TanStack wraps the commit in
32
- // de-opts to a synchronous render and that suspension hits the nearest fallback, which is
33
- // `null` unless a `pendingComponent` is configured — blanking the page. Deferring the payload
34
- // keeps the previous view painted until the new one is renderable, then swaps.
35
- const rscPayload = useDeferredValue(data?.rscPayload);
36
- return /*#__PURE__*/ _jsx(Fragment, {
37
- children: rscPayload
38
- });
39
- }
40
- function AdminNotFound(props) {
41
- const rscPayload = props?.data?.rscPayload;
42
- if (!rscPayload) {
43
- return /*#__PURE__*/ _jsx(NotFoundClient, {});
44
- }
45
- return /*#__PURE__*/ _jsx(Fragment, {
46
- children: rscPayload
47
- }, props?.data?.routeKey);
48
- }
49
- const adminRouteOptions = ({ forwardNotFoundPayload, load, resolveSplat })=>({
50
- component: AdminPage,
51
- head: ({ loaderData })=>getAdminMeta(loaderData?.metadata),
52
- // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a
53
- // sibling route option — router-core only reads it off a non-function loader)
54
- // makes stale-match revalidation await the fresh loader before committing,
55
- // instead of the default background SWR that flashes the pre-navigation list
56
- // (e.g. a just-created doc missing) until the reload lands.
57
- loader: {
58
- handler: async ({ location, params })=>{
59
- const data = await runLoader(load, resolveSplat(params), location.searchStr);
60
- if (data?._notFound) {
61
- // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects
62
- throw notFound(forwardNotFoundPayload ? {
63
- data: {
64
- routeKey: data.routeKey,
65
- rscPayload: data.rscPayload
66
- }
67
- } : undefined);
68
- }
69
- return data;
70
- },
71
- staleReloadMode: 'blocking'
72
- },
73
- // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.
74
- loaderDeps: ({ search })=>({
75
- searchKey: JSON.stringify(search)
76
- }),
77
- validateSearch: (search)=>search
78
- });
79
- /**
80
- * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's
81
- * server-built NotFound page (shipped via the `notFound()` error's
82
- * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare
83
- * client view.
84
- */ export function payloadAdminSplatRoute({ load }) {
85
- return {
86
- ...adminRouteOptions({
87
- forwardNotFoundPayload: true,
88
- load,
89
- resolveSplat: (params)=>params._splat ?? ''
90
- }),
91
- notFoundComponent: AdminNotFound
92
- };
93
- }
94
- /**
95
- * Route options for the admin index route (`/_payload/admin/`). Same loader as the
96
- * splat route but throws a bare `notFound()` (no rscPayload) on miss, so
97
- * `AdminNotFound` falls through to the bare client view.
98
- *
99
- * `notFoundComponent` must be set here even though the payload is never forwarded:
100
- * TanStack picks the boundary component from its presence (`routeNotFoundComponent ?
101
- * CatchNotFound : SafeFragment`), so leaving it off gives this route a different
102
- * component type than the splat route at the same position in the tree. Navigating
103
- * between the two would then unmount the whole admin subtree and remount it —
104
- * blanking the page for as long as the new view takes to render.
105
- */ export function payloadAdminIndexRoute({ load }) {
106
- return {
107
- ...adminRouteOptions({
108
- forwardNotFoundPayload: false,
109
- load,
110
- resolveSplat: ()=>''
111
- }),
112
- notFoundComponent: AdminNotFound
113
- };
114
- }
115
-
116
- //# sourceMappingURL=adminRoutes.js.map
@@ -1 +0,0 @@
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, useDeferredValue } 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 // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.\n // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.\n const data = useLoaderData({ strict: false })\n\n // The loader resolves as soon as the RSC wire data lands, but rendering the payload then\n // suspends while its client references are imported — code-split chunks in a production build.\n // Router state lives in an external store, so the transition TanStack wraps the commit in\n // de-opts to a synchronous render and that suspension hits the nearest fallback, which is\n // `null` unless a `pendingComponent` is configured — blanking the page. Deferring the payload\n // keeps the previous view painted until the new one is renderable, then swaps.\n const rscPayload = useDeferredValue(data?.rscPayload)\n\n return <Fragment>{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\nconst adminRouteOptions = ({\n forwardNotFoundPayload,\n load,\n resolveSplat,\n}: {\n /**\n * Ships the server-rendered NotFound tree through `notFound()`'s `data` so a\n * `notFoundComponent` can render it with the full admin chrome. Routes without\n * one throw bare.\n */\n forwardNotFoundPayload: boolean\n load: AdminLoad\n /** The route's splat, i.e. the path after `/admin/`. */\n resolveSplat: (params: any) => string\n}) => ({\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, resolveSplat(params), 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 forwardNotFoundPayload\n ? { data: { routeKey: data.routeKey, rscPayload: data.rscPayload } }\n : undefined,\n )\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 validateSearch: (search: Record<string, unknown>) => search,\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 ...adminRouteOptions({\n forwardNotFoundPayload: true,\n load,\n resolveSplat: (params) => params._splat ?? '',\n }),\n notFoundComponent: AdminNotFound,\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, so\n * `AdminNotFound` falls through to the bare client view.\n *\n * `notFoundComponent` must be set here even though the payload is never forwarded:\n * TanStack picks the boundary component from its presence (`routeNotFoundComponent ?\n * CatchNotFound : SafeFragment`), so leaving it off gives this route a different\n * component type than the splat route at the same position in the tree. Navigating\n * between the two would then unmount the whole admin subtree and remount it —\n * blanking the page for as long as the new view takes to render.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return {\n ...adminRouteOptions({\n forwardNotFoundPayload: false,\n load,\n resolveSplat: () => '',\n }),\n notFoundComponent: AdminNotFound,\n }\n}\n"],"names":["NotFoundClient","notFound","redirect","useLoaderData","Fragment","useDeferredValue","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","AdminNotFound","props","routeKey","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","loader","handler","location","params","_notFound","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","notFoundComponent","payloadAdminIndexRoute"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB;AAC1E,SAASC,QAAQ,EAAkBC,gBAAgB,QAAQ,QAAO;AAElE,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,MAAMhB,SAAS;YAAEiB,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,SAASK;IACP,+HAA+H;IAC/H,2HAA2H;IAC3H,MAAML,OAAOZ,cAAc;QAAEkB,QAAQ;IAAM;IAE3C,yFAAyF;IACzF,+FAA+F;IAC/F,0FAA0F;IAC1F,0FAA0F;IAC1F,8FAA8F;IAC9F,+EAA+E;IAC/E,MAAMC,aAAajB,iBAAiBU,MAAMO;IAE1C,qBAAO,KAAClB;kBAAUkB;;AACpB;AAEA,SAASC,cAAcC,KAA+D;IACpF,MAAMF,aAAaE,OAAOT,MAAMO;IAChC,IAAI,CAACA,YAAY;QACf,qBAAO,KAACtB;IACV;IACA,qBAAO,KAACI;kBAAsCkB;OAAxBE,OAAOT,MAAMU;AACrC;AAEA,MAAMC,oBAAoB,CAAC,EACzBC,sBAAsB,EACtBd,IAAI,EACJe,YAAY,EAWb,GAAM,CAAA;QACLC,WAAWT;QACXU,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKzB,aAAayB,YAAYC;QACzE,0EAA0E;QAC1E,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,4DAA4D;QAC5DC,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAEC,MAAM,EAAkC;gBAClE,MAAMrB,OAAO,MAAMH,UAAUC,MAAMe,aAAaQ,SAASD,SAAS3B,SAAS;gBAC3E,IAAIO,MAAMsB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMpC,SACJ0B,yBACI;wBAAEZ,MAAM;4BAAEU,UAAUV,KAAKU,QAAQ;4BAAEH,YAAYP,KAAKO,UAAU;wBAAC;oBAAE,IACjEgB;gBAER;gBACA,OAAOvB;YACT;YACAwB,iBAAiB;QACnB;QACA,2EAA2E;QAC3EC,YAAY,CAAC,EAAEvB,MAAM,EAAuC,GAAM,CAAA;gBAChEwB,WAAWC,KAAKC,SAAS,CAAC1B;YAC5B,CAAA;QACA2B,gBAAgB,CAAC3B,SAAoCA;IACvD,CAAA;AAEA;;;;;CAKC,GACD,OAAO,SAAS4B,uBAAuB,EAAEhC,IAAI,EAAuB;IAClE,OAAO;QACL,GAAGa,kBAAkB;YACnBC,wBAAwB;YACxBd;YACAe,cAAc,CAACQ,SAAWA,OAAOpB,MAAM,IAAI;QAC7C,EAAE;QACF8B,mBAAmBvB;IACrB;AACF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASwB,uBAAuB,EAAElC,IAAI,EAAuB;IAClE,OAAO;QACL,GAAGa,kBAAkB;YACnBC,wBAAwB;YACxBd;YACAe,cAAc,IAAM;QACtB,EAAE;QACFkB,mBAAmBvB;IACrB;AACF"}
@@ -1 +0,0 @@
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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"}
@@ -1 +0,0 @@
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 * Imported from `@payloadcms/tanstack-start/server` (not the root barrel) so\n * the server-only `handleAPIRoute` graph never reaches the client bundle.\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 * import { payloadApiHandlers } from '@payloadcms/tanstack-start/server'\n *\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.server.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;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,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"}
@@ -1,26 +0,0 @@
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
@@ -1 +0,0 @@
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;IAsCG,SAAS;IACT,MAAM;QAAI,OAAO;QAAgB,eAAe;;EAEnD"}
@@ -1,58 +0,0 @@
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
- embed: data.isEmbedded,
23
- fallbackLang: data.fallbackLang,
24
- highContrastMode: false,
25
- isNavOpen: data.isNavOpen,
26
- languageCode: data.languageCode,
27
- languageOptions: data.languageOptions,
28
- locale: data.locale,
29
- permissions: data.user ? data.permissions : null,
30
- RouterAdapter: TanStackRouterAdapter,
31
- serverFunction: serverFunction,
32
- theme: data.theme,
33
- translations: data.translations,
34
- user: data.user,
35
- children: [
36
- /*#__PURE__*/ _jsx(ProgressBar, {}),
37
- data.providers ?? /*#__PURE__*/ _jsx(Outlet, {})
38
- ]
39
- }),
40
- /*#__PURE__*/ _jsx("div", {
41
- id: "portal"
42
- })
43
- ]
44
- });
45
- }
46
- // `staleReloadMode` lives on the loader *object* — router-core only reads it
47
- // off a non-function loader — so stale-match revalidation blocks on the fresh
48
- // loader instead of flashing stale layout data via the default background SWR.
49
- return {
50
- component: PayloadLayout,
51
- loader: {
52
- handler: ()=>load(),
53
- staleReloadMode: 'blocking'
54
- }
55
- };
56
- }
57
-
58
- //# sourceMappingURL=layoutRoute.js.map
@@ -1 +0,0 @@
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 embed={data.isEmbedded}\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","embed","isEmbedded","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,OAAOL,KAAKM,UAAU;oBACtBC,cAAcP,KAAKO,YAAY;oBAC/BC,kBAAkB;oBAClBC,WAAWT,KAAKS,SAAS;oBACzBC,cAAcV,KAAKU,YAAY;oBAC/BC,iBAAiBX,KAAKW,eAAe;oBACrCC,QAAQZ,KAAKY,MAAM;oBACnBC,aAAab,KAAKc,IAAI,GAAGd,KAAKa,WAAW,GAAG;oBAC5CE,eAAepB;oBACfG,gBAAgBA;oBAChBkB,OAAOhB,KAAKgB,KAAK;oBACjBC,cAAcjB,KAAKiB,YAAY;oBAC/BH,MAAMd,KAAKc,IAAI;;sCAEf,KAACvB;wBAIAS,KAAKkB,SAAS,kBAAI,KAACzB;;;8BAEtB,KAAC0B;oBAAIC,IAAG;;;;IAGd;IAEA,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWtB;QACXuB,QAAQ;YAAEC,SAAS,IAAM1B;YAAQ2B,iBAAiB;QAAW;IAC/D;AACF"}
@@ -1,10 +0,0 @@
1
- import type { DevReloadStrategy } from 'payload';
2
- /**
3
- * Dev reload strategy for Vite (used by TanStack Start).
4
- *
5
- * Connects to Vite's HMR WebSocket and triggers a callback on full reloads.
6
- * In development, Vite sends HMR updates over a WebSocket connection at
7
- * the configured HMR path (defaults to root).
8
- */
9
- export declare const viteDevReloadStrategy: DevReloadStrategy;
10
- //# sourceMappingURL=devReloadStrategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devReloadStrategy.d.ts","sourceRoot":"","sources":["../../src/utilities/devReloadStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAuBnC,CAAA"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Dev reload strategy for Vite (used by TanStack Start).
3
- *
4
- * Connects to Vite's HMR WebSocket and triggers a callback on full reloads.
5
- * In development, Vite sends HMR updates over a WebSocket connection at
6
- * the configured HMR path (defaults to root).
7
- */ export const viteDevReloadStrategy = {
8
- connect: (onReload)=>{
9
- if (typeof window === 'undefined') {
10
- return ()=>{};
11
- }
12
- // Vite injects import.meta.hot in development builds
13
- const hot = import.meta.hot;
14
- if (!hot) {
15
- return ()=>{};
16
- }
17
- const handleUpdate = ()=>{
18
- onReload();
19
- };
20
- hot.on('vite:beforeFullReload', handleUpdate);
21
- return ()=>{
22
- hot.off('vite:beforeFullReload', handleUpdate);
23
- };
24
- }
25
- };
26
-
27
- //# sourceMappingURL=devReloadStrategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/devReloadStrategy.ts"],"sourcesContent":["import type { DevReloadStrategy } from 'payload'\n\n/**\n * Dev reload strategy for Vite (used by TanStack Start).\n *\n * Connects to Vite's HMR WebSocket and triggers a callback on full reloads.\n * In development, Vite sends HMR updates over a WebSocket connection at\n * the configured HMR path (defaults to root).\n */\nexport const viteDevReloadStrategy: DevReloadStrategy = {\n connect: (onReload) => {\n if (typeof window === 'undefined') {\n return () => {}\n }\n\n // Vite injects import.meta.hot in development builds\n const hot = (import.meta as unknown as { hot?: ViteHotContext }).hot\n\n if (!hot) {\n return () => {}\n }\n\n const handleUpdate = () => {\n onReload()\n }\n\n hot.on('vite:beforeFullReload', handleUpdate)\n\n return () => {\n hot.off('vite:beforeFullReload', handleUpdate)\n }\n },\n}\n\ntype ViteHotContext = {\n off: (event: string, cb: () => void) => void\n on: (event: string, cb: () => void) => void\n}\n"],"names":["viteDevReloadStrategy","connect","onReload","window","hot","handleUpdate","on","off"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,MAAMA,wBAA2C;IACtDC,SAAS,CAACC;QACR,IAAI,OAAOC,WAAW,aAAa;YACjC,OAAO,KAAO;QAChB;QAEA,qDAAqD;QACrD,MAAMC,MAAM,AAAC,YAAoDA,GAAG;QAEpE,IAAI,CAACA,KAAK;YACR,OAAO,KAAO;QAChB;QAEA,MAAMC,eAAe;YACnBH;QACF;QAEAE,IAAIE,EAAE,CAAC,yBAAyBD;QAEhC,OAAO;YACLD,IAAIG,GAAG,CAAC,yBAAyBF;QACnC;IACF;AACF,EAAC"}
@@ -1,7 +0,0 @@
1
- import type { Locale, PayloadRequest } from 'payload';
2
- type GetRequestLocaleArgs = {
3
- req: PayloadRequest;
4
- };
5
- export declare function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined>;
6
- export {};
7
- //# sourceMappingURL=getRequestLocale.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRequestLocale.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrD,KAAK,oBAAoB,GAAG;IAC1B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,wBAAsB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkCjG"}
@@ -1,19 +0,0 @@
1
- import { getPreferences, upsertPreferences } from '@payloadcms/ui/rsc';
2
- import { findLocaleFromCode } from '@payloadcms/ui/shared';
3
- export async function getRequestLocale({ req }) {
4
- if (req.payload.config.localization) {
5
- const localeFromParams = req.query.locale;
6
- if (req.user && localeFromParams) {
7
- await upsertPreferences({
8
- key: 'locale',
9
- req,
10
- value: localeFromParams
11
- });
12
- }
13
- const userLocale = req.user && findLocaleFromCode(req.payload.config.localization, localeFromParams || (await getPreferences('locale', req.payload, req.user.id, req.user.collection))?.value);
14
- return userLocale ?? findLocaleFromCode(req.payload.config.localization, req.payload.config.localization.defaultLocale || 'en') ?? undefined;
15
- }
16
- return undefined;
17
- }
18
-
19
- //# sourceMappingURL=getRequestLocale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/getRequestLocale.ts"],"sourcesContent":["import type { Locale, PayloadRequest } from 'payload'\n\nimport { getPreferences, upsertPreferences } from '@payloadcms/ui/rsc'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\n\ntype GetRequestLocaleArgs = {\n req: PayloadRequest\n}\n\nexport async function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined> {\n if (req.payload.config.localization) {\n const localeFromParams = req.query.locale as string | undefined\n\n if (req.user && localeFromParams) {\n await upsertPreferences<Locale['code']>({ key: 'locale', req, value: localeFromParams })\n }\n\n const userLocale =\n req.user &&\n findLocaleFromCode(\n req.payload.config.localization,\n localeFromParams ||\n (\n await getPreferences<Locale['code']>(\n 'locale',\n req.payload,\n req.user.id,\n req.user.collection,\n )\n )?.value,\n )\n\n return (\n userLocale ??\n findLocaleFromCode(\n req.payload.config.localization,\n req.payload.config.localization.defaultLocale || 'en',\n ) ??\n undefined\n )\n }\n\n return undefined\n}\n"],"names":["getPreferences","upsertPreferences","findLocaleFromCode","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","user","key","value","userLocale","id","collection","defaultLocale","undefined"],"mappings":"AAEA,SAASA,cAAc,EAAEC,iBAAiB,QAAQ,qBAAoB;AACtE,SAASC,kBAAkB,QAAQ,wBAAuB;AAM1D,OAAO,eAAeC,iBAAiB,EAAEC,GAAG,EAAwB;IAClE,IAAIA,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACnC,MAAMC,mBAAmBJ,IAAIK,KAAK,CAACC,MAAM;QAEzC,IAAIN,IAAIO,IAAI,IAAIH,kBAAkB;YAChC,MAAMP,kBAAkC;gBAAEW,KAAK;gBAAUR;gBAAKS,OAAOL;YAAiB;QACxF;QAEA,MAAMM,aACJV,IAAIO,IAAI,IACRT,mBACEE,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BC,oBAEI,CAAA,MAAMR,eACJ,UACAI,IAAIC,OAAO,EACXD,IAAIO,IAAI,CAACI,EAAE,EACXX,IAAIO,IAAI,CAACK,UAAU,CACrB,GACCH;QAGT,OACEC,cACAZ,mBACEE,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BH,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,CAACU,aAAa,IAAI,SAEnDC;IAEJ;IAEA,OAAOA;AACT"}
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/graphqlHandler.server.ts"],"sourcesContent":["import type { Payload, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport {\n addDataAndFileToRequest,\n addLocalesToRequestFromData,\n createPayloadRequest,\n headersWithCors,\n logError,\n mergeHeaders,\n} from 'payload'\n\nconst handleError = async ({\n err,\n payload,\n req,\n}: {\n err: any\n payload: Payload\n req: PayloadRequest\n}): Promise<any> => {\n const status = err.originalError?.status || 500\n let errorMessage = err.message\n logError({ err, payload })\n\n if (!payload.config.debug && status === 500) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: any = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && err.originalError.data) || undefined,\n stack: payload.config.debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n await payload.config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n context: req.context,\n error: err,\n graphqlResult: response,\n req,\n })\n\n if (result) {\n response = result.graphqlResult || response\n }\n }, Promise.resolve())\n\n return response\n}\n\nlet cached: { graphql: any; promise: null | Promise<any> } = { graphql: null, promise: null }\n\nconst getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n const graphqlPackage = '@payloadcms/graphql'\n const { configToSchema } = await import(/* @vite-ignore */ graphqlPackage)\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\n/**\n * Handles GraphQL HTTP requests for TanStack Start apps.\n * Mirrors the behaviour of `@payloadcms/next`'s GraphQL route handler.\n *\n * Requires `@payloadcms/graphql` and `graphql-http` to be installed in the consuming app.\n */\nexport const handleGraphQL = async ({\n config,\n request,\n}: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n request: Request\n}): Promise<Response> => {\n const originalRequest = request.clone()\n\n const req = await createPayloadRequest({\n canSetHeaders: true,\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const graphqlHttpHandlerPath = 'graphql-http/lib/use/fetch'\n const { createHandler } = await import(/* @vite-ignore */ graphqlHttpHandlerPath)\n\n const headers: Record<string, string> = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (_request: any, args: any, result: any) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: _request,\n result,\n })\n : result\n if (response.errors) {\n const errors = await Promise.all(\n response.errors.map((error: any) => {\n return handleError({ err: error, payload, req })\n }),\n )\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_: any, args: any, defaultRules: any) =>\n defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key of Object.keys(headers)) {\n resHeaders.append(key, headers[key]!)\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n}\n"],"names":["addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","logError","mergeHeaders","handleError","err","payload","req","status","originalError","errorMessage","message","config","debug","response","extensions","name","undefined","data","stack","statusCode","locations","path","hooks","afterError","reduce","promise","hook","result","context","error","graphqlResult","Promise","resolve","cached","graphql","getGraphql","process","env","NODE_ENV","resolvedConfig","graphqlPackage","configToSchema","schema","e","handleGraphQL","request","originalRequest","clone","canSetHeaders","validationRules","graphqlHttpHandlerPath","createHandler","headers","apiResponse","onOperation","_request","args","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","Object","keys","append","Response","body","responseHeaders"],"mappings":"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"}
@@ -1,11 +0,0 @@
1
- import type { SanitizedConfig } from 'payload';
2
- /**
3
- * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL
4
- * endpoint handler. The framework adapter wires this into the `/api/$` route's
5
- * server handlers, supplying the app's resolved `config`.
6
- */
7
- export declare function handleAPIRoute({ config, request, }: {
8
- config: SanitizedConfig;
9
- request: Request;
10
- }): Promise<Response>;
11
- //# sourceMappingURL=handleAPIRoute.server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleAPIRoute.server.d.ts","sourceRoot":"","sources":["../../src/utilities/handleAPIRoute.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAapB"}
@@ -1,17 +0,0 @@
1
- import { handleEndpoints } from 'payload';
2
- /**
3
- * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL
4
- * endpoint handler. The framework adapter wires this into the `/api/$` route's
5
- * server handlers, supplying the app's resolved `config`.
6
- */ export async function handleAPIRoute({ config, request }) {
7
- const url = new URL(request.url);
8
- const slugParts = url.pathname.replace(/^\/api\/?/, '').split('/').filter(Boolean);
9
- const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api';
10
- return handleEndpoints({
11
- config,
12
- path,
13
- request
14
- });
15
- }
16
-
17
- //# sourceMappingURL=handleAPIRoute.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/handleAPIRoute.server.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { handleEndpoints } from 'payload'\n\n/**\n * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL\n * endpoint handler. The framework adapter wires this into the `/api/$` route's\n * server handlers, supplying the app's resolved `config`.\n */\nexport async function handleAPIRoute({\n config,\n request,\n}: {\n config: SanitizedConfig\n request: Request\n}): Promise<Response> {\n const url = new URL(request.url)\n const slugParts = url.pathname\n .replace(/^\\/api\\/?/, '')\n .split('/')\n .filter(Boolean)\n const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api'\n\n return handleEndpoints({\n config,\n path,\n request,\n })\n}\n"],"names":["handleEndpoints","handleAPIRoute","config","request","url","URL","slugParts","pathname","replace","split","filter","Boolean","path","length","join"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAEzC;;;;CAIC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,OAAO,EAIR;IACC,MAAMC,MAAM,IAAIC,IAAIF,QAAQC,GAAG;IAC/B,MAAME,YAAYF,IAAIG,QAAQ,CAC3BC,OAAO,CAAC,aAAa,IACrBC,KAAK,CAAC,KACNC,MAAM,CAACC;IACV,MAAMC,OAAON,UAAUO,MAAM,GAAG,CAAC,KAAK,EAAEP,UAAUQ,IAAI,CAAC,MAAM,GAAG;IAEhE,OAAOd,gBAAgB;QACrBE;QACAU;QACAT;IACF;AACF"}
@@ -1,2 +0,0 @@
1
- export declare const handleServerFunctions: import("payload").ServerFunctionHandler;
2
- //# sourceMappingURL=handleServerFunctions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/handleServerFunctions.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,yCAGhC,CAAA"}