Type-safe middleware pipeline builder with parallel execution and React provider wrapping.
- 🪧 About
- 📦 Installation
- 🚀 Usage
- 📖 API
- 🤗 Contributing
- 📝 License
Framework-agnostic middleware pipeline engine. Provides the core execution model for composing middlewares sequentially or in parallel, accumulating a typed context, and wrapping React providers. Used as the foundation for framework-specific builders (page, layout, route, action).
pnpm add @arckit/pipelineimport { render, withFetch, withMap } from '@arckit/pipeline';
const middlewares = [
withFetch('users', async () => fetchUsers()),
withMap('count', ({ users }) => users.length)
];
const page = render(middlewares)(async ({ users, count }, props) => (
<UserList users={users} count={count} />
));import { withFetch, withMap } from '@arckit/pipeline';
// withFetch: async data fetching into context
const loadUsers = withFetch('users', async () => fetchUsers());
// withMap: synchronous value derivation
const countUsers = withMap('count', ({ users }) => users.length);| Export | Description |
|---|---|
render(middlewares) |
Creates an execution function from a middleware array. Handles sequential/parallel execution and provider wrapping. |
applyProviders(providers, content) |
Wraps React content with provider components. |
withFetch(key, fetcher) |
Middleware: fetches async data into context. |
withMap(key, mapper) |
Middleware: derives a synchronous value into context. |
Provider |
Type for React provider configuration (component + props). |
Merge<A, B> |
Utility type for merging context types. |
See CONTRIBUTING.md for details.
MIT © Marc Gavanier