loadline
A JS/TS validator whose schemas are data: checked with no eval, or compiled ahead of time from a contract. Zero dependencies. A zod migration path.
loadline is a JS/TS validator whose schemas are plain data. You write them in TypeScript and the
static type is inferred from the schema; check validates with no eval
and no new Function, so it runs under a strict Content-Security-Policy; and loadline/jit and
loadline/emit compile the same schema to a function or to source ahead of time when speed matters
more. Every issue is a JSON Pointer path and a message that ends in fix:, so an agent reads the
same record a person does.
Where you write zod schemas today, the builders keep zod's names. It implements Standard Schema and
Standard JSON Schema, so it plugs in wherever a library accepts a zod schema through those interfaces, and it reads and writes JSON Schema. contractdiff's
validator target generates loadline schemas from an OpenAPI or AsyncAPI contract.
Install
npm install loadline
pnpm add loadline
yarn add loadline
bun add loadlineIt has zero dependencies.
Quick start
npm install loadlineimport { check, number, object, optional, parse, string } from "loadline";
const User = object({ name: string(), age: number(), email: optional(string()) });
console.log(check(User, { name: "Ada", age: 36 }));
const result = parse(User, { name: "Ada", age: "36" });
console.log(result.ok ? result.value : result.issues);true
[
{
path: '/age',
keyword: 'type',
message: 'expected a number, got string "36". fix: send a finite number'
}
]check narrows a value to the schema's type; parse returns the value or every issue at once.
What it does
- Builders that infer the type.
object,string,number,array,union,discriminated,optionaland the rest;Infer<typeof User>is the static type. - Checks with no eval.
check,parseandassertwalk the schema as data, so they run where a Content-Security-Policy forbidsnew Function. - Compiled when it pays.
loadline/jitbuilds a function at run time andloadline/emitwrites its source ahead of time, from the same schema. - JSON Schema both ways.
loadline/json-schemawrites a schema out and reads one in, andloadline/standardgives every schema the Standard Schema interface.
Migrating
loadline has no command, so there is no npx loadline to run: the switch is the import.
The builders keep zod's names where zod has one, so most schemas move by their import:
- import { z } from "zod";
- const User = z.object({ name: z.string(), age: z.number(), email: z.string().optional() });
- const user = User.parse(input);
+ import { assert, number, object, optional, string } from "loadline";
+ const User = object({ name: string(), age: number(), email: optional(string()) });
+ assert(User, input); // throws on an issue, and narrows `input` to the schema's typeA library that takes a Standard Schema takes a loadline schema as it is.
Compatibility
Not graded: no incumbent's own suite runs against loadline through compat-oracle. Its features are
read beside zod's and ajv's in benchmarks/validator.
Benchmarks
Every number here is produced by npm run bench and published at burgee.interlace.tools/docs/benchmarks.
No suite is graded against this package yet, so there is no compatibility number to quote.
For agents
- Every issue is data: a JSON Pointer
path, thekeywordthat failed and a message that ends infix:, the same record an agent reads and a person reads. - Schemas are JSON:
loadline/json-schemawrites a schema out as JSON Schema and reads one back, so an agent can hand a schema across a tool boundary. - The docs are machine-readable at burgee.interlace.tools/llms.txt.
API
| Import | What it gives you |
|---|---|
loadline | the builders (object, string, number, array, union, …), check, parse, assert |
loadline/jit | compile(): the schema as a function, for a hot path where eval is allowed |
loadline/emit | emit(): the schema as source, written ahead of time |
loadline/formats | string formats: email, uuid, url, datetime and the rest |
loadline/json-schema | toJsonSchema() and fromJsonSchema() |
loadline/standard | standard(): the Standard Schema and Standard JSON Schema interfaces |
Requirements
Node 22.13 or later.
Where it sits
It hosts no plugin key of its own.
contractdiff builds on it, and it builds on nothing in this family.
The family
14 packages, one repository, one release pipeline. Each installs and works on its own, and each owns
one job. Seven of them — bellpull, closeout, linegauge, loadline, paratext, roundel,
seniority — depend on nothing; the others depend only on packages in this table, and every
dependency points one way, down the layers.
No package declares a dependency from outside the family; react and react-reconciler are
optional peers of controlroom, which npm does not install; vitest is an optional peer of
oxmutate, which npm does not install; eslint is an optional peer of truemark, which npm does
not install.
package-shape-lock
holds that for every manifest, and
independence-install-lock
installs each package alone and finds nothing but the family packages it declares.
Releases are published by one workflow through npm trusted publishing: no npm token is used, and
each release carries SLSA provenance, which npm view <package> dist.attestations shows.
trusted-publishing-lock
keeps both true.
| Package | What it is | Migrates from |
|---|---|---|
| burgee | The CLI framework: one declaration, every surface | commander, yargs and meow |
| roundel | Colour: one output policy, semantic tokens, a theme | chalk, colorette, kleur, picocolors, supports-color and yoctocolors |
| flagstaff | The frame loop: spinners, progress, boxes and tables | ora, log-update, boxen and cli-table3 |
| caique | Prompts that are flags first, and never hang | @inquirer/core |
| linegauge | Measuring, wrapping, truncating and slicing styled text | string-width, wrap-ansi, strip-ansi, slice-ansi, cli-truncate and widest-line |
| paratext | Hyperlinks, images, title, clipboard and notifications | ansi-escapes, terminal-link and term-img |
| seniority | Configuration precedence and discovery, with provenance | cosmiconfig, lilconfig, dotenv and rc |
| closeout | Exit handlers, terminal restore and a bounded shutdown | signal-exit, exit-hook, restore-cursor, cli-cursor and onetime |
| bellpull | Subprocesses, and which executable actually ran | cross-spawn and which |
| controlroom | Keyboard-driven terminal screens, inline or full-screen | ink |
| oxmutate | Mutation testing on the oxc engine, inside your own Vitest | Stryker |
| truemark | Lint rules and a pre-push check that keep a test suite honest | @vitest/eslint-plugin |
| contractdiff | API contracts: breaking-change diff, lint, and code from the spec | openapi-typescript |
| loadline (this package) | Validation whose schemas are data, with no eval | zod |
Every migration guide, and the family-wide compatibility and benchmarks pages, are on burgee.interlace.tools.
Contributing
Issues and pull requests are welcome at ofri-peretz/burgee; read CONTRIBUTING.md first. Report a vulnerability privately, as SECURITY.md describes — never in a public issue.
Licence
MIT © Ofri Peretz — see LICENSE.
contractdiff
Breaking-change diff, lint and code generation for API contracts (OpenAPI, JSON Schema, AsyncAPI, MCP), and the spec back from the code. No dependency outside the burgee family. An openapi-typescript migration path.
truemark
Test integrity for JS and TS: lint rules for focused, skipped, sleeping and retried tests, and a pre-push check for weakened assertions and unexplained snapshots. No dependency outside the burgee family. A @vitest/eslint-plugin migration path.