Package exports

Every manicjs entry point and how it maps to subpath imports.

Package exports

The manicjs package exposes multiple subpath exports (package.json "exports"). Prefer importing from the smallest surface you need (manicjs/router, manicjs/config, …). The root entry (manicjs) bundles the pieces most apps use in one place.


Entry points

Import pathRoleDetailed docs
manicjsRouter + UI shells + theme + transitions + typed config surface + RPC clientThis page + Router, Theme, Transitions, Errors, Client
manicjs/routerFull router surface including extras not on the root barrelRouter, preloadRoute
manicjs/configConfig authoring, plugin helper, cached config (getConfig)Config, Plugins
manicjs/serverProduction/dev Bun server (createManicServer)Server
manicjs/themeTheme context + toggle (+ initTheme)Theme
manicjs/transitionsViewTransitions.* elements + navigate / setViewTransitions re-exportsTransitions
manicjs/envgetEnv, getPublicEnvEnvironment
manicjs/clientAlias of config client — RPC helper onlyClient, RPC
manicjs/pluginsLow-level loaders (apiLoaderPlugin, fileImporterPlugin)Plugin loaders

The manic CLI is shipped as the package binary (package.json "bin"); it is not a runtime import.


manicjs (root)

These symbols are re-exported from packages/manic/index.ts — convenient for app code (main.tsx, route modules).

ExportNotes
Router, Link, navigate, useRouter, useQueryParamsClient SPA routing (Router)
NotFound, ErrorOverlay, ServerErrorDefault error UI (Errors)
defineConfig, loadConfigSame implementations as manicjs/config; types ManicConfig, ManicPlugin, contexts, PageRoute, ApiRoute (Config)
ThemeProvider, useTheme, ThemeToggle(Theme)
ViewTransitions, setViewTransitions(Transitions)
createClientHono RPC client — identical to manicjs/client (RPC)

Not re-exported from the root (import from manicjs/router or manicjs/config instead):

  • preloadRoute, RouterContext, setViewTransitions (also on manicjs/router), type-only RouteDef, RouterContextValue
  • createPlugin, getConfig, ManicProvider, BuildContext, SitemapConfig, and the rest of the config module API

manicjs/router

ExportNotes
Router, Link, navigate, useRouter, useQueryParamsSame as root
preloadRouteManual route chunk preload (preloadRoute)
setViewTransitionsSame as manicjs / manicjs/transitions
RouterContextReact context backing useRouter
RouteDef, RouterContextValueTypes

manicjs/config

ExportNotes
defineConfig, loadConfig, getConfigConfig load + cache (Config)
createPluginPlugin authoring with staticFiles shorthand (Plugins)
ManicConfig, ManicPlugin, ManicPluginContext, ManicServerPluginContext, ManicBuildPluginContextTypes
ManicProvider, BuildContextDeployment provider authoring
PageRoute, ApiRoute, SitemapConfigDiscovery / plugin types

manicjs/server

ExportNotes
createManicServerBun Bun.serve wrapper used from ~manic.ts (Server)

manicjs/theme

ExportNotes
ThemeProvider, useTheme, ThemeToggleRuntime theme UI
initThemeEarly boot helper (apply persisted/system theme before paint)

manicjs/transitions

ExportNotes
ViewTransitionsElement factory (ViewTransitions.div, …)
navigate, setViewTransitionsRe-exported from the router implementation

manicjs/env

ExportNotes
getEnv, getPublicEnvBuild-time public vars + server secrets (Environment)

manicjs/client

ExportNotes
createClientSame as root — points at src/config/client.ts (RPC)

manicjs/plugins

See Plugin loaders: apiLoaderPlugin, fileImporterPlugin.


Choosing an import style

// Typical app components — shortest path
import { Link, useRouter, ViewTransitions } from 'manicjs';

// When you need preloadRoute or RouterContext
import { preloadRoute, RouterContext } from 'manicjs/router';

// manic.config.ts — always config entry
import { defineConfig, createPlugin } from 'manicjs/config';

If something is exported from manicjs and a subpath, either import works; bundlers dedupe to one module instance.

On this page