@praxisjs/content
Changelog for @praxisjs/content — markdown content collections with @Collection, ContentSchema, and Vite plugin.
@praxisjs/content
0.2.3
Depends on the other @praxisjs/* packages through caret ranges (^2.3.0) instead of exact versions, so npm no longer installs a second copy of a package when two releases disagree, and upgrades no longer end in peer conflicts.
0.2.2
The published package no longer contains the package's tests (compiled tests in dist/__tests__, test sources in src/__tests__).
The package is marked "sideEffects": false, so bundlers leave out the modules of it that an app does not use.
@Collection and @PagedCollection throw a TypeError when the class is defined if they decorate an accessor instead of a plain field, naming the member to fix (see assertFieldContext).
The entry cache now covers every API: each file is loaded, parsed and rendered once and shared by getCollection(), getPage() and getEntry(). Paging back and forth, or opening a detail page after the list, no longer re-renders markdown. getEntry() finds the slug in an index instead of scanning every path, getPage() sorts the paths once, and schema defaults are built once per class instead of once per entry. @Collection and @PagedCollection fields share one accessor across instances. A failed load is still not cached.
0.2.1
getCollection() now caches its result per collection: entries are loaded, parsed, and rendered once, and later calls (a list page followed by each detail page, or every page of an SSG run) reuse them. Callers receive a copy of the array. A failed load is not cached.
0.2.0
Add collectionStaticPaths(Schema) — builds a @praxisjs/ssg-compatible per-route getStaticPaths directly from a collection, substituting each entry's slug into the route's one dynamic segment. Removes the need to hand-write a getCollection(...).map(...) for the common case of a dynamic route backed 1:1 by a content collection; throws a clear error if the route path has zero or more than one dynamic segment.
0.1.10
peerDependencies.vite raised from >=7.0.0 to >=8.0.0, matching the Vite 8 requirement the rest of the ecosystem (@praxisjs/vite-plugin) already enforces. contentPlugin() itself has no Vite-version-specific behavior — this only corrects the declared range.
0.1.0
Initial release — markdown content collections for PraxisJS.
ContentSchemabase class — extend to define the frontmatter shape via class fields with default values@Collection('./path/*.md')class decorator — registers the collection and its glob path; the Vite plugin expands the string toimport.meta.glob(...)at build time, no runtime requests@Collection(SchemaClass)field decorator — injects a reactiveResource<Entry<S>[]>into any component fieldgetCollection(SchemaClass)— loads all entries in parallelgetEntry(SchemaClass, slug)— loads only the single file matching the sluggetPage(SchemaClass, { page, pageSize })— loads only the requested slice, files fetched in parallel; keys sorted for a stable ordergetTotal(SchemaClass)— synchronous, counts glob keys without loading any file@PagedCollection(SchemaClass, pagerField)— field decorator that wires a collection to any composable exposingpageandpageSize(e.g.Paginationfrom@praxisjs/composables); re-fetches automatically when the page signal changes- Glob loading is lazy by default — each
.mdfile becomes its own chunk - Runtime schema validation — fields are checked against default value types; missing or mistyped fields fall back to defaults with
console.warn - Zero-dependency frontmatter YAML parser for string, number, boolean, and primitive arrays
markedfor HTML rendering (pluggable viarenderoption inCollectionConfig)contentPlugin()Vite plugin exported from@praxisjs/content/vitePageOptionstype exported for use withgetPage