@ecopages/content-processor 0.7.1 → 0.9.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/README.md +11 -13
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -172,21 +172,19 @@ import { eco } from '@ecopages/core';
|
|
|
172
172
|
import { entries, getEntryBySegments } from 'ecopages:content/docs';
|
|
173
173
|
import { getComponent, getEntryDependencies } from 'ecopages:content/docs/server';
|
|
174
174
|
import type { Entry } from 'ecopages:content/docs';
|
|
175
|
+
import type { JsxRenderable } from '@ecopages/jsx';
|
|
175
176
|
|
|
176
|
-
export default eco.page<{ entry: Entry }>({
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
export default eco.page<{ entry: Entry }, JsxRenderable>({
|
|
178
|
+
paths: async () =>
|
|
179
|
+
entries.map((post) => ({
|
|
179
180
|
params: { slug: post.segments },
|
|
180
181
|
})),
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
props: { entry: getEntryBySegments(segments) },
|
|
189
|
-
};
|
|
182
|
+
props: async ({ params }) => {
|
|
183
|
+
const segments = Array.isArray(params.slug)
|
|
184
|
+
? params.slug
|
|
185
|
+
: [params.slug];
|
|
186
|
+
|
|
187
|
+
return { entry: getEntryBySegments(segments) };
|
|
190
188
|
},
|
|
191
189
|
dependencies: async ({ props }) => getEntryDependencies(props.entry.slug),
|
|
192
190
|
metadata: ({ props: { entry } }) => ({
|
|
@@ -216,7 +214,7 @@ import { getEntryDependencies } from 'ecopages:content/docs/server';
|
|
|
216
214
|
const docs = createLazyCollectionComponents(loadComponent);
|
|
217
215
|
|
|
218
216
|
export default eco.page({
|
|
219
|
-
|
|
217
|
+
props: async ({ params }) => ({ entry: getEntry(params.slug) }),
|
|
220
218
|
dependencies: ({ props }) => getEntryDependencies(props.entry.slug),
|
|
221
219
|
render: ({ entry }) => {
|
|
222
220
|
const Content = docs.get(entry.slug);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/content-processor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
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",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"directory": "packages/processors/content-processor"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@ecopages/core": "0.
|
|
26
|
+
"@ecopages/core": "0.9.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ecopages/file-system": "0.
|
|
29
|
+
"@ecopages/file-system": "0.9.0",
|
|
30
30
|
"@ecopages/logger": "^0.2.3",
|
|
31
31
|
"remark-frontmatter": "^5.0.0",
|
|
32
32
|
"unified": "^11.0.5",
|