🥬 Romaine, Resolvers, Relations, Renovations!
Pre-release
Pre-release
·
124 commits
to main
since this release
First off, I'd like to extend a warm welcome to our new contributors @odama626 and @Sheharyar566!
This is a mighty large release, JAMpacked with juicy new features and fixes.
🏡 Organization updates
- We created a dedicated @FlatbreadLabs organization which Flatbread now belongs to
- @odama626 is now a co-maintainer of Flatbread & a member of the core team 🙌
- We're working on an official Flatbread docs & marketing site to help others get this bread
- Add badges & Slack link to docs #23
- Dear prospective contributors, we'd love to have ya on the project - join the Slack to get started!
Features
-
Bounded GraphQL server cache #22
-
Recursive directory scan for source-filesystem #25
- Glob matches are supported for content paths to import from nested directories.
{ path: 'content/markdown/posts/**/*.md', collection: 'PostCategoryBlob', refs: { authors: 'Author', }, },
- Named globs will derive meaningful data from a directory name it matches. These are made available as a field on that collection within the GraphQL API:
{ path: 'content/markdown/posts/[category]/[slug].md', collection: 'PostCategory', refs: { authors: 'Author', }, },
- Glob matches are supported for content paths to import from nested directories.
-
Allow field overrides #29
-
Allow multiple transformers #30
- You can now provide an array of transformers to match collections with mixed file types
export default defineConfig({ transformer: [transformerMarkdown(transformerConfig), transformerYaml()], ... }
- You can now provide an array of transformers to match collections with mixed file types
-
Allow serverside function flatbread #31
- Exposes a direct way to resolve GraphQL queries passed to a query function baked with Flatbread schema.
import { FlatbreadProvider } from "@flatbread/core"; // Run Flatbread as a function to execute a subquery const flatbread = new FlatbreadProvider({ // a Flatbread config object here... }); const gqlQuery = ` query Foo { allPosts { id title } } `; const { data } = await flatbread.query({ source: gqlQuery, });
- Exposes a direct way to resolve GraphQL queries passed to a query function baked with Flatbread schema.
-
Introduce concept of custom
resolverplugins:@flatbread/resolver-svimg#32- Optimizes images in your data to next-gen formats using src-sets and placeholders
import { createSvImgField } from '@flatbread/resolver-svimg'; export default defineConfig({ ... content: [ { path: 'content/markdown/authors', collection: 'Author', refs: { friend: 'Author', }, overrides: [ createSvImgField('image', { inputDir: 'static/authorImages', outputDir: 'static/g', srcGenerator: (path) => '/g/' + path, }), ], }, ], });
-
Support alternative config file extensions #51
- You should now be able to run Flatbread in any framework and environment, regardless of scope (CJS/ESM).
- Supports the following config flavors:
flatbread.config.jsflatbread.config.mjsflatbread.config.cjsflatbread.config.tsflatbread.config.mtsflatbread.config.cts
Fixes
- Relational/post-resolved filtering via GraphQL subquery #35
- Set up RenovateBot & pin dependencies #44 #46
- Build Flatbread on Windows #85
- Run CI on external PRs #68
⚠️ Breaking changes!
import { filesystem } from ‘flatbread’is nowimport { sourceFilesystem } from ‘flatbread’import { markdownTransformer } from ‘flatbread’is nowimport { transformerMarkdown } from ‘flatbread’