@jorvel/types
Zero-runtime-ish shared types + a small set of pure helpers. The canonical source of RouteTarget, the federation contract DSL, workspace/app config shapes, and the JSON Schemas the CLI validates against.
Federation contracts
ts
import { defineFederationContract, type InferExposed, type InferEmits } from '@jorvel/types';
export const contract = defineFederationContract({
name: 'dashboard',
exposes: { './App': null as unknown as import('./App').default },
events: { emits: ['dashboard:action'] as const, listens: ['shell:ready'] as const },
});
type App = InferExposed<typeof contract, './App'>; // the module's default-export type
type Emitted = InferEmits<typeof contract>; // 'dashboard:action'
type Heard = InferListens<typeof contract>; // 'shell:ready'
// runtime validation (awaits container.get per exposed key)
validateFederationContract(contract, container): Promise<ContractViolation[]>;
validateFederationContractKeys(contract, container): ContractViolation[];Config types
ts
type JorvelWorkspaceConfig = { // jorvel.config.json
name: string; appsDir?: string; libsDir?: string;
features?: { tailwind?: boolean; reactCompiler?: boolean; template?: string };
orchestrator?: { mode?: 'parallel' | 'on-demand'; proxyRemotes?: boolean; hmrRemotes?: boolean };
federation?: { shared?: string[]; sri?: { algo?: string }; publicPath?: string; versionCheck?: boolean };
security?: { csp?: { enabled?: boolean; reportUri?: string } };
deploy?: { target?: string };
plugins?: unknown[];
};
type JorvelAppConfig = { name: string; type: 'host' | 'remote'; port: number; /* … */ };
type RouteTarget = { path: string; remote: string; module?: string }; // matches @jorvel/runtimeRedirects & rewrites
ts
import { matchRedirect, matchRewrite } from '@jorvel/types';
matchRedirect([{ source: '/old/:slug', destination: '/new/:slug', permanent: true }], '/old/x');
// → { destination: '/new/x', status: 308 }
matchRewrite([{ source: '/api/*', destination: '/proxy/*' }], '/api/users'); // → '/proxy/users'Contract-test helpers
ts
// @jorvel/types/testing
contractChecks(contract, loadContainer): ContractCheck[]; // ready-to-run test cases
assertContract(contract, container): Promise<void>; // throws on violation
generateContractTestSource(opts): string; // scaffold a spec fileJSON Schemas
Draft 2020-12 schemas for jorvel.config / jorvel.app / jorvel.federation, exposed as package subpaths so editors autocomplete:
json
{ "$schema": "./node_modules/@jorvel/types/schemas/jorvel.config.json" }jorvel schema re-emits them; jorvel config validate checks a workspace against the bundled schema.
