@phtngyn/cms 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +90 -0
- package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +1 -0
- package/dist/studio/assets/ActivityView-D-XBBUHb.js +1 -0
- package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +1 -0
- package/dist/studio/assets/DocumentsView-CxRpmAxt.js +34 -0
- package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +1 -0
- package/dist/studio/assets/Input-DVao38h7.js +3 -0
- package/dist/studio/assets/MediaView-BHrPIjxB.js +1 -0
- package/dist/studio/assets/Modal-VNrXGa5C.js +1 -0
- package/dist/studio/assets/OverviewView-DfP6-mLZ.js +1 -0
- package/dist/studio/assets/Select-BJZIs9sY.js +1 -0
- package/dist/studio/assets/SettingsView-CerHe-ua.js +1 -0
- package/dist/studio/assets/Skeleton-CWJNi3nS.js +1 -0
- package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +1 -0
- package/dist/studio/assets/UsersView-cP3REkH2.js +1 -0
- package/dist/studio/assets/collaboration-BLnCzfvV.js +4 -0
- package/dist/studio/assets/context-dY4fNbn3.js +1 -0
- package/dist/studio/assets/editor-CE07wW83.js +137 -0
- package/dist/studio/assets/gateway-BAyQgCse.js +10 -0
- package/dist/studio/assets/index-CjoaPLhZ.js +28 -0
- package/dist/studio/assets/index-s2rPqCmP.css +2 -0
- package/dist/studio/assets/render-BkxbK2St.js +83 -0
- package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +1 -0
- package/dist/studio/index.html +76 -0
- package/package.json +75 -0
- package/src/Authoring.d.ts +46 -0
- package/src/Authoring.js +1 -0
- package/src/AuthoringSchema-BQ5kbhVB.js +926 -0
- package/src/AuthoringSchema-BQ5kbhVB.js.map +1 -0
- package/src/Configuration-BGYFD2N1.js +150 -0
- package/src/Configuration-BGYFD2N1.js.map +1 -0
- package/src/Configuration.d.ts +44 -0
- package/src/Configuration.js +9 -0
- package/src/Configuration.js.map +1 -0
- package/src/DocumentEngine-Da0kWotL.js +851 -0
- package/src/DocumentEngine-Da0kWotL.js.map +1 -0
- package/src/DocumentModel.d.ts +30 -0
- package/src/DocumentModel.js +15 -0
- package/src/DocumentModel.js.map +1 -0
- package/src/HttpPaths-86qLGB90.js +15 -0
- package/src/HttpPaths-86qLGB90.js.map +1 -0
- package/src/Module.d.ts +12 -0
- package/src/Module.js +167 -0
- package/src/Module.js.map +1 -0
- package/src/StudioHttp-BTLLooh0.js +916 -0
- package/src/StudioHttp-BTLLooh0.js.map +1 -0
- package/src/connection-ZGtL54qY.js +94 -0
- package/src/connection-ZGtL54qY.js.map +1 -0
- package/src/installation-BNKaVjni.js +9128 -0
- package/src/installation-BNKaVjni.js.map +1 -0
- package/src/internal/authoring-compiler.js +120 -0
- package/src/internal/authoring-compiler.js.map +1 -0
- package/src/internal/authoring-metadata.js +163 -0
- package/src/internal/authoring-metadata.js.map +1 -0
- package/src/internal/cms-config.js +46 -0
- package/src/internal/cms-config.js.map +1 -0
- package/src/internal/component-metadata.js +37 -0
- package/src/internal/component-metadata.js.map +1 -0
- package/src/internal/configuration.js +93 -0
- package/src/internal/configuration.js.map +1 -0
- package/src/internal/document-model.js +236 -0
- package/src/internal/document-model.js.map +1 -0
- package/src/internal/field-metadata.js +6 -0
- package/src/internal/field-metadata.js.map +1 -0
- package/src/metadata-Czvi3E4K.js +190 -0
- package/src/metadata-Czvi3E4K.js.map +1 -0
- package/src/models-Citx8jBi.js +306 -0
- package/src/models-Citx8jBi.js.map +1 -0
- package/src/models-DS5ClMsH.js +153 -0
- package/src/models-DS5ClMsH.js.map +1 -0
- package/src/runtime/api.js +9 -0
- package/src/runtime/api.js.map +1 -0
- package/src/runtime/collaboration.js +40 -0
- package/src/runtime/collaboration.js.map +1 -0
- package/src/runtime/delivery/DocumentField.js +23 -0
- package/src/runtime/delivery/DocumentField.js.map +1 -0
- package/src/runtime/delivery/DocumentRenderer.js +51 -0
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -0
- package/src/runtime/delivery/DocumentScope.js +41 -0
- package/src/runtime/delivery/DocumentScope.js.map +1 -0
- package/src/runtime/delivery/document-page.js +23 -0
- package/src/runtime/delivery/document-page.js.map +1 -0
- package/src/runtime/delivery/document.js +25 -0
- package/src/runtime/delivery/document.js.map +1 -0
- package/src/runtime/delivery/preview.d.ts +11 -0
- package/src/runtime/delivery/preview.js +6 -0
- package/src/runtime/delivery/preview.js.map +1 -0
- package/src/runtime/delivery/types.d.ts +80 -0
- package/src/runtime/delivery/types.js +1 -0
- package/src/runtime/delivery/useDocument.d.ts +6 -0
- package/src/runtime/delivery/useDocument.js +20 -0
- package/src/runtime/delivery/useDocument.js.map +1 -0
- package/src/runtime/delivery/useDocumentQuery.d.ts +7 -0
- package/src/runtime/delivery/useDocumentQuery.js +26 -0
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -0
- package/src/runtime/installation.js +3 -0
- package/src/runtime/plugin.js +32 -0
- package/src/runtime/plugin.js.map +1 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js +15 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +1 -0
- package/src/runtime/preview/comark-document.js +38 -0
- package/src/runtime/preview/comark-document.js.map +1 -0
- package/src/runtime/preview/connection.js +3 -0
- package/src/runtime/preview/controller.js +247 -0
- package/src/runtime/preview/controller.js.map +1 -0
- package/src/runtime/preview/plugin.client.js +70 -0
- package/src/runtime/preview/plugin.client.js.map +1 -0
- package/src/runtime/preview/preview.css +9 -0
- package/src/runtime/preview/protocol.d.ts +10 -0
- package/src/runtime/preview/protocol.js +11 -0
- package/src/runtime/preview/protocol.js.map +1 -0
- package/src/runtime/preview/store.js +4 -0
- package/src/runtime/preview/targets.js +102 -0
- package/src/runtime/preview/targets.js.map +1 -0
- package/src/runtime/studio-app.js +13 -0
- package/src/runtime/studio-app.js.map +1 -0
- package/src/store-Nl4uxEXx.js +221 -0
- package/src/store-Nl4uxEXx.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentEngine-Da0kWotL.js","names":["nestedValue","PublicPathSchema","CmsDocumentAnalysisSchema","visit","isDocumentParseFailed","DocumentSourceMappingSchema","EffectResult","CompiledDocumentSchema","DocumentParseFailedError","DocumentValidationResultSchema"],"sources":["../../../../protocol/src/internal/documents/address.ts","../../../../document/src/internal/document-engine/errors.ts","../../../../document/src/internal/comark/analysis.ts","../../../../document/src/internal/document-engine/frontmatter-validation.ts","../../../../document/src/internal/document-engine/compilation.ts","../../../../document/src/internal/document-engine/catalog-lookup.ts","../../../../document/src/internal/document-engine/catalog-issues.ts","../../../../document/src/internal/document-engine/component-validation.ts","../../../../document/src/internal/document-engine/reference-target.ts","../../../../document/src/internal/document-engine/references.ts","../../../../document/src/internal/document-engine/catalog.ts","../../../../document/src/internal/document-engine/configuration.ts","../../../../document/src/DocumentEngine.ts"],"sourcesContent":["import type { LocaleConfiguration } from '../../Configuration'\nimport type { AddressPattern, Locale } from '../configuration/scalars'\nimport { Predicate, Result, Schema } from 'effect'\nimport { PublicPath as PublicPathSchema, type PublicPath } from './scalars'\n\nexport interface DocumentAddressToken {\n readonly catchAll: boolean\n readonly name: string\n}\n\nexport interface DocumentAddress {\n readonly pattern: AddressPattern\n readonly tokens: ReadonlyArray<DocumentAddressToken>\n}\n\nexport interface DocumentAddressError {\n readonly field?: string\n readonly message: string\n}\n\nconst addressTokenPattern = /:([a-z][\\w.]*)(\\*)?/giu\n\nexport function parseDocumentAddress(pattern: AddressPattern): Result.Result<DocumentAddress, DocumentAddressError> {\n const matches = [...pattern.matchAll(addressTokenPattern)]\n const tokens = matches.map((match) => ({\n catchAll: match[2] === '*',\n name: match[1] ?? '',\n }))\n const remainder = pattern.replace(addressTokenPattern, '')\n\n if (remainder.includes(':') || tokens.some((token) => !token.name)) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains an invalid token.`,\n })\n }\n if (tokens.filter((token) => token.catchAll).length > 1) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains more than one catch-all token.`,\n })\n }\n if (new Set(tokens.map((token) => token.name)).size !== tokens.length) {\n return Result.fail({\n field: 'addressPattern',\n message: `Document address pattern \"${pattern}\" contains duplicate tokens.`,\n })\n }\n\n return Result.succeed({ pattern, tokens })\n}\n\nexport function resolveDocumentAddress(\n address: DocumentAddress,\n relativeKey: PublicPath,\n data: Schema.JsonObject,\n): Result.Result<PublicPath, DocumentAddressError> {\n const relativePath = relativeKey === '/' ? '' : relativeKey.slice(1)\n let resolved: string = address.pattern\n\n for (const token of address.tokens) {\n const authored = nestedValue(data, token.name)\n const fallback = token.catchAll ? relativePath : undefined\n const value =\n authored === undefined ? fallback : Predicate.isString(authored) && authored.trim() ? authored : undefined\n\n if (value === undefined) {\n return Result.fail({\n field: token.name,\n message:\n authored === undefined\n ? `Document address field \"${token.name}\" is required by pattern \"${address.pattern}\".`\n : `Document address field \"${token.name}\" must be a non-empty string.`,\n })\n }\n\n const normalized = token.catchAll ? normalizeDocumentRelativePath(value) : normalizeDocumentSegment(value)\n if (Result.isFailure(normalized)) return Result.fail(normalized.failure)\n resolved = resolved.replace(`:${token.name}${token.catchAll ? '*' : ''}`, normalized.success)\n }\n\n return normalizePublicPath(resolved)\n}\n\nexport function documentKeyFromSourcePath(relativeSourcePath: string): Result.Result<PublicPath, DocumentAddressError> {\n const extension = relativeSourcePath.match(/\\.(?:md|mdc)$/iu)?.[0]\n if (!extension) {\n return Result.fail({\n field: 'sourcePath',\n message: `Document source must be a Markdown file: \"${relativeSourcePath}\".`,\n })\n }\n\n const segments = relativeSourcePath.slice(0, -extension.length).split('/')\n if (segments.at(-1)?.toLocaleLowerCase() === 'index') segments.pop()\n\n return normalizeDocumentRelativePath(segments.join('/')).pipe(Result.flatMap(normalizePublicPath))\n}\n\nexport function localizeDocumentPath(\n key: PublicPath,\n locale: Locale | undefined,\n configuration: LocaleConfiguration | undefined,\n): PublicPath {\n if (!configuration || !locale || (locale === configuration.defaultLocale && !configuration.prefixDefaultLocale)) {\n return key\n }\n return PublicPathSchema.make(`/${locale}${key === '/' ? '' : key}`)\n}\n\nexport function normalizePublicPath(value: string): Result.Result<PublicPath, DocumentAddressError> {\n const path = `/${value.replace(/\\\\/gu, '/').replace(/^\\/+|\\/+$/gu, '')}`.replace(/\\/{2,}/gu, '/')\n return Schema.decodeResult(PublicPathSchema)(path).pipe(\n Result.mapError(() => ({\n field: 'path',\n message: `Document path \"${value}\" cannot be normalized into a public path.`,\n })),\n )\n}\n\nexport function normalizeDocumentRelativePath(value: string): Result.Result<string, DocumentAddressError> {\n if (!value.trim()) return Result.succeed('')\n\n const segments = value.replace(/\\\\/gu, '/').split('/').filter(Boolean)\n const normalized: string[] = []\n for (const segment of segments) {\n const result = normalizeDocumentSegment(segment)\n if (Result.isFailure(result)) return result\n normalized.push(result.success)\n }\n return Result.succeed(normalized.join('/'))\n}\n\nexport function normalizeDocumentSegment(value: string): Result.Result<string, DocumentAddressError> {\n const normalized = value\n .trim()\n .normalize('NFKC')\n .toLocaleLowerCase()\n .replace(/[^\\p{Letter}\\p{Number}_-]+/gu, '-')\n .replace(/^-+|-+$/gu, '')\n\n return normalized\n ? Result.succeed(normalized)\n : Result.fail({ message: `Document path segment \"${value}\" is empty after normalization.` })\n}\n\nfunction nestedValue(value: Schema.JsonObject, path: string): Schema.Json | undefined {\n return path.split('.').reduce<Schema.Json | undefined>((current, segment) => {\n if (!Schema.is(Schema.JsonObject)(current)) return undefined\n return current[segment]\n }, value)\n}\n","import { DocumentIssue } from '@internal/protocol/Documents'\nimport { SourcePath } from '@internal/protocol/Documents'\nimport { Schema } from 'effect'\n\nexport class DocumentEngineConfigurationInvalid extends Schema.TaggedError<DocumentEngineConfigurationInvalid>()(\n 'DocumentEngine.ConfigurationInvalid',\n {\n message: Schema.NonEmptyString,\n field: Schema.optionalKey(Schema.NonEmptyString),\n },\n) {}\n\nexport class DocumentParseFailed extends Schema.TaggedError<DocumentParseFailed>()(\n 'DocumentEngine.DocumentParseFailed',\n {\n sourcePath: SourcePath,\n cause: Schema.Defect(),\n },\n) {}\n\nexport class DocumentCompilationFailed extends Schema.TaggedError<DocumentCompilationFailed>()(\n 'DocumentEngine.DocumentCompilationFailed',\n {\n issues: Schema.Array(DocumentIssue),\n },\n) {}\n","import type { CmsDocumentAnalysis, CmsMarkdownDocument, MarkdownNode } from '@internal/protocol/Documents'\nimport { CmsDocumentAnalysis as CmsDocumentAnalysisSchema } from '@internal/protocol/Documents'\nimport { Predicate } from 'effect'\nimport { cmsComarkTextContent } from './document-adapter'\n\nexport const CMS_STANDARD_TAGS = new Set([\n 'a',\n 'abbr',\n 'address',\n 'article',\n 'aside',\n 'b',\n 'blockquote',\n 'br',\n 'button',\n 'caption',\n 'code',\n 'col',\n 'colgroup',\n 'dd',\n 'del',\n 'details',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'i',\n 'img',\n 'kbd',\n 'li',\n 'main',\n 'mark',\n 'nav',\n 'ol',\n 'p',\n 'pre',\n 'q',\n 's',\n 'section',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'tfoot',\n 'th',\n 'thead',\n 'tr',\n 'u',\n 'ul',\n])\n\nexport function analyzeCmsDocument(\n body: CmsMarkdownDocument,\n metadata: { readonly description?: string; readonly title: string },\n): CmsDocumentAnalysis {\n const headings: Array<{ readonly depth: number; readonly id: string; readonly text: string }> = []\n const components = new Set<string>()\n\n visit(body.nodes, (node) => {\n const tag = node[0].toLocaleLowerCase()\n if (/^h[1-6]$/u.test(tag)) {\n headings.push({\n depth: Number(tag.slice(1)),\n id: Predicate.isString(node[1].id) ? node[1].id : '',\n text: cmsComarkTextContent(node).trim(),\n })\n } else if (!CMS_STANDARD_TAGS.has(tag)) {\n components.add(tag)\n }\n })\n\n const bodyText = normalizeText(body.nodes.map(cmsComarkTextContent).join(' '))\n const summary = normalizeText(metadata.description ?? firstParagraph(body.nodes) ?? metadata.title)\n const searchText = normalizeText([metadata.title, metadata.description, bodyText].filter(Boolean).join(' '))\n\n return CmsDocumentAnalysisSchema.make({\n components: [...components].sort(),\n headings,\n searchText,\n summary,\n })\n}\n\nfunction visit(\n nodes: ReadonlyArray<MarkdownNode>,\n inspect: (node: Exclude<MarkdownNode, string | readonly [null, object, string]>) => void,\n): void {\n for (const node of nodes) {\n if (Predicate.isString(node) || node[0] === null) continue\n inspect(node)\n const [, , ...children] = node\n visit(children, inspect)\n }\n}\n\nfunction firstParagraph(nodes: ReadonlyArray<MarkdownNode>): string | undefined {\n const paragraph = nodes.find((node) => Array.isArray(node) && node[0] === 'p')\n if (!paragraph || Predicate.isString(paragraph) || paragraph[0] === null) return undefined\n const text = normalizeText(cmsComarkTextContent(paragraph))\n return text || undefined\n}\n\nfunction normalizeText(value: string): string {\n return value.replace(/\\s+/gu, ' ').trim()\n}\n","import type { CollectionDefinition } from '@internal/protocol/Configuration'\nimport type { DocumentIssue } from '@internal/protocol/Documents'\nimport type { SourcePath } from '@internal/protocol/Documents'\nimport type { DocumentSchemaIssue, ExecutableDocumentSchema } from './document-schema'\nimport { Effect, Predicate, Schema } from 'effect'\n\nexport const validateFrontmatter = Effect.fn('DocumentEngine.validateFrontmatter')(function* (\n raw: Schema.JsonObject,\n schema: ExecutableDocumentSchema,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n) {\n const projection = schema.project(raw)\n const issues = projection.unknownPaths\n .toSorted()\n .map((path): DocumentIssue => unknownFieldIssue(path, type, sourcePath))\n const result = yield* schema.validate(projection.value)\n\n if ('issues' in result) {\n issues.push(...result.issues.map((issue) => schemaIssue(issue, projection.value, type, sourcePath)))\n return { data: projection.value, issues }\n }\n\n const parsed = Schema.decodeUnknownOption(Schema.JsonObject)(result.value)\n if (parsed._tag === 'None') {\n issues.push(\n issue(\n 'schema.constraint',\n 'The collection schema output must be a JSON-compatible object.',\n type,\n sourcePath,\n 'frontmatter',\n ),\n )\n return { data: projection.value, issues }\n }\n\n return issues.length === 0 ? { data: parsed.value, issues } : { data: projection.value, issues }\n})\n\nfunction unknownFieldIssue(path: string, type: CollectionDefinition, sourcePath: SourcePath): DocumentIssue {\n if (path === 'id') {\n return issue(\n 'document.id',\n 'Document identity is managed by the CMS and cannot be authored in frontmatter.',\n type,\n sourcePath,\n path,\n )\n }\n return issue(\n 'schema.unknown',\n `Frontmatter field \"${path}\" is not declared by collection \"${type.collection}\".`,\n type,\n sourcePath,\n path,\n )\n}\n\nfunction schemaIssue(\n error: DocumentSchemaIssue,\n input: Schema.JsonObject,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n): DocumentIssue {\n const field = issuePath(error.path)\n const code = issueCode(error, input, field)\n return issue(code, error.message, type, sourcePath, field || undefined)\n}\n\nfunction issueCode(error: DocumentSchemaIssue, input: Schema.JsonObject, field: string): DocumentIssue['code'] {\n if (error.code === 'invalid_type') return nestedValue(input, field) === undefined ? 'schema.required' : 'schema.type'\n if (error.code === 'invalid_value') return 'schema.option'\n return 'schema.constraint'\n}\n\nfunction issuePath(path: DocumentSchemaIssue['path']): string {\n return (path ?? [])\n .map((segment) => (Predicate.hasProperty(segment, 'key') ? segment.key : segment))\n .map(String)\n .join('.')\n}\n\nfunction nestedValue(value: Schema.JsonObject, path: string): Schema.Json | undefined {\n if (!path) return value\n return path.split('.').reduce<Schema.Json | undefined>((current, segment) => {\n if (Array.isArray(current)) {\n const index = Number(segment)\n return Number.isSafeInteger(index) ? current[index] : undefined\n }\n return Schema.is(Schema.JsonObject)(current) ? current[segment] : undefined\n }, value)\n}\n\nfunction issue(\n code: DocumentIssue['code'],\n message: string,\n type: CollectionDefinition,\n sourcePath: SourcePath,\n field?: string,\n): DocumentIssue {\n return {\n code,\n collection: type.collection,\n ...(field === undefined ? undefined : { field }),\n message,\n severity: 'error',\n sourcePath,\n }\n}\n","import type {\n DocumentIssue,\n DocumentSourceMapping,\n CmsMarkdownDocument as MarkdownDocumentType,\n} from '@internal/protocol/Documents'\nimport type { Locale } from '@internal/protocol/Configuration'\nimport type { ComarkParseFn } from 'comark'\nimport type { DocumentCompilationSource } from './compilation-source'\nimport type { ResolvedDocumentEngineConfiguration, ResolvedCollection } from './configuration'\nimport {\n CompiledDocument,\n documentKeyFromSourcePath,\n DocumentSourceMapping as DocumentSourceMappingSchema,\n localizeDocumentPath,\n CmsMarkdownDocument,\n resolveDocumentAddress,\n} from '@internal/protocol/Documents'\nimport { PublicPath } from '@internal/protocol/Documents'\nimport { Effect, Predicate, Result, Schema } from 'effect'\nimport { DocumentCompilationFailed, DocumentParseFailed } from './errors'\nimport { normalizeCmsComponentBindings } from '../comark/bindings'\nimport { analyzeCmsDocument } from '../comark/analysis'\nimport { DOCUMENT_ENGINE_FINGERPRINT } from '../comark/grammar'\nimport { validateFrontmatter } from './frontmatter-validation'\nimport { SOURCE_MAPPINGS_META_KEY } from '../comark/source-mapping'\nimport { validateAuthoringDocument } from '../../AuthoringSchema'\n\nconst isDocumentParseFailed = Schema.is(DocumentParseFailed)\n\nexport const compileCompiledDocument = Effect.fn('DocumentEngine.compileDocument')(function* (\n configuration: ResolvedDocumentEngineConfiguration,\n parseMarkdown: ComarkParseFn,\n source: DocumentCompilationSource,\n) {\n const location = yield* resolveSourceLocation(configuration, source)\n const parsedBody = yield* parseBody(parseMarkdown, source)\n const mappings = yield* sourceMappings(parsedBody, source)\n const body = normalizeCmsComponentBindings(withoutSourceMappings(parsedBody), configuration.components)\n const relativeKey = yield* fromAddressResult(\n documentKeyFromSourcePath(location.relativeSourcePath),\n source.sourcePath,\n )\n const validation = yield* validateFrontmatter(\n body.frontmatter,\n location.type.schema,\n location.type.definition,\n source.sourcePath,\n ).pipe(\n Effect.mapError(\n (cause) =>\n new DocumentCompilationFailed({\n issues: [\n {\n code: 'schema.constraint',\n collection: location.type.definition.collection,\n message: cause.message,\n severity: 'error',\n sourcePath: source.sourcePath,\n },\n ],\n }),\n ),\n )\n const address = resolveDocumentAddress(location.type.address, relativeKey, validation.data)\n const key = Result.isSuccess(address) ? address.success : provisionalKey(source.documentId)\n const path = localizeDocumentPath(key, location.locale, configuration.documents.locales)\n const title =\n stringValue(validation.data.title) ?? stringValue(body.meta.title) ?? titleFromSource(location.relativeSourcePath)\n const description = stringValue(validation.data.description) ?? stringValue(body.meta.description)\n const issues = Result.isSuccess(address)\n ? validation.issues\n : [...validation.issues, addressIssue(address.failure, source.sourcePath)]\n const canonicalBody = CmsMarkdownDocument.make({ frontmatter: validation.data, meta: body.meta, nodes: body.nodes })\n const analysis = analyzeCmsDocument(canonicalBody, description === undefined ? { title } : { description, title })\n\n return CompiledDocument.make(\n Object.assign(\n {\n id: source.documentId,\n key,\n path,\n collection: location.type.definition.collection,\n draft: source.draft,\n title,\n data: validation.data,\n issues: [\n ...issues,\n ...validateAuthoringDocument(canonicalBody, configuration.components).map((message): DocumentIssue => ({\n code: 'reference.component',\n message,\n severity: 'error',\n sourcePath: source.sourcePath,\n })),\n ],\n analysis,\n body: canonicalBody,\n engineFingerprint: DOCUMENT_ENGINE_FINGERPRINT,\n source: {\n path: source.sourcePath,\n mappings,\n },\n },\n location.locale === undefined ? undefined : { locale: location.locale },\n description === undefined ? undefined : { description },\n ),\n )\n})\n\nfunction provisionalKey(documentId: DocumentCompilationSource['documentId']): PublicPath {\n return PublicPath.make(`/_cms-invalid/${documentId}`)\n}\n\nfunction addressIssue(\n error: { readonly field?: string; readonly message: string },\n sourcePath: DocumentCompilationSource['sourcePath'],\n): DocumentIssue {\n const issue = {\n code: 'document.invalid' as const,\n message: error.message,\n severity: 'error' as const,\n sourcePath,\n }\n return error.field === undefined ? issue : { ...issue, field: error.field }\n}\n\ninterface SourceLocation {\n readonly locale?: Locale\n readonly relativeSourcePath: string\n readonly type: ResolvedCollection\n}\n\nfunction resolveSourceLocation(\n configuration: ResolvedDocumentEngineConfiguration,\n source: DocumentCompilationSource,\n): Effect.Effect<SourceLocation, DocumentCompilationFailed> {\n const segments = source.sourcePath.split('/')\n let locale: Locale | undefined\n if (configuration.documents.locales) {\n const candidate = segments.shift()\n locale = configuration.documents.locales.locales.find((value) => value === candidate)\n if (!locale) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'locale',\n message: `Localized document \"${source.sourcePath}\" must begin with a configured locale.`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n }\n\n const localizedSourcePath = segments.join('/')\n const type = configuration.types.find(\n ({ definition }) => definition.directory === '.' || localizedSourcePath.startsWith(`${definition.directory}/`),\n )\n if (!type) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'sourcePath',\n message: `No document collection contains \"${source.sourcePath}\".`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n\n const relativeSourcePath =\n type.definition.directory === '.'\n ? localizedSourcePath\n : localizedSourcePath.slice(type.definition.directory.length + 1)\n if (!relativeSourcePath) {\n return compilationFailure({\n code: 'document.invalid',\n field: 'sourcePath',\n message: `Document source \"${source.sourcePath}\" has no collection-relative path.`,\n severity: 'error',\n sourcePath: source.sourcePath,\n })\n }\n\n return Effect.succeed(locale === undefined ? { relativeSourcePath, type } : { locale, relativeSourcePath, type })\n}\n\nfunction parseBody(\n parseMarkdown: ComarkParseFn,\n source: DocumentCompilationSource,\n): Effect.Effect<MarkdownDocumentType, DocumentParseFailed> {\n return Effect.tryPromise({\n try: () => parseMarkdown(source.markdown),\n catch: (cause) => new DocumentParseFailed({ cause, sourcePath: source.sourcePath }),\n }).pipe(\n Effect.flatMap(Schema.decodeUnknownEffect(CmsMarkdownDocument)),\n Effect.mapError((cause) =>\n isDocumentParseFailed(cause) ? cause : new DocumentParseFailed({ cause, sourcePath: source.sourcePath }),\n ),\n )\n}\n\nfunction sourceMappings(\n body: MarkdownDocumentType,\n source: DocumentCompilationSource,\n): Effect.Effect<ReadonlyArray<DocumentSourceMapping>, DocumentParseFailed> {\n return Schema.decodeUnknownEffect(Schema.Array(DocumentSourceMappingSchema))(\n body.meta[SOURCE_MAPPINGS_META_KEY] ?? [],\n ).pipe(Effect.mapError((cause) => new DocumentParseFailed({ cause, sourcePath: source.sourcePath })))\n}\n\nfunction withoutSourceMappings(body: MarkdownDocumentType): MarkdownDocumentType {\n const { [SOURCE_MAPPINGS_META_KEY]: _mappings, ...meta } = body.meta\n return CmsMarkdownDocument.make({ frontmatter: body.frontmatter, meta, nodes: body.nodes })\n}\n\nfunction fromAddressResult<A>(\n result: Result.Result<A, { readonly field?: string; readonly message: string }>,\n sourcePath: DocumentCompilationSource['sourcePath'],\n): Effect.Effect<A, DocumentCompilationFailed> {\n if (Result.isSuccess(result)) return Effect.succeed(result.success)\n return compilationFailure(addressIssue(result.failure, sourcePath))\n}\n\nfunction compilationFailure(issue: DocumentIssue): Effect.Effect<never, DocumentCompilationFailed> {\n return Effect.fail(new DocumentCompilationFailed({ issues: [issue] }))\n}\n\nfunction stringValue(value: Schema.Json | undefined): string | undefined {\n return Predicate.isString(value) && value.trim() ? value.trim() : undefined\n}\n\nfunction titleFromSource(sourcePath: string): string {\n const file = sourcePath.split('/').at(-1) ?? 'content'\n const stem = file.replace(/\\.(?:md|mdc)$/iu, '')\n const title = stem.toLocaleLowerCase() === 'index' ? (sourcePath.split('/').at(-2) ?? 'home') : stem\n return title.replace(/[-_]+/gu, ' ').replace(/^./u, (character) => character.toLocaleUpperCase())\n}\n","import type { Locale } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, PublicPath } from '@internal/protocol/Documents'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport { normalizePublicPath } from '@internal/protocol/Documents'\nimport { Option, Result } from 'effect'\n\nexport interface CatalogLookup {\n readonly findByKey: (key: string, locale?: Locale) => Option.Option<CompiledDocument>\n readonly findByPath: (path: string) => Option.Option<CompiledDocument>\n}\n\nexport function createCatalogLookup(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n): CatalogLookup {\n const byPath = new Map(documents.map((document) => [document.path, document]))\n const byVariant = new Map(documents.map((document) => [localeAndKey(document.locale, document.key), document]))\n\n const findByKey = (input: string, locale?: Locale) => {\n const keyResult = normalizePublicPath(input)\n if (Result.isFailure(keyResult)) return Option.none<CompiledDocument>()\n const key = keyResult.success\n const locales = configuration.documents.locales\n if (!locales) return Option.fromNullishOr(byVariant.get(localeAndKey(undefined, key)))\n const requestedLocale = locale ?? locales.defaultLocale\n const localized = byVariant.get(localeAndKey(requestedLocale, key))\n if (localized) return Option.some(localized)\n if (!locales.fallbackLocale) return Option.none()\n return Option.fromNullishOr(byVariant.get(localeAndKey(locales.fallbackLocale, key)))\n }\n\n const findByPath = (input: string) => {\n const pathResult = normalizePublicPath(input)\n if (Result.isFailure(pathResult)) return Option.none<CompiledDocument>()\n const path = pathResult.success\n const direct = byPath.get(path)\n if (direct) return Option.some(direct)\n\n const locales = configuration.documents.locales\n if (!locales) return Option.none()\n const request = localizedRequest(path, locales.locales, locales.defaultLocale, locales.prefixDefaultLocale)\n if (!request) return Option.none()\n const localized = byVariant.get(localeAndKey(request.locale, request.key))\n if (localized) return Option.some(localized)\n if (!locales.fallbackLocale) return Option.none()\n return Option.fromNullishOr(byVariant.get(localeAndKey(locales.fallbackLocale, request.key)))\n }\n\n return { findByKey, findByPath }\n}\n\nexport function localeAndKey(locale: Locale | undefined, key: PublicPath): string {\n return `${locale ?? ''}:${key}`\n}\n\nfunction localizedRequest(\n path: PublicPath,\n locales: ReadonlyArray<Locale>,\n defaultLocale: Locale,\n prefixDefaultLocale: boolean,\n): { readonly key: PublicPath; readonly locale: Locale } | undefined {\n const segments = path === '/' ? [] : path.slice(1).split('/')\n const possibleLocale = locales.find((locale) => locale === segments[0])\n const prefixedLocale =\n possibleLocale && (possibleLocale !== defaultLocale || prefixDefaultLocale) ? possibleLocale : undefined\n if (prefixedLocale) {\n const keyResult = normalizePublicPath(segments.slice(1).join('/'))\n return Result.isSuccess(keyResult) ? { key: keyResult.success, locale: prefixedLocale } : undefined\n }\n if (prefixDefaultLocale) return undefined\n return { key: path, locale: defaultLocale }\n}\n","import type { CompiledDocument, DocumentIssue, PublicPath } from '@internal/protocol/Documents'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport { localeAndKey } from './catalog-lookup'\n\nexport function collisionIssues(documents: ReadonlyArray<CompiledDocument>): DocumentIssue[] {\n const issues: DocumentIssue[] = []\n const byId = new Map<string, CompiledDocument>()\n const byPath = new Map<string, CompiledDocument>()\n const byVariant = new Map<string, CompiledDocument>()\n\n for (const document of documents) {\n const identityCollision = byId.get(document.id)\n if (identityCollision) {\n issues.push(\n collisionIssue(\n `Document identity collision for \"${document.id}\" between \"${identityCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n ),\n )\n } else byId.set(document.id, document)\n\n const pathCollision = byPath.get(document.path)\n if (pathCollision) {\n issues.push(\n collisionIssue(\n `Document route collision at \"${document.path}\" between \"${pathCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n document.path,\n ),\n )\n } else byPath.set(document.path, document)\n\n const variant = localeAndKey(document.locale, document.key)\n const variantCollision = byVariant.get(variant)\n if (variantCollision && variantCollision.path !== pathCollision?.path) {\n issues.push(\n collisionIssue(\n `Document locale collision at \"${document.key}\" between \"${variantCollision.source.path}\" and \"${document.source.path}\".`,\n document,\n document.key,\n ),\n )\n } else byVariant.set(variant, document)\n }\n return issues\n}\n\nexport function translationIssues(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n): DocumentIssue[] {\n const locales = configuration.documents.locales\n if (!locales) return []\n const variants = new Set(documents.map((document) => localeAndKey(document.locale, document.key)))\n const keys = new Set(documents.map((document) => document.key))\n return [...keys].flatMap((key) =>\n locales.locales.flatMap((locale): DocumentIssue[] =>\n variants.has(localeAndKey(locale, key))\n ? []\n : [\n {\n code: 'i18n.missing-translation',\n key,\n locale,\n message: `Document \"${key}\" is missing its \"${locale}\" translation.`,\n severity: 'warning',\n },\n ],\n ),\n )\n}\n\nfunction collisionIssue(message: string, document: CompiledDocument, key?: PublicPath): DocumentIssue {\n const issue = {\n code: 'document.collision' as const,\n message,\n severity: 'error' as const,\n sourcePath: document.source.path,\n }\n return key === undefined ? issue : Object.assign(issue, { key })\n}\n","import type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport type { MarkdownNode } from '@internal/protocol/Documents'\nimport type { CmsComarkAttributes } from '../comark/bindings'\nimport { Predicate } from 'effect'\nimport { matchesCmsComponentPropType } from '../comark/bindings'\n\nexport function componentValidationMessages(\n definition: ComponentDefinition,\n attributes: CmsComarkAttributes,\n children: ReadonlyArray<MarkdownNode>,\n): ReadonlyArray<string> {\n // Authored blocks are validated during compilation, including single-document validation.\n if (definition.authoring) return []\n const messages: string[] = []\n const props = new Map(definition.props.map((prop) => [prop.name, prop]))\n for (const prop of definition.props) {\n if (prop.required && attributes.get(prop.name) === undefined) {\n messages.push(`Document component \"${definition.name}\" requires prop \"${prop.name}\".`)\n }\n }\n for (const [name, value] of attributes) {\n if (name === '$' || name === 'class' || name === 'id' || name === 'style') continue\n const prop = props.get(name)\n if (!prop) {\n messages.push(`Document component \"${definition.name}\" does not define prop \"${name}\".`)\n } else if (!matchesCmsComponentPropType(value, prop.type)) {\n messages.push(\n `Document component \"${definition.name}\" prop \"${name}\" must be ${article(prop.type)} ${prop.type}.`,\n )\n }\n }\n\n const slots = new Set(definition.slots.map((slot) => slot.name))\n const explicitSlots = children.flatMap((node) => {\n if (Predicate.isString(node) || node[0] !== 'template') return []\n return [Predicate.isString(node[1].name) ? node[1].name : 'default']\n })\n const hasImplicitDefault = children.some((node) =>\n Predicate.isString(node) ? Boolean(node.trim()) : node[0] !== 'template',\n )\n if (hasImplicitDefault && !slots.has('default')) explicitSlots.push('default')\n for (const name of new Set(explicitSlots)) {\n if (!slots.has(name)) messages.push(`Document component \"${definition.name}\" does not define slot \"${name}\".`)\n }\n return messages\n}\n\nfunction article(type: ComponentDefinition['props'][number]['type']): 'a' | 'an' {\n return type === 'array' || type === 'object' ? 'an' : 'a'\n}\n","import type { PublicPath } from '@internal/protocol/Documents'\nimport type { CmsComarkAttributeValue, CmsComarkAttributes } from '../comark/bindings'\nimport { normalizePublicPath } from '@internal/protocol/Documents'\nimport { Predicate, Result } from 'effect'\nimport { CMS_STANDARD_TAGS } from '../comark/analysis'\n\nexport type DocumentReferenceTarget =\n | { readonly kind: 'component'; readonly name: string }\n | { readonly kind: 'document'; readonly path: PublicPath }\n | { readonly kind: 'media'; readonly key: string }\n\nexport function referenceTarget(\n tag: string,\n attributes: CmsComarkAttributes,\n documentPath: PublicPath,\n mediaBaseUrl: string | undefined,\n): DocumentReferenceTarget | undefined {\n if (tag === 'a') {\n const path = documentTarget(attributes.get('href'), documentPath)\n return path ? { kind: 'document', path } : undefined\n }\n if (tag === 'img') {\n const key = mediaKey(attributes.get('src'), mediaBaseUrl)\n return key ? { kind: 'media', key } : undefined\n }\n\n const normalizedTag = tag.toLocaleLowerCase()\n return CMS_STANDARD_TAGS.has(normalizedTag) ? undefined : { kind: 'component', name: normalizedTag }\n}\n\nexport function targetKey(target: DocumentReferenceTarget): string {\n switch (target.kind) {\n case 'component':\n return `component:${target.name.toLocaleLowerCase()}`\n case 'document':\n return `document:${target.path}`\n case 'media':\n return `media:${target.key}`\n }\n}\n\nfunction mediaKey(value: CmsComarkAttributeValue, mediaBaseUrl: string | undefined): string | undefined {\n if (!Predicate.isString(value) || mediaBaseUrl === undefined) return undefined\n const prefix = `${mediaBaseUrl}/`\n if (!value.startsWith(prefix)) return undefined\n const encodedKey = value.slice(prefix.length).split(/[?#]/u, 1)[0]\n if (!encodedKey) return undefined\n\n try {\n const segments = encodedKey.split('/').map(decodeURIComponent)\n if (\n segments.some(\n (segment) =>\n !segment ||\n segment === '.' ||\n segment === '..' ||\n segment.includes('/') ||\n segment.includes('\\\\') ||\n hasControlCharacter(segment),\n )\n ) {\n return undefined\n }\n const key = segments.join('/')\n return key.startsWith('media/') ? key : undefined\n } catch {\n return undefined\n }\n}\n\nfunction documentTarget(value: CmsComarkAttributeValue, documentPath: PublicPath): PublicPath | undefined {\n if (!Predicate.isString(value)) return undefined\n const href = value.trim()\n if (\n !href ||\n href.startsWith('#') ||\n href.startsWith('?') ||\n href.startsWith('//') ||\n /^[a-z][a-z\\d+.-]*:/iu.test(href)\n ) {\n return undefined\n }\n\n const path = href.split(/[?#]/u)[0] ?? ''\n const resolvedPath = resolveRelativePath(path, documentPath)\n const lastSegment = resolvedPath.split('/').at(-1) ?? ''\n if (lastSegment.includes('.')) return undefined\n const normalized = normalizePublicPath(resolvedPath)\n return Result.isSuccess(normalized) ? normalized.success : undefined\n}\n\nfunction resolveRelativePath(href: string, documentPath: PublicPath): string {\n const normalizedHref = href.replace(/\\\\/gu, '/')\n const segments = normalizedHref.startsWith('/') ? [] : documentPath.split('/').filter(Boolean).slice(0, -1)\n for (const segment of normalizedHref.split('/')) {\n if (!segment || segment === '.') continue\n if (segment === '..') segments.pop()\n else segments.push(segment)\n }\n return `/${segments.join('/')}`\n}\n\nfunction hasControlCharacter(value: string): boolean {\n for (const character of value) {\n const codePoint = character.codePointAt(0)\n if (codePoint !== undefined && (codePoint <= 31 || codePoint === 127)) return true\n }\n return false\n}\n","import type { CompiledDocument, DocumentId, DocumentIssue, MarkdownNode } from '@internal/protocol/Documents'\nimport type { PublicPath, SourcePath } from '@internal/protocol/Documents'\nimport type { CmsComarkAttributes } from '../comark/bindings'\nimport type { NodeRenderData } from 'comark'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport type { DocumentReferenceTarget } from './reference-target'\nimport { Option, Predicate } from 'effect'\nimport { resolveCmsComarkAttributes, withCmsComarkProps } from '../comark/bindings'\nimport { createCmsComarkRenderData } from '../comark/document-adapter'\nimport { componentValidationMessages } from './component-validation'\nimport { referenceTarget, targetKey } from './reference-target'\n\nexport type { DocumentReferenceTarget } from './reference-target'\n\nexport interface DocumentReference {\n readonly nodePath: ReadonlyArray<number>\n readonly source: {\n readonly documentId: DocumentId\n readonly path: PublicPath\n readonly sourcePath: SourcePath\n }\n readonly target: DocumentReferenceTarget\n}\n\nexport interface DocumentReferenceIndex {\n readonly all: ReadonlyArray<DocumentReference>\n readonly impact: (target: DocumentReferenceTarget) => ReadonlyArray<DocumentReference>\n}\n\ninterface IndexedDocumentReferences {\n readonly index: DocumentReferenceIndex\n readonly issues: ReadonlyMap<SourcePath, ReadonlyArray<DocumentIssue>>\n}\n\nconst noReferences: ReadonlyArray<DocumentReference> = Object.freeze([])\n\nexport function createDocumentReferenceIndex(\n documents: ReadonlyArray<CompiledDocument>,\n configuration: ResolvedDocumentEngineConfiguration,\n findByPath: (path: string) => Option.Option<CompiledDocument>,\n): IndexedDocumentReferences {\n const all: DocumentReference[] = []\n const byTarget = new Map<string, DocumentReference[]>()\n const issues = new Map<SourcePath, DocumentIssue[]>()\n\n for (const document of documents) {\n visit(document.body.nodes, createCmsComarkRenderData(document.body), (tag, attributes, children, nodePath) => {\n const target = referenceTarget(tag, attributes, document.path, configuration.mediaBaseUrl)\n if (!target) return\n\n const reference = freezeReference({\n nodePath,\n source: {\n documentId: document.id,\n path: document.path,\n sourcePath: document.source.path,\n },\n target,\n })\n all.push(reference)\n const key = targetKey(target)\n const matching = byTarget.get(key) ?? []\n matching.push(reference)\n byTarget.set(key, matching)\n\n if (target.kind === 'document' && Option.isNone(findByPath(target.path))) {\n addIssue(issues, document.source.path, {\n code: 'reference.document',\n key: target.path,\n message: `Document link \"${target.path}\" does not resolve.`,\n severity: 'error',\n sourcePath: document.source.path,\n })\n } else if (target.kind === 'component' && configuration.components) {\n const definition = configuration.components.get(target.name)\n if (!definition) {\n addIssue(\n issues,\n document.source.path,\n componentIssue(document.source.path, `Document component \"${tag}\" is not registered.`),\n )\n } else {\n for (const message of componentValidationMessages(definition, attributes, children)) {\n addIssue(issues, document.source.path, componentIssue(document.source.path, message))\n }\n }\n }\n })\n }\n\n const frozenAll = Object.freeze(all)\n const frozenByTarget = new Map([...byTarget].map(([key, references]) => [key, Object.freeze(references)] as const))\n\n return {\n index: Object.freeze({\n all: frozenAll,\n impact: (target: DocumentReferenceTarget) => frozenByTarget.get(targetKey(target)) ?? noReferences,\n }),\n issues,\n }\n}\n\nfunction visit(\n nodes: CompiledDocument['body']['nodes'],\n renderData: NodeRenderData,\n onElement: (\n tag: string,\n attributes: CmsComarkAttributes,\n children: ReadonlyArray<MarkdownNode>,\n nodePath: ReadonlyArray<number>,\n ) => void,\n parentPath: ReadonlyArray<number> = [],\n): void {\n nodes.forEach((node, index) => {\n if (Predicate.isString(node) || node[0] === null) return\n const [tag, attributes, ...children] = node\n const nodePath = [...parentPath, index]\n const resolved = resolveCmsComarkAttributes(attributes, renderData)\n onElement(tag, resolved, children, nodePath)\n const childrenRenderData = withCmsComarkProps(renderData, resolved)\n visit(children, childrenRenderData, onElement, nodePath)\n })\n}\n\nfunction freezeReference(reference: DocumentReference): DocumentReference {\n return Object.freeze({\n nodePath: Object.freeze([...reference.nodePath]),\n source: Object.freeze({ ...reference.source }),\n target: Object.freeze({ ...reference.target }),\n })\n}\n\nfunction componentIssue(sourcePath: SourcePath, message: string): DocumentIssue {\n return { code: 'reference.component', message, severity: 'error', sourcePath }\n}\n\nfunction addIssue(issues: Map<SourcePath, DocumentIssue[]>, sourcePath: SourcePath, issue: DocumentIssue): void {\n const sourceIssues = issues.get(sourcePath) ?? []\n sourceIssues.push(issue)\n issues.set(sourcePath, sourceIssues)\n}\n","import type { Locale } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, DocumentIssue } from '@internal/protocol/Documents'\nimport type { Option, Result } from 'effect'\nimport type { ResolvedDocumentEngineConfiguration } from './configuration'\nimport type { DocumentReferenceIndex } from './references'\nimport { CompiledDocument as CompiledDocumentSchema } from '@internal/protocol/Documents'\nimport { Result as EffectResult } from 'effect'\nimport { collisionIssues, translationIssues } from './catalog-issues'\nimport { createCatalogLookup } from './catalog-lookup'\nimport { DocumentCompilationFailed } from './errors'\nimport { createDocumentReferenceIndex } from './references'\n\nexport interface DocumentCatalog {\n readonly documents: ReadonlyArray<CompiledDocument>\n readonly issues: ReadonlyArray<DocumentIssue>\n readonly findByKey: (key: string, locale?: Locale) => Option.Option<CompiledDocument>\n readonly findByPath: (path: string) => Option.Option<CompiledDocument>\n readonly references: DocumentReferenceIndex\n}\n\nexport function createDocumentCatalog(\n configuration: ResolvedDocumentEngineConfiguration,\n input: ReadonlyArray<CompiledDocument>,\n): Result.Result<DocumentCatalog, DocumentCompilationFailed> {\n const documents = [...input].sort((left, right) => left.source.path.localeCompare(right.source.path))\n const collisions = collisionIssues(documents)\n if (collisions.length > 0) return EffectResult.fail(new DocumentCompilationFailed({ issues: collisions }))\n\n const lookup = createCatalogLookup(documents, configuration)\n const references = createDocumentReferenceIndex(documents, configuration, lookup.findByPath)\n const withReferenceIssues = documents.map((document) => {\n const additional = references.issues.get(document.source.path) ?? []\n return additional.length === 0\n ? document\n : CompiledDocumentSchema.make(Object.assign({}, document, { issues: [...document.issues, ...additional] }))\n })\n\n return EffectResult.succeed({\n documents: withReferenceIssues,\n issues: [\n ...withReferenceIssues.flatMap((document) => document.issues),\n ...translationIssues(withReferenceIssues, configuration),\n ],\n ...createCatalogLookup(withReferenceIssues, configuration),\n references: references.index,\n } satisfies DocumentCatalog)\n}\n","import type { ComponentDefinition, DocumentConfiguration, CollectionDefinition } from '@internal/protocol/Configuration'\nimport type { DocumentAddress } from '@internal/protocol/Documents'\nimport type { ExecutableDocumentModel, ExecutableDocumentSchema } from './document-schema'\nimport { parseDocumentAddress } from '@internal/protocol/Documents'\nimport { Result } from 'effect'\nimport { DocumentEngineConfigurationInvalid } from './errors'\n\nexport interface ResolvedCollection {\n readonly address: DocumentAddress\n readonly definition: CollectionDefinition\n readonly schema: ExecutableDocumentSchema\n}\n\nexport interface ResolvedDocumentEngineConfiguration {\n readonly components?: ReadonlyMap<string, ComponentDefinition>\n readonly documents: DocumentConfiguration\n readonly mediaBaseUrl?: string\n readonly types: ReadonlyArray<ResolvedCollection>\n}\n\nexport interface DocumentEngineOptions {\n readonly components?: ReadonlyArray<ComponentDefinition>\n readonly documentModel: ExecutableDocumentModel\n readonly mediaBaseUrl?: string\n}\n\ntype ResolvedDocumentEngineConfigurationBuilder = {\n -readonly [Key in keyof ResolvedDocumentEngineConfiguration]: ResolvedDocumentEngineConfiguration[Key]\n}\n\nexport function resolveDocumentEngineConfiguration(\n documents: DocumentConfiguration,\n options: DocumentEngineOptions,\n): Result.Result<ResolvedDocumentEngineConfiguration, DocumentEngineConfigurationInvalid> {\n if (documents.types.length === 0) return invalid('Documents must define at least one collection.', 'types')\n\n const collections = new Set<string>()\n const directories = new Map<string, string>()\n const resolved: ResolvedCollection[] = []\n\n for (const definition of documents.types) {\n if (collections.has(definition.collection)) {\n return invalid(`Document collection \"${definition.collection}\" is defined more than once.`, 'types')\n }\n collections.add(definition.collection)\n\n const existing = directories.get(definition.directory)\n if (existing) {\n return invalid(\n `Document collections \"${existing}\" and \"${definition.collection}\" use the same directory \"${definition.directory}\".`,\n 'types',\n )\n }\n directories.set(definition.directory, definition.collection)\n\n const addressResult = parseDocumentAddress(definition.addressPattern)\n if (Result.isFailure(addressResult)) return invalid(addressResult.failure.message, addressResult.failure.field)\n if (definition.hierarchy && !addressResult.success.tokens.some((token) => token.catchAll)) {\n return invalid(\n `Document collection \"${definition.collection}\" can only enable hierarchy with a catch-all address.`,\n 'types',\n )\n }\n const schema = options.documentModel.types[definition.collection]\n if (!schema)\n return invalid(`Document collection \"${definition.collection}\" has no executable schema.`, 'documentModel')\n\n resolved.push({ address: addressResult.success, definition, schema })\n }\n\n const locales = documents.locales\n if (locales) {\n if (new Set(locales.locales).size !== locales.locales.length)\n return invalid('Document locales must be unique.', 'locales.locales')\n if (!locales.locales.includes(locales.defaultLocale)) {\n return invalid(`Default locale \"${locales.defaultLocale}\" is not configured.`, 'locales.defaultLocale')\n }\n if (locales.fallbackLocale && !locales.locales.includes(locales.fallbackLocale)) {\n return invalid(`Fallback locale \"${locales.fallbackLocale}\" is not configured.`, 'locales.fallbackLocale')\n }\n }\n\n let components: ReadonlyMap<string, ComponentDefinition> | undefined\n if (options.components !== undefined) {\n const result = resolveComponents(options.components)\n if (Result.isFailure(result)) return Result.fail(result.failure)\n components = result.success\n }\n const mediaBaseUrl = options.mediaBaseUrl?.replace(/\\/+$/u, '')\n\n resolved.sort((left, right) => directoryDepth(right.definition.directory) - directoryDepth(left.definition.directory))\n\n const configuration: ResolvedDocumentEngineConfigurationBuilder = {\n documents,\n types: resolved,\n }\n if (components !== undefined) configuration.components = components\n if (mediaBaseUrl !== undefined) configuration.mediaBaseUrl = mediaBaseUrl\n return Result.succeed(configuration satisfies ResolvedDocumentEngineConfiguration)\n}\n\nfunction resolveComponents(\n definitions: ReadonlyArray<ComponentDefinition>,\n): Result.Result<ReadonlyMap<string, ComponentDefinition>, DocumentEngineConfigurationInvalid> {\n const components = new Map<string, ComponentDefinition>()\n for (const component of definitions) {\n const name = component.name.toLocaleLowerCase()\n if (components.has(name))\n return invalid(`Document component \"${component.name}\" is defined more than once.`, 'components')\n components.set(name, component)\n }\n return Result.succeed(components)\n}\n\nfunction directoryDepth(directory: string): number {\n return directory === '.' ? 0 : directory.split('/').length\n}\n\nfunction invalid(message: string, field?: string): Result.Result<never, DocumentEngineConfigurationInvalid> {\n return Result.fail(new DocumentEngineConfigurationInvalid(field === undefined ? { message } : { field, message }))\n}\n","import type { DocumentConfiguration } from '@internal/protocol/Configuration'\nimport type { CompiledDocument, DocumentIssue, DocumentValidationResult } from '@internal/protocol/Documents'\nimport type { DocumentCompilationSource } from './internal/document-engine/compilation-source'\nimport type { DocumentEngineOptions } from './internal/document-engine/configuration'\nimport type { DocumentCompilationFailed, DocumentParseFailed } from './internal/document-engine/errors'\nimport type { DocumentCatalog } from './internal/document-engine/catalog'\nimport { DocumentValidationResult as DocumentValidationResultSchema } from '@internal/protocol/Documents'\nimport { Effect, Result, Schema } from 'effect'\nimport { compileCompiledDocument } from './internal/document-engine/compilation'\nimport { DOCUMENT_ENGINE_FINGERPRINT, createDocumentParser } from './internal/comark/grammar'\nimport { createDocumentCatalog } from './internal/document-engine/catalog'\nimport { resolveDocumentEngineConfiguration } from './internal/document-engine/configuration'\nimport { DocumentParseFailed as DocumentParseFailedError } from './internal/document-engine/errors'\n\ntype CompilationError = DocumentCompilationFailed | DocumentParseFailed\n\nexport interface DocumentCatalogCompilation {\n readonly previous?: DocumentCatalog\n readonly sources: ReadonlyArray<DocumentCompilationSource>\n}\n\nconst isDocumentParseFailed = Schema.is(DocumentParseFailedError)\n\n/**\n * Portable authority for compiled Documents. `compileAll` reuses unchanged\n * source compilations from `previous`, then rebuilds the catalog-wide collision,\n * translation, and reference projection. `validate` reports every parse or\n * compilation failure as data and therefore has no error channel.\n */\nexport interface DocumentEngine {\n readonly fingerprint: string\n readonly compile: (source: DocumentCompilationSource) => Effect.Effect<CompiledDocument, CompilationError>\n readonly compileAll: (input: DocumentCatalogCompilation) => Effect.Effect<DocumentCatalog, CompilationError>\n readonly validate: (source: DocumentCompilationSource) => Effect.Effect<DocumentValidationResult>\n}\n\n/** Resolves installation configuration once and rejects an unusable engine before any Source is compiled. */\nexport const createDocumentEngine = Effect.fn('DocumentEngine.make')(function* (\n documents: DocumentConfiguration,\n options: DocumentEngineOptions,\n) {\n const configuration = yield* Effect.fromResult(resolveDocumentEngineConfiguration(documents, options))\n const parseMarkdown = createDocumentParser()\n const compilations = new WeakMap<\n DocumentCatalog,\n ReadonlyMap<string, { readonly document: CompiledDocument; readonly source: DocumentCompilationSource }>\n >()\n\n const compile = Effect.fn('DocumentEngine.compile')((source: DocumentCompilationSource) =>\n compileCompiledDocument(configuration, parseMarkdown, source),\n )\n\n const compileAll = Effect.fn('DocumentEngine.compileAll')(function* (input: DocumentCatalogCompilation) {\n const previous = input.previous ? compilations.get(input.previous) : undefined\n const compiled = yield* Effect.forEach(input.sources, (source) => {\n const cached = previous?.get(source.documentId)\n return cached && sameCompilationSource(cached.source, source) ? Effect.succeed(cached.document) : compile(source)\n })\n const catalog = yield* Effect.fromResult(createDocumentCatalog(configuration, compiled))\n compilations.set(\n catalog,\n new Map(\n input.sources.map((source, index) => {\n const document = compiled[index]\n if (!document) throw new Error(`Compiled document \"${source.documentId}\" is missing.`)\n return [source.documentId, { document, source }] as const\n }),\n ),\n )\n return catalog\n })\n\n const validate = Effect.fn('DocumentEngine.validate')(function* (source: DocumentCompilationSource) {\n const result = yield* Effect.result(compile(source))\n if (Result.isSuccess(result)) {\n const document = result.success\n return DocumentValidationResultSchema.make({\n valid: !document.issues.some((issue) => issue.severity === 'error'),\n document,\n issues: document.issues,\n })\n }\n\n const error = result.failure\n const issues: ReadonlyArray<DocumentIssue> = isDocumentParseFailed(error)\n ? [\n {\n code: 'markdown.parse',\n message: errorMessage(error.cause),\n severity: 'error',\n sourcePath: error.sourcePath,\n },\n ]\n : error.issues\n return DocumentValidationResultSchema.make({\n valid: false,\n issues,\n })\n })\n\n return {\n compile,\n compileAll,\n fingerprint: DOCUMENT_ENGINE_FINGERPRINT,\n validate,\n } satisfies DocumentEngine\n})\n\nfunction sameCompilationSource(left: DocumentCompilationSource, right: DocumentCompilationSource): boolean {\n return (\n left.documentId === right.documentId &&\n left.draft === right.draft &&\n left.markdown === right.markdown &&\n left.sourcePath === right.sourcePath\n )\n}\n\nfunction errorMessage(cause: unknown): string {\n return cause instanceof Error && cause.message ? cause.message : 'Markdown could not be parsed.'\n}\n\nexport { DocumentCompilationSource } from './internal/document-engine/compilation-source'\nexport type { DocumentCatalog } from './internal/document-engine/catalog'\nexport type { DocumentEngineOptions } from './internal/document-engine/configuration'\nexport {\n DocumentCompilationFailed,\n DocumentEngineConfigurationInvalid,\n DocumentParseFailed,\n} from './internal/document-engine/errors'\nexport type {\n DocumentReference,\n DocumentReferenceIndex,\n DocumentReferenceTarget,\n} from './internal/document-engine/references'\nexport type {\n DocumentSchemaIssue,\n DocumentSchemaProjection,\n DocumentSchemaValidation,\n ExecutableDocumentModel,\n ExecutableDocumentSchema,\n} from './internal/document-engine/document-schema'\n"],"mappings":";;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAgB,qBAAqB,SAA+E;CAElH,MAAM,SAAS,CADE,GAAG,QAAQ,SAAS,mBAAmB,CACnC,CAAC,CAAC,KAAK,WAAW;EACrC,UAAU,MAAM,OAAO;EACvB,MAAM,MAAM,MAAM;CACpB,EAAE;CAGF,IAFkB,QAAQ,QAAQ,qBAAqB,EAE3C,CAAC,CAAC,SAAS,GAAG,KAAK,OAAO,MAAM,UAAU,CAAC,MAAM,IAAI,GAC/D,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAEH,IAAI,OAAO,QAAQ,UAAU,MAAM,QAAQ,CAAC,CAAC,SAAS,GACpD,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAEH,IAAI,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,OAAO,QAC7D,OAAO,OAAO,KAAK;EACjB,OAAO;EACP,SAAS,6BAA6B,QAAQ;CAChD,CAAC;CAGH,OAAO,OAAO,QAAQ;EAAE;EAAS;CAAO,CAAC;AAC3C;AAEA,SAAgB,uBACd,SACA,aACA,MACiD;CACjD,MAAM,eAAe,gBAAgB,MAAM,KAAK,YAAY,MAAM,CAAC;CACnE,IAAI,WAAmB,QAAQ;CAE/B,KAAK,MAAM,SAAS,QAAQ,QAAQ;EAClC,MAAM,WAAWA,cAAY,MAAM,MAAM,IAAI;EAC7C,MAAM,WAAW,MAAM,WAAW,eAAe;EACjD,MAAM,QACJ,aAAa,SAAY,WAAW,UAAU,SAAS,QAAQ,KAAK,SAAS,KAAK,IAAI,WAAW;EAEnG,IAAI,UAAU,QAC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ACxB,OAAOC,yBAA+B,KAAK;IACzC,OAAO,CAAC,SAAS,OAAO,MAAM,UAAU,MAAM,aAAa,OAAO;IAClE;IACA,QAAQ,SAAS;GACnB,CAAC;EACH;EAEA,MAAM,QAAQ,OAAO;EACrB,MAAM,SAAuC,sBAAsB,KAAK,IACpE,CACE;GACE,MAAM;GACN,SAAS,aAAa,MAAM,KAAK;GACjC,UAAU;GACV,YAAY,MAAM;EACpB,CACF,IACA,MAAM;EACV,OAAOA,yBAA+B,KAAK;GACzC,OAAO;GACP;EACF,CAAC;CACH,CAAC;CAED,OAAO;EACL;EACA;EACA,aAAa;EACb;CACF;AACF,CAAC;AAED,SAAS,sBAAsB,MAAiC,OAA2C;CACzG,OACE,KAAK,eAAe,MAAM,cAC1B,KAAK,UAAU,MAAM,SACrB,KAAK,aAAa,MAAM,YACxB,KAAK,eAAe,MAAM;AAE9B;AAEA,SAAS,aAAa,OAAwB;CAC5C,OAAO,iBAAiB,SAAS,MAAM,UAAU,MAAM,UAAU;AACnE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZodObject, ZodType } from "zod";
|
|
2
|
+
//#region src/DocumentModel.d.ts
|
|
3
|
+
export type CmsFieldInput = 'date' | 'multiselect' | 'number' | 'select' | 'text' | 'textarea' | 'toggle';
|
|
4
|
+
export interface CmsFieldPresentation {
|
|
5
|
+
readonly description?: string;
|
|
6
|
+
readonly input?: CmsFieldInput;
|
|
7
|
+
readonly label?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CmsCollectionOptions {
|
|
10
|
+
readonly canCreate?: boolean;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
readonly hierarchy?: boolean;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly route: string;
|
|
15
|
+
readonly schema: ZodObject;
|
|
16
|
+
readonly source?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CmsDocumentModelOptions {
|
|
19
|
+
readonly collections: Readonly<Record<string, CmsCollectionOptions>>;
|
|
20
|
+
readonly locales?: {
|
|
21
|
+
readonly defaultLocale: string;
|
|
22
|
+
readonly fallbackLocale?: null | string;
|
|
23
|
+
readonly locales: ReadonlyArray<string>;
|
|
24
|
+
readonly prefixDefaultLocale?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Adds CMS presentation metadata without changing the schema's inferred input or output types. */
|
|
28
|
+
export declare function field<const FieldSchema extends ZodType>(schema: FieldSchema, presentation: CmsFieldPresentation): FieldSchema;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=DocumentModel.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FIELD_INPUT_METADATA } from "./internal/field-metadata.js";
|
|
2
|
+
|
|
3
|
+
//#region src/DocumentModel.ts
|
|
4
|
+
/** Adds CMS presentation metadata without changing the schema's inferred input or output types. */
|
|
5
|
+
function field(schema, presentation) {
|
|
6
|
+
return schema.meta({
|
|
7
|
+
...presentation.description === void 0 ? void 0 : { description: presentation.description },
|
|
8
|
+
...presentation.input === void 0 ? void 0 : { [FIELD_INPUT_METADATA]: presentation.input },
|
|
9
|
+
...presentation.label === void 0 ? void 0 : { title: presentation.label }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { field };
|
|
15
|
+
//# sourceMappingURL=DocumentModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentModel.js","names":[],"sources":["../../../src/DocumentModel.ts"],"sourcesContent":["import type { ZodObject, ZodType } from 'zod'\nimport { FIELD_INPUT_METADATA } from './internal/field-metadata'\n\nexport type CmsFieldInput = 'date' | 'multiselect' | 'number' | 'select' | 'text' | 'textarea' | 'toggle'\n\nexport interface CmsFieldPresentation {\n readonly description?: string\n readonly input?: CmsFieldInput\n readonly label?: string\n}\n\nexport interface CmsCollectionOptions {\n readonly canCreate?: boolean\n readonly description?: string\n readonly hierarchy?: boolean\n readonly label: string\n readonly route: string\n readonly schema: ZodObject\n readonly source?: string\n}\n\nexport interface CmsDocumentModelOptions {\n readonly collections: Readonly<Record<string, CmsCollectionOptions>>\n readonly locales?: {\n readonly defaultLocale: string\n readonly fallbackLocale?: null | string\n readonly locales: ReadonlyArray<string>\n readonly prefixDefaultLocale?: boolean\n }\n}\n\n/** Adds CMS presentation metadata without changing the schema's inferred input or output types. */\nexport function field<const FieldSchema extends ZodType>(\n schema: FieldSchema,\n presentation: CmsFieldPresentation,\n): FieldSchema {\n return schema.meta({\n ...(presentation.description === undefined ? undefined : { description: presentation.description }),\n ...(presentation.input === undefined ? undefined : { [FIELD_INPUT_METADATA]: presentation.input }),\n ...(presentation.label === undefined ? undefined : { title: presentation.label }),\n })\n}\n"],"mappings":";;;;AAgCA,SAAgB,MACd,QACA,cACa;CACb,OAAO,OAAO,KAAK;EACjB,GAAI,aAAa,gBAAgB,SAAY,SAAY,EAAE,aAAa,aAAa,YAAY;EACjG,GAAI,aAAa,UAAU,SAAY,SAAY,GAAG,uBAAuB,aAAa,MAAM;EAChG,GAAI,aAAa,UAAU,SAAY,SAAY,EAAE,OAAO,aAAa,MAAM;CACjF,CAAC;AACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region ../protocol/src/HttpPaths.ts
|
|
2
|
+
const STUDIO_BASE_PATH = "/_cms";
|
|
3
|
+
const STUDIO_APP_PATH = `${STUDIO_BASE_PATH}/app`;
|
|
4
|
+
const STUDIO_API_PATH = `${STUDIO_BASE_PATH}/api`;
|
|
5
|
+
const STUDIO_COLLABORATION_PATH = `${STUDIO_BASE_PATH}/collaboration`;
|
|
6
|
+
const STUDIO_HEALTH_PATH = `${STUDIO_BASE_PATH}/health`;
|
|
7
|
+
const CMS_AUTHENTICATION_PATH = "/api/cms/auth";
|
|
8
|
+
const CMS_LIVENESS_PATH = `${STUDIO_HEALTH_PATH}/live`;
|
|
9
|
+
const CMS_READINESS_PATH = `${STUDIO_HEALTH_PATH}/ready`;
|
|
10
|
+
const CMS_DELIVERY_READ_PATH = `${STUDIO_API_PATH}/delivery/read`;
|
|
11
|
+
const CMS_DELIVERY_QUERY_PATH = `${STUDIO_API_PATH}/delivery/query`;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CMS_READINESS_PATH as a, STUDIO_BASE_PATH as c, CMS_LIVENESS_PATH as i, STUDIO_COLLABORATION_PATH as l, CMS_DELIVERY_QUERY_PATH as n, STUDIO_API_PATH as o, CMS_DELIVERY_READ_PATH as r, STUDIO_APP_PATH as s, CMS_AUTHENTICATION_PATH as t };
|
|
15
|
+
//# sourceMappingURL=HttpPaths-86qLGB90.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpPaths-86qLGB90.js","names":[],"sources":["../../../../protocol/src/HttpPaths.ts"],"sourcesContent":["export const STUDIO_BASE_PATH = '/_cms'\nexport const STUDIO_APP_PATH = `${STUDIO_BASE_PATH}/app`\nexport const STUDIO_API_PATH = `${STUDIO_BASE_PATH}/api`\nexport const STUDIO_COLLABORATION_PATH = `${STUDIO_BASE_PATH}/collaboration`\nexport const STUDIO_HEALTH_PATH = `${STUDIO_BASE_PATH}/health`\nexport const CMS_AUTHENTICATION_PATH = '/api/cms/auth'\nexport const CMS_LIVENESS_PATH = `${STUDIO_HEALTH_PATH}/live`\nexport const CMS_READINESS_PATH = `${STUDIO_HEALTH_PATH}/ready`\nexport const CMS_DELIVERY_READ_PATH = `${STUDIO_API_PATH}/delivery/read`\nexport const CMS_DELIVERY_QUERY_PATH = `${STUDIO_API_PATH}/delivery/query`\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,4BAA4B,GAAG,iBAAiB;AAC7D,MAAa,qBAAqB,GAAG,iBAAiB;AACtD,MAAa,0BAA0B;AACvC,MAAa,oBAAoB,GAAG,mBAAmB;AACvD,MAAa,qBAAqB,GAAG,mBAAmB;AACxD,MAAa,yBAAyB,GAAG,gBAAgB;AACzD,MAAa,0BAA0B,GAAG,gBAAgB"}
|
package/src/Module.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HookResult } from "@nuxt/schema";
|
|
2
|
+
import { NitroConfig } from "nitropack/types";
|
|
3
|
+
//#region src/Module.d.ts
|
|
4
|
+
declare module '@nuxt/schema' {
|
|
5
|
+
interface NuxtHooks {
|
|
6
|
+
'nitro:config': (nitroConfig: NitroConfig) => HookResult;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare const cmsNuxtModule: import("@nuxt/schema").NuxtModule<import("@nuxt/schema").ModuleOptions, import("@nuxt/schema").ModuleOptions, false>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { cmsNuxtModule as default };
|
|
12
|
+
//# sourceMappingURL=Module.d.ts.map
|
package/src/Module.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { c as STUDIO_BASE_PATH, l as STUDIO_COLLABORATION_PATH, s as STUDIO_APP_PATH, t as CMS_AUTHENTICATION_PATH } from "./HttpPaths-86qLGB90.js";
|
|
2
|
+
import { loadCmsConfiguration } from "./internal/cms-config.js";
|
|
3
|
+
import { compileCmsConfiguration } from "./internal/configuration.js";
|
|
4
|
+
import { cmsAuthoringPlugin } from "./internal/authoring-compiler.js";
|
|
5
|
+
import { resolveBlockAuthoring } from "./internal/authoring-metadata.js";
|
|
6
|
+
import { createCheckerByJson } from "vue-component-meta";
|
|
7
|
+
import { NodeFileSystem, NodePath } from "@effect/platform-node-shared";
|
|
8
|
+
import { addComponent, addImports, addPlugin, addServerHandler, addServerPlugin, addServerTemplate, addVitePlugin, createResolver, defineNuxtModule, extendPages } from "@nuxt/kit";
|
|
9
|
+
import { Effect, FileSystem, Layer, Path, Schema } from "effect";
|
|
10
|
+
|
|
11
|
+
//#region src/Module.ts
|
|
12
|
+
const resolver = createResolver(import.meta.url);
|
|
13
|
+
const nodeLayer = Layer.merge(NodeFileSystem.layer, NodePath.layer);
|
|
14
|
+
var StudioApplicationMissing = class extends Schema.TaggedError()("StudioApplicationMissing", {}) {};
|
|
15
|
+
const cmsNuxtModule = defineNuxtModule({
|
|
16
|
+
moduleDependencies: {
|
|
17
|
+
"@comark/nuxt": {},
|
|
18
|
+
"nuxt-component-meta": { overrides: {
|
|
19
|
+
exclude: [/(?:^|[\\/])node_modules[\\/]/u],
|
|
20
|
+
globalsOnly: true
|
|
21
|
+
} }
|
|
22
|
+
},
|
|
23
|
+
meta: {
|
|
24
|
+
compatibility: { nuxt: ">=4.5.0 <5.0.0" },
|
|
25
|
+
name: "@phtngyn/cms"
|
|
26
|
+
},
|
|
27
|
+
setup(_options, nuxt) {
|
|
28
|
+
return Effect.runPromise(setupModule(nuxt).pipe(Effect.provide(nodeLayer)));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const setupModule = Effect.fn("CmsNuxtModule.setup")(function* (nuxt) {
|
|
32
|
+
addVitePlugin(cmsAuthoringPlugin());
|
|
33
|
+
const path = yield* Path.Path;
|
|
34
|
+
const authored = yield* loadCmsConfiguration(nuxt.options.rootDir);
|
|
35
|
+
const initialSources = yield* Effect.promise(() => Promise.resolve(authored.configuration.initialSources?.() ?? []));
|
|
36
|
+
const compiled = compileCmsConfiguration(authored.configuration, initialSources);
|
|
37
|
+
nuxt.options.watch.push(authored.path);
|
|
38
|
+
const runAuthoring = Effect.runPromiseWith(yield* Effect.context());
|
|
39
|
+
let authoring = [];
|
|
40
|
+
nuxt.hook("components:extend", (components) => runAuthoring(Effect.gen(function* () {
|
|
41
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
42
|
+
const checker = createCheckerByJson(nuxt.options.rootDir, {
|
|
43
|
+
compilerOptions: {
|
|
44
|
+
strict: true,
|
|
45
|
+
target: "ESNext",
|
|
46
|
+
module: "ESNext",
|
|
47
|
+
moduleResolution: "Bundler",
|
|
48
|
+
baseUrl: nuxt.options.rootDir,
|
|
49
|
+
paths: Object.fromEntries(Object.entries(nuxt.options.alias).map(([key, value]) => [`${key}/*`, [`${value}/*`]]))
|
|
50
|
+
},
|
|
51
|
+
files: []
|
|
52
|
+
}, { schema: true });
|
|
53
|
+
const resolved = [];
|
|
54
|
+
for (const component of components) {
|
|
55
|
+
if (!component.filePath.endsWith(".vue") || component.filePath.includes("/node_modules/")) continue;
|
|
56
|
+
const source = yield* fileSystem.readFileString(component.filePath);
|
|
57
|
+
const definition = yield* resolveBlockAuthoring(checker, component.filePath, component.kebabName, source);
|
|
58
|
+
if (!definition) continue;
|
|
59
|
+
if (resolved.some((existing) => existing.name === definition.name)) throw new Error(`Duplicate authoring block ${definition.name}.`);
|
|
60
|
+
resolved.push(definition);
|
|
61
|
+
component.global = true;
|
|
62
|
+
}
|
|
63
|
+
authoring = resolved.sort((left, right) => left.name.localeCompare(right.name));
|
|
64
|
+
})));
|
|
65
|
+
const installationPluginId = resolver.resolve("./runtime/plugin.virtual.mjs");
|
|
66
|
+
const installationPluginTemplate = addServerTemplate({
|
|
67
|
+
filename: installationPluginId,
|
|
68
|
+
getContents: () => [
|
|
69
|
+
`import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve("./runtime/plugin"))}`,
|
|
70
|
+
`import cmsConfiguration from ${JSON.stringify(authored.path)}`,
|
|
71
|
+
"import components from '#nuxt-component-meta/nitro'",
|
|
72
|
+
`export default createInstallationPlugin(cmsConfiguration, components, ${JSON.stringify(compiled.initialSources)}, ${JSON.stringify(authoring)})`
|
|
73
|
+
].join("\n")
|
|
74
|
+
});
|
|
75
|
+
registerDeliveryUi(nuxt);
|
|
76
|
+
yield* registerStudioApp();
|
|
77
|
+
const shellPath = resolver.resolve("../dist/studio/index.html");
|
|
78
|
+
configureNitro(nuxt, path.resolve(path.dirname(shellPath), "assets"));
|
|
79
|
+
addServerPlugin(installationPluginTemplate.filename);
|
|
80
|
+
addServerHandler({
|
|
81
|
+
handler: resolver.resolve("./runtime/api"),
|
|
82
|
+
route: `${CMS_AUTHENTICATION_PATH}/**:path`
|
|
83
|
+
});
|
|
84
|
+
addServerHandler({
|
|
85
|
+
handler: resolver.resolve("./runtime/collaboration"),
|
|
86
|
+
route: STUDIO_COLLABORATION_PATH
|
|
87
|
+
});
|
|
88
|
+
addServerHandler({
|
|
89
|
+
handler: resolver.resolve("./runtime/api"),
|
|
90
|
+
route: `${STUDIO_BASE_PATH}/**:path`
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
function registerDeliveryUi(nuxt) {
|
|
94
|
+
nuxt.options.css.push(resolver.resolve("./runtime/preview/preview.css"));
|
|
95
|
+
addComponent({
|
|
96
|
+
name: "DocumentField",
|
|
97
|
+
filePath: resolver.resolve("./runtime/delivery/DocumentField")
|
|
98
|
+
});
|
|
99
|
+
addComponent({
|
|
100
|
+
name: "DocumentRenderer",
|
|
101
|
+
filePath: resolver.resolve("./runtime/delivery/DocumentRenderer")
|
|
102
|
+
});
|
|
103
|
+
addComponent({
|
|
104
|
+
name: "DocumentScope",
|
|
105
|
+
filePath: resolver.resolve("./runtime/delivery/DocumentScope")
|
|
106
|
+
});
|
|
107
|
+
addComponent({
|
|
108
|
+
name: "CmsStudioPreviewMarker",
|
|
109
|
+
filePath: resolver.resolve("./runtime/preview/CmsStudioPreviewMarker")
|
|
110
|
+
});
|
|
111
|
+
addPlugin(resolver.resolve("./runtime/preview/plugin.client"));
|
|
112
|
+
addImports([{
|
|
113
|
+
name: "useDocument",
|
|
114
|
+
from: resolver.resolve("./runtime/delivery/useDocument")
|
|
115
|
+
}, {
|
|
116
|
+
name: "useDocumentQuery",
|
|
117
|
+
from: resolver.resolve("./runtime/delivery/useDocumentQuery")
|
|
118
|
+
}]);
|
|
119
|
+
extendPages((pages) => {
|
|
120
|
+
pages.push({
|
|
121
|
+
file: resolver.resolve("./runtime/delivery/document"),
|
|
122
|
+
name: "cms-document-page",
|
|
123
|
+
path: "/:contentPath(.*)*"
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const registerStudioApp = Effect.fn("CmsNuxtModule.registerStudioApp")(function* () {
|
|
128
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
129
|
+
const shellPath = resolver.resolve("../dist/studio/index.html");
|
|
130
|
+
if (!(yield* fileSystem.exists(shellPath))) return yield* new StudioApplicationMissing();
|
|
131
|
+
const shell = yield* fileSystem.readFileString(shellPath);
|
|
132
|
+
const handler = addServerTemplate({
|
|
133
|
+
filename: resolver.resolve("./runtime/studio-app.virtual.mjs"),
|
|
134
|
+
getContents: () => [`import { createStudioAppHandler } from ${JSON.stringify(resolver.resolve("./runtime/studio-app"))}`, `export default createStudioAppHandler(${JSON.stringify(shell)})`].join("\n")
|
|
135
|
+
});
|
|
136
|
+
addServerHandler({
|
|
137
|
+
handler: handler.filename,
|
|
138
|
+
method: "get",
|
|
139
|
+
route: STUDIO_APP_PATH
|
|
140
|
+
});
|
|
141
|
+
addServerHandler({
|
|
142
|
+
handler: handler.filename,
|
|
143
|
+
method: "get",
|
|
144
|
+
route: `${STUDIO_APP_PATH}/**:path`
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
function configureNitro(nuxt, assetsPath) {
|
|
148
|
+
nuxt.hook("nitro:config", (config) => {
|
|
149
|
+
config.experimental ||= {};
|
|
150
|
+
config.experimental.websocket = true;
|
|
151
|
+
config.publicAssets ||= [];
|
|
152
|
+
config.publicAssets.push({
|
|
153
|
+
baseURL: `${STUDIO_APP_PATH}/assets`,
|
|
154
|
+
dir: assetsPath,
|
|
155
|
+
maxAge: nuxt.options.dev ? 0 : 31536e3
|
|
156
|
+
});
|
|
157
|
+
config.routeRules ||= {};
|
|
158
|
+
config.routeRules[STUDIO_BASE_PATH] = { redirect: {
|
|
159
|
+
statusCode: 302,
|
|
160
|
+
to: STUDIO_APP_PATH
|
|
161
|
+
} };
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//#endregion
|
|
166
|
+
export { cmsNuxtModule as default };
|
|
167
|
+
//# sourceMappingURL=Module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Module.js","names":[],"sources":["../../../src/Module.ts"],"sourcesContent":["import type { HookResult, Nuxt } from '@nuxt/schema'\nimport type { NitroConfig } from 'nitropack/types'\nimport type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport { createCheckerByJson } from 'vue-component-meta'\nimport { NodeFileSystem, NodePath } from '@effect/platform-node-shared'\nimport {\n CMS_AUTHENTICATION_PATH,\n STUDIO_APP_PATH,\n STUDIO_BASE_PATH,\n STUDIO_COLLABORATION_PATH,\n} from '@internal/protocol/HttpPaths'\nimport {\n addComponent,\n addImports,\n addPlugin,\n addServerHandler,\n addServerPlugin,\n addServerTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n extendPages,\n} from '@nuxt/kit'\nimport { Effect, FileSystem, Layer, Path, Schema } from 'effect'\nimport { loadCmsConfiguration } from './internal/cms-config'\nimport { compileCmsConfiguration } from './internal/configuration'\nimport { cmsAuthoringPlugin } from './internal/authoring-compiler'\nimport { resolveBlockAuthoring } from './internal/authoring-metadata'\n\ndeclare module '@nuxt/schema' {\n interface NuxtHooks {\n 'nitro:config': (nitroConfig: NitroConfig) => HookResult\n }\n}\n\nconst resolver = createResolver(import.meta.url)\nconst nodeLayer = Layer.merge(NodeFileSystem.layer, NodePath.layer)\n\nclass StudioApplicationMissing extends Schema.TaggedError<StudioApplicationMissing>()('StudioApplicationMissing', {}) {}\n\nconst cmsNuxtModule = defineNuxtModule({\n moduleDependencies: {\n '@comark/nuxt': {},\n 'nuxt-component-meta': {\n overrides: {\n exclude: [/(?:^|[\\\\/])node_modules[\\\\/]/u],\n globalsOnly: true,\n },\n },\n },\n meta: {\n compatibility: { nuxt: '>=4.5.0 <5.0.0' },\n name: '@phtngyn/cms',\n },\n setup(_options, nuxt) {\n return Effect.runPromise(setupModule(nuxt).pipe(Effect.provide(nodeLayer)))\n },\n})\n\nexport default cmsNuxtModule\n\nconst setupModule = Effect.fn('CmsNuxtModule.setup')(function* (nuxt: Nuxt) {\n addVitePlugin(cmsAuthoringPlugin())\n const path = yield* Path.Path\n const authored = yield* loadCmsConfiguration(nuxt.options.rootDir)\n const initialSources = yield* Effect.promise(() => Promise.resolve(authored.configuration.initialSources?.() ?? []))\n const compiled = compileCmsConfiguration(authored.configuration, initialSources)\n nuxt.options.watch.push(authored.path)\n const runAuthoring = Effect.runPromiseWith(yield* Effect.context<FileSystem.FileSystem>())\n let authoring: ReadonlyArray<ComponentDefinition> = []\n nuxt.hook('components:extend', (components) =>\n runAuthoring(\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem\n const checker = createCheckerByJson(\n nuxt.options.rootDir,\n {\n compilerOptions: {\n strict: true,\n target: 'ESNext',\n module: 'ESNext',\n moduleResolution: 'Bundler',\n baseUrl: nuxt.options.rootDir,\n paths: Object.fromEntries(\n Object.entries(nuxt.options.alias).map(([key, value]) => [`${key}/*`, [`${value}/*`]]),\n ),\n },\n files: [],\n },\n { schema: true },\n )\n const resolved: ComponentDefinition[] = []\n for (const component of components) {\n if (!component.filePath.endsWith('.vue') || component.filePath.includes('/node_modules/')) continue\n const source = yield* fileSystem.readFileString(component.filePath)\n const definition = yield* resolveBlockAuthoring(checker, component.filePath, component.kebabName, source)\n if (!definition) continue\n if (resolved.some((existing) => existing.name === definition.name))\n throw new Error(`Duplicate authoring block ${definition.name}.`)\n resolved.push(definition)\n // Nuxt generates delivery and preview registration from this same discovered component.\n component.global = true\n }\n authoring = resolved.sort((left, right) => left.name.localeCompare(right.name))\n }),\n ),\n )\n\n const installationPluginId = resolver.resolve('./runtime/plugin.virtual.mjs')\n const installationPluginTemplate = addServerTemplate({\n filename: installationPluginId,\n getContents: () =>\n [\n `import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve('./runtime/plugin'))}`,\n `import cmsConfiguration from ${JSON.stringify(authored.path)}`,\n \"import components from '#nuxt-component-meta/nitro'\",\n `export default createInstallationPlugin(cmsConfiguration, components, ${JSON.stringify(compiled.initialSources)}, ${JSON.stringify(authoring)})`,\n ].join('\\n'),\n })\n registerDeliveryUi(nuxt)\n yield* registerStudioApp()\n const shellPath = resolver.resolve('../dist/studio/index.html')\n configureNitro(nuxt, path.resolve(path.dirname(shellPath), 'assets'))\n addServerPlugin(installationPluginTemplate.filename)\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${CMS_AUTHENTICATION_PATH}/**:path`,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/collaboration'),\n route: STUDIO_COLLABORATION_PATH,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${STUDIO_BASE_PATH}/**:path`,\n })\n})\n\nfunction registerDeliveryUi(nuxt: Nuxt): void {\n nuxt.options.css.push(resolver.resolve('./runtime/preview/preview.css'))\n addComponent({ name: 'DocumentField', filePath: resolver.resolve('./runtime/delivery/DocumentField') })\n addComponent({ name: 'DocumentRenderer', filePath: resolver.resolve('./runtime/delivery/DocumentRenderer') })\n addComponent({ name: 'DocumentScope', filePath: resolver.resolve('./runtime/delivery/DocumentScope') })\n addComponent({\n name: 'CmsStudioPreviewMarker',\n filePath: resolver.resolve('./runtime/preview/CmsStudioPreviewMarker'),\n })\n addPlugin(resolver.resolve('./runtime/preview/plugin.client'))\n addImports([\n { name: 'useDocument', from: resolver.resolve('./runtime/delivery/useDocument') },\n { name: 'useDocumentQuery', from: resolver.resolve('./runtime/delivery/useDocumentQuery') },\n ])\n extendPages((pages) => {\n pages.push({\n file: resolver.resolve('./runtime/delivery/document'),\n name: 'cms-document-page',\n path: '/:contentPath(.*)*',\n })\n })\n}\n\nconst registerStudioApp = Effect.fn('CmsNuxtModule.registerStudioApp')(function* () {\n const fileSystem = yield* FileSystem.FileSystem\n const shellPath = resolver.resolve('../dist/studio/index.html')\n if (!(yield* fileSystem.exists(shellPath))) {\n return yield* new StudioApplicationMissing()\n }\n const shell = yield* fileSystem.readFileString(shellPath)\n const handler = addServerTemplate({\n filename: resolver.resolve('./runtime/studio-app.virtual.mjs'),\n getContents: () =>\n [\n `import { createStudioAppHandler } from ${JSON.stringify(resolver.resolve('./runtime/studio-app'))}`,\n `export default createStudioAppHandler(${JSON.stringify(shell)})`,\n ].join('\\n'),\n })\n addServerHandler({ handler: handler.filename, method: 'get', route: STUDIO_APP_PATH })\n addServerHandler({ handler: handler.filename, method: 'get', route: `${STUDIO_APP_PATH}/**:path` })\n})\n\nfunction configureNitro(nuxt: Nuxt, assetsPath: string): void {\n nuxt.hook('nitro:config', (config: NitroConfig) => {\n config.experimental ||= {}\n config.experimental.websocket = true\n config.publicAssets ||= []\n config.publicAssets.push({\n baseURL: `${STUDIO_APP_PATH}/assets`,\n dir: assetsPath,\n maxAge: nuxt.options.dev ? 0 : 60 * 60 * 24 * 365,\n })\n config.routeRules ||= {}\n config.routeRules[STUDIO_BASE_PATH] = { redirect: { statusCode: 302, to: STUDIO_APP_PATH } }\n })\n}\n"],"mappings":";;;;;;;;;;;AAmCA,MAAM,WAAW,eAAe,YAAY,GAAG;AAC/C,MAAM,YAAY,MAAM,MAAM,eAAe,OAAO,SAAS,KAAK;AAElE,IAAM,2BAAN,cAAuC,OAAO,YAAsC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvH,MAAM,gBAAgB,iBAAiB;CACrC,oBAAoB;EAClB,gBAAgB,CAAC;EACjB,uBAAuB,EACrB,WAAW;GACT,SAAS,CAAC,+BAA+B;GACzC,aAAa;EACf,EACF;CACF;CACA,MAAM;EACJ,eAAe,EAAE,MAAM,iBAAiB;EACxC,MAAM;CACR;CACA,MAAM,UAAU,MAAM;EACpB,OAAO,OAAO,WAAW,YAAY,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC;CAC5E;AACF,CAAC;AAID,MAAM,cAAc,OAAO,GAAG,qBAAqB,CAAC,CAAC,WAAW,MAAY;CAC1E,cAAc,mBAAmB,CAAC;CAClC,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