@soda-gql/runtime
v0.10.2
Published
Minimal runtime for soda-gql operations
Maintainers
Readme
@soda-gql/runtime
Runtime utilities for soda-gql zero-runtime GraphQL operations.
Installation
bun add @soda-gql/runtimeOverview
This package provides the minimal runtime needed to execute soda-gql GraphQL operations. It includes:
- Operation registry for storing compiled GraphQL documents
- Runtime utilities for operation retrieval
- Minimal footprint for production builds
Usage
With Build-Time Transformation
When using soda-gql with a build plugin (Babel, TypeScript, Vite, etc.), the runtime is automatically integrated:
// Your source code
import { gql } from "@/graphql-system";
export const userQuery = gql.default(({ query, $var }) =>
query.operation({
name: "GetUser",
variables: { ...$var("id").ID("!") },
fields: ({ f, $ }) => ({ ...f.user({ id: $.id })(({ f }) => ({ ...f.id(), ...f.name() })) }),
}),
);
// After transformation (automatically handled by build plugin)
import { gqlRuntime } from "@soda-gql/runtime";
export const userQuery = gqlRuntime.getOperation("canonicalId");API Reference
gqlRuntime
The main runtime object for operation management:
import { gqlRuntime } from "@soda-gql/runtime";
// Get an operation by canonical ID
const operation = gqlRuntime.getOperation("path/to/file.ts::userQuery");Zero-Runtime Philosophy
This package is designed to have minimal impact on bundle size:
- Operations are registered at build time
- No heavy dependencies
- Tree-shakeable exports
Related Packages
- @soda-gql/core - Core types and utilities
- @soda-gql/babel-plugin - Babel transformation plugin
- @soda-gql/tsc-plugin - TypeScript transformation plugin
License
MIT
