@conloca/astro-cms 0.2.0 → 0.2.2

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.
Files changed (98) hide show
  1. package/README.md +23 -20
  2. package/dist/internal/page-handler.astro +8 -2
  3. package/dist/ts/node/content.d.ts +1 -2
  4. package/dist/ts/node/content.d.ts.map +1 -1
  5. package/dist/ts/node/content.js +1 -1
  6. package/dist/ts/node/content.js.map +1 -1
  7. package/dist/ts/src/checks.d.ts +3 -3
  8. package/dist/ts/src/checks.d.ts.map +1 -1
  9. package/dist/ts/src/checks.js +3 -3
  10. package/dist/ts/src/checks.js.map +1 -1
  11. package/dist/ts/src/cms-handler.js +2 -1
  12. package/dist/ts/src/cms-handler.js.map +1 -1
  13. package/dist/ts/src/collections.d.ts +35 -56
  14. package/dist/ts/src/collections.d.ts.map +1 -1
  15. package/dist/ts/src/collections.js +77 -74
  16. package/dist/ts/src/collections.js.map +1 -1
  17. package/dist/ts/src/entries.d.ts +44 -0
  18. package/dist/ts/src/entries.d.ts.map +1 -0
  19. package/dist/ts/src/entries.js +48 -0
  20. package/dist/ts/src/entries.js.map +1 -0
  21. package/dist/ts/src/handlers/collection-content-api.d.ts.map +1 -1
  22. package/dist/ts/src/handlers/collection-content-api.js +7 -2
  23. package/dist/ts/src/handlers/collection-content-api.js.map +1 -1
  24. package/dist/ts/src/handlers/collection-names.d.ts +9 -0
  25. package/dist/ts/src/handlers/collection-names.d.ts.map +1 -0
  26. package/dist/ts/src/handlers/collection-names.js +9 -0
  27. package/dist/ts/src/handlers/collection-names.js.map +1 -0
  28. package/dist/ts/src/handlers/page-render-core.d.ts +31 -12
  29. package/dist/ts/src/handlers/page-render-core.d.ts.map +1 -1
  30. package/dist/ts/src/handlers/page-render-core.js +38 -17
  31. package/dist/ts/src/handlers/page-render-core.js.map +1 -1
  32. package/dist/ts/src/index.d.ts +2 -2
  33. package/dist/ts/src/index.d.ts.map +1 -1
  34. package/dist/ts/src/index.js +1 -3
  35. package/dist/ts/src/index.js.map +1 -1
  36. package/dist/ts/src/internal/collection-parsers.d.ts +26 -0
  37. package/dist/ts/src/internal/collection-parsers.d.ts.map +1 -0
  38. package/dist/ts/src/internal/collection-parsers.js +34 -0
  39. package/dist/ts/src/internal/collection-parsers.js.map +1 -0
  40. package/dist/ts/src/internal/entry-issues.d.ts +8 -0
  41. package/dist/ts/src/internal/entry-issues.d.ts.map +1 -0
  42. package/dist/ts/src/internal/entry-issues.js +19 -0
  43. package/dist/ts/src/internal/entry-issues.js.map +1 -0
  44. package/dist/ts/src/internal/entry-validation.d.ts +93 -0
  45. package/dist/ts/src/internal/entry-validation.d.ts.map +1 -0
  46. package/dist/ts/src/internal/entry-validation.js +228 -0
  47. package/dist/ts/src/internal/entry-validation.js.map +1 -0
  48. package/dist/ts/src/lib/content-config-guard.d.ts +2 -0
  49. package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -1
  50. package/dist/ts/src/lib/content-config-guard.js +5 -1
  51. package/dist/ts/src/lib/content-config-guard.js.map +1 -1
  52. package/dist/ts/src/lib/virtual-module-generators.d.ts +13 -0
  53. package/dist/ts/src/lib/virtual-module-generators.d.ts.map +1 -1
  54. package/dist/ts/src/lib/virtual-module-generators.js +18 -0
  55. package/dist/ts/src/lib/virtual-module-generators.js.map +1 -1
  56. package/dist/ts/src/loader.d.ts +9 -12
  57. package/dist/ts/src/loader.d.ts.map +1 -1
  58. package/dist/ts/src/loader.js +19 -16
  59. package/dist/ts/src/loader.js.map +1 -1
  60. package/dist/ts/src/page-schemas.d.ts +1 -1
  61. package/dist/ts/src/page-schemas.d.ts.map +1 -1
  62. package/dist/ts/src/page-schemas.js +1 -1
  63. package/dist/ts/src/page-schemas.js.map +1 -1
  64. package/dist/ts/src/plugin-spa.d.ts +12 -0
  65. package/dist/ts/src/plugin-spa.d.ts.map +1 -1
  66. package/dist/ts/src/plugin-spa.js +33 -6
  67. package/dist/ts/src/plugin-spa.js.map +1 -1
  68. package/dist/ts/src/tiptap-html-static.d.ts +13 -12
  69. package/dist/ts/src/tiptap-html-static.d.ts.map +1 -1
  70. package/dist/ts/src/tiptap-html-static.js +104 -54
  71. package/dist/ts/src/tiptap-html-static.js.map +1 -1
  72. package/dist/virtual-modules.d.ts +14 -0
  73. package/node/content.ts +10 -1
  74. package/package.json +15 -10
  75. package/src/checks.ts +3 -2
  76. package/src/cms-handler.ts +2 -1
  77. package/src/collections.ts +119 -79
  78. package/src/entries.ts +111 -0
  79. package/src/handlers/collection-content-api.ts +7 -2
  80. package/src/handlers/collection-names.ts +8 -0
  81. package/src/handlers/page-handler.astro +8 -2
  82. package/src/handlers/page-render-core.ts +65 -17
  83. package/src/index.ts +6 -7
  84. package/src/internal/collection-parsers.ts +51 -0
  85. package/src/internal/entry-issues.ts +23 -0
  86. package/src/internal/entry-validation.ts +305 -0
  87. package/src/lib/content-config-guard.ts +8 -3
  88. package/src/lib/virtual-module-generators.ts +20 -0
  89. package/src/loader.ts +33 -17
  90. package/src/page-schemas.ts +4 -0
  91. package/src/plugin-spa.ts +49 -10
  92. package/src/tiptap-html-static.ts +114 -64
  93. package/src/virtual-modules.d.ts +14 -0
  94. package/dist/ts/src/internal/page-collection-schema.d.ts +0 -44
  95. package/dist/ts/src/internal/page-collection-schema.d.ts.map +0 -1
  96. package/dist/ts/src/internal/page-collection-schema.js +0 -152
  97. package/dist/ts/src/internal/page-collection-schema.js.map +0 -1
  98. package/src/internal/page-collection-schema.ts +0 -210
