Morphos & Kosmesis are here.Explore
PraxisJS

@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.

  • ContentSchema base 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 to import.meta.glob(...) at build time, no runtime requests
  • @Collection(SchemaClass) field decorator — injects a reactive Resource<Entry<S>[]> into any component field
  • getCollection(SchemaClass) — loads all entries in parallel
  • getEntry(SchemaClass, slug) — loads only the single file matching the slug
  • getPage(SchemaClass, { page, pageSize }) — loads only the requested slice, files fetched in parallel; keys sorted for a stable order
  • getTotal(SchemaClass) — synchronous, counts glob keys without loading any file
  • @PagedCollection(SchemaClass, pagerField) — field decorator that wires a collection to any composable exposing page and pageSize (e.g. Pagination from @praxisjs/composables); re-fetches automatically when the page signal changes
  • Glob loading is lazy by default — each .md file 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
  • marked for HTML rendering (pluggable via render option in CollectionConfig)
  • contentPlugin() Vite plugin exported from @praxisjs/content/vite
  • PageOptions type exported for use with getPage

On this page