@lunacrest/form
v0.1.0
Published
TypeScript library starter with Rollup bundles (ESM/CJS/UMD).
Downloads
13
Readme
TypeScript Library Starter
Rollup-based TypeScript library starter producing ESM, CJS, and UMD bundles. Uses pnpm, ESLint, Prettier, and Vitest.
Scripts
pnpm build– clean and bundle outputs todist/(ESM/CJS/UMD +.d.ts).pnpm dev– watch and rebuild on changes.pnpm lint– run ESLint on source and tests.pnpm test– run unit tests with Vitest.pnpm typecheck– TypeScript type checking without emit.pnpm format– format with Prettier.
Entry Points
- ESM:
dist/index.mjs - CJS:
dist/index.cjs - UMD:
dist/index.umd.js(global nameTsLib) - Types:
dist/index.d.ts
Usage
Signal-backed forms with @preact/signals-core:
This is a TypeScript form library powered by @preact/signals-core with a deterministic dependency graph and Rollup bundling (ESM/CJS/UMD). A Preact example app demonstrates usage.
Engine Determinism & Phase Ledger
- Overview: see DETERMINISM.md
- Phase status & locked semantics: see PHASE_LEDGER.md
- Public API stability and exports: see PUBLIC_API.md
const age = new Field('age', 0, [(value) => (value > 0 ? null : 'Must be positive')]);
const form = new Form({ name, age });
const result = await form.submit(async (values) => {
// handle validated values
console.log(values.name, values.age);
});
if (!result.ok) {
console.log(form.errors.value);
}Utility exports remain available:
import { greet, sum } from 'ts-lib';
greet('Ada');
sum([1, 2, 3]);Development Notes
- Node >= 18.17
- Package manager: pnpm (see
packageManagerfield) - Source lives in
src/, tests intest/.