package/README.md CHANGED
@@ -11,7 +11,8 @@ workflow, accessible at `/__cms` routes without requiring authentication or comp
11
11
 
12
12
  ```bash
13
13
  npm install @conloca/astro-cms
14
- npm install @astrojs/react @vitejs/plugin-react astro react react-dom vite zod
14
+ npm install @astrojs/react @vitejs/plugin-react astro react react-dom vite typia
15
+ npm install -D ttsc @ttsc/unplugin
15
16
  ```
16
17
 
17
18
  The second line is the full peer set — the CMS expects the host site to own those packages. `@astrojs/react` is not
@@ -95,7 +96,8 @@ augmentation, the host's own page fields, and a data entry carries `data` typed
95
96
  (`data?: T`): an entry saved before any payload exists is not an error, so readers guard the access. Content the config
96
97
  does not declare fails the build, and the error names the collection and its kind, rather than silently not building;
97
98
  declaring a collection before its folder exists is the normal order, since the folder appears with the first entry saved
98
- in the editor.
99
+ in the editor. The editor saves new fragments in the `fragments` folder, and every form of `conlocaFragments(...)`
100
+ declares that folder, so it never needs naming for the build to accept it.
99
101
 
100
102
  A site with no MDX fragments yet prints this once per rendered page, and it is expected — nothing is wrong with the file
101
103
  this message points at:
@@ -167,24 +169,25 @@ With those four files in place, run the Astro dev server and open `/__cms`.
167
169
 
168
170
  Passed to `conlocaCMS({ ... })`. Only two are required.
169
171
 
170
- | Option | Required | What it does |
171
- | ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
172
- | `contentRoot` | yes | Directory holding `sites.json` and the content files. Also handed to the collection factories, so the content config needs no copy of it. |
173
- | `puckConfigPath` | yes | Module whose default export is the Puck `Config`. Supplies the visual editor's component palette and seeds component auto-discovery. |
174
- | `canvasDir` | no | Directory for canvas documents. |
175
- | `route` | no | Where the CMS mounts. Defaults to `/__cms`. |
176
- | `layout` | no | Default layout for content pages. On its own it enables routing with a catch-all pattern. |
177
- | `routing` | no | Full routing configuration, for sites with more than one content route. |
178
- | `templates` | no | Page templates offered in the create-page dialog. |
179
- | `schemasPath` | no | Module exporting `dataSchemas`, `pageSchemas` and `mdxComponents`. Drives the page-settings form and the MDX component registry. |
180
- | `componentPaths` | no | Extra folders to scan for components wrapped in `withHydration()`. |
181
- | `mdxComponentFolders` | no | Folders scanned for locally authored MDX components, whose `interface Props` becomes the editor's prop panel. Defaults to `['src/components/mdx']`. |
182
- | `assetsPath` | no | Upload directory; enables the Media Library. The site must serve it from `publicDir`, directly or through a link there, or dev and build fail. |
183
- | `siteStyles` | no | CSS injected into the Puck preview iframe so components render with site styling. |
184
- | `editorStyles` | no | CSS injected into the MDX editor's admin document. Host-component selectors only — see the file's own notes on what does not belong. |
185
- | `editorCSS` | no | Raw CSS applied after auto-discovered host styles in the editor's host-preview layer. |
186
- | `fragmentPreviewRoute` | no | Route whose styles and content wrapper frame the standalone fragment editor. Defaults to `/`. |
187
- | `locales` | no | The site's locales and default locale. Falls back to `globalLocales` in `sites.json`. |
172
+ | Option | Required | What it does |
173
+ | ---------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
174
+ | `contentRoot` | yes | Directory holding `sites.json` and the content files. Also handed to the collection factories, so the content config needs no copy of it. |
175
+ | `puckConfigPath` | yes | Module whose default export is the Puck `Config`. Supplies the visual editor's component palette and seeds component auto-discovery. |
176
+ | `canvasDir` | no | Directory for canvas documents. |
177
+ | `route` | no | Where the CMS mounts. Defaults to `/__cms`. |
178
+ | `layout` | no | Default layout for content pages. On its own it enables routing with a catch-all pattern. |
179
+ | `routing` | no | Full routing configuration, for sites with more than one content route. |
180
+ | `templates` | no | Page templates offered in the create-page dialog. |
181
+ | `schemasPath` | no | Module exporting `dataSchemas`, `pageSchemas` and `mdxComponents`. Drives the page-settings form and the MDX component registry. |
182
+ | `contentSchemasPath` | no | Schema-only module exporting the `pageSchemas` / `dataSchemas` your content config passes to `conlocaPages()` / `conlocaData()`. Draft previews parse entries with the entry parsers built from it, as the build does. |
183
+ | `componentPaths` | no | Extra folders to scan for components wrapped in `withHydration()`. |
184
+ | `mdxComponentFolders` | no | Folders scanned for locally authored MDX components, whose `interface Props` becomes the editor's prop panel. Defaults to `['src/components/mdx']`. |
185
+ | `assetsPath` | no | Upload directory; enables the Media Library. The site must serve it from `publicDir`, directly or through a link there, or dev and build fail. |
186
+ | `siteStyles` | no | CSS injected into the Puck preview iframe so components render with site styling. |
187
+ | `editorStyles` | no | CSS injected into the MDX editor's admin document. Host-component selectors only — see the file's own notes on what does not belong. |
188
+ | `editorCSS` | no | Raw CSS applied after auto-discovered host styles in the editor's host-preview layer. |
189
+ | `fragmentPreviewRoute` | no | Route whose styles and content wrapper frame the standalone fragment editor. Defaults to `/`. |
190
+ | `locales` | no | The site's locales and default locale. Without it: the site's `locales` and `defaultLocale` in `sites.json`, else `globalLocales`. |
188
191
 
