@owlmeans/client-route
v0.1.11
Published
Client-side route model extension — marks routes as client-side and provides URL parameter utilities.
Readme
@owlmeans/client-route
Client-side route model extension — marks routes as client-side and provides URL parameter utilities.
Overview
route(routeModel, opts?)— wraps aCommonRouteModelinto aClientRouteModel(marks_client: true)isClientRouteModel(route)— type guard distinguishing client routes from server routesextractParams(path)— extracts path parameter names (:paramsegments) from a URL pattern- Used internally by
@owlmeans/client-modulewhen building client-side module URLs
Installation
bun add @owlmeans/client-routeUsage
import { route, isClientRouteModel, extractParams } from '@owlmeans/client-route'
import type { ClientRouteModel } from '@owlmeans/client-route'
// Wrap a route as a client route
const clientRoute = route(someRouteModel, { overrides: { partialPath: '/items' } })
// Type guard
if (isClientRouteModel(arg)) {
// arg is ClientRouteModel
}
// Extract named params from a path pattern
const params = extractParams('/projects/:projectId/items/:itemId')
// => ['projectId', 'itemId']API
route(route, opts?): ClientRouteModel
Converts a CommonRouteModel to a ClientRouteModel. Options: overrides?: Partial<ClientRoute>.
isClientRouteModel(route): route is ClientRouteModel
Returns true if the route was created with route().
extractParams(path): string[]
Returns the list of :param segment names in a URL pattern string.
ClientRouteModel
Extends CommonRouteModel with _client: true flag and partialPath for relative URL segments.
Related Packages
@owlmeans/route—CommonRouteModel,CommonRoutebase types@owlmeans/client-module— usesroute()andisClientRouteModel()when constructing modules
Agent guidance
This package ships embedded Claude Code skills and GitHub Copilot instructions under
agent-meta/. After installing your @owlmeans/* packages, run the OwlMeans
agent-skills installer to place them into your project's native locations
(.claude/skills/ and .github/instructions/):
npx @owlmeans/agent-skillsThe embedded files are version-matched to this package release. Do not edit them directly — they are regenerated on each publish. To contribute guidance edits, open a PR against the source monorepo.
