@ecopages/content-processor 0.2.0-beta.22 → 0.2.0-beta.23

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/README.md CHANGED
@@ -4,12 +4,22 @@ Build-time content collections for Ecopages. Scans MDX (or other configured exte
4
4
 
5
5
  ## Mental model
6
6
 
7
- 1. **You declare collections** in `eco.config.ts` (content directory, schema, sort order).
8
- 2. **The processor scans files at build time** and writes generated modules under `.eco/cache/`.
9
- 3. **Pages import a virtual module** (`ecopages:content/docs`) for entries, metadata, and MDX components.
10
- 4. **Frontmatter is yours; routing fields are not.** You define and validate frontmatter with any [Standard Schema](https://standardschema.dev)-compatible library (Zod, Valibot, ArkType, etc.). The processor adds `slug` and `segments` from the file path.
7
+ 1. **Declare collections** in `eco.config.ts` — content directory, frontmatter schema, and sort order.
8
+ 2. **Scan at build time** — the processor validates frontmatter and writes generated modules under `.eco/cache/`.
9
+ 3. **Import the virtual module** — pages and layouts use `ecopages:content/<collection>` for `entries`, metadata, and MDX components.
10
+ 4. **Own your frontmatter** — define fields with any [Standard Schema](https://standardschema.dev)-compatible library (Zod, Valibot, ArkType, etc.). The processor adds `slug` and `segments` from the file path.
11
11
 
12
- The processor does **not** ship page factories or navigation builders. You write `eco.page` routes and build nav from `entries` in app code.
12
+ ### What this package owns vs. what your app owns
13
+
14
+ | Layer | Owned by |
15
+ | :-------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- |
16
+ | File discovery, frontmatter validation, manifest sort | `@ecopages/content-processor` |
17
+ | Generated `ecopages:content/*` modules (`entries`, `getComponent`, …) | `@ecopages/content-processor` |
18
+ | `ContentScanner` for build scripts (for example `llms.txt`) | `@ecopages/content-processor` |
19
+ | Routes (`eco.page`), layouts, metadata, URL shape | Your app |
20
+ | Sidebar, breadcrumbs, pagination | Your app — derive from `entries` and frontmatter fields such as `title`, `group`, and `order` |
21
+
22
+ The processor gives you a typed manifest and MDX components at build time. Wire them into Ecopages routing and UI the same way you would any other data source.
13
23
 
14
24
  ## Features
15
25
 
@@ -156,7 +166,7 @@ import type { Entry } from 'ecopages:content/docs';
156
166
 
157
167
  ## Page usage
158
168
 
159
- Write routes with `eco.page`. The processor does not provide a `createContentPage` helper.
169
+ Define a catch-all or per-entry route with `eco.page`. Import the collection manifest and MDX components from the virtual module:
160
170
 
161
171
  ```typescript
162
172
  import { eco } from '@ecopages/core';
@@ -191,18 +201,18 @@ export default eco.page<{ entry: Entry }>({
191
201
 
192
202
  ## Navigation (app-side)
193
203
 
194
- Build navigation from `entries` in your app. The processor does not generate nav trees.
204
+ Navigation is app code. Map `entries` to links using the frontmatter and path fields the processor already validated:
195
205
 
196
206
  ```typescript
197
207
  import { entries } from 'ecopages:content/docs';
198
208
 
199
- export const docsNav = buildGroupedNav(entries, {
200
- rootDir: '/docs',
201
- groupOrder: groupOrderIndex,
202
- });
209
+ export const docsNav = entries.map((entry) => ({
210
+ title: entry.title,
211
+ href: `/docs/${entry.segments.join('/')}`,
212
+ }));
203
213
  ```
204
214
 
205
- Use `entry.group`, `entry.segments`, and `entry.title` from the manifest.
215
+ Group or sort in your app — for example by a `group` frontmatter field and an `order` number. See `apps/docs` (`src/lib/content-nav.ts`) and `examples/docs-starter` (`src/content-nav.ts`) for full layouts with sections and sidebars.
206
216
 
207
217
  ## Build scripts
208
218
 
@@ -227,7 +237,7 @@ const raw = await scanner.getRawContent('getting-started/intro');
227
237
 
228
238
  | Import | Purpose |
229
239
  | :----------------------------------- | :------------------------------------------------------------ |
230
- | `@ecopages/content-processor` | `ContentScanner`, sort helpers, plugin factory, shared types. |
240
+ | `@ecopages/content-processor` | `ContentScanner`, sort helpers, shared types. |
231
241
  | `@ecopages/content-processor/plugin` | `contentProcessorPlugin()` for `eco.config.ts`. |
232
242
  | `@ecopages/content-processor/types` | `ContentEntry`, `ContentCollectionModule`, `EntryComparator`. |
233
243
  | `@ecopages/content-processor/mdx` | `remarkFrontmatter`, `withContentMdxPlugins()`. |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecopages/content-processor",
3
- "version": "0.2.0-beta.22",
4
- "description": "Build-time content collections exposed as ecopages:content/* virtual modules",
3
+ "version": "0.2.0-beta.23",
4
+ "description": "Scan MDX collections at build time and expose typed ecopages:content/* virtual modules for pages and scripts",
5
5
  "keywords": [
6
6
  "content",
7
7
  "mdx",
@@ -17,10 +17,10 @@
17
17
  "directory": "packages/processors/content-processor"
18
18
  },
19
19
  "peerDependencies": {
20
- "@ecopages/core": "0.2.0-beta.22"
20
+ "@ecopages/core": "0.2.0-beta.23"
21
21
  },
22
22
  "dependencies": {
23
- "@ecopages/file-system": "0.2.0-beta.22",
23
+ "@ecopages/file-system": "0.2.0-beta.23",
24
24
  "@ecopages/logger": "^0.2.3",
25
25
  "remark-frontmatter": "^5.0.0",
26
26
  "unified": "^11.0.5",
package/src/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export { ContentScanner } from './content-scanner.js';
2
2
  export type { ContentScannerConfig } from './content-scanner.js';
3
3
  export { CONTENT_PROCESSOR_NAME, CONTENT_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PREFIX, COLLECTION_NAME_PATTERN, } from './constants.js';
4
- export { contentProcessorPlugin, ContentProcessorPlugin } from './plugin.js';
5
4
  export { compareEntriesByField, compareEntriesBySlug, type EntryComparator } from './sort.js';
6
5
  export type { ContentCollectionDefinition, ContentCollectionsConfig, ContentProcessorConfig, } from './collection-types.js';
7
6
  export type { StandardSchema } from '@ecopages/core';
package/src/index.js CHANGED
@@ -5,16 +5,13 @@ import {
5
5
  CONTENT_VIRTUAL_MODULE_PREFIX,
6
6
  COLLECTION_NAME_PATTERN
7
7
  } from "./constants.js";
8
- import { contentProcessorPlugin, ContentProcessorPlugin } from "./plugin.js";
9
8
  import { compareEntriesByField, compareEntriesBySlug } from "./sort.js";
10
9
  export {
11
10
  COLLECTION_NAME_PATTERN,
12
11
  CONTENT_PROCESSOR_NAME,
13
12
  CONTENT_VIRTUAL_MODULE_PATTERN,
14
13
  CONTENT_VIRTUAL_MODULE_PREFIX,
15
- ContentProcessorPlugin,
16
14
  ContentScanner,
17
15
  compareEntriesByField,
18
- compareEntriesBySlug,
19
- contentProcessorPlugin
16
+ compareEntriesBySlug
20
17
  };