Fix
This commit is contained in:
+137
-137
@@ -1,3 +1,20 @@
|
||||
export { ipalKit } from './plugin.js'
|
||||
export type { IpalOptions } from './types.js'
|
||||
export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'
|
||||
export {
|
||||
buildLocalizedPath,
|
||||
getDefaultLocale,
|
||||
getLocaleCodes,
|
||||
getLocaleDefinition,
|
||||
getLocalizedSlugs,
|
||||
isValidLocale,
|
||||
LOCALE_COOKIE_NAME,
|
||||
matchAcceptLanguage,
|
||||
negotiateLocale,
|
||||
switchLocalePath,
|
||||
} from './modules/i18n/index.js'
|
||||
export type { PagesOption, SystemPageRole } from './modules/pages/index.js'
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'
|
||||
export type { AccessOption, Role } from './modules/access/index.js'
|
||||
export {
|
||||
adminOnly,
|
||||
@@ -13,102 +30,58 @@ export {
|
||||
requireRoleField,
|
||||
ROLE_HIERARCHY,
|
||||
} from './modules/access/index.js'
|
||||
export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'
|
||||
export type { A11yState } from './modules/accessibility/index.js'
|
||||
export { rowLabel } from './modules/admin-ui/index.js'
|
||||
export type { RowLabelProps } from './modules/admin-ui/index.js'
|
||||
export type { AnalyticsConfig } from './modules/analytics/index.js'
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js'
|
||||
export type { GlobalQueryOptions } from './modules/payload/index.js'
|
||||
export {
|
||||
ACCEPT_ALL_CONSENT,
|
||||
CONSENT_CATEGORIES,
|
||||
CONSENT_COOKIE,
|
||||
CONSENT_MAX_AGE,
|
||||
CONSENT_VERSION,
|
||||
DEFAULT_CONSENT,
|
||||
getConsentTexts,
|
||||
parseConsent,
|
||||
REJECT_ALL_CONSENT,
|
||||
serializeConsent,
|
||||
setDefaultConsent,
|
||||
updateConsent,
|
||||
} from './modules/consent/index.js'
|
||||
export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'
|
||||
export type { ContentCollectionOption, ContentOption, ResolvedRoute } from './modules/content/index.js'
|
||||
getGlobal,
|
||||
getSiteSettings,
|
||||
getSiteIntegrations,
|
||||
SITE_SETTINGS_SLUG,
|
||||
SITE_INTEGRATIONS_SLUG,
|
||||
} from './modules/payload/index.js'
|
||||
export type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js'
|
||||
export {
|
||||
archiveFieldName,
|
||||
composeTitle,
|
||||
buildHreflangAlternates,
|
||||
buildMetadata,
|
||||
readSiteMetaConfig,
|
||||
slugsAcrossLocales,
|
||||
} from './modules/seo/index.js'
|
||||
export type { SiteMetaConfig } from './modules/seo/index.js'
|
||||
export type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js'
|
||||
export { createContentHelpers } from './modules/frontend/index.js'
|
||||
export {
|
||||
resolveRoute,
|
||||
resolveRedirect,
|
||||
resolveNotFoundPage,
|
||||
blocksToMarkdown,
|
||||
createMarkdownRenderer,
|
||||
markdownResponse,
|
||||
prefersMarkdown,
|
||||
markdownHref,
|
||||
MARKDOWN_PREFIX,
|
||||
searchContent,
|
||||
createSearchRoute,
|
||||
archiveFieldName,
|
||||
getArchiveEntries,
|
||||
buildArchivePath,
|
||||
buildEntryPath,
|
||||
createMarkdownRenderer,
|
||||
createSearchRoute,
|
||||
getArchiveEntries,
|
||||
MARKDOWN_PREFIX,
|
||||
markdownHref,
|
||||
markdownResponse,
|
||||
parsePageParam,
|
||||
prefersMarkdown,
|
||||
resolveNotFoundPage,
|
||||
resolveRedirect,
|
||||
resolveRoute,
|
||||
searchContent,
|
||||
} from './modules/content/index.js'
|
||||
export type { ArchiveEntries } from './modules/content/index.js'
|
||||
export type { SearchResult } from './modules/content/index.js'
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js'
|
||||
export type { GraphAdapterArgs } from './modules/email/graphAdapter.js'
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js'
|
||||
export type { MailAdapterArgs } from './modules/email/mailAdapter.js'
|
||||
// Imported straight from the file, NOT from ./modules/email/index.js — that
|
||||
// barrel re-exports sendEmail, which imports 'server-only' and would crash when
|
||||
// Payload loads the config (or runs generate:importmap) as a plain Node script.
|
||||
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'
|
||||
export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'
|
||||
// Boot-time environment validation (fail fast on misconfigured deploys).
|
||||
export { assertEnv, ipalEnvRules } from './modules/env/index.js'
|
||||
export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js'
|
||||
// Panel-managed form analytics (config-time field builder).
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'
|
||||
export type {
|
||||
FormsCollectionOverrides,
|
||||
FormsFieldsOverride,
|
||||
FormsOption,
|
||||
} from './modules/forms/types.js'
|
||||
export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'
|
||||
// Validation rules are pure — exported server-side too, for re-validating a
|
||||
// submission inside a server action. (useForm/useContactForm are client-only →
|
||||
// '@intecion/ipal-kit/client'.)
|
||||
// Lexical → Markdown (pure, no React) — for AI-readable output.
|
||||
export { lexicalToMarkdown } from './modules/richtext/index.js'
|
||||
export type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js'
|
||||
export {
|
||||
buildValidator,
|
||||
checked,
|
||||
custom,
|
||||
email,
|
||||
isEmail,
|
||||
maxLength,
|
||||
minLength,
|
||||
pattern,
|
||||
required,
|
||||
} from './modules/forms/validators.js'
|
||||
export type { Rule } from './modules/forms/validators.js'
|
||||
export { createContentHelpers } from './modules/frontend/index.js'
|
||||
// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
|
||||
export { createHealthRoute } from './modules/health/index.js'
|
||||
export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'
|
||||
export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'
|
||||
export {
|
||||
buildLocalizedPath,
|
||||
getDefaultLocale,
|
||||
getLocaleCodes,
|
||||
getLocaleDefinition,
|
||||
getLocalizedSlugs,
|
||||
isValidLocale,
|
||||
LOCALE_COOKIE_NAME,
|
||||
matchAcceptLanguage,
|
||||
negotiateLocale,
|
||||
switchLocalePath,
|
||||
} from './modules/i18n/index.js'
|
||||
buildAutoFillMetaHook,
|
||||
injectAutoFillMeta,
|
||||
createMetadataGenerator,
|
||||
createPageMetadata,
|
||||
buildSitemapEntries,
|
||||
buildRobots,
|
||||
AI_ASSISTANT_BOTS,
|
||||
AI_TRAINING_BOTS,
|
||||
} from './modules/seo/index.js'
|
||||
export type { LocaleMiddlewareResult } from './modules/i18n/index.js'
|
||||
export {
|
||||
createLocaleMiddleware,
|
||||
@@ -116,70 +89,97 @@ export {
|
||||
} from './modules/i18n/index.js'
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'
|
||||
export { resolveLocalized } from './modules/i18n/index.js'
|
||||
export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'
|
||||
export {
|
||||
CONSENT_CATEGORIES,
|
||||
DEFAULT_CONSENT,
|
||||
ACCEPT_ALL_CONSENT,
|
||||
REJECT_ALL_CONSENT,
|
||||
CONSENT_COOKIE,
|
||||
CONSENT_VERSION,
|
||||
CONSENT_MAX_AGE,
|
||||
serializeConsent,
|
||||
parseConsent,
|
||||
setDefaultConsent,
|
||||
updateConsent,
|
||||
getConsentTexts,
|
||||
} from './modules/consent/index.js'
|
||||
export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'
|
||||
// Imported straight from the file, NOT from ./modules/email/index.js — that
|
||||
// barrel re-exports sendEmail, which imports 'server-only' and would crash when
|
||||
// Payload loads the config (or runs generate:importmap) as a plain Node script.
|
||||
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js'
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js'
|
||||
export type { MailAdapterArgs } from './modules/email/mailAdapter.js'
|
||||
export type { GraphAdapterArgs } from './modules/email/graphAdapter.js'
|
||||
export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'
|
||||
export type {
|
||||
BuildLinkFieldOptions,
|
||||
BuildLinksFieldOptions,
|
||||
LinkAppearance,
|
||||
LinkValue,
|
||||
ResolveLinkHrefOptions,
|
||||
} from './modules/links/index.js'
|
||||
FormsOption,
|
||||
FormsCollectionOverrides,
|
||||
FormsFieldsOverride,
|
||||
} from './modules/forms/types.js'
|
||||
// Validation rules are pure — exported server-side too, for re-validating a
|
||||
// submission inside a server action. (useForm/useContactForm are client-only →
|
||||
// '@intecion/ipal-kit/client'.)
|
||||
export {
|
||||
buildValidator,
|
||||
isEmail,
|
||||
required,
|
||||
email,
|
||||
minLength,
|
||||
maxLength,
|
||||
checked,
|
||||
pattern,
|
||||
custom,
|
||||
} from './modules/forms/validators.js'
|
||||
export type { Rule } from './modules/forms/validators.js'
|
||||
export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'
|
||||
// Panel-managed form analytics (config-time field builder).
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'
|
||||
// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
|
||||
export { createHealthRoute } from './modules/health/index.js'
|
||||
// Read-only MCP server (Claude/agents connect to the site and query it).
|
||||
export { createMcpRoute } from './modules/mcp/index.js'
|
||||
export { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js'
|
||||
export type { OptimizeUploadOptions } from './modules/media/index.js'
|
||||
export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'
|
||||
export type { FormNotificationTexts, NotificationTexts } from './modules/notifications/index.js'
|
||||
export type { PagesOption, SystemPageRole } from './modules/pages/index.js'
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'
|
||||
export type { GlobalQueryOptions } from './modules/payload/index.js'
|
||||
// Boot-time environment validation (fail fast on misconfigured deploys).
|
||||
export { assertEnv, ipalEnvRules } from './modules/env/index.js'
|
||||
export type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js'
|
||||
export type { AnalyticsConfig } from './modules/analytics/index.js'
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js'
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js'
|
||||
export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js'
|
||||
|
||||
export {
|
||||
getGlobal,
|
||||
getSiteIntegrations,
|
||||
getSiteSettings,
|
||||
SITE_INTEGRATIONS_SLUG,
|
||||
SITE_SETTINGS_SLUG,
|
||||
} from './modules/payload/index.js'
|
||||
// Lexical → Markdown (pure, no React) — for AI-readable output.
|
||||
export { lexicalToMarkdown } from './modules/richtext/index.js'
|
||||
export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js'
|
||||
export { buildSecurityHeaders } from './modules/security/index.js'
|
||||
export { buildCsp } from './modules/security/index.js'
|
||||
export type { BuildCspArgs } from './modules/security/index.js'
|
||||
export type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js'
|
||||
export type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js'
|
||||
export {
|
||||
buildHreflangAlternates,
|
||||
buildMetadata,
|
||||
composeTitle,
|
||||
readSiteMetaConfig,
|
||||
slugsAcrossLocales,
|
||||
} from './modules/seo/index.js'
|
||||
export type { SiteMetaConfig } from './modules/seo/index.js'
|
||||
export type { AutoFillMapping, RobotsOptions, RobotsRules, SitemapEntry } from './modules/seo/index.js'
|
||||
export {
|
||||
AI_ASSISTANT_BOTS,
|
||||
AI_TRAINING_BOTS,
|
||||
buildAutoFillMetaHook,
|
||||
buildRobots,
|
||||
buildSitemapEntries,
|
||||
createMetadataGenerator,
|
||||
createPageMetadata,
|
||||
injectAutoFillMeta,
|
||||
} from './modules/seo/index.js'
|
||||
export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js'
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'
|
||||
export { buildNoindexField } from './modules/seo/index.js'
|
||||
export { rowLabel } from './modules/admin-ui/index.js'
|
||||
export type { RowLabelProps } from './modules/admin-ui/index.js'
|
||||
export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'
|
||||
export type {
|
||||
LinkAppearance,
|
||||
LinkValue,
|
||||
BuildLinkFieldOptions,
|
||||
BuildLinksFieldOptions,
|
||||
ResolveLinkHrefOptions,
|
||||
} from './modules/links/index.js'
|
||||
export { buildSpeakableJsonLd } from './modules/seo/index.js'
|
||||
export { buildSummaryField } from './modules/seo/index.js'
|
||||
export { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js'
|
||||
export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js'
|
||||
// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.
|
||||
export { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js'
|
||||
export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js'
|
||||
export { buildArticleJsonLd } from './modules/seo/index.js'
|
||||
export { buildLlmsTxt } from './modules/seo/index.js'
|
||||
export { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js'
|
||||
export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js'
|
||||
export type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js'
|
||||
export { buildR2Storage } from './modules/storage/index.js'
|
||||
export { ipalKit } from './plugin.js'
|
||||
export type { IpalOptions } from './types.js'
|
||||
export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js'
|
||||
export type { OptimizeUploadOptions } from './modules/media/index.js'
|
||||
export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js'
|
||||
export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'
|
||||
export type { A11yState } from './modules/accessibility/index.js'
|
||||
export type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js'
|
||||
export type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js'
|
||||
|
||||
@@ -89,13 +89,13 @@ export type SitemapRouteOptions = {
|
||||
export function createSitemapRouteHandler(
|
||||
sitemap: () => Promise<SitemapEntry[]>,
|
||||
opts: SitemapRouteOptions = {},
|
||||
): (req: Request) => Promise<Response> {
|
||||
): (req?: Request) => Promise<Response> {
|
||||
const style = opts.cssUrl ? false : opts.style === false ? false : (opts.style ?? {})
|
||||
|
||||
return async (req: Request) => {
|
||||
const url = new URL(req.url)
|
||||
return async (req?: Request) => {
|
||||
const url = req ? new URL(req.url) : null
|
||||
|
||||
if (style && url.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
if (style && url?.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
let title: string | undefined
|
||||
try {
|
||||
title = typeof style.title === 'function' ? await style.title() : style.title
|
||||
@@ -111,7 +111,7 @@ export function createSitemapRouteHandler(
|
||||
})
|
||||
}
|
||||
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url.pathname}?${SITEMAP_STYLE_PARAM}` : undefined)
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url?.pathname ?? '/sitemap.xml'}?${SITEMAP_STYLE_PARAM}` : undefined)
|
||||
try {
|
||||
const entries = await sitemap()
|
||||
const xml = buildSitemapXml(entries, { cssUrl })
|
||||
|
||||
Reference in New Issue
Block a user