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:
Radosław Smoliński
2026-10-22 17:17:42 +02:00
co-authored by Claude Opus 5.5
parent e5d86b8afe
commit 14fd2c497f
18 changed files with 102 additions and 63 deletions
+3 -3
View File
@@ -4,17 +4,17 @@ import { describe, expect, test, vi } from 'vitest'
import { resolveRedirect } from '../src/modules/content/resolveRedirect.js'
const config = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'PL' }] }
const config = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'PL' }] } as const
const payloadWith = (doc: object) => ({ find: vi.fn(async () => ({ docs: [doc] })) }) as unknown as BasePayload
describe('old-slug redirects and drafts', () => {
test('a published page redirects from its old slug', async () => {
const payload = payloadWith({ _status: 'published', slug: 'nowa-oferta' })
const payload = payloadWith({ slug: 'nowa-oferta', _status: 'published' })
expect(await resolveRedirect({ config, locale: 'pl', payload, segments: ['oferta'] })).toBe('/nowa-oferta')
})
test('a never-published draft does not redirect (its new slug stays private)', async () => {
const payload = payloadWith({ _status: 'draft', slug: 'tajny-projekt' })
const payload = payloadWith({ slug: 'tajny-projekt', _status: 'draft' })
expect(await resolveRedirect({ config, locale: 'pl', payload, segments: ['oferta'] })).toBeNull()
})