Server entries no longer load 'use client' modules
The main entry and next/middleware re-exported module barrels that also export React client components (LanguageSwitcher, AlternateLinks*, AccessibilityWidget), so payload.config, the CLI and the proxy bundle evaluated React UI. They now import concrete files; i18n client components moved to modules/i18n/client.ts. test/entryGraph guards it. Also lint fixes in tests added on this branch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e5d86b8afe
commit
14fd2c497f
@@ -23,4 +23,3 @@ export {
|
||||
serializeConsent,
|
||||
} from './storage.js'
|
||||
export type { ConsentTexts } from './texts.js'
|
||||
export { useIsMounted } from './useIsMounted.js'
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { BasePayload } from 'payload'
|
||||
import type { I18nConfig } from '../i18n/index.js'
|
||||
import type { ClientIpOptions } from '../shared/rateLimit.js'
|
||||
|
||||
import { type PathVisibility, pathOf } from '../construction/visibility.js'
|
||||
import { pathOf, type PathVisibility } from '../construction/visibility.js'
|
||||
import { clientIp, consumeRateLimit, tooManyRequests } from '../shared/rateLimit.js'
|
||||
import { searchContent } from './searchContent.js'
|
||||
|
||||
@@ -20,6 +20,8 @@ type CreateSearchRouteArgs = {
|
||||
getCachedPayload: () => Promise<BasePayload>
|
||||
/** Home slug map/string so the home result collapses to root. */
|
||||
homeSlug?: Record<string, string> | string
|
||||
/** Hide pages the site hides (construction mode) — pass `isPathVisible` from createContentHelpers. */
|
||||
isPathVisible?: PathVisibility
|
||||
/**
|
||||
* Per-IP limit (in memory per instance, or the store from setRateLimitStore). Default { max: 120, windowMs: 60_000 }.
|
||||
* `false` = off (a limiter in front, e.g. Cloudflare WAF rate limiting).
|
||||
@@ -27,8 +29,6 @@ type CreateSearchRouteArgs = {
|
||||
rateLimit?: { max?: number; windowMs?: number } | false
|
||||
/** Field holding a richer AI summary (buildSummaryField) to prefer as description. */
|
||||
summaryField?: string
|
||||
/** Hide pages the site hides (construction mode) — pass `isPathVisible` from createContentHelpers. */
|
||||
isPathVisible?: PathVisibility
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -776,7 +776,6 @@ export function createContentHelpers({
|
||||
getCachedPayload,
|
||||
getConfiguredLocales,
|
||||
getConstructionMode,
|
||||
isPathVisible,
|
||||
getEntries,
|
||||
getFormTexts,
|
||||
getHomeSlug,
|
||||
@@ -789,6 +788,7 @@ export function createContentHelpers({
|
||||
healthRoute,
|
||||
i18n,
|
||||
indexNowKeyRoute,
|
||||
isPathVisible,
|
||||
llmsFullRoute,
|
||||
llmsRoute,
|
||||
manifest,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// Client components of the i18n module — kept out of ./index.ts so server
|
||||
// code importing i18n helpers never loads React UI (test/entryGraph).
|
||||
export {
|
||||
AlternateLinksProvider,
|
||||
useAlternateLinks,
|
||||
useSetAlternateLinks,
|
||||
} from './AlternateLinksContext.js'
|
||||
export type { AlternateLinks } from './AlternateLinksContext.js'
|
||||
export { AlternateLinksUpdater } from './AlternateLinksUpdater.js'
|
||||
export { LanguageSwitcher } from './LanguageSwitcher.js'
|
||||
export type { LanguageSwitcherClassNames } from './LanguageSwitcher.js'
|
||||
@@ -1,15 +1,7 @@
|
||||
export {
|
||||
AlternateLinksProvider,
|
||||
useAlternateLinks,
|
||||
useSetAlternateLinks,
|
||||
} from './AlternateLinksContext.js'
|
||||
export type { AlternateLinks } from './AlternateLinksContext.js'
|
||||
export { AlternateLinksUpdater } from './AlternateLinksUpdater.js'
|
||||
// Client components (LanguageSwitcher, AlternateLinks*) live in ./client.ts.
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from './createProxy.js'
|
||||
export { getLocalizedSlugs } from './getLocalizedSlugs.js'
|
||||
export { getDefaultLocale, getLocaleCodes, getLocaleDefinition, isValidLocale } from './helpers.js'
|
||||
export { LanguageSwitcher } from './LanguageSwitcher.js'
|
||||
export type { LanguageSwitcherClassNames } from './LanguageSwitcher.js'
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './localeMiddleware.js'
|
||||
export type { LocaleMiddlewareResult } from './localeMiddleware.js'
|
||||
export { buildLocalizationConfig } from './localizationConfig.js'
|
||||
|
||||
@@ -59,6 +59,11 @@ export type CreateMcpRouteArgs = {
|
||||
/** Archive-backed collections (same as the plugin option) for get_page. */
|
||||
content?: ContentOption
|
||||
getCachedPayload: () => Promise<BasePayload>
|
||||
/**
|
||||
* Hide pages the site hides (construction mode): filtered out of list_pages
|
||||
* and search_content, "not found" in get_page. createContentHelpers passes it.
|
||||
*/
|
||||
isPathVisible?: PathVisibility
|
||||
/** Max messages in one JSON-RPC batch. Default 10. */
|
||||
maxBatch?: number
|
||||
/**
|
||||
@@ -74,11 +79,6 @@ export type CreateMcpRouteArgs = {
|
||||
settingsSlug?: string
|
||||
/** Field holding a richer AI summary (buildSummaryField) to prefer in search results. */
|
||||
summaryField?: string
|
||||
/**
|
||||
* Hide pages the site hides (construction mode): filtered out of list_pages
|
||||
* and search_content, "not found" in get_page. createContentHelpers passes it.
|
||||
*/
|
||||
isPathVisible?: PathVisibility
|
||||
}
|
||||
|
||||
type JsonRpcId = null | number | string
|
||||
|
||||
Reference in New Issue
Block a user