mdxts@0.17.0
github-actions
released this
08 May 09:34
·
103 commits
to main
since this release
Minor Changes
-
e493fbd: Refines
paths
returned fromcreateSource
andmergeSources
. Based on the glob pattern provided, either a one-dimensional or two-dimensional array of paths will be returned:import { createSource, mergeSources } from "mdxts"; const allPosts = createSource("posts/*.mdx").paths(); // string[] const allDocs = createSource("docs/**/*.mdx").paths(); // string[][] const allPaths = mergeSources(allDocs, allPosts).paths(); // string[] | string[][]
Likewise the
get
method will be narrowed to only accept a single pathname or an array of pathname segments:allPosts.get("building-a-button-component-in-react"); allDocs.get(["examples", "authoring"]);
Breaking Changes
- The
paths
method now returns a one-dimensional array of paths for a single glob pattern and a two-dimensional array of paths for multiple glob patterns. - The
get
method now only accepts a single pathname or an array of pathname segments.
You may need to update your code to accommodate these changes:
export function generateStaticParams() { -- return allPosts.paths().map((pathname) => ({ slug: pathname.at(-1) })) ++ return allPosts.paths().map((pathname) => ({ slug: pathname })) }
- The
-
7444586: Now
createSource.get
attempts to prepend the incoming pathname withbasePathname
if defined and no data was found.
Patch Changes
- 6d338a6: Handles null values and throws an error for undefined values when formatting front matter for type checking.