@payloadcms/tanstack-start 4.0.0-internal.656159a → 4.0.0-internal.697830c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
- package/dist/elements/RouterAdapter/index.js +2 -18
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/server.d.ts +2 -3
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +2 -3
- package/dist/exports/server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +1 -1
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/layouts/Root/index.js +2 -4
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +31 -7
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.js +34 -33
- package/dist/layouts/Root/withPayloadRoot.js.map +1 -1
- package/dist/node/cssLoader.d.mts +2 -24
- package/dist/node/cssLoader.d.mts.map +1 -1
- package/dist/routes/adminRoutes.d.ts.map +1 -1
- package/dist/routes/apiRoute.d.ts +0 -5
- package/dist/routes/apiRoute.d.ts.map +1 -1
- package/dist/routes/apiRoute.js +1 -6
- package/dist/routes/apiRoute.js.map +1 -1
- package/dist/routes/layoutRoute.d.ts.map +1 -1
- package/dist/utilities/getRequestTheme.d.ts +10 -0
- package/dist/utilities/getRequestTheme.d.ts.map +1 -0
- package/dist/utilities/getRequestTheme.js +25 -0
- package/dist/utilities/getRequestTheme.js.map +1 -0
- package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
- package/dist/utilities/{handleAPIRoute.server.d.ts → handleAPIRoute.d.ts} +1 -1
- package/dist/utilities/handleAPIRoute.d.ts.map +1 -0
- package/dist/utilities/{handleAPIRoute.server.js → handleAPIRoute.js} +1 -1
- package/dist/utilities/handleAPIRoute.js.map +1 -0
- package/dist/utilities/loadAdminPage.d.ts.map +1 -1
- package/dist/utilities/loadAdminPage.js +2 -11
- package/dist/utilities/loadAdminPage.js.map +1 -1
- package/dist/utilities/meta.d.ts +0 -1
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +1 -2
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
- package/dist/vite/config/external.d.ts +0 -21
- package/dist/vite/config/external.d.ts.map +1 -1
- package/dist/vite/config/external.js +1 -30
- package/dist/vite/config/external.js.map +1 -1
- package/dist/vite/index.d.ts +10 -28
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +29 -32
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/workarounds/devTransforms.d.ts.map +1 -1
- package/dist/vite/workarounds/devTransforms.js +0 -5
- package/dist/vite/workarounds/devTransforms.js.map +1 -1
- package/dist/vite/workarounds/stubPrettierInClient.d.ts +13 -5
- package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +1 -1
- package/dist/vite/workarounds/stubPrettierInClient.js +15 -8
- package/dist/vite/workarounds/stubPrettierInClient.js.map +1 -1
- package/package.json +7 -14
- package/dist/utilities/handleAPIRoute.server.d.ts.map +0 -1
- package/dist/utilities/handleAPIRoute.server.js.map +0 -1
- package/dist/utilities/routerSearch.d.ts +0 -40
- package/dist/utilities/routerSearch.d.ts.map +0 -1
- package/dist/utilities/routerSearch.js +0 -45
- package/dist/utilities/routerSearch.js.map +0 -1
package/dist/vite/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
// Optional peers, not deps: `plugin-rsc` is a singleton, so bundling our own copy
|
|
2
|
-
// alongside the host's would load two instances and crash.
|
|
3
1
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
4
2
|
import viteReact from '@vitejs/plugin-react';
|
|
5
3
|
import rsc from '@vitejs/plugin-rsc';
|
|
6
4
|
import path from 'node:path';
|
|
7
5
|
import { createLogger, mergeConfig } from 'vite';
|
|
8
|
-
import {
|
|
6
|
+
import { payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js';
|
|
9
7
|
import { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js';
|
|
10
8
|
import { payloadScssImporters } from './config/scss.js';
|
|
11
9
|
import { defaultImportProtectionIgnoreImporters, onImportProtectionViolation, serverOnlyClientSpecifiers } from './importProtection.js';
|
|
@@ -56,28 +54,28 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
56
54
|
* Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:
|
|
57
55
|
*
|
|
58
56
|
* ```ts
|
|
59
|
-
* export default withPayload(
|
|
57
|
+
* export default withPayload({ payloadConfigPath: './src/payload.config.ts' })
|
|
60
58
|
* ```
|
|
61
59
|
*
|
|
62
60
|
* Guest mode — pass a `build` callback to instantiate them yourself (one copy of
|
|
63
|
-
* each; `@vitejs/plugin-rsc` is a hard singleton)
|
|
64
|
-
* `withPayload` deep-merges them onto Payload's base config:
|
|
61
|
+
* each; `@vitejs/plugin-rsc` is a hard singleton):
|
|
65
62
|
*
|
|
66
63
|
* ```ts
|
|
67
64
|
* export default withPayload(
|
|
68
|
-
*
|
|
65
|
+
* { payloadConfigPath: './src/payload.config.ts' },
|
|
66
|
+
* ({ config, pluginOptions }) => ({
|
|
67
|
+
* ...config,
|
|
69
68
|
* plugins: [
|
|
69
|
+
* ...config.plugins,
|
|
70
70
|
* rsc(pluginOptions.rsc),
|
|
71
71
|
* tanstackStart(pluginOptions.tanstackStart),
|
|
72
72
|
* viteReact(pluginOptions.react),
|
|
73
73
|
* ],
|
|
74
|
-
* // ...other config options
|
|
75
74
|
* }),
|
|
76
|
-
* { payloadConfigPath: './src/payload.config.ts' },
|
|
77
75
|
* )
|
|
78
76
|
* ```
|
|
79
|
-
*/ export function withPayload(
|
|
80
|
-
const { additionalIgnoreImporters = [],
|
|
77
|
+
*/ export function withPayload(options, build) {
|
|
78
|
+
const { additionalIgnoreImporters = [], payloadConfigPath, routesDirectory = 'app', silenceDependencyWarnings = true, srcDirectory = 'src', vite } = options;
|
|
81
79
|
return (env)=>{
|
|
82
80
|
const base = {
|
|
83
81
|
build: {
|
|
@@ -101,7 +99,7 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
101
99
|
rsc: {
|
|
102
100
|
build: {
|
|
103
101
|
rollupOptions: {
|
|
104
|
-
external:
|
|
102
|
+
external: ssrExternalPackages
|
|
105
103
|
}
|
|
106
104
|
},
|
|
107
105
|
resolve: {
|
|
@@ -111,7 +109,7 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
111
109
|
ssr: {
|
|
112
110
|
build: {
|
|
113
111
|
rollupOptions: {
|
|
114
|
-
external:
|
|
112
|
+
external: ssrExternalPackages
|
|
115
113
|
}
|
|
116
114
|
},
|
|
117
115
|
resolve: {
|
|
@@ -169,17 +167,16 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
169
167
|
rsc: payloadRscOptions(),
|
|
170
168
|
tanstackStart: payloadTanstackStartOptions({
|
|
171
169
|
additionalIgnoreImporters,
|
|
172
|
-
adminRouteId,
|
|
173
|
-
clientDenialExcludeFiles,
|
|
174
170
|
routesDirectory,
|
|
175
171
|
srcDirectory
|
|
176
172
|
})
|
|
177
173
|
};
|
|
178
174
|
if (build) {
|
|
179
|
-
return applyDependencyWarningSuppression(
|
|
175
|
+
return applyDependencyWarningSuppression(build({
|
|
176
|
+
config: base,
|
|
180
177
|
env,
|
|
181
178
|
pluginOptions
|
|
182
|
-
})
|
|
179
|
+
}), silenceDependencyWarnings);
|
|
183
180
|
}
|
|
184
181
|
base.plugins = [
|
|
185
182
|
...base.plugins,
|
|
@@ -207,7 +204,7 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
207
204
|
* code-splitting). TanStack Start is one-per-app, so a host that already runs it
|
|
208
205
|
* should merge these into its single `tanstackStart` call.
|
|
209
206
|
*/ export function payloadTanstackStartOptions(args = {}) {
|
|
210
|
-
const { additionalIgnoreImporters = [],
|
|
207
|
+
const { additionalIgnoreImporters = [], routesDirectory = 'app', srcDirectory = 'src' } = args;
|
|
211
208
|
return {
|
|
212
209
|
importProtection: {
|
|
213
210
|
client: {
|
|
@@ -223,25 +220,25 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
|
|
|
223
220
|
],
|
|
224
221
|
mockAccess: 'warn',
|
|
225
222
|
onViolation: onImportProtectionViolation,
|
|
226
|
-
// Payload
|
|
227
|
-
// server-rendered during SSR
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
//
|
|
223
|
+
// Payload uses the `.client.*` suffix for React Client Components that must
|
|
224
|
+
// be server-rendered during SSR — its convention app-wide, including host
|
|
225
|
+
// code. TanStack's default rule denies `**/*.client.*` in the server
|
|
226
|
+
// environment (client-only semantics), which collides: it would mock those
|
|
227
|
+
// components and crash React. Filenames can't distinguish the two
|
|
228
|
+
// conventions, so disable the default `.client.*` denial entirely.
|
|
231
229
|
server: {
|
|
232
|
-
|
|
233
|
-
'**/node_modules/**',
|
|
234
|
-
...clientDenialExcludeFiles
|
|
235
|
-
]
|
|
230
|
+
files: []
|
|
236
231
|
}
|
|
237
232
|
},
|
|
233
|
+
// Disable per-route code-splitting so route components ship in the initial
|
|
234
|
+
// bundle and hydrate on first paint — otherwise the admin renders but isn't
|
|
235
|
+
// interactive until each lazy `?tsr-split=` chunk lands. `defaultBehavior:
|
|
236
|
+
// []` is the knob the splitter actually honours; `autoCodeSplitting: false`
|
|
237
|
+
// is a belt-and-braces signal (the plugin's schema strips it).
|
|
238
238
|
router: {
|
|
239
|
+
autoCodeSplitting: false,
|
|
239
240
|
codeSplittingOptions: {
|
|
240
|
-
|
|
241
|
-
// a split admin renders but isn't interactive until its lazy `?tsr-split=`
|
|
242
|
-
// chunk lands. Returning `[]` disables splitting for a route; `undefined`
|
|
243
|
-
// lets host routes keep TanStack's default per-route splitting.
|
|
244
|
-
splitBehavior: ({ routeId })=>routeId === adminRouteId || routeId.startsWith(`${adminRouteId}/`) ? [] : undefined
|
|
241
|
+
defaultBehavior: []
|
|
245
242
|
},
|
|
246
243
|
// Ignore generated importMap files and colocated `*.functions.ts` modules
|
|
247
244
|
// (they define `createServerFn`s, not routes).
|
package/dist/vite/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["import type { ConfigEnv, Logger, PluginOption, UserConfig, UserConfigFnObject } from 'vite'\n\n// Optional peers, not deps: `plugin-rsc` is a singleton, so bundling our own copy\n// alongside the host's would load two instances and crash.\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport rsc from '@vitejs/plugin-rsc'\nimport path from 'node:path'\nimport { createLogger, mergeConfig } from 'vite'\n\nimport {\n buildExternalPackages,\n payloadNoExternalPatterns,\n ssrExternalPackages,\n} from './config/external.js'\nimport { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js'\nimport { payloadScssImporters } from './config/scss.js'\nimport {\n defaultImportProtectionIgnoreImporters,\n onImportProtectionViolation,\n serverOnlyClientSpecifiers,\n} from './importProtection.js'\nimport { clientModuleResolution } from './workarounds/clientModuleResolution.js'\nimport { payloadDevTransforms } from './workarounds/devTransforms.js'\nimport { reactDomServerInRsc } from './workarounds/reactDomServerInRsc.js'\nimport { ssrStripDistStyleImports } from './workarounds/stripDistStyleImports.js'\nimport { stubPrettierInClient } from './workarounds/stubPrettierInClient.js'\nimport { wrapCjsForClient } from './workarounds/wrapCjsForClient.js'\n\n/**\n * Vite dependency warnings Payload consumers can't act on: third-party packages\n * ship sourcemaps whose original sources aren't published, so Vite warns on\n * every one. Suppressed by default (see `silenceDependencyWarnings`).\n */\nconst suppressibleWarningPatterns = ['points to missing source files', 'Sourcemap for']\n\n/**\n * Wraps a Vite logger so warnings matching {@link suppressibleWarningPatterns}\n * are dropped. Mutates and returns the given logger (or a fresh default one).\n */\nfunction withQuietedDependencyWarnings(existing?: Logger): Logger {\n const logger = existing ?? createLogger()\n const shouldSuppress = (msg: unknown): boolean =>\n typeof msg === 'string' && suppressibleWarningPatterns.some((pattern) => msg.includes(pattern))\n\n const baseWarn = logger.warn.bind(logger)\n const baseWarnOnce = logger.warnOnce.bind(logger)\n logger.warn = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarn(msg, options)\n }\n }\n logger.warnOnce = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarnOnce(msg, options)\n }\n }\n return logger\n}\n\n/** Applies dependency-warning suppression to a config in place when enabled. */\nfunction applyDependencyWarningSuppression(config: UserConfig, enabled: boolean): UserConfig {\n if (enabled) {\n config.customLogger = withQuietedDependencyWarnings(config.customLogger)\n }\n return config\n}\n\nexport type WithPayloadOptions = {\n /** Extra import-protection `ignoreImporters` patterns for the TanStack Start plugin. */\n additionalIgnoreImporters?: RegExp[]\n /** Route id of Payload's admin layout, eager-loaded instead of code-split. Defaults to `'/_payload'`. */\n adminRouteId?: string\n /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */\n clientDenialExcludeFiles?: string[]\n /** Path to the user's `payload.config.ts` (required) */\n payloadConfigPath: string\n /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */\n routesDirectory?: string\n /** Silence Vite warnings about third-party dependency sourcemaps. Defaults to `true`. */\n silenceDependencyWarnings?: boolean\n /** TanStack source directory. Defaults to `'src'` */\n srcDirectory?: string\n /** Extra Vite config deep-merged over the Payload defaults. Ignored in `build` mode. */\n vite?: UserConfig\n}\n\n/** The options Payload's admin requires for each third-party plugin. */\nexport type PayloadPluginOptions = {\n react: NonNullable<Parameters<typeof viteReact>[0]>\n rsc: NonNullable<Parameters<typeof rsc>[0]>\n tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>\n}\n\nexport type WithPayloadBuilderContext = {\n env: ConfigEnv\n /** Options to pass to the `viteReact`/`rsc`/`tanstackStart` factories you import. */\n pluginOptions: PayloadPluginOptions\n}\n\n/**\n * Returns the extra Vite config — the plugins you instantiate plus any overrides.\n * `withPayload` deep-merges it onto Payload's base config, so you don't spread or\n * merge the base yourself.\n */\nexport type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserConfig\n\n/**\n * Vite config helper for Payload + TanStack Start; the counterpart to Next.js'\n * `withPayload`.\n *\n * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:\n *\n * ```ts\n * export default withPayload(undefined, { payloadConfigPath: './src/payload.config.ts' })\n * ```\n *\n * Guest mode — pass a `build` callback to instantiate them yourself (one copy of\n * each; `@vitejs/plugin-rsc` is a hard singleton). Return only your additions;\n * `withPayload` deep-merges them onto Payload's base config:\n *\n * ```ts\n * export default withPayload(\n * ({ pluginOptions }) => ({\n * plugins: [\n * rsc(pluginOptions.rsc),\n * tanstackStart(pluginOptions.tanstackStart),\n * viteReact(pluginOptions.react),\n * ],\n * // ...other config options\n * }),\n * { payloadConfigPath: './src/payload.config.ts' },\n * )\n * ```\n */\nexport function withPayload(\n build: undefined | WithPayloadBuilder,\n options: WithPayloadOptions,\n): UserConfigFnObject {\n const {\n additionalIgnoreImporters = [],\n adminRouteId,\n clientDenialExcludeFiles = [],\n payloadConfigPath,\n routesDirectory = 'app',\n silenceDependencyWarnings = true,\n srcDirectory = 'src',\n vite,\n } = options\n\n return (env) => {\n const base: UserConfig = {\n build: {\n cssMinify: 'esbuild',\n },\n css: {\n preprocessorOptions: {\n scss: {\n importers: payloadScssImporters,\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\n },\n environments: {\n rsc: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: payloadNoExternalPatterns },\n },\n ssr: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: payloadNoExternalPatterns },\n },\n } as any,\n optimizeDeps: {\n exclude: optimizeDepsExcludeDefaults,\n include: optimizeDepsIncludeDefaults,\n },\n // Payload's internal workaround plugins only. The RSC, TanStack Start, and\n // React plugins are appended below (default form) or by the consumer's\n // `build` callback (guest form).\n plugins: [\n clientModuleResolution(),\n wrapCjsForClient(),\n ssrStripDistStyleImports(),\n reactDomServerInRsc(),\n stubPrettierInClient(),\n payloadDevTransforms(),\n ],\n resolve: {\n alias: [{ find: '@payload-config', replacement: path.resolve(payloadConfigPath) }],\n dedupe: [\n 'react',\n 'react-dom',\n 'scheduler',\n '@payloadcms/ui',\n '@payloadcms/richtext-lexical',\n ],\n extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],\n tsconfigPaths: true,\n } as any,\n ssr: {\n external: ssrExternalPackages,\n noExternal: payloadNoExternalPatterns,\n },\n }\n\n const pluginOptions: PayloadPluginOptions = {\n react: payloadReactOptions(),\n rsc: payloadRscOptions(),\n tanstackStart: payloadTanstackStartOptions({\n additionalIgnoreImporters,\n adminRouteId,\n clientDenialExcludeFiles,\n routesDirectory,\n srcDirectory,\n }),\n }\n\n if (build) {\n return applyDependencyWarningSuppression(\n mergeConfig(base, build({ env, pluginOptions })),\n silenceDependencyWarnings,\n )\n }\n\n base.plugins = [\n ...(base.plugins as PluginOption[]),\n rsc(pluginOptions.rsc),\n tanstackStart(pluginOptions.tanstackStart),\n viteReact(pluginOptions.react),\n ]\n\n const merged = vite ? mergeConfig(base, vite) : base\n\n return applyDependencyWarningSuppression(merged, silenceDependencyWarnings)\n }\n}\n\n/** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */\nexport function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]> {\n return { serverHandler: false }\n}\n\n/** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */\nexport function payloadReactOptions(): NonNullable<Parameters<typeof viteReact>[0]> {\n return { exclude: [], include: /\\.[jt]sx?$/ }\n}\n\nexport type PayloadTanstackStartOptionsArgs = {\n /** Additional import-protection `ignoreImporters` patterns. */\n additionalIgnoreImporters?: RegExp[]\n /**\n * Route id of Payload's admin layout route, eager-loaded (not code-split) so it\n * hydrates on first paint. It and its children skip splitting; host routes keep\n * TanStack's default. Defaults to `'/_payload'` (the `_payload.tsx` convention).\n */\n adminRouteId?: string\n /**\n * Extra globs exempted from TanStack's `.client.*` SSR denial, on top of the\n * default node_modules exemption. Needed only when Payload's own `.client.*`\n * files resolve outside node_modules (e.g. the monorepo's `packages` sources).\n */\n clientDenialExcludeFiles?: string[]\n /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'`. */\n routesDirectory?: string\n /** TanStack source directory. Defaults to `'src'`. */\n srcDirectory?: string\n}\n\n/**\n * The `tanstackStart` options Payload's admin requires (import-protection and\n * code-splitting). TanStack Start is one-per-app, so a host that already runs it\n * should merge these into its single `tanstackStart` call.\n */\nexport function payloadTanstackStartOptions(\n args: PayloadTanstackStartOptionsArgs = {},\n): NonNullable<Parameters<typeof tanstackStart>[0]> {\n const {\n additionalIgnoreImporters = [],\n adminRouteId = '/_payload',\n clientDenialExcludeFiles = [],\n routesDirectory = 'app',\n srcDirectory = 'src',\n } = args\n\n return {\n importProtection: {\n client: { excludeFiles: [], specifiers: serverOnlyClientSpecifiers },\n ignoreImporters: [...defaultImportProtectionIgnoreImporters, ...additionalIgnoreImporters],\n include: ['**/*'],\n mockAccess: 'warn',\n onViolation: onImportProtectionViolation,\n // Payload's `.client.*` components are React Client Components that must be\n // server-rendered during SSR; TanStack's default `**/*.client.*` server\n // denial would mock and crash them. All such files live in `@payloadcms/*`\n // packages, so keep the denial (host `.client.*` files still get it) and\n // just exempt Payload's — `node_modules` covers published installs.\n server: { excludeFiles: ['**/node_modules/**', ...clientDenialExcludeFiles] },\n },\n router: {\n codeSplittingOptions: {\n // Eager-load only Payload's admin routes so they hydrate on first paint —\n // a split admin renders but isn't interactive until its lazy `?tsr-split=`\n // chunk lands. Returning `[]` disables splitting for a route; `undefined`\n // lets host routes keep TanStack's default per-route splitting.\n splitBehavior: ({ routeId }: { routeId: string }) =>\n routeId === adminRouteId || routeId.startsWith(`${adminRouteId}/`) ? [] : undefined,\n },\n // Ignore generated importMap files and colocated `*.functions.ts` modules\n // (they define `createServerFn`s, not routes).\n routeFileIgnorePattern: 'importMap\\\\.(?:js|server\\\\.ts)$|\\\\.functions\\\\.',\n routesDirectory,\n } as any,\n rsc: { enabled: true },\n srcDirectory,\n }\n}\n"],"names":["tanstackStart","viteReact","rsc","path","createLogger","mergeConfig","buildExternalPackages","payloadNoExternalPatterns","ssrExternalPackages","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults","payloadScssImporters","defaultImportProtectionIgnoreImporters","onImportProtectionViolation","serverOnlyClientSpecifiers","clientModuleResolution","payloadDevTransforms","reactDomServerInRsc","ssrStripDistStyleImports","stubPrettierInClient","wrapCjsForClient","suppressibleWarningPatterns","withQuietedDependencyWarnings","existing","logger","shouldSuppress","msg","some","pattern","includes","baseWarn","warn","bind","baseWarnOnce","warnOnce","options","applyDependencyWarningSuppression","config","enabled","customLogger","withPayload","build","additionalIgnoreImporters","adminRouteId","clientDenialExcludeFiles","payloadConfigPath","routesDirectory","silenceDependencyWarnings","srcDirectory","vite","env","base","cssMinify","css","preprocessorOptions","scss","importers","silenceDeprecations","define","global","environments","rollupOptions","external","resolve","noExternal","ssr","optimizeDeps","exclude","include","plugins","alias","find","replacement","dedupe","extensions","tsconfigPaths","pluginOptions","react","payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","merged","serverHandler","args","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","router","codeSplittingOptions","splitBehavior","routeId","startsWith","undefined","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;gBAAEL,cAAc;oBAAC;uBAAyB1C;iBAAyB;YAAC;QAC9E;QACAgD,QAAQ;YACNC,sBAAsB;gBACpB,0EAA0E;gBAC1E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,gEAAgE;gBAChEC,eAAe,CAAC,EAAEC,OAAO,EAAuB,GAC9CA,YAAYpD,gBAAgBoD,QAAQC,UAAU,CAAC,GAAGrD,aAAa,CAAC,CAAC,IAAI,EAAE,GAAGsD;YAC9E;YACA,0EAA0E;YAC1E,+CAA+C;YAC/CC,wBAAwB;YACxBpD;QACF;QACA5C,KAAK;YAAEoC,SAAS;QAAK;QACrBU;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["import type { ConfigEnv, Logger, PluginOption, UserConfig, UserConfigFnObject } from 'vite'\n\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport rsc from '@vitejs/plugin-rsc'\nimport path from 'node:path'\nimport { createLogger, mergeConfig } from 'vite'\n\nimport { payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js'\nimport { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js'\nimport { payloadScssImporters } from './config/scss.js'\nimport {\n defaultImportProtectionIgnoreImporters,\n onImportProtectionViolation,\n serverOnlyClientSpecifiers,\n} from './importProtection.js'\nimport { clientModuleResolution } from './workarounds/clientModuleResolution.js'\nimport { payloadDevTransforms } from './workarounds/devTransforms.js'\nimport { reactDomServerInRsc } from './workarounds/reactDomServerInRsc.js'\nimport { ssrStripDistStyleImports } from './workarounds/stripDistStyleImports.js'\nimport { stubPrettierInClient } from './workarounds/stubPrettierInClient.js'\nimport { wrapCjsForClient } from './workarounds/wrapCjsForClient.js'\n\n/**\n * Vite dependency warnings Payload consumers can't act on: third-party packages\n * ship sourcemaps whose original sources aren't published, so Vite warns on\n * every one. Suppressed by default (see `silenceDependencyWarnings`).\n */\nconst suppressibleWarningPatterns = ['points to missing source files', 'Sourcemap for']\n\n/**\n * Wraps a Vite logger so warnings matching {@link suppressibleWarningPatterns}\n * are dropped. Mutates and returns the given logger (or a fresh default one).\n */\nfunction withQuietedDependencyWarnings(existing?: Logger): Logger {\n const logger = existing ?? createLogger()\n const shouldSuppress = (msg: unknown): boolean =>\n typeof msg === 'string' && suppressibleWarningPatterns.some((pattern) => msg.includes(pattern))\n\n const baseWarn = logger.warn.bind(logger)\n const baseWarnOnce = logger.warnOnce.bind(logger)\n logger.warn = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarn(msg, options)\n }\n }\n logger.warnOnce = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarnOnce(msg, options)\n }\n }\n return logger\n}\n\n/** Applies dependency-warning suppression to a config in place when enabled. */\nfunction applyDependencyWarningSuppression(config: UserConfig, enabled: boolean): UserConfig {\n if (enabled) {\n config.customLogger = withQuietedDependencyWarnings(config.customLogger)\n }\n return config\n}\n\nexport type WithPayloadOptions = {\n /** Extra import-protection `ignoreImporters` patterns for the TanStack Start plugin. */\n additionalIgnoreImporters?: RegExp[]\n /** Path to the user's `payload.config.ts` (required) */\n payloadConfigPath: string\n /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */\n routesDirectory?: string\n /** Silence Vite warnings about third-party dependency sourcemaps. Defaults to `true`. */\n silenceDependencyWarnings?: boolean\n /** TanStack source directory. Defaults to `'src'` */\n srcDirectory?: string\n /** Extra Vite config deep-merged over the Payload defaults. Ignored in `build` mode. */\n vite?: UserConfig\n}\n\n/** The options Payload's admin requires for each third-party plugin. */\nexport type PayloadPluginOptions = {\n react: NonNullable<Parameters<typeof viteReact>[0]>\n rsc: NonNullable<Parameters<typeof rsc>[0]>\n tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>\n}\n\nexport type WithPayloadBuilderContext = {\n /** Payload's base Vite config; `plugins` holds Payload's workaround plugins only. */\n config: UserConfig\n env: ConfigEnv\n /** Options to pass to the `viteReact`/`rsc`/`tanstackStart` factories you import. */\n pluginOptions: PayloadPluginOptions\n}\n\n/** Assembles the final Vite config from Payload's base config and plugin options. */\nexport type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserConfig\n\n/**\n * Vite config helper for Payload + TanStack Start; the counterpart to Next.js'\n * `withPayload`.\n *\n * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:\n *\n * ```ts\n * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })\n * ```\n *\n * Guest mode — pass a `build` callback to instantiate them yourself (one copy of\n * each; `@vitejs/plugin-rsc` is a hard singleton):\n *\n * ```ts\n * export default withPayload(\n * { payloadConfigPath: './src/payload.config.ts' },\n * ({ config, pluginOptions }) => ({\n * ...config,\n * plugins: [\n * ...config.plugins,\n * rsc(pluginOptions.rsc),\n * tanstackStart(pluginOptions.tanstackStart),\n * viteReact(pluginOptions.react),\n * ],\n * }),\n * )\n * ```\n */\nexport function withPayload(\n options: WithPayloadOptions,\n build?: WithPayloadBuilder,\n): UserConfigFnObject {\n const {\n additionalIgnoreImporters = [],\n payloadConfigPath,\n routesDirectory = 'app',\n silenceDependencyWarnings = true,\n srcDirectory = 'src',\n vite,\n } = options\n\n return (env) => {\n const base: UserConfig = {\n build: {\n cssMinify: 'esbuild',\n },\n css: {\n preprocessorOptions: {\n scss: {\n importers: payloadScssImporters,\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\n },\n environments: {\n rsc: {\n build: { rollupOptions: { external: ssrExternalPackages } },\n resolve: { noExternal: payloadNoExternalPatterns },\n },\n ssr: {\n build: { rollupOptions: { external: ssrExternalPackages } },\n resolve: { noExternal: payloadNoExternalPatterns },\n },\n } as any,\n optimizeDeps: {\n exclude: optimizeDepsExcludeDefaults,\n include: optimizeDepsIncludeDefaults,\n },\n // Payload's internal workaround plugins only. The RSC, TanStack Start, and\n // React plugins are appended below (default form) or by the consumer's\n // `build` callback (guest form).\n plugins: [\n clientModuleResolution(),\n wrapCjsForClient(),\n ssrStripDistStyleImports(),\n reactDomServerInRsc(),\n stubPrettierInClient(),\n payloadDevTransforms(),\n ],\n resolve: {\n alias: [{ find: '@payload-config', replacement: path.resolve(payloadConfigPath) }],\n dedupe: [\n 'react',\n 'react-dom',\n 'scheduler',\n '@payloadcms/ui',\n '@payloadcms/richtext-lexical',\n ],\n extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],\n tsconfigPaths: true,\n } as any,\n ssr: {\n external: ssrExternalPackages,\n noExternal: payloadNoExternalPatterns,\n },\n }\n\n const pluginOptions: PayloadPluginOptions = {\n react: payloadReactOptions(),\n rsc: payloadRscOptions(),\n tanstackStart: payloadTanstackStartOptions({\n additionalIgnoreImporters,\n routesDirectory,\n srcDirectory,\n }),\n }\n\n if (build) {\n return applyDependencyWarningSuppression(\n build({ config: base, env, pluginOptions }),\n silenceDependencyWarnings,\n )\n }\n\n base.plugins = [\n ...(base.plugins as PluginOption[]),\n rsc(pluginOptions.rsc),\n tanstackStart(pluginOptions.tanstackStart),\n viteReact(pluginOptions.react),\n ]\n\n const merged = vite ? mergeConfig(base, vite) : base\n\n return applyDependencyWarningSuppression(merged, silenceDependencyWarnings)\n }\n}\n\n/** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */\nexport function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]> {\n return { serverHandler: false }\n}\n\n/** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */\nexport function payloadReactOptions(): NonNullable<Parameters<typeof viteReact>[0]> {\n return { exclude: [], include: /\\.[jt]sx?$/ }\n}\n\nexport type PayloadTanstackStartOptionsArgs = {\n /** Additional import-protection `ignoreImporters` patterns. */\n additionalIgnoreImporters?: RegExp[]\n /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'`. */\n routesDirectory?: string\n /** TanStack source directory. Defaults to `'src'`. */\n srcDirectory?: string\n}\n\n/**\n * The `tanstackStart` options Payload's admin requires (import-protection and\n * code-splitting). TanStack Start is one-per-app, so a host that already runs it\n * should merge these into its single `tanstackStart` call.\n */\nexport function payloadTanstackStartOptions(\n args: PayloadTanstackStartOptionsArgs = {},\n): NonNullable<Parameters<typeof tanstackStart>[0]> {\n const { additionalIgnoreImporters = [], routesDirectory = 'app', srcDirectory = 'src' } = args\n\n return {\n importProtection: {\n client: { excludeFiles: [], specifiers: serverOnlyClientSpecifiers },\n ignoreImporters: [...defaultImportProtectionIgnoreImporters, ...additionalIgnoreImporters],\n include: ['**/*'],\n mockAccess: 'warn',\n onViolation: onImportProtectionViolation,\n // Payload uses the `.client.*` suffix for React Client Components that must\n // be server-rendered during SSR — its convention app-wide, including host\n // code. TanStack's default rule denies `**/*.client.*` in the server\n // environment (client-only semantics), which collides: it would mock those\n // components and crash React. Filenames can't distinguish the two\n // conventions, so disable the default `.client.*` denial entirely.\n server: { files: [] },\n },\n // Disable per-route code-splitting so route components ship in the initial\n // bundle and hydrate on first paint — otherwise the admin renders but isn't\n // interactive until each lazy `?tsr-split=` chunk lands. `defaultBehavior:\n // []` is the knob the splitter actually honours; `autoCodeSplitting: false`\n // is a belt-and-braces signal (the plugin's schema strips it).\n router: {\n autoCodeSplitting: false,\n codeSplittingOptions: { defaultBehavior: [] },\n // Ignore generated importMap files and colocated `*.functions.ts` modules\n // (they define `createServerFn`s, not routes).\n routeFileIgnorePattern: 'importMap\\\\.(?:js|server\\\\.ts)$|\\\\.functions\\\\.',\n routesDirectory,\n } as any,\n rsc: { enabled: true },\n srcDirectory,\n }\n}\n"],"names":["tanstackStart","viteReact","rsc","path","createLogger","mergeConfig","payloadNoExternalPatterns","ssrExternalPackages","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults","payloadScssImporters","defaultImportProtectionIgnoreImporters","onImportProtectionViolation","serverOnlyClientSpecifiers","clientModuleResolution","payloadDevTransforms","reactDomServerInRsc","ssrStripDistStyleImports","stubPrettierInClient","wrapCjsForClient","suppressibleWarningPatterns","withQuietedDependencyWarnings","existing","logger","shouldSuppress","msg","some","pattern","includes","baseWarn","warn","bind","baseWarnOnce","warnOnce","options","applyDependencyWarningSuppression","config","enabled","customLogger","withPayload","build","additionalIgnoreImporters","payloadConfigPath","routesDirectory","silenceDependencyWarnings","srcDirectory","vite","env","base","cssMinify","css","preprocessorOptions","scss","importers","silenceDeprecations","define","global","environments","rollupOptions","external","resolve","noExternal","ssr","optimizeDeps","exclude","include","plugins","alias","find","replacement","dedupe","extensions","tsconfigPaths","pluginOptions","react","payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","merged","serverHandler","args","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","files","router","autoCodeSplitting","codeSplittingOptions","defaultBehavior","routeFileIgnorePattern"],"mappings":"AAEA,SAASA,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,eAAe,uBAAsB;AAC5C,OAAOC,SAAS,qBAAoB;AACpC,OAAOC,UAAU,YAAW;AAC5B,SAASC,YAAY,EAAEC,WAAW,QAAQ,OAAM;AAEhD,SAASC,yBAAyB,EAAEC,mBAAmB,QAAQ,uBAAsB;AACrF,SAASC,2BAA2B,EAAEC,2BAA2B,QAAQ,2BAA0B;AACnG,SAASC,oBAAoB,QAAQ,mBAAkB;AACvD,SACEC,sCAAsC,EACtCC,2BAA2B,EAC3BC,0BAA0B,QACrB,wBAAuB;AAC9B,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,SAASC,oBAAoB,QAAQ,iCAAgC;AACrE,SAASC,mBAAmB,QAAQ,uCAAsC;AAC1E,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,oBAAoB,QAAQ,wCAAuC;AAC5E,SAASC,gBAAgB,QAAQ,oCAAmC;AAEpE;;;;CAIC,GACD,MAAMC,8BAA8B;IAAC;IAAkC;CAAgB;AAEvF;;;CAGC,GACD,SAASC,8BAA8BC,QAAiB;IACtD,MAAMC,SAASD,YAAYlB;IAC3B,MAAMoB,iBAAiB,CAACC,MACtB,OA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K,EAAEE,eAAe,KAAK,EAAE,GAAGmC;IAE1F,OAAO;QACLC,kBAAkB;YAChBC,QAAQ;gBAAEC,cAAc,EAAE;gBAAEC,YAAYvE;YAA2B;YACnEwE,iBAAiB;mBAAI1E;mBAA2C8B;aAA0B;YAC1FwB,SAAS;gBAAC;aAAO;YACjBqB,YAAY;YACZC,aAAa3E;YACb,4EAA4E;YAC5E,0EAA0E;YAC1E,qEAAqE;YACrE,2EAA2E;YAC3E,kEAAkE;YAClE,mEAAmE;YACnE4E,QAAQ;gBAAEC,OAAO,EAAE;YAAC;QACtB;QACA,2EAA2E;QAC3E,4EAA4E;QAC5E,2EAA2E;QAC3E,4EAA4E;QAC5E,+DAA+D;QAC/DC,QAAQ;YACNC,mBAAmB;YACnBC,sBAAsB;gBAAEC,iBAAiB,EAAE;YAAC;YAC5C,0EAA0E;YAC1E,+CAA+C;YAC/CC,wBAAwB;YACxBnD;QACF;QACAzC,KAAK;YAAEmC,SAAS;QAAK;QACrBQ;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devTransforms.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/devTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"devTransforms.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/devTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CA2DnD"}
|
|
@@ -38,11 +38,6 @@ window.__vite_plugin_react_preamble_installed__ = true
|
|
|
38
38
|
return chunk;
|
|
39
39
|
}
|
|
40
40
|
const str = typeof chunk === 'string' ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : chunk instanceof Uint8Array ? Buffer.from(chunk).toString() : null;
|
|
41
|
-
// Skip if a host already injected the preamble — a second copy breaks HMR.
|
|
42
|
-
if (str && str.includes('__vite_plugin_react_preamble_installed__')) {
|
|
43
|
-
injected = true;
|
|
44
|
-
return chunk;
|
|
45
|
-
}
|
|
46
41
|
if (str && str.includes('</head>')) {
|
|
47
42
|
injected = true;
|
|
48
43
|
return str.replace('</head>', `${devScripts}</head>`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/workarounds/devTransforms.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Dev-time transforms:\n * - Replaces `process.cwd()` with `\"/\"` in client code (non-SSR, non-prebundled)\n * - Injects Vite HMR + React Refresh preamble into SSR-rendered HTML (dev only)\n *\n * The preamble is injected just before `</head>`, *after* everything React\n * renders into the head. React 19 treats `<meta>`/`<link>`/`<style>`/`<title>`\n * as hoistable resources it matches by key (position-tolerant), but a\n * non-hoistable inline `<script type=\"module\">` placed *before* React's first\n * rendered head node makes hydration position-match that script against a\n * `<style>`/`<meta>` and throw — discarding the whole tree client-side, which\n * aborts in-flight server-function fetches and intermittently breaks drawers,\n * forms, and navigation. Appending after React's head content keeps the\n * preamble out of that positional comparison while still running before the\n * body's app-entry module.\n */\nexport function payloadDevTransforms(): PluginOption {\n const devScripts = `<script type=\"module\" src=\"/@vite/client\"></script>\n<script type=\"module\">\nimport RefreshRuntime from \"/@react-refresh\"\nRefreshRuntime.injectIntoGlobalHook(window)\nwindow.$RefreshReg$ = () => {}\nwindow.$RefreshSig$ = () => (type) => type\nwindow.__vite_plugin_react_preamble_installed__ = true\n</script>`\n\n return {\n name: 'payload:dev-transforms',\n configureServer(server) {\n server.middlewares.use((_req, res, next) => {\n let injected = false\n const origWrite = res.write\n const origEnd = res.end\n\n function tryInject(chunk: any): any {\n if (injected || chunk == null) {\n return chunk\n }\n const ct = res.getHeader('content-type')\n if (typeof ct !== 'string' || !ct.includes('text/html')) {\n return chunk\n }\n const str =\n typeof chunk === 'string'\n ? chunk\n : Buffer.isBuffer(chunk)\n ? chunk.toString()\n : chunk instanceof Uint8Array\n ? Buffer.from(chunk).toString()\n : null\n
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/workarounds/devTransforms.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Dev-time transforms:\n * - Replaces `process.cwd()` with `\"/\"` in client code (non-SSR, non-prebundled)\n * - Injects Vite HMR + React Refresh preamble into SSR-rendered HTML (dev only)\n *\n * The preamble is injected just before `</head>`, *after* everything React\n * renders into the head. React 19 treats `<meta>`/`<link>`/`<style>`/`<title>`\n * as hoistable resources it matches by key (position-tolerant), but a\n * non-hoistable inline `<script type=\"module\">` placed *before* React's first\n * rendered head node makes hydration position-match that script against a\n * `<style>`/`<meta>` and throw — discarding the whole tree client-side, which\n * aborts in-flight server-function fetches and intermittently breaks drawers,\n * forms, and navigation. Appending after React's head content keeps the\n * preamble out of that positional comparison while still running before the\n * body's app-entry module.\n */\nexport function payloadDevTransforms(): PluginOption {\n const devScripts = `<script type=\"module\" src=\"/@vite/client\"></script>\n<script type=\"module\">\nimport RefreshRuntime from \"/@react-refresh\"\nRefreshRuntime.injectIntoGlobalHook(window)\nwindow.$RefreshReg$ = () => {}\nwindow.$RefreshSig$ = () => (type) => type\nwindow.__vite_plugin_react_preamble_installed__ = true\n</script>`\n\n return {\n name: 'payload:dev-transforms',\n configureServer(server) {\n server.middlewares.use((_req, res, next) => {\n let injected = false\n const origWrite = res.write\n const origEnd = res.end\n\n function tryInject(chunk: any): any {\n if (injected || chunk == null) {\n return chunk\n }\n const ct = res.getHeader('content-type')\n if (typeof ct !== 'string' || !ct.includes('text/html')) {\n return chunk\n }\n const str =\n typeof chunk === 'string'\n ? chunk\n : Buffer.isBuffer(chunk)\n ? chunk.toString()\n : chunk instanceof Uint8Array\n ? Buffer.from(chunk).toString()\n : null\n if (str && str.includes('</head>')) {\n injected = true\n return str.replace('</head>', `${devScripts}</head>`)\n }\n return chunk\n }\n\n res.write = function (this: any, chunk: any, encodingOrCb?: any, cb?: any) {\n return origWrite.call(this, tryInject(chunk), encodingOrCb, cb)\n } as typeof res.write\n res.end = function (this: any, chunk?: any, encodingOrCb?: any, cb?: any) {\n return origEnd.call(this, tryInject(chunk), encodingOrCb, cb)\n } as typeof res.end\n next()\n })\n },\n transform(code, id, options) {\n if (options?.ssr) {\n return\n }\n if (code.includes('process.cwd') && !id.includes('node_modules/.vite')) {\n return code.replace(/process\\.cwd\\(\\)/g, '\"/\"')\n }\n },\n }\n}\n"],"names":["payloadDevTransforms","devScripts","name","configureServer","server","middlewares","use","_req","res","next","injected","origWrite","write","origEnd","end","tryInject","chunk","ct","getHeader","includes","str","Buffer","isBuffer","toString","Uint8Array","from","replace","encodingOrCb","cb","call","transform","code","id","options","ssr"],"mappings":"AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASA;IACd,MAAMC,aAAa,CAAC;;;;;;;SAOb,CAAC;IAER,OAAO;QACLC,MAAM;QACNC,iBAAgBC,MAAM;YACpBA,OAAOC,WAAW,CAACC,GAAG,CAAC,CAACC,MAAMC,KAAKC;gBACjC,IAAIC,WAAW;gBACf,MAAMC,YAAYH,IAAII,KAAK;gBAC3B,MAAMC,UAAUL,IAAIM,GAAG;gBAEvB,SAASC,UAAUC,KAAU;oBAC3B,IAAIN,YAAYM,SAAS,MAAM;wBAC7B,OAAOA;oBACT;oBACA,MAAMC,KAAKT,IAAIU,SAAS,CAAC;oBACzB,IAAI,OAAOD,OAAO,YAAY,CAACA,GAAGE,QAAQ,CAAC,cAAc;wBACvD,OAAOH;oBACT;oBACA,MAAMI,MACJ,OAAOJ,UAAU,WACbA,QACAK,OAAOC,QAAQ,CAACN,SACdA,MAAMO,QAAQ,KACdP,iBAAiBQ,aACfH,OAAOI,IAAI,CAACT,OAAOO,QAAQ,KAC3B;oBACV,IAAIH,OAAOA,IAAID,QAAQ,CAAC,YAAY;wBAClCT,WAAW;wBACX,OAAOU,IAAIM,OAAO,CAAC,WAAW,GAAGzB,WAAW,OAAO,CAAC;oBACtD;oBACA,OAAOe;gBACT;gBAEAR,IAAII,KAAK,GAAG,SAAqBI,KAAU,EAAEW,YAAkB,EAAEC,EAAQ;oBACvE,OAAOjB,UAAUkB,IAAI,CAAC,IAAI,EAAEd,UAAUC,QAAQW,cAAcC;gBAC9D;gBACApB,IAAIM,GAAG,GAAG,SAAqBE,KAAW,EAAEW,YAAkB,EAAEC,EAAQ;oBACtE,OAAOf,QAAQgB,IAAI,CAAC,IAAI,EAAEd,UAAUC,QAAQW,cAAcC;gBAC5D;gBACAnB;YACF;QACF;QACAqB,WAAUC,IAAI,EAAEC,EAAE,EAAEC,OAAO;YACzB,IAAIA,SAASC,KAAK;gBAChB;YACF;YACA,IAAIH,KAAKZ,QAAQ,CAAC,kBAAkB,CAACa,GAAGb,QAAQ,CAAC,uBAAuB;gBACtE,OAAOY,KAAKL,OAAO,CAAC,qBAAqB;YAC3C;QACF;IACF;AACF"}
|
|
@@ -2,12 +2,20 @@ import type { PluginOption } from 'vite';
|
|
|
2
2
|
/**
|
|
3
3
|
* Stubs `prettier` in the CLIENT bundle only.
|
|
4
4
|
*
|
|
5
|
-
* `payload`'s barrel transitively pulls `
|
|
6
|
-
* (CommonJS) into the client
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* `payload`'s barrel transitively pulls `configToJSONSchema` →
|
|
6
|
+
* `json-schema-to-typescript` → `prettier` (CommonJS) into the client module
|
|
7
|
+
* graph through re-export side effects. That path is type-generation only
|
|
8
|
+
* (`payload generate:types`) and never runs in the browser, but the bundler
|
|
9
|
+
* still drags `prettier`'s `index.cjs` in — where it fails to parse as ESM and
|
|
10
|
+
* breaks the client build.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
12
|
+
* We redirect `prettier` to a no-op `format` stub in the client environment
|
|
13
|
+
* only. SSR/RSC keep the real `prettier` (there `json-schema-to-typescript`
|
|
14
|
+
* stays external and resolves it from `node_modules`), and the `prettier` CLI /
|
|
15
|
+
* `payload generate:types` are unaffected.
|
|
16
|
+
*
|
|
17
|
+
* Delete this once `payload`'s barrel no longer reaches the type-gen path from
|
|
18
|
+
* the client-reachable export graph.
|
|
11
19
|
*/
|
|
12
20
|
export declare function stubPrettierInClient(): PluginOption;
|
|
13
21
|
//# sourceMappingURL=stubPrettierInClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubPrettierInClient.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC
|
|
1
|
+
{"version":3,"file":"stubPrettierInClient.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CAoBnD"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stubs `prettier` in the CLIENT bundle only.
|
|
3
3
|
*
|
|
4
|
-
* `payload`'s barrel transitively pulls `
|
|
5
|
-
* (CommonJS) into the client
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* `payload`'s barrel transitively pulls `configToJSONSchema` →
|
|
5
|
+
* `json-schema-to-typescript` → `prettier` (CommonJS) into the client module
|
|
6
|
+
* graph through re-export side effects. That path is type-generation only
|
|
7
|
+
* (`payload generate:types`) and never runs in the browser, but the bundler
|
|
8
|
+
* still drags `prettier`'s `index.cjs` in — where it fails to parse as ESM and
|
|
9
|
+
* breaks the client build.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
11
|
+
* We redirect `prettier` to a no-op `format` stub in the client environment
|
|
12
|
+
* only. SSR/RSC keep the real `prettier` (there `json-schema-to-typescript`
|
|
13
|
+
* stays external and resolves it from `node_modules`), and the `prettier` CLI /
|
|
14
|
+
* `payload generate:types` are unaffected.
|
|
15
|
+
*
|
|
16
|
+
* Delete this once `payload`'s barrel no longer reaches the type-gen path from
|
|
17
|
+
* the client-reachable export graph.
|
|
10
18
|
*/ export function stubPrettierInClient() {
|
|
11
19
|
const RESOLVED_ID = '\0payload:prettier-client-stub';
|
|
12
20
|
return {
|
|
@@ -17,12 +25,11 @@
|
|
|
17
25
|
return 'export const format = (source) => source;\nexport default { format };';
|
|
18
26
|
}
|
|
19
27
|
},
|
|
20
|
-
resolveId (id,
|
|
28
|
+
resolveId (id, _importer, options) {
|
|
21
29
|
if (options?.ssr) {
|
|
22
30
|
return;
|
|
23
31
|
}
|
|
24
|
-
|
|
25
|
-
if (id === 'prettier' && importer?.includes('json-schema-to-typescript')) {
|
|
32
|
+
if (id === 'prettier') {
|
|
26
33
|
return RESOLVED_ID;
|
|
27
34
|
}
|
|
28
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Stubs `prettier` in the CLIENT bundle only.\n *\n * `payload`'s barrel transitively pulls `json-schema-to-typescript` → `prettier
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Stubs `prettier` in the CLIENT bundle only.\n *\n * `payload`'s barrel transitively pulls `configToJSONSchema` →\n * `json-schema-to-typescript` → `prettier` (CommonJS) into the client module\n * graph through re-export side effects. That path is type-generation only\n * (`payload generate:types`) and never runs in the browser, but the bundler\n * still drags `prettier`'s `index.cjs` in — where it fails to parse as ESM and\n * breaks the client build.\n *\n * We redirect `prettier` to a no-op `format` stub in the client environment\n * only. SSR/RSC keep the real `prettier` (there `json-schema-to-typescript`\n * stays external and resolves it from `node_modules`), and the `prettier` CLI /\n * `payload generate:types` are unaffected.\n *\n * Delete this once `payload`'s barrel no longer reaches the type-gen path from\n * the client-reachable export graph.\n */\nexport function stubPrettierInClient(): PluginOption {\n const RESOLVED_ID = '\\0payload:prettier-client-stub'\n\n return {\n name: 'payload:stub-prettier-in-client',\n enforce: 'pre',\n load(id) {\n if (id === RESOLVED_ID) {\n return 'export const format = (source) => source;\\nexport default { format };'\n }\n },\n resolveId(id, _importer, options) {\n if (options?.ssr) {\n return\n }\n if (id === 'prettier') {\n return RESOLVED_ID\n }\n },\n }\n}\n"],"names":["stubPrettierInClient","RESOLVED_ID","name","enforce","load","id","resolveId","_importer","options","ssr"],"mappings":"AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASA;IACd,MAAMC,cAAc;IAEpB,OAAO;QACLC,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAIA,OAAOJ,aAAa;gBACtB,OAAO;YACT;QACF;QACAK,WAAUD,EAAE,EAAEE,SAAS,EAAEC,OAAO;YAC9B,IAAIA,SAASC,KAAK;gBAChB;YACF;YACA,IAAIJ,OAAO,YAAY;gBACrB,OAAOJ;YACT;QACF;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/tanstack-start",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.697830c",
|
|
4
4
|
"description": "TanStack Start framework adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -57,39 +57,32 @@
|
|
|
57
57
|
"dist"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
+
"@vitejs/plugin-react": "^6.0.0",
|
|
61
|
+
"@vitejs/plugin-rsc": "^0.5.21",
|
|
60
62
|
"qs-esm": "^7.0.2",
|
|
61
|
-
"@payloadcms/
|
|
62
|
-
"@payloadcms/
|
|
63
|
+
"@payloadcms/ui": "4.0.0-internal.697830c",
|
|
64
|
+
"@payloadcms/translations": "4.0.0-internal.697830c"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
67
|
"@tanstack/react-router": "^1.120.0",
|
|
66
68
|
"@tanstack/react-start": "^1.168.26",
|
|
67
69
|
"@types/react": "^19.0.0",
|
|
68
70
|
"@types/react-dom": "^19.0.0",
|
|
69
|
-
"@vitejs/plugin-react": "^6.0.0",
|
|
70
71
|
"@vitejs/plugin-rsc": "^0.5.21",
|
|
71
72
|
"react": "^19.0.0",
|
|
72
73
|
"react-dom": "^19.0.0",
|
|
73
74
|
"vite": ">=8.0.0",
|
|
74
|
-
"payload": "4.0.0-internal.
|
|
75
|
+
"payload": "4.0.0-internal.697830c"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"@tanstack/react-router": "^1.120.0",
|
|
78
79
|
"@tanstack/react-start": "^1.168.26",
|
|
79
|
-
"@vitejs/plugin-react": "^6.0.0",
|
|
80
|
-
"@vitejs/plugin-rsc": "^0.5.21",
|
|
81
80
|
"react": "^19.0.0",
|
|
82
81
|
"react-dom": "^19.0.0",
|
|
83
82
|
"vite": ">=8.0.0",
|
|
84
|
-
"payload": "4.0.0-internal.
|
|
83
|
+
"payload": "4.0.0-internal.697830c"
|
|
85
84
|
},
|
|
86
85
|
"peerDependenciesMeta": {
|
|
87
|
-
"@vitejs/plugin-react": {
|
|
88
|
-
"optional": true
|
|
89
|
-
},
|
|
90
|
-
"@vitejs/plugin-rsc": {
|
|
91
|
-
"optional": true
|
|
92
|
-
},
|
|
93
86
|
"vite": {
|
|
94
87
|
"optional": true
|
|
95
88
|
}
|
|
@@ -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 +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,40 +0,0 @@
|
|
|
1
|
-
import * as qs from 'qs-esm';
|
|
2
|
-
/**
|
|
3
|
-
* `parseSearch` for TanStack Router's `createRouter`, required for Payload's
|
|
4
|
-
* admin UI. Pair with {@link payloadStringifySearch}.
|
|
5
|
-
*
|
|
6
|
-
* Payload serializes query state (notably the list-view `where` filter) with
|
|
7
|
-
* `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
|
|
8
|
-
* Router's default serializer treats each bracketed string as a flat key and
|
|
9
|
-
* JSON-encodes values, so it never round-trips Payload's nested query: every
|
|
10
|
-
* navigation re-encodes the already-encoded value, exponentially nesting it
|
|
11
|
-
* (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
|
|
12
|
-
* stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
|
|
13
|
-
* the URL idempotent and the nested `where` intact across navigations.
|
|
14
|
-
*
|
|
15
|
-
* This is a router-global serializer: it applies to every route, not just
|
|
16
|
-
* `/admin`. On your own routes, search values arrive as strings (qs does no
|
|
17
|
-
* JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
|
|
18
|
-
* you need numbers or booleans.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* import { createRouter } from '@tanstack/react-router'
|
|
23
|
-
* import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start'
|
|
24
|
-
*
|
|
25
|
-
* export function getRouter() {
|
|
26
|
-
* return createRouter({
|
|
27
|
-
* parseSearch: payloadParseSearch,
|
|
28
|
-
* routeTree,
|
|
29
|
-
* stringifySearch: payloadStringifySearch,
|
|
30
|
-
* })
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare const payloadParseSearch: (searchStr: string) => qs.ParsedQs;
|
|
35
|
-
/**
|
|
36
|
-
* `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
|
|
37
|
-
* admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
|
|
38
|
-
*/
|
|
39
|
-
export declare const payloadStringifySearch: (search: Record<string, unknown>) => string;
|
|
40
|
-
//# sourceMappingURL=routerSearch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routerSearch.d.ts","sourceRoot":"","sources":["../../src/utilities/routerSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,cAAe,MAAM,gBACS,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAGrE,CAAA"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as qs from 'qs-esm';
|
|
2
|
-
/**
|
|
3
|
-
* `parseSearch` for TanStack Router's `createRouter`, required for Payload's
|
|
4
|
-
* admin UI. Pair with {@link payloadStringifySearch}.
|
|
5
|
-
*
|
|
6
|
-
* Payload serializes query state (notably the list-view `where` filter) with
|
|
7
|
-
* `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
|
|
8
|
-
* Router's default serializer treats each bracketed string as a flat key and
|
|
9
|
-
* JSON-encodes values, so it never round-trips Payload's nested query: every
|
|
10
|
-
* navigation re-encodes the already-encoded value, exponentially nesting it
|
|
11
|
-
* (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
|
|
12
|
-
* stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
|
|
13
|
-
* the URL idempotent and the nested `where` intact across navigations.
|
|
14
|
-
*
|
|
15
|
-
* This is a router-global serializer: it applies to every route, not just
|
|
16
|
-
* `/admin`. On your own routes, search values arrive as strings (qs does no
|
|
17
|
-
* JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
|
|
18
|
-
* you need numbers or booleans.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* import { createRouter } from '@tanstack/react-router'
|
|
23
|
-
* import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start'
|
|
24
|
-
*
|
|
25
|
-
* export function getRouter() {
|
|
26
|
-
* return createRouter({
|
|
27
|
-
* parseSearch: payloadParseSearch,
|
|
28
|
-
* routeTree,
|
|
29
|
-
* stringifySearch: payloadStringifySearch,
|
|
30
|
-
* })
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/ export const payloadParseSearch = (searchStr)=>qs.parse(searchStr, {
|
|
34
|
-
depth: 10,
|
|
35
|
-
ignoreQueryPrefix: true
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
|
|
39
|
-
* admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
|
|
40
|
-
*/ export const payloadStringifySearch = (search)=>{
|
|
41
|
-
const searchStr = qs.stringify(search);
|
|
42
|
-
return searchStr ? `?${searchStr}` : '';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=routerSearch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/routerSearch.ts"],"sourcesContent":["import * as qs from 'qs-esm'\n\n/**\n * `parseSearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadStringifySearch}.\n *\n * Payload serializes query state (notably the list-view `where` filter) with\n * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack\n * Router's default serializer treats each bracketed string as a flat key and\n * JSON-encodes values, so it never round-trips Payload's nested query: every\n * navigation re-encodes the already-encoded value, exponentially nesting it\n * (`[true,\"[true,\\\"[true…\"]`) until the filter is unusable. Parsing and\n * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps\n * the URL idempotent and the nested `where` intact across navigations.\n *\n * This is a router-global serializer: it applies to every route, not just\n * `/admin`. On your own routes, search values arrive as strings (qs does no\n * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where\n * you need numbers or booleans.\n *\n * @example\n * ```ts\n * import { createRouter } from '@tanstack/react-router'\n * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start'\n *\n * export function getRouter() {\n * return createRouter({\n * parseSearch: payloadParseSearch,\n * routeTree,\n * stringifySearch: payloadStringifySearch,\n * })\n * }\n * ```\n */\nexport const payloadParseSearch = (searchStr: string) =>\n qs.parse(searchStr, { depth: 10, ignoreQueryPrefix: true })\n\n/**\n * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.\n */\nexport const payloadStringifySearch = (search: Record<string, unknown>) => {\n const searchStr = qs.stringify(search)\n return searchStr ? `?${searchStr}` : ''\n}\n"],"names":["qs","payloadParseSearch","searchStr","parse","depth","ignoreQueryPrefix","payloadStringifySearch","search","stringify"],"mappings":"AAAA,YAAYA,QAAQ,SAAQ;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,qBAAqB,CAACC,YACjCF,GAAGG,KAAK,CAACD,WAAW;QAAEE,OAAO;QAAIC,mBAAmB;IAAK,GAAE;AAE7D;;;CAGC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAML,YAAYF,GAAGQ,SAAS,CAACD;IAC/B,OAAOL,YAAY,CAAC,CAAC,EAAEA,WAAW,GAAG;AACvC,EAAC"}
|