burgee
Packages

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 loadline

It has zero dependencies.

Quick start

npm install loadline
import { 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, optional and the rest; Infer<typeof User> is the static type.
  • Checks with no eval. check, parse and assert walk the schema as data, so they run where a Content-Security-Policy forbids new Function.
  • Compiled when it pays. loadline/jit builds a function at run time and loadline/emit writes its source ahead of time, from the same schema.
  • JSON Schema both ways. loadline/json-schema writes a schema out and reads one in, and loadline/standard gives 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 type

A 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, the keyword that failed and a message that ends in fix:, the same record an agent reads and a person reads.
  • Schemas are JSON: loadline/json-schema writes 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

ImportWhat it gives you
loadlinethe builders (object, string, number, array, union, …), check, parse, assert
loadline/jitcompile(): the schema as a function, for a hot path where eval is allowed
loadline/emitemit(): the schema as source, written ahead of time
loadline/formatsstring formats: email, uuid, url, datetime and the rest
loadline/json-schematoJsonSchema() and fromJsonSchema()
loadline/standardstandard(): 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.

PackageWhat it isMigrates from
burgeeThe CLI framework: one declaration, every surfacecommander, yargs and meow
roundelColour: one output policy, semantic tokens, a themechalk, colorette, kleur, picocolors, supports-color and yoctocolors
flagstaffThe frame loop: spinners, progress, boxes and tablesora, log-update, boxen and cli-table3
caiquePrompts that are flags first, and never hang@inquirer/core
linegaugeMeasuring, wrapping, truncating and slicing styled textstring-width, wrap-ansi, strip-ansi, slice-ansi, cli-truncate and widest-line
paratextHyperlinks, images, title, clipboard and notificationsansi-escapes, terminal-link and term-img
seniorityConfiguration precedence and discovery, with provenancecosmiconfig, lilconfig, dotenv and rc
closeoutExit handlers, terminal restore and a bounded shutdownsignal-exit, exit-hook, restore-cursor, cli-cursor and onetime
bellpullSubprocesses, and which executable actually rancross-spawn and which
controlroomKeyboard-driven terminal screens, inline or full-screenink
oxmutateMutation testing on the oxc engine, inside your own VitestStryker
truemarkLint rules and a pre-push check that keep a test suite honest@vitest/eslint-plugin
contractdiffAPI contracts: breaking-change diff, lint, and code from the specopenapi-typescript
loadline (this package)Validation whose schemas are data, with no evalzod

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.

On this page