@zonekit/core
v0.2.0
Published
Convenience re-export of schema, validator, and runtime for Zonekit
Downloads
73
Maintainers
Readme
@zonekit/core
Single entry point for the most common non-React Zonekit APIs.
@zonekit/core re-exports the most common config, runtime, validator, and schema entry points from Zonekit. Use it when you want one dependency for evaluation, Node services, tests, or a non-React shell.
This package does not include the React provider or hooks. If you are building a React shell, install @zonekit/runtime-react alongside it or import directly from the package-specific entry points.
Installation
pnpm add @zonekit/coreQuick start
import {
createConfigResolver,
createManifestFetcher,
validateConfigResponse,
type ResolvedConfig,
} from "@zonekit/core";
const fetcher = createManifestFetcher({
primaryBaseUrl: "https://cdn.example.com/manifests",
buildPath: (dimensions) => `${dimensions[0]?.value ?? "default"}.json`,
});
const resolver = createConfigResolver({
fetcher,
dimensions: [{ name: "region", value: "us" }],
});
const resolvedConfig: ResolvedConfig = await resolver.resolve();
validateConfigResponse(resolvedConfig);
console.log(resolvedConfig.routes);
console.log(resolvedConfig.flags);If you also need routing primitives, createRouter and loadRemoteModule are re-exported here as well. For React bindings, use @zonekit/runtime-react.
Exact exports
Functions
| Function | Source |
|---|---|
| createConfigResolver | @zonekit/config |
| createManifestFetcher | @zonekit/config |
| createPreviewResolver | @zonekit/config |
| createRouter | @zonekit/runtime |
| loadRemoteModule | @zonekit/runtime |
| validateAll | @zonekit/validator |
| validateConfigResponse | @zonekit/validator |
Types
@zonekit/core currently re-exports these schema and config types:
ConfigResolver, ConfigResolverOptions, FlagProvider, GuardCondition, ManifestConfig, ManifestFetcher, NavigationItem, RemoteEntry, ResolutionDimension, ResolvedConfig, ResolvedRoute, ResolvedRouteTree, RouteConfig, RoutingConfig, Transition, ValidationResult, ZoneConfig, ZonekitConfig, and ZonekitLogger.
If you need additional schema types beyond that list, import them directly from @zonekit/schema.
Common combinations
@zonekit/corealone for evaluation, tests, Node services, or a vanilla host.@zonekit/coreplus@zonekit/runtime-reactfor React shells that still want one import for config and runtime primitives.- Direct package imports when you want the smallest public surface or tighter bundle control.
When to use individual packages instead
- Types only: use
@zonekit/schema. - React bindings: use
@zonekit/runtime-react. - Server-side resolution and preview APIs: use
@zonekit/config-server. - Build and publish workflows: use
@zonekit/config-publisherand@zonekit/cli. - Bundler integration for Module Federation: use
@zonekit/federation-preset.
License
MIT
Read more:
