@payloadcms/tanstack-start 4.0.0-internal.f05c47f → 4.0.0-internal.f715c6e
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 +3 -17
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -0
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +1 -1
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/server.d.ts +1 -1
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js.map +1 -1
- package/dist/routes/adminRoutes.d.ts +9 -4
- package/dist/routes/adminRoutes.d.ts.map +1 -1
- package/dist/routes/adminRoutes.js +5 -18
- package/dist/routes/adminRoutes.js.map +1 -1
- package/dist/routes/layoutRoute.d.ts +3 -4
- package/dist/routes/layoutRoute.d.ts.map +1 -1
- package/dist/routes/layoutRoute.js.map +1 -1
- package/dist/utilities/devReloadStrategy.d.ts +10 -0
- package/dist/utilities/devReloadStrategy.d.ts.map +1 -0
- package/dist/utilities/devReloadStrategy.js +27 -0
- package/dist/utilities/devReloadStrategy.js.map +1 -0
- package/dist/utilities/initReq.server.d.ts +0 -1
- package/dist/utilities/initReq.server.d.ts.map +1 -1
- package/dist/utilities/initReq.server.js +0 -3
- package/dist/utilities/initReq.server.js.map +1 -1
- package/dist/utilities/loadAdminPage.d.ts +2 -5
- package/dist/utilities/loadAdminPage.d.ts.map +1 -1
- package/dist/utilities/loadAdminPage.js.map +1 -1
- package/dist/utilities/loadLayoutData.d.ts +1 -3
- package/dist/utilities/loadLayoutData.d.ts.map +1 -1
- package/dist/utilities/loadLayoutData.js +3 -2
- package/dist/utilities/loadLayoutData.js.map +1 -1
- package/dist/utilities/toSerializable.d.ts +0 -9
- package/dist/utilities/toSerializable.d.ts.map +1 -1
- package/dist/utilities/toSerializable.js +2 -13
- package/dist/utilities/toSerializable.js.map +1 -1
- package/dist/withPayload/config/external.d.ts +8 -16
- package/dist/withPayload/config/external.d.ts.map +1 -1
- package/dist/withPayload/config/external.js +9 -23
- package/dist/withPayload/config/external.js.map +1 -1
- package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -1
- package/dist/withPayload/config/optimizeDeps.js +3 -7
- package/dist/withPayload/config/optimizeDeps.js.map +1 -1
- package/dist/withPayload/index.d.ts +0 -13
- package/dist/withPayload/index.d.ts.map +1 -1
- package/dist/withPayload/index.js +3 -28
- package/dist/withPayload/index.js.map +1 -1
- package/package.json +7 -8
- package/dist/utilities/devConfigReload.server.d.ts +0 -2
- package/dist/utilities/devConfigReload.server.d.ts.map +0 -1
- package/dist/utilities/devConfigReload.server.js +0 -38
- package/dist/utilities/devConfigReload.server.js.map +0 -1
- package/dist/utilities/devConfigReloadEvent.d.ts +0 -9
- package/dist/utilities/devConfigReloadEvent.d.ts.map +0 -1
- package/dist/utilities/devConfigReloadEvent.js +0 -9
- package/dist/utilities/devConfigReloadEvent.js.map +0 -1
- package/dist/withPayload/devConfigReload.d.ts +0 -14
- package/dist/withPayload/devConfigReload.d.ts.map +0 -1
- package/dist/withPayload/devConfigReload.js +0 -84
- package/dist/withPayload/devConfigReload.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/withPayload/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 { payloadDevConfigReload } from './devConfigReload.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 *\n * `Failed to load source map` covers deps that ship a `sourceMappingURL` comment\n * without the `.map` file it points at (e.g. `undici`'s `lib/llhttp/*.js`, pulled\n * in via `@vercel/blob`). Vite appends the underlying `ENOENT` stack to that one,\n * so each occurrence is a ~10-line block that buries real log output.\n */\nconst suppressibleWarningPatterns = [\n 'points to missing source files',\n 'Sourcemap for',\n 'Failed to load source map',\n 'references a map file outside its package',\n]\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 `nitro()` options Payload's server build requires. Typed structurally — `nitro` is the host's dependency, not Payload's. */\nexport type PayloadNitroOptions = {\n traceDeps: string[]\n}\n\n/** The options Payload's admin requires for each third-party plugin. */\nexport type PayloadPluginOptions = {\n nitro: PayloadNitroOptions\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 * nitro(pluginOptions.nitro), // only if the app deploys through Nitro\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 // `pluralize` ships a UMD wrapper that throws when run through Vite's dev SSR\n // transform, so dev serve keeps it external and lets Node require it.\n // The production build must bundle it instead: it is reached from the\n // force-bundled `@payloadcms/ui` / `@payloadcms/translations`, and Vite would\n // otherwise externalize it into a client chunk as a bare specifier that pnpm\n // can't resolve from `dist/` at runtime. Dropping it from the externals list\n // isn't enough — Vite externalizes deps of `noExternal` packages by default,\n // so it must be forced back in via `noExternal`.\n const isBuild = env.command === 'build'\n const noExternalPatterns = isBuild\n ? [...payloadNoExternalPatterns, 'pluralize']\n : payloadNoExternalPatterns\n // Dev serve externalizes the server-only Node packages (including `pluralize`,\n // whose UMD wrapper breaks under Vite's SSR transform). The prod build instead\n // externalizes the package boundaries (`buildExternalPackages`) and drops\n // `pluralize` so it bundles — leaving it in `ssr.external` here would win over\n // `noExternal` and re-emit the bare specifier.\n const ssrExternal = isBuild ? buildExternalPackages : ssrExternalPackages\n\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: noExternalPatterns },\n },\n ssr: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: noExternalPatterns },\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 payloadDevConfigReload({ payloadConfigPath }),\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: ssrExternal,\n noExternal: noExternalPatterns,\n },\n }\n\n const pluginOptions: PayloadPluginOptions = {\n nitro: payloadNitroOptions(),\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/**\n * `nitro/vite` options for Payload's server build. `tslib*` full-traces `tslib`\n * so an externalized dep's `tslib/modules/index.js` import (its `import.node`\n * export condition) ships — otherwise the build is green and the server 500s\n * with `ERR_MODULE_NOT_FOUND` on the first request.\n */\nexport function payloadNitroOptions(): PayloadNitroOptions {\n return { traceDeps: ['tslib*'] }\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\\\\.(?:d\\\\.ts|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","payloadDevConfigReload","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","isBuild","command","noExternalPatterns","ssrExternal","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","nitro","payloadNitroOptions","react","payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","merged","serverHandler","traceDeps","args","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","router","codeSplittingOptions","splitBehavior","routeId","startsWith","undefined","routeFileIgnorePattern"],"mappings":"AAEA,kFAAkF;AAClF,2DAA2D;AAC3D,SAASA,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,eAAe,uBAAsB;AAC5C,OAAOC,SAAS,qBAAoB;AACpC,OAAOC,UAAU,YAAW;AAC5B,SAASC,YAAY,EAAEC,WAAW,QAAQ,OAAM;AAEhD,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,mBAAmB,QACd,uBAAsB;AAC7B,SAASC,2BAA2B,EAAEC,2BAA2B,QAAQ,2BAA0B;AACnG,SAASC,oBAAoB,QAAQ,mBAAkB;AACvD,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,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;;;;;;;;;CASC,GACD,MAAMC,8BAA8B;IAClC;IACA;IACA;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,GAAG5D,aAAa,CAAC,CAAC,IAAI,EAAE,GAAG6D;YAC9E;YACA,0EAA0E;YAC1E,+CAA+C;YAC/CC,wBAAwB;YACxB3D;QACF;QACA7C,KAAK;YAAEqC,SAAS;QAAK;QACrBU;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/withPayload/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 // `pluralize` ships a UMD wrapper that throws when run through Vite's dev SSR\n // transform, so dev serve keeps it external and lets Node require it.\n // The production build must bundle it instead: it is reached from the\n // force-bundled `@payloadcms/ui` / `@payloadcms/translations`, and Vite would\n // otherwise externalize it into a client chunk as a bare specifier that pnpm\n // can't resolve from `dist/` at runtime. Dropping it from the externals list\n // isn't enough — Vite externalizes deps of `noExternal` packages by default,\n // so it must be forced back in via `noExternal`.\n const isBuild = env.command === 'build'\n const noExternalPatterns = isBuild\n ? [...payloadNoExternalPatterns, 'pluralize']\n : payloadNoExternalPatterns\n // Dev serve externalizes the server-only Node packages (including `pluralize`,\n // whose UMD wrapper breaks under Vite's SSR transform). The prod build instead\n // externalizes the package boundaries (`buildExternalPackages`) and drops\n // `pluralize` so it bundles — leaving it in `ssr.external` here would win over\n // `noExternal` and re-emit the bare specifier.\n const ssrExternal = isBuild ? buildExternalPackages : ssrExternalPackages\n\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: noExternalPatterns },\n },\n ssr: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: noExternalPatterns },\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: ssrExternal,\n noExternal: noExternalPatterns,\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","isBuild","command","noExternalPatterns","ssrExternal","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","routeFileIgnorePattern"],"mappings":"AAEA,kFAAkF;AAClF,2DAA2D;AAC3D,SAASA,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,eAAe,uBAAsB;AAC5C,OAAOC,SAAS,qBAAoB;AACpC,OAAOC,UAAU,YAAW;AAC5B,SAASC,YAAY,EAAEC,WAAW,QAAQ,OAAM;AAEhD,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,mBAAmB,QACd,uBAAsB;AAC7B,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,YAAYnB;IAC3B,MAAMqB,iBAAiB,CAACC,MACtB,OAAOA,QAAQ,YAAYL,4BAA4BM,IAAI,CAAC,CAACC,UAAYF,IAAIG,QAAQ,CAACD;IAExF,MAAME,WAAWN,OAAOO,IAAI,CAACC,IAA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AAEA,kGAAkG,GAClG,OAAO,SAASoC;IACd,OAAO;QAAEG,eAAe;IAAM;AAChC;AAEA,iFAAiF,GACjF,OAAO,SAASJ;IACd,OAAO;QAAEX,SAAS,EAAE;QAAEC,SAAS;IAAa;AAC9C;AAuBA;;;;CAIC,GACD,OAAO,SAASY,4BACdG,OAAwC,CAAC,CAAC;IAE1C,MAAM,EACJ7C,4BAA4B,EAAE,EAC9BC,eAAe,WAAW,EAC1BC,2BAA2B,EAAE,EAC7BE,kBAAkB,KAAK,EACvBE,eAAe,KAAK,EACrB,GAAGuC;IAEJ,OAAO;QACLC,kBAAkB;YAChBC,QAAQ;gBAAEC,cAAc,EAAE;gBAAEC,YAAY7E;YAA2B;YACnE8E,iBAAiB;mBAAIhF;mBAA2C8B;aAA0B;YAC1F8B,SAAS;gBAAC;aAAO;YACjBqB,YAAY;YACZC,aAAajF;YACb,4EAA4E;YAC5E,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,oEAAoE;YACpEkF,QAAQ;gBAAEL,cAAc;oBAAC;uBAAyB9C;iBAAyB;YAAC;QAC9E;QACAoD,QAAQ;YACNC,sBAAsB;gBACpB,0EAA0E;gBAC1E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,gEAAgE;gBAChEC,eAAe,CAAC,EAAEC,OAAO,EAAuB,GAC9CA,YAAYxD,gBAAgBwD,QAAQC,UAAU,CAAC,GAAGzD,aAAa,CAAC,CAAC,IAAI,EAAE,GAAG0D;YAC9E;YACA,0EAA0E;YAC1E,+CAA+C;YAC/CC,wBAAwB;YACxBxD;QACF;QACA5C,KAAK;YAAEoC,SAAS;QAAK;QACrBU;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.f715c6e",
|
|
4
4
|
"description": "TanStack Start framework adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"qs-esm": "^7.0.2",
|
|
61
|
-
"@payloadcms/
|
|
62
|
-
"@payloadcms/
|
|
61
|
+
"@payloadcms/translations": "4.0.0-internal.f715c6e",
|
|
62
|
+
"@payloadcms/ui": "4.0.0-internal.f715c6e"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tanstack/react-router": "^1.120.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react": "^19.0.0",
|
|
72
72
|
"react-dom": "^19.0.0",
|
|
73
73
|
"vite": ">=8.0.0",
|
|
74
|
-
"payload": "4.0.0-internal.
|
|
74
|
+
"payload": "4.0.0-internal.f715c6e"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@tanstack/react-router": "^1.120.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react": "^19.0.0",
|
|
82
82
|
"react-dom": "^19.0.0",
|
|
83
83
|
"vite": ">=8.0.0",
|
|
84
|
-
"payload": "4.0.0-internal.
|
|
84
|
+
"payload": "4.0.0-internal.f715c6e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"@vitejs/plugin-react": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"node": "^18.20.2 || >=20.9.0"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
|
-
"build": "pnpm build:types && pnpm
|
|
101
|
+
"build": "pnpm build:types && pnpm build:swc && pnpm build:copy-mjs",
|
|
102
102
|
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
103
103
|
"build:copy-mjs": "node ./scripts/copyMjs.mjs",
|
|
104
104
|
"build:debug": "pnpm build",
|
|
@@ -106,7 +106,6 @@
|
|
|
106
106
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
107
107
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
108
108
|
"lint": "eslint .",
|
|
109
|
-
"lint:fix": "eslint . --fix"
|
|
110
|
-
"test:types": "tsc --project test/tsconfig.json"
|
|
109
|
+
"lint:fix": "eslint . --fix"
|
|
111
110
|
}
|
|
112
111
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devConfigReload.server.d.ts","sourceRoot":"","sources":["../../src/utilities/devConfigReload.server.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { registerDevReloadStrategy } from 'payload';
|
|
2
|
-
import { PAYLOAD_CONFIG_CHANGED_EVENT } from './devConfigReloadEvent.js';
|
|
3
|
-
/**
|
|
4
|
-
* Subscribes the Payload instance to the config-changed event that the
|
|
5
|
-
* `payload:dev-config-reload` Vite plugin broadcasts.
|
|
6
|
-
*
|
|
7
|
-
* Imported for its side effect by `initReq.server.ts`, the adapter's only
|
|
8
|
-
* `getPayload` call site, so the strategy is registered before an instance can
|
|
9
|
-
* be built. Registration is module-scoped on both ends: this runs inside the
|
|
10
|
-
* app's server graph and so resolves the same copy of `payload` that
|
|
11
|
-
* `getPayload` is called on, and each Vite environment (`ssr`, `rsc`) registers
|
|
12
|
-
* its own listener against its own copy.
|
|
13
|
-
*
|
|
14
|
-
* Vite re-evaluates this module on a program reload, which drops the listeners
|
|
15
|
-
* the previous instance had collected. `getPayload` reconnects on its next call
|
|
16
|
-
* because the registered strategy is a new object - see `connectDevReload`.
|
|
17
|
-
*
|
|
18
|
-
* `import.meta.hot` is only defined during dev serve, so this is inert in a
|
|
19
|
-
* production build.
|
|
20
|
-
*/ const hot = import.meta.hot;
|
|
21
|
-
if (hot) {
|
|
22
|
-
const listeners = new Set();
|
|
23
|
-
hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, ()=>{
|
|
24
|
-
for (const onReload of listeners){
|
|
25
|
-
onReload();
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
registerDevReloadStrategy({
|
|
29
|
-
connect: (onReload)=>{
|
|
30
|
-
listeners.add(onReload);
|
|
31
|
-
return ()=>{
|
|
32
|
-
listeners.delete(onReload);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=devConfigReload.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/devConfigReload.server.ts"],"sourcesContent":["import { registerDevReloadStrategy } from 'payload'\n\nimport { PAYLOAD_CONFIG_CHANGED_EVENT } from './devConfigReloadEvent.js'\n\n/**\n * Subscribes the Payload instance to the config-changed event that the\n * `payload:dev-config-reload` Vite plugin broadcasts.\n *\n * Imported for its side effect by `initReq.server.ts`, the adapter's only\n * `getPayload` call site, so the strategy is registered before an instance can\n * be built. Registration is module-scoped on both ends: this runs inside the\n * app's server graph and so resolves the same copy of `payload` that\n * `getPayload` is called on, and each Vite environment (`ssr`, `rsc`) registers\n * its own listener against its own copy.\n *\n * Vite re-evaluates this module on a program reload, which drops the listeners\n * the previous instance had collected. `getPayload` reconnects on its next call\n * because the registered strategy is a new object - see `connectDevReload`.\n *\n * `import.meta.hot` is only defined during dev serve, so this is inert in a\n * production build.\n */\nconst hot = (import.meta as unknown as { hot?: ViteHotContext }).hot\n\nif (hot) {\n const listeners = new Set<() => void>()\n\n hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, () => {\n for (const onReload of listeners) {\n onReload()\n }\n })\n\n registerDevReloadStrategy({\n connect: (onReload) => {\n listeners.add(onReload)\n\n return () => {\n listeners.delete(onReload)\n }\n },\n })\n}\n\ntype ViteHotContext = {\n on: (event: string, cb: () => void) => void\n}\n"],"names":["registerDevReloadStrategy","PAYLOAD_CONFIG_CHANGED_EVENT","hot","listeners","Set","on","onReload","connect","add","delete"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,UAAS;AAEnD,SAASC,4BAA4B,QAAQ,4BAA2B;AAExE;;;;;;;;;;;;;;;;;CAiBC,GACD,MAAMC,MAAM,AAAC,YAAoDA,GAAG;AAEpE,IAAIA,KAAK;IACP,MAAMC,YAAY,IAAIC;IAEtBF,IAAIG,EAAE,CAACJ,8BAA8B;QACnC,KAAK,MAAMK,YAAYH,UAAW;YAChCG;QACF;IACF;IAEAN,0BAA0B;QACxBO,SAAS,CAACD;YACRH,UAAUK,GAAG,CAACF;YAEd,OAAO;gBACLH,UAAUM,MAAM,CAACH;YACnB;QACF;IACF;AACF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when
|
|
3
|
-
* the Payload config (or anything it imports) changes on disk.
|
|
4
|
-
*
|
|
5
|
-
* Kept in its own module so the Vite plugin can name the event without pulling
|
|
6
|
-
* in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.
|
|
7
|
-
*/
|
|
8
|
-
export declare const PAYLOAD_CONFIG_CHANGED_EVENT = "payload:config-changed";
|
|
9
|
-
//# sourceMappingURL=devConfigReloadEvent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devConfigReloadEvent.d.ts","sourceRoot":"","sources":["../../src/utilities/devConfigReloadEvent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,2BAA2B,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when
|
|
3
|
-
* the Payload config (or anything it imports) changes on disk.
|
|
4
|
-
*
|
|
5
|
-
* Kept in its own module so the Vite plugin can name the event without pulling
|
|
6
|
-
* in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.
|
|
7
|
-
*/ export const PAYLOAD_CONFIG_CHANGED_EVENT = 'payload:config-changed';
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=devConfigReloadEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/devConfigReloadEvent.ts"],"sourcesContent":["/**\n * Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when\n * the Payload config (or anything it imports) changes on disk.\n *\n * Kept in its own module so the Vite plugin can name the event without pulling\n * in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.\n */\nexport const PAYLOAD_CONFIG_CHANGED_EVENT = 'payload:config-changed'\n"],"names":["PAYLOAD_CONFIG_CHANGED_EVENT"],"mappings":"AAAA;;;;;;CAMC,GACD,OAAO,MAAMA,+BAA+B,yBAAwB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PluginOption } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Reloads Payload when `payload.config.ts`, or anything it imports, changes.
|
|
4
|
-
*
|
|
5
|
-
* Vite re-evaluates the config module on its own, but `getPayload` keeps
|
|
6
|
-
* serving its cached instance until a `DevReloadStrategy` marks it stale. This
|
|
7
|
-
* plugin only broadcasts the change; `devConfigReload.server.ts` subscribes
|
|
8
|
-
* from inside the server runtime and marks the instance, which `getPayload`
|
|
9
|
-
* then reloads on its next call.
|
|
10
|
-
*/
|
|
11
|
-
export declare function payloadDevConfigReload({ payloadConfigPath, }: {
|
|
12
|
-
payloadConfigPath: string;
|
|
13
|
-
}): PluginOption;
|
|
14
|
-
//# sourceMappingURL=devConfigReload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devConfigReload.d.ts","sourceRoot":"","sources":["../../src/withPayload/devConfigReload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,YAAY,EAAiB,MAAM,MAAM,CAAA;AAO9E;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,MAAM,CAAA;CAC1B,GAAG,YAAY,CA+Cf"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { normalizePath } from 'vite';
|
|
3
|
-
import { PAYLOAD_CONFIG_CHANGED_EVENT } from '../utilities/devConfigReloadEvent.js';
|
|
4
|
-
/**
|
|
5
|
-
* Reloads Payload when `payload.config.ts`, or anything it imports, changes.
|
|
6
|
-
*
|
|
7
|
-
* Vite re-evaluates the config module on its own, but `getPayload` keeps
|
|
8
|
-
* serving its cached instance until a `DevReloadStrategy` marks it stale. This
|
|
9
|
-
* plugin only broadcasts the change; `devConfigReload.server.ts` subscribes
|
|
10
|
-
* from inside the server runtime and marks the instance, which `getPayload`
|
|
11
|
-
* then reloads on its next call.
|
|
12
|
-
*/ export function payloadDevConfigReload({ payloadConfigPath }) {
|
|
13
|
-
const configFile = normalizePath(path.resolve(payloadConfigPath));
|
|
14
|
-
let server;
|
|
15
|
-
// Vite runs `hotUpdate` once per environment (client, ssr, rsc) per change,
|
|
16
|
-
// sharing one timestamp; without this the notice prints three times.
|
|
17
|
-
let lastHandled = '';
|
|
18
|
-
return {
|
|
19
|
-
name: 'payload:dev-config-reload',
|
|
20
|
-
apply: 'serve',
|
|
21
|
-
configureServer (devServer) {
|
|
22
|
-
server = devServer;
|
|
23
|
-
},
|
|
24
|
-
hotUpdate ({ file, modules, timestamp }) {
|
|
25
|
-
if (!server) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const changeKey = `${file}:${timestamp}`;
|
|
29
|
-
if (changeKey === lastHandled) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (!affectsPayloadConfig({
|
|
33
|
-
configFile,
|
|
34
|
-
file,
|
|
35
|
-
modules
|
|
36
|
-
})) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
lastHandled = changeKey;
|
|
40
|
-
server.config.logger.info(`payload config changed, reloading Payload (${path.basename(file)})`, {
|
|
41
|
-
timestamp: true
|
|
42
|
-
});
|
|
43
|
-
// Broadcast to every environment rather than just `this.environment`: the
|
|
44
|
-
// changed module may only be in the graph of the environment that saw it,
|
|
45
|
-
// while the Payload instance was built in another. Each environment's
|
|
46
|
-
// runtime subscribes with its own copy of `payload`, and environments with
|
|
47
|
-
// no subscriber (e.g. `client`) simply ignore the event.
|
|
48
|
-
for (const environment of Object.values(server.environments)){
|
|
49
|
-
environment.hot.send({
|
|
50
|
-
type: 'custom',
|
|
51
|
-
event: PAYLOAD_CONFIG_CHANGED_EVENT
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Whether `file` is the Payload config or something it imports. Walks *up*
|
|
59
|
-
* through importers, since the config sits at the root of that subtree.
|
|
60
|
-
*/ function affectsPayloadConfig({ configFile, file, modules }) {
|
|
61
|
-
if (normalizePath(file) === configFile) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
const seen = new Set();
|
|
65
|
-
const queue = [
|
|
66
|
-
...modules
|
|
67
|
-
];
|
|
68
|
-
while(queue.length > 0){
|
|
69
|
-
const mod = queue.pop();
|
|
70
|
-
if (seen.has(mod)) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
seen.add(mod);
|
|
74
|
-
if (mod.file && normalizePath(mod.file) === configFile) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
for (const importer of mod.importers){
|
|
78
|
-
queue.push(importer);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=devConfigReload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/withPayload/devConfigReload.ts"],"sourcesContent":["import type { EnvironmentModuleNode, PluginOption, ViteDevServer } from 'vite'\n\nimport path from 'node:path'\nimport { normalizePath } from 'vite'\n\nimport { PAYLOAD_CONFIG_CHANGED_EVENT } from '../utilities/devConfigReloadEvent.js'\n\n/**\n * Reloads Payload when `payload.config.ts`, or anything it imports, changes.\n *\n * Vite re-evaluates the config module on its own, but `getPayload` keeps\n * serving its cached instance until a `DevReloadStrategy` marks it stale. This\n * plugin only broadcasts the change; `devConfigReload.server.ts` subscribes\n * from inside the server runtime and marks the instance, which `getPayload`\n * then reloads on its next call.\n */\nexport function payloadDevConfigReload({\n payloadConfigPath,\n}: {\n payloadConfigPath: string\n}): PluginOption {\n const configFile = normalizePath(path.resolve(payloadConfigPath))\n\n let server: undefined | ViteDevServer\n\n // Vite runs `hotUpdate` once per environment (client, ssr, rsc) per change,\n // sharing one timestamp; without this the notice prints three times.\n let lastHandled = ''\n\n return {\n name: 'payload:dev-config-reload',\n apply: 'serve',\n configureServer(devServer) {\n server = devServer\n },\n hotUpdate({ file, modules, timestamp }) {\n if (!server) {\n return\n }\n\n const changeKey = `${file}:${timestamp}`\n\n if (changeKey === lastHandled) {\n return\n }\n\n if (!affectsPayloadConfig({ configFile, file, modules })) {\n return\n }\n\n lastHandled = changeKey\n\n server.config.logger.info(\n `payload config changed, reloading Payload (${path.basename(file)})`,\n { timestamp: true },\n )\n\n // Broadcast to every environment rather than just `this.environment`: the\n // changed module may only be in the graph of the environment that saw it,\n // while the Payload instance was built in another. Each environment's\n // runtime subscribes with its own copy of `payload`, and environments with\n // no subscriber (e.g. `client`) simply ignore the event.\n for (const environment of Object.values(server.environments)) {\n environment.hot.send({ type: 'custom', event: PAYLOAD_CONFIG_CHANGED_EVENT })\n }\n },\n }\n}\n\n/**\n * Whether `file` is the Payload config or something it imports. Walks *up*\n * through importers, since the config sits at the root of that subtree.\n */\nfunction affectsPayloadConfig({\n configFile,\n file,\n modules,\n}: {\n configFile: string\n file: string\n modules: EnvironmentModuleNode[]\n}): boolean {\n if (normalizePath(file) === configFile) {\n return true\n }\n\n const seen = new Set<EnvironmentModuleNode>()\n const queue = [...modules]\n\n while (queue.length > 0) {\n const mod = queue.pop()!\n\n if (seen.has(mod)) {\n continue\n }\n seen.add(mod)\n\n if (mod.file && normalizePath(mod.file) === configFile) {\n return true\n }\n\n for (const importer of mod.importers) {\n queue.push(importer)\n }\n }\n\n return false\n}\n"],"names":["path","normalizePath","PAYLOAD_CONFIG_CHANGED_EVENT","payloadDevConfigReload","payloadConfigPath","configFile","resolve","server","lastHandled","name","apply","configureServer","devServer","hotUpdate","file","modules","timestamp","changeKey","affectsPayloadConfig","config","logger","info","basename","environment","Object","values","environments","hot","send","type","event","seen","Set","queue","length","mod","pop","has","add","importer","importers","push"],"mappings":"AAEA,OAAOA,UAAU,YAAW;AAC5B,SAASC,aAAa,QAAQ,OAAM;AAEpC,SAASC,4BAA4B,QAAQ,uCAAsC;AAEnF;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAAuB,EACrCC,iBAAiB,EAGlB;IACC,MAAMC,aAAaJ,cAAcD,KAAKM,OAAO,CAACF;IAE9C,IAAIG;IAEJ,4EAA4E;IAC5E,qEAAqE;IACrE,IAAIC,cAAc;IAElB,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,iBAAgBC,SAAS;YACvBL,SAASK;QACX;QACAC,WAAU,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAE;YACpC,IAAI,CAACT,QAAQ;gBACX;YACF;YAEA,MAAMU,YAAY,GAAGH,KAAK,CAAC,EAAEE,WAAW;YAExC,IAAIC,cAAcT,aAAa;gBAC7B;YACF;YAEA,IAAI,CAACU,qBAAqB;gBAAEb;gBAAYS;gBAAMC;YAAQ,IAAI;gBACxD;YACF;YAEAP,cAAcS;YAEdV,OAAOY,MAAM,CAACC,MAAM,CAACC,IAAI,CACvB,CAAC,2CAA2C,EAAErB,KAAKsB,QAAQ,CAACR,MAAM,CAAC,CAAC,EACpE;gBAAEE,WAAW;YAAK;YAGpB,0EAA0E;YAC1E,0EAA0E;YAC1E,sEAAsE;YACtE,2EAA2E;YAC3E,yDAAyD;YACzD,KA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