diff --git a/dist/index.d.ts b/dist/index.d.ts index 5a361c0..a64ff3d 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,74 +1,74 @@ -export type { AccessOption, Role } from './modules/access/index.js'; -export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, 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 { 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'; -export { archiveFieldName, blocksToMarkdown, 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'; -export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'; -export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'; -export { assertEnv, ipalEnvRules } from './modules/env/index.js'; -export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js'; -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'; -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'; -export { createHealthRoute } from './modules/health/index.js'; -export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'; +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, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY, } from './modules/access/index.js'; +export type { GlobalQueryOptions } from './modules/payload/index.js'; +export { 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 { 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, parsePageParam, } from './modules/content/index.js'; +export type { ArchiveEntries } from './modules/content/index.js'; +export type { SearchResult } from './modules/content/index.js'; +export { lexicalToMarkdown } from './modules/richtext/index.js'; +export type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js'; +export { 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, DEFAULT_MIDDLEWARE_MATCHER, } 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 type { BuildLinkFieldOptions, BuildLinksFieldOptions, LinkAppearance, LinkValue, ResolveLinkHrefOptions, } 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'; +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 { FormsOption, FormsCollectionOverrides, FormsFieldsOverride, } from './modules/forms/types.js'; +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'; +export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'; +export { createHealthRoute } from './modules/health/index.js'; 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'; -export { getGlobal, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG, } from './modules/payload/index.js'; -export { lexicalToMarkdown } from './modules/richtext/index.js'; +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 { 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 { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js'; +export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } 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'; diff --git a/dist/index.js b/dist/index.js index 1307e11..1e2ca64 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,59 +1,59 @@ +export { ipalKit } from './plugin.js'; +export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js'; +export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'; export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY } from './modules/access/index.js'; -export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'; -export { rowLabel } from './modules/admin-ui/index.js'; -export { getAnalyticsConfig } from './modules/analytics/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 { archiveFieldName, blocksToMarkdown, buildArchivePath, buildEntryPath, createMarkdownRenderer, createSearchRoute, getArchiveEntries, MARKDOWN_PREFIX, markdownHref, markdownResponse, parsePageParam, prefersMarkdown, resolveNotFoundPage, resolveRedirect, resolveRoute, searchContent } from './modules/content/index.js'; -export { graphAdapter } from './modules/email/graphAdapter.js'; -export { mailAdapter } from './modules/email/mailAdapter.js'; +export { getGlobal, getSiteSettings, getSiteIntegrations, SITE_SETTINGS_SLUG, SITE_INTEGRATIONS_SLUG } from './modules/payload/index.js'; +export { composeTitle, buildHreflangAlternates, buildMetadata, readSiteMetaConfig, slugsAcrossLocales } from './modules/seo/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, parsePageParam } from './modules/content/index.js'; +// Lexical → Markdown (pure, no React) — for AI-readable output. +export { lexicalToMarkdown } from './modules/richtext/index.js'; +export { buildAutoFillMetaHook, injectAutoFillMeta, createMetadataGenerator, createPageMetadata, buildSitemapEntries, buildRobots, AI_ASSISTANT_BOTS, AI_TRAINING_BOTS } from './modules/seo/index.js'; +export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js'; +export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'; +export { resolveLocalized } from './modules/i18n/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'; // 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'; -// Boot-time environment validation (fail fast on misconfigured deploys). -export { assertEnv, ipalEnvRules } from './modules/env/index.js'; -// Panel-managed form analytics (config-time field builder). -export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'; +export { graphAdapter } from './modules/email/graphAdapter.js'; +export { mailAdapter } from './modules/email/mailAdapter.js'; export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'; -export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.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, checked, custom, email, isEmail, maxLength, minLength, pattern, required } from './modules/forms/validators.js'; -export { createContentHelpers } from './modules/frontend/index.js'; +export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom } from './modules/forms/validators.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'; -export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'; -export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js'; -export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } 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'; // 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 { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'; -export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/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'; +// Boot-time environment validation (fail fast on misconfigured deploys). +export { assertEnv, ipalEnvRules } from './modules/env/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 { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js'; export { buildSecurityHeaders } from './modules/security/index.js'; export { buildCsp } from './modules/security/index.js'; -export { buildHreflangAlternates, buildMetadata, composeTitle, readSiteMetaConfig, slugsAcrossLocales } 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 { buildLinkField, buildLinksField, resolveLinkHref } 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 { buildSlugField, toSlug } from './modules/slug/index.js'; +export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js'; export { buildR2Storage } from './modules/storage/index.js'; -export { ipalKit } from './plugin.js'; +export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } 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'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 2a5fcd9..dfed5b7 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { AccessOption, Role } from './modules/access/index.js'\nexport {\n adminOnly,\n adminOnlyField,\n adminOrEditor,\n adminOrEditorField,\n adminOrSelf,\n authenticated,\n hasMinimumRole,\n isAdmin,\n isEditor,\n requireRole,\n requireRoleField,\n ROLE_HIERARCHY,\n} from './modules/access/index.js'\nexport { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'\nexport type { A11yState } from './modules/accessibility/index.js'\nexport { rowLabel } from './modules/admin-ui/index.js'\nexport type { RowLabelProps } from './modules/admin-ui/index.js'\nexport type { AnalyticsConfig } from './modules/analytics/index.js'\nexport { getAnalyticsConfig } from './modules/analytics/index.js'\nexport {\n ACCEPT_ALL_CONSENT,\n CONSENT_CATEGORIES,\n CONSENT_COOKIE,\n CONSENT_MAX_AGE,\n CONSENT_VERSION,\n DEFAULT_CONSENT,\n getConsentTexts,\n parseConsent,\n REJECT_ALL_CONSENT,\n serializeConsent,\n setDefaultConsent,\n updateConsent,\n} from './modules/consent/index.js'\nexport type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'\nexport type { ContentCollectionOption, ContentOption, ResolvedRoute } from './modules/content/index.js'\nexport {\n archiveFieldName,\n blocksToMarkdown,\n buildArchivePath,\n buildEntryPath,\n createMarkdownRenderer,\n createSearchRoute,\n getArchiveEntries,\n MARKDOWN_PREFIX,\n markdownHref,\n markdownResponse,\n parsePageParam,\n prefersMarkdown,\n resolveNotFoundPage,\n resolveRedirect,\n resolveRoute,\n searchContent,\n} from './modules/content/index.js'\nexport type { ArchiveEntries } from './modules/content/index.js'\nexport type { SearchResult } from './modules/content/index.js'\nexport { graphAdapter } from './modules/email/graphAdapter.js'\nexport type { GraphAdapterArgs } from './modules/email/graphAdapter.js'\nexport { mailAdapter } from './modules/email/mailAdapter.js'\nexport type { MailAdapterArgs } from './modules/email/mailAdapter.js'\n// Imported straight from the file, NOT from ./modules/email/index.js — that\n// barrel re-exports sendEmail, which imports 'server-only' and would crash when\n// Payload loads the config (or runs generate:importmap) as a plain Node script.\nexport { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'\nexport type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'\n// Boot-time environment validation (fail fast on misconfigured deploys).\nexport { assertEnv, ipalEnvRules } from './modules/env/index.js'\nexport type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js'\n// Panel-managed form analytics (config-time field builder).\nexport { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'\nexport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'\nexport type {\n FormsCollectionOverrides,\n FormsFieldsOverride,\n FormsOption,\n} from './modules/forms/types.js'\nexport type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'\n// Validation rules are pure — exported server-side too, for re-validating a\n// submission inside a server action. (useForm/useContactForm are client-only →\n// '@intecion/ipal-kit/client'.)\nexport {\n buildValidator,\n checked,\n custom,\n email,\n isEmail,\n maxLength,\n minLength,\n pattern,\n required,\n} from './modules/forms/validators.js'\nexport type { Rule } from './modules/forms/validators.js'\nexport { createContentHelpers } from './modules/frontend/index.js'\n// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).\nexport { createHealthRoute } from './modules/health/index.js'\nexport { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/index.js'\nexport type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'\nexport {\n buildLocalizedPath,\n getDefaultLocale,\n getLocaleCodes,\n getLocaleDefinition,\n getLocalizedSlugs,\n isValidLocale,\n LOCALE_COOKIE_NAME,\n matchAcceptLanguage,\n negotiateLocale,\n switchLocalePath,\n} from './modules/i18n/index.js'\nexport type { LocaleMiddlewareResult } from './modules/i18n/index.js'\nexport {\n createLocaleMiddleware,\n DEFAULT_MIDDLEWARE_MATCHER,\n} from './modules/i18n/index.js'\nexport { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'\nexport { resolveLocalized } from './modules/i18n/index.js'\nexport { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'\nexport type {\n BuildLinkFieldOptions,\n BuildLinksFieldOptions,\n LinkAppearance,\n LinkValue,\n ResolveLinkHrefOptions,\n} from './modules/links/index.js'\n// Read-only MCP server (Claude/agents connect to the site and query it).\nexport { createMcpRoute } from './modules/mcp/index.js'\nexport { buildOptimizeUploadField, buildOptimizeUploadHook, normalizeFilename, normalizeFilenameHook } from './modules/media/index.js'\nexport type { OptimizeUploadOptions } from './modules/media/index.js'\nexport { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/index.js'\nexport type { FormNotificationTexts, NotificationTexts } from './modules/notifications/index.js'\nexport type { PagesOption, SystemPageRole } from './modules/pages/index.js'\nexport { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'\nexport type { GlobalQueryOptions } from './modules/payload/index.js'\n\nexport {\n getGlobal,\n getSiteIntegrations,\n getSiteSettings,\n SITE_INTEGRATIONS_SLUG,\n SITE_SETTINGS_SLUG,\n} from './modules/payload/index.js'\n// Lexical → Markdown (pure, no React) — for AI-readable output.\nexport { lexicalToMarkdown } from './modules/richtext/index.js'\nexport { buildSecurityHeaders } from './modules/security/index.js'\nexport { buildCsp } from './modules/security/index.js'\nexport type { BuildCspArgs } from './modules/security/index.js'\nexport type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js'\nexport type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js'\nexport {\n buildHreflangAlternates,\n buildMetadata,\n composeTitle,\n readSiteMetaConfig,\n slugsAcrossLocales,\n} from './modules/seo/index.js'\nexport type { SiteMetaConfig } from './modules/seo/index.js'\nexport type { AutoFillMapping, RobotsOptions, RobotsRules, SitemapEntry } from './modules/seo/index.js'\nexport {\n AI_ASSISTANT_BOTS,\n AI_TRAINING_BOTS,\n buildAutoFillMetaHook,\n buildRobots,\n buildSitemapEntries,\n createMetadataGenerator,\n createPageMetadata,\n injectAutoFillMeta,\n} from './modules/seo/index.js'\nexport { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js'\nexport { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'\nexport { buildNoindexField } from './modules/seo/index.js'\nexport { buildSpeakableJsonLd } from './modules/seo/index.js'\nexport { buildSummaryField } from './modules/seo/index.js'\nexport { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } from './modules/seo/index.js'\n// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.\nexport { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } from './modules/seo/index.js'\nexport { buildArticleJsonLd } from './modules/seo/index.js'\nexport { buildLlmsTxt } from './modules/seo/index.js'\nexport { buildSitemapCss, buildSitemapXml, DEFAULT_SITEMAP_CREDIT, SITEMAP_STYLE_PARAM } from './modules/seo/index.js'\nexport type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'\nexport { buildSlugField, toSlug } from './modules/slug/index.js'\nexport { buildR2Storage } from './modules/storage/index.js'\nexport { ipalKit } from './plugin.js'\nexport type { IpalOptions } from './types.js'\n"],"names":["adminOnly","adminOnlyField","adminOrEditor","adminOrEditorField","adminOrSelf","authenticated","hasMinimumRole","isAdmin","isEditor","requireRole","requireRoleField","ROLE_HIERARCHY","A11Y_COOKIE","A11Y_DEFAULT","a11yAttributes","parseA11y","serializeA11y","rowLabel","getAnalyticsConfig","ACCEPT_ALL_CONSENT","CONSENT_CATEGORIES","CONSENT_COOKIE","CONSENT_MAX_AGE","CONSENT_VERSION","DEFAULT_CONSENT","getConsentTexts","parseConsent","REJECT_ALL_CONSENT","serializeConsent","setDefaultConsent","updateConsent","archiveFieldName","blocksToMarkdown","buildArchivePath","buildEntryPath","createMarkdownRenderer","createSearchRoute","getArchiveEntries","MARKDOWN_PREFIX","markdownHref","markdownResponse","parsePageParam","prefersMarkdown","resolveNotFoundPage","resolveRedirect","resolveRoute","searchContent","graphAdapter","mailAdapter","panelSmtpAdapter","assertEnv","ipalEnvRules","buildFormAnalyticsFields","buildFormsPlugin","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","buildValidator","checked","custom","email","isEmail","maxLength","minLength","pattern","required","createContentHelpers","createHealthRoute","buildCrossLocaleFieldSync","buildPreventDeleteSystemPage","buildRevalidateHook","buildValidateUniqueRole","setPublishedAtHook","trackSlugHistoryHook","buildLocalizedPath","getDefaultLocale","getLocaleCodes","getLocaleDefinition","getLocalizedSlugs","isValidLocale","LOCALE_COOKIE_NAME","matchAcceptLanguage","negotiateLocale","switchLocalePath","createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER","createProxy","DEFAULT_PROXY_MATCHER","resolveLocalized","buildLinkField","buildLinksField","resolveLinkHref","createMcpRoute","buildOptimizeUploadField","buildOptimizeUploadHook","normalizeFilename","normalizeFilenameHook","getNotificationTexts","NOTIFICATION_FALLBACK","resolveFormMessage","ALL_SYSTEM_PAGE_ROLES","getSystemPagePath","getGlobal","getSiteIntegrations","getSiteSettings","SITE_INTEGRATIONS_SLUG","SITE_SETTINGS_SLUG","lexicalToMarkdown","buildSecurityHeaders","buildCsp","buildHreflangAlternates","buildMetadata","composeTitle","readSiteMetaConfig","slugsAcrossLocales","AI_ASSISTANT_BOTS","AI_TRAINING_BOTS","buildAutoFillMetaHook","buildRobots","buildSitemapEntries","createMetadataGenerator","createPageMetadata","injectAutoFillMeta","createLlmsTxtRoute","createManifestHandler","createSitemapRouteHandler","buildIconsMetadata","buildOrganizationJsonLd","validateFaviconField","buildNoindexField","buildSpeakableJsonLd","buildSummaryField","buildBreadcrumbJsonLd","buildSiteNavigationJsonLd","buildWebSiteJsonLd","buildFaqJsonLd","buildLocalBusinessJsonLd","buildServiceJsonLd","buildArticleJsonLd","buildLlmsTxt","buildSitemapCss","buildSitemapXml","DEFAULT_SITEMAP_CREDIT","SITEMAP_STYLE_PARAM","buildSlugField","toSlug","buildR2Storage","ipalKit"],"mappings":"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"} \ No newline at end of file +{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { ipalKit } from './plugin.js'\nexport type { IpalOptions } from './types.js'\nexport type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js'\nexport {\n buildLocalizedPath,\n getDefaultLocale,\n getLocaleCodes,\n getLocaleDefinition,\n getLocalizedSlugs,\n isValidLocale,\n LOCALE_COOKIE_NAME,\n matchAcceptLanguage,\n negotiateLocale,\n switchLocalePath,\n} from './modules/i18n/index.js'\nexport type { PagesOption, SystemPageRole } from './modules/pages/index.js'\nexport { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js'\nexport type { AccessOption, Role } from './modules/access/index.js'\nexport {\n adminOnly,\n adminOnlyField,\n adminOrEditor,\n adminOrEditorField,\n adminOrSelf,\n authenticated,\n hasMinimumRole,\n isAdmin,\n isEditor,\n requireRole,\n requireRoleField,\n ROLE_HIERARCHY,\n} from './modules/access/index.js'\nexport type { GlobalQueryOptions } from './modules/payload/index.js'\nexport {\n getGlobal,\n getSiteSettings,\n getSiteIntegrations,\n SITE_SETTINGS_SLUG,\n SITE_INTEGRATIONS_SLUG,\n} from './modules/payload/index.js'\nexport type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js'\nexport {\n composeTitle,\n buildHreflangAlternates,\n buildMetadata,\n readSiteMetaConfig,\n slugsAcrossLocales,\n} from './modules/seo/index.js'\nexport type { SiteMetaConfig } from './modules/seo/index.js'\nexport type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js'\nexport { createContentHelpers } from './modules/frontend/index.js'\nexport {\n resolveRoute,\n resolveRedirect,\n resolveNotFoundPage,\n blocksToMarkdown,\n createMarkdownRenderer,\n markdownResponse,\n prefersMarkdown,\n markdownHref,\n MARKDOWN_PREFIX,\n searchContent,\n createSearchRoute,\n archiveFieldName,\n getArchiveEntries,\n buildArchivePath,\n buildEntryPath,\n parsePageParam,\n} from './modules/content/index.js'\nexport type { ArchiveEntries } from './modules/content/index.js'\nexport type { SearchResult } from './modules/content/index.js'\n// Lexical → Markdown (pure, no React) — for AI-readable output.\nexport { lexicalToMarkdown } from './modules/richtext/index.js'\nexport type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js'\nexport {\n buildAutoFillMetaHook,\n injectAutoFillMeta,\n createMetadataGenerator,\n createPageMetadata,\n buildSitemapEntries,\n buildRobots,\n AI_ASSISTANT_BOTS,\n AI_TRAINING_BOTS,\n} from './modules/seo/index.js'\nexport type { LocaleMiddlewareResult } from './modules/i18n/index.js'\nexport {\n createLocaleMiddleware,\n DEFAULT_MIDDLEWARE_MATCHER,\n} from './modules/i18n/index.js'\nexport { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js'\nexport { resolveLocalized } from './modules/i18n/index.js'\nexport {\n CONSENT_CATEGORIES,\n DEFAULT_CONSENT,\n ACCEPT_ALL_CONSENT,\n REJECT_ALL_CONSENT,\n CONSENT_COOKIE,\n CONSENT_VERSION,\n CONSENT_MAX_AGE,\n serializeConsent,\n parseConsent,\n setDefaultConsent,\n updateConsent,\n getConsentTexts,\n} from './modules/consent/index.js'\nexport type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js'\n// Imported straight from the file, NOT from ./modules/email/index.js — that\n// barrel re-exports sendEmail, which imports 'server-only' and would crash when\n// Payload loads the config (or runs generate:importmap) as a plain Node script.\nexport { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js'\nexport { graphAdapter } from './modules/email/graphAdapter.js'\nexport { mailAdapter } from './modules/email/mailAdapter.js'\nexport type { MailAdapterArgs } from './modules/email/mailAdapter.js'\nexport type { GraphAdapterArgs } from './modules/email/graphAdapter.js'\nexport type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js'\nexport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nexport type {\n FormsOption,\n FormsCollectionOverrides,\n FormsFieldsOverride,\n} from './modules/forms/types.js'\n// Validation rules are pure — exported server-side too, for re-validating a\n// submission inside a server action. (useForm/useContactForm are client-only →\n// '@intecion/ipal-kit/client'.)\nexport {\n buildValidator,\n isEmail,\n required,\n email,\n minLength,\n maxLength,\n checked,\n pattern,\n custom,\n} from './modules/forms/validators.js'\nexport type { Rule } from './modules/forms/validators.js'\nexport type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js'\n// Panel-managed form analytics (config-time field builder).\nexport { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js'\n// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).\nexport { createHealthRoute } from './modules/health/index.js'\n// Read-only MCP server (Claude/agents connect to the site and query it).\nexport { createMcpRoute } from './modules/mcp/index.js'\n// Boot-time environment validation (fail fast on misconfigured deploys).\nexport { assertEnv, ipalEnvRules } from './modules/env/index.js'\nexport type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js'\nexport type { AnalyticsConfig } from './modules/analytics/index.js'\nexport { getAnalyticsConfig } from './modules/analytics/index.js'\nexport { buildSlugField, toSlug } from './modules/slug/index.js'\nexport { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js'\n\nexport { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js'\nexport { buildSecurityHeaders } from './modules/security/index.js'\nexport { buildCsp } from './modules/security/index.js'\nexport type { BuildCspArgs } from './modules/security/index.js'\nexport { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js'\nexport { buildNoindexField } from './modules/seo/index.js'\nexport { rowLabel } from './modules/admin-ui/index.js'\nexport type { RowLabelProps } from './modules/admin-ui/index.js'\nexport { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js'\nexport type {\n LinkAppearance,\n LinkValue,\n BuildLinkFieldOptions,\n BuildLinksFieldOptions,\n ResolveLinkHrefOptions,\n} from './modules/links/index.js'\nexport { buildSpeakableJsonLd } from './modules/seo/index.js'\nexport { buildSummaryField } from './modules/seo/index.js'\nexport { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js'\n// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.\nexport { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js'\nexport { buildArticleJsonLd } from './modules/seo/index.js'\nexport { buildLlmsTxt } from './modules/seo/index.js'\nexport { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js'\nexport type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js'\nexport { buildR2Storage } from './modules/storage/index.js'\nexport { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js'\nexport type { OptimizeUploadOptions } from './modules/media/index.js'\nexport { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js'\nexport { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js'\nexport type { A11yState } from './modules/accessibility/index.js'\nexport type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js'\nexport type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js'\n"],"names":["ipalKit","buildLocalizedPath","getDefaultLocale","getLocaleCodes","getLocaleDefinition","getLocalizedSlugs","isValidLocale","LOCALE_COOKIE_NAME","matchAcceptLanguage","negotiateLocale","switchLocalePath","ALL_SYSTEM_PAGE_ROLES","getSystemPagePath","adminOnly","adminOnlyField","adminOrEditor","adminOrEditorField","adminOrSelf","authenticated","hasMinimumRole","isAdmin","isEditor","requireRole","requireRoleField","ROLE_HIERARCHY","getGlobal","getSiteSettings","getSiteIntegrations","SITE_SETTINGS_SLUG","SITE_INTEGRATIONS_SLUG","composeTitle","buildHreflangAlternates","buildMetadata","readSiteMetaConfig","slugsAcrossLocales","createContentHelpers","resolveRoute","resolveRedirect","resolveNotFoundPage","blocksToMarkdown","createMarkdownRenderer","markdownResponse","prefersMarkdown","markdownHref","MARKDOWN_PREFIX","searchContent","createSearchRoute","archiveFieldName","getArchiveEntries","buildArchivePath","buildEntryPath","parsePageParam","lexicalToMarkdown","buildAutoFillMetaHook","injectAutoFillMeta","createMetadataGenerator","createPageMetadata","buildSitemapEntries","buildRobots","AI_ASSISTANT_BOTS","AI_TRAINING_BOTS","createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER","createProxy","DEFAULT_PROXY_MATCHER","resolveLocalized","CONSENT_CATEGORIES","DEFAULT_CONSENT","ACCEPT_ALL_CONSENT","REJECT_ALL_CONSENT","CONSENT_COOKIE","CONSENT_VERSION","CONSENT_MAX_AGE","serializeConsent","parseConsent","setDefaultConsent","updateConsent","getConsentTexts","panelSmtpAdapter","graphAdapter","mailAdapter","buildFormsPlugin","buildValidator","isEmail","required","email","minLength","maxLength","checked","pattern","custom","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","buildFormAnalyticsFields","createHealthRoute","createMcpRoute","assertEnv","ipalEnvRules","getAnalyticsConfig","buildSlugField","toSlug","createLlmsTxtRoute","createSitemapRouteHandler","createManifestHandler","getNotificationTexts","resolveFormMessage","NOTIFICATION_FALLBACK","buildSecurityHeaders","buildCsp","buildIconsMetadata","buildOrganizationJsonLd","validateFaviconField","buildNoindexField","rowLabel","buildLinkField","buildLinksField","resolveLinkHref","buildSpeakableJsonLd","buildSummaryField","buildWebSiteJsonLd","buildBreadcrumbJsonLd","buildSiteNavigationJsonLd","buildLocalBusinessJsonLd","buildFaqJsonLd","buildServiceJsonLd","buildArticleJsonLd","buildLlmsTxt","buildSitemapXml","buildSitemapCss","SITEMAP_STYLE_PARAM","DEFAULT_SITEMAP_CREDIT","buildR2Storage","normalizeFilename","normalizeFilenameHook","buildOptimizeUploadHook","buildOptimizeUploadField","buildRevalidateHook","setPublishedAtHook","buildPreventDeleteSystemPage","buildValidateUniqueRole","trackSlugHistoryHook","buildCrossLocaleFieldSync","A11Y_COOKIE","A11Y_DEFAULT","a11yAttributes","parseA11y","serializeA11y"],"mappings":"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"} \ No newline at end of file diff --git a/dist/modules/frontend/createContentHelpers.d.ts b/dist/modules/frontend/createContentHelpers.d.ts index 931a6e4..1d3fc64 100644 --- a/dist/modules/frontend/createContentHelpers.d.ts +++ b/dist/modules/frontend/createContentHelpers.d.ts @@ -84,6 +84,6 @@ export declare function createContentHelpers({ baseUrl, config, content, i18n, p resolveRoute: (locale: string, segments: string[] | undefined, page: number) => Promise; robots: () => RobotsRules; sitemap: () => Promise; - sitemapRoute: (req: Request) => Promise; + sitemapRoute: (req?: Request) => Promise; }; export {}; diff --git a/dist/modules/seo/routeHandlers.d.ts b/dist/modules/seo/routeHandlers.d.ts index 1a3b16b..d17d3e9 100644 --- a/dist/modules/seo/routeHandlers.d.ts +++ b/dist/modules/seo/routeHandlers.d.ts @@ -56,4 +56,4 @@ export type SitemapRouteOptions = { * `GET /sitemap.xml` → XML (crawlers), `GET /sitemap.xml?style` → its CSS. * Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers. */ -export declare function createSitemapRouteHandler(sitemap: () => Promise, opts?: SitemapRouteOptions): (req: Request) => Promise; +export declare function createSitemapRouteHandler(sitemap: () => Promise, opts?: SitemapRouteOptions): (req?: Request) => Promise; diff --git a/dist/modules/seo/routeHandlers.js b/dist/modules/seo/routeHandlers.js index 442f3bb..b698fd3 100644 --- a/dist/modules/seo/routeHandlers.js +++ b/dist/modules/seo/routeHandlers.js @@ -62,8 +62,8 @@ import { buildSitemapCss, SITEMAP_STYLE_PARAM } from './sitemapStyle.js'; */ export function createSitemapRouteHandler(sitemap, opts = {}) { const style = opts.cssUrl ? false : opts.style === false ? false : opts.style ?? {}; return async (req)=>{ - const url = new URL(req.url); - if (style && url.searchParams.has(SITEMAP_STYLE_PARAM)) { + const url = req ? new URL(req.url) : null; + if (style && url?.searchParams.has(SITEMAP_STYLE_PARAM)) { let title; try { title = typeof style.title === 'function' ? await style.title() : style.title; @@ -81,7 +81,7 @@ import { buildSitemapCss, SITEMAP_STYLE_PARAM } from './sitemapStyle.js'; } }); } - 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, { diff --git a/dist/modules/seo/routeHandlers.js.map b/dist/modules/seo/routeHandlers.js.map index 003742d..5292462 100644 --- a/dist/modules/seo/routeHandlers.js.map +++ b/dist/modules/seo/routeHandlers.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/modules/seo/routeHandlers.ts"],"sourcesContent":["import type { BasePayload } from 'payload'\n\nimport type { I18nConfig } from '../i18n/index.js'\nimport type { SitemapEntry } from './buildSitemapEntries.js'\n\nimport { buildLlmsTxt } from './buildLlmsTxt.js'\nimport { buildSitemapXml } from './buildSitemapXml.js'\nimport { buildSitemapCss, SITEMAP_STYLE_PARAM, type SitemapStyleOptions } from './sitemapStyle.js'\n\n/**\n * Ready-made Next route handler for /llms.txt. Replaces the ~60-line try/catch\n * every project was copying. buildLlmsTxt already handles collections without\n * drafts, so no workaround is needed here.\n *\n * // app/llms.txt/route.ts\n * import { createLlmsTxtRoute } from '@intecion/ipal-kit'\n * import { getCachedPayload } from '@/lib/content'\n * import { i18nConfig } from '@/i18n.config'\n * export const dynamic = 'force-dynamic'\n * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig,\n * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL! })\n *\n * For the full-content variant, add a second route with `full: true`:\n *\n * // app/llms-full.txt/route.ts\n * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig,\n * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL!, full: true })\n */\nexport function createLlmsTxtRoute(opts: {\n baseUrl: string\n config: I18nConfig\n /** Inline every page's full Markdown (llms-full.txt). Default false. */\n full?: boolean\n getCachedPayload: () => Promise\n pagesSlug?: string\n settingsSlug?: string\n /** Field holding a richer AI summary (buildSummaryField) to prefer as description. */\n summaryField?: string\n}): () => Promise {\n return async () => {\n try {\n const payload = await opts.getCachedPayload()\n const body = await buildLlmsTxt({\n baseUrl: opts.baseUrl,\n config: opts.config,\n full: opts.full,\n pagesSlug: opts.pagesSlug,\n payload,\n settingsSlug: opts.settingsSlug,\n summaryField: opts.summaryField,\n })\n return new Response(body, {\n headers: { 'Content-Type': 'text/plain; charset=utf-8' },\n })\n } catch (err) {\n // DB unreachable at build (container) — return a minimal valid file so the\n // route doesn't 500; it fills in at runtime. No per-project try/catch.\n console.warn('[ipal] createLlmsTxtRoute: could not build llms.txt:', err)\n return new Response('# llms.txt\\n', {\n headers: { 'Content-Type': 'text/plain; charset=utf-8' },\n })\n }\n }\n}\n\nexport type SitemapRouteOptions = {\n /** Legacy: your own stylesheet URL (e.g. '/sitemap.css'). Overrides `style`. */\n cssUrl?: string\n /**\n * Built-in browser look (default ON): the XML points at `?style`\n * and the same handler serves the CSS — nothing to copy into /public.\n * `false` = raw XML. Object = header/credit/accent (SitemapStyleOptions);\n * `title` may be async (sitemapRoute passes the Site Settings name).\n */\n style?: ({ title?: (() => Promise) | string } & Omit) | false\n}\n\n/**\n * Ready-made Next route handler for /sitemap.xml, styled for humans out of the box.\n * Usually you don't call this — `createContentHelpers` returns `sitemapRoute`:\n *\n * // app/sitemap.xml/route.ts — the whole file\n * export { sitemapRoute as GET } from '@/lib/content'\n * export const dynamic = 'force-dynamic'\n *\n * `GET /sitemap.xml` → XML (crawlers), `GET /sitemap.xml?style` → its CSS.\n * Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers.\n */\nexport function createSitemapRouteHandler(\n sitemap: () => Promise,\n opts: SitemapRouteOptions = {},\n): (req: Request) => Promise {\n const style = opts.cssUrl ? false : opts.style === false ? false : (opts.style ?? {})\n\n return async (req: Request) => {\n const url = new URL(req.url)\n\n if (style && url.searchParams.has(SITEMAP_STYLE_PARAM)) {\n let title: string | undefined\n try {\n title = typeof style.title === 'function' ? await style.title() : style.title\n } catch {\n title = undefined // DB down → generic heading, never a broken stylesheet\n }\n return new Response(buildSitemapCss({ ...style, title }), {\n headers: {\n 'Cache-Control': 'public, max-age=3600',\n 'Content-Type': 'text/css; charset=utf-8',\n 'X-Robots-Tag': 'noindex',\n },\n })\n }\n\n const cssUrl = opts.cssUrl ?? (style ? `${url.pathname}?${SITEMAP_STYLE_PARAM}` : undefined)\n try {\n const entries = await sitemap()\n const xml = buildSitemapXml(entries, { cssUrl })\n return new Response(xml, {\n headers: { 'Content-Type': 'application/xml; charset=utf-8' },\n })\n } catch (err) {\n console.warn('[ipal] createSitemapRouteHandler: could not build sitemap:', err)\n // Valid empty urlset so the route doesn't 500 during a DB-less build.\n const empty =\n '\\n' +\n ''\n return new Response(empty, {\n headers: { 'Content-Type': 'application/xml; charset=utf-8' },\n })\n }\n }\n}\n"],"names":["buildLlmsTxt","buildSitemapXml","buildSitemapCss","SITEMAP_STYLE_PARAM","createLlmsTxtRoute","opts","payload","getCachedPayload","body","baseUrl","config","full","pagesSlug","settingsSlug","summaryField","Response","headers","err","console","warn","createSitemapRouteHandler","sitemap","style","cssUrl","req","url","URL","searchParams","has","title","undefined","pathname","entries","xml","empty"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AAChD,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,eAAe,EAAEC,mBAAmB,QAAkC,oBAAmB;AAElG;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,mBAAmBC,IAUlC;IACC,OAAO;QACL,IAAI;YACF,MAAMC,UAAU,MAAMD,KAAKE,gBAAgB;YAC3C,MAAMC,OAAO,MAAMR,aAAa;gBAC9BS,SAASJ,KAAKI,OAAO;gBACrBC,QAAQL,KAAKK,MAAM;gBACnBC,MAAMN,KAAKM,IAAI;gBACfC,WAAWP,KAAKO,SAAS;gBACzBN;gBACAO,cAAcR,KAAKQ,YAAY;gBAC/BC,cAAcT,KAAKS,YAAY;YACjC;YACA,OAAO,IAAIC,SAASP,MAAM;gBACxBQ,SAAS;oBAAE,gBAAgB;gBAA4B;YACzD;QACF,EAAE,OAAOC,KAAK;YACZ,2EAA2E;YAC3E,uEAAuE;YACvEC,QAAQC,IAAI,CAAC,wDAAwDF;YACrE,OAAO,IAAIF,SAAS,gBAAgB;gBAClCC,SAAS;oBAAE,gBAAgB;gBAA4B;YACzD;QACF;IACF;AACF;AAcA;;;;;;;;;;CAUC,GACD,OAAO,SAASI,0BACdC,OAAsC,EACtChB,OAA4B,CAAC,CAAC;IAE9B,MAAMiB,QAAQjB,KAAKkB,MAAM,GAAG,QAAQlB,KAAKiB,KAAK,KAAK,QAAQ,QAASjB,KAAKiB,KAAK,IAAI,CAAC;IAEnF,OAAO,OAAOE;QACZ,MAAMC,MAAM,IAAIC,IAAIF,IAAIC,GAAG;QAE3B,IAAIH,SAASG,IAAIE,YAAY,CAACC,GAAG,CAACzB,sBAAsB;YACtD,IAAI0B;YACJ,IAAI;gBACFA,QAAQ,OAAOP,MAAMO,KAAK,KAAK,aAAa,MAAMP,MAAMO,KAAK,KAAKP,MAAMO,KAAK;YAC/E,EAAE,OAAM;gBACNA,QAAQC,WAAU,uDAAuD;YAC3E;YACA,OAAO,IAAIf,SAASb,gBAAgB;gBAAE,GAAGoB,KAAK;gBAAEO;YAAM,IAAI;gBACxDb,SAAS;oBACP,iBAAiB;oBACjB,gBAAgB;oBAChB,gBAAgB;gBAClB;YACF;QACF;QAEA,MAAMO,SAASlB,KAAKkB,MAAM,IAAKD,CAAAA,QAAQ,GAAGG,IAAIM,QAAQ,CAAC,CAAC,EAAE5B,qBAAqB,GAAG2B,SAAQ;QAC1F,IAAI;YACF,MAAME,UAAU,MAAMX;YACtB,MAAMY,MAAMhC,gBAAgB+B,SAAS;gBAAET;YAAO;YAC9C,OAAO,IAAIR,SAASkB,KAAK;gBACvBjB,SAAS;oBAAE,gBAAgB;gBAAiC;YAC9D;QACF,EAAE,OAAOC,KAAK;YACZC,QAAQC,IAAI,CAAC,8DAA8DF;YAC3E,sEAAsE;YACtE,MAAMiB,QACJ,6CACA;YACF,OAAO,IAAInB,SAASmB,OAAO;gBACzBlB,SAAS;oBAAE,gBAAgB;gBAAiC;YAC9D;QACF;IACF;AACF"} \ No newline at end of file +{"version":3,"sources":["../../../src/modules/seo/routeHandlers.ts"],"sourcesContent":["import type { BasePayload } from 'payload'\n\nimport type { I18nConfig } from '../i18n/index.js'\nimport type { SitemapEntry } from './buildSitemapEntries.js'\n\nimport { buildLlmsTxt } from './buildLlmsTxt.js'\nimport { buildSitemapXml } from './buildSitemapXml.js'\nimport { buildSitemapCss, SITEMAP_STYLE_PARAM, type SitemapStyleOptions } from './sitemapStyle.js'\n\n/**\n * Ready-made Next route handler for /llms.txt. Replaces the ~60-line try/catch\n * every project was copying. buildLlmsTxt already handles collections without\n * drafts, so no workaround is needed here.\n *\n * // app/llms.txt/route.ts\n * import { createLlmsTxtRoute } from '@intecion/ipal-kit'\n * import { getCachedPayload } from '@/lib/content'\n * import { i18nConfig } from '@/i18n.config'\n * export const dynamic = 'force-dynamic'\n * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig,\n * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL! })\n *\n * For the full-content variant, add a second route with `full: true`:\n *\n * // app/llms-full.txt/route.ts\n * export const GET = createLlmsTxtRoute({ getCachedPayload, config: i18nConfig,\n * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL!, full: true })\n */\nexport function createLlmsTxtRoute(opts: {\n baseUrl: string\n config: I18nConfig\n /** Inline every page's full Markdown (llms-full.txt). Default false. */\n full?: boolean\n getCachedPayload: () => Promise\n pagesSlug?: string\n settingsSlug?: string\n /** Field holding a richer AI summary (buildSummaryField) to prefer as description. */\n summaryField?: string\n}): () => Promise {\n return async () => {\n try {\n const payload = await opts.getCachedPayload()\n const body = await buildLlmsTxt({\n baseUrl: opts.baseUrl,\n config: opts.config,\n full: opts.full,\n pagesSlug: opts.pagesSlug,\n payload,\n settingsSlug: opts.settingsSlug,\n summaryField: opts.summaryField,\n })\n return new Response(body, {\n headers: { 'Content-Type': 'text/plain; charset=utf-8' },\n })\n } catch (err) {\n // DB unreachable at build (container) — return a minimal valid file so the\n // route doesn't 500; it fills in at runtime. No per-project try/catch.\n console.warn('[ipal] createLlmsTxtRoute: could not build llms.txt:', err)\n return new Response('# llms.txt\\n', {\n headers: { 'Content-Type': 'text/plain; charset=utf-8' },\n })\n }\n }\n}\n\nexport type SitemapRouteOptions = {\n /** Legacy: your own stylesheet URL (e.g. '/sitemap.css'). Overrides `style`. */\n cssUrl?: string\n /**\n * Built-in browser look (default ON): the XML points at `?style`\n * and the same handler serves the CSS — nothing to copy into /public.\n * `false` = raw XML. Object = header/credit/accent (SitemapStyleOptions);\n * `title` may be async (sitemapRoute passes the Site Settings name).\n */\n style?: ({ title?: (() => Promise) | string } & Omit) | false\n}\n\n/**\n * Ready-made Next route handler for /sitemap.xml, styled for humans out of the box.\n * Usually you don't call this — `createContentHelpers` returns `sitemapRoute`:\n *\n * // app/sitemap.xml/route.ts — the whole file\n * export { sitemapRoute as GET } from '@/lib/content'\n * export const dynamic = 'force-dynamic'\n *\n * `GET /sitemap.xml` → XML (crawlers), `GET /sitemap.xml?style` → its CSS.\n * Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers.\n */\nexport function createSitemapRouteHandler(\n sitemap: () => Promise,\n opts: SitemapRouteOptions = {},\n): (req?: Request) => Promise {\n const style = opts.cssUrl ? false : opts.style === false ? false : (opts.style ?? {})\n\n return async (req?: Request) => {\n const url = req ? new URL(req.url) : null\n\n if (style && url?.searchParams.has(SITEMAP_STYLE_PARAM)) {\n let title: string | undefined\n try {\n title = typeof style.title === 'function' ? await style.title() : style.title\n } catch {\n title = undefined // DB down → generic heading, never a broken stylesheet\n }\n return new Response(buildSitemapCss({ ...style, title }), {\n headers: {\n 'Cache-Control': 'public, max-age=3600',\n 'Content-Type': 'text/css; charset=utf-8',\n 'X-Robots-Tag': 'noindex',\n },\n })\n }\n\n const cssUrl = opts.cssUrl ?? (style ? `${url?.pathname ?? '/sitemap.xml'}?${SITEMAP_STYLE_PARAM}` : undefined)\n try {\n const entries = await sitemap()\n const xml = buildSitemapXml(entries, { cssUrl })\n return new Response(xml, {\n headers: { 'Content-Type': 'application/xml; charset=utf-8' },\n })\n } catch (err) {\n console.warn('[ipal] createSitemapRouteHandler: could not build sitemap:', err)\n // Valid empty urlset so the route doesn't 500 during a DB-less build.\n const empty =\n '\\n' +\n ''\n return new Response(empty, {\n headers: { 'Content-Type': 'application/xml; charset=utf-8' },\n })\n }\n }\n}\n"],"names":["buildLlmsTxt","buildSitemapXml","buildSitemapCss","SITEMAP_STYLE_PARAM","createLlmsTxtRoute","opts","payload","getCachedPayload","body","baseUrl","config","full","pagesSlug","settingsSlug","summaryField","Response","headers","err","console","warn","createSitemapRouteHandler","sitemap","style","cssUrl","req","url","URL","searchParams","has","title","undefined","pathname","entries","xml","empty"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AAChD,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,eAAe,EAAEC,mBAAmB,QAAkC,oBAAmB;AAElG;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,mBAAmBC,IAUlC;IACC,OAAO;QACL,IAAI;YACF,MAAMC,UAAU,MAAMD,KAAKE,gBAAgB;YAC3C,MAAMC,OAAO,MAAMR,aAAa;gBAC9BS,SAASJ,KAAKI,OAAO;gBACrBC,QAAQL,KAAKK,MAAM;gBACnBC,MAAMN,KAAKM,IAAI;gBACfC,WAAWP,KAAKO,SAAS;gBACzBN;gBACAO,cAAcR,KAAKQ,YAAY;gBAC/BC,cAAcT,KAAKS,YAAY;YACjC;YACA,OAAO,IAAIC,SAASP,MAAM;gBACxBQ,SAAS;oBAAE,gBAAgB;gBAA4B;YACzD;QACF,EAAE,OAAOC,KAAK;YACZ,2EAA2E;YAC3E,uEAAuE;YACvEC,QAAQC,IAAI,CAAC,wDAAwDF;YACrE,OAAO,IAAIF,SAAS,gBAAgB;gBAClCC,SAAS;oBAAE,gBAAgB;gBAA4B;YACzD;QACF;IACF;AACF;AAcA;;;;;;;;;;CAUC,GACD,OAAO,SAASI,0BACdC,OAAsC,EACtChB,OAA4B,CAAC,CAAC;IAE9B,MAAMiB,QAAQjB,KAAKkB,MAAM,GAAG,QAAQlB,KAAKiB,KAAK,KAAK,QAAQ,QAASjB,KAAKiB,KAAK,IAAI,CAAC;IAEnF,OAAO,OAAOE;QACZ,MAAMC,MAAMD,MAAM,IAAIE,IAAIF,IAAIC,GAAG,IAAI;QAErC,IAAIH,SAASG,KAAKE,aAAaC,IAAIzB,sBAAsB;YACvD,IAAI0B;YACJ,IAAI;gBACFA,QAAQ,OAAOP,MAAMO,KAAK,KAAK,aAAa,MAAMP,MAAMO,KAAK,KAAKP,MAAMO,KAAK;YAC/E,EAAE,OAAM;gBACNA,QAAQC,WAAU,uDAAuD;YAC3E;YACA,OAAO,IAAIf,SAASb,gBAAgB;gBAAE,GAAGoB,KAAK;gBAAEO;YAAM,IAAI;gBACxDb,SAAS;oBACP,iBAAiB;oBACjB,gBAAgB;oBAChB,gBAAgB;gBAClB;YACF;QACF;QAEA,MAAMO,SAASlB,KAAKkB,MAAM,IAAKD,CAAAA,QAAQ,GAAGG,KAAKM,YAAY,eAAe,CAAC,EAAE5B,qBAAqB,GAAG2B,SAAQ;QAC7G,IAAI;YACF,MAAME,UAAU,MAAMX;YACtB,MAAMY,MAAMhC,gBAAgB+B,SAAS;gBAAET;YAAO;YAC9C,OAAO,IAAIR,SAASkB,KAAK;gBACvBjB,SAAS;oBAAE,gBAAgB;gBAAiC;YAC9D;QACF,EAAE,OAAOC,KAAK;YACZC,QAAQC,IAAI,CAAC,8DAA8DF;YAC3E,sEAAsE;YACtE,MAAMiB,QACJ,6CACA;YACF,OAAO,IAAInB,SAASmB,OAAO;gBACzBlB,SAAS;oBAAE,gBAAgB;gBAAiC;YAC9D;QACF;IACF;AACF"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 70c2c63..2ca3d3b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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' diff --git a/src/modules/seo/routeHandlers.ts b/src/modules/seo/routeHandlers.ts index 211cb5e..e363b67 100644 --- a/src/modules/seo/routeHandlers.ts +++ b/src/modules/seo/routeHandlers.ts @@ -89,13 +89,13 @@ export type SitemapRouteOptions = { export function createSitemapRouteHandler( sitemap: () => Promise, opts: SitemapRouteOptions = {}, -): (req: Request) => Promise { +): (req?: Request) => Promise { 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 })