189
192
  `ConlocaCMSOptions` also extends the editor's `UIConfig` (minus `basename`), so fields such as `apiBaseUrl`,
190
193
  `siteBaseUrl`, `enableDevtools`, `queryClientOptions`, `projectRoot` and `hosted` are accepted as well. Those exist for
@@ -10,6 +10,7 @@
10
10
  */
11
11
 
12
12
  import { getCollection } from 'astro:content';
13
+ import { loadContentSchemas } from 'virtual:conloca-content-schemas';
13
14
  import Layout from 'virtual:conloca-layout';
14
15
  import puckConfig from 'virtual:conloca-puck-config';
15
16
  import routingConfig from 'virtual:conloca-routing-config';
@@ -37,6 +38,7 @@ import {
37
38
  pageNotFoundResponse,
38
39
  resolvePuckData,
39
40
  } from '../ts/src/handlers/page-render-core.js';
41
+ import { previewEntryParsers } from '../ts/src/internal/collection-parsers.js';
40
42
 
41
43
  // prerender is controlled by injectRoute({ prerender }) in plugin-spa.ts
42
44
  // Do not hardcode here — it overrides the route-level config
@@ -148,11 +150,15 @@ if (!routeName || !collection || !pathname) {
148
150
 
149
151
  // Content-access seam. A caller can install a ContentAPI on
150
152
  // `Astro.locals.contentApi`; when present we read through it, so the page shows
151
- // what that reader serves. Absent — the normal render — we read Astro content
153
+ // what that reader serves, parsed with each collection's entry parser as the build
154
+ // parses its entries. Absent — the normal render — we read Astro content
152
155
  // collections, byte-for-byte identically to before the extraction.
153
156
  const previewContentApi = (Astro.locals as { contentApi?: ContentAPI }).contentApi;
154
157
  const source: PageContentSource = previewContentApi
155
- ? createReaderContentSource(previewContentApi, config.locale)
158
+ ? createReaderContentSource(previewContentApi, {
159
+ renderLocale: config.locale,
160
+ parsers: previewEntryParsers(config, await loadContentSchemas()),
161
+ })
156
162
  : createCollectionContentSource({
157
163
  getCollection: (name) => getCollection(name as never) as Promise<{ data: unknown }[]>,
158
164
  isDev: import.meta.env.DEV,
@@ -1,4 +1,3 @@
1
- export { ALL_FRAGMENTS_COLLECTION, type ConlocaCollectionsResult, type ConlocaDataOptions, type ConlocaPagesOptions, type CreateConlocaCollectionsOptions, conlocaData, conlocaFragments, conlocaPages, createConlocaCollections, pageSchemasOf, } from '../src/collections.js';
2
- export type { ConlocaPageEntry } from '../src/internal/page-collection-schema.js';
1
+ export { ALL_FRAGMENTS_COLLECTION, type CollectionEntryLike, type ConlocaCollectionsResult, type ConlocaDataEntry, type ConlocaDataOptions, type ConlocaFragmentEntry, type ConlocaPageEntry, type ConlocaPagesOptions, type CreateConlocaCollectionsOptions, conlocaData, conlocaDataEntries, conlocaFragmentEntries, conlocaFragments, conlocaPageEntries, conlocaPages, createConlocaCollections, type EntryParser, entryParserOf, pageSchemasOf, type TypedCollectionEntry, } from '../src/collections.js';
3
2
  export { type ConlocaLoaderOptions, conlocaLoader } from '../src/loader.js';
4
3
  //# sourceMappingURL=content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../node/content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../node/content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EACxB,KAAK,WAAW,EAChB,aAAa,EACb,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,3 +1,3 @@
1
- export { ALL_FRAGMENTS_COLLECTION, conlocaData, conlocaFragments, conlocaPages, createConlocaCollections, pageSchemasOf, } from '../src/collections.js';
1
+ export { ALL_FRAGMENTS_COLLECTION, conlocaData, conlocaDataEntries, conlocaFragmentEntries, conlocaFragments, conlocaPageEntries, conlocaPages, createConlocaCollections, entryParserOf, pageSchemasOf, } from '../src/collections.js';
2
2
  export { conlocaLoader } from '../src/loader.js';
3
3
  //# sourceMappingURL=content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../node/content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAKxB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAA6B,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../node/content.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EASxB,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EAExB,aAAa,EACb,aAAa,GAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAA6B,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pure project-health helpers shared with external tooling (the conloca CLI's
3
- * doctor command). This entry must stay a leaf: node:fs and node:path only,
4
- * so importing it never pulls in the astro integration graph.
3
+ * doctor and page create commands). This entry must stay a leaf: node:fs and
4
+ * node:path only, so importing it never pulls in the astro integration graph.
5
5
  */
6
- export { CONTENT_CONFIG_SNIPPET, type ContentConfigProblem, findContentConfigProblem, } from './lib/content-config-guard.js';
6
+ export { CONTENT_CONFIG_SNIPPET, type ContentConfigProblem, findContentConfig, findContentConfigProblem, } from './lib/content-config-guard.js';
7
7
  //# sourceMappingURL=checks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/checks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/checks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pure project-health helpers shared with external tooling (the conloca CLI's
3
- * doctor command). This entry must stay a leaf: node:fs and node:path only,
4
- * so importing it never pulls in the astro integration graph.
3
+ * doctor and page create commands). This entry must stay a leaf: node:fs and
4
+ * node:path only, so importing it never pulls in the astro integration graph.
5
5
  */
6
- export { CONTENT_CONFIG_SNIPPET, findContentConfigProblem, } from './lib/content-config-guard.js';
6
+ export { CONTENT_CONFIG_SNIPPET, findContentConfig, findContentConfigProblem, } from './lib/content-config-guard.js';
7
7
  //# sourceMappingURL=checks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/checks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,sBAAsB,EAEtB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/checks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,sBAAsB,EAEtB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
@@ -199,7 +199,8 @@ async function handleContentApi(request, cfResult) {
199
199
  // Create the Hono router with assets and content root for git operations
200
200
  const assetsPath = import.meta.env.CONLOCA_ASSETS_PATH || '';
201
201
  const app = createContentAPIRouter(contentApi, {
202
- ...(assetsPath && { assetsPath }),
202
+ // The editor stores image links under assetRefBase, so the usage lookup must search for that.
203
+ ...(assetsPath && { assetsPath, assetRefBase: spaConfig.assetRefBase }),
203
204
  contentRoot,
204
205
  });
205
206
  // Mounted here rather than in @conloca/content-api because compiling MDX is a
@@ -1 +1 @@
1
- {"version":3,"file":"cms-handler.js","sourceRoot":"","sources":["../../../src/cms-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAEL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;GAMG;AACH,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,eAAuD,CAAC;IACrF,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,sBAA4C,CAAC;IACnF,OA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CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,sDAAsD;IACtD,wEAAwE;IACxE,6CAA6C;IAC7C,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,IAAI,EAAE;QACnF,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO;QACP,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;KACxC,CAAC,CAAC;IAEH,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE9C,2BAA2B;IAC3B,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { defineCollection } from 'astro:content';
2
- import type { DataSchemas, PageSchemas } from '@conloca/cms-spa/page-schema-define';
3
- import { z } from 'zod';
4
- import { ALL_FRAGMENTS_COLLECTION } from './handlers/page-render-core.js';
2
+ import type { DataSchemas, HostSchema, PageSchemas } from '@conloca/cms-spa/page-schema-define';
3
+ import type { Loader } from 'astro/loaders';
4
+ import { ALL_FRAGMENTS_COLLECTION } from './handlers/collection-names.js';
5
+ import { type EntryParser } from './internal/entry-validation.js';
6
+ export { type CollectionEntryLike, type ConlocaDataEntry, type ConlocaFragmentEntry, type ConlocaPageEntry, conlocaDataEntries, conlocaFragmentEntries, conlocaPageEntries, type TypedCollectionEntry, } from './entries.js';
7
+ export type { EntryParser };
5
8
  export { ALL_FRAGMENTS_COLLECTION };
6
9
  /**
7
10
  * Options for createConlocaCollections().
@@ -16,8 +19,8 @@ export interface CreateConlocaCollectionsOptions {
16
19
  site?: string;
17
20
  /**
18
21
  * The same `pageSchemas` object the editor loads. Host meta fields are
19
- * validated on every page collection at build time (made optional, because
20
- * the editor scopes a descriptor to a prefix while Astro validates the
22
+ * validated on every page collection at build time (optional, because
23
+ * the editor scopes a descriptor to a prefix while Astro builds the
21
24
  * whole pile). Pass the object itself — not a hand-copied field list — so
22
25
  * the form and the build cannot drift. Listing types come from augmenting
23
26
  * `HostPageMeta`, not from Astro `entry.data`.
@@ -35,10 +38,8 @@ export interface ConlocaCollectionsResult {
35
38
  }
36
39
  /**
37
40
  * @deprecated Declare collections explicitly with {@link conlocaPages},
38
- * {@link conlocaData} and {@link conlocaFragments} — they keep the entry
39
- * types Astro's generated `getCollection` needs, and undeclared content
40
- * fails the build instead of silently not building. This wrapper still
41
- * works but returns untyped entries.
41
+ * {@link conlocaData} and {@link conlocaFragments} — undeclared content fails
42
+ * the build instead of silently not building. This wrapper still works.
42
43
  *
43
44
  * Creates Astro Content Collections by discovering from indexed content.
44
45
  * Uses content-api to find collections that have content.
@@ -47,7 +48,7 @@ export interface ConlocaCollectionsResult {
47
48
  * ```typescript
48
49
  * // src/content.config.ts
49
50
  * import { createConlocaCollections } from '@conloca/astro-cms/node/content';
50
- * import { pageSchemas } from './page-schemas';
51
+ * import { pageSchemas } from './page-schemas.js';
51
52
  *
52
53
  * export const { collections } = await createConlocaCollections({ pageSchemas });
53
54
  * ```
@@ -77,17 +78,22 @@ export interface ConlocaPagesOptions {
77
78
  */
78
79
  export declare function pageSchemasOf(collection: object): PageSchemas | undefined;
79
80
  /**
80
- * One typed Astro collection for Conloca pages — the explicit,
81
- * Starlight-shaped declaration:
81
+ * The entry parser a Conloca-built collection's loader validates every entry
82
+ * with before storing it, or undefined for any other collection.
83
+ */
84
+ export declare function entryParserOf(collection: object): EntryParser<Record<string, unknown>> | undefined;
85
+ /**
86
+ * One Astro collection for Conloca pages — the explicit, Starlight-shaped
87
+ * declaration:
82
88
  *
83
89
  * ```ts
84
90
  * export const collections = { pages: conlocaPages({ pageSchemas }) };
85
91
  * ```
86
92
  *
87
- * Entry data is typed as {@link ConlocaPageEntry}; `getCollection('pages')`
88
- * carries pathname/title/dates and the host's declared meta fields.
93
+ * Every page is validated as {@link ConlocaPageEntry} while it loads; read it
94
+ * typed with `conlocaPageEntries(await getCollection('pages'), pageSchemas)`.
89
95
  */
90
- export declare function conlocaPages(options?: ConlocaPagesOptions): import("astro/content/config").CollectionConfig<z.ZodType<import("./internal/page-collection-schema.js").ConlocaPageEntry, unknown, z.core.$ZodTypeInternals<import("./internal/page-collection-schema.js").ConlocaPageEntry, unknown>>, import("astro/loaders").Loader>;
96
+ export declare function conlocaPages(options?: ConlocaPagesOptions): import("astro/content/config").CollectionConfig<import("astro:content").BaseSchema, Loader>;
91
97
  /** Options for conlocaData(). */
92
98
  export interface ConlocaDataOptions<DS extends DataSchemas> {
93
99
  /**
@@ -103,58 +109,31 @@ export interface ConlocaDataOptions<DS extends DataSchemas> {
103
109
  }
104
110
  /**
105
111
  * Deliberate asymmetry with pages: a data schema is validated AS GIVEN —
106
- * requiredness preserved, no rewrite guard — because the site owns it whole
107
- * for exactly one collection, unlike host page fields folded into the shared
108
- * pages schema. The flip side, accepted for now: a .transform or .default in
109
- * a dataSchema runs at build time but not in the editor form, so the two can
110
- * diverge.
112
+ * requiredness preserved — because the site owns it whole for exactly one
113
+ * collection, unlike host page fields checked across the shared pages pile.
111
114
  */
112
- declare function conlocaDataCollection<T extends z.ZodObject<z.ZodRawShape>>(name: string, payload: T, contentRoot: string, site: string): import("astro/content/config").CollectionConfig<z.ZodObject<{
113
- title: z.ZodString;
114
- description: z.ZodOptional<z.ZodString>;
115
- category: z.ZodOptional<z.ZodString>;
116
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
- id: z.ZodString;
118
- locale: z.ZodString;
119
- name: z.ZodString;
120
- data: z.ZodOptional<T>;
121
- }, z.core.$loose>, import("astro/loaders").Loader>;
115
+ declare function conlocaDataCollection(name: string, payload: HostSchema, contentRoot: string, site: string): import("astro/content/config").CollectionConfig<import("astro:content").BaseSchema, Loader>;
122
116
  /**
123
- * Typed Astro collections for Conloca data, one per `dataSchemas` key:
117
+ * Astro collections for Conloca data, one per `dataSchemas` key:
124
118
  *
125
119
  * ```ts
126
120
  * export const collections = { ...conlocaData({ dataSchemas }) };
127
121
  * ```
128
122
  *
129
- * `getCollection('testimonials')` entries carry `data` typed by that key's
130
- * schema, and a stored entry that fails its schema fails the build instead
131
- * of rendering blank.
123
+ * A stored entry whose payload fails its schema fails the build instead of
124
+ * rendering blank. Read entries typed by that key's schema with
125
+ * `conlocaDataEntries(dataSchemas, 'testimonials', await getCollection('testimonials'))`.
132
126
  */
133
- export declare function conlocaData<DS extends DataSchemas>(options: ConlocaDataOptions<DS>): { [K in keyof DS]: ReturnType<typeof conlocaDataCollection<DS[K]>>; };
127
+ export declare function conlocaData<DS extends DataSchemas>(options: ConlocaDataOptions<DS>): { [K in keyof DS]: ReturnType<typeof conlocaDataCollection>; };
134
128
  /**
135
129
  * The fragments aggregate (always) plus one collection per named fragment
136
130
  * folder: `...conlocaFragments('general')`. No arguments declares only the
137
- * aggregate the render pipeline reads. There are no per-call options:
138
- * contentRoot comes from conlocaCMS()'s contentRoot (via
139
- * CONLOCA_CONTENT_ROOT) and the site is always 'default'.
131
+ * aggregate the render pipeline reads. Every form also declares the folder
132
+ * the editor saves new fragments to, without returning a collection for it.
133
+ * There are no per-call options: contentRoot comes from conlocaCMS()'s
134
+ * contentRoot (via CONLOCA_CONTENT_ROOT) and the site is always 'default'.
140
135
  */
141
136
  export declare function conlocaFragments<const N extends readonly string[]>(...names: N): {
142
- [ALL_FRAGMENTS_COLLECTION]: ReturnType<(collection?: string) => import("astro/content/config").CollectionConfig<z.ZodObject<{
143
- title: z.ZodString;
144
- description: z.ZodOptional<z.ZodString>;
145
- category: z.ZodOptional<z.ZodString>;
146
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
147
- id: z.ZodString;
148
- locale: z.ZodString;
149
- name: z.ZodString;
150
- }, z.core.$loose>, import("astro/loaders").Loader>>;
151
- } & { [K in N[number]]: ReturnType<(collection?: string) => import("astro/content/config").CollectionConfig<z.ZodObject<{
152
- title: z.ZodString;
153
- description: z.ZodOptional<z.ZodString>;
154
- category: z.ZodOptional<z.ZodString>;
155
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
- id: z.ZodString;
157
- locale: z.ZodString;
158
- name: z.ZodString;
159
- }, z.core.$loose>, import("astro/loaders").Loader>>; };
137
+ [ALL_FRAGMENTS_COLLECTION]: ReturnType<(collection?: string) => import("astro/content/config").CollectionConfig<import("astro:content").BaseSchema, Loader>>;
138
+ } & { [K in N[number]]: ReturnType<(collection?: string) => import("astro/content/config").CollectionConfig<import("astro:content").BaseSchema, Loader>>; };
160
139
  //# sourceMappingURL=collections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAK1E,OAAO,EAAE,wBAAwB,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,wBAA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,EAAE,kBAAkB,CAAC,EAAE,CAAC,GAS3D,GAAG,CAAC,IAAI,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,GAAE,CACpF;AASD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,GAqBJ;IACvE,CAAC,wBAAwB,CAAC,EAAE,UAAU,eAlBC,MAAM,iGAkBoB,CAAC;CACnE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,eAnBO,MAAM,iGAmBc,GAAE,CAChE"}
@@ -1,18 +1,35 @@
1
1
  import { defineCollection } from 'astro:content';
2
2
  import { createContentAPI } from '@conloca/content-api/reader';
3
- import { dataMetaSchema, fragmentMetaSchema, pageMetaSchema } from '@conloca/content-api/schemas';
4
- import { z } from 'zod';
5
- import { ALL_FRAGMENTS_COLLECTION } from './handlers/page-render-core.js';
3
+ import { parseLooseDataMeta } from '@conloca/content-api/schemas';
4
+ import { ALL_FRAGMENTS_COLLECTION } from './handlers/collection-names.js';
6
5
  import { declareConlocaCollection, withDeclarationCheck } from './internal/declared-collections.js';
7
- import { buildPageCollectionSchema, hostFieldsFromPageSchemas } from './internal/page-collection-schema.js';
6
+ import { createDataEntryParser, createPageEntryParser, parseFragmentEntry, } from './internal/entry-validation.js';
8
7
  import { conlocaLoader } from './loader.js';
8
+ export { conlocaDataEntries, conlocaFragmentEntries, conlocaPageEntries, } from './entries.js';
9
9
  export { ALL_FRAGMENTS_COLLECTION };
10
+ /**
11
+ * How every collection below is declared: a loader and NO `schema`.
12
+ *
13
+ * Astro's `schema` option only accepts Zod; it is optional, and without it
14
+ * `parseData` stores the loader's data unchanged. Validation therefore runs in
15
+ * the loader, before `store.set`, with the generated Typia validators for the
16
+ * collection (see `internal/entry-validation.ts`) — a stored entry that fails
17
+ * them still fails the build. Entry typing comes from the typed accessors
18
+ * (`conlocaPageEntries` / `conlocaDataEntries` / `conlocaFragmentEntries`),
19
+ * because Astro infers `getCollection` types from a Zod schema only.
20
+ */
21
+ function conlocaCollection(loader, parseEntry) {
22
+ const defined = defineCollection({ loader });
23
+ entryParsersByCollection.set(defined, parseEntry);
24
+ return defined;
25
+ }
26
+ // The entry parser each Conloca-built collection's loader validates with, so a
27
+ // test (or a host) can run exactly the build's validation without a content root.
28
+ const entryParsersByCollection = new WeakMap();
10
29
  /**
11
30
  * @deprecated Declare collections explicitly with {@link conlocaPages},
12
- * {@link conlocaData} and {@link conlocaFragments} — they keep the entry
13
- * types Astro's generated `getCollection` needs, and undeclared content
14
- * fails the build instead of silently not building. This wrapper still
15
- * works but returns untyped entries.
31
+ * {@link conlocaData} and {@link conlocaFragments} — undeclared content fails
32
+ * the build instead of silently not building. This wrapper still works.
16
33
  *
17
34
  * Creates Astro Content Collections by discovering from indexed content.
18
35
  * Uses content-api to find collections that have content.
@@ -21,7 +38,7 @@ export { ALL_FRAGMENTS_COLLECTION };
21
38
  * ```typescript
22
39
  * // src/content.config.ts
23
40
  * import { createConlocaCollections } from '@conloca/astro-cms/node/content';
24
- * import { pageSchemas } from './page-schemas';
41
+ * import { pageSchemas } from './page-schemas.js';
25
42
  *
26
43
  * export const { collections } = await createConlocaCollections({ pageSchemas });
27
44
  * ```
@@ -34,32 +51,17 @@ export async function createConlocaCollections(options = {}) {
34
51
  const { contentRoot = process.env.CONLOCA_CONTENT_ROOT ?? './content', site = 'default', pageSchemas } = options;
35
52
  const api = await createContentAPI({ contentRoot });
36
53
  const collections = {};
37
- collections[ALL_FRAGMENTS_COLLECTION] = defineCollection({
38
- loader: conlocaLoader({ contentRoot, site, kind: 'fragment' }),
39
- schema: fragmentMetaSchema.loose(),
40
- });
54
+ collections[ALL_FRAGMENTS_COLLECTION] = conlocaCollection(conlocaLoader({ contentRoot, site, kind: 'fragment', parseEntry: parseFragmentEntry }), parseFragmentEntry);
41
55
  for (const name of api.fragments.collections) {
42
- collections[name] = defineCollection({
43
- loader: conlocaLoader({ collection: name, contentRoot, site, kind: 'fragment' }),
44
- schema: fragmentMetaSchema.loose(),
45
- });
56
+ collections[name] = conlocaCollection(conlocaLoader({ collection: name, contentRoot, site, kind: 'fragment', parseEntry: parseFragmentEntry }), parseFragmentEntry);
46
57
  }
47
58
  for (const name of api.data.collections) {
48
- collections[name] = defineCollection({
49
- loader: conlocaLoader({ collection: name, contentRoot, site, kind: 'data' }),
50
- schema: dataMetaSchema.loose(),
51
- });
59
+ collections[name] = conlocaCollection(conlocaLoader({ collection: name, contentRoot, site, kind: 'data', parseEntry: parseLooseDataMeta }), parseLooseDataMeta);
52
60
  }
53
- const hostFields = pageSchemas ? hostFieldsFromPageSchemas(pageSchemas) : undefined;
54
- const pageSchema = hostFields && Object.keys(hostFields.shape).length > 0
55
- ? buildPageCollectionSchema(hostFields)
56
- : pageMetaSchema.loose();
61
+ const parsePage = createPageEntryParser(pageSchemas);
57
62
  const siteCollections = api.getSite(site)?.collections ?? new Set();
58
63
  for (const name of siteCollections) {
59
- collections[name] = defineCollection({
60
- loader: conlocaLoader({ collection: name, contentRoot, site, kind: 'page' }),
61
- schema: pageSchema,
62
- });
64
+ collections[name] = conlocaCollection(conlocaLoader({ collection: name, contentRoot, site, kind: 'page', parseEntry: parsePage }), parsePage);
63
65
  }
64
66
  return { collections };
65
67
  }
@@ -77,87 +79,88 @@ export function pageSchemasOf(collection) {
77
79
  return pageSchemasByCollection.get(collection);
78
80
  }
79
81
  /**
80
- * One typed Astro collection for Conloca pages — the explicit,
81
- * Starlight-shaped declaration:
82
+ * The entry parser a Conloca-built collection's loader validates every entry
83
+ * with before storing it, or undefined for any other collection.
84
+ */
85
+ export function entryParserOf(collection) {
86
+ return entryParsersByCollection.get(collection);
87
+ }
88
+ /**
89
+ * One Astro collection for Conloca pages — the explicit, Starlight-shaped
90
+ * declaration:
82
91
  *
83
92
  * ```ts
84
93
  * export const collections = { pages: conlocaPages({ pageSchemas }) };
85
94
  * ```
86
95
  *
87
- * Entry data is typed as {@link ConlocaPageEntry}; `getCollection('pages')`
88
- * carries pathname/title/dates and the host's declared meta fields.
96
+ * Every page is validated as {@link ConlocaPageEntry} while it loads; read it
97
+ * typed with `conlocaPageEntries(await getCollection('pages'), pageSchemas)`.
89
98
  */
90
99
  export function conlocaPages(options = {}) {
91
100
  const { contentRoot = defaultContentRoot(), site = 'default', collection = 'pages', pageSchemas } = options;
92
101
  declareConlocaCollection('page', collection);
93
- const defined = defineCollection({
94
- loader: withDeclarationCheck(conlocaLoader({ collection, contentRoot, site, kind: 'page' }), {
95
- contentRoot,
96
- site,
97
- }),
98
- schema: buildPageCollectionSchema(pageSchemas ? hostFieldsFromPageSchemas(pageSchemas) : z.object({})),
99
- });
102
+ const parseEntry = createPageEntryParser(pageSchemas);
103
+ const defined = conlocaCollection(withDeclarationCheck(conlocaLoader({ collection, contentRoot, site, kind: 'page', parseEntry }), {
104
+ contentRoot,
105
+ site,
106
+ }), parseEntry);
100
107
  if (pageSchemas)
101
108
  pageSchemasByCollection.set(defined, pageSchemas);
102
109
  return defined;
103
110
  }
104
111
  /**
105
112
  * Deliberate asymmetry with pages: a data schema is validated AS GIVEN —
106
- * requiredness preserved, no rewrite guard — because the site owns it whole
107
- * for exactly one collection, unlike host page fields folded into the shared
108
- * pages schema. The flip side, accepted for now: a .transform or .default in
109
- * a dataSchema runs at build time but not in the editor form, so the two can
110
- * diverge.
113
+ * requiredness preserved — because the site owns it whole for exactly one
114
+ * collection, unlike host page fields checked across the shared pages pile.
111
115
  */
112
116
  function conlocaDataCollection(name, payload, contentRoot, site) {
113
- return defineCollection({
114
- loader: withDeclarationCheck(conlocaLoader({ collection: name, contentRoot, site, kind: 'data' }), {
115
- contentRoot,
116
- site,
117
- }),
118
- // Base meta plus this collection's payload under `data`. `data` stays
119
- // optional: an entry saved before any payload exists is not an error.
120
- schema: z.looseObject({ ...dataMetaSchema.shape, data: payload.optional() }),
121
- });
117
+ const parseEntry = createDataEntryParser(payload);
118
+ return conlocaCollection(withDeclarationCheck(conlocaLoader({ collection: name, contentRoot, site, kind: 'data', parseEntry }), {
119
+ contentRoot,
120
+ site,
121
+ }), parseEntry);
122
122
  }
123
123
  /**
124
- * Typed Astro collections for Conloca data, one per `dataSchemas` key:
124
+ * Astro collections for Conloca data, one per `dataSchemas` key:
125
125
  *
126
126
  * ```ts
127
127
  * export const collections = { ...conlocaData({ dataSchemas }) };
128
128
  * ```
129
129
  *
130
- * `getCollection('testimonials')` entries carry `data` typed by that key's
131
- * schema, and a stored entry that fails its schema fails the build instead
132
- * of rendering blank.
130
+ * A stored entry whose payload fails its schema fails the build instead of
131
+ * rendering blank. Read entries typed by that key's schema with
132
+ * `conlocaDataEntries(dataSchemas, 'testimonials', await getCollection('testimonials'))`.
133
133
  */
134
134
  export function conlocaData(options) {
135
135
  const { dataSchemas, contentRoot = defaultContentRoot(), site = 'default' } = options;
136
- const entries = Object.entries(dataSchemas).map(([name, payload]) => {
136
+ const collections = {};
137
+ for (const [name, payload] of Object.entries(dataSchemas)) {
137
138
  declareConlocaCollection('data', name);
138
- return [name, conlocaDataCollection(name, payload, contentRoot, site)];
139
- });
140
- // Object.fromEntries erases per-key types; the assertion restores exactly
141
- // what the loop built — one collection per dataSchemas key.
142
- return Object.fromEntries(entries);
139
+ collections[name] = conlocaDataCollection(name, payload, contentRoot, site);
140
+ }
141
+ // The loop built exactly one collection per dataSchemas key; the record type
142
+ // keeps those keys for the content.config `collections` export.
143
+ return collections;
143
144
  }
145
+ /**
146
+ * The folder the editor saves every new fragment to (content/fragments/fragments/).
147
+ * Every conlocaFragments call declares it, so a fragment made in the editor
148
+ * never fails the build of a site whose config does not name that folder.
149
+ */
150
+ const EDITOR_FRAGMENT_FOLDER = 'fragments';
144
151
  /**
145
152
  * The fragments aggregate (always) plus one collection per named fragment
146
153
  * folder: `...conlocaFragments('general')`. No arguments declares only the
147
- * aggregate the render pipeline reads. There are no per-call options:
148
- * contentRoot comes from conlocaCMS()'s contentRoot (via
149
- * CONLOCA_CONTENT_ROOT) and the site is always 'default'.
154
+ * aggregate the render pipeline reads. Every form also declares the folder
155
+ * the editor saves new fragments to, without returning a collection for it.
156
+ * There are no per-call options: contentRoot comes from conlocaCMS()'s
157
+ * contentRoot (via CONLOCA_CONTENT_ROOT) and the site is always 'default'.
150
158
  */
151
159
  export function conlocaFragments(...names) {
152
160
  const contentRoot = defaultContentRoot();
153
161
  const site = 'default';
154
- const fragmentCollection = (collection) => defineCollection({
155
- loader: withDeclarationCheck(conlocaLoader({ collection, contentRoot, site, kind: 'fragment' }), {
156
- contentRoot,
157
- site,
158
- }),
159
- schema: fragmentMetaSchema.loose(),
160
- });
162
+ declareConlocaCollection('fragment', EDITOR_FRAGMENT_FOLDER);
163
+ const fragmentCollection = (collection) => conlocaCollection(withDeclarationCheck(conlocaLoader({ collection, contentRoot, site, kind: 'fragment', parseEntry: parseFragmentEntry }), { contentRoot, site }), parseFragmentEntry);
161
164
  const named = Object.fromEntries(names.map((name) => {
162
165
  declareConlocaCollection('fragment', name);
163
166
  return [name, fragmentCollection(name)];