@vyriy/static
Static file serving helper and CLI for Vyriy projects.
Purpose
Use this package when a Vyriy project needs a small focused module for static behavior.
Vyriy packages are intentionally small. The goal is to keep the public API explicit, easy to test, and easy to compose with the rest of the Vyriy ecosystem.
Install
With npm:
npm install @vyriy/static
With Yarn:
yarn add @vyriy/static
Usage
import { serveStatic } from '@vyriy/static';
export const handler = serveStatic({
root: 'dist',
spa: true,
fallback: 'index.html',
cache: 'static',
});
vyriy-static ./dist --spa --fallback index.html --cache static
Public API
The package is expected to expose the following main surface:
staticHandlerserveStaticstaticServerspaFallbackcacheHeaders
Parameters and options
root— Directory with static files.spa— When true, unknown routes fall back to the fallback file.fallback— Fallback file for SPA mode. Usually index.html.cache— Cache strategy for immutable/static/html files.prefix— Optional URL prefix for mounted static files.
Examples
Minimal usage
import * as module from '@vyriy/static';
console.info(module);
Use inside a Vyriy package
// packages/example/index.ts
export { default as example } from '@vyriy/static';
Keep the boundary explicit
// Prefer importing from the package root unless a documented subpath is required.
import {} from /* named export */ '@vyriy/static';
Notes
- Keep configuration close to the package that owns it.
- Prefer explicit options over hidden global state.
- Keep examples small enough to copy into tests or Storybook docs.
- When adding a new public export, document it in this README and add a focused test.
Related packages
@vyriy/configfor environment-driven options.@vyriy/scriptfor readable operational flows.@vyriy/handlerand@vyriy/serverwhen the package participates in runtime handling